arcadia 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,15 @@
1
+ name=output2
2
+ label=Event Log
3
+ frame=1.1
4
+ active=yes
5
+ require=ext/ae-output/ae-output
6
+ class=Output
7
+ MsgContract.channel=CH1
8
+
9
+
10
+ font=courier 7
11
+ font.bold=courier 9 bold
12
+ i386-freebsd6:font=courier 10
13
+ i386-freebsd6:font.bold=courier 12 bold
14
+ i386-mswin32:font={Courier New} 9
15
+ i386-mswin32:font.bold={Courier New} 9 bold
@@ -0,0 +1,14 @@
1
+ name=output
2
+ label=Output
3
+ frame=1.1
4
+ active=yes
5
+ require=ext/ae-output/ae-output
6
+ class=Output
7
+ MsgContract.channel=0
8
+
9
+ font=courier 7
10
+ font.bold=courier 9 bold
11
+ i386-freebsd6:font=courier 12
12
+ i386-freebsd6:font.bold=courier 12 bold
13
+ i386-mswin32:font={Courier New} 9
14
+ i386-mswin32:font.bold={Courier New} 9 bold
@@ -0,0 +1,162 @@
1
+ #
2
+ # ae-output.rb - Arcadia Ruby ide
3
+ # by Antonio Galeone <antonio-galeone@rubyforge.org>
4
+ #
5
+
6
+ require "tk"
7
+ require "base/a-utils"
8
+
9
+ class OutputView
10
+ attr_reader :text
11
+ def initialize(parent=nil)
12
+
13
+ left_frame = TkFrame.new(parent.frame).place('x' => '0','y' => '0','relheight' => '1','width' => '25')
14
+
15
+ @button_u = Tk::BWidget::Button.new(left_frame){
16
+ image TkPhotoImage.new('dat' => CLEAR_GIF)
17
+ helptext 'Clear'
18
+ foreground 'blue'
19
+ command proc{parent.main_frame.text.delete('1.0','end')}
20
+ relief 'groove'
21
+ pack('side' =>'top', 'anchor'=>'n',:padx=>0, :pady=>0)
22
+ }
23
+
24
+
25
+ #@splitted_frame = AGTkVSplittedFrames.new(parent.frame,20)
26
+ @text = TkText.new(parent.frame,
27
+ 'relief' => 'sunken',
28
+ 'font' => parent.conf('font')
29
+ ){|j|
30
+ TkScrollbar.new(j){|s|
31
+ command proc{|*args| j.yview(*args)}
32
+ j.yscrollcommand proc{|first,last| s.set first,last}
33
+ }.pack('side'=>'right', 'fill'=>'y')
34
+ }.place('relwidth' => '1','x' => '25','y' => '0','relheight' => '1', 'width' => '-25')
35
+ @text.tag_configure('simple_msg',
36
+ 'background' => '#d9d994',
37
+ 'borderwidth'=>1,
38
+ 'relief'=> 'flat'
39
+ )
40
+ @text.tag_configure('debug_msg',
41
+ 'background' => '#f6c9f6',
42
+ 'foreground' => '#000000',
43
+ 'borderwidth'=>1,
44
+ 'relief'=> 'flat'
45
+ )
46
+ @text.tag_configure('bord_msg',
47
+ #'foreground' => '#b9b8b9'
48
+ 'foreground' => '#7c9b10'
49
+ )
50
+
51
+ end
52
+ end
53
+
54
+ class Output < ArcadiaExt
55
+ attr_reader :main_frame
56
+
57
+ def before_build
58
+ ArcadiaContractListener.new(self, MsgContract, :do_msg_event)
59
+ #_frame = @arcadia.layout.register_panel('_rome_',@name, 'Output')
60
+ @main_frame = OutputView.new(self)
61
+ @run_threads = Array.new
62
+ @main_frame.text.tag_configure('error','foreground' => 'red')
63
+ end
64
+
65
+
66
+ def build
67
+ #@ae_file_contract = @arcadia.retrieve_contract(self, EditorActionContract, :file_state)
68
+ end
69
+
70
+ def after_build
71
+ MainContract.instance.raise_extension(MainContract::TMainObj.new(self,
72
+ 'domain'=>@arcadia['conf'][@name+'.frame'],
73
+ 'extension' =>@name,
74
+ 'channel'=>conf('MsgContract.channel')
75
+
76
+ ))
77
+ end
78
+
79
+ def format_time(_time)
80
+ _time.strftime("at %a %d-%b-%Y %H:%M:%S")
81
+ end
82
+
83
+ def do_msg_event(_event)
84
+ _txt = "\n+--- "+format_time(_event.time)+" ---+\n"+_event.context.text.strip+"\n"
85
+ _index_begin = @main_frame.text.index('end')
86
+ @main_frame.text.insert(_index_begin,_txt)
87
+ _index_end = @main_frame.text.index('end')
88
+ if _event.context.type == MsgContract::TYPE_DEBUG
89
+ @main_frame.text.tag_remove('simple_msg',_index_begin, _index_end+ ' lineend')
90
+ @main_frame.text.tag_add('debug_msg',_index_begin, _index_end+ ' lineend')
91
+ parse_debug(_index_begin.split('.')[0].to_i)
92
+ else
93
+ @main_frame.text.tag_remove('debug_msg',_index_begin, _index_end+ ' lineend')
94
+ @main_frame.text.tag_add('simple_msg',_index_begin, _index_end+ ' lineend')
95
+ end
96
+ @main_frame.text.tag_add('bord_msg',_index_begin+' linestart', _index_begin+ ' lineend')
97
+ @main_frame.text.tag_add('bord_msg',_index_end+' -1 lines linestart', _index_end+ ' -1 lines lineend')
98
+ @main_frame.text.see(_index_end)
99
+ end
100
+
101
+ def parse_debug(_from_row=0)
102
+ _row = 0
103
+ _cursor = @main_frame.text.cget('cursor')
104
+ @main_frame.text.value.each{|l|
105
+ _row = _row+1
106
+ if _row >= _from_row
107
+ _end = 0
108
+ m = /([\.\/]*[\/A-Za-z_\-\.]*[\.\/\w\d]*\.rb):(\d*)/.match(l)
109
+ while m
110
+ _txt = m.post_match
111
+ if m[1] && m[2]
112
+ _file = m[1]
113
+ _line = m[2]
114
+ _ibegin = _row.to_s+'.'+(m.begin(1)+_end).to_s
115
+ _iend = _row.to_s+'.'+(m.end(2)+_end).to_s
116
+ _end = m.end(2) + _end
117
+ @main_frame.text.tag_configure(_row,
118
+ 'foreground' => '#800000',
119
+ 'borderwidth'=>0,
120
+ 'relief'=>'flat',
121
+ 'underline'=>true
122
+ )
123
+ @main_frame.text.tag_add(_row,_ibegin,_iend)
124
+ @main_frame.text.tag_bind(_row,"Double-ButtonPress-1",
125
+ proc{
126
+ _tobj = EditorContract::TEditorObj.new(self)
127
+ _tobj.file= _file
128
+ _tobj.line= _line
129
+ EditorContract.instance.open_file(_tobj)
130
+ }
131
+ )
132
+ @main_frame.text.tag_bind(_row,"Enter",
133
+ proc{@main_frame.text.configure('cursor'=> 'hand2')}
134
+ )
135
+ @main_frame.text.tag_bind(_row,"Leave",
136
+ proc{@main_frame.text.configure('cursor'=> _cursor)}
137
+ )
138
+
139
+
140
+
141
+ end
142
+ m = /([A-Za-z]*[\.:]{0,1}[\/\w\d]*\.rb):(\d*)/.match(_txt)
143
+ end
144
+ end
145
+ }
146
+ end
147
+
148
+ def out(_txt=nil, _tag=nil)
149
+ if @main_frame && _txt
150
+ if _tag
151
+ @main_frame.text.insert('end',_txt, _tag)
152
+ else
153
+ @main_frame.text.insert('end',_txt)
154
+ end
155
+ end
156
+ end
157
+
158
+ def outln(_txt=nil, _tag=nil)
159
+ self.out(_txt+"\n",_tag)
160
+ end
161
+
162
+ end
@@ -0,0 +1,7 @@
1
+ name=palette
2
+ label=Palette
3
+ frame=0.0
4
+ active=yes
5
+ require=ext/ae-palette/ae-palette
6
+ class=Palette
7
+
@@ -0,0 +1,319 @@
1
+ #
2
+ # ae-palette.rb - Arcadia Ruby ide
3
+ # by Antonio Galeone <antonio-galeone@rubyforge.org>
4
+ #
5
+
6
+ #require 'ext/ae-inspector/ae-inspector'
7
+ require 'base/a-libs'
8
+ require 'lib/tk/al-tk'
9
+ require 'tk'
10
+ require 'tkmenubar'
11
+ require 'tkextlib/bwidget'
12
+
13
+
14
+ class Palette < ArcadiaExt
15
+ attr_reader :buttons
16
+ attr_reader :selected_wrapper
17
+
18
+ def before_build
19
+ ArcadiaContractListener.new(self, InspectorContract, :do_inspector_event)
20
+ ArcadiaContractListener.new(self, PaletteContract, :do_palette_event)
21
+ end
22
+
23
+ def build
24
+ #@ae_inspector_action_contract = @arcadia.retrieve_contract(self, InspectorActionContract)
25
+ #@main_frame = @arcadia.layout.register_panel('_tokyo_','libman', 'Libman')
26
+ @buttons = Hash.new
27
+ create_palettes
28
+ end
29
+
30
+ def after_build
31
+ #p @ae_inspector_talker.info
32
+ #exit
33
+ end
34
+
35
+ def do_inspector_event(_event)
36
+ case _event.signature
37
+ when InspectorContract::SELECT_WRAPPER
38
+ @selected_wrapper=_event.context.wrapper
39
+ end
40
+
41
+ end
42
+
43
+ def do_palette_event(_event)
44
+ case _event.signature
45
+ when PaletteContract::MAKE_SELECTED_WRAPPER
46
+ give_me_obj(_event.context.parent)
47
+ end
48
+ end
49
+
50
+ def eval_form_file(_filename)
51
+ cod = '';
52
+ IO.foreach(_filename) { |line| cod += line };
53
+ Revparsel.new(cod, _filename)
54
+ end
55
+
56
+
57
+ def eval_file(_filename)
58
+ cod = '';
59
+ begin
60
+ IO.foreach(_filename) { |line| cod += line }
61
+ rescue SystemCallError
62
+ handleException # defined elsewhere
63
+ end
64
+ eval(cod)
65
+ end
66
+
67
+ # def eval_file_saved(_filename=nil)
68
+ # if _filename && (_filename.length > 0)
69
+ # @arcadia.objects('editor').open_file(_filename)
70
+ # end
71
+ # end
72
+
73
+ def create_palettes
74
+ @cc = WrapperContainer.new(self){
75
+ border 0
76
+ borderwidth 1
77
+ }
78
+ @cc.pack('side' =>'left', 'fill' =>'both', 'anchor'=>'nw', :padx=>2, :pady=>2)
79
+ #place('x'=>0, 'y'=>0,'relheight'=>1, 'relwidth'=>1)
80
+ @arcadia.libs.list.each{|lib|
81
+ @cc.add_palette(lib)
82
+ }
83
+ end
84
+
85
+ def give_me_obj(_owner)
86
+ @cc.new_wrapper(_owner)
87
+ end
88
+
89
+ def give_me_code
90
+ @cc.new_wrapper_code
91
+ end
92
+
93
+ end
94
+
95
+ class WrapperContainer < TkFrame
96
+
97
+ def initialize(_owner)
98
+ super(_owner.frame)
99
+ @owner = _owner
100
+ _self = self
101
+ frame = TkFrame.new(self).pack('side' =>'left', 'anchor'=>'n', :padx=>2, :pady=>2)
102
+
103
+ @button_u = Tk::BWidget::Button.new(frame){
104
+ image TkPhotoImage.new('dat' => CURSOR_GIF)
105
+ helptext 'Select'
106
+ text 'C'
107
+ foreground 'blue'
108
+ command proc{_self.unfill}
109
+ relief 'groove'
110
+ pack('side' =>'top', 'anchor'=>'n',:padx=>2, :pady=>2)
111
+ }
112
+ @button_m = Tk::BWidget::Button.new(frame){
113
+ _command = proc{
114
+ require 'tk/clipboard'
115
+ #objiinfo = _owner.ae_inspector_talker.info
116
+ #_code = $arcadia['objic'].active.active_object.renderer.class_code.to_s
117
+ #_code = objiinfo.active_wrapper.renderer.class_code.to_s
118
+ _code = AG.active.renderer.class_code.to_s if AG.active
119
+ TkClipboard::set(_code)
120
+ eval(_code)
121
+ _self.fill(
122
+ self,
123
+ _owner.selected_wrapper.class,
124
+ nil,
125
+ _owner.selected_wrapper.getInstanceClass
126
+ )
127
+ _self.new_wrapper if _owner.selected_wrapper.class.is_top
128
+
129
+ }
130
+ image TkPhotoImage.new('dat' => WIDGET_COPY_GIF)
131
+ helptext 'Copy current selected'
132
+ text 'C'
133
+ foreground 'blue'
134
+ command _command
135
+ relief 'groove'
136
+ pack('side' =>'left','anchor'=>'n', :padx=>2, :pady=>2)
137
+ }
138
+ @familyts = Tk::BWidget::NoteBook.new(self){
139
+ tabbevelsize 0
140
+ internalborderwidth 1
141
+ activeforeground 'orange'
142
+ font $arcadia['conf']['main.font']
143
+ pack('side' =>'left','expand'=>'yes','fill'=>'both', :padx=>2, :pady=>2)
144
+ }
145
+ @objCollections = Array.new
146
+ end
147
+
148
+ def new_wrapper_code
149
+ _code = ''
150
+ if @selected_button != nil && @selected_class_obj != nil
151
+ #objiinfo = @owner.ae_inspector_talker.info
152
+ #_code = objiinfo.active_wrapper.renderer.class_code.to_s
153
+ _code = AG.active.renderer.class_code.to_s
154
+ @selected_button.configure('relief'=>'groove')
155
+ @selected_button = @selected_class = @selected_require = nil
156
+ end
157
+ return _code
158
+ end
159
+
160
+
161
+ def new_wrapper(_parent = nil, _obj = nil)
162
+ if @selected_button == nil
163
+ return
164
+ end
165
+ # copy obj
166
+ if @selected_class_obj != nil && _obj == nil
167
+ _obj = eval(@selected_class_obj).new(_parent == nil ?nil:_parent.obj)
168
+ end
169
+
170
+ w = @selected_class.new(_parent, _obj)
171
+ #$arcadia['objic'].active.select_last(true) if @selected_class_obj != nil
172
+ #$arcadia.objects('objic').active.addRequire(@selected_require) if @selected_require != nil
173
+
174
+
175
+ w.select.activate if @selected_class_obj != nil
176
+ w.add_require([@selected_require]) if @selected_require != nil
177
+
178
+ @selected_button.configure('relief'=>'groove')
179
+ @selected_button = @selected_class = @selected_require = nil
180
+ end
181
+
182
+
183
+ def fill(_b, _class, _require, _class_obj = nil)
184
+ _b.configure('relief'=>'sunken')
185
+ if @selected_button != nil
186
+ @selected_button.configure('relief'=>'groove')
187
+ end
188
+ @selected_button = _b
189
+ @selected_class = _class
190
+ @selected_require = _require
191
+ @selected_class_obj = _class_obj
192
+ Arcadia.instance.layout.domain(Arcadia.instance['conf']['palette.frame'])['root'].top_text(_class.class_wrapped)
193
+
194
+ end
195
+
196
+ def unfill
197
+ if @selected_button != nil
198
+ @selected_button.configure('relief'=>'groove')
199
+ end
200
+ @selected_button = nil
201
+ @selected_class = nil
202
+ @selected_require = nil
203
+ @selected_class_obj = nil
204
+ Arcadia.instance.layout.domain(Arcadia.instance['conf']['palette.frame'])['root'].top_text('')
205
+ end
206
+
207
+ def add_palette(_lib_obj)
208
+ _name = _lib_obj.arcadia_lib_params.name
209
+ _file = _lib_obj.arcadia_lib_params.require
210
+ _img = nil
211
+ @objCollections << {
212
+ 'name'=>_name,
213
+ 'collection'=>_lib_obj,
214
+ 'file'=>_file,
215
+ 'img'=>_img
216
+ }
217
+
218
+ @classes_panel = @familyts.insert('end',_name,
219
+ 'text'=>_name#,
220
+ )
221
+
222
+ @tpanel = TkText.new(@classes_panel){
223
+ relief 'flat'
224
+ }.pack('side' =>'left', 'anchor'=>'nw', :padx=>2, :pady=>2)
225
+
226
+
227
+ _lib_obj.classes.each{|value|
228
+ _self = self
229
+ _image = self.class_image(value)
230
+ ewin = TkTextWindow.new(@tpanel, 'end',
231
+ 'window'=> Tk::BWidget::Button.new(@tpanel){
232
+ _command = proc{
233
+ _self.fill(self, value, _file)
234
+ _self.new_wrapper if value.is_top
235
+ }
236
+ text value.class_wrapped.to_s
237
+ helptext value.class_wrapped.to_s
238
+ image TkPhotoImage.new( 'dat' => _image )
239
+ foreground 'blue'
240
+ command _command
241
+ font $arcadia['conf']['main.component.font']
242
+ relief 'groove'
243
+ height 25
244
+ width 25
245
+ #pack('side' =>'left', 'anchor'=>'nw', :padx=>2, :pady=>2)
246
+ }
247
+ )
248
+ }
249
+
250
+
251
+ # _lib_obj.classes.each{|value|
252
+ # _self = self
253
+ # _image = self.class_image(value)
254
+ # ewin = TkTextWindow.new(@tpanel, 'end',
255
+ # 'window'=> Tk::BWidget::Button.new(@tpanel){
256
+ # _command = proc{
257
+ # _self.fill(self, value, _file)
258
+ # _self.new_wrapper if value.is_top
259
+ # }
260
+ # text value.class_wrapped.to_s
261
+ # helptext value.class_wrapped.to_s
262
+ # image TkPhotoImage.new( 'dat' => _image )
263
+ # foreground 'blue'
264
+ # command _command
265
+ # font $arcadia['conf']['main.component.font']
266
+ # relief 'groove'
267
+ # pack('side' =>'left', 'anchor'=>'nw', :padx=>2, :pady=>2)
268
+ # }
269
+ # )
270
+ # }
271
+
272
+ # _lib_obj.classes.each{|value|
273
+ # _self = self
274
+ # _image = self.class_image(value)
275
+ # Tk::BWidget::Button.new(@classes_panel){
276
+ # _command = proc{
277
+ # _self.fill(self, value, _file)
278
+ # _self.new_wrapper if value.is_top
279
+ # }
280
+ # text value.class_wrapped.to_s
281
+ # helptext value.class_wrapped.to_s
282
+ # image TkPhotoImage.new( 'dat' => _image )
283
+ # foreground 'blue'
284
+ # command _command
285
+ # font $arcadia['conf']['main.component.font']
286
+ # relief 'groove'
287
+ # pack('side' =>'left', 'anchor'=>'nw', :padx=>2, :pady=>2)
288
+ # }
289
+ #
290
+ # }
291
+
292
+ if @objCollections.length == 1
293
+ @familyts.raise(_name)
294
+ end
295
+ end
296
+
297
+ def class_image(_class=nil)
298
+ _current_class = _class
299
+ _found = false
300
+ if _class
301
+ _dir = File.dirname(_class.library.arcadia_lib_params.source)
302
+ end
303
+ while _current_class != nil && !_found
304
+ if defined?(_current_class.library)
305
+ _dir = File.dirname(_current_class.library.arcadia_lib_params.source)
306
+ end
307
+ _img = (_current_class.to_s+"_gif").upcase
308
+ _data = eval(_img + ' if defined?('+_img+')' )
309
+ #_file = _dir+"/res/"+_current_class.to_s+".gif"
310
+ if _data
311
+ #if FileTest.exist?(_file)
312
+ _found = true
313
+ else
314
+ _current_class = _current_class.superclass
315
+ end
316
+ end
317
+ return (_found)?_data:A_WIDGET_GIF
318
+ end
319
+ end