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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dfad4ea2ab9c0dc40116d83d3527b2c37eca5707
4
- data.tar.gz: 0545e9a2bb43d8f25456f002be2f6de45d4a909d
3
+ metadata.gz: 4552b5a897a9e272236e07ca2bdb655aedc647cc
4
+ data.tar.gz: e7e23dcc3cf9b0f4dcd412b67dbfa2c93c8b9e37
5
5
  SHA512:
6
- metadata.gz: 9d7a3d89a2780640937a303dd9eb51688e5cffa914241a808862fd84c589f7b92713f98927aa3f0963d70a936b435aad41061614372cea9ff159755d9074bd8d
7
- data.tar.gz: 87860ddce8263104e234e071876270923cefc297eb8162ceb911f756c4bd44c3e74e492841c0c77aba890bb82ef2de4d2acec013b44b3bf434134d2827e0a873
6
+ metadata.gz: c091f19fc83fa88f941fa63ed59fe79577634314ac25960fa1d0896f329e918a64b1652fa04d44e5727c371442b2e92457d53fa5ed70175de3f21880d97d0908
7
+ data.tar.gz: dc1dd9d38f6fb5a71603e6f8a766c78ebcee43f334e32c4da02adb98dad0555c426ae3f07ffb3d62cac6332b13b268d38d928edcc111214193aa4ca3c83ecb37
data/.vr_settings.yaml ADDED
@@ -0,0 +1,27 @@
1
+ --- !ruby/object:VR_ENV
2
+ width: 1364
3
+ height: 691
4
+ panel_pos: 270
5
+ run_command_line: ruby vr
6
+ open_files:
7
+ - "/home/eric/vrp/vr3/vrlib/lib/treeview/FileTreeView.rb"
8
+ - "/home/eric/vrp/vr3/bin/main/VR_Main.rb"
9
+ - "/home/eric/vrp/vr3/bin/main/OpenProject.rb"
10
+ - "/home/eric/vrp/vr3/bin/main/ProjectTree.rb"
11
+ - "/home/eric/vrp/vr3/bin/main/VR_ENV.rb"
12
+ - "/home/eric/vrp/vr3/vr.gemspec"
13
+ - "/home/eric/vrp/vr3/examples/settings_file/bin/SavableSettings.rb"
14
+ - "/home/eric/vrp/vr3/bin/editor/VR_Tabs.rb"
15
+ - "/home/eric/vrp/vr3/bin/editor/VR_TextShell.rb"
16
+ - "/home/eric/vrp/vr3/bin/main/GemTree.rb"
17
+ - "/home/eric/vrp/vr3/bin/main/VR_File_Tree.rb"
18
+ - "/home/eric/vrp/vr3/bin/editor/VR_Document.rb"
19
+ open_folders:
20
+ - "/home/eric/vrp/vr3"
21
+ current_file: "/home/eric/vrp/vr3/bin/editor/VR_Document.rb"
22
+ rdoc_command_line: rdoc -x README -x /*.glade -x /*.yaml -x /*.gemspec -x /*.css
23
+ vr_yaml_file: ".vr_settings.yaml"
24
+ notebook_panel_position: 474
25
+ current_line: 227
26
+ builder: !ruby/object:Gtk::Builder {}
27
+ top_level_window: false
@@ -1,9 +1,9 @@
1
1
 
2
2
  class VR_Document < GtkSource::View
3
-
4
- include GladeGUI
5
- include VR_TextViewCommon
6
-
3
+
4
+ include GladeGUI
5
+ include VR_TextViewCommon
6
+
7
7
 
8
8
  attr_accessor :full_path_file
9
9
 
@@ -23,204 +23,204 @@ class VR_Document < GtkSource::View
23
23
  @hilight = buffer.create_tag("hilight", { "background" => "#FFF0A0" })
24
24
  buffer.signal_connect("changed") { remove_tag(@hilight) }
25
25
  self.show_line_numbers = true
26
- self.insert_spaces_instead_of_tabs = true
27
- self.indent_width = $VR_ENV_GLOBAL.tab_spaces.to_i
26
+ self.insert_spaces_instead_of_tabs = true
27
+ self.indent_width = $VR_ENV_GLOBAL.tab_spaces.to_i
28
28
  self.highlight_current_line = true
29
29
  self.set_cursor_visible(true)
30
30
  update_style()
31
31
  end
32
32
 
33
- def get_language(fn)
34
- case File.extname(full_path_file)
35
- when ".rb", "", ".gemspec" ; return "ruby"
36
- when ".erb", ".html" ; return "html"
37
- else ; return ""
38
- end
39
- end
33
+ def get_language(fn)
34
+ case File.extname(full_path_file)
35
+ when ".rb", "", ".gemspec" ; return "ruby"
36
+ when ".erb", ".html" ; return "html"
37
+ else ; return ""
38
+ end
39
+ end
40
40
 
41
- def update_style()
41
+ def update_style()
42
42
  override_font(Pango::FontDescription.new($VR_ENV_GLOBAL.font_name))
43
43
  tab_array = Pango::TabArray.new(1, true)
44
44
  tab_array.set_tab(0, Pango::TAB_LEFT, $VR_ENV_GLOBAL.tab_spaces.to_i * 8)
45
45
  set_tabs(tab_array)
46
- end
47
-
48
- def reload_from_disk(fn = @full_path_file)
49
- @full_path_file = fn
50
- @title.label = File.basename(@full_path_file)
51
- buffer.text = File.open(@full_path_file, "r").read if File.file?(@full_path_file.to_s) #protect against nil to_s
52
- buffer.modified = false
53
- @modified_time = mod_time()
54
- end
46
+ end
47
+
48
+ def reload_from_disk(fn = @full_path_file)
49
+ @full_path_file = fn
50
+ @title.label = File.basename(@full_path_file)
51
+ buffer.text = File.open(@full_path_file, "r").read if File.file?(@full_path_file.to_s) #protect against nil to_s
52
+ buffer.modified = false
53
+ @modified_time = mod_time()
54
+ end
55
55
 
56
- def modified_time_matches()
57
- return true if @modified_time == mod_time()
58
- text = "The file: <b>#{@full_path_file}</b>\n has been modified since you loaded it:\n\nYou loaded: #{@modified_time}\nOn disk: #{mod_time().to_s}\n\nDo you wnat to keep this version?\n"
59
- ans = alert(text, headline: "Warning!", width: 400, button_yes: "Keep Current Version",
60
- button_no: "Reload Disk Version", button_cancel: "Cancel", parent: @main)
61
- if ans == true # yes, keep current
62
- write_to_disk()
63
- return true
64
- elsif ans == false # Reload From Disk
65
- reload_from_disk()
66
- end
67
- return false #abort!
68
- end
56
+ def modified_time_matches()
57
+ return true if @modified_time == mod_time()
58
+ text = "The file: <b>#{@full_path_file}</b>\n has been modified since you loaded it:\n\nYou loaded: #{@modified_time}\nOn disk: #{mod_time().to_s}\n\nDo you wnat to keep this version?\n"
59
+ ans = alert(text, headline: "Warning!", width: 400, button_yes: "Keep Current Version",
60
+ button_no: "Reload Disk Version", button_cancel: "Cancel", parent: @main)
61
+ if ans == true # yes, keep current
62
+ write_to_disk()
63
+ return true
64
+ elsif ans == false # Reload From Disk
65
+ reload_from_disk()
66
+ end
67
+ return false #abort!
68
+ end
69
69
 
70
70
 
71
- def try_to_save(ask = true)
72
- return false if not modified_time_matches()
73
- return true if empty?
74
- if (@title.label == "Untitled")
75
- return save_changes?
76
- elsif (buffer.modified? and ask)
77
- return save_changes?
78
- elsif buffer.modified?
79
- write_to_disk()
80
- return true
81
- else
82
- return true
83
- end
84
- end
71
+ def try_to_save(ask = true)
72
+ return false if not modified_time_matches()
73
+ return true if empty?
74
+ if (@title.label == "Untitled")
75
+ return save_changes?
76
+ elsif (buffer.modified? and ask)
77
+ return save_changes?
78
+ elsif buffer.modified?
79
+ write_to_disk()
80
+ return true
81
+ else
82
+ return true
83
+ end
84
+ end
85
85
 
86
86
  def write_to_disk(fn = @full_path_file)
87
- @full_path_file = fn
87
+ @full_path_file = fn
88
88
  File.open(fn, "w") { |f| f.puts(buffer.text) }
89
89
  buffer.modified = false
90
- @modified_time = mod_time()
91
- @title.label = File.basename(fn)
92
- return true
90
+ @modified_time = mod_time()
91
+ @title.label = File.basename(fn)
92
+ return true
93
93
  end
94
94
 
95
- def save_changes?
96
- answer = alert "Save chages to: <b> #{File.basename(@full_path_file)}</b> ?",
97
- parent: @main,
98
- button_yes: "Save Changes", button_no: "Discard Changes",
99
- headline: "Save Changes?", button_cancel: "Cancel"
100
- if answer == true # save
101
- return @title.label == "Untitled" ? save_as() : write_to_disk()
102
- elsif answer == false # Discard Changes
103
- reload_from_disk()
104
- return true #continue without saving
105
- end
106
- return false #abort!
107
- end
95
+ def save_changes?
96
+ answer = alert "Save chages to: <b> #{File.basename(@full_path_file)}</b> ?",
97
+ parent: @main,
98
+ button_yes: "Save Changes", button_no: "Discard Changes",
99
+ headline: "Save Changes?", button_cancel: "Cancel"
100
+ if answer == true # save
101
+ return @title.label == "Untitled" ? save_as() : write_to_disk()
102
+ elsif answer == false # Discard Changes
103
+ reload_from_disk()
104
+ return true #continue without saving
105
+ end
106
+ return false #abort!
107
+ end
108
108
 
109
109
 
110
110
 
111
111
  #todo update file tree, parent window?
112
112
  def save_as() # returns false or complete file name.
113
113
  dialog = Gtk::FileChooserDialog.new(
114
- title: "Save File As...",
114
+ title: "Save File As...",
115
115
  parent: @main.builder[:window1],
116
116
  action: :save,
117
117
  buttons: [["_Cancel", :cancel], ["_Save", :accept]])
118
118
 
119
- dialog.current_folder = File.dirname(@full_path_file)
120
- dialog.current_name = VR_Document.get_class_title(buffer.text)
121
- resp = dialog.run
122
- dialog.hide
123
- if resp == :accept
124
- write_to_disk(dialog.filename)
125
- @main.file_tree.refresh()
126
- return true
127
- end
128
- return false
119
+ dialog.current_folder = File.dirname(@full_path_file)
120
+ dialog.current_name = VR_Document.get_class_title(buffer.text)
121
+ resp = dialog.run
122
+ dialog.hide
123
+ if resp == :accept
124
+ write_to_disk(dialog.filename)
125
+ @main.file_tree.refresh()
126
+ return true
127
+ end
128
+ return false
129
129
  end
130
130
 
131
131
  def jump_to_line(line_num, search_str = nil)
132
132
  while (Gtk.events_pending?)
133
133
  Gtk.main_iteration
134
134
  end
135
- hilight_line(line_num)
135
+ hilight_line(line_num)
136
136
  iter = buffer.get_iter_at(:line => line_num - 1)
137
- buffer.place_cursor(iter)
137
+ buffer.place_cursor(iter)
138
138
  mark = buffer.get_mark("insert")
139
139
  scroll_to_mark(mark, 0.1, true, 0.0, 0.5)
140
- select_text(line_num - 1, search_str) if search_str
141
- end
142
-
143
- def hilight_line(line)
144
- remove_tag(@hilight)
145
- apply_tag_to_line(line-1, @hilight, nil)
146
- end
147
-
148
- def indent(spaces)
149
- return unless buffer.has_selection?
150
- s,e = get_selected_lines()
151
- (s..e).each do |i|
152
- iter = buffer.get_iter_at(:line => i)
153
- buffer.insert(iter, " " * spaces)
154
- end
155
- end
156
-
157
- def unindent(spaces)
158
- return unless buffer.has_selection?
159
- s,e = get_selected_lines()
160
- (s..e).each do |i|
161
- iter, iter_end = get_line_iters(i)
162
- if iter_end.offset >= iter.offset + 2
163
- iter_end.offset = iter.offset + 2
164
- t = buffer.get_text(iter, iter_end, false)
165
- buffer.delete(iter, iter_end)
166
- buffer.insert(iter,t.lstrip)
167
- end
168
- end
169
- end
170
-
171
- def comment()
172
- return unless buffer.has_selection?
173
- s,e = get_selected_lines()
174
- (s..e).each do |i|
175
- iter, iter_end = get_line_iters(i)
176
- iter_end.offset = iter.offset+1
140
+ select_text(line_num - 1, search_str) if search_str
141
+ end
142
+
143
+ def hilight_line(line)
144
+ remove_tag(@hilight)
145
+ apply_tag_to_line(line-1, @hilight, nil)
146
+ end
147
+
148
+ def indent(spaces)
149
+ return unless buffer.has_selection?
150
+ s,e = get_selected_lines()
151
+ (s..e).each do |i|
152
+ iter = buffer.get_iter_at(:line => i)
153
+ buffer.insert(iter, " " * spaces)
154
+ end
155
+ end
156
+
157
+ def unindent(spaces)
158
+ return unless buffer.has_selection?
159
+ s,e = get_selected_lines()
160
+ (s..e).each do |i|
161
+ iter, iter_end = get_line_iters(i)
162
+ if iter_end.offset >= iter.offset + 2
163
+ iter_end.offset = iter.offset + 2
164
+ t = buffer.get_text(iter, iter_end, false)
165
+ buffer.delete(iter, iter_end)
166
+ buffer.insert(iter,t.lstrip)
167
+ end
168
+ end
169
+ end
170
+
171
+ def comment()
172
+ return unless buffer.has_selection?
173
+ s,e = get_selected_lines()
174
+ (s..e).each do |i|
175
+ iter, iter_end = get_line_iters(i)
176
+ iter_end.offset = iter.offset+1
177
177
  chr = buffer.get_text(iter, iter_end, false)
178
178
  buffer.insert(iter, "#")
179
- end
180
- end
181
-
182
- def un_comment()
183
- return unless buffer.has_selection?
184
- s,e = get_selected_lines()
185
- (s..e).each do |i|
186
- iter, iter_end = get_line_iters(i)
179
+ end
180
+ end
181
+
182
+ def un_comment()
183
+ return unless buffer.has_selection?
184
+ s,e = get_selected_lines()
185
+ (s..e).each do |i|
186
+ iter, iter_end = get_line_iters(i)
187
187
  next if iter_end.offset <= iter.offset + 1
188
- iter_end.offset = iter.offset+1
188
+ iter_end.offset = iter.offset+1
189
189
  chr = buffer.get_text(iter, iter_end, false)
190
- buffer.delete(iter, iter_end) if chr == "#"
191
- end
192
- end
193
-
194
- def get_selected_lines()
195
- return unless buffer.has_selection?
196
- s,e = buffer.selection_bounds
197
- return s.line, e.line
198
- end
199
-
200
- def replace(str)
201
- return unless buffer.has_selection?
202
- s,e = buffer.selection_bounds
203
- buffer.delete(s,e)
204
- buffer.insert_at_cursor(str)
205
- end
206
-
207
- def selected_text()
208
- s,e = buffer.selection_bounds
209
- buffer.get_text(s, e, false)
210
- end
211
-
190
+ buffer.delete(iter, iter_end) if chr == "#"
191
+ end
192
+ end
193
+
194
+ def get_selected_lines()
195
+ return unless buffer.has_selection?
196
+ s,e = buffer.selection_bounds
197
+ return s.line, e.line
198
+ end
199
+
200
+ def replace(str)
201
+ return unless buffer.has_selection?
202
+ s,e = buffer.selection_bounds
203
+ buffer.delete(s,e)
204
+ buffer.insert_at_cursor(str)
205
+ end
206
+
207
+ def selected_text()
208
+ s,e = buffer.selection_bounds
209
+ buffer.get_text(s, e, false)
210
+ end
211
+
212
212
  def empty?()
213
213
  return buffer.text.strip == ''
214
214
  end
215
215
 
216
- def self.get_class_title(source_code)
217
- cn = /^\s*class\s+(\b\w+\b)/.match(source_code)
218
- cn == nil ? "Untitled" : cn[1] + ".rb"
219
- end
220
-
221
- def mod_time()
222
- return File.file?(@full_path_file) ? File.stat(@full_path_file).mtime : nil
223
- end
216
+ def self.get_class_title(source_code)
217
+ cn = /^\s*class\s+(\b\w+\b)/.match(source_code)
218
+ cn == nil ? "Untitled" : cn[1] + ".rb"
219
+ end
220
+
221
+ def mod_time()
222
+ return File.file?(@full_path_file) ? File.stat(@full_path_file).mtime : nil
223
+ end
224
224
 
225
225
  end
226
226
 
@@ -1,47 +1,47 @@
1
1
 
2
2
  module VR_TabSearch
3
3
 
4
- def find_in_tabs(str)
5
- out = "Search Results for: " + str + "\n"
6
- out += scan_for_text(str, @docs[self.page].buffer.text, @docs[self.page].full_path_file)
7
- (0..self.n_pages-1).each do |i|
8
- if i != self.page
9
- out += scan_for_text(str, @docs[i].buffer.text, @docs[i].full_path_file)
10
- end
11
- end
12
- return out
13
- end
4
+ def find_in_tabs(str)
5
+ out = "Search Results for: " + str + "\n"
6
+ out += scan_for_text(str, @docs[self.page].buffer.text, @docs[self.page].full_path_file)
7
+ (0..self.n_pages-1).each do |i|
8
+ if i != self.page
9
+ out += scan_for_text(str, @docs[i].buffer.text, @docs[i].full_path_file)
10
+ end
11
+ end
12
+ return out
13
+ end
14
14
 
15
- def find_in_all(str)
16
- out = "Search Results for: " + str + "\n"
17
- Find.find(Dir.pwd) do |path|
18
- Find.prune if path =~ /\/glade$/ or path =~ /\/doc$/ #or File.directory?(path)
19
- if (File.extname(path) == ".rb" or File.extname(path) == ".erb") and not File.directory?(path)
20
- txt = File.open(path, "r").read
21
- out += scan_for_text(str, txt, path)
22
- end
23
- end
24
- return out
25
- end
15
+ def find_in_all(str)
16
+ out = "Search Results for: " + str + "\n"
17
+ Find.find(Dir.pwd) do |path|
18
+ Find.prune if path =~ /\/glade$/ or path =~ /\/doc$/ #or File.directory?(path)
19
+ if (File.extname(path) == ".rb" or File.extname(path) == ".erb") and not File.directory?(path)
20
+ txt = File.open(path, "r").read
21
+ out += scan_for_text(str, txt, path)
22
+ end
23
+ end
24
+ return out
25
+ end
26
26
 
27
- def replace(str_replacement)
28
- @docs[self.page].replace(str_replacement)
29
- end
27
+ def replace(str_replacement)
28
+ @docs[self.page].replace(str_replacement)
29
+ end
30
30
 
31
- def scan_for_text(str, txt, path)
32
- i = 1
33
- out = ''
34
- txt.each_line do |line|
35
- match = line.scan(str)
36
- out += path + ':' + i.to_s + ": Found: "+ str + "\n" if match.size > 0
37
- i += 1
38
- end
39
- return out
40
- end
31
+ def scan_for_text(str, txt, path)
32
+ i = 1
33
+ out = ''
34
+ txt.each_line do |line|
35
+ match = line.scan(str)
36
+ out += path + ':' + i.to_s + ": Found: "+ str + "\n" if match.size > 0
37
+ i += 1
38
+ end
39
+ return out
40
+ end
41
41
 
42
- def jump_to(line)
43
- return if line.nil?
44
- load_tab(line[:path])
42
+ def jump_to(line)
43
+ return if line.nil?
44
+ load_tab(line[:path])
45
45
  @docs[self.page].jump_to_line(line[:line], line[:search_str])
46
46
  end
47
47