visualruby 3.0.2 → 3.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.vr_settings.yaml +27 -0
- data/bin/editor/VR_Document.rb +156 -156
- data/bin/editor/VR_TabSearch.rb +37 -37
- data/bin/editor/VR_Tabs.rb +82 -82
- data/bin/editor/VR_TextShell.rb +49 -52
- data/bin/editor/VR_TextViewCommon.rb +31 -31
- data/bin/main/GemTree.rb +14 -14
- data/bin/main/NewProjectGUI.rb +24 -24
- data/bin/main/OpenProject.rb +53 -53
- data/bin/main/ProjectChooserView.rb +31 -31
- data/bin/main/ProjectTree.rb +17 -17
- data/bin/main/RubygemsAPI.rb +73 -63
- data/bin/main/VR_ENV.rb +29 -29
- data/bin/main/VR_ENV_GLOBAL.rb +52 -52
- data/bin/main/VR_File_Tree.rb +88 -88
- data/bin/main/VR_Local_Gem_Tree.rb +53 -53
- data/bin/main/VR_Main.rb +240 -238
- data/bin/main/VR_Remote_Gem_Tree.rb +41 -41
- data/bin/main/glade/Splash.glade +19 -0
- data/bin/tools/VR_Tools.rb +72 -72
- data/examples/active_record/.vr_settings.yaml +50 -0
- data/examples/active_record/active_record.rb +2 -2
- data/examples/active_record/bin/ChoosePerson.rb +10 -10
- data/examples/active_record/bin/Person.rb +6 -6
- data/examples/active_record2/.vr_settings.yaml +23 -0
- data/examples/active_record2/bin/CompanyGUI.rb +42 -42
- data/examples/active_record2/bin/Employee.rb +13 -13
- data/examples/active_record2/bin/Employer.rb +5 -5
- data/examples/active_record2/bin/Paycheck.rb +5 -5
- data/examples/active_record2/main.rb +4 -4
- data/examples/alert_box/bin/AlertBoxDemo.rb +40 -50
- data/examples/alert_box/bin/glade/AlertBoxDemo.glade +14 -45
- data/examples/all_widgets/.vr_settings.yaml +18 -0
- data/examples/all_widgets/bin/AllWidgets.rb +19 -16
- data/examples/calculator/.vr_settings.yaml +18 -0
- data/examples/calculator/bin/Calculator.rb +22 -22
- data/examples/child_window/.vr_settings.yaml +21 -0
- data/examples/child_window/bin/ChildWindowDemo.rb +10 -10
- data/examples/child_window/bin/ModalWindow.rb +4 -4
- data/examples/child_window/bin/ModelessWindow.rb +4 -4
- data/examples/child_window/bin/MyChildClass.rb +10 -10
- data/examples/drag_drop/.vr_settings.yaml +16 -0
- data/examples/drag_drop/bin/DragDropDemo.rb +28 -28
- data/examples/filetreeview/.vr_settings.yaml +20 -0
- data/examples/filetreeview/bin/ProjectTree.rb +13 -23
- data/examples/filetreeview/bin/ProjectTreeGUI.rb +18 -17
- data/examples/listview/.vr_settings.yaml +19 -0
- data/examples/listview/bin/SongListView.rb +72 -72
- data/examples/listview/bin/SongListViewGUI.rb +52 -52
- data/examples/listview_objects/.vr_settings.yaml +19 -0
- data/examples/listview_objects/bin/DataObject.rb +23 -23
- data/examples/listview_objects/bin/ListViewObjects.rb +29 -29
- data/examples/listview_objects/bin/ListViewObjectsGUI.rb +12 -12
- data/examples/settings_file/bin/MainApp.rb +25 -25
- data/examples/settings_file/bin/SavableSettings.rb +25 -26
- data/examples/settings_file/settings.yaml +1 -1
- data/examples/simple_ruby_gui/.vr_settings.yaml +20 -0
- data/examples/simple_ruby_gui/bin/DataObjectGUI.rb +12 -12
- data/examples/treeview/.vr_settings.yaml +17 -0
- data/examples/treeview/bin/MyClass.rb +18 -17
- data/examples/treeview/bin/glade/MyClass.glade +61 -6
- data/skeleton/document/NewWindow.rb +8 -8
- data/skeleton/project/.vr_settings.yaml +15 -0
- data/skeleton/project/bin/MyClass.rb +7 -7
- data/vr +38 -41
- data/vrlib/doc/images/add.png +0 -0
- data/vrlib/doc/images/arrow_up.png +0 -0
- data/vrlib/doc/images/brick.png +0 -0
- data/vrlib/doc/images/brick_link.png +0 -0
- data/vrlib/doc/images/bug.png +0 -0
- data/vrlib/doc/images/bullet_black.png +0 -0
- data/vrlib/doc/images/bullet_toggle_minus.png +0 -0
- data/vrlib/doc/images/bullet_toggle_plus.png +0 -0
- data/vrlib/doc/images/date.png +0 -0
- data/vrlib/doc/images/delete.png +0 -0
- data/vrlib/doc/images/find.png +0 -0
- data/vrlib/doc/images/macFFBgHack.png +0 -0
- data/vrlib/doc/images/package.png +0 -0
- data/vrlib/doc/images/page_green.png +0 -0
- data/vrlib/doc/images/page_white_text.png +0 -0
- data/vrlib/doc/images/page_white_width.png +0 -0
- data/vrlib/doc/images/plugin.png +0 -0
- data/vrlib/doc/images/ruby.png +0 -0
- data/vrlib/doc/images/tag_blue.png +0 -0
- data/vrlib/doc/images/tag_green.png +0 -0
- data/vrlib/doc/images/transparent.png +0 -0
- data/vrlib/doc/images/wrench.png +0 -0
- data/vrlib/doc/images/wrench_orange.png +0 -0
- data/vrlib/doc/images/zoom.png +0 -0
- data/vrlib/lib/Alert.rb +98 -55
- data/vrlib/lib/DragDrop.rb +43 -43
- data/vrlib/lib/GladeGUI.rb +207 -207
- data/vrlib/lib/IconHash.rb +10 -10
- data/vrlib/lib/SavableClass.rb +38 -38
- data/vrlib/lib/SimpleComboBoxEntry.rb +3 -3
- data/vrlib/lib/treeview/FileTreeView.rb +71 -70
- data/vrlib/lib/treeview/IterMethods.rb +35 -35
- data/vrlib/lib/treeview/ListView.rb +25 -25
- data/vrlib/lib/treeview/TreeView.rb +15 -15
- data/vrlib/lib/treeview/ViewCommon.rb +134 -131
- data/vrlib/lib/treeview/columns/CalendarCol.rb +48 -48
- data/vrlib/lib/treeview/columns/CellRendererCombo.rb +26 -26
- data/vrlib/lib/treeview/columns/CellRendererDate.rb +25 -25
- data/vrlib/lib/treeview/columns/CellRendererObject.rb +37 -37
- data/vrlib/lib/treeview/columns/CellRendererPhone.rb +25 -25
- data/vrlib/lib/treeview/columns/CellRendererPixbuf.rb +8 -8
- data/vrlib/lib/treeview/columns/CellRendererProgress.rb +8 -8
- data/vrlib/lib/treeview/columns/CellRendererSpin.rb +17 -17
- data/vrlib/lib/treeview/columns/CellRendererText.rb +18 -18
- data/vrlib/lib/treeview/columns/CellRendererToggle.rb +25 -25
- data/vrlib/lib/treeview/columns/ComboCol.rb +12 -12
- data/vrlib/lib/treeview/columns/CurrencyCol.rb +13 -13
- data/vrlib/lib/treeview/columns/DateCol.rb +10 -10
- data/vrlib/lib/treeview/columns/ImageCol.rb +16 -16
- data/vrlib/lib/treeview/columns/SpinCol.rb +5 -5
- data/vrlib/lib/treeview/columns/TextCol.rb +24 -24
- data/vrlib/lib/treeview/columns/TreeViewColumn.rb +71 -76
- data/vrlib/rdoc_replace.yaml +36 -36
- metadata +43 -6
- data/Splash.rb +0 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4552b5a897a9e272236e07ca2bdb655aedc647cc
|
4
|
+
data.tar.gz: e7e23dcc3cf9b0f4dcd412b67dbfa2c93c8b9e37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/bin/editor/VR_Document.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
|
2
2
|
class VR_Document < GtkSource::View
|
3
|
-
|
4
|
-
|
5
|
-
|
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
|
-
|
27
|
-
|
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
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
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
|
-
|
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
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
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
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
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
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
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
|
-
|
87
|
+
@full_path_file = fn
|
88
88
|
File.open(fn, "w") { |f| f.puts(buffer.text) }
|
89
89
|
buffer.modified = false
|
90
|
-
|
91
|
-
|
92
|
-
|
90
|
+
@modified_time = mod_time()
|
91
|
+
@title.label = File.basename(fn)
|
92
|
+
return true
|
93
93
|
end
|
94
94
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
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
|
-
|
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
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
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
|
-
|
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
|
-
|
141
|
-
end
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
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
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
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
|
-
|
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
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
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
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
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
|
|
data/bin/editor/VR_TabSearch.rb
CHANGED
@@ -1,47 +1,47 @@
|
|
1
1
|
|
2
2
|
module VR_TabSearch
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
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
|
-
|
28
|
-
|
29
|
-
|
27
|
+
def replace(str_replacement)
|
28
|
+
@docs[self.page].replace(str_replacement)
|
29
|
+
end
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
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
|
-
|
43
|
-
|
44
|
-
|
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
|
|