visualruby 3.0.2 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/.vr_settings.yaml +27 -0
  3. data/bin/editor/VR_Document.rb +156 -156
  4. data/bin/editor/VR_TabSearch.rb +37 -37
  5. data/bin/editor/VR_Tabs.rb +82 -82
  6. data/bin/editor/VR_TextShell.rb +49 -52
  7. data/bin/editor/VR_TextViewCommon.rb +31 -31
  8. data/bin/main/GemTree.rb +14 -14
  9. data/bin/main/NewProjectGUI.rb +24 -24
  10. data/bin/main/OpenProject.rb +53 -53
  11. data/bin/main/ProjectChooserView.rb +31 -31
  12. data/bin/main/ProjectTree.rb +17 -17
  13. data/bin/main/RubygemsAPI.rb +73 -63
  14. data/bin/main/VR_ENV.rb +29 -29
  15. data/bin/main/VR_ENV_GLOBAL.rb +52 -52
  16. data/bin/main/VR_File_Tree.rb +88 -88
  17. data/bin/main/VR_Local_Gem_Tree.rb +53 -53
  18. data/bin/main/VR_Main.rb +240 -238
  19. data/bin/main/VR_Remote_Gem_Tree.rb +41 -41
  20. data/bin/main/glade/Splash.glade +19 -0
  21. data/bin/tools/VR_Tools.rb +72 -72
  22. data/examples/active_record/.vr_settings.yaml +50 -0
  23. data/examples/active_record/active_record.rb +2 -2
  24. data/examples/active_record/bin/ChoosePerson.rb +10 -10
  25. data/examples/active_record/bin/Person.rb +6 -6
  26. data/examples/active_record2/.vr_settings.yaml +23 -0
  27. data/examples/active_record2/bin/CompanyGUI.rb +42 -42
  28. data/examples/active_record2/bin/Employee.rb +13 -13
  29. data/examples/active_record2/bin/Employer.rb +5 -5
  30. data/examples/active_record2/bin/Paycheck.rb +5 -5
  31. data/examples/active_record2/main.rb +4 -4
  32. data/examples/alert_box/bin/AlertBoxDemo.rb +40 -50
  33. data/examples/alert_box/bin/glade/AlertBoxDemo.glade +14 -45
  34. data/examples/all_widgets/.vr_settings.yaml +18 -0
  35. data/examples/all_widgets/bin/AllWidgets.rb +19 -16
  36. data/examples/calculator/.vr_settings.yaml +18 -0
  37. data/examples/calculator/bin/Calculator.rb +22 -22
  38. data/examples/child_window/.vr_settings.yaml +21 -0
  39. data/examples/child_window/bin/ChildWindowDemo.rb +10 -10
  40. data/examples/child_window/bin/ModalWindow.rb +4 -4
  41. data/examples/child_window/bin/ModelessWindow.rb +4 -4
  42. data/examples/child_window/bin/MyChildClass.rb +10 -10
  43. data/examples/drag_drop/.vr_settings.yaml +16 -0
  44. data/examples/drag_drop/bin/DragDropDemo.rb +28 -28
  45. data/examples/filetreeview/.vr_settings.yaml +20 -0
  46. data/examples/filetreeview/bin/ProjectTree.rb +13 -23
  47. data/examples/filetreeview/bin/ProjectTreeGUI.rb +18 -17
  48. data/examples/listview/.vr_settings.yaml +19 -0
  49. data/examples/listview/bin/SongListView.rb +72 -72
  50. data/examples/listview/bin/SongListViewGUI.rb +52 -52
  51. data/examples/listview_objects/.vr_settings.yaml +19 -0
  52. data/examples/listview_objects/bin/DataObject.rb +23 -23
  53. data/examples/listview_objects/bin/ListViewObjects.rb +29 -29
  54. data/examples/listview_objects/bin/ListViewObjectsGUI.rb +12 -12
  55. data/examples/settings_file/bin/MainApp.rb +25 -25
  56. data/examples/settings_file/bin/SavableSettings.rb +25 -26
  57. data/examples/settings_file/settings.yaml +1 -1
  58. data/examples/simple_ruby_gui/.vr_settings.yaml +20 -0
  59. data/examples/simple_ruby_gui/bin/DataObjectGUI.rb +12 -12
  60. data/examples/treeview/.vr_settings.yaml +17 -0
  61. data/examples/treeview/bin/MyClass.rb +18 -17
  62. data/examples/treeview/bin/glade/MyClass.glade +61 -6
  63. data/skeleton/document/NewWindow.rb +8 -8
  64. data/skeleton/project/.vr_settings.yaml +15 -0
  65. data/skeleton/project/bin/MyClass.rb +7 -7
  66. data/vr +38 -41
  67. data/vrlib/doc/images/add.png +0 -0
  68. data/vrlib/doc/images/arrow_up.png +0 -0
  69. data/vrlib/doc/images/brick.png +0 -0
  70. data/vrlib/doc/images/brick_link.png +0 -0
  71. data/vrlib/doc/images/bug.png +0 -0
  72. data/vrlib/doc/images/bullet_black.png +0 -0
  73. data/vrlib/doc/images/bullet_toggle_minus.png +0 -0
  74. data/vrlib/doc/images/bullet_toggle_plus.png +0 -0
  75. data/vrlib/doc/images/date.png +0 -0
  76. data/vrlib/doc/images/delete.png +0 -0
  77. data/vrlib/doc/images/find.png +0 -0
  78. data/vrlib/doc/images/macFFBgHack.png +0 -0
  79. data/vrlib/doc/images/package.png +0 -0
  80. data/vrlib/doc/images/page_green.png +0 -0
  81. data/vrlib/doc/images/page_white_text.png +0 -0
  82. data/vrlib/doc/images/page_white_width.png +0 -0
  83. data/vrlib/doc/images/plugin.png +0 -0
  84. data/vrlib/doc/images/ruby.png +0 -0
  85. data/vrlib/doc/images/tag_blue.png +0 -0
  86. data/vrlib/doc/images/tag_green.png +0 -0
  87. data/vrlib/doc/images/transparent.png +0 -0
  88. data/vrlib/doc/images/wrench.png +0 -0
  89. data/vrlib/doc/images/wrench_orange.png +0 -0
  90. data/vrlib/doc/images/zoom.png +0 -0
  91. data/vrlib/lib/Alert.rb +98 -55
  92. data/vrlib/lib/DragDrop.rb +43 -43
  93. data/vrlib/lib/GladeGUI.rb +207 -207
  94. data/vrlib/lib/IconHash.rb +10 -10
  95. data/vrlib/lib/SavableClass.rb +38 -38
  96. data/vrlib/lib/SimpleComboBoxEntry.rb +3 -3
  97. data/vrlib/lib/treeview/FileTreeView.rb +71 -70
  98. data/vrlib/lib/treeview/IterMethods.rb +35 -35
  99. data/vrlib/lib/treeview/ListView.rb +25 -25
  100. data/vrlib/lib/treeview/TreeView.rb +15 -15
  101. data/vrlib/lib/treeview/ViewCommon.rb +134 -131
  102. data/vrlib/lib/treeview/columns/CalendarCol.rb +48 -48
  103. data/vrlib/lib/treeview/columns/CellRendererCombo.rb +26 -26
  104. data/vrlib/lib/treeview/columns/CellRendererDate.rb +25 -25
  105. data/vrlib/lib/treeview/columns/CellRendererObject.rb +37 -37
  106. data/vrlib/lib/treeview/columns/CellRendererPhone.rb +25 -25
  107. data/vrlib/lib/treeview/columns/CellRendererPixbuf.rb +8 -8
  108. data/vrlib/lib/treeview/columns/CellRendererProgress.rb +8 -8
  109. data/vrlib/lib/treeview/columns/CellRendererSpin.rb +17 -17
  110. data/vrlib/lib/treeview/columns/CellRendererText.rb +18 -18
  111. data/vrlib/lib/treeview/columns/CellRendererToggle.rb +25 -25
  112. data/vrlib/lib/treeview/columns/ComboCol.rb +12 -12
  113. data/vrlib/lib/treeview/columns/CurrencyCol.rb +13 -13
  114. data/vrlib/lib/treeview/columns/DateCol.rb +10 -10
  115. data/vrlib/lib/treeview/columns/ImageCol.rb +16 -16
  116. data/vrlib/lib/treeview/columns/SpinCol.rb +5 -5
  117. data/vrlib/lib/treeview/columns/TextCol.rb +24 -24
  118. data/vrlib/lib/treeview/columns/TreeViewColumn.rb +71 -76
  119. data/vrlib/rdoc_replace.yaml +36 -36
  120. metadata +43 -6
  121. data/Splash.rb +0 -40
@@ -3,118 +3,118 @@ class VR_Tabs < Gtk::Notebook
3
3
 
4
4
  attr_reader :docs
5
5
 
6
- include VR_TabSearch
6
+ include VR_TabSearch
7
7
 
8
8
  def initialize(main)
9
9
  super()
10
10
  @docs = Array.new
11
11
  @main = main
12
12
  @pix_close = Gdk::Pixbuf.new(File.dirname(__FILE__) + '/../../img/close.png')
13
- @close_filename = File.dirname(__FILE__) + '/../../img/close.png'
14
- self.scrollable = true #after super
15
- self.expand = true
13
+ @close_filename = File.dirname(__FILE__) + '/../../img/close.png'
14
+ self.scrollable = true #after super
15
+ self.expand = true
16
16
  end
17
17
 
18
- def update_style_all()
19
- @docs.each { |doc| doc.update_style() }
20
- end
18
+ def update_style_all()
19
+ @docs.each { |doc| doc.update_style() }
20
+ end
21
21
 
22
- def try_to_save_all(flags)
23
- ask = flags[:ask]
24
- passed = true
25
- @docs.each do |doc|
26
- unless doc.try_to_save(ask)
27
- passed = false
28
- end
29
- end
30
- (n_pages).times { destroy_tab() } if flags[:close]
31
- return passed
32
- end
22
+ def try_to_save_all(flags)
23
+ ask = flags[:ask]
24
+ passed = true
25
+ @docs.each do |doc|
26
+ unless doc.try_to_save(ask)
27
+ passed = false
28
+ end
29
+ end
30
+ (n_pages).times { destroy_tab() } if flags[:close]
31
+ return passed
32
+ end
33
33
 
34
34
  ##todo update file_tree!
35
- # def try_to_save_all(ask = true)
36
- # @docs.each do |doc|
37
- # return false unless doc.try_to_save(ask)
38
- # end
39
- # end
35
+ # def try_to_save_all(ask = true)
36
+ # @docs.each do |doc|
37
+ # return false unless doc.try_to_save(ask)
38
+ # end
39
+ # end
40
40
  #
41
41
  ##todo update file_tree!
42
- # def try_to_close_all(ask = true)
43
- # return false unless try_to_save_all(ask)
44
- # (n_pages).times { destroy_tab() }
45
- # end
42
+ # def try_to_close_all(ask = true)
43
+ # return false unless try_to_save_all(ask)
44
+ # (n_pages).times { destroy_tab() }
45
+ # end
46
46
 
47
47
 
48
48
  def switch_to(path)
49
- i = @docs.index{ |d| d.full_path_file == path }
50
- return false if i.nil?
49
+ i = @docs.index{ |d| d.full_path_file == path }
50
+ return false if i.nil?
51
51
  self.page = i if i != self.page
52
- return true
52
+ return true
53
53
  end
54
54
 
55
- def set_contents(text)
56
- if @docs[self.page].buffer.text == ""
57
- @docs[self.page].buffer.text = text
58
- @docs[self.page].buffer.modified = false
59
- end
60
- end
55
+ def set_contents(text)
56
+ if @docs[self.page].buffer.text == ""
57
+ @docs[self.page].buffer.text = text
58
+ @docs[self.page].buffer.modified = false
59
+ end
60
+ end
61
61
 
62
- def load_tab(full_path_file = Dir.pwd + "/Untitled")
62
+ def load_tab(full_path_file = Dir.pwd + "/Untitled")
63
63
  return if switch_to(full_path_file)
64
- box = Gtk::EventBox.new
65
- tab = Gtk::Box.new(:horizontal)
66
- img = Gtk::Image.new(:pixbuf => @pix_close)
67
- box.add(img)
68
- title = Gtk::Label.new(File.basename(full_path_file))
69
- tab.pack_start(title, :expand=>true, :fill=>true, :padding=>2)
70
- tab.pack_start(box)
64
+ box = Gtk::EventBox.new
65
+ tab = Gtk::Box.new(:horizontal)
66
+ img = Gtk::Image.new(:pixbuf => @pix_close)
67
+ box.add(img)
68
+ title = Gtk::Label.new(File.basename(full_path_file))
69
+ tab.pack_start(title, :expand=>true, :fill=>true, :padding=>2)
70
+ tab.pack_start(box)
71
71
  tab.show_all #needed
72
- text = VR_Document.new(full_path_file, title, @main)
73
- child = Gtk::ScrolledWindow.new
74
- child.add(text)
75
- box.signal_connect("button_release_event") {remove_id(text.object_id)}
76
- #remove blank tab
77
- if @docs.size == 1 and @docs[0].buffer.text.strip == ""
78
- @docs[0] = text
79
- self.remove_page(0)
80
- end
72
+ text = VR_Document.new(full_path_file, title, @main)
73
+ child = Gtk::ScrolledWindow.new
74
+ child.add(text)
75
+ box.signal_connect("button_release_event") {remove_id(text.object_id)}
76
+ #remove blank tab
77
+ if @docs.size == 1 and @docs[0].buffer.text.strip == ""
78
+ @docs[0] = text
79
+ self.remove_page(0)
80
+ end
81
81
  child.show_all #needed
82
- append_page(child, tab)
83
- self.page = self.n_pages - 1
84
- @docs[self.page] = text
85
- end
86
-
87
- #used when little 'x' image is clicked to close.
88
- def remove_id(object_id)
89
- i = @docs.index { |doc| doc.object_id == object_id }
90
- if @docs[i].try_to_save(true)
91
- destroy_tab(i)
92
- end
93
- end
94
-
95
- #if its there, destroys it
96
- def destroy_file_tab(file_name)
97
- destroy_tab() if switch_to(file_name)
98
- end
82
+ append_page(child, tab)
83
+ self.page = self.n_pages - 1
84
+ @docs[self.page] = text
85
+ end
86
+
87
+ #used when little 'x' image is clicked to close.
88
+ def remove_id(object_id)
89
+ i = @docs.index { |doc| doc.object_id == object_id }
90
+ if @docs[i].try_to_save(true)
91
+ destroy_tab(i)
92
+ end
93
+ end
94
+
95
+ #if its there, destroys it
96
+ def destroy_file_tab(file_name)
97
+ destroy_tab() if switch_to(file_name)
98
+ end
99
99
 
100
100
  # this spits out a bunch of warnings on remove_page
101
- def destroy_tab(tab = self.page)
101
+ def destroy_tab(tab = self.page)
102
102
  self.page = self.page - 1 # stops some warnings
103
103
  VR_Tools.clear_events
104
- # self.set_tab_label(get_nth_page(tab), nil)
105
- self.remove_page(tab)
104
+ # self.set_tab_label(get_nth_page(tab), nil)
105
+ self.remove_page(tab)
106
106
  VR_Tools.clear_events
107
- @docs.delete_at(tab)
108
- load_tab() if @docs.empty?
109
- end
107
+ @docs.delete_at(tab)
108
+ load_tab() if @docs.empty?
109
+ end
110
110
 
111
- def get_open_fn()
112
- @docs.inject([]) { |ar, doc| ar << doc.full_path_file }
113
- end
111
+ def get_open_fn()
112
+ @docs.inject([]) { |ar, doc| ar << doc.full_path_file }
113
+ end
114
114
 
115
- def open_file_names(ar)
116
- ar.each { |fn| load_tab(fn) if File.file?(fn) and fn.include? Dir.pwd}
115
+ def open_file_names(ar)
116
+ ar.each { |fn| load_tab(fn) if File.file?(fn) and fn.include? Dir.pwd}
117
117
  load_tab() if @docs.empty?
118
- end
118
+ end
119
119
 
120
120
  end
@@ -1,61 +1,58 @@
1
1
 
2
2
  class VR_TextShell < GtkSource::View
3
3
 
4
- include VR_TextViewCommon
4
+ include VR_TextViewCommon
5
5
 
6
- def initialize(tabs)
7
- super()
8
- @tabs = tabs
9
- @current_line = 0
10
- @lines = [] #needed
11
- self.editable = false
12
- @blue = buffer.create_tag("blue", { "foreground" => "#0000A0", "underline" => Pango::UNDERLINE_SINGLE })
6
+ def initialize(tabs)
7
+ super()
8
+ @tabs = tabs
9
+ @current_line = 0
10
+ @lines = [] #needed
11
+ self.editable = false
12
+ @blue = buffer.create_tag("blue", { "foreground" => "#0000A0", "underline" => Pango::UNDERLINE_SINGLE })
13
13
  self.highlight_current_line = true
14
- # @hilight = buffer.create_tag("hilight", { "background" => "#FFF0A0" } )
15
- signal_connect("button_release_event") { puts "release" ; jump_to(line_at_cursor() - 1) } #buffer's lines start at 1
16
- signal_connect("key_release_event") { jump_to(line_at_cursor() - 1) } #buffer's lines start at 1
17
- end
14
+ @hilight = buffer.create_tag("hilight", { "background" => "#FFF0A0" } )
15
+ signal_connect("button_release_event") { jump_to(line_at_cursor() - 1) } #buffer's lines start at 1
16
+ signal_connect("key_release_event") { jump_to(line_at_cursor() - 1) } #buffer's lines start at 1
17
+ end
18
18
 
19
+ def hilight_links(text, jump_to_first)
20
+ self.buffer.text = text
21
+ first_valid_line = load_lines()
22
+ (0..@lines.size - 1).each do |i|
23
+ next if @lines[i].nil?
24
+ apply_tag_to_line(i, @blue, @lines[i][:file_name] + ":" + @lines[i][:line].to_s)
25
+ end
26
+ @current_line = 0
27
+ @tabs.jump_to(first_valid_line) if jump_to_first and first_valid_line
28
+ end
19
29
 
20
- def hilight_links(text, jump_to_first)
21
- self.buffer.text = text
22
- first_valid_line = load_lines()
23
- (0..@lines.size - 1).each do |i|
24
- next if @lines[i].nil?
25
- apply_tag_to_line(i, @blue, @lines[i][:file_name] + ":" + @lines[i][:line].to_s)
26
- end
27
- @current_line = 0
28
- @tabs.jump_to(first_valid_line) if jump_to_first and first_valid_line
29
- end
30
-
31
- def load_lines()
32
- @lines = []
33
- first = nil
34
- reg = /^.*(#{Dir.pwd}[\w+|\/]*)\/([\w|\.]+):(\d+):/
35
- reg_str = /Found:\s(.+)$/
36
- self.buffer.text. each_line do |l|
37
- m = reg.match(l)
38
- if m.nil?
39
- @lines << nil
40
- else
41
- m2 = reg_str.match(l)
42
- search_str = (m2.nil?) ? "" : m2[1]
43
- @lines << { :path => m[1] + "/" + m[2], :file_name => m[2], :line => m[3].to_i, :search_str => search_str }
44
- first ||= @lines.last
45
- end
46
- end
47
- return first
48
- end
49
-
50
- def jump_to(line_no = @current_line+1)
51
- puts "fed: " + line_no.to_s
52
- return false if line_no > @lines.size
53
- @current_line = line_no
54
- # remove_tag(@hilight)
55
- # apply_tag_to_line(@current_line, @hilight, nil)
56
- puts "jumping to " + line_no.to_s + " = " + @lines[line_no].to_s
57
- @tabs.jump_to(@lines[@current_line])
58
- return false #must return false for button_up event
59
- end
30
+ def load_lines()
31
+ @lines = []
32
+ first = nil
33
+ reg = /^.*(#{Dir.pwd}[\w+|\/]*)\/([\w|\.]+):(\d+):/
34
+ reg_str = /Found:\s(.+)$/
35
+ self.buffer.text. each_line do |l|
36
+ m = reg.match(l)
37
+ if m.nil?
38
+ @lines << nil
39
+ else
40
+ m2 = reg_str.match(l)
41
+ search_str = (m2.nil?) ? "" : m2[1]
42
+ @lines << { :path => m[1] + "/" + m[2], :file_name => m[2], :line => m[3].to_i, :search_str => search_str }
43
+ first ||= @lines.last
44
+ end
45
+ end
46
+ return first
47
+ end
48
+
49
+ def jump_to(line_no = @current_line+1)
50
+ return false if line_no > @lines.size
51
+ @current_line = line_no
52
+ remove_tag(@hilight)
53
+ apply_tag_to_line(@current_line, @hilight, nil)
54
+ @tabs.jump_to(@lines[@current_line])
55
+ return false #must return false for button_up event
56
+ end
60
57
 
61
58
  end
@@ -1,46 +1,46 @@
1
1
  module VR_TextViewCommon
2
2
 
3
- def get_line_iters(line, search_str = nil)
4
- s = buffer.get_iter_at(:line => line)
5
- e = get_end_iter(s)
6
- if !search_str.nil?
7
- s, e = s.forward_search(search_str, :text_only, e)
8
- end
9
- return s, e
10
- end
11
-
12
- def select_text(line, search_str = nil)
13
- s, e = get_line_iters(line, search_str)
14
- return if s.nil? or e.nil?
3
+ def get_line_iters(line, search_str = nil)
4
+ s = buffer.get_iter_at(:line => line)
5
+ e = get_end_iter(s)
6
+ if !search_str.nil?
7
+ s, e = s.forward_search(search_str, :text_only, e)
8
+ end
9
+ return s, e
10
+ end
11
+
12
+ def select_text(line, search_str = nil)
13
+ s, e = get_line_iters(line, search_str)
14
+ return if s.nil? or e.nil?
15
15
  buffer.place_cursor(s)
16
- # buffer.move_mark(buffer.get_mark("insert"),s)
17
- buffer.move_mark(buffer.get_mark("selection_bound"), e)
18
- end
16
+ # buffer.move_mark(buffer.get_mark("insert"),s)
17
+ buffer.move_mark(buffer.get_mark("selection_bound"), e)
18
+ end
19
19
 
20
20
 
21
- def apply_tag_to_line(line, tag, search_str = nil)
22
- s, e = get_line_iters(line, search_str)
23
- buffer.apply_tag(tag, s, e)
24
- end
21
+ def apply_tag_to_line(line, tag, search_str = nil)
22
+ s, e = get_line_iters(line, search_str)
23
+ buffer.apply_tag(tag, s, e)
24
+ end
25
25
 
26
-
26
+
27
27
 
28
- def get_end_iter(iter)
28
+ def get_end_iter(iter)
29
29
  if iter.line == buffer.line_count - 1 # last line
30
30
  return buffer.end_iter
31
31
  end
32
32
  return buffer.get_iter_at(:line => iter.line+1)
33
- end
34
-
35
- def remove_tag(tag)
36
- s, e = buffer.bounds
37
- buffer.remove_tag(tag, s, e)
38
- end
39
-
40
- def line_at_cursor()
33
+ end
34
+
35
+ def remove_tag(tag)
36
+ s, e = buffer.bounds
37
+ buffer.remove_tag(tag, s, e)
38
+ end
39
+
40
+ def line_at_cursor()
41
41
  cursor_pos = buffer.cursor_position
42
42
  iter = buffer.get_iter_at(:offset => cursor_pos) #get_iter_at_offset depricated
43
- return iter.line + 1
44
- end
43
+ return iter.line + 1
44
+ end
45
45
 
46
46
  end
data/bin/main/GemTree.rb CHANGED
@@ -1,23 +1,23 @@
1
1
 
2
2
  class GemTree < VR::ListView
3
3
 
4
- RUBY_ICON = Gdk::Pixbuf.new(File.dirname(__FILE__) + '/../../img/rb.png')
4
+ RUBY_ICON = Gdk::Pixbuf.new(File.dirname(__FILE__) + '/../../img/rb.png')
5
5
 
6
- def initialize()
7
- hash = {:gems => {:pix => Gdk::Pixbuf, :gem => String}}
8
- super(hash)
9
- self.headers_visible = false
10
- @api = RubygemsAPI.new
11
- end
6
+ def initialize()
7
+ hash = {:gems => {:pix => Gdk::Pixbuf, :gem => String}}
8
+ super(hash)
9
+ self.headers_visible = false
10
+ @api = RubygemsAPI.new
11
+ end
12
12
 
13
- def self__button_release_event(w, event)
14
- return unless selection.selected and event.button == 3 #right mouse
15
- @builder['popGem'].popup(nil, nil, event.button, event.time)
13
+ def self__button_release_event(w, event)
14
+ return unless selection.selected and event.button == 3 #right mouse
15
+ @builder['popGem'].popup(nil, nil, event.button, event.time)
16
16
  end
17
17
 
18
- def get_name_ver(line)
19
- match = /^(.*)\s+\((.*)\)/.match(line)
20
- return match[1], match[2]
21
- end
18
+ def get_name_ver(line)
19
+ match = /^(.*)\s+\((.*)\)/.match(line)
20
+ return match[1], match[2]
21
+ end
22
22
 
23
23
  end
@@ -1,33 +1,33 @@
1
1
 
2
2
  class NewProjectGUI
3
3
 
4
- include GladeGUI
4
+ include GladeGUI
5
5
 
6
- attr_accessor :my_var
6
+ attr_accessor :my_var
7
7
 
8
- def initialize(parent)
9
- @parent = parent
10
- @projects_home = $VR_ENV_GLOBAL.projects_home + "/"
11
- end
8
+ def initialize(parent)
9
+ @parent = parent
10
+ @projects_home = $VR_ENV_GLOBAL.projects_home + "/"
11
+ end
12
12
 
13
- def buttonCreate__clicked(*args)
14
- fn = @builder["entryFolderName"].text
15
- fn = fn.gsub(/[^\w\.\/]/, '_')
16
- path = File.join($VR_ENV_GLOBAL.projects_home + "/" + fn)
17
- if File.directory?(path)
18
- alert "The folder <b>" + path + "</b> is already ok disk. You can open it using the <b>Open Project</b> button.",
19
- :headline=> "Project Already Exists", :parent => self, :width => 500
20
- else
21
- FileUtils.mkpath path
22
- VR_Tools.copy_skeleton_project(path)
23
- @parent.proj_path = path
24
- @builder["window1"].destroy
25
- end
26
- end
13
+ def buttonCreate__clicked(*args)
14
+ fn = @builder["entryFolderName"].text
15
+ fn = fn.gsub(/[^\w\.\/]/, '_')
16
+ path = File.join($VR_ENV_GLOBAL.projects_home + "/" + fn)
17
+ if File.directory?(path)
18
+ alert "The folder <b>" + path + "</b> is already ok disk. You can open it using the <b>Open Project</b> button.",
19
+ :headline=> "Project Already Exists", :parent => self, :width => 500
20
+ else
21
+ FileUtils.mkpath path
22
+ VR_Tools.copy_skeleton_project(path)
23
+ @parent.proj_path = path
24
+ @builder["window1"].destroy
25
+ end
26
+ end
27
27
 
28
- def buttonCancel__clicked(*args)
29
- @my_var = "Hello"
30
- # @builder["window1"].destroy
31
- end
28
+ def buttonCancel__clicked(*args)
29
+ @my_var = "Hello"
30
+ # @builder["window1"].destroy
31
+ end
32
32
 
33
33
  end
@@ -1,69 +1,69 @@
1
1
 
2
2
  class OpenProject
3
3
 
4
- include GladeGUI
4
+ include GladeGUI
5
5
 
6
- def initialize(parent)
7
- @parent = parent
8
- @projects_home = $VR_ENV_GLOBAL.projects_home
9
- end
6
+ def initialize(parent)
7
+ @parent = parent
8
+ @projects_home = $VR_ENV_GLOBAL.projects_home
9
+ end
10
10
 
11
- def before_show
12
- @ftv = ProjectTree.new()
13
- @ftv.set_show_expanders(false)
14
- @builder["view"].add(@ftv)
15
- @ftv.visible = true
16
- end
11
+ def before_show
12
+ @ftv = ProjectTree.new()
13
+ @ftv.set_show_expanders(false)
14
+ @builder["view"].add(@ftv)
15
+ @ftv.visible = true
16
+ end
17
17
 
18
- def ftv__cursor_changed(*a)
19
- return unless row = @ftv.selected_rows.first
20
- @ftv.expand_or_collapse_folder()
21
- end
18
+ def ftv__cursor_changed(*a)
19
+ # return unless row = @ftv.selected_rows.first
20
+ @ftv.expand_or_collapse_folder()
21
+ end
22
22
 
23
23
  def ftv__row_activated(_self, path, col)
24
- buttonOpen__clicked
25
- end
24
+ buttonOpen__clicked
25
+ end
26
26
 
27
- def buttonChange__clicked(*a)
28
- $VR_ENV_GLOBAL.show_glade(self)
29
- @projects_home = $VR_ENV_GLOBAL.projects_home
30
- @ftv.refresh(:root => @projects_home)
31
- @builder[:projects_home].label = @projects_home
32
- end
27
+ def buttonChange__clicked(*a)
28
+ $VR_ENV_GLOBAL.show_glade(self)
29
+ @projects_home = $VR_ENV_GLOBAL.projects_home
30
+ @ftv.refresh(:root => @projects_home)
31
+ @builder[:projects_home].label = @projects_home
32
+ end
33
33
 
34
- def buttonDelete__clicked(*a)
35
- return unless row = @ftv.selected_rows.first
36
- return if row[:path] == Dir.pwd #can't delete current project
37
- if alert("Do you really want to delete \n<b>" + row[:path] + " </b>?",
38
- parent: self, headline: "Warning!", button_yes: "Delete", button_no: "Cancel", width: 400)
39
- FileUtils.remove_dir(row[:path], true)
40
- @ftv.refresh()
41
- end
42
- end
34
+ def buttonDelete__clicked(*a)
35
+ return unless row = @ftv.selected_rows.first
36
+ return if row[:path] == Dir.pwd #can't delete current project
37
+ if alert("Do you really want to delete \n<b>" + row[:path] + " </b>?",
38
+ parent: self, headline: "Warning!", button_yes: "Delete", button_no: "Cancel", width: 400)
39
+ FileUtils.remove_dir(row[:path], true)
40
+ @ftv.refresh()
41
+ end
42
+ end
43
43
 
44
- def buttonOpen__clicked(*a)
45
- return unless row = @ftv.selected_rows.first
46
- test_file = File.join(row[:path], VR_ENV::SETTINGS_FILE)
47
- if File.exists?(test_file)
48
- @parent.proj_path = row[:path]
49
- buttonCancel__clicked
50
- else
51
- # alert("This is not a visualruby project. It's a folder that holds visualruby projects.", :parent=>self, :width=>400)
52
- @ftv.expand_or_collapse_folder()
53
- end
54
- end
44
+ def buttonOpen__clicked(*a)
45
+ return unless row = @ftv.selected_rows.first
46
+ test_file = File.join(row[:path], VR_ENV::SETTINGS_FILE)
47
+ if File.exists?(test_file)
48
+ @parent.proj_path = row[:path]
49
+ buttonCancel__clicked
50
+ else
51
+ # alert("This is not a visualruby project. It's a folder that holds visualruby projects.", :parent=>self, :width=>400)
52
+ @ftv.expand_or_collapse_folder()
53
+ end
54
+ end
55
55
 
56
- def buttonNew__clicked(*a)
57
- old_proj_path = @parent.proj_path
58
- NewProjectGUI.new(@parent).show_glade(self)
59
- @builder[:window1].destroy if @parent.proj_path != old_proj_path #new path created!
60
- end
56
+ def buttonNew__clicked(*a)
57
+ old_proj_path = @parent.proj_path
58
+ NewProjectGUI.new(@parent).show_glade(self)
59
+ @builder[:window1].destroy if @parent.proj_path != old_proj_path #new path created!
60
+ end
61
61
 
62
62
 
63
- def buttonCancel__clicked(*a) #save state
64
- $VR_ENV_GLOBAL.projects_home_open_folders = @ftv.get_open_folders()
65
- VR::save_yaml($VR_ENV_GLOBAL)
66
- @builder["window1"].destroy
67
- end
63
+ def buttonCancel__clicked(*a) #save state
64
+ $VR_ENV_GLOBAL.projects_home_open_folders = @ftv.get_open_folders()
65
+ VR::save_yaml($VR_ENV_GLOBAL)
66
+ @builder["window1"].destroy
67
+ end
68
68
 
69
69
  end