arcadia 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +90 -28
  3. data/conf/LC/en-UK.LANG +6 -0
  4. data/conf/LC/ru-RU.LANG +0 -0
  5. data/conf/arcadia.conf +8 -4
  6. data/conf/arcadia.res.rb +86 -1
  7. data/conf/theme-dark.conf +2 -1
  8. data/ext/ae-breakpoints/ae-breakpoints.rb +1 -1
  9. data/ext/ae-dir-projects/ae-dir-projects.rb +42 -6
  10. data/ext/ae-editor/ae-editor.rb +227 -120
  11. data/ext/ae-editor/langs/coderay.tokens +0 -0
  12. data/ext/ae-editor/langs/conf.lang +0 -0
  13. data/ext/ae-editor/langs/css.lang +0 -0
  14. data/ext/ae-editor/langs/html.lang +0 -0
  15. data/ext/ae-editor/langs/java.lang +0 -0
  16. data/ext/ae-editor/langs/python.lang +0 -0
  17. data/ext/ae-editor/langs/ruby.lang +0 -0
  18. data/ext/ae-editor/langs/text.lang +0 -0
  19. data/ext/ae-editor/langs/xml.lang +0 -0
  20. data/ext/ae-editor/lib/rbeautify.rb +0 -0
  21. data/ext/ae-file-history/ae-file-history.rb +4 -3
  22. data/ext/ae-output/ae-output.rb +44 -31
  23. data/ext/ae-ruby-debug/ae-ruby-debug.conf +3 -2
  24. data/ext/ae-ruby-debug/ae-ruby-debug.rb +1 -0
  25. data/ext/ae-search-in-files/ae-search-in-files.rb +3 -3
  26. data/ext/ae-search-in-files/ext/ack-in-files/ack-in-files.conf +0 -0
  27. data/ext/ae-search-in-files/ext/ack-in-files/ack-in-files.rb +0 -0
  28. data/ext/ae-shell/ae-shell.rb +37 -15
  29. data/ext/ae-subprocess-inspector/ae-subprocess-inspector.rb +14 -8
  30. data/ext/ae-subprocess-inspector/butterfly.res +0 -0
  31. data/ext/ae-subprocess-inspector/process.res +0 -0
  32. data/ext/ae-subprocess-inspector/space-invader.res +0 -0
  33. data/ext/ae-term/ae-term.conf +0 -0
  34. data/ext/ae-term/ae-term.rb +0 -0
  35. data/ext/test-shutdown-after-startup/test-shutdown-after-startup.conf +0 -0
  36. data/ext/test-shutdown-after-startup/test-shutdown-after-startup.rb +0 -0
  37. data/lib/a-commons.rb +1 -1
  38. data/lib/a-contracts.rb +13 -3
  39. data/lib/a-core.rb +612 -142
  40. data/lib/a-tkcommons.rb +661 -50
  41. data/lib/anigif.rb +0 -0
  42. data/lib/iosync.rb +71 -0
  43. data/tcl/anigif/anigif.tcl +0 -0
  44. data/tcl/anigif/pkgIndex.tcl +0 -0
  45. metadata +5 -2
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -93,6 +93,7 @@ class FilesHistrory < ArcadiaExt
93
93
  def on_build(_event)
94
94
  @h_stack = Hash.new
95
95
  @h_stack_changed = false
96
+ #@content_root = Tk::ScrollFrame.new(self.frame.hinner_frame).pack('fill'=>'both', :padx=>0, :pady=>0, :expand => 'yes').baseframe
96
97
  @bookmarks_frame = TkFrame.new(self.frame.hinner_frame)
97
98
  @history_frame = TkFrame.new(self.frame.hinner_frame).pack('fill'=>'both', :padx=>0, :pady=>0, :expand => 'yes')
98
99
  @panel = self.frame.root.add_panel(self.frame.name, "sync");
@@ -181,7 +182,7 @@ class FilesHistrory < ArcadiaExt
181
182
  _selected = @htree.selected
182
183
  _dir, _file = _selected.sub("%%%",":").split('@@@')
183
184
  if _dir && _file.nil? && File.ftype(node2file(_dir)) == 'directory'
184
- _file = Arcadia.open_file_dialog(node2file(_dir))
185
+ _file = Arcadia.select_file_dialog(node2file(_dir))
185
186
  #Tk.getOpenFile('initialdir'=>node2file(_dir))
186
187
  if _file && _file.strip.length > 0
187
188
  Arcadia.process_event(OpenBufferTransientEvent.new(self,'file'=>_file))
@@ -209,8 +210,8 @@ class FilesHistrory < ArcadiaExt
209
210
  font @font_italic
210
211
  cursor nil
211
212
  }
212
- @hlist.bind_append('KeyPress'){|e| Tk.callback_break }
213
- @hlist.bind_append('KeyRelease'){|e| Tk.callback_break }
213
+ @hlist.bind_append('KeyPress'){Tk.callback_break }
214
+ @hlist.bind_append('KeyRelease'){Tk.callback_break }
214
215
  @hlist.extend(TkScrollableWidget)
215
216
  @hlist.tag_configure("file_selected", 'foreground' => Arcadia.conf('hightlight.link.foreground'))
216
217
  build_list
@@ -68,7 +68,7 @@ class OutputView
68
68
  'background'=>Arcadia.conf('hightlight.sel.background'),
69
69
  'foreground'=>Arcadia.conf('hightlight.sel.foreground')
70
70
  )
71
- @text.bind_append("KeyPress"){|e| input(e.keysym)}
71
+ @text.bind_append("KeyPress", "%K"){|_keysym| input(_keysym)}
72
72
  @input_buffer = nil
73
73
  pop_up_menu
74
74
  end
@@ -172,7 +172,8 @@ class Output < ArcadiaExt
172
172
  attr_reader :main_frame
173
173
  attr_reader :prompt
174
174
  MARKSUF='mark-'
175
- PROMPT_SIMBOL='$'
175
+ # PROMPT_SIMBOL='$'
176
+ PROMPT_SIMBOL='>'
176
177
  def on_before_build(_event)
177
178
  #ArcadiaContractListener.new(self, MsgContract, :do_msg_event)
178
179
  @tag_seq = 0
@@ -308,6 +309,8 @@ class Output < ArcadiaExt
308
309
  lines = @main_frame.text.value.to_a[_from_row.._to_row]
309
310
  end
310
311
 
312
+ # p "parso "
313
+
311
314
  if lines
312
315
  lines.each{|l|
313
316
  _row = _row+1
@@ -343,36 +346,46 @@ class Output < ArcadiaExt
343
346
  end
344
347
 
345
348
  def file_binding(_file, _line, _ibegin, _iend)
346
- if _file == '<<current buffer>>'
347
- _file = "*CURR"
349
+ if defined?(@file_binding)
350
+ while @file_binding
351
+ sleep(1)
352
+ end
348
353
  end
349
- _line = '0' if _line.nil? || _line.strip.length == 0
350
- tag_name = next_tag_name
351
- @main_frame.text.tag_configure(tag_name,
352
- 'foreground' => Arcadia.conf('hightlight.link.foreground'),
353
- 'borderwidth'=>0,
354
- 'relief'=>'flat',
355
- 'underline'=>true
356
- )
357
- @main_frame.text.tag_add(tag_name,_ibegin,_iend)
358
- #@main_frame.text.tag_bind(tag_name,"Double-ButtonPress-1",
359
- @main_frame.text.tag_bind(tag_name,"ButtonPress-1",
360
- proc{
361
- Arcadia.process_event(OpenBufferTransientEvent.new(self,'file'=>_file, 'row'=>_line))
362
- }
363
- )
364
- @main_frame.text.tag_bind(tag_name,"Enter",
365
- proc{@main_frame.text.configure('cursor'=> 'hand2')}
366
- )
367
- @main_frame.text.tag_bind(tag_name,"Leave",
368
- proc{@main_frame.text.configure('cursor'=> @cursor)}
369
- )
370
-
371
- if @main_frame.auto_open_file?
372
- Arcadia.process_event(OpenBufferTransientEvent.new(self,'file'=>_file, 'row'=>_line))
373
- self.frame.show
374
- @main_frame.text.set_focus
375
- @main_frame.text.see("end")
354
+ @file_binding=true
355
+ begin
356
+ if _file == '<<current buffer>>'
357
+ _file = "*CURR"
358
+ end
359
+ _line = '0' if _line.nil? || _line.strip.length == 0
360
+ tag_name = next_tag_name
361
+ @main_frame.text.tag_configure(tag_name,
362
+ 'foreground' => Arcadia.conf('hightlight.link.foreground'),
363
+ 'borderwidth'=>0,
364
+ 'relief'=>'flat',
365
+ 'underline'=>true
366
+ )
367
+ @main_frame.text.tag_add(tag_name,_ibegin,_iend)
368
+ #@main_frame.text.tag_bind(tag_name,"Double-ButtonPress-1",
369
+ @main_frame.text.tag_bind(tag_name,"ButtonPress-1",
370
+ proc{OpenBufferTransientEvent.new(self,'file'=>_file, 'row'=>_line).go!}
371
+ # proc{OpenBufferEvent.new(self,'file'=>_file, 'row'=>_line).go!}
372
+ )
373
+ @main_frame.text.tag_bind(tag_name,"Enter",
374
+ proc{@main_frame.text.configure('cursor'=> 'hand2')}
375
+ )
376
+ @main_frame.text.tag_bind(tag_name,"Leave",
377
+ proc{@main_frame.text.configure('cursor'=> @cursor)}
378
+ )
379
+
380
+ if @main_frame.auto_open_file?
381
+ OpenBufferEvent.new(self,'file'=>_file, 'row'=>_line, 'debug'=>'yes').go!
382
+ # OpenBufferEvent.new(self,'file'=>_file, 'row'=>_line).go!
383
+ self.frame.show
384
+ @main_frame.text.set_focus
385
+ @main_frame.text.see("end")
386
+ end
387
+ ensure
388
+ @file_binding = false
376
389
  end
377
390
  end
378
391
 
@@ -4,14 +4,15 @@ name=ruby-debug
4
4
  frames=0.0,1.1
5
5
  frames.labels=Debug Inspector,Debug Server
6
6
  frames.names=ruby_debug_inspector,ruby_debug_server
7
- active=yes
7
+ active=no
8
+ 1.9:@:active=yes
8
9
  require=ext/ae-ruby-debug/ae-ruby-debug
9
10
  class=RubyDebug
10
11
  #gems=ruby-debug,whichr
11
12
  #1.9:@:gems=ruby-debug19,whichr
12
13
  gems=ruby-debug
13
14
  1.9:@:gems=debugger
14
- 2:@:gems=debugger
15
+ 2:@:gems=
15
16
  #========================================
16
17
  #========================================
17
18
  server.host=localhost
@@ -802,6 +802,7 @@ class RubyDebugServer
802
802
  def start_session(_debug_event, _host='localhost', _remote_port='8989')
803
803
  _filename = _debug_event.file
804
804
  commandLine = "#{Arcadia.ruby} #{@rdebug_file} --host #{_host} --port #{_remote_port} -sw '#{_filename}'"
805
+ #commandLine = "#{Arcadia.ruby} -r debug --host #{_host} --port #{_remote_port} -sw '#{_filename}'"
805
806
  #p commandLine
806
807
  begin
807
808
  @alive = true
@@ -33,8 +33,8 @@ class SearchInFiles < ArcadiaExt
33
33
  @find.b_go.bind('1', proc{update_all_combo;do_find}) # add trigger to button
34
34
  #@find.b_go.bind('1', proc{Thread.new{update_all_combo;do_find}}) # add trigger to button
35
35
 
36
- enter_proc = proc {|e|
37
- case e.keysym
36
+ enter_proc = proc {|_keysym|
37
+ case _keysym
38
38
  when 'Return'
39
39
  if @find.visible?
40
40
  update_all_combo
@@ -46,7 +46,7 @@ class SearchInFiles < ArcadiaExt
46
46
 
47
47
  #for method in [:e_what_entry, :e_filter_entry, :e_dir_entry] do
48
48
  for method in [:e_what, :e_filter, :e_dir] do
49
- @find.send(method).bind_append('KeyPress') { |*args| enter_proc.call *args } # ltodo why can't we pass it in like &enter_proc?
49
+ @find.send(method).bind_append('KeyPress', "%K") { |_keysym| enter_proc.call _keysym } # ltodo why can't we pass it in like &enter_proc?
50
50
  end
51
51
  @find.title(title)
52
52
  end
@@ -134,9 +134,25 @@ class Shell < ArcadiaExt
134
134
  @@next_number = 0
135
135
  def on_run_cmd(_event)
136
136
  if _event.cmd
137
- #p "_event.cmd = #{_event.cmd}"
138
137
  begin
138
+ if _event.prompt
139
+ hd_args = {
140
+ 'type'=>'ok_cancel',
141
+ 'msg'=>_event.title,
142
+ 'title' => _event.title,
143
+ 'prompt' => _event.prompt,
144
+ 'level' => 'info'
145
+ }
146
+
147
+ hd_event = HinnerDialogEvent.new(self, hd_args).go!
148
+ end
149
+ if _event.file
150
+ process_name = _event.file
151
+ else
152
+ process_name = "#{_event.cmd[0..8]} ..."
153
+ end
139
154
  output_mark = Arcadia.console(self,'msg'=>"Running #{_event.title} as #{_event.lang}...", 'level'=>'info') # info?
155
+ output_mark = Arcadia.console(self,'msg'=>_event.cmd, 'level'=>'info', 'mark'=>output_mark)
140
156
  start_time = Time.now
141
157
  @arcadia['pers']['run.file.last']=_event.file if _event.persistent
142
158
  @arcadia['pers']['run.cmd.last']=_event.cmd if _event.persistent
@@ -147,6 +163,7 @@ class Shell < ArcadiaExt
147
163
  output_file_name = "out_#{@@next_number += 1}_#{Process.pid}.txt"
148
164
  output = File.open(output_file_name, 'wb')
149
165
  child = Process.create :command_line => _event.cmd, :startup_info => {:stdout => output, :stderr => output}
166
+ RunCmdStartedEvent.new(self, 'parent'=>_event).shot!
150
167
  #----
151
168
  abort_action = proc{
152
169
  Process.kill(9,child.process_id)
@@ -154,23 +171,27 @@ class Shell < ArcadiaExt
154
171
  alive_check = proc{
155
172
  WMI::Win32_Process.find(:first, :conditions => {:ProcessId => child.process_id})
156
173
  }
157
- Arcadia.process_event(SubProcessEvent.new(self,'pid'=>child.process_id, 'name'=>_event.file,'abort_action'=>abort_action, 'alive_check'=>alive_check))
174
+ Arcadia.process_event(SubProcessEvent.new(self,'pid'=>child.process_id, 'name'=>process_name,'abort_action'=>abort_action, 'alive_check'=>alive_check))
158
175
  #----
159
176
  timer=nil
160
177
  procy = proc {
161
178
  still_alive = WMI::Win32_Process.find(:first, :conditions => {:ProcessId => child.process_id})
162
179
  if !still_alive #&& File.exists?(output_file_name)
163
- output.close
164
- timer.stop
165
- File.open(output_file_name, 'r') do |f|
166
- _readed = f.read
167
- _readed.strip!
168
-
169
- _readed += "\n" + Arcadia.text('ext.shell.done', [_event.title, Time.now - start_time])
170
- output_mark = Arcadia.console(self,'msg'=>_readed, 'level'=>'debug', 'mark'=>output_mark)
171
- _event.add_result(self, 'output'=>_readed)
180
+ begin
181
+ output.close
182
+ timer.stop
183
+ File.open(output_file_name, 'r') do |f|
184
+ _readed = f.read
185
+ _readed.strip!
186
+
187
+ _readed += "\n" + Arcadia.text('ext.shell.done', [_event.title, Time.now - start_time])
188
+ output_mark = Arcadia.console(self,'msg'=>_readed, 'level'=>'debug', 'mark'=>output_mark)
189
+ _event.add_result(self, 'output'=>_readed)
190
+ end
191
+ File.delete output_file_name
192
+ ensure
193
+ RunCmdEndedEvent.new(self, 'parent'=>_event).shot!
172
194
  end
173
- File.delete output_file_name
174
195
  end
175
196
  }
176
197
 
@@ -189,10 +210,10 @@ class Shell < ArcadiaExt
189
210
  Open3.popen3(_cmd_){|stdin, stdout, stderr, th|
190
211
  fi_pid = th.pid if th
191
212
  output_mark = Arcadia.console(self,'msg'=>" [pid #{fi_pid}]", 'level'=>'info', 'mark'=>output_mark, 'append'=>true)
213
+ RunCmdStartedEvent.new(self, 'parent'=>_event).shot!
192
214
  alive_check = proc{th.status != false}
193
- abort_action = proc{Process.kill(9,fi_pid.to_i)}
194
-
195
- Arcadia.process_event(SubProcessEvent.new(self, 'pid'=>fi_pid, 'name'=>_event.file,'abort_action'=>abort_action, 'alive_check'=>alive_check))
215
+ abort_action = proc{Process.kill(9,fi_pid.to_i); th.exit}
216
+ Arcadia.process_event(SubProcessEvent.new(self, 'pid'=>fi_pid, 'name'=>process_name, 'abort_action'=>abort_action, 'alive_check'=>alive_check))
196
217
 
197
218
  to = Thread.new(stdout) do |tout|
198
219
  begin
@@ -200,6 +221,7 @@ class Shell < ArcadiaExt
200
221
  output_mark = Arcadia.console(self,'msg'=>line, 'level'=>'debug', 'mark'=>output_mark)
201
222
  _event.add_result(self, 'output'=>line)
202
223
  end
224
+ RunCmdEndedEvent.new(self, 'parent'=>_event).shot!
203
225
  rescue Exception => e
204
226
  output_mark = Arcadia.console(self,'msg'=>e.to_s, 'level'=>'debug', 'mark'=>output_mark)
205
227
  end
@@ -20,7 +20,7 @@ class SubProcessInspector < ArcadiaExt
20
20
  def on_exit_query(_event)
21
21
  _event.can_exit=true
22
22
  @processs.each{|pr|
23
- if !pr.nil?
23
+ if !pr.nil? && pr.event.abort_dialog_yes != false
24
24
  message = Arcadia.text("ext.spi.d.exit_query.msg")
25
25
  r=Arcadia.hinner_dialog(self,
26
26
  'type'=>'yes_no',
@@ -106,13 +106,19 @@ class SubProcessWidget
106
106
  def initialize(_parent=nil, _event=nil, *args)
107
107
  @parent = _parent
108
108
  @event = _event
109
+ @anigif = _event.anigif.nil? ? "process.res" : _event.anigif
110
+ abort_dialog_yes = _event.abort_dialog_yes.nil? || _event.abort_dialog_yes == true
109
111
  b_command = proc{
110
- message = Arcadia.text('ext.spi.d.kill.msg', [_event.pid, _event.name])
111
- r=Arcadia.hinner_dialog(self,
112
- 'type'=>'yes_no',
113
- 'level'=>'warning',
114
- 'title'=> Arcadia.text('ext.spi.d.kill.title'),
115
- 'msg'=>message)
112
+ if abort_dialog_yes
113
+ message = Arcadia.text('ext.spi.d.kill.msg', [_event.pid, _event.name])
114
+ r=Arcadia.hinner_dialog(self,
115
+ 'type'=>'yes_no',
116
+ 'level'=>'warning',
117
+ 'title'=> Arcadia.text('ext.spi.d.kill.title'),
118
+ 'msg'=>message)
119
+ else
120
+ r="yes"
121
+ end
116
122
  if r=="yes"
117
123
  _event.abort_action.call
118
124
  end
@@ -131,7 +137,7 @@ class SubProcessWidget
131
137
  text l_text
132
138
  pack('side' =>'left', :padx=>2, :pady=>0)
133
139
  }
134
- Tk::Anigif.image(@label, "#{Dir.pwd}/ext/ae-subprocess-inspector/process.res")
140
+ Tk::Anigif.image(@label, "#{Dir.pwd}/ext/ae-subprocess-inspector/#{@anigif}")
135
141
 
136
142
  @button = Arcadia.wf.toolbutton(Arcadia['toolbar'].frame){
137
143
  command b_command
File without changes
File without changes
File without changes
@@ -1099,7 +1099,7 @@ module Persistable
1099
1099
  if f
1100
1100
  if _persistent_hash
1101
1101
  _persistent_hash.each{|key,value|
1102
- f.syswrite(key+'='+value+"\n")
1102
+ f.syswrite(key+'='+value+"\n") if key && value
1103
1103
  }
1104
1104
  end
1105
1105
  end
@@ -116,7 +116,7 @@ class NewBufferEvent < BufferEvent
116
116
  end
117
117
 
118
118
  class OpenBufferEvent < BufferEvent
119
- attr_accessor :select_index
119
+ attr_accessor :select_index, :debug
120
120
  end
121
121
 
122
122
  class OpenBufferTransientEvent < OpenBufferEvent
@@ -182,6 +182,9 @@ end
182
182
  class BufferClosedEvent < BufferEvent
183
183
  end
184
184
 
185
+ class DeleteFileBufferEvent < BufferEvent
186
+ end
187
+
185
188
  # +---------------------------------------------+
186
189
  # Bookmark event
187
190
  # +---------------------------------------------+
@@ -252,7 +255,7 @@ class MsgEvent < ArcadiaEvent
252
255
  end
253
256
 
254
257
  class SubProcessEvent < ArcadiaEvent
255
- attr_accessor :abort_action, :alive_check, :name, :pid, :timeout, :timecheck
258
+ attr_accessor :abort_action, :alive_check, :name, :pid, :timeout, :timecheck, :abort_dialog_yes, :anigif
256
259
  end
257
260
 
258
261
  class SubProcessProgressEvent < SubProcessEvent
@@ -313,6 +316,13 @@ class RunCmdEvent < ArcadiaEvent
313
316
  attr_accessor :persistent
314
317
  attr_accessor :runner_name
315
318
  attr_accessor :lang
319
+ attr_accessor :prompt
320
+ end
321
+
322
+ class RunCmdStartedEvent < RunCmdEvent
323
+ end
324
+
325
+ class RunCmdEndedEvent < RunCmdEvent
316
326
  end
317
327
 
318
328
  class InputKeyboardQueryEvent < ArcadiaEvent
@@ -375,7 +385,7 @@ class DialogEvent < ArcadiaEvent
375
385
  class Result < Result
376
386
  attr_accessor :value
377
387
  end
378
- attr_accessor :title, :msg, :type, :level, :exception
388
+ attr_accessor :title, :msg, :type, :level, :exception, :prompt
379
389
  end
380
390
 
381
391
  class SystemDialogEvent < DialogEvent
@@ -21,12 +21,13 @@ class Arcadia < TkApplication
21
21
  attr_reader :wf
22
22
  attr_reader :mf_root
23
23
  attr_reader :localization
24
+ attr_reader :exts
24
25
  def initialize
25
26
  @initialized=false
26
27
  super(
27
28
  ApplicationParams.new(
28
29
  'arcadia',
29
- '1.0.0',
30
+ '1.1.0',
30
31
  'conf/arcadia.conf',
31
32
  'conf/arcadia.pers'
32
33
  )
@@ -53,7 +54,7 @@ class Arcadia < TkApplication
53
54
  #_title = "Arcadia Ruby ide :: [Platform = #{RUBY_PLATFORM}] [Ruby version = #{RUBY_VERSION}] [TclTk version = #{tcltk_info.level}]"
54
55
  _title = "Arcadia"
55
56
  @root = TkRoot.new(
56
- 'background'=> self['conf']['background']
57
+ 'background'=> self['conf']['background']
57
58
  ){
58
59
  title _title
59
60
  withdraw
@@ -69,12 +70,10 @@ class Arcadia < TkApplication
69
70
  @mf_root = Tk::BWidget::MainFrame.new(@root,
70
71
  'background'=> self['conf']['background'],
71
72
  'height'=> 0
72
- ){
73
- #menu @main_menu_bar
74
- }.pack(
75
- 'anchor'=> 'center',
76
- 'fill'=> 'both',
77
- 'expand'=> 1
73
+ ).pack(
74
+ 'anchor'=> 'center',
75
+ 'fill'=> 'both',
76
+ 'expand'=> 1
78
77
  )
79
78
  #.place('x'=>0,'y'=>0,'relwidth'=>1,'relheight'=>1)
80
79
 
@@ -179,6 +178,10 @@ class Arcadia < TkApplication
179
178
  # @focus_event_manager = FocusEventManager.new
180
179
  end
181
180
 
181
+ def root_height
182
+ @root.winfo_height
183
+ end
184
+
182
185
  def initialized?
183
186
  @initialized
184
187
  end
@@ -662,54 +665,123 @@ class Arcadia < TkApplication
662
665
  #@layout.build_invert_menu
663
666
  end
664
667
 
665
- def load_runners
666
- self['runners'] = Hash.new
667
- self['runners_by_ext'] = Hash.new
668
- self['runners_by_lang'] = Hash.new
668
+ def refresh_runners_on_menu(root_menu=nil, _file=nil, _dir=nil)
669
+ return if root_menu.nil?
670
+ if !root_menu.index('end').nil?
671
+ index_end = root_menu.index('end')-1
672
+ root_menu.delete('0',index_end)
673
+ end
674
+ self['runners'].each{|name, run|
675
+ newrun = {}.update(run)
676
+ newrun[:file] = _file if !_file.nil?
677
+ newrun[:dir] = _dir if !_dir.nil?
678
+ insert_runner_item(root_menu, name, newrun)
679
+ }
680
+ end
681
+
682
+ def reload_runners
669
683
  mr = Arcadia.menu_root('runcurr')
670
684
  return if mr.nil?
685
+ self['runners'].clear if self['runners']
686
+ self['runners_by_ext'].clear if self['runners_by_ext']
687
+ self['runners_by_lang'].clear if self['runners_by_lang']
688
+ index_end = mr.index('end')-1
689
+ mr.delete('0',index_end)
690
+ load_runners
691
+ end
671
692
 
672
- insert_runner_item = proc{|name, run|
673
- if run[:file_exts]
674
- run[:file_exts].split(',').each{|ext|
675
- self['runners_by_ext'][ext.strip.sub('.','')]=run
676
- }
677
- end
678
- if run[:lang]
679
- self['runners_by_lang'][run[:lang]]=run
680
- end
681
- if run[:runner] && self['runners'][run[:runner]]
682
- run = Hash.new.update(self['runners'][run[:runner]]).update(run)
683
- #self['runners'][name]=run
684
- end
685
- if run[:image]
686
- image = Arcadia.image_res(run[:image])
687
- else
688
- image = Arcadia.file_icon(run[:file_exts])
689
- end
690
- _run_title = run[:title]
691
- run[:title] = nil
692
- run[:runner_name] = name
693
- _command = proc{
694
- _event = Arcadia.process_event(
695
- RunCmdEvent.new(self, run)
696
- )
693
+ def insert_runner_item(root_menu=nil, name, run)
694
+ return if root_menu.nil?
695
+ if run[:file_exts]
696
+ run[:file_exts].split(',').each{|ext|
697
+ self['runners_by_ext'][ext.strip.sub('.','')]=run
697
698
  }
698
- if run[:pos]
699
- pos = run[:pos]
700
- else
701
- pos = '0'
702
- end
703
- args = {
704
- :image => image,
705
- :label => _run_title,
706
- :compound => 'left',
707
- :command => _command
708
- }
709
- args[:font] = Arcadia.conf('menu.font') #if !OS.mac?
710
-
711
- mr.insert(pos, :command , args)
699
+ end
700
+ if run[:lang]
701
+ self['runners_by_lang'][run[:lang]]=run
702
+ end
703
+ if run[:runner] && self['runners'][run[:runner]]
704
+ run = Hash.new.update(self['runners'][run[:runner]]).update(run)
705
+ #self['runners'][name]=run
706
+ end
707
+ if run[:image]
708
+ image = Arcadia.image_res(run[:image])
709
+ else
710
+ image = Arcadia.file_icon(run[:file_exts])
711
+ end
712
+ _run_title = run[:title]
713
+ #run[:title] = nil
714
+ run[:runner_name] = name
715
+ _command = proc{
716
+ _event = Arcadia.process_event(
717
+ RunCmdEvent.new(self, run)
718
+ )
712
719
  }
720
+ if run[:pos]
721
+ pos = run[:pos]
722
+ else
723
+ pos = '0'
724
+ end
725
+ args = {
726
+ :image => image,
727
+ :label => _run_title,
728
+ :compound => 'left',
729
+ :command => _command
730
+ }
731
+ args[:font] = Arcadia.conf('menu.font') #if !OS.mac?
732
+
733
+ root_menu.insert(pos, :command , args)
734
+ end
735
+
736
+
737
+ def load_runners
738
+ self['runners'] = Hash.new if self['runners'].nil?
739
+ self['runners_by_ext'] = Hash.new if self['runners_by_ext'].nil?
740
+ self['runners_by_lang'] = Hash.new if self['runners_by_lang'].nil?
741
+ mr = Arcadia.menu_root('runcurr')
742
+ return if mr.nil?
743
+
744
+ # insert_runner_item = proc{|name, run|
745
+ # if run[:file_exts]
746
+ # run[:file_exts].split(',').each{|ext|
747
+ # self['runners_by_ext'][ext.strip.sub('.','')]=run
748
+ # }
749
+ # end
750
+ # if run[:lang]
751
+ # self['runners_by_lang'][run[:lang]]=run
752
+ # end
753
+ # if run[:runner] && self['runners'][run[:runner]]
754
+ # run = Hash.new.update(self['runners'][run[:runner]]).update(run)
755
+ # #self['runners'][name]=run
756
+ # end
757
+ # if run[:image]
758
+ # image = Arcadia.image_res(run[:image])
759
+ # else
760
+ # image = Arcadia.file_icon(run[:file_exts])
761
+ # end
762
+ # _run_title = run[:title]
763
+ # #run[:title] = nil
764
+ # run[:runner_name] = name
765
+ # _command = proc{
766
+ # _event = Arcadia.process_event(
767
+ # RunCmdEvent.new(self, run)
768
+ # )
769
+ # }
770
+ # if run[:pos]
771
+ # pos = run[:pos]
772
+ # else
773
+ # pos = '0'
774
+ # end
775
+ # args = {
776
+ # :image => image,
777
+ # :label => _run_title,
778
+ # :compound => 'left',
779
+ # :command => _command
780
+ # }
781
+ # args[:font] = Arcadia.conf('menu.font') #if !OS.mac?
782
+ #
783
+ # mr.insert(pos, :command , args)
784
+ # }
713
785
 
714
786
  insert_runner_instance_item = proc{|name, run|
715
787
  if run[:runner] && self['runners'][run[:runner]]
@@ -741,7 +813,7 @@ class Arcadia < TkApplication
741
813
  }
742
814
 
743
815
  #conf runner
744
- runs=Arcadia.conf_group('runners')
816
+ runs=Arcadia.conf_group('runners', true)
745
817
  mr.insert('0', :separator) if runs && !runs.empty?
746
818
 
747
819
  runs.each{|name, hash_string|
@@ -749,19 +821,21 @@ class Arcadia < TkApplication
749
821
  }
750
822
 
751
823
  self['runners'].each{|name, run|
752
- insert_runner_item.call(name, run)
824
+ #insert_runner_item.call(name, run)
825
+ insert_runner_item(mr, name, run)
753
826
  }
754
827
 
755
828
 
756
829
  #conf exts runner
757
830
  @exts.each{|ext|
758
831
  if ext_active?(ext)
759
- ext_runs=Arcadia.conf_group("#{ext}.runners")
832
+ ext_runs=Arcadia.conf_group("#{ext}.runners", true)
760
833
  mr.insert(self['runners'].count, :separator) if ext_runs && !ext_runs.empty?
761
834
  ext_runs.each{|name, hash_string|
762
835
  self['runners'][name]=eval hash_string
763
836
  self['runners'][name][:pos]=self['runners'].count
764
- insert_runner_item.call(name, self['runners'][name])
837
+ #insert_runner_item.call(name, self['runners'][name])
838
+ insert_runner_item(mr, name, self['runners'][name])
765
839
  }
766
840
  end
767
841
  }
@@ -769,7 +843,7 @@ class Arcadia < TkApplication
769
843
 
770
844
 
771
845
  # pers runner instance
772
- runs=Arcadia.pers_group('runners')
846
+ runs=Arcadia.pers_group('runners', true)
773
847
  mr.insert('0', :separator) if runs && !runs.empty?
774
848
  pers_runner = Hash.new
775
849
  runs.each{|name, hash_string|
@@ -786,12 +860,16 @@ class Arcadia < TkApplication
786
860
  end
787
861
 
788
862
  def manage_runners
789
- if !@runm
863
+ if !@runm || @runm.nil?
790
864
  @runm = RunnerManager.new(Arcadia.layout.root)
791
- @runm.on_close=proc{@runm.hide}
865
+ @runm.on_close=proc{@runm = nil}
866
+ @runm.clear_items
867
+ @runm.load_tips
868
+ @runm.load_items(:runtime)
869
+ @runm.load_items(:config)
792
870
  end
793
- @runm.show
794
- @runm.load_items
871
+ #@runm.show
872
+ #@runm.load_items
795
873
  end
796
874
 
797
875
  def register_key_binding(_self_target, k, v)
@@ -802,8 +880,8 @@ class Arcadia < TkApplication
802
880
  if key_dits[1]
803
881
  key_sym=key_dits[1][0..-2]
804
882
  end
805
- @root.bind_append(key_event){|e|
806
- if key_sym == e.keysym
883
+ @root.bind_append(key_event, "%K"){|_keysym|
884
+ if key_sym == _keysym
807
885
  Arcadia.process_event(_self_target.instance_eval(value))
808
886
  end
809
887
  }
@@ -897,6 +975,8 @@ class Arcadia < TkApplication
897
975
  'title' => Arcadia.text("main.d.confirm_exit.title"),
898
976
  'level' => 'question')=='yes')
899
977
  if q1 && can_exit?
978
+ @root.geometry('1x1-1-1')
979
+ #ArcadiaAboutSplash.new.deiconify
900
980
  do_finalize
901
981
  @root.destroy
902
982
  # Tk.mainloop_exist?
@@ -1106,6 +1186,10 @@ class Arcadia < TkApplication
1106
1186
  Configurable.properties_group(_path, Arcadia.instance['conf'], 'conf', _refresh)
1107
1187
  end
1108
1188
 
1189
+ def Arcadia.conf_group_without_local(_path, _refresh=false)
1190
+ Configurable.properties_group(_path, Arcadia.instance['conf_without_local'], 'conf_without_local', _refresh)
1191
+ end
1192
+
1109
1193
  def Arcadia.conf_group_copy(_path_source, _path_target, _suff = 'conf')
1110
1194
  _target = conf_group(_path_source)
1111
1195
  _postfix = _path_target.sub(_path_source,"")
@@ -1172,12 +1256,12 @@ class Arcadia < TkApplication
1172
1256
  Tk.getOpenFile 'initialdir' => MonitorLastUsedDir.get_last_dir
1173
1257
  end
1174
1258
 
1175
- def Arcadia.open_file_dialog(_initial_dir=MonitorLastUsedDir.get_last_dir)
1176
- HinnerFileDialog.new.file(_initial_dir)
1259
+ def Arcadia.select_file_dialog(_initial_dir=MonitorLastUsedDir.get_last_dir, _label=nil)
1260
+ HinnerFileDialog.new(HinnerFileDialog::SELECT_FILE_MODE, nil, _label).file(_initial_dir)
1177
1261
  end
1178
1262
 
1179
- def Arcadia.select_dir_dialog(_initial_dir=MonitorLastUsedDir.get_last_dir, must_exist = nil)
1180
- HinnerFileDialog.new(HinnerFileDialog::SELECT_DIR_MODE, must_exist).dir(_initial_dir)
1263
+ def Arcadia.select_dir_dialog(_initial_dir=MonitorLastUsedDir.get_last_dir, must_exist = nil, _label=nil)
1264
+ HinnerFileDialog.new(HinnerFileDialog::SELECT_DIR_MODE, must_exist, _label).dir(_initial_dir)
1181
1265
  end
1182
1266
 
1183
1267
  def Arcadia.save_file_dialog(_initial_dir=MonitorLastUsedDir.get_last_dir)
@@ -1196,6 +1280,10 @@ class Arcadia < TkApplication
1196
1280
  end
1197
1281
  end
1198
1282
 
1283
+ def Arcadia.open_string_dialog(_label=nil)
1284
+ HinnerStringDialog.new(_label).string
1285
+ end
1286
+
1199
1287
  def Arcadia.is_windows?
1200
1288
  OS.windows?
1201
1289
  #RUBY_PLATFORM =~ /mingw|mswin/
@@ -1360,6 +1448,12 @@ class Arcadia < TkApplication
1360
1448
  end
1361
1449
  end
1362
1450
 
1451
+ def Arcadia.extensions
1452
+ if @@instance && @@instance.exts
1453
+ return @@instance.exts
1454
+ end
1455
+ end
1456
+
1363
1457
  def Arcadia.runtime_error(_e, _title=Arcadia.text("main.e.runtime.title"))
1364
1458
  ArcadiaProblemEvent.new(self, "type"=>ArcadiaProblemEvent::RUNTIME_ERROR_TYPE,"title"=>"#{_title} : [#{_e.class}] #{_e.message} at :", "detail"=>_e.backtrace).go!
1365
1459
  end
@@ -1707,26 +1801,104 @@ class ArcadiaMainMenu < ArcadiaUserControl
1707
1801
 
1708
1802
  end
1709
1803
 
1710
- class RunnerManager < TkFloatTitledFrame
1711
- class RunnerMangerItem < TkFrame
1712
- def initialize(_parent=nil, _runner_hash=nil, *args)
1713
- super(_parent, Arcadia.style('panel'))
1804
+ #class RunnerManager < TkFloatTitledFrame
1805
+ class RunnerManager < HinnerSplittedDialogTitled
1806
+ ROW_GAP = 25
1807
+ attr_reader :ext_width, :name_width, :title_width, :cmd_width
1808
+ class RunnerMangerItem # < TkFrame
1809
+ attr_reader :runner_hash , :readonly
1810
+ def initialize(_runner_manager, _parent=nil, _runner_hash=nil, _row=0, _state_array=nil, *args)
1811
+ #super(_parent, Arcadia.style('panel'))
1714
1812
  @runner_hash = _runner_hash
1715
- Tk::BWidget::Label.new(self,
1716
- 'image'=> Arcadia.file_icon(_runner_hash[:file_exts]),
1717
- 'relief'=>'flat').pack('side' =>'left')
1718
- Tk::BWidget::Label.new(self,
1719
- 'text'=>_runner_hash[:title],
1720
- 'helptext'=>_runner_hash[:file],
1721
- 'compound'=>:left,
1722
- 'relief'=>'flat').pack('fill'=>'x','side' =>'left')
1723
- _close_command = proc{
1813
+ @readonly = _state_array && _state_array.include?(:disabled)
1814
+ @enable_close_button = !@readonly || _runner_hash[:origin] == 'runtime'
1815
+
1816
+ @h_hash = {}
1817
+
1818
+ p_update_height = proc{|tktext|
1819
+ index = tktext.index('end -1 chars')
1820
+ r,c = index.split('.')
1821
+ if tktext.cget('wrap') != 'none'
1822
+ w = tktext.width
1823
+ h = ((c.to_i-1)/w.to_i).round + 1
1824
+ else
1825
+ h = r.to_i
1826
+ end
1827
+ h_to_set = h
1828
+ @h_hash.each{|k,v| h_to_set = v if k != tktext && v > h_to_set }
1829
+ @h_hash[tktext] = h
1830
+ if tktext.height != h_to_set
1831
+ tktext.height(h_to_set)
1832
+ @h_hash.each{|k,v|
1833
+ p_update_height.call(k) if k != tktext
1834
+ }
1835
+
1836
+ end
1837
+ }
1838
+
1839
+ row_fill = false
1840
+
1841
+ # ICON
1842
+ @ttklicon = Arcadia.wf.label(_parent,
1843
+ 'image'=> _runner_hash[:image].nil? ? Arcadia.file_icon(_runner_hash[:file_exts]) : Arcadia.image_res(_runner_hash[:image]) ,
1844
+ 'relief'=>'flat').grid(:column => 0, :row => _row, :sticky => "W", :padx=>1, :pady=>1)
1845
+ @ttklicon.state(:disabled) if @readonly
1846
+
1847
+ # NAME
1848
+ @ename_old = _runner_hash[:name]
1849
+ @ttkename = Arcadia.wf.text(_parent, 'width' => _runner_manager.name_width,
1850
+ "height" => 1).hint(_runner_hash[:file]).grid(:column => 1, :row => _row, :sticky => "WE", :padx=>1, :pady=>1)
1851
+ @ttkename.insert('end', _runner_hash[:name])
1852
+ @ttkename.state(:disabled) && @ttkename.fg('darkgray') if @readonly
1853
+
1854
+ row_fill = row_fill || @ttkename.value.strip.length > 0
1855
+
1856
+ # TITLE
1857
+ @etitle_old = _runner_hash[:title]
1858
+ @ttketitle = Arcadia.wf.text(_parent, 'width' => _runner_manager.title_width,
1859
+ "height" => 1).hint(_runner_hash[:file]).grid(:column => 2, :row => _row, :sticky => "WE", :padx=>1, :pady=>1)
1860
+ @ttketitle.insert('end', _runner_hash[:title])
1861
+ @ttketitle.state(:disabled) && @ttketitle.fg('darkgray') if @readonly
1862
+
1863
+ row_fill = row_fill || @ttketitle.value.strip.length > 0
1864
+
1865
+ # CMD
1866
+ @ecmd_old = _runner_hash[:cmd]
1867
+ @ttkecmd = Arcadia.wf.text(_parent, 'width' => _runner_manager.cmd_width, 'wrap'=>'word',
1868
+ "height" => 1).grid(:column => 3, :row => _row, :sticky => "WE", :padx=>1, :pady=>1)
1869
+ @ttkecmd.insert('end', _runner_hash[:cmd])
1870
+ @ttkecmd.state(:disabled) && @ttkecmd.fg('darkgray') if @readonly
1871
+
1872
+ row_fill = row_fill || @ttkecmd.value.strip.length > 0
1873
+
1874
+ # FILE EXTS
1875
+ @eexts_old = _runner_hash[:file_exts]
1876
+ @ttkeexts = Arcadia.wf.text(_parent, 'width' => _runner_manager.ext_width,
1877
+ "height" => 1).grid(:column => 4, :row => _row, :sticky => "WE", :padx=>1, :pady=>1)
1878
+ @ttkeexts.insert('end', _runner_hash[:file_exts])
1879
+ @ttkeexts.state(:disabled) && @ttkeexts.fg('darkgray') if @readonly
1880
+
1881
+ row_fill = row_fill || @ttkeexts.value.strip.length > 0
1882
+
1883
+ # COPY BUTTON
1884
+ copy_command = proc{ _runner_manager.do_add(self) }
1885
+ @ttkbcopy = Arcadia.wf.toolbutton(_parent,
1886
+ 'command'=> copy_command,
1887
+ 'image'=> Arcadia.image_res(COPY_GIF)
1888
+ ).grid(:column => 5, :row => _row, :sticky => "W", :padx=>1, :pady=>1)
1889
+
1890
+ # DELETE BUTTON
1891
+ close_command = proc{
1724
1892
  if (Arcadia.hinner_dialog(self, 'type'=>'yes_no',
1725
1893
  'msg'=> Arcadia.text("main.d.confirm_delete_runner.msg", [_runner_hash[:name]]),
1726
1894
  'title' => Arcadia.text("main.d.confirm_delete_runner.title"),
1727
1895
  'level' => 'question')=='yes')
1728
1896
 
1729
- Arcadia.unpersistent("runners.#{_runner_hash[:name]}")
1897
+ if _runner_hash[:origin] == 'runtime'
1898
+ Arcadia.unpersistent("runners.#{_runner_hash[:name]}")
1899
+ else
1900
+ Arcadia.del_conf("runners.#{_runner_hash[:name]}")
1901
+ end
1730
1902
  mr = Arcadia.menu_root('runcurr')
1731
1903
  index_to_delete = -1
1732
1904
  i_end = mr.index('end')
@@ -1745,47 +1917,334 @@ class RunnerManager < TkFloatTitledFrame
1745
1917
  if index_to_delete > -1
1746
1918
  mr.delete(index_to_delete)
1747
1919
  end
1920
+ _runner_manager.do_delete_item(self)
1748
1921
  self.destroy
1749
1922
  end
1750
1923
  }
1751
- #Tk::BWidget::Button.new(self,
1752
- b = Arcadia.wf.toolbutton(self,
1753
- 'command'=>_close_command,
1754
- # 'helptext'=>@runner_hash[:file],
1755
- # 'background'=>'white',
1756
- 'image'=> Arcadia.image_res(TRASH_GIF)
1757
- # 'relief'=>'flat'
1758
- ).pack('side' =>'right','padx'=>0)
1759
- b.hint=@runner_hash[:file]
1924
+ @ttkbclose = Arcadia.wf.toolbutton(_parent,
1925
+ 'command'=> close_command,
1926
+ 'image'=> Arcadia.image_res(CLOSE_FRAME_GIF)
1927
+ ).grid(:column => 6, :row => _row, :sticky => "W", :padx=>1, :pady=>1)
1928
+ @ttkbclose.hint=@runner_hash[:file]
1929
+ @ttkbclose.state(:disabled) if !@enable_close_button
1930
+
1931
+ [@ttkename, @ttketitle, @ttkecmd, @ttkeexts].each{|tktext|
1932
+ p_update_height.call(tktext) if row_fill
1933
+ tktext.bind_append("KeyRelease"){p_update_height.call(tktext)}
1934
+ }
1935
+
1936
+ end
1937
+
1938
+ def destroy
1939
+ @ttklicon.destroy
1940
+ @ttkename.destroy
1941
+ @ttketitle.destroy
1942
+ @ttkecmd.destroy
1943
+ @ttkeexts.destroy
1944
+ @ttkbcopy.destroy
1945
+ @ttkbclose.destroy
1946
+ end
1947
+
1948
+ def hash_value
1949
+ ret = {}
1950
+ ret[:name]=@ttkename.value
1951
+ ret[:title]=@ttketitle.value
1952
+ ret[:cmd]=@ttkecmd.value
1953
+ ret[:file_exts]=@ttkeexts.value
1954
+ ret[:image]=@runner_hash[:image] if @runner_hash[:image]
1955
+ ret
1956
+ end
1957
+
1958
+ def name_change?
1959
+ @ename_old != @ttkename.value
1960
+ end
1961
+
1962
+ def title_change?
1963
+ @etitle_old != @ttketitle.value
1964
+ end
1760
1965
 
1761
- pack('side' =>'top','anchor'=>'nw','fill'=>'x','padx'=>5, 'pady'=>5)
1966
+ def cmd_change?
1967
+ @ecmd_old != @ttkecmd.value
1762
1968
  end
1763
1969
 
1970
+ def exts_change?
1971
+ @eexts_old != @ttkeexts.value
1972
+ end
1973
+
1974
+ def change?
1975
+ title_change? || cmd_change? || exts_change? || exts_change? || name_change?
1976
+ end
1977
+
1978
+ def reset_change
1979
+ @ename_old = @ttkename.value
1980
+ @etitle_old = @ttketitle.value
1981
+ @ecmd_old = @ttkecmd.value
1982
+ @eexts_old = @ttkeexts.value
1983
+ end
1764
1984
  end
1765
1985
 
1766
1986
  def initialize(_parent)
1767
- super(_parent)
1768
- title("Runners manager")
1987
+ super("Runners manager")
1988
+ @addb = @titled_frame.add_fixed_button('[Add Runner]',proc{do_add})
1989
+ @saveb = @titled_frame.add_fixed_button('[Save]',proc{do_save})
1990
+
1769
1991
  @items = Hash.new
1770
- place('x'=>100,'y'=>100,'height'=> 220,'width'=> 300)
1992
+ @content = Hash.new
1993
+ @content_root = Tk::ScrollFrame.new(self.hinner_frame).place('x'=>0, 'y'=>0, 'relheight'=>1, 'relwidth'=>1)
1994
+ @content_root_frame = @content_root.baseframe
1995
+
1996
+ #screen_width = TkWinfo.vrootwidth(self.hinner_frame) - 140
1997
+ #char_width = 8
1998
+
1999
+ font_metrics = TkFont.new(Arcadia.conf('edit.font')).metrics
2000
+ screen_width = TkWinfo.vrootwidth(self.hinner_frame) - 140
2001
+ font_metrics_hash = {}
2002
+ font_metrics.each{|a| font_metrics_hash[a[0]] = a[1] }
2003
+ char_width = font_metrics_hash["ascent"] - font_metrics_hash["descent"] - 1
2004
+
2005
+ screen_width_in_chars = screen_width.to_f/char_width
2006
+
2007
+ #proporzioni
2008
+ ext_part = 1
2009
+ name_part = 3
2010
+ title_part = 4
2011
+ cmd_part = 8
2012
+ tot_part = ext_part+name_part+title_part+cmd_part
2013
+ one_part = screen_width_in_chars/tot_part
2014
+
2015
+ @ext_width = (one_part*ext_part).round
2016
+ @name_width = (one_part*name_part).round
2017
+ @title_width = (one_part*title_part).round
2018
+ @cmd_width = (one_part*cmd_part).round
2019
+
2020
+ end
2021
+
2022
+ def do_close
2023
+ if something_has_changed?
2024
+ if Arcadia.dialog(self,
2025
+ 'type'=>'yes_no',
2026
+ 'msg'=> Arcadia.text("main.d.confirm_exit_runners_manager.msg"),
2027
+ 'title' => Arcadia.text("main.d.confirm_exit_runners_manager.title"),
2028
+ 'level' => 'question')!='yes'
2029
+ return
2030
+ end
2031
+ end
2032
+ super()
1771
2033
  end
1772
2034
 
1773
- def clear_items
1774
- @items.each_value{|i| i.destroy }
1775
- @items.clear
2035
+ def do_add(_runner_from=nil)
2036
+ if _runner_from
2037
+ runner_hash = _runner_from.hash_value
2038
+ runner_hash[:name]="copy of #{runner_hash[:name]}"
2039
+ else
2040
+ runner_hash = {}
2041
+ end
2042
+ @items[:config]["item#{@items[:config].count}"]=RunnerMangerItem.new(self, @content[:config], runner_hash, @items[:config].count+1)
2043
+ # @content[:config].pack
2044
+ # root_height = Arcadia.instance.root_height
2045
+ #
2046
+ # self.height(self.height + ROW_GAP) if self.height < root_height
2047
+ add_gap
2048
+ @content_root.yview_moveto('1.0')
2049
+ end
2050
+
2051
+ def add_gap
2052
+ #p @content_root.y_scrolled?
2053
+ root_height = Arcadia.instance.root_height
2054
+ if self.height < root_height/2
2055
+ self.height(self.height + ROW_GAP)
2056
+ @content_root.vscroll(true) if !@content_root.y_scrolled?
2057
+ end
2058
+ end
2059
+
2060
+ def del_gap
2061
+ self.height(self.height - ROW_GAP)
2062
+ end
2063
+
2064
+ def do_delete_item(_item, _tyme=:config)
2065
+ @items[:config].delete_if{|k,v| v == _item}
2066
+ del_gap
2067
+ #self.height(self.height - ROW_GAP)
1776
2068
  end
1777
2069
 
1778
- def load_items
1779
- clear_items
1780
- runs=Arcadia.pers_group('runners', true)
1781
- runs.each{|name, hash_string|
2070
+ def something_has_changed?
2071
+ ret = false
2072
+ @items.each_value{|i|
2073
+ i.each_value{|j|
2074
+ ret = ret || (!j.readonly && j.change?)
2075
+ break if ret
2076
+ }
2077
+ break if ret
2078
+ }
2079
+ ret
2080
+ end
2081
+
2082
+ def do_save
2083
+ items_saved = []
2084
+ @items.each_value{|i|
2085
+ i.each_value{|j|
2086
+ if !j.readonly && j.change?
2087
+ jhash = j.hash_value
2088
+ name = jhash[:name].gsub(" ", "_")
2089
+ Arcadia.conf("runners.#{name}", jhash.to_s)
2090
+ j.reset_change
2091
+ items_saved << name
2092
+ end
2093
+ }
2094
+ }
2095
+ Arcadia.instance.update_local_config
2096
+ Arcadia.instance.reload_runners
2097
+ if items_saved.count >0
2098
+ Arcadia.dialog(self,
2099
+ 'type'=>'ok',
2100
+ 'title' => "Save info",
2101
+ 'msg'=>"Saved #{items_saved.to_s}!",
2102
+ 'level'=>'info')
2103
+ else
2104
+ Arcadia.dialog(self,
2105
+ 'type'=>'ok',
2106
+ 'title' => "Save info",
2107
+ 'msg'=>"Nothing done!",
2108
+ 'level'=>'info')
2109
+ end
2110
+ end
2111
+
2112
+ def clear_items
2113
+ @items.each_value{|i|
2114
+ i.each_value{|j| j.destroy }
2115
+ i.clear
2116
+ }
2117
+ #@items.clear
2118
+ end
2119
+
2120
+ def load_tips
2121
+ # Runners keywords related the current file => <<FILE>>, <<DIR>>, <<FILE_BASENAME>>, <<FILE_BASENAME_WITHOUT_EXT>>, <<INPUT>>, <<INPUT_FILE>>
2122
+ # INPUT is required to user
2123
+ text = Arcadia.wf.text(@content_root_frame,
2124
+ "height" => 2,
2125
+ "bg" => '#009999'
2126
+ )
2127
+ text.pack('side' =>'top','anchor'=>'nw','fill'=>'x','padx'=>5, 'pady'=>5)
2128
+ text.insert("end", "Keywords => <<RUBY>>, <<FILE>>, <<DIR>>, <<FILE_BASENAME>>, <<FILE_BASENAME_WITHOUT_EXT>>, <<INPUT_FILE>>, <<INPUT_DIR>>, <<INPUT_STRING>>")
2129
+ add_gap
2130
+ #self.height(self.height + ROW_GAP)
2131
+ end
2132
+
2133
+ def load_titles(_content)
2134
+ bg = Arcadia.conf("titlelabel.background")
2135
+ fg = Arcadia.conf("titlelabel.foreground")
2136
+ # # ICON
2137
+ # Arcadia.wf.label(_content,
2138
+ # 'text'=> "" ,
2139
+ # 'background'=> bg,
2140
+ # 'relief'=>'flat').grid(:column => 0, :row => 0, :sticky => "WE", :padx=>1, :pady=>1)
2141
+
2142
+ # NAME
2143
+ Arcadia.wf.label(_content,
2144
+ 'text'=> "Name",
2145
+ 'background'=> bg,
2146
+ 'foreground'=> fg,
2147
+ 'relief'=>'flat').grid(:column => 1, :row => 0, :sticky => "WE", :padx=>1, :pady=>1)
2148
+
2149
+
2150
+ # TITLE
2151
+ Arcadia.wf.label(_content,
2152
+ 'text'=> "Title" ,
2153
+ 'background'=> bg,
2154
+ 'foreground'=> fg,
2155
+ 'relief'=>'flat').grid(:column => 2, :row => 0, :sticky => "WE", :padx=>1, :pady=>1)
2156
+
2157
+ # CMD
2158
+ Arcadia.wf.label(_content,
2159
+ 'text'=> "CMD" ,
2160
+ 'background'=> bg,
2161
+ 'foreground'=> fg,
2162
+ 'relief'=>'flat').grid(:column => 3, :row => 0, :sticky => "WE", :padx=>1, :pady=>1)
2163
+
2164
+ # FILE EXTS
2165
+ Arcadia.wf.label(_content,
2166
+ 'text'=> "Exts" ,
2167
+ 'background'=> bg,
2168
+ 'foreground'=> fg,
2169
+ 'relief'=>'flat').grid(:column => 4, :row => 0, :sticky => "WE", :padx=>1, :pady=>1)
2170
+ end
2171
+
2172
+ def load_items(_kind = :runtime)
2173
+ items = @items[_kind]
2174
+ if items.nil?
2175
+ items = @items[_kind] = Hash.new
2176
+ end
2177
+ if _kind == :runtime
2178
+ runs_pers=Arcadia.pers_group('runners', true)
2179
+ runs = {}
2180
+ runs_pers.each{|k, v|
2181
+ runs[k]="#{v}|||runtime"
2182
+ }
2183
+ elsif _kind == :config
2184
+ runs_with_local=Arcadia.conf_group('runners', true)
2185
+ runs_without_local = Arcadia.conf_group_without_local('runners', false)
2186
+ runs = {}
2187
+
2188
+ # loading extensions runners
2189
+ Arcadia.extensions.each{|ext|
2190
+ ext_runs = Arcadia.conf_group("#{ext}.runners", true)
2191
+ if ext_runs && !ext_runs.empty?
2192
+ ext_runs_enanched = {}
2193
+ ext_runs.each{|k, v|
2194
+ ext_runs_enanched[k]="#{v}|||#{ext}"
2195
+ }
2196
+ runs.update(ext_runs_enanched)
2197
+ end
2198
+ }
2199
+
2200
+ # loading main runners
2201
+ runs_with_local.each{|k,v|
2202
+ if runs_without_local.include?(k)
2203
+ runs[k]="#{v}|||main"
2204
+ else
2205
+ runs[k]=v
2206
+ end
2207
+ }
2208
+
2209
+ end
2210
+ @content[_kind] = Arcadia.wf.frame(@content_root_frame){padding "3 3 12 12"}
2211
+
2212
+ @content[_kind].pack('fill'=>'both', :padx=>0, :pady=>0, :expand => 'yes')
2213
+
2214
+
2215
+ #@content.extend(TkScrollableWidget).show
2216
+ # ICON
2217
+ TkGrid.columnconfigure(@content[_kind], 0, :weight => 0 , :uniform => 'a')
2218
+ # NAME
2219
+ TkGrid.columnconfigure(@content[_kind], 1, :weight => 1 )
2220
+ # TITLE
2221
+ TkGrid.columnconfigure(@content[_kind], 2, :weight => 2 )
2222
+ # CMD
2223
+ TkGrid.columnconfigure(@content[_kind], 3, :weight => 3 )
2224
+ # FILE EXTS
2225
+ TkGrid.columnconfigure(@content[_kind], 4, :weight => 1 )
2226
+ # COPY BUTTON
2227
+ TkGrid.columnconfigure(@content[_kind], 5, :weight => 0, :uniform => 'a' )
2228
+ # DELETE BUTTON
2229
+ TkGrid.columnconfigure(@content[_kind], 6, :weight => 0, :uniform => 'a' )
2230
+ TkGrid.propagate(@content[_kind], true)
2231
+ load_titles(@content[_kind])
2232
+ runs.keys.reverse.each{|name|
2233
+ hash_string = runs[name]
2234
+ hash_string, origin = hash_string.split("|||")
1782
2235
  item_hash = eval hash_string
1783
2236
  item_hash[:name]=name
1784
2237
  if item_hash[:runner] && Arcadia.runner(item_hash[:runner])
1785
2238
  item_hash = Hash.new.update(Arcadia.runner(item_hash[:runner])).update(item_hash)
1786
2239
  end
1787
- @items[name]=RunnerMangerItem.new(self.frame, item_hash)
1788
- }
2240
+ if origin
2241
+ item_hash[:origin] = origin
2242
+ state_array = [] << :disabled
2243
+ end
2244
+ items[name]=RunnerMangerItem.new(self, @content[_kind], item_hash, items.count+1, state_array)
2245
+ #self.height(self.height + ROW_GAP)
2246
+ add_gap
2247
+ }
1789
2248
  end
1790
2249
  end
1791
2250
 
@@ -1807,7 +2266,8 @@ class ArcadiaAboutSplash < TkToplevel
1807
2266
  @llogo = TkLabel.new(self){
1808
2267
  image Arcadia.image_res(A_LOGO_GIF)
1809
2268
  background _bgcolor
1810
- place('x'=> 20,'y' => 20)
2269
+ #place('x'=> 20,'y' => 20)
2270
+ place('x'=> 140,'y' => 55)
1811
2271
  }
1812
2272
 
1813
2273
 
@@ -1820,74 +2280,82 @@ class ArcadiaAboutSplash < TkToplevel
1820
2280
  # place('width' => '190','x' => 110,'y' => 10,'height' => 25)
1821
2281
  # }
1822
2282
 
2283
+ # @tkLabel1 = TkLabel.new(self){
2284
+ # image Arcadia.image_res(ARCADIA_JAP_WHITE_GIF)
2285
+ # background _bgcolor
2286
+ # justify 'left'
2287
+ # place('x' => 90,'y' => 10)
2288
+ # }
2289
+
1823
2290
  @tkLabel1 = TkLabel.new(self){
1824
- image Arcadia.image_res(ARCADIA_JAP_WHITE_GIF)
2291
+ image Arcadia.image_res(ARCADIA_7THE_GIF)
1825
2292
  background _bgcolor
1826
2293
  justify 'left'
1827
- place('x' => 90,'y' => 10)
2294
+ place('x' => 26,'y' => 10)
1828
2295
  }
1829
2296
 
1830
- @tkLabelRuby = TkLabel.new(self){
1831
- image Arcadia.image_res(RUBY_DOCUMENT_GIF)
1832
- background _bgcolor
1833
- place('x'=> 210,'y' => 12)
1834
- }
2297
+ # @tkLabelRuby = TkLabel.new(self){
2298
+ # image Arcadia.image_res(RUBY_DOCUMENT_GIF)
2299
+ # background _bgcolor
2300
+ # place('x'=> 210,'y' => 12)
2301
+ # }
2302
+
2303
+ # @tkLabel2 = TkLabel.new(self){
2304
+ # text 'Arcadia IDE'
2305
+ # background _bgcolor
2306
+ # foreground '#ffffff'
2307
+ # font Arcadia.instance['conf']['splash.subtitle.font']
2308
+ # justify 'left'
2309
+ # place('x' => 100,'y' => 40,'height' => 19)
2310
+ # }
1835
2311
 
1836
- @tkLabel2 = TkLabel.new(self){
1837
- text 'Arcadia IDE'
1838
- background _bgcolor
1839
- foreground '#ffffff'
1840
- font Arcadia.instance['conf']['splash.subtitle.font']
1841
- justify 'left'
1842
- place('x' => 100,'y' => 40,'height' => 19)
1843
- }
1844
2312
  @tkLabelVersion = TkLabel.new(self){
1845
2313
  text Arcadia.text('main.about.version', [$arcadia['applicationParams'].version])
1846
2314
  background _bgcolor
1847
- foreground '#ffffff'
2315
+ foreground '#009999'
1848
2316
  font Arcadia.instance['conf']['splash.version.font']
1849
2317
  justify 'left'
1850
- place('x' => 100,'y' => 65,'height' => 19)
2318
+ #place('x' => 100,'y' => 65,'height' => 19)
2319
+ place('x' => 28,'y' => 47,'height' => 19)
1851
2320
  }
1852
2321
  @tkLabel21 = TkLabel.new(self){
1853
- text Arcadia.text("main.about.by", ['Antonio Galeone - 2004/2014'])
2322
+ text Arcadia.text("main.about.by", ['Antonio Galeone - 2004/2015'])
1854
2323
  background _bgcolor
1855
- foreground '#ffffff'
2324
+ foreground '#009999'
1856
2325
  font Arcadia.instance['conf']['splash.credits.font']
1857
2326
  justify 'left'
1858
2327
  anchor 'w'
1859
- place('width' => '220','x' => 100,'y' => 95,'height' => 25)
2328
+ place('width' => '220','x' => 28,'y' => 32,'height' => 19)
1860
2329
  }
1861
2330
 
1862
- @tkLabelCredits = TkLabel.new(self){
1863
- text Arcadia.text("main.about.contributors", ['Roger D. Pack'])
1864
- background _bgcolor
1865
- foreground '#ffffff'
1866
- font Arcadia.instance['conf']['splash.credits.font']
1867
- justify 'left'
1868
- anchor 'w'
1869
- place('width' => '210','x' => 100,'y' => 115,'height' => 25)
1870
- }
2331
+ # @tkLabelCredits = TkLabel.new(self){
2332
+ # text Arcadia.text("main.about.contributors", ['Roger D. Pack'])
2333
+ # background _bgcolor
2334
+ # foreground '#ffffff'
2335
+ # font Arcadia.instance['conf']['splash.credits.font']
2336
+ # justify 'left'
2337
+ # anchor 'w'
2338
+ # place('width' => '210','x' => 100,'y' => 115,'height' => 25)
2339
+ # }
1871
2340
 
1872
2341
  @tkLabelStep = TkLabel.new(self){
1873
2342
  text ''
1874
2343
  background _bgcolor
1875
- foreground '#666666'
2344
+ foreground '#009999'
1876
2345
  font Arcadia.instance['conf']['splash.banner.font']
1877
2346
  justify 'left'
1878
2347
  anchor 'w'
1879
- place('width'=>-5,'relwidth' => 1,'x' => 5,'y' => 160,'height' => 45)
2348
+ place('width'=>-28,'relwidth' => 1,'x' => 28,'y' => 160,'height' => 45)
1880
2349
  }
1881
2350
  @progress = TkVariable.new
1882
2351
  reset
1883
- _width = 380
2352
+ _width = 345
1884
2353
  _height = 210
1885
2354
  #_width = 0;_height = 0
1886
2355
  _x = TkWinfo.screenwidth(self)/2 - _width / 2
1887
2356
  _y = TkWinfo.screenheight(self)/2 - _height / 2
1888
2357
  geometry = _width.to_s+'x'+_height.to_s+'+'+_x.to_s+'+'+_y.to_s
1889
2358
  Tk.tk_call('wm', 'geometry', self, geometry )
1890
- #bind("ButtonPress-1", proc{self.destroy})
1891
2359
  bind("Double-Button-1", proc{self.destroy})
1892
2360
  info = TkApplication.sys_info
1893
2361
  set_sysinfo(info)
@@ -1918,7 +2386,7 @@ class ArcadiaAboutSplash < TkToplevel
1918
2386
  @tkAlert = TkLabel.new(self){
1919
2387
  image Arcadia.image_res(ALERT_GIF)
1920
2388
  background 'black'
1921
- place('x'=> 10,'y' => 152)
2389
+ place('x'=> 28,'y' => 152)
1922
2390
  }
1923
2391
 
1924
2392
  @tkLabelProblems = TkLabel.new(self){
@@ -1928,7 +2396,7 @@ class ArcadiaAboutSplash < TkToplevel
1928
2396
  font Arcadia.instance['conf']['splash.problems.font']
1929
2397
  justify 'left'
1930
2398
  anchor 'w'
1931
- place('width' => '210','x' => 28,'y' => 150,'height' => 25)
2399
+ place('width' => '210','x' => 46,'y' => 150,'height' => 25)
1932
2400
  }
1933
2401
  end
1934
2402
  @problems_nums=@problems_nums+1
@@ -1941,14 +2409,16 @@ class ArcadiaAboutSplash < TkToplevel
1941
2409
 
1942
2410
  def set_progress(_max=10)
1943
2411
  @max = _max
1944
- Tk::BWidget::ProgressBar.new(self, :width=>150, :height=>10,
2412
+ Tk::BWidget::ProgressBar.new(self, :width=>340, :height=>5,
1945
2413
  :background=>'#000000',
1946
2414
  :troughcolor=>'#000000',
1947
- :foreground=>'#666666',
2415
+ :foreground=>'#990000',
1948
2416
  :variable=>@progress,
1949
2417
  :borderwidth=>0,
1950
2418
  :relief=>'flat',
1951
- :maximum=>_max).place('relwidth' => '1','y' => 144,'height' => 6)
2419
+ # :maximum=>_max).place('relwidth' => '1','y' => 145,'height' => 1)
2420
+ # :maximum=>_max).place('width' => '280','x'=>28,'y' => 33,'height' => 1)
2421
+ :maximum=>_max).place('width' => '280','x'=>28,'y' => 189,'height' => 10)
1952
2422
  end
1953
2423
 
1954
2424
  def reset
@@ -2290,7 +2760,7 @@ class ArcadiaSh < TkToplevel
2290
2760
  @wait = true
2291
2761
  @result = false
2292
2762
  prompt
2293
- @text.bind_append("KeyPress"){|e| input(e.keysym)}
2763
+ @text.bind_append("KeyPress","%K"){|_keysym| input(_keysym)}
2294
2764
  end
2295
2765
 
2296
2766
  def exec_buffer