arcadia 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +126 -123
- data/arcadia.rb +770 -756
- data/base/a-contracts.rb +130 -93
- data/base/a-ext.rb +280 -280
- data/base/a-libs.rb +5 -11
- data/base/a-utils.rb +235 -44
- data/conf/arcadia.conf +20 -16
- data/conf/arcadia.init.rb +0 -0
- data/conf/arcadia.res.rb +74 -0
- data/ext/ae-complete-code/ae-complete-code.conf +0 -0
- data/ext/ae-complete-code/ae-complete-code.rb +80 -79
- data/ext/ae-debug/ae-debug.conf +0 -0
- data/ext/ae-debug/ae-debug.rb +2 -6
- data/ext/ae-debug/debug1.57.rb +0 -0
- data/ext/ae-doc-code/ae-doc-code.conf +15 -0
- data/ext/ae-doc-code/ae-doc-code.rb +289 -0
- data/ext/ae-editor/ae-editor.conf +17 -8
- data/ext/ae-editor/ae-editor.rb +738 -396
- data/ext/ae-event-log/ae-event-log.conf +0 -0
- data/ext/ae-event-log/ae-event-log.rb +0 -0
- data/ext/ae-file-history/ae-file-history.conf +2 -2
- data/ext/ae-file-history/ae-file-history.rb +286 -290
- data/ext/ae-inspector/ae-inspector.conf +0 -0
- data/ext/ae-inspector/ae-inspector.rb +0 -0
- data/ext/ae-output-event/ae-output-event.conf +2 -2
- data/ext/ae-output/ae-output.conf +2 -2
- data/ext/ae-output/ae-output.rb +173 -178
- data/ext/ae-palette/ae-palette.conf +0 -0
- data/ext/ae-palette/ae-palette.rb +0 -0
- data/ext/ae-shell/ae-shell.conf +0 -0
- data/ext/ae-shell/ae-shell.rb +54 -54
- data/lib/tk/al-tk.rb +3076 -3082
- data/lib/tk/al-tk.res.rb +0 -0
- data/lib/tk/al-tkarcadia.rb +0 -0
- data/lib/tk/al-tkcustom.rb +0 -0
- data/lib/tkext/al-bwidget.rb +0 -0
- data/lib/tkext/al-iwidgets.rb +0 -0
- data/lib/tkext/al-tile.rb +0 -0
- data/lib/tkext/al-tktable.rb +0 -0
- data/tcl/BWidget-1.8.0/BWman/ArrowButton.html +276 -0
- data/tcl/BWidget-1.8.0/BWman/BWidget.html +228 -0
- data/tcl/BWidget-1.8.0/BWman/Button.html +273 -0
- data/tcl/BWidget-1.8.0/BWman/ButtonBox.html +264 -0
- data/tcl/BWidget-1.8.0/BWman/ComboBox.html +402 -0
- data/tcl/BWidget-1.8.0/BWman/Dialog.html +314 -0
- data/tcl/BWidget-1.8.0/BWman/DragSite.html +139 -0
- data/tcl/BWidget-1.8.0/BWman/DropSite.html +254 -0
- data/tcl/BWidget-1.8.0/BWman/DynamicHelp.html +248 -0
- data/tcl/BWidget-1.8.0/BWman/Entry.html +341 -0
- data/tcl/BWidget-1.8.0/BWman/Label.html +331 -0
- data/tcl/BWidget-1.8.0/BWman/LabelEntry.html +194 -0
- data/tcl/BWidget-1.8.0/BWman/LabelFrame.html +144 -0
- data/tcl/BWidget-1.8.0/BWman/ListBox.html +678 -0
- data/tcl/BWidget-1.8.0/BWman/MainFrame.html +283 -0
- data/tcl/BWidget-1.8.0/BWman/MessageDlg.html +218 -0
- data/tcl/BWidget-1.8.0/BWman/NoteBook.html +374 -0
- data/tcl/BWidget-1.8.0/BWman/PagesManager.html +180 -0
- data/tcl/BWidget-1.8.0/BWman/PanedWindow.html +142 -0
- data/tcl/BWidget-1.8.0/BWman/PanelFrame.html +153 -0
- data/tcl/BWidget-1.8.0/BWman/PasswdDlg.html +214 -0
- data/tcl/BWidget-1.8.0/BWman/ProgressBar.html +152 -0
- data/tcl/BWidget-1.8.0/BWman/ProgressDlg.html +145 -0
- data/tcl/BWidget-1.8.0/BWman/ScrollView.html +130 -0
- data/tcl/BWidget-1.8.0/BWman/ScrollableFrame.html +191 -0
- data/tcl/BWidget-1.8.0/BWman/ScrolledWindow.html +116 -0
- data/tcl/BWidget-1.8.0/BWman/SelectColor.html +164 -0
- data/tcl/BWidget-1.8.0/BWman/SelectFont.html +152 -0
- data/tcl/BWidget-1.8.0/BWman/Separator.html +77 -0
- data/tcl/BWidget-1.8.0/BWman/SpinBox.html +250 -0
- data/tcl/BWidget-1.8.0/BWman/StatusBar.html +147 -0
- data/tcl/BWidget-1.8.0/BWman/TitleFrame.html +107 -0
- data/tcl/BWidget-1.8.0/BWman/Tree.html +947 -0
- data/tcl/BWidget-1.8.0/BWman/Widget.html +502 -0
- data/tcl/BWidget-1.8.0/BWman/contents.html +84 -0
- data/tcl/BWidget-1.8.0/BWman/index.html +7 -0
- data/tcl/BWidget-1.8.0/BWman/navtree.html +41 -0
- data/tcl/BWidget-1.8.0/BWman/options.htm +458 -0
- data/tcl/BWidget-1.8.0/CHANGES.txt +266 -0
- data/tcl/BWidget-1.8.0/ChangeLog +1641 -0
- data/tcl/BWidget-1.8.0/LICENSE.txt +41 -0
- data/tcl/BWidget-1.8.0/README.txt +127 -0
- data/tcl/BWidget-1.8.0/arrow.tcl +551 -0
- data/tcl/BWidget-1.8.0/bitmap.tcl +94 -0
- data/tcl/BWidget-1.8.0/button.tcl +324 -0
- data/tcl/BWidget-1.8.0/buttonbox.tcl +403 -0
- data/tcl/BWidget-1.8.0/color.tcl +493 -0
- data/tcl/BWidget-1.8.0/combobox.tcl +809 -0
- data/tcl/BWidget-1.8.0/demo/basic.tcl +199 -0
- data/tcl/BWidget-1.8.0/demo/bwidget.xbm +46 -0
- data/tcl/BWidget-1.8.0/demo/demo.tcl +212 -0
- data/tcl/BWidget-1.8.0/demo/dnd.tcl +42 -0
- data/tcl/BWidget-1.8.0/demo/manager.tcl +141 -0
- data/tcl/BWidget-1.8.0/demo/select.tcl +59 -0
- data/tcl/BWidget-1.8.0/demo/tmpldlg.tcl +214 -0
- data/tcl/BWidget-1.8.0/demo/tree.tcl +260 -0
- data/tcl/BWidget-1.8.0/demo/x1.xbm +2258 -0
- data/tcl/BWidget-1.8.0/dialog.tcl +345 -0
- data/tcl/BWidget-1.8.0/dragsite.tcl +197 -0
- data/tcl/BWidget-1.8.0/dropsite.tcl +455 -0
- data/tcl/BWidget-1.8.0/dynhelp.tcl +625 -0
- data/tcl/BWidget-1.8.0/entry.tcl +469 -0
- data/tcl/BWidget-1.8.0/font.tcl +566 -0
- data/tcl/BWidget-1.8.0/images/bold.gif +0 -0
- data/tcl/BWidget-1.8.0/images/copy.gif +0 -0
- data/tcl/BWidget-1.8.0/images/cut.gif +0 -0
- data/tcl/BWidget-1.8.0/images/dragfile.gif +0 -0
- data/tcl/BWidget-1.8.0/images/dragicon.gif +0 -0
- data/tcl/BWidget-1.8.0/images/error.gif +0 -0
- data/tcl/BWidget-1.8.0/images/file.gif +0 -0
- data/tcl/BWidget-1.8.0/images/folder.gif +0 -0
- data/tcl/BWidget-1.8.0/images/hourglass.gif +0 -0
- data/tcl/BWidget-1.8.0/images/info.gif +0 -0
- data/tcl/BWidget-1.8.0/images/italic.gif +0 -0
- data/tcl/BWidget-1.8.0/images/minus.xbm +5 -0
- data/tcl/BWidget-1.8.0/images/new.gif +0 -0
- data/tcl/BWidget-1.8.0/images/opcopy.xbm +5 -0
- data/tcl/BWidget-1.8.0/images/open.gif +0 -0
- data/tcl/BWidget-1.8.0/images/openfold.gif +0 -0
- data/tcl/BWidget-1.8.0/images/oplink.xbm +5 -0
- data/tcl/BWidget-1.8.0/images/opmove.xbm +5 -0
- data/tcl/BWidget-1.8.0/images/overstrike.gif +0 -0
- data/tcl/BWidget-1.8.0/images/palette.gif +0 -0
- data/tcl/BWidget-1.8.0/images/passwd.gif +0 -0
- data/tcl/BWidget-1.8.0/images/paste.gif +0 -0
- data/tcl/BWidget-1.8.0/images/plus.xbm +5 -0
- data/tcl/BWidget-1.8.0/images/print.gif +0 -0
- data/tcl/BWidget-1.8.0/images/question.gif +0 -0
- data/tcl/BWidget-1.8.0/images/redo.gif +0 -0
- data/tcl/BWidget-1.8.0/images/save.gif +0 -0
- data/tcl/BWidget-1.8.0/images/target.xbm +9 -0
- data/tcl/BWidget-1.8.0/images/underline.gif +0 -0
- data/tcl/BWidget-1.8.0/images/undo.gif +0 -0
- data/tcl/BWidget-1.8.0/images/warning.gif +0 -0
- data/tcl/BWidget-1.8.0/init.tcl +40 -0
- data/tcl/BWidget-1.8.0/label.tcl +271 -0
- data/tcl/BWidget-1.8.0/labelentry.tcl +100 -0
- data/tcl/BWidget-1.8.0/labelframe.tcl +160 -0
- data/tcl/BWidget-1.8.0/lang/da.rc +52 -0
- data/tcl/BWidget-1.8.0/lang/de.rc +52 -0
- data/tcl/BWidget-1.8.0/lang/en.rc +52 -0
- data/tcl/BWidget-1.8.0/lang/es.rc +53 -0
- data/tcl/BWidget-1.8.0/lang/fr.rc +52 -0
- data/tcl/BWidget-1.8.0/listbox.tcl +1638 -0
- data/tcl/BWidget-1.8.0/mainframe.tcl +711 -0
- data/tcl/BWidget-1.8.0/messagedlg.tcl +128 -0
- data/tcl/BWidget-1.8.0/notebook.tcl +1164 -0
- data/tcl/BWidget-1.8.0/pagesmgr.tcl +294 -0
- data/tcl/BWidget-1.8.0/panedw.tcl +381 -0
- data/tcl/BWidget-1.8.0/panelframe.tcl +246 -0
- data/tcl/BWidget-1.8.0/passwddlg.tcl +178 -0
- data/tcl/BWidget-1.8.0/pkgIndex.tcl +47 -0
- data/tcl/BWidget-1.8.0/progressbar.tcl +208 -0
- data/tcl/BWidget-1.8.0/progressdlg.tcl +87 -0
- data/tcl/BWidget-1.8.0/scrollframe.tcl +226 -0
- data/tcl/BWidget-1.8.0/scrollview.tcl +254 -0
- data/tcl/BWidget-1.8.0/scrollw.tcl +280 -0
- data/tcl/BWidget-1.8.0/separator.tcl +75 -0
- data/tcl/BWidget-1.8.0/spinbox.tcl +331 -0
- data/tcl/BWidget-1.8.0/statusbar.tcl +422 -0
- data/tcl/BWidget-1.8.0/tests/entry.test +173 -0
- data/tcl/BWidget-1.8.0/titleframe.tcl +170 -0
- data/tcl/BWidget-1.8.0/tree.tcl +2228 -0
- data/tcl/BWidget-1.8.0/utils.tcl +645 -0
- data/tcl/BWidget-1.8.0/widget.tcl +1576 -0
- data/tcl/BWidget-1.8.0/wizard.tcl +1028 -0
- data/tcl/BWidget-1.8.0/xpm2image.tcl +115 -0
- metadata +141 -5
data/base/a-contracts.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# by Antonio Galeone <antonio-galeone@rubyforge.org>
|
4
4
|
#
|
5
5
|
|
6
|
-
# Catalog of all contracts used by
|
6
|
+
# Catalog of all contracts used by extensions. This astraction guarantees
|
7
7
|
# the separation of ext
|
8
8
|
# contract must extend AeContract
|
9
9
|
|
@@ -23,24 +23,25 @@ class MainContract < ArcadiaContract
|
|
23
23
|
RAISE_EXTENSION = "RAISE_EXTENSION"
|
24
24
|
EVENT_HANDLED = "EVENT_HANDLED"
|
25
25
|
|
26
|
-
|
27
|
-
|
26
|
+
|
27
|
+
def event_handled(_sender, *args)
|
28
|
+
raise_event(EVENT_HANDLED, TMainObj.new(_sender, *args))
|
28
29
|
end
|
29
30
|
|
30
|
-
def extension_before_build(
|
31
|
-
raise_event(EXTENSION_BEFORE_BUILD,
|
31
|
+
def extension_before_build(_sender, *args)
|
32
|
+
raise_event(EXTENSION_BEFORE_BUILD, TMainObj.new(_sender, *args))
|
32
33
|
end
|
33
34
|
|
34
|
-
def extension_build(
|
35
|
-
raise_event(EXTENSION_BUILD,
|
35
|
+
def extension_build(_sender, *args)
|
36
|
+
raise_event(EXTENSION_BUILD, TMainObj.new(_sender, *args))
|
36
37
|
end
|
37
38
|
|
38
|
-
def extension_after_build(
|
39
|
-
raise_event(EXTENSION_AFTER_BUILD,
|
39
|
+
def extension_after_build(_sender, *args)
|
40
|
+
raise_event(EXTENSION_AFTER_BUILD, TMainObj.new(_sender, *args))
|
40
41
|
end
|
41
42
|
|
42
|
-
def raise_extension(
|
43
|
-
|
43
|
+
def raise_extension(_sender, *args)
|
44
|
+
raise_event(RAISE_EXTENSION, TMainObj.new(_sender, *args))
|
44
45
|
end
|
45
46
|
|
46
47
|
end
|
@@ -48,63 +49,111 @@ end
|
|
48
49
|
|
49
50
|
class EditorContract < ArcadiaContract
|
50
51
|
class TEditorObj < TObj
|
51
|
-
attr_accessor :file, :line, :col, :title, :text, :candidates
|
52
|
+
attr_accessor :file, :line, :col, :title, :text, :candidates, :xdoc, :ydoc, :doc_entry,:doc
|
52
53
|
end
|
53
54
|
OPEN_FILE = "OPEN_FILE"
|
54
55
|
CLOSE_FILE = "CLOSE_FILE"
|
56
|
+
SHOW_SEARCH_DIALOG = "SHOW_SEARCH_DIALOG"
|
57
|
+
SHOW_GOTO_LINE_DIALOG = "SHOW_GOTO_LINE_DIALOG"
|
58
|
+
SAVE_FILE = "SAVE_FILE"
|
59
|
+
SAVE_AS_FILE = "SAVE_AS_FILE"
|
60
|
+
SAVE_FILE_RAISED = "SAVE_FILE_RAISED"
|
61
|
+
SAVE_AS_FILE_RAISED = "SAVE_AS_FILE_RAISED"
|
55
62
|
OPEN_TEXT = "OPEN_TEXT"
|
63
|
+
COMPLETE_CODE = "COMPLETE_CODE"
|
64
|
+
DOC_CODE = "DOC_CODE"
|
56
65
|
|
57
|
-
AFTER_CREATE = "AFTER_CREATE"
|
66
|
+
#AFTER_CREATE = "AFTER_CREATE"
|
58
67
|
BREAKPOINT_AFTER_CREATE = "BREAKPOINT_AFTER_CREATE"
|
59
68
|
BREAKPOINT_AFTER_DELETE = "BREAKPOINT_AFTER_DELETE"
|
60
69
|
BREAKPOINTS_AFTER_CREATE = "BREAKPOINTS_AFTER_CREATE"
|
61
70
|
BREAKPOINTS_AFTER_DELETE = "BREAKPOINTS_AFTER_DELETE"
|
62
71
|
FILE_AFTER_OPEN = "FILE_AFTER_OPEN"
|
63
72
|
FILE_AFTER_CLOSE = "FILE_AFTER_CLOSE"
|
73
|
+
FILE_AFTER_SAVE = "FILE_AFTER_SAVE"
|
74
|
+
FILE_AFTER_CREATE = "FILE_AFTER_CREATE"
|
64
75
|
BUFFER_AFTER_RAISE = "BUFFER_AFTER_RAISE"
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
raise_action(OPEN_FILE, _tobj)
|
76
|
+
|
77
|
+
def open_file(_sender, *args)
|
78
|
+
raise_action(OPEN_FILE, TEditorObj.new(_sender, *args))
|
69
79
|
end
|
70
|
-
|
71
|
-
def close_file(
|
72
|
-
raise_action(CLOSE_FILE,
|
80
|
+
|
81
|
+
def close_file(_sender, *args)
|
82
|
+
raise_action(CLOSE_FILE, TEditorObj.new(_sender, *args))
|
73
83
|
end
|
74
|
-
|
75
|
-
def
|
76
|
-
|
84
|
+
|
85
|
+
def save_file(_sender, *args)
|
86
|
+
raise_action(SAVE_FILE, TEditorObj.new(_sender, *args))
|
87
|
+
end
|
88
|
+
|
89
|
+
def save_file_raised(_sender, *args)
|
90
|
+
raise_action(SAVE_FILE_RAISED, TEditorObj.new(_sender, *args))
|
91
|
+
end
|
92
|
+
|
93
|
+
def save_as_file(_sender, *args)
|
94
|
+
raise_action(SAVE_AS_FILE, TEditorObj.new(_sender, *args))
|
95
|
+
end
|
96
|
+
|
97
|
+
def save_as_file_raised(_sender, *args)
|
98
|
+
raise_action(SAVE_AS_FILE_RAISED, TEditorObj.new(_sender, *args))
|
99
|
+
end
|
100
|
+
|
101
|
+
def show_search_dialog(_sender, *args)
|
102
|
+
raise_action(SHOW_SEARCH_DIALOG, TEditorObj.new(_sender, *args))
|
103
|
+
end
|
104
|
+
|
105
|
+
|
106
|
+
def show_goto_line_dialog(_sender, *args)
|
107
|
+
raise_action(SHOW_GOTO_LINE_DIALOG, TEditorObj.new(_sender, *args))
|
108
|
+
end
|
109
|
+
|
110
|
+
def open_text(_sender, *args)
|
111
|
+
raise_action(OPEN_TEXT, TEditorObj.new(_sender, *args))
|
77
112
|
end
|
78
113
|
|
79
|
-
def complete_code(
|
80
|
-
raise_action(COMPLETE_CODE,
|
114
|
+
def complete_code(_sender, *args)
|
115
|
+
raise_action(COMPLETE_CODE, TEditorObj.new(_sender, *args))
|
81
116
|
end
|
82
117
|
|
83
|
-
|
84
|
-
|
118
|
+
def doc_code(_sender, *args)
|
119
|
+
raise_action(DOC_CODE, TEditorObj.new(_sender, *args))
|
120
|
+
end
|
121
|
+
|
122
|
+
def file_opened(_sender, *args)
|
123
|
+
raise_event(FILE_AFTER_OPEN, TEditorObj.new(_sender, *args))
|
85
124
|
end
|
86
125
|
|
87
|
-
def
|
88
|
-
raise_event(
|
126
|
+
def file_saved(_sender, *args)
|
127
|
+
raise_event(FILE_AFTER_SAVE, TEditorObj.new(_sender, *args))
|
89
128
|
end
|
90
129
|
|
91
|
-
def
|
92
|
-
raise_event(
|
130
|
+
def file_created(_sender, *args)
|
131
|
+
raise_event(FILE_AFTER_CREATE, TEditorObj.new(_sender, *args))
|
93
132
|
end
|
94
|
-
|
95
|
-
def
|
96
|
-
raise_event(
|
133
|
+
|
134
|
+
def buffer_raised(_sender, *args)
|
135
|
+
raise_event(BUFFER_AFTER_RAISE, TEditorObj.new(_sender, *args))
|
97
136
|
end
|
98
|
-
|
99
|
-
def
|
100
|
-
raise_event(
|
137
|
+
|
138
|
+
def file_closed(_sender, *args)
|
139
|
+
raise_event(FILE_AFTER_CLOSE, TEditorObj.new(_sender, *args))
|
101
140
|
end
|
102
|
-
|
103
|
-
|
141
|
+
|
142
|
+
def breakpoint_created(_sender, *args)
|
143
|
+
raise_event(BREAKPOINT_AFTER_CREATE, TEditorObj.new(_sender, *args))
|
104
144
|
end
|
105
|
-
|
106
|
-
|
145
|
+
|
146
|
+
def breakpoint_deleted(_sender, *args)
|
147
|
+
raise_event(BREAKPOINT_AFTER_DELETE, TEditorObj.new(_sender, *args))
|
107
148
|
end
|
149
|
+
|
150
|
+
# def breakpoints_created(_array_of_tobj=nil)
|
151
|
+
# raise_event(BREAKPOINTS_AFTER_CREATE, _array_of_tobj)
|
152
|
+
# end
|
153
|
+
# def breakpoints_deleted(_array_of_tobj=nil)
|
154
|
+
# raise_event(BREAKPOINTS_AFTER_DELETE, _array_of_tobj)
|
155
|
+
# end
|
156
|
+
|
108
157
|
end
|
109
158
|
|
110
159
|
class MsgContract < ArcadiaContract
|
@@ -118,29 +167,20 @@ class MsgContract < ArcadiaContract
|
|
118
167
|
end
|
119
168
|
|
120
169
|
EVENT_EXT_MSG_OUT = "EVENT_EXT_MSG_OUT"
|
121
|
-
def out(
|
122
|
-
raise_event(EVENT_EXT_MSG_OUT,
|
170
|
+
def out(_sender, *args)
|
171
|
+
raise_event(EVENT_EXT_MSG_OUT, TMsgObj.new(_sender, *args))
|
123
172
|
end
|
124
173
|
|
125
174
|
def out_simple(_sender, _msg, _channel=nil)
|
126
|
-
|
127
|
-
_tobj.type = TYPE_SIMPLE
|
128
|
-
_tobj.text = _msg
|
129
|
-
self.out(_tobj)
|
175
|
+
self.out(_sender, 'type'=>TYPE_SIMPLE, 'text'=>_msg, 'channel'=>_channel)
|
130
176
|
end
|
131
177
|
|
132
178
|
def out_debug(_sender, _msg, _channel=nil)
|
133
|
-
|
134
|
-
_tobj.type = TYPE_DEBUG
|
135
|
-
_tobj.text = _msg
|
136
|
-
self.out(_tobj)
|
179
|
+
self.out(_sender, 'type'=>TYPE_DEBUG, 'text'=>_msg, 'channel'=>_channel)
|
137
180
|
end
|
138
181
|
|
139
182
|
def out_error(_sender, _msg, _channel=nil)
|
140
|
-
|
141
|
-
_tobj.type = TYPE_ERROR
|
142
|
-
_tobj.text = _msg
|
143
|
-
self.out(_tobj)
|
183
|
+
self.out(_sender, 'type'=>TYPE_ERROR, 'text'=>_msg, 'channel'=>_channel)
|
144
184
|
end
|
145
185
|
end
|
146
186
|
|
@@ -151,10 +191,11 @@ class ShellContract < ArcadiaContract
|
|
151
191
|
attr_accessor :file
|
152
192
|
end
|
153
193
|
|
154
|
-
def run(
|
155
|
-
|
156
|
-
|
157
|
-
|
194
|
+
def run(_sender, *args)
|
195
|
+
end
|
196
|
+
|
197
|
+
def debug(_sender, *args)
|
198
|
+
end
|
158
199
|
end
|
159
200
|
|
160
201
|
|
@@ -169,14 +210,14 @@ class DebugContract < ArcadiaContract
|
|
169
210
|
DEBUG_END="DEBUG_END"
|
170
211
|
DEBUG_STEP="DEBUG_STEP"
|
171
212
|
|
172
|
-
def debug_begin(
|
173
|
-
raise_event(DEBUG_BEGIN,
|
213
|
+
def debug_begin(_sender, *args)
|
214
|
+
raise_event(DEBUG_BEGIN, TDebugObj.new(_sender, *args))
|
174
215
|
end
|
175
|
-
def debug_end(
|
176
|
-
raise_event(DEBUG_END,
|
216
|
+
def debug_end(_sender, *args)
|
217
|
+
raise_event(DEBUG_END, TDebugObj.new(_sender, *args))
|
177
218
|
end
|
178
|
-
def debug_step(
|
179
|
-
raise_event(DEBUG_STEP,
|
219
|
+
def debug_step(_sender, *args)
|
220
|
+
raise_event(DEBUG_STEP, TDebugObj.new(_sender, *args))
|
180
221
|
end
|
181
222
|
end
|
182
223
|
|
@@ -197,36 +238,32 @@ class InspectorContract < ArcadiaContract
|
|
197
238
|
RAISE_LAST_WIDGET = "RAISE_LAST_WIDGET"
|
198
239
|
RAISE_ACTIVE_TOPLEVEL = "RAISE_ACTIVE_TOPLEVEL"
|
199
240
|
|
200
|
-
def delete_wrapper(
|
201
|
-
raise_action(DELETE_WRAPPER,
|
241
|
+
def delete_wrapper(_sender, *args)
|
242
|
+
raise_action(DELETE_WRAPPER, TInspectorObj.new(_sender, *args))
|
202
243
|
end
|
203
244
|
|
204
|
-
def raise_last_widget(
|
205
|
-
raise_action(RAISE_LAST_WIDGET,
|
245
|
+
def raise_last_widget(_sender, *args)
|
246
|
+
raise_action(RAISE_LAST_WIDGET, TInspectorObj.new(_sender, *args))
|
206
247
|
end
|
207
248
|
|
208
|
-
def raise_active_toplevel(
|
209
|
-
raise_action(RAISE_ACTIVE_TOPLEVEL,
|
249
|
+
def raise_active_toplevel(_sender, *args)
|
250
|
+
raise_action(RAISE_ACTIVE_TOPLEVEL, TInspectorObj.new(_sender, *args))
|
210
251
|
end
|
211
252
|
|
212
|
-
def select(
|
213
|
-
raise_action(SELECT_WRAPPER,
|
253
|
+
def select(_sender, *args)
|
254
|
+
raise_action(SELECT_WRAPPER, TInspectorObj.new(_sender, *args))
|
214
255
|
end
|
215
256
|
|
216
|
-
def add_require(
|
217
|
-
raise_action(ADD_REQUIRE,
|
257
|
+
def add_require(_sender, *args)
|
258
|
+
raise_action(ADD_REQUIRE, TInspectorObj.new(_sender, *args))
|
218
259
|
end
|
219
260
|
|
220
|
-
def register(
|
221
|
-
raise_action(REGISTER_WRAPPER,
|
261
|
+
def register(_sender, *args)
|
262
|
+
raise_action(REGISTER_WRAPPER, TInspectorObj.new(_sender, *args))
|
222
263
|
end
|
223
264
|
|
224
|
-
|
225
|
-
|
226
|
-
# end
|
227
|
-
|
228
|
-
def delete_inspector(_tobj=nil)
|
229
|
-
raise_action(DELETE_INSPECTOR, _tobj)
|
265
|
+
def delete_inspector(_sender, *args)
|
266
|
+
raise_action(DELETE_INSPECTOR, TInspectorObj.new(_sender, *args))
|
230
267
|
end
|
231
268
|
|
232
269
|
publish_action :raise_active_object
|
@@ -234,8 +271,8 @@ end
|
|
234
271
|
|
235
272
|
class PublishContract < ArcadiaContract
|
236
273
|
ADD_COMAND_ACTOR = "ADD_COMAND_ACTOR"
|
237
|
-
def add_command_actor(
|
238
|
-
raise_action(ADD_COMAND_ACTOR,
|
274
|
+
def add_command_actor(_sender, *args)
|
275
|
+
raise_action(ADD_COMAND_ACTOR, TObj.new(_sender, *args))
|
239
276
|
end
|
240
277
|
end
|
241
278
|
|
@@ -248,14 +285,14 @@ class WrapperContract < ArcadiaContract
|
|
248
285
|
WRAPPER_AFTER_CREATE="WRAPPER_AFTER_CREATE"
|
249
286
|
PROPERTY_AFTER_UPDATE="PROPERTY_AFTER_UPDATE"
|
250
287
|
UPDATE_PROPERTY="UPDATE_PROPERTY"
|
251
|
-
def update_property(
|
252
|
-
raise_action(UPDATE_PROPERTY,
|
288
|
+
def update_property(_sender, *args)
|
289
|
+
raise_action(UPDATE_PROPERTY, TWrapperObj.new(_sender, *args))
|
253
290
|
end
|
254
|
-
def property_updated(
|
255
|
-
raise_event(PROPERTY_AFTER_UPDATE,
|
291
|
+
def property_updated(_sender, *args)
|
292
|
+
raise_event(PROPERTY_AFTER_UPDATE, TWrapperObj.new(_sender, *args))
|
256
293
|
end
|
257
|
-
def wrapper_created(
|
258
|
-
raise_event(WRAPPER_AFTER_CREATE,
|
294
|
+
def wrapper_created(_sender, *args)
|
295
|
+
raise_event(WRAPPER_AFTER_CREATE, TWrapperObj.new(_sender, *args))
|
259
296
|
end
|
260
297
|
end
|
261
298
|
|
@@ -264,7 +301,7 @@ class PaletteContract < ArcadiaContract
|
|
264
301
|
attr_accessor :parent, :x, :y
|
265
302
|
end
|
266
303
|
MAKE_SELECTED_WRAPPER = "MAKE_SELECTED_WRAPPER"
|
267
|
-
def make_selected(
|
268
|
-
raise_action(MAKE_SELECTED_WRAPPER,
|
304
|
+
def make_selected(_sender, *args)
|
305
|
+
raise_action(MAKE_SELECTED_WRAPPER, TPaletteObj.new(_sender, *args))
|
269
306
|
end
|
270
307
|
end
|
data/base/a-ext.rb
CHANGED
@@ -1,280 +1,280 @@
|
|
1
|
-
#
|
2
|
-
# a-ext.rb - Arcadia Ruby ide
|
3
|
-
# by Antonio Galeone <antonio-galeone@rubyforge.org>
|
4
|
-
#
|
5
|
-
|
6
|
-
require "observer"
|
7
|
-
require 'singleton'
|
8
|
-
|
9
|
-
class ArcadiaExt
|
10
|
-
attr_reader :arcadia
|
11
|
-
|
12
|
-
def initialize(_arcadia, _name=nil)
|
13
|
-
@arcadia = _arcadia
|
14
|
-
@name = _name
|
15
|
-
unless self.respond_to? :build
|
16
|
-
raise NoMethodError, "ArcadiaExt needs to respond to `:build'"
|
17
|
-
end
|
18
|
-
unless self.respond_to? :before_build
|
19
|
-
raise NoMethodError, "ArcadiaExt needs to respond to `:before_build'"
|
20
|
-
end
|
21
|
-
unless self.respond_to? :after_build
|
22
|
-
raise NoMethodError, "ArcadiaExt needs to respond to `:after_build'"
|
23
|
-
end
|
24
|
-
if self.respond_to? :arcadia_update
|
25
|
-
ObserverCallback.new(@arcadia.main_contract, self, :arcadia_update)
|
26
|
-
end
|
27
|
-
ObjectSpace.define_finalizer(self, self.method(:finalize).to_proc)
|
28
|
-
end
|
29
|
-
|
30
|
-
def before_build
|
31
|
-
#must be implemented in child
|
32
|
-
end
|
33
|
-
|
34
|
-
def build
|
35
|
-
#must be implemented in child
|
36
|
-
end
|
37
|
-
|
38
|
-
def after_build
|
39
|
-
#must be implemented in child
|
40
|
-
end
|
41
|
-
|
42
|
-
def frame
|
43
|
-
if @frame == nil
|
44
|
-
@frame = @arcadia.layout.register_panel(@arcadia['conf'][@name+'.frame'],@name, @arcadia['conf'][@name+'.label'])
|
45
|
-
end
|
46
|
-
return @frame
|
47
|
-
end
|
48
|
-
|
49
|
-
def frame_free
|
50
|
-
@arcadia.layout.unregister_panel(@arcadia['conf'][@name+'.frame'],@name)
|
51
|
-
@frame = nil
|
52
|
-
end
|
53
|
-
|
54
|
-
def conf(_property)
|
55
|
-
@arcadia['conf'][@name+'.'+_property]
|
56
|
-
end
|
57
|
-
# def arcadia_update(_sender, _event)
|
58
|
-
#must be implemented to activate
|
59
|
-
# end
|
60
|
-
|
61
|
-
def can_exit_query
|
62
|
-
return true
|
63
|
-
end
|
64
|
-
|
65
|
-
def finalize
|
66
|
-
#may be extendeded in child
|
67
|
-
end
|
68
|
-
|
69
|
-
def verbose
|
70
|
-
'??????'
|
71
|
-
end
|
72
|
-
|
73
|
-
end
|
74
|
-
|
75
|
-
|
76
|
-
class ObserverCallback
|
77
|
-
def initialize(_publisher, _subscriber, _method_update_to_call=:update)
|
78
|
-
@publisher = _publisher
|
79
|
-
@subscriber = _subscriber
|
80
|
-
@method=_method_update_to_call
|
81
|
-
@publisher.add_observer(self)
|
82
|
-
end
|
83
|
-
def update(*args)
|
84
|
-
@subscriber.send(@method,*args)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
class ObserverCallbackContract < ObserverCallback
|
89
|
-
def initialize(_publisher, _subscriber, _method_update_to_call=:update, _channel=nil)
|
90
|
-
super(_publisher, _subscriber, _method_update_to_call)
|
91
|
-
@channel = _channel
|
92
|
-
@channel_conf = @subscriber.conf(@publisher.class.to_s+'.channel') if @subscriber.respond_to?(:conf)
|
93
|
-
end
|
94
|
-
|
95
|
-
def filter(_event)
|
96
|
-
@channel_conf != nil && @channel_conf != _event.channel
|
97
|
-
end
|
98
|
-
|
99
|
-
def update(_event, *args)
|
100
|
-
super(_event, *args) if !filter(_event)
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
|
105
|
-
class ObserverCallbackContractThread < ObserverCallbackContract
|
106
|
-
def update(*args)
|
107
|
-
Thread.new do
|
108
|
-
super(*args)
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
end
|
113
|
-
|
114
|
-
|
115
|
-
# The contract define the interface beetwhen extension
|
116
|
-
# in particulare define method than raise event to observers client
|
117
|
-
# and a way to retreive state from client
|
118
|
-
|
119
|
-
class ArcadiaContract
|
120
|
-
include Observable
|
121
|
-
include Singleton
|
122
|
-
class ContractEvent
|
123
|
-
attr_reader :contract
|
124
|
-
attr_reader :signature
|
125
|
-
attr_reader :context
|
126
|
-
attr_reader :channel
|
127
|
-
attr_reader :time
|
128
|
-
attr_writer :action
|
129
|
-
|
130
|
-
SIGNATURE = "NOT_DEFINED"
|
131
|
-
def initialize(_contract, _signature=SIGNATURE, _context=nil)
|
132
|
-
@contract = _contract
|
133
|
-
@signature = _signature
|
134
|
-
@context = _context
|
135
|
-
_context.channel != nil ?@channel=_context.channel: @channel='0'
|
136
|
-
@time = Time.new
|
137
|
-
@action = false
|
138
|
-
end
|
139
|
-
|
140
|
-
def handled(_from)
|
141
|
-
MainContract.instance.event_handled(
|
142
|
-
end
|
143
|
-
|
144
|
-
def is_action?
|
145
|
-
@action
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
class TObj
|
150
|
-
attr_reader :sender
|
151
|
-
attr_accessor :caused_by
|
152
|
-
attr_accessor :channel
|
153
|
-
DEFAULT_CHANNEL='0'
|
154
|
-
def initialize(_sender, _args=nil)
|
155
|
-
@sender=_sender
|
156
|
-
@channel = DEFAULT_CHANNEL
|
157
|
-
if _args
|
158
|
-
_args.each do |key, value|
|
159
|
-
self.send(key+'=', value)
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
|
-
end
|
164
|
-
|
165
|
-
# properties.each do |prop|
|
166
|
-
# define_method(prop) {
|
167
|
-
# instance_variable_get("@#{prop}")
|
168
|
-
# }
|
169
|
-
# define_method("#{prop}=") do |value|
|
170
|
-
# instance_variable_set("@#{prop}", value)
|
171
|
-
# end
|
172
|
-
# end
|
173
|
-
|
174
|
-
# define_method(prop)
|
175
|
-
# attr_reader prop.to_sym # prop by itself also worked for me
|
176
|
-
# # code snip ? setter method
|
177
|
-
# end
|
178
|
-
|
179
|
-
|
180
|
-
# def TObj.property(*properties)
|
181
|
-
# properties.each { |property|
|
182
|
-
# class_eval(%Q[
|
183
|
-
# def #{property}
|
184
|
-
# @#{property}
|
185
|
-
# end
|
186
|
-
#
|
187
|
-
# def #{property}=(value)
|
188
|
-
# @#{property} = value
|
189
|
-
# end
|
190
|
-
# ])
|
191
|
-
# }
|
192
|
-
# end
|
193
|
-
end
|
194
|
-
|
195
|
-
class EventInfo
|
196
|
-
attr_reader :method
|
197
|
-
attr_reader :label
|
198
|
-
attr_reader :icon
|
199
|
-
def initialize(_method)
|
200
|
-
@method = @method
|
201
|
-
end
|
202
|
-
end
|
203
|
-
|
204
|
-
SObj = Struct.new("GenericState",
|
205
|
-
:caller
|
206
|
-
)
|
207
|
-
|
208
|
-
def _event_forge(_event_signature, _tobj)
|
209
|
-
ContractEvent.new(self, _event_signature, _tobj)
|
210
|
-
end
|
211
|
-
private :_event_forge
|
212
|
-
|
213
|
-
|
214
|
-
def raise_event(_event_signature, _tobj, *args)
|
215
|
-
_raise_event(_event_forge(_event_signature, _tobj),*args)
|
216
|
-
end
|
217
|
-
|
218
|
-
def _raise_event(_event, *args)
|
219
|
-
changed
|
220
|
-
notify_observers(_event, *args)
|
221
|
-
if self.class != ArcadiaContract
|
222
|
-
self.class.superclass.instance._raise_event(_event, *args)
|
223
|
-
end
|
224
|
-
end
|
225
|
-
#protected :_raise_event
|
226
|
-
|
227
|
-
def raise_action(_event_signature, _tobj, *args)
|
228
|
-
_raise_action(_event_forge(_event_signature, _tobj),*args)
|
229
|
-
end
|
230
|
-
|
231
|
-
def _raise_action(_event, *args)
|
232
|
-
_event.action = true
|
233
|
-
_raise_event(_event, *args)
|
234
|
-
end
|
235
|
-
private :_raise_action
|
236
|
-
|
237
|
-
def ArcadiaContract.publish_action(_method)
|
238
|
-
_info = EventInfo.new(_method)
|
239
|
-
@@actions = Array.new if !defined?(@@actions)
|
240
|
-
@@actions << _info
|
241
|
-
end
|
242
|
-
|
243
|
-
end
|
244
|
-
|
245
|
-
class ArcadiaContractListener
|
246
|
-
def initialize(_subscriber, _class, _method, _channel=nil)
|
247
|
-
@subscriber = _subscriber
|
248
|
-
@class = _class
|
249
|
-
@method = _method
|
250
|
-
@channel = _channel
|
251
|
-
create_callback(_class.instance)
|
252
|
-
end
|
253
|
-
|
254
|
-
def create_callback(_contract)
|
255
|
-
ObserverCallbackContract.new(_contract, @subscriber, @method, @channel)
|
256
|
-
end
|
257
|
-
|
258
|
-
end
|
259
|
-
|
260
|
-
class ArcadiaContractListenerThread < ArcadiaContractListener
|
261
|
-
|
262
|
-
def create_callback(_contract)
|
263
|
-
#Thread.new do super(_contract, _subscriber, _method) end
|
264
|
-
ObserverCallbackContractThread.new(_contract, @subscriber, @method, @channel)
|
265
|
-
end
|
266
|
-
|
267
|
-
end
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
#class AeContractListener
|
273
|
-
# def initialize(_arcadia)
|
274
|
-
#
|
275
|
-
# end
|
276
|
-
# def listen_on(_aeclip_name, _method_update_to_call=:update)
|
277
|
-
# end
|
278
|
-
# def update(_tobj)
|
279
|
-
# end
|
280
|
-
#end
|
1
|
+
#
|
2
|
+
# a-ext.rb - Arcadia Ruby ide
|
3
|
+
# by Antonio Galeone <antonio-galeone@rubyforge.org>
|
4
|
+
#
|
5
|
+
|
6
|
+
require "observer"
|
7
|
+
require 'singleton'
|
8
|
+
|
9
|
+
class ArcadiaExt
|
10
|
+
attr_reader :arcadia
|
11
|
+
|
12
|
+
def initialize(_arcadia, _name=nil)
|
13
|
+
@arcadia = _arcadia
|
14
|
+
@name = _name
|
15
|
+
unless self.respond_to? :build
|
16
|
+
raise NoMethodError, "ArcadiaExt needs to respond to `:build'"
|
17
|
+
end
|
18
|
+
unless self.respond_to? :before_build
|
19
|
+
raise NoMethodError, "ArcadiaExt needs to respond to `:before_build'"
|
20
|
+
end
|
21
|
+
unless self.respond_to? :after_build
|
22
|
+
raise NoMethodError, "ArcadiaExt needs to respond to `:after_build'"
|
23
|
+
end
|
24
|
+
if self.respond_to? :arcadia_update
|
25
|
+
ObserverCallback.new(@arcadia.main_contract, self, :arcadia_update)
|
26
|
+
end
|
27
|
+
ObjectSpace.define_finalizer(self, self.method(:finalize).to_proc)
|
28
|
+
end
|
29
|
+
|
30
|
+
def before_build
|
31
|
+
#must be implemented in child
|
32
|
+
end
|
33
|
+
|
34
|
+
def build
|
35
|
+
#must be implemented in child
|
36
|
+
end
|
37
|
+
|
38
|
+
def after_build
|
39
|
+
#must be implemented in child
|
40
|
+
end
|
41
|
+
|
42
|
+
def frame
|
43
|
+
if @frame == nil
|
44
|
+
@frame = @arcadia.layout.register_panel(@arcadia['conf'][@name+'.frame'],@name, @arcadia['conf'][@name+'.label'])
|
45
|
+
end
|
46
|
+
return @frame
|
47
|
+
end
|
48
|
+
|
49
|
+
def frame_free
|
50
|
+
@arcadia.layout.unregister_panel(@arcadia['conf'][@name+'.frame'],@name)
|
51
|
+
@frame = nil
|
52
|
+
end
|
53
|
+
|
54
|
+
def conf(_property)
|
55
|
+
@arcadia['conf'][@name+'.'+_property]
|
56
|
+
end
|
57
|
+
# def arcadia_update(_sender, _event)
|
58
|
+
#must be implemented to activate
|
59
|
+
# end
|
60
|
+
|
61
|
+
def can_exit_query
|
62
|
+
return true
|
63
|
+
end
|
64
|
+
|
65
|
+
def finalize
|
66
|
+
#may be extendeded in child
|
67
|
+
end
|
68
|
+
|
69
|
+
def verbose
|
70
|
+
'??????'
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
|
76
|
+
class ObserverCallback
|
77
|
+
def initialize(_publisher, _subscriber, _method_update_to_call=:update)
|
78
|
+
@publisher = _publisher
|
79
|
+
@subscriber = _subscriber
|
80
|
+
@method=_method_update_to_call
|
81
|
+
@publisher.add_observer(self)
|
82
|
+
end
|
83
|
+
def update(*args)
|
84
|
+
@subscriber.send(@method,*args)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
class ObserverCallbackContract < ObserverCallback
|
89
|
+
def initialize(_publisher, _subscriber, _method_update_to_call=:update, _channel=nil)
|
90
|
+
super(_publisher, _subscriber, _method_update_to_call)
|
91
|
+
@channel = _channel
|
92
|
+
@channel_conf = @subscriber.conf(@publisher.class.to_s+'.channel') if @subscriber.respond_to?(:conf)
|
93
|
+
end
|
94
|
+
|
95
|
+
def filter(_event)
|
96
|
+
@channel_conf != nil && @channel_conf != _event.channel
|
97
|
+
end
|
98
|
+
|
99
|
+
def update(_event, *args)
|
100
|
+
super(_event, *args) if !filter(_event)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
|
105
|
+
class ObserverCallbackContractThread < ObserverCallbackContract
|
106
|
+
def update(*args)
|
107
|
+
Thread.new do
|
108
|
+
super(*args)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
113
|
+
|
114
|
+
|
115
|
+
# The contract define the interface beetwhen extension
|
116
|
+
# in particulare define method than raise event to observers client
|
117
|
+
# and a way to retreive state from client
|
118
|
+
|
119
|
+
class ArcadiaContract
|
120
|
+
include Observable
|
121
|
+
include Singleton
|
122
|
+
class ContractEvent
|
123
|
+
attr_reader :contract
|
124
|
+
attr_reader :signature
|
125
|
+
attr_reader :context
|
126
|
+
attr_reader :channel
|
127
|
+
attr_reader :time
|
128
|
+
attr_writer :action
|
129
|
+
|
130
|
+
SIGNATURE = "NOT_DEFINED"
|
131
|
+
def initialize(_contract, _signature=SIGNATURE, _context=nil)
|
132
|
+
@contract = _contract
|
133
|
+
@signature = _signature
|
134
|
+
@context = _context
|
135
|
+
_context.channel != nil ?@channel=_context.channel: @channel='0'
|
136
|
+
@time = Time.new
|
137
|
+
@action = false
|
138
|
+
end
|
139
|
+
|
140
|
+
def handled(_from)
|
141
|
+
MainContract.instance.event_handled(_from,'caused_by'=>self)
|
142
|
+
end
|
143
|
+
|
144
|
+
def is_action?
|
145
|
+
@action
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
class TObj
|
150
|
+
attr_reader :sender
|
151
|
+
attr_accessor :caused_by
|
152
|
+
attr_accessor :channel
|
153
|
+
DEFAULT_CHANNEL='0'
|
154
|
+
def initialize(_sender, _args=nil)
|
155
|
+
@sender=_sender
|
156
|
+
@channel = DEFAULT_CHANNEL
|
157
|
+
if _args
|
158
|
+
_args.each do |key, value|
|
159
|
+
self.send(key+'=', value)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
end
|
164
|
+
|
165
|
+
# properties.each do |prop|
|
166
|
+
# define_method(prop) {
|
167
|
+
# instance_variable_get("@#{prop}")
|
168
|
+
# }
|
169
|
+
# define_method("#{prop}=") do |value|
|
170
|
+
# instance_variable_set("@#{prop}", value)
|
171
|
+
# end
|
172
|
+
# end
|
173
|
+
|
174
|
+
# define_method(prop)
|
175
|
+
# attr_reader prop.to_sym # prop by itself also worked for me
|
176
|
+
# # code snip ? setter method
|
177
|
+
# end
|
178
|
+
|
179
|
+
|
180
|
+
# def TObj.property(*properties)
|
181
|
+
# properties.each { |property|
|
182
|
+
# class_eval(%Q[
|
183
|
+
# def #{property}
|
184
|
+
# @#{property}
|
185
|
+
# end
|
186
|
+
#
|
187
|
+
# def #{property}=(value)
|
188
|
+
# @#{property} = value
|
189
|
+
# end
|
190
|
+
# ])
|
191
|
+
# }
|
192
|
+
# end
|
193
|
+
end
|
194
|
+
|
195
|
+
class EventInfo
|
196
|
+
attr_reader :method
|
197
|
+
attr_reader :label
|
198
|
+
attr_reader :icon
|
199
|
+
def initialize(_method)
|
200
|
+
@method = @method
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
SObj = Struct.new("GenericState",
|
205
|
+
:caller
|
206
|
+
)
|
207
|
+
|
208
|
+
def _event_forge(_event_signature, _tobj)
|
209
|
+
ContractEvent.new(self, _event_signature, _tobj)
|
210
|
+
end
|
211
|
+
private :_event_forge
|
212
|
+
|
213
|
+
|
214
|
+
def raise_event(_event_signature, _tobj, *args)
|
215
|
+
_raise_event(_event_forge(_event_signature, _tobj),*args)
|
216
|
+
end
|
217
|
+
|
218
|
+
def _raise_event(_event, *args)
|
219
|
+
changed
|
220
|
+
notify_observers(_event, *args)
|
221
|
+
if self.class != ArcadiaContract
|
222
|
+
self.class.superclass.instance._raise_event(_event, *args)
|
223
|
+
end
|
224
|
+
end
|
225
|
+
#protected :_raise_event
|
226
|
+
|
227
|
+
def raise_action(_event_signature, _tobj, *args)
|
228
|
+
_raise_action(_event_forge(_event_signature, _tobj),*args)
|
229
|
+
end
|
230
|
+
|
231
|
+
def _raise_action(_event, *args)
|
232
|
+
_event.action = true
|
233
|
+
_raise_event(_event, *args)
|
234
|
+
end
|
235
|
+
private :_raise_action
|
236
|
+
|
237
|
+
def ArcadiaContract.publish_action(_method)
|
238
|
+
_info = EventInfo.new(_method)
|
239
|
+
@@actions = Array.new if !defined?(@@actions)
|
240
|
+
@@actions << _info
|
241
|
+
end
|
242
|
+
|
243
|
+
end
|
244
|
+
|
245
|
+
class ArcadiaContractListener
|
246
|
+
def initialize(_subscriber, _class, _method, _channel=nil)
|
247
|
+
@subscriber = _subscriber
|
248
|
+
@class = _class
|
249
|
+
@method = _method
|
250
|
+
@channel = _channel
|
251
|
+
create_callback(_class.instance)
|
252
|
+
end
|
253
|
+
|
254
|
+
def create_callback(_contract)
|
255
|
+
ObserverCallbackContract.new(_contract, @subscriber, @method, @channel)
|
256
|
+
end
|
257
|
+
|
258
|
+
end
|
259
|
+
|
260
|
+
class ArcadiaContractListenerThread < ArcadiaContractListener
|
261
|
+
|
262
|
+
def create_callback(_contract)
|
263
|
+
#Thread.new do super(_contract, _subscriber, _method) end
|
264
|
+
ObserverCallbackContractThread.new(_contract, @subscriber, @method, @channel)
|
265
|
+
end
|
266
|
+
|
267
|
+
end
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
#class AeContractListener
|
273
|
+
# def initialize(_arcadia)
|
274
|
+
#
|
275
|
+
# end
|
276
|
+
# def listen_on(_aeclip_name, _method_update_to_call=:update)
|
277
|
+
# end
|
278
|
+
# def update(_tobj)
|
279
|
+
# end
|
280
|
+
#end
|