arcadia 0.9.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,222 @@
1
+ #!/usr/bin/ruby -w
2
+
3
+
4
+ =begin
5
+ /***************************************************************************
6
+ * Copyright (C) 2008, Paul Lutus *
7
+ * *
8
+ * This program is free software; you can redistribute it and/or modify *
9
+ * it under the terms of the GNU General Public License as published by *
10
+ * the Free Software Foundation; either version 2 of the License, or *
11
+ * (at your option) any later version. *
12
+ * *
13
+ * This program is distributed in the hope that it will be useful, *
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16
+ * GNU General Public License for more details. *
17
+ * *
18
+ * You should have received a copy of the GNU General Public License *
19
+ * along with this program; if not, write to the *
20
+ * Free Software Foundation, Inc., *
21
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
22
+ ***************************************************************************/
23
+ =end
24
+
25
+ PVERSION = "Version 2.9, 10/24/2008"
26
+
27
+ module RBeautify
28
+
29
+ # user-customizable values
30
+
31
+ RBeautify::TabStr = " "
32
+ RBeautify::TabSize = 2
33
+
34
+ # indent regexp tests
35
+
36
+ IndentExp = [
37
+ /^module\b/,
38
+ /^class\b/,
39
+ /^if\b/,
40
+ /(=\s*|^)until\b/,
41
+ /(=\s*|^)for\b/,
42
+ /^unless\b/,
43
+ /(=\s*|^)while\b/,
44
+ /(=\s*|^)begin\b/,
45
+ /(^| )case\b/,
46
+ /\bthen\b/,
47
+ /^rescue\b/,
48
+ /^def\b/,
49
+ /\bdo\b/,
50
+ /^else\b/,
51
+ /^elsif\b/,
52
+ /^ensure\b/,
53
+ /\bwhen\b/,
54
+ /\{[^\}]*$/,
55
+ /\[[^\]]*$/
56
+ ]
57
+
58
+ # outdent regexp tests
59
+
60
+ OutdentExp = [
61
+ /^rescue\b/,
62
+ /^ensure\b/,
63
+ /^elsif\b/,
64
+ /^end\b/,
65
+ /^else\b/,
66
+ /\bwhen\b/,
67
+ /^[^\{]*\}/,
68
+ /^[^\[]*\]/
69
+ ]
70
+
71
+ def RBeautify.rb_make_tab(tab)
72
+ return (tab < 0)?"":TabStr * TabSize * tab
73
+ end
74
+
75
+ def RBeautify.rb_add_line(line,tab)
76
+ line.strip!
77
+ line = rb_make_tab(tab) + line if line.length > 0
78
+ return line
79
+ end
80
+
81
+ def RBeautify.beautify_string(source, path = "")
82
+ comment_block = false
83
+ in_here_doc = false
84
+ here_doc_term = ""
85
+ program_end = false
86
+ multiLine_array = []
87
+ multiLine_str = ""
88
+ tab = 0
89
+ output = []
90
+ source.each do |line|
91
+ line.chomp!
92
+ if(!program_end)
93
+ # detect program end mark
94
+ if(line =~ /^__END__$/)
95
+ program_end = true
96
+ else
97
+ # combine continuing lines
98
+ if(!(line =~ /^\s*#/) && line =~ /[^\\]\\\s*$/)
99
+ multiLine_array.push line
100
+ multiLine_str += line.sub(/^(.*)\\\s*$/,"\\1")
101
+ next
102
+ end
103
+
104
+ # add final line
105
+ if(multiLine_str.length > 0)
106
+ multiLine_array.push line
107
+ multiLine_str += line.sub(/^(.*)\\\s*$/,"\\1")
108
+ end
109
+
110
+ tline = ((multiLine_str.length > 0)?multiLine_str:line).strip
111
+ if(tline =~ /^=begin/)
112
+ comment_block = true
113
+ end
114
+ if(in_here_doc)
115
+ in_here_doc = false if tline =~ %r{\s*#{here_doc_term}\s*}
116
+ else # not in here_doc
117
+ if tline =~ %r{=\s*<<}
118
+ here_doc_term = tline.sub(%r{.*=\s*<<-?\s*([_|\w]+).*},"\\1")
119
+ in_here_doc = here_doc_term.size > 0
120
+ end
121
+ end
122
+ end
123
+ end
124
+ if(comment_block || program_end || in_here_doc)
125
+ # add the line unchanged
126
+ output << line
127
+ else
128
+ comment_line = (tline =~ /^#/)
129
+ if(!comment_line)
130
+ # throw out sequences that will
131
+ # only sow confusion
132
+ while tline.gsub!(/\{[^\{]*?\}/,"")
133
+ end
134
+ while tline.gsub!(/\[[^\[]*?\]/,"")
135
+ end
136
+ while tline.gsub!(/'.*?'/,"")
137
+ end
138
+ while tline.gsub!(/".*?"/,"")
139
+ end
140
+ while tline.gsub!(/\`.*?\`/,"")
141
+ end
142
+ while tline.gsub!(/\([^\(]*?\)/,"")
143
+ end
144
+ while tline.gsub!(/\/.*?\//,"")
145
+ end
146
+ while tline.gsub!(/%r(.).*?\1/,"")
147
+ end
148
+ # delete end-of-line comments
149
+ tline.sub!(/#[^\"]+$/,"")
150
+ # convert quotes
151
+ tline.gsub!(/\\\"/,"'")
152
+ OutdentExp.each do |re|
153
+ if(tline =~ re)
154
+ tab -= 1
155
+ break
156
+ end
157
+ end
158
+ end
159
+ if (multiLine_array.length > 0)
160
+ multiLine_array.each do |ml|
161
+ output << rb_add_line(ml,tab)
162
+ end
163
+ multiLine_array.clear
164
+ multiLine_str = ""
165
+ else
166
+ output << rb_add_line(line,tab)
167
+ end
168
+ if(!comment_line)
169
+ IndentExp.each do |re|
170
+ if(tline =~ re && !(tline =~ /\s+end\s*$/))
171
+ tab += 1
172
+ break
173
+ end
174
+ end
175
+ end
176
+ end
177
+ if(tline =~ /^=end/)
178
+ comment_block = false
179
+ end
180
+ end
181
+ error = (tab != 0)
182
+ STDERR.puts "Error: indent/outdent mismatch: #{tab}." if error
183
+ return output.join("\n") + "\n",error
184
+ end # beautify_string
185
+
186
+ def RBeautify.beautify_file(path)
187
+ error = false
188
+ if(path == '-') # stdin source
189
+ source = STDIN.read
190
+ dest,error = beautify_string(source,"stdin")
191
+ print dest
192
+ else # named file source
193
+ source = File.read(path)
194
+ dest,error = beautify_string(source,path)
195
+ if(source != dest)
196
+ # make a backup copy
197
+ File.open(path + "~","w") { |f| f.write(source) }
198
+ # overwrite the original
199
+ File.open(path,"w") { |f| f.write(dest) }
200
+ end
201
+ end
202
+ return error
203
+ end # beautify_file
204
+
205
+ def RBeautify.main
206
+ error = false
207
+ if(!ARGV[0])
208
+ STDERR.puts "usage: Ruby filenames or \"-\" for stdin."
209
+ exit 0
210
+ end
211
+ ARGV.each do |path|
212
+ error = (beautify_file(path))?true:error
213
+ end
214
+ error = (error)?1:0
215
+ exit error
216
+ end # main
217
+ end # module RBeautify
218
+
219
+ # if launched as a standalone program, not loaded as a module
220
+ if __FILE__ == $0
221
+ RBeautify.main
222
+ end
@@ -270,4 +270,4 @@ class WrapperContainer < TkFrame
270
270
  end
271
271
  return (_found)?_data:A_WIDGET_GIF
272
272
  end
273
- end
273
+ end
@@ -4,7 +4,7 @@ frames.labels=Rad,Object Inspector
4
4
  frames.names=rad,rad_object_inspector
5
5
  float_frames=200x220+10+10
6
6
  float_labels=Rad
7
- active=yes
7
+ active=no
8
8
  require=ext/ae-rad/ae-rad
9
9
  class=Rad
10
10
 
@@ -232,8 +232,11 @@ class RubyDebugView
232
232
  @b_local_onoff.image(_i_on)
233
233
  command_enabled(false)
234
234
  Thread.new{
235
- update_variables('local_var', @controller.rdc.variables('local_variables')) #if @tree_var.open?('local_var')
236
- command_enabled(true)
235
+ begin
236
+ update_variables('local_var', @controller.rdc.variables('local_variables')) #if @tree_var.open?('local_var')
237
+ ensure
238
+ command_enabled(true)
239
+ end
237
240
  }
238
241
  elsif @local_state == B_STATE_FREEZE
239
242
  @b_local_onoff.image(_i_freeze)
@@ -276,8 +279,11 @@ class RubyDebugView
276
279
  @b_instance_onoff.image(_i_on)
277
280
  command_enabled(false)
278
281
  Thread.new{
279
- update_variables('instance_var', @controller.rdc.variables('instance_variables')) #if @tree_var.open?('local_var')
280
- command_enabled(true)
282
+ begin
283
+ update_variables('instance_var', @controller.rdc.variables('instance_variables')) #if @tree_var.open?('local_var')
284
+ ensure
285
+ command_enabled(true)
286
+ end
281
287
  }
282
288
  elsif @instance_state == B_STATE_FREEZE
283
289
  @b_instance_onoff.image(_i_freeze)
@@ -319,8 +325,11 @@ class RubyDebugView
319
325
  @b_class_onoff.image(_i_on)
320
326
  command_enabled(false)
321
327
  Thread.new{
322
- update_variables('class_var', @controller.rdc.variables('self.class.class_variables')) #if @tree_var.open?('local_var')
323
- command_enabled(true)
328
+ begin
329
+ update_variables('class_var', @controller.rdc.variables('self.class.class_variables')) #if @tree_var.open?('local_var')
330
+ ensure
331
+ command_enabled(true)
332
+ end
324
333
  }
325
334
  elsif @class_state == B_STATE_FREEZE
326
335
  @b_class_onoff.image(_i_freeze)
@@ -363,8 +372,11 @@ class RubyDebugView
363
372
  @b_global_onoff.image(_i_on)
364
373
  command_enabled(false)
365
374
  Thread.new{
366
- update_variables('global_var', @controller.rdc.variables('global_variables')) #if @tree_var.open?('local_var')
367
- command_enabled(true)
375
+ begin
376
+ update_variables('global_var', @controller.rdc.variables('global_variables')) #if @tree_var.open?('local_var')
377
+ ensure
378
+ command_enabled(true)
379
+ end
368
380
  }
369
381
  elsif @global_state == B_STATE_FREEZE
370
382
  @b_global_onoff.image(_i_freeze)
@@ -768,7 +780,7 @@ class RubyDebugServer
768
780
  else
769
781
  rdebug_cmd = "rdebug"
770
782
  end
771
- commandLine = "#{rdebug_cmd} --host #{_host} --port #{_remote_port} -sw #{_filename}"
783
+ commandLine = "#{rdebug_cmd} --host #{_host} --port #{_remote_port} -sw #{_filename}"
772
784
  else
773
785
  commandLine = "rdebug --host #{_host} --port #{_remote_port} -sw #{_filename}"
774
786
  end
@@ -88,11 +88,16 @@ class FixedFrameWrapper < AbstractFrameWrapper
88
88
  @fixed_frame
89
89
  end
90
90
 
91
- def top_text(_top_text=nil)
91
+ def root
92
92
  fixed_frame_forge
93
- Arcadia.layout.domain(@domain)['root'].top_text(_top_text)
94
- #@arcadia.layout.domain_for_frame(@domain, @name)['root'].top_text(_title)
93
+ Arcadia.layout.domain(@domain)['root']
95
94
  end
95
+
96
+ # def top_text(_top_text=nil)
97
+ # fixed_frame_forge
98
+ # Arcadia.layout.domain(@domain)['root'].top_text(_top_text)
99
+ # #@arcadia.layout.domain_for_frame(@domain, @name)['root'].top_text(_title)
100
+ # end
96
101
 
97
102
  def show
98
103
  fixed_frame_forge
@@ -61,6 +61,8 @@ class LayoutRaisingFrameEvent < ArcadiaEvent
61
61
  attr_accessor :frame_name
62
62
  end
63
63
 
64
+ class LayoutChangedFrameEvent < ArcadiaEvent
65
+ end
64
66
 
65
67
  # +---------------------------------------------+
66
68
  # Buffer event
@@ -22,7 +22,7 @@ class Arcadia < TkApplication
22
22
  super(
23
23
  ApplicationParams.new(
24
24
  'arcadia',
25
- '0.9.0',
25
+ '0.9.1',
26
26
  'conf/arcadia.conf',
27
27
  'conf/arcadia.pers'
28
28
  )
@@ -98,9 +98,9 @@ class Arcadia < TkApplication
98
98
  geometry = start_width.to_s+'x'+start_height.to_s+'+0+0'
99
99
  end
100
100
  @root.deiconify
101
- @root.raise
102
101
  @root.focus(true)
103
102
  @root.geometry(geometry)
103
+ @root.raise
104
104
  Tk.update_idletasks
105
105
  #sleep(1)
106
106
  @splash.destroy if @splash
@@ -682,7 +682,7 @@ class Arcadia < TkApplication
682
682
  item_args['context_path'] = context_path
683
683
  item_args['context_caption'] = groups_caption[gi] if groups_caption
684
684
  item_args['context_underline'] = context_underline.strip.to_i if context_underline
685
- i = _user_control.new_item(self, item_args)
685
+ i = _user_control.new_item(_self_on_eval, item_args)
686
686
  i.enable=false if disabled
687
687
  }
688
688
  rescue Exception
@@ -712,6 +712,8 @@ class Arcadia < TkApplication
712
712
  if q1 && can_exit?
713
713
  do_finalize
714
714
  @root.destroy
715
+ # Tk.mainloop_exist?
716
+ # Tk.destroy
715
717
  Tk.exit
716
718
  end
717
719
  end
@@ -1022,7 +1024,6 @@ class ArcadiaMainToolbar < ArcadiaUserControl
1022
1024
  height 20
1023
1025
  helptext _hint if _hint
1024
1026
  text _caption if _caption
1025
-
1026
1027
  }
1027
1028
  if _args['context_path'] && _args['last_item_for_context']
1028
1029
  @item_obj.pack('after'=>_args['last_item_for_context'].item_obj, 'side' =>'left', :padx=>2, :pady=>0)
@@ -1198,11 +1199,6 @@ class ArcadiaMainMenu < ArcadiaUserControl
1198
1199
  @menu = menu
1199
1200
  build
1200
1201
  @menu.configure(Arcadia.style('menu'))
1201
- # menu.foreground('black')
1202
- # menu.activeforeground('#6679f1')
1203
- # menu.relief('flat')
1204
- # menu.borderwidth(0)
1205
- # menu.font(Arcadia.conf('main.mainmenu.font'))
1206
1202
  end
1207
1203
 
1208
1204
  def get_menu_context(_menubar, _context, _underline=nil)
@@ -2347,11 +2343,11 @@ class ArcadiaLayout
2347
2343
  break
2348
2344
  elsif @panels[dom]['notebook'] != nil
2349
2345
  cfrs = TkWinfo.children(_frame)
2350
- if cfrs && cfrs.length == 1 && cfrs[0].instance_of?(TkTitledFrame) && TkWinfo.parent(@panels[dom]['notebook'])== cfrs[0].frame
2346
+ if cfrs && cfrs.length == 1 && cfrs[0].instance_of?(TkTitledFrameAdapter) && TkWinfo.parent(@panels[dom]['notebook'])== cfrs[0].frame
2351
2347
  ret_doms << dom
2352
2348
  frame_found = true
2353
2349
  end
2354
- elsif @panels[dom]['root'].instance_of?(TkTitledFrame) && @panels[dom]['root'].parent == _frame
2350
+ elsif @panels[dom]['root'].instance_of?(TkTitledFrameAdapter) && @panels[dom]['root'].parent == _frame
2355
2351
  ret_doms << dom
2356
2352
  frame_found = true
2357
2353
  end
@@ -2360,7 +2356,7 @@ class ArcadiaLayout
2360
2356
 
2361
2357
  if !frame_found
2362
2358
  cfrs = TkWinfo.children(_frame)
2363
- if cfrs && cfrs.length == 1 && cfrs[0].instance_of?(TkTitledFrame)
2359
+ if cfrs && cfrs.length == 1 && cfrs[0].instance_of?(TkTitledFrameAdapter)
2364
2360
  @wrappers.each{|name, ffw|
2365
2361
  if ffw.hinner_frame.frame == cfrs[0].frame
2366
2362
  ret_doms << ffw.domain
@@ -2371,244 +2367,6 @@ class ArcadiaLayout
2371
2367
  ret_doms
2372
2368
  end
2373
2369
 
2374
- def close_runtime_old(_domain)
2375
- splitted_adapter = find_splitted_frame(@panels[_domain]['root'])
2376
- splitted_adapter_frame = splitted_adapter.frame
2377
- vertical = splitted_adapter.instance_of?(AGTkVSplittedFrames)
2378
-
2379
- _row, _col = _domain.split('.')
2380
-
2381
- if @frames[_row.to_i][_col.to_i] == splitted_adapter.frame1
2382
- close_first = true
2383
- elsif @frames[_row.to_i][_col.to_i] == splitted_adapter.frame2
2384
- close_first = false
2385
- end
2386
-
2387
- return if close_first.nil?
2388
-
2389
- #source_domains = domains_on_frame(splitted_adapter.frame1).concat(domains_on_frame(splitted_adapter.frame2))
2390
- #Arcadia.console(self,'msg'=>"domini coinvolti = #{source_domains.to_s}")
2391
-
2392
- @panels[_domain]['sons'].each{|name,ffw|
2393
- unregister_panel(ffw, false, false)
2394
- }
2395
- unbuild_titled_frame(_domain)
2396
- if close_first
2397
- #left_frame
2398
- other_ds = domains_on_frame(@panels[_domain]['splitted_frames'].frame2)
2399
- if other_ds.length == 1
2400
- source_domain = other_ds[0]
2401
- elsif other_ds.length > 1
2402
- max = other_ds.length-1
2403
- j = 0
2404
- while j <= max
2405
- if source_domain.nil?
2406
- source_domain = other_ds[j]
2407
- else
2408
- r,c = source_domain.split('.')
2409
- new_r,new_c = other_ds[j].split('.')
2410
- if new_r.to_i < r.to_i || new_r.to_i == r.to_i && new_c.to_i < c.to_i
2411
- source_domain = other_ds[j]
2412
- end
2413
- end
2414
- j = j+1
2415
- end
2416
- else
2417
- if vertical
2418
- source_domain = domain_name(_row.to_i, _col.to_i+1)
2419
- else
2420
- source_domain = domain_name(_row.to_i+1, _col.to_i)
2421
- end
2422
- end
2423
- if vertical
2424
- ref_source_domain = domain_name(_row.to_i, _col.to_i+1)
2425
- else
2426
- ref_source_domain = domain_name(_row.to_i+1, _col.to_i)
2427
- end
2428
-
2429
- destination_domain = _domain
2430
-
2431
- if @panels[source_domain]['splitted_frames'] != @panels[destination_domain]['splitted_frames']
2432
- if @panels[source_domain]['root_splitted_frames'] && @panels[source_domain]['root_splitted_frames'] != @panels[destination_domain]['splitted_frames']
2433
- other_root_splitted_adapter = @panels[source_domain]['root_splitted_frames']
2434
- elsif @panels[source_domain]['splitted_frames']
2435
- other_root_splitted_adapter = @panels[source_domain]['splitted_frames']
2436
- end
2437
- end
2438
-
2439
- if other_root_splitted_adapter
2440
- p "primo quadrante"
2441
- other_root_splitted_adapter.detach_frame
2442
- splitted_adapter.detach_frame
2443
- splitted_adapter.destroy
2444
- other_root_splitted_adapter.attach_frame(splitted_adapter_frame)
2445
- if source_domain == ref_source_domain
2446
- if vertical
2447
- rows = domains_on_splitter_rows(other_root_splitted_adapter)
2448
- rows.each{|r|
2449
- shift_left(r.to_i,_col.to_i)
2450
- }
2451
- else
2452
- cols = domains_on_splitter_cols(other_root_splitted_adapter)
2453
- cols.each{|c|
2454
- shift_top(_row.to_i,c.to_i)
2455
- }
2456
- end
2457
- else
2458
- @panels.delete(_domain)
2459
- @frames[_row.to_i][_col.to_i] = nil
2460
- # @domains[_row.to_i][_col.to_i] = nil
2461
- # ref_r,ref_c = ref_source_domain.split('.')
2462
- # real_r,real_c=source_domain.split('.')
2463
- # gap_r = ref_r.to_i - real_r.to_i
2464
- # gap_c = ref_c.to_i - real_c.to_i
2465
- # if gap_r != 0 && gap_c == 0 # vertical
2466
- # doms = domains_on_splitter(other_root_splitted_adapter)
2467
- # doms.each{|d|
2468
- # r,c=d.split('.')
2469
- # cur_r = r.to_i+gap_r
2470
- # cur_domain = "#{cur_r}.#{_col}"
2471
- # if @panels[cur_domain] != nil
2472
- # shift_bottom(cur_r,_col.to_i)
2473
- # end
2474
- # @panels[cur_domain] = @panels[d]
2475
- # @panels[cur_domain]['root'].set_domain(cur_domain)
2476
- # @panels[cur_domain]['sons'].each{|name,ffw| ffw.domain=cur_domain}
2477
- # @frames[cur_r.to_i][_col.to_i] = @frames[r.to_i][c.to_i]
2478
- # @domains[cur_r.to_i][_col.to_i] = @domains[r.to_i][c.to_i]
2479
- #
2480
- # @panels.delete(d)
2481
- # @frames[r.to_i][c.to_i] = nil
2482
- # @domains[r.to_i][c.to_i] = nil
2483
- # }
2484
- # elsif gap_c != 0
2485
- # end
2486
- end
2487
- @panels.delete(source_domain)
2488
- if vertical
2489
- @frames[_row.to_i][_col.to_i+1] = nil
2490
- # @domains[_row.to_i][_col.to_i+1] = nil
2491
- else
2492
- @frames[_row.to_i+1][_col.to_i] = nil
2493
- # @domains[_row.to_i+1][_col.to_i] = nil
2494
- end
2495
- else
2496
- p "secondo quadrante"
2497
- source_save = Hash.new
2498
- source_save.update(@panels[source_domain]['sons']) if @panels[source_domain]
2499
- source_save.each{|name,ffw|
2500
- unregister_panel(ffw, false, false)
2501
- }
2502
- splitted_adapter.detach_frame
2503
- splitted_adapter.destroy
2504
- @panels[destination_domain]['root']=splitted_adapter_frame
2505
- @frames[_row.to_i][_col.to_i] = splitted_adapter_frame
2506
- # @domains[_row.to_i][_col.to_i] = destination_domain
2507
- build_titled_frame(destination_domain)
2508
- @panels.delete(source_domain)
2509
- if vertical
2510
- @frames[_row.to_i][_col.to_i+1] = nil
2511
- # @domains[_row.to_i][_col.to_i+1] = nil
2512
- else
2513
- @frames[_row.to_i+1][_col.to_i] = nil
2514
- # @domains[_row.to_i+1][_col.to_i] = nil
2515
- end
2516
- source_save.each{|name,ffw|
2517
- ffw.domain = destination_domain
2518
- register_panel(ffw, ffw.hinner_frame)
2519
- }
2520
- #-----
2521
- parent_splitted_adapter = find_splitted_frame(@panels[destination_domain]['root'])
2522
- if parent_splitted_adapter
2523
- @panels[destination_domain]['splitted_frames']=parent_splitted_adapter
2524
- else
2525
- @panels[destination_domain]['splitted_frames']= nil
2526
- end
2527
- #-----
2528
- source_row,source_col = source_domain.split('.')
2529
- # shift_left(source_row.to_i,source_col.to_i)
2530
- if vertical
2531
- shift_left(source_row.to_i,source_col.to_i-1)
2532
- else
2533
- shift_top(source_row.to_i-1,source_col.to_i)
2534
- end
2535
- end
2536
- else # CLOSE OTHER
2537
- other_ds = domains_on_frame(@panels[_domain]['splitted_frames'].frame1)
2538
- if other_ds.length == 1
2539
- other_dom = other_ds[0]
2540
- else
2541
- if vertical
2542
- other_dom = domain_name(_row.to_i, _col.to_i-1)
2543
- else
2544
- other_dom = domain_name(_row.to_i-1, _col.to_i)
2545
- end
2546
- end
2547
- if @panels[_domain]['splitted_frames'] != @panels[other_dom]['splitted_frames']
2548
- if @panels[other_dom]['root_splitted_frames'] && @panels[other_dom]['root_splitted_frames'] != @panels[_domain]['splitted_frames']
2549
- other_root_splitted_adapter = @panels[other_dom]['root_splitted_frames']
2550
- elsif @panels[other_dom]['splitted_frames']
2551
- other_root_splitted_adapter = @panels[other_dom]['splitted_frames']
2552
- end
2553
- end
2554
-
2555
- if other_root_splitted_adapter
2556
- p "terzo quadrante"
2557
- other_root_splitted_adapter.detach_frame
2558
- splitted_adapter.detach_frame
2559
- splitted_adapter.destroy
2560
- other_root_splitted_adapter.attach_frame(splitted_adapter_frame)
2561
-
2562
- @frames[_row.to_i][_col.to_i] = nil
2563
- # @domains[_row.to_i][_col.to_i] = nil
2564
- @panels.delete(_domain)
2565
- else
2566
- p "quarto quadrante"
2567
- source_save = Hash.new
2568
- source_save.update(@panels[other_dom]['sons'])
2569
- source_save.each{|name,ffw|
2570
- unregister_panel(ffw, false, false)
2571
- }
2572
- splitted_adapter.detach_frame
2573
- splitted_adapter.destroy
2574
- @panels[other_dom]['root']=splitted_adapter_frame
2575
-
2576
- @frames[_row.to_i][_col.to_i] = nil
2577
- # @domains[_row.to_i][_col.to_i] = nil
2578
- build_titled_frame(other_dom)
2579
- @panels.delete(_domain)
2580
-
2581
- source_save.each{|name,ffw|
2582
- ffw.domain = other_dom
2583
- register_panel(ffw, ffw.hinner_frame)
2584
- }
2585
- #-----
2586
- parent_splitted_adapter = find_splitted_frame(@panels[other_dom]['root'])
2587
- if parent_splitted_adapter
2588
- @panels[other_dom]['splitted_frames']=parent_splitted_adapter
2589
- else
2590
- @panels[other_dom]['splitted_frames']= nil
2591
- end
2592
- other_row,other_col = other_dom.split('.')
2593
- @frames[other_row.to_i][other_col.to_i] = splitted_adapter_frame
2594
- # @domains[other_row.to_i][other_col.to_i] = other_dom
2595
- # if vertical
2596
- # @frames[_row.to_i][_col.to_i-1] = splitted_adapter_frame
2597
- # # @domains[_row.to_i][_col.to_i-1] = other_dom
2598
- # else
2599
- # @frames[_row.to_i-1][_col.to_i] = splitted_adapter_frame
2600
- # # @domains[_row.to_i-1][_col.to_i] = other_dom
2601
- # end
2602
- end
2603
-
2604
- if vertical
2605
- shift_left(_row.to_i,_col.to_i)
2606
- else
2607
- shift_top(_row.to_i,_col.to_i)
2608
- end
2609
- end
2610
- build_invert_menu(true)
2611
- end
2612
2370
 
2613
2371
  def find_splitted_frame(_start_frame)
2614
2372
  splitted_frame = _start_frame
@@ -2746,8 +2504,8 @@ class ArcadiaLayout
2746
2504
 
2747
2505
  def build_titled_frame(domain)
2748
2506
  if @panels[domain]
2749
- tframe = TkTitledFrame.new(@panels[domain]['root']).place('x'=>0, 'y'=>0,'relheight'=>1, 'relwidth'=>1)
2750
- mb = tframe.add_menu_button('ext')
2507
+ tframe = TkTitledFrameAdapter.new(@panels[domain]['root']).place('x'=>0, 'y'=>0,'relheight'=>1, 'relwidth'=>1)
2508
+ mb = tframe.add_fixed_menu_button('ext')
2751
2509
  # add commons item
2752
2510
  menu = mb.cget('menu')
2753
2511
  add_commons_menu_items(domain, menu)
@@ -2805,10 +2563,10 @@ class ArcadiaLayout
2805
2563
  end
2806
2564
 
2807
2565
  def change_domain(_target_domain, _source_name)
2808
- tt1= @panels[_target_domain]['root'].top_text
2566
+ #tt1= @panels[_target_domain]['root'].top_text
2809
2567
  source_domain = @wrappers[_source_name].domain
2810
2568
  source_has_domain = !source_domain.nil?
2811
- tt2= @panels[source_domain]['root'].top_text if source_has_domain
2569
+ #tt2= @panels[source_domain]['root'].top_text if source_has_domain
2812
2570
  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
2813
2571
  # change ------
2814
2572
  ffw1 = raised_fixed_frame(_target_domain)
@@ -2819,20 +2577,29 @@ class ArcadiaLayout
2819
2577
  ffw2.domain = _target_domain
2820
2578
  register_panel(ffw1, ffw1.hinner_frame) if ffw1
2821
2579
  register_panel(ffw2, ffw2.hinner_frame)
2822
- @panels[_target_domain]['root'].top_text(tt2)
2823
- @panels[source_domain]['root'].top_text(tt1)
2580
+ #@panels[_target_domain]['root'].top_text(tt2)
2581
+ #@panels[source_domain]['root'].top_text(tt1)
2582
+ @panels[_target_domain]['root'].save_caption(ffw2.name, @panels[source_domain]['root'].last_caption(ffw2.name))
2583
+ @panels[source_domain]['root'].save_caption(ffw1.name, @panels[_target_domain]['root'].last_caption(ffw1.name))
2584
+ @panels[_target_domain]['root'].restore_caption(ffw2.name)
2585
+ @panels[source_domain]['root'].restore_caption(ffw1.name)
2586
+ @panels[_target_domain]['root'].change_adapter(ffw2.name, @panels[source_domain]['root'].forge_transient_adapter(ffw2.name))
2587
+ @panels[source_domain]['root'].change_adapter(ffw1.name, @panels[_target_domain]['root'].forge_transient_adapter(ffw1.name))
2824
2588
  elsif source_has_domain && @panels[source_domain]['sons'].length >= 1
2825
2589
  ffw2 = @panels[source_domain]['sons'][_source_name]
2826
2590
  unregister_panel(ffw2, false, false)
2827
2591
  ffw2.domain = _target_domain
2828
2592
  register_panel(ffw2, ffw2.hinner_frame)
2829
- @panels[_target_domain]['root'].top_text(tt2)
2830
- @panels[source_domain]['root'].top_text('')
2593
+ #@panels[_target_domain]['root'].top_text(tt2)
2594
+ #@panels[source_domain]['root'].top_text('')
2595
+ @panels[_target_domain]['root'].save_caption(ffw2.name, @panels[source_domain]['root'].last_caption(ffw2.name))
2596
+ @panels[_target_domain]['root'].restore_caption(ffw2.name)
2597
+ @panels[_target_domain]['root'].change_adapter(ffw2.name, @panels[source_domain]['root'].forge_transient_adapter(ffw2.name))
2831
2598
  elsif !source_has_domain
2832
2599
  ffw2 = @wrappers[_source_name]
2833
2600
  ffw2.domain = _target_domain
2834
2601
  register_panel(ffw2, ffw2.hinner_frame)
2835
- @panels[_target_domain]['root'].top_text('')
2602
+ #@panels[_target_domain]['root'].top_text('')
2836
2603
  end
2837
2604
  # refresh -----
2838
2605
  build_invert_menu
@@ -2872,7 +2639,7 @@ class ArcadiaLayout
2872
2639
  @panels.keys.each{|dom|
2873
2640
  if dom != '_domain_root_' && dom != _ffw.domain && @panels[dom] && @panels[dom]['root']
2874
2641
  titledFrame = @panels[dom]['root']
2875
- if titledFrame.instance_of?(TkTitledFrame)
2642
+ if titledFrame.instance_of?(TkTitledFrameAdapter)
2876
2643
  menu = @panels[dom]['root'].menu_button('ext').cget('menu')
2877
2644
  menu.insert('0',:command,
2878
2645
  :label=>_ffw.title,
@@ -2886,7 +2653,7 @@ class ArcadiaLayout
2886
2653
  }
2887
2654
  if @panels[_ffw.domain]
2888
2655
  titledFrame = @panels[_ffw.domain]['root']
2889
- if titledFrame.instance_of?(TkTitledFrame)
2656
+ if titledFrame.instance_of?(TkTitledFrameAdapter)
2890
2657
  mymenu = titledFrame.menu_button('ext').cget('menu')
2891
2658
  index = mymenu.index('end').to_i
2892
2659
  if @panels.keys.length > 2
@@ -2914,7 +2681,7 @@ class ArcadiaLayout
2914
2681
  @panels.keys.each{|dom|
2915
2682
  if dom != '_domain_root_' && @panels[dom] && @panels[dom]['root']
2916
2683
  titledFrame = @panels[dom]['root']
2917
- if titledFrame.instance_of?(TkTitledFrame)
2684
+ if titledFrame.instance_of?(TkTitledFrameAdapter)
2918
2685
  menu = titledFrame.menu_button('ext').cget('menu')
2919
2686
  if refresh_commons_items
2920
2687
  @panels[dom]['root'].menu_button('ext').cget('menu').delete('0','end')
@@ -2956,23 +2723,23 @@ class ArcadiaLayout
2956
2723
  if pan!=nil
2957
2724
  num = pan['sons'].length
2958
2725
  if @headed
2726
+ root_frame = pan['root'].frame
2959
2727
  pan['root'].title(_title)
2960
- if !pan['root'].frame.instance_of?(TkFrameAdapter) && num==0
2728
+ pan['root'].restore_caption(_name)
2729
+ pan['root'].change_adapter_name(_name)
2730
+ if !root_frame.instance_of?(TkFrameAdapter) && num==0
2961
2731
  if _adapter
2962
2732
  adapter = _adapter
2963
2733
  else
2964
2734
  adapter = TkFrameAdapter.new(self.root, Arcadia.style('frame'))
2965
2735
  end
2966
- adapter.attach_frame(pan['root'].frame)
2736
+ adapter.attach_frame(root_frame)
2967
2737
  adapter.raise
2968
- #@wrappers[_name]=wrapper
2969
2738
  end
2970
- root_frame = pan['root'].frame
2971
2739
  else
2972
2740
  root_frame = pan['root']
2973
2741
  end
2974
2742
  if (num == 0 && @autotab)
2975
- #api = ArcadiaPanelInfo.new(_name,_title,wrapper,_ffw)
2976
2743
  pan['sons'][_name] = _ffw
2977
2744
  process_frame(_ffw)
2978
2745
  return adapter
@@ -2989,7 +2756,8 @@ class ArcadiaLayout
2989
2756
  'text'=>api.title,
2990
2757
  'raisecmd'=>proc{
2991
2758
  pan['root'].title(api.title)
2992
- pan['root'].top_text('')
2759
+ pan['root'].restore_caption(api.name)
2760
+ pan['root'].change_adapter_name(api.name)
2993
2761
  Arcadia.process_event(LayoutRaisingFrameEvent.new(self,'extension_name'=>pan['sons'][api.name].extension_name, 'frame_name'=>pan['sons'][api.name].name))
2994
2762
  # changed
2995
2763
  # notify_observers('RAISE', api.name)
@@ -3009,7 +2777,9 @@ class ArcadiaLayout
3009
2777
  _panel = pan['notebook'].insert('end',_name ,
3010
2778
  'text'=>_title,
3011
2779
  'raisecmd'=>proc{
3012
- pan['root'].title(_title)
2780
+ pan['root'].title(_title)
2781
+ pan['root'].restore_caption(_name)
2782
+ pan['root'].change_adapter_name(_name)
3013
2783
  Arcadia.process_event(LayoutRaisingFrameEvent.new(self,'extension_name'=>_ffw.extension_name, 'frame_name'=>_ffw.name))
3014
2784
  # changed
3015
2785
  # notify_observers('RAISE', _name)
@@ -3062,9 +2832,13 @@ class ArcadiaLayout
3062
2832
  if @panels[_domain_name]['sons'].length == 1
3063
2833
  w = @panels[_domain_name]['sons'].values[0].hinner_frame
3064
2834
  t = @panels[_domain_name]['sons'].values[0].title
2835
+ n = @panels[_domain_name]['sons'].values[0].name
3065
2836
  w.detach_frame
3066
2837
  w.attach_frame(@panels[_domain_name]['root'].frame)
3067
2838
  @panels[_domain_name]['root'].title(t)
2839
+ @panels[_domain_name]['root'].restore_caption(n)
2840
+ @panels[_domain_name]['root'].change_adapter_name(n)
2841
+
3068
2842
  @panels[_domain_name]['notebook'].destroy
3069
2843
  @panels[_domain_name]['notebook']=nil
3070
2844
  elsif @panels[_domain_name]['sons'].length > 1
@@ -3076,6 +2850,7 @@ class ArcadiaLayout
3076
2850
  #p "unregister #{_name} ------> 5"
3077
2851
  elsif @panels[_domain_name]['sons'].length == 0
3078
2852
  @panels[_domain_name]['root'].title('')
2853
+ @panels[_domain_name]['root'].top_text('')
3079
2854
  end
3080
2855
  build_invert_menu if refresh_menu
3081
2856
  end
@@ -3143,7 +2918,7 @@ class ArcadiaLayout
3143
2918
  ret = _frame
3144
2919
  # child = TkWinfo.children(_frame)[0]
3145
2920
  TkWinfo.children(_frame).each{|child|
3146
- if child.instance_of?(TkTitledFrame)
2921
+ if child.instance_of?(TkTitledFrameAdapter)
3147
2922
  ret = child.frame
3148
2923
  break
3149
2924
  end
@@ -3350,11 +3125,19 @@ class FocusEventManager
3350
3125
  end
3351
3126
 
3352
3127
  def do_upper_case(_focused_widget)
3353
- _replace_sel(_focused_widget, :upcase)
3128
+ if _focused_widget.respond_to?(:do_upper_case)
3129
+ _focused_widget.do_upper_case
3130
+ else
3131
+ _replace_sel(_focused_widget, :upcase)
3132
+ end
3354
3133
  end
3355
3134
 
3356
3135
  def do_lower_case(_focused_widget)
3357
- _replace_sel(_focused_widget, :downcase)
3136
+ if _focused_widget.respond_to?(:do_lower_case)
3137
+ _focused_widget.do_lower_case
3138
+ else
3139
+ _replace_sel(_focused_widget, :downcase)
3140
+ end
3358
3141
  end
3359
3142
 
3360
3143
  def _replace_sel(_focused_widget, _method)