visualruby 3.0.15 → 3.0.17
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.
- checksums.yaml +4 -4
- data/.vr_settings.yaml +15 -25
- data/lib/ActLikeAHash.rb +12 -0
- data/lib/Alert.rb +6 -4
- data/lib/GladeGUI.rb +101 -53
- data/lib/SavableClass.rb +5 -3
- data/lib/oinspect/ObjectInspectorGUI.rb +3 -3
- data/lib/treeview/IterMethods.rb +10 -3
- data/my_yard.yaml +20 -0
- data/src/editor/VR_Document.rb +14 -70
- data/src/editor/VR_Tabs.rb +107 -37
- data/src/main/NewProjectGUI.rb +1 -2
- data/src/main/OpenProject.rb +12 -3
- data/src/main/VR_File_Tree.rb +14 -10
- data/src/main/VR_Main.rb +44 -39
- data/src/main/VR_Tools.rb +3 -12
- data/src/main/glade/OpenProject.glade +13 -0
- data/src/main/glade/VR_Main.glade +3 -0
- data/vr +13 -6
- metadata +4 -6
- data/examples/alert_box/.vr_settings.yaml +0 -19
- data/examples/phantom/.vr_settings.yaml +0 -22
- data/examples/pop_up/.vr_settings.yaml +0 -19
- data/examples/settings_file/.vr_settings.yaml +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2434c8926f2476bec1c11354108a4b320cd4583
|
4
|
+
data.tar.gz: 5e1d3930bd198f21c7dd1a306f8b410815c6411d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3d2196193f960088d68eddacef6f32dd231e61d5bccd91898bceda3e96699255e656712b4895d442e8cee86eb718e7c207ff8b8d865347472da07cd695c5126
|
7
|
+
data.tar.gz: f6ee408bcdc3e445ae952acdb6568f1870cf679e322c1a71f1f753fe41015e3307ff19a949f79f49e620ed5b409bf28c74df7a91126f8ebd12c1d04610538051
|
data/.vr_settings.yaml
CHANGED
@@ -1,37 +1,27 @@
|
|
1
1
|
--- !ruby/object:VR_ENV
|
2
|
-
vr_yaml_file: "
|
3
|
-
width:
|
4
|
-
height:
|
5
|
-
panel_pos:
|
6
|
-
notebook_panel_position:
|
2
|
+
vr_yaml_file: "/home/eric/vrp/vr3/.vr_settings.yaml"
|
3
|
+
width: 1364
|
4
|
+
height: 691
|
5
|
+
panel_pos: 297
|
6
|
+
notebook_panel_position: 458
|
7
7
|
run_command_line: ruby vr
|
8
8
|
open_files:
|
9
|
+
- "/home/eric/vrp/vr3/yard_hack/common.css"
|
10
|
+
- "/home/eric/vrp/vr3/src/editor/VR_Tabs.rb"
|
11
|
+
- "/home/eric/vrp/vr3/lib/Alert.rb"
|
12
|
+
- "/home/eric/vrp/vr3/lib/GladeGUI.rb"
|
13
|
+
- "/home/eric/vrp/vr3/src/main/NewProjectGUI.rb"
|
14
|
+
- "/home/eric/vrp/vr3/src/main/VR_Main.rb"
|
9
15
|
- "/home/eric/vrp/vr3/src/main/VR_File_Tree.rb"
|
10
|
-
- "/home/eric/vrp/vr3/src/main/VR_Tools.rb"
|
11
|
-
- "/home/eric/vrp/vr3/src/main/OpenProject.rb"
|
12
16
|
- "/home/eric/vrp/vr3/vr.gemspec"
|
13
|
-
- "/home/eric/vrp/vr3/lib/DragDrop.rb"
|
14
|
-
- "/home/eric/vrp/vr3/site/Quick_Start.md"
|
15
|
-
- "/home/eric/vrp/vr3/site/ActiveRecord_Totorial.md"
|
16
|
-
- "/home/eric/vrp/vr3/site/Child_Windows_Tutorial.rdoc"
|
17
|
-
- "/home/eric/vrp/vr3/site/Download.md"
|
18
|
-
- "/home/eric/vrp/vr3/site/Generate_RDocs_Tutorial.rdoc"
|
19
|
-
- "/home/eric/vrp/vr3/site/Help_Contact_Info.rdoc"
|
20
|
-
- "/home/eric/vrp/vr3/site/ListView_Tutorial.rdoc"
|
21
|
-
- "/home/eric/vrp/vr3/site/README.md"
|
22
|
-
- "/home/eric/vrp/vr3/site/RubyGems_Tutorial.rdoc"
|
23
|
-
- "/home/eric/vrp/vr3/site/Screen_Shots.rdoc"
|
24
|
-
- "/home/eric/vrp/vr3/site/Signals_Tutorial.rdoc"
|
25
17
|
open_folders:
|
26
18
|
- "/home/eric/vrp/vr3"
|
27
|
-
- "/home/eric/vrp/vr3/lib"
|
28
|
-
- "/home/eric/vrp/vr3/lib/oinspect"
|
29
|
-
- "/home/eric/vrp/vr3/site"
|
30
19
|
- "/home/eric/vrp/vr3/src"
|
20
|
+
- "/home/eric/vrp/vr3/src/editor"
|
31
21
|
- "/home/eric/vrp/vr3/src/main"
|
32
|
-
- "/home/eric/vrp/vr3/
|
33
|
-
current_file: "/home/eric/vrp/vr3/
|
34
|
-
current_line:
|
22
|
+
- "/home/eric/vrp/vr3/yard_hack"
|
23
|
+
current_file: "/home/eric/vrp/vr3/vr.gemspec"
|
24
|
+
current_line: 21
|
35
25
|
rdoc_command_line: yardoc lib - site/*.*
|
36
26
|
builder: !ruby/object:Gtk::Builder {}
|
37
27
|
top_level_window: false
|
data/lib/ActLikeAHash.rb
ADDED
data/lib/Alert.rb
CHANGED
@@ -34,7 +34,7 @@ module VR
|
|
34
34
|
|
35
35
|
@builder[:button_no].show if @flags[:button_no]
|
36
36
|
@builder[:button_cancel].show if @flags[:button_cancel]
|
37
|
-
|
37
|
+
set_glade_hash(@flags)
|
38
38
|
end
|
39
39
|
|
40
40
|
def button_yes__clicked(but)
|
@@ -102,9 +102,11 @@ end
|
|
102
102
|
# There are many examples in the "alert_box" example project.
|
103
103
|
|
104
104
|
def alert(message, options = {})
|
105
|
-
@
|
106
|
-
VR::Alert.new(message, @
|
107
|
-
|
105
|
+
@answer_from_user = VR::Alert::DialogAnswer.new()
|
106
|
+
VR::Alert.new(message, @answer_from_user, options).show_glade(options[:parent])
|
107
|
+
ans = @answer_from_user.answer
|
108
|
+
remove_instance_variable(:@answer_from_user)
|
109
|
+
return ans
|
108
110
|
end
|
109
111
|
|
110
112
|
|
data/lib/GladeGUI.rb
CHANGED
@@ -84,7 +84,8 @@
|
|
84
84
|
# set_glade_variables() method.)
|
85
85
|
module GladeGUI
|
86
86
|
|
87
|
-
|
87
|
+
# @!attribute [rw] builder
|
88
|
+
# @return [Gtk::Builder] The builder that holds references to everything in the glade form.
|
88
89
|
attr_accessor :builder
|
89
90
|
|
90
91
|
##
|
@@ -163,7 +164,7 @@ end
|
|
163
164
|
if @builder
|
164
165
|
@builder.objects.each do |obj|
|
165
166
|
next unless obj.respond_to?(:builder_name)
|
166
|
-
if obj.builder_name == glade_name or obj.builder_name =~ /^(?:#{class_name(self)}\.|)#{glade_name}\[\
|
167
|
+
if obj.builder_name == glade_name or obj.builder_name =~ /^(?:#{class_name(self)}\.|)#{glade_name}\[[a-zA-Z\d_-]+\]$/ #arrays
|
167
168
|
obj.signal_connect(signal_name) { |*args| method(meth.to_sym).call(*args) }
|
168
169
|
end
|
169
170
|
end
|
@@ -239,46 +240,47 @@ end
|
|
239
240
|
return if not defined? @attributes
|
240
241
|
obj.attributes.each_pair { |key, val| fill_control(class_name(obj) + "." + key, val) }
|
241
242
|
end
|
242
|
-
|
243
|
+
|
244
|
+
# Matches names in glade form to keys in a Hash.
|
245
|
+
# @param [Hash] hash The hash with keys that match the names in the glade form.
|
243
246
|
def set_glade_hash(hash)
|
244
247
|
return unless hash.is_a?(Hash)
|
245
248
|
hash.each { |key,val| fill_control( key.to_s, val.to_s) }
|
246
249
|
end
|
247
250
|
|
248
|
-
#Populates the glade form from the instance variables of the class.
|
249
|
-
#
|
250
|
-
#So instead of having to assign each widget a value:
|
251
|
+
# Populates the glade form from the instance variables of the class.
|
252
|
+
# So instead of having to assign each widget a value:
|
251
253
|
#
|
252
|
-
# @builder["
|
253
|
-
# @builder["
|
254
|
-
# @builder["
|
255
|
-
# @builder["
|
254
|
+
# @builder["name"].text = @name
|
255
|
+
# @builder["address"].text = @address
|
256
|
+
# @builder["email"].text = @eamil
|
257
|
+
# @builder["phone"].text = @phone
|
256
258
|
#
|
257
|
-
#you can write one line of code:
|
259
|
+
# you can write one line of code:
|
258
260
|
#
|
259
261
|
# set_glade_variables()
|
260
262
|
#
|
261
|
-
#The optional parameter is seldom used because you usually want the
|
262
|
-
#glade form to populate from the calling class. If you passed another object,
|
263
|
-
#the form would populate from it.
|
263
|
+
# The optional parameter is seldom used because you usually want the
|
264
|
+
# glade form to populate from the calling class. If you passed another object,
|
265
|
+
# the form would populate from it.
|
264
266
|
#
|
265
|
-
#obj - type Object
|
267
|
+
# obj - type Object
|
266
268
|
#
|
267
|
-
|
268
|
-
|
269
|
-
|
270
269
|
def set_glade_variables(obj = self)
|
271
|
-
# set_glade_hash(obj) if obj.is_a?(Hash)
|
272
270
|
obj.instance_variables.each do |name|
|
273
271
|
name = name.to_s #ruby 1.9 passes symbol!
|
274
|
-
v = obj.instance_variable_get(name)
|
275
|
-
|
276
|
-
if v.
|
277
|
-
|
278
|
-
fill_control(
|
279
|
-
end
|
272
|
+
v = obj.instance_variable_get(name)
|
273
|
+
name = name.gsub('@', '')
|
274
|
+
if v.is_a?(Array)
|
275
|
+
v.each_index do |i|
|
276
|
+
fill_control("#{name}[#{i.to_s}]", v[i] )
|
277
|
+
end
|
278
|
+
elsif v.is_a?(Hash)
|
279
|
+
v.each_pair do |key, val|
|
280
|
+
fill_control("#{name}[#{key.to_s}]", val)
|
281
|
+
end
|
280
282
|
else
|
281
|
-
fill_control(
|
283
|
+
fill_control(name, v)
|
282
284
|
end
|
283
285
|
end
|
284
286
|
end
|
@@ -286,13 +288,13 @@ end
|
|
286
288
|
|
287
289
|
def fill_control(glade_name, val)
|
288
290
|
control = @builder[glade_name]
|
289
|
-
|
290
|
-
control
|
291
|
-
case control
|
291
|
+
return unless control
|
292
|
+
case control # order matters-- subclasses?
|
292
293
|
when Gtk::Window then control.title = val
|
293
294
|
when Gtk::CheckButton then control.active = val
|
294
295
|
when Gtk::TextView then control.buffer.text = val.to_s
|
295
|
-
when Gtk::Entry then control.text = val.to_s
|
296
|
+
when Gtk::Entry then control.text = val.to_s
|
297
|
+
when Gtk::ColorButton then control.color = Gdk::Color.parse(val.to_s)
|
296
298
|
when Gtk::FontButton then control.font_name = val.to_s
|
297
299
|
when Gtk::LinkButton then control.uri = control.label = val.to_s
|
298
300
|
when Gtk::Label, Gtk::Button then control.label = val.to_s
|
@@ -301,9 +303,22 @@ end
|
|
301
303
|
when Gtk::ProgressBar then control.fraction = val.to_f
|
302
304
|
when Gtk::Calendar then control.select_month(val.month, val.year) ; control.select_day(val.day) ; control.mark_day(val.day)
|
303
305
|
when Gtk::Adjustment then control.value = val.to_f
|
304
|
-
when Gtk::ScrolledWindow, Gtk::Frame, Gtk::VBox, Gtk::HBox then control.add(val)
|
306
|
+
when Gtk::ScrolledWindow, Gtk::Frame, Gtk::VBox, Gtk::HBox then control.add(val)
|
307
|
+
when Gtk::ComboBoxText then try_to_select_text_in_combobox(control, val.to_s)
|
305
308
|
end
|
306
|
-
end
|
309
|
+
end
|
310
|
+
|
311
|
+
def try_to_select_text_in_combobox(cb, text)
|
312
|
+
i = 0
|
313
|
+
cb.model.each do |model, path, iter|
|
314
|
+
if iter[0] == text
|
315
|
+
cb.active = i
|
316
|
+
return
|
317
|
+
end
|
318
|
+
i = i + 1
|
319
|
+
end
|
320
|
+
end
|
321
|
+
|
307
322
|
|
308
323
|
#
|
309
324
|
# Populates your instance variables from the glade form.
|
@@ -327,25 +342,48 @@ end
|
|
327
342
|
# @param [Object] obj Any object with instance variables with same names as in galde form.
|
328
343
|
# @return none
|
329
344
|
def get_glade_variables(obj = self)
|
330
|
-
obj.instance_variables.each do |
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
345
|
+
obj.instance_variables.each do |var_name|
|
346
|
+
var = obj.instance_variable_get(var_name)
|
347
|
+
var_name = var_name.to_s.gsub("@", "") #fix for ruby 1.9 giving symbols
|
348
|
+
if var.is_a? Hash
|
349
|
+
var.each_pair do |key, val|
|
350
|
+
if glade_value = get_control_value("#{var_name}[#{key.to_s}]")
|
351
|
+
var[key] = glade_value
|
352
|
+
end
|
353
|
+
end
|
354
|
+
obj.instance_variable_set("@"+ var_name, var)
|
355
|
+
elsif var.is_a? Array
|
356
|
+
var.each_index do |i|
|
357
|
+
if glade_value = get_control_value("#{var_name}[#{i.to_s}]")
|
358
|
+
var[i] = glade_value
|
359
|
+
end
|
360
|
+
end
|
361
|
+
obj.instance_variable_set("@"+ var_name, var)
|
362
|
+
else
|
363
|
+
glade_value = get_control_value(var_name)
|
364
|
+
if glade_value
|
365
|
+
obj.instance_variable_set("@"+ var_name, glade_value)
|
366
|
+
end
|
367
|
+
end
|
346
368
|
end
|
347
369
|
end
|
348
|
-
|
370
|
+
|
371
|
+
def get_control_value(glade_name)
|
372
|
+
return unless control = @builder[glade_name]
|
373
|
+
case control
|
374
|
+
when Gtk::CheckButton then control.active?
|
375
|
+
when Gtk::Entry then control.text
|
376
|
+
when Gtk::TextView then control.buffer.text
|
377
|
+
when Gtk::FontButton then control.font_name
|
378
|
+
when Gtk::ColorButton then control.color.to_s[0..2] + control.color.to_s[5..6] + control.color.to_s[9..10]
|
379
|
+
when Gtk::Label, Gtk::Button then control.label
|
380
|
+
when Gtk::SpinButton, Gtk::Adjustment then control.value
|
381
|
+
when Gtk::Image then control.file
|
382
|
+
when Gtk::ProgressBar then control.fraction
|
383
|
+
when Gtk::Calendar then DateTime.new(*control.date)
|
384
|
+
when Gtk::ComboBoxText then control.active_text
|
385
|
+
end
|
386
|
+
end
|
349
387
|
|
350
388
|
def get_glade_active_record(obj)
|
351
389
|
return if not defined? @attributes
|
@@ -367,8 +405,7 @@ end
|
|
367
405
|
end
|
368
406
|
end
|
369
407
|
|
370
|
-
|
371
|
-
# Ignore, just helps figure out name of class including GladeGUI
|
408
|
+
# @private
|
372
409
|
def self.included(obj)
|
373
410
|
temp = caller[0].split(":") #correct for windows C:\Users\george etc.
|
374
411
|
caller_path_to_class_file, = temp[0].size == 1 ? temp[0] + ":" + temp[1] : temp[0]
|
@@ -395,9 +432,8 @@ end
|
|
395
432
|
parse_signals()
|
396
433
|
set_glade_all()
|
397
434
|
@builder[:window1].show #show_all can't hide widgets in before_show
|
398
|
-
# @builder[:window1].add_events(Gdk::EventMask.new(:key_press))
|
399
435
|
@top_level_window = Gtk.main_level == 0 ? true : false
|
400
|
-
Gtk.main if @top_level_window or @builder[:window1].modal? #need new Gtk.main for blocking!
|
436
|
+
Gtk.main if @top_level_window or @builder[:window1].modal? # need new Gtk.main for blocking!
|
401
437
|
end
|
402
438
|
|
403
439
|
# Called when window is destroyed when you execute: <tt>@builder[:window1].destroy</tt>
|
@@ -417,6 +453,18 @@ end
|
|
417
453
|
oinspect
|
418
454
|
end
|
419
455
|
|
456
|
+
# retrieves the key inside a glade control name. Useful when handling events where
|
457
|
+
# the control name is returned, and you need to match it to an actual hash.
|
458
|
+
# @example
|
459
|
+
# # Widget in glade form has name of "button[5]"
|
460
|
+
# var = @builder["button[5]"]
|
461
|
+
# extract_key(var) => "5"
|
462
|
+
# @param [String] widget Name for the widget in the glade form.
|
463
|
+
# @return [String] the key value.
|
464
|
+
def extract_key(widget)
|
465
|
+
widget.builder_name[/\[.+?\]/]
|
466
|
+
end
|
467
|
+
|
420
468
|
|
421
469
|
#
|
422
470
|
# private def active_record_valid?(show_errors = true)
|
data/lib/SavableClass.rb
CHANGED
@@ -7,7 +7,8 @@ module VR
|
|
7
7
|
elsif flags[:class]
|
8
8
|
me = flags[:class].new()
|
9
9
|
end
|
10
|
-
|
10
|
+
file_name = File.expand_path(flags[:file_name])
|
11
|
+
me.instance_variable_set(:@vr_yaml_file, file_name)
|
11
12
|
me.defaults() if me.respond_to?(:defaults)
|
12
13
|
VR::save_yaml(me)
|
13
14
|
return me
|
@@ -16,8 +17,9 @@ module VR
|
|
16
17
|
# todo create folders if don't exist
|
17
18
|
def self.save_yaml(obj, filename = nil)
|
18
19
|
filename ||= obj.instance_variable_get(:@vr_yaml_file)
|
19
|
-
|
20
|
-
|
20
|
+
dirname = File.dirname(filename)
|
21
|
+
FileUtils.mkdir_p(dirname) unless File.directory?(dirname)
|
22
|
+
File.open(filename, "w") {|f| f.puts(obj.to_yaml)}
|
21
23
|
end
|
22
24
|
|
23
25
|
end
|
@@ -30,16 +30,16 @@ module VR::ObjectInspector
|
|
30
30
|
|
31
31
|
end
|
32
32
|
|
33
|
-
|
34
|
-
# @return none.
|
33
|
+
|
35
34
|
# Displays object on screen and halts the program. Anywhere in your code you can halt
|
36
35
|
# the execution, and display an object in a window like this:
|
37
36
|
# alert anyobject
|
38
37
|
#
|
39
38
|
# Also, at any window, if you press the F8 key, the object inspector will run. Try it.
|
40
|
-
|
41
39
|
# http://visualruby.net/img/object_inspector.jpg
|
42
40
|
#
|
41
|
+
# @param [Object] obj Any object that you want to display.
|
42
|
+
# @return none.
|
43
43
|
def oinspect(obj=self)
|
44
44
|
VR::ObjectInspector::ObjectInspectorGUI.new(obj).show_glade()
|
45
45
|
end
|
data/lib/treeview/IterMethods.rb
CHANGED
@@ -18,12 +18,19 @@ module VR::ViewCommon
|
|
18
18
|
#
|
19
19
|
|
20
20
|
def [](col_id)
|
21
|
-
|
21
|
+
if col_id.is_a? Fixnum
|
22
|
+
super
|
23
|
+
else
|
24
|
+
get_value(id(col_id))
|
25
|
+
end
|
22
26
|
end
|
23
27
|
|
24
28
|
def []=(col_id,val)
|
25
|
-
|
26
|
-
|
29
|
+
if col_id.is_a? Fixnum
|
30
|
+
super(col_id, val)
|
31
|
+
else
|
32
|
+
super(id(col_id), val)
|
33
|
+
end
|
27
34
|
end
|
28
35
|
|
29
36
|
# The id() method translates visualruby's colum ID symbols into integers that
|
data/my_yard.yaml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
--- !ruby/object:MyYard
|
2
|
+
project_root: "/home/eric/vrp/vr3"
|
3
|
+
output_dir: doc
|
4
|
+
theme: visualruby
|
5
|
+
template: default
|
6
|
+
files: lib/**/*.rb
|
7
|
+
extra_files: site/*.*
|
8
|
+
exclude: ''
|
9
|
+
include_public: true
|
10
|
+
include_private: false
|
11
|
+
include_protected: false
|
12
|
+
no_private: true
|
13
|
+
export_db: true
|
14
|
+
title: Visual Ruby
|
15
|
+
vr_yaml_file: "/home/eric/vrp/vr3/my_yard.yaml"
|
16
|
+
main: index.html
|
17
|
+
builder: !ruby/object:Gtk::Builder {}
|
18
|
+
top_level_window: true
|
19
|
+
answer: !ruby/object:VR::Alert::DialogAnswer
|
20
|
+
answer: true
|
data/src/editor/VR_Document.rb
CHANGED
@@ -4,21 +4,23 @@ class VR_Document < GtkSource::View
|
|
4
4
|
include GladeGUI
|
5
5
|
include VR_TextViewCommon
|
6
6
|
|
7
|
-
|
8
|
-
attr_accessor :full_path_file
|
7
|
+
attr_accessor :full_path_file, :title
|
9
8
|
|
10
9
|
def initialize(full_path_file, title_label, main)
|
11
10
|
@main = main
|
12
11
|
super()
|
13
|
-
@title = title_label #reference to label on tab
|
14
|
-
|
12
|
+
@title = title_label #reference to label on tab
|
13
|
+
@full_path_file = full_path_file
|
14
|
+
reload_from_disk()
|
15
15
|
hilight_current_line = true
|
16
16
|
show_right_margin = true
|
17
17
|
right_margin_position = 80
|
18
|
-
auto_indent = true
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
auto_indent = true
|
19
|
+
if ["", ".gemspec", ".erb"].include?(File.extname(full_path_file))
|
20
|
+
buffer.language = GtkSource::LanguageManager.new.get_language("ruby")
|
21
|
+
else
|
22
|
+
buffer.language = GtkSource::LanguageManager.new.guess_language(full_path_file)
|
23
|
+
end
|
22
24
|
buffer.highlight_syntax = true
|
23
25
|
buffer.highlight_matching_brackets = false
|
24
26
|
@hilight = buffer.create_tag("hilight", { "background" => "#FFF0A0" })
|
@@ -31,14 +33,6 @@ class VR_Document < GtkSource::View
|
|
31
33
|
update_style()
|
32
34
|
end
|
33
35
|
|
34
|
-
# def get_language(fn)
|
35
|
-
# case File.extname(full_path_file)
|
36
|
-
# when ".rb", "", ".gemspec" ; return "ruby"
|
37
|
-
# when ".erb", ".html" ; return "html"
|
38
|
-
# else ; return ""
|
39
|
-
# end
|
40
|
-
# end
|
41
|
-
|
42
36
|
def update_style()
|
43
37
|
override_font(Pango::FontDescription.new($VR_ENV_GLOBAL.font_name))
|
44
38
|
tab_array = Pango::TabArray.new(1, true)
|
@@ -46,11 +40,9 @@ class VR_Document < GtkSource::View
|
|
46
40
|
set_tabs(tab_array)
|
47
41
|
end
|
48
42
|
|
49
|
-
def reload_from_disk(
|
50
|
-
@full_path_file = fn
|
51
|
-
@title.label = File.basename(@full_path_file)
|
43
|
+
def reload_from_disk()
|
52
44
|
buffer.text = File.open(@full_path_file, "r").read if File.file?(@full_path_file.to_s) #protect against nil to_s
|
53
|
-
|
45
|
+
buffer.modified = false
|
54
46
|
@modified_time = mod_time()
|
55
47
|
end
|
56
48
|
|
@@ -66,22 +58,6 @@ class VR_Document < GtkSource::View
|
|
66
58
|
reload_from_disk()
|
67
59
|
end
|
68
60
|
return false #abort!
|
69
|
-
end
|
70
|
-
|
71
|
-
|
72
|
-
def try_to_save(ask = true)
|
73
|
-
return false if not modified_time_matches()
|
74
|
-
return true if empty?
|
75
|
-
if (@title.label == "Untitled")
|
76
|
-
return save_changes?
|
77
|
-
elsif (buffer.modified? and ask)
|
78
|
-
return save_changes?
|
79
|
-
elsif buffer.modified?
|
80
|
-
write_to_disk()
|
81
|
-
return true
|
82
|
-
else
|
83
|
-
return true
|
84
|
-
end
|
85
61
|
end
|
86
62
|
|
87
63
|
def write_to_disk(fn = @full_path_file)
|
@@ -93,41 +69,9 @@ class VR_Document < GtkSource::View
|
|
93
69
|
return true
|
94
70
|
end
|
95
71
|
|
96
|
-
|
97
|
-
answer = alert "Save chages to: <b> #{File.basename(@full_path_file)}</b> ?",
|
98
|
-
parent: @main,
|
99
|
-
button_yes: "Save Changes", button_no: "Discard Changes",
|
100
|
-
headline: "Save Changes?", button_cancel: "Cancel"
|
101
|
-
if answer == true # save
|
102
|
-
return @title.label == "Untitled" ? save_as() : write_to_disk()
|
103
|
-
elsif answer == false # Discard Changes
|
104
|
-
reload_from_disk()
|
105
|
-
return true #continue without saving
|
106
|
-
end
|
107
|
-
return false #abort!
|
108
|
-
end
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
#todo update file tree, parent window?
|
113
|
-
def save_as() # returns false or complete file name.
|
114
|
-
dialog = Gtk::FileChooserDialog.new(
|
115
|
-
title: "Save File As...",
|
116
|
-
parent: @main.builder[:window1],
|
117
|
-
action: :save,
|
118
|
-
buttons: [["_Cancel", :cancel], ["_Save", :accept]])
|
72
|
+
|
119
73
|
|
120
|
-
|
121
|
-
dialog.current_name = VR_Document.get_class_title(buffer.text)
|
122
|
-
resp = dialog.run
|
123
|
-
dialog.hide
|
124
|
-
if resp == :accept
|
125
|
-
write_to_disk(dialog.filename)
|
126
|
-
@main.file_tree.refresh()
|
127
|
-
return true
|
128
|
-
end
|
129
|
-
return false
|
130
|
-
end
|
74
|
+
|
131
75
|
|
132
76
|
def jump_to_line(line_num, search_str = nil)
|
133
77
|
while (Gtk.events_pending?)
|
data/src/editor/VR_Tabs.rb
CHANGED
@@ -5,31 +5,94 @@ class VR_Tabs < Gtk::Notebook
|
|
5
5
|
|
6
6
|
include VR_TabSearch
|
7
7
|
|
8
|
-
def initialize(main)
|
8
|
+
def initialize(main)
|
9
9
|
super()
|
10
|
-
@docs =
|
10
|
+
@docs = []
|
11
11
|
@main = main
|
12
|
-
@
|
13
|
-
|
14
|
-
self.scrollable = true #after super
|
12
|
+
@x_img = File.dirname(__FILE__) + '/../../img/close.png'
|
13
|
+
self.scrollable = true #after super
|
15
14
|
self.expand = true
|
16
15
|
end
|
17
16
|
|
17
|
+
#todo update file tree, parent window?
|
18
|
+
def save_as() # returns false or complete file name.
|
19
|
+
dialog = Gtk::FileChooserDialog.new(
|
20
|
+
title: "Save File As...",
|
21
|
+
parent: @main.builder[:window1],
|
22
|
+
action: :save,
|
23
|
+
buttons: [["_Cancel", :cancel], ["_Save", :accept]])
|
24
|
+
dialog.current_folder = File.dirname(@docs[page].full_path_file)
|
25
|
+
dialog.current_name = VR_Document.get_class_title(@docs[page].buffer.text)
|
26
|
+
resp = dialog.run
|
27
|
+
dialog.hide
|
28
|
+
if resp == :accept
|
29
|
+
@docs[page].write_to_disk(dialog.filename)
|
30
|
+
destroy_tab()
|
31
|
+
clear_events
|
32
|
+
load_tab(dialog.filename)
|
33
|
+
clear_events
|
34
|
+
@main.file_tree.refresh()
|
35
|
+
return true
|
36
|
+
end
|
37
|
+
return false
|
38
|
+
end
|
39
|
+
|
40
|
+
def save_changes?
|
41
|
+
answer = alert "Save chages to: <b> #{File.basename(@docs[page].full_path_file)}</b> ?",
|
42
|
+
parent: @main,
|
43
|
+
button_yes: "Save Changes", button_no: "Discard Changes",
|
44
|
+
headline: "Save Changes?", button_cancel: "Cancel"
|
45
|
+
if answer == true # save
|
46
|
+
if @docs[page].title.label == "Untitled"
|
47
|
+
return save_as()
|
48
|
+
else
|
49
|
+
return @docs[page].write_to_disk()
|
50
|
+
end
|
51
|
+
elsif answer == false # Discard Changes
|
52
|
+
@docs[page].reload_from_disk()
|
53
|
+
return true #continue without saving
|
54
|
+
end
|
55
|
+
return false #abort!
|
56
|
+
end
|
57
|
+
|
58
|
+
def try_to_save(ask = true)
|
59
|
+
return false if not @docs[page].modified_time_matches()
|
60
|
+
return true if @docs[page].empty?
|
61
|
+
if (@docs[page].title.label == "Untitled")
|
62
|
+
return save_changes?
|
63
|
+
elsif (@docs[page].buffer.modified? and ask)
|
64
|
+
return save_changes?
|
65
|
+
elsif @docs[page].buffer.modified?
|
66
|
+
@docs[page].write_to_disk()
|
67
|
+
return true
|
68
|
+
else
|
69
|
+
return true
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
|
18
74
|
def update_style_all()
|
19
75
|
@docs.each { |doc| doc.update_style() }
|
20
76
|
end
|
21
77
|
|
22
|
-
|
78
|
+
# Tries to save and/or close all open documents
|
79
|
+
# @param [Hash] flags Optiions
|
80
|
+
# @option [Boolean] ask Whether or not to ask to save or save without asking.
|
81
|
+
# @option [Boolean] close Close tab when finished
|
82
|
+
# @option [String] folder operate only on folders matching this string. Default = "/"
|
83
|
+
def try_to_save_all(flags)
|
23
84
|
ask = flags[:ask]
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
85
|
+
folder ||= "/"
|
86
|
+
passed = true
|
87
|
+
(0..n_pages-1).each do |i|
|
88
|
+
page = i
|
89
|
+
unless try_to_save(ask)
|
90
|
+
passed = false
|
91
|
+
end
|
92
|
+
end
|
93
|
+
(n_pages).times { destroy_tab() } if flags[:close]
|
94
|
+
return passed
|
95
|
+
end
|
33
96
|
|
34
97
|
##todo update file_tree!
|
35
98
|
# def try_to_save_all(ask = true)
|
@@ -46,8 +109,8 @@ class VR_Tabs < Gtk::Notebook
|
|
46
109
|
|
47
110
|
|
48
111
|
def switch_to(path)
|
49
|
-
i =
|
50
|
-
return false if i.nil?
|
112
|
+
i = tab_number(path)
|
113
|
+
return false if i.nil?
|
51
114
|
self.page = i if i != self.page
|
52
115
|
return true
|
53
116
|
end
|
@@ -59,18 +122,18 @@ class VR_Tabs < Gtk::Notebook
|
|
59
122
|
end
|
60
123
|
end
|
61
124
|
|
62
|
-
def load_tab(full_path_file = Dir.pwd + "/Untitled")
|
63
|
-
full_path_file = Dir.pwd + "/Untitled" if full_path_file == ""
|
125
|
+
def load_tab(full_path_file = Dir.pwd + "/Untitled")
|
64
126
|
return if switch_to(full_path_file)
|
127
|
+
return unless File.exist?(full_path_file) or full_path_file == Dir.pwd + "/Untitled"
|
65
128
|
box = Gtk::EventBox.new
|
66
129
|
tab = Gtk::Box.new(:horizontal)
|
67
|
-
img = Gtk::Image.new(:
|
130
|
+
img = Gtk::Image.new(:file => @x_img)
|
68
131
|
box.add(img)
|
69
132
|
title = Gtk::Label.new(File.basename(full_path_file))
|
70
133
|
tab.pack_start(title, :expand=>true, :fill=>true, :padding=>2)
|
71
|
-
tab.pack_start(box)
|
134
|
+
tab.pack_start(box)
|
72
135
|
tab.show_all #needed
|
73
|
-
text = VR_Document.new(full_path_file, title, @main)
|
136
|
+
text = VR_Document.new(full_path_file, title, @main)
|
74
137
|
child = Gtk::ScrolledWindow.new
|
75
138
|
child.add(text)
|
76
139
|
box.signal_connect("button_release_event") {remove_id(text.object_id)}
|
@@ -78,34 +141,41 @@ class VR_Tabs < Gtk::Notebook
|
|
78
141
|
if @docs.size == 1 and @docs[0].buffer.text.strip == ""
|
79
142
|
@docs[0] = text
|
80
143
|
self.remove_page(0)
|
81
|
-
end
|
144
|
+
end
|
82
145
|
child.show_all #needed
|
83
146
|
append_page(child, tab)
|
84
|
-
self.page = self.n_pages - 1
|
85
|
-
@docs[self.page] = text
|
147
|
+
self.page = self.n_pages - 1
|
148
|
+
@docs[self.page] = text
|
86
149
|
end
|
87
150
|
|
88
151
|
#used when little 'x' image is clicked to close.
|
89
152
|
def remove_id(object_id)
|
90
|
-
i = @docs.index { |doc| doc.object_id == object_id }
|
91
|
-
|
92
|
-
|
153
|
+
i = @docs.index { |doc| doc.object_id == object_id }
|
154
|
+
page = i
|
155
|
+
clear_events
|
156
|
+
if try_to_save(true)
|
157
|
+
destroy_tab(i)
|
93
158
|
end
|
94
159
|
end
|
95
160
|
|
96
161
|
#if its there, destroys it
|
97
162
|
def destroy_file_tab(file_name)
|
98
|
-
destroy_tab
|
163
|
+
destroy_tab tab_number(file_name)
|
99
164
|
end
|
100
165
|
|
101
|
-
|
166
|
+
def tab_number(file_name)
|
167
|
+
@docs.index{ |d| d.full_path_file == file_name}
|
168
|
+
end
|
169
|
+
|
170
|
+
# this spits out a bunch of warnings on remove_page. Changing the page number
|
171
|
+
# stops the warnings.
|
102
172
|
def destroy_tab(tab = self.page)
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
173
|
+
return unless tab
|
174
|
+
self.page = self.page - 1 # stops some warnings
|
175
|
+
clear_events
|
176
|
+
@docs.delete_at(tab)
|
177
|
+
# self.set_tab_label(get_nth_page(tab), nil)
|
178
|
+
self.remove_page(tab) # causes warinings nothing I can do!
|
109
179
|
load_tab() if @docs.empty?
|
110
180
|
end
|
111
181
|
|
@@ -114,7 +184,7 @@ class VR_Tabs < Gtk::Notebook
|
|
114
184
|
end
|
115
185
|
|
116
186
|
def open_file_names(ar)
|
117
|
-
ar.each { |fn| load_tab(fn) if File.file?(fn) and fn.include? Dir.pwd}
|
187
|
+
ar.each { |fn| load_tab(fn) if File.file?(fn) and fn.include? Dir.pwd}
|
118
188
|
load_tab() if @docs.empty?
|
119
189
|
end
|
120
190
|
|
data/src/main/NewProjectGUI.rb
CHANGED
@@ -5,12 +5,11 @@ class NewProjectGUI
|
|
5
5
|
|
6
6
|
def initialize(parent)
|
7
7
|
@parent = parent
|
8
|
-
@projects_home = $VR_ENV_GLOBAL.projects_home + "/"
|
9
8
|
end
|
10
9
|
|
11
10
|
def buttonCreate__clicked(*args)
|
12
11
|
fn = @builder["entryFolderName"].text
|
13
|
-
fn = fn.gsub(/[^\w
|
12
|
+
fn = fn.gsub(/[^\w\.\/\-]/, '_')
|
14
13
|
path = File.join($VR_ENV_GLOBAL.projects_home, fn)
|
15
14
|
return if fn.length < 2
|
16
15
|
unless File.directory?(path)
|
data/src/main/OpenProject.rb
CHANGED
@@ -10,9 +10,9 @@ class OpenProject
|
|
10
10
|
|
11
11
|
def before_show
|
12
12
|
@ftv = ProjectTree.new()
|
13
|
+
@ftv.show
|
13
14
|
@ftv.set_show_expanders(false)
|
14
15
|
@builder["view"].add(@ftv)
|
15
|
-
@ftv.visible = true
|
16
16
|
end
|
17
17
|
|
18
18
|
def ftv__cursor_changed(*a)
|
@@ -46,14 +46,23 @@ class OpenProject
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def buttonOpen__clicked(*a)
|
49
|
+
return unless row = @ftv.selected_rows.first
|
50
|
+
test_file = File.join(row[:path], VR_ENV::SETTINGS_FILE)
|
51
|
+
if File.exists?(test_file)
|
52
|
+
@parent.proj_path = row[:path]
|
53
|
+
buttonCancel__clicked
|
54
|
+
else
|
55
|
+
@ftv.expand_or_collapse_folder()
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def buttonNewWindow__clicked(*a)
|
49
60
|
return unless row = @ftv.selected_rows.first
|
50
61
|
test_file = File.join(row[:path], VR_ENV::SETTINGS_FILE)
|
51
62
|
if File.exists?(test_file)
|
52
63
|
VR_Tools.popen("vr #{row[:path]}")
|
53
|
-
# @parent.proj_path = row[:path]
|
54
64
|
buttonCancel__clicked
|
55
65
|
else
|
56
|
-
# alert("This is not a visualruby project. It's a folder that holds visualruby projects.", :parent=>self, :width=>400)
|
57
66
|
@ftv.expand_or_collapse_folder()
|
58
67
|
end
|
59
68
|
end
|
data/src/main/VR_File_Tree.rb
CHANGED
@@ -7,8 +7,7 @@ class VR_File_Tree < VR::FileTreeView
|
|
7
7
|
super(Dir.pwd,icon_path)
|
8
8
|
@main = main
|
9
9
|
@api = RubygemsAPI.new
|
10
|
-
load_glade()
|
11
|
-
# set_show_expanders(false)
|
10
|
+
load_glade() # loads menus
|
12
11
|
end
|
13
12
|
|
14
13
|
def self__row_activated(*args)
|
@@ -123,14 +122,19 @@ class VR_File_Tree < VR::FileTreeView
|
|
123
122
|
def self__key_press_event(view, evt)
|
124
123
|
return unless evt.keyval == 65535 #delete
|
125
124
|
return unless file_name = get_selected_path()
|
126
|
-
return unless alert("Delete: <b>" + File.basename(file_name) + "</b> ?" ,
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
125
|
+
return unless alert("Delete: <b>" + File.basename(file_name) + "</b> ?" ,
|
126
|
+
:button_yes => "Delete", :button_no=>"Cancel", :parent=>self, :headline => "Delete File?")
|
127
|
+
if File.exist?(file_name) and file_name != Dir.pwd #root!
|
128
|
+
delete_me = @main.tabs.docs.select { |d| d.full_path_file.start_with?(file_name) }
|
129
|
+
delete_me.each { |d| @main.tabs.destroy_file_tab(d.full_path_file) }
|
130
|
+
delete_selected()
|
131
|
+
# @main.tabs.destroy_file_tab(file_name)
|
132
|
+
#this is where the nasty error occurs. If you save_as a file, then delete the old
|
133
|
+
# one, the following line crashes the prgogram.
|
134
|
+
# @main.file_tree.model.clear
|
135
|
+
FileUtils.rm_rf(file_name)
|
136
|
+
end
|
137
|
+
|
134
138
|
end
|
135
139
|
|
136
140
|
|
data/src/main/VR_Main.rb
CHANGED
@@ -11,20 +11,20 @@ class VR_Main
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def before_show
|
14
|
-
|
15
|
-
# there must be a visualruby directory:
|
14
|
+
|
15
|
+
# there must be a visualruby directory:
|
16
16
|
required_project = File.join(ENV["HOME"],"","visualruby", "examples","alert_box")
|
17
17
|
menuInstallExamples__activate if not File.directory?(required_project)
|
18
|
-
|
18
|
+
|
19
19
|
# load global settings (requires /home/visuaruby folder exists
|
20
20
|
$VR_ENV_GLOBAL = VR::load_yaml(:class => VR_ENV_GLOBAL, :file_name => VR_ENV_GLOBAL::GLOBAL_SETTINGS_FILE)
|
21
|
-
|
21
|
+
|
22
22
|
# try to open right project
|
23
|
-
if not project_valid?(@proj_path)
|
23
|
+
if not project_valid?(@proj_path)
|
24
24
|
if not project_valid?($VR_ENV_GLOBAL.default_project)
|
25
|
-
$VR_ENV_GLOBAL.default_project = required_project
|
26
|
-
VR::save_yaml($VR_ENV_GLOBAL)
|
27
|
-
end
|
25
|
+
$VR_ENV_GLOBAL.default_project = required_project
|
26
|
+
VR::save_yaml($VR_ENV_GLOBAL)
|
27
|
+
end
|
28
28
|
@proj_path = $VR_ENV_GLOBAL.default_project
|
29
29
|
end
|
30
30
|
|
@@ -50,9 +50,9 @@ class VR_Main
|
|
50
50
|
@remote_gem_tree = VR_Remote_Gem_Tree.new(self)
|
51
51
|
@builder["scrolledRemoteGems"].add(@remote_gem_tree)
|
52
52
|
@remote_gem_tree.show
|
53
|
-
|
54
|
-
@splash
|
55
|
-
Gtk.main_quit
|
53
|
+
|
54
|
+
@splash.destroy
|
55
|
+
Gtk.main_quit
|
56
56
|
|
57
57
|
unless project_valid?(@proj_path)
|
58
58
|
toolOpenFolder__clicked # should never gets here.
|
@@ -134,7 +134,7 @@ class VR_Main
|
|
134
134
|
end
|
135
135
|
|
136
136
|
def menuSaveAs__activate(*a)
|
137
|
-
@tabs.
|
137
|
+
@tabs.save_as()
|
138
138
|
end
|
139
139
|
|
140
140
|
def toolRefresh__clicked(*a)
|
@@ -144,27 +144,27 @@ class VR_Main
|
|
144
144
|
when 2 then @remote_gem_tree.refresh()
|
145
145
|
end
|
146
146
|
end
|
147
|
-
|
148
|
-
def toolRDoc__clicked(*a)
|
149
|
-
return unless @tabs.try_to_save_all(:ask => false)
|
150
|
-
@shell.buffer.text = $VR_ENV.rdoc_command_line + "\n"
|
147
|
+
|
148
|
+
def toolRDoc__clicked(*a)
|
149
|
+
return unless @tabs.try_to_save_all(:ask => false)
|
150
|
+
@shell.buffer.text = $VR_ENV.rdoc_command_line + "\n"
|
151
151
|
clear_events
|
152
152
|
@shell.buffer.text += `#{$VR_ENV.rdoc_command_line} 2>&1`
|
153
|
-
VR_Tools.replace_html_in_docs()
|
154
|
-
if File.exists?("yard_hack/index.html.replace")
|
155
|
-
FileUtils.copy("yard_hack/index.html.replace", "doc/index.html")
|
156
|
-
FileUtils.copy("yard_hack/index.html.replace", "doc/frames.html")
|
157
|
-
FileUtils.copy("yard_hack/common.css", "doc/css/common.css")
|
158
|
-
end
|
159
|
-
|
160
|
-
end
|
161
|
-
|
162
|
-
def toolViewRDoc__clicked(*a)
|
163
|
-
VR_Tools.popen("#{$VR_ENV_GLOBAL.browser} #{Dir.pwd}/doc/index.html")
|
164
|
-
end
|
153
|
+
VR_Tools.replace_html_in_docs()
|
154
|
+
if File.exists?("yard_hack/index.html.replace")
|
155
|
+
FileUtils.copy("yard_hack/index.html.replace", "doc/index.html")
|
156
|
+
FileUtils.copy("yard_hack/index.html.replace", "doc/frames.html")
|
157
|
+
FileUtils.copy("yard_hack/common.css", "doc/css/common.css")
|
158
|
+
end
|
159
|
+
|
160
|
+
end
|
161
|
+
|
162
|
+
def toolViewRDoc__clicked(*a)
|
163
|
+
VR_Tools.popen("#{$VR_ENV_GLOBAL.browser} #{Dir.pwd}/doc/index.html")
|
164
|
+
end
|
165
165
|
|
166
166
|
def toolSave__clicked(*a) # saves open tab
|
167
|
-
@tabs.
|
167
|
+
@tabs.try_to_save(false) # false = don't ask
|
168
168
|
end
|
169
169
|
|
170
170
|
def menuNewWindow__activate(*a)
|
@@ -202,21 +202,21 @@ class VR_Main
|
|
202
202
|
VR_Tools.back_up()
|
203
203
|
end
|
204
204
|
|
205
|
-
def toolIndent__clicked(*a)
|
205
|
+
def toolIndent__clicked(*a)
|
206
206
|
press_key(65289) #tab
|
207
207
|
end
|
208
208
|
|
209
|
-
def toolUnIndent__clicked(*a)
|
209
|
+
def toolUnIndent__clicked(*a)
|
210
210
|
press_key(65056, :shift_mask) # shift+tab
|
211
211
|
end
|
212
|
-
|
213
|
-
def press_key(keyval, mask = nil)
|
214
|
-
evt = Gdk::EventKey.new(:key_press)
|
215
|
-
evt.state = mask if mask
|
216
|
-
evt.keyval = keyval
|
217
|
-
@tabs.docs[@tabs.page].signal_emit(:key_press_event, evt)
|
218
|
-
end
|
219
|
-
|
212
|
+
|
213
|
+
def press_key(keyval, mask = nil)
|
214
|
+
evt = Gdk::EventKey.new(:key_press)
|
215
|
+
evt.state = mask if mask
|
216
|
+
evt.keyval = keyval
|
217
|
+
@tabs.docs[@tabs.page].signal_emit(:key_press_event, evt)
|
218
|
+
end
|
219
|
+
|
220
220
|
|
221
221
|
def toolComment__clicked(*a)
|
222
222
|
@tabs.docs[@tabs.page].comment()
|
@@ -316,5 +316,10 @@ class VR_Main
|
|
316
316
|
def menuQuit__activate(*a)
|
317
317
|
@builder[:window1].destroy
|
318
318
|
end
|
319
|
+
|
320
|
+
def tabs__switch_page(_self, x, page_num)
|
321
|
+
return unless tab = @tabs.docs[page_num] # needed. sometimes nil
|
322
|
+
@builder[:labelStatus].label = "Project: #{@proj_path} File: #{tab.full_path_file}"
|
323
|
+
end
|
319
324
|
|
320
325
|
end
|
data/src/main/VR_Tools.rb
CHANGED
@@ -1,10 +1,4 @@
|
|
1
1
|
module VR_Tools
|
2
|
-
|
3
|
-
def VR_Tools.clear_events
|
4
|
-
while (Gtk.events_pending?)
|
5
|
-
Gtk.main_iteration
|
6
|
-
end
|
7
|
-
end
|
8
2
|
|
9
3
|
def VR_Tools.popen(cmd)
|
10
4
|
begin
|
@@ -15,8 +9,6 @@ module VR_Tools
|
|
15
9
|
end
|
16
10
|
end
|
17
11
|
|
18
|
-
|
19
|
-
|
20
12
|
def VR_Tools.back_up()
|
21
13
|
path = File.join(ENV["HOME"], "visualruby_backup", Dir.pwd.gsub(ENV["HOME"], ""))
|
22
14
|
t = Time.now
|
@@ -48,14 +40,13 @@ module VR_Tools
|
|
48
40
|
main_file = $VR_ENV.run_command_line.split(" ")[1]
|
49
41
|
main_path = "."
|
50
42
|
bindir = "'.'" #( main_path == "bin") ? "'bin'" : "'#{main_path}', 'bin'"
|
51
|
-
libdir = "'
|
43
|
+
libdir = "'lib'" #(main_path == "lib") ? "'lib'" : "'#{main_path}', 'lib'"
|
52
44
|
str = <<END
|
53
45
|
Gem::Specification.new do |s|
|
54
46
|
s.name = "#{File.basename(Dir.pwd).downcase}" # i.e. visualruby. This name will show up in the gem list.
|
55
47
|
s.version = "0.0.1" # i.e. (major,non-backwards compatable).(backwards compatable).(bugfix)
|
56
|
-
s.add_dependency "
|
57
|
-
s.add_dependency "
|
58
|
-
s.add_dependency "require_all", ">= 0.0.1"
|
48
|
+
s.add_dependency "visualruby", ">= 3.0.15"
|
49
|
+
s.add_dependency "require_all", ">= 1.2.0"
|
59
50
|
s.has_rdoc = false
|
60
51
|
s.authors = ["Your Name"]
|
61
52
|
s.email = "you@yoursite.com" # optional
|
@@ -232,6 +232,19 @@
|
|
232
232
|
<property name="position">3</property>
|
233
233
|
</packing>
|
234
234
|
</child>
|
235
|
+
<child>
|
236
|
+
<object class="GtkButton" id="buttonNewWindow">
|
237
|
+
<property name="label" translatable="yes">Open in New Window</property>
|
238
|
+
<property name="visible">True</property>
|
239
|
+
<property name="can_focus">True</property>
|
240
|
+
<property name="receives_default">True</property>
|
241
|
+
</object>
|
242
|
+
<packing>
|
243
|
+
<property name="expand">False</property>
|
244
|
+
<property name="fill">True</property>
|
245
|
+
<property name="position">4</property>
|
246
|
+
</packing>
|
247
|
+
</child>
|
235
248
|
</object>
|
236
249
|
<packing>
|
237
250
|
<property name="expand">False</property>
|
@@ -32,6 +32,7 @@
|
|
32
32
|
<property name="visible">True</property>
|
33
33
|
<property name="can_focus">False</property>
|
34
34
|
<property name="label" translatable="yes">New Project</property>
|
35
|
+
<accelerator key="n" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
35
36
|
</object>
|
36
37
|
</child>
|
37
38
|
<child>
|
@@ -91,6 +92,7 @@
|
|
91
92
|
<property name="visible">True</property>
|
92
93
|
<property name="can_focus">False</property>
|
93
94
|
<property name="label" translatable="yes">Quit</property>
|
95
|
+
<accelerator key="q" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
94
96
|
</object>
|
95
97
|
</child>
|
96
98
|
</object>
|
@@ -163,6 +165,7 @@
|
|
163
165
|
<property name="can_focus">False</property>
|
164
166
|
<property name="tooltip_text" translatable="yes">Visit visualruby.net for complete tutorials on using Visual Ruby</property>
|
165
167
|
<property name="label" translatable="yes">Online Tutorails</property>
|
168
|
+
<accelerator key="F1" signal="activate"/>
|
166
169
|
</object>
|
167
170
|
</child>
|
168
171
|
<child>
|
data/vr
CHANGED
@@ -19,19 +19,26 @@ def load_everything
|
|
19
19
|
require_rel 'lib/'
|
20
20
|
require_rel 'src/'
|
21
21
|
|
22
|
-
VR_Main.new(ARGV, @
|
22
|
+
VR_Main.new(ARGV, @splash).show_glade()
|
23
23
|
|
24
24
|
end
|
25
25
|
|
26
26
|
$root = File.dirname(__FILE__)
|
27
27
|
|
28
|
-
@
|
29
|
-
@
|
30
|
-
|
31
|
-
|
28
|
+
@splash = Gtk::Window.new()
|
29
|
+
@splash.decorated = false
|
30
|
+
img = Gtk::Image.new(file: File.join($root, "img", "splash.png"))
|
31
|
+
img.visible = true
|
32
|
+
@splash.add(img)
|
33
|
+
@splash.show_all
|
34
|
+
@splash.position = :center_always
|
32
35
|
|
33
36
|
|
34
|
-
|
37
|
+
|
38
|
+
GLib::Timeout.add(40) {
|
39
|
+
while (Gtk.events_pending?)
|
40
|
+
Gtk.main_iteration
|
41
|
+
end
|
35
42
|
load_everything
|
36
43
|
}
|
37
44
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: visualruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Cunningham
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir:
|
10
10
|
- "."
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-06-
|
12
|
+
date: 2016-06-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gtk3
|
@@ -83,7 +83,6 @@ files:
|
|
83
83
|
- "./examples/active_record2/bin/glade/Paycheck.glade"
|
84
84
|
- "./examples/active_record2/db/development.sqlite3"
|
85
85
|
- "./examples/active_record2/main.rb"
|
86
|
-
- "./examples/alert_box/.vr_settings.yaml"
|
87
86
|
- "./examples/alert_box/bin/AlertBoxDemo.rb"
|
88
87
|
- "./examples/alert_box/bin/glade/AlertBoxDemo.glade"
|
89
88
|
- "./examples/alert_box/main.rb"
|
@@ -142,15 +141,12 @@ files:
|
|
142
141
|
- "./examples/listview_objects/bin/glade/DataObject.glade"
|
143
142
|
- "./examples/listview_objects/bin/glade/ListViewObjectsGUI.glade"
|
144
143
|
- "./examples/listview_objects/main.rb"
|
145
|
-
- "./examples/phantom/.vr_settings.yaml"
|
146
144
|
- "./examples/phantom/main.rb"
|
147
145
|
- "./examples/phantom/src/MyClass.rb"
|
148
146
|
- "./examples/phantom/src/glade/MyClass.glade"
|
149
|
-
- "./examples/pop_up/.vr_settings.yaml"
|
150
147
|
- "./examples/pop_up/main.rb"
|
151
148
|
- "./examples/pop_up/src/MyClass.rb"
|
152
149
|
- "./examples/pop_up/src/glade/MyClass.glade"
|
153
|
-
- "./examples/settings_file/.vr_settings.yaml"
|
154
150
|
- "./examples/settings_file/bin/MainApp.rb"
|
155
151
|
- "./examples/settings_file/bin/SavableSettings.rb"
|
156
152
|
- "./examples/settings_file/bin/glade/MainApp.glade"
|
@@ -175,6 +171,7 @@ files:
|
|
175
171
|
- "./img/ruby.png"
|
176
172
|
- "./img/splash.png"
|
177
173
|
- "./img/unknown.png"
|
174
|
+
- "./lib/ActLikeAHash.rb"
|
178
175
|
- "./lib/Alert.rb"
|
179
176
|
- "./lib/DragDrop.rb"
|
180
177
|
- "./lib/GladeGUI.rb"
|
@@ -207,6 +204,7 @@ files:
|
|
207
204
|
- "./lib/treeview/columns/glade/ImageCol.glade"
|
208
205
|
- "./lib/treeview/columns/glade/TextCol.glade"
|
209
206
|
- "./lib/vrlib.rb"
|
207
|
+
- "./my_yard.yaml"
|
210
208
|
- "./skeleton/document/New.glade"
|
211
209
|
- "./skeleton/document/NewWindow.rb"
|
212
210
|
- "./skeleton/project/.vr_settings.yaml"
|
@@ -1,19 +0,0 @@
|
|
1
|
-
--- !ruby/object:VR_ENV
|
2
|
-
vr_yaml_file: ".vr_settings.yaml"
|
3
|
-
width: 1329
|
4
|
-
height: 753
|
5
|
-
panel_pos: 513
|
6
|
-
notebook_panel_position: 400
|
7
|
-
run_command_line: ruby main.rb
|
8
|
-
open_files:
|
9
|
-
- "/home/eric/vrp/vr3/examples/alert_box/bin/AlertBoxDemo.rb"
|
10
|
-
open_folders:
|
11
|
-
- "/home/eric/vrp/vr3/examples/alert_box"
|
12
|
-
- "/home/eric/vrp/vr3/examples/alert_box/bin"
|
13
|
-
- "/home/eric/vrp/vr3/examples/alert_box/bin/glade"
|
14
|
-
current_file: "/home/eric/vrp/vr3/examples/alert_box/bin/AlertBoxDemo.rb"
|
15
|
-
current_line: 71
|
16
|
-
rdoc_command_line: rdoc
|
17
|
-
builder: !ruby/object:Gtk::Builder {}
|
18
|
-
top_level_window: false
|
19
|
-
settings_file_version: 1
|
@@ -1,22 +0,0 @@
|
|
1
|
-
--- !ruby/object:VR_ENV
|
2
|
-
vr_yaml_file: ".vr_settings.yaml"
|
3
|
-
width: 1102
|
4
|
-
height: 611
|
5
|
-
panel_pos: 360
|
6
|
-
notebook_panel_position: 400
|
7
|
-
run_command_line: ruby main.rb
|
8
|
-
open_files:
|
9
|
-
- "/home/eric/vrp/phantom/main.rb"
|
10
|
-
- "/home/eric/vrp/phantom/src/MyClass.rb"
|
11
|
-
open_folders:
|
12
|
-
- "/home/eric/vrp/phantom"
|
13
|
-
- "/home/eric/vrp/phantom/src"
|
14
|
-
- "/home/eric/vrp/phantom/src/glade"
|
15
|
-
current_file: "/home/eric/vrp/phantom/main.rb"
|
16
|
-
current_line: 11
|
17
|
-
rdoc_command_line: rdoc -x README
|
18
|
-
browser: firefox
|
19
|
-
backup_path: "/home/eric"
|
20
|
-
tab_spaces: 2
|
21
|
-
glade_path: glade-3
|
22
|
-
font_name: Monospace 10
|
@@ -1,19 +0,0 @@
|
|
1
|
-
--- !ruby/object:VR_ENV
|
2
|
-
vr_yaml_file: ".vr_settings.yaml"
|
3
|
-
width: 800
|
4
|
-
height: 600
|
5
|
-
panel_pos: 360
|
6
|
-
notebook_panel_position: 400
|
7
|
-
run_command_line: ruby main.rb
|
8
|
-
open_files:
|
9
|
-
- "/home/eric/vrp/vrx/Untitled"
|
10
|
-
open_folders:
|
11
|
-
- "/home/eric/vrp/examples/pop_up"
|
12
|
-
current_file: "/home/eric/vrp/vrx/Untitled"
|
13
|
-
current_line: 1
|
14
|
-
rdoc_command_line: rdoc -x README
|
15
|
-
browser: firefox
|
16
|
-
backup_path: "/home/eric"
|
17
|
-
tab_spaces: 2
|
18
|
-
glade_path: glade-3
|
19
|
-
font_name: Monospace 10
|
@@ -1,22 +0,0 @@
|
|
1
|
-
--- !ruby/object:VR_ENV
|
2
|
-
vr_yaml_file: ".vr_settings.yaml"
|
3
|
-
width: 1264
|
4
|
-
height: 727
|
5
|
-
panel_pos: 267
|
6
|
-
notebook_panel_position: 444
|
7
|
-
run_command_line: ruby main.rb
|
8
|
-
open_files:
|
9
|
-
- "/home/eric/vrp/vr3/examples/settings_file/main.rb"
|
10
|
-
- "/home/eric/vrp/vr3/examples/settings_file/bin/SavableSettings.rb"
|
11
|
-
- "/home/eric/vrp/vr3/examples/settings_file/bin/MainApp.rb"
|
12
|
-
open_folders:
|
13
|
-
- "/home/eric/vrp/vr3/examples/settings_file"
|
14
|
-
current_file: "/home/eric/vrp/vr3/examples/settings_file/main.rb"
|
15
|
-
current_line: 15
|
16
|
-
rdoc_command_line: rdoc -x README
|
17
|
-
browser: firefox
|
18
|
-
backup_path: "/home/eric"
|
19
|
-
tab_spaces: 2
|
20
|
-
glade_path: glade-3
|
21
|
-
font_name: Monospace 10
|
22
|
-
filename: ".vr_settings.yaml"
|