arcadia 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. data/README +132 -134
  2. data/bin/arcadia +13 -0
  3. data/conf/arcadia.conf +196 -3
  4. data/conf/arcadia.init.rb +27 -6
  5. data/conf/arcadia.res.rb +10 -0
  6. data/ext/ae-complete-code/ae-complete-code.rb +76 -82
  7. data/ext/ae-doc-code/ae-doc-code.rb +295 -291
  8. data/ext/ae-editor/ae-editor.conf +88 -67
  9. data/ext/ae-editor/ae-editor.rb +400 -202
  10. data/ext/ae-editor/langs/conf.lang +16 -5
  11. data/ext/ae-editor/langs/lang.lang.bind +1 -1
  12. data/ext/ae-editor/langs/rb.lang +77 -41
  13. data/ext/ae-editor/langs/rbw.lang.bind +1 -1
  14. data/ext/ae-event-log/ae-event-log.rb +46 -45
  15. data/ext/ae-file-history/ae-file-history.conf +1 -1
  16. data/ext/ae-file-history/ae-file-history.rb +373 -298
  17. data/ext/ae-output/ae-output.conf +2 -0
  18. data/ext/ae-output/ae-output.rb +200 -202
  19. data/ext/ae-rad/ae-rad-inspector.rb +64 -70
  20. data/ext/ae-rad/ae-rad-palette.rb +14 -14
  21. data/ext/ae-rad/ae-rad.conf +2 -0
  22. data/ext/ae-rad/lib/tk/al-tk.rb +2991 -2987
  23. data/ext/ae-rad/lib/tk/al-tkarcadia.rb +26 -26
  24. data/ext/ae-ruby-debug/ae-ruby-debug.conf +8 -8
  25. data/ext/ae-ruby-debug/ae-ruby-debug.rb +1566 -1465
  26. data/ext/ae-search-in-files/ae-search-in-files.rb +294 -284
  27. data/ext/ae-shell/ae-shell.rb +20 -11
  28. data/{base → lib}/a-commons.rb +291 -80
  29. data/{base → lib}/a-contracts.rb +40 -18
  30. data/{arcadia.rb → lib/a-core.rb} +238 -148
  31. data/{base → lib}/a-tkcommons.rb +81 -63
  32. metadata +64 -65
  33. data/ext/ae-action-dispatcher/ae-action-dispatcher.conf +0 -6
  34. data/ext/ae-action-dispatcher/ae-action-dispatcher.rb +0 -22
  35. data/ext/ae-inspector/ae-inspector.conf +0 -7
  36. data/ext/ae-inspector/ae-inspector.rb +0 -1519
  37. data/ext/ae-palette/ae-palette.conf +0 -7
  38. data/ext/ae-palette/ae-palette.rb +0 -265
@@ -130,14 +130,14 @@ end
130
130
  # +---------------------------------------------+
131
131
 
132
132
  class MsgEvent < ArcadiaEvent
133
- attr_accessor :msg
133
+ attr_accessor :msg, :level
134
134
  end
135
135
 
136
- class DebugMsgEvent < MsgEvent
137
- end
138
-
139
- class ErrorMsgEvent < MsgEvent
140
- end
136
+ #class DebugMsgEvent < MsgEvent
137
+ #end
138
+ #
139
+ #class ErrorMsgEvent < MsgEvent
140
+ #end
141
141
 
142
142
  # +---------------------------------------------+
143
143
  # Other event
@@ -164,6 +164,28 @@ class RunRubyFileEvent < ArcadiaEvent
164
164
  attr_accessor :file
165
165
  end
166
166
 
167
+ class InputEvent < ArcadiaEvent
168
+ end
169
+
170
+ class InputEnterEvent < InputEvent
171
+ attr_accessor :receiver
172
+ end
173
+
174
+ class InputExitEvent < InputEvent
175
+ attr_accessor :receiver
176
+ end
177
+
178
+
179
+ #class VirtualKeyboardEvent < ArcadiaEvent
180
+ #end
181
+ #class VirtualKeyboardOnEvent < VirtualKeyboardEvent
182
+ # attr_accessor :receiver
183
+ #end
184
+ #
185
+ #class VirtualKeyboardOffEvent < VirtualKeyboardEvent
186
+ #end
187
+
188
+
167
189
  # +---------------------------------------------+
168
190
  # Dialog event (raised only by Arcadia)
169
191
  # to raise use:
@@ -179,20 +201,20 @@ class DialogEvent < ArcadiaEvent
179
201
  class Result < Result
180
202
  attr_accessor :value
181
203
  end
182
- attr_accessor :title, :msg, :type
183
- end
184
-
185
- class QuestionDialogEvent < DialogEvent
186
- end
187
-
188
- class InfoDialogEvent < DialogEvent
204
+ attr_accessor :title, :msg, :type, :level
189
205
  end
190
206
 
191
- class WarningDialogEvent < DialogEvent
192
- end
193
-
194
- class ErrorDialogEvent < DialogEvent
195
- end
207
+ #class QuestionDialogEvent < DialogEvent
208
+ #end
209
+ #
210
+ #class InfoDialogEvent < DialogEvent
211
+ #end
212
+ #
213
+ #class WarningDialogEvent < DialogEvent
214
+ #end
215
+ #
216
+ #class ErrorDialogEvent < DialogEvent
217
+ #end
196
218
 
197
219
 
198
220
  # +---------------------------------------------+
@@ -1,67 +1,68 @@
1
1
  #
2
- # arcadia.rb - Arcadia Ruby ide
2
+ # a-core.rb - Arcadia Ruby ide
3
3
  # by Antonio Galeone <antonio-galeone@rubyforge.org>
4
4
  #
5
5
 
6
- Dir.chdir(File.dirname(__FILE__))
7
- if FileTest.exist?('conf/arcadia.init.rb')
8
- require 'conf/arcadia.init'
9
- end
10
6
  require "conf/arcadia.res"
11
7
  require 'tkextlib/bwidget'
12
- require "base/a-tkcommons"
13
- require "base/a-contracts"
8
+ require "lib/a-tkcommons"
9
+ require "lib/a-contracts"
14
10
  require "observer"
15
11
 
16
12
  class Arcadia < TkApplication
17
13
  include Observable
18
14
  attr_reader :layout
19
15
  attr_reader :main_menu
20
- #attr_reader :libs
21
- #attr_reader :root
22
16
  def initialize
23
17
  super(
24
18
  ApplicationParams.new(
25
19
  'arcadia',
26
- '0.2.0',
20
+ '0.3.0',
27
21
  'conf/arcadia.conf',
28
22
  'conf/arcadia.pers'
29
23
  )
30
24
  )
25
+ load_config
31
26
  ArcadiaDialogManager.new(self)
32
- self.load_local_config(false)
27
+ ActionDispatcher.new(self)
28
+ #self.load_local_config(false)
33
29
  ObjectSpace.define_finalizer($arcadia, self.class.method(:finalize).to_proc)
34
30
  publish('action.on_exit', proc{do_exit})
35
31
  _title = "Arcadia Ruby ide :: [Platform = "+RUBY_PLATFORM+'] [Ruby version = ' + RUBY_VERSION+']'
36
- @root = TkRoot.new{
32
+ @root = TkRoot.new(
33
+ 'background'=> self['conf']['background']
34
+ ){
37
35
  title _title
38
36
  withdraw
39
37
  protocol( "WM_DELETE_WINDOW", $arcadia['action.on_exit'])
40
38
  }
41
39
  @on_event = Hash.new
42
- @main_menu_bar = TkMenubar.new.pack('fill'=>'x')
43
- @mf_root = Tk::BWidget::MainFrame.new(@root){
40
+
41
+ @main_menu_bar = TkMenubar.new('background'=> self['conf']['background']).pack('fill'=>'x')
42
+ @mf_root = Tk::BWidget::MainFrame.new(@root,
43
+ 'background'=> self['conf']['background']
44
+ ){
44
45
  menu @main_menu_bar
45
46
  }.pack(
46
47
  'anchor'=> 'center',
47
48
  'fill'=> 'both',
48
49
  'expand'=> 1
49
50
  )
50
-
51
51
  #.place('x'=>0,'y'=>0,'relwidth'=>1,'relheight'=>1)
52
52
  @mf_root.show_statusbar('none')
53
53
  #@toolbar = @mf_root.add_toolbar
54
54
  @main_toolbar = ArcadiaMainToolbar.new(self, @mf_root.add_toolbar)
55
55
  @is_toolbar_show=self['conf']['user_toolbar_show']=='yes'
56
56
  @mf_root.show_toolbar(0,@is_toolbar_show)
57
- @splash = ArcadiaAboutSplash.new('... initialize')
58
- @splash.set_progress(50)
59
- @splash.deiconify
57
+ @use_splash = self['conf']['splash.show']=='yes'
58
+ @splash = ArcadiaAboutSplash.new('... initialize') if @use_splash
59
+ @splash.set_progress(50) if @splash
60
+ @splash.deiconify if @splash
60
61
  Tk.update
61
62
  #sleep(1)
62
- @splash.next_step('..prepare')
63
+ @splash.next_step('..prepare') if @splash
63
64
  prepare
64
- @splash.last_step('..load finish')
65
+ @splash.last_step('..load finish') if @splash
65
66
  geometry = (TkWinfo.screenwidth(@root)-4).to_s+'x'+
66
67
  (TkWinfo.screenheight(@root)-20).to_s+'+0+0'
67
68
  @root.deiconify
@@ -70,15 +71,18 @@ class Arcadia < TkApplication
70
71
  @root.geometry(geometry)
71
72
  Tk.update_idletasks
72
73
  #sleep(1)
73
- @splash.destroy
74
+ @splash.destroy if @splash
74
75
  if @first_run
75
76
  Arcadia.process_event(OpenBufferEvent.new(self,'file'=>'README'))
76
77
  elsif ARGV.length > 0
77
78
  ARGV.each{|_f|
79
+ if $pwd != File.dirname(__FILE__) && !File.exist?(_f)
80
+ _f = "#{$pwd}/#{_f}"
81
+ end
78
82
  Arcadia.process_event(OpenBufferEvent.new(self,'file'=>_f)) if File.exist?(_f)
79
83
  }
80
84
  end
81
- Arcadia.add_listener(self, QuitEvent)
85
+ Arcadia.attach_listener(self, QuitEvent)
82
86
  end
83
87
 
84
88
  def on_quit(_event)
@@ -137,7 +141,7 @@ class Arcadia < TkApplication
137
141
  # create extensions
138
142
  @exts.each{|extension|
139
143
  if extension && ext_active?(extension)
140
- @splash.next_step('... creating '+extension)
144
+ @splash.next_step('... creating '+extension) if @splash
141
145
  ext_create(extension)
142
146
  end
143
147
  }
@@ -191,55 +195,100 @@ class Arcadia < TkApplication
191
195
  end
192
196
  end
193
197
 
194
-
195
- def prepare
196
- super
197
- @splash.next_step('...initialize')
198
+ def init_layout
198
199
  @layout = ArcadiaLayout.new(self, @mf_root.get_frame)
199
-
200
- @layout.add_cols(0,0,225)
201
- #@layout.add_rows(0,0,180)
202
- @layout.add_rows_perc(0,1,70)
203
-
204
- # @layout.add_rows_perc(0,0,70)
205
- # @layout.add_cols(0,0,225)
206
- # @layout.add_rows(0,0,180)
207
-
208
-
200
+ suf = "layout.split"
201
+ elems = self['conf'][suf]
202
+ return if elems.nil?
203
+ groups = elems.split(',')
204
+ groups.each{|group|
205
+ if group
206
+ suf1 = suf+'.'+group
207
+ begin
208
+ property = self['conf'][suf1]
209
+ c = property.split('c')
210
+ if c && c.length == 2
211
+ pt = c[0].split('.')
212
+ perc = c[1].include?('%')
213
+ w = c[1].sub('%','')
214
+ if perc
215
+ @layout.add_cols_perc(pt[0].to_i, pt[1].to_i, w.to_i)
216
+ else
217
+ @layout.add_cols(pt[0].to_i, pt[1].to_i, w.to_i)
218
+ end
219
+ else
220
+ r = property.split('r')
221
+ if r && r.length == 2
222
+ pt = r[0].split('.')
223
+ perc = r[1].include?('%')
224
+ w = r[1].sub('%','')
225
+ if perc
226
+ @layout.add_rows_perc(pt[0].to_i, pt[1].to_i, w.to_i)
227
+ else
228
+ @layout.add_rows_perc(pt[0].to_i, pt[1].to_i, w.to_i)
229
+ end
230
+ end
231
+ end
232
+
233
+ rescue Exception
234
+ msg = "Loading layout"
235
+ if Arcadia.dialog(self, 'type'=>'ok_cancel', 'title' => '(Arcadia) Layout', 'msg'=>msg)=='cancel'
236
+ raise
237
+ exit
238
+ else
239
+ Tk.update
240
+ end
241
+ end
242
+ end
243
+ }
209
244
 
210
245
  @layout.add_headers
211
- @splash.next_step
212
- #self.load_libs
213
- @splash.next_step
214
- @splash.next_step('... load extensions')
246
+ end
247
+
248
+ def load_config
249
+ self.load_local_config(false)
250
+ # local config can contain loading conditions
215
251
  self.load_exts_conf
216
252
  self.load_local_config
217
- self.do_build
253
+ self.load_theme(self['conf']['theme'])
254
+ self.resolve_properties_link(self['conf'],self['conf'])
255
+ end
256
+
257
+ def prepare
258
+ super
259
+ @splash.next_step('...initialize') if @splash
260
+ @splash.next_step if @splash
261
+ #self.load_libs
262
+ @splash.next_step if @splash
263
+ @splash.next_step('... load extensions') if @splash
264
+ #load_config
265
+ init_layout
218
266
  publish('buffers.code.in_memory',Hash.new)
219
267
  publish('action.load_code_from_buffers', proc{TkBuffersChoise.new})
220
268
  publish('output.action.run_last', proc{$arcadia['output'].run_last})
221
269
  publish('main.action.open_file', proc{self['editor'].open_file(Tk.getOpenFile)})
222
- @splash.next_step('... load obj controller')
223
- @splash.next_step('... load editor')
270
+ @splash.next_step('... load obj controller') if @splash
271
+ @splash.next_step('... load editor') if @splash
224
272
  publish('main.action.new_file',proc{$arcadia['editor'].open_buffer()})
225
273
  publish('main.action.edit_cut',proc{$arcadia['editor'].raised.text.text_cut()})
226
274
  publish('main.action.edit_copy',proc{$arcadia['editor'].raised.text.text_copy()})
227
275
  publish('main.action.edit_paste',proc{$arcadia['editor'].raised.text.text_paste()})
228
- @splash.next_step('... load actions')
276
+ @splash.next_step('... load actions') if @splash
229
277
  publish('action.test.keys', proc{KetTest.new})
230
278
  publish('action.get.font', proc{Tk::BWidget::SelectFont::Dialog.new.create})
231
- @splash.next_step
279
+ @splash.next_step if @splash
232
280
  publish('action.show_about', proc{ArcadiaAboutSplash.new.deiconify})
233
281
  # publish('main.menu', @main_menu)
234
282
  @main_menu = ArcadiaMainMenu.new(@main_menu_bar)
283
+ self.do_build
235
284
  #publish('main.menu', ArcadiaMainMenu.new(@main_menu))
236
- @splash.next_step
285
+ @splash.next_step if @splash
237
286
  publish('objic.action.raise_active_obj',
238
287
  proc{
239
288
  InspectorContract.instance.raise_active_toplevel(self)
240
289
  }
241
290
  )
242
- @splash.next_step('... toolbar buttons ')
291
+ @splash.next_step('... toolbar buttons ') if @splash
243
292
  #@main_toolbar.load_toolbar_buttons
244
293
 
245
294
  #load user controls
@@ -248,7 +297,7 @@ class Arcadia < TkApplication
248
297
  load_user_control(@main_toolbar)
249
298
  #Extension control
250
299
  @exts.each{|ext|
251
- @splash.next_step("... load #{ext} user controls ")
300
+ @splash.next_step("... load #{ext} user controls ") if @splash
252
301
  load_user_control(@main_menu, ext)
253
302
  load_user_control(@main_toolbar, ext)
254
303
  }
@@ -270,9 +319,11 @@ class Arcadia < TkApplication
270
319
  suf = "#{_pre}.#{suf}"
271
320
  end
272
321
  contexts = self['conf']["#{suf}.contexts"]
322
+ contexts_caption = self['conf']["#{suf}.contexts.caption"]
273
323
  return if contexts.nil?
274
324
  groups = contexts.split(',')
275
- groups.each{|group|
325
+ groups_caption = contexts_caption.split(',') if contexts_caption
326
+ groups.each_with_index{|group, gi|
276
327
  if group
277
328
  suf1 = suf+'.'+group
278
329
  begin
@@ -298,7 +349,7 @@ class Arcadia < TkApplication
298
349
 
299
350
  event_args = property_to_eval.call('event_args',suf2)
300
351
  image_data = property_to_eval.call('image_data',suf2)
301
- i = _user_control.new_item(self,
352
+ item_args = {
302
353
  'name'=>name,
303
354
  'caption'=>caption,
304
355
  'hint'=>hint,
@@ -306,12 +357,16 @@ class Arcadia < TkApplication
306
357
  'event_args' =>event_args,
307
358
  'image_data' =>image_data,
308
359
  'context'=>group,
309
- 'context_path'=>context_path)
360
+ 'context_path'=>context_path
361
+ }
362
+ item_args['context_caption'] = groups_caption[gi] if groups_caption
363
+ i = _user_control.new_item(self, item_args)
310
364
  i.enable=false if disabled
365
+
311
366
  }
312
367
  rescue Exception
313
368
  msg = "Loading #{groups} ->#{items} (#{$!.class.to_s} : #{$!.to_s} at : #{$@.to_s})"
314
- if Arcadia.ok_cancel(self, 'title' => '(Arcadia) Toolbar', 'msg'=>msg)=='cancel'
369
+ if Arcadia.dialog(self, 'type'=>'ok_cancel', 'title' => '(Arcadia) Toolbar', 'msg'=>msg)=='cancel'
315
370
  raise
316
371
  exit
317
372
  else
@@ -325,7 +380,8 @@ class Arcadia < TkApplication
325
380
 
326
381
 
327
382
  def do_exit
328
- q1 = (Arcadia.yes_no(self,
383
+ q1 = (Arcadia.dialog(self,
384
+ 'type'=>'yes_no',
329
385
  'msg'=>"Do you want exit?",
330
386
  'title' => '(Arcadia) Exit',
331
387
  'level' => 'question')=='yes')
@@ -336,72 +392,39 @@ class Arcadia < TkApplication
336
392
  end
337
393
 
338
394
  def can_exit?
339
- _can_exit = true
340
395
  _event = Arcadia.process_event(ExitQueryEvent.new(self, 'can_exit'=>true))
341
- _can_exit = _event.can_exit
342
- @exts.each{|extension|
343
- if ext_active?(extension) && !self[extension].can_exit_query
344
- _can_exit = false
345
- break
346
- end
347
- }
348
- return _can_exit
396
+ return _event.can_exit
349
397
  end
350
398
 
351
399
  def do_finalize
352
400
  _event = Arcadia.process_event(FinalizeEvent.new(self))
353
-
354
- @exts.each{|extension|
355
- self[extension].finalize if ext_active?(extension)
356
- }
357
401
  self.write_persist(self['applicationParams'].persistent_file)
358
402
  end
359
403
 
360
- def Arcadia.new_msg(_sender, _msg, _channel=nil)
361
- process_event(MsgEvent.new(_sender, 'msg'=>_msg))
362
- end
363
-
364
- def Arcadia.new_debug_msg(_sender, _msg, _channel=nil)
365
- process_event(DebugMsgEvent.new(_sender, 'msg'=>_msg))
366
- end
367
-
368
- def Arcadia.new_error_msg(_sender, _msg, _channel=nil)
369
- process_event(ErrorMsgEvent.new(_sender, 'msg'=>_msg))
370
- end
371
-
372
- def Arcadia.dialog(_sender, _type, _msg, _title=nil, _level=nil)
373
- case _level
374
- when 'info', nil
375
- _event = process_event(DialogEvent.new(_sender, 'msg'=>_msg, 'title'=>_title, 'type'=>_type))
376
- when 'question'
377
- _event = process_event(QuestionDialogEvent.new(_sender, 'msg'=>_msg, 'title'=>_title, 'type'=>_type))
378
- when 'warning'
379
- _event = process_event(WarningDialogEvent.new(_sender, 'msg'=>_msg, 'title'=>_title, 'type'=>_type))
380
- when 'error'
381
- _event = process_event(ErrorDialogEvent.new(_sender, 'msg'=>_msg, 'title'=>_title, 'type'=>_type))
382
- end
383
- return _event.results[0].value if _event
404
+ def Arcadia.console(_sender, _args=Hash.new)
405
+ process_event(MsgEvent.new(_sender, _args))
384
406
  end
385
407
 
386
- def Arcadia.ok(_sender, _args=nil)
387
- Arcadia.dialog(_sender, 'ok', _args['msg'], _args['title'], _args['level']) if _args
408
+ def Arcadia.dialog(_sender, _args=Hash.new)
409
+ _event = process_event(DialogEvent.new(_sender, _args))
410
+ return _event.results[0].value if _event
388
411
  end
389
412
 
390
- def Arcadia.ok_cancel(_sender, _args=nil)
391
- Arcadia.dialog(_sender, 'ok_cancel', _args['msg'], _args['title'], _args['level']) if _args
392
- end
393
-
394
- def Arcadia.yes_no(_sender, _args=nil)
395
- Arcadia.dialog(_sender, 'yes_no', _args['msg'], _args['title'], _args['level']) if _args
413
+ def Arcadia.style(_class)
414
+ Configurable.properties_group(_class, Arcadia.instance['conf'])
396
415
  end
397
416
 
398
- def Arcadia.yes_no_cancel(_sender, _args=nil)
399
- Arcadia.dialog(_sender, 'yes_no_cancel', _args['msg'], _args['title'], _args['level']) if _args
400
- end
401
-
402
- def Arcadia.abort_retry_ignore(_sender, _args=nil)
403
- Arcadia.dialog(_sender, 'abort_retry_ignore', _args['msg'], _args['title'], _args['level']) if _args
404
- end
417
+
418
+
419
+ # def Arcadia.res(_res)
420
+ # theme = Arcadia.instance['conf']['theme']
421
+ # if theme
422
+ # ret = eval("#{theme}::#{_res}")
423
+ # end
424
+ # ret=Res::_res if ret.nil?
425
+ # return ret
426
+ # end
427
+
405
428
 
406
429
  end
407
430
 
@@ -410,6 +433,7 @@ class ArcadiaUserControl
410
433
  class UserItem
411
434
  attr_accessor :name
412
435
  attr_accessor :context
436
+ attr_accessor :context_caption
413
437
  attr_accessor :caption
414
438
  attr_accessor :hint
415
439
  attr_accessor :event_class
@@ -468,17 +492,18 @@ class ArcadiaMainToolbar < ArcadiaUserControl
468
492
  _command = proc{Arcadia.process_event(@event_class.new(_sender, @event_args))} if @event_class
469
493
  _hint = @hint
470
494
  _font = @font
471
- _foreground = @foreground
472
- _background = @background
473
495
  _caption = @caption
474
- @item_obj = Tk::BWidget::Button.new(_args['frame']){
496
+ @item_obj = Tk::BWidget::Button.new(_args['frame'], Arcadia.style('toolbarbutton')){
475
497
  image _image if _image
476
- borderwidth 1
477
- font _font if _font
478
- background _background if _background
479
- foreground _foreground if _foreground
498
+ #borderwidth 1
499
+ #font _font if _font
500
+ #activebackground Arcadia.conf('button.activebackground')
501
+ #activeforeground Arcadia.conf('button.activeforeground')
502
+ #background Arcadia.conf('button.background')
503
+ #foreground Arcadia.conf('button.foreground')
504
+ #highlightbackground Arcadia.conf('button.highlightbackground')
505
+ #relief Arcadia.conf('button.relief')
480
506
  command _command if _command
481
- relief 'flat'
482
507
  #relief 'groove'
483
508
  width 20
484
509
  height 20
@@ -502,7 +527,11 @@ class ArcadiaMainToolbar < ArcadiaUserControl
502
527
  def initialize(_arcadia, _frame)
503
528
  @arcadia = _arcadia
504
529
  @frame = _frame
505
- # @context_frames = Hash.new
530
+ @frame.borderwidth(Arcadia.conf('panel.borderwidth'))
531
+ #@frame.highlightbackground(Arcadia.conf('panel.highlightbackground'))
532
+ @frame.relief(Arcadia.conf('panel.relief'))
533
+
534
+ @context_frames = Hash.new
506
535
  @last_context = nil
507
536
  end
508
537
 
@@ -530,7 +559,10 @@ class ArcadiaMainToolbar < ArcadiaUserControl
530
559
  end
531
560
 
532
561
  def new_separator
533
- Tk::BWidget::Separator.new(@frame, :orient=>'vertical').pack('side' =>'left', :padx=>2, :pady=>2, :fill=>'y',:anchor=> 'w')
562
+ Tk::BWidget::Separator.new(@frame,
563
+ :orient=>'vertical',
564
+ :background=>Arcadia.conf('button.highlightbackground')
565
+ ).pack('side' =>'left', :padx=>2, :pady=>2, :fill=>'y',:anchor=> 'w')
534
566
  end
535
567
 
536
568
  # def load_toolbar_buttons
@@ -604,7 +636,9 @@ class ArcadiaMainMenu < ArcadiaUserControl
604
636
  def initialize(_sender, _args)
605
637
  super(_sender, _args)
606
638
  _image = TkPhotoImage.new('data' => @image_data) if @image_data
607
- _command = proc{Arcadia.process_event(@event_class.new(_sender, @event_args))} if @event_class
639
+ _command = proc{
640
+ Arcadia.process_event(@event_class.new(_sender, @event_args))
641
+ } if @event_class
608
642
  #_menu = @menu[@parent]
609
643
  @item_obj = @menu.insert('end', :command,
610
644
  'image'=>_image,
@@ -627,11 +661,12 @@ class ArcadiaMainMenu < ArcadiaUserControl
627
661
  # create main menu
628
662
  @menu = menu
629
663
  build
630
- menu.foreground('black')
631
- menu.activeforeground('#6679f1')
632
- menu.relief('flat')
633
- menu.borderwidth(0)
634
- menu.font($arcadia['conf']['main.mainmenu.font'])
664
+ @menu.configure(Arcadia.style('menu'))
665
+ # menu.foreground('black')
666
+ # menu.activeforeground('#6679f1')
667
+ # menu.relief('flat')
668
+ # menu.borderwidth(0)
669
+ # menu.font(Arcadia.conf('main.mainmenu.font'))
635
670
  end
636
671
 
637
672
  def get_menu_context(_menubar, _context)
@@ -673,6 +708,8 @@ class ArcadiaMainMenu < ArcadiaUserControl
673
708
  :parent=>@pop_up,
674
709
  :tearoff=>0
675
710
  )
711
+ sub.configure(Arcadia.style('menu'))
712
+ #update_style(sub)
676
713
  menu_context.insert('end',
677
714
  :cascade,
678
715
  :label=>folder,
@@ -696,7 +733,12 @@ class ArcadiaMainMenu < ArcadiaUserControl
696
733
 
697
734
  def new_item(_sender, _args= nil)
698
735
  return if _args.nil?
699
- _args['menu']=get_menu(@menu, _args['context'], _args['context_path'])
736
+ if _args['context_caption']
737
+ conte = _args['context_caption']
738
+ else
739
+ conte = _args['context']
740
+ end
741
+ _args['menu']=get_menu(@menu, conte, _args['context_path'])
700
742
  super(_sender, _args)
701
743
  end
702
744
 
@@ -759,7 +801,7 @@ class ArcadiaAboutSplash < TkToplevel
759
801
  text 'Arcadia'
760
802
  background _bgcolor
761
803
  foreground '#ffffff'
762
- font Arcadia.instance['conf']['splash.title.font']
804
+ font Arcadia.conf('splash.title.font')
763
805
  justify 'left'
764
806
  place('width' => '190','x' => 110,'y' => 10,'height' => 25)
765
807
  }
@@ -794,7 +836,7 @@ class ArcadiaAboutSplash < TkToplevel
794
836
  place('width'=>-5,'relwidth' => 1,'x' => 5,'y' => 175,'height' => 19)
795
837
  }
796
838
  @tkLabel21 = TkLabel.new(self){
797
- text 'by Antonio Galeone - 2007'
839
+ text 'by Antonio Galeone - 2008'
798
840
  background _bgcolor
799
841
  foreground '#ffffff'
800
842
  font Arcadia.instance['conf']['splash.credits.font']
@@ -845,28 +887,49 @@ class ArcadiaAboutSplash < TkToplevel
845
887
 
846
888
  end
847
889
 
890
+ class ActionDispatcher
891
+
892
+ def initialize(_arcadia)
893
+ @arcadia = _arcadia
894
+ Arcadia.attach_listener(self, ActionEvent)
895
+ end
896
+
897
+ def on_action(_event)
898
+ if _event.receiver != nil && _event.receiver.respond_to?(_event.action)
899
+ if _event.action_args.nil?
900
+ _event.receiver.send(_event.action)
901
+ else
902
+ _event.receiver.send(_event.action, _event.action_args)
903
+ end
904
+ end
905
+ end
906
+
907
+ end
908
+
909
+
848
910
  class ArcadiaDialogManager
849
911
  def initialize(_arcadia)
850
912
  @arcadia = _arcadia
851
- Arcadia.add_listener(self, DialogEvent)
913
+ Arcadia.attach_listener(self, DialogEvent)
852
914
  end
853
915
  def on_dialog(_event)
854
916
  type = _event.type
855
917
  if !DialogEvent::TYPE_PATTERNS.include?(_event.type)
856
918
  type = 'ok'
857
919
  end
858
- case _event
859
- when QuestionDialogEvent
860
- icon = 'question'
861
- when InfoDialogEvent
862
- icon = 'info'
863
- when WarningDialogEvent
864
- icon = 'warning'
865
- when ErrorDialogEvent
866
- icon = 'error'
867
- else
868
- icon = 'info'
869
- end
920
+ icon = _event.level
921
+ # case _event
922
+ # when QuestionDialogEvent
923
+ # icon = 'question'
924
+ # when InfoDialogEvent
925
+ # icon = 'info'
926
+ # when WarningDialogEvent
927
+ # icon = 'warning'
928
+ # when ErrorDialogEvent
929
+ # icon = 'error'
930
+ # else
931
+ # icon = 'info'
932
+ # end
870
933
 
871
934
  tktype = type.gsub('_','').downcase
872
935
 
@@ -918,7 +981,7 @@ class ArcadiaLayout
918
981
 
919
982
  def _prepare_rows(_row,_col, _height, _perc=false, _top_name=nil, _bottom_name=nil)
920
983
  if (@frames[_row][_col] != nil)
921
- _h = AGTkOSplittedFrames.new(@frames[_row][_col],_height, _perc)
984
+ _h = AGTkOSplittedFrames.new(@frames[_row][_col],_height, @arcadia['conf']['layout.splitter.length'].to_i,_perc)
922
985
  if @frames[_row + 1] == nil
923
986
  @frames[_row + 1] = Array.new
924
987
  @domains[_row + 1] = Array.new
@@ -957,10 +1020,9 @@ class ArcadiaLayout
957
1020
  _prepare_rows(_row,_col, _height, true, _top_name, _bottom_name)
958
1021
  end
959
1022
 
960
-
961
- def add_cols(_row,_col, _width, _left_name=nil, _right_name=nil)
1023
+ def _prepare_cols(_row,_col, _width, _perc=false, _left_name=nil, _right_name=nil)
962
1024
  if (@frames[_row][_col] != nil)
963
- _w = AGTkVSplittedFrames.new(@frames[_row][_col],_width)
1025
+ _w = AGTkVSplittedFrames.new(@frames[_row][_col],_width,@arcadia['conf']['layout.splitter.length'].to_i,_perc)
964
1026
  @frames[_row][_col] = _w.left_frame
965
1027
  @frames[_row][_col + 1] = _w.right_frame
966
1028
 
@@ -977,11 +1039,20 @@ class ArcadiaLayout
977
1039
  @domains[_row][_col + 1] = _right_name
978
1040
  end
979
1041
  end
1042
+ private :_prepare_cols
1043
+
1044
+ def add_cols(_row,_col, _width, _left_name=nil, _right_name=nil)
1045
+ _prepare_cols(_row,_col, _width, false, _left_name, _right_name)
1046
+ end
1047
+
1048
+ def add_cols_perc(_row,_col, _width, _left_name=nil, _right_name=nil)
1049
+ _prepare_cols(_row,_col, _width, true, _left_name, _right_name)
1050
+ end
980
1051
 
981
1052
  def add_headers
982
1053
  @domains.each{|row|
983
1054
  row.each{|domain|
984
- @panels[domain]['root']= TkTitledFrame.new(@panels[domain]['root'], '...').place('x'=>0, 'y'=>0,'relheight'=>1, 'relwidth'=>1) if @panels[domain]
1055
+ @panels[domain]['root']= TkTitledFrame.new(@panels[domain]['root']).place('x'=>0, 'y'=>0,'relheight'=>1, 'relwidth'=>1) if @panels[domain]
985
1056
  }
986
1057
  }
987
1058
  @headed = true
@@ -1000,6 +1071,7 @@ class ArcadiaLayout
1000
1071
  end
1001
1072
 
1002
1073
  def register_panel(_domain_name, _name, _title)
1074
+ #p "register #{_name} ------ 1"
1003
1075
  p = @panels[_domain_name]
1004
1076
  if p!=nil
1005
1077
  num = p['sons'].length
@@ -1010,13 +1082,15 @@ class ArcadiaLayout
1010
1082
  root_frame = p['root']
1011
1083
  end
1012
1084
  if (num == 0 && @autotab)
1085
+ #p "register #{_name} ------ 2"
1013
1086
  api = ArcadiaPanelInfo.new(_name,_title,nil)
1014
- api.frame = TkFrame.new(root_frame).place('x'=>0, 'y'=>0, 'relwidth'=>1, 'relheight'=>1)
1087
+ api.frame = TkFrame.new(root_frame, Arcadia.style('panel')).place('x'=>0, 'y'=>0, 'relwidth'=>1, 'relheight'=>1)
1015
1088
  p['sons'][_name] = api
1016
1089
  return api.frame
1017
1090
  else
1018
1091
  if num == 1 && @autotab && p['notebook'] == nil
1019
- p['notebook'] = Tk::BWidget::NoteBook.new(root_frame){
1092
+ #p "register #{_name} ------ 3"
1093
+ p['notebook'] = Tk::BWidget::NoteBook.new(root_frame, Arcadia.style('tabpanel')){
1020
1094
  tabbevelsize 0
1021
1095
  internalborderwidth 0
1022
1096
  pack('fill'=>'both', :padx=>0, :pady=>0, :expand => 'yes')
@@ -1035,12 +1109,14 @@ class ArcadiaLayout
1035
1109
  api.frame.place('in'=>api_tab_frame, 'x'=>0, 'y'=>0, 'relwidth'=>1, 'relheight'=>1)
1036
1110
  api.frame.raise
1037
1111
  elsif (num==0 && !@autotab)
1112
+ #p "register #{_name} ------ 4"
1038
1113
  p['notebook'] = Tk::BWidget::NoteBook.new(root_frame){
1039
1114
  tabbevelsize 0
1040
1115
  internalborderwidth 0
1041
1116
  pack('fill'=>'both', :padx=>0, :pady=>0, :expand => 'yes')
1042
1117
  }
1043
1118
  end
1119
+ # p "---- insert in notebook #{_name} "
1044
1120
  _panel = p['notebook'].insert('end',_name ,
1045
1121
  'text'=>_title,
1046
1122
  #'background'=>_tab_bg,
@@ -1054,14 +1130,29 @@ class ArcadiaLayout
1054
1130
  p['notebook'].raise(_name)
1055
1131
  return _panel
1056
1132
  end
1133
+ else
1134
+ Arcadia.dialog(self,
1135
+ 'type'=>'ok',
1136
+ 'msg'=>"domain #{_domain_name} do not exist\nfor '#{_title}'!",
1137
+ 'level'=>'warning'
1138
+ )
1139
+ float_frame = new_float_frame
1140
+ float_frame.title(_title)
1141
+ return float_frame.frame
1057
1142
  end
1058
1143
  end
1059
1144
 
1060
1145
  def unregister_panel(_domain_name, _name)
1146
+ #p "unregister #{_name} ------> 1"
1061
1147
  @panels[_domain_name]['sons'].delete(_name)
1062
- @panels[_domain_name]['notebook'].delete(_name)
1148
+ #p "unregister #{_name} ------> 2"
1149
+ #p @panels[_domain_name]['notebook'].pages
1150
+ @panels[_domain_name]['notebook'].delete(_name) if @panels[_domain_name]['notebook'].index(_name) > 0
1151
+ #p "unregister #{_name} ------> 3"
1063
1152
  new_raise_key = @panels[_domain_name]['sons'].keys[@panels[_domain_name]['sons'].length-1]
1153
+ #p "unregister #{_name} ------> 4"
1064
1154
  @panels[_domain_name]['notebook'].raise(new_raise_key)
1155
+ #p "unregister #{_name} ------> 5"
1065
1156
  end
1066
1157
 
1067
1158
  def raise_panel(_domain_name, _name)
@@ -1086,7 +1177,7 @@ class ArcadiaLayout
1086
1177
 
1087
1178
  def new_float_frame(_args=nil)
1088
1179
  if _args.nil?
1089
- _args = {'x'=>0, 'y'=>0, 'width'=>100, 'height'=>100}
1180
+ _args = {'x'=>10, 'y'=>10, 'width'=>100, 'height'=>100}
1090
1181
  end
1091
1182
  _frame = TkFloatTitledFrame.new(root)
1092
1183
  _frame.on_close=proc{_frame.hide}
@@ -1094,4 +1185,3 @@ class ArcadiaLayout
1094
1185
  return _frame
1095
1186
  end
1096
1187
  end
1097
- Arcadia.new.run