visualruby 1.0.19 → 3.0.2

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.
Files changed (182) hide show
  1. checksums.yaml +4 -4
  2. data/Splash.rb +40 -0
  3. data/bin/editor/VR_Document.rb +81 -74
  4. data/bin/editor/VR_TabSearch.rb +5 -7
  5. data/bin/editor/VR_Tabs.rb +57 -36
  6. data/bin/editor/VR_TextShell.rb +12 -34
  7. data/bin/editor/VR_TextViewCommon.rb +9 -28
  8. data/bin/main/NewProjectGUI.rb +14 -13
  9. data/bin/main/OpenProject.rb +69 -0
  10. data/bin/main/ProjectChooserView.rb +3 -2
  11. data/bin/main/ProjectTree.rb +25 -0
  12. data/bin/main/RubygemsAPI.rb +15 -11
  13. data/bin/main/VR_ENV.rb +38 -60
  14. data/bin/main/VR_ENV_GLOBAL.rb +45 -44
  15. data/bin/main/VR_File_Tree.rb +29 -21
  16. data/bin/main/VR_Local_Gem_Tree.rb +4 -19
  17. data/bin/main/VR_Main.rb +128 -144
  18. data/bin/main/VR_Remote_Gem_Tree.rb +6 -19
  19. data/bin/main/glade/NewProjectGUI.glade +94 -98
  20. data/bin/main/glade/OpenProject.glade +259 -0
  21. data/bin/main/glade/RubygemsAPI.glade +98 -62
  22. data/bin/main/glade/VR_ENV.glade +46 -55
  23. data/bin/main/glade/VR_ENV_GLOBAL.glade +251 -180
  24. data/bin/main/glade/VR_File_Tree.glade +25 -16
  25. data/bin/main/glade/VR_Local_Gem_Tree.glade +16 -8
  26. data/bin/main/glade/VR_Main.glade +410 -449
  27. data/bin/main/glade/VR_Remote_Gem_Tree.glade +33 -31
  28. data/bin/tools/VR_Tools.rb +60 -46
  29. data/{visualruby_examples → examples}/active_record/active_record.rb +16 -10
  30. data/{visualruby_examples → examples}/active_record/bin/ChoosePerson.rb +7 -0
  31. data/examples/active_record/bin/Person.rb +21 -0
  32. data/examples/active_record/bin/glade/ChoosePerson.glade +89 -0
  33. data/examples/active_record/bin/glade/Person.glade +197 -0
  34. data/{visualruby_examples → examples}/active_record/db/development.sqlite3 +0 -0
  35. data/{visualruby_examples → examples}/active_record2/bin/CompanyGUI.rb +7 -7
  36. data/{visualruby_examples → examples}/active_record2/bin/Employee.rb +0 -0
  37. data/{visualruby_examples → examples}/active_record2/bin/Employer.rb +0 -0
  38. data/{visualruby_examples → examples}/active_record2/bin/Paycheck.rb +0 -0
  39. data/examples/active_record2/bin/glade/CompanyGUI.glade +149 -0
  40. data/examples/active_record2/bin/glade/Employee.glade +126 -0
  41. data/{visualruby_examples → examples}/active_record2/bin/glade/Employer.glade +0 -0
  42. data/{visualruby_examples → examples}/active_record2/bin/glade/Paycheck.glade +0 -0
  43. data/{visualruby_examples → examples}/active_record2/db/development.sqlite3 +0 -0
  44. data/{visualruby_examples → examples}/active_record2/main.rb +15 -9
  45. data/examples/alert_box/bin/AlertBoxDemo.rb +80 -0
  46. data/examples/alert_box/bin/glade/AlertBoxDemo.glade +234 -0
  47. data/examples/alert_box/main.rb +12 -0
  48. data/{visualruby_examples → examples}/all_widgets/bin/AllWidgets.rb +18 -10
  49. data/{visualruby_examples → examples}/all_widgets/bin/glade/AllWidgets.glade +52 -16
  50. data/{visualruby_examples → examples}/all_widgets/bin/splash.png +0 -0
  51. data/examples/all_widgets/main.rb +12 -0
  52. data/{visualruby_examples → examples}/calculator/bin/Calculator.rb +23 -22
  53. data/{visualruby_examples → examples}/calculator/bin/glade/Calculator.glade +81 -51
  54. data/examples/calculator/main.rb +13 -0
  55. data/examples/child_window/bin/ChildWindowDemo.rb +52 -0
  56. data/examples/child_window/bin/ModalWindow.rb +9 -0
  57. data/examples/child_window/bin/ModelessWindow.rb +9 -0
  58. data/examples/child_window/bin/MyChildClass.rb +21 -0
  59. data/examples/child_window/bin/glade/ChildWindowDemo.glade +87 -0
  60. data/examples/child_window/bin/glade/ModalWindow.glade +61 -0
  61. data/examples/child_window/bin/glade/ModelessWindow.glade +61 -0
  62. data/{visualruby_examples → examples}/child_window/bin/glade/MyChildClass.glade +14 -12
  63. data/examples/child_window/main.rb +12 -0
  64. data/{visualruby_examples → examples}/drag_drop/bin/DragDropDemo.rb +9 -10
  65. data/examples/drag_drop/bin/glade/DragDropDemo.glade +161 -0
  66. data/{visualruby_examples → examples}/drag_drop/img/folder.png +0 -0
  67. data/{visualruby_examples → examples}/drag_drop/img/glade.png +0 -0
  68. data/{visualruby_examples → examples}/drag_drop/img/gtk-edit.png +0 -0
  69. data/{visualruby_examples → examples}/drag_drop/img/obj.png +0 -0
  70. data/{visualruby_examples → examples}/drag_drop/img/png.png +0 -0
  71. data/{visualruby_examples → examples}/drag_drop/img/rb.png +0 -0
  72. data/{visualruby_examples → examples}/drag_drop/img/ruby.png +0 -0
  73. data/{visualruby_examples → examples}/drag_drop/img/unknown.png +0 -0
  74. data/examples/drag_drop/main.rb +11 -0
  75. data/examples/filetreeview/bin/ProjectTree.rb +32 -0
  76. data/examples/filetreeview/bin/ProjectTreeGUI.rb +28 -0
  77. data/examples/filetreeview/bin/glade/ProjectTreeGUI.glade +156 -0
  78. data/examples/filetreeview/main.rb +13 -0
  79. data/{visualruby_examples → examples}/listview/bin/SongListView.rb +24 -20
  80. data/{visualruby_examples → examples}/listview/bin/SongListViewGUI.rb +12 -11
  81. data/{visualruby_examples → examples}/listview/bin/audio-x-generic.png +0 -0
  82. data/examples/listview/bin/glade/SongListViewGUI.glade +195 -0
  83. data/examples/listview/main.rb +10 -0
  84. data/examples/listview_objects/bin/DataObject.rb +53 -0
  85. data/{visualruby_examples → examples}/listview_objects/bin/ListViewObjects.rb +7 -4
  86. data/examples/listview_objects/bin/ListViewObjectsGUI.rb +26 -0
  87. data/examples/listview_objects/bin/glade/DataObject.glade +196 -0
  88. data/examples/listview_objects/bin/glade/ListViewObjectsGUI.glade +87 -0
  89. data/examples/listview_objects/main.rb +12 -0
  90. data/examples/settings_file/bin/MainApp.rb +38 -0
  91. data/examples/settings_file/bin/SavableSettings.rb +39 -0
  92. data/examples/settings_file/bin/glade/MainApp.glade +87 -0
  93. data/examples/settings_file/bin/glade/SavableSettings.glade +162 -0
  94. data/examples/settings_file/main.rb +14 -0
  95. data/examples/settings_file/settings.yaml +15 -0
  96. data/examples/simple_ruby_gui/bin/DataObjectGUI.rb +21 -0
  97. data/examples/simple_ruby_gui/bin/glade/DataObjectGUI.glade +195 -0
  98. data/examples/simple_ruby_gui/main.rb +16 -0
  99. data/{visualruby_examples → examples}/treeview/bin/MyClass.rb +1 -5
  100. data/examples/treeview/bin/glade/MyClass.glade +24 -0
  101. data/examples/treeview/main.rb +13 -0
  102. data/skeleton/document/New.glade +3 -4
  103. data/skeleton/document/NewWindow.rb +1 -1
  104. data/skeleton/project/bin/MyClass.rb +2 -2
  105. data/skeleton/project/bin/glade/MyClass.glade +12 -26
  106. data/skeleton/project/main.rb +4 -8
  107. data/vr +41 -37
  108. data/vrlib/lib/Alert.rb +67 -0
  109. data/vrlib/lib/DragDrop.rb +90 -0
  110. data/vrlib/lib/GladeGUI.rb +433 -0
  111. data/vrlib/lib/IconHash.rb +18 -0
  112. data/vrlib/lib/SavableClass.rb +56 -0
  113. data/vrlib/lib/SimpleComboBoxEntry.rb +8 -0
  114. data/vrlib/lib/glade/Alert.glade +119 -0
  115. data/vrlib/lib/treeview/FileTreeView.rb +113 -0
  116. data/vrlib/lib/treeview/IterMethods.rb +82 -0
  117. data/vrlib/lib/treeview/ListView.rb +85 -0
  118. data/vrlib/lib/treeview/TreeView.rb +43 -0
  119. data/vrlib/lib/treeview/ViewCommon.rb +370 -0
  120. data/vrlib/lib/treeview/columns/CalendarCol.rb +89 -0
  121. data/vrlib/lib/treeview/columns/CellRendererCombo.rb +66 -0
  122. data/vrlib/lib/treeview/columns/CellRendererDate.rb +45 -0
  123. data/vrlib/lib/treeview/columns/CellRendererObject.rb +57 -0
  124. data/vrlib/lib/treeview/columns/CellRendererPhone.rb +45 -0
  125. data/vrlib/lib/treeview/columns/CellRendererPixbuf.rb +16 -0
  126. data/vrlib/lib/treeview/columns/CellRendererProgress.rb +17 -0
  127. data/vrlib/lib/treeview/columns/CellRendererSpin.rb +37 -0
  128. data/vrlib/lib/treeview/columns/CellRendererText.rb +38 -0
  129. data/vrlib/lib/treeview/columns/CellRendererToggle.rb +47 -0
  130. data/vrlib/lib/treeview/columns/ComboCol.rb +43 -0
  131. data/vrlib/lib/treeview/columns/CurrencyCol.rb +23 -0
  132. data/vrlib/lib/treeview/columns/DateCol.rb +20 -0
  133. data/vrlib/lib/treeview/columns/ImageCol.rb +27 -0
  134. data/vrlib/lib/treeview/columns/ProgressCol.rb +27 -0
  135. data/vrlib/lib/treeview/columns/SpinCol.rb +11 -0
  136. data/vrlib/lib/treeview/columns/TextCol.rb +65 -0
  137. data/vrlib/lib/treeview/columns/TreeViewColumn.rb +93 -0
  138. data/{bin/main/glade/ProjectChooserGUI.glade → vrlib/lib/treeview/columns/glade/CalendarCol.glade} +71 -63
  139. data/{bin/main/glade/Splash.glade → vrlib/lib/treeview/columns/glade/ImageCol.glade} +5 -6
  140. data/vrlib/lib/treeview/columns/glade/TextCol.glade +82 -0
  141. data/vrlib/rdoc_replace.yaml +77 -0
  142. data/vrlib/vrlib.rb +7 -0
  143. metadata +163 -136
  144. data/bin/editor/glade/VR_Document.glade +0 -160
  145. data/bin/main/ProjectChooserGUI.rb +0 -41
  146. data/bin/main/Splash.rb +0 -22
  147. data/visualruby_examples/active_record/.vr_settings.yaml +0 -47
  148. data/visualruby_examples/active_record/bin/Person.rb +0 -13
  149. data/visualruby_examples/active_record/bin/glade/ChoosePerson.glade +0 -61
  150. data/visualruby_examples/active_record/bin/glade/Person.glade +0 -148
  151. data/visualruby_examples/active_record2/.vr_settings.yaml +0 -16
  152. data/visualruby_examples/active_record2/bin/glade/CompanyGUI.glade +0 -167
  153. data/visualruby_examples/active_record2/bin/glade/Employee.glade +0 -123
  154. data/visualruby_examples/all_widgets/.vr_settings.yaml +0 -13
  155. data/visualruby_examples/all_widgets/main.rb +0 -14
  156. data/visualruby_examples/calculator/.vr_settings.yaml +0 -11
  157. data/visualruby_examples/calculator/main.rb +0 -13
  158. data/visualruby_examples/child_window/.vr_settings.yaml +0 -16
  159. data/visualruby_examples/child_window/bin/ChildWindowDemo.rb +0 -39
  160. data/visualruby_examples/child_window/bin/MyChildClass.rb +0 -40
  161. data/visualruby_examples/child_window/bin/glade/ChildWindowDemo.glade +0 -101
  162. data/visualruby_examples/child_window/main.rb +0 -13
  163. data/visualruby_examples/drag_drop/.vr_settings.yaml +0 -12
  164. data/visualruby_examples/drag_drop/bin/glade/DragDropDemo.glade +0 -143
  165. data/visualruby_examples/drag_drop/main.rb +0 -14
  166. data/visualruby_examples/listview/.vr_settings.yaml +0 -12
  167. data/visualruby_examples/listview/bin/glade/SongListViewGUI.glade +0 -220
  168. data/visualruby_examples/listview/main.rb +0 -19
  169. data/visualruby_examples/listview_objects/.vr_settings.yaml +0 -16
  170. data/visualruby_examples/listview_objects/bin/DataObject.rb +0 -32
  171. data/visualruby_examples/listview_objects/bin/DataObjectGUI.rb +0 -41
  172. data/visualruby_examples/listview_objects/bin/ListViewObjectsGUI.rb +0 -18
  173. data/visualruby_examples/listview_objects/bin/glade/DataObject.glade +0 -198
  174. data/visualruby_examples/listview_objects/bin/glade/ListViewObjectsGUI.glade +0 -102
  175. data/visualruby_examples/listview_objects/main.rb +0 -13
  176. data/visualruby_examples/simple_ruby_gui/.vr_settings.yaml +0 -16
  177. data/visualruby_examples/simple_ruby_gui/bin/DataObjectGUI.rb +0 -20
  178. data/visualruby_examples/simple_ruby_gui/bin/glade/DataObjectGUI.glade +0 -163
  179. data/visualruby_examples/simple_ruby_gui/main.rb +0 -16
  180. data/visualruby_examples/treeview/.vr_settings.yaml +0 -12
  181. data/visualruby_examples/treeview/bin/glade/MyClass.glade +0 -48
  182. data/visualruby_examples/treeview/main.rb +0 -14
data/bin/main/VR_Main.rb CHANGED
@@ -1,108 +1,98 @@
1
-
2
1
  class VR_Main
3
2
 
4
3
  include GladeGUI
5
4
 
6
5
  attr_accessor :proj_path, :tabs, :shell, :builder, :file_tree
7
6
 
8
- def initialize(argv)
9
- @proj_path = argv[0] == "new" ? new_project(argv[1]) : argv[0]
10
- @proj_path = @proj_path == nil ? Dir.pwd : @proj_path.chomp("/")
11
- @proj_path = ENV["HOME"] unless File.split(@proj_path).length >= 2 and File.directory?(@proj_path)
12
- end
13
-
7
+ def initialize(argv)
8
+ @proj_path = argv[0] ? argv[0] : Dir.pwd
9
+ @proj_path = @proj_path.chomp("/")
10
+ end
11
+
14
12
  def before_show
15
- # splash = Splash.new
16
- # splash.show(self)
13
+ # there must be a visualruby directory:
14
+ menuInstallExamples__activate if not File.directory?(File.join(ENV["HOME"],"","visualruby", "examples","drag_drop"))
15
+ # load global settings (requires /home/visuaruby folder exists
16
+ $VR_ENV_GLOBAL = VR::load_yaml(:class => VR_ENV_GLOBAL, :file_name => VR_ENV_GLOBAL::GLOBAL_SETTINGS_FILE)
17
+ # try to open right project
18
+
19
+ if not project_valid?(@proj_path)
20
+ @proj_path = $VR_ENV_GLOBAL.default_project if project_valid?($VR_ENV_GLOBAL.default_project)
21
+ end
22
+
17
23
  @file_tree = VR_File_Tree.new(self, File.expand_path(File.dirname(__FILE__) + "/../../img"))
18
24
  @builder["scrolledwindowFileTree"].add(@file_tree)
19
25
 
20
26
  #add document notebook
21
- @tabs = VR_Tabs.new(self)
22
- @builder["vboxTabs"].add(@tabs)
27
+ @tabs = VR_Tabs.new(self)
28
+ @builder["boxTabs"].add(@tabs)
29
+ @tabs.show
23
30
 
24
31
  #add shell textview
25
32
  @shell = VR_TextShell.new(@tabs)
26
- @builder["scrollShell"].add(@shell)
33
+ @builder["scrollShell"].add(@shell)
34
+ @shell.show
27
35
 
28
36
  #add local gem tab
29
37
  @gem_tree = VR_Local_Gem_Tree.new(self)
30
- @builder['scrolledLocalGems'].add(@gem_tree)
38
+ @builder['scrolledLocalGems'].add(@gem_tree)
39
+ @gem_tree.show
40
+
31
41
  #add remote gem tab
32
42
  @remote_gem_tree = VR_Remote_Gem_Tree.new(self)
33
43
  @builder["scrolledRemoteGems"].add(@remote_gem_tree)
34
-
35
- menuInstallExamples__activate if not File.directory?(File.join(ENV["HOME"],"","visualruby", "examples", "drag_drop"))
36
-
37
- if Dir.entries(@proj_path).join == "..." #empty
38
- VR_Tools.copy_recursively(File.dirname(__FILE__) + "/../../skeleton/project", @proj_path)
39
- end
40
-
41
- if not File.file?(@proj_path + "/" + VR_ENV::SETTINGS_FILE)
42
- menuInstallExamples__activate if Dir.glob(ENV["HOME"] + File.join( "", "**", VR_ENV::SETTINGS_FILE)).size == 0
43
- toolOpenFolder_clicked
44
- else
45
- load_project(@proj_path)
44
+ @remote_gem_tree.show
45
+
46
+ unless project_valid?(@proj_path)
47
+ toolOpenFolder__clicked
46
48
  end
47
- # splash.destroy_window()cvnc
48
- # show_window() if not $VR_ENV.nil?
49
- end
50
49
 
51
- def project_valid?(proj_path)
52
- return false if proj_path.nil?
53
- if not File.directory?(proj_path.to_s)
54
- VR::Dialog.message_box("This folder is invalid:\n\n" + proj_path)
55
- return false
56
- end
57
- if ENV["HOME"] == proj_path
58
- return false
59
- end
60
- if Dir.entries(proj_path).join == "..." #empty
61
- VR_Tools.copy_recursively(File.dirname(__FILE__) + "/../../skeleton/project", proj_path)
62
- return true
63
- elsif not File.file?(proj_path + "/" + VR_ENV::SETTINGS_FILE)
64
- return VR::Dialog.ok_box("No Visual Ruby project file was found in this folder:\n " + proj_path + " Do you wan to open it anyway?")
65
- end #success!
50
+ if project_valid?(@proj_path)
51
+ load_project
52
+ else
53
+ exit
54
+ end
55
+ $splash.destroy if $splash
56
+ Gtk.main_quit
57
+
58
+ end
59
+
60
+ def project_valid?(proj_path)
61
+ return false if proj_path.nil? or proj_path == ""
62
+ return false if ENV["HOME"] == proj_path
63
+ return false unless File.directory?(proj_path)
64
+ return false unless File.file?(File.join(proj_path, VR_ENV::SETTINGS_FILE))
66
65
  return true
67
66
  end
68
67
 
69
- def load_project(proj_path) #assumes valid_project? is true
70
- FileUtils.cd(proj_path)
68
+
69
+ def load_project() # assumes valid_project? is true
70
+ FileUtils.cd(@proj_path)
71
71
  @builder['window1'].title = "VR: " + File.basename(Dir.pwd)
72
72
  @builder["labelStatus"].label = Dir.pwd
73
- $VR_ENV = VR_ENV.load_yaml()
74
- $VR_ENV_GLOBAL = VR_ENV_GLOBAL.load_yaml()
73
+ @file_tree.root = @proj_path
75
74
  @file_tree.refresh()
76
- load_state()
77
75
  @shell.buffer.text = ""
76
+ # if default project invalid, set default
77
+ unless project_valid?($VR_ENV_GLOBAL.default_project)
78
+ $VR_ENV_GLOBAL.default_project = @proj_path
79
+ VR::save_yaml($VR_ENV_GLOBAL)
80
+ end
81
+ load_state()
78
82
  end
79
-
80
- def new_project(proj_path)
81
- return nil unless proj_path
82
- path = File.join(Dir.pwd,proj_path)
83
- FileUtils.mkdir(path) unless File.directory?(path)
84
- return path
85
- end
86
-
87
- def toolBack_clicked
88
- @tabs.back()
89
- end
90
-
91
- def toolOpenFolder_clicked
83
+
84
+ def toolOpenFolder__clicked(*a)
92
85
  save_state
93
- return unless @tabs.try_to_save_all()
86
+ return unless @tabs.try_to_save_all(:ask=>true)
94
87
  old_path = @proj_path
95
- ProjectChooserGUI.new(self).show() #modal stops execution here, sets @proj_path
96
- # return if @proj_path == old_path #first time needs to be ok
97
- if project_valid?(@proj_path)
98
- @tabs.try_to_close_all()
99
- load_project(@proj_path)
100
- else
101
- @proj_path = old_path
88
+ OpenProject.new(self).show_glade(self)
89
+ if old_path != @proj_path
90
+ @tabs.try_to_save_all(:ask => false, :close => true)
91
+ load_project()
102
92
  end
103
93
  end
104
94
 
105
- def notebookTree_changed #file, gem notebook
95
+ def notebookTree_changed #file, gem notebook
106
96
  case @builder['notebookTree'].page
107
97
  when 1 then @gem_tree.refresh()
108
98
  when 2 then @remote_gem_tree.refresh(false) #false = don't force refresh
@@ -111,44 +101,41 @@ class VR_Main
111
101
 
112
102
  def window1_key_press(win, key)
113
103
  case x = key.keyval
114
- when 65474 then toolRun_clicked # F5
115
- # when 115 then toolSave_clicked # Ctrl-S
104
+ when 65474 then toolRun__clicked # F5
105
+ # when 115 then toolSave__clicked # Ctrl-S
116
106
  end
117
107
  end
118
-
119
- def menuCreateLauncher__activate(*a)
120
- VR_Tools.create_desktop_launcher
121
- end
122
108
 
123
109
  def menuCloseAll__activate(*a)
124
- @tabs.try_to_close_all()
110
+ @tabs.try_to_save_all(:close=>true)
125
111
  end
126
112
 
127
113
  def menuSettings__activate(*a)
128
- $VR_ENV.show()
114
+ $VR_ENV.show_glade(self)
115
+ end
116
+
117
+ def menuGlobalSettings__activate(*a)
118
+ $VR_ENV_GLOBAL.show_glade(self)
119
+ @tabs.update_style_all()
129
120
  end
130
-
131
- def menuGlobalSettings__activate(*a)
132
- $VR_ENV_GLOBAL.show()
133
- @tabs.update_style_all()
134
- end
135
121
 
136
122
  def menuWWWRubygems__activate(*a)
137
123
  VR_Tools.popen("#{$VR_ENV_GLOBAL.browser} https://rubygems.org/users/new")
138
- end
139
-
124
+ end
125
+
140
126
  def menuSaveAll__activate(*a)
141
- @tabs.try_to_save_all(false) # don't prompt
127
+ @tabs.try_to_save_all(:ask=>false) # don't prompt
142
128
  end
143
129
 
144
130
  def menuNew__activate(*a)
145
131
  @tabs.load_tab()
146
132
  end
133
+
147
134
  def menuSaveAs__activate(*a)
148
135
  @tabs.docs[@tabs.page].save_as()
149
136
  end
150
137
 
151
- def toolRefresh_clicked
138
+ def toolRefresh__clicked(*a)
152
139
  case @builder['notebookTree'].page
153
140
  when 0 then @file_tree.refresh()
154
141
  when 1 then @gem_tree.refresh()
@@ -156,77 +143,68 @@ class VR_Main
156
143
  end
157
144
  end
158
145
 
159
- def toolSave_clicked() # saves open tab
160
- @tabs.docs[@tabs.page].try_to_save(false)
146
+ def toolSave__clicked(*a) # saves open tab
147
+ @tabs.docs[@tabs.page].try_to_save(false) # false = don't ask
161
148
  end
162
149
 
163
-
164
- #returns false to abort!
165
-
166
-
167
150
  def menuNewWindow__activate(*a)
168
151
  fn = File.dirname(__FILE__) + "/../../skeleton/document/NewWindow.rb"
169
152
  @tabs.load_tab()
170
153
  @tabs.set_contents(File.open(fn).read)
171
154
  end
172
-
155
+
173
156
  def menuNewProject__activate(*a)
174
157
  save_state
175
- return unless @tabs.try_to_save_all()
158
+ return unless @tabs.try_to_save_all(:ask=>true)
176
159
  old_path = @proj_path
177
- NewProjectGUI.new(self).show
178
- if project_valid?(@proj_path)
179
- @tabs.try_to_close_all()
180
- load_project(@proj_path)
181
- else
182
- @proj_path = old_path
183
- end
160
+ NewProjectGUI.new(self).show_glade(self)
161
+ if old_path != @proj_path
162
+ @tabs.try_to_save_all(:ask=>false, :close=>true)
163
+ load_project
164
+ end
165
+ end
166
+
167
+ def toolHome__clicked(*a)
168
+ default_project = $VR_ENV_GLOBAL.default_project
169
+ return if default_project == @proj_path
170
+ if not project_valid?(default_project)
171
+ alert("Your default home project is invalid:\n\n<b>#{default_project}</b>.\n\nGo to: Tools > Global Settings to set it.",
172
+ parent: self, headline: "Invalid Home Project")
173
+ return
174
+ end
175
+ return unless @tabs.try_to_save_all( ask: true, close: true)
176
+ @proj_path = default_project
177
+ load_project
184
178
  end
185
-
186
- def toolBackUp_clicked
187
- return unless @tabs.try_to_save_all()
188
- # path = File.join(ENV["HOME"], "visualruby_backup", Dir.pwd.gsub(ENV["HOME"], ""))
179
+
180
+ def toolBackUp__clicked(*a)
181
+ return unless @tabs.try_to_save_all(:ask=>true)
189
182
  VR_Tools.back_up()
190
- # VR::Dialog.message_box("Files backed up to: \n\n" + path)
191
- end
192
-
193
- # def toolBackUp_clicked
194
- # return unless @tabs.try_to_save_all()
195
- # path = $VR_ENV.backup_path
196
- # return if path.nil?
197
- # if File.directory?(path) and path.gsub('\\', '/').include?(ENV["HOME"])
198
- # VR_Tools.back_up(Dir.pwd, path)
199
- # VR::Dialog.message_box("Files backed up to: \n\n" + path)
200
- # else
201
- # VR::Dialog.message_box("Backup path must be subdirecory of #{ENV['HOME']}:\n\n InValid: " + path)
202
- # menuSettings__activate
203
- # end
204
- # end
205
-
206
-
207
- def toolIndent_clicked
183
+ end
184
+
185
+ def toolIndent__clicked(*a)
208
186
  @tabs.docs[@tabs.page].indent($VR_ENV_GLOBAL.tab_spaces)
209
187
  end
210
188
 
211
- def toolUnIndent_clicked
189
+ def toolUnIndent__clicked(*a)
212
190
  @tabs.docs[@tabs.page].unindent($VR_ENV_GLOBAL.tab_spaces)
213
191
  end
214
192
 
215
- def toolComment_clicked
193
+ def toolComment__clicked(*a)
216
194
  @tabs.docs[@tabs.page].comment()
217
195
  end
218
196
 
219
- def toolUnComment_clicked
197
+ def toolUnComment__clicked(*a)
220
198
  @tabs.docs[@tabs.page].un_comment()
221
199
  end
222
200
 
223
- def toolRun_clicked
201
+ def toolRun__clicked(*a)
224
202
  run_command($VR_ENV.run_command_line)
225
203
  end
226
204
 
227
205
  def run_command(cmd)
228
206
  save_state()
229
- return unless @tabs.try_to_save_all(false) # false = don't prompt for changes to files
207
+ return unless @tabs.try_to_save_all(:ask => false) # false = don't prompt for changes to files
230
208
  cur_dir = Dir.pwd
231
209
  result = "\n#{cur_dir}$ #{cmd}\n"
232
210
  result += `#{cmd} 2>&1`
@@ -235,30 +213,33 @@ class VR_Main
235
213
  end
236
214
 
237
215
  def save_state
238
- return if $VR_ENV == nil
216
+ return unless $VR_ENV
239
217
  $VR_ENV.width, $VR_ENV.height = @builder["window1"].size()
240
218
  $VR_ENV.panel_pos = @builder["panelMain"].position
219
+ $VR_ENV.notebook_panel_position = @builder["panelNotebook"].position
241
220
  $VR_ENV.open_folders = @file_tree.get_open_folders()
242
221
  $VR_ENV.open_files = @tabs.get_open_fn()
243
222
  $VR_ENV.current_file = @tabs.docs[@tabs.page].full_path_file
244
- $VR_ENV.save_yaml()
223
+ $VR_ENV.current_line = @tabs.docs[@tabs.page].line_at_cursor()
224
+ VR::save_yaml($VR_ENV)
245
225
  end
246
226
 
247
227
  def load_state
228
+ $VR_ENV = VR::load_yaml(:class => VR_ENV, :file_name => VR_ENV::SETTINGS_FILE)
248
229
  @builder["window1"].resize($VR_ENV.width, $VR_ENV.height)
249
230
  @builder['panelMain'].set_position($VR_ENV.panel_pos)
250
- @builder["window1"].visible = true
231
+ @builder["panelNotebook"].set_position($VR_ENV.notebook_panel_position)
251
232
  @tabs.open_file_names($VR_ENV.open_files)
252
- @tabs.switch_to($VR_ENV.current_file)
253
233
  @file_tree.open_folders($VR_ENV.open_folders)
254
- @builder["window1"].show_all
234
+ @tabs.load_tab($VR_ENV.current_file)
235
+ @tabs.docs[@tabs.page].jump_to_line($VR_ENV.current_line)
255
236
  end
256
237
 
257
238
  def menuCreateGemspec__activate(*a)
258
239
  if file_name = VR_Tools.create_gemspec()
259
240
  @tabs.destroy_file_tab(file_name)
260
241
  @tabs.load_tab(file_name)
261
- @file_tree.insert(file_name)
242
+ @file_tree.refresh()
262
243
  end
263
244
  end
264
245
 
@@ -275,7 +256,7 @@ class VR_Main
275
256
  end
276
257
 
277
258
  def buttonReplace_clicked
278
- @tabs.docs[@tabs.page].replace(@builder["entryReplace"].text)
259
+ @tabs.docs[@tabs.page].replace(@builder[:entryReplace].text)
279
260
  end
280
261
 
281
262
  def entryFind_key_press(me, evt)
@@ -289,20 +270,23 @@ class VR_Main
289
270
 
290
271
  def menuInstallExamples__activate(*a)
291
272
  path = File.join(ENV["HOME"], "", "visualruby", "examples")
292
- VR_Tools.copy_recursively(File.expand_path(File.join(File.dirname(__FILE__),"","..","..","visualruby_examples")), path)
293
- VR::Dialog.message_box("The example projects are installed in:\n#{path}\nIf you want to uninstall them, just delete the folder.\n\nUse the /home/visualruby folder for all your visualruby projects.")
273
+ VR_Tools.copy_recursively(File.expand_path(File.join(File.dirname(__FILE__),"","..","..","examples")), path)
274
+ alert("The example projects are installed in this folder:\n\n<b>#{path}</b>\n\n "+
275
+ "Use your <b>/home/visualruby</b> folder for all your visualruby projects.",
276
+ :parent => self,
277
+ :headline => "Installing Example Projects...",
278
+ :width => 500)
294
279
  end
295
280
 
296
- #needed so tabs can be saved
297
- def on_window1_delete_event
281
+ # needed so tabs can be saved, called before destroy, must return false to close wndow.
282
+ def window1__delete_event(*args)
298
283
  save_state
299
- return true unless @tabs.try_to_save_all()
284
+ return true unless @tabs.try_to_save_all(:ask=>true)
300
285
  return false #ok to close
301
286
  end
302
287
 
303
- def destroy_window()
304
- super
305
- # exit! # note exit makes it not spit out buffer
288
+ def menuQuit__activate(*a)
289
+ @builder[:window1].destroy
306
290
  end
307
291
 
308
292
  end
@@ -1,18 +1,14 @@
1
-
2
1
  class VR_Remote_Gem_Tree < GemTree
3
2
 
4
- # PIX = Gdk::Pixbuf.new(File.dirname(__FILE__) + '/../../img/rb.png')
5
-
6
3
  include GladeGUI
7
4
 
8
5
  def initialize(main)
9
6
  super()
10
7
  @main = main
11
- # set_title(PIX => "Gems on rubygems.org")
12
8
  @gems = Hash.new
13
- load_glade(__FILE__, main)
9
+ load_glade() #for pop-up menu
10
+ parse_signals()
14
11
  end
15
-
16
12
 
17
13
  def refresh(force = true)
18
14
  return if @t
@@ -35,29 +31,20 @@ class VR_Remote_Gem_Tree < GemTree
35
31
 
36
32
  def selected_gem
37
33
  row = self.selection.selected[1].split(" (")
38
- # ver = row[1].gsub(")","")
39
34
  @gems.detect { |gem| gem['name'] == row[0] } #and gem['version'] == ver}
40
35
  end
41
36
 
42
- def popOpenRubygemsPage_clicked
37
+ def popOpenRubygemsPage__activate(*args)
43
38
  gem = selected_gem()
44
39
  VR_Tools.popen("#{$VR_ENV_GLOBAL.browser} #{gem['project_uri']}")
45
40
  end
46
41
 
47
- def popOpenHomepage_clicked
42
+ def popOpenHomepage__activate(*args)
48
43
  gem = selected_gem()
49
44
  VR_Tools.popen("#{$VR_ENV_GLOBAL.browser} #{gem['homepage_uri']}")
50
45
  end
51
46
 
52
- # def remoteGemTree_rclicked(w, event)
53
- # if event.event_type == Gdk::Event::BUTTON_RELEASE
54
- # if event.button == 3 # right mouse button
55
- # @builder['popGemRemote'].popup(nil, nil, event.button, event.time)
56
- # end
57
- # end
58
- # end
59
-
60
- def popYank_clicked
47
+ def popYank__activate(*args)
61
48
  name, ver = get_name_ver(selection.selected[1])
62
49
  reply = @api.yank_gem(name, ver)
63
50
  @main.shell.buffer.text = "Yanking gem: #{name} #{ver}\n" + reply
@@ -67,4 +54,4 @@ class VR_Remote_Gem_Tree < GemTree
67
54
  end
68
55
 
69
56
 
70
- #
57
+