arcadia 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. data/README +132 -134
  2. data/bin/arcadia +13 -0
  3. data/conf/arcadia.conf +196 -3
  4. data/conf/arcadia.init.rb +27 -6
  5. data/conf/arcadia.res.rb +10 -0
  6. data/ext/ae-complete-code/ae-complete-code.rb +76 -82
  7. data/ext/ae-doc-code/ae-doc-code.rb +295 -291
  8. data/ext/ae-editor/ae-editor.conf +88 -67
  9. data/ext/ae-editor/ae-editor.rb +400 -202
  10. data/ext/ae-editor/langs/conf.lang +16 -5
  11. data/ext/ae-editor/langs/lang.lang.bind +1 -1
  12. data/ext/ae-editor/langs/rb.lang +77 -41
  13. data/ext/ae-editor/langs/rbw.lang.bind +1 -1
  14. data/ext/ae-event-log/ae-event-log.rb +46 -45
  15. data/ext/ae-file-history/ae-file-history.conf +1 -1
  16. data/ext/ae-file-history/ae-file-history.rb +373 -298
  17. data/ext/ae-output/ae-output.conf +2 -0
  18. data/ext/ae-output/ae-output.rb +200 -202
  19. data/ext/ae-rad/ae-rad-inspector.rb +64 -70
  20. data/ext/ae-rad/ae-rad-palette.rb +14 -14
  21. data/ext/ae-rad/ae-rad.conf +2 -0
  22. data/ext/ae-rad/lib/tk/al-tk.rb +2991 -2987
  23. data/ext/ae-rad/lib/tk/al-tkarcadia.rb +26 -26
  24. data/ext/ae-ruby-debug/ae-ruby-debug.conf +8 -8
  25. data/ext/ae-ruby-debug/ae-ruby-debug.rb +1566 -1465
  26. data/ext/ae-search-in-files/ae-search-in-files.rb +294 -284
  27. data/ext/ae-shell/ae-shell.rb +20 -11
  28. data/{base → lib}/a-commons.rb +291 -80
  29. data/{base → lib}/a-contracts.rb +40 -18
  30. data/{arcadia.rb → lib/a-core.rb} +238 -148
  31. data/{base → lib}/a-tkcommons.rb +81 -63
  32. metadata +64 -65
  33. data/ext/ae-action-dispatcher/ae-action-dispatcher.conf +0 -6
  34. data/ext/ae-action-dispatcher/ae-action-dispatcher.rb +0 -22
  35. data/ext/ae-inspector/ae-inspector.conf +0 -7
  36. data/ext/ae-inspector/ae-inspector.rb +0 -1519
  37. data/ext/ae-palette/ae-palette.conf +0 -7
  38. data/ext/ae-palette/ae-palette.rb +0 -265
@@ -1,6 +0,0 @@
1
- name=action_dispatcher
2
- labels=Action dispatcher
3
- #frames=1.1
4
- active=yes
5
- require=ext/ae-action-dispatcher/ae-action-dispatcher
6
- class=ActionDispatcher
@@ -1,22 +0,0 @@
1
- #
2
- # ae-action-dispatcher.rb - Arcadia Ruby ide
3
- # by Antonio Galeone <antonio-galeone@rubyforge.org>
4
- #
5
-
6
- class ActionDispatcher < ArcadiaExt
7
-
8
- def on_before_build(_event)
9
- Arcadia.add_listener(self, ActionEvent)
10
- end
11
-
12
- def on_action(_event)
13
- if _event.receiver != nil && _event.receiver.respond_to?(_event.action)
14
- if _event.action_args.nil?
15
- _event.receiver.send(_event.action)
16
- else
17
- _event.receiver.send(_event.action, _event.action_args)
18
- end
19
- end
20
- end
21
-
22
- end
@@ -1,7 +0,0 @@
1
- name=objic
2
- labels=Object Inspector
3
- frames=1.0
4
- active=no
5
- require=ext/ae-inspector/ae-inspector
6
- class=ObjiController
7
-
@@ -1,1519 +0,0 @@
1
- #
2
- # ae-inspector.rb - Arcadia Ruby ide
3
- # by Antonio Galeone <antonio-galeone@rubyforge.org>
4
- #
5
-
6
- require 'tk'
7
- require 'base/a-utils'
8
- require 'tkextlib/bwidget'
9
- require "observer"
10
-
11
- class TkTy
12
- attr_reader :agobj, :prop, :labelhost
13
- attr_writer :labelhost
14
- def free(_updatehost = false, _text = nil)
15
- if (defined? @propobj)&&(@propobj != nil)
16
- @propobj.destroy
17
- @propobj=nil
18
- end
19
- if _text
20
- @etextvalue = _text
21
- end
22
- if _updatehost and TkWinfo.exist?(@labelhost)
23
- @labelhost.configure('text' => @etextvalue) if defined? @labelhost
24
- end
25
- end
26
- end
27
-
28
- class TkReadOnly < TkTy
29
- def initialize(_label)
30
- @label = _label
31
- @color = @label.cget('foreground')
32
- @label.configure('foreground'=>'#919191')
33
- end
34
-
35
- def free(_updatehost = false, _text = nil)
36
- @label.configure('foreground'=>@color)
37
- super
38
- end
39
- end
40
-
41
-
42
- class TkStringType < TkTy
43
-
44
- def initialize(_host, _family, _agobj, _prop, _val = nil)
45
- @agobj = _agobj
46
- @prop = _prop
47
- @labelhost = _host
48
- @family = _family
49
- @etext = TkVariable.new(_host.cget('text'))
50
- @etextvalue = @etext.to_s
51
- @propobj = TkEntry.new(_host, 'textvariable'=>@etext){
52
- relief 'groove'
53
- font $arcadia['conf']['inspectors.inspector.value.font']
54
- place('x'=>0, 'y'=>0,'relheight'=>1, 'relwidth'=>1, 'bordermode'=>'outside')
55
- }
56
- @propobj.bind("KeyRelease-F1", proc{do_update})
57
- end
58
-
59
- def setpropvalue(_value)
60
- @etext = _value
61
- end
62
-
63
- def do_update
64
- if @etextvalue != @etext.to_s
65
- @agobj.update_property(self, @family, @prop['name'],@etext.to_s)
66
- @etextvalue = @etext.to_s
67
- end
68
- end
69
-
70
- def free(_updatehost = true, _text = nil)
71
- do_update if (defined? @propobj)&&(@propobj != nil)
72
- super
73
- end
74
-
75
- end
76
-
77
- class TkProcType < TkStringType
78
-
79
- def initialize(_host, _family, _agobj, _prop)
80
- super(_host, _family, _agobj, _prop, true)
81
- @bProp = TkButton.new(@propobj){
82
- text '...'
83
- relief 'flat'
84
- anchor 'e'
85
- padx 0
86
- pady 0
87
- activebackground background
88
- activeforeground 'red'
89
- borderwidth 1
90
- pack('side' => 'right','fill' => 'y')
91
- }
92
- do_proc_update = proc{
93
- _pr = @prop['type'].procReturn
94
- $arcadia['objic.action.raise_active_obj'].call
95
- if _pr && (_pr.length > 0)
96
- @etext = _pr if _pr != ''
97
- do_update
98
- @propobj.value = @etext
99
- end
100
- }
101
- @propobj.bind("Double-1", do_proc_update)
102
- @bProp.bind("ButtonRelease-1", do_proc_update)
103
- end
104
-
105
- end
106
-
107
- class TkEnumType < TkTy
108
-
109
- def initialize(_host, _family, _agobj, _prop, _editable = false)
110
- @agobj = _agobj
111
- @prop = _prop
112
- @labelhost = _host
113
- @family = _family
114
- @bool = _prop['type'].values[0].class.to_s == 'TrueClass'
115
- if @bool
116
- do_update = proc{
117
- @etextvalue = @propobj.cget('text')
118
- @agobj.update_property(self, @family, @prop['name'], source_to_bool(@etextvalue))
119
- $arcadia['objic.action.raise_active_obj'].call
120
- }
121
- _values = []
122
- _prop['type'].values.each{|value|
123
- _values << bool_to_string(value)
124
- }
125
- #Tk.messageBox('message'=>_values.to_s)
126
- else
127
- do_update = proc{
128
- #Tk.messageBox('message'=>'sasda')
129
- @etextvalue = @propobj.cget('text')
130
- @agobj.update_property(self, @family, @prop['name'], @etextvalue)
131
- $arcadia['objic.action.raise_active_obj'].call
132
- }
133
- _values = _prop['type'].values
134
- #Tk.messageBox('message'=>_values.class.to_s)
135
- end
136
- @propobj = Tk::BWidget::ComboBox.new(_host){
137
- values _values
138
- modifycmd do_update
139
- font $arcadia['conf']['inspectors.inspector.value.font']
140
- editable _editable
141
- place('x'=>0, 'y'=>0,'relheight'=>1, 'relwidth'=>1, 'bordermode'=>'outside')
142
- def e
143
- TkWinfo.children(self)[0]
144
- end
145
- def b
146
- TkWinfo.children(self)[1]
147
- end
148
- }
149
- setpropvalue(@prop['get'].call.to_s)
150
- end
151
-
152
- def bool_to_string(_source)
153
- if _source
154
- return 'true'
155
- else
156
- return 'false'
157
- end
158
- end
159
-
160
- def source_to_bool(_source)
161
- _source = _source.to_s
162
- if (_source == '1') or (_source == 'true')
163
- return true
164
- else
165
- return false
166
- end
167
- end
168
-
169
- def setpropvalue(_value)
170
- #Tk.messageBox('message'=>'dip')
171
- _index = @prop['type'].values.index(_value)
172
- if _index != nil
173
- @propobj.set_value(_index)
174
- else
175
- @propobj.e.insert( 0, _value)
176
- end
177
- @etextvalue = _value
178
- end
179
- end
180
-
181
-
182
-
183
- class TkEnumProcType < TkEnumType
184
-
185
- def initialize(_host, _family, _agobj, _prop)
186
- super(_host, _family, _agobj, _prop, true)
187
- @bProp = TkButton.new(@propobj.e){
188
- text '...'
189
- relief 'flat'
190
- anchor 'e'
191
- padx 0
192
- pady 0
193
- activebackground background
194
- activeforeground 'red'
195
- borderwidth 1
196
- pack('side' => 'right','fill' => 'y')
197
- }
198
- do_proc_update = proc{
199
- _pr = @prop['type'].procReturn
200
- $arcadia['objic.action.raise_active_obj'].call
201
- @etextvalue = _pr if _pr != ''
202
- @agobj.update_property(self, _family, @prop['name'], @etextvalue)
203
- @propobj.configure('text'=>@etextvalue)
204
- }
205
- @propobj.e.bind("Double-1", do_proc_update)
206
- @bProp.bind("ButtonRelease-1", do_proc_update)
207
- end
208
-
209
- def do_update
210
- if @etextvalue != @propobj.cget('text')
211
- @etextvalue = @propobj.cget('text')
212
- @agobj.update_property(self, @family, @prop['name'], @etextvalue)
213
- end
214
- end
215
-
216
- def free(_updatehost=true, _text=nil)
217
- do_update if (defined? @propobj)&&(@propobj != nil)
218
- super
219
- end
220
- end
221
-
222
- #class PTkEntryButton
223
- #
224
- # def initialize(_host, _agobj, _prop)
225
- # do_update = proc{
226
- # @etextvalue = @prop['type'].procReturn
227
- # @agobj.updatep(@prop['name'], @etextvalue)
228
- # @propobj.configure('text'=>@etextvalue, 'background'=>@etextvalue)
229
- # }
230
- # @button = TkButton.new(_host){
231
- # text '...'
232
- # font $arcadia['conf']['inspectors.inspector.value.font']
233
- # place('x' => 20 ,'relheight'=>1, 'relwidth'=>0.5, 'bordermode'=>'outside', 'anchor'=>'e')
234
- # }
235
- # @etext = TkVariable.new(_prop['get'].call.to_s)
236
- # @entry = TkEntry.new(_host, 'textvariable'=>@etext){
237
- # relief 'groove'
238
- # font $arcadia['conf']['inspectors.inspector.value.font']
239
- # place('relheight'=>1, 'relwidth'=>0.5, 'bordermode'=>'outside')
240
- # }
241
- # end
242
- #
243
- # def setpropvalue(_value)
244
- # @propobj.configure('text'=>_value)
245
- # @etextvalue = _value
246
- # end
247
- #
248
- # def destroy
249
- # @entry.destroy
250
- # @etext.destroy
251
- # @button.destroy
252
- # end
253
- #
254
- #end
255
-
256
- class ValueRap
257
- attr_reader :labelvalue, :handlervalue
258
- attr_reader :labelkey
259
- def initialize(_parent, _prop, _text = nil)
260
- @parent = _parent;
261
- #@host = _parent.pwind.right_frame
262
- #Tk.messageBox('message'=>_prop)
263
- @agobj = _parent.agobj
264
- @family = _parent.family
265
- @prop = _prop
266
- if _text == nil
267
- _text = _prop['get'].call.to_s
268
- end
269
- @text = _text
270
- if !defined? @parent.lasthandlervalue
271
- @parent.lasthandlervalue = 0
272
- end
273
- @labelkey = TkLabel.new(@parent.right_text,
274
- 'text' => _text,
275
- 'justify' => 'right',
276
- 'anchor' => 'w',
277
- #'width'=>15,
278
- 'font'=> $arcadia['conf']['inspectors.inspector.value.font'],
279
- 'relief'=>'groove')
280
-
281
- TkTextWindow.new(@parent.right_text, 'end', 'window'=> @labelkey)
282
-
283
- #@labelkey.pack('fill'=>'x',:padx=>0, :pady=>0)
284
-
285
- @parent.right_text.insert('end',"\n")
286
-
287
-
288
- @labelkey.bind("ButtonPress-1", proc{
289
- if @prop['set'] != nil
290
- do_manage(@prop['type'].class.to_s)
291
- else
292
- do_manage('ReadOnly')
293
- end
294
- })
295
- end
296
-
297
- def reset_last
298
- @parent.lasthandlervalue = 0
299
- end
300
-
301
- def free
302
- _reset_last = @handlervalue == @parent.lasthandlervalue
303
- @labelkey.destroy if defined? @labelkey
304
- @handlervalue.free if @handlervalue == @parent.lasthandlervalue
305
- @parent.lasthandlervalue = 0 if _reset_last
306
- end
307
-
308
- def recicle(_family, _agobj, _prop)
309
- @agobj = _agobj
310
- @family = _family
311
- @prop = _prop
312
- if _prop['value'] != nil
313
- @text = _prop['value']
314
- else
315
- @text = _prop['get'].call.to_s
316
- end
317
- @parent.lasthandlervalue = 0 if @parent.lasthandlervalue == @handlervalue
318
- @handlervalue.free(false,@text) if defined? @handlervalue
319
- @labelkey.configure('text' => @text)
320
- end
321
-
322
- def updatevalue(_text)
323
- @labelkey.configure('text'=>_text)
324
- @text = _text
325
- end
326
-
327
- def do_manage(_type)
328
- if @parent.lasthandlervalue != 0
329
- @parent.lasthandlervalue.free(defined? @labelkey)
330
- end
331
- case _type
332
- when 'EnumType'
333
- @handlervalue = TkEnumType.new(@labelkey, @family, @agobj, @prop)
334
- when 'ProcType'
335
- @handlervalue = TkProcType.new(@labelkey, @family, @agobj, @prop)
336
- when 'StringType'
337
- @handlervalue = TkStringType.new(@labelkey, @family, @agobj, @prop)
338
- when 'EnumProcType'
339
- @handlervalue = TkEnumProcType.new(@labelkey, @family, @agobj, @prop)
340
- when 'ReadOnly'
341
- @handlervalue = TkReadOnly.new(@labelkey)
342
- else
343
- @handlervalue = TkStringType.new(@labelkey, @family, @agobj, @prop)
344
- end
345
- @parent.lasthandlervalue = @handlervalue
346
- end
347
-
348
- end
349
-
350
- class PropLine
351
- attr_reader :valueobj
352
- def initialize(_parent, _name, _prop)
353
- @parent = _parent
354
- @prop = _prop
355
-
356
- @propkey = TkLabel.new(@parent.left_text){
357
- text _name
358
- justify 'right'
359
- font $arcadia['conf']['inspectors.inspector.key.font']
360
- anchor 'w'
361
- # pack('fill'=>'x',:padx=>0, :pady=>0)
362
- }
363
-
364
- TkTextWindow.new(@parent.left_text, 'end',
365
- 'window'=> @propkey)
366
- @parent.left_text.insert('end',"\n")
367
-
368
- if !defined? _prop['type']
369
- _prop['type'] = 'StringType'
370
- end
371
- @valueobj = ValueRap.new(@parent, @prop)
372
- end
373
-
374
- def free
375
- @propkey.destroy if @propkey !=nil
376
- @valueobj.free if @valueobj !=nil
377
- @valueobj = nil
378
- @parent.left_text.delete('end -1 lines linestart','end')
379
- @parent.right_text.delete('end -1 lines linestart','end')
380
- end
381
-
382
- def setvalue(_value)
383
- @valueobj.updatevalue(_value)
384
- end
385
-
386
- def updatekeyvalue(_agobj, _name, _prop)
387
- @prop = _prop
388
- @propkey.configure('text'=>_name) # chiave
389
- @valueobj.recicle(@parent.family, _agobj, @prop)
390
- end
391
-
392
- end
393
-
394
-
395
- class ValueRapReadOnly
396
- attr_reader :labelvalue, :handlervalue
397
- def initialize(_parent, _text = nil)
398
- @parent = _parent;
399
- @host = _parent.splitted_frame.right_frame
400
- @text = _text
401
- if !defined? @parent.bodyprops.lasthandlervalue
402
- @parent.bodyprops.lasthandlervalue = 0
403
- end
404
- @labelkey = TkLabel.new(@host,
405
- 'text' => _text,
406
- 'justify' => 'right',
407
- 'anchor' => 'w',
408
- 'font'=> $arcadia['conf']['inspectors.inspector.value.font'],
409
- 'relief'=>'groove')
410
- @labelkey.pack('fill'=>'x',:padx=>0, :pady=>0)
411
- @labelkey.bind("ButtonPress-1", proc{
412
- do_manage_read_only
413
- })
414
- end
415
-
416
- def reset_last
417
- @parent.bodyprops.lasthandlervalue = 0
418
- end
419
-
420
- def free
421
- _reset_last = @handlervalue == @parent.bodyprops.lasthandlervalue
422
- @labelkey.destroy if defined? @labelkey
423
- @handlervalue.free if @handlervalue == @parent.bodyprops.lasthandlervalue
424
- @parent.bodyprops.lasthandlervalue = 0 if _reset_last
425
- end
426
-
427
- def recicle(_text)
428
- @text = _text
429
- @parent.bodyprops.lasthandlervalue = 0 if @parent.bodyprops.lasthandlervalue == @handlervalue
430
- @handlervalue.free(false,@text) if defined? @handlervalue
431
- @labelkey.configure('text' => @text)
432
- end
433
-
434
- def updatevalue(_text)
435
- @labelkey.configure('text'=>_text)
436
- @text = _text
437
- end
438
-
439
- def do_manage_read_only
440
- @handlervalue = TkReadOnly.new(@labelkey)
441
- @parent.bodyprops.lasthandlervalue = @handlervalue
442
- end
443
-
444
- end
445
-
446
- class PropLineReadOnly
447
- attr_reader :valueobj
448
- attr_reader :splitted_frame
449
- attr_reader :bodyprops
450
- def initialize(_bodyprops, _key, _value)
451
- @bodyprops = _bodyprops
452
- @key = _key
453
- @splitted_frame = AGTkVSplittedFrames.new(@bodyprops.host, 85)
454
- @propkey = TkLabel.new(@splitted_frame.left_frame){
455
- text _key
456
- justify 'right'
457
- font $arcadia['conf']['inspectors.inspector.key.font']
458
- anchor 'w'
459
- pack('fill'=>'x',:padx=>0, :pady=>0)
460
- }
461
- @valueobj = ValueRapReadOnly.new(self, _value)
462
- end
463
-
464
- def free
465
- @propkey.destroy if @propkey !=nil
466
- @valueobj.free if @valueobj !=nil
467
- @valueobj = nil
468
- end
469
-
470
- def setvalue(_value)
471
- @valueobj.updatevalue(_value)
472
- end
473
-
474
- def updatekeyvalue(_key, _value)
475
- @key = _key
476
- @propkey.configure('text'=>_key) # chiave
477
- @valueobj.recicle(_value)
478
- end
479
-
480
- end
481
-
482
-
483
- class InspectListReadOnly
484
- attr_reader :host
485
- attr_writer :lasthandlervalue
486
- attr_reader :lasthandlervalue
487
-
488
- def initialize(_host, _left_width = 85)
489
- @lasthandlervalue = 0;
490
- @host = _host
491
- @proplines = Hash.new
492
- end
493
-
494
- def clear
495
- @proplines.values.each do | _value|
496
- _value.free
497
- end
498
- @lasthandlervalue = 0;
499
- @proplines.clear
500
- end
501
-
502
- def updatelines(_properties=nil)
503
- if _properties == nil
504
- clear
505
- return
506
- else
507
- @lasthandlervalue.free(false) if @lasthandlervalue != 0
508
- @lasthandlervalue = 0;
509
- end
510
- _propvalues = []
511
- @proplines.keys.sort.each{|key|
512
- _propvalues << @proplines[key]
513
- }
514
- @proplines.clear
515
- _inf = 0
516
- _sup = _propvalues.length
517
- @array_key = _properties.keys
518
- @array_key.sort.each do |key|
519
- if _inf < _sup # reuse it
520
- _propvalues[_inf].updatekeyvalue(key, _properties[key])
521
- @proplines[key] = _propvalues[_inf]
522
- _inf = _inf.next
523
- else # create new
524
- @proplines[key] = PropLineReadOnly.new(self, key, _properties[key])
525
- end
526
- end
527
- if _sup > _inf
528
- _inf.upto(_sup -1 ) {|i|
529
- _propvalues[i].free
530
- }
531
- end
532
- end
533
-
534
- def modProp(_name, _newvalue)
535
- @proplines[_name].setvalue(_newvalue)
536
- end
537
-
538
- def delete
539
- @pwind.destroy
540
- end
541
-
542
- end
543
-
544
- class InspectList
545
- attr_reader :pwind, :agobj, :family
546
- attr_writer :lasthandlervalue, :family
547
- attr_reader :lasthandlervalue
548
- attr_reader :left_text, :right_text
549
- def initialize(_family, _host, _left_width = 85)
550
- @lasthandlervalue = 0;
551
- @family = _family
552
- @bar = TkScrollbar.new(_host).pack('side'=>'right', 'fill'=>'y')
553
- @pwind = AGTkVSplittedFrames.new(_host,_left_width)
554
- background = _host.cget('background')
555
- common_properties = {'relief'=>'flat','state'=>'disabled', 'borderwidth'=>0, 'relief'=>'flat', 'background'=>background}
556
- @left_text = TkText.new(@pwind.left_frame, common_properties).pack('expand'=>'yes', 'fill'=>'both')
557
- @right_text = TkText.new(@pwind.right_frame, common_properties).pack('expand'=>'yes', 'fill'=>'both')
558
-
559
- @left_text.configure('selectbackground'=>@left_text.cget('background'))
560
- @right_text.configure('selectbackground'=>@right_text.cget('background'))
561
- # @left_text = TkText.new(@pwind.left_frame, 'relief'=>'flat').pack('expand'=>'yes', 'fill'=>'both')
562
- # @right_text = TkText.new(@pwind.right_frame, 'relief'=>'flat').pack('expand'=>'yes', 'fill'=>'both')
563
- @bar.command(proc { |*args|
564
- @left_text.yview(*args)
565
- @right_text.yview(*args)
566
- })
567
- @left_text.yscrollcommand(proc { |first, last|
568
- @bar.set(first, last)
569
- })
570
- @right_text.yscrollcommand(proc { |first, last|
571
- @bar.set(first, last)
572
- })
573
- @right_text.bind("Configure",
574
- proc{
575
- new_width = new_right_width
576
- if new_width
577
- @proplines.values.each do | _value|
578
- _value.valueobj.labelkey.configure('width'=>(new_width))
579
- end
580
- end
581
-
582
- },"%w")
583
- @proplines = Hash.new
584
- end
585
-
586
- def new_right_width
587
- font_size = TkFont.new(@right_text.cget('font')).size
588
- w=TkPlace.info(@pwind.right_frame)['width']
589
- dw = TkPlace.info(@pwind.left_frame)['width']
590
- p = @pwind
591
- while p != nil && !p.kind_of?(AGTkVSplittedFrames) || p == @pwind
592
- p= TkWinfo.parent(p)
593
- end
594
- if p
595
- dwp = TkPlace.info(p.left_frame)['width']
596
- new_width = ((dwp+w)/(font_size-2)).round
597
- end
598
- return new_width
599
- end
600
-
601
- def clear
602
- @proplines.values.each do | _value|
603
- _value.free
604
- end
605
- @lasthandlervalue = 0;
606
- @proplines.clear
607
- end
608
-
609
- def updatelines(_agobj, _properties=nil)
610
- @left_text.configure('state'=>'normal')
611
- @right_text.configure('state'=>'normal')
612
- if _properties == nil
613
- clear
614
- return
615
- else
616
- @lasthandlervalue.free(false) if @lasthandlervalue != 0
617
- @lasthandlervalue = 0;
618
- end
619
- @agobj = _agobj
620
- _propvalues = []
621
- @proplines.keys.sort.each{|key|
622
- _propvalues << @proplines[key]
623
- }
624
- @proplines.clear
625
- _inf = 0
626
- _sup = _propvalues.length
627
- @array_key = _properties.keys
628
- @array_key.sort.each do |key|
629
- if _inf < _sup # reuse it
630
- _propvalues[_inf].updatekeyvalue(@agobj, key, _properties[key])
631
- @proplines[key] = _propvalues[_inf]
632
- _inf = _inf.next
633
- else # create new
634
- #Tk.messageBox('message'=>key)
635
- @proplines[key] = PropLine.new(self, key, _properties[key])
636
- @proplines[key].valueobj.labelkey.configure('width'=>(new_right_width))
637
- end
638
- end
639
- if _sup > _inf
640
- _inf.upto(_sup -1 ) {|i|
641
- _propvalues[i].free
642
- }
643
- end
644
- @left_text.configure('state'=>'disabled')
645
- @right_text.configure('state'=>'disabled')
646
- end
647
-
648
- def modProp(_name, _newvalue)
649
- @proplines[_name].setvalue(_newvalue)
650
- end
651
- def delete
652
- @pwind.destroy
653
- end
654
- end
655
-
656
- class InnerFrameInspectMultiList < TkFrame
657
- attr_reader :lTitle
658
- attr_reader :tkFrameHost
659
- attr_reader :index
660
- def initialize(_parent, _index,_contr=nil)
661
- super(_parent)
662
- @index = _index
663
- borderwidth 2
664
- relief 'groove'
665
- pack('side' => 'top',
666
- 'anchor' => 'n',
667
- 'expand' => 0,
668
- 'ipady' => 40,
669
- 'fill' => 'x')
670
- _self = self
671
- bind('Enter', proc{ _contr.set_current(_index)})
672
- @lTitle = TkLabel.new(self){
673
- text '...'
674
- background '#494949'
675
- place('relwidth' => '1',
676
- 'x' => 0,
677
- 'y' => 0,
678
- 'height' => 19)
679
-
680
- @tkButtonX = TkButton.new(self){
681
- text 'X'
682
- pack('side' => 'top',
683
- 'anchor' => 'e')
684
- bind('ButtonPress-1',proc{_contr.del_event(_self, _index)})
685
- }
686
- class << self
687
- attr_reader :tkButton2
688
- end
689
- }
690
-
691
- @tkFrameHost = TkFrame.new(self){
692
- borderwidth 2
693
- relief 'groove'
694
- place('relwidth' => '1',
695
- 'x' => 0,
696
- 'y' => 19,
697
- 'relheight' => '1',
698
- 'height' => -19)
699
- }
700
- end
701
- end
702
-
703
-
704
- class InspectMultiList
705
- def initialize(_family, _host)
706
- _contr = self
707
- @family = _family
708
- @itemCount = 0
709
- @tkFrame1 = TkFrame.new(_host){
710
- borderwidth 2
711
- relief 'groove'
712
- place(
713
- 'relwidth' => '1',
714
- 'x' => 0,
715
- 'y' => 0,
716
- 'height' => 30
717
- )
718
- @tkButton1 = TkButton.new(self){
719
- text 'New'
720
- padx 0
721
- pady 0
722
- relief 'groove'
723
- place(
724
- 'x' => 2,
725
- 'y' => 2,
726
- 'height' => 21,
727
- 'width' => 54
728
- )
729
- bind('ButtonPress-1',proc{_contr.add_event})
730
- }
731
- class << self
732
- attr_reader :tkButton1
733
- end
734
- }
735
- @tkFrame2 = TkFrame.new(_host){
736
- borderwidth 2
737
- relief 'groove'
738
- place(
739
- 'relwidth' => '1',
740
- 'relheight' => '1',
741
- 'height'=>-50,
742
- 'x' => 0,
743
- 'y' => 50
744
- )
745
- }
746
- @il = Hash.new
747
- end
748
-
749
- def add_event
750
- set_current(@itemCount)
751
- fi = InnerFrameInspectMultiList.new(@tkFrame2, @itemCount, self)
752
- @il[fi]=InspectList.new(@family, fi.tkFrameHost,30)
753
- @il[fi].updatelines(@agobj, @agobj.props[@family])
754
- @itemCount = @itemCount + 1
755
- end
756
-
757
- def del_event(_innerFrame, _item)
758
- if (@agobj.persistent != nil)
759
- @agobj.persistent['events'].delete_at(_item)
760
- @agobj.persistent['procs'].delete_at(_item) if @agobj.persistent['procs'] != nil
761
- end
762
- @itemCount = @itemCount - 1
763
- _innerFrame.destroy
764
- _innerFrame.callback_break
765
- end
766
-
767
- def set_current(_index)
768
- @itemIndex = _index
769
- if (@agobj.persistent['prog'] != nil)
770
- @agobj.persistent['prog']=@itemIndex
771
- end
772
- end
773
-
774
- def update(_agobj)
775
- @itemCount = 0
776
- @agobj = _agobj
777
- @il.each_key{|k|
778
- k.destroy
779
- }
780
- @il.clear
781
- if _agobj.persistent['events'] != nil
782
- _agobj.persistent['events'].each{|item|
783
- add_event
784
- }
785
- end
786
- end
787
-
788
- end
789
-
790
- class InspectEvents
791
- attr_reader :pbottom
792
- def initialize(_host, _agobj, _family)
793
- @hash_entity = _agobj.props[_family]
794
- @agobj = _agobj
795
- @family = _family
796
- @pmain = Tk::BWidget::PanedWindow.new(_host, 'side' => 'left', 'weights'=> 'available', 'width'=> 3){
797
- pack('fill'=>'both', :padx=>0, :pady=>0)
798
- }
799
- @ptop = @pmain.add('weight'=>1)
800
- @pbottom = @pmain.add('weight'=>2)
801
- @list = InspectList.new('evens', @ptop)
802
- end
803
-
804
- def add(_event,_mods,_handler)
805
- end
806
-
807
- def update(_agobj, _family)
808
- @hash_entity = _agobj.props[_family]
809
- @agobj = _agobj
810
- @family = _family
811
- end
812
-
813
- end
814
-
815
-
816
- class InspectTkEvents
817
-
818
- def initialize(_host, _agobj, _family)
819
- @hash_entity = _agobj.props[_family]
820
- @agobj = _agobj
821
- @family = _family
822
- @pmain = Tk::BWidget::PanedWindow.new(_host, 'side' => 'left', 'weights'=> 'available', 'width'=> 3){
823
- pack('fill'=>'both', :padx=>0, :pady=>0)
824
- }
825
- @ptop = @pmain.add('weight'=>1)
826
-
827
- @pbottom = @pmain.add('weight'=>2)
828
-
829
- list = TkListbox.new(@ptop){
830
- pack
831
- }
832
- end
833
-
834
- def add(_event,_mods,_handler)
835
-
836
- end
837
- def update(_agobj, _family)
838
- @hash_entity = _agobj.props[_family]
839
- @agobj = _agobj
840
- @family = _family
841
- end
842
- end
843
-
844
- class ObjList
845
- attr_reader :objects
846
- def initialize
847
- @objects = Array.new
848
- end
849
- def append(_o)
850
- @objects << _o
851
- end
852
- end
853
-
854
-
855
-
856
- class TkScrollbox<TkListbox
857
- include TkComposite
858
- def initialize_composite(keys=nil)
859
- list = TkListbox.new(@frame)
860
- scroll = TkScrollbar.new(@frame)
861
- @path = list.path
862
- list.configure 'yscroll', scroll.path+" set"
863
- list.pack 'side'=>'left','fill'=>'both','expand'=>'yes'
864
- scroll.configure 'command', list.path+" yview"
865
- scroll.pack 'side'=>'right','fill'=>'y'
866
- delegate('DEFAULT', list)
867
- delegate('foreground', list)
868
- delegate('background', list, scroll)
869
- delegate('borderwidth', @frame)
870
- delegate('relief', @frame)
871
- configure keys if keys
872
- end
873
- end
874
-
875
- class ObjBoard
876
- attr_reader :objectsList
877
- def initialize(_host, _obji)
878
- @obji = _obji
879
- @objectsList = Array.new
880
- @count = 0
881
- @itemindex = -1
882
- end
883
-
884
- def get_string(_agobj)
885
- _agobj.i_name + ' [ < '+ _agobj.obj_class.to_s+' ]'
886
- end
887
-
888
- def delete(_agobj)
889
- @objectsList.delete(_agobj)
890
- @count = @count - 1
891
- end
892
-
893
- def insert(_agobj)
894
- @objectsList << _agobj
895
- @count = @count + 1
896
- @itemindex = @count - 1
897
- end
898
-
899
- def select(_agobj)
900
- end
901
-
902
- # def change_name(_agobj, _newname)
903
- # _agobj.i_name = _newname
904
- # end
905
-
906
- end
907
-
908
-
909
- class TkScrollboxObjBoard < ObjBoard
910
-
911
- def initialize(_host)
912
- super
913
- @sb = TkScrollbox.new(_host){
914
- width 200
915
- height 200
916
- pack('fill'=>'both', :padx=>0, :pady=>0)
917
- }
918
- end
919
-
920
- def delete(_agobj)
921
- super
922
- @sb.delete('active')
923
- end
924
-
925
- def insert(_agobj)
926
- super
927
- @sb.insert('end', _agobj.i_name)
928
- end
929
-
930
- def select(_agobj)
931
- super
932
- @sb.selection_clear(0, @sb.size - 1)
933
- for i in 0..@sb.size - 1
934
- if @sb.get(i) == _agobj.i_name.to_s
935
- @sb.selection_set(i)
936
- break
937
- end
938
- end
939
- end
940
-
941
- end
942
-
943
- class TkBwComboBoxObjBoard < ObjBoard
944
-
945
- def initialize(_host, _obji)
946
- super
947
- do_select = proc {
948
- _itemindex = @sb.cget('values').index(@sb.cget('text'))
949
- @obji.select(@objectsList[_itemindex])
950
- @objectsList[_itemindex].activate
951
- }
952
- @sb = Tk::BWidget::ComboBox.new(_host){
953
- modifycmd do_select
954
- editable false
955
- expand 'tab'
956
- pack('fill'=>'x', 'padx'=>0, 'pady'=>0, 'anchor'=>'n')
957
- }
958
- end
959
-
960
- def delete(_agobj)
961
- super
962
- @sb.delete('active')
963
- end
964
-
965
- def getString(_agobj)
966
- _agobj.i_name + '<--'+ _agobj.obj.class.to_s
967
- end
968
-
969
- def insert(_agobj)
970
- super
971
- _values = @sb.cget('values').to_a
972
- _values << getString(_agobj)
973
- @sb.configure('values'=>_values)
974
- @sb.set_value(@itemindex)
975
- end
976
-
977
- def select(_agobj)
978
- super
979
- @itemindex = @sb.cget('values').index(getString(_agobj))
980
- @sb.set_value(@itemindex)
981
- end
982
-
983
- end
984
-
985
- class TkMenuButtonObjBoard < ObjBoard
986
-
987
- def initialize(_host, _obji)
988
- super
989
- @sb = TkMenubutton.new(
990
- :parent=>_host,
991
- :underline=>0,
992
- :direction=>:flush,
993
- :font=>$arcadia['conf']['inspectors.inspector.tree.font'],
994
- :relief=>:groove,
995
- :background=> :white,
996
- :justify=> :left){|mb|
997
- menu TkMenu.new(
998
- :parent=>mb,
999
- :tearoff=>1,
1000
- :font=>$arcadia['conf']['inspectors.inspector.tree.font'],
1001
- :background=> :white,:relief=>'flat'
1002
- )
1003
- pack('fill'=>'x', 'padx'=>0, 'pady'=>0, 'anchor'=>'n')
1004
- }
1005
- @menu = @sb.cget('menu')
1006
- end
1007
-
1008
- def delete(_agobj)
1009
- super
1010
- @menu.delete(getobjstring(_agobj))
1011
- end
1012
-
1013
- def getobjstring(_agobj)
1014
- _num = 0
1015
- _result = _agobj.i_name
1016
- _parent = _agobj.ag_parent
1017
- while _parent != nil
1018
- _result = ' - '+_result
1019
- _parent = _parent.ag_parent
1020
- _num = _num+1
1021
- end
1022
- _space = ''; _num.times do
1023
- _space = _space + ' '
1024
- end
1025
- if _agobj.ag_parent != nil
1026
- _result = _space + '�'+_result
1027
- end
1028
- return _result
1029
- end
1030
-
1031
- def change_name(_agobj, _newname)
1032
- @menu.delete(getobjstring(_agobj))
1033
- super
1034
- insert_menu_item(_agobj)
1035
- end
1036
-
1037
- def insert_menu_item(_agobj)
1038
- _do_select = proc {
1039
- @obji.select(_agobj)
1040
- @sb.configure('text'=>get_string(_agobj))
1041
- }
1042
- if (!defined? _agobj.ag_parent)|| (_agobj.ag_parent == nil)
1043
- _index = 0
1044
- else
1045
- _index = @menu.index(getobjstring(_agobj.ag_parent))
1046
- end
1047
- @menu.insert(_index + 1,
1048
- :command,
1049
- :label=>getobjstring(_agobj),
1050
- :hidemargin => true,
1051
- :accelerator => _agobj.obj_class.to_s,
1052
- :command=>_do_select
1053
- )
1054
- @sb.configure('text'=>get_string(_agobj))
1055
- end
1056
-
1057
- def insert(_agobj)
1058
- super
1059
- insert_menu_item(_agobj)
1060
- end
1061
-
1062
- def select(_agobj)
1063
- super
1064
- @sb.configure('text'=>get_string(_agobj))
1065
- end
1066
-
1067
- end
1068
-
1069
- class ObjiRenderer
1070
-
1071
- def initialize(_obji=nil)
1072
- if _obji
1073
- @obji = _obji
1074
- else
1075
- exit
1076
- end
1077
- end
1078
-
1079
- def code
1080
- return codeBegin, codeHinnerBegin, codeHinnerEnd, codeEnd
1081
- end
1082
-
1083
- def codeBegin
1084
- code_rb = ''
1085
- @obji.requires.each_key do |key|
1086
- code_rb = code_rb, "require '",key,"'\n"
1087
- end
1088
- return code_rb
1089
- end
1090
-
1091
- def codeHinnerBegin
1092
- end
1093
-
1094
- def codeHinnerEnd
1095
- end
1096
-
1097
- def codeEnd
1098
- code_rb = code_rb, "\n", @obji.agobj_start.renderer.classCode
1099
- end
1100
-
1101
- end
1102
-
1103
-
1104
- class Obji
1105
- include Observable
1106
- attr :lb
1107
- attr :tlb
1108
- attr :active_object
1109
- attr_reader :filename
1110
- attr_writer :filename
1111
- attr_reader :requires
1112
- attr_reader :inspect_core
1113
- attr_reader :editor
1114
- attr_reader :agobj_start
1115
- attr_reader :renderer
1116
-
1117
- def initialize(_frame, _controller, _agobj_start, _filename = nil)
1118
- @agobj_start = _agobj_start
1119
- @agobj_last = nil
1120
- @controller = _controller
1121
- @filename = _filename
1122
- @frame = _frame
1123
- @pmainwind = AGTkOSplittedFrames.new(@frame,20)
1124
- @f_top = @pmainwind.top_frame
1125
- @f_bottom = @pmainwind.bottom_frame
1126
- @lb = TkMenuButtonObjBoard.new(@f_top, self)
1127
- @ojts = Tk::BWidget::NoteBook.new(@f_bottom){
1128
- tabbevelsize 0
1129
- internalborderwidth 0
1130
- side $arcadia['conf']['inspectors.inspector.tabs.side']
1131
- font $arcadia['conf']['inspectors.inspector.tabs.font']
1132
- pack('fill'=>'both', :padx=>0, :pady=>0, :expand => 'yes')
1133
- }
1134
- #@inspect_core = _agobj_start.class.class_inspector.new(@ojts, _agobj_start)
1135
- @inspect_core = Inspector.iclass(_agobj_start.class).new(@ojts, _agobj_start)
1136
- #@requires = Hash.new
1137
- @renderer = @inspect_core.class.class_inspector_renderer.new(self)
1138
- select(_agobj_start)
1139
- end
1140
-
1141
- def free
1142
- #@agobj_start.delete
1143
- @inspect_core.clear
1144
- end
1145
-
1146
- def change_name(_agobj, _newname)
1147
- @lb.change_name(_agobj, _newname)
1148
- end
1149
-
1150
- def raise_toplevel
1151
- @agobj_start.obj.raise
1152
- end
1153
-
1154
- def active
1155
- @controller.active
1156
- end
1157
-
1158
- # def add_require(_require)
1159
- # if @requires[_require] == nil
1160
- # @requires[_require] = 1
1161
- # else
1162
- # @requires[_require] += 1
1163
- # end
1164
- # end
1165
-
1166
- # def del_require(_require)
1167
- # @requires[_require] -= 1
1168
- # if @requires[_require] == 0
1169
- # @requires[_require] = nil
1170
- # end
1171
- # end
1172
-
1173
- def delete(_agobj)
1174
- _agobj.obj.destroy if defined? _agobj.obj
1175
- if _agobj==agobj_start
1176
- @controller.del(self)
1177
- else
1178
- @lb.delete(_agobj)
1179
- select(@lb.objectsList[@lb.objectsList.length - 1]) if @lb.objectsList.length > 0
1180
- end
1181
- end
1182
-
1183
- def activate
1184
- @controller.activate(self)
1185
- end
1186
-
1187
- def register(me)
1188
- @lb.insert(me)
1189
- @agobj_last = me
1190
- return self
1191
- end
1192
-
1193
- def select_last(_activate=true)
1194
- #Tk.messageBox('message'=>'select last')
1195
- if @agobj_last != nil
1196
- select(@agobj_last, _activate)
1197
- end
1198
- end
1199
-
1200
- def select(me, _activate_me=true)
1201
- return if @active_object == me
1202
- me.activate #if _activate_me
1203
- @active_object = me
1204
- @inspect_core.recicle_inspects(me)
1205
- @lb.select(me)
1206
- changed
1207
- notify_observers('SELECT', me)
1208
- end
1209
-
1210
- # def objects2code
1211
- # code_rb = ''
1212
- # @requires.each_key do |key|
1213
- # code_rb = code_rb, "require '",key,"'\n"
1214
- # end
1215
- # code_rb = code_rb, "\n", @inspect_core.objects2text(@lb.objectsList)
1216
- # end
1217
-
1218
- def code2file(_objects_file = nil)
1219
- @filename = _objects_file
1220
- if !@filename
1221
- exit
1222
- end
1223
-
1224
- File.open(_objects_file, "w") do |aFile|
1225
- aFile.print @renderer.code
1226
- end
1227
- end
1228
-
1229
- # def saveObjectsCreationtoFile(_objects_file = 'sample\objects.rb')
1230
- # @filename = _objects_file
1231
- # code_rb = ''
1232
- # code_rbd = ''
1233
- # code_form = ''
1234
- # code_form = code_form, "class ", File.basename(_objects_file, ".rb"),"\n"
1235
- # code_rbd = code_rbd, "require '",_objects_file,"'\n"
1236
- # @requires.each_key do |key|
1237
- # code_rb = code_rb, "require '",key,"'\n"
1238
- # end
1239
- # @lb.objectsList.each{|object|
1240
- # code_rb = code_rb, object.get_class_code
1241
- # code_rbd = code_rbd,"\n", object.get_implementation_code
1242
- # }
1243
- # File.open(_objects_file, "w") do |aFile|
1244
- # aFile.print code_rb
1245
- # end
1246
- # File.open(_objects_file+'d', "w") do |aFile|
1247
- # aFile.print code_rbd
1248
- # end
1249
- # end
1250
-
1251
- def dumpObjectstoFile(_objects_file = 'sample\objects.rb')
1252
- @filename = _objects_file
1253
- File.open(_objects_file, "w") do |aFile|
1254
- @lb.objectsList.each{|object|
1255
- Marshal.dump(object.obj, aFile)
1256
- }
1257
- end
1258
- end
1259
-
1260
- end
1261
-
1262
- class ObjiControllerView
1263
- attr_reader :nb
1264
- attr_reader :nb_base
1265
- attr_reader :layout
1266
- def initialize(_frame)
1267
- @nb_base = Tk::BWidget::NoteBook.new(_frame){
1268
- tabbevelsize 0
1269
- internalborderwidth 0
1270
- side $arcadia['conf']['inspectors.tabs.side']
1271
- font $arcadia['conf']['inspectors.tabs.font']
1272
- pack('fill'=>'both', :padx=>0, :pady=>0, :expand => 'yes')
1273
- }
1274
- end
1275
- end
1276
-
1277
- class ObjiController < ArcadiaExt
1278
- attr_reader :active
1279
-
1280
- def on_before_build(_event)
1281
- ArcadiaContractListener.new(self, InspectorContract, :do_inspector_event)
1282
- ArcadiaContractListener.new(self, WrapperContract, :do_wrapper_event)
1283
- end
1284
-
1285
- def on_build(_event)
1286
- #@main_frame = ObjiControllerView.new(self.frame)
1287
- @objis = Hash.new
1288
- @wrappers_obji = Hash.new
1289
- @frames = Array.new
1290
- end
1291
-
1292
- def do_wrapper_event(_event)
1293
- obji = @wrappers_obji[_event.context.wrapper] if _event.context
1294
- case _event.signature
1295
- when WrapperContract::WRAPPER_AFTER_CREATE
1296
- self.register(_event.context.wrapper)
1297
- when WrapperContract::PROPERTY_AFTER_UPDATE
1298
- obji.inspect_core.update_property(_event.context.wrapper, _event.context.property_family, _event.context.property_name, _event.context.property_new_value)
1299
- if (_event.context.property_family=='layout_man')
1300
- obji.inspect_core.tabs['Layout'].family=_event.context.property_new_value
1301
- obji.inspect_core.tabs['Layout'].updatelines(
1302
- _event.context.wrapper,
1303
- _event.context.wrapper.props[_event.context.property_new_value]
1304
- )
1305
- end
1306
-
1307
- end
1308
- end
1309
-
1310
- def main_frame
1311
- if !defined?(@main_frame) || @main_frame == nil
1312
- @main_frame = ObjiControllerView.new(self.frame)
1313
- end
1314
- return @main_frame
1315
- end
1316
-
1317
- def do_inspector_event(_event)
1318
- obji = @wrappers_obji[_event.context.wrapper] if _event.context
1319
-
1320
- case _event.signature
1321
- when InspectorContract::SELECT_WRAPPER
1322
- obji.select(_event.context.wrapper, false)
1323
- when InspectorContract::DELETE_WRAPPER
1324
- obji.delete(_event.context.wrapper)
1325
- when InspectorContract::DELETE_INSPECTOR
1326
- self.del(obji)
1327
- when InspectorContract::RAISE_ACTIVE_TOPLEVEL
1328
- self.active.raise_toplevel if active
1329
- when InspectorContract::RAISE_LAST_WIDGET
1330
- self.active.select_last(true) if active
1331
- end
1332
- end
1333
-
1334
- def register(_wrapper)
1335
- if _wrapper.ag_parent
1336
- obji = @wrappers_obji[_wrapper.ag_parent]
1337
- else
1338
- obji = self.new_obji(_wrapper)
1339
- end
1340
- if obji
1341
- obji.register(_wrapper)
1342
-
1343
- @wrappers_obji[_wrapper]=obji
1344
- end
1345
- @last_registred = _wrapper
1346
- end
1347
-
1348
- def new_obji(_sender, _filename = nil)
1349
- _fname = 'f'+@frames.length.to_s
1350
- _frame = self.main_frame.nb_base.insert('end',_fname,'text'=>_sender.i_name)
1351
- @frames << _frame
1352
-
1353
- _newobji = Obji.new(_frame, self, _sender, _filename)
1354
-
1355
- @objis[_newobji]=_fname
1356
-
1357
- activate(_newobji)
1358
-
1359
- #@arcadia.layout.raise_panel('_mosca_','Inspect')
1360
-
1361
- return _newobji
1362
- end
1363
-
1364
- def del(_obji)
1365
- _obji.free
1366
- self.main_frame.nb_base.delete(@objis.delete(_obji))
1367
- if @objis.length == 0
1368
- @active = nil
1369
- self.frame_free
1370
- @main_frame = nil
1371
- else
1372
- activate(@objis.keys[@objis.length-1])
1373
- end
1374
- end
1375
-
1376
- def activate(me)
1377
- @active = me
1378
- self.main_frame.nb_base.raise(@objis[me])
1379
- end
1380
-
1381
- end
1382
-
1383
-
1384
- class ObjiThread
1385
- attr_reader :oi
1386
-
1387
- def initialize(_filename = nil)
1388
- @oi = Obji.new(_filename)
1389
- end
1390
-
1391
- def initialize_in_osservazione
1392
- t_obji = Thread.new {
1393
- print ' Thread.current = ', Thread.current,"\n"
1394
- Thread.current[:oi]= Obji.new
1395
- }
1396
- @oi = t_obji[:oi]
1397
- end
1398
-
1399
- end
1400
-
1401
-
1402
- #----- inspector core ------
1403
-
1404
- class Inspector
1405
- def Inspector.iclass(_wrapper_class)
1406
- class_rif = _wrapper_class
1407
- while @@i[class_rif] == nil
1408
- class_rif = class_rif.superclass
1409
- end
1410
- return @@i[class_rif]
1411
- end
1412
-
1413
- def Inspector.add_wrapper_class(_class)
1414
- if defined?(@@i)
1415
- @@i[_class]=self
1416
- else
1417
- @@i = Hash.new
1418
- end
1419
- end
1420
- end
1421
-
1422
- class AGInspector < Inspector
1423
- attr_reader :tabs
1424
-
1425
- def initialize(_host, _agobj)
1426
- @@instance = self
1427
- @tabs = Hash.new
1428
- @code = Hash.new
1429
- @ag_signature_obj = _agobj
1430
- @ojts_p = _host.insert('end','props','text'=>'Properties')
1431
- _host.raise('props')
1432
- @tabs['Properties'] = InspectList.new('property', @ojts_p)
1433
- end
1434
-
1435
- def AGInspector.instance
1436
- @@instance
1437
- end
1438
-
1439
- def AGInspector.class_inspector_renderer
1440
- ObjiRenderer
1441
- end
1442
-
1443
- def recicle_inspects(_agobj)
1444
- tabs['Properties'].updatelines(_agobj, _agobj.props['property'])
1445
- end
1446
-
1447
- def update_property(obj, _fam, _name, _value)
1448
- if _fam == 'property'
1449
- tabs['Properties'].modProp(_name, _value)
1450
- end
1451
- end
1452
-
1453
- def activate
1454
-
1455
- end
1456
-
1457
- def clear
1458
- @tabs['Properties'].clear
1459
- end
1460
-
1461
- add_wrapper_class AG
1462
-
1463
- end
1464
-
1465
- class AGTkInspector < AGInspector
1466
-
1467
- def initialize( _host, _agobj)
1468
- super( _host, _agobj)
1469
- @ojts_layout = _host.insert('end','layout','text'=>'Layout')
1470
- @top_panel = TkFrame.new(@ojts_layout){
1471
- place('x'=>0, 'y'=>0, 'relheight'=>1, 'relwidth'=>1)
1472
- }
1473
- @tabs['LayoutType'] = InspectList.new('layout_man', @top_panel)
1474
- @mid_panel = TkFrame.new(@ojts_layout){
1475
- place('x'=>0, 'y'=>20,'relheight'=>1, 'relwidth'=>1)
1476
- }
1477
- @tabs['Layout'] = InspectList.new('...',@mid_panel)
1478
-
1479
- @ojts_winfo = _host.insert('end','winfo','text'=>'Winfo')
1480
- @tabs['Winfo'] = InspectList.new('winfo', @ojts_winfo)
1481
-
1482
-
1483
- #@ojts_bind = _host.insert('end','bind','text'=>'Binding')
1484
- #@tabs['Binding'] = InspectMultiList.new('bind',@ojts_bind)
1485
- end
1486
-
1487
- def clear
1488
- super
1489
- @tabs['LayoutType'].clear
1490
- end
1491
-
1492
- def recicle_inspects(_agobj)
1493
- super(_agobj)
1494
- if _agobj.props['layout_man'] != nil
1495
- _fam = _agobj.props['layout_man']['manager']['get'].call
1496
- @tabs['Layout'].family=_fam
1497
- @tabs['Layout'].updatelines(_agobj, _agobj.props[_fam])
1498
- end
1499
- @tabs['LayoutType'].updatelines(_agobj, _agobj.props['layout_man'])
1500
- @tabs['Winfo'].updatelines(_agobj, _agobj.props['winfo'])
1501
- #@tabs['Binding'].update(_agobj)
1502
- end
1503
-
1504
- def update_property(obj, _fam, _name, _value)
1505
- if ['place','pack','grid'].include?(_fam)
1506
- @tabs['Layout'].modProp(_name, _value)
1507
- elsif ['layout_man'].include?(_fam)
1508
- @tabs['LayoutType'].modProp(_name, _value)
1509
- else
1510
- super(obj, _fam, _name, _value)
1511
- end
1512
- end
1513
-
1514
- add_wrapper_class AGTk
1515
-
1516
-
1517
- end
1518
-
1519
-