Class: ArcadiaLayout
- Inherits:
-
Object
- Object
- ArcadiaLayout
- Defined in:
- lib/a-core.rb
Instance Method Summary collapse
- #[](_row, _col) ⇒ Object
- #add_cols(_row, _col, _width, _left_name = nil, _right_name = nil) ⇒ Object
- #add_cols_perc(_row, _col, _width, _left_name = nil, _right_name = nil) ⇒ Object
- #add_cols_runtime(_domain) ⇒ Object
- #add_commons_menu_items(_domain, _menu) ⇒ Object
- #add_headers ⇒ Object
- #add_mono_panel(_name = nil) ⇒ Object
- #add_rows(_row, _col, _height, _top_name = nil, _bottom_name = nil) ⇒ Object
- #add_rows_perc(_row, _col, _height, _top_name = nil, _bottom_name = nil) ⇒ Object
- #add_rows_runtime(_domain) ⇒ Object
-
#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.
- #all_domains_cols(_frame) ⇒ Object
- #all_domains_rows(_frame) ⇒ Object
- #autotab? ⇒ Boolean
- #build_invert_menu(refresh_commons_items = false) ⇒ Object
- #build_titled_frame(domain) ⇒ Object
- #change_domain(_target_domain, _source_name) ⇒ Object
-
#close_runtime(_domain) ⇒ Object
–.
-
#domain(_domain_name) ⇒ Object
def domain_for_frame(_domain_name, _name) domain(@panels[‘sons’].domain) end.
- #domain_name(_row, _col) ⇒ Object
- #domain_root_frame(_domain_name) ⇒ Object
- #domains ⇒ Object
- #domains_cols(_domains) ⇒ Object
- #domains_on_frame(_frame) ⇒ Object
- #domains_on_frame_cols(_frame) ⇒ Object
- #domains_on_frame_rows(_frame) ⇒ Object
- #domains_on_splitter(_splitter) ⇒ Object
- #domains_on_splitter_cols(_splitter) ⇒ Object
- #domains_on_splitter_rows(_splitter) ⇒ Object
- #domains_rows(_domains) ⇒ Object
- #dump_geometry(_r = 0, _c = 0, _frame = root) ⇒ Object
- #dump_splitter(_splitter) ⇒ Object
- #find_splitted_frame(_start_frame) ⇒ Object
- #frame(_domain_name, _name) ⇒ Object
- #gap_domain_column(_r, _c, _dom) ⇒ Object
- #gap_domain_row(_r, _c, _dom) ⇒ Object
- #get_hinner_frame(_frame) ⇒ Object
- #headed? ⇒ Boolean
- #hide_panel ⇒ Object
-
#initialize(_arcadia, _frame, _autotab = true) ⇒ ArcadiaLayout
constructor
).
- #max_col(_domains, _row) ⇒ Object
- #max_row(_domains, _col) ⇒ Object
- #new_float_frame(_args = nil) ⇒ Object
-
#process_frame(_ffw) ⇒ Object
def change_domain_old(_dom1, _dom2, _name2) tt1= @panels[‘root’].top_text tt2= @panels[‘root’].top_text if @panels[‘sons’].length ==1 && @panels[‘sons’].length > 0 # change —— ffw1 = raised_fixed_frame(_dom1) ffw2 = @panels[‘sons’].values unregister_panel(ffw1,false,false) if ffw1 unregister_panel(ffw2,false,false) ffw1.domain = _dom2 if ffw1 ffw2.domain = _dom1 register_panel(ffw1, ffw1.hinner_frame) if ffw1 register_panel(ffw2, ffw2.hinner_frame) @panels[‘root’].top_text(tt2) @panels[‘root’].top_text(tt1) elsif @panels[‘sons’].length > 1 ffw2 = @panels[‘sons’] unregister_panel(ffw2, false, false) ffw2.domain = _dom1 register_panel(ffw2, ffw2.hinner_frame) @panels[‘root’].top_text(tt2) @panels[‘root’].top_text(”) end # refresh —– build_invert_menu end.
- #raise_panel(_domain, _extension) ⇒ Object
- #raised?(_domain, _name) ⇒ Boolean
- #raised_fixed_frame(_domain) ⇒ Object
- #registed?(_domain_name, _name) ⇒ Boolean
- #register_panel(_ffw, _adapter = nil) ⇒ Object
- #registered_panel?(_ffw) ⇒ Boolean
- #root ⇒ Object
- #shift_bottom(_row, _col) ⇒ Object
- #shift_domain_column(_r, _c, _dom) ⇒ Object
- #shift_domain_row(_r, _c, _dom) ⇒ Object
- #shift_left(_row, _col) ⇒ Object
- #shift_right(_row, _col) ⇒ Object
- #shift_top(_row, _col) ⇒ Object
- #splitter_frame_on_frame(_frame) ⇒ Object
-
#unbuild_titled_frame(domain) ⇒ Object
–.
- #unregister_panel(_ffw, delete_wrapper = true, refresh_menu = true) ⇒ Object
- #view_panel ⇒ Object
Constructor Details
#initialize(_arcadia, _frame, _autotab = true) ⇒ ArcadiaLayout
)
1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 |
# File 'lib/a-core.rb', line 1941 def initialize(_arcadia, _frame, _autotab=true) @arcadia = _arcadia @frames = Array.new @frames[0] = Array.new @frames[0][0] = _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']= _frame @panels['_domain_root_']['sons'] = Hash.new @autotab = _autotab @headed = false @wrappers=Hash.new @splitters=Array.new #ArcadiaContractListener.new(self, MainContract, :do_main_event) end |
Instance Method Details
#[](_row, _col) ⇒ Object
2910 2911 2912 |
# File 'lib/a-core.rb', line 2910 def [](_row, _col) @frames[_row][_col] end |
#add_cols(_row, _col, _width, _left_name = nil, _right_name = nil) ⇒ Object
2236 2237 2238 |
# File 'lib/a-core.rb', line 2236 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
2240 2241 2242 |
# File 'lib/a-core.rb', line 2240 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
2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 |
# File 'lib/a-core.rb', line 2244 def add_cols_runtime(_domain) saved_root_splitted_frames = @panels[_domain]['root_splitted_frames'] _saved = Hash.new _saved.update(@panels[_domain]['sons']) 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) } if saved_root_splitted_frames @panels[_domain]['root_splitted_frames']=saved_root_splitted_frames end (true) end |
#add_commons_menu_items(_domain, _menu) ⇒ Object
2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 |
# File 'lib/a-core.rb', line 2523 def (_domain, ) .insert('end', :separator) .insert('end',:command, :label=>"add column", :image=>TkPhotoImage.new('dat'=>ADD_GIF), :compound=>'left', :command=>proc{add_cols_runtime(_domain)}, :hidemargin => true ) .insert('end',:command, :label=>"add row", :image=>TkPhotoImage.new('dat'=>ADD_GIF), :compound=>'left', :command=>proc{add_rows_runtime(_domain)}, :hidemargin => true ) if @panels.keys.length > 2 .insert('end',:command, :label=>"close", :image=>TkPhotoImage.new('dat'=>CLOSE_FRAME_GIF), :compound=>'left', :command=>proc{close_runtime(_domain)}, :hidemargin => true ) end end |
#add_headers ⇒ Object
2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 |
# File 'lib/a-core.rb', line 2584 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_mono_panel(_name = nil) ⇒ Object
2043 2044 2045 2046 2047 2048 2049 2050 |
# File 'lib/a-core.rb', line 2043 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
2052 2053 2054 |
# File 'lib/a-core.rb', line 2052 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
2056 2057 2058 |
# File 'lib/a-core.rb', line 2056 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
2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 |
# File 'lib/a-core.rb', line 2268 def add_rows_runtime(_domain) saved_root_splitted_frames = @panels[_domain]['root_splitted_frames'] _saved = Hash.new _saved.update(@panels[_domain]['sons']) 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) } if saved_root_splitted_frames @panels[_domain]['root_splitted_frames']=saved_root_splitted_frames end (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
2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 |
# File 'lib/a-core.rb', line 2079 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
2090 2091 2092 2093 2094 2095 2096 2097 |
# File 'lib/a-core.rb', line 2090 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
2099 2100 2101 2102 2103 2104 2105 2106 |
# File 'lib/a-core.rb', line 2099 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
2603 2604 2605 |
# File 'lib/a-core.rb', line 2603 def autotab? @autotab end |
#build_invert_menu(refresh_commons_items = false) ⇒ Object
2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 |
# File 'lib/a-core.rb', line 2726 def (refresh_commons_items=false) @panels.keys.each{|dom| if dom != '_domain_root_' && @panels[dom] && @panels[dom]['root'] titledFrame = @panels[dom]['root'] if titledFrame.instance_of?(TkTitledFrameAdapter) = titledFrame.('ext').cget('menu') if refresh_commons_items @panels[dom]['root'].('ext').cget('menu').delete('0','end') (dom, ) else index = .index('end').to_i if @panels.keys.length > 2 i=index-4 else i=index-3 end if i >= 0 end_index = i.to_s @panels[dom]['root'].('ext').cget('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
2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 |
# File 'lib/a-core.rb', line 2551 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.('ext') # add commons item = mb.cget('menu') (domain, ) @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
2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 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 2647 2648 2649 2650 2651 2652 |
# File 'lib/a-core.rb', line 2611 def change_domain(_target_domain, _source_name) #tt1= @panels[_target_domain]['root'].top_text source_domain = @wrappers[_source_name].domain source_has_domain = !source_domain.nil? #tt2= @panels[source_domain]['root'].top_text if source_has_domain 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'].top_text(tt2) #@panels[source_domain]['root'].top_text(tt1) @panels[_target_domain]['root'].(ffw2.name, @panels[source_domain]['root'].(ffw2.name)) @panels[source_domain]['root'].(ffw1.name, @panels[_target_domain]['root'].(ffw1.name)) @panels[_target_domain]['root'].(ffw2.name) @panels[source_domain]['root'].(ffw1.name) @panels[_target_domain]['root'].change_adapter(ffw2.name, @panels[source_domain]['root'].forge_transient_adapter(ffw2.name)) @panels[source_domain]['root'].change_adapter(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'].top_text(tt2) #@panels[source_domain]['root'].top_text('') @panels[_target_domain]['root'].(ffw2.name, @panels[source_domain]['root'].(ffw2.name)) @panels[_target_domain]['root'].(ffw2.name) @panels[_target_domain]['root'].change_adapter(ffw2.name, @panels[source_domain]['root'].forge_transient_adapter(ffw2.name)) elsif !source_has_domain ffw2 = @wrappers[_source_name] ffw2.domain = _target_domain register_panel(ffw2, ffw2.hinner_frame) #@panels[_target_domain]['root'].top_text('') end # refresh ----- end |
#close_runtime(_domain) ⇒ Object
–
2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 |
# File 'lib/a-core.rb', line 2425 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{|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) } 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 (true) end |
#domain(_domain_name) ⇒ Object
def domain_for_frame(_domain_name, _name)
domain(@panels[_domain_name]['sons'][_name].domain)
end
2922 2923 2924 |
# File 'lib/a-core.rb', line 2922 def domain(_domain_name) @panels[_domain_name] end |
#domain_name(_row, _col) ⇒ Object
2146 2147 2148 |
# File 'lib/a-core.rb', line 2146 def domain_name(_row,_col) _row.to_s+'.'+_col.to_s end |
#domain_root_frame(_domain_name) ⇒ Object
2926 2927 2928 |
# File 'lib/a-core.rb', line 2926 def domain_root_frame(_domain_name) @panels[_domain_name]['root'].frame end |
#domains ⇒ Object
2574 2575 2576 2577 2578 2579 2580 2581 2582 |
# File 'lib/a-core.rb', line 2574 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
2338 2339 2340 2341 2342 2343 2344 2345 |
# File 'lib/a-core.rb', line 2338 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
2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 |
# File 'lib/a-core.rb', line 2380 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
2348 2349 2350 2351 2352 2353 2354 2355 |
# File 'lib/a-core.rb', line 2348 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
2292 2293 2294 2295 2296 2297 2298 2299 |
# File 'lib/a-core.rb', line 2292 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
2357 2358 2359 |
# File 'lib/a-core.rb', line 2357 def domains_on_splitter(_splitter) domains_on_frame(_splitter.frame1).concat(domains_on_frame(_splitter.frame2)) end |
#domains_on_splitter_cols(_splitter) ⇒ Object
2361 2362 2363 2364 2365 2366 2367 2368 |
# File 'lib/a-core.rb', line 2361 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
2370 2371 2372 2373 2374 2375 2376 2377 |
# File 'lib/a-core.rb', line 2370 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
2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 |
# File 'lib/a-core.rb', line 2301 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
3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 |
# File 'lib/a-core.rb', line 3023 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
2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 |
# File 'lib/a-core.rb', line 2940 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
2417 2418 2419 2420 2421 2422 2423 |
# File 'lib/a-core.rb', line 2417 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
2914 2915 2916 |
# File 'lib/a-core.rb', line 2914 def frame(_domain_name, _name) @panels[_domain_name]['sons'][_name].frame end |
#gap_domain_column(_r, _c, _dom) ⇒ Object
3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 |
# File 'lib/a-core.rb', line 3000 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
3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 |
# File 'lib/a-core.rb', line 3011 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
2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 |
# File 'lib/a-core.rb', line 2963 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
2599 2600 2601 |
# File 'lib/a-core.rb', line 2599 def headed? @headed end |
#hide_panel ⇒ Object
2907 2908 |
# File 'lib/a-core.rb', line 2907 def hide_panel end |
#max_col(_domains, _row) ⇒ Object
2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 |
# File 'lib/a-core.rb', line 2312 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
2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 |
# File 'lib/a-core.rb', line 2325 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 |
#new_float_frame(_args = nil) ⇒ Object
2930 2931 2932 2933 2934 2935 2936 2937 2938 |
# File 'lib/a-core.rb', line 2930 def new_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 |
#process_frame(_ffw) ⇒ Object
def change_domain_old(_dom1, _dom2, _name2)
tt1= @panels[_dom1]['root'].top_text
tt2= @panels[_dom2]['root'].top_text
if @panels[_dom2]['sons'].length ==1 && @panels[_dom1]['sons'].length > 0
# change ------
ffw1 = raised_fixed_frame(_dom1)
ffw2 = @panels[_dom2]['sons'].values[0]
unregister_panel(ffw1,false,false) if ffw1
unregister_panel(ffw2,false,false)
ffw1.domain = _dom2 if ffw1
ffw2.domain = _dom1
register_panel(ffw1, ffw1.hinner_frame) if ffw1
register_panel(ffw2, ffw2.hinner_frame)
@panels[_dom1]['root'].top_text(tt2)
@panels[_dom2]['root'].top_text(tt1)
elsif @panels[_dom2]['sons'].length > 1
ffw2 = @panels[_dom2]['sons'][_name2]
unregister_panel(ffw2, false, false)
ffw2.domain = _dom1
register_panel(ffw2, ffw2.hinner_frame)
@panels[_dom1]['root'].top_text(tt2)
@panels[_dom2]['root'].top_text('')
end
# refresh -----
build_invert_menu
end
2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 |
# File 'lib/a-core.rb', line 2682 def process_frame(_ffw) #def process_frame(_domain_name, _frame_name) #domain_root = @panels[_domain_name]['sons'][_frame_name] @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) = @panels[dom]['root'].('ext').cget('menu') .insert('0',:command, :label=>_ffw.title, :image=>TkPhotoImage.new('dat'=>ARROW_LEFT_GIF), :compound=>'left', :command=>proc{change_domain(dom, _ffw.name)}, :hidemargin => true ) end end } if @panels[_ffw.domain] titledFrame = @panels[_ffw.domain]['root'] if titledFrame.instance_of?(TkTitledFrameAdapter) = titledFrame.('ext').cget('menu') index = .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 .insert(index,:command, :label=>"close \"#{_ffw.title}\"", :image=>TkPhotoImage.new('dat'=>CLOSE_FRAME_GIF), :compound=>'left', :command=>proc{unregister_panel(_ffw, false, true)}, :hidemargin => true ) end end end |
#raise_panel(_domain, _extension) ⇒ Object
1964 1965 1966 1967 1968 1969 1970 |
# File 'lib/a-core.rb', line 1964 def raise_panel(_domain, _extension) p = @panels[_domain] if p && p['notebook'] != nil p['notebook'].raise(_extension) p['notebook'].see(_extension) 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
1976 1977 1978 1979 1980 1981 1982 1983 |
# File 'lib/a-core.rb', line 1976 def raised?(_domain, _name) ret = true p = @panels[_domain] if p && p['notebook'] != nil ret=p['notebook'].raise == _name end ret end |
#raised_fixed_frame(_domain) ⇒ Object
1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 |
# File 'lib/a-core.rb', line 1985 def raised_fixed_frame(_domain) ret = nil p = @panels[_domain] 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 ret end |
#registed?(_domain_name, _name) ⇒ Boolean
2607 2608 2609 |
# File 'lib/a-core.rb', line 2607 def registed?(_domain_name, _name) @panels[_domain_name]['sons'][_name] != nil end |
#register_panel(_ffw, _adapter = nil) ⇒ Object
2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 |
# File 'lib/a-core.rb', line 2763 def register_panel(_ffw, _adapter=nil) _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 pan['root'].title(_title) pan['root'].(_name) pan['root'].change_adapter_name(_name) if !root_frame.instance_of?(TkFrameAdapter) && num==0 if _adapter adapter = _adapter else adapter = TkFrameAdapter.new(self.root, Arcadia.style('frame')) end adapter.attach_frame(root_frame) adapter.raise end else root_frame = pan['root'] end 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{ pan['root'].title(api.title) pan['root'].(api.name) pan['root'].change_adapter_name(api.name) Arcadia.process_event(LayoutRaisingFrameEvent.new(self,'extension_name'=>pan['sons'][api.name].extension_name, 'frame_name'=>pan['sons'][api.name].name)) # changed # notify_observers('RAISE', api.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{ pan['root'].title(_title) pan['root'].(_name) pan['root'].change_adapter_name(_name) Arcadia.process_event(LayoutRaisingFrameEvent.new(self,'extension_name'=>_ffw.extension_name, 'frame_name'=>_ffw.name)) # changed # notify_observers('RAISE', _name) } ) if _adapter adapter = _adapter else adapter = TkFrameAdapter.new(self.root, Arcadia.style('frame')) end adapter.attach_frame(_panel) adapter.raise _panel=adapter #@wrappers[_name]=wrapper #p['sons'][_name] = ArcadiaPanelInfo.new(_name,_title,_panel,_ffw) pan['sons'][_name] = _ffw pan['notebook'].raise(_name) process_frame(_ffw) return _panel end else _ffw.domain = nil process_frame(_ffw) return TkFrameAdapter.new(self.root, Arcadia.style('frame')) # # Arcadia.dialog(self, # 'type'=>'ok', # 'msg'=>"domain #{_domain_name} do not exist\nfor '#{_title}'!", # 'level'=>'warning' # ) # float_frame = new_float_frame # float_frame.title(_title) # return float_frame.frame end end |
#registered_panel?(_ffw) ⇒ Boolean
2759 2760 2761 |
# File 'lib/a-core.rb', line 2759 def registered_panel?(_ffw) _ffw.domain.nil? || _ffw.domain.length == 0 ?false:registed?(_ffw.domain, _ffw.name) end |
#root ⇒ Object
1960 1961 1962 |
# File 'lib/a-core.rb', line 1960 def root @panels['_domain_root_']['root'] end |
#shift_bottom(_row, _col) ⇒ Object
2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 |
# File 'lib/a-core.rb', line 2212 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
2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 |
# File 'lib/a-core.rb', line 2978 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
2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 |
# File 'lib/a-core.rb', line 2989 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
2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 |
# File 'lib/a-core.rb', line 2170 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
2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 |
# File 'lib/a-core.rb', line 2150 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
2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 |
# File 'lib/a-core.rb', line 2190 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) ⇒ Object
2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 |
# File 'lib/a-core.rb', line 2952 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
–
2515 2516 2517 2518 2519 2520 2521 |
# File 'lib/a-core.rb', line 2515 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
2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 |
# File 'lib/a-core.rb', line 2866 def unregister_panel(_ffw, delete_wrapper=true, =true) #p "unregister #{_name} ------> 1" _domain_name = _ffw.domain _name = _ffw.name @panels[_domain_name]['sons'][_name].hinner_frame.detach_frame if delete_wrapper @wrappers.delete(_name).hinner_frame.destroy else @wrappers[_name].domain=nil end @panels[_domain_name]['sons'].delete(_name) #p "unregister #{_name} ------> 2" if @panels[_domain_name]['sons'].length == 1 w = @panels[_domain_name]['sons'].values[0].hinner_frame t = @panels[_domain_name]['sons'].values[0].title n = @panels[_domain_name]['sons'].values[0].name w.detach_frame w.attach_frame(@panels[_domain_name]['root'].frame) @panels[_domain_name]['root'].title(t) @panels[_domain_name]['root'].(n) @panels[_domain_name]['root'].change_adapter_name(n) @panels[_domain_name]['notebook'].destroy @panels[_domain_name]['notebook']=nil elsif @panels[_domain_name]['sons'].length > 1 @panels[_domain_name]['notebook'].delete(_name) if @panels[_domain_name]['notebook'].index(_name) > 0 #p "unregister #{_name} ------> 3" new_raise_key = @panels[_domain_name]['sons'].keys[@panels[_domain_name]['sons'].length-1] #p "unregister #{_name} ------> 4" @panels[_domain_name]['notebook'].raise(new_raise_key) #p "unregister #{_name} ------> 5" elsif @panels[_domain_name]['sons'].length == 0 @panels[_domain_name]['root'].title('') @panels[_domain_name]['root'].top_text('') end if end |
#view_panel ⇒ Object
2904 2905 |
# File 'lib/a-core.rb', line 2904 def view_panel end |