Piggy 0.4.2.4 → 0.4.3.0
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.
- data/CHANGES.txt +15 -0
- data/INSTALL.txt +9 -4
- data/README.txt +8 -6
- data/bin/directory_diff +1 -1
- data/bin/ftp_browser +1 -1
- data/bin/piggy +1 -1
- data/lib/directory_diff.rb +8 -6
- data/lib/ftp_browser.rb +8 -6
- data/lib/icons/connect.ico +0 -0
- data/lib/icons/hide_details.ico +0 -0
- data/lib/icons/show_details.ico +0 -0
- data/lib/piggy-core/alive_check.rb +4 -4
- data/lib/piggy-core/debug.rb +4 -4
- data/lib/piggy-core/environment.rb +24 -26
- data/lib/piggy-core/exifr_adapter.rb +11 -11
- data/lib/piggy-core/file_info.rb +61 -61
- data/lib/piggy-core/ftp_adapter.rb +24 -24
- data/lib/piggy-core/htmlgen.rb +41 -45
- data/lib/piggy-core/nconvert_thumbsgen.rb +22 -22
- data/lib/piggy-core/options.rb +25 -19
- data/lib/piggy-core/options_persistence.rb +8 -8
- data/lib/piggy-core/progress.rb +7 -7
- data/lib/piggy-core/rmagick_thumbnail_page_generator.rb +14 -14
- data/lib/piggy-core/thumbnail_generator.rb +26 -26
- data/lib/piggy-core/thumbnail_page_generator.rb +234 -230
- data/lib/piggy-core/upload_info.rb +22 -22
- data/lib/piggy-core/version.rb +7 -7
- data/lib/piggy-core/winshell.rb +136 -80
- data/lib/piggy-gui/dir_chooser.rb +14 -14
- data/lib/piggy-gui/directory_diff_widget.rb +177 -160
- data/lib/piggy-gui/filtered_file_list.rb +87 -87
- data/lib/piggy-gui/fox_thumbsgen.rb +4 -4
- data/lib/piggy-gui/ftp_browser_widget.rb +211 -155
- data/lib/piggy-gui/fullscreen.rb +4 -4
- data/lib/piggy-gui/html_generation_dialog.rb +42 -115
- data/lib/piggy-gui/html_options_widget.rb +97 -0
- data/lib/piggy-gui/image_processor.rb +58 -58
- data/lib/piggy-gui/modal_dialog.rb +11 -5
- data/lib/piggy-gui/multiimagecanvas.rb +59 -59
- data/lib/piggy-gui/options_dialog.rb +170 -48
- data/lib/piggy-gui/piggy_image_browser.rb +382 -340
- data/lib/piggy-gui/pipe_log.rb +17 -17
- data/lib/piggy-gui/progress_with_dialog.rb +8 -8
- data/lib/piggy-gui/require-fox.rb +23 -8
- data/lib/piggy.rb +7 -5
- data/lib/templates/styles/basic/style.css +16 -14
- data/lib/templates/styles/black/style.css +28 -29
- data/lib/templates/styles/roundedbox/style.css +28 -31
- data/lib/templates/styles/shadow/style.css +26 -26
- data/lib/templates/styles/shadow_D9F5F3/style.css +1 -1
- data/lib/templates/styles/shadow_black/lo.jpg +0 -0
- data/lib/templates/styles/shadow_black/lu.jpg +0 -0
- data/lib/templates/styles/shadow_black/ro.jpg +0 -0
- data/lib/templates/styles/shadow_black/ru.jpg +0 -0
- data/lib/templates/styles/shadow_black/style.css +78 -0
- data/lib/templates/styles/shadow_bowers/style.css +48 -51
- data/lib/templates/styles/sylvester/sh.png +0 -0
- data/lib/templates/styles/sylvester/style.css +74 -0
- data/lib/templates/styles/sylvester/wunderkerze.jpg +0 -0
- data/test/file_info_test.rb +29 -29
- 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(:
|
37
|
+
attr_reader(:image_processor)
|
38
38
|
|
39
|
-
def
|
40
|
-
@filelist.
|
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
|
-
|
47
|
+
0, 0, 200, 700, 0, 0)
|
48
48
|
# now in critical order
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
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(:
|
57
|
+
connect(SEL_CLOSE, method(:on_cmd_close)) unless FOXVERSION_GE_1_2
|
58
58
|
end
|
59
59
|
|
60
|
-
def
|
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.
|
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
|
93
|
-
@windowIcon =
|
94
|
-
@generateIcon =
|
95
|
-
@addToPreviewIcon =
|
96
|
-
@removeFromPreviewIcon =
|
97
|
-
@uplevelIcon =
|
98
|
-
@uploadIcon =
|
99
|
-
@filesaveIcon =
|
100
|
-
@rotateIcon =
|
101
|
-
@backIcon =
|
102
|
-
@nextImageIcon =
|
103
|
-
@previousImageIcon =
|
104
|
-
@slideshowImageIcon =
|
105
|
-
@slideshowOffImageIcon =
|
106
|
-
@fullscreenIcon =
|
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
|
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
|
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
|
-
|
120
|
+
TOOLBARGRIP_DOUBLE)
|
121
121
|
end
|
122
122
|
|
123
|
-
def
|
124
|
-
|
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
|
-
|
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,
|
136
|
-
FXMenuTitle.new(@menubar,
|
137
|
-
|
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
|
-
|
142
|
-
tmp.connect(SEL_COMMAND, method(:
|
141
|
+
"&Open...\tCtl-O\tOpen image file.")
|
142
|
+
tmp.connect(SEL_COMMAND, method(:on_cmd_open))
|
143
143
|
tmp = FXMenuCommand.new(menus['file'],
|
144
|
-
|
145
|
-
|
146
|
-
tmp.connect(SEL_COMMAND, method(:
|
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
|
-
|
149
|
-
|
150
|
-
tmp.connect(SEL_COMMAND, method(:
|
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
|
-
|
153
|
-
tmp.connect(SEL_COMMAND, method(:
|
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(:
|
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
|
-
|
161
|
-
|
162
|
-
tmp.connect(SEL_COMMAND, method(:
|
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
|
-
|
167
|
-
|
168
|
-
tmp.connect(SEL_COMMAND, method(:
|
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
|
-
|
171
|
-
|
172
|
-
tmp.connect(SEL_COMMAND, method(:
|
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
|
-
|
177
|
-
tmp.connect(SEL_COMMAND, method(:
|
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.
|
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.
|
193
|
-
|
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,
|
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
|
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
|
-
|
213
|
+
TOOLBARGRIP_DOUBLE)
|
208
214
|
end
|
209
215
|
|
210
|
-
def
|
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
|
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
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
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
|
-
|
242
|
-
|
247
|
+
new_toolbar_button(@fullscreenIcon, "&Full\tOpen fullscreen",
|
248
|
+
method(:on_cmd_fullscreen))
|
243
249
|
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
end
|
255
|
-
|
256
|
-
def
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
end
|
261
|
-
|
262
|
-
def
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
@fileframe = FXVerticalFrame.new(
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
@imageviewframe = FXVerticalFrame.new(
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
@exifFrame = FXVerticalFrame.new(
|
281
|
-
@previewFrame = FXVerticalFrame.new(
|
282
|
-
@logFrame = FXVerticalFrame.new(
|
283
|
-
end
|
284
|
-
|
285
|
-
def
|
286
|
-
|
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(
|
290
|
-
@filelist.connect(SEL_COMMAND, method(:
|
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,
|
300
|
+
MultiImageCanvas.new(@imageviewframe, fill_mode)
|
295
301
|
end
|
296
|
-
@imageview.setLayoutHints(
|
297
|
-
@imageview.connect(SEL_CONFIGURE, method(:
|
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(:
|
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,
|
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
|
-
|
323
|
+
options_changed(@options)
|
318
324
|
super
|
319
325
|
end
|
320
326
|
|
321
327
|
# CHANGE VIEW
|
322
328
|
|
323
|
-
def
|
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
|
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.
|
344
|
+
@preview.load_images(chosen_sequence)
|
339
345
|
end
|
340
346
|
|
341
|
-
def
|
347
|
+
def options_changed(newOptions)
|
342
348
|
preview if newOptions.usePreview && !@options.usePreview
|
343
|
-
|
344
|
-
|
345
|
-
|
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
|
350
|
-
@pipeLog.
|
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
|
363
|
+
def load_image(file)
|
358
364
|
@filename = file # needs to be called this early
|
359
|
-
info =
|
360
|
-
@imageComment.setText(
|
361
|
-
|
362
|
-
|
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
|
371
|
+
def reload_image(file)
|
366
372
|
if UseImageView
|
367
|
-
old = @imageview.image.nil? ? nil :
|
368
|
-
image = @imageProcessor.
|
369
|
-
@imageProcessor.
|
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
|
-
|
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
|
-
|
378
|
-
|
379
|
-
|
383
|
+
old = @fullScreenView.image
|
384
|
+
@fullScreenView.load_image(@filename, false, @currentRotation)
|
385
|
+
@imageProcessor.garbage_image(old) unless old.nil?
|
380
386
|
else
|
381
|
-
|
382
|
-
|
383
|
-
|
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.
|
392
|
+
@imageProcessor.garbage_image(old) unless old.nil?
|
387
393
|
end
|
388
394
|
|
389
|
-
def
|
395
|
+
def open_file_or_link(filename)
|
390
396
|
@exifView.setText('')
|
391
|
-
|
392
|
-
if FileTest.directory?
|
393
|
-
|
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?(
|
402
|
+
if @shell.link?(ruby_file)
|
397
403
|
# file is a windows-shortcut
|
398
|
-
|
399
|
-
return 0 if !
|
400
|
-
log("Shortcut to: #{
|
401
|
-
if FileTest.directory?(
|
402
|
-
|
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
|
-
|
408
|
-
@exifView.setText(
|
409
|
-
@filelist.
|
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
|
429
|
+
def has_extension?(filename, ext)
|
424
430
|
File.basename(filename.upcase, ext.upcase) !=
|
425
|
-
|
431
|
+
File.basename(filename.upcase)
|
426
432
|
end
|
427
433
|
|
428
434
|
# ACCESSING
|
429
435
|
|
430
|
-
def
|
431
|
-
return NconvertThumbnailPageGenerator if @options.
|
432
|
-
if RMAGICK_AVAILIABLE && @options.
|
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
|
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.
|
451
|
+
@filelist.go_to_directory(dirname)
|
446
452
|
if(@options.preselectDirectories?)
|
447
|
-
@filelist.
|
448
|
-
|
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
|
454
|
-
return @shell.
|
459
|
+
def default_startup_directory
|
460
|
+
return @shell.picture_directory
|
455
461
|
end
|
456
462
|
|
457
|
-
def
|
458
|
-
return @shell.
|
463
|
+
def get_link_path(dirname, linkname)
|
464
|
+
return @shell.get_link_target(linkname, dirname)
|
459
465
|
end
|
460
466
|
|
461
|
-
def
|
462
|
-
@shell.
|
467
|
+
def ruby_path(path)
|
468
|
+
@shell.ruby_path(path)
|
463
469
|
end
|
464
470
|
|
465
|
-
def
|
466
|
-
|
467
|
-
icon = @imageProcessor.
|
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
|
473
|
-
|
474
|
-
@exif = ExifrAdapter.new(
|
475
|
-
info = CommentedFile.new(File.basename(
|
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.
|
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
|
487
|
-
|
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
|
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
|
518
|
+
def fit_image
|
513
519
|
@imageview.fit unless UseImageView
|
514
520
|
end
|
515
521
|
|
516
|
-
def
|
517
|
-
|
518
|
-
|
519
|
-
return if
|
520
|
-
if File.exists?
|
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.
|
526
|
-
@imageProcessor.
|
527
|
-
@imageProcessor.
|
528
|
-
@imageProcessor.
|
529
|
-
@filelist.
|
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
|
-
|
532
|
-
|
537
|
+
set_directory(save_dialog.getDirectory)
|
538
|
+
open_file_or_link(save_dialog.filename)
|
533
539
|
end
|
534
540
|
|
535
|
-
def
|
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
|
-
|
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
|
-
|
551
|
+
set_current_rotation(@currentRotation + degree)
|
546
552
|
getApp().beginWaitCursor do
|
547
|
-
|
553
|
+
reload_image(@filename)
|
548
554
|
end
|
549
555
|
end
|
550
556
|
|
551
|
-
def
|
552
|
-
if(!File.exist? generator.
|
553
|
-
return error("#{generator.
|
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.
|
556
|
-
return error("#{generator.
|
561
|
+
if(!File.exist? generator.main_index_with_path)
|
562
|
+
return error("#{generator.main_index_with_path} doesn't exist")
|
557
563
|
end
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
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
|
575
|
-
|
600
|
+
def on_cmd_save_selected_image(sender, sel, ptr)
|
601
|
+
save_image
|
576
602
|
end
|
577
603
|
|
578
|
-
def
|
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
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
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
|
592
|
-
|
617
|
+
def on_configure(sender, sel, ptr)
|
618
|
+
fit_image
|
593
619
|
end
|
594
620
|
|
595
|
-
def
|
621
|
+
def on_cmd_options(sender, sel, index)
|
596
622
|
dialog = OptionsDialog.new(self, @options.clone)
|
597
|
-
|
623
|
+
options_changed(dialog.options) if dialog.execute
|
598
624
|
end
|
599
625
|
|
600
626
|
# Open a new file
|
601
|
-
def
|
602
|
-
|
627
|
+
def on_cmd_open(sender, sel, ptr)
|
628
|
+
open_system_file_chooser
|
603
629
|
return 1
|
604
630
|
end
|
605
631
|
|
606
|
-
def
|
607
|
-
|
632
|
+
def open_system_file_chooser
|
633
|
+
open_dialog = FXFileDialog.new(self, "Open Image")
|
608
634
|
#openDialog.filename = @filename
|
609
|
-
|
635
|
+
open_dialog.set_directory(@filelist.get_current_directory)
|
610
636
|
patterns = ["All Files (*)" ] + @supportedImageTypes.values
|
611
|
-
|
612
|
-
|
613
|
-
if
|
614
|
-
@preferredFileFilter =
|
615
|
-
filename =
|
616
|
-
|
617
|
-
|
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
|
624
|
-
|
649
|
+
def on_cmd_file_list_selection(sender, dummy, index)
|
650
|
+
select_index(index)
|
625
651
|
end
|
626
652
|
|
627
|
-
def
|
628
|
-
|
653
|
+
def on_cmd_next_image(sender, sel, dummy)
|
654
|
+
next_image
|
629
655
|
end
|
630
656
|
|
631
|
-
def
|
632
|
-
|
657
|
+
def on_cmd_previous_image(sender, sel, dummy)
|
658
|
+
previous_image
|
633
659
|
end
|
634
660
|
|
635
|
-
def
|
636
|
-
i = @filelist.
|
637
|
-
|
661
|
+
def next_image
|
662
|
+
i = @filelist.select_next_chosen
|
663
|
+
select_index(i) unless i < 0
|
638
664
|
end
|
639
665
|
|
640
|
-
def
|
641
|
-
i = @filelist.
|
642
|
-
|
666
|
+
def previous_image
|
667
|
+
i = @filelist.select_previous_chosen
|
668
|
+
select_index(i) unless i < 0
|
643
669
|
end
|
644
670
|
|
645
|
-
def
|
671
|
+
def start_slideshow
|
646
672
|
@slideManager = 1
|
647
673
|
Thread.new {
|
648
674
|
while(@slideManager) do
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
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
|
684
|
+
def stop_slideshow
|
659
685
|
@slideManager = nil
|
660
|
-
|
686
|
+
stop_fullscreen
|
661
687
|
end
|
662
688
|
|
663
|
-
def
|
664
|
-
|
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
|
-
|
667
|
-
@fullScreenView = MultiImageCanvas.new(@fullscreen,
|
692
|
+
DECOR_BORDER|DECOR_TITLE|DECOR_CLOSE)
|
693
|
+
@fullScreenView = MultiImageCanvas.new(@fullscreen, fill_mode)
|
668
694
|
@fullscreen.connect(SEL_CLOSE){ |sender, sel, ptr|
|
669
|
-
|
695
|
+
stop_fullscreen
|
670
696
|
}
|
671
697
|
@fullscreen.create
|
672
698
|
@fullscreen.show(PLACEMENT_MAXIMIZED)
|
673
|
-
|
699
|
+
reload_image(@filename)
|
674
700
|
end
|
675
701
|
|
676
|
-
def
|
702
|
+
def stop_fullscreen
|
677
703
|
@fullscreen.destroy if fullscreen?
|
678
704
|
@fullscreen = nil
|
679
705
|
@fullScreenView = nil
|
680
|
-
|
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
|
713
|
+
def select_index(index)
|
688
714
|
return 0 if index < 0
|
689
715
|
if @filelist.isItemDirectory(index)
|
690
|
-
|
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.
|
695
|
-
return
|
696
|
-
end
|
720
|
+
filename = @filelist.get_item_ruby_pathname(index)
|
721
|
+
return open_file_or_link(filename)
|
722
|
+
end
|
697
723
|
|
698
|
-
def
|
699
|
-
|
700
|
-
|
701
|
-
if(
|
702
|
-
|
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
|
-
|
730
|
+
set_directory(new_dir) unless(old_dir == new_dir)
|
705
731
|
end
|
706
732
|
|
707
|
-
def
|
708
|
-
@filelist.
|
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
|
713
|
-
@filelist.
|
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
|
743
|
+
def on_cmd_back(sender, unused1, unused2)
|
718
744
|
if(@historyPos > 1)
|
719
745
|
@historyPos -= 1
|
720
|
-
|
746
|
+
set_directory(@history[@historyPos - 1])
|
721
747
|
end
|
722
748
|
end
|
723
749
|
|
724
|
-
def
|
750
|
+
def on_cmd_slideshow(sender, sel, index)
|
725
751
|
if @slideManager
|
726
|
-
|
752
|
+
stop_slideshow
|
727
753
|
else
|
728
|
-
|
754
|
+
start_slideshow
|
729
755
|
end
|
730
756
|
end
|
731
757
|
|
732
|
-
def
|
758
|
+
def on_cmd_fullscreen(sender, sel, index)
|
733
759
|
if fullscreen?
|
734
|
-
|
760
|
+
stop_fullscreen
|
735
761
|
else
|
736
|
-
|
762
|
+
start_fullscreen
|
737
763
|
end
|
738
764
|
end
|
739
765
|
|
740
|
-
def
|
741
|
-
unless @filelist.
|
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
|
-
|
745
|
-
return false unless
|
746
|
-
@options =
|
747
|
-
|
748
|
-
|
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 =
|
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.
|
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.
|
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
|
-
|
762
|
-
|
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
|
-
|
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
|
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
|
783
|
-
|
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
|
830
|
+
def prepare_closure
|
789
831
|
puts 'About to quit'
|
790
|
-
@optionStore.
|
791
|
-
@pipeLog.
|
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
|
-
|
838
|
+
prepare_closure
|
797
839
|
super(notify)
|
798
840
|
end
|
799
|
-
def
|
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
|
805
|
-
|
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
|
810
|
-
|
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
|