Class: ArcadiaLayout

Inherits:
Object
  • Object
show all
Defined in:
lib/a-core.rb

Constant Summary collapse

HIDDEN_DOMAIN =
'-1.-1'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_arcadia, _frame, _autotab = true) ⇒ ArcadiaLayout

Returns a new instance of ArcadiaLayout.



2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
# File 'lib/a-core.rb', line 2580

def initialize(_arcadia, _frame, _autotab=true)
  @arcadia = _arcadia
  @frames = Array.new
  @frames[0] = Array.new
  @parent_frame = _frame
  @content_frame = TkFrame.new(_frame).pack('fill'=>'both', :padx=>0, :pady=>0, :expand => 'yes')
#    @dialog_frame = TkFrame.new(_frame)

  @frames[0][0] = @content_frame
  # @domains = Array.new
  # @domains[0] = Array.new
  # @domains[0][0] = '_domain_root_'
  
  
  @panels = Hash.new
  @panels['_domain_root_']= Hash.new
  @panels['_domain_root_']['root']= @content_frame
  @panels['_domain_root_']['sons'] = Hash.new
  @panels['_domain_root_'][:raised_stack] = []

  @panels['nil'] = Hash.new
  @panels['nil']['root'] = TkTitledFrameAdapter.new(self.root)
  @autotab = _autotab
  @headed = false
  @wrappers=Hash.new
  @splitters=Array.new
  @tabbed = Arcadia.conf('layout.tabbed')=='true'
end

Instance Attribute Details

#parent_frameObject (readonly)

include Observable

ArcadiaPanelInfo = Struct.new( "ArcadiaPanelInfo",
  :name,
  :title,
  :frame,
  :ffw
)


2578
2579
2580
# File 'lib/a-core.rb', line 2578

def parent_frame
  @parent_frame
end

Instance Method Details

#[](_row, _col) ⇒ Object



3762
3763
3764
# File 'lib/a-core.rb', line 3762

def [](_row, _col)
  @frames[_row][_col]
end

#add_cols(_row, _col, _width, _left_name = nil, _right_name = nil) ⇒ Object



2927
2928
2929
# File 'lib/a-core.rb', line 2927

def add_cols(_row,_col, _width, _left_name=nil, _right_name=nil)
  _prepare_cols(_row,_col, _width, false, _left_name, _right_name)
end

#add_cols_perc(_row, _col, _width, _left_name = nil, _right_name = nil) ⇒ Object



2931
2932
2933
# File 'lib/a-core.rb', line 2931

def add_cols_perc(_row,_col, _width, _left_name=nil, _right_name=nil)
  _prepare_cols(_row,_col, _width, true, _left_name, _right_name)
end

#add_cols_runtime(_domain) ⇒ Object



2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
# File 'lib/a-core.rb', line 2935

def add_cols_runtime(_domain)
  saved_root_splitted_frames = @panels[_domain]['root_splitted_frames']
  _saved = Hash.new
  _saved.update(@panels[_domain]['sons'])
  _saved.each_key{|name|
    @panels['nil']['root'].change_adapters(name, @panels[_domain]['root'].transient_frame_adapter[name])
  }
  geometry = TkWinfo.geometry(@panels[_domain]['root'])
  width = geometry.split('x')[0].to_i/2
  _saved.each{|name,ffw|
    unregister_panel(ffw, false, false)
  }
  unbuild_titled_frame(_domain)
  _row,_col = _domain.split('.')
  add_cols(_row.to_i,_col.to_i, width)
  build_titled_frame(_domain)
  build_titled_frame(domain_name(_row.to_i,_col.to_i+1))
  _saved.each{|name,ffw|
    ffw.domain = _domain
    register_panel(ffw, ffw.hinner_frame)
    @panels[_domain]['root'].change_adapters(name, @panels['nil']['root'].transient_frame_adapter[name])
  }
  if saved_root_splitted_frames
    @panels[_domain]['root_splitted_frames']=saved_root_splitted_frames
  end
  build_invert_menu(true)
end

#add_commons_menu_items(_domain, _menu) ⇒ Object



3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
# File 'lib/a-core.rb', line 3224

def add_commons_menu_items(_domain, _menu)
  _menu.insert('end', :separator)
  _menu.insert('end', :command,
  :label=>"add column",
  :image=>Arcadia.image_res(ADD_GIF),
  :compound=>'left',
  :command=>proc{add_cols_runtime(_domain)},
  :hidemargin => true
  )
  _menu.insert('end', :command,
  :label=>"add row",
  :image=>Arcadia.image_res(ADD_GIF),
  :compound=>'left',
  :command=>proc{add_rows_runtime(_domain)},
  :hidemargin => true
  )
  if @panels.keys.length > 2
    _menu.insert('end', :command,
    :label=>"close",
    :image=>Arcadia.image_res(CLOSE_FRAME_GIF),
    :compound=>'left',
    :command=>proc{close_runtime(_domain)},
    :hidemargin => true
    )
  end

end

#add_float_frame(_args = nil) ⇒ Object



3782
3783
3784
3785
3786
3787
3788
3789
3790
# File 'lib/a-core.rb', line 3782

def add_float_frame(_args=nil)
  if _args.nil?
    _args = {'x'=>10, 'y'=>10, 'width'=>100, 'height'=>100}
  end
  _frame =  TkFloatTitledFrame.new(root)
  _frame.on_close=proc{_frame.hide}
  _frame.place(_args)
  return _frame
end

#add_headersObject



3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
# File 'lib/a-core.rb', line 3309

def add_headers
  @panels.keys.each{|dom|
    if dom != '_domain_root_' && @panels[dom] && @panels[dom]['root']
      build_titled_frame(dom)
    end
  }

  #    @domains.each{|row|
  #      row.each{|domain|
  #        build_titled_frame(domain)
  #      }
  #    }
  @headed = true
end

#add_hinner_dialog(side = 'top', args = nil) ⇒ Object



3792
3793
3794
3795
# File 'lib/a-core.rb', line 3792

def add_hinner_dialog(side='top', args=nil)
  hd = HinnerDialog.new(side, args)
  return hd
end

#add_hinner_splitted_dialog(side = 'top', height = 100, args = nil) ⇒ Object



3797
3798
3799
3800
# File 'lib/a-core.rb', line 3797

def add_hinner_splitted_dialog(side='top', height=100, args=nil)
  hd = HinnerSplittedDialog.new(side, height, args)
  return hd
end

#add_hinner_splitted_dialog_titled(title = nil, side = 'top', height = 100, args = nil) ⇒ Object



3802
3803
3804
3805
# File 'lib/a-core.rb', line 3802

def add_hinner_splitted_dialog_titled(title=nil, side='top', height=100, args=nil)
  hd = HinnerSplittedDialogTitled.new(title, side, height, args)
  return hd
end

#add_mono_panel(_name = nil) ⇒ Object



2734
2735
2736
2737
2738
2739
2740
2741
# File 'lib/a-core.rb', line 2734

def add_mono_panel(_name=nil)
  if (@frames[0][0] !=  nil)
    _name = '0.0' if _name.nil?
    @panels[_name] = Hash.new
    @panels[_name]['root'] = @frames[0][0]
    @panels[_name]['sons'] = 	Hash.new
  end
end

#add_rows(_row, _col, _height, _top_name = nil, _bottom_name = nil) ⇒ Object



2743
2744
2745
# File 'lib/a-core.rb', line 2743

def add_rows(_row,_col, _height, _top_name=nil, _bottom_name=nil)
  _prepare_rows(_row,_col, _height, false, _top_name, _bottom_name)
end

#add_rows_perc(_row, _col, _height, _top_name = nil, _bottom_name = nil) ⇒ Object



2747
2748
2749
# File 'lib/a-core.rb', line 2747

def add_rows_perc(_row,_col, _height, _top_name=nil, _bottom_name=nil)
  _prepare_rows(_row,_col, _height, true, _top_name, _bottom_name)
end

#add_rows_runtime(_domain) ⇒ Object



2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
# File 'lib/a-core.rb', line 2963

def add_rows_runtime(_domain)
  saved_root_splitted_frames = @panels[_domain]['root_splitted_frames']
  _saved = Hash.new
  _saved.update(@panels[_domain]['sons'])
  _saved.each_key{|name|
    @panels['nil']['root'].change_adapters(name, @panels[_domain]['root'].transient_frame_adapter[name])
  }
  geometry = TkWinfo.geometry(@panels[_domain]['root'])
  height = geometry.split('+')[0].split('x')[1].to_i/2
  _saved.each{|name,ffw|
    unregister_panel(ffw, false, false)
  }
  unbuild_titled_frame(_domain)
  _row,_col = _domain.split('.')
  add_rows(_row.to_i,_col.to_i, height)
  build_titled_frame(_domain)
  build_titled_frame(domain_name(_row.to_i+1,_col.to_i))
  _saved.each{|name,ffw|
    ffw.domain = _domain
    register_panel(ffw, ffw.hinner_frame)
    @panels[_domain]['root'].change_adapters(name, @panels['nil']['root'].transient_frame_adapter[name])
  }
  if saved_root_splitted_frames
    @panels[_domain]['root_splitted_frames']=saved_root_splitted_frames
  end
  build_invert_menu(true)
end

#all_domains(_frame) ⇒ Object

def others_domains(_frame, _vertical=true)

    if _vertical
      splitter_adapter_class = AGTkVSplittedFrames
    else
      splitter_adapter_class = AGTkOSplittedFrames
    end
    splitted_adapter = find_splitted_frame(_frame)
    consider_it = splitted_adapter.instance_of?(splitter_adapter_class) && splitted_adapter.frame1 == _frame
    if splitted_adapter && !consider_it && splitted_adapter != _frame
       rif_frame = splitted_adapter.frame
       ret = others_domains(rif_frame)
    elsif splitted_adapter && consider_it
      ret = domains_on_frame(splitted_adapter.frame2)
    else
      ret = Array.new
    end
    ret
end


2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
# File 'lib/a-core.rb', line 2770

def all_domains(_frame)
  splitted_adapter = find_splitted_frame(_frame)
  consider_it = splitted_adapter.kind_of?(AGTkSplittedFrames)
  if consider_it
    ret = domains_on_frame(splitted_adapter.frame2).concat(domains_on_frame(splitted_adapter.frame1))
  else
    ret = Array.new
  end
  ret
end

#all_domains_cols(_frame) ⇒ Object



2781
2782
2783
2784
2785
2786
2787
2788
# File 'lib/a-core.rb', line 2781

def all_domains_cols(_frame)
  ret = Array.new
  all_domains(_frame).each{|d|
    v = d.split('.')[1]
    ret << v if !ret.include?(v)
  }
  ret
end

#all_domains_rows(_frame) ⇒ Object



2790
2791
2792
2793
2794
2795
2796
2797
# File 'lib/a-core.rb', line 2790

def all_domains_rows(_frame)
  ret = Array.new
  all_domains(_frame).each{|d|
    v = d.split('.')[0]
    ret << v if !ret.include?(v)
  }
  ret
end

#autotab?Boolean

Returns:

  • (Boolean)


3328
3329
3330
# File 'lib/a-core.rb', line 3328

def autotab?
  @autotab
end

#build_invert_menu(refresh_commons_items = false) ⇒ Object



3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
# File 'lib/a-core.rb', line 3533

def build_invert_menu(refresh_commons_items=false)
  #p " ***build_invert_menu"

  @panels.keys.each{|dom|
    if dom != '_domain_root_' && @panels[dom] && @panels[dom]['root']
      titledFrame = @panels[dom]['root']
      if titledFrame.instance_of?(TkTitledFrameAdapter)
        #menu = titledFrame.menu_button('ext').cget('menu')
        menu = titledFrame.title_menu
        if refresh_commons_items
          #@panels[dom]['root'].menu_button('ext').cget('menu').delete('0','end')
          @panels[dom]['root'].title_menu.delete('0','end')
          add_commons_menu_items(dom, menu)
        else
          index = menu.index('end').to_i
          if @tabbed
            if @panels.keys.length > 2
              i=index-4
            else
              i=index-3
            end
          else
            if @panels.keys.length > 2
              i=index-4
            else
              i=index-3
            end
          end
          if i >= 0
            end_index = i.to_s
            #@panels[dom]['root'].menu_button('ext').cget('menu').delete('0',end_index)
            @panels[dom]['root'].title_menu.delete('0',end_index)
          end
        end
        #          index = menu.index('end').to_i
        #          @panels[dom]['root'].menu_button('ext').cget('menu').delete('2','end') if index > 1
      end
    end
  }

  @wrappers.each{|name,ffw|
    process_frame(ffw) #if ffw.domain
  }

end

#build_titled_frame(domain) ⇒ Object

def title_titled_frame(_domain, _text)

  mb = @panels[_domain]['root'].menu_button('ext') if @panels[_domain]
  if mb
    #mb.configure('text'=>_text)
    mb.cget('textvariable').value=_text
    p "configuro #{_text}"
  end 
end


3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
# File 'lib/a-core.rb', line 3261

def build_titled_frame(domain)
  if @panels[domain]
    tframe = TkTitledFrameAdapter.new(@panels[domain]['root']).place('x'=>0, 'y'=>0,'relheight'=>1, 'relwidth'=>1)
#      mb = tframe.add_fixed_menu_button('ext')

#      mb = tframe.add_fixed_menu_button(
#        'ext',
#        nil,
#        'left',
#      {'relief'=>:flat, 
#       'borderwidth'=>1, 
#       'compound'=> 'left',
#       'anchor'=>'w',
#       'activebackground'=>Arcadia.conf('titlelabel.background'),
#       'foreground' => Arcadia.conf('titlecontext.foreground'),
#       'textvariable'=> TkVariable.new('')
#       })

    # add commons item
#      menu = mb.cget('menu')
    menu = tframe.title_menu
    add_commons_menu_items(domain, menu)
    @panels[domain]['root']= tframe
    #-----------------------------------
    #      class << tframe
    #        def set_domain(_domain)
    #          if @label_domain.nil?
    #            @label_domail = TkLabel.new(self.frame, 'text'=>_domain).pack
    #          else
    #            @label_domain.configure('text'=>_domain)
    #          end
    #        end
    #      end
    #      tframe.set_domain(domain)
    #-----------------------------------
  end
end

#change_domain(_target_domain, _source_name) ⇒ Object



3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
# File 'lib/a-core.rb', line 3336

def change_domain(_target_domain, _source_name)
  source_domain = @wrappers[_source_name].domain
  source_has_domain = !source_domain.nil?
  if @arcadia.conf('layout.exchange_panel_if_no_tabbed')=='true' && source_has_domain && @panels[source_domain]['sons'].length == 1 && @panels[_target_domain]['sons'].length > 0
    # change ------
    ffw1 = raised_fixed_frame(_target_domain)
    ffw2 = @panels[source_domain]['sons'].values[0]
    unregister_panel(ffw1,false,false) if ffw1
    unregister_panel(ffw2,false,false)
    ffw1.domain = source_domain if ffw1
    ffw2.domain = _target_domain
    register_panel(ffw1, ffw1.hinner_frame) if ffw1
    register_panel(ffw2, ffw2.hinner_frame)
    @panels[_target_domain]['root'].save_caption(ffw2.name, @panels[source_domain]['root'].last_caption(ffw2.name), @panels[source_domain]['root'].last_caption_image(ffw2.name))
    @panels[source_domain]['root'].save_caption(ffw1.name, @panels[_target_domain]['root'].last_caption(ffw1.name), @panels[_target_domain]['root'].last_caption_image(ffw1.name))
    @panels[_target_domain]['root'].restore_caption(ffw2.name)
     @panels[source_domain]['root'].restore_caption(ffw1.name)
    @panels[_target_domain]['root'].change_adapters(ffw2.name, @panels[source_domain]['root'].forge_transient_adapter(ffw2.name))
    @panels[source_domain]['root'].change_adapters(ffw1.name, @panels[_target_domain]['root'].forge_transient_adapter(ffw1.name))
  elsif source_has_domain && @panels[source_domain]['sons'].length >= 1
    ffw2 = @panels[source_domain]['sons'][_source_name]
    unregister_panel(ffw2, false, false)
    ffw2.domain = _target_domain
    register_panel(ffw2, ffw2.hinner_frame)
    @panels[_target_domain]['root'].save_caption(ffw2.name, @panels[source_domain]['root'].last_caption(ffw2.name), @panels[source_domain]['root'].last_caption_image(ffw2.name))
    @panels[_target_domain]['root'].restore_caption(ffw2.name)
    @panels[_target_domain]['root'].change_adapters(ffw2.name, @panels[source_domain]['root'].forge_transient_adapter(ffw2.name))
    #Tk.event_generate(ffw2.hinner_frame, "Map")
  elsif !source_has_domain
    ffw2 = @wrappers[_source_name]
    ffw2.domain = _target_domain
    register_panel(ffw2, ffw2.hinner_frame)
    if @panels['nil']['root'].transient_frame_adapter[ffw2.name]
      @panels[ffw2.domain]['root'].change_adapters(ffw2.name, @panels['nil']['root'].transient_frame_adapter[ffw2.name])
    end
    #@panels[_target_domain]['root'].top_text('')
  end
  # refresh -----
  build_invert_menu
  Tk.update
  LayoutChangedDomainEvent.new(self, 'old_domain'=>source_domain, 'new_domain'=>_target_domain).go!
end

#close_runtime(_domain) ⇒ Object



3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
# File 'lib/a-core.rb', line 3122

def close_runtime(_domain)
  splitted_adapter = find_splitted_frame(@panels[_domain]['root'])
  splitted_adapter_frame = splitted_adapter.frame
  vertical = splitted_adapter.instance_of?(AGTkVSplittedFrames)
  _row, _col = _domain.split('.')
  if @frames[_row.to_i][_col.to_i] == splitted_adapter.frame1
    other_ds = domains_on_frame(@panels[_domain]['splitted_frames'].frame2)
  elsif @frames[_row.to_i][_col.to_i] == splitted_adapter.frame2
    other_ds = domains_on_frame(@panels[_domain]['splitted_frames'].frame1)
  end

  return if other_ds.nil?


  if other_ds.length == 1
    other_domain = other_ds[0]
  elsif other_ds.length > 1
    max = other_ds.length-1
    j = 0
    while j <= max
      if other_domain.nil?
        other_domain = other_ds[j]
      else
        r,c = other_domain.split('.')
        new_r,new_c = other_ds[j].split('.')
        if new_r.to_i < r.to_i || new_r.to_i == r.to_i && new_c.to_i < c.to_i
          other_domain = other_ds[j]
        end
      end
      j = j+1
    end
  end
  _other_row, _other_col = other_domain.split('.')
  @panels[_domain]['sons'].each{|name,ffw|
    unregister_panel(ffw, false, false)
  }
  unbuild_titled_frame(_domain)

  if @panels[other_domain]['splitted_frames'] != @panels[_domain]['splitted_frames']
    if @panels[other_domain]['root_splitted_frames'].frame == @panels[_domain]['splitted_frames'].frame1 || @panels[other_domain]['root_splitted_frames'].frame == @panels[_domain]['splitted_frames'].frame2
      other_root_splitted_adapter = @panels[other_domain]['root_splitted_frames']
    elsif @panels[other_domain]['splitted_frames']
      other_root_splitted_adapter = @panels[other_domain]['splitted_frames']
    end
  end

  @panels.delete(_domain)
  @frames[_row.to_i][_col.to_i] = nil
  # @domains[_row.to_i][_col.to_i] = nil

  if other_root_splitted_adapter
    if other_root_splitted_adapter != @panels[other_domain]['splitted_frames']
      other_ds.each{|d|
        if @panels[d]['root_splitted_frames'] == splitted_adapter
          @panels[d]['root_splitted_frames']=other_root_splitted_adapter
        end
      }
    end
    other_root_splitted_adapter.detach_frame
    splitted_adapter.detach_frame
    @splitters.delete(splitted_adapter)
    splitted_adapter.destroy
    other_root_splitted_adapter.attach_frame(splitted_adapter_frame)
  else
    other_source_save = Hash.new
    other_source_save.update(@panels[other_domain]['sons']) if @panels[other_domain]
    other_source_save.each_key{|name|
      @panels['nil']['root'].change_adapters(name, @panels[other_domain]['root'].transient_frame_adapter[name])
    }
    other_source_save.each{|name,ffw|
      unregister_panel(ffw, false, false)
    }
    splitted_adapter.detach_frame
    splitted_adapter.destroy
    @panels[other_domain]['root']=splitted_adapter_frame
    @frames[_other_row.to_i][_other_col.to_i] = splitted_adapter_frame
    build_titled_frame(other_domain)
    other_source_save.each{|name,ffw|
      ffw.domain = other_domain
      register_panel(ffw, ffw.hinner_frame)
      @panels[other_domain]['root'].change_adapters(name, @panels['nil']['root'].transient_frame_adapter[name])
    }
    parent_splitted_adapter = find_splitted_frame(@panels[other_domain]['root'])
    if  parent_splitted_adapter
      @panels[other_domain]['splitted_frames']=parent_splitted_adapter
    else
      @panels[other_domain]['splitted_frames']= nil
    end
  end
  build_invert_menu(true)
end

#domain(_domain_name) ⇒ Object

def domain_for_frame(_domain_name, _name)

  domain(@panels[_domain_name]['sons'][_name].domain)
end


3774
3775
3776
# File 'lib/a-core.rb', line 3774

def domain(_domain_name)
  @panels[_domain_name]
end

#domain_name(_row, _col) ⇒ Object



2837
2838
2839
# File 'lib/a-core.rb', line 2837

def domain_name(_row,_col)
  _row.to_s+'.'+_col.to_s
end

#domain_root_frame(_domain_name) ⇒ Object



3778
3779
3780
# File 'lib/a-core.rb', line 3778

def domain_root_frame(_domain_name)
  @panels[_domain_name]['root'].frame
end

#domainsObject



3299
3300
3301
3302
3303
3304
3305
3306
3307
# File 'lib/a-core.rb', line 3299

def domains
  ret = Array.new
  @panels.keys.each{|dom|
    if dom != '_domain_root_' && @panels[dom] && @panels[dom]['root']
      ret << dom
    end
  }
  ret
end

#domains_cols(_domains) ⇒ Object



3037
3038
3039
3040
3041
3042
3043
3044
# File 'lib/a-core.rb', line 3037

def domains_cols(_domains)
  ret = Array.new
  _domains.each{|d|
    v = d.split('.')[1]
    ret << v if !ret.include?(v)
  }
  ret
end

#domains_on_frame(_frame) ⇒ Object



3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
# File 'lib/a-core.rb', line 3078

def domains_on_frame(_frame)
  ret_doms = Array.new
  frame_found = false
  @panels.keys.each{|dom|
    if dom != '_domain_root_'
      if (@panels[dom]['splitted_frames'] != nil && @panels[dom]['splitted_frames'].frame == _frame) || (@panels[dom]['root_splitted_frames'] != nil && @panels[dom]['root_splitted_frames'].frame  == _frame)
        ret_doms.concat(domains_on_frame(@panels[dom]['splitted_frames'].frame1))
        ret_doms.concat(domains_on_frame(@panels[dom]['splitted_frames'].frame2))
        frame_found = true
        break
      elsif @panels[dom]['notebook'] != nil
        cfrs = TkWinfo.children(_frame)
        if cfrs && cfrs.length == 1 && cfrs[0].instance_of?(TkTitledFrameAdapter) && TkWinfo.parent(@panels[dom]['notebook'])== cfrs[0].frame
          ret_doms << dom
          frame_found = true
        end
      elsif @panels[dom]['root'].instance_of?(TkTitledFrameAdapter) && @panels[dom]['root'].parent == _frame
        ret_doms << dom
        frame_found = true
      end
    end
  }

  if !frame_found
    cfrs = TkWinfo.children(_frame)
    if cfrs && cfrs.length == 1 && cfrs[0].instance_of?(TkTitledFrameAdapter)
      @wrappers.each{|name, ffw|
        if ffw.hinner_frame.frame == cfrs[0].frame
          ret_doms << ffw.domain
        end
      }
    end
  end
  ret_doms
end

#domains_on_frame_cols(_frame) ⇒ Object



3047
3048
3049
3050
3051
3052
3053
3054
# File 'lib/a-core.rb', line 3047

def domains_on_frame_cols(_frame)
  ret = Array.new
  domains_on_frame(_frame).each{|d|
    v = d.split('.')[1]
    ret << v if !ret.include?(v)
  }
  ret
end

#domains_on_frame_rows(_frame) ⇒ Object



2991
2992
2993
2994
2995
2996
2997
2998
# File 'lib/a-core.rb', line 2991

def domains_on_frame_rows(_frame)
  ret = Array.new
  domains_on_frame(_frame).each{|d|
    v = d.split('.')[0]
    ret << v if !ret.include?(v)
  }
  ret
end

#domains_on_splitter(_splitter) ⇒ Object



3056
3057
3058
# File 'lib/a-core.rb', line 3056

def domains_on_splitter(_splitter)
  domains_on_frame(_splitter.frame1).concat(domains_on_frame(_splitter.frame2))
end

#domains_on_splitter_cols(_splitter) ⇒ Object



3060
3061
3062
3063
3064
3065
3066
3067
# File 'lib/a-core.rb', line 3060

def domains_on_splitter_cols(_splitter)
  ret = Array.new
  domains_on_splitter(_splitter).each{|d|
    v = d.split('.')[1]
    ret << v if !ret.include?(v)
  }
  ret
end

#domains_on_splitter_rows(_splitter) ⇒ Object



3069
3070
3071
3072
3073
3074
3075
3076
# File 'lib/a-core.rb', line 3069

def domains_on_splitter_rows(_splitter)
  ret = Array.new
  domains_on_splitter(_splitter).each{|d|
    v = d.split('.')[0]
    ret << v if !ret.include?(v)
  }
  ret
end

#domains_rows(_domains) ⇒ Object



3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
# File 'lib/a-core.rb', line 3000

def domains_rows(_domains)
  ret = Array.new
  if _domains
    _domains.each{|d|
      v = d.split('.')[0]
      ret << v if !ret.include?(v)
    }
  end
  ret
end

#dump_geometry(_r = 0, _c = 0, _frame = root) ⇒ Object



3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
# File 'lib/a-core.rb', line 3890

def dump_geometry(_r=0,_c=0,_frame=root)
  spl = Array.new
  dom = Hash.new
  ret = [nil,nil,nil,nil]
  sp = splitter_frame_on_frame(_frame)
  if sp
    spl << "#{domain_name(_r,_c)}#{dump_splitter(sp)}"
    dom[get_hinner_frame(sp.frame1)]=domain_name(_r,_c)
    sspl,ddom,rr,cc = dump_geometry(_r, _c, sp.frame1)
    spl.concat(sspl)
    dom.update(ddom)
    if sp.instance_of?(AGTkVSplittedFrames)
      _c=cc+1
      _c=gap_domain_column(_r,_c,dom)
    else
      _r=rr+1
      _r=gap_domain_row(_r,_c,dom)
    end
    dom[get_hinner_frame(sp.frame2)]=domain_name(_r,_c)
    sspl,ddom,rr,cc = dump_geometry(_r, _c, sp.frame2)
    spl.concat(sspl)
    dom.update(ddom)
  elsif _frame==root
    dom[get_hinner_frame(root)]=domain_name(_r,_c)
  end
  ret[0]=spl
  ret[1]=dom
  ret[2]=_r
  ret[3]=_c
  ret
end

#dump_splitter(_splitter) ⇒ Object



3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
# File 'lib/a-core.rb', line 3807

def dump_splitter(_splitter)
  ret = ''
  if  _splitter.instance_of?(AGTkVSplittedFrames)
    w = TkWinfo.width(_splitter.frame1)
    ret = "c#{w}"
  elsif _splitter.instance_of?(AGTkOSplittedFrames)
    h = TkWinfo.height(_splitter.frame1)
    ret = "r#{h}"
  end
  ret
end

#find_splitted_frame(_start_frame) ⇒ Object



3114
3115
3116
3117
3118
3119
3120
# File 'lib/a-core.rb', line 3114

def find_splitted_frame(_start_frame)
  splitted_frame = _start_frame
  while splitted_frame != nil && !splitted_frame.kind_of?(AGTkSplittedFrames)
    splitted_frame = TkWinfo.parent(splitted_frame)
  end
  splitted_frame
end

#frame(_domain_name, _name) ⇒ Object



3766
3767
3768
# File 'lib/a-core.rb', line 3766

def frame(_domain_name, _name)
  @panels[_domain_name]['sons'][_name].hinner_frame
end

#gap_domain_column(_r, _c, _dom) ⇒ Object



3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
# File 'lib/a-core.rb', line 3867

def gap_domain_column(_r,_c,_dom)
  ret = _c
  Hash.new.update(_dom).each{|k,d|
    dr,dc=d.split('.')
    if dc.to_i == _c && dr.to_i == _r
      ret = gap_domain_column(_r,dc.to_i+1,_dom)
    end
  }
  ret
end

#gap_domain_row(_r, _c, _dom) ⇒ Object



3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
# File 'lib/a-core.rb', line 3878

def gap_domain_row(_r,_c,_dom)
  ret = _r
  Hash.new.update(_dom).each{|k,d|
    dr,dc=d.split('.')
    if dr.to_i == _r && dc.to_i == _c
      ret = gap_domain_row(dr.to_i+1,_c,_dom)
    end
  }
  ret
end

#get_hinner_frame(_frame) ⇒ Object



3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
# File 'lib/a-core.rb', line 3830

def get_hinner_frame(_frame)
  ret = _frame
  #    child = TkWinfo.children(_frame)[0]
  TkWinfo.children(_frame).each{|child|
    if child.instance_of?(TkTitledFrameAdapter)
      ret = child.frame
      break
    end
  }
  #    if child.instance_of?(TkTitledFrame)
  #      ret = child.frame
  #    end
  ret
end

#headed?Boolean

Returns:

  • (Boolean)


3324
3325
3326
# File 'lib/a-core.rb', line 3324

def headed?
  @headed
end

#hide_panel(_domain, _extension) ⇒ Object



3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
# File 'lib/a-core.rb', line 3746

def hide_panel(_domain, _extension)
  pan = @panels[_domain]
  if @tabbed
    if pan && pan['notebook'] != nil
      pan['notebook'].unpack
    end
  elsif pan
    pan['sons'].each{|k,v|
      if k == _extension
        v.hide
        break
      end
    }
  end
end

#max_col(_domains, _row) ⇒ Object



3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
# File 'lib/a-core.rb', line 3011

def max_col(_domains, _row)
  ret = 0
  if _domains
    _domains.each{|d|
      r,c = d.split('.')
      if r.to_i == _row && c.to_i > ret
        ret = c.to_i
      end
    }
  end
  ret
end

#max_row(_domains, _col) ⇒ Object



3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
# File 'lib/a-core.rb', line 3024

def max_row(_domains, _col)
  ret = 0
  if _domains
    _domains.each{|d|
      r,c = d.split('.')
      if c.to_i == _col && r.to_i > ret
        ret = r.to_i
      end
    }
  end
  ret
end


3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
# File 'lib/a-core.rb', line 3415

def menu_item_add(_menu, _dom, _ffw, _is_plus=false)
  if !menu_item_exist?(_menu, _ffw.title)
    ind = sorted_menu_index(_menu, _ffw.title)
    if _is_plus
      if Arcadia.extension(_ffw.name).main_instance? 
        submenu_title = _ffw.title
      else
        submenu_title = Arcadia.extension(_ffw.name).main_instance.frame_title
      end
      submenu = nil
      newlabel = "New ..."
      if menu_item_exist?(_menu, submenu_title)
        submenu = ArcadiaMainMenu.sub_menu(_menu, submenu_title)
      end
      if submenu.nil?
      
        #submenu = TkMenu.new(
        submenu = Arcadia.wf.menu(
          :parent=>_menu,
          :tearoff=>0,
          :title => submenu_title
        )
        #submenu.extend(TkAutoPostMenu)
        #submenu.configure(Arcadia.style('menu'))
        _menu.insert(ind,
          :cascade,
          :image=>Arcadia.image_res(ARROW_LEFT_GIF),
          :label=>submenu_title,
          :compound=>'left',
          :menu=>submenu,
          :hidemargin => false
        )
        submenu.insert('end',:command,
          :label=>newlabel,
          :image=>Arcadia.image_res(STAR_EMPTY_GIF),
          :compound=>'left',
          :command=>proc{Arcadia.extension(_ffw.name).main_instance.duplicate(nil, _dom)},
          :hidemargin => true
        )
      end
      submenu.insert(newlabel,:command,
        :label=>_ffw.title,
        :image=>Arcadia.image_res(ARROW_LEFT_GIF),
        :compound=>'left',
        :command=>proc{change_domain(_dom, _ffw.name)},
        :hidemargin => true
      )

    else
        _menu.insert(ind,:command,
        :label=>_ffw.title,
        :image=>Arcadia.image_res(ARROW_LEFT_GIF),
        :compound=>'left',
        :command=>proc{change_domain(_dom, _ffw.name)},
        :hidemargin => true
      )
    end
  end
end

Returns:

  • (Boolean)


3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
# File 'lib/a-core.rb', line 3397

def menu_item_exist?(_menu, _name)
  exist = false
  i_end = _menu.index('end')
  if i_end
    0.upto(i_end){|j|
      type = _menu.menutype(j)
      if type != 'separator'
        value = _menu.entrycget(j,'label').to_s
        if value == _name
          exist = true
          break
        end
      end
    }
  end
  exist
end

#process_frame(_ffw) ⇒ Object



3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
# File 'lib/a-core.rb', line 3475

def process_frame(_ffw)
  #p "process frame #{_ffw.title}"
  #-------
  is_plus = Arcadia.extension(_ffw.name).kind_of?(ArcadiaExtPlus)
  #-------
  @panels.keys.each{|dom|
    if  dom != '_domain_root_' && dom != _ffw.domain && @panels[dom] && @panels[dom]['root']
      titledFrame = @panels[dom]['root']
      if titledFrame.instance_of?(TkTitledFrameAdapter)
        #menu = @panels[dom]['root'].menu_button('ext').cget('menu')
        menu = titledFrame.title_menu
        menu_item_add(menu, dom, _ffw, is_plus)
      end
    end
  }
  if @panels[_ffw.domain]
    titledFrame = @panels[_ffw.domain]['root']
    if titledFrame.instance_of?(TkTitledFrameAdapter)
      #titledFrame.menu_button('ext').text("#{_ffw.title}::")
      #mymenu = titledFrame.menu_button('ext').cget('menu')
      mymenu = titledFrame.title_menu
      index = mymenu.index('end').to_i
      if @panels.keys.length > 2
        i=index-3
      else
        i=index-2
      end
      if i >= 0
        index = i.to_s
      end
      clabel = "close \"#{_ffw.title}\"" 
      if @tabbed
        if !menu_item_exist?(mymenu, clabel)
          mymenu.insert(index,:command,
          :label=> clabel,
          :image=>Arcadia.image_res(CLOSE_FRAME_GIF),
          :compound=>'left',
          :command=>proc{unregister_panel(_ffw, false, true)},
          :hidemargin => true
          )
        end
      else
         if !menu_item_exist?(mymenu, clabel)
           mymenu.insert(index,:command,
             :label=> clabel,
             :image=>Arcadia.image_res(CLOSE_FRAME_GIF),
             :compound=>'left',
             :command=>proc{unregister_panel(_ffw, false, true)},
             :hidemargin => true
           )
         end
         menu_item_add(mymenu, _ffw.domain, _ffw, is_plus)
      end
    end
  end

end

#raise_panel(_domain, _extension) ⇒ Object



2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
# File 'lib/a-core.rb', line 2621

def raise_panel(_domain, _extension)
  p = @panels[_domain]
  if p
    #p[:raised_name]=_extension
    p[:raised_stack].delete(_extension)
    p[:raised_stack] << _extension
  end
  if @tabbed
    if p && p['notebook'] != nil
      p['notebook'].raise(_extension)
      p['notebook'].see(_extension)
    end
  elsif p
    p['sons'].each{|k,v|
      if k == _extension
        v.hinner_frame.raise
        #title_titled_frame(_domain, v.title)
        p['root'].title(v.title)
        p['root'].restore_caption(k)
        p['root'].change_adapters_name(k)
        Arcadia.process_event(LayoutRaisingFrameEvent.new(self,'extension_name'=>k, 'frame_name'=>p['sons'][k].name))
        break
      end
    }
  end
end

#raised?(_domain, _name) ⇒ Boolean

def raise_panel(_domain_name, _name)

  @panels[_domain_name]['notebook'].raise(_name) if @panels[_domain_name] && @panels[_domain_name]['notebook']
end

Returns:

  • (Boolean)


2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
# File 'lib/a-core.rb', line 2652

def raised?(_domain, _name)
  ret = true
  p = @panels[_domain]
  if @tabbed
    if p && p['notebook'] != nil
      ret=p['notebook'].raise == _name
    end
  else
    #ret = @panels[_domain][:raised_name] == _name
    ret = raised_name(_domain) == _name
  end
  ret
end

#raised_fixed_frame(_domain) ⇒ Object



2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
# File 'lib/a-core.rb', line 2666

def raised_fixed_frame(_domain)
  ret = nil
  p = @panels[_domain]
  if @tabbed
    if p && p['notebook'] != nil
      raised_name=p['notebook'].raise
      @panels[_domain]['sons'].each{|k,v|
        if raised_name == k
          ret = v
          break
        end
      }
    elsif @panels[_domain]['sons'].length == 1
      ret = @panels[_domain]['sons'].values[0]
    end
  else
    p['sons'].each{|k,v|
      #        if k == @panels[_domain][:raised_name]
      if k == raised_name(_domain)
        ret = v
        break
      end
    }
  end
  ret
end

#raised_name(_domain) ⇒ Object



2613
2614
2615
2616
2617
2618
2619
# File 'lib/a-core.rb', line 2613

def raised_name(_domain)
  ret = nil
  if @panels[_domain] && @panels[_domain][:raised_stack] && @panels[_domain][:raised_stack].length > 0
    ret = @panels[_domain][:raised_stack][-1]
  end
  ret
end

#registed?(_domain_name, _name) ⇒ Boolean

Returns:

  • (Boolean)


3332
3333
3334
# File 'lib/a-core.rb', line 3332

def registed?(_domain_name, _name)
  @panels[_domain_name]['sons'][_name] != nil
end

#register_panel(_ffw, _adapter = nil) ⇒ Object



3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
# File 'lib/a-core.rb', line 3583

def register_panel(_ffw, _adapter=nil)
  #p " > register_panel #{_ffw.title} _adapter #{_adapter}"
  _domain_name = _ffw.domain
  _name = _ffw.name
  _title = _ffw.title
  pan = @panels[_domain_name]
  @wrappers[_name]=_ffw
  if pan!=nil
    num = pan['sons'].length
    if @headed
      root_frame = pan['root'].frame
      #title_titled_frame(_domain_name, _title)
      pan['root'].title(_title)
      pan['root'].restore_caption(_name)
      pan['root'].change_adapters_name(_name)
      if !root_frame.instance_of?(TkFrameAdapter) && num==0
        if _adapter
          adapter = _adapter
        else
          adapter = TkFrameAdapter.new(self.root)
        end
        adapter.attach_frame(root_frame)
        adapter.raise
      end
    else
      root_frame = pan['root']
    end
    #@panels[_domain_name][:raised_name]=_name
    @panels[_domain_name][:raised_stack] = [] if @panels[_domain_name][:raised_stack].nil?
    @panels[_domain_name][:raised_stack] << _name
    if @tabbed
      if (num == 0 && @autotab)
        pan['sons'][_name] = _ffw
        process_frame(_ffw)
        return adapter
      else
        if num == 1 && @autotab &&  pan['notebook'] == nil
          pan['notebook'] = Tk::BWidget::NoteBook.new(root_frame, Arcadia.style('titletabpanel')){
            tabbevelsize 0
            internalborderwidth 0
            pack('fill'=>'both', :padx=>0, :pady=>0, :expand => 'yes')
          }
          api = pan['sons'].values[0]
          api_tab_frame = pan['notebook'].insert('end',
          api.name,
          'text'=>api.title,
          'raisecmd'=>proc{
            #title_titled_frame(_domain_name, api.title)
            pan['root'].title(api.title)
            pan['root'].restore_caption(api.name)
            pan['root'].change_adapters_name(api.name)
            Arcadia.process_event(LayoutRaisingFrameEvent.new(self,'extension_name'=>pan['sons'][api.name].extension_name, 'frame_name'=>pan['sons'][api.name].name))
          }
          )
          adapter = api.hinner_frame
          adapter.detach_frame
          adapter.attach_frame(api_tab_frame)
          api.hinner_frame.raise
        elsif (num==0 && !@autotab)
          pan['notebook'] = Tk::BWidget::NoteBook.new(root_frame, Arcadia.style('titletabpanel')){
            tabbevelsize 0
            internalborderwidth 0
            pack('fill'=>'both', :padx=>0, :pady=>0, :expand => 'yes')
          }
        end
        _panel = pan['notebook'].insert('end',_name ,
        'text'=>_title,
        'raisecmd'=>proc{
          #title_titled_frame(_domain_name, _title)
          pan['root'].title(_title)
          pan['root'].restore_caption(_name)
          pan['root'].change_adapters_name(_name)
          Arcadia.process_event(LayoutRaisingFrameEvent.new(self,'extension_name'=>_ffw.extension_name, 'frame_name'=>_ffw.name))
        }
        )
        if _adapter
          adapter = _adapter
        else
          adapter = TkFrameAdapter.new(self.root)
        end
        adapter.attach_frame(_panel)
        adapter.raise
        _panel=adapter
        pan['sons'][_name] = _ffw
        pan['notebook'].raise(_name)
        process_frame(_ffw)
        return _panel
      end
    else
      # not tabbed
      pan['sons'][_name] = _ffw
      process_frame(_ffw)
      if adapter.nil?
        if _adapter
          adapter = _adapter
        else
          adapter = TkFrameAdapter.new(self.root)
        end
      end
      adapter.attach_frame(root_frame)
      adapter.raise
      #        pan['sons'].each{|k,v|
      #          if k != _name
      #            unregister_panel(v,false)
      #          end
      #        }
      return adapter
    end
  else
    _ffw.domain = nil
    process_frame(_ffw)
    return TkFrameAdapter.new(self.root)
  end
end

#registered_panel?(_ffw) ⇒ Boolean

Returns:

  • (Boolean)


3579
3580
3581
# File 'lib/a-core.rb', line 3579

def registered_panel?(_ffw)
  _ffw.domain.nil? || _ffw.domain.length == 0 ?false:registed?(_ffw.domain, _ffw.name)
end

#rootObject



2609
2610
2611
# File 'lib/a-core.rb', line 2609

def root
  @panels['_domain_root_']['root']
end

#shift_bottom(_row, _col) ⇒ Object



2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
# File 'lib/a-core.rb', line 2903

def shift_bottom(_row, _col)
  d = domain_name(_row+1, _col)
  dj = domain_name(_row, _col)
  if @panels[d] !=nil
    shift_bottom(_row+1,_col)
  end
  @panels[d] = @panels[dj]
  #-------------------------------
  #@panels[d]['root'].set_domain(d)
  #-------------------------------
  @panels[d]['sons'].each{|name,ffw| ffw.domain=d}
  if @frames[_row + 1] == nil
    @frames[_row + 1] = Array.new
    #	@domains[_row + 1] = Array.new
  end
  @frames[_row+1][_col] = @frames[_row][_col]
  # @domains[_row+1][_col] = @domains[_row][_col]

  @panels.delete(dj)
  #@panels[dj] = nil
  @frames[_row][_col] = nil
  # @domains[_row][_col] = nil
end

#shift_domain_column(_r, _c, _dom) ⇒ Object



3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
# File 'lib/a-core.rb', line 3845

def shift_domain_column(_r,_c,_dom)
  Hash.new.update(_dom).each{|k,d|
    dr,dc=d.split('.')
    if dc.to_i >= _c && dr.to_i == _r
      #shift_domain_column(_r,dc.to_i+1,_dom)
      #p "== #{d} --> #{domain_name(_r,dc.to_i+1)}"
      _dom[k]= domain_name(_r,dc.to_i+1)
    end
  }
end

#shift_domain_row(_r, _c, _dom) ⇒ Object



3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
# File 'lib/a-core.rb', line 3856

def shift_domain_row(_r,_c,_dom)
  Hash.new.update(_dom).each{|k,d|
    dr,dc=d.split('.')
    if dr.to_i >= _r && dc.to_i == _c
      #shift_domain_row(dr.to_i+1,_c,_dom)
      #p "shift_domain_row == #{d} --> #{domain_name(dr.to_i+1,_c)}"
      _dom[k]=domain_name(dr.to_i+1,_c)
    end
  }
end

#shift_left(_row, _col) ⇒ Object



2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
# File 'lib/a-core.rb', line 2861

def shift_left(_row,_col)
  d = domain_name(_row, _col)
  dj = domain_name(_row, _col+1)
  if @panels[dj] !=nil
    @panels[d] = @panels[dj]
    #-------------------------------
    #@panels[d]['root'].set_domain(d)
    #-------------------------------
    @panels[d]['sons'].each{|name,ffw| ffw.domain=d}
    @frames[_row][_col] = @frames[_row][_col+1]
    # @domains[_row][_col] = @domains[_row][_col+1]

    @panels.delete(dj) # = nil
    @frames[_row][_col+1] = nil
    # @domains[_row][_col+1] = nil
    shift_left(_row,_col+1)
  end

end

#shift_right(_row, _col) ⇒ Object



2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
# File 'lib/a-core.rb', line 2841

def shift_right(_row,_col)
  d = domain_name(_row, _col+1)
  dj = domain_name(_row, _col)
  if @panels[d] !=nil
    shift_right(_row,_col+1)
  end
  @panels[d] = @panels[dj]
  #-------------------------------
  #@panels[d]['root'].set_domain(d)
  #-------------------------------
  @panels[d]['sons'].each{|name,ffw| ffw.domain=d}
  @frames[_row][_col+1] = @frames[_row][_col]
  # @domains[_row][_col+1] = @domains[_row][_col]

  @panels.delete(dj)
  #@panels[dj] = nil
  @frames[_row][_col] = nil
  # @domains[_row][_col] = nil
end

#shift_top(_row, _col) ⇒ Object



2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
# File 'lib/a-core.rb', line 2881

def shift_top(_row,_col)
  d = domain_name(_row, _col)
  dj = domain_name(_row+1, _col)
  if @panels[dj] !=nil
    @panels[d] = @panels[dj]
    #-------------------------------
    #@panels[d]['root'].set_domain(d)
    #-------------------------------
    @panels[d]['sons'].each{|name,ffw| ffw.domain=d}
    @frames[_row][_col] = @frames[_row+1][_col]
    # @domains[_row][_col] = @domains[_row+1][_col]

    @panels.delete(dj) # = nil
    @frames[_row+1][_col] = nil
    # @domains[_row+1][_col] = nil

    shift_top(_row+1,_col)
  end

end

#sorted_menu_index(_menu, _label) ⇒ Object



3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
# File 'lib/a-core.rb', line 3379

def sorted_menu_index(_menu, _label)
  index = '0'
  i_end = _menu.index('end').to_i - 4
  if i_end && i_end > 0
    0.upto(i_end){|j|
      type = _menu.menutype(j)
      if type != 'separator'
        value = _menu.entrycget(j,'label').to_s
        if value > _label
          index=j
          break
        end
      end
    }
  end
  index
end

#splitter_frame_on_frame(_frame) ⇒ Object



3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
# File 'lib/a-core.rb', line 3819

def splitter_frame_on_frame(_frame)
  ret=nil
  @splitters.each{|sp|
    if sp.frame == _frame
      ret = sp
      break
    end
  }
  ret
end

#unbuild_titled_frame(domain) ⇒ Object



3216
3217
3218
3219
3220
3221
3222
# File 'lib/a-core.rb', line 3216

def unbuild_titled_frame(domain)
  if @panels[domain]
    parent = @panels[domain]['root'].parent
    @panels[domain]['root'].destroy
    @panels[domain]['root']=parent
  end
end

#unregister_panel(_ffw, delete_wrapper = true, refresh_menu = true) ⇒ Object



3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
# File 'lib/a-core.rb', line 3699

def unregister_panel(_ffw, delete_wrapper=true, refresh_menu=true)
  _domain_name = _ffw.domain
  _name = _ffw.name
  @panels[_domain_name]['sons'][_name].hinner_frame.detach_frame
  if delete_wrapper
    @wrappers[_name].root.clear_transient_adapters(_name)
    @wrappers.delete(_name).hinner_frame.destroy
  else
    @wrappers[_name].domain=nil
  end
  @panels[_domain_name]['sons'].delete(_name)
  @panels[_domain_name][:raised_stack].delete(_name)
  #p "unregister #{_name} ------> 2"
  if @panels[_domain_name]['sons'].length >= 1
    n = @panels[_domain_name][:raised_stack][-1]
    w = @panels[_domain_name]['sons'][n].hinner_frame
    t = @panels[_domain_name]['sons'][n].title
    #title_titled_frame(_domain_name, t)
    @panels[_domain_name]['root'].title(t)
    @panels[_domain_name]['root'].restore_caption(n)
    @panels[_domain_name]['root'].shift_on if !@panels[_domain_name]['sons'][n].kind_of?(ArcadiaExtPlus)
    @panels[_domain_name]['root'].change_adapters_name(n)
    if !@tabbed || @panels[_domain_name]['sons'].length == 1
      w.detach_frame
      w.attach_frame(@panels[_domain_name]['root'].frame)
    end
    if @tabbed
      if @panels[_domain_name]['sons'].length == 1
        @panels[_domain_name]['notebook'].destroy
        @panels[_domain_name]['notebook']=nil
      else
        @panels[_domain_name]['notebook'].delete(_name) if @panels[_domain_name]['notebook'].index(_name) > 0
        new_raise_key = @panels[_domain_name]['sons'].keys[@panels[_domain_name]['sons'].length-1]
        @panels[_domain_name]['notebook'].raise(new_raise_key)
      end
    end
  elsif @panels[_domain_name]['sons'].length == 0
    #title_titled_frame(_domain_name, '')
    @panels[_domain_name]['root'].title('')
    @panels[_domain_name]['root'].top_text_clear
  end
  build_invert_menu if refresh_menu
end

#view_panelObject



3743
3744
# File 'lib/a-core.rb', line 3743

def view_panel
end