Piggy 0.4.2.4 → 0.4.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. data/CHANGES.txt +15 -0
  2. data/INSTALL.txt +9 -4
  3. data/README.txt +8 -6
  4. data/bin/directory_diff +1 -1
  5. data/bin/ftp_browser +1 -1
  6. data/bin/piggy +1 -1
  7. data/lib/directory_diff.rb +8 -6
  8. data/lib/ftp_browser.rb +8 -6
  9. data/lib/icons/connect.ico +0 -0
  10. data/lib/icons/hide_details.ico +0 -0
  11. data/lib/icons/show_details.ico +0 -0
  12. data/lib/piggy-core/alive_check.rb +4 -4
  13. data/lib/piggy-core/debug.rb +4 -4
  14. data/lib/piggy-core/environment.rb +24 -26
  15. data/lib/piggy-core/exifr_adapter.rb +11 -11
  16. data/lib/piggy-core/file_info.rb +61 -61
  17. data/lib/piggy-core/ftp_adapter.rb +24 -24
  18. data/lib/piggy-core/htmlgen.rb +41 -45
  19. data/lib/piggy-core/nconvert_thumbsgen.rb +22 -22
  20. data/lib/piggy-core/options.rb +25 -19
  21. data/lib/piggy-core/options_persistence.rb +8 -8
  22. data/lib/piggy-core/progress.rb +7 -7
  23. data/lib/piggy-core/rmagick_thumbnail_page_generator.rb +14 -14
  24. data/lib/piggy-core/thumbnail_generator.rb +26 -26
  25. data/lib/piggy-core/thumbnail_page_generator.rb +234 -230
  26. data/lib/piggy-core/upload_info.rb +22 -22
  27. data/lib/piggy-core/version.rb +7 -7
  28. data/lib/piggy-core/winshell.rb +136 -80
  29. data/lib/piggy-gui/dir_chooser.rb +14 -14
  30. data/lib/piggy-gui/directory_diff_widget.rb +177 -160
  31. data/lib/piggy-gui/filtered_file_list.rb +87 -87
  32. data/lib/piggy-gui/fox_thumbsgen.rb +4 -4
  33. data/lib/piggy-gui/ftp_browser_widget.rb +211 -155
  34. data/lib/piggy-gui/fullscreen.rb +4 -4
  35. data/lib/piggy-gui/html_generation_dialog.rb +42 -115
  36. data/lib/piggy-gui/html_options_widget.rb +97 -0
  37. data/lib/piggy-gui/image_processor.rb +58 -58
  38. data/lib/piggy-gui/modal_dialog.rb +11 -5
  39. data/lib/piggy-gui/multiimagecanvas.rb +59 -59
  40. data/lib/piggy-gui/options_dialog.rb +170 -48
  41. data/lib/piggy-gui/piggy_image_browser.rb +382 -340
  42. data/lib/piggy-gui/pipe_log.rb +17 -17
  43. data/lib/piggy-gui/progress_with_dialog.rb +8 -8
  44. data/lib/piggy-gui/require-fox.rb +23 -8
  45. data/lib/piggy.rb +7 -5
  46. data/lib/templates/styles/basic/style.css +16 -14
  47. data/lib/templates/styles/black/style.css +28 -29
  48. data/lib/templates/styles/roundedbox/style.css +28 -31
  49. data/lib/templates/styles/shadow/style.css +26 -26
  50. data/lib/templates/styles/shadow_D9F5F3/style.css +1 -1
  51. data/lib/templates/styles/shadow_black/lo.jpg +0 -0
  52. data/lib/templates/styles/shadow_black/lu.jpg +0 -0
  53. data/lib/templates/styles/shadow_black/ro.jpg +0 -0
  54. data/lib/templates/styles/shadow_black/ru.jpg +0 -0
  55. data/lib/templates/styles/shadow_black/style.css +78 -0
  56. data/lib/templates/styles/shadow_bowers/style.css +48 -51
  57. data/lib/templates/styles/sylvester/sh.png +0 -0
  58. data/lib/templates/styles/sylvester/style.css +74 -0
  59. data/lib/templates/styles/sylvester/wunderkerze.jpg +0 -0
  60. data/test/file_info_test.rb +29 -29
  61. metadata +52 -38
@@ -34,30 +34,30 @@ class PiggyImageBrowser < Fox::FXMainWindow
34
34
  MsgStyle = MBOX_OK|DECOR_TITLE|DECOR_CLOSE|PIGGY_WINDOW_PLACEMENT
35
35
  UseImageView = false
36
36
 
37
- attr_reader(:imageProcessor)
37
+ attr_reader(:image_processor)
38
38
 
39
- def chosenSequence
40
- @filelist.chosenSequence
39
+ def chosen_sequence
40
+ @filelist.chosen_sequence
41
41
  end
42
42
 
43
43
  #INIT
44
44
 
45
45
  def initialize(app)
46
46
  super(app, "Piggy", nil, nil, DECOR_ALL,
47
- 0, 0, 200, 700, 0, 0)
47
+ 0, 0, 200, 700, 0, 0)
48
48
  # now in critical order
49
- initVars
50
- initMenubar
51
- initToolbar
52
- initView
53
- initIcons
54
- initMenu
55
- initToolbarButtons
49
+ init_vars
50
+ init_menubar
51
+ init_toolbar
52
+ init_view
53
+ init_icons
54
+ init_menu
55
+ init_toolbar_buttons
56
56
  @tooltip = FXTooltip.new(getApp, TOOLTIP_NORMAL)
57
- connect(SEL_CLOSE, method(:onCmdClose)) unless FOXVERSION_GE_1_2
57
+ connect(SEL_CLOSE, method(:on_cmd_close)) unless FOXVERSION_GE_1_2
58
58
  end
59
59
 
60
- def initVars
60
+ def init_vars
61
61
  @slideManager = nil
62
62
  @fullscreen = nil
63
63
  @fullscreenView = nil
@@ -65,7 +65,7 @@ class PiggyImageBrowser < Fox::FXMainWindow
65
65
  @history = Array.new
66
66
  @historyPos = @history.size
67
67
  @optionStore = PiggyOptionsPersistence.new
68
- @options = @optionStore.loadYaml
68
+ @options = @optionStore.load_yaml
69
69
  @imageProcessor = ImageProcessor.new(getApp)
70
70
  @fileInfos = FileRepository.new
71
71
  @filename = ''
@@ -89,39 +89,39 @@ class PiggyImageBrowser < Fox::FXMainWindow
89
89
  @iconStyle = ICON_ABOVE_TEXT|BUTTON_TOOLBAR|FRAME_RAISED
90
90
  end
91
91
 
92
- def initIcons
93
- @windowIcon = getIcon("gallery.ico")
94
- @generateIcon = getIcon("generate.ico")
95
- @addToPreviewIcon = getIcon("plus.png")
96
- @removeFromPreviewIcon = getIcon("minus.png")
97
- @uplevelIcon = getIcon("dirup.ico")
98
- @uploadIcon = getIcon("upload.ico")
99
- @filesaveIcon = getIcon("filesave.ico")
100
- @rotateIcon = getIcon("rotate.ico")
101
- @backIcon = getIcon("back.ico")
102
- @nextImageIcon = getIcon("next-image.ico")
103
- @previousImageIcon = getIcon("previous-image.ico")
104
- @slideshowImageIcon = getIcon("slides.ico")
105
- @slideshowOffImageIcon = getIcon("stop-slides.ico")
106
- @fullscreenIcon = getIcon("fullscreen.ico")
92
+ def init_icons
93
+ @windowIcon = get_icon("gallery.ico")
94
+ @generateIcon = get_icon("generate.ico")
95
+ @addToPreviewIcon = get_icon("plus.png")
96
+ @removeFromPreviewIcon = get_icon("minus.png")
97
+ @uplevelIcon = get_icon("dirup.ico")
98
+ @uploadIcon = get_icon("upload.ico")
99
+ @filesaveIcon = get_icon("filesave.ico")
100
+ @rotateIcon = get_icon("rotate.ico")
101
+ @backIcon = get_icon("back.ico")
102
+ @nextImageIcon = get_icon("next-image.ico")
103
+ @previousImageIcon = get_icon("previous-image.ico")
104
+ @slideshowImageIcon = get_icon("slides.ico")
105
+ @slideshowOffImageIcon = get_icon("stop-slides.ico")
106
+ @fullscreenIcon = get_icon("fullscreen.ico")
107
107
  end
108
108
 
109
- def initStatusbar
109
+ def init_statusbar
110
110
  @statusbar = FXStatusbar.new(self, STATUSBAR_WITH_DRAGCORNER)
111
111
  @statusbar.setLayoutHints(LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X)
112
112
  @orientationStatus = FXTextField.new(@statusbar, 4)
113
113
  @orientationStatus.disable
114
114
  end
115
115
 
116
- def initMenubar
116
+ def init_menubar
117
117
  @menubar = FXMenubar.new(self, FRAME_RAISED)
118
118
  @menubar.setLayoutHints(LAYOUT_SIDE_TOP|LAYOUT_FILL_X)
119
119
  FXToolbarGrip.new(@menubar, @menubar, FXMenubar::ID_TOOLBARGRIP,
120
- TOOLBARGRIP_DOUBLE)
120
+ TOOLBARGRIP_DOUBLE)
121
121
  end
122
122
 
123
- def initMenu
124
- menuTitles = {
123
+ def init_menu
124
+ menu_titles = {
125
125
  'file' => '&File',
126
126
  'view' => '&View',
127
127
  'actions' => '&Actions',
@@ -129,178 +129,184 @@ class PiggyImageBrowser < Fox::FXMainWindow
129
129
  'help' => '&Help' }
130
130
  menus = Hash.new(6)
131
131
  @menus = menus # destroy panes on closure
132
- menuTitles.each_pair { |key, value|
132
+ menu_titles.each_pair { |key, value|
133
133
  menus[key] = FXMenuPane.new(self) }
134
134
  [ 'file', 'view', 'actions', 'options' ].each { | key |
135
- FXMenuTitle.new(@menubar, menuTitles[key], nil, menus[key]) }
136
- FXMenuTitle.new(@menubar, menuTitles['help'], nil, menus['help'],
137
- LAYOUT_RIGHT)
135
+ FXMenuTitle.new(@menubar, menu_titles[key], nil, menus[key]) }
136
+ FXMenuTitle.new(@menubar, menu_titles['help'], nil, menus['help'],
137
+ LAYOUT_RIGHT)
138
138
 
139
139
  # File menu entries
140
140
  tmp = FXMenuCommand.new(menus['file'],
141
- "&Open...\tCtl-O\tOpen image file.")
142
- tmp.connect(SEL_COMMAND, method(:onCmdOpen))
141
+ "&Open...\tCtl-O\tOpen image file.")
142
+ tmp.connect(SEL_COMMAND, method(:on_cmd_open))
143
143
  tmp = FXMenuCommand.new(menus['file'],
144
- "B&ack\t\tBack in history",
145
- @backIcon)
146
- tmp.connect(SEL_COMMAND, method(:onCmdBack))
144
+ "B&ack\t\tBack in history",
145
+ @backIcon)
146
+ tmp.connect(SEL_COMMAND, method(:on_cmd_back))
147
147
  tmp = FXMenuCommand.new(menus['file'],
148
- "&Save image\t\tSave image.",
149
- @filesaveIcon)
150
- tmp.connect(SEL_COMMAND, method(:onCmdSaveSelectedImage))
148
+ "&Save image\t\tSave image.",
149
+ @filesaveIcon)
150
+ tmp.connect(SEL_COMMAND, method(:on_cmd_save_selected_image))
151
151
  tmp = FXMenuCommand.new(menus['file'],
152
- "&Quit\tAlt-X\tQuit Application")
153
- tmp.connect(SEL_COMMAND, method(:onTerminate))
152
+ "&Quit\tAlt-X\tQuit Application")
153
+ tmp.connect(SEL_COMMAND, method(:on_terminate))
154
154
 
155
155
  # View menu entries
156
- # tmp = FXMenuCheck.new(menus['view'],
157
- # "S&lides\t\tSlideshow.")
158
- # tmp.connect(SEL_COMMAND, method(:onCmdSlideshow))
156
+ # tmp = FXMenuCheck.new(menus['view'],
157
+ # "S&lides\t\tSlideshow.")
158
+ # tmp.connect(SEL_COMMAND, method(:on_cmd_slideshow))
159
159
  tmp = FXMenuCommand.new(menus['view'],
160
- "&Rotate 90\t\tRotate 90 degrees.",
161
- @rotateIcon)
162
- tmp.connect(SEL_COMMAND, method(:onRotate90))
160
+ "&Rotate 90\t\tRotate 90 degrees.",
161
+ @rotateIcon)
162
+ tmp.connect(SEL_COMMAND, method(:on_rotate_90))
163
163
 
164
164
  # Action menu entries
165
165
  tmp = FXMenuCommand.new(menus['actions'],
166
- "&Html\t\tGenerate Html page.",
167
- @generateIcon)
168
- tmp.connect(SEL_COMMAND, method(:onCmdGenerateHtml))
166
+ "&Html\t\tGenerate Html page.",
167
+ @generateIcon)
168
+ tmp.connect(SEL_COMMAND, method(:on_cmd_generate_html))
169
169
  tmp = FXMenuCommand.new(menus['actions'],
170
- "Upl&oad\t\tUpload Files",
171
- @uploadIcon)
172
- tmp.connect(SEL_COMMAND, method(:onCmdUpload))
170
+ "Upl&oad\t\tUpload Files",
171
+ @uploadIcon)
172
+ tmp.connect(SEL_COMMAND, method(:on_cmd_upload))
173
173
 
174
174
  # Options menu entries
175
175
  tmp = FXMenuCommand.new(menus['options'],
176
- "&Options...\t\tOpen options dialog.")
177
- tmp.connect(SEL_COMMAND, method(:onCmdOptions))
176
+ "&Options...\t\tOpen options dialog.")
177
+ tmp.connect(SEL_COMMAND, method(:on_cmd_options))
178
178
 
179
179
  # Help Menu entries
180
+ tmp = FXMenuCommand.new(menus['help'], "Sample galleries")
181
+ tmp.textColor = FXColor::Blue
182
+ tmp.connect(SEL_COMMAND) {
183
+ open_hyperlink("http://piggy.rubyforge.org/caps/index.htm", '.')
184
+ }
185
+
180
186
  msg = "Piggy: (P)ick (i)mages and (g)enerate a (g)aller(y)\n"
181
187
  msg += "Piggy is a generator for html picture albums.\n\n"
182
188
  msg += "Using the FOX C++ GUI Library (http://www.fox-toolkit.org)\n"
183
189
  msg += "Using Patrick Fitzgerald's Javascript slideshow (http://slideshow.barelyfitz.com/)\n"
184
190
  msg += "\n"
185
- msg += "#{PiggyVersion.copyrightString}\n\n"
191
+ msg += "#{PiggyVersion.copyright_string}\n\n"
186
192
  msg += "Version information:\n"
187
193
  msg += "- Plattform #{RUBY_PLATFORM}\n"
188
194
  msg += "- Ruby #{RUBY_VERSION} (released #{RUBY_RELEASE_DATE})\n"
189
195
  msg += "- FXRuby #{Fox.fxrubyversion}\n"
190
196
  msg += "- FOX Toolkit #{Fox.fxversion}\n"
191
197
  msg += "- Javascript slideshow no version information availiable\n"
192
- msg += "- Piggy #{PiggyVersion.displayString}\n"
193
- aboutTitle = "About Piggy"
198
+ msg += "- Piggy #{PiggyVersion.display_string}\n"
199
+ about_title = "About Piggy"
194
200
  tmp = FXMenuCommand.new(menus['help'], "&About Piggy...")
195
201
  tmp.connect(SEL_COMMAND) do
196
- FXMessageBox.new(self, ruby2Fox(aboutTitle), ruby2Fox(msg), nil, MsgStyle).execute
202
+ FXMessageBox.new(self, ruby_2_fox(about_title), ruby_2_fox(msg), nil, MsgStyle).execute
197
203
  end
198
204
  end
199
205
 
200
- def initToolbar
206
+ def init_toolbar
201
207
  @dragshell = FXToolbarShell.new(self, 0)
202
208
  @toolbar = FXToolbar.new(self, @dragshell)
203
209
  @toolbar.setFrameStyle(FRAME_RAISED)
204
210
  @toolbar.setPackingHints(PACK_UNIFORM_WIDTH|PACK_UNIFORM_HEIGHT)
205
211
  @toolbar.setLayoutHints(LAYOUT_SIDE_TOP|LAYOUT_FILL_X)
206
212
  FXToolbarGrip.new(@toolbar, @toolbar, FXToolbar::ID_TOOLBARGRIP,
207
- TOOLBARGRIP_DOUBLE)
213
+ TOOLBARGRIP_DOUBLE)
208
214
  end
209
215
 
210
- def newToolbarButton(icon, bubble, method)
216
+ def new_toolbar_button(icon, bubble, method)
211
217
  button = FXButton.new(@toolbar, bubble, icon, nil, 0, @iconStyle)
212
218
  button.connect(SEL_COMMAND, method)
213
219
  button
214
220
  end
215
221
 
216
- def newToolbarToggleButton(icon1, icon2, bubble1, bubble2, method)
222
+ def new_toolbar_toggle_button(icon1, icon2, bubble1, bubble2, method)
217
223
  button = FXToggleButton.new(@toolbar, bubble1, bubble2, icon1, icon2, nil, 0, @iconStyle)
218
224
  button.connect(SEL_COMMAND, method)
219
225
  button
220
226
  end
221
227
 
222
- def initToolbarButtons
223
- newToolbarButton(@uplevelIcon, "&Up\tGo up to higher directory",
224
- method(:onOneLevelUp))
225
- newToolbarButton(@backIcon, "&Back\tBack to previous directory",
226
- method(:onCmdBack))
227
- newToolbarButton(@previousImageIcon, "&Previous\tShow previous selected image",
228
- method(:onCmdPreviousImage))
229
- newToolbarButton(@nextImageIcon, "&Next\tShow next selected image",
230
- method(:onCmdNextImage))
231
- slideshowButton = newToolbarToggleButton(@slideshowImageIcon,
232
- @slideshowOffImageIcon,
233
- "S&lides on\tStart slideshow",
234
- "S&lides off\tStop slideshow",
235
- method(:onCmdSlideshow))
228
+ def init_toolbar_buttons
229
+ new_toolbar_button(@uplevelIcon, "&Up\tGo up to higher directory",
230
+ method(:on_one_level_up))
231
+ new_toolbar_button(@backIcon, "&Back\tBack to previous directory",
232
+ method(:on_cmd_back))
233
+ new_toolbar_button(@previousImageIcon, "&Previous\tShow previous selected image",
234
+ method(:on_cmd_previous_image))
235
+ new_toolbar_button(@nextImageIcon, "&Next\tShow next selected image",
236
+ method(:on_cmd_next_image))
237
+ slideshow_button = new_toolbar_toggle_button(@slideshowImageIcon,
238
+ @slideshowOffImageIcon,
239
+ "S&lides on\tStart slideshow",
240
+ "S&lides off\tStop slideshow",
241
+ method(:on_cmd_slideshow))
236
242
  @delayField = FXTextField.new(@toolbar, 2)
237
243
  @delayField.setText(@options.slideshowDelay.to_s + ' sec')
238
244
  @delayField.connect(SEL_COMMAND) { |sender, sel, ptr|
239
245
  @options.slideshowDelay = @delayField.getText.to_i
240
246
  }
241
- newToolbarButton(@fullscreenIcon, "&Full\tOpen fullscreen",
242
- method(:onCmdFullscreen))
247
+ new_toolbar_button(@fullscreenIcon, "&Full\tOpen fullscreen",
248
+ method(:on_cmd_fullscreen))
243
249
 
244
- newToolbarButton(@rotateIcon, "&Rotate\tRotate 90� right",
245
- method(:onRotate90))
246
- newToolbarButton(@addToPreviewIcon, "&Add\tSelect image(s)",
247
- method(:onCmdAddFiles))
248
- newToolbarButton(@removeFromPreviewIcon, "S&kip\tDeselect image(s)",
249
- method(:onCmdRemoveFiles))
250
- newToolbarButton(@generateIcon, "&Html\tGenerate HTML",
251
- method(:onCmdGenerateHtml))
252
- newToolbarButton(@uploadIcon, "Upl&oad\tUpload files",
253
- method(:onCmdUpload))
254
- end
255
-
256
- def initView
257
- initStatusbar
258
- initFrames
259
- initFrameContents
260
- end
261
-
262
- def initFrames
263
- fillMode = LAYOUT_FILL_X|LAYOUT_FILL_Y
264
- frameStyle = FRAME_SUNKEN
265
- splitterMode = SPLITTER_TRACKING
266
- vSplit = FXSplitter.new(self,
267
- splitterMode|SPLITTER_REVERSED|SPLITTER_VERTICAL)
268
- vSplit.setLayoutHints(fillMode)
269
- hSplit = FXSplitter.new(vSplit,
270
- splitterMode|SPLITTER_HORIZONTAL)
271
- hSplit.setLayoutHints(fillMode)
272
- @fileframe = FXVerticalFrame.new(hSplit, frameStyle|fillMode)
273
- hSplit2 = FXSplitter.new(hSplit,
274
- splitterMode|SPLITTER_REVERSED|SPLITTER_HORIZONTAL)
275
- hSplit2.setLayoutHints(fillMode)
276
- @imageviewframe = FXVerticalFrame.new(hSplit2, frameStyle|fillMode)
277
- hSplit3 = FXSplitter.new(hSplit2,
278
- splitterMode|SPLITTER_REVERSED|SPLITTER_HORIZONTAL)
279
- hSplit3.setLayoutHints(fillMode)
280
- @exifFrame = FXVerticalFrame.new(hSplit3, FRAME_NONE|fillMode)
281
- @previewFrame = FXVerticalFrame.new(hSplit3, frameStyle|fillMode)
282
- @logFrame = FXVerticalFrame.new(vSplit, FRAME_NONE|fillMode)
283
- end
284
-
285
- def initFrameContents
286
- fillMode = LAYOUT_FILL_X|LAYOUT_FILL_Y
250
+ new_toolbar_button(@rotateIcon, "&Rotate\tRotate 90� right",
251
+ method(:on_rotate_90))
252
+ new_toolbar_button(@addToPreviewIcon, "&Add\tSelect image(s)",
253
+ method(:on_cmd_add_files))
254
+ new_toolbar_button(@removeFromPreviewIcon, "S&kip\tDeselect image(s)",
255
+ method(:on_cmd_remove_files))
256
+ new_toolbar_button(@generateIcon, "&Html\tGenerate HTML",
257
+ method(:on_cmd_generate_html))
258
+ new_toolbar_button(@uploadIcon, "Upl&oad\tUpload files",
259
+ method(:on_cmd_upload))
260
+ end
261
+
262
+ def init_view
263
+ init_statusbar
264
+ init_frames
265
+ init_frame_contents
266
+ end
267
+
268
+ def init_frames
269
+ fill_mode = LAYOUT_FILL_X|LAYOUT_FILL_Y
270
+ frame_style = FRAME_SUNKEN
271
+ splitter_mode = SPLITTER_TRACKING
272
+ v_split = FXSplitter.new(self,
273
+ splitter_mode|SPLITTER_REVERSED|SPLITTER_VERTICAL)
274
+ v_split.setLayoutHints(fill_mode)
275
+ h_split = FXSplitter.new(v_split,
276
+ splitter_mode|SPLITTER_HORIZONTAL)
277
+ h_split.setLayoutHints(fill_mode)
278
+ @fileframe = FXVerticalFrame.new(h_split, frame_style|fill_mode)
279
+ h_split2 = FXSplitter.new(h_split,
280
+ splitter_mode|SPLITTER_REVERSED|SPLITTER_HORIZONTAL)
281
+ h_split2.setLayoutHints(fill_mode)
282
+ @imageviewframe = FXVerticalFrame.new(h_split2, frame_style|fill_mode)
283
+ h_split3 = FXSplitter.new(h_split2,
284
+ splitter_mode|SPLITTER_REVERSED|SPLITTER_HORIZONTAL)
285
+ h_split3.setLayoutHints(fill_mode)
286
+ @exifFrame = FXVerticalFrame.new(h_split3, FRAME_NONE|fill_mode)
287
+ @previewFrame = FXVerticalFrame.new(h_split3, frame_style|fill_mode)
288
+ @logFrame = FXVerticalFrame.new(v_split, FRAME_NONE|fill_mode)
289
+ end
290
+
291
+ def init_frame_contents
292
+ fill_mode = LAYOUT_FILL_X|LAYOUT_FILL_Y
287
293
  @filelist = FilteredFileList.new(@fileframe)
288
294
  @filelist.choosable = proc { |filename| supports(filename) }
289
- @filelist.setLayoutHints(fillMode)
290
- @filelist.connect(SEL_COMMAND, method(:onCmdFileListSelection))
295
+ @filelist.setLayoutHints(fill_mode)
296
+ @filelist.connect(SEL_COMMAND, method(:on_cmd_file_list_selection))
291
297
  @imageview = if UseImageView
292
298
  FXImageView.new(@imageviewframe)
293
299
  else
294
- MultiImageCanvas.new(@imageviewframe, fillMode)
300
+ MultiImageCanvas.new(@imageviewframe, fill_mode)
295
301
  end
296
- @imageview.setLayoutHints(fillMode)
297
- @imageview.connect(SEL_CONFIGURE, method(:onConfigure))
302
+ @imageview.setLayoutHints(fill_mode)
303
+ @imageview.connect(SEL_CONFIGURE, method(:on_configure))
298
304
  @imageComment = FXTextField.new(@imageviewframe, 32)
299
305
  @imageComment.setLayoutHints(LAYOUT_FILL_X)
300
- @imageComment.connect(SEL_COMMAND, method(:onCommentMightHaveChanged))
306
+ @imageComment.connect(SEL_COMMAND, method(:on_comment_might_have_changed))
301
307
  @exifView = FXText.new(@exifFrame)
302
308
  @exifView.setLayoutHints(LAYOUT_FILL_X|LAYOUT_FILL_Y)
303
- @preview = MultiImageCanvas.new(@previewFrame, fillMode)
309
+ @preview = MultiImageCanvas.new(@previewFrame, fill_mode)
304
310
  @pipeLog = PipeLog.new(@logFrame)
305
311
  @pipeLog.setLayoutHints(LAYOUT_FILL_X|LAYOUT_FILL_Y)
306
312
  end
@@ -314,13 +320,13 @@ class PiggyImageBrowser < Fox::FXMainWindow
314
320
  resize(720, 620)
315
321
  place(PIGGY_WINDOW_PLACEMENT)
316
322
  setIcon(@windowIcon)
317
- optionsChanged(@options)
323
+ options_changed(@options)
318
324
  super
319
325
  end
320
326
 
321
327
  # CHANGE VIEW
322
328
 
323
- def frameVisible(frame, bool)
329
+ def frame_visible(frame, bool)
324
330
  if bool
325
331
  frame.show
326
332
  else
@@ -328,85 +334,85 @@ class PiggyImageBrowser < Fox::FXMainWindow
328
334
  end
329
335
  end
330
336
 
331
- def refreshWithNewLayout
337
+ def refresh_with_new_layout
332
338
  # method layout missing
333
339
  resize(width, height - 1)
334
340
  resize(width, height + 1)
335
341
  end
336
342
 
337
343
  def preview
338
- @preview.loadImages(chosenSequence)
344
+ @preview.load_images(chosen_sequence)
339
345
  end
340
346
 
341
- def optionsChanged(newOptions)
347
+ def options_changed(newOptions)
342
348
  preview if newOptions.usePreview && !@options.usePreview
343
- frameVisible(@logFrame, newOptions.useLog)
344
- frameVisible(@previewFrame, newOptions.usePreview)
345
- refreshWithNewLayout
349
+ frame_visible(@logFrame, newOptions.useLog)
350
+ frame_visible(@previewFrame, newOptions.usePreview)
351
+ refresh_with_new_layout
346
352
  @options = newOptions
347
353
  end
348
354
 
349
- def runCommand(commandline, workingDir)
350
- @pipeLog.runCommand(commandline, workingDir)
355
+ def run_command(commandline, workingDir)
356
+ @pipeLog.run_command(commandline, workingDir)
351
357
  end
352
358
 
353
359
  def log(msg)
354
360
  @pipeLog.appendText("#{msg}\n")
355
361
  end
356
362
 
357
- def loadImage(file)
363
+ def load_image(file)
358
364
  @filename = file # needs to be called this early
359
- info = currentFileInfo
360
- @imageComment.setText(ruby2Fox(info.comment))
361
- setCurrentRotation(info.rotation)
362
- reloadImage(file)
365
+ info = current_file_info
366
+ @imageComment.setText(ruby_2_fox(info.comment))
367
+ set_current_rotation(info.rotation)
368
+ reload_image(file)
363
369
  end
364
370
 
365
- def reloadImage(file)
371
+ def reload_image(file)
366
372
  if UseImageView
367
- old = @imageview.image.nil? ? nil : fox2Ruby(@imageview.image)
368
- image = @imageProcessor.loadImage(file, false)
369
- @imageProcessor.fitImage(image, 800, 600)
373
+ old = @imageview.image.nil? ? nil : fox_2_ruby(@imageview.image)
374
+ image = @imageProcessor.load_image(file, false)
375
+ @imageProcessor.fit_image(image, 800, 600)
370
376
  if @currentRotation > 0
371
- @imageProcessor.rotateImage(image, @currentRotation)
377
+ @imageProcessor.rotate_image(image, @currentRotation)
372
378
  end
373
379
  image.create
374
380
  @imageview.image = image
375
381
  else
376
382
  if fullscreen? && @fullScreenView
377
- old = @fullScreenView.image
378
- @fullScreenView.loadImage(@filename, false, @currentRotation)
379
- @imageProcessor.garbageImage(old) unless old.nil?
383
+ old = @fullScreenView.image
384
+ @fullScreenView.load_image(@filename, false, @currentRotation)
385
+ @imageProcessor.garbage_image(old) unless old.nil?
380
386
  else
381
- old = @imageview.image
382
- @imageview.loadImage(file, false, @currentRotation)
383
- @imageProcessor.garbageImage(old) unless old.nil?
387
+ old = @imageview.image
388
+ @imageview.load_image(file, false, @currentRotation)
389
+ @imageProcessor.garbage_image(old) unless old.nil?
384
390
  end
385
391
  end
386
- @imageProcessor.garbageImage(old) unless old.nil?
392
+ @imageProcessor.garbage_image(old) unless old.nil?
387
393
  end
388
394
 
389
- def openFileOrLink(filename)
395
+ def open_file_or_link(filename)
390
396
  @exifView.setText('')
391
- rubyFile = rubyPath(filename)
392
- if FileTest.directory? rubyFile
393
- setDirectory(rubyFile)
397
+ ruby_file = ruby_path(filename)
398
+ if FileTest.directory? ruby_file
399
+ set_directory(ruby_file)
394
400
  return 1
395
401
  end
396
- if @shell.link?(rubyFile)
402
+ if @shell.link?(ruby_file)
397
403
  # file is a windows-shortcut
398
- rubyFile = getLinkPath(@filelist.getDirectory, rubyFile)
399
- return 0 if !rubyFile || rubyFile.empty?
400
- log("Shortcut to: #{rubyFile}")
401
- if FileTest.directory?(rubyFile)
402
- setDirectory(rubyFile)
404
+ ruby_file = get_link_path(@filelist.getDirectory, ruby_file)
405
+ return 0 if !ruby_file || ruby_file.empty?
406
+ log("Shortcut to: #{ruby_file}")
407
+ if FileTest.directory?(ruby_file)
408
+ set_directory(ruby_file)
403
409
  return 1
404
410
  end
405
411
  end
406
412
  if(supports(filename))
407
- loadImage(rubyFile)
408
- @exifView.setText(ruby2Fox("#{File.basename(rubyFile)}\n#{@exif.to_s}"))
409
- @filelist.assumeSelected(rubyFile)
413
+ load_image(ruby_file)
414
+ @exifView.setText(ruby_2_fox("#{File.basename(ruby_file)}\n#{@exif.to_s}"))
415
+ @filelist.assume_selected(ruby_file)
410
416
  return 1
411
417
  end
412
418
  return 0
@@ -420,71 +426,71 @@ class PiggyImageBrowser < Fox::FXMainWindow
420
426
  return @supportedImageTypes.include?(extension)
421
427
  end
422
428
 
423
- def hasExtension?(filename, ext)
429
+ def has_extension?(filename, ext)
424
430
  File.basename(filename.upcase, ext.upcase) !=
425
- File.basename(filename.upcase)
431
+ File.basename(filename.upcase)
426
432
  end
427
433
 
428
434
  # ACCESSING
429
435
 
430
- def generatorClass
431
- return NconvertThumbnailPageGenerator if @options.useNconvert?
432
- if RMAGICK_AVAILIABLE && @options.useRmagick?
436
+ def generator_class
437
+ return NconvertThumbnailPageGenerator if @options.use_nconvert?
438
+ if RMAGICK_AVAILIABLE && @options.use_rmagick?
433
439
  return RmagickThumbnailPageGenerator
434
440
  end
435
441
  return FoxThumbnailPageGenerator
436
442
  end
437
443
 
438
- def setDirectory(dirname)
444
+ def set_directory(dirname)
439
445
  if @historyPos < @history.size
440
446
  @history.pop
441
447
  else
442
448
  @history.push(dirname)
443
449
  @historyPos = @history.size
444
450
  end
445
- @filelist.goToDirectory(dirname)
451
+ @filelist.go_to_directory(dirname)
446
452
  if(@options.preselectDirectories?)
447
- @filelist.chooseAllInFilelist
448
- nextImage
453
+ @filelist.choose_all_in_filelist
454
+ next_image
449
455
  end
450
456
  preview if @options.usePreview
451
457
  end
452
458
 
453
- def defaultStartupDirectory
454
- return @shell.pictureDirectory
459
+ def default_startup_directory
460
+ return @shell.picture_directory
455
461
  end
456
462
 
457
- def getLinkPath(dirname, linkname)
458
- return @shell.getLinkTarget(linkname, dirname)
463
+ def get_link_path(dirname, linkname)
464
+ return @shell.get_link_target(linkname, dirname)
459
465
  end
460
466
 
461
- def rubyPath(path)
462
- @shell.rubyPath(path)
467
+ def ruby_path(path)
468
+ @shell.ruby_path(path)
463
469
  end
464
470
 
465
- def getIcon(filename)
466
- iconPath = File.join(PIGGY_PATH, 'icons', filename)
467
- icon = @imageProcessor.loadIcon(iconPath)
471
+ def get_icon(filename)
472
+ icon_path = File.join(PIGGY_PATH, 'icons', filename)
473
+ icon = @imageProcessor.load_icon(icon_path)
468
474
  @icons.push(icon)
469
475
  return icon
470
476
  end
471
477
 
472
- def infoForFile(osPathString)
473
- pathString = @shell.rubyPath(osPathString)
474
- @exif = ExifrAdapter.new(pathString)
475
- info = CommentedFile.new(File.basename(pathString), File.dirname(pathString))
478
+ def info_for_file(osPathString)
479
+ path_string = @shell.ruby_path(osPathString)
480
+ @exif = ExifrAdapter.new(path_string)
481
+ info = CommentedFile.new(File.basename(path_string), File.dirname(path_string))
476
482
  if @fileInfos.has_key?(info)
477
483
  info = @fileInfos[info]
478
484
  else
479
- info.rotation = @exif.viewDegrees
485
+ info.rotation = @exif.view_degrees
480
486
  info.comment = @exif.comment
481
487
  @fileInfos[info] = info
482
488
  end
483
489
  return info
484
490
  end
485
491
 
486
- def currentFileInfo
487
- infoForFile(@filename)
492
+ def current_file_info
493
+ info_for_file(@filename)
488
494
  end
489
495
 
490
496
  # MESSAGES
@@ -498,7 +504,7 @@ class PiggyImageBrowser < Fox::FXMainWindow
498
504
  MBOX_CLICKED_YES == FXMessageBox.question(self, MBOX_YES_NO, title, question)
499
505
  end
500
506
 
501
- def checkLocalDestinationPath
507
+ def check_local_destination_path
502
508
  output = @options.localDestinationPath
503
509
  if(!File.directory?(output))
504
510
  error("#{output} ist no directory}")
@@ -509,264 +515,300 @@ class PiggyImageBrowser < Fox::FXMainWindow
509
515
 
510
516
  # ACTIONS
511
517
 
512
- def fitImage
518
+ def fit_image
513
519
  @imageview.fit unless UseImageView
514
520
  end
515
521
 
516
- def saveImage
517
- saveDialog = FXFileDialog.new(self, "Save Image")
518
- saveDialog.filename = @filename.gsub(/([^.])\.(.*)/, '\1.piggy.\2')
519
- return if saveDialog.execute == 0
520
- if File.exists? saveDialog.filename
522
+ def save_image
523
+ save_dialog = FXFileDialog.new(self, "Save Image")
524
+ save_dialog.filename = @filename.gsub(/([^.])\.(.*)/, '\1.piggy.\2')
525
+ return if save_dialog.execute == 0
526
+ if File.exists? save_dialog.filename
521
527
  # return unless question("Overwrite existing image?", "Overwrite Image")
522
528
  return error('Sorry, overwrite an existing image is not implemented, yet.')
523
529
  end
524
530
  getApp().beginWaitCursor do
525
- manipulatedImage = @imageProcessor.loadImage(@filename)
526
- @imageProcessor.rotateImage(manipulatedImage, @currentRotation)
527
- @imageProcessor.saveImage(manipulatedImage, saveDialog.filename)
528
- @imageProcessor.garbageImage(manipulatedImage)
529
- @filelist.updateFileList
531
+ manipulatedImage = @imageProcessor.load_image(@filename)
532
+ @imageProcessor.rotate_image(manipulatedImage, @currentRotation)
533
+ @imageProcessor.save_image(manipulatedImage, save_dialog.filename)
534
+ @imageProcessor.garbage_image(manipulatedImage)
535
+ @filelist.update_file_list
530
536
  end
531
- setDirectory(saveDialog.getDirectory)
532
- openFileOrLink(saveDialog.filename)
537
+ set_directory(save_dialog.getDirectory)
538
+ open_file_or_link(save_dialog.filename)
533
539
  end
534
540
 
535
- def setCurrentRotation(newRotation)
541
+ def set_current_rotation(newRotation)
536
542
  @currentRotation = newRotation
537
543
  if @currentRotation >= 360
538
544
  @currentRotation = @currentRotation - 360
539
545
  end
540
- @orientationStatus.setText(@currentRotation.to_s + '�')
541
- currentFileInfo.rotation = @currentRotation
546
+ @orientationStatus.setText(ruby_2_fox(@currentRotation.to_s + '�'))
547
+ current_file_info.rotation = @currentRotation
542
548
  end
543
549
 
544
550
  def rotate(degree)
545
- setCurrentRotation(@currentRotation + degree)
551
+ set_current_rotation(@currentRotation + degree)
546
552
  getApp().beginWaitCursor do
547
- reloadImage(@filename)
553
+ reload_image(@filename)
548
554
  end
549
555
  end
550
556
 
551
- def openHtmlBrowserOnResult(generator)
552
- if(!File.exist? generator.mainIndexPath)
553
- return error("#{generator.mainIndexPath} doesn't exist")
557
+ def open_html_browser_on_result(generator)
558
+ if(!File.exist? generator.main_index_path)
559
+ return error("#{generator.main_index_path} doesn't exist")
554
560
  end
555
- if(!File.exist? generator.mainIndexWithPath)
556
- return error("#{generator.mainIndexWithPath} doesn't exist")
561
+ if(!File.exist? generator.main_index_with_path)
562
+ return error("#{generator.main_index_with_path} doesn't exist")
557
563
  end
558
- if(@options.browser?)
559
- getApp.beginWaitCursor
560
- begin
561
- cmd = @options.browser
562
- args = @shell.osPath(generator.mainIndexWithPath)
563
- path = generator.mainIndexPath
564
- @pipeLog.runCommand(cmd + ' ' + args, path, true)
565
- rescue StandardError => ex
566
- log(ex.to_s)
564
+ url = @shell.os_path(generator.main_index_with_path)
565
+ working_dir = generator.main_index_path
566
+ open_hyperlink(url, working_dir)
567
+ end
568
+
569
+ # Modified an idea of David Naseby on how to
570
+ # do Hyperlinks with FXRuby
571
+ def add_hyperlink_to(container, url)
572
+ link = FXButton.new(container, ruby_2_fox(url), nil, nil, 0, FRAME_NONE)
573
+ link.textColor = FXColor::Blue
574
+ link.connect(SEL_COMMAND) { open_hyperlink(url, '.') }
575
+ end
576
+
577
+ def open_hyperlink(url, working_dir)
578
+ getApp.beginWaitCursor
579
+ begin
580
+ if(@options.browser?)
581
+ cmd = @options.browser
582
+ @pipeLog.run_command(cmd + ' ' + url, working_dir, true)
583
+ else
584
+ if PLATFORM =~ /mswin/
585
+ require 'win32ole'
586
+ ie = WIN32OLE.new('InternetExplorer.Application')
587
+ ie.visible = TRUE
588
+ ie.navigate(url)
589
+ end
567
590
  end
591
+ rescue StandardError => ex
592
+ log(ex.to_s)
593
+ ensure
568
594
  getApp.endWaitCursor
569
595
  end
570
596
  end
571
597
 
572
598
  # EVENTS
573
599
 
574
- def onCmdSaveSelectedImage(sender, sel, ptr)
575
- saveImage
600
+ def on_cmd_save_selected_image(sender, sel, ptr)
601
+ save_image
576
602
  end
577
603
 
578
- def onRotate90(sender, sel, ptr)
604
+ def on_rotate_90(sender, sel, ptr)
579
605
  image = @imageview.image
580
606
  return error('Doubleclick image file first') if image == nil
581
607
  rotate(90)
582
608
  end
583
609
 
584
- def onCmdUpload(sender, sel, index)
585
- uploadDialog = FtpBrowserDialog.new(self, @options.clone)
586
- uploadDialog.connect(SEL_CLOSE, method(:onFtpBrowserDialogClosed))
587
- uploadDialog.execute
588
- optionsChanged(uploadDialog.options)
610
+ def on_cmd_upload(sender, sel, index)
611
+ upload_dialog = FtpBrowserDialog.new(self, @options.clone)
612
+ upload_dialog.connect(SEL_CLOSE, method(:on_ftp_browser_dialog_closed))
613
+ upload_dialog.execute
614
+ options_changed(upload_dialog.options)
589
615
  end
590
616
 
591
- def onConfigure(sender, sel, ptr)
592
- fitImage
617
+ def on_configure(sender, sel, ptr)
618
+ fit_image
593
619
  end
594
620
 
595
- def onCmdOptions(sender, sel, index)
621
+ def on_cmd_options(sender, sel, index)
596
622
  dialog = OptionsDialog.new(self, @options.clone)
597
- optionsChanged(dialog.options) if dialog.execute
623
+ options_changed(dialog.options) if dialog.execute
598
624
  end
599
625
 
600
626
  # Open a new file
601
- def onCmdOpen(sender, sel, ptr)
602
- openSystemFileChooser
627
+ def on_cmd_open(sender, sel, ptr)
628
+ open_system_file_chooser
603
629
  return 1
604
630
  end
605
631
 
606
- def openSystemFileChooser
607
- openDialog = FXFileDialog.new(self, "Open Image")
632
+ def open_system_file_chooser
633
+ open_dialog = FXFileDialog.new(self, "Open Image")
608
634
  #openDialog.filename = @filename
609
- openDialog.setDirectory(@filelist.getCurrentDirectory)
635
+ open_dialog.set_directory(@filelist.get_current_directory)
610
636
  patterns = ["All Files (*)" ] + @supportedImageTypes.values
611
- openDialog.patternList = patterns
612
- openDialog.currentPattern = @preferredFileFilter
613
- if openDialog.execute
614
- @preferredFileFilter = openDialog.currentPattern
615
- filename = openDialog.filename
616
- setDirectory(openDialog.getDirectory)
617
- openFileOrLink(filename)
637
+ open_dialog.patternList = patterns
638
+ open_dialog.currentPattern = @preferredFileFilter
639
+ if open_dialog.execute
640
+ @preferredFileFilter = open_dialog.currentPattern
641
+ filename = open_dialog.filename
642
+ set_directory(open_dialog.getDirectory)
643
+ open_file_or_link(filename)
618
644
  end
619
645
  end
620
646
 
621
647
  # Command message from the file list
622
648
 
623
- def onCmdFileListSelection(sender, dummy, index)
624
- selectIndex(index)
649
+ def on_cmd_file_list_selection(sender, dummy, index)
650
+ select_index(index)
625
651
  end
626
652
 
627
- def onCmdNextImage(sender, sel, dummy)
628
- nextImage
653
+ def on_cmd_next_image(sender, sel, dummy)
654
+ next_image
629
655
  end
630
656
 
631
- def onCmdPreviousImage(sender, sel, dummy)
632
- previousImage
657
+ def on_cmd_previous_image(sender, sel, dummy)
658
+ previous_image
633
659
  end
634
660
 
635
- def nextImage
636
- i = @filelist.selectNextChosen
637
- selectIndex(i) unless i < 0
661
+ def next_image
662
+ i = @filelist.select_next_chosen
663
+ select_index(i) unless i < 0
638
664
  end
639
665
 
640
- def previousImage
641
- i = @filelist.selectPreviousChosen
642
- selectIndex(i) unless i < 0
666
+ def previous_image
667
+ i = @filelist.select_previous_chosen
668
+ select_index(i) unless i < 0
643
669
  end
644
670
 
645
- def startSlideshow
671
+ def start_slideshow
646
672
  @slideManager = 1
647
673
  Thread.new {
648
674
  while(@slideManager) do
649
- # Threading issues: addChore seems to provide enough
650
- # synchronisation to avoid segfaults here
651
- getApp().addChore { |x, y, z| nextImage }
652
- delay = @options.slideshowDelay
653
- sleep(delay > 0 ? delay : 1)
675
+ # Threading issues: addChore seems to provide enough
676
+ # synchronisation to avoid segfaults here
677
+ getApp().addChore { |x, y, z| next_image }
678
+ delay = @options.slideshowDelay
679
+ sleep(delay > 0 ? delay : 1)
654
680
  end
655
681
  }
656
682
  end
657
683
 
658
- def stopSlideshow
684
+ def stop_slideshow
659
685
  @slideManager = nil
660
- stopFullscreen
686
+ stop_fullscreen
661
687
  end
662
688
 
663
- def startFullscreen
664
- fillMode = LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_CENTER_X|LAYOUT_CENTER_Y
689
+ def start_fullscreen
690
+ fill_mode = LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_CENTER_X|LAYOUT_CENTER_Y
665
691
  @fullscreen = Fullscreen.new(getApp, "Piggy fullscreen", nil, nil,
666
- DECOR_BORDER|DECOR_TITLE|DECOR_CLOSE)
667
- @fullScreenView = MultiImageCanvas.new(@fullscreen, fillMode)
692
+ DECOR_BORDER|DECOR_TITLE|DECOR_CLOSE)
693
+ @fullScreenView = MultiImageCanvas.new(@fullscreen, fill_mode)
668
694
  @fullscreen.connect(SEL_CLOSE){ |sender, sel, ptr|
669
- stopFullscreen
695
+ stop_fullscreen
670
696
  }
671
697
  @fullscreen.create
672
698
  @fullscreen.show(PLACEMENT_MAXIMIZED)
673
- reloadImage(@filename)
699
+ reload_image(@filename)
674
700
  end
675
701
 
676
- def stopFullscreen
702
+ def stop_fullscreen
677
703
  @fullscreen.destroy if fullscreen?
678
704
  @fullscreen = nil
679
705
  @fullScreenView = nil
680
- reloadImage(@filename)
706
+ reload_image(@filename)
681
707
  end
682
708
 
683
709
  def fullscreen?
684
710
  @fullscreen && @fullscreen.shown?
685
711
  end
686
712
 
687
- def selectIndex(index)
713
+ def select_index(index)
688
714
  return 0 if index < 0
689
715
  if @filelist.isItemDirectory(index)
690
- setDirectory(@filelist.getItemRubyPathname(index))
716
+ set_directory(@filelist.get_item_ruby_pathname(index))
691
717
  return 1
692
718
  end
693
719
  return 0 if !@filelist.isItemFile(index)
694
- filename = @filelist.getItemRubyPathname(index)
695
- return openFileOrLink(filename)
696
- end
720
+ filename = @filelist.get_item_ruby_pathname(index)
721
+ return open_file_or_link(filename)
722
+ end
697
723
 
698
- def onOneLevelUp(sender, sel, unused)
699
- oldDir = rubyPath(@filelist.getCurrentDirectory)
700
- newDir = FilePath.oneDirUp(oldDir)
701
- if(oldDir == newDir)
702
- newDir = FXDirDialog.getOpenDirectory(self, "Choose directory", oldDir)
724
+ def on_one_level_up(sender, sel, unused)
725
+ old_dir = ruby_path(@filelist.get_current_directory)
726
+ new_dir = FilePath.one_dir_up(old_dir)
727
+ if(old_dir == new_dir)
728
+ new_dir = FXDirDialog.getOpenDirectory(self, "Choose directory", old_dir)
703
729
  end
704
- setDirectory(newDir) unless(oldDir == newDir)
730
+ set_directory(new_dir) unless(old_dir == new_dir)
705
731
  end
706
732
 
707
- def onCmdAddFiles(sender, sel, unused)
708
- @filelist.addSelectedFiles
733
+ def on_cmd_add_files(sender, sel, unused)
734
+ @filelist.add_selected_files
709
735
  preview if @options.usePreview
710
736
  end
711
737
 
712
- def onCmdRemoveFiles(sender, sel, unused)
713
- @filelist.removeSelectedFiles
714
- preview if @options.usePreview
738
+ def on_cmd_remove_files(sender, sel, unused)
739
+ @filelist.remove_selected_files
740
+ preview if @options.usePreview
715
741
  end
716
742
 
717
- def onCmdBack(sender, unused1, unused2)
743
+ def on_cmd_back(sender, unused1, unused2)
718
744
  if(@historyPos > 1)
719
745
  @historyPos -= 1
720
- setDirectory(@history[@historyPos - 1])
746
+ set_directory(@history[@historyPos - 1])
721
747
  end
722
748
  end
723
749
 
724
- def onCmdSlideshow(sender, sel, index)
750
+ def on_cmd_slideshow(sender, sel, index)
725
751
  if @slideManager
726
- stopSlideshow
752
+ stop_slideshow
727
753
  else
728
- startSlideshow
754
+ start_slideshow
729
755
  end
730
756
  end
731
757
 
732
- def onCmdFullscreen(sender, sel, index)
758
+ def on_cmd_fullscreen(sender, sel, index)
733
759
  if fullscreen?
734
- stopFullscreen
760
+ stop_fullscreen
735
761
  else
736
- startFullscreen
762
+ start_fullscreen
737
763
  end
738
764
  end
739
765
 
740
- def onCmdGenerateHtml(sender, sel, index)
741
- unless @filelist.anyFilesChosen?
766
+ def on_cmd_generate_html(sender, sel, index)
767
+ unless @filelist.any_files_chosen?
742
768
  return error("Select some image files first!")
743
769
  end
744
- optionsDialog = HtmlGenerationDialog.new(self, @options.clone)
745
- return false unless optionsDialog.execute
746
- @options = optionsDialog.options
747
- directory = @filelist.getDirectory
748
- outputDir = optionsDialog.getSubdir
749
- subdir = File.join(@options.localDestinationPath, outputDir)
750
- title = optionsDialog.getTitle
770
+ options_dialog = HtmlGenerationDialog.new(self, @options.clone)
771
+ return false unless options_dialog.execute
772
+ @options = options_dialog.options
773
+ output_dir = options_dialog.get_subdir
774
+ title = options_dialog.get_title
751
775
  title = "" if(!title)
752
- generator = generatorClass.new(@options)
776
+ generator = generator_class.new(@options)
777
+ generator.set_title(title)
778
+ generator.set_output_directory(output_dir)
753
779
  generator.client = @pipeLog
754
- generator.setOutputDirectory(outputDir)
755
- generator.setTitle(title)
756
- generator.setFiles(chosenSequence.collect { |f| infoForFile(f) })
780
+ generator.set_files(chosen_sequence.collect { |f| info_for_file(f) })
757
781
  getApp.beginWaitCursor
758
782
  progress = ProgressWithDialog.new(self)
759
- progress.setTask('Generating', @filelist.numFilesChosen)
783
+ progress.set_task('Generating', @filelist.num_files_chosen)
784
+ success = false
785
+ overwrite = true # user has been asked in dialog
760
786
  begin
761
- success = generator.generate(progress, false, @options.addZip?)
762
- while @pipeLog.hasOpenPipes?
787
+ if(@options.stylesSample?)
788
+ actual_options = @options.clone
789
+ begin
790
+ get_style_list.each { |style|
791
+ @options.style = style
792
+ @options.skipImageProcessing = (style != 'basic')
793
+ @options.stylesSample = (style != 'basic')
794
+ generator.set_title(style)
795
+ generator.set_output_directory(style)
796
+ success = success & generator.generate(progress, overwrite, @options.addZip?)
797
+ }
798
+ ensure
799
+ @options = actual_options
800
+ end
801
+ else
802
+ success = generator.generate(progress, overwrite, @options.addZip?)
803
+ end
804
+ while @pipeLog.has_open_pipes?
763
805
  end
764
806
  ensure
765
807
  progress.finish
766
808
  getApp.endWaitCursor
767
809
  end
768
810
  if(success)
769
- openHtmlBrowserOnResult(generator)
811
+ open_html_browser_on_result(generator)
770
812
  else
771
813
  @pipeLog.appendText('Error')
772
814
  error("Error in html generation!")
@@ -774,41 +816,41 @@ class PiggyImageBrowser < Fox::FXMainWindow
774
816
  return success
775
817
  end
776
818
 
777
- def onFtpBrowserDialogClosed(sender, sel, ptr)
819
+ def on_ftp_browser_dialog_closed(sender, sel, ptr)
778
820
  # get options?
779
821
  return 0
780
822
  end
781
823
 
782
- def onCommentMightHaveChanged(sender, sel, ptr)
783
- currentFileInfo.comment = fox2Ruby(@imageComment.getText)
824
+ def on_comment_might_have_changed(sender, sel, ptr)
825
+ current_file_info.comment = fox_2_ruby(@imageComment.getText)
784
826
  end
785
827
 
786
828
  # EXIT
787
829
 
788
- def prepareClosure
830
+ def prepare_closure
789
831
  puts 'About to quit'
790
- @optionStore.saveYaml(@options)
791
- @pipeLog.closePipes
832
+ @optionStore.save_yaml(@options)
833
+ @pipeLog.close_pipes
792
834
  end
793
835
 
794
836
  if FOXVERSION_GE_1_2
795
837
  def close(notify=false)
796
- prepareClosure
838
+ prepare_closure
797
839
  super(notify)
798
840
  end
799
- def onTerminate(sender, sel, ptr)
841
+ def on_terminate(sender, sel, ptr)
800
842
  close
801
843
  end
802
844
  else
803
845
  # Send whenever this window is about to close
804
- def onCmdClose(sender, sel, ptr)
805
- prepareClosure
846
+ def on_cmd_close(sender, sel, ptr)
847
+ prepare_closure
806
848
  return 0
807
849
  end
808
850
  # Use this to react on termination signals
809
- def onTerminate(sender, sel, ptr)
810
- prepareClosure
851
+ def on_terminate(sender, sel, ptr)
852
+ prepare_closure
811
853
  getApp.exit(0)
812
854
  end
813
855
  end
814
- end
856
+ end