Class: Arcadia

Inherits:
TkApplication show all
Includes:
Observable
Defined in:
lib/a-core.rb

Instance Attribute Summary collapse

Attributes inherited from TkApplication

#tcltk_info

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from TkApplication

#run, sys_info

Methods inherited from Application

#[], #[]=, conf, #conf, #create, del_conf, del_conf_group, instance, #load_local_config, #load_theme, #local_dir, #local_file_config, #objects, #publish, #run, sys_info, #update_local_config

Methods included from EventBus

#attach_listener, #broadcast_event, #detach_listener, #process_event

Methods included from Persistable

#append_persistent_property, #override_persistent

Methods included from Configurable

#properties_file2hash, properties_group, #resolve_link, #resolve_properties_link

Constructor Details

#initializeArcadia

Returns a new instance of Arcadia.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/a-core.rb', line 20

def initialize
  super(
    ApplicationParams.new(
      'arcadia',
      '0.8.0',
      'conf/arcadia.conf',
      'conf/arcadia.pers'
    )
  )
  load_config
  set_sysdefaultproperty
  ArcadiaDialogManager.new(self)
  ArcadiaActionDispatcher.new(self)
  ArcadiaGemsWizard.new(self)
  MonitorLastUsedDir.new
  FocusEventManager.new
  #self.load_local_config(false)
  ObjectSpace.define_finalizer($arcadia, self.class.method(:finalize).to_proc)
  publish('action.on_exit', proc{do_exit})
  #_title = "Arcadia Ruby ide :: [Platform = #{RUBY_PLATFORM}] [Ruby version = #{RUBY_VERSION}] [TclTk version = #{tcltk_info.level}]"
  _title = "Arcadia ide "
  @root = TkRoot.new(
    'background'=> self['conf']['background']
    ){
    title _title
    withdraw
    protocol( "WM_DELETE_WINDOW", $arcadia['action.on_exit'])
    iconphoto(TkPhotoImage.new('dat'=>ARCADIA_RING_GIF))
  }
  
  @on_event = Hash.new

  @main_menu_bar = TkMenubar.new(
    'background'=> self['conf']['background']
  ).pack('fill'=>'x')
  @mf_root = Tk::BWidget::MainFrame.new(@root,
   'background'=> self['conf']['background'],
   'height'=> 0
    ){
    menu @main_menu_bar
  }.pack(
    'anchor'=> 'center',
    'fill'=> 'both',
    'expand'=> 1
  )
  #.place('x'=>0,'y'=>0,'relwidth'=>1,'relheight'=>1)
  @mf_root.show_statusbar('none')
  #@toolbar = @mf_root.add_toolbar
  @main_toolbar = ArcadiaMainToolbar.new(self, @mf_root.add_toolbar)
  @is_toolbar_show=self['conf']['user_toolbar_show']=='yes'
  @mf_root.show_toolbar(0,@is_toolbar_show)
  @use_splash = self['conf']['splash.show']=='yes'
  @splash = ArcadiaAboutSplash.new if @use_splash
  @splash.set_progress(50) if @splash
  @splash.deiconify if @splash
  Tk.update
  @splash.next_step('..prepare')  if @splash
  prepare
  @splash.last_step('..load finish')  if @splash
  if self['conf']['geometry']
    geometry = self['conf']['geometry']
  else
    start_width = (TkWinfo.screenwidth(@root)-4)
    start_height = (TkWinfo.screenheight(@root)-20)
    if RUBY_PLATFORM =~ /mswin|mingw/ # on doze don't go below the start gar
      start_height -= 50
      start_width -= 20
    end
    geometry = start_width.to_s+'x'+start_height.to_s+'+0+0'
  end
  @root.deiconify
  @root.raise
  @root.focus(true)
  @root.geometry(geometry)
  Tk.update_idletasks
  #sleep(1)
  @splash.destroy  if @splash
  if @first_run # first ARCADIA ever
    Arcadia.process_event(OpenBufferEvent.new(self,'file'=>'README'))
  elsif ARGV.length > 0
    ARGV.each{|_f|
      if  $pwd != File.dirname(__FILE__) && !File.exist?(_f)
        _f = "#{$pwd}/#{_f}"
      end
      Arcadia.process_event(OpenBufferEvent.new(self,'file'=>_f)) if File.exist?(_f)
    }
  end
  Arcadia.attach_listener(self, QuitEvent)
  Arcadia.persistent("version", self['applicationParams'].version)
end

Instance Attribute Details

#layoutObject (readonly)

Returns the value of attribute layout.



19
20
21
# File 'lib/a-core.rb', line 19

def layout
  @layout
end

Class Method Details

.conf_group(_path) ⇒ Object



681
682
683
# File 'lib/a-core.rb', line 681

def Arcadia.conf_group(_path)
  Configurable.properties_group(_path, Arcadia.instance['conf'])
end

.console(_sender, _args = Hash.new) ⇒ Object



668
669
670
# File 'lib/a-core.rb', line 668

def Arcadia.console(_sender, _args=Hash.new)
  process_event(MsgEvent.new(_sender, _args))
end

.dialog(_sender, _args = Hash.new) ⇒ Object



672
673
674
675
# File 'lib/a-core.rb', line 672

def Arcadia.dialog(_sender, _args=Hash.new)
  _event = process_event(DialogEvent.new(_sender, _args))  
  return _event.results[0].value if _event
end

.file_icon(_file_name) ⇒ Object



713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
# File 'lib/a-core.rb', line 713

def Arcadia.file_icon(_file_name)
  if @@instance['file_icons'] == nil
    @@instance['file_icons'] = Hash.new 
    @@instance['file_icons']['default']= TkPhotoImage.new('dat' => FILE_ICON_DEFAULT)
  end
  _base_name= File.basename(_file_name)
  if _base_name.include?('.')
    file_dn = _base_name.split('.')[-1]
  else
    file_dn = "no_ext"
  end
  if @@instance['file_icons'][file_dn].nil?
    file_icon_name="FILE_ICON_#{file_dn.upcase}"
    begin
      if eval("defined?(#{file_icon_name})")
        @@instance['file_icons'][file_dn]= TkPhotoImage.new('dat' => eval(file_icon_name))
      else
        @@instance['file_icons'][file_dn]= @@instance['file_icons']['default']
      end
    rescue Exception
      @@instance['file_icons'][file_dn]= @@instance['file_icons']['default']
    end
  end
  @@instance['file_icons'][file_dn]
end

.finalize(id) ⇒ Object



132
133
134
# File 'lib/a-core.rb', line 132

def Arcadia.finalize(id)
  puts "\nArcadia #{id} dying at #{Time.new}"
end

.gem_available?(_gem) ⇒ Boolean

Returns:

  • (Boolean)


196
197
198
199
200
201
202
# File 'lib/a-core.rb', line 196

def Arcadia.gem_available?(_gem)
    if Gem.respond_to?(:available?)
        return Gem.available?(_gem)
    else
        return !Gem.source_index.find_name(_gem).empty?
    end
end

.is_windows?Boolean

Returns:

  • (Boolean)


708
709
710
# File 'lib/a-core.rb', line 708

def Arcadia.is_windows?
  RUBY_PLATFORM =~ /mingw|mswin/
end

.layoutObject



698
699
700
701
702
# File 'lib/a-core.rb', line 698

def Arcadia.layout
  if @@instance
      return @@instance.layout
 end
end

.open_file_dialogObject



704
705
706
# File 'lib/a-core.rb', line 704

def Arcadia.open_file_dialog
   Tk.getOpenFile 'initialdir' => MonitorLastUsedDir.get_last_dir
end

.persistent(_property, _value = nil, _immediate = false) ⇒ Object



685
686
687
688
689
690
691
692
693
694
695
696
# File 'lib/a-core.rb', line 685

def Arcadia.persistent(_property, _value=nil, _immediate=false)
  if @@instance
    if _value.nil?
      return @@instance['pers'][_property]
    else
     @@instance['pers'][_property] = _value 
   end
   if _immediate      
     @@instance.append_persistent_property(@@instance['applicationParams'].persistent_file,_property, _value )
    end
 end
end

.style(_class) ⇒ Object



677
678
679
# File 'lib/a-core.rb', line 677

def Arcadia.style(_class)
  Configurable.properties_group(_class, Arcadia.instance['conf'])
end

Instance Method Details

#can_exit?Boolean

Returns:

  • (Boolean)


580
581
582
583
# File 'lib/a-core.rb', line 580

def can_exit?
  _event = Arcadia.process_event(ExitQueryEvent.new(self, 'can_exit'=>true))
  _event.can_exit
end

#check_gems_dependences(_ext) ⇒ Object



204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# File 'lib/a-core.rb', line 204

def check_gems_dependences(_ext)
  ret = true
  gems_property = self['conf']["#{_ext}.gems"]
  if gems_property
    gems = gems_property.split(',').collect{| g | g.strip }
    if gems && gems.length > 0
      gems.each{|gem|
        # consider gem only if it is not installed
        if !Arcadia.gem_available?(gem)
          repository_property =  self['conf']["#{_ext}.gems.#{gem}.repository"]
          events_property =  self['conf']["#{_ext}.gems.#{gem}.events"]
          args = Hash.new
          args['extension_name']=_ext
          args['gem_name']=gem
          args['gem_repository']=repository_property if repository_property
          args['gem_events']=events_property if events_property
          if events_property
            #EventWatcher.new
            events_str = events_property.split(',')
            events_str.each{|event_str|
              EventWatcherForGem.new(eval(event_str),args)
            }
          else
            _event = Arcadia.process_event(NeedRubyGemWizardEvent.new(self, args))
            ret = ret &&  Arcadia.gem_available?(gem)
#              if _event && _event.results
#                ret = ret && _event.results[0].installed
#              end
          end
          break if !ret
        end
      } 
    end 
  end 
  ret
end

#do_buildObject



241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/a-core.rb', line 241

def do_build
  # create extensions
  Array.new.concat(@exts).each{|extension|
    if extension && ext_source_must_be_loaded?(extension)
      gems_installed = check_gems_dependences(extension)
      if !gems_installed || !ext_load(extension)
        @exts.delete(extension)
      elsif !ext_active?(extension)
        @exts.delete(extension)
      elsif ext_active?(extension)
        @splash.next_step('... creating '+extension)  if @splash
        @exts.delete(extension) unless 
          (((@exts_dip[extension] != nil && @exts_loaded.include?(@exts_dip[extension]))||@exts_dip[extension] == nil) && ext_create(extension)) 
      end
    end
  }
  begin
    _build_event = Arcadia.process_event(BuildEvent.new(self))
  rescue Exception
    ret = false
    msg = "During build event processing(#{$!.class.to_s}) : #{$!} at : #{[email protected]_s}"
    ans = Tk.messageBox('icon' => 'error', 'type' => 'abortretryignore',
    'title' => "(Arcadia) Build face", 'parent' => @root,
    'message' => msg)
    if  ans == 'abort'
      raise
      exit
    elsif ans == 'retry'
      retry
    else
      Tk.update
    end
  end
end

#do_exitObject



568
569
570
571
572
573
574
575
576
577
578
# File 'lib/a-core.rb', line 568

def do_exit
  q1 = conf('confirm-on-exit')!='yes' || (Arcadia.dialog(self,
                      'type'=>'yes_no',
                      'msg'=>"Do you want exit?",
                      'title' => '(Arcadia) Exit',
                      'level' => 'question')=='yes')
  if q1 && can_exit?
    do_finalize
    @root.destroy
  end
end

#do_finalizeObject



661
662
663
664
665
666
# File 'lib/a-core.rb', line 661

def do_finalize
  self.save_layout
  _event = Arcadia.process_event(FinalizeEvent.new(self))
  update_local_config
  self.override_persistent(self['applicationParams'].persistent_file, self['pers'])
end

#ext_active?(_name) ⇒ Boolean

Returns:

  • (Boolean)


136
137
138
139
# File 'lib/a-core.rb', line 136

def ext_active?(_name)
return (self['conf'][_name+'.active'] != nil && self['conf'][_name+'.active']=='yes')||
        (self['conf'][_name+'.active'] == nil)
end

#ext_create(_extension) ⇒ Object



321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
# File 'lib/a-core.rb', line 321

def ext_create(_extension)
  ret = true
  begin
    class_name = self['conf'][_extension+'.class']
    if class_name.strip.length > 0
      klass = nil
      begin
        klass = eval(class_name)
      rescue => e
        puts 'does an extension class have the wrong name associated with it, in its conf file?, or is not listing the right .rb file?'
        raise e
      end
      publish(_extension, klass.new(self, _extension))
    end
  rescue Exception,LoadError
    ret = false
    msg = "Loading \"#{_extension}\" (#{$!.class.to_s}) : #{$!} at : #{[email protected]_s}"
    ans = Tk.messageBox('icon' => 'error', 'type' => 'abortretryignore',
    'title' => "(Arcadia) Extensions '#{_extension}'", 'parent' => @root,
    'message' => msg)
    if  ans == 'abort'
      raise
      exit
    elsif ans == 'retry'
      retry
    else
      Tk.update
    end
  end
  ret
end

#ext_load(_extension) ⇒ Object



295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
# File 'lib/a-core.rb', line 295

def ext_load(_extension)
  ret = true
  begin
    source = self['conf'][_extension+'.require']
    if source.strip.length > 0
     require source 
    end
    @exts_loaded << _extension
  rescue Exception,LoadError
    ret = false
    msg = "Loading \"#{_extension}\" (#{$!.class.to_s}) : #{$!} at : #{[email protected]_s}"
    ans = Tk.messageBox('icon' => 'error', 'type' => 'abortretryignore',
    'title' => "(Arcadia) Extensions '#{_extension}'", 'parent' => @root,
    'message' => msg)
    if  ans == 'abort'
      raise
      exit
    elsif ans == 'retry'
      retry
    else
      Tk.update
    end
  end
  ret
end

#ext_method(_extension, _method) ⇒ Object



353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
# File 'lib/a-core.rb', line 353

def ext_method(_extension, _method)
  begin
    self[_extension].send(_method)
  rescue Exception
    msg = _method.to_s+' "'+_extension.to_s+'"'+" ("+$!.class.to_s+") "+" : "+$! + "\n at : "+$@.to_s
    ans = Tk.messageBox('icon' => 'warning', 'type' => 'abortretryignore',
    'title' => '(Arcadia) Extensions', 'parent' => @root,
    'message' => msg)
    if ans == 'abort'
      raise
      exit
    elsif ans == 'retry'
      retry
    else
      Tk.update
    end
  end
end

#ext_source_must_be_loaded?(_name) ⇒ Boolean

Returns:

  • (Boolean)


141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/a-core.rb', line 141

def ext_source_must_be_loaded?(_name)
  ret = ext_active?(_name)
  if !ret
  @exts_dip.each{|key,val|
    if val == _name
      ret = ret || ext_active?(key)
    end
    break if ret
  }
  end
  ret
end

#init_layoutObject



372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
# File 'lib/a-core.rb', line 372

def init_layout
  @layout = ArcadiaLayout.new(self, @mf_root.get_frame)
  suf = "layout.split"
  elems = self['conf'][suf]
  return if elems.nil?
  if elems.strip.length > 0
    groups = elems.split(',')
    groups.each{|group|
      if group
        suf1 = suf+'.'+group
        begin
          property = self['conf'][suf1]
          c = property.split('c')
          if c && c.length == 2
            pt = c[0].split('.')
            perc = c[1].include?('%')
            w = c[1].sub('%','')
            if perc 
              @layout.add_cols_perc(pt[0].to_i, pt[1].to_i, w.to_i)
            else
              @layout.add_cols(pt[0].to_i, pt[1].to_i, w.to_i)
            end
          else
            r = property.split('r')
            if r && r.length == 2
              pt = r[0].split('.')
              perc = r[1].include?('%')
              w = r[1].sub('%','')
              if perc 
                @layout.add_rows_perc(pt[0].to_i, pt[1].to_i, w.to_i)
              else
                @layout.add_rows(pt[0].to_i, pt[1].to_i, w.to_i)
              end
            end
          end
          
        rescue Exception
          msg = "Loading layout: (#{$!.class.to_s} : #{$!.to_s} at : #{[email protected]_s})"
          if Arcadia.dialog(self, 'type'=>'ok_cancel', 'level'=>'error','title' => '(Arcadia) Layout', 'msg'=>msg)=='cancel'
            raise
            exit
          else
            Tk.update
          end
        end
      end
    }
  else
    @layout.add_mono_panel
  end
  @layout.add_headers
end

#load_configObject



425
426
427
428
429
430
431
432
433
# File 'lib/a-core.rb', line 425

def load_config
  self.load_local_config(false)
  # local config can contain loading conditions
  self.load_exts_conf
  self.load_local_config
  self.load_theme(self['conf']['theme'])
  self.resolve_properties_link(self['conf'],self['conf'])
  self.resolve_properties_link(self['origin_conf'],self['origin_conf'])
end

#load_exts_confObject



154
155
156
157
158
159
160
# File 'lib/a-core.rb', line 154

def load_exts_conf
    @exts = Array.new
    @exts_i = Array.new
    @exts_dip = Hash.new
    @exts_loaded = Array.new
    load_exts_conf_from('ext')
end

#load_exts_conf_from(_dir = '', _ext_root = nil) ⇒ Object



162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/a-core.rb', line 162

def load_exts_conf_from(_dir='',_ext_root=nil)
    dirs = Array.new
    files = Dir["#{_dir}/*"].concat(Dir[ENV["HOME"]+"/.arcadia/#{_dir}/*"]).sort
    files.each{|f|
       dirs << f if File.stat(f).directory? && FileTest.exist?(f+'/'+File.basename(f)+'.conf')
    }
    dirs.each{|ext_dir|
      conf_hash = self.properties_file2hash(ext_dir+'/'+File.basename(ext_dir)+'.conf') 
     conf_hash2 = Hash.new
     name = conf_hash['name']
       conf_hash.each{|key, value|
         var_plat = key.split(':')
         if var_plat.length > 1
           new_key = var_plat[0] + ':' + name + '.' + var_plat[1]
         else
           begin
            new_key = name+'.'+key
           rescue => e
            puts 'is an extension missing a name?'
            raise e
           end
         end  
         conf_hash2[new_key]= value
       }
     @exts << name
     if _ext_root
       @exts_dip[name] = _ext_root
     end     
       self['conf'].update(conf_hash2)  
       self['origin_conf'].update(conf_hash2) 
       load_exts_conf_from("#{ext_dir}/ext",name)
    }
end

#load_maximisedObject



276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
# File 'lib/a-core.rb', line 276

def load_maximised
  lm = self['conf']['layout.maximized']
  if lm    
    ext,index=lm.split(',')
    maxed = false
    if ext && index
      ext = ext.strip
      i=index.strip.to_i
      @exts_i.each{|e|
        if e.conf('name')==ext && !maxed
          e.maximize(i)
          maxed=true
          break
        end
      }    
    end
  end
end

#load_user_control(_user_control, _ext = '', _pre = '') ⇒ Object



497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
# File 'lib/a-core.rb', line 497

def load_user_control(_user_control, _ext='', _pre='')
  return unless _ext && ext_active?(_ext)
  
  if _ext.length > 0 && self[_ext]
    _self_on_eval = self[_ext]
    suf = "#{_ext}.#{_user_control.class::SUF}"
  else
    _self_on_eval = self
    suf = "#{_user_control.class::SUF}"
  end
  if _pre.length > 0
    suf = "#{_pre}.#{suf}"
  end
  contexts = self['conf']["#{suf}.contexts"]
  contexts_caption = self['conf']["#{suf}.contexts.caption"]
  return if contexts.nil?
  groups = contexts.split(',')
  groups_caption = contexts_caption.split(',') if contexts_caption
  groups.each_with_index{|group, gi|
    if group
      suf1 = suf+'.'+group
      begin
        context_path = self['conf']["#{suf1}.context_path"]
        context_underline = self['conf']["#{suf1}.context_underline"]
#          property = proc{|_str, _suf| self['conf']["#{_suf}.#{_str}"]} 
#          property_to_eval = proc{|_str, _suf| 
#            p = self['conf']["#{_suf}.#{_str}"]
#            _self_on_eval.instance_eval(p) if p 
#          } 
        items = self['conf'][suf1].split(',')
        items.each{|item|
          suf2 = suf1+'.'+item
          disabled = !self['conf']["#{suf2}.disabled"].nil?
          iprops=Arcadia.conf_group(suf2)
          item_args = Hash.new
          iprops.each{|k,v|
            value = v.strip
            if value[0..0]=='!'
              item_args[k]=_self_on_eval.instance_eval(value[1..-1])  
            else
              item_args[k]=value
            end
          }
        #  item_args['caption'] = item if item_args['caption'].nil?
          item_args['name'] = item if item_args['name'].nil?
          item_args['context'] = group
          item_args['context_path'] = context_path
          item_args['context_caption'] = groups_caption[gi] if groups_caption
          item_args['context_underline'] = context_underline.strip.to_i if context_underline
          i = _user_control.new_item(self, item_args)
          i.enable=false if disabled
        }
      rescue Exception
        msg = "Loading #{groups} ->#{items} (#{$!.class.to_s} : #{$!.to_s} at : #{[email protected]_s})"
        if Arcadia.dialog(self, 
          'type'=>'ok_cancel', 
          'title' => '(Arcadia) Toolbar', 
          'msg'=>msg,
          'level'=>'error')=='cancel'
          raise
          exit
        else
          Tk.update
        end
      end
    end
  }
  
end

#on_quit(_event) ⇒ Object



111
112
113
# File 'lib/a-core.rb', line 111

def on_quit(_event)
  self.do_exit
end

#prepareObject



443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
# File 'lib/a-core.rb', line 443

def prepare
  super
  @splash.next_step('...initialize')  if @splash
  @splash.next_step  if @splash
  #self.load_libs
  @splash.next_step  if @splash
  @splash.next_step('... load extensions')  if @splash
  #load_config
  init_layout
  publish('buffers.code.in_memory',Hash.new)
  publish('action.load_code_from_buffers', proc{TkBuffersChoise.new})
  publish('output.action.run_last', proc{$arcadia['output'].run_last})
  publish('main.action.open_file', proc{self['editor'].open_file(Arcadia.open_file_dialog)})
  @splash.next_step('... load obj controller')  if @splash
  @splash.next_step('... load editor')  if @splash
  publish('main.action.new_file',proc{$arcadia['editor'].open_buffer()})
  @splash.next_step('... load actions')  if @splash
  #provvisorio 
  @keytest = KeyTest.new
  @keytest.on_close=proc{@keytest.hide}
  @keytest.hide
  @keytest.title("Keys test")
  publish('action.test.keys', proc{@keytest.show})
  publish('action.get.font', proc{Tk::BWidget::SelectFont::Dialog.new.create})
  @splash.next_step  if @splash
  publish('action.show_about', proc{ArcadiaAboutSplash.new.deiconify})
#    publish('main.menu', @main_menu)
  @main_menu = ArcadiaMainMenu.new(@main_menu_bar)
  self.do_build
  #publish('main.menu', ArcadiaMainMenu.new(@main_menu))
  @splash.next_step  if @splash
  publish('objic.action.raise_active_obj',
  proc{
      InspectorContract.instance.raise_active_toplevel(self)
  }
  )
  @splash.next_step('... toolbar buttons ')  if @splash
  #@main_toolbar.load_toolbar_buttons
  
  #load user controls
  #Arcadia control
  load_user_control(@main_menu)
  load_user_control(@main_toolbar)
  #Extension control
  @exts.each{|ext|
    @splash.next_step("... load #{ext} user controls ")  if @splash
    load_user_control(@main_menu, ext)
    load_user_control(@main_toolbar, ext)
  }
  load_user_control(@main_menu,"","e")
  load_user_control(@main_toolbar,"","e")
  #@layout.build_invert_menu
end

#register(_ext) ⇒ Object



115
116
117
# File 'lib/a-core.rb', line 115

def register(_ext)
  @exts_i << _ext
end

#save_layoutObject



585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
# File 'lib/a-core.rb', line 585

def save_layout
  self['conf']['geometry']= TkWinfo.geometry(@root)
  Arcadia.del_conf_group('layout')
  # resizing
  @exts_i.each{|e|
    found = false
    if e.conf('frames')
      frs = e.conf('frames').split(',') 
    else 
      frs = Array.new
    end
    frs.each_index{|i|
      if e.maximized?(i)
        self['conf']['layout.maximized']="#{e.conf('name')},#{i}"
        e.resize(i)
        found=true
        break
      end
    } 
    break if found
  }
  # layouts
  splits,doms,r,c = @layout.dump_geometry
  header = ""
  splits.each_index{|i|
    header << i.to_s
    header << ',' if i < splits.length-1
  }
  self['conf']['layout.split']= header
  splits.each_with_index{|sp,i|
    self['conf']["layout.split.#{i}"]=sp
  }
  # domains
  @exts_i.each{|e|
    if e.conf('frames')
      frs = e.conf('frames').split(',') 
    else 
      frs = Array.new
    end
    str_frames=''
    frs.each_index{|i|
      f = e.frame(i,false)
      if f
        ff = f.hinner_frame
        frame = ff.frame if ff
        if frame && TkWinfo.parent(frame).instance_of?(Tk::BWidget::NoteBook)
          frame=TkWinfo.parent(TkWinfo.parent(frame))
        elsif frame.nil?
          if str_frames.length > 0
            str_frames << ','
          end
          str_frames << '-1.-1'
        end
        if doms[frame]
          if str_frames.length > 0
            str_frames << ','
          end
          str_frames << doms[frame]
        end
      else
      end
    }
    if str_frames.length > 0
      self['conf']["#{e.conf('name')}.frames"]=str_frames
 #     p "#{e.conf('name')}.frames=#{str_frames}"
    end
  }
  # toolbar
  if @is_toolbar_show
    self['conf']['user_toolbar_show']='yes'
  else
    self['conf']['user_toolbar_show']='no'
  end
  
end

#set_sysdefaultpropertyObject



435
436
437
438
439
440
441
# File 'lib/a-core.rb', line 435

def set_sysdefaultproperty
  Tk.tk_call "eval","option add *background #{self['conf']['background']}"
  Tk.tk_call "eval","option add *foreground #{self['conf']['foreground']}"
  #Tk.tk_call "eval","option add *font #{self['conf']['font']}"
  Tk.tk_call "eval","option add *activebackground #{self['conf']['activebackground']}"
  Tk.tk_call "eval","option add *activeforeground #{self['conf']['activeforeground']}"
end

#show_hide_toolbarObject



119
120
121
122
123
124
125
126
127
128
129
# File 'lib/a-core.rb', line 119

def show_hide_toolbar
  if @is_toolbar_show
      @mf_root.show_toolbar(0,false)
      @is_toolbar_show = false
  else
      @mf_root.show_toolbar(0,true)
      Tk.update
      @is_toolbar_show = true
  end
    
end