arcadia 0.12.2 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +25 -14
- data/conf/LC/en-UK.LANG +3 -1
- data/conf/arcadia.conf +10 -0
- data/conf/arcadia.res.rb +29 -1
- data/ext/ae-editor/ae-editor.rb +239 -48
- data/ext/ae-file-history/ae-file-history.conf +11 -1
- data/ext/ae-file-history/ae-file-history.rb +120 -2
- data/ext/ae-ruby-debug/ae-ruby-debug.rb +6 -5
- data/ext/ae-subprocess-inspector/ae-subprocess-inspector.rb +7 -3
- data/ext/ae-term/ae-term.rb +1 -1
- data/lib/a-commons.rb +72 -56
- data/lib/a-contracts.rb +23 -1
- data/lib/a-core.rb +136 -41
- data/lib/a-tkcommons.rb +127 -36
- data/tcl/fsdialog/fsdialog.tcl +2 -2
- data/tcl/ptwidgets-1.1.0/COPYRIGHT +10 -0
- data/tcl/ptwidgets-1.1.0/ChangeLog +194 -0
- data/tcl/ptwidgets-1.1.0/README +50 -0
- data/tcl/ptwidgets-1.1.0/common/stacktrace.tcl +29 -0
- data/tcl/ptwidgets-1.1.0/common/tokenframe.tcl +200 -0
- data/tcl/ptwidgets-1.1.0/doc/img/toggleswitch_off.png +0 -0
- data/tcl/ptwidgets-1.1.0/doc/img/toggleswitch_on.png +0 -0
- data/tcl/ptwidgets-1.1.0/doc/img/tokenentry.png +0 -0
- data/tcl/ptwidgets-1.1.0/doc/img/tokensearch_popup_example.png +0 -0
- data/tcl/ptwidgets-1.1.0/doc/img/tokensearch_popup_example2.png +0 -0
- data/tcl/ptwidgets-1.1.0/doc/img/wmarkentry.png +0 -0
- data/tcl/ptwidgets-1.1.0/doc/toggleswitch.html +402 -0
- data/tcl/ptwidgets-1.1.0/doc/tokenentry.html +1366 -0
- data/tcl/ptwidgets-1.1.0/doc/tokensearch.html +1549 -0
- data/tcl/ptwidgets-1.1.0/doc/wmarkentry.html +634 -0
- data/tcl/ptwidgets-1.1.0/library/toggleswitch.tcl +432 -0
- data/tcl/ptwidgets-1.1.0/library/tokenentry.tcl +2208 -0
- data/tcl/ptwidgets-1.1.0/library/tokensearch.tcl +2488 -0
- data/tcl/ptwidgets-1.1.0/library/wmarkentry.tcl +630 -0
- data/tcl/ptwidgets-1.1.0/pkgIndex.tcl +10 -0
- data/tcl/ptwidgets-1.1.0/test/Makefile +3 -0
- data/tcl/ptwidgets-1.1.0/test/run.tcl +3 -0
- data/tcl/ptwidgets-1.1.0/test/test.tcl +89 -0
- data/tcl/ptwidgets-1.1.0/test/toggleswitch.test +562 -0
- data/tcl/ptwidgets-1.1.0/test/tokenentry.test +1023 -0
- data/tcl/ptwidgets-1.1.0/test/tokensearch.test +1023 -0
- data/tcl/ptwidgets-1.1.0/test/wmarkentry.test +1325 -0
- data/tcl/themes/altTheme.tcl +101 -0
- data/tcl/themes/aquaTheme.tcl +59 -0
- data/tcl/themes/clamTheme.tcl +140 -0
- data/tcl/themes/classicTheme.tcl +108 -0
- data/tcl/themes/pkgIndex.tcl +3 -0
- data/tcl/themes/ttk.tcl +176 -0
- data/tcl/themes/vistaTheme.tcl +224 -0
- data/tcl/themes/winTheme.tcl +80 -0
- data/tcl/themes/xpTheme.tcl +65 -0
- data/tcl/tkfbox/folder.gif +0 -0
- data/tcl/tkfbox/textfile.gif +0 -0
- data/tcl/tkfbox/tkfbox.tcl +1 -0
- data/tcl/tkfbox/tkfbox.tcl~ +1 -0
- data/tcl/tkfbox/updir.xbm +1 -0
- metadata +43 -2
@@ -8,4 +8,14 @@ class=FilesHistrory
|
|
8
8
|
|
9
9
|
file.name=arcadia.history
|
10
10
|
length=20
|
11
|
-
view=tree
|
11
|
+
view=tree
|
12
|
+
|
13
|
+
bookmarks.range=10
|
14
|
+
|
15
|
+
user_toolbar.contexts=bookmarks
|
16
|
+
user_toolbar.bookmarks.context_path=file
|
17
|
+
user_toolbar.bookmarks=bm
|
18
|
+
user_toolbar.bookmarks.bm.name=togglebm
|
19
|
+
user_toolbar.bookmarks.bm.hint=!Arcadia.text('ext.file_history.toggle_bookmark')
|
20
|
+
user_toolbar.bookmarks.bm.image_data=!BOOKMARK_GIF
|
21
|
+
user_toolbar.bookmarks.bm.event_class=!ToggleBookmarkEvent
|
@@ -86,12 +86,16 @@ class FilesHistrory < ArcadiaExt
|
|
86
86
|
end
|
87
87
|
|
88
88
|
def on_before_build(_event)
|
89
|
+
@bookmarks =Array.new
|
89
90
|
Arcadia.attach_listener(self, BufferRaisedEvent)
|
91
|
+
Arcadia.attach_listener(self, BookmarkEvent)
|
90
92
|
end
|
91
93
|
|
92
94
|
def on_build(_event)
|
93
95
|
@h_stack = Hash.new
|
94
96
|
@h_stack_changed = false
|
97
|
+
@bookmarks_frame = TkFrame.new(self.frame.hinner_frame)
|
98
|
+
@history_frame = TkFrame.new(self.frame.hinner_frame).pack('fill'=>'both', :padx=>0, :pady=>0, :expand => 'yes')
|
95
99
|
@panel = self.frame.root.add_panel(self.frame.name, "sync");
|
96
100
|
@cb_sync = TkCheckButton.new(@panel, Arcadia.style('checkbox').update('background'=>@panel.background)){
|
97
101
|
text 'Sync'
|
@@ -152,7 +156,7 @@ class FilesHistrory < ArcadiaExt
|
|
152
156
|
@font_b = "#{Arcadia.conf('treeitem.font')} bold"
|
153
157
|
@font_italic = "#{Arcadia.conf('treeitem.font')} italic"
|
154
158
|
|
155
|
-
@htree = BWidgetTreePatched.new(
|
159
|
+
@htree = BWidgetTreePatched.new(@history_frame, Arcadia.style('treepanel')){
|
156
160
|
showlines false
|
157
161
|
deltay 18
|
158
162
|
crosscloseimage Arcadia.image_res(PLUS_GIF)
|
@@ -190,7 +194,7 @@ class FilesHistrory < ArcadiaExt
|
|
190
194
|
build_tree
|
191
195
|
pop_up_menu_tree
|
192
196
|
|
193
|
-
@hlist = TkText.new(
|
197
|
+
@hlist = TkText.new(@history_frame, Arcadia.style('text')){|j|
|
194
198
|
wrap 'none'
|
195
199
|
font @font_italic
|
196
200
|
cursor nil
|
@@ -206,7 +210,93 @@ class FilesHistrory < ArcadiaExt
|
|
206
210
|
@hlist.show
|
207
211
|
end
|
208
212
|
end
|
213
|
+
|
214
|
+
def on_initialize(_event)
|
215
|
+
load_persistent_bookmarks
|
216
|
+
end
|
217
|
+
|
218
|
+
|
219
|
+
def on_bookmark(_event)
|
220
|
+
return if _event.file.nil?
|
221
|
+
case _event
|
222
|
+
when ToggleBookmarkEvent
|
223
|
+
self.frame.show_anyway
|
224
|
+
# set or unset ?
|
225
|
+
to_set = true
|
226
|
+
to_del_detail = nil
|
227
|
+
@bookmarks.each{|detail|
|
228
|
+
if detail[:file] == _event.file && (_event.from_row.to_i >= detail[:from_line].to_i - _event.range) && (_event.to_row.to_i <= detail[:to_line].to_i + _event.range)
|
229
|
+
to_set = false
|
230
|
+
to_del_detail = detail
|
231
|
+
end
|
232
|
+
break if !to_set
|
233
|
+
}
|
234
|
+
if to_set
|
235
|
+
SetBookmarkEvent.new(self,
|
236
|
+
'file'=>_event.file,
|
237
|
+
'from_row'=>_event.from_row,
|
238
|
+
'to_row'=>_event.to_row,
|
239
|
+
'range'=>_event.range,
|
240
|
+
'persistent'=>_event.persistent,
|
241
|
+
'id'=>_event.id).go!
|
242
|
+
else
|
243
|
+
UnsetBookmarkEvent.new(self,
|
244
|
+
'file'=>_event.file,
|
245
|
+
'from_row'=>to_del_detail[:from_line],
|
246
|
+
'to_row'=>to_del_detail[:to_line],
|
247
|
+
'range'=>_event.range,
|
248
|
+
'persistent'=>_event.persistent,
|
249
|
+
'id'=>_event.id).go!
|
250
|
+
end
|
251
|
+
when SetBookmarkEvent
|
252
|
+
@bookmarks_frame.pack('before'=>@history_frame,'side' =>'top','anchor'=>'nw', 'fill'=>'x', :padx=>0, :pady=>0) if @bookmarks.empty?
|
253
|
+
if _event.persistent
|
254
|
+
bookmark = {:file=>_event.file}
|
255
|
+
caption = File.basename(_event.file)
|
256
|
+
else
|
257
|
+
bookmark = {:file=>"__TMP__#{_event.id}"}
|
258
|
+
caption = _event.id
|
259
|
+
end
|
260
|
+
caption = "#{caption} [#{_event.from_row}, #{_event.to_row}]"
|
261
|
+
bookmark[:from_line] = _event.from_row
|
262
|
+
bookmark[:to_line] = _event.to_row
|
263
|
+
bookmark[:persistent] = _event.persistent
|
264
|
+
bookmark[:widget] = Tk::BWidget::Button.new(@bookmarks_frame, Arcadia.style('toolbarbutton')){
|
265
|
+
image Arcadia.image_res(BOOKMARK_GIF)
|
266
|
+
compound 'left'
|
267
|
+
anchor "w"
|
268
|
+
command proc{OpenBufferTransientEvent.new(self,'file'=>_event.file, 'row'=> _event.from_row).go!}
|
269
|
+
#width 20
|
270
|
+
#height 20
|
271
|
+
helptext _event.content
|
272
|
+
text caption
|
273
|
+
}.pack('side' =>'top','anchor'=>'nw', 'fill'=>'x', :padx=>0, :pady=>0)
|
274
|
+
|
275
|
+
Tk::BWidget::Button.new(bookmark[:widget], Arcadia.style('toolbarbutton')){
|
276
|
+
image TkPhotoImage.new('dat' => CLOSE_GIF)
|
277
|
+
command proc{UnsetBookmarkEvent.new(self,
|
278
|
+
'file'=>_event.file,
|
279
|
+
'from_row'=>_event.from_row,
|
280
|
+
'to_row'=>_event.to_row).go!}
|
281
|
+
#width 20
|
282
|
+
height 16
|
283
|
+
}.pack('side' =>'right','anchor'=>'e', 'fill'=>'y', :padx=>0, :pady=>0)
|
284
|
+
|
285
|
+
@bookmarks << bookmark
|
286
|
+
when UnsetBookmarkEvent
|
287
|
+
@bookmarks.delete_if{|b|
|
288
|
+
if (b[:file]==_event.file && b[:from_line]==_event.from_row)
|
289
|
+
b[:widget].destroy
|
290
|
+
true
|
291
|
+
else
|
292
|
+
false
|
293
|
+
end
|
294
|
+
}
|
295
|
+
@bookmarks_frame.unpack if @bookmarks.empty?
|
296
|
+
end
|
209
297
|
|
298
|
+
end
|
299
|
+
|
210
300
|
def toggle_list_tree
|
211
301
|
Tk::BWidget::DynamicHelp::delete(@btoggle_list_tree)
|
212
302
|
if @is_tree
|
@@ -433,6 +523,8 @@ class FilesHistrory < ArcadiaExt
|
|
433
523
|
@hlist.tag_configure(tag_name, 'underline'=>false)
|
434
524
|
}
|
435
525
|
)
|
526
|
+
TkTextImage.new(@hlist, 'end', 'image'=> Arcadia.file_icon(_file))
|
527
|
+
@hlist.insert("end", " ")
|
436
528
|
@hlist.insert("end", "#{File.basename(_file)}\n", tag_name)
|
437
529
|
@hlist.tag_bind(tag_name,"ButtonPress-1", proc{OpenBufferTransientEvent.new(self,'file'=>_file).go!})
|
438
530
|
end
|
@@ -614,6 +706,14 @@ class FilesHistrory < ArcadiaExt
|
|
614
706
|
end
|
615
707
|
|
616
708
|
def on_finalize(_event)
|
709
|
+
bookmarks = '';
|
710
|
+
@bookmarks.each{|bm|
|
711
|
+
if bm[:file] != nil && bm[:persistent]
|
712
|
+
bookmarks="#{bookmarks}|" if bookmarks.strip.length > 0
|
713
|
+
bookmarks="#{bookmarks}#{bm[:file]}@@@#{bm[:from_line]}@@@#{bm[:to_line]}"
|
714
|
+
end
|
715
|
+
}
|
716
|
+
Arcadia.persistent('bookmarks', bookmarks)
|
617
717
|
if @is_tree
|
618
718
|
conf('view','tree')
|
619
719
|
else
|
@@ -648,6 +748,24 @@ class FilesHistrory < ArcadiaExt
|
|
648
748
|
end
|
649
749
|
end
|
650
750
|
|
751
|
+
def load_persistent_bookmarks
|
752
|
+
b = Arcadia.persistent('bookmarks')
|
753
|
+
if b
|
754
|
+
bm_list =b.split("|")
|
755
|
+
bm_list.each do |bm|
|
756
|
+
file,from_line,to_line = bm.split('@@@')
|
757
|
+
if file && from_line && to_line
|
758
|
+
SetBookmarkEvent.new(self,
|
759
|
+
'file'=>file,
|
760
|
+
'from_row'=>from_line.to_i,
|
761
|
+
'to_row'=>to_line.to_i,
|
762
|
+
'persistent'=>true).go!
|
763
|
+
end
|
764
|
+
end
|
765
|
+
end
|
766
|
+
end
|
767
|
+
|
768
|
+
|
651
769
|
def create_history_file(_content=nil)
|
652
770
|
dir,fil =File.split(File.expand_path(history_file))
|
653
771
|
if !File.exist?(dir)
|
@@ -833,20 +833,19 @@ class RubyDebugServer
|
|
833
833
|
set_alive(false)
|
834
834
|
notify(RDS_QUIET)
|
835
835
|
Kernel.system('y')
|
836
|
-
|
837
836
|
if _debug_event.persistent == false && File.basename(_debug_event.file)[0..1] == '~~'
|
838
837
|
File.delete(_debug_event.file) if File.exist?(_debug_event.file)
|
839
838
|
end
|
840
|
-
|
841
839
|
Kernel.exit!
|
842
840
|
else
|
841
|
+
set_alive(false)
|
842
|
+
notify(RDS_QUIET)
|
843
843
|
Kernel.exit!
|
844
|
-
Arcadia.console(self, 'msg'=>"#{
|
844
|
+
Arcadia.console(self, 'msg'=>"#{$!.inspect}", 'level'=>'debug')
|
845
845
|
end
|
846
846
|
end
|
847
847
|
end
|
848
848
|
rescue Exception => e
|
849
|
-
|
850
849
|
Arcadia.console(self, 'msg'=>Arcadia.text('ext.ruby_debug.server.e.on_start', [e.class, e.message]), 'level'=>'debug')
|
851
850
|
#Arcadia.new_debug_msg(self,"Error on start_server : #{e.class}:#{e.message}")
|
852
851
|
end
|
@@ -1012,6 +1011,7 @@ class RubyDebugClient
|
|
1012
1011
|
begin
|
1013
1012
|
#sleep(2)
|
1014
1013
|
@session = TCPSocket.new(@server, @port)
|
1014
|
+
#@session = IO.popen("|rdebug -c --cport #{@port}",'r+')
|
1015
1015
|
@pend = false
|
1016
1016
|
rescue Errno::ECONNREFUSED,Errno::EBADF => e
|
1017
1017
|
sleep(1)
|
@@ -1078,6 +1078,7 @@ class RubyDebugClient
|
|
1078
1078
|
return false if @busy
|
1079
1079
|
if is_alive?
|
1080
1080
|
@busy = true
|
1081
|
+
#p "sending #{_command}"
|
1081
1082
|
@session.puts(_command) if socket_session
|
1082
1083
|
else
|
1083
1084
|
start_session if !@pend
|
@@ -1087,7 +1088,7 @@ class RubyDebugClient
|
|
1087
1088
|
rescue Errno::ECONNABORTED,Errno::ECONNRESET, Errno::EPIPE => e
|
1088
1089
|
notify("quit_yes")
|
1089
1090
|
#DebugContract.instance.debug_end(self)
|
1090
|
-
Arcadia.console(self, 'msg'=>Arcadia.text('ext.ruby_debug.client.e.abort_session', [e.class, e.inspect]), 'level'=>'debug')
|
1091
|
+
Arcadia.console(self, 'msg'=>Arcadia.text('ext.ruby_debug.client.e.abort_session', [_command, e.class, e.inspect]), 'level'=>'debug')
|
1091
1092
|
@session = nil
|
1092
1093
|
@pend = true
|
1093
1094
|
false
|
@@ -54,11 +54,10 @@ end
|
|
54
54
|
class SubProcessWidget < Tk::BWidget::Button
|
55
55
|
attr_reader :event
|
56
56
|
def initialize(_parent=nil, _event=nil, *args)
|
57
|
-
super(Arcadia['toolbar'].frame, Arcadia.style('button').update("background"=>'black',"activebackground"=>'black', 'relief'=>'groove'))
|
57
|
+
super(Arcadia['toolbar'].frame, Arcadia.style('button').update("compound"=>'left', "background"=>'black',"activebackground"=>'black', 'relief'=>'groove'))
|
58
58
|
@parent = _parent
|
59
59
|
@event = _event
|
60
60
|
b_command = proc{
|
61
|
-
|
62
61
|
message = Arcadia.text('ext.spi.d.kill.msg', [_event.pid, _event.name])
|
63
62
|
r=Arcadia.dialog(self,
|
64
63
|
'type'=>'yes_no',
|
@@ -69,7 +68,12 @@ class SubProcessWidget < Tk::BWidget::Button
|
|
69
68
|
_event.abort_action.call
|
70
69
|
end
|
71
70
|
}
|
72
|
-
command b_command
|
71
|
+
command b_command
|
72
|
+
begin
|
73
|
+
text File.basename(_event.name)
|
74
|
+
rescue
|
75
|
+
text _event.name
|
76
|
+
end
|
73
77
|
helptext "#{_event.name} [pid #{_event.pid}]"
|
74
78
|
pack('side' =>'left', :padx=>2, :pady=>0)
|
75
79
|
Tk::Anigif.image(self, "#{Dir.pwd}/ext/ae-subprocess-inspector/process.res")
|
data/ext/ae-term/ae-term.rb
CHANGED
data/lib/a-commons.rb
CHANGED
@@ -215,15 +215,15 @@ class ArcadiaExt
|
|
215
215
|
attr_reader :name
|
216
216
|
def initialize(_arcadia, _name=nil)
|
217
217
|
@arcadia = _arcadia
|
218
|
-
@arcadia.register(self)
|
219
218
|
@name = _name
|
219
|
+
@arcadia.register(self)
|
220
220
|
@frames = Array.new
|
221
|
-
@frames_points = conf_array("
|
222
|
-
@frames_labels = conf_array("
|
223
|
-
@frames_names = conf_array("
|
221
|
+
@frames_points = conf_array("frames")
|
222
|
+
@frames_labels = conf_array("frames.labels")
|
223
|
+
@frames_names = conf_array("frames.names")
|
224
224
|
@float_frames = Array.new
|
225
|
-
@float_geometries = conf_array("
|
226
|
-
@float_labels = conf_array("
|
225
|
+
@float_geometries = conf_array("float_frames")
|
226
|
+
@float_labels = conf_array("float_labels")
|
227
227
|
Arcadia.attach_listener(self, BuildEvent)
|
228
228
|
Arcadia.attach_listener(self, InitializeEvent)
|
229
229
|
Arcadia.attach_listener(self, ExitQueryEvent)
|
@@ -236,23 +236,25 @@ class ArcadiaExt
|
|
236
236
|
end
|
237
237
|
|
238
238
|
def conf_array(_name)
|
239
|
-
res = []
|
240
|
-
value = @arcadia['conf'][_name]
|
241
|
-
res.concat(value.split(',')) if value
|
242
|
-
res
|
239
|
+
# res = []
|
240
|
+
# value = @arcadia['conf'][_name]
|
241
|
+
# res.concat(value.split(',')) if value
|
242
|
+
# res
|
243
|
+
Application.conf_array("#{@name}.#{_name}")
|
243
244
|
end
|
244
245
|
|
245
246
|
def array_conf(_name, _array)
|
246
|
-
value = ''
|
247
|
-
_array.each{|e|
|
248
|
-
if value.length > 0
|
249
|
-
value = "#{value},#{e}"
|
250
|
-
else
|
251
|
-
value = "#{e}"
|
252
|
-
end
|
253
|
-
}
|
254
|
-
@arcadia['conf'][_name]=value
|
255
|
-
value
|
247
|
+
# value = ''
|
248
|
+
# _array.each{|e|
|
249
|
+
# if value.length > 0
|
250
|
+
# value = "#{value},#{e}"
|
251
|
+
# else
|
252
|
+
# value = "#{e}"
|
253
|
+
# end
|
254
|
+
# }
|
255
|
+
# @arcadia['conf'][_name]=value
|
256
|
+
# value
|
257
|
+
Application.array_conf("#{@name}.#{_name}", _array)
|
256
258
|
end
|
257
259
|
|
258
260
|
def add_to_conf_property(_name, _value)
|
@@ -269,6 +271,10 @@ class ArcadiaExt
|
|
269
271
|
array_conf(_name,a)
|
270
272
|
end
|
271
273
|
|
274
|
+
def frame_title(_n=0)
|
275
|
+
@frames_labels[_n] if @frames[_n] != nil
|
276
|
+
end
|
277
|
+
|
272
278
|
def frame_def_visible?(_n=0)
|
273
279
|
@arcadia.layout.domains.include?(@frames_points[_n])
|
274
280
|
#@frames_points[_n] != '-1.-1'
|
@@ -398,26 +404,6 @@ class ArcadiaExtPlus < ArcadiaExt
|
|
398
404
|
Arcadia.attach_listener(self, ActivateInstanceEvent)
|
399
405
|
super(_arcadia, _name)
|
400
406
|
@@active_instance[self.class] = self if @@active_instance[self.class] == nil
|
401
|
-
# if self.frame != nil
|
402
|
-
# self.frame.hinner_frame.bind_append("Enter", proc{activate})
|
403
|
-
# if @@main_instance[self.class] == self
|
404
|
-
# frame.root.add_state_button(
|
405
|
-
# self.name,
|
406
|
-
# 'Duplicate',
|
407
|
-
# proc{duplicate},
|
408
|
-
# PLUS_EX_GIF,
|
409
|
-
# 'left')
|
410
|
-
# activate(self, false)
|
411
|
-
# else
|
412
|
-
# frame.root.add_state_button(
|
413
|
-
# self.name,
|
414
|
-
# 'Destroy',
|
415
|
-
# proc{deduplicate},
|
416
|
-
# MINUS_EX_GIF,
|
417
|
-
# 'left')
|
418
|
-
# activate(self, false)
|
419
|
-
# end
|
420
|
-
# end
|
421
407
|
end
|
422
408
|
|
423
409
|
def frame(_n=0,create_if_not_exist=true)
|
@@ -426,13 +412,13 @@ class ArcadiaExtPlus < ArcadiaExt
|
|
426
412
|
@frame_initialize = true
|
427
413
|
fr.hinner_frame.bind_append("Enter", proc{activate})
|
428
414
|
if main_instance?
|
429
|
-
fr.root.add_state_button(
|
430
|
-
self.name,
|
431
|
-
'Duplicate',
|
432
|
-
proc{duplicate},
|
433
|
-
PLUS_EX_GIF,
|
434
|
-
'left')
|
435
|
-
activate(self, false)
|
415
|
+
# fr.root.add_state_button(
|
416
|
+
# self.name,
|
417
|
+
# 'Duplicate',
|
418
|
+
# proc{duplicate},
|
419
|
+
# PLUS_EX_GIF,
|
420
|
+
# 'left')
|
421
|
+
# activate(self, false)
|
436
422
|
else
|
437
423
|
fr.root.add_state_button(
|
438
424
|
self.name,
|
@@ -508,17 +494,25 @@ class ArcadiaExtPlus < ArcadiaExt
|
|
508
494
|
exist
|
509
495
|
end
|
510
496
|
|
511
|
-
def duplicate(_name=
|
497
|
+
def duplicate(_name=nil, _dom=nil, _confirm_on_exit=true)
|
498
|
+
_name = new_name if _name.nil?
|
499
|
+
@confirm_on_exit = _confirm_on_exit
|
512
500
|
#create conf properties
|
513
501
|
Arcadia.conf_group_copy(@@main_instance[self.class].name, _name)
|
514
|
-
|
502
|
+
if !_dom.nil?
|
503
|
+
doms = Application.conf_array("#{_name}.frames")
|
504
|
+
doms[0] = _dom
|
505
|
+
Application.array_conf("#{_name}.frames", doms)
|
506
|
+
end
|
507
|
+
instance = clone(_name, _dom)
|
515
508
|
#initialize
|
516
509
|
Arcadia.process_event(InitializeEvent.new(Arcadia.instance), [instance])
|
517
|
-
add_to_conf_property("#{main_instance.name}.clones", _name)
|
510
|
+
#add_to_conf_property("#{main_instance.name}.clones", _name)
|
511
|
+
main_instance.add_to_conf_property("clones", _name)
|
518
512
|
instance
|
519
513
|
end
|
520
514
|
|
521
|
-
def clone(_name)
|
515
|
+
def clone(_name, _dom=nil)
|
522
516
|
#create
|
523
517
|
instance = self.class.new(Arcadia.instance, _name)
|
524
518
|
#build
|
@@ -545,21 +539,22 @@ class ArcadiaExtPlus < ArcadiaExt
|
|
545
539
|
@@instances[self.class].delete(self) if @@instances[self.class]
|
546
540
|
Arcadia.del_conf_group(Arcadia['conf'],@name)
|
547
541
|
Arcadia.del_conf_group(Arcadia['pers'],@name)
|
548
|
-
del_from_conf_property("#{main_instance.name}.clones", @name)
|
542
|
+
#del_from_conf_property("#{main_instance.name}.clones", @name)
|
543
|
+
main_instance.del_from_conf_property("clones", @name)
|
549
544
|
Arcadia.process_event(ClearCacheInstanceEvent.new(Arcadia.instance), [self])
|
550
545
|
Arcadia.process_event(DestroyInstanceEvent.new(Arcadia.instance), [self])
|
551
546
|
end
|
552
547
|
|
553
548
|
def deduplicate
|
554
|
-
|
549
|
+
can_exit=true
|
550
|
+
if @confirm_on_exit && (Arcadia.dialog(self, 'type'=>'yes_no',
|
555
551
|
'msg'=>Arcadia.text('main.d.confirm_delete_ext_instance.msg', [@name]),
|
556
552
|
'title' => Arcadia.text('main.d.confirm_delete_ext_instance.title', [@name]),
|
557
553
|
'level' => 'question')=='yes')
|
558
554
|
exit_query_event = Arcadia.process_event(ExitQueryEvent.new(self, 'can_exit'=>true))
|
559
|
-
|
560
|
-
clean_instance
|
561
|
-
end
|
555
|
+
can_exit = exit_query_event.can_exit
|
562
556
|
end
|
557
|
+
clean_instance if can_exit
|
563
558
|
end
|
564
559
|
|
565
560
|
end
|
@@ -1113,6 +1108,27 @@ class Application
|
|
1113
1108
|
def Application.del_conf(_k)
|
1114
1109
|
@@instance['conf'].delete(_k)
|
1115
1110
|
end
|
1111
|
+
|
1112
|
+
def Application.conf_array(_name)
|
1113
|
+
res = []
|
1114
|
+
value = @@instance['conf'][_name]
|
1115
|
+
res.concat(value.split(',')) if value
|
1116
|
+
res
|
1117
|
+
end
|
1118
|
+
|
1119
|
+
def Application.array_conf(_name, _array)
|
1120
|
+
value = ''
|
1121
|
+
_array.each{|e|
|
1122
|
+
if value.length > 0
|
1123
|
+
value = "#{value},#{e}"
|
1124
|
+
else
|
1125
|
+
value = "#{e}"
|
1126
|
+
end
|
1127
|
+
}
|
1128
|
+
@@instance['conf'][_name]=value
|
1129
|
+
value
|
1130
|
+
end
|
1131
|
+
|
1116
1132
|
|
1117
1133
|
def prepare
|
1118
1134
|
end
|