class ArcadiaLayout
Constants
- HIDDEN_DOMAIN
Attributes
parent_frame[R]
include Observable ArcadiaPanelInfo = Struct.new( “ArcadiaPanelInfo”,
:name, :title, :frame, :ffw
)
Public Class Methods
new(_arcadia, _frame, _autotab=true)
click to toggle source
# File lib/a-core.rb, line 3050 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
Public Instance Methods
[](_row, _col)
click to toggle source
# File lib/a-core.rb, line 4232 def [](_row, _col) @frames[_row][_col] end
add_cols(_row,_col, _width, _left_name=nil, _right_name=nil)
click to toggle source
# File lib/a-core.rb, line 3397 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)
click to toggle source
# File lib/a-core.rb, line 3401 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)
click to toggle source
# File lib/a-core.rb, line 3405 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_float_frame(_args=nil)
click to toggle source
# File lib/a-core.rb, line 4252 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_headers()
click to toggle source
# File lib/a-core.rb, line 3779 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)
click to toggle source
# File lib/a-core.rb, line 4262 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)
click to toggle source
# File lib/a-core.rb, line 4267 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)
click to toggle source
# File lib/a-core.rb, line 4272 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)
click to toggle source
# File lib/a-core.rb, line 3204 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)
click to toggle source
# File lib/a-core.rb, line 3213 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)
click to toggle source
# File lib/a-core.rb, line 3217 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)
click to toggle source
# File lib/a-core.rb, line 3433 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)
click to toggle source
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
# File lib/a-core.rb, line 3240 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)
click to toggle source
# File lib/a-core.rb, line 3251 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)
click to toggle source
# File lib/a-core.rb, line 3260 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?()
click to toggle source
# File lib/a-core.rb, line 3798 def autotab? @autotab end
build_titled_frame(domain)
click to toggle source
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
# File lib/a-core.rb, line 3731 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)
click to toggle source
# File lib/a-core.rb, line 3806 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)
click to toggle source
# File lib/a-core.rb, line 3592 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)
click to toggle source
def domain_for_frame(_domain_name, _name)
domain(@panels[_domain_name]['sons'][_name].domain)
end
# File lib/a-core.rb, line 4244 def domain(_domain_name) @panels[_domain_name] end
domain_name(_row,_col)
click to toggle source
# File lib/a-core.rb, line 3307 def domain_name(_row,_col) _row.to_s+'.'+_col.to_s end
domain_root_frame(_domain_name)
click to toggle source
# File lib/a-core.rb, line 4248 def domain_root_frame(_domain_name) @panels[_domain_name]['root'].frame end
domains()
click to toggle source
# File lib/a-core.rb, line 3769 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)
click to toggle source
# File lib/a-core.rb, line 3507 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)
click to toggle source
# File lib/a-core.rb, line 3548 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)
click to toggle source
# File lib/a-core.rb, line 3517 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)
click to toggle source
# File lib/a-core.rb, line 3461 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)
click to toggle source
# File lib/a-core.rb, line 3526 def domains_on_splitter(_splitter) domains_on_frame(_splitter.frame1).concat(domains_on_frame(_splitter.frame2)) end
domains_on_splitter_cols(_splitter)
click to toggle source
# File lib/a-core.rb, line 3530 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)
click to toggle source
# File lib/a-core.rb, line 3539 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)
click to toggle source
# File lib/a-core.rb, line 3470 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)
click to toggle source
# File lib/a-core.rb, line 4360 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)
click to toggle source
# File lib/a-core.rb, line 4277 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)
click to toggle source
# File lib/a-core.rb, line 3584 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)
click to toggle source
# File lib/a-core.rb, line 4236 def frame(_domain_name, _name) @panels[_domain_name]['sons'][_name].hinner_frame end
gap_domain_column(_r,_c,_dom)
click to toggle source
# File lib/a-core.rb, line 4337 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)
click to toggle source
# File lib/a-core.rb, line 4348 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)
click to toggle source
# File lib/a-core.rb, line 4300 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?()
click to toggle source
# File lib/a-core.rb, line 3794 def headed? @headed end
hide_panel(_domain, _extension)
click to toggle source
# File lib/a-core.rb, line 4216 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)
click to toggle source
# File lib/a-core.rb, line 3481 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)
click to toggle source
# File lib/a-core.rb, line 3494 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
process_frame(_ffw)
click to toggle source
# File lib/a-core.rb, line 3945 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)
click to toggle source
# File lib/a-core.rb, line 3091 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)
click to toggle source
def raise_panel
(_domain_name, _name)
@panels[_domain_name]['notebook'].raise(_name) if @panels[_domain_name] && @panels[_domain_name]['notebook']
end
# File lib/a-core.rb, line 3122 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)
click to toggle source
# File lib/a-core.rb, line 3136 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)
click to toggle source
# File lib/a-core.rb, line 3083 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)
click to toggle source
# File lib/a-core.rb, line 3802 def registed?(_domain_name, _name) @panels[_domain_name]['sons'][_name] != nil end
register_panel(_ffw, _adapter=nil)
click to toggle source
# File lib/a-core.rb, line 4053 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)
click to toggle source
# File lib/a-core.rb, line 4049 def registered_panel?(_ffw) _ffw.domain.nil? || _ffw.domain.length == 0 ?false:registed?(_ffw.domain, _ffw.name) end
root()
click to toggle source
# File lib/a-core.rb, line 3079 def root @panels['_domain_root_']['root'] end
shift_bottom(_row, _col)
click to toggle source
# File lib/a-core.rb, line 3373 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)
click to toggle source
# File lib/a-core.rb, line 4315 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)
click to toggle source
# File lib/a-core.rb, line 4326 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)
click to toggle source
# File lib/a-core.rb, line 3331 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)
click to toggle source
# File lib/a-core.rb, line 3311 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)
click to toggle source
# File lib/a-core.rb, line 3351 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
splitter_frame_on_frame(_frame)
click to toggle source
# File lib/a-core.rb, line 4289 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)
click to toggle source
# File lib/a-core.rb, line 3686 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)
click to toggle source
# File lib/a-core.rb, line 4169 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_panel()
click to toggle source
# File lib/a-core.rb, line 4213 def view_panel end
Private Instance Methods
_prepare_cols(_row,_col, _width, _perc=false, _left_name=nil, _right_name=nil)
click to toggle source
# File lib/a-core.rb, line 3269 def _prepare_cols(_row,_col, _width, _perc=false, _left_name=nil, _right_name=nil) if (@frames[_row][_col] != nil) #source_domains = all_domains(@frames[_row][_col]) #source_domains = others_domains(@frames[_row][_col]) _w = AGTkVSplittedFrames.new(self.root,@frames[_row][_col],_width,@arcadia['conf']['layout.splitter.length'].to_i,_perc) @splitters << _w @frames[_row][_col] = _w.left_frame #@frames[_row][_col + 1] = _w.right_frame _left_name = _row.to_s+'.'+_col.to_s if _left_name == nil @panels[_left_name] = Hash.new @panels[_left_name]['root'] = @frames[_row][_col] @panels[_left_name]['sons'] = Hash.new if @panels[_left_name]['root_splitted_frames'].nil? @panels[_left_name]['root_splitted_frames'] = _w end @panels[_left_name]['splitted_frames'] = _w # @domains[_row][_col] = _left_name _right_name = _row.to_s+'.'+(_col+1).to_s if _right_name == nil if !@panels[_right_name].nil? shift_right(_row, _col+1) end @frames[_row][_col + 1] = _w.right_frame @panels[_right_name] = Hash.new @panels[_right_name]['root'] = @frames[_row][_col + 1] @panels[_right_name]['sons'] = Hash.new if @panels[_right_name]['root_splitted_frames'].nil? @panels[_right_name]['root_splitted_frames'] = _w end @panels[_right_name]['splitted_frames'] = _w # @domains[_row][_col + 1] = _right_name end end
_prepare_rows(_row,_col, _height, _perc=false, _top_name=nil, _bottom_name=nil)
click to toggle source
# File lib/a-core.rb, line 3163 def _prepare_rows(_row,_col, _height, _perc=false, _top_name=nil, _bottom_name=nil) if (@frames[_row][_col] != nil) #source_domains = all_domains(@frames[_row][_col]) #source_domains = others_domains(@frames[_row][_col], false) _h = AGTkOSplittedFrames.new(self.root,@frames[_row][_col],_height, @arcadia['conf']['layout.splitter.length'].to_i,_perc) @splitters << _h if @frames[_row + 1] == nil @frames[_row + 1] = Array.new # @domains[_row + 1] = Array.new end @frames[_row][_col] = _h.top_frame _top_name = _row.to_s+'.'+_col.to_s if _top_name == nil @panels[_top_name] = Hash.new @panels[_top_name]['root'] = @frames[_row][_col] @panels[_top_name]['sons'] = Hash.new if @panels[_top_name]['root_splitted_frames'].nil? @panels[_top_name]['root_splitted_frames'] = _h end @panels[_top_name]['splitted_frames'] = _h # @domains[_row][_col] = _top_name _bottom_name = (_row+1).to_s+'.'+_col.to_s if _bottom_name == nil if !@panels[_bottom_name].nil? shift_bottom(_row+1, _col) end @panels[_bottom_name] = Hash.new @frames[_row + 1][_col] = _h.bottom_frame @panels[_bottom_name]['root'] = @frames[_row + 1][_col] @panels[_bottom_name]['sons'] = Hash.new if @panels[_bottom_name]['root_splitted_frames'].nil? @panels[_bottom_name]['root_splitted_frames'] = _h end @panels[_bottom_name]['splitted_frames'] = _h # @domains[_row + 1][_col] = _bottom_name end end