arcadia 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -1,8 +1,8 @@
1
1
  = Arcadia Ide
2
- version 0.9.1
2
+ version 0.9.2
3
3
 
4
4
  by Antonio Galeone
5
- on Oct 19, 2010
5
+ on Nov 21, 2010
6
6
 
7
7
 
8
8
  == About
@@ -16,16 +16,11 @@ Some of Arcadia ide project features include:
16
16
  * Working on any platform where ruby and tcl-tk work.
17
17
  * Highly extensibility architecture.
18
18
 
19
- == In this release 0.9.1
19
+ == In this release 0.9.2
20
20
 
21
21
  [Improvements]
22
- commons:
23
- - bug-fixing
24
- new features:
25
- editor
26
- - added a button for close current tab
27
- - added menu button for quick file selection
28
- - "Edit/Prettify Current" now works
22
+ - bugs fixed in case of ruby 1.8 enviroment
23
+ - supported the maximized state saving of the main window
29
24
 
30
25
  == Dependencies
31
26
  - rubygems
@@ -129,50 +129,13 @@ class DirProjects < ArcadiaExt
129
129
  do_close_folder_cmd = proc{|_node| do_close_folder(_node)}
130
130
 
131
131
  # @htree = Tk::BWidget::Tree.new(self.frame.hinner_frame, Arcadia.style('treepanel')){
132
- @htree = Tk::BWidget::Tree.new(self.frame.hinner_frame, Arcadia.style('treepanel')){
132
+ @htree = BWidgetTreePatched.new(self.frame.hinner_frame, Arcadia.style('treepanel')){
133
133
  showlines false
134
134
  deltay 18
135
135
  opencmd do_open_folder_cmd
136
136
  closecmd do_close_folder_cmd
137
137
  selectcommand do_select_item
138
138
  }
139
-
140
- class << @htree
141
- def open?(node)
142
- bool(self.itemcget(tagid(node), 'open'))
143
- end
144
-
145
- def areabind(context, *args)
146
- if TkComm._callback_entry?(args[0]) || !block_given?
147
- cmd = args.shift
148
- else
149
- cmd = Proc.new
150
- end
151
- _bind_for_event_class(Event_for_Items, [path, 'bindArea'],
152
- context, cmd, *args)
153
- self
154
- end
155
-
156
- def areabind_append(context, *args)
157
- if TkComm._callback_entry?(args[0]) || !block_given?
158
- cmd = args.shift
159
- else
160
- cmd = Proc.new
161
- end
162
- _bind_append_for_event_class(Event_for_Items, [path, 'bindArea'],
163
- context, cmd, *args)
164
- self
165
- end
166
-
167
- def areabind_remove(*args)
168
- _bind_remove_for_event_class(Event_for_Items, [path, 'bindArea'], *args)
169
- self
170
- end
171
-
172
- def areabindinfo(*args)
173
- _bindinfo_for_event_class(Event_for_Items, [path, 'bindArea'], *args)
174
- end
175
- end
176
139
  @htree.extend(TkScrollableWidget).show(0,26)
177
140
  self.pop_up_menu_tree
178
141
  @image_kdir = TkPhotoImage.new('dat' => ICON_FOLDER_OPEN_GIF)
@@ -194,7 +157,25 @@ class DirProjects < ArcadiaExt
194
157
  }
195
158
 
196
159
  @htree.textbind_append('Double-1',do_double_click)
197
- end
160
+ end
161
+
162
+ def do_select_item2
163
+ proc{|_tree, _selected|
164
+ if File.exist?(node2file(_selected))
165
+ if File.ftype(node2file(_selected)) == 'file'
166
+ _sync_val = @sync
167
+ @sync = false
168
+ begin
169
+ Arcadia.process_event(OpenBufferTransientEvent.new(self,'file'=>node2file(_selected)))
170
+ ensure
171
+ @sync = _sync_val
172
+ end
173
+ end
174
+ else
175
+ shure_delete_node(_selected)
176
+ end
177
+ }
178
+ end
198
179
 
199
180
  def key_press(_keysym)
200
181
  case _keysym
@@ -535,8 +516,6 @@ class DirProjects < ArcadiaExt
535
516
  end
536
517
  _ret
537
518
  }
538
- # @htree.textbind('KeyPress', proc{|e|
539
- # p 'pippo'})
540
519
  @htree.edit(tmp_node_name, tmp_node_name.split(File::SEPARATOR)[-1], _verify_cmd, 1)
541
520
  end
542
521
 
@@ -817,14 +796,17 @@ class DirProjects < ArcadiaExt
817
796
  def shure_select_node(_node)
818
797
  return if @selecting_node
819
798
  @selecting_node = true
820
- _proc = @htree.selectcommand
821
- @htree.selectcommand(nil)
799
+ #_proc = @htree.selectcommand
800
+ #@htree.selectcommand(nil)
801
+ _proc = @htree.cget('selectcommand')
802
+ @htree.configure('selectcommand'=>nil)
822
803
  begin
823
804
  @htree.selection_clear
824
805
  @htree.selection_add(_node)
825
806
  @htree.see(_node)
826
807
  ensure
827
- @htree.selectcommand(_proc)
808
+ #@htree.selectcommand(_proc)
809
+ @htree.configure('selectcommand'=>_proc)
828
810
  @selecting_node = false
829
811
  end
830
812
  end
@@ -1284,7 +1284,7 @@ class AgEditor
1284
1284
  _buffer = @text.get(_begin_index, 'insert')
1285
1285
  _buffer_ini_length = _buffer.length
1286
1286
  @raised_listbox_frame.place('x'=>_xroot,'y'=>_yroot, 'width'=>_width, 'height'=>_height)
1287
- @raised_listbox.extend(TkScrollableWidget).show(0,0,'inside')
1287
+ @raised_listbox.extend(TkScrollableWidget).show(0,0)
1288
1288
  @raised_listbox.focus
1289
1289
  #@raised_listbox.activate(0)
1290
1290
  @raised_listbox.select(1)
@@ -3358,7 +3358,7 @@ class AgMultiEditor < ArcadiaExt
3358
3358
  entry_hash[:dir]= _event.dir if _event.dir
3359
3359
  entry_hash[:title]= "#{bn}"
3360
3360
 
3361
- Arcadia.persistent("runners.#{bn}", entry_hash.to_s)
3361
+ Arcadia.persistent("runners.#{bn}", entry_hash.inspect)
3362
3362
  # here add new menu' item
3363
3363
  mr = Arcadia.menu_root('runcurr')
3364
3364
  if mr
@@ -3368,7 +3368,7 @@ class AgMultiEditor < ArcadiaExt
3368
3368
  )
3369
3369
  }
3370
3370
  exts = ''
3371
- run = Application.runner(entry_hash[:runner])
3371
+ run = Arcadia.runner(entry_hash[:runner])
3372
3372
  if run
3373
3373
  file_exts = run[:file_exts]
3374
3374
  end
@@ -242,8 +242,10 @@ class FilesHistrory < ArcadiaExt
242
242
  _f = _f.downcase if is_windows?
243
243
  _file_node_rif = _d+'@@@'+_f
244
244
  if @htree.exist?(_file_node_rif)
245
- _proc = @htree.selectcommand
246
- @htree.selectcommand(proc{nil})
245
+ _proc = @htree.cget('selectcommand')
246
+ @htree.configure('selectcommand'=>nil)
247
+ #_proc = @htree.selectcommand
248
+ #@htree.selectcommand(proc{nil})
247
249
  begin
248
250
  parent = root.dir(_d)
249
251
  @htree.selection_clear
@@ -255,7 +257,8 @@ class FilesHistrory < ArcadiaExt
255
257
  end
256
258
  @htree.see(_file_node_rif)
257
259
  ensure
258
- @htree.selectcommand(_proc)
260
+ #@htree.selectcommand(_proc)
261
+ @htree.configure('selectcommand'=>_proc)
259
262
  end
260
263
  end
261
264
  end
@@ -140,7 +140,7 @@ end
140
140
 
141
141
  class Output < ArcadiaExt
142
142
  attr_reader :main_frame
143
-
143
+ MARKSUF='mark-'
144
144
  def on_before_build(_event)
145
145
  #ArcadiaContractListener.new(self, MsgContract, :do_msg_event)
146
146
  Arcadia.attach_listener(self, MsgEvent)
@@ -161,7 +161,9 @@ class Output < ArcadiaExt
161
161
  def on_msg(_event)
162
162
  self.frame.show
163
163
  if _event.mark
164
- _index_begin = "#{@main_frame.text.index(_event.mark)} + 1 lines + 1 chars"
164
+ _mark_index = _event.mark.sub(MARKSUF,'');
165
+ _index_begin = "#{_mark_index} + 1 lines + 1 chars"
166
+ #_index_begin = "#{@main_frame.text.index(_event.mark)} + 1 lines + 1 chars"
165
167
  # _b = Tk::BWidget::Button.new(@main_frame.text,
166
168
  # 'helptext'=>Time.now.strftime("-> %d-%b-%Y %H:%M:%S"),
167
169
  # 'background'=>Arcadia.style('edit')['background'],
@@ -194,7 +196,7 @@ class Output < ArcadiaExt
194
196
  end
195
197
  @main_frame.text.see(_index_end)
196
198
  @main_frame.text.mark_unset(_event.mark)
197
- _event.mark="mark-#{_index_end}"
199
+ _event.mark="#{MARKSUF}#{_index_end}"
198
200
  @main_frame.text.mark_set(_event.mark, "#{_index_end} - 1 lines -1 chars")
199
201
  # if _event.instance_of?(MsgRunEvent)
200
202
  # _b = TkButton.new(@main_frame.text,
@@ -139,16 +139,16 @@ class SearchOutput
139
139
  Arcadia.process_event(OpenBufferTransientEvent.new(self,'file'=>@results[n_parent][n][0], 'row'=>@results[n_parent][n][1])) if n && @results[n_parent][n]
140
140
  #EditorContract.instance.open_file(self, 'file'=>@results[n_parent][n][0], 'line'=>@results[n_parent][n][1]) if n && @results[n_parent][n]
141
141
  end
142
-
143
142
  @tree = Tk::BWidget::Tree.new(@ext.frame.hinner_frame, Arcadia.style('treepanel')){
144
143
  #background '#FFFFFF'
145
144
  #relief 'flat'
146
145
  #showlines true
147
146
  #linesfill '#e7de8f'
148
- selectcommand _open_file
147
+ selectcommand(_open_file)
149
148
  deltay 15
150
- }.place('x' => '25','y' => '0','relwidth' => '1', 'relheight' => '1', 'width' => '-40', 'height'=>'-15')
151
- @tree.extend(TkScrollableWidget).show
149
+ }
150
+ #.place('x' => '25','y' => '0','relwidth' => '1', 'relheight' => '1', 'width' => '-40', 'height'=>'-15')
151
+ @tree.extend(TkScrollableWidget).show(25,0)
152
152
 
153
153
  _proc_clear = proc{clear_tree}
154
154
 
@@ -193,15 +193,15 @@ class Shell < ArcadiaExt
193
193
  }
194
194
 
195
195
  alive_check = proc{
196
- num = `ps -p #{fi_pid}|wc -l`
197
- num.to_i > 1
196
+ num = `ps -p #{fi_pid}|wc -l` if fi_pid
197
+ num.to_i > 1 && fi_pid
198
198
  }
199
199
 
200
200
 
201
201
  #Arcadia.console(self,'msg'=>"#{th}", 'level'=>'debug', 'abort_action'=>abort_action)
202
202
 
203
203
  Open3.popen3(_cmd_){|stdin, stdout, stderr, th|
204
- fi_pid = th.pid
204
+ fi_pid = th.pid if th
205
205
  output_mark = Arcadia.console(self,'msg'=>" [pid #{fi_pid}]", 'level'=>'debug', 'mark'=>output_mark, 'append'=>true)
206
206
  Arcadia.process_event(SubProcessEvent.new(self, 'pid'=>fi_pid, 'name'=>_event.file,'abort_action'=>abort_action, 'alive_check'=>alive_check))
207
207
 
@@ -34,6 +34,13 @@ class SubProcessInspector < ArcadiaExt
34
34
  pr.event.abort_action.call if !pr.nil?
35
35
  }
36
36
  end
37
+
38
+ def do_delete_process(_process)
39
+ @processs.delete(_process)
40
+ if @processs.length == 0
41
+ self.frame.free
42
+ end
43
+ end
37
44
 
38
45
  end
39
46
 
@@ -98,7 +105,7 @@ class SubProcessWidget < TkFrame
98
105
  #p "ALIVE=#{alive}"
99
106
  if !alive
100
107
  @timer.stop
101
- @parent.processs.delete(self)
108
+ @parent.do_delete_process(self)
102
109
  self.destroy
103
110
  end
104
111
  @progress.numeric += 1
data/lib/a-core.rb CHANGED
@@ -22,7 +22,7 @@ class Arcadia < TkApplication
22
22
  super(
23
23
  ApplicationParams.new(
24
24
  'arcadia',
25
- '0.9.1',
25
+ '0.9.2',
26
26
  'conf/arcadia.conf',
27
27
  'conf/arcadia.pers'
28
28
  )
@@ -55,8 +55,6 @@ class Arcadia < TkApplication
55
55
  protocol( "WM_DELETE_WINDOW", $arcadia['action.on_exit'])
56
56
  iconphoto(TkPhotoImage.new('dat'=>ARCADIA_RING_GIF))
57
57
  }
58
-
59
-
60
58
  @on_event = Hash.new
61
59
 
62
60
  @main_menu_bar = TkMenubar.new(
@@ -102,6 +100,13 @@ class Arcadia < TkApplication
102
100
  @root.geometry(geometry)
103
101
  @root.raise
104
102
  Tk.update_idletasks
103
+ if self['conf']['geometry.state'] == 'zoomed'
104
+ if Arcadia.is_windows?
105
+ @root.state('zoomed')
106
+ else
107
+ @root.wm_attributes('zoomed',1)
108
+ end
109
+ end
105
110
  #sleep(1)
106
111
  @splash.destroy if @splash
107
112
  if @first_run # first ARCADIA ever
@@ -286,7 +291,7 @@ class Arcadia < TkApplication
286
291
  end
287
292
  end
288
293
 
289
- def load_maximised
294
+ def load_maximized
290
295
  lm = self['conf']['layout.maximized']
291
296
  if lm
292
297
  ext,index=lm.split(',')
@@ -592,7 +597,12 @@ class Arcadia < TkApplication
592
597
  mr.insert('0', :separator) if runs && !runs.empty?
593
598
  pers_runner = Hash.new
594
599
  runs.each{|name, hash_string|
595
- pers_runner[name]=eval hash_string
600
+ begin
601
+ pers_runner[name]=eval hash_string
602
+ rescue Exception => e
603
+ p "Loading runners : probably bud runner conf '#{hash_string}' : #{e.message}"
604
+ Arcadia.unpersistent("runners.#{name}")
605
+ end
596
606
  }
597
607
 
598
608
  pers_runner.each{|name, run|
@@ -723,8 +733,44 @@ class Arcadia < TkApplication
723
733
  _event.can_exit
724
734
  end
725
735
 
736
+ def geometry_refine(_geometry)
737
+ begin
738
+ a = geometry_to_a(_geometry)
739
+ toolbar_height = @root.winfo_height-@root.winfo_screenheight
740
+ a[3] = (a[3].to_i - toolbar_height).to_s
741
+ geometry_from_a(a)
742
+ rescue
743
+ return _geometry
744
+ end
745
+ end
746
+
747
+ def geometry_to_a(_geometry=nil)
748
+ return if _geometry.nil?
749
+ wh,x,y=_geometry.split('+')
750
+ w,h=wh.split('x')
751
+ [w,h,x,y]
752
+ end
753
+
754
+ def geometry_from_a(_a=nil)
755
+ return "0x0+0+0" if _a.nil? || _a.length < 4
756
+ "#{_a[0]}x#{_a[1]}+#{_a[2]}+#{_a[3]}"
757
+ end
758
+
726
759
  def save_layout
727
- self['conf']['geometry']= TkWinfo.geometry(@root)
760
+ self['conf']['geometry']= geometry_refine(TkWinfo.geometry(@root))
761
+ begin
762
+ if Arcadia.is_windows?
763
+ self['conf']['geometry.state'] = @root.state.to_s
764
+ else
765
+ if @root.wm_attributes('zoomed') == '1'
766
+ self['conf']['geometry.state']='zoomed'
767
+ else
768
+ self['conf']['geometry.state']='normal'
769
+ end
770
+ end
771
+ rescue
772
+ self['conf']['geometry.state']='not_supported'
773
+ end
728
774
  Arcadia.del_conf_group(self['conf'],'layout')
729
775
  # resizing
730
776
  @exts_i.each{|e|
data/lib/a-tkcommons.rb CHANGED
@@ -11,15 +11,15 @@ class BWidgetTreePatched < Tk::BWidget::Tree
11
11
  def open?(node)
12
12
  bool(self.itemcget(tagid(node), 'open'))
13
13
  end
14
-
14
+
15
15
  def areabind(context, *args)
16
16
  if TkComm._callback_entry?(args[0]) || !block_given?
17
17
  cmd = args.shift
18
18
  else
19
19
  cmd = Proc.new
20
20
  end
21
- _bind_for_event_class(Event_for_Items, [path, 'bindArea'],
22
- context, cmd, *args)
21
+ _bind_for_event_class(Event_for_Items, [path, 'bindArea'],
22
+ context, cmd, *args)
23
23
  self
24
24
  end
25
25
 
@@ -29,8 +29,8 @@ class BWidgetTreePatched < Tk::BWidget::Tree
29
29
  else
30
30
  cmd = Proc.new
31
31
  end
32
- _bind_append_for_event_class(Event_for_Items, [path, 'bindArea'],
33
- context, cmd, *args)
32
+ _bind_append_for_event_class(Event_for_Items, [path, 'bindArea'],
33
+ context, cmd, *args)
34
34
  self
35
35
  end
36
36
 
@@ -43,6 +43,9 @@ class BWidgetTreePatched < Tk::BWidget::Tree
43
43
  _bindinfo_for_event_class(Event_for_Items, [path, 'bindArea'], *args)
44
44
  end
45
45
 
46
+ # def selectcommand(_proc=nil)
47
+ # self.configure('selectcommand'=>_proc)
48
+ # end
46
49
  end
47
50
 
48
51
 
@@ -52,11 +55,11 @@ class TkApplication < Application
52
55
  super(_application_params)
53
56
  @tcltk_info = TclTkInfo.new
54
57
  end
55
-
58
+
56
59
  def self.sys_info
57
- "#{super}\n[TclTk version = #{TclTkInfo.new.level}]"
60
+ "#{super}\n[TclTk version = #{TclTkInfo.new.level}]"
58
61
  end
59
-
62
+
60
63
  def run
61
64
  Tk.appname(self['applicationParams'].name)
62
65
  Tk.mainloop
@@ -77,18 +80,18 @@ module TkMovable
77
80
  @moving_obj.bind_remove("B1-Motion")
78
81
  @moving_obj.bind_remove("ButtonPress-1")
79
82
  end
80
-
83
+
81
84
  def moving_do_press(_x, _y)
82
- @x0 = _x
83
- @y0 = _y
85
+ @x0 = _x
86
+ @y0 = _y
84
87
  end
85
-
88
+
86
89
  def moving_do_move_obj(_x, _y)
87
90
  _x = TkPlace.info(@moved_obj)['x'] + _x - @x0
88
91
  _y = TkPlace.info(@moved_obj)['y'] + _y - @y0
89
92
  @moved_obj.place('x'=>_x, 'y'=>_y)
90
93
  end
91
-
94
+
92
95
  end
93
96
 
94
97
  module TkResizable
@@ -107,12 +110,12 @@ module TkResizable
107
110
  @moving_obj.bind_remove("B1-Motion")
108
111
  @moving_obj.bind_remove("ButtonPress-1")
109
112
  end
110
-
113
+
111
114
  def resizing_do_press(_x, _y)
112
- @x0 = _x
113
- @y0 = _y
115
+ @x0 = _x
116
+ @y0 = _y
114
117
  end
115
-
118
+
116
119
  def resizing_do_move_obj(_x, _y)
117
120
  _width0 = TkPlace.info(@moved_obj)['width']
118
121
  _height0 = TkPlace.info(@moved_obj)['height']
@@ -122,7 +125,7 @@ module TkResizable
122
125
  _height = MIN_HEIGHT if _height < MIN_HEIGHT
123
126
  @moved_obj.place('width'=>_width, 'height'=>_height)
124
127
  end
125
-
128
+
126
129
  end
127
130
 
128
131
 
@@ -247,27 +250,27 @@ class TkFrameAdapter < TkFrame
247
250
  @movable = true
248
251
  start_moving(_obj, self)
249
252
  end
250
-
253
+
251
254
  def detach_frame
252
- if @frame
255
+ if @frame
253
256
  if @movable
254
- @frame.bind_remove("Configure")
255
- @frame.bind_remove("Map")
256
- @frame.bind_remove("Unmap")
257
+ @frame.bind_remove("Configure")
258
+ @frame.bind_remove("Map")
259
+ @frame.bind_remove("Unmap")
257
260
  end
258
261
  @frame = nil
259
262
  self.unmap
260
263
  end
261
264
  end
262
-
265
+
263
266
  def unmap
264
267
  if is_place?
265
268
  self.unplace
266
269
  elsif is_pack?
267
270
  self.unpack
268
- end
271
+ end
269
272
  end
270
-
273
+
271
274
  def attach_frame(_frame)
272
275
  @frame = _frame
273
276
  @frame_manager = TkWinfo.manager(@frame)
@@ -287,15 +290,15 @@ class TkFrameAdapter < TkFrame
287
290
  def is_pack?
288
291
  @frame_manager == 'pack'
289
292
  end
290
-
293
+
291
294
  def refresh(_x=0, _y=0)
292
- if is_place?
295
+ if is_place?
293
296
  place('in'=>@frame, 'x'=>_x, 'y'=>_y, 'relheight'=> 1, 'relwidth'=>1, 'bordermode'=>'outside')
294
297
  elsif is_pack?
295
298
  pack('in'=>@frame, 'fill'=>'both', 'expand'=>true)
296
299
  end
297
300
  end
298
-
301
+
299
302
  end
300
303
 
301
304
  class AGTkSplittedFrames < TkFrameAdapter
@@ -340,19 +343,19 @@ class AGTkVSplittedFrames < AGTkSplittedFrames
340
343
  @frame1 = @left_frame
341
344
  if perc
342
345
  p_width = TkWinfo.screenwidth(self)
343
- x = (p_width/100*width).to_i
346
+ x = (p_width/100*width).to_i
344
347
  else
345
- x = width
348
+ x = width
346
349
  end
347
-
350
+
348
351
  @left_frame.place(
349
- 'relx' => 0,
350
- 'x' => 0,
351
- 'y' => '0',
352
- 'relheight' => '1',
353
- 'rely' => 0,
354
- 'bordermode' => 'inside',
355
- 'width' => x
352
+ 'relx' => 0,
353
+ 'x' => 0,
354
+ 'y' => '0',
355
+ 'relheight' => '1',
356
+ 'rely' => 0,
357
+ 'bordermode' => 'inside',
358
+ 'width' => x
356
359
  )
357
360
  @left_frame_obj = AGTkObjPlace.new(@left_frame, 'x', nil, false)
358
361
  @left_frame_obj.width = x
@@ -363,47 +366,47 @@ class AGTkVSplittedFrames < AGTkSplittedFrames
363
366
  @splitter_frame = TkFrame.new(self, Arcadia.style('splitter'))
364
367
 
365
368
  @splitter_frame.place(
366
- 'relx' => 0,
367
- 'x' => x,
368
- 'y' => '0',
369
- 'relheight' => '1',
370
- 'rely' => 0,
371
- 'bordermode' => 'inside',
372
- 'width' => @slen
369
+ 'relx' => 0,
370
+ 'x' => x,
371
+ 'y' => '0',
372
+ 'relheight' => '1',
373
+ 'rely' => 0,
374
+ 'bordermode' => 'inside',
375
+ 'width' => @slen
373
376
  )
374
-
377
+
375
378
  if @user_control
376
379
  @splitter_frame.bind_append(
377
- "ButtonRelease-1",
378
- proc{do_resize}
380
+ "ButtonRelease-1",
381
+ proc{do_resize}
379
382
  )
380
383
  _xbutton = TkButton.new(@splitter_frame, Arcadia.style('toolbarbutton')){
381
384
  background '#4966d7'
382
385
  }
383
386
  _xbutton.place(
384
- 'x' => 0,
385
- 'y' => 0,
386
- 'relwidth' => 1,
387
- 'bordermode' => 'outside',
388
- 'height' => 20
387
+ 'x' => 0,
388
+ 'y' => 0,
389
+ 'relwidth' => 1,
390
+ 'bordermode' => 'outside',
391
+ 'height' => 20
389
392
  )
390
393
  _xbutton.bind_append(
391
- "ButtonPress-1",
392
- proc{hide_left}
394
+ "ButtonPress-1",
395
+ proc{hide_left}
393
396
  )
394
397
  _ybutton = TkButton.new(@splitter_frame, Arcadia.style('toolbarbutton')){
395
398
  background '#118124'
396
399
  }
397
400
  _ybutton.place(
398
- 'x' => 0,
399
- 'y' => 21,
400
- 'bordermode' => 'outside',
401
- 'height' => 20,
402
- 'relwidth' => 1
401
+ 'x' => 0,
402
+ 'y' => 21,
403
+ 'bordermode' => 'outside',
404
+ 'height' => 20,
405
+ 'relwidth' => 1
403
406
  )
404
407
  _ybutton.bind_append(
405
- "ButtonPress-1",
406
- proc{hide_right}
408
+ "ButtonPress-1",
409
+ proc{hide_right}
407
410
  )
408
411
  end
409
412
  #-----
@@ -417,14 +420,14 @@ class AGTkVSplittedFrames < AGTkSplittedFrames
417
420
  @right_frame = TkFrame.new(self, Arcadia.style('panel'))
418
421
  @frame2 = @right_frame
419
422
  @right_frame.place(
420
- 'relwidth' => 1,
421
- 'relx' => 0,
422
- 'x' => x,
423
- 'y' => 0,
424
- 'width' => -x,
425
- 'relheight' => 1,
426
- 'rely' => 0,
427
- 'bordermode' => 'inside'
423
+ 'relwidth' => 1,
424
+ 'relx' => 0,
425
+ 'x' => x,
426
+ 'y' => 0,
427
+ 'width' => -x,
428
+ 'relheight' => 1,
429
+ 'rely' => 0,
430
+ 'bordermode' => 'inside'
428
431
  )
429
432
  @right_frame_obj = AGTkObjPlace.new(@right_frame, 'x', nil, false)
430
433
  @right_frame_obj.width = -x
@@ -483,7 +486,7 @@ class AGTkVSplittedFrames < AGTkSplittedFrames
483
486
  @right_frame_obj.width = - _w - @slen
484
487
  @right_frame_obj.amove(_w + @slen,0)
485
488
  end
486
-
489
+
487
490
  def is_left_hide?
488
491
  @left_frame_obj.w == 0
489
492
  end
@@ -553,21 +556,21 @@ class AGTkOSplittedFrames < AGTkSplittedFrames
553
556
  def initialize(parent=nil, frame=nil, height=10, slen=5, perc=false, user_control=true, keys=nil)
554
557
  super(parent, frame, height, slen, user_control, keys)
555
558
  @top_frame = TkFrame.new(self, Arcadia.style('panel')){
556
- # relief 'flat'
559
+ # relief 'flat'
557
560
  }
558
561
  @frame1 = @top_frame
559
562
  if perc
560
- p_height = TkWinfo.screenheight(self)
561
- y = (p_height/100*height).to_i
563
+ p_height = TkWinfo.screenheight(self)
564
+ y = (p_height/100*height).to_i
562
565
  else
563
566
  y = height
564
567
  end
565
568
  @top_frame.place(
566
- 'relwidth' => '1',
567
- 'bordermode' => 'inside',
568
- 'height' => y
569
+ 'relwidth' => '1',
570
+ 'bordermode' => 'inside',
571
+ 'height' => y
569
572
  )
570
-
573
+
571
574
  @top_frame_obj = AGTkObjPlace.new(@top_frame, 'y', nil, false)
572
575
  @top_frame_obj.width = 0
573
576
  @top_frame_obj.height = y
@@ -578,13 +581,13 @@ class AGTkOSplittedFrames < AGTkSplittedFrames
578
581
  #border 1
579
582
  }
580
583
  @splitter_frame.place(
581
- 'relx' => 0,
582
- 'x' => 0,
583
- 'y' => y,
584
- 'relwidth' => '1',
585
- 'rely' => 0,
586
- 'bordermode' => 'inside',
587
- 'height' => @slen
584
+ 'relx' => 0,
585
+ 'x' => 0,
586
+ 'y' => y,
587
+ 'relwidth' => '1',
588
+ 'rely' => 0,
589
+ 'bordermode' => 'inside',
590
+ 'height' => @slen
588
591
  )
589
592
  @splitter_frame_obj = AGTkObjPlace.new(@splitter_frame, 'y', nil, user_control)
590
593
  @splitter_frame_obj.width = 0
@@ -593,18 +596,18 @@ class AGTkOSplittedFrames < AGTkSplittedFrames
593
596
  @splitter_frame_obj.relheight = 0
594
597
  y = y + @slen
595
598
  @bottom_frame = TkFrame.new(self, Arcadia.style('panel')){
596
- # relief 'flat'
599
+ # relief 'flat'
597
600
  }
598
601
  @frame2 = @bottom_frame
599
602
  @bottom_frame.place(
600
- 'relwidth' => 1,
601
- 'relx' => 0,
602
- 'x' => 0,
603
- 'y' => y,
604
- 'height' => -y,
605
- 'relheight' => 1,
606
- 'rely' => 0,
607
- 'bordermode' => 'inside'
603
+ 'relwidth' => 1,
604
+ 'relx' => 0,
605
+ 'x' => 0,
606
+ 'y' => y,
607
+ 'height' => -y,
608
+ 'relheight' => 1,
609
+ 'rely' => 0,
610
+ 'bordermode' => 'inside'
608
611
  )
609
612
  @bottom_frame_obj = AGTkObjPlace.new(@bottom_frame, 'y', nil, false)
610
613
  @bottom_frame_obj.width = 0
@@ -613,40 +616,40 @@ class AGTkOSplittedFrames < AGTkSplittedFrames
613
616
  @bottom_frame_obj.relheight = 1
614
617
  if @user_control
615
618
  @splitter_frame.bind_append(
616
- "B1-Motion",
617
- proc{@splitter_frame.raise}
619
+ "B1-Motion",
620
+ proc{@splitter_frame.raise}
618
621
  )
619
622
  @splitter_frame.bind_append(
620
- "ButtonRelease-1",
621
- proc{do_resize}
623
+ "ButtonRelease-1",
624
+ proc{do_resize}
622
625
  )
623
626
  _xbutton = TkButton.new(@splitter_frame, Arcadia.style('toolbarbutton')){
624
627
  background '#4966d7'
625
628
  }
626
629
  _xbutton.place(
627
- 'x' => 0,
628
- 'y' => 0,
629
- 'relheight' => 1,
630
- 'bordermode' => 'outside',
631
- 'width' => 20
630
+ 'x' => 0,
631
+ 'y' => 0,
632
+ 'relheight' => 1,
633
+ 'bordermode' => 'outside',
634
+ 'width' => 20
632
635
  )
633
636
  _xbutton.bind_append(
634
- "ButtonPress-1",
635
- proc{hide_top}
637
+ "ButtonPress-1",
638
+ proc{hide_top}
636
639
  )
637
640
  _ybutton = TkButton.new(@splitter_frame, Arcadia.style('toolbarbutton')){
638
641
  background '#118124'
639
642
  }
640
643
  _ybutton.place(
641
- 'x' => 21,
642
- 'y' => 0,
643
- 'bordermode' => 'outside',
644
- 'width' => 20,
645
- 'relheight' => 1
644
+ 'x' => 21,
645
+ 'y' => 0,
646
+ 'bordermode' => 'outside',
647
+ 'width' => 20,
648
+ 'relheight' => 1
646
649
  )
647
650
  _ybutton.bind_append(
648
- "ButtonPress-1",
649
- proc{hide_bottom}
651
+ "ButtonPress-1",
652
+ proc{hide_bottom}
650
653
  )
651
654
  end
652
655
  @state = 'middle'
@@ -879,10 +882,10 @@ class TkTitledFrame < TkBaseTitledFrame
879
882
  def create_right_label
880
883
  __create_right_label(@top)
881
884
  end
882
-
885
+
883
886
  def __create_left_label(_frame)
884
887
  @title.nil??_text_title ='':_text_title = @title+' :: '
885
- _img=@img
888
+ _img=@img
886
889
  TkLabel.new(_frame, Arcadia.style('titlelabel')){
887
890
  text _text_title
888
891
  anchor 'w'
@@ -901,7 +904,7 @@ class TkTitledFrame < TkBaseTitledFrame
901
904
  pack('side'=> 'left','anchor'=> 'e')
902
905
  }
903
906
  end
904
-
907
+
905
908
  def title(_text=nil)
906
909
  if _text.nil?
907
910
  return @title
@@ -926,11 +929,11 @@ class TkTitledFrame < TkBaseTitledFrame
926
929
  def save_caption(_name, _caption)
927
930
  @right_labels_text[_name] = _caption
928
931
  end
929
-
932
+
930
933
  def last_caption(_name)
931
934
  @right_labels_text[_name]
932
- end
933
-
935
+ end
936
+
934
937
  def restore_caption(_name)
935
938
  if @right_labels_text[_name]
936
939
  top_text(@right_labels_text[_name])
@@ -939,9 +942,9 @@ class TkTitledFrame < TkBaseTitledFrame
939
942
  end
940
943
  end
941
944
 
942
- # def top_text(_text)
943
- # @right_label.text(_text)
944
- # end
945
+ # def top_text(_text)
946
+ # @right_label.text(_text)
947
+ # end
945
948
 
946
949
  def head_buttons
947
950
  @bmaxmin = add_fixed_button('[ ]',proc{resize}, W_MAX_GIF)
@@ -965,7 +968,7 @@ class TkTitledFrame < TkBaseTitledFrame
965
968
  end
966
969
  self.raise
967
970
  end
968
-
971
+
969
972
  def maximized?
970
973
  @state == 'maximize'
971
974
  end
@@ -1010,20 +1013,20 @@ end
1010
1013
  # @god_parent = god_parent
1011
1014
  # #add_moved_by(self)
1012
1015
  # end
1013
- #
1016
+ #
1014
1017
  # def add_moved_by(_obj)
1015
1018
  # start_moving(_obj, self)
1016
1019
  # end
1017
1020
  #
1018
1021
  # def detach_frame
1019
- # if @frame
1020
- # @frame.bind_remove("Configure")
1021
- # @frame.bind_remove("Map")
1022
- # @frame.bind_remove("Unmap")
1022
+ # if @frame
1023
+ # @frame.bind_remove("Configure")
1024
+ # @frame.bind_remove("Map")
1025
+ # @frame.bind_remove("Unmap")
1023
1026
  # @frame = nil
1024
1027
  # end
1025
1028
  # end
1026
- #
1029
+ #
1027
1030
  # def attach_frame(_frame)
1028
1031
  # @frame = _frame
1029
1032
  # init
@@ -1040,9 +1043,9 @@ end
1040
1043
  # @last_y = 0
1041
1044
  # @last_w = 100
1042
1045
  # @last_h = 100
1043
- # reset_offset
1044
- # end
1045
- #
1046
+ # reset_offset
1047
+ # end
1048
+ #
1046
1049
  # def reset
1047
1050
  # w = TkPlace.info(@frame)['width']
1048
1051
  # h = TkPlace.info(@frame)['height']
@@ -1050,7 +1053,7 @@ end
1050
1053
  # y = TkPlace.info(@frame)['y']
1051
1054
  # refresh(x,y,w,h)
1052
1055
  # end
1053
- #
1056
+ #
1054
1057
  # def reset_offset
1055
1058
  # @x0=0
1056
1059
  # @y0=0
@@ -1062,9 +1065,9 @@ end
1062
1065
  # @x0=@x0+xc if xc
1063
1066
  # @y0=@y0+yc if yc
1064
1067
  # parent= TkWinfo.parent(parent)
1065
- # end
1068
+ # end
1066
1069
  # end
1067
- #
1070
+ #
1068
1071
  # def refresh(_x=nil, _y=nil, _w=nil, _h=nil)
1069
1072
  # reset_offset
1070
1073
  # _x=@last_x if _x.nil?
@@ -1092,11 +1095,11 @@ end
1092
1095
  # @wrapper.attach_frame(@frame)
1093
1096
  # @frame=@wrapper
1094
1097
  # end
1095
- #
1098
+ #
1096
1099
  # def change_wrapper(_new_wrapper)
1097
1100
  # @wrapper = _new_wrapper
1098
1101
  # @frame = _new_wrapper
1099
- # end
1102
+ # end
1100
1103
  #
1101
1104
  # # def initialize(root_parent=nil, parent=nil, title=nil, img=nil , keys=nil)
1102
1105
  # # @root_parent = root_parent
@@ -1106,7 +1109,7 @@ end
1106
1109
  # # #@wrapper.add_moved_by(@top)
1107
1110
  # # @wrapper.attach_frame(parent)
1108
1111
  # # end
1109
- #
1112
+ #
1110
1113
  #end
1111
1114
 
1112
1115
  class TkTitledFrameAdapter < TkTitledFrame
@@ -1122,23 +1125,23 @@ class TkTitledFrameAdapter < TkTitledFrame
1122
1125
  }
1123
1126
  @transient_frame_adapter = Hash.new
1124
1127
  end
1125
-
1128
+
1126
1129
  def forge_transient_adapter(_name)
1127
1130
  if @transient_frame_adapter[_name].nil?
1128
- @transient_frame_adapter[_name] = TkFrameAdapter.new(Arcadia.layout.root,
1129
- Arcadia.style('frame').update({'background'=> Arcadia.conf('titlelabel.background')}))
1131
+ @transient_frame_adapter[_name] = TkFrameAdapter.new(Arcadia.layout.root,
1132
+ Arcadia.style('frame').update({'background'=> Arcadia.conf('titlelabel.background')}))
1130
1133
  __attach_adapter(@transient_frame_adapter[_name])
1131
1134
  @transient_frame_adapter[_name].raise
1132
1135
  end
1133
1136
  @transient_frame_adapter[_name]
1134
1137
  end
1135
-
1138
+
1136
1139
  def __attach_adapter(_adapter)
1137
1140
  @last_attached_adapter.detach_frame if @last_attached_adapter
1138
1141
  _adapter.attach_frame(@transient_frame)
1139
1142
  @last_attached_adapter = _adapter
1140
1143
  end
1141
-
1144
+
1142
1145
  def change_adapter(_name, _adapter)
1143
1146
  @transient_frame_adapter[_name] = _adapter
1144
1147
  @transient_frame_adapter[_name].detach_frame
@@ -1165,7 +1168,7 @@ class TkTitledFrameAdapter < TkTitledFrame
1165
1168
  forge_transient_adapter(_sender_name)
1166
1169
  __add_sep(_width, @transient_frame_adapter[_sender_name])
1167
1170
  end
1168
-
1171
+
1169
1172
  end
1170
1173
 
1171
1174
 
@@ -1214,14 +1217,14 @@ class TkFloatTitledFrame < TkBaseTitledFrame
1214
1217
  start_moving(frame, self)
1215
1218
  start_resizing(@resizing_label, self)
1216
1219
  @grabbed = false
1217
- # frame.bind_append('KeyPress'){|e|
1218
- # p e.keysym
1219
- # case e.keysym
1220
- # when 'Escape'
1221
- # p "WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW"
1222
- # hide
1223
- # end
1224
- # }
1220
+ # frame.bind_append('KeyPress'){|e|
1221
+ # p e.keysym
1222
+ # case e.keysym
1223
+ # when 'Escape'
1224
+ # p "WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW"
1225
+ # hide
1226
+ # end
1227
+ # }
1225
1228
  end
1226
1229
 
1227
1230
  def title(_text)
@@ -1231,24 +1234,24 @@ class TkFloatTitledFrame < TkBaseTitledFrame
1231
1234
  def on_close=(_proc)
1232
1235
  add_fixed_button('X', _proc, TAB_CLOSE_GIF)
1233
1236
  end
1234
-
1237
+
1235
1238
  def hide
1236
- @manager = TkWinfo.manager(self)
1239
+ @manager = TkWinfo.manager(self)
1237
1240
  if @manager == 'place'
1238
- @x_place = TkPlace.info(self)['x']
1239
- @y_place = TkPlace.info(self)['y']
1240
- @width_place = TkPlace.info(self)['width']
1241
- @height_place = TkPlace.info(self)['height']
1242
- self.unplace
1241
+ @x_place = TkPlace.info(self)['x']
1242
+ @y_place = TkPlace.info(self)['y']
1243
+ @width_place = TkPlace.info(self)['width']
1244
+ @height_place = TkPlace.info(self)['height']
1245
+ self.unplace
1243
1246
  end
1244
-
1247
+
1245
1248
  if @grabbed
1246
1249
  self.grab("release")
1247
1250
  @grabbed = false
1248
1251
  end
1249
1252
  self
1250
1253
  end
1251
-
1254
+
1252
1255
  def show
1253
1256
  if @manager == 'place'
1254
1257
  self.place('x'=>@x_place, 'y'=>@y_place, 'width'=>@width_place, 'height'=>@height_place)
@@ -1261,11 +1264,11 @@ class TkFloatTitledFrame < TkBaseTitledFrame
1261
1264
  @grabbed = true
1262
1265
  self.grab("set")
1263
1266
  end
1264
-
1265
- # def show_modal
1266
- # # not implemented
1267
- # end
1268
-
1267
+
1268
+ # def show_modal
1269
+ # # not implemented
1270
+ # end
1271
+
1269
1272
  def head_buttons
1270
1273
  end
1271
1274
 
@@ -1280,14 +1283,14 @@ class TkProgressframe < TkFloatTitledFrame
1280
1283
  @progress = TkVariable.new
1281
1284
  @progress.value = -1
1282
1285
  Tk::BWidget::ProgressBar.new(self, :width=>150, :height=>10,
1283
- :background=>'red',
1284
- :foreground=>'blue',
1285
- :variable=>@progress,
1286
- :borderwidth=>0,
1287
- :relief=>'flat',
1288
- :maximum=>_max).place('width' => '150','x' => 25,'y' => 30,'height' => 15)
1289
-
1290
- @buttons_frame = TkFrame.new(self).pack('fill'=>'x', 'side'=>'bottom')
1286
+ :background=>'red',
1287
+ :foreground=>'blue',
1288
+ :variable=>@progress,
1289
+ :borderwidth=>0,
1290
+ :relief=>'flat',
1291
+ :maximum=>_max).place('width' => '150','x' => 25,'y' => 30,'height' => 15)
1292
+
1293
+ @buttons_frame = TkFrame.new(self).pack('fill'=>'x', 'side'=>'bottom')
1291
1294
 
1292
1295
  @b_cancel = TkButton.new(@buttons_frame){|_b_go|
1293
1296
  default 'disabled'
@@ -1299,11 +1302,11 @@ class TkProgressframe < TkFloatTitledFrame
1299
1302
 
1300
1303
  place('x'=>100,'y'=>100,'height'=> 120,'width'=> 200)
1301
1304
  end
1302
-
1305
+
1303
1306
  def quit
1304
1307
  #self.destroy
1305
1308
  end
1306
-
1309
+
1307
1310
  def progress(_incr=1)
1308
1311
  @progress.numeric += _incr
1309
1312
  end
@@ -1314,7 +1317,7 @@ class TkProgressframe < TkFloatTitledFrame
1314
1317
  end
1315
1318
 
1316
1319
  class TkBuffersChoiseView < TkToplevel
1317
-
1320
+
1318
1321
  def initialize
1319
1322
  super
1320
1323
  Tk.tk_call('wm', 'title', self, '...hello' )
@@ -1325,11 +1328,11 @@ class TkBuffersChoiseView < TkToplevel
1325
1328
  place('relwidth' => '1','relx' => 0,'x' => '0','y' => '0','relheight' => '1','rely' => 0,'height' => '0','bordermode' => 'inside','width' => '0')
1326
1329
  }
1327
1330
  end
1328
-
1331
+
1329
1332
  end
1330
1333
 
1331
1334
  class TkBuffersChoise < TkBuffersChoiseView
1332
-
1335
+
1333
1336
  def initialize
1334
1337
  super
1335
1338
  @lb.value= $arcadia['buffers.code.in_memory'].keys
@@ -1342,7 +1345,7 @@ class TkBuffersChoise < TkBuffersChoiseView
1342
1345
  })
1343
1346
  raise
1344
1347
  end
1345
-
1348
+
1346
1349
  end
1347
1350
 
1348
1351
  class TclTkInfo
@@ -1374,39 +1377,39 @@ class TkWidgetFactory
1374
1377
  initialize_tile_widgets if @use_tile
1375
1378
  end
1376
1379
  end
1377
-
1380
+
1378
1381
  def initialize_tile_widgets
1379
1382
  #TScrollbar
1380
1383
  Tk::Tile::Style.configure("Arcadia.TScrollbar", Arcadia.style('scrollbar'))
1381
- Tk::Tile::Style.map("Arcadia.TScrollbar",
1382
- :background=>[:pressed, '#694418', :disabled, '#333333', :active, Arcadia.style('scrollbar')['activebackground']],
1383
- :arrowcolor=>[:pressed, '#FEF7CB', :disabled, Arcadia.style('scrollbar')['background'], :active, Arcadia.style('scrollbar')['activebackground']],
1384
- :relief=>[:pressed, :sunken])
1385
-
1386
- Tk::Tile::Style.layout(Tk::Tile.style('Vertical', "Arcadia.TScrollbar"),
1387
- ["Scrollbar.trough",{:sticky=>"nsew", :children=>[
1388
- "Scrollbar.uparrow",{:side=>:top, :sticky=>"we"},
1389
- "Scrollbar.downarrow", {:side=>:bottom, :sticky=>"we"},
1390
- "Scrollbar.thumb", {:sticky=>"nswe",:side=>:top, :border =>1, :expand=>true}]}])
1391
-
1392
- Tk::Tile::Style.layout(Tk::Tile.style('Horizontal', "Arcadia.TScrollbar"),
1393
- ['Scrollbar.trough', {:children=>[
1394
- 'Scrollbar.leftarrow', {:side=>:left},
1395
- 'Scrollbar.rightarrow', {:side=>:right},
1396
- 'Scrollbar.thumb', {:side=>:left, :expand=>true}]}])
1397
-
1398
- #TFrame
1384
+ Tk::Tile::Style.map("Arcadia.TScrollbar",
1385
+ :background=>[:pressed, '#694418', :disabled, '#333333', :active, Arcadia.style('scrollbar')['activebackground']],
1386
+ :arrowcolor=>[:pressed, '#FEF7CB', :disabled, Arcadia.style('scrollbar')['background'], :active, Arcadia.style('scrollbar')['activebackground']],
1387
+ :relief=>[:pressed, :sunken])
1388
+
1389
+ Tk::Tile::Style.layout(Tk::Tile.style('Vertical', "Arcadia.TScrollbar"),
1390
+ ["Scrollbar.trough",{:sticky=>"nsew", :children=>[
1391
+ "Scrollbar.uparrow",{:side=>:top, :sticky=>"we"},
1392
+ "Scrollbar.downarrow", {:side=>:bottom, :sticky=>"we"},
1393
+ "Scrollbar.thumb", {:sticky=>"nswe",:side=>:top, :border =>1, :expand=>true}]}])
1394
+
1395
+ Tk::Tile::Style.layout(Tk::Tile.style('Horizontal', "Arcadia.TScrollbar"),
1396
+ ['Scrollbar.trough', {:children=>[
1397
+ 'Scrollbar.leftarrow', {:side=>:left},
1398
+ 'Scrollbar.rightarrow', {:side=>:right},
1399
+ 'Scrollbar.thumb', {:side=>:left, :expand=>true}]}])
1400
+
1401
+ #TFrame
1399
1402
  #Tk::Tile::Style.configure(Tk::Tile::TFrame, Arcadia.style('panel'))
1400
1403
 
1401
- #TPaned
1404
+ #TPaned
1402
1405
  #Tk::Tile::Style.configure(Tk::Tile::TPaned, Arcadia.style('panel'))
1403
-
1406
+
1404
1407
  #TEntry
1405
1408
  #Tk::Tile::Style.configure(Tk::Tile::TEntry, Arcadia.style('edit'))
1406
1409
 
1407
1410
  #TCombobox
1408
1411
  #Tk::Tile::Style.configure(Tk::Tile::TCombobox, Arcadia.style('combobox'))
1409
-
1412
+
1410
1413
  #TLabel
1411
1414
  #Tk::Tile::Style.configure(Tk::Tile::TLabel, Arcadia.style('label'))
1412
1415
 
@@ -1421,16 +1424,16 @@ class TkWidgetFactory
1421
1424
  #TButton
1422
1425
  #Tk::Tile::Style.configure(Tk::Tile::TButton, Arcadia.style('button'))
1423
1426
  end
1424
-
1427
+
1425
1428
  def scrollbar(_parent,_args=nil, &b)
1426
1429
  if @use_tile
1427
1430
  return Tk::Tile::Scrollbar.new(_parent,{:style=>"Arcadia.TScrollbar"}.update(_args), &b)
1428
1431
  else
1429
1432
  return TkScrollbar.new(_parent,Arcadia.style('scrollbar').update(_args), &b)
1430
1433
  end
1431
-
1434
+
1432
1435
  end
1433
-
1436
+
1434
1437
  end
1435
1438
 
1436
1439
 
@@ -1456,7 +1459,7 @@ module TkAutoPostMenu
1456
1459
  def self.included(_widget)
1457
1460
  _widget.__initialize_posting(_widget)
1458
1461
  end
1459
-
1462
+
1460
1463
  def event_posting_on
1461
1464
  @event_posting_on = true
1462
1465
  @posting_on = false
@@ -1467,12 +1470,12 @@ module TkAutoPostMenu
1467
1470
  @posting_on = true
1468
1471
  end
1469
1472
 
1470
-
1473
+
1471
1474
  def __initialize_posting(_widget=self)
1472
- # parent = TkWinfo.parent(_widget)
1473
- # parent.bind_append("Enter", proc{p "Enter parent"})
1474
- # parent.bind_append("Leave", proc{p "Leave parent"})
1475
-
1475
+ # parent = TkWinfo.parent(_widget)
1476
+ # parent.bind_append("Enter", proc{p "Enter parent"})
1477
+ # parent.bind_append("Leave", proc{p "Leave parent"})
1478
+
1476
1479
  chs = TkWinfo.children(_widget)
1477
1480
  hh = 22
1478
1481
  @last_post = nil
@@ -1492,7 +1495,7 @@ module TkAutoPostMenu
1492
1495
  @last_clicked.unpost
1493
1496
  @last_clicked = nil
1494
1497
  end
1495
-
1498
+
1496
1499
  ch.menu.post(x-rx,y-ry+hh)
1497
1500
 
1498
1501
  #just_posted = TkWinfo.containing(x, y+hh)
@@ -1503,26 +1506,26 @@ module TkAutoPostMenu
1503
1506
  @last_menu_posted.bind("Enter", proc{
1504
1507
  @last_menu_posted.bind("Leave", proc{
1505
1508
  if @posting_on
1506
- @last_post.unpost if @last_post
1507
- @last_post = nil
1508
- @last_menu_posted.bind("Enter", proc{})
1509
- @last_menu_posted.bind("Leave", proc{})
1509
+ @last_post.unpost if @last_post
1510
+ @last_post = nil
1511
+ @last_menu_posted.bind("Enter", proc{})
1512
+ @last_menu_posted.bind("Leave", proc{})
1510
1513
  end
1511
1514
  })
1512
1515
  })
1513
1516
  #@last_post = just_posted
1514
1517
  end
1515
-
1518
+
1516
1519
  #@last_post=ch.menu
1517
- }, "%X %Y %x %y")
1520
+ }, "%X %Y %x %y")
1518
1521
  ch.bind_append("Leave", proc{
1519
1522
  ch.configure("state"=>:normal, "relief"=>:flat)
1520
1523
  if @posting_on
1521
1524
  if @last_post
1522
1525
  _x = TkWinfo.x(@last_post)
1523
1526
  _y = TkWinfo.y(@last_post)
1524
- ch.event_generate("KeyPress", :keysym=>"Escape") #if Tk.focus.kind_of?(TkMenu) && Tk.focus != ch.menu
1525
- @last_post.post(_x,_y) if @last_clicked && @last_clicked == ch.menu
1527
+ ch.event_generate("KeyPress", :keysym=>"Escape") #if Tk.focus.kind_of?(TkMenu) && Tk.focus != ch.menu
1528
+ @last_post.post(_x,_y) if @last_clicked && @last_clicked == ch.menu
1526
1529
  end
1527
1530
  if @last_post!=ch.menu
1528
1531
  @last_post=ch.menu
@@ -1547,12 +1550,12 @@ module TkAutoPostMenu
1547
1550
  #@last_post.unpost
1548
1551
  #@last_post.post(0,0)
1549
1552
  #@last_post.set_focus
1550
-
1553
+
1551
1554
  }, "%X %Y %x %y")
1552
-
1555
+
1553
1556
  }
1554
1557
  _widget.bind_append("Leave", proc{
1555
- if @posting_on && Tk.focus != @last_menu_posted
1558
+ if @posting_on && Tk.focus != @last_menu_posted
1556
1559
  @last_post.unpost if @last_post
1557
1560
  @last_post=nil
1558
1561
  @posting_on = false if @event_posting_on
@@ -1560,17 +1563,17 @@ module TkAutoPostMenu
1560
1563
  TkAfter.new(1000,1, proc{
1561
1564
  one_post = false
1562
1565
  @m_show.each{|m,v|
1563
- one_post = v
1564
- break if v
1566
+ one_post = v
1567
+ break if v
1565
1568
  }
1566
1569
  @posting_on = one_post if @event_posting_on
1567
1570
  }).start
1568
1571
  })
1569
-
1570
-
1572
+
1573
+
1571
1574
  _widget.bind_append("1", proc{
1572
- @posting_on=true if @event_posting_on
1573
- })
1575
+ @posting_on=true if @event_posting_on
1576
+ })
1574
1577
 
1575
1578
  end
1576
1579
  end
@@ -1585,7 +1588,7 @@ module TkScrollableWidget
1585
1588
  def self.included(_widget)
1586
1589
  _widget.__initialize_scrolling(_widget)
1587
1590
  end
1588
-
1591
+
1589
1592
  def __initialize_scrolling(_widget=self)
1590
1593
  @widget = _widget
1591
1594
  @parent = TkWinfo.parent(@widget)
@@ -1602,21 +1605,21 @@ module TkScrollableWidget
1602
1605
  @h_scroll.destroy
1603
1606
  @v_scroll.destroy
1604
1607
  end
1605
-
1608
+
1606
1609
  def add_yscrollcommand(cmd=Proc.new)
1607
1610
  @v_scroll_command = cmd
1608
- end
1609
-
1611
+ end
1612
+
1610
1613
  def do_yscrollcommand(first,last)
1611
1614
  if first != nil && last != nil
1612
1615
  delta = last.to_f - first.to_f
1613
1616
  if delta < 1 && delta > 0 && last != @last_y_last
1614
1617
  show_v_scroll
1615
- begin
1616
- @v_scroll.set(first,last) #if TkWinfo.mapped?(@v_scroll)
1617
- rescue Exception => e
1618
- p "#{e.message}"
1619
- end
1618
+ begin
1619
+ @v_scroll.set(first,last) #if TkWinfo.mapped?(@v_scroll)
1620
+ rescue Exception => e
1621
+ p "#{e.message}"
1622
+ end
1620
1623
  elsif delta == 1 || delta == 0
1621
1624
  hide_v_scroll
1622
1625
  end
@@ -1624,21 +1627,21 @@ module TkScrollableWidget
1624
1627
  @last_y_last = last if last.to_f < 1
1625
1628
  end
1626
1629
  end
1627
-
1630
+
1628
1631
  def add_xscrollcommand(cmd=Proc.new)
1629
1632
  @h_scroll_command = cmd
1630
- end
1631
-
1633
+ end
1634
+
1632
1635
  def do_xscrollcommand(first,last)
1633
1636
  if first != nil && last != nil
1634
1637
  delta = last.to_f - first.to_f
1635
1638
  if delta < 1 && delta > 0 && last != @last_x_last
1636
1639
  show_h_scroll
1637
- begin
1640
+ begin
1638
1641
  @h_scroll.set(first,last) #if TkWinfo.mapped?(@h_scroll)
1639
- rescue Exception => e
1640
- p "#{e.message}"
1641
- end
1642
+ rescue Exception => e
1643
+ p "#{e.message}"
1644
+ end
1642
1645
  elsif delta == 1 || delta == 0
1643
1646
  hide_h_scroll
1644
1647
  end
@@ -1646,18 +1649,20 @@ module TkScrollableWidget
1646
1649
  @last_x_last = last if last.to_f < 1
1647
1650
  end
1648
1651
  end
1649
-
1650
- def show(_x=0,_y=0,_border_mode='inside')
1652
+
1653
+ def show(_x=0,_y=0,_w=nil,_h=nil,_border_mode='inside')
1651
1654
  @x=_x
1652
1655
  @y=_y
1656
+ _w != nil ? @w=_w : @w=-@x
1657
+ _h != nil ? @h=_h : @h=-@y
1653
1658
  @widget.place(
1654
- 'x'=>@x,
1655
- 'y'=>@y,
1656
- 'width' => -@x,
1657
- 'height' => -@y,
1658
- 'relheight'=>1,
1659
- 'relwidth'=>1,
1660
- 'bordermode'=>_border_mode
1659
+ 'x'=>@x,
1660
+ 'y'=>@y,
1661
+ 'width' => @w,
1662
+ 'height' => @h,
1663
+ 'relheight'=>1,
1664
+ 'relwidth'=>1,
1665
+ 'bordermode'=>_border_mode
1661
1666
  )
1662
1667
  @widget.raise
1663
1668
  if @v_scroll_on
@@ -1667,9 +1672,9 @@ module TkScrollableWidget
1667
1672
  show_h_scroll(true)
1668
1673
  end
1669
1674
  begin
1670
- arm_scroll_binding
1675
+ arm_scroll_binding
1671
1676
  rescue Exception => e
1672
- p "#{e.message}"
1677
+ p "#{e.message}"
1673
1678
  end
1674
1679
  end
1675
1680
 
@@ -1679,15 +1684,15 @@ module TkScrollableWidget
1679
1684
  @v_scroll.unpack
1680
1685
  @h_scroll.unpack
1681
1686
  end
1682
-
1687
+
1683
1688
  def arm_scroll_binding
1684
- @widget.yscrollcommand(proc{|first,last|
1689
+ @widget.yscrollcommand(proc{|first,last|
1685
1690
  do_yscrollcommand(first,last)
1686
1691
  })
1687
1692
  @v_scroll.command(proc{|*args|
1688
1693
  @widget.yview *args
1689
1694
  })
1690
- @widget.xscrollcommand(proc{|first,last|
1695
+ @widget.xscrollcommand(proc{|first,last|
1691
1696
  do_xscrollcommand(first,last)
1692
1697
  })
1693
1698
  @h_scroll.command(proc{|*args|
@@ -1701,13 +1706,14 @@ module TkScrollableWidget
1701
1706
  @v_scroll.command(proc{})
1702
1707
  @h_scroll.command(proc{})
1703
1708
  end
1704
-
1709
+
1705
1710
  def show_v_scroll(_force=false)
1706
1711
  if _force || !@v_scroll_on
1707
1712
  begin
1708
1713
  @widget.place('width' => -@scroll_width-@x)
1709
1714
  @v_scroll.pack('side' => 'right', 'fill' => 'y')
1710
1715
  @v_scroll_on = true
1716
+ @v_scroll.raise
1711
1717
  rescue RuntimeError => e
1712
1718
  p "RuntimeError : #{e.message}"
1713
1719
  end
@@ -1720,6 +1726,7 @@ module TkScrollableWidget
1720
1726
  @widget.place('height' => -@scroll_width-@y)
1721
1727
  @h_scroll.pack('side' => 'bottom', 'fill' => 'x')
1722
1728
  @h_scroll_on = true
1729
+ @h_scroll.raise
1723
1730
  rescue RuntimeError => e
1724
1731
  p "RuntimeError : #{e.message}"
1725
1732
  end
@@ -1748,7 +1755,7 @@ module TkScrollableWidget
1748
1755
  rescue RuntimeError => e
1749
1756
  p "RuntimeError : #{e.message}"
1750
1757
  end
1751
- end
1758
+ end
1752
1759
  end
1753
1760
 
1754
1761
  end