arcadia 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +69 -77
- data/arcadia.rb +1097 -770
- data/base/a-commons.rb +480 -0
- data/base/a-contracts.rb +207 -322
- data/base/{a-utils.rb → a-tkcommons.rb} +933 -993
- data/conf/arcadia.conf +130 -203
- data/conf/arcadia.res.rb +1332 -1325
- data/ext/ae-action-dispatcher/ae-action-dispatcher.conf +6 -0
- data/ext/ae-action-dispatcher/ae-action-dispatcher.rb +22 -0
- data/ext/ae-complete-code/ae-complete-code.conf +2 -2
- data/ext/ae-complete-code/ae-complete-code.rb +82 -80
- data/ext/ae-doc-code/ae-doc-code.conf +2 -2
- data/ext/ae-doc-code/ae-doc-code.rb +114 -111
- data/ext/ae-editor/ae-editor.conf +110 -105
- data/ext/ae-editor/ae-editor.rb +2501 -2287
- data/ext/ae-editor/langs/conf.lang +15 -0
- data/ext/ae-editor/langs/lang.lang.bind +1 -0
- data/ext/ae-editor/langs/rb.lang +67 -0
- data/ext/ae-editor/langs/rbw.lang.bind +1 -0
- data/ext/ae-event-log/ae-event-log.rb +45 -52
- data/ext/ae-file-history/ae-file-history.conf +4 -4
- data/ext/ae-file-history/ae-file-history.rb +298 -286
- data/ext/ae-flag/ae-flag.conf +6 -6
- data/ext/ae-flag/ae-flag.rb +12 -12
- data/ext/ae-inspector/ae-inspector.conf +3 -3
- data/ext/ae-inspector/ae-inspector.rb +2 -2
- data/ext/ae-output-event/ae-output-event.conf +15 -15
- data/ext/ae-output/ae-output.conf +5 -3
- data/ext/ae-output/ae-output.rb +62 -33
- data/ext/ae-palette/ae-palette.conf +3 -3
- data/ext/ae-palette/ae-palette.rb +265 -306
- data/ext/ae-rad/ae-rad-inspector.rb +1534 -0
- data/{base/a-libs.rb → ext/ae-rad/ae-rad-libs.rb} +1118 -846
- data/ext/ae-rad/ae-rad-palette.rb +273 -0
- data/ext/ae-rad/ae-rad.conf +71 -0
- data/ext/ae-rad/ae-rad.rb +56 -0
- data/{lib → ext/ae-rad/lib}/tk/al-tk.rb +21 -110
- data/{lib → ext/ae-rad/lib}/tk/al-tk.res.rb +0 -0
- data/{lib → ext/ae-rad/lib}/tk/al-tkarcadia.rb +26 -26
- data/{lib → ext/ae-rad/lib}/tk/al-tkcustom.rb +70 -70
- data/{lib → ext/ae-rad/lib}/tkext/al-bwidget.rb +194 -194
- data/{lib → ext/ae-rad/lib}/tkext/al-iwidgets.rb +25 -25
- data/{lib → ext/ae-rad/lib}/tkext/al-tile.rb +173 -173
- data/{lib → ext/ae-rad/lib}/tkext/al-tktable.rb +0 -0
- data/ext/ae-ruby-debug/ae-ruby-debug.conf +7 -4
- data/ext/ae-ruby-debug/ae-ruby-debug.rb +278 -142
- data/ext/ae-search-in-files/ae-search-in-files.conf +15 -0
- data/ext/ae-search-in-files/ae-search-in-files.rb +284 -0
- data/ext/ae-shell/ae-shell.rb +88 -8
- data/ext/ae-shell/sh.rb +7 -0
- metadata +93 -79
- data/base/a-contracts-work.rb +0 -219
- data/base/a-ext.rb +0 -280
- data/ext/ae-debug/ae-debug.conf +0 -7
- data/ext/ae-debug/ae-debug.rb +0 -601
- data/ext/ae-debug/debug1.57.rb +0 -998
@@ -0,0 +1,273 @@
|
|
1
|
+
#
|
2
|
+
# ae-palette.rb - Arcadia Ruby ide
|
3
|
+
# by Antonio Galeone <antonio-galeone@rubyforge.org>
|
4
|
+
#
|
5
|
+
|
6
|
+
require 'ext/ae-rad/ae-rad-libs'
|
7
|
+
require 'ext/ae-rad/lib/tk/al-tk'
|
8
|
+
require 'tk'
|
9
|
+
require 'tkmenubar'
|
10
|
+
require 'tkextlib/bwidget'
|
11
|
+
|
12
|
+
|
13
|
+
class Palette #< ArcadiaExt
|
14
|
+
attr_reader :buttons
|
15
|
+
attr_reader :selected_wrapper
|
16
|
+
attr_reader :rad
|
17
|
+
def initialize(_rad)
|
18
|
+
@rad = _rad
|
19
|
+
ArcadiaContractListener.new(self, InspectorContract, :do_inspector_event)
|
20
|
+
ArcadiaContractListener.new(self, PaletteContract, :do_palette_event)
|
21
|
+
build
|
22
|
+
end
|
23
|
+
|
24
|
+
# def on_before_build(_event)
|
25
|
+
# ArcadiaContractListener.new(self, InspectorContract, :do_inspector_event)
|
26
|
+
# ArcadiaContractListener.new(self, PaletteContract, :do_palette_event)
|
27
|
+
# end
|
28
|
+
|
29
|
+
def build
|
30
|
+
@buttons = Hash.new
|
31
|
+
create_palettes
|
32
|
+
end
|
33
|
+
|
34
|
+
def on_after_build(_event)
|
35
|
+
end
|
36
|
+
|
37
|
+
def do_inspector_event(_event)
|
38
|
+
case _event.signature
|
39
|
+
when InspectorContract::SELECT_WRAPPER
|
40
|
+
@selected_wrapper=_event.context.wrapper
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def do_palette_event(_event)
|
45
|
+
case _event.signature
|
46
|
+
when PaletteContract::MAKE_SELECTED_WRAPPER
|
47
|
+
give_me_obj(_event.context.parent)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def eval_form_file(_filename)
|
52
|
+
cod = '';
|
53
|
+
IO.foreach(_filename) { |line| cod += line };
|
54
|
+
Revparsel.new(cod, _filename)
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
def eval_file(_filename)
|
59
|
+
cod = '';
|
60
|
+
begin
|
61
|
+
IO.foreach(_filename) { |line| cod += line }
|
62
|
+
rescue SystemCallError
|
63
|
+
handleException # defined elsewhere
|
64
|
+
end
|
65
|
+
eval(cod)
|
66
|
+
end
|
67
|
+
|
68
|
+
def create_palettes
|
69
|
+
@cc = WrapperContainer.new(self){
|
70
|
+
border 0
|
71
|
+
borderwidth 1
|
72
|
+
}
|
73
|
+
@cc.pack('side' =>'left', 'fill' =>'both', 'anchor'=>'nw', :padx=>2, :pady=>2)
|
74
|
+
@rad.libs.list.each{|lib|
|
75
|
+
@cc.add_palette(lib)
|
76
|
+
}
|
77
|
+
end
|
78
|
+
|
79
|
+
def give_me_obj(_owner)
|
80
|
+
@cc.new_wrapper(_owner)
|
81
|
+
end
|
82
|
+
|
83
|
+
def give_me_code
|
84
|
+
@cc.new_wrapper_code
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
|
89
|
+
class WrapperContainer < TkFrame
|
90
|
+
|
91
|
+
def initialize(_owner)
|
92
|
+
|
93
|
+
super(_owner.rad.float_frame(0, 'x'=>10, 'y'=>10, 'width'=>200,'heigh'=>220).frame)
|
94
|
+
@owner = _owner
|
95
|
+
_self = self
|
96
|
+
frame = TkFrame.new(self).pack('side' =>'left', 'anchor'=>'n', :padx=>2, :pady=>2)
|
97
|
+
|
98
|
+
@button_u = Tk::BWidget::Button.new(frame){
|
99
|
+
image TkPhotoImage.new('dat' => CURSOR_GIF)
|
100
|
+
helptext 'Select'
|
101
|
+
text 'C'
|
102
|
+
foreground 'blue'
|
103
|
+
command proc{_self.unfill}
|
104
|
+
relief 'groove'
|
105
|
+
pack('side' =>'top', 'anchor'=>'n',:padx=>2, :pady=>2)
|
106
|
+
}
|
107
|
+
@button_m = Tk::BWidget::Button.new(frame){
|
108
|
+
_command = proc{
|
109
|
+
require 'tk/clipboard'
|
110
|
+
_code = AG.active.renderer.class_code.to_s if AG.active
|
111
|
+
TkClipboard::set(_code)
|
112
|
+
eval(_code)
|
113
|
+
_self.fill(
|
114
|
+
self,
|
115
|
+
_owner.selected_wrapper.class,
|
116
|
+
nil,
|
117
|
+
_owner.selected_wrapper.getInstanceClass
|
118
|
+
)
|
119
|
+
_self.new_wrapper if _owner.selected_wrapper.class.is_top
|
120
|
+
|
121
|
+
}
|
122
|
+
image TkPhotoImage.new('dat' => WIDGET_COPY_GIF)
|
123
|
+
helptext 'Copy current selected'
|
124
|
+
text 'C'
|
125
|
+
foreground 'blue'
|
126
|
+
command _command
|
127
|
+
relief 'groove'
|
128
|
+
pack('side' =>'left','anchor'=>'n', :padx=>2, :pady=>2)
|
129
|
+
}
|
130
|
+
@familyts = Tk::BWidget::NoteBook.new(self){
|
131
|
+
tabbevelsize 0
|
132
|
+
internalborderwidth 1
|
133
|
+
activeforeground 'orange'
|
134
|
+
font $arcadia['conf']['main.font']
|
135
|
+
pack('side' =>'left','expand'=>'yes','fill'=>'both', :padx=>2, :pady=>2)
|
136
|
+
}
|
137
|
+
@objCollections = Array.new
|
138
|
+
end
|
139
|
+
|
140
|
+
def new_wrapper_code
|
141
|
+
_code = ''
|
142
|
+
if @selected_button != nil && @selected_class_obj != nil
|
143
|
+
#objiinfo = @owner.ae_inspector_talker.info
|
144
|
+
#_code = objiinfo.active_wrapper.renderer.class_code.to_s
|
145
|
+
_code = AG.active.renderer.class_code.to_s
|
146
|
+
@selected_button.configure('relief'=>'groove')
|
147
|
+
@selected_button = @selected_class = @selected_require = nil
|
148
|
+
end
|
149
|
+
return _code
|
150
|
+
end
|
151
|
+
|
152
|
+
|
153
|
+
def new_wrapper(_parent = nil, _obj = nil)
|
154
|
+
if @selected_button == nil
|
155
|
+
return
|
156
|
+
end
|
157
|
+
# copy obj
|
158
|
+
if @selected_class_obj != nil && _obj == nil
|
159
|
+
_obj = eval(@selected_class_obj).new(_parent == nil ?nil:_parent.obj)
|
160
|
+
end
|
161
|
+
|
162
|
+
w = @selected_class.new(_parent, _obj)
|
163
|
+
#$arcadia['objic'].active.select_last(true) if @selected_class_obj != nil
|
164
|
+
#$arcadia.objects('objic').active.addRequire(@selected_require) if @selected_require != nil
|
165
|
+
|
166
|
+
|
167
|
+
w.select.activate if @selected_class_obj != nil
|
168
|
+
w.add_require([@selected_require]) if @selected_require != nil
|
169
|
+
|
170
|
+
@selected_button.configure('relief'=>'groove')
|
171
|
+
@selected_button = @selected_class = @selected_require = nil
|
172
|
+
end
|
173
|
+
|
174
|
+
|
175
|
+
def fill(_b, _class, _require, _class_obj = nil)
|
176
|
+
_b.configure('relief'=>'sunken')
|
177
|
+
if @selected_button != nil
|
178
|
+
@selected_button.configure('relief'=>'groove')
|
179
|
+
end
|
180
|
+
@selected_button = _b
|
181
|
+
@selected_class = _class
|
182
|
+
@selected_require = _require
|
183
|
+
@selected_class_obj = _class_obj
|
184
|
+
@owner.rad.float_frame.title(_class.class_wrapped)
|
185
|
+
#Arcadia.instance.layout.domain(Arcadia.instance['conf']['palette.frame'])['root'].top_text(_class.class_wrapped)
|
186
|
+
|
187
|
+
end
|
188
|
+
|
189
|
+
def unfill
|
190
|
+
if @selected_button != nil
|
191
|
+
@selected_button.configure('relief'=>'groove')
|
192
|
+
end
|
193
|
+
@selected_button = nil
|
194
|
+
@selected_class = nil
|
195
|
+
@selected_require = nil
|
196
|
+
@selected_class_obj = nil
|
197
|
+
Arcadia.instance.layout.domain(Arcadia.instance['conf']['palette.frame'])['root'].top_text('')
|
198
|
+
end
|
199
|
+
|
200
|
+
def add_palette(_lib_obj)
|
201
|
+
_name = _lib_obj.arcadia_lib_params.name
|
202
|
+
_file = _lib_obj.arcadia_lib_params.require
|
203
|
+
_img = nil
|
204
|
+
@objCollections << {
|
205
|
+
'name'=>_name,
|
206
|
+
'collection'=>_lib_obj,
|
207
|
+
'file'=>_file,
|
208
|
+
'img'=>_img
|
209
|
+
}
|
210
|
+
|
211
|
+
@classes_panel = @familyts.insert('end',_name,
|
212
|
+
'text'=>_name#,
|
213
|
+
)
|
214
|
+
|
215
|
+
_background = @classes_panel.cget('background')
|
216
|
+
|
217
|
+
@tpanel = TkText.new(@classes_panel){
|
218
|
+
relief 'flat'
|
219
|
+
background _background
|
220
|
+
}.pack('side' =>'left', 'anchor'=>'nw', :padx=>2, :pady=>2)
|
221
|
+
|
222
|
+
|
223
|
+
_lib_obj.classes.each{|value|
|
224
|
+
_self = self
|
225
|
+
_image = self.class_image(value)
|
226
|
+
ewin = TkTextWindow.new(@tpanel, 'end',
|
227
|
+
'window'=> Tk::BWidget::Button.new(@tpanel){
|
228
|
+
_command = proc{
|
229
|
+
_self.fill(self, value, _file)
|
230
|
+
_self.new_wrapper if value.is_top
|
231
|
+
}
|
232
|
+
text value.class_wrapped.to_s
|
233
|
+
helptext value.class_wrapped.to_s
|
234
|
+
image TkPhotoImage.new( 'dat' => _image )
|
235
|
+
foreground 'blue'
|
236
|
+
command _command
|
237
|
+
font $arcadia['conf']['main.component.font']
|
238
|
+
relief 'groove'
|
239
|
+
height 25
|
240
|
+
width 25
|
241
|
+
#pack('side' =>'left', 'anchor'=>'nw', :padx=>2, :pady=>2)
|
242
|
+
}
|
243
|
+
)
|
244
|
+
}
|
245
|
+
|
246
|
+
if @objCollections.length == 1
|
247
|
+
@familyts.raise(_name)
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
def class_image(_class=nil)
|
252
|
+
_current_class = _class
|
253
|
+
_found = false
|
254
|
+
if _class
|
255
|
+
_dir = File.dirname(_class.library.arcadia_lib_params.source)
|
256
|
+
end
|
257
|
+
while _current_class != nil && !_found
|
258
|
+
if defined?(_current_class.library)
|
259
|
+
_dir = File.dirname(_current_class.library.arcadia_lib_params.source)
|
260
|
+
end
|
261
|
+
_img = (_current_class.to_s+"_gif").upcase
|
262
|
+
_data = eval(_img + ' if defined?('+_img+')' )
|
263
|
+
#_file = _dir+"/res/"+_current_class.to_s+".gif"
|
264
|
+
if _data
|
265
|
+
#if FileTest.exist?(_file)
|
266
|
+
_found = true
|
267
|
+
else
|
268
|
+
_current_class = _current_class.superclass
|
269
|
+
end
|
270
|
+
end
|
271
|
+
return (_found)?_data:A_WIDGET_GIF
|
272
|
+
end
|
273
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
name=rad
|
2
|
+
labels=Rad,Object Inspector
|
3
|
+
frames=0.0
|
4
|
+
active=yes
|
5
|
+
require=ext/ae-rad/ae-rad
|
6
|
+
class=Rad
|
7
|
+
|
8
|
+
#:::::::::::::::: user toolbar :::::::::::::::::::::::::<begin>
|
9
|
+
user_toolbar.contexts=tkrad
|
10
|
+
user_toolbar.tkrad = show
|
11
|
+
user_toolbar.tkrad.show.name=show_rad
|
12
|
+
user_toolbar.tkrad.show.hint=Show Rad Palette
|
13
|
+
user_toolbar.tkrad.show.image_data=AGTKTOPLEVEL_GIF
|
14
|
+
user_toolbar.tkrad.show.event_class=ActionEvent
|
15
|
+
user_toolbar.tkrad.show.event_args={'receiver'=>self, 'action' =>'show_rad'}
|
16
|
+
#:::::::::::::::: user toolbar :::::::::::::::::::::::::<end>
|
17
|
+
|
18
|
+
#:::::::::::::::: Libraries group ::::::::::::::::::::::<begin>
|
19
|
+
|
20
|
+
# this section is for the components pallets of the wrapped class
|
21
|
+
|
22
|
+
libraries=tk,tkCustom
|
23
|
+
#libraries=tk,tkBWidget,tkCustom,tkArcadia
|
24
|
+
#win::libraries=tk,tkBWidget,tkCustom, tkIWidget
|
25
|
+
# tk library properties
|
26
|
+
libraries.tk.name=Tk
|
27
|
+
libraries.tk.source=ext/ae-rad/lib/tk/al-tk.rb
|
28
|
+
#libraries.tk.collection.class=AWClassesTk
|
29
|
+
libraries.tk.collection.class=ArcadiaLibTk
|
30
|
+
libraries.tk.action=
|
31
|
+
libraries.tk.require=tk
|
32
|
+
|
33
|
+
# tk BWidget library properties
|
34
|
+
libraries.tkBWidget.name=Tk BWidget
|
35
|
+
libraries.tkBWidget.source=ext/ae-rad/lib/tkext/al-bwidget.rb
|
36
|
+
libraries.tkBWidget.collection.class=ArcadiaLibBWidget
|
37
|
+
libraries.tkBWidget.action=
|
38
|
+
libraries.tkBWidget.require=tk
|
39
|
+
|
40
|
+
# tk Tile library properties
|
41
|
+
libraries.tkTile.name=Tk Tile
|
42
|
+
libraries.tkTile.source=ext/ae-rad/lib/tkext/al-tile.rb
|
43
|
+
libraries.tkTile.collection.class=ArcadiaLibTkTile
|
44
|
+
libraries.tkTile.action=
|
45
|
+
libraries.tkTile.require=tk
|
46
|
+
|
47
|
+
|
48
|
+
# tk IWidget library properties
|
49
|
+
libraries.tkIWidget.name=Tk IWidget
|
50
|
+
libraries.tkIWidget.source=ext/ae-rad/lib/tkext/al-iwidgets.rb
|
51
|
+
libraries.tkIWidget.collection.class=AWClassesTkIWidget
|
52
|
+
libraries.tkIWidget.action=
|
53
|
+
libraries.tkIWidget.require=tk
|
54
|
+
|
55
|
+
|
56
|
+
# tk Custom library properties
|
57
|
+
libraries.tkCustom.name=Tk Custom
|
58
|
+
libraries.tkCustom.source=ext/ae-rad/lib/tk/al-tkcustom.rb
|
59
|
+
libraries.tkCustom.collection.class=ArcadiaLibTkCustom
|
60
|
+
libraries.tkCustom.action=
|
61
|
+
libraries.tkCustom.require=tk
|
62
|
+
|
63
|
+
# tk Arcadia library properties
|
64
|
+
libraries.tkArcadia.name=Tk Arcadia
|
65
|
+
libraries.tkArcadia.source=ext/ae-rad/lib/tk/al-tkarcadia.rb
|
66
|
+
libraries.tkArcadia.collection.class=ArcadiaLibArcadiaTk
|
67
|
+
libraries.tkArcadia.action=
|
68
|
+
libraries.tkArcadia.require=tk
|
69
|
+
|
70
|
+
|
71
|
+
#:::::::::::::::: Libraries group ::::::::::::::::::::::<end>
|
@@ -0,0 +1,56 @@
|
|
1
|
+
#
|
2
|
+
# ae-rad.rb - Arcadia Ruby ide
|
3
|
+
# by Antonio Galeone <antonio-galeone@rubyforge.org>
|
4
|
+
#
|
5
|
+
|
6
|
+
require 'ext/ae-rad/ae-rad-libs'
|
7
|
+
require 'ext/ae-rad/ae-rad-palette'
|
8
|
+
require 'ext/ae-rad/ae-rad-inspector'
|
9
|
+
|
10
|
+
class Rad < ArcadiaExt
|
11
|
+
attr_reader :libs
|
12
|
+
attr_reader :palette
|
13
|
+
attr_reader :inspector
|
14
|
+
def on_build(_event)
|
15
|
+
load_libs
|
16
|
+
end
|
17
|
+
|
18
|
+
def show_rad
|
19
|
+
if @palette.nil?
|
20
|
+
@palette = Palette.new(self)
|
21
|
+
@inspector = ObjiController.new(self)
|
22
|
+
else
|
23
|
+
float_frame(0).show
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def load_libs
|
28
|
+
@libs = ArcadiaLibs.new(self)
|
29
|
+
libs = conf('libraries').split(',')
|
30
|
+
libs.each{|lib|
|
31
|
+
if lib
|
32
|
+
begin
|
33
|
+
require conf('libraries.'+lib+'.source')
|
34
|
+
@libs.add_lib(
|
35
|
+
ArcadiaLibs::ArcadiaLibParams.new(
|
36
|
+
conf('libraries.'+lib+'.name'),
|
37
|
+
conf('libraries.'+lib+'.source'),
|
38
|
+
conf('libraries.'+lib+'.require'),
|
39
|
+
eval(conf('libraries.'+lib+'.collection.class')))
|
40
|
+
)
|
41
|
+
rescue Exception
|
42
|
+
msg = "Loading lib "+'"'+lib+'"'+" ("+$!.class.to_s+") "+" : "+$! + " at : "+$@.to_s
|
43
|
+
if Tk.messageBox('icon' => 'error', 'type' => 'okcancel',
|
44
|
+
'title' => '(Rad) Libs',
|
45
|
+
'message' => msg) == 'cancel'
|
46
|
+
raise
|
47
|
+
exit
|
48
|
+
else
|
49
|
+
Tk.update
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
@@ -4,9 +4,9 @@
|
|
4
4
|
#
|
5
5
|
|
6
6
|
require 'tk'
|
7
|
-
require '
|
8
|
-
require "base/a-
|
9
|
-
require "lib/tk/al-tk.res"
|
7
|
+
require 'ext/ae-rad/ae-rad-libs'
|
8
|
+
require "base/a-tkcommons"
|
9
|
+
require "ext/ae-rad/lib/tk/al-tk.res"
|
10
10
|
|
11
11
|
TkAllPhotoImage = TkPhotoImage
|
12
12
|
|
@@ -1429,112 +1429,6 @@ class ParsifalTk
|
|
1429
1429
|
|
1430
1430
|
end
|
1431
1431
|
|
1432
|
-
class AGTkObjPlace
|
1433
|
-
attr_reader :obj, :r, :start_x, :start_y, :motion, :x0, :y0, :w0, :h0, :width,:height,:relwidth,:relheight
|
1434
|
-
attr_writer :r, :start_x, :start_y, :motion,:width,:height,:relwidth,:relheight
|
1435
|
-
|
1436
|
-
def initialize(_obj=nil , _side='both' , _cursor=nil, _bind = true )
|
1437
|
-
if !_obj
|
1438
|
-
break
|
1439
|
-
end
|
1440
|
-
@obj = _obj
|
1441
|
-
if !_cursor
|
1442
|
-
case _side
|
1443
|
-
when 'x'
|
1444
|
-
_cursor = 'sb_h_double_arrow'
|
1445
|
-
when 'y'
|
1446
|
-
_cursor = 'sb_v_double_arrow'
|
1447
|
-
when 'both'
|
1448
|
-
_cursor = 'draft_small'
|
1449
|
-
end
|
1450
|
-
end
|
1451
|
-
@motion = false
|
1452
|
-
@side = _side
|
1453
|
-
@x0 = TkPlace.info(@obj)['x']
|
1454
|
-
@y0 = TkPlace.info(@obj)['y']
|
1455
|
-
if TkWinfo.mapped?(@obj)
|
1456
|
-
@w0=TkWinfo.width(@obj)
|
1457
|
-
@h0=TkWinfo.height(@obj)
|
1458
|
-
else
|
1459
|
-
@w0=TkWinfo.reqwidth(@obj)
|
1460
|
-
@h0=TkWinfo.reqheight(@obj)
|
1461
|
-
end
|
1462
|
-
@start_x = @x0
|
1463
|
-
@start_y = @y0
|
1464
|
-
@cursor = _cursor
|
1465
|
-
if _bind
|
1466
|
-
@obj.bind_append("Enter", proc{|x, y| do_enter(x, y)}, "%x %y")
|
1467
|
-
@obj.bind_append("ButtonPress-1", proc{|e| do_press(e.x, e.y)})
|
1468
|
-
@obj.bind_append("B1-Motion", proc{|x, y| do_motion(x,y)},"%x %y")
|
1469
|
-
end
|
1470
|
-
end
|
1471
|
-
|
1472
|
-
def w
|
1473
|
-
if TkWinfo.mapped?(@obj)
|
1474
|
-
@w0= TkWinfo.width(@obj)
|
1475
|
-
else
|
1476
|
-
@w0= TkWinfo.reqwidth(@obj)
|
1477
|
-
end
|
1478
|
-
end
|
1479
|
-
|
1480
|
-
def h
|
1481
|
-
if TkWinfo.mapped?(@obj)
|
1482
|
-
@h0= TkWinfo.height(@obj)
|
1483
|
-
else
|
1484
|
-
@h0= TkWinfo.reqheight(@obj)
|
1485
|
-
end
|
1486
|
-
end
|
1487
|
-
|
1488
|
-
def do_enter(x, y)
|
1489
|
-
@oldcursor = @obj.cget('cursor')
|
1490
|
-
@obj.configure('cursor'=> @cursor)
|
1491
|
-
end
|
1492
|
-
|
1493
|
-
def do_leave
|
1494
|
-
@obj.configure('cursor'=>@oldcursor)
|
1495
|
-
end
|
1496
|
-
|
1497
|
-
def do_press(x, y)
|
1498
|
-
@start_x = x
|
1499
|
-
@start_y = y
|
1500
|
-
end
|
1501
|
-
|
1502
|
-
def do_motion( _x, _y)
|
1503
|
-
@motion = true
|
1504
|
-
move(_x - @start_x, _y - @start_y)
|
1505
|
-
end
|
1506
|
-
|
1507
|
-
def move(_x,_y)
|
1508
|
-
case @side
|
1509
|
-
when 'both'
|
1510
|
-
@x0 = @x0 + _x if (@x0 + _x) >= 0
|
1511
|
-
@y0 = @y0 + _y
|
1512
|
-
@obj.place('x' => @x0, 'y' => @y0, 'width' => @width, 'height'=>@height, 'relwidth'=>@relwidth, 'relheight'=>@relheight)
|
1513
|
-
when 'x'
|
1514
|
-
@x0 = @x0 + _x if (@x0 + _x) >= 0
|
1515
|
-
@obj.place('x' => @x0, 'width' => @width, 'height'=>@height, 'relwidth'=>@relwidth, 'relheight'=>@relheight)
|
1516
|
-
when 'y'
|
1517
|
-
@y0 = @y0 + _y
|
1518
|
-
@obj.place('y' => @y0, 'width' => @width, 'height'=>@height, 'relwidth'=>@relwidth, 'relheight'=>@relheight)
|
1519
|
-
end
|
1520
|
-
end
|
1521
|
-
|
1522
|
-
def amove(_x,_y)
|
1523
|
-
move(_x - @x0 , _y - @y0)
|
1524
|
-
end
|
1525
|
-
|
1526
|
-
def go(_w, _h)
|
1527
|
-
case @side
|
1528
|
-
when 'x'
|
1529
|
-
@w0 = _w
|
1530
|
-
@obj.place('width' => @w0, 'height'=>@height, 'relwidth'=>@relwidth, 'relheight'=>@relheight)
|
1531
|
-
when 'y'
|
1532
|
-
@h0 = _h
|
1533
|
-
@obj.place('height' => @h0, 'width' => @width, 'relwidth'=>@relwidth, 'relheight'=>@relheight)
|
1534
|
-
end
|
1535
|
-
end
|
1536
|
-
|
1537
|
-
end
|
1538
1432
|
|
1539
1433
|
class AGTkFramePlaceManager
|
1540
1434
|
attr_reader :main_frame
|
@@ -2478,7 +2372,24 @@ class AGTkToplevel < AGTkContainer
|
|
2478
2372
|
def form2code
|
2479
2373
|
_title = @i_name+'.rb'
|
2480
2374
|
_text = @renderer.class_code.to_s
|
2481
|
-
|
2375
|
+
Arcadia.process_event(OpenBufferEvent.new(self,'title'=>_title, 'text'=>_text))
|
2376
|
+
meditor = $arcadia['editor']
|
2377
|
+
if meditor
|
2378
|
+
_editor = meditor.raised
|
2379
|
+
code2form = proc{
|
2380
|
+
Revparsel.new(_editor.text_value)
|
2381
|
+
meditor.close_editor(_editor, false)
|
2382
|
+
InspectorContract.instance.raise_last_widget(meditor)
|
2383
|
+
}
|
2384
|
+
_editor.insert_popup_menu_item('end',
|
2385
|
+
:command,
|
2386
|
+
:label=>'View as form',
|
2387
|
+
:hidemargin => false,
|
2388
|
+
:command=> code2form
|
2389
|
+
)
|
2390
|
+
end
|
2391
|
+
|
2392
|
+
#EditorContract.instance.open_text(self, 'title'=>_title, 'text'=>_text)
|
2482
2393
|
self.delete
|
2483
2394
|
end
|
2484
2395
|
|