Merge lp:~mario-kemper/shutter/libunique into lp:shutter
- libunique
- Merge into devel
Proposed by
Mario Kemper (Romario)
Status: | Merged | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Merged at revision: | 907 | ||||||||||||
Proposed branch: | lp:~mario-kemper/shutter/libunique | ||||||||||||
Merge into: | lp:shutter | ||||||||||||
Diff against target: |
20789 lines (+10435/-9843) 10 files modified
bin/shutter (+9984/-9808) share/shutter/resources/modules/Shutter/App/Common.pm (+38/-8) share/shutter/resources/modules/Shutter/App/HelperFunctions.pm (+10/-5) share/shutter/resources/modules/Shutter/App/Menu.pm (+15/-2) share/shutter/resources/modules/Shutter/App/Options.pm (+89/-0) share/shutter/resources/modules/Shutter/App/Toolbar.pm (+11/-11) share/shutter/resources/modules/Shutter/Screenshot/Error.pm (+15/-3) share/shutter/resources/modules/Shutter/Screenshot/SelectorAuto.pm (+106/-0) share/shutter/resources/modules/Shutter/Screenshot/Window.pm (+8/-6) share/shutter/resources/modules/Shutter/Screenshot/WindowName.pm (+159/-0) |
||||||||||||
To merge this branch: | bzr merge lp:~mario-kemper/shutter/libunique | ||||||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mario Kemper (Romario) | Pending | ||
Review via email: mp+35406@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'bin/shutter' |
2 | --- bin/shutter 2010-08-31 17:26:24 +0000 |
3 | +++ bin/shutter 2010-09-14 13:58:08 +0000 |
4 | @@ -43,6 +43,9 @@ |
5 | use Gtk2::Pango; |
6 | use Gtk2::ImageView; |
7 | |
8 | +#Use single instance applications |
9 | +use Gtk2::Unique; |
10 | + |
11 | #Glib |
12 | use Glib qw/TRUE FALSE/; |
13 | |
14 | @@ -153,6 +156,7 @@ |
15 | require Shutter::App::GlobalSettings; |
16 | require Shutter::App::SimpleDialogs; |
17 | require Shutter::App::HelperFunctions; |
18 | +require Shutter::App::Options; |
19 | require Shutter::App::Menu; |
20 | require Shutter::App::Notification; |
21 | require Shutter::App::ShutterNotification; |
22 | @@ -174,10 +178,12 @@ |
23 | #screenshot classes |
24 | require Shutter::Screenshot::SelectorAdvanced; |
25 | require Shutter::Screenshot::SelectorSimple; |
26 | +require Shutter::Screenshot::SelectorAuto; |
27 | require Shutter::Screenshot::Workspace; |
28 | require Shutter::Screenshot::Web; |
29 | require Shutter::Screenshot::Window; |
30 | require Shutter::Screenshot::WindowXid; |
31 | +require Shutter::Screenshot::WindowName; |
32 | require Shutter::Screenshot::Error; |
33 | |
34 | #upload classes |
35 | @@ -198,6 +204,7 @@ |
36 | #-------------------------------------- |
37 | my $sc = Shutter::App::Common->new($shutter_root, $window, SHUTTER_NAME, SHUTTER_VERSION, SHUTTER_REV, $$); |
38 | my $shf = Shutter::App::HelperFunctions->new($sc); |
39 | +my $so = Shutter::App::Options->new($sc, $shf); |
40 | my $sm = Shutter::App::Menu->new($sc); |
41 | my $st = Shutter::App::Toolbar->new($sc); |
42 | my $sd = Shutter::App::SimpleDialogs->new($window); |
43 | @@ -207,4600 +214,4588 @@ |
44 | |
45 | #-------------------------------------- |
46 | |
47 | -#Clipboard |
48 | -my $clipboard = Gtk2::Clipboard->get( Gtk2::Gdk->SELECTION_CLIPBOARD ); |
49 | - |
50 | -#Gettext |
51 | -my $d = $sc->get_gettext; |
52 | - |
53 | -#Page Setup |
54 | -my $pagesetup = undef; |
55 | - |
56 | -#Tooltips |
57 | -my $tooltips = $sc->get_tooltips; |
58 | - |
59 | -#Gtk2::ImageView and Selector for advanced selection tool |
60 | -my $view = Gtk2::ImageView->new; |
61 | -my $selector = Gtk2::ImageView::Tool::Selector->new($view); |
62 | -my $dragger = Gtk2::ImageView::Tool::Dragger->new($view); |
63 | -$view->set_interpolation ('tiles'); |
64 | -$view->set_tool($selector); |
65 | - |
66 | -#Gtk2::ImageView and Selector for drawing tool |
67 | -my $view_d; |
68 | -my $selector_d; |
69 | -my $dragger_d; |
70 | -if($goocanvas){ |
71 | - $view_d = Gtk2::ImageView->new; |
72 | - $selector_d = Gtk2::ImageView::Tool::Selector->new($view_d); |
73 | - $dragger_d = Gtk2::ImageView::Tool::Dragger->new($view_d); |
74 | - $view_d->set_interpolation ('tiles'); |
75 | - $view_d->set_tool($selector_d); |
76 | -} |
77 | - |
78 | -#UbuntuOne Client |
79 | -my $u1 = undef; |
80 | -my $u1_watcher = undef; |
81 | - |
82 | -#data structures |
83 | -#-------------------------------------- |
84 | -my %plugins; #hash to store plugin infos |
85 | -my %accounts; #hash to store account infos |
86 | -my %settings; #hash to store settings |
87 | - |
88 | -#init |
89 | -#-------------------------------------- |
90 | -my @init_files; #array to store filenames (cmd arguments) |
91 | -&fct_init; |
92 | -&fct_init_debug_output if $sc->get_debug; |
93 | -&fct_load_accounts; |
94 | - |
95 | -#signal-handler |
96 | -$SIG{RTMIN} = sub { &evt_take_screenshot( 'global_keybinding', 'select' ) }; |
97 | -$SIG{USR1} = sub { &evt_take_screenshot( 'global_keybinding', 'raw' ) }; |
98 | -$SIG{USR2} = sub { &evt_take_screenshot( 'global_keybinding', 'window' ) }; |
99 | -$SIG{RTMAX} = sub { &evt_take_screenshot( 'global_keybinding', 'section' ) }; |
100 | - |
101 | -#shutdown Shutter carefully when INT or TERM are detected |
102 | -# => save settings |
103 | -$SIG{INT} = sub { &evt_delete_window( '', 'quit' ) }; |
104 | -$SIG{TERM} = sub { &evt_delete_window( '', 'quit' ) }; |
105 | - |
106 | -#hash of screenshots during session |
107 | -my %session_screens; |
108 | -my %session_start_screen; |
109 | - |
110 | -#main window gui |
111 | -#-------------------------------------- |
112 | -$window->set_default_icon_name( "shutter" ); |
113 | -$window->signal_connect( 'delete-event' => \&evt_delete_window ); |
114 | -$window->set_border_width(0); |
115 | -$window->set_resizable(TRUE); |
116 | -$window->set_focus_on_map(TRUE); |
117 | -$window->set_default_size( -1, 500 ); |
118 | - |
119 | -#TRAY ICON AND MENU |
120 | -my $tray = undef; |
121 | -my $tray_box = undef; #Gtk2::TrayIcon needs and Gtk2::EventBox |
122 | -my $tray_menu = &fct_ret_tray_menu; |
123 | - |
124 | -#HELPERS |
125 | -my $current_profile_indx = 0; #current profile index |
126 | -my $is_hidden = TRUE; #main window hidden flag |
127 | - |
128 | -#SESSION NOTEBOOK |
129 | -my $notebook = Gtk2::Notebook->new; |
130 | -$notebook = &fct_create_session_notebook; |
131 | - |
132 | -#STATUSBAR |
133 | -my $status = Gtk2::Statusbar->new; |
134 | -$status->set_name('main-window-statusbar'); |
135 | - |
136 | -#customize the statusbar style |
137 | -Gtk2::Rc->parse_string ( |
138 | - "style 'statusbar-style' { |
139 | - GtkStatusbar::shadow-type = GTK_SHADOW_NONE |
140 | - } |
141 | - widget '*.main-window-statusbar' style 'statusbar-style'" |
142 | -); |
143 | - |
144 | -my $combobox_status_profiles_label = Gtk2::Label->new( $d->get("Profile") . ":" ); |
145 | -my $combobox_status_profiles = Gtk2::ComboBox->new_text; |
146 | - |
147 | -#arrange settings in notebook |
148 | -my $notebook_settings = Gtk2::Notebook->new; |
149 | -my $settings_dialog = Gtk2::Dialog->new( |
150 | - SHUTTER_NAME . " - " . $d->get("Preferences"), |
151 | - $window, |
152 | - [qw/modal destroy-with-parent/], |
153 | - 'gtk-close' => 'close' |
154 | -); |
155 | -$settings_dialog->set_has_separator(FALSE); |
156 | - |
157 | -my $vbox = Gtk2::VBox->new( FALSE, 0 ); |
158 | -$window->add($vbox); |
159 | - |
160 | -#attach signal handlers to subroutines and pack menu |
161 | -#-------------------------------------- |
162 | -$vbox->pack_start( $sm->create_menu, FALSE, TRUE, 0 ); |
163 | - |
164 | -$sm->{_menuitem_open}->signal_connect( 'activate', \&evt_open, 'menu_open' ); |
165 | - |
166 | -#recent manager and menu entry |
167 | -my $rmanager = Gtk2::RecentManager->new; |
168 | -$sm->{_menu_recent} = Gtk2::RecentChooserMenu->new_for_manager($rmanager); |
169 | -$sm->{_menu_recent}->set_sort_type('mru'); |
170 | -$sm->{_menu_recent}->set_local_only (TRUE); |
171 | - |
172 | -my $recentfilter = Gtk2::RecentFilter->new; |
173 | -$recentfilter->add_pixbuf_formats; |
174 | -$sm->{_menu_recent}->add_filter ($recentfilter); |
175 | -$sm->{_menu_recent}->signal_connect('item-activated' => \&evt_open); |
176 | -$sm->{_menuitem_recent}->set_submenu($sm->{_menu_recent}); |
177 | - |
178 | -$sm->{_menuitem_redoshot}->signal_connect( 'activate', \&evt_take_screenshot, 'redoshot' ); |
179 | -$sm->{_menuitem_selection}->signal_connect( 'activate', \&evt_take_screenshot, 'select' ); |
180 | -$sm->{_menuitem_full}->signal_connect( 'activate', \&evt_take_screenshot, 'raw' ); |
181 | -$sm->{_menuitem_window}->signal_connect( 'activate', \&evt_take_screenshot, 'window' ); |
182 | -$sm->{_menuitem_section}->signal_connect( 'activate', \&evt_take_screenshot, 'section' ); |
183 | -$sm->{_menuitem_menu}->signal_connect( 'activate', \&evt_take_screenshot, 'menu' ); |
184 | -$sm->{_menuitem_tooltip}->signal_connect( 'activate', \&evt_take_screenshot, 'tooltip' ); |
185 | -$sm->{_menuitem_iclipboard}->signal_connect( 'activate', \&fct_clipboard_import ); |
186 | - |
187 | -#gnome web photo is optional, don't enable it when gnome-web-photo is not in PATH |
188 | -if($gnome_web_photo){ |
189 | - $sm->{_menuitem_web}->set_sensitive(TRUE); |
190 | - $sm->{_menuitem_web}->signal_connect( 'activate', \&evt_take_screenshot, 'web' ); |
191 | -}else{ |
192 | - $sm->{_menuitem_web}->set_sensitive(FALSE); |
193 | -} |
194 | - |
195 | -$sm->{_menuitem_save_as}->signal_connect( 'activate', \&evt_save_as, 'menu_save_as' ); |
196 | -#~ $sm->{_menuitem_export_svg}->signal_connect( 'activate', \&evt_save_as, 'menu_export_svg' ); |
197 | -$sm->{_menuitem_export_pdf}->signal_connect( 'activate', \&evt_save_as, 'menu_export_pdf' ); |
198 | -$sm->{_menuitem_print}->signal_connect( 'activate', \&fct_print, 'menu_print' ); |
199 | -$sm->{_menuitem_pagesetup}->signal_connect( 'activate', \&evt_page_setup, 'menu_pagesetup' ); |
200 | -$sm->{_menuitem_email}->signal_connect( 'activate', \&fct_email, 'menu_email' ); |
201 | -$sm->{_menuitem_close}->signal_connect( 'activate', sub { &fct_remove(undef, 'menu_close'); } ); |
202 | -$sm->{_menuitem_close_all}->signal_connect( 'activate', sub { &fct_select_all; &fct_remove(undef, 'menu_close_all'); } ); |
203 | -$sm->{_menuitem_quit}->signal_connect( 'activate', \&evt_delete_window, 'quit' ); |
204 | - |
205 | -$sm->{_menuitem_undo}->signal_connect( 'activate', \&fct_undo ); |
206 | -$sm->{_menuitem_redo}->signal_connect( 'activate', \&fct_redo ); |
207 | -$sm->{_menuitem_copy}->signal_connect( 'activate', \&fct_clipboard, 'image' ); |
208 | -$sm->{_menuitem_copy_filename}->signal_connect( 'activate', \&fct_clipboard, 'text' ); |
209 | -$sm->{_menuitem_trash}->signal_connect( 'activate', sub { &fct_delete(undef); } ); |
210 | -$sm->{_menuitem_select_all}->signal_connect( 'activate', \&fct_select_all ); |
211 | -$sm->{_menuitem_settings}->signal_connect( 'activate', \&evt_show_settings ); |
212 | - |
213 | -$sm->{_menuitem_btoolbar}->signal_connect( 'toggled', \&fct_navigation_toolbar ); |
214 | -$sm->{_menuitem_zoom_in}->signal_connect( 'activate', \&fct_zoom_in ); |
215 | -$sm->{_menuitem_zoom_out}->signal_connect( 'activate', \&fct_zoom_out ); |
216 | -$sm->{_menuitem_zoom_100}->signal_connect( 'activate', \&fct_zoom_100 ); |
217 | -$sm->{_menuitem_zoom_best}->signal_connect( 'activate', \&fct_zoom_best ); |
218 | -$sm->{_menuitem_fullscreen}->signal_connect( 'toggled', \&fct_fullscreen ); |
219 | - |
220 | -#screenshot menu |
221 | -$sm->{_menu_actions}->signal_connect( 'focus', sub { $sm->{_menuitem_reopen}->set_submenu(&fct_ret_program_menu); }); |
222 | -$sm->{_menuitem_rename}->signal_connect( 'activate', \&fct_rename ); |
223 | -$sm->{_menuitem_upload}->signal_connect( 'activate', \&fct_upload ); |
224 | - |
225 | -#nautilus-sendto is optional, don't enable it when not installed |
226 | -if ( $nautilus_sendto ) { |
227 | - $sm->{_menuitem_send}->signal_connect( 'activate', \&fct_send ); |
228 | -}else{ |
229 | - $sm->{_menuitem_send}->set_sensitive(FALSE); |
230 | -} |
231 | - |
232 | -#goocanvas is optional, don't enable it when not installed |
233 | -if ( $goocanvas ) { |
234 | - $sm->{_menuitem_draw}->signal_connect( 'activate', \&fct_draw ); |
235 | -}else{ |
236 | - $sm->{_menuitem_draw}->set_sensitive(FALSE); |
237 | -} |
238 | - |
239 | -$sm->{_menuitem_plugin}->signal_connect( 'activate', \&fct_plugin ); |
240 | -$sm->{_menuitem_redoshot_this}->signal_connect( 'activate', \&evt_take_screenshot, 'redoshot_this' ); |
241 | - |
242 | -#large screenshot menu |
243 | -$sm->{_menu_large_actions}->signal_connect( 'focus', sub { $sm->{_menuitem_large_reopen}->set_submenu(&fct_ret_program_menu); }); |
244 | -$sm->{_menuitem_large_rename}->signal_connect( 'activate', \&fct_rename ); |
245 | -$sm->{_menuitem_large_copy}->signal_connect( 'activate', \&fct_clipboard, 'image' ); |
246 | -$sm->{_menuitem_large_copy_filename}->signal_connect( 'activate', \&fct_clipboard, 'text' ); |
247 | -$sm->{_menuitem_large_trash}->signal_connect( 'activate', sub { &fct_delete(undef); } ); |
248 | -$sm->{_menuitem_large_upload}->signal_connect( 'activate', \&fct_upload ); |
249 | - |
250 | -#nautilus-sendto is optional, don't enable it when not installed |
251 | -if ( $nautilus_sendto ) { |
252 | - $sm->{_menuitem_large_send}->signal_connect( 'activate', \&fct_send ); |
253 | -}else{ |
254 | - $sm->{_menuitem_large_send}->set_sensitive(FALSE); |
255 | -} |
256 | - |
257 | -#goocanvas is optional, don't enable it when not installed |
258 | -if ( $goocanvas ) { |
259 | - $sm->{_menuitem_large_draw}->signal_connect( 'activate', \&fct_draw ); |
260 | -}else{ |
261 | - $sm->{_menuitem_large_draw}->set_sensitive(FALSE); |
262 | -} |
263 | - |
264 | -$sm->{_menuitem_large_plugin}->signal_connect( 'activate', \&fct_plugin ); |
265 | -$sm->{_menuitem_large_redoshot_this}->signal_connect( 'activate', \&evt_take_screenshot, 'redoshot_this' ); |
266 | - |
267 | -#go to menu |
268 | -$sm->{_menuitem_back}->signal_connect( 'activate' => sub { |
269 | - $notebook->prev_page; |
270 | - } |
271 | -); |
272 | -$sm->{_menuitem_forward}->signal_connect( 'activate' => sub{ |
273 | - $notebook->next_page; |
274 | - } |
275 | -); |
276 | -$sm->{_menuitem_first}->signal_connect( 'activate' => sub { |
277 | - $notebook->set_current_page(0); |
278 | - } |
279 | -); |
280 | -$sm->{_menuitem_last}->signal_connect( 'activate' => sub { |
281 | - $notebook->set_current_page( $notebook->get_n_pages - 1 ); |
282 | - } |
283 | -); |
284 | - |
285 | -#help |
286 | -$sm->{_menuitem_question}->signal_connect( 'activate', \&evt_question ); |
287 | -$sm->{_menuitem_translate}->signal_connect( 'activate', \&evt_translate ); |
288 | -$sm->{_menuitem_bug}->signal_connect( 'activate', \&evt_bug ); |
289 | -$sm->{_menuitem_about}->signal_connect( 'activate', \&evt_about ); |
290 | - |
291 | -#-------------------------------------- |
292 | - |
293 | -#trayicon |
294 | -#-------------------------------------- |
295 | -#command line param set to disable tray icon? |
296 | -unless ( $sc->get_disable_systray ) { |
297 | - |
298 | - if ( Gtk2->CHECK_VERSION( 2, 10, 0 ) ) { |
299 | - $tray = Gtk2::StatusIcon->new(); |
300 | - |
301 | - $tray->set_from_icon_name("shutter-panel"); |
302 | - $tray->set_visible(1); |
303 | - $tray->{'hid'} = $tray->signal_connect( |
304 | - 'popup-menu' => sub { &evt_show_systray_statusicon; }, |
305 | - $tray |
306 | - ); |
307 | - $tray->{'hid2'} = $tray->signal_connect( |
308 | - 'activate' => sub { |
309 | - &evt_activate_systray_statusicon; |
310 | - $tray; |
311 | - }, |
312 | - $tray |
313 | - ); |
314 | - } else { |
315 | - |
316 | - my $tray_image = Gtk2::Image->new_from_icon_name( 'shutter-panel', 'large-toolbar' ); |
317 | - |
318 | - #eventbox with shutter logo |
319 | - $tray_box = Gtk2::EventBox->new; |
320 | - $tray_box->add($tray_image); |
321 | - |
322 | - #tray icon |
323 | - require Gtk2::TrayIcon; |
324 | - $tray = Gtk2::TrayIcon->new('Shutter TrayIcon'); |
325 | - $tray->add($tray_box); |
326 | - $tray_box->{'hid'} = $tray_box->signal_connect( 'button_release_event', \&evt_show_systray ); |
327 | - $tray->show_all; |
328 | - } |
329 | - |
330 | -} |
331 | - |
332 | -#-------------------------------------- |
333 | - |
334 | -#settings |
335 | -#-------------------------------------- |
336 | -my $vbox_settings = Gtk2::VBox->new( FALSE, 12 ); |
337 | -my $hbox_settings = Gtk2::HBox->new( FALSE, 12 ); |
338 | -my $vbox_basic = Gtk2::VBox->new( FALSE, 12 ); |
339 | -my $vbox_advanced = Gtk2::VBox->new( FALSE, 12 ); |
340 | -my $vbox_actions = Gtk2::VBox->new( FALSE, 12 ); |
341 | -my $vbox_imageview = Gtk2::VBox->new( FALSE, 12 ); |
342 | -my $vbox_behavior = Gtk2::VBox->new( FALSE, 12 ); |
343 | -my $vbox_keyboard = Gtk2::VBox->new( FALSE, 12 ); |
344 | -my $vbox_accounts = Gtk2::VBox->new( FALSE, 12 ); |
345 | - |
346 | -#profiles |
347 | -my $profiles_box = Gtk2::HBox->new( FALSE, 0 ); |
348 | - |
349 | -#main |
350 | -my $file_vbox = Gtk2::VBox->new( FALSE, 0 ); |
351 | -my $save_vbox = Gtk2::VBox->new( FALSE, 0 ); |
352 | -my $capture_vbox = Gtk2::VBox->new( FALSE, 0 ); |
353 | - |
354 | -my $scale_box = Gtk2::HBox->new( FALSE, 0 ); |
355 | -my $filetype_box = Gtk2::HBox->new( FALSE, 0 ); |
356 | -my $filename_box = Gtk2::HBox->new( FALSE, 0 ); |
357 | -my $saveDir_box = Gtk2::HBox->new( FALSE, 0 ); |
358 | -my $save_ask_box = Gtk2::HBox->new( FALSE, 0 ); |
359 | -my $save_auto_box = Gtk2::HBox->new( FALSE, 0 ); |
360 | -my $no_autocopy_box = Gtk2::HBox->new( FALSE, 0 ); |
361 | -my $image_autocopy_box = Gtk2::HBox->new( FALSE, 0 ); |
362 | -my $fname_autocopy_box = Gtk2::HBox->new( FALSE, 0 ); |
363 | -my $delay_box = Gtk2::HBox->new( FALSE, 0 ); |
364 | -my $cursor_box = Gtk2::HBox->new( FALSE, 0 ); |
365 | - |
366 | -#keybindings |
367 | -my $sel_capture_vbox = Gtk2::VBox->new( FALSE, 0 ); |
368 | -my $asel_capture_vbox = Gtk2::VBox->new( FALSE, 0 ); |
369 | - |
370 | -my $keybinding_mode_box = Gtk2::HBox->new( TRUE, 0 ); |
371 | -my $key_box = Gtk2::HBox->new( FALSE, 0 ); |
372 | -my $key_sel_box = Gtk2::HBox->new( FALSE, 0 ); |
373 | - |
374 | -#actions |
375 | -my $actions_vbox = Gtk2::VBox->new( FALSE, 0 ); |
376 | - |
377 | -my $progname_box = Gtk2::HBox->new( FALSE, 0 ); |
378 | -my $im_colors_box = Gtk2::HBox->new( FALSE, 0 ); |
379 | -my $thumbnail_box = Gtk2::HBox->new( FALSE, 0 ); |
380 | -my $bordereffect_box = Gtk2::HBox->new( FALSE, 0 ); |
381 | - |
382 | -#advanced |
383 | -my $window_capture_vbox = Gtk2::VBox->new( FALSE, 0 ); |
384 | -my $menu_capture_vbox = Gtk2::VBox->new( FALSE, 0 ); |
385 | -my $web_capture_vbox = Gtk2::VBox->new( FALSE, 0 ); |
386 | - |
387 | -my $zoom_box = Gtk2::HBox->new( FALSE, 0 ); |
388 | -my $as_help_box = Gtk2::HBox->new( FALSE, 0 ); |
389 | -my $asel_isize_box = Gtk2::HBox->new( FALSE, 0 ); |
390 | -my $asel_isize_box2 = Gtk2::HBox->new( FALSE, 0 ); |
391 | -my $border_box = Gtk2::HBox->new( FALSE, 0 ); |
392 | -my $visible_windows_box = Gtk2::HBox->new( FALSE, 0 ); |
393 | -my $menu_delay_box = Gtk2::HBox->new( FALSE, 0 ); |
394 | -my $menu_waround_box = Gtk2::HBox->new( FALSE, 0 ); |
395 | -my $web_width_box = Gtk2::HBox->new( FALSE, 0 ); |
396 | - |
397 | -#imageview |
398 | -my $transparent_vbox = Gtk2::VBox->new( FALSE, 0 ); |
399 | -my $imageview_hbox1 = Gtk2::HBox->new( FALSE, 0 ); |
400 | -my $imageview_hbox2 = Gtk2::HBox->new( FALSE, 0 ); |
401 | -my $imageview_hbox3 = Gtk2::HBox->new( FALSE, 0 ); |
402 | - |
403 | -#behavior |
404 | -my $window_vbox = Gtk2::VBox->new( FALSE, 0 ); |
405 | -my $notify_vbox = Gtk2::VBox->new( FALSE, 0 ); |
406 | -my $trash_vbox = Gtk2::VBox->new( FALSE, 0 ); |
407 | -my $keybinding_vbox = Gtk2::VBox->new( FALSE, 0 ); |
408 | - |
409 | -my $hide_active_hbox = Gtk2::HBox->new( FALSE, 0 ); |
410 | -my $pafter_active_hbox = Gtk2::HBox->new( FALSE, 0 ); |
411 | -my $cac_hbox = Gtk2::HBox->new( FALSE, 0 ); |
412 | -my $hide_time_hbox = Gtk2::HBox->new( FALSE, 0 ); |
413 | -my $na_active_hbox = Gtk2::HBox->new( FALSE, 0 ); |
414 | -my $nt_active_hbox = Gtk2::HBox->new( FALSE, 0 ); |
415 | -my $npt_active_hbox = Gtk2::HBox->new( FALSE, 0 ); |
416 | -my $ns_combo_hbox = Gtk2::HBox->new( FALSE, 0 ); |
417 | -my $aod_active_hbox = Gtk2::HBox->new( FALSE, 0 ); |
418 | -my $doc_active_hbox = Gtk2::HBox->new( FALSE, 0 ); |
419 | - |
420 | -#upload |
421 | -my $accounts_vbox = Gtk2::VBox->new( FALSE, 0 ); |
422 | -my $ftp_vbox = Gtk2::VBox->new( FALSE, 0 ); |
423 | - |
424 | -my $accounts_hbox = Gtk2::HBox->new( FALSE, 0 ); |
425 | -my $ftp_hbox1 = Gtk2::HBox->new( FALSE, 0 ); |
426 | -my $ftp_hbox2 = Gtk2::HBox->new( FALSE, 0 ); |
427 | -my $ftp_hbox3 = Gtk2::HBox->new( FALSE, 0 ); |
428 | -my $ftp_hbox4 = Gtk2::HBox->new( FALSE, 0 ); |
429 | -my $ftp_hbox5 = Gtk2::HBox->new( FALSE, 0 ); |
430 | - |
431 | -#plugins |
432 | -my $effects_vbox = Gtk2::VBox->new( FALSE, 0 ); |
433 | - |
434 | -#load settings |
435 | -#-------------------------------------- |
436 | -my $settings_xml = &fct_load_settings( "start" ); |
437 | - |
438 | -#load last profile |
439 | -if ( defined $settings_xml->{'general'}->{'last_profile'} ) { |
440 | - if ( $settings_xml->{'general'}->{'last_profile'} != -1 ) { |
441 | - $settings_xml = &fct_load_settings("start", $settings_xml->{'general'}->{'last_profile_name'} ); |
442 | - } |
443 | -} |
444 | - |
445 | -#-------------------------------------- |
446 | - |
447 | -#block signals while checking plugins / opening files |
448 | -&fct_control_signals('block'); |
449 | - |
450 | -#check plugins |
451 | -#-------------------------------------- |
452 | -#not used in a standalone environment |
453 | -unless($ENV{PAR_TEMP}){ |
454 | - &fct_check_installed_plugins; |
455 | -} |
456 | - |
457 | -$vbox->pack_start( $st->create_toolbar, FALSE, TRUE, 0 ); |
458 | - |
459 | -$st->{_redoshot}->signal_connect( 'clicked' => \&evt_take_screenshot, 'redoshot' ); |
460 | -$st->{_redoshot}->set_sensitive(FALSE); |
461 | - |
462 | -my ( $tool_advanced, $tool_simple ) = undef; |
463 | -$st->{_select}->set_menu(&fct_ret_sel_menu); |
464 | -$st->{_select}->signal_connect( 'clicked' => \&evt_take_screenshot, 'select' ); |
465 | - |
466 | -my $current_monitor_active = undef; |
467 | -$st->{_full}->signal_connect( 'clicked' => \&evt_take_screenshot, 'raw' ); |
468 | - |
469 | -#init menus |
470 | -$st->{_full}->set_menu( &fct_ret_workspace_menu(TRUE) ); |
471 | -$st->{_window}->set_menu( &fct_ret_window_menu ); |
472 | - |
473 | -#and attach signal handlers |
474 | -$st->{_full}->signal_connect( 'show-menu' => sub { $st->{_full}->set_menu( &fct_ret_workspace_menu(FALSE) ) } ); |
475 | -$st->{_window}->signal_connect( 'clicked' => \&evt_take_screenshot, 'window' ); |
476 | - |
477 | -$st->{_window}->signal_connect( 'show-menu' => sub { $st->{_window}->set_menu( &fct_ret_window_menu ) } ); |
478 | -$st->{_section}->signal_connect( 'clicked' => \&evt_take_screenshot, 'section' ); |
479 | -$st->{_menu}->signal_connect( 'clicked' => \&evt_take_screenshot, 'menu' ); |
480 | -$st->{_tooltip}->signal_connect( 'clicked' => \&evt_take_screenshot, 'tooltip' ); |
481 | - |
482 | -#gnome-web-photo is optional, don't enable it when gnome-web-photo is not in PATH |
483 | -if ( $gnome_web_photo ) { |
484 | - $st->{_web}->set_sensitive(TRUE); |
485 | - $st->{_web}->signal_connect( 'clicked' => \&evt_take_screenshot, 'web' ); |
486 | - $st->{_web}->set_menu(&fct_ret_web_menu); |
487 | - $st->{_web}->signal_connect( 'show-menu' => \&fct_ret_web_menu ); |
488 | -} else { |
489 | - $tooltips->set_tip( $st->{_web}, $d->get("gnome-web-photo needs to be installed for this feature") ); |
490 | - $st->{_web}->set_arrow_tooltip( $tooltips, $d->get("gnome-web-photo needs to be installed for this feature"), '' ); |
491 | - $st->{_web}->set_sensitive(FALSE); |
492 | -} |
493 | - |
494 | -#goocanvas is optional, don't enable it when not installed |
495 | -if ( $goocanvas ) { |
496 | - $st->{_edit}->signal_connect( 'clicked' => \&fct_draw ); |
497 | -}else{ |
498 | - $tooltips->set_tip( $st->{_edit}, $d->get("Goo::Canvas/libgoocanvas needs to be installed for this feature") ); |
499 | -} |
500 | -$st->{_edit}->set_sensitive(FALSE); |
501 | - |
502 | -$st->{_upload}->signal_connect( 'clicked' => \&fct_upload ); |
503 | -$st->{_upload}->set_sensitive(FALSE); |
504 | - |
505 | - |
506 | -#-------------------------------------- |
507 | - |
508 | -#handle profiles |
509 | -#-------------------------------------- |
510 | -my $combobox_settings_profiles = Gtk2::ComboBox->new_text; |
511 | -my @current_profiles; |
512 | -my $current_index = 0; |
513 | -foreach ( sort glob("$ENV{'HOME'}/.shutter/profiles/*.xml") ) { |
514 | - utf8::decode $_; |
515 | - next if $_ =~ /\_accounts.xml/; #accounts file - we are looking for "real" profiles |
516 | - $_ =~ /.*\/(.*)\.xml/; #get profiles name |
517 | - my $last_profile_name = $1; |
518 | - $combobox_settings_profiles->append_text($last_profile_name); |
519 | - |
520 | - #set active profile |
521 | - if ( exists $settings_xml->{'general'}->{'last_profile_name'} ) { |
522 | - if ( $settings_xml->{'general'}->{'last_profile_name'} eq $last_profile_name ) { |
523 | - $combobox_settings_profiles->set_active($current_index); |
524 | - $current_profile_indx = $current_index; |
525 | - } |
526 | - } |
527 | - |
528 | - push( @current_profiles, $last_profile_name ); |
529 | - $current_index++; |
530 | -} |
531 | -$tooltips->set_tip( $combobox_settings_profiles, $d->get("Choose a profile") ); |
532 | - |
533 | -#set 0 if nothing is selected yet |
534 | -if ( !$combobox_settings_profiles->get_active_text ) { |
535 | - $combobox_settings_profiles->set_active(0); |
536 | - $current_profile_indx = 0; |
537 | -} |
538 | - |
539 | -#populate quick selector as well |
540 | -&fct_update_profile_selectors($combobox_settings_profiles, \@current_profiles); |
541 | - |
542 | -my $button_profile_save = Gtk2::Button->new; |
543 | -$button_profile_save->signal_connect( |
544 | - 'clicked' => sub { |
545 | - my $widget = shift; |
546 | - &evt_save_profile( $widget, $combobox_settings_profiles, \@current_profiles ); |
547 | - } |
548 | -); |
549 | -$button_profile_save->set_image( Gtk2::Image->new_from_stock( 'gtk-save', 'button' ) ); |
550 | -$tooltips->set_tip( $button_profile_save, $d->get("Save configuration as profile") ); |
551 | - |
552 | -my $button_profile_delete = Gtk2::Button->new; |
553 | -$button_profile_delete->signal_connect( |
554 | - 'clicked' => sub { |
555 | - my $widget = shift; |
556 | - &evt_delete_profile( $widget, $combobox_settings_profiles, \@current_profiles ); |
557 | - } |
558 | -); |
559 | -$button_profile_delete->set_image( Gtk2::Image->new_from_stock( 'gtk-delete', 'button' ) ); |
560 | -$tooltips->set_tip( $button_profile_delete, $d->get("Delete profile") ); |
561 | -my $button_profile_apply = Gtk2::Button->new; |
562 | -$button_profile_apply->signal_connect( |
563 | - 'clicked' => sub { |
564 | - my $widget = shift; |
565 | - &evt_apply_profile( $widget, $combobox_settings_profiles, \@current_profiles ); |
566 | - } |
567 | -); |
568 | -$button_profile_apply->set_image( Gtk2::Image->new_from_stock( 'gtk-apply', 'button' ) ); |
569 | -$tooltips->set_tip( $button_profile_apply, $d->get("Load the selected profile's configuration") ); |
570 | - |
571 | -#-------------------------------------- |
572 | - |
573 | - |
574 | -#frames and label for settings dialog |
575 | -#-------------------------------------- |
576 | -my $file_frame_label = Gtk2::Label->new; |
577 | -$file_frame_label->set_markup( "<b>" . $d->get("Image format") . "</b>" ); |
578 | - |
579 | -my $file_frame = Gtk2::Frame->new(); |
580 | -$file_frame->set_label_widget($file_frame_label); |
581 | -$file_frame->set_shadow_type('none'); |
582 | - |
583 | -my $save_frame_label = Gtk2::Label->new; |
584 | -$save_frame_label->set_markup( "<b>" . $d->get("Save") . "</b>" ); |
585 | - |
586 | -my $save_frame = Gtk2::Frame->new(); |
587 | -$save_frame->set_label_widget($save_frame_label); |
588 | -$save_frame->set_shadow_type('none'); |
589 | - |
590 | -my $window_frame_label = Gtk2::Label->new; |
591 | -$window_frame_label->set_markup( "<b>" . $d->get("Window Preferences") . "</b>" ); |
592 | - |
593 | -my $window_frame = Gtk2::Frame->new(); |
594 | -$window_frame->set_label_widget($window_frame_label); |
595 | -$window_frame->set_shadow_type('none'); |
596 | - |
597 | -my $notify_frame_label = Gtk2::Label->new; |
598 | -$notify_frame_label->set_markup( "<b>" . $d->get("Notifications") . "</b>" ); |
599 | - |
600 | -my $notify_frame = Gtk2::Frame->new(); |
601 | -$notify_frame->set_label_widget($notify_frame_label); |
602 | -$notify_frame->set_shadow_type('none'); |
603 | - |
604 | -my $trash_frame_label = Gtk2::Label->new; |
605 | -$trash_frame_label->set_markup( "<b>" . $d->get("Trash") . "</b>" ); |
606 | - |
607 | -my $trash_frame = Gtk2::Frame->new(); |
608 | -$trash_frame->set_label_widget($trash_frame_label); |
609 | -$trash_frame->set_shadow_type('none'); |
610 | - |
611 | -my $keybinding_frame_label = Gtk2::Label->new; |
612 | -$keybinding_frame_label->set_markup( "<b>" . $d->get("Gnome-Keybinding") . "</b>" ); |
613 | - |
614 | -my $keybinding_frame = Gtk2::Frame->new(); |
615 | -$keybinding_frame->set_label_widget($keybinding_frame_label); |
616 | -$keybinding_frame->set_shadow_type('none'); |
617 | - |
618 | -my $actions_frame_label = Gtk2::Label->new; |
619 | -$actions_frame_label->set_markup( "<b>" . $d->get("Actions") . "</b>" ); |
620 | - |
621 | -my $actions_frame = Gtk2::Frame->new(); |
622 | -$actions_frame->set_label_widget($actions_frame_label); |
623 | -$actions_frame->set_shadow_type('none'); |
624 | - |
625 | -my $capture_frame_label = Gtk2::Label->new; |
626 | -$capture_frame_label->set_markup( "<b>" . $d->get("Capture") . "</b>" ); |
627 | - |
628 | -my $capture_frame = Gtk2::Frame->new(); |
629 | -$capture_frame->set_label_widget($capture_frame_label); |
630 | -$capture_frame->set_shadow_type('none'); |
631 | - |
632 | -my $sel_capture_frame_label = Gtk2::Label->new; |
633 | -$sel_capture_frame_label->set_markup( "<b>" . $d->get("Selection Capture") . "</b>" ); |
634 | - |
635 | -my $sel_capture_frame = Gtk2::Frame->new(); |
636 | -$sel_capture_frame->set_label_widget($sel_capture_frame_label); |
637 | -$sel_capture_frame->set_shadow_type('none'); |
638 | - |
639 | -my $asel_capture_frame_label = Gtk2::Label->new; |
640 | -$asel_capture_frame_label->set_markup( "<b>" . $d->get("Advanced Selection Capture") . "</b>" ); |
641 | - |
642 | -my $asel_capture_frame = Gtk2::Frame->new(); |
643 | -$asel_capture_frame->set_label_widget($asel_capture_frame_label); |
644 | -$asel_capture_frame->set_shadow_type('none'); |
645 | - |
646 | -my $window_capture_frame_label = Gtk2::Label->new; |
647 | -$window_capture_frame_label->set_markup( "<b>" . $d->get("Window Capture") . "</b>" ); |
648 | - |
649 | -my $window_capture_frame = Gtk2::Frame->new(); |
650 | -$window_capture_frame->set_label_widget($window_capture_frame_label); |
651 | -$window_capture_frame->set_shadow_type('none'); |
652 | - |
653 | -my $menu_capture_frame_label = Gtk2::Label->new; |
654 | -$menu_capture_frame_label->set_markup( "<b>" . $d->get("Menu/Tooltip Capture") . "</b>" ); |
655 | - |
656 | -my $menu_capture_frame = Gtk2::Frame->new(); |
657 | -$menu_capture_frame->set_label_widget($menu_capture_frame_label); |
658 | -$menu_capture_frame->set_shadow_type('none'); |
659 | - |
660 | -my $web_capture_frame_label = Gtk2::Label->new; |
661 | -$web_capture_frame_label->set_markup( "<b>" . $d->get("Website Capture") . "</b>" ); |
662 | - |
663 | -my $web_capture_frame = Gtk2::Frame->new(); |
664 | -$web_capture_frame->set_label_widget($web_capture_frame_label); |
665 | -$web_capture_frame->set_shadow_type('none'); |
666 | - |
667 | -my $accounts_frame_label = Gtk2::Label->new; |
668 | -$accounts_frame_label->set_markup( "<b>" . $d->get("Accounts") . "</b>" ); |
669 | - |
670 | -my $accounts_frame = Gtk2::Frame->new(); |
671 | -$accounts_frame->set_label_widget($accounts_frame_label); |
672 | -$accounts_frame->set_shadow_type('none'); |
673 | - |
674 | -my $ftp_frame_label = Gtk2::Label->new; |
675 | -$ftp_frame_label->set_markup( "<b>" . $d->get("File Transfer Protocol (FTP)") . "</b>" ); |
676 | - |
677 | -my $ftp_frame = Gtk2::Frame->new(); |
678 | -$ftp_frame->set_label_widget($ftp_frame_label); |
679 | -$ftp_frame->set_shadow_type('none'); |
680 | - |
681 | -my $transparent_frame_label = Gtk2::Label->new; |
682 | -$transparent_frame_label->set_markup( "<b>" . $d->get("Transparent Parts") . "</b>" ); |
683 | - |
684 | -my $transparent_frame = Gtk2::Frame->new(); |
685 | -$transparent_frame->set_label_widget($transparent_frame_label); |
686 | -$transparent_frame->set_shadow_type('none'); |
687 | - |
688 | -#filename |
689 | -#-------------------------------------- |
690 | -my $filename_label = Gtk2::Label->new( $d->get("Filename") . ":" ); |
691 | - |
692 | -my $filename = Gtk2::Entry->new; |
693 | -if ( defined $settings_xml->{'general'}->{'filename'} ) { |
694 | - $filename->set_text( $settings_xml->{'general'}->{'filename'} ); |
695 | -} else { |
696 | - $filename->set_text("\$name_\%NNN"); |
697 | -} |
698 | - |
699 | -#do some input validation |
700 | -#here are all invalid char codes |
701 | -my @invalid_codes = (47,92,63,42,58,124,34,60,62,44,59,35,38); |
702 | -my $filename_hint = Gtk2::Label->new; |
703 | -$filename_hint->set_no_show_all(TRUE); |
704 | -$filename->signal_connect('key-press-event' => sub { |
705 | - my $filename = shift; |
706 | - my $event = shift; |
707 | - |
708 | - my $input = Gtk2::Gdk->keyval_to_unicode ($event->keyval); |
709 | - |
710 | - #invalid input |
711 | - #~ print $input."\n"; |
712 | - if(grep($input == $_, @invalid_codes)){ |
713 | - my $char = chr($input); |
714 | - $char = '&' if $char eq '&'; |
715 | - $filename_hint->set_markup("<span size='small'>" . |
716 | - sprintf($d->get("Reserved character %s is not allowed to be in a filename.") , "'".$char."'") |
717 | - . "</span>"); |
718 | - |
719 | - $filename_hint->show; |
720 | - return TRUE; |
721 | - }else{ |
722 | - #clear possible message when valid char is entered |
723 | - $filename_hint->set_markup("<span size='small'></span>"); |
724 | - $filename_hint->hide; |
725 | - return FALSE; |
726 | - } |
727 | -}); |
728 | - |
729 | -my $filename_tooltip_string = |
730 | - $d->get("There are several wildcards available, like\n"). |
731 | - $d->get("%Y = year\n"). |
732 | - $d->get("%m = month\n"). |
733 | - $d->get("%d = day\n"). |
734 | - $d->get("%T = time\n"). |
735 | - $d->get("\$w = width\n"). |
736 | - $d->get("\$h = height\n"). |
737 | - $d->get("\$name = multi-purpose (e.g. window title)\n"). |
738 | - $d->get("\$nb_name = like \$name but without blanks in resulting strings\n"). |
739 | - $d->get("\$profile = name of current profile\n"). |
740 | - $d->get("\$R = random char (e.g. \$RRRR = ag4r)\n"). |
741 | - $d->get("%NN = counter"); |
742 | - |
743 | -$tooltips->set_tip($filename, $filename_tooltip_string); |
744 | -$tooltips->set_tip($filename_label, $filename_tooltip_string); |
745 | - |
746 | -$filename_box->pack_start( $filename_label, FALSE, TRUE, 12 ); |
747 | -$filename_box->pack_start( $filename, TRUE, TRUE, 0 ); |
748 | - |
749 | -#end - filename |
750 | -#-------------------------------------- |
751 | - |
752 | - |
753 | -#filetype and scale |
754 | -#-------------------------------------- |
755 | -my $scale = Gtk2::HScale->new_with_range( 0, 9, 1 ); |
756 | -my $scale_label = Gtk2::Label->new( $d->get("Compression") . ":" ); |
757 | -$scale->set_value_pos('right'); |
758 | -$scale->set_value(1); |
759 | - |
760 | -#we don't need a default here because it will be set through signal handling (filetype) |
761 | -if ( defined $settings_xml->{'general'}->{'quality'} ) { |
762 | - $scale->set_value( $settings_xml->{'general'}->{'quality'} ); |
763 | -} |
764 | - |
765 | -$tooltips->set_tip( $scale, |
766 | - $d->get("Quality/Compression:\nHigh value means high size / high compression\n(depending on file format chosen)") ); |
767 | -$tooltips->set_tip( $scale_label, |
768 | - $d->get("Quality/Compression:\nHigh value means high size / high compression\n(depending on file format chosen)") ); |
769 | -$scale_box->pack_start( $scale_label, FALSE, TRUE, 12 ); |
770 | -$scale_box->pack_start( $scale, TRUE, TRUE, 0 ); |
771 | - |
772 | -#add compatile, writeable file types |
773 | -my $combobox_type = Gtk2::ComboBox->new_text; |
774 | -my ( $int_png, $int_jpeg, $int_bmp ) = ( -1, -1, -1 ); |
775 | -my $format_counter = 0; |
776 | - |
777 | -foreach ( Gtk2::Gdk::Pixbuf->get_formats ) { |
778 | - if ( $_->{name} eq "jpeg" |
779 | - || $_->{name} eq "png" |
780 | - || $_->{name} eq "bmp" ) |
781 | - { |
782 | - $combobox_type->append_text( $_->{name} . " - " . $_->{description} ); |
783 | - |
784 | - #a little ugly here, maybe the values are in alternative order on several machine... |
785 | - #just remember the number when appending, so we can set png as default for example |
786 | - if ( $_->{name} eq "jpeg" ) { |
787 | - $int_jpeg = $format_counter; |
788 | - } elsif ( $_->{name} eq "png" ) { |
789 | - $int_png = $format_counter; |
790 | - } elsif ( $_->{name} eq "bmp" ) { |
791 | - $int_bmp = $format_counter; |
792 | - } |
793 | - |
794 | - $format_counter++; |
795 | - |
796 | - } |
797 | -} |
798 | -$combobox_type->signal_connect( 'changed' => \&evt_value_changed, 'type_changed' ); |
799 | -$scale->signal_connect( 'value-changed' => \&evt_value_changed, 'qvalue_changed' ); |
800 | - |
801 | -if ( defined $settings_xml->{'general'}->{'filetype'} ) { |
802 | - |
803 | - #migration from gscrot to shutter |
804 | - #maybe we can drop this in future releases |
805 | - # 0 := jpeg |
806 | - # 1 := png |
807 | - unless(defined $settings_xml->{'general'}->{'app_version'}){ |
808 | - if($settings_xml->{'general'}->{'filetype'} == 0){ |
809 | - $combobox_type->set_active($int_jpeg); |
810 | - }elsif($settings_xml->{'general'}->{'filetype'} == 1){ |
811 | - $combobox_type->set_active($int_png); |
812 | - } |
813 | - |
814 | - #shutter |
815 | - }else{ |
816 | - $combobox_type->set_active($settings_xml->{'general'}->{'filetype'}); |
817 | - } |
818 | - |
819 | - #set saved quality/compression value if there is one |
820 | - if(defined $settings_xml->{'general'}->{'quality'}){ |
821 | - $scale->set_value( $settings_xml->{'general'}->{'quality'} ); |
822 | - } |
823 | - |
824 | -} else { |
825 | - |
826 | - #we will try to set a default value in this order |
827 | - foreach ( @{ [ $int_png, $int_jpeg, $int_bmp ] } ) { |
828 | - if ( $_ > -1 ) { |
829 | - $combobox_type->set_active( $_ ); |
830 | - last; |
831 | - } |
832 | - } |
833 | - |
834 | -} |
835 | - |
836 | -my $filetype_label = Gtk2::Label->new( $d->get("Image format") . ":" ); |
837 | -$tooltips->set_tip( $combobox_type, $d->get("Select a file format") ); |
838 | -$tooltips->set_tip( $filetype_label, $d->get("Select a file format") ); |
839 | -$filetype_box->pack_start( $filetype_label, FALSE, TRUE, 12 ); |
840 | -$filetype_box->pack_start( $combobox_type, TRUE, TRUE, 0 ); |
841 | - |
842 | -#end - filetype and scale |
843 | -#-------------------------------------- |
844 | - |
845 | -#saveDir |
846 | -#-------------------------------------- |
847 | -my $saveDir_label = Gtk2::Label->new( $d->get("Directory") . ":" ); |
848 | -my $saveDir_button = Gtk2::FileChooserButton->new( "Shutter - " . $d->get("Choose folder"), 'select-folder' ); |
849 | -if ( defined $settings_xml->{'general'}->{'folder'} ) { |
850 | - $saveDir_button->set_current_folder( $settings_xml->{'general'}->{'folder'} ); |
851 | -} else { |
852 | - $saveDir_button->set_current_folder( File::HomeDir->my_pictures ); |
853 | -} |
854 | - |
855 | -$tooltips->set_tip( $saveDir_button, $d->get("Your screenshots will be saved to this directory") ); |
856 | -$tooltips->set_tip( $saveDir_label, $d->get("Your screenshots will be saved to this directory") ); |
857 | -$saveDir_box->pack_start( $saveDir_label, FALSE, TRUE, 12 ); |
858 | -$saveDir_box->pack_start( $saveDir_button, TRUE, TRUE, 0 ); |
859 | - |
860 | -#end - saveDir |
861 | -#-------------------------------------- |
862 | - |
863 | -#save options |
864 | -#-------------------------------------- |
865 | -my $save_ask_active = Gtk2::RadioButton->new_with_label(undef, $d->get("Browse for save folder every time") ); |
866 | -$save_ask_box->pack_start( $save_ask_active, FALSE, TRUE, 12 ); |
867 | - |
868 | -$tooltips->set_tip( $save_ask_active, $d->get("Browse for save folder every time") ); |
869 | - |
870 | -my $save_auto_active = Gtk2::RadioButton->new_with_label($save_ask_active, $d->get("Automatically save file") ); |
871 | -$save_auto_box->pack_start( $save_auto_active, FALSE, TRUE, 12 ); |
872 | - |
873 | -$tooltips->set_tip( $save_auto_active, $d->get("Automatically save file") ); |
874 | - |
875 | -$save_ask_active->signal_connect( |
876 | - 'toggled' => \&evt_value_changed, |
877 | - 'save_toggled' |
878 | -); |
879 | - |
880 | -$save_auto_active->signal_connect( |
881 | - 'toggled' => \&evt_value_changed, |
882 | - 'save_toggled' |
883 | -); |
884 | - |
885 | -#default state |
886 | -$save_ask_active->set_active( FALSE ); |
887 | -$save_auto_active->set_active( TRUE ); |
888 | - |
889 | -if ( defined $settings_xml->{'general'}->{'save_auto'} ) { |
890 | - $save_auto_active->set_active( $settings_xml->{'general'}->{'save_auto'} ); |
891 | -} |
892 | - |
893 | -if ( defined $settings_xml->{'general'}->{'save_ask'} ) { |
894 | - $save_ask_active->set_active( $settings_xml->{'general'}->{'save_ask'} ); |
895 | -} |
896 | - |
897 | -#end - save options |
898 | -#-------------------------------------- |
899 | - |
900 | -#image_autocopy |
901 | -#-------------------------------------- |
902 | -my $image_autocopy_active = Gtk2::RadioButton->new_with_label(undef, $d->get("Automatically copy screenshot to clipboard") ); |
903 | -$image_autocopy_box->pack_start( $image_autocopy_active, FALSE, TRUE, 12 ); |
904 | - |
905 | -if ( defined $settings_xml->{'general'}->{'image_autocopy'} ) { |
906 | - $image_autocopy_active->set_active( $settings_xml->{'general'}->{'image_autocopy'} ); |
907 | -} else { |
908 | - $image_autocopy_active->set_active(TRUE); |
909 | -} |
910 | - |
911 | -$tooltips->set_tip( $image_autocopy_active, $d->get("Automatically copy screenshot to clipboard") ); |
912 | - |
913 | -#end - image_autocopy |
914 | -#-------------------------------------- |
915 | - |
916 | -#fname_autocopy |
917 | -#-------------------------------------- |
918 | -my $fname_autocopy_active = Gtk2::RadioButton->new_with_label($image_autocopy_active, $d->get("Automatically copy filename to clipboard") ); |
919 | -$fname_autocopy_box->pack_start( $fname_autocopy_active, FALSE, TRUE, 12 ); |
920 | - |
921 | -if ( defined $settings_xml->{'general'}->{'fname_autocopy'} ) { |
922 | - $fname_autocopy_active->set_active( $settings_xml->{'general'}->{'fname_autocopy'} ); |
923 | -} else { |
924 | - $fname_autocopy_active->set_active(FALSE); |
925 | -} |
926 | - |
927 | -$tooltips->set_tip( $fname_autocopy_active, $d->get("Automatically copy filename to clipboard") ); |
928 | - |
929 | -#end - fname_autocopy |
930 | -#-------------------------------------- |
931 | - |
932 | -#no_autocopy |
933 | -#-------------------------------------- |
934 | -my $no_autocopy_active = Gtk2::RadioButton->new_with_label($image_autocopy_active, $d->get("Do not copy anything to clipboard") ); |
935 | -$no_autocopy_box->pack_start( $no_autocopy_active, FALSE, TRUE, 12 ); |
936 | - |
937 | -if ( defined $settings_xml->{'general'}->{'no_autocopy'} ) { |
938 | - $no_autocopy_active->set_active( $settings_xml->{'general'}->{'no_autocopy'} ); |
939 | -} else { |
940 | - $no_autocopy_active->set_active(FALSE); |
941 | -} |
942 | - |
943 | -$tooltips->set_tip( $no_autocopy_active, $d->get("Do not copy anything to clipboard") ); |
944 | - |
945 | -#end - no_autocopy |
946 | -#-------------------------------------- |
947 | - |
948 | -#delay |
949 | -#-------------------------------------- |
950 | - |
951 | -#delay statusbar |
952 | -my $delay_status_label = Gtk2::Label->new( $d->get("Delay") .":" ); |
953 | -my $delay_status = Gtk2::SpinButton->new_with_range( 0, 99, 1 ); |
954 | -my $delay_status_vlabel = Gtk2::Label->new( $d->nget("second", "seconds", $delay_status->get_value) ); |
955 | -$delay_status->signal_connect( |
956 | - 'value-changed' => \&evt_value_changed, |
957 | - 'delay_status_changed' |
958 | -); |
959 | - |
960 | -#delay settings dialog |
961 | -my $delay_label = Gtk2::Label->new( $d->get("Capture after a delay of") ); |
962 | -my $delay = Gtk2::SpinButton->new_with_range( 0, 99, 1 ); |
963 | -my $delay_vlabel = Gtk2::Label->new( $d->nget("second", "seconds", $delay->get_value) ); |
964 | -$delay->signal_connect( |
965 | - 'value-changed' => \&evt_value_changed, |
966 | - 'delay_changed' |
967 | -); |
968 | - |
969 | -if ( defined $settings_xml->{'general'}->{'delay'} ) { |
970 | - $delay->set_value( $settings_xml->{'general'}->{'delay'} ); |
971 | -} else { |
972 | - $delay->set_value(0); |
973 | -} |
974 | - |
975 | -$tooltips->set_tip( $delay, $d->get("Wait n seconds before taking a screenshot") ); |
976 | -$tooltips->set_tip( $delay_label, $d->get("Wait n seconds before taking a screenshot") ); |
977 | -$tooltips->set_tip( $delay_vlabel, $d->get("Wait n seconds before taking a screenshot") ); |
978 | - |
979 | -$tooltips->set_tip( $delay_status, $d->get("Wait n seconds before taking a screenshot") ); |
980 | -$tooltips->set_tip( $delay_status_label, $d->get("Wait n seconds before taking a screenshot") ); |
981 | -$tooltips->set_tip( $delay_status_vlabel, $d->get("Wait n seconds before taking a screenshot") ); |
982 | - |
983 | -$delay_box->pack_start( $delay_label, FALSE, FALSE, 12 ); |
984 | -$delay_box->pack_start( $delay, FALSE, FALSE, 0 ); |
985 | -$delay_box->pack_start( $delay_vlabel, FALSE, FALSE, 2 ); |
986 | - |
987 | -#end - delay |
988 | -#-------------------------------------- |
989 | - |
990 | -#cursor |
991 | -#-------------------------------------- |
992 | -my $cursor_status_active = Gtk2::CheckButton->new_with_label( $d->get("Include Cursor") ); |
993 | -$tooltips->set_tip( $cursor_status_active, $d->get("Include cursor when taking a screenshot") ); |
994 | -$cursor_status_active->signal_connect( |
995 | - 'toggled' => \&evt_value_changed, |
996 | - 'cursor_status_toggled' |
997 | -); |
998 | - |
999 | -my $cursor_active = Gtk2::CheckButton->new_with_label( $d->get("Include cursor when taking a screenshot") ); |
1000 | -$tooltips->set_tip( $cursor_active, $d->get("Include cursor when taking a screenshot") ); |
1001 | -$cursor_active->signal_connect( |
1002 | - 'toggled' => \&evt_value_changed, |
1003 | - 'cursor_toggled' |
1004 | -); |
1005 | - |
1006 | -$cursor_box->pack_start( $cursor_active, FALSE, TRUE, 12 ); |
1007 | - |
1008 | -if ( defined $settings_xml->{'general'}->{'cursor'} ) { |
1009 | - $cursor_active->set_active( $settings_xml->{'general'}->{'cursor'} ); |
1010 | -} else { |
1011 | - $cursor_active->set_active(TRUE); |
1012 | -} |
1013 | - |
1014 | -#end - cursor |
1015 | -#-------------------------------------- |
1016 | - |
1017 | -#program |
1018 | -#-------------------------------------- |
1019 | -my $model = &fct_get_program_model; |
1020 | -my $progname = Gtk2::ComboBox->new($model); |
1021 | - |
1022 | -#add pixbuf renderer for icon |
1023 | -my $renderer_pix = Gtk2::CellRendererPixbuf->new; |
1024 | -$progname->pack_start( $renderer_pix, FALSE ); |
1025 | -$progname->add_attribute( $renderer_pix, pixbuf => 0 ); |
1026 | - |
1027 | -#add text renderer for app name |
1028 | -my $renderer_text = Gtk2::CellRendererText->new; |
1029 | -$progname->pack_start( $renderer_text, FALSE ); |
1030 | -$progname->add_attribute( $renderer_text, text => 1 ); |
1031 | - |
1032 | -#try to set the saved value |
1033 | -if ( defined $settings_xml->{'general'}->{'prog'} ) { |
1034 | - $model->foreach( \&fct_iter_programs, $settings_xml->{'general'}->{'prog'} ); |
1035 | -} else { |
1036 | - $progname->set_active(0); |
1037 | -} |
1038 | - |
1039 | -#nothing has been set |
1040 | -if ( $progname->get_active == -1 ) { |
1041 | - $progname->set_active(0); |
1042 | -} |
1043 | - |
1044 | -my $progname_active = Gtk2::CheckButton->new; |
1045 | -$progname_active->set_active(TRUE); |
1046 | -$progname_active->signal_connect( |
1047 | - 'toggled' => \&evt_value_changed, |
1048 | - 'progname_toggled' |
1049 | -); |
1050 | -if ( defined $settings_xml->{'general'}->{'prog_active'} ) { |
1051 | - $progname_active->set_active( $settings_xml->{'general'}->{'prog_active'} ); |
1052 | -} else { |
1053 | - $progname_active->set_active(FALSE); |
1054 | -} |
1055 | -my $progname_label = Gtk2::Label->new( $d->get("Open with") . ":" ); |
1056 | -$tooltips->set_tip( $progname, $d->get("Open your screenshot with this program after capturing") ); |
1057 | -$tooltips->set_tip( $progname_active, $d->get("Open your screenshot with this program after capturing") ); |
1058 | -$tooltips->set_tip( $progname_label, $d->get("Open your screenshot with this program after capturing") ); |
1059 | -$progname_box->pack_start( $progname_label, FALSE, TRUE, 12 ); |
1060 | -$progname_box->pack_start( $progname_active, FALSE, TRUE, 0 ); |
1061 | -$progname_box->pack_start( $progname, TRUE, TRUE, 0 ); |
1062 | - |
1063 | -#end - program |
1064 | -#-------------------------------------- |
1065 | - |
1066 | -#im_colors |
1067 | -#-------------------------------------- |
1068 | -my $combobox_im_colors = Gtk2::ComboBox->new_text; |
1069 | -$combobox_im_colors->insert_text( 0, $d->get("16 colors - (4bit) ") ); |
1070 | -$combobox_im_colors->insert_text( 1, $d->get("64 colors - (6bit) ") ); |
1071 | -$combobox_im_colors->insert_text( 2, $d->get("256 colors - (8bit) ") ); |
1072 | -$combobox_im_colors->signal_connect( |
1073 | - 'changed' => \&evt_value_changed, |
1074 | - 'im_colors_changed' |
1075 | -); |
1076 | - |
1077 | -if ( defined $settings_xml->{'general'}->{'im_colors'} ) { |
1078 | - $combobox_im_colors->set_active( $settings_xml->{'general'}->{'im_colors'} ); |
1079 | -} else { |
1080 | - $combobox_im_colors->set_active(2); |
1081 | -} |
1082 | - |
1083 | -my $im_colors_active = Gtk2::CheckButton->new; |
1084 | -$im_colors_active->set_active(TRUE); |
1085 | -$im_colors_active->signal_connect( |
1086 | - 'toggled' => \&evt_value_changed, |
1087 | - 'im_colors_toggled' |
1088 | -); |
1089 | - |
1090 | -if ( defined $settings_xml->{'general'}->{'im_colors_active'} ) { |
1091 | - $im_colors_active->set_active( $settings_xml->{'general'}->{'im_colors_active'} ); |
1092 | -} else { |
1093 | - $im_colors_active->set_active(FALSE); |
1094 | -} |
1095 | - |
1096 | -my $im_colors_label = Gtk2::Label->new( $d->get("Reduce colors") . ":" ); |
1097 | -$tooltips->set_tip( $combobox_im_colors, $d->get("Automatically reduce colors after taking a screenshot") ); |
1098 | -$tooltips->set_tip( $im_colors_active, $d->get("Automatically reduce colors after taking a screenshot") ); |
1099 | -$tooltips->set_tip( $im_colors_label, $d->get("Automatically reduce colors after taking a screenshot") ); |
1100 | -$im_colors_box->pack_start( $im_colors_label, FALSE, TRUE, 12 ); |
1101 | -$im_colors_box->pack_start( $im_colors_active, FALSE, TRUE, 0 ); |
1102 | -$im_colors_box->pack_start( $combobox_im_colors, TRUE, TRUE, 0 ); |
1103 | - |
1104 | -#end - colors |
1105 | -#-------------------------------------- |
1106 | - |
1107 | -#thumbnail |
1108 | -#-------------------------------------- |
1109 | -my $thumbnail_label = Gtk2::Label->new( $d->get("Thumbnail") . ":" ); |
1110 | -my $thumbnail = Gtk2::HScale->new_with_range( 1, 100, 1 ); |
1111 | -$thumbnail->signal_connect( |
1112 | - 'value-changed' => \&evt_value_changed, |
1113 | - 'thumbnail_changed' |
1114 | -); |
1115 | -$thumbnail->set_value_pos('right'); |
1116 | - |
1117 | -if ( defined $settings_xml->{'general'}->{'thumbnail'} ) { |
1118 | - $thumbnail->set_value( $settings_xml->{'general'}->{'thumbnail'} ); |
1119 | -} else { |
1120 | - $thumbnail->set_value(50); |
1121 | -} |
1122 | -my $thumbnail_active = Gtk2::CheckButton->new; |
1123 | -$thumbnail_active->set_active(TRUE); |
1124 | -$thumbnail_active->signal_connect( |
1125 | - 'toggled' => \&evt_value_changed, |
1126 | - 'thumbnail_toggled' |
1127 | -); |
1128 | - |
1129 | -if ( defined $settings_xml->{'general'}->{'thumbnail_active'} ) { |
1130 | - $thumbnail_active->set_active( $settings_xml->{'general'}->{'thumbnail_active'} ); |
1131 | -} else { |
1132 | - $thumbnail_active->set_active(FALSE); |
1133 | -} |
1134 | -$tooltips->set_tip( $thumbnail, |
1135 | - $d->get("Generate thumbnail too.\nselect the percentage of the original size for the thumbnail to be") ); |
1136 | -$tooltips->set_tip( $thumbnail_active, |
1137 | - $d->get("Generate thumbnail too.\nselect the percentage of the original size for the thumbnail to be") ); |
1138 | -$tooltips->set_tip( $thumbnail_label, |
1139 | - $d->get("Generate thumbnail too.\nselect the percentage of the original size for the thumbnail to be") ); |
1140 | -$thumbnail_box->pack_start( $thumbnail_label, FALSE, TRUE, 12 ); |
1141 | -$thumbnail_box->pack_start( $thumbnail_active, FALSE, FALSE, 0 ); |
1142 | -$thumbnail_box->pack_start( $thumbnail, TRUE, TRUE, 0 ); |
1143 | - |
1144 | -#end - thumbnail |
1145 | -#-------------------------------------- |
1146 | - |
1147 | -#bordereffect |
1148 | -#-------------------------------------- |
1149 | -my $bordereffect_active = Gtk2::CheckButton->new; |
1150 | -$bordereffect_active->set_active(TRUE); |
1151 | - |
1152 | -my $bordereffect_label = Gtk2::Label->new( $d->get("Border") . ":" ); |
1153 | -my $bordereffect = Gtk2::SpinButton->new_with_range( 1, 100, 1 ); |
1154 | -my $bordereffect_vlabel = Gtk2::Label->new( $d->get("pixels") ); |
1155 | - |
1156 | -my $bordereffect_clabel = Gtk2::Label->new( $d->get("Color") . ":" ); |
1157 | -my $bordereffect_cbtn = Gtk2::ColorButton->new(); |
1158 | -$bordereffect_cbtn->set_use_alpha(FALSE); |
1159 | -$bordereffect_cbtn->set_title( $d->get("Choose border color") ); |
1160 | - |
1161 | -$tooltips->set_tip( $bordereffect_active, |
1162 | - $d->get("Adds a border effect to the screenshot") ); |
1163 | -$tooltips->set_tip( $bordereffect, |
1164 | - $d->get("Adds a border effect to the screenshot") ); |
1165 | -$tooltips->set_tip( $bordereffect_label, |
1166 | - $d->get("Adds a border effect to the screenshot") ); |
1167 | - |
1168 | -$tooltips->set_tip( $bordereffect_clabel, |
1169 | - $d->get("Choose border color") ); |
1170 | -$tooltips->set_tip( $bordereffect_cbtn, |
1171 | - $d->get("Choose border color") ); |
1172 | - |
1173 | -$bordereffect_box->pack_start( $bordereffect_label, FALSE, TRUE, 12 ); |
1174 | -$bordereffect_box->pack_start( $bordereffect_active, FALSE, FALSE, 0 ); |
1175 | -$bordereffect_box->pack_start( $bordereffect, TRUE, TRUE, 2 ); |
1176 | -$bordereffect_box->pack_start( $bordereffect_vlabel, FALSE, FALSE, 2 ); |
1177 | -$bordereffect_box->pack_start( $bordereffect_clabel, FALSE, FALSE, 12 ); |
1178 | -$bordereffect_box->pack_start( $bordereffect_cbtn, FALSE, FALSE, 0 ); |
1179 | - |
1180 | -$bordereffect_active->signal_connect( |
1181 | - 'toggled' => \&evt_value_changed, |
1182 | - 'bordereffect_toggled' |
1183 | -); |
1184 | - |
1185 | -$bordereffect->signal_connect( |
1186 | - 'value-changed' => \&evt_value_changed, |
1187 | - 'bordereffect_changed' |
1188 | -); |
1189 | - |
1190 | -if ( defined $settings_xml->{'general'}->{'bordereffect_active'} ) { |
1191 | - $bordereffect_active->set_active( $settings_xml->{'general'}->{'bordereffect_active'} ); |
1192 | -} else { |
1193 | - $bordereffect_active->set_active(FALSE); |
1194 | -} |
1195 | - |
1196 | -if ( defined $settings_xml->{'general'}->{'bordereffect'} ) { |
1197 | - $bordereffect->set_value( $settings_xml->{'general'}->{'bordereffect'} ); |
1198 | -} else { |
1199 | - $bordereffect->set_value(2); |
1200 | -} |
1201 | - |
1202 | -if ( defined $settings_xml->{'general'}->{'bordereffect_col'} ){ |
1203 | - $bordereffect_cbtn->set_color(Gtk2::Gdk::Color->parse($settings_xml->{'general'}->{'bordereffect_col'})); |
1204 | -} else { |
1205 | - $bordereffect_cbtn->set_color( Gtk2::Gdk::Color->parse('black') ); |
1206 | -} |
1207 | - |
1208 | -#end - bordereffect |
1209 | -#-------------------------------------- |
1210 | - |
1211 | -#zoom window |
1212 | -#-------------------------------------- |
1213 | -my $zoom_active = Gtk2::CheckButton->new_with_label( $d->get("Enable zoom window") ); |
1214 | - |
1215 | -if ( defined $settings_xml->{'general'}->{'zoom_active'} ) { |
1216 | - $zoom_active->set_active( $settings_xml->{'general'}->{'zoom_active'} ); |
1217 | -} else { |
1218 | - $zoom_active->set_active(TRUE); |
1219 | -} |
1220 | - |
1221 | -$tooltips->set_tip( $zoom_active, $d->get("Enable zoom window") ); |
1222 | - |
1223 | -$zoom_box->pack_start( $zoom_active, FALSE, TRUE, 12 ); |
1224 | - |
1225 | -#end - zoom window |
1226 | -#-------------------------------------- |
1227 | - |
1228 | -#initial size for advanced selection tool |
1229 | -#-------------------------------------- |
1230 | -my $asel_size_label1 = Gtk2::Label->new( $d->get("Start with selection size of") ); |
1231 | -my $asel_size_label2 = Gtk2::Label->new( "x" ); |
1232 | -my $asel_size_label3 = Gtk2::Label->new( $d->get("at") ); |
1233 | -my $asel_size_label4 = Gtk2::Label->new( "," ); |
1234 | -my $asel_size1 = Gtk2::SpinButton->new_with_range( 0, 10000, 1 ); |
1235 | -my $asel_size2 = Gtk2::SpinButton->new_with_range( 0, 10000, 1 ); |
1236 | -my $asel_size3 = Gtk2::SpinButton->new_with_range( 0, 10000, 1 ); |
1237 | -my $asel_size4 = Gtk2::SpinButton->new_with_range( 0, 10000, 1 ); |
1238 | -my $asel_size_vlabel1 = Gtk2::Label->new( $d->get("pixels") ); |
1239 | -my $asel_size_vlabel2 = Gtk2::Label->new( $d->get("pixels") ); |
1240 | - |
1241 | -if ( defined $settings_xml->{'general'}->{'asel_x'} ) { |
1242 | - $asel_size3->set_value($settings_xml->{'general'}->{'asel_x'}); |
1243 | -} else { |
1244 | - $asel_size3->set_value(0); |
1245 | -} |
1246 | -if ( defined $settings_xml->{'general'}->{'asel_y'} ) { |
1247 | - $asel_size4->set_value($settings_xml->{'general'}->{'asel_y'}); |
1248 | -} else { |
1249 | - $asel_size4->set_value(0); |
1250 | -} |
1251 | -if ( defined $settings_xml->{'general'}->{'asel_w'} ) { |
1252 | - $asel_size1->set_value($settings_xml->{'general'}->{'asel_w'}); |
1253 | -} else { |
1254 | - $asel_size1->set_value(0); |
1255 | -} |
1256 | -if ( defined $settings_xml->{'general'}->{'asel_h'} ) { |
1257 | - $asel_size2->set_value($settings_xml->{'general'}->{'asel_h'}); |
1258 | -} else { |
1259 | - $asel_size2->set_value(0); |
1260 | -} |
1261 | - |
1262 | -$tooltips->set_tip( $asel_size_label1, $d->get("Start Advanced Selection Tool with a customized selection size") ); |
1263 | -$tooltips->set_tip( $asel_size_label2, $d->get("Start Advanced Selection Tool with a customized selection size") ); |
1264 | -$tooltips->set_tip( $asel_size_label3, $d->get("Start Advanced Selection Tool with a customized selection size") ); |
1265 | -$tooltips->set_tip( $asel_size_label4, $d->get("Start Advanced Selection Tool with a customized selection size") ); |
1266 | -$tooltips->set_tip( $asel_size1, $d->get("Start Advanced Selection Tool with a customized selection size") ); |
1267 | -$tooltips->set_tip( $asel_size2, $d->get("Start Advanced Selection Tool with a customized selection size") ); |
1268 | -$tooltips->set_tip( $asel_size3, $d->get("Start Advanced Selection Tool with a customized selection size") ); |
1269 | -$tooltips->set_tip( $asel_size4, $d->get("Start Advanced Selection Tool with a customized selection size") ); |
1270 | -$tooltips->set_tip( $asel_size_vlabel1, $d->get("Start Advanced Selection Tool with a customized selection size") ); |
1271 | -$tooltips->set_tip( $asel_size_vlabel2, $d->get("Start Advanced Selection Tool with a customized selection size") ); |
1272 | - |
1273 | -$asel_isize_box->pack_start( $asel_size_label1, FALSE, FALSE, 12 ); |
1274 | -$asel_isize_box->pack_start( $asel_size1, FALSE, FALSE, 0 ); |
1275 | -$asel_isize_box->pack_start( $asel_size_label2, FALSE, FALSE, 0 ); |
1276 | -$asel_isize_box->pack_start( $asel_size2, FALSE, FALSE, 0 ); |
1277 | -$asel_isize_box->pack_start( $asel_size_vlabel1, FALSE, FALSE, 2 ); |
1278 | -$asel_isize_box2->pack_start( $asel_size_label3, FALSE, FALSE, 12 ); |
1279 | -$asel_isize_box2->pack_start( $asel_size3, FALSE, FALSE, 0 ); |
1280 | -$asel_isize_box2->pack_start( $asel_size_label4, FALSE, FALSE, 0 ); |
1281 | -$asel_isize_box2->pack_start( $asel_size4, FALSE, FALSE, 0 ); |
1282 | -$asel_isize_box2->pack_start( $asel_size_vlabel2, FALSE, FALSE, 2 ); |
1283 | - |
1284 | -#end - initial size for advanced selection tool |
1285 | -#-------------------------------------- |
1286 | - |
1287 | -#show help text when using advanced selection tool |
1288 | -#-------------------------------------- |
1289 | -my $as_help_active = Gtk2::CheckButton->new_with_label( $d->get("Show help text") ); |
1290 | - |
1291 | -if ( defined $settings_xml->{'general'}->{'as_help_active'} ) { |
1292 | - $as_help_active->set_active( $settings_xml->{'general'}->{'as_help_active'} ); |
1293 | -} else { |
1294 | - $as_help_active->set_active(TRUE); |
1295 | -} |
1296 | - |
1297 | -$tooltips->set_tip( $as_help_active, $d->get("Enables the help text") ); |
1298 | - |
1299 | -$as_help_box->pack_start( $as_help_active, FALSE, TRUE, 12 ); |
1300 | - |
1301 | -#end - show help text when using advanced selection tool |
1302 | -#-------------------------------------- |
1303 | - |
1304 | -#border |
1305 | -#-------------------------------------- |
1306 | -my $border_active = Gtk2::CheckButton->new_with_label( $d->get("Include window decoration when capturing a window") ); |
1307 | -$tooltips->set_tip( $border_active, $d->get("Include window decoration when capturing a window") ); |
1308 | - |
1309 | -$border_box->pack_start( $border_active, FALSE, TRUE, 12 ); |
1310 | - |
1311 | -if ( defined $settings_xml->{'general'}->{'border'} ) { |
1312 | - $border_active->set_active( $settings_xml->{'general'}->{'border'} ); |
1313 | -} else { |
1314 | - $border_active->set_active(TRUE); |
1315 | -} |
1316 | - |
1317 | -#end - border |
1318 | -#-------------------------------------- |
1319 | - |
1320 | -#visible windows only |
1321 | -#-------------------------------------- |
1322 | -my $visible_windows_active = Gtk2::CheckButton->new_with_label( $d->get("Select only visible windows") ); |
1323 | -$tooltips->set_tip( $visible_windows_active, $d->get("Select only visible windows") ); |
1324 | - |
1325 | -$visible_windows_box->pack_start( $visible_windows_active, FALSE, TRUE, 12 ); |
1326 | - |
1327 | -if ( defined $settings_xml->{'general'}->{'visible_windows'} ) { |
1328 | - $visible_windows_active->set_active( $settings_xml->{'general'}->{'visible_windows'} ); |
1329 | -} else { |
1330 | - $visible_windows_active->set_active(FALSE); |
1331 | -} |
1332 | - |
1333 | -#end - visible windows only |
1334 | -#-------------------------------------- |
1335 | - |
1336 | -#menu capture delay |
1337 | -#-------------------------------------- |
1338 | -#delay settings dialog |
1339 | -my $menu_delay_label = Gtk2::Label->new( $d->get("Pre-Capture Delay") . ":" ); |
1340 | -my $menu_delay = Gtk2::SpinButton->new_with_range( 1, 99, 1 ); |
1341 | -my $menu_delay_vlabel = Gtk2::Label->new( $d->nget("second", "seconds", $delay->get_value) ); |
1342 | -$menu_delay->signal_connect( |
1343 | - 'value-changed' => \&evt_value_changed, |
1344 | - 'menu_delay_changed' |
1345 | -); |
1346 | - |
1347 | -if ( defined $settings_xml->{'general'}->{'menu_delay'} ) { |
1348 | - $menu_delay->set_value( $settings_xml->{'general'}->{'menu_delay'} ); |
1349 | -} else { |
1350 | - $menu_delay->set_value(10); |
1351 | -} |
1352 | - |
1353 | -$tooltips->set_tip( $menu_delay, $d->get("Capture menu/tooltip after a delay of n seconds") ); |
1354 | -$tooltips->set_tip( $menu_delay_label, $d->get("Capture menu/tooltip after a delay of n seconds") ); |
1355 | -$tooltips->set_tip( $menu_delay_vlabel, $d->get("Capture menu/tooltip after a delay of n seconds") ); |
1356 | - |
1357 | -$menu_delay_box->pack_start( $menu_delay_label, FALSE, TRUE, 12 ); |
1358 | -$menu_delay_box->pack_start( $menu_delay, FALSE, TRUE, 0 ); |
1359 | -$menu_delay_box->pack_start( $menu_delay_vlabel, FALSE, TRUE, 2 ); |
1360 | - |
1361 | -#end - menu capture delay |
1362 | -#-------------------------------------- |
1363 | - |
1364 | -#menu/tooltip workaround |
1365 | -#-------------------------------------- |
1366 | -my $menu_waround_active = Gtk2::CheckButton->new_with_label( $d->get("Ignore possibly wrong type hints") ); |
1367 | -$tooltips->set_tip( $menu_waround_active, $d->get("The type hint constants specify hints for the window manager that indicate what type of function the window has. Sometimes these type hints are not correctly set. By enabling this option Shutter will not insist on the requested type hint.") ); |
1368 | - |
1369 | -$menu_waround_box->pack_start( $menu_waround_active, FALSE, TRUE, 12 ); |
1370 | - |
1371 | -if ( defined $settings_xml->{'general'}->{'menu_waround'} ) { |
1372 | - $menu_waround_active->set_active( $settings_xml->{'general'}->{'menu_waround'} ); |
1373 | -} else { |
1374 | - $menu_waround_active->set_active(TRUE); |
1375 | -} |
1376 | - |
1377 | -#end - menu/tooltip workaround |
1378 | -#-------------------------------------- |
1379 | - |
1380 | -#web width |
1381 | -#-------------------------------------- |
1382 | -my $web_width_label = Gtk2::Label->new( $d->get("Virtual browser width") . ":" ); |
1383 | -my $combobox_web_width = Gtk2::ComboBox->new_text; |
1384 | -$combobox_web_width->insert_text( 0, "640" ); |
1385 | -$combobox_web_width->insert_text( 1, "800" ); |
1386 | -$combobox_web_width->insert_text( 2, "1024" ); |
1387 | -$combobox_web_width->insert_text( 3, "1152" ); |
1388 | -$combobox_web_width->insert_text( 4, "1280" ); |
1389 | -$combobox_web_width->insert_text( 5, "1366" ); |
1390 | -$combobox_web_width->insert_text( 6, "1440" ); |
1391 | -$combobox_web_width->insert_text( 7, "1600" ); |
1392 | -$combobox_web_width->insert_text( 8, "1680" ); |
1393 | -$combobox_web_width->insert_text( 9, "1920" ); |
1394 | -$combobox_web_width->insert_text( 10, "2048" ); |
1395 | -my $web_width_vlabel = Gtk2::Label->new( $d->get("pixels") ); |
1396 | - |
1397 | -if ( defined $settings_xml->{'general'}->{'web_width'} ) { |
1398 | - $combobox_web_width->set_active( $settings_xml->{'general'}->{'web_width'} ); |
1399 | -} else { |
1400 | - $combobox_web_width->set_active(2); |
1401 | -} |
1402 | - |
1403 | -$tooltips->set_tip( $web_width_label, $d->get("Virtual browser width when taking a website screenshot") ); |
1404 | -$tooltips->set_tip( $combobox_web_width, $d->get("Virtual browser width when taking a website screenshot") ); |
1405 | -$tooltips->set_tip( $web_width_vlabel, $d->get("Virtual browser width when taking a website screenshot") ); |
1406 | - |
1407 | -$web_width_box->pack_start( $web_width_label, FALSE, TRUE, 12 ); |
1408 | -$web_width_box->pack_start( $combobox_web_width, FALSE, TRUE, 0 ); |
1409 | -$web_width_box->pack_start( $web_width_vlabel, FALSE, TRUE, 2 ); |
1410 | - |
1411 | -#end - web width |
1412 | -#-------------------------------------- |
1413 | - |
1414 | -#imageview |
1415 | -#-------------------------------------- |
1416 | -my $trans_check = Gtk2::RadioButton->new (undef, $d->get("Show as check pattern")); |
1417 | -my $trans_custom = Gtk2::RadioButton->new ($trans_check, $d->get("Show as custom color:")); |
1418 | -my $trans_custom_btn = Gtk2::ColorButton->new(); |
1419 | -$trans_custom_btn->set_use_alpha(FALSE); |
1420 | -$trans_custom_btn->set_title( $d->get("Choose fill color") ); |
1421 | - |
1422 | -my $trans_backg = Gtk2::RadioButton->new ($trans_custom, $d->get("Show as background")); |
1423 | - |
1424 | -$imageview_hbox1->pack_start( $trans_check, FALSE, TRUE, 12 ); |
1425 | -$imageview_hbox2->pack_start( $trans_custom, FALSE, TRUE, 12 ); |
1426 | -$imageview_hbox2->pack_start( $trans_custom_btn, FALSE, TRUE, 0 ); |
1427 | -$imageview_hbox3->pack_start( $trans_backg, FALSE, TRUE, 12 ); |
1428 | - |
1429 | -if ( defined $settings_xml->{'general'}->{'trans_custom_col'} ){ |
1430 | - $trans_custom_btn->set_color(Gtk2::Gdk::Color->parse($settings_xml->{'general'}->{'trans_custom_col'})); |
1431 | -} else { |
1432 | - $trans_custom_btn->set_color( Gtk2::Gdk::Color->parse('black') ); |
1433 | -} |
1434 | - |
1435 | -if ( defined $settings_xml->{'general'}->{'trans_check'} && defined $settings_xml->{'general'}->{'trans_custom'} && defined $settings_xml->{'general'}->{'trans_backg'}) { |
1436 | - $trans_check->set_active( $settings_xml->{'general'}->{'trans_check'} ); |
1437 | - $trans_custom->set_active( $settings_xml->{'general'}->{'trans_custom'} ); |
1438 | - $trans_backg->set_active( $settings_xml->{'general'}->{'trans_backg'} ); |
1439 | -} else { |
1440 | - $trans_check->set_active(TRUE); |
1441 | -} |
1442 | - |
1443 | -$tooltips->set_tip( $trans_check, $d->get("Displays any transparent parts of the image in a check pattern") ); |
1444 | -$tooltips->set_tip( $trans_custom, $d->get("Displays any transparent parts of the image in a solid color that you specify") ); |
1445 | -$tooltips->set_tip( $trans_backg, $d->get("Displays any transparent parts of the image in the background color of the application") ); |
1446 | - |
1447 | -#connect signals after restoring the saved state |
1448 | -$trans_check->signal_connect( |
1449 | - 'toggled' => \&evt_value_changed, |
1450 | - 'transp_toggled' |
1451 | -); |
1452 | - |
1453 | -$trans_custom->signal_connect( |
1454 | - 'toggled' => \&evt_value_changed, |
1455 | - 'transp_toggled' |
1456 | -); |
1457 | - |
1458 | -$trans_custom_btn->signal_connect( |
1459 | - 'color-set' => \&evt_value_changed, |
1460 | - 'transp_toggled' |
1461 | -); |
1462 | - |
1463 | -$trans_backg->signal_connect( |
1464 | - 'toggled' => \&evt_value_changed, |
1465 | - 'transp_toggled' |
1466 | -); |
1467 | - |
1468 | -#end - imageview |
1469 | -#-------------------------------------- |
1470 | - |
1471 | -#keybindings |
1472 | -#-------------------------------------- |
1473 | -my $capture_key = Gtk2::Entry->new; |
1474 | -if ( defined $settings_xml->{'general'}->{'capture_key'} ) { |
1475 | - $capture_key->set_text( $settings_xml->{'general'}->{'capture_key'} ); |
1476 | -} else { |
1477 | - $capture_key->set_text("Print"); |
1478 | -} |
1479 | -my $capture_label = Gtk2::Label->new( $d->get("Capture") . ":" ); |
1480 | -$tooltips->set_tip( |
1481 | - $capture_key, |
1482 | - $d->get( |
1483 | - "Configure global keybinding for capture\nThe format looks like \"<Control>a\" or \"<Shift><Alt>F1\". The parser is fairly liberal and allows lower or upper case, and also abbreviations such as \"<Ctl>\" and \"<Ctrl>\". If you set the option to the special string \"disabled\", then there will be no keybinding for this action. " |
1484 | - ) |
1485 | -); |
1486 | -$tooltips->set_tip( |
1487 | - $capture_label, |
1488 | - $d->get( |
1489 | - "Configure global keybinding for capture\nThe format looks like \"<Control>a\" or \"<Shift><Alt>F1\". The parser is fairly liberal and allows lower or upper case, and also abbreviations such as \"<Ctl>\" and \"<Ctrl>\". If you set the option to the special string \"disabled\", then there will be no keybinding for this action. " |
1490 | - ) |
1491 | -); |
1492 | -my $capture_sel_key = Gtk2::Entry->new; |
1493 | -if ( defined $settings_xml->{'general'}->{'capture_sel_key'} ) { |
1494 | - $capture_sel_key->set_text( $settings_xml->{'general'}->{'capture_sel_key'} ); |
1495 | -} else { |
1496 | - $capture_sel_key->set_text("<Alt>Print"); |
1497 | -} |
1498 | - |
1499 | -my $capture_sel_label = Gtk2::Label->new( $d->get("Capture with selection") . ":" ); |
1500 | -$tooltips->set_tip( |
1501 | - $capture_sel_key, |
1502 | - $d->get( |
1503 | - "Configure global keybinding for capture with selection\nThe format looks like \"<Control>a\" or \"<Shift><Alt>F1\". The parser is fairly liberal and allows lower or upper case, and also abbreviations such as \"<Ctl>\" and \"<Ctrl>\". If you set the option to the special string \"disabled\", then there will be no keybinding for this action. " |
1504 | - ) |
1505 | -); |
1506 | -$tooltips->set_tip( |
1507 | - $capture_sel_label, |
1508 | - $d->get( |
1509 | - "Configure global keybinding for capture with selection\nThe format looks like \"<Control>a\" or \"<Shift><Alt>F1\". The parser is fairly liberal and allows lower or upper case, and also abbreviations such as \"<Ctl>\" and \"<Ctrl>\". If you set the option to the special string \"disabled\", then there will be no keybinding for this action. " |
1510 | - ) |
1511 | -); |
1512 | - |
1513 | -#keybinding_mode |
1514 | -my $combobox_keybinding_mode = Gtk2::ComboBox->new_text; |
1515 | -$combobox_keybinding_mode->insert_text( 0, $d->get("Selection") ); |
1516 | -$combobox_keybinding_mode->insert_text( 1, $d->get("Window") ); |
1517 | -$combobox_keybinding_mode->insert_text( 2, $d->get("Section") ); |
1518 | - |
1519 | -if ( defined $settings_xml->{'general'}->{'keybinding_mode'} ) { |
1520 | - $combobox_keybinding_mode->set_active( $settings_xml->{'general'}->{'keybinding_mode'} ); |
1521 | -} else { |
1522 | - $combobox_keybinding_mode->set_active(1); |
1523 | -} |
1524 | -$tooltips->set_tip( |
1525 | - $combobox_keybinding_mode, |
1526 | - $d->get( |
1527 | - "Configure global keybinding for capture with selection\nThe format looks like \"<Control>a\" or \"<Shift><Alt>F1\". The parser is fairly liberal and allows lower or upper case, and also abbreviations such as \"<Ctl>\" and \"<Ctrl>\". If you set the option to the special string \"disabled\", then there will be no keybinding for this action. " |
1528 | - ) |
1529 | -); |
1530 | - |
1531 | -$keybinding_mode_box->pack_start( Gtk2::Label->new, FALSE, FALSE, 0 ); |
1532 | -$keybinding_mode_box->pack_start( $combobox_keybinding_mode, TRUE, TRUE, 0 ); |
1533 | - |
1534 | -my $keybinding_active = Gtk2::CheckButton->new; |
1535 | -my $keybinding_sel_active = Gtk2::CheckButton->new; |
1536 | - |
1537 | -$key_box->pack_start( $capture_label, FALSE, TRUE, 12 ); |
1538 | -$key_box->pack_start( $keybinding_active, FALSE, FALSE, 0 ); |
1539 | -$key_box->pack_start( $capture_key, TRUE, TRUE, 0 ); |
1540 | -$key_sel_box->pack_start( $capture_sel_label, FALSE, TRUE, 12 ); |
1541 | -$key_sel_box->pack_start( $keybinding_sel_active, FALSE, FALSE, 0 ); |
1542 | -$key_sel_box->pack_start( $capture_sel_key, TRUE, TRUE, 0 ); |
1543 | -$keybinding_active->set_active(TRUE); |
1544 | - |
1545 | -#add signal handlers BEFORE settings are restored |
1546 | -$keybinding_active->signal_connect( |
1547 | - 'toggled' => \&evt_behavior_handle, |
1548 | - 'keybinding_toggled' |
1549 | -); |
1550 | - |
1551 | -$keybinding_sel_active->signal_connect( |
1552 | - 'toggled' => \&evt_behavior_handle, |
1553 | - 'keybinding_sel_toggled' |
1554 | -); |
1555 | - |
1556 | -if ( defined $settings_xml->{'general'}->{'keybinding'} ) { |
1557 | - $keybinding_active->set_active( $settings_xml->{'general'}->{'keybinding'} ); |
1558 | -} else { |
1559 | - $keybinding_active->set_active(FALSE); |
1560 | -} |
1561 | -$keybinding_sel_active->set_active(TRUE); |
1562 | -if ( defined $settings_xml->{'general'}->{'keybinding_sel'} ) { |
1563 | - $keybinding_sel_active->set_active( $settings_xml->{'general'}->{'keybinding_sel'} ); |
1564 | -} else { |
1565 | - $keybinding_sel_active->set_active(FALSE); |
1566 | -} |
1567 | -#end - keybindings |
1568 | -#-------------------------------------- |
1569 | - |
1570 | -#behavior |
1571 | -#-------------------------------------- |
1572 | -my $hide_active = Gtk2::CheckButton->new_with_label( $d->get("Autohide main window when taking a screenshot") ); |
1573 | -my $hide_time_label = Gtk2::Label->new($d->get("Redraw Delay"). ":"); |
1574 | -my $hide_time_vlabel = Gtk2::Label->new; |
1575 | -my $hide_time = Gtk2::SpinButton->new_with_range (0, 1000, 50); |
1576 | -$hide_time->signal_connect( |
1577 | - 'value-changed' => \&evt_value_changed, |
1578 | - 'hide_time_changed' |
1579 | -); |
1580 | - |
1581 | -my $present_after_active = Gtk2::CheckButton->new_with_label( $d->get("Present main window after taking a screenshot") ); |
1582 | -my $close_at_close_active = Gtk2::CheckButton->new_with_label( $d->get("Minimize to tray when closing main window") ); |
1583 | - |
1584 | -my $notify_after_active = Gtk2::CheckButton->new_with_label( $d->get("Display pop-up notification after taking a screenshot") ); |
1585 | -my $notify_timeout_active = Gtk2::CheckButton->new_with_label( $d->get("Display pop-up notification when using a delay") ); |
1586 | -my $notify_ptimeout_active = Gtk2::CheckButton->new_with_label( $d->get("Display pop-up notification when using a pre-capture delay") ); |
1587 | - |
1588 | -my $ns_label = Gtk2::Label->new( $d->get("Notification agent") . ":" ); |
1589 | -my $combobox_ns = Gtk2::ComboBox->new_text; |
1590 | -$combobox_ns->append_text($d->get("Desktop Notifications")); |
1591 | -$combobox_ns->append_text($d->get("Built-In Notifications")); |
1592 | - |
1593 | -$combobox_ns->signal_connect( 'changed' => \&evt_value_changed, 'ns_changed' ); |
1594 | - |
1595 | -my $ask_on_delete_active = Gtk2::CheckButton->new_with_label( $d->get("Ask before moving files to trash") ); |
1596 | -my $delete_on_close_active = Gtk2::CheckButton->new_with_label( $d->get("Move file to trash when closing tab") ); |
1597 | - |
1598 | -$hide_active_hbox->pack_start( $hide_active, FALSE, TRUE, 12 ); |
1599 | -$pafter_active_hbox->pack_start( $present_after_active, FALSE, TRUE, 12 ); |
1600 | -$cac_hbox->pack_start( $close_at_close_active, FALSE, TRUE, 12 ); |
1601 | -$hide_time_hbox->pack_start( $hide_time_label, FALSE, TRUE, 12 ); |
1602 | -$hide_time_hbox->pack_start( $hide_time, FALSE, TRUE, 6 ); |
1603 | -$hide_time_hbox->pack_start( $hide_time_vlabel, FALSE, TRUE, 0 ); |
1604 | -$na_active_hbox->pack_start( $notify_after_active, FALSE, TRUE, 12 ); |
1605 | -$nt_active_hbox->pack_start( $notify_timeout_active, FALSE, TRUE, 12 ); |
1606 | -$npt_active_hbox->pack_start( $notify_ptimeout_active, FALSE, TRUE, 12 ); |
1607 | -$ns_combo_hbox->pack_start( $ns_label, FALSE, TRUE, 12 ); |
1608 | -$ns_combo_hbox->pack_start( $combobox_ns, FALSE, TRUE, 0 ); |
1609 | -$aod_active_hbox->pack_start( $ask_on_delete_active, FALSE, TRUE, 12 ); |
1610 | -$doc_active_hbox->pack_start( $delete_on_close_active, FALSE, TRUE, 12 ); |
1611 | - |
1612 | -if ( defined $settings_xml->{'general'}->{'autohide'} ) { |
1613 | - $hide_active->set_active( $settings_xml->{'general'}->{'autohide'} ); |
1614 | -} else { |
1615 | - $hide_active->set_active(TRUE); |
1616 | -} |
1617 | - |
1618 | -$tooltips->set_tip( $hide_active, $d->get("Autohide main window when taking a screenshot") ); |
1619 | - |
1620 | -if ( defined $settings_xml->{'general'}->{'autohide_time'} ) { |
1621 | - $hide_time->set_value( $settings_xml->{'general'}->{'autohide_time'} ); |
1622 | -} else { |
1623 | - $hide_time->set_value(400); |
1624 | -} |
1625 | - |
1626 | -$tooltips->set_tip( $hide_time_label, $d->get("Configure a short timeout to give the Xserver a chance to redraw areas that were obscured by Shutter's windows before taking a screenshot.") ); |
1627 | -$tooltips->set_tip( $hide_time, $d->get("Configure a short timeout to give the Xserver a chance to redraw areas that were obscured by Shutter's windows before taking a screenshot.") ); |
1628 | -$tooltips->set_tip( $hide_time_vlabel, $d->get("Configure a short timeout to give the Xserver a chance to redraw areas that were obscured by Shutter's windows before taking a screenshot.") ); |
1629 | - |
1630 | -if ( defined $settings_xml->{'general'}->{'present_after'} ) { |
1631 | - $present_after_active->set_active( $settings_xml->{'general'}->{'present_after'} ); |
1632 | -} else { |
1633 | - $present_after_active->set_active(TRUE); |
1634 | -} |
1635 | - |
1636 | -$tooltips->set_tip( $present_after_active, $d->get("Present main window after taking a screenshot") ); |
1637 | - |
1638 | -if ( defined $settings_xml->{'general'}->{'notify_after'} ) { |
1639 | - $notify_after_active->set_active( $settings_xml->{'general'}->{'notify_after'} ); |
1640 | -} else { |
1641 | - $notify_after_active->set_active(TRUE); |
1642 | -} |
1643 | - |
1644 | -$tooltips->set_tip( $notify_after_active, $d->get("Display pop-up notification after taking a screenshot") ); |
1645 | - |
1646 | -if ( defined $settings_xml->{'general'}->{'notify_timeout'} ) { |
1647 | - $notify_timeout_active->set_active( $settings_xml->{'general'}->{'notify_timeout'} ); |
1648 | -} else { |
1649 | - $notify_timeout_active->set_active(TRUE); |
1650 | -} |
1651 | - |
1652 | -$tooltips->set_tip( $notify_timeout_active, $d->get("Display pop-up notification when using a delay") ); |
1653 | - |
1654 | -if ( defined $settings_xml->{'general'}->{'notify_ptimeout'} ) { |
1655 | - $notify_ptimeout_active->set_active( $settings_xml->{'general'}->{'notify_ptimeout'} ); |
1656 | -} else { |
1657 | - $notify_ptimeout_active->set_active(TRUE); |
1658 | -} |
1659 | - |
1660 | -$tooltips->set_tip( $notify_timeout_active, $d->get("Display pop-up notification when using a delay") ); |
1661 | - |
1662 | -if ( defined $settings_xml->{'general'}->{'notify_agent'} ) { |
1663 | - $combobox_ns->set_active( $settings_xml->{'general'}->{'notify_agent'} ); |
1664 | -} else { |
1665 | - $combobox_ns->set_active(TRUE); |
1666 | -} |
1667 | - |
1668 | -$tooltips->set_tip( $ns_label, $d->get("You can either choose the system-wide desktop notifications (e.g. Ubuntu's Notify-OSD) or Shutter's built-in notification system") ); |
1669 | -$tooltips->set_tip( $combobox_ns, $d->get("You can either choose the system-wide desktop notifications (e.g. Ubuntu's Notify-OSD) or Shutter's built-in notification system") ); |
1670 | - |
1671 | -if ( defined $settings_xml->{'general'}->{'close_at_close'} ) { |
1672 | - $close_at_close_active->set_active( $settings_xml->{'general'}->{'close_at_close'} ); |
1673 | -} else { |
1674 | - $close_at_close_active->set_active(TRUE); |
1675 | -} |
1676 | - |
1677 | -$tooltips->set_tip( $close_at_close_active, $d->get("Minimize to tray when closing main window") ); |
1678 | - |
1679 | -if ( defined $settings_xml->{'general'}->{'ask_on_delete'} ) { |
1680 | - $ask_on_delete_active->set_active( $settings_xml->{'general'}->{'ask_on_delete'} ); |
1681 | -} else { |
1682 | - $ask_on_delete_active->set_active(FALSE); |
1683 | -} |
1684 | - |
1685 | -$tooltips->set_tip( $ask_on_delete_active, $d->get("Ask before moving files to trash") ); |
1686 | - |
1687 | -if ( defined $settings_xml->{'general'}->{'delete_on_close'} ) { |
1688 | - $delete_on_close_active->set_active( $settings_xml->{'general'}->{'delete_on_close'} ); |
1689 | -} else { |
1690 | - $delete_on_close_active->set_active(FALSE); |
1691 | -} |
1692 | - |
1693 | -$tooltips->set_tip( $delete_on_close_active, $d->get("Move file to trash when closing tab") ); |
1694 | - |
1695 | -#end - behavior |
1696 | -#-------------------------------------- |
1697 | - |
1698 | -#accounts |
1699 | -#-------------------------------------- |
1700 | -my $accounts_model = undef; |
1701 | -&fct_load_accounts_tree; |
1702 | - |
1703 | -my $accounts_tree = Gtk2::TreeView->new_with_model($accounts_model); |
1704 | -$tooltips->set_tip( |
1705 | - $accounts_tree, |
1706 | - $d->get( |
1707 | - "Entering your Accounts for specific hosting-sites is optional. If entered it will give you the same benefits as the upload on the website. If you leave these fields empty you will be able to upload to the specific hosting-partner as a guest." |
1708 | - ) |
1709 | -); |
1710 | - |
1711 | -$accounts_tree->signal_connect( |
1712 | - 'row-activated' => \&evt_accounts, |
1713 | - 'row_activated' |
1714 | -); |
1715 | - |
1716 | -&fct_set_model_accounts($accounts_tree); |
1717 | - |
1718 | -#ftp uri |
1719 | -my $ftp_entry_label = Gtk2::Label->new( $d->get("URI") . ":" ); |
1720 | - |
1721 | -my $ftp_remote_entry = Gtk2::Entry->new; |
1722 | -if ( defined $settings_xml->{'general'}->{'ftp_uri'} ) { |
1723 | - $ftp_remote_entry->set_text( $settings_xml->{'general'}->{'ftp_uri'} ); |
1724 | -} else { |
1725 | - $ftp_remote_entry->set_text("ftp://host:port/path"); |
1726 | -} |
1727 | - |
1728 | -$tooltips->set_tip( $ftp_entry_label, $d->get("URI\nExample: ftp://host:port/path") ); |
1729 | - |
1730 | -$tooltips->set_tip( $ftp_remote_entry, $d->get("URI\nExample: ftp://host:port/path") ); |
1731 | - |
1732 | -$ftp_hbox1->pack_start( $ftp_entry_label, FALSE, TRUE, 12 ); |
1733 | -$ftp_hbox1->pack_start( $ftp_remote_entry, TRUE, TRUE, 0 ); |
1734 | - |
1735 | -#connection mode |
1736 | -my $ftp_mode_label = Gtk2::Label->new( $d->get("Connection mode") . ":" ); |
1737 | - |
1738 | -my $ftp_mode_combo = Gtk2::ComboBox->new_text; |
1739 | -$ftp_mode_combo->insert_text( 0, $d->get("Active mode") ); |
1740 | -$ftp_mode_combo->insert_text( 1, $d->get("Passive mode") ); |
1741 | -if ( defined $settings_xml->{'general'}->{'ftp_mode'} ) { |
1742 | - $ftp_mode_combo->set_active( $settings_xml->{'general'}->{'ftp_mode'} ); |
1743 | -} else { |
1744 | - $ftp_mode_combo->set_active(0); |
1745 | -} |
1746 | - |
1747 | -$tooltips->set_tip( $ftp_mode_label, $d->get("Connection mode") ); |
1748 | - |
1749 | -$tooltips->set_tip( $ftp_mode_combo, $d->get("Connection mode") ); |
1750 | - |
1751 | -$ftp_hbox2->pack_start( $ftp_mode_label, FALSE, TRUE, 12 ); |
1752 | -$ftp_hbox2->pack_start( $ftp_mode_combo, TRUE, TRUE, 0 ); |
1753 | - |
1754 | -#username |
1755 | -my $ftp_username_label = Gtk2::Label->new( $d->get("Username") . ":" ); |
1756 | - |
1757 | -my $ftp_username_entry = Gtk2::Entry->new; |
1758 | -if ( defined $settings_xml->{'general'}->{'ftp_username'} ) { |
1759 | - $ftp_username_entry->set_text( $settings_xml->{'general'}->{'ftp_username'} ); |
1760 | -} else { |
1761 | - $ftp_username_entry->set_text(""); |
1762 | -} |
1763 | - |
1764 | -$tooltips->set_tip( $ftp_username_label, $d->get("Username") ); |
1765 | - |
1766 | -$tooltips->set_tip( $ftp_username_entry, $d->get("Username") ); |
1767 | - |
1768 | -$ftp_hbox3->pack_start( $ftp_username_label, FALSE, TRUE, 12 ); |
1769 | -$ftp_hbox3->pack_start( $ftp_username_entry, TRUE, TRUE, 0 ); |
1770 | - |
1771 | -#password |
1772 | -my $ftp_password_label = Gtk2::Label->new( $d->get("Password") . ":" ); |
1773 | - |
1774 | -my $ftp_password_entry = Gtk2::Entry->new; |
1775 | -$ftp_password_entry->set_invisible_char("*"); |
1776 | -$ftp_password_entry->set_visibility(FALSE); |
1777 | -if ( defined $settings_xml->{'general'}->{'ftp_password'} ) { |
1778 | - $ftp_password_entry->set_text( $settings_xml->{'general'}->{'ftp_password'} ); |
1779 | -} else { |
1780 | - $ftp_password_entry->set_text(""); |
1781 | -} |
1782 | - |
1783 | -$tooltips->set_tip( $ftp_password_label, $d->get("Password") ); |
1784 | - |
1785 | -$tooltips->set_tip( $ftp_password_entry, $d->get("Password") ); |
1786 | - |
1787 | -$ftp_hbox4->pack_start( $ftp_password_label, FALSE, TRUE, 12 ); |
1788 | -$ftp_hbox4->pack_start( $ftp_password_entry, TRUE, TRUE, 0 ); |
1789 | - |
1790 | -#website url |
1791 | -my $ftp_wurl_label = Gtk2::Label->new( $d->get("Website URL") . ":" ); |
1792 | - |
1793 | -my $ftp_wurl_entry = Gtk2::Entry->new; |
1794 | -if ( defined $settings_xml->{'general'}->{'ftp_wurl'} ) { |
1795 | - $ftp_wurl_entry->set_text( $settings_xml->{'general'}->{'ftp_wurl'} ); |
1796 | -} else { |
1797 | - $ftp_wurl_entry->set_text("http://example.com/screenshots"); |
1798 | -} |
1799 | - |
1800 | -$tooltips->set_tip( $ftp_wurl_label, $d->get("Website URL") ); |
1801 | - |
1802 | -$tooltips->set_tip( $ftp_wurl_entry, $d->get("Website URL") ); |
1803 | - |
1804 | -$ftp_hbox5->pack_start( $ftp_wurl_label, FALSE, TRUE, 12 ); |
1805 | -$ftp_hbox5->pack_start( $ftp_wurl_entry, TRUE, TRUE, 0 ); |
1806 | - |
1807 | -#-------------------------------------- |
1808 | - |
1809 | -#packing |
1810 | -#-------------------------------------- |
1811 | - |
1812 | -#settings main tab |
1813 | -my $label_basic = Gtk2::Label->new; |
1814 | -$label_basic->set_markup( $d->get("Main") ); |
1815 | - |
1816 | -$file_vbox->pack_start( $scale_box, TRUE, TRUE, 3 ); |
1817 | -$file_vbox->pack_start( $filetype_box, FALSE, TRUE, 3 ); |
1818 | -$file_frame->add($file_vbox); |
1819 | - |
1820 | -$save_vbox->pack_start( $save_ask_box, TRUE, TRUE, 3 ); |
1821 | -$save_vbox->pack_start( $save_auto_box, TRUE, TRUE, 3 ); |
1822 | -$save_vbox->pack_start( $filename_box, TRUE, TRUE, 3 ); |
1823 | -$save_vbox->pack_start( $saveDir_box, FALSE, TRUE, 3 ); |
1824 | -$save_vbox->pack_start( $filename_hint, TRUE, TRUE, 3 ); |
1825 | -$save_vbox->pack_start( $fname_autocopy_box, TRUE, TRUE, 3 ); |
1826 | -$save_vbox->pack_start( $image_autocopy_box, TRUE, TRUE, 3 ); |
1827 | -$save_vbox->pack_start( $no_autocopy_box, TRUE, TRUE, 3 ); |
1828 | -$save_frame->add($save_vbox); |
1829 | - |
1830 | -$capture_vbox->pack_start( $cursor_box, FALSE, TRUE, 3 ); |
1831 | -$capture_vbox->pack_start( $delay_box, TRUE, TRUE, 3 ); |
1832 | -$capture_frame->add($capture_vbox); |
1833 | - |
1834 | -#all labels = one size |
1835 | -$scale_label->set_alignment( 0, 0.5 ); |
1836 | -$filetype_label->set_alignment( 0, 0.5 ); |
1837 | -$filename_label->set_alignment( 0, 0.5 ); |
1838 | -$saveDir_label->set_alignment( 0, 0.5 ); |
1839 | - |
1840 | -my $sg_main = Gtk2::SizeGroup->new('horizontal'); |
1841 | -$sg_main->add_widget($scale_label); |
1842 | -$sg_main->add_widget($filetype_label); |
1843 | -$sg_main->add_widget($filename_label); |
1844 | -$sg_main->add_widget($saveDir_label); |
1845 | - |
1846 | -$vbox_basic->pack_start( $file_frame, FALSE, TRUE, 3 ); |
1847 | -$vbox_basic->pack_start( $save_frame, FALSE, TRUE, 3 ); |
1848 | -$vbox_basic->pack_start( $capture_frame, FALSE, TRUE, 3 ); |
1849 | -$vbox_basic->set_border_width(5); |
1850 | - |
1851 | -#settings actions tab |
1852 | -my $label_actions = Gtk2::Label->new; |
1853 | -$label_actions->set_markup( $d->get("Actions") ); |
1854 | - |
1855 | -$actions_vbox->pack_start( $progname_box, FALSE, TRUE, 3 ); |
1856 | -$actions_vbox->pack_start( $im_colors_box, FALSE, TRUE, 3 ); |
1857 | -$actions_vbox->pack_start( $thumbnail_box, FALSE, TRUE, 3 ); |
1858 | -$actions_vbox->pack_start( $bordereffect_box, FALSE, TRUE, 3 ); |
1859 | -$actions_frame->add($actions_vbox); |
1860 | - |
1861 | -#all labels = one size |
1862 | -$progname_label->set_alignment( 0, 0.5 ); |
1863 | -$im_colors_label->set_alignment( 0, 0.5 ); |
1864 | -$thumbnail_label->set_alignment( 0, 0.5 ); |
1865 | -$bordereffect_label->set_alignment( 0, 0.5 ); |
1866 | - |
1867 | -my $sg_actions = Gtk2::SizeGroup->new('horizontal'); |
1868 | -$sg_actions->add_widget($progname_label); |
1869 | -$sg_actions->add_widget($im_colors_label); |
1870 | -$sg_actions->add_widget($thumbnail_label); |
1871 | -$sg_actions->add_widget($bordereffect_label); |
1872 | - |
1873 | -$vbox_actions->pack_start( $actions_frame, FALSE, TRUE, 3 ); |
1874 | -$vbox_actions->set_border_width(5); |
1875 | - |
1876 | -#settings advanced tab |
1877 | -my $label_advanced = Gtk2::Label->new; |
1878 | -$label_advanced->set_markup( $d->get("Advanced") ); |
1879 | - |
1880 | -$sel_capture_vbox->pack_start( $zoom_box, FALSE, TRUE, 3 ); |
1881 | -$sel_capture_frame->add($sel_capture_vbox); |
1882 | - |
1883 | -#align labels (asel) |
1884 | -$asel_size_label3->set_alignment( 1, 0.5 ); |
1885 | - |
1886 | -my $sg_asel = Gtk2::SizeGroup->new('horizontal'); |
1887 | -$sg_asel->add_widget($asel_size_label1); |
1888 | -$sg_asel->add_widget($asel_size_label3); |
1889 | - |
1890 | -my $sg_asel2 = Gtk2::SizeGroup->new('horizontal'); |
1891 | -$sg_asel2->add_widget($asel_size_label2); |
1892 | -$sg_asel2->add_widget($asel_size_label4); |
1893 | - |
1894 | -$asel_capture_vbox->pack_start( $as_help_box, FALSE, TRUE, 3 ); |
1895 | -$asel_capture_vbox->pack_start( $asel_isize_box, FALSE, TRUE, 3 ); |
1896 | -$asel_capture_vbox->pack_start( $asel_isize_box2, FALSE, TRUE, 3 ); |
1897 | -$asel_capture_frame->add($asel_capture_vbox); |
1898 | - |
1899 | -$window_capture_vbox->pack_start( $border_box, FALSE, TRUE, 3 ); |
1900 | -$window_capture_vbox->pack_start( $visible_windows_box, FALSE, TRUE, 3 ); |
1901 | -$window_capture_frame->add($window_capture_vbox); |
1902 | - |
1903 | -$menu_capture_vbox->pack_start( $menu_delay_box, TRUE, TRUE, 3 ); |
1904 | -$menu_capture_vbox->pack_start( $menu_waround_box, TRUE, TRUE, 3 ); |
1905 | -$menu_capture_frame->add($menu_capture_vbox); |
1906 | - |
1907 | -$web_capture_vbox->pack_start( $web_width_box, FALSE, TRUE, 3 ); |
1908 | -$web_capture_frame->add($web_capture_vbox); |
1909 | - |
1910 | -#all labels = one size |
1911 | -$menu_delay_label->set_alignment( 0, 0.5 ); |
1912 | -$web_width_label->set_alignment( 0, 0.5 ); |
1913 | - |
1914 | -my $sg_adv = Gtk2::SizeGroup->new('horizontal'); |
1915 | -$sg_adv->add_widget($menu_delay_label); |
1916 | -$sg_adv->add_widget($web_width_label); |
1917 | - |
1918 | -$vbox_advanced->pack_start( $sel_capture_frame, FALSE, TRUE, 3 ); |
1919 | -$vbox_advanced->pack_start( $asel_capture_frame, FALSE, TRUE, 3 ); |
1920 | -$vbox_advanced->pack_start( $window_capture_frame, FALSE, TRUE, 3 ); |
1921 | -$vbox_advanced->pack_start( $menu_capture_frame, FALSE, TRUE, 3 ); |
1922 | -$vbox_advanced->pack_start( $web_capture_frame, FALSE, TRUE, 3 ); |
1923 | -$vbox_advanced->set_border_width(5); |
1924 | - |
1925 | -#settings image view tab |
1926 | -my $label_imageview = Gtk2::Label->new; |
1927 | -$label_imageview->set_markup( $d->get("Image View") ); |
1928 | - |
1929 | -$transparent_vbox->pack_start( $imageview_hbox1, TRUE, TRUE, 3 ); |
1930 | -$transparent_vbox->pack_start( $imageview_hbox2, TRUE, TRUE, 3 ); |
1931 | -$transparent_vbox->pack_start( $imageview_hbox3, TRUE, TRUE, 3 ); |
1932 | -$transparent_frame->add($transparent_vbox); |
1933 | - |
1934 | -$vbox_imageview->pack_start( $transparent_frame, FALSE, TRUE, 3 ); |
1935 | -$vbox_imageview->set_border_width(5); |
1936 | - |
1937 | -#settings behavior tab |
1938 | -my $label_behavior = Gtk2::Label->new; |
1939 | -$label_behavior->set_markup( $d->get("Behavior") ); |
1940 | - |
1941 | -$window_vbox->pack_start( $hide_active_hbox, TRUE, TRUE, 3 ); |
1942 | -$window_vbox->pack_start( $pafter_active_hbox, TRUE, TRUE, 3 ); |
1943 | -$window_vbox->pack_start( $cac_hbox, TRUE, TRUE, 3 ); |
1944 | -$window_vbox->pack_start( $hide_time_hbox, TRUE, TRUE, 3 ); |
1945 | -$window_frame->add($window_vbox); |
1946 | - |
1947 | -$notify_vbox->pack_start( $na_active_hbox, TRUE, TRUE, 3 ); |
1948 | -$notify_vbox->pack_start( $nt_active_hbox, TRUE, TRUE, 3 ); |
1949 | -$notify_vbox->pack_start( $npt_active_hbox, TRUE, TRUE, 3 ); |
1950 | -$notify_vbox->pack_start( $ns_combo_hbox, TRUE, TRUE, 3 ); |
1951 | -$notify_frame->add($notify_vbox); |
1952 | - |
1953 | -$trash_vbox->pack_start( $aod_active_hbox, TRUE, TRUE, 3 ); |
1954 | -$trash_vbox->pack_start( $doc_active_hbox, TRUE, TRUE, 3 ); |
1955 | -$trash_frame->add($trash_vbox); |
1956 | - |
1957 | -#all labels = one size |
1958 | -$hide_time_label->set_alignment( 0, 0.5 ); |
1959 | - |
1960 | -my $sg_behav = Gtk2::SizeGroup->new('horizontal'); |
1961 | -$sg_behav->add_widget($hide_time_label); |
1962 | - |
1963 | -$vbox_behavior->pack_start( $window_frame, FALSE, TRUE, 3 ); |
1964 | -$vbox_behavior->pack_start( $notify_frame, FALSE, TRUE, 3 ); |
1965 | -$vbox_behavior->pack_start( $trash_frame, FALSE, TRUE, 3 ); |
1966 | -$vbox_behavior->set_border_width(5); |
1967 | - |
1968 | -#settings keyboard tab |
1969 | -my $label_keyboard = Gtk2::Label->new; |
1970 | -$label_keyboard->set_markup( $d->get("Keyboard") ); |
1971 | - |
1972 | -#all labels = one size |
1973 | -$capture_label->set_alignment( 0, 0.5 ); |
1974 | -$capture_sel_label->set_alignment( 0, 0.5 ); |
1975 | - |
1976 | -my $sg_key = Gtk2::SizeGroup->new('horizontal'); |
1977 | -$sg_key->add_widget($capture_label); |
1978 | -$sg_key->add_widget($capture_sel_label); |
1979 | - |
1980 | -$keybinding_vbox->pack_start( $key_box, FALSE, TRUE, 3 ); |
1981 | -$keybinding_vbox->pack_start( $key_sel_box, FALSE, TRUE, 3 ); |
1982 | -$keybinding_vbox->pack_start( $keybinding_mode_box, FALSE, TRUE, 3 ); |
1983 | -$keybinding_frame->add($keybinding_vbox); |
1984 | - |
1985 | -$vbox_keyboard->pack_start( $keybinding_frame, FALSE, TRUE, 3 ); |
1986 | -$vbox_keyboard->set_border_width(5); |
1987 | - |
1988 | -#settings upload tab |
1989 | -my $label_accounts = Gtk2::Label->new; |
1990 | -$label_accounts->set_markup( $d->get("Upload") ); |
1991 | - |
1992 | -my $scrolled_accounts_window = Gtk2::ScrolledWindow->new; |
1993 | -$scrolled_accounts_window->set_policy( 'automatic', 'automatic' ); |
1994 | -$scrolled_accounts_window->set_shadow_type('in'); |
1995 | -$scrolled_accounts_window->add($accounts_tree); |
1996 | -$accounts_hbox->pack_start( $scrolled_accounts_window, TRUE, TRUE, 3 ); |
1997 | -$accounts_vbox->pack_start( $accounts_hbox, TRUE, TRUE, 3 ); |
1998 | -$accounts_frame->add($accounts_vbox); |
1999 | - |
2000 | -$ftp_vbox->pack_start( $ftp_hbox1, FALSE, TRUE, 3 ); |
2001 | -$ftp_vbox->pack_start( $ftp_hbox2, FALSE, TRUE, 3 ); |
2002 | -$ftp_vbox->pack_start( $ftp_hbox3, FALSE, TRUE, 3 ); |
2003 | -$ftp_vbox->pack_start( $ftp_hbox4, FALSE, TRUE, 3 ); |
2004 | -$ftp_vbox->pack_start( $ftp_hbox5, FALSE, TRUE, 3 ); |
2005 | -$ftp_frame->add($ftp_vbox); |
2006 | - |
2007 | -#all labels = one size |
2008 | -$ftp_entry_label->set_alignment( 0, 0.5 ); |
2009 | -$ftp_mode_label->set_alignment( 0, 0.5 ); |
2010 | -$ftp_username_label->set_alignment( 0, 0.5 ); |
2011 | -$ftp_password_label->set_alignment( 0, 0.5 ); |
2012 | -$ftp_wurl_label->set_alignment( 0, 0.5 ); |
2013 | - |
2014 | -my $sg_acc = Gtk2::SizeGroup->new('horizontal'); |
2015 | -$sg_acc->add_widget($ftp_entry_label); |
2016 | -$sg_acc->add_widget($ftp_mode_label); |
2017 | -$sg_acc->add_widget($ftp_username_label); |
2018 | -$sg_acc->add_widget($ftp_password_label); |
2019 | -$sg_acc->add_widget($ftp_wurl_label); |
2020 | - |
2021 | -$vbox_accounts->pack_start( $accounts_frame, TRUE, TRUE, 3 ); |
2022 | -$vbox_accounts->pack_start( $ftp_frame, FALSE, TRUE, 3 ); |
2023 | -$vbox_accounts->set_border_width(5); |
2024 | - |
2025 | -#append pages to notebook |
2026 | -$notebook_settings->append_page( $vbox_basic, $label_basic ); |
2027 | -$notebook_settings->append_page( $vbox_advanced, $label_advanced ); |
2028 | -$notebook_settings->append_page( $vbox_actions, $label_actions ); |
2029 | -$notebook_settings->append_page( $vbox_imageview, $label_imageview ); |
2030 | -$notebook_settings->append_page( $vbox_behavior, $label_behavior ); |
2031 | -$notebook_settings->append_page( $vbox_keyboard, $label_keyboard ); |
2032 | -$notebook_settings->append_page( $vbox_accounts, $label_accounts ); |
2033 | - |
2034 | -#plugins |
2035 | -#not used in a standalone environment |
2036 | -if ( keys(%plugins) > 0 && !$ENV{PAR_TEMP} ) { |
2037 | - |
2038 | - my $effects_tree = Gtk2::TreeView->new_with_model(&fct_load_plugin_tree); |
2039 | - &fct_set_model_plugins($effects_tree); |
2040 | - |
2041 | - my $scrolled_plugins_window = Gtk2::ScrolledWindow->new; |
2042 | - $scrolled_plugins_window->set_policy( 'automatic', 'automatic' ); |
2043 | - $scrolled_plugins_window->set_shadow_type('in'); |
2044 | - $scrolled_plugins_window->add($effects_tree); |
2045 | - |
2046 | - my $label_plugins = Gtk2::Label->new; |
2047 | - $label_plugins->set_markup( $d->get("Plugins") ); |
2048 | - |
2049 | - my $label_treeview = Gtk2::Label->new( $d->get("The following plugins are installed") ); |
2050 | - $label_treeview->set_alignment( 0, 0.5 ); |
2051 | - $effects_vbox->pack_start( $label_treeview, FALSE, TRUE, 1 ); |
2052 | - $effects_vbox->pack_start( $scrolled_plugins_window, TRUE, TRUE, 1 ); |
2053 | - |
2054 | - my $vbox_plugins = Gtk2::VBox->new( FALSE, 12 ); |
2055 | - $vbox_plugins->set_border_width(5); |
2056 | - $vbox_plugins->pack_start( $effects_vbox, TRUE, TRUE, 1 ); |
2057 | - |
2058 | - $notebook_settings->append_page( $vbox_plugins, $label_plugins ); |
2059 | -} |
2060 | - |
2061 | -#profiles |
2062 | -$profiles_box->pack_start( Gtk2::Label->new( $d->get("Profile") . ":" ), FALSE, TRUE, 1 ); |
2063 | -$profiles_box->pack_start( $combobox_settings_profiles, TRUE, TRUE, 6 ); |
2064 | -$profiles_box->pack_start( $button_profile_save, FALSE, TRUE, 1 ); |
2065 | -$profiles_box->pack_start( $button_profile_delete, FALSE, TRUE, 1 ); |
2066 | -$profiles_box->pack_start( $button_profile_apply, FALSE, TRUE, 1 ); |
2067 | - |
2068 | -$vbox_settings->pack_start( $profiles_box, FALSE, TRUE, 1 ); |
2069 | -$vbox_settings->pack_start( $notebook_settings, TRUE, TRUE, 1 ); |
2070 | - |
2071 | -#settings |
2072 | -$hbox_settings->pack_start( $vbox_settings, TRUE, TRUE, 6 ); |
2073 | -$settings_dialog->vbox->add($hbox_settings); |
2074 | -$settings_dialog->set_default_response('apply'); |
2075 | - |
2076 | -#~ #iconview |
2077 | -#~ my $iconview = Gtk2::IconView->new_with_model($session_start_screen{'first_page'}->{'model'}); |
2078 | -#~ $iconview->set_item_width (150); |
2079 | -#~ $iconview->set_pixbuf_column(0); |
2080 | -#~ $iconview->set_text_column(1); |
2081 | -#~ $iconview->set_selection_mode('multiple'); |
2082 | -#~ $iconview->signal_connect( 'selection-changed', \&evt_iconview_sel_changed ); |
2083 | -#~ $iconview->signal_connect( 'item-activated', \&evt_iconview_item_activated ); |
2084 | -#~ |
2085 | -#~ my $scrolled_window_view = Gtk2::ScrolledWindow->new; |
2086 | -#~ $scrolled_window_view->set_policy( 'automatic', 'automatic' ); |
2087 | -#~ $scrolled_window_view->set_shadow_type('in'); |
2088 | -#~ $scrolled_window_view->add($iconview); |
2089 | -#~ |
2090 | -#~ #add an event box to show a context menu on right-click |
2091 | -#~ my $view_event = Gtk2::EventBox->new; |
2092 | -#~ $view_event->add($scrolled_window_view); |
2093 | -#~ $view_event->signal_connect( 'button-press-event', \&evt_iconview_button_press, $iconview ); |
2094 | -#~ |
2095 | -#~ |
2096 | -#~ #pack notebook and iconview into vpaned# |
2097 | -#~ my $vpaned = Gtk2::VPaned->new; |
2098 | -#~ $vpaned->add1($notebook); |
2099 | -#~ $vpaned->add2($view_event); |
2100 | -#~ |
2101 | -#~ #vpaned into vbox |
2102 | -#~ $vbox->pack_start( $vpaned, TRUE, TRUE, 0 ); |
2103 | - |
2104 | -#notebook |
2105 | -$vbox->pack_start( $notebook, TRUE, TRUE, 0 ); |
2106 | - |
2107 | -#bottom toolbar |
2108 | -my $nav_toolbar = $st->create_btoolbar; |
2109 | -$vbox->pack_start( $nav_toolbar, FALSE, TRUE, 0 ); |
2110 | - |
2111 | -#signal handler |
2112 | -$st->{_back}->signal_connect( 'clicked' => sub { |
2113 | - $notebook->prev_page; |
2114 | - } |
2115 | -); |
2116 | -$st->{_forw}->signal_connect( 'clicked' => sub{ |
2117 | - $notebook->next_page; |
2118 | - } |
2119 | -); |
2120 | -$st->{_home}->signal_connect( 'clicked' => sub { |
2121 | - $notebook->set_current_page(0); |
2122 | - } |
2123 | -); |
2124 | - |
2125 | -#pack statusbar |
2126 | -$status->pack_start( $cursor_status_active, FALSE, FALSE, 0 ); |
2127 | -$status->pack_start( Gtk2::HSeparator->new , FALSE, FALSE, 6 ); |
2128 | - |
2129 | -$status->pack_start( $delay_status_label, FALSE, FALSE, 0 ); |
2130 | -$status->pack_start( $delay_status, FALSE, FALSE, 0 ); |
2131 | -$status->pack_start( Gtk2::HSeparator->new , FALSE, FALSE, 6 ); |
2132 | - |
2133 | -$vbox->pack_start( $status, FALSE, FALSE, 0 ); |
2134 | - |
2135 | -#-------------------------------------- |
2136 | - |
2137 | -#restore session |
2138 | -#-------------------------------------- |
2139 | -&fct_load_session; |
2140 | - |
2141 | -#open init files (cmd arguments) |
2142 | -#-------------------------------------- |
2143 | -if(scalar @init_files > 0){ |
2144 | - &fct_open_files(@init_files); |
2145 | -} |
2146 | - |
2147 | -#unblock controls |
2148 | -&fct_control_signals('unblock'); |
2149 | - |
2150 | -#start minimized? |
2151 | -#-------------------------------------- |
2152 | -unless ( $sc->get_min ) { |
2153 | - &fct_control_main_window ('show'); |
2154 | -} else { |
2155 | - &fct_control_main_window ('hide'); |
2156 | -} |
2157 | - |
2158 | -#restore menu/toolbar settings |
2159 | -#-------------------------------------- |
2160 | -if(defined $settings_xml->{'gui'}->{'btoolbar_active'}){ |
2161 | - $sm->{_menuitem_btoolbar}->set_active($settings_xml->{'gui'}->{'btoolbar_active'}); |
2162 | -}else{ |
2163 | - $sm->{_menuitem_btoolbar}->set_active(FALSE); |
2164 | -} |
2165 | - |
2166 | -#-------------------------------------- |
2167 | - |
2168 | -#FIXME |
2169 | -#this is an ugly fix when 'tranparent parts' is set to background |
2170 | -#we don't get the corret background color until the main window is shown |
2171 | -#so we change it now |
2172 | -if($trans_backg->get_active){ |
2173 | - &evt_value_changed (undef, 'transp_toggled'); |
2174 | -} |
2175 | - |
2176 | -#update the first tab on startup |
2177 | -&fct_update_info_and_tray(); |
2178 | - |
2179 | -#load saved settings |
2180 | -#-------------------------------------- |
2181 | -my $folder_to_save = $settings_xml->{'general'}->{'folder'} || $ENV{'HOME'}; |
2182 | -if ( $sc->get_start_with && $folder_to_save ) { |
2183 | - if ( $sc->get_start_with eq "raw" ) { |
2184 | - &evt_take_screenshot( 'global_keybinding', "raw", $folder_to_save ); |
2185 | - } elsif ( $sc->get_start_with eq "select" ) { |
2186 | - &evt_take_screenshot( 'global_keybinding', "select", $folder_to_save ); |
2187 | - } elsif ( $sc->get_start_with eq "window" ) { |
2188 | - &evt_take_screenshot( 'global_keybinding', "window", $folder_to_save ); |
2189 | - } elsif ( $sc->get_start_with eq "section" ) { |
2190 | - &evt_take_screenshot( 'global_keybinding', "section", $folder_to_save ); |
2191 | - } |
2192 | -} |
2193 | - |
2194 | -Gtk2->main; |
2195 | - |
2196 | -0; |
2197 | - |
2198 | -#events |
2199 | -#-------------------------------------- |
2200 | -sub evt_value_changed { |
2201 | - my ( $widget, $data ) = @_; |
2202 | - print "\n$data was emitted by widget $widget\n" |
2203 | - if $sc->get_debug; |
2204 | - |
2205 | - return FALSE unless $data; |
2206 | - |
2207 | - #checkbox for "open with" -> entry active/inactive |
2208 | - if ( $data eq "progname_toggled" ) { |
2209 | - if ( $progname_active->get_active ) { |
2210 | - $progname->set_sensitive(TRUE); |
2211 | - } else { |
2212 | - $progname->set_sensitive(FALSE); |
2213 | - } |
2214 | - } |
2215 | - |
2216 | - #checkbox for "color depth" -> entry active/inactive |
2217 | - if ( $data eq "im_colors_toggled" ) { |
2218 | - if ( $im_colors_active->get_active ) { |
2219 | - $combobox_im_colors->set_sensitive(TRUE); |
2220 | - } else { |
2221 | - $combobox_im_colors->set_sensitive(FALSE); |
2222 | - } |
2223 | - } |
2224 | - |
2225 | - #radiobuttons for "transparent parts" |
2226 | - if ( $data eq "transp_toggled" ) { |
2227 | - |
2228 | - #Sets how the view should draw transparent parts of images with an alpha channel |
2229 | - my $color = $trans_custom_btn->get_color; |
2230 | - my $color_string = sprintf( "%02x%02x%02x", $color->red / 257, $color->green / 257, $color->blue / 257 ); |
2231 | - |
2232 | - my $mode; |
2233 | - if ( $trans_check->get_active ) { |
2234 | - $mode = 'grid'; |
2235 | - }elsif ( $trans_custom->get_active ) { |
2236 | - $mode = 'color'; |
2237 | - }elsif ( $trans_backg->get_active ) { |
2238 | - $mode = 'color'; |
2239 | - my $bg = $window->get_style->bg('normal'); |
2240 | - $color_string = sprintf( "%02x%02x%02x", $bg->red / 257, $bg->green / 257, $bg->blue / 257 ); |
2241 | - } |
2242 | - |
2243 | - #change all imageviews in session |
2244 | - foreach my $key (keys %session_screens){ |
2245 | - if($session_screens{$key}->{'image'}){ |
2246 | - $session_screens{$key}->{'image'}->set_transp($mode, hex $color_string); |
2247 | - } |
2248 | - } |
2249 | - |
2250 | - } |
2251 | - |
2252 | - #"save" toggled |
2253 | - if ( $data eq "save_toggled" ) { |
2254 | - $filename_label->set_sensitive($save_auto_active->get_active); |
2255 | - $filename->set_sensitive($save_auto_active->get_active); |
2256 | - $saveDir_label->set_sensitive($save_auto_active->get_active); |
2257 | - $saveDir_label->set_sensitive($save_auto_active->get_active); |
2258 | - $saveDir_button->set_sensitive($save_auto_active->get_active); |
2259 | - } |
2260 | - |
2261 | - #"cursor_status" toggled |
2262 | - if ( $data eq "cursor_status_toggled" ) { |
2263 | - $cursor_active->set_active($cursor_status_active->get_active); |
2264 | - } |
2265 | - |
2266 | - #"cursor" toggled |
2267 | - if ( $data eq "cursor_toggled" ) { |
2268 | - $cursor_status_active->set_active($cursor_active->get_active); |
2269 | - } |
2270 | - |
2271 | - #value for "delay" -> update text |
2272 | - if ( $data eq "delay_changed" ) { |
2273 | - $delay_status->set_value($delay->get_value); |
2274 | - $delay_vlabel->set_text($d->nget("second", "seconds", $delay->get_value) ); |
2275 | - } |
2276 | - |
2277 | - #value for "delay" -> update text |
2278 | - if ( $data eq "delay_status_changed" ) { |
2279 | - $delay->set_value($delay_status->get_value); |
2280 | - $delay_status_vlabel->set_text($d->nget("second", "seconds", $delay_status->get_value) ); |
2281 | - } |
2282 | - |
2283 | - #value for "menu_delay" -> update text |
2284 | - if ( $data eq "menu_delay_changed" ) { |
2285 | - $menu_delay_vlabel->set_text( $d->nget("second", "seconds", $menu_delay->get_value) ); |
2286 | - } |
2287 | - |
2288 | - #value for "hide_time" -> update text |
2289 | - if ( $data eq "hide_time_changed" ) { |
2290 | - $hide_time_vlabel->set_text( $d->nget("millisecond", "milliseconds", $hide_time->get_value) ); |
2291 | - } |
2292 | - |
2293 | - #checkbox for "thumbnail" -> HScale active/inactive |
2294 | - if ( $data eq "thumbnail_toggled" ) { |
2295 | - if ( $thumbnail_active->get_active ) { |
2296 | - $thumbnail->set_sensitive(TRUE); |
2297 | - } else { |
2298 | - $thumbnail->set_sensitive(FALSE); |
2299 | - } |
2300 | - } |
2301 | - |
2302 | - #quality value changed |
2303 | - if ( $data eq "qvalue_changed" ) { |
2304 | - my $settings = undef; |
2305 | - if(defined $sc->get_globalsettings_object){ |
2306 | - $settings = $sc->get_globalsettings_object; |
2307 | - }else{ |
2308 | - $settings = Shutter::App::GlobalSettings->new(); |
2309 | - $sc->set_globalsettings_object($settings); |
2310 | - } |
2311 | - if ( $combobox_type->get_active_text =~ /jpeg/ ) { |
2312 | - $settings->set_jpg_quality($scale->get_value); |
2313 | - } elsif ( $combobox_type->get_active_text =~ /png/ ) { |
2314 | - $settings->set_png_quality($scale->get_value); |
2315 | - } else { |
2316 | - $settings->clear_quality_settings(); |
2317 | - } |
2318 | - } |
2319 | - |
2320 | - #checkbox for "bordereffect" -> HScale active/inactive |
2321 | - if ( $data eq "bordereffect_toggled" ) { |
2322 | - if ( $bordereffect_active->get_active ) { |
2323 | - $bordereffect->set_sensitive(TRUE); |
2324 | - } else { |
2325 | - $bordereffect->set_sensitive(FALSE); |
2326 | - } |
2327 | - } |
2328 | - |
2329 | - #value for "bordereffect" -> update text |
2330 | - if ( $data eq "bordereffect_changed" ) { |
2331 | - $bordereffect_vlabel->set_text( $d->nget("pixel", "pixels", $bordereffect->get_value) ); |
2332 | - } |
2333 | - |
2334 | - #filetype changed |
2335 | - if ( $data eq "type_changed" ) { |
2336 | - if ( $combobox_type->get_active_text =~ /jpeg/ ) { |
2337 | - $scale->set_sensitive(TRUE); |
2338 | - $scale_label->set_sensitive(TRUE); |
2339 | - $scale->set_range( 1, 100 ); |
2340 | - $scale->set_value(90); |
2341 | - $scale_label->set_text( $d->get("Quality") . ":" ); |
2342 | - } elsif ( $combobox_type->get_active_text =~ /png/ ) { |
2343 | - $scale->set_sensitive(TRUE); |
2344 | - $scale_label->set_sensitive(TRUE); |
2345 | - $scale->set_range( 0, 9 ); |
2346 | - $scale->set_value(9); |
2347 | - $scale_label->set_text( $d->get("Compression") . ":" ); |
2348 | - } else { |
2349 | - $scale->set_sensitive(FALSE); |
2350 | - $scale_label->set_sensitive(FALSE); |
2351 | - } |
2352 | - } |
2353 | - |
2354 | - #notify agent changed |
2355 | - if ( $data eq "ns_changed" ) { |
2356 | - if ( $combobox_ns->get_active == 0 ) { |
2357 | - $sc->set_notification_object(Shutter::App::Notification->new); |
2358 | - } else { |
2359 | - $sc->set_notification_object(Shutter::App::ShutterNotification->new($sc)); |
2360 | - } |
2361 | - } |
2362 | - |
2363 | - return TRUE; |
2364 | -} |
2365 | - |
2366 | -sub evt_take_screenshot { |
2367 | - my ( $widget, $data, $folder_from_config ) = @_; |
2368 | - |
2369 | - #get xid if any window was selected from the submenu... |
2370 | - my $selfcapture = FALSE; |
2371 | - if ( $data =~ /^shutter_window_direct(.*)/ ) { |
2372 | - my $xid = $1; |
2373 | - $selfcapture = TRUE if $xid == $window->window->XID; |
2374 | - } |
2375 | - |
2376 | - #hide mainwindow |
2377 | - if ( $hide_active->get_active && $data ne "web" && $data ne "tray_web" |
2378 | - && !$is_hidden |
2379 | - && !$selfcapture ) { |
2380 | - |
2381 | - &fct_control_main_window('hide'); |
2382 | - |
2383 | - }else{ |
2384 | - |
2385 | - #save current position of main window |
2386 | - ( $window->{x}, $window->{y} ) = $window->get_position; |
2387 | - |
2388 | - } |
2389 | - |
2390 | - #close last message displayed |
2391 | - my $notify = $sc->get_notification_object; |
2392 | - $notify->close; |
2393 | - |
2394 | - #disable signal-handler |
2395 | +my $app = Gtk2::UniqueApp->new( |
2396 | + "org.shutter-project.Shutter", undef, |
2397 | + select => 1, |
2398 | + full => 2, |
2399 | + window => 3, |
2400 | + awindow => 4, |
2401 | + section => 5, |
2402 | + menu => 6, |
2403 | + tooltip => 7, |
2404 | + web => 8, |
2405 | + null => 9, |
2406 | +); |
2407 | + |
2408 | +#load command line arguments |
2409 | +#as well as file to open when starting |
2410 | +my $init_files = $so->get_options; |
2411 | +my @init_files = @$init_files; |
2412 | + |
2413 | +#The application is already running, send it a message |
2414 | +if ($app->is_running) { |
2415 | + |
2416 | + my ($cmdname, $extra) = $sc->get_start_with; |
2417 | + |
2418 | + if(defined $cmdname && defined $extra){ |
2419 | + $app->send_message_by_name( $cmdname, text => $extra ); |
2420 | + }elsif(defined $cmdname){ |
2421 | + $app->send_message_by_name( $cmdname ); |
2422 | + }else{ |
2423 | + $app->send_message_by_name( 'null' ); |
2424 | + } |
2425 | + |
2426 | +#Create the single application instance and wait for other requests |
2427 | +} else { |
2428 | + |
2429 | + #Clipboard |
2430 | + my $clipboard = Gtk2::Clipboard->get( Gtk2::Gdk->SELECTION_CLIPBOARD ); |
2431 | + |
2432 | + #Gettext |
2433 | + my $d = $sc->get_gettext; |
2434 | + |
2435 | + #Page Setup |
2436 | + my $pagesetup = undef; |
2437 | + |
2438 | + #Tooltips |
2439 | + my $tooltips = $sc->get_tooltips; |
2440 | + |
2441 | + #Gtk2::ImageView and Selector for advanced selection tool |
2442 | + my $view = Gtk2::ImageView->new; |
2443 | + my $selector = Gtk2::ImageView::Tool::Selector->new($view); |
2444 | + my $dragger = Gtk2::ImageView::Tool::Dragger->new($view); |
2445 | + $view->set_interpolation ('tiles'); |
2446 | + $view->set_tool($selector); |
2447 | + |
2448 | + #Gtk2::ImageView and Selector for drawing tool |
2449 | + my $view_d; |
2450 | + my $selector_d; |
2451 | + my $dragger_d; |
2452 | + if($goocanvas){ |
2453 | + $view_d = Gtk2::ImageView->new; |
2454 | + $selector_d = Gtk2::ImageView::Tool::Selector->new($view_d); |
2455 | + $dragger_d = Gtk2::ImageView::Tool::Dragger->new($view_d); |
2456 | + $view_d->set_interpolation ('tiles'); |
2457 | + $view_d->set_tool($selector_d); |
2458 | + } |
2459 | + |
2460 | + #UbuntuOne Client |
2461 | + my $u1 = undef; |
2462 | + my $u1_watcher = undef; |
2463 | + |
2464 | + #data structures |
2465 | + #-------------------------------------- |
2466 | + my %plugins; #hash to store plugin infos |
2467 | + my %accounts; #hash to store account infos |
2468 | + my %settings; #hash to store settings |
2469 | + |
2470 | + #HELPERS |
2471 | + my $current_profile_indx = 0; #current profile index |
2472 | + my $is_hidden = TRUE; #main window hidden flag |
2473 | + |
2474 | + # Watch the main window and register a handler that will be called each time |
2475 | + # that there's a new message. |
2476 | + $app->watch_window($window); |
2477 | + my $app_watch_id = $app->signal_connect('message-received' => sub { |
2478 | + my ($app, $cmdno, $message, $time) = @_; |
2479 | + |
2480 | + my $cmdname = undef; |
2481 | + if ($cmdno == 1) { |
2482 | + $cmdname = 'select'; |
2483 | + } elsif ($cmdno == 2) { |
2484 | + $cmdname = 'full'; |
2485 | + } elsif ($cmdno == 3) { |
2486 | + $cmdname = 'window'; |
2487 | + } elsif ($cmdno == 4) { |
2488 | + $cmdname = 'awindow'; |
2489 | + } elsif ($cmdno == 5) { |
2490 | + $cmdname = 'section'; |
2491 | + } elsif ($cmdno == 6) { |
2492 | + $cmdname = 'menu'; |
2493 | + } elsif ($cmdno == 7) { |
2494 | + $cmdname = 'tooltip'; |
2495 | + } elsif ($cmdno == 8) { |
2496 | + $cmdname = 'web'; |
2497 | + } |
2498 | + |
2499 | + if(defined $cmdname){ |
2500 | + if($is_hidden){ |
2501 | + $is_hidden = FALSE; |
2502 | + &fct_control_main_window('hide'); |
2503 | + } |
2504 | + &evt_take_screenshot( 'global_keybinding', $cmdname, undef, $message->get_text ); |
2505 | + } |
2506 | + |
2507 | + return 'ok'; |
2508 | + }); |
2509 | + |
2510 | + #create needed directories etc. |
2511 | + &fct_init_environment; |
2512 | + |
2513 | + #print debug output |
2514 | + &fct_init_debug_output if $sc->get_debug; |
2515 | + |
2516 | + #load accounts for hosting services |
2517 | + &fct_load_accounts; |
2518 | + |
2519 | + #shutdown Shutter carefully when INT or TERM are detected |
2520 | + # => save settings |
2521 | + $SIG{INT} = sub { &evt_delete_window( '', 'quit' ) }; |
2522 | + $SIG{TERM} = sub { &evt_delete_window( '', 'quit' ) }; |
2523 | + |
2524 | + #hash of screenshots during session |
2525 | + my %session_screens; |
2526 | + my %session_start_screen; |
2527 | + |
2528 | + #main window gui |
2529 | + #-------------------------------------- |
2530 | + $window->set_default_icon_name( "shutter" ); |
2531 | + $window->signal_connect( 'delete-event' => \&evt_delete_window ); |
2532 | + $window->set_border_width(0); |
2533 | + $window->set_resizable(TRUE); |
2534 | + $window->set_focus_on_map(TRUE); |
2535 | + $window->set_default_size( -1, 500 ); |
2536 | + |
2537 | + #TRAY ICON AND MENU |
2538 | + my $tray = undef; |
2539 | + my $tray_box = undef; #Gtk2::TrayIcon needs and Gtk2::EventBox |
2540 | + my $tray_menu = &fct_ret_tray_menu; |
2541 | + |
2542 | + #SESSION NOTEBOOK |
2543 | + my $notebook = Gtk2::Notebook->new; |
2544 | + $notebook = &fct_create_session_notebook; |
2545 | + |
2546 | + #STATUSBAR |
2547 | + my $status = Gtk2::Statusbar->new; |
2548 | + $status->set_name('main-window-statusbar'); |
2549 | + |
2550 | + #customize the statusbar style |
2551 | + Gtk2::Rc->parse_string ( |
2552 | + "style 'statusbar-style' { |
2553 | + GtkStatusbar::shadow-type = GTK_SHADOW_NONE |
2554 | + } |
2555 | + widget '*.main-window-statusbar' style 'statusbar-style'" |
2556 | + ); |
2557 | + |
2558 | + my $combobox_status_profiles_label = Gtk2::Label->new( $d->get("Profile") . ":" ); |
2559 | + my $combobox_status_profiles = Gtk2::ComboBox->new_text; |
2560 | + |
2561 | + #arrange settings in notebook |
2562 | + my $notebook_settings = Gtk2::Notebook->new; |
2563 | + my $settings_dialog = Gtk2::Dialog->new( |
2564 | + SHUTTER_NAME . " - " . $d->get("Preferences"), |
2565 | + $window, |
2566 | + [qw/modal destroy-with-parent/], |
2567 | + 'gtk-close' => 'close' |
2568 | + ); |
2569 | + $settings_dialog->set_has_separator(FALSE); |
2570 | + |
2571 | + my $vbox = Gtk2::VBox->new( FALSE, 0 ); |
2572 | + $window->add($vbox); |
2573 | + |
2574 | + #attach signal handlers to subroutines and pack menu |
2575 | + #-------------------------------------- |
2576 | + $vbox->pack_start( $sm->create_menu, FALSE, TRUE, 0 ); |
2577 | + |
2578 | + $sm->{_menuitem_open}->signal_connect( 'activate', \&evt_open, 'menu_open' ); |
2579 | + |
2580 | + #recent manager and menu entry |
2581 | + my $rmanager = Gtk2::RecentManager->new; |
2582 | + $sm->{_menu_recent} = Gtk2::RecentChooserMenu->new_for_manager($rmanager); |
2583 | + $sm->{_menu_recent}->set_sort_type('mru'); |
2584 | + $sm->{_menu_recent}->set_local_only (TRUE); |
2585 | + |
2586 | + my $recentfilter = Gtk2::RecentFilter->new; |
2587 | + $recentfilter->add_pixbuf_formats; |
2588 | + $sm->{_menu_recent}->add_filter ($recentfilter); |
2589 | + $sm->{_menu_recent}->signal_connect('item-activated' => \&evt_open); |
2590 | + $sm->{_menuitem_recent}->set_submenu($sm->{_menu_recent}); |
2591 | + |
2592 | + $sm->{_menuitem_redoshot}->signal_connect( 'activate', \&evt_take_screenshot, 'redoshot' ); |
2593 | + $sm->{_menuitem_selection}->signal_connect( 'activate', \&evt_take_screenshot, 'select' ); |
2594 | + $sm->{_menuitem_full}->signal_connect( 'activate', \&evt_take_screenshot, 'full' ); |
2595 | + $sm->{_menuitem_awindow}->signal_connect( 'activate', \&evt_take_screenshot, 'awindow' ); |
2596 | + $sm->{_menuitem_window}->signal_connect( 'activate', \&evt_take_screenshot, 'window' ); |
2597 | + $sm->{_menuitem_section}->signal_connect( 'activate', \&evt_take_screenshot, 'section' ); |
2598 | + $sm->{_menuitem_menu}->signal_connect( 'activate', \&evt_take_screenshot, 'menu' ); |
2599 | + $sm->{_menuitem_tooltip}->signal_connect( 'activate', \&evt_take_screenshot, 'tooltip' ); |
2600 | + $sm->{_menuitem_iclipboard}->signal_connect( 'activate', \&fct_clipboard_import ); |
2601 | + |
2602 | + #gnome web photo is optional, don't enable it when gnome-web-photo is not in PATH |
2603 | + if($gnome_web_photo){ |
2604 | + $sm->{_menuitem_web}->set_sensitive(TRUE); |
2605 | + $sm->{_menuitem_web}->signal_connect( 'activate', \&evt_take_screenshot, 'web' ); |
2606 | + }else{ |
2607 | + $sm->{_menuitem_web}->set_sensitive(FALSE); |
2608 | + } |
2609 | + |
2610 | + $sm->{_menuitem_save_as}->signal_connect( 'activate', \&evt_save_as, 'menu_save_as' ); |
2611 | + #~ $sm->{_menuitem_export_svg}->signal_connect( 'activate', \&evt_save_as, 'menu_export_svg' ); |
2612 | + $sm->{_menuitem_export_pdf}->signal_connect( 'activate', \&evt_save_as, 'menu_export_pdf' ); |
2613 | + $sm->{_menuitem_print}->signal_connect( 'activate', \&fct_print, 'menu_print' ); |
2614 | + $sm->{_menuitem_pagesetup}->signal_connect( 'activate', \&evt_page_setup, 'menu_pagesetup' ); |
2615 | + $sm->{_menuitem_email}->signal_connect( 'activate', \&fct_email, 'menu_email' ); |
2616 | + $sm->{_menuitem_close}->signal_connect( 'activate', sub { &fct_remove(undef, 'menu_close'); } ); |
2617 | + $sm->{_menuitem_close_all}->signal_connect( 'activate', sub { &fct_select_all; &fct_remove(undef, 'menu_close_all'); } ); |
2618 | + $sm->{_menuitem_quit}->signal_connect( 'activate', \&evt_delete_window, 'quit' ); |
2619 | + |
2620 | + $sm->{_menuitem_undo}->signal_connect( 'activate', \&fct_undo ); |
2621 | + $sm->{_menuitem_redo}->signal_connect( 'activate', \&fct_redo ); |
2622 | + $sm->{_menuitem_copy}->signal_connect( 'activate', \&fct_clipboard, 'image' ); |
2623 | + $sm->{_menuitem_copy_filename}->signal_connect( 'activate', \&fct_clipboard, 'text' ); |
2624 | + $sm->{_menuitem_trash}->signal_connect( 'activate', sub { &fct_delete(undef); } ); |
2625 | + $sm->{_menuitem_select_all}->signal_connect( 'activate', \&fct_select_all ); |
2626 | + $sm->{_menuitem_settings}->signal_connect( 'activate', \&evt_show_settings ); |
2627 | + |
2628 | + $sm->{_menuitem_btoolbar}->signal_connect( 'toggled', \&fct_navigation_toolbar ); |
2629 | + $sm->{_menuitem_zoom_in}->signal_connect( 'activate', \&fct_zoom_in ); |
2630 | + $sm->{_menuitem_zoom_out}->signal_connect( 'activate', \&fct_zoom_out ); |
2631 | + $sm->{_menuitem_zoom_100}->signal_connect( 'activate', \&fct_zoom_100 ); |
2632 | + $sm->{_menuitem_zoom_best}->signal_connect( 'activate', \&fct_zoom_best ); |
2633 | + $sm->{_menuitem_fullscreen}->signal_connect( 'toggled', \&fct_fullscreen ); |
2634 | + |
2635 | + #screenshot menu |
2636 | + $sm->{_menu_actions}->signal_connect( 'focus', sub { $sm->{_menuitem_reopen}->set_submenu(&fct_ret_program_menu); }); |
2637 | + $sm->{_menuitem_rename}->signal_connect( 'activate', \&fct_rename ); |
2638 | + $sm->{_menuitem_upload}->signal_connect( 'activate', \&fct_upload ); |
2639 | + |
2640 | + #nautilus-sendto is optional, don't enable it when not installed |
2641 | + if ( $nautilus_sendto ) { |
2642 | + $sm->{_menuitem_send}->signal_connect( 'activate', \&fct_send ); |
2643 | + }else{ |
2644 | + $sm->{_menuitem_send}->set_sensitive(FALSE); |
2645 | + } |
2646 | + |
2647 | + #goocanvas is optional, don't enable it when not installed |
2648 | + if ( $goocanvas ) { |
2649 | + $sm->{_menuitem_draw}->signal_connect( 'activate', \&fct_draw ); |
2650 | + }else{ |
2651 | + $sm->{_menuitem_draw}->set_sensitive(FALSE); |
2652 | + } |
2653 | + |
2654 | + $sm->{_menuitem_plugin}->signal_connect( 'activate', \&fct_plugin ); |
2655 | + $sm->{_menuitem_redoshot_this}->signal_connect( 'activate', \&evt_take_screenshot, 'redoshot_this' ); |
2656 | + |
2657 | + #large screenshot menu |
2658 | + $sm->{_menu_large_actions}->signal_connect( 'focus', sub { $sm->{_menuitem_large_reopen}->set_submenu(&fct_ret_program_menu); }); |
2659 | + $sm->{_menuitem_large_rename}->signal_connect( 'activate', \&fct_rename ); |
2660 | + $sm->{_menuitem_large_copy}->signal_connect( 'activate', \&fct_clipboard, 'image' ); |
2661 | + $sm->{_menuitem_large_copy_filename}->signal_connect( 'activate', \&fct_clipboard, 'text' ); |
2662 | + $sm->{_menuitem_large_trash}->signal_connect( 'activate', sub { &fct_delete(undef); } ); |
2663 | + $sm->{_menuitem_large_upload}->signal_connect( 'activate', \&fct_upload ); |
2664 | + |
2665 | + #nautilus-sendto is optional, don't enable it when not installed |
2666 | + if ( $nautilus_sendto ) { |
2667 | + $sm->{_menuitem_large_send}->signal_connect( 'activate', \&fct_send ); |
2668 | + }else{ |
2669 | + $sm->{_menuitem_large_send}->set_sensitive(FALSE); |
2670 | + } |
2671 | + |
2672 | + #goocanvas is optional, don't enable it when not installed |
2673 | + if ( $goocanvas ) { |
2674 | + $sm->{_menuitem_large_draw}->signal_connect( 'activate', \&fct_draw ); |
2675 | + }else{ |
2676 | + $sm->{_menuitem_large_draw}->set_sensitive(FALSE); |
2677 | + } |
2678 | + |
2679 | + $sm->{_menuitem_large_plugin}->signal_connect( 'activate', \&fct_plugin ); |
2680 | + $sm->{_menuitem_large_redoshot_this}->signal_connect( 'activate', \&evt_take_screenshot, 'redoshot_this' ); |
2681 | + |
2682 | + #go to menu |
2683 | + $sm->{_menuitem_back}->signal_connect( 'activate' => sub { |
2684 | + $notebook->prev_page; |
2685 | + } |
2686 | + ); |
2687 | + $sm->{_menuitem_forward}->signal_connect( 'activate' => sub{ |
2688 | + $notebook->next_page; |
2689 | + } |
2690 | + ); |
2691 | + $sm->{_menuitem_first}->signal_connect( 'activate' => sub { |
2692 | + $notebook->set_current_page(0); |
2693 | + } |
2694 | + ); |
2695 | + $sm->{_menuitem_last}->signal_connect( 'activate' => sub { |
2696 | + $notebook->set_current_page( $notebook->get_n_pages - 1 ); |
2697 | + } |
2698 | + ); |
2699 | + |
2700 | + #help |
2701 | + $sm->{_menuitem_question}->signal_connect( 'activate', \&evt_question ); |
2702 | + $sm->{_menuitem_translate}->signal_connect( 'activate', \&evt_translate ); |
2703 | + $sm->{_menuitem_bug}->signal_connect( 'activate', \&evt_bug ); |
2704 | + $sm->{_menuitem_about}->signal_connect( 'activate', \&evt_about ); |
2705 | + |
2706 | + #-------------------------------------- |
2707 | + |
2708 | + #trayicon |
2709 | + #-------------------------------------- |
2710 | + #command line param set to disable tray icon? |
2711 | + unless ( $sc->get_disable_systray ) { |
2712 | + |
2713 | + if ( Gtk2->CHECK_VERSION( 2, 10, 0 ) ) { |
2714 | + $tray = Gtk2::StatusIcon->new(); |
2715 | + |
2716 | + $tray->set_from_icon_name("shutter-panel"); |
2717 | + $tray->set_visible(1); |
2718 | + $tray->{'hid'} = $tray->signal_connect( |
2719 | + 'popup-menu' => sub { &evt_show_systray_statusicon; }, |
2720 | + $tray |
2721 | + ); |
2722 | + $tray->{'hid2'} = $tray->signal_connect( |
2723 | + 'activate' => sub { |
2724 | + &evt_activate_systray_statusicon; |
2725 | + $tray; |
2726 | + }, |
2727 | + $tray |
2728 | + ); |
2729 | + } else { |
2730 | + |
2731 | + my $tray_image = Gtk2::Image->new_from_icon_name( 'shutter-panel', 'large-toolbar' ); |
2732 | + |
2733 | + #eventbox with shutter logo |
2734 | + $tray_box = Gtk2::EventBox->new; |
2735 | + $tray_box->add($tray_image); |
2736 | + |
2737 | + #tray icon |
2738 | + require Gtk2::TrayIcon; |
2739 | + $tray = Gtk2::TrayIcon->new('Shutter TrayIcon'); |
2740 | + $tray->add($tray_box); |
2741 | + $tray_box->{'hid'} = $tray_box->signal_connect( 'button_release_event', \&evt_show_systray ); |
2742 | + $tray->show_all; |
2743 | + } |
2744 | + |
2745 | + } |
2746 | + |
2747 | + #-------------------------------------- |
2748 | + |
2749 | + #settings |
2750 | + #-------------------------------------- |
2751 | + my $vbox_settings = Gtk2::VBox->new( FALSE, 12 ); |
2752 | + my $hbox_settings = Gtk2::HBox->new( FALSE, 12 ); |
2753 | + my $vbox_basic = Gtk2::VBox->new( FALSE, 12 ); |
2754 | + my $vbox_advanced = Gtk2::VBox->new( FALSE, 12 ); |
2755 | + my $vbox_actions = Gtk2::VBox->new( FALSE, 12 ); |
2756 | + my $vbox_imageview = Gtk2::VBox->new( FALSE, 12 ); |
2757 | + my $vbox_behavior = Gtk2::VBox->new( FALSE, 12 ); |
2758 | + my $vbox_keyboard = Gtk2::VBox->new( FALSE, 12 ); |
2759 | + my $vbox_accounts = Gtk2::VBox->new( FALSE, 12 ); |
2760 | + |
2761 | + #profiles |
2762 | + my $profiles_box = Gtk2::HBox->new( FALSE, 0 ); |
2763 | + |
2764 | + #main |
2765 | + my $file_vbox = Gtk2::VBox->new( FALSE, 0 ); |
2766 | + my $save_vbox = Gtk2::VBox->new( FALSE, 0 ); |
2767 | + my $capture_vbox = Gtk2::VBox->new( FALSE, 0 ); |
2768 | + |
2769 | + my $scale_box = Gtk2::HBox->new( FALSE, 0 ); |
2770 | + my $filetype_box = Gtk2::HBox->new( FALSE, 0 ); |
2771 | + my $filename_box = Gtk2::HBox->new( FALSE, 0 ); |
2772 | + my $saveDir_box = Gtk2::HBox->new( FALSE, 0 ); |
2773 | + my $save_ask_box = Gtk2::HBox->new( FALSE, 0 ); |
2774 | + my $save_auto_box = Gtk2::HBox->new( FALSE, 0 ); |
2775 | + my $no_autocopy_box = Gtk2::HBox->new( FALSE, 0 ); |
2776 | + my $image_autocopy_box = Gtk2::HBox->new( FALSE, 0 ); |
2777 | + my $fname_autocopy_box = Gtk2::HBox->new( FALSE, 0 ); |
2778 | + my $delay_box = Gtk2::HBox->new( FALSE, 0 ); |
2779 | + my $cursor_box = Gtk2::HBox->new( FALSE, 0 ); |
2780 | + |
2781 | + #keybindings |
2782 | + my $sel_capture_vbox = Gtk2::VBox->new( FALSE, 0 ); |
2783 | + my $asel_capture_vbox = Gtk2::VBox->new( FALSE, 0 ); |
2784 | + |
2785 | + my $keybinding_mode_box = Gtk2::HBox->new( TRUE, 0 ); |
2786 | + my $key_box = Gtk2::HBox->new( FALSE, 0 ); |
2787 | + my $key_sel_box = Gtk2::HBox->new( FALSE, 0 ); |
2788 | + |
2789 | + #actions |
2790 | + my $actions_vbox = Gtk2::VBox->new( FALSE, 0 ); |
2791 | + |
2792 | + my $progname_box = Gtk2::HBox->new( FALSE, 0 ); |
2793 | + my $im_colors_box = Gtk2::HBox->new( FALSE, 0 ); |
2794 | + my $thumbnail_box = Gtk2::HBox->new( FALSE, 0 ); |
2795 | + my $bordereffect_box = Gtk2::HBox->new( FALSE, 0 ); |
2796 | + |
2797 | + #advanced |
2798 | + my $window_capture_vbox = Gtk2::VBox->new( FALSE, 0 ); |
2799 | + my $menu_capture_vbox = Gtk2::VBox->new( FALSE, 0 ); |
2800 | + my $web_capture_vbox = Gtk2::VBox->new( FALSE, 0 ); |
2801 | + |
2802 | + my $zoom_box = Gtk2::HBox->new( FALSE, 0 ); |
2803 | + my $as_help_box = Gtk2::HBox->new( FALSE, 0 ); |
2804 | + my $asel_isize_box = Gtk2::HBox->new( FALSE, 0 ); |
2805 | + my $asel_isize_box2 = Gtk2::HBox->new( FALSE, 0 ); |
2806 | + my $border_box = Gtk2::HBox->new( FALSE, 0 ); |
2807 | + my $visible_windows_box = Gtk2::HBox->new( FALSE, 0 ); |
2808 | + my $menu_delay_box = Gtk2::HBox->new( FALSE, 0 ); |
2809 | + my $menu_waround_box = Gtk2::HBox->new( FALSE, 0 ); |
2810 | + my $web_width_box = Gtk2::HBox->new( FALSE, 0 ); |
2811 | + |
2812 | + #imageview |
2813 | + my $transparent_vbox = Gtk2::VBox->new( FALSE, 0 ); |
2814 | + my $imageview_hbox1 = Gtk2::HBox->new( FALSE, 0 ); |
2815 | + my $imageview_hbox2 = Gtk2::HBox->new( FALSE, 0 ); |
2816 | + my $imageview_hbox3 = Gtk2::HBox->new( FALSE, 0 ); |
2817 | + |
2818 | + #behavior |
2819 | + my $window_vbox = Gtk2::VBox->new( FALSE, 0 ); |
2820 | + my $notify_vbox = Gtk2::VBox->new( FALSE, 0 ); |
2821 | + my $trash_vbox = Gtk2::VBox->new( FALSE, 0 ); |
2822 | + my $keybinding_vbox = Gtk2::VBox->new( FALSE, 0 ); |
2823 | + |
2824 | + my $hide_active_hbox = Gtk2::HBox->new( FALSE, 0 ); |
2825 | + my $pafter_active_hbox = Gtk2::HBox->new( FALSE, 0 ); |
2826 | + my $cac_hbox = Gtk2::HBox->new( FALSE, 0 ); |
2827 | + my $hide_time_hbox = Gtk2::HBox->new( FALSE, 0 ); |
2828 | + my $na_active_hbox = Gtk2::HBox->new( FALSE, 0 ); |
2829 | + my $nt_active_hbox = Gtk2::HBox->new( FALSE, 0 ); |
2830 | + my $npt_active_hbox = Gtk2::HBox->new( FALSE, 0 ); |
2831 | + my $ns_combo_hbox = Gtk2::HBox->new( FALSE, 0 ); |
2832 | + my $aod_active_hbox = Gtk2::HBox->new( FALSE, 0 ); |
2833 | + my $doc_active_hbox = Gtk2::HBox->new( FALSE, 0 ); |
2834 | + |
2835 | + #upload |
2836 | + my $accounts_vbox = Gtk2::VBox->new( FALSE, 0 ); |
2837 | + my $ftp_vbox = Gtk2::VBox->new( FALSE, 0 ); |
2838 | + |
2839 | + my $accounts_hbox = Gtk2::HBox->new( FALSE, 0 ); |
2840 | + my $ftp_hbox1 = Gtk2::HBox->new( FALSE, 0 ); |
2841 | + my $ftp_hbox2 = Gtk2::HBox->new( FALSE, 0 ); |
2842 | + my $ftp_hbox3 = Gtk2::HBox->new( FALSE, 0 ); |
2843 | + my $ftp_hbox4 = Gtk2::HBox->new( FALSE, 0 ); |
2844 | + my $ftp_hbox5 = Gtk2::HBox->new( FALSE, 0 ); |
2845 | + |
2846 | + #plugins |
2847 | + my $effects_vbox = Gtk2::VBox->new( FALSE, 0 ); |
2848 | + |
2849 | + #load settings |
2850 | + #-------------------------------------- |
2851 | + my $settings_xml = &fct_load_settings( "start" ); |
2852 | + |
2853 | + #load requested profile (argv) |
2854 | + if(defined $sc->get_profile_to_start_with){ |
2855 | + $settings_xml = &fct_load_settings("start", $sc->get_profile_to_start_with ); |
2856 | + }else{ |
2857 | + #or load last used profile |
2858 | + if ( defined $settings_xml->{'general'}->{'last_profile'} ) { |
2859 | + if ( $settings_xml->{'general'}->{'last_profile'} != -1 ) { |
2860 | + $settings_xml = &fct_load_settings("start", $settings_xml->{'general'}->{'last_profile_name'} ); |
2861 | + } |
2862 | + } |
2863 | + } |
2864 | + |
2865 | + #-------------------------------------- |
2866 | + |
2867 | + #block signals while checking plugins / opening files |
2868 | &fct_control_signals('block'); |
2869 | |
2870 | - if ( $data eq "web" || $data eq "tray_web" ){ |
2871 | - &fct_take_screenshot($widget, $data, $folder_from_config); |
2872 | - #unblock signal handler |
2873 | - &fct_control_signals('unblock'); |
2874 | - }elsif ( $data eq "menu" || |
2875 | - $data eq "tray_menu" || |
2876 | - $data eq "tooltip" || |
2877 | - $data eq "tray_tooltip" ){ |
2878 | - |
2879 | - my $scd_text; |
2880 | - if ( $data eq "menu" || $data eq "tray_menu" ) { |
2881 | - $scd_text = $d->get("Please activate the menu you want to capture"); |
2882 | - }elsif( $data eq "tooltip" || $data eq "tray_tooltip" ) { |
2883 | - $scd_text = $d->get("Please activate the tooltip you want to capture"); |
2884 | - } |
2885 | - |
2886 | - #show notification messages displaying the countdown |
2887 | - if($notify_ptimeout_active->get_active){ |
2888 | - my $notify = $sc->get_notification_object; |
2889 | - my $ttw = $menu_delay->get_value; |
2890 | - |
2891 | - #first notification immediately |
2892 | - $notify->show( sprintf($d->nget("Screenshot will be taken in %s second", "Screenshot will be taken in %s seconds", $ttw) , $ttw), |
2893 | - $scd_text |
2894 | - ); |
2895 | - $ttw--; |
2896 | - |
2897 | - #delay is only 1 second |
2898 | - #do not show any further messages |
2899 | - if($ttw >= 1){ |
2900 | - #then controlled via timeout |
2901 | - Glib::Timeout->add (1000, sub{ |
2902 | - $notify->show( sprintf($d->nget("Screenshot will be taken in %s second", "Screenshot will be taken in %s seconds", $ttw) , $ttw), |
2903 | - $scd_text |
2904 | - ); |
2905 | - $ttw--; |
2906 | - if($ttw == 0){ |
2907 | - |
2908 | - #close last message with a short delay (less than a second) |
2909 | - Glib::Timeout->add (500, sub{ |
2910 | - $notify->close; |
2911 | - return FALSE; |
2912 | - }); |
2913 | - |
2914 | - return FALSE; |
2915 | - |
2916 | - }else{ |
2917 | - |
2918 | - return TRUE; |
2919 | - |
2920 | - } |
2921 | - }); |
2922 | + #check plugins |
2923 | + #-------------------------------------- |
2924 | + #not used in a standalone environment |
2925 | + unless($ENV{PAR_TEMP}){ |
2926 | + &fct_check_installed_plugins; |
2927 | + } |
2928 | + |
2929 | + $vbox->pack_start( $st->create_toolbar, FALSE, TRUE, 0 ); |
2930 | + |
2931 | + $st->{_redoshot}->signal_connect( 'clicked' => \&evt_take_screenshot, 'redoshot' ); |
2932 | + $st->{_redoshot}->set_sensitive(FALSE); |
2933 | + |
2934 | + my ( $tool_advanced, $tool_simple ) = undef; |
2935 | + $st->{_select}->set_menu(&fct_ret_sel_menu); |
2936 | + $st->{_select}->signal_connect( 'clicked' => \&evt_take_screenshot, 'select' ); |
2937 | + |
2938 | + my $current_monitor_active = undef; |
2939 | + $st->{_full}->signal_connect( 'clicked' => \&evt_take_screenshot, 'full' ); |
2940 | + |
2941 | + #init menus |
2942 | + $st->{_full}->set_menu( &fct_ret_workspace_menu(TRUE) ); |
2943 | + $st->{_awindow}->set_menu( &fct_ret_window_menu ); |
2944 | + |
2945 | + #and attach signal handlers |
2946 | + $st->{_full}->signal_connect( 'show-menu' => sub { $st->{_full}->set_menu( &fct_ret_workspace_menu(FALSE) ) } ); |
2947 | + $st->{_awindow}->signal_connect( 'clicked' => \&evt_take_screenshot, 'awindow' ); |
2948 | + |
2949 | + $st->{_awindow}->signal_connect( 'show-menu' => sub { $st->{_awindow}->set_menu( &fct_ret_window_menu ) } ); |
2950 | + $st->{_section}->signal_connect( 'clicked' => \&evt_take_screenshot, 'section' ); |
2951 | + $st->{_menu}->signal_connect( 'clicked' => \&evt_take_screenshot, 'menu' ); |
2952 | + $st->{_tooltip}->signal_connect( 'clicked' => \&evt_take_screenshot, 'tooltip' ); |
2953 | + |
2954 | + #gnome-web-photo is optional, don't enable it when gnome-web-photo is not in PATH |
2955 | + if ( $gnome_web_photo ) { |
2956 | + $st->{_web}->set_sensitive(TRUE); |
2957 | + $st->{_web}->signal_connect( 'clicked' => \&evt_take_screenshot, 'web' ); |
2958 | + $st->{_web}->set_menu(&fct_ret_web_menu); |
2959 | + $st->{_web}->signal_connect( 'show-menu' => \&fct_ret_web_menu ); |
2960 | + } else { |
2961 | + $tooltips->set_tip( $st->{_web}, $d->get("gnome-web-photo needs to be installed for this feature") ); |
2962 | + $st->{_web}->set_arrow_tooltip( $tooltips, $d->get("gnome-web-photo needs to be installed for this feature"), '' ); |
2963 | + $st->{_web}->set_sensitive(FALSE); |
2964 | + } |
2965 | + |
2966 | + #goocanvas is optional, don't enable it when not installed |
2967 | + if ( $goocanvas ) { |
2968 | + $st->{_edit}->signal_connect( 'clicked' => \&fct_draw ); |
2969 | + }else{ |
2970 | + $tooltips->set_tip( $st->{_edit}, $d->get("Goo::Canvas/libgoocanvas needs to be installed for this feature") ); |
2971 | + } |
2972 | + $st->{_edit}->set_sensitive(FALSE); |
2973 | + |
2974 | + $st->{_upload}->signal_connect( 'clicked' => \&fct_upload ); |
2975 | + $st->{_upload}->set_sensitive(FALSE); |
2976 | + |
2977 | + |
2978 | + #-------------------------------------- |
2979 | + |
2980 | + #handle profiles |
2981 | + #-------------------------------------- |
2982 | + my $combobox_settings_profiles = Gtk2::ComboBox->new_text; |
2983 | + my @current_profiles; |
2984 | + my $current_index = 0; |
2985 | + foreach ( sort glob("$ENV{'HOME'}/.shutter/profiles/*.xml") ) { |
2986 | + utf8::decode $_; |
2987 | + next if $_ =~ /\_accounts.xml/; #accounts file - we are looking for "real" profiles |
2988 | + $_ =~ /.*\/(.*)\.xml/; #get profiles name |
2989 | + my $last_profile_name = $1; |
2990 | + $combobox_settings_profiles->append_text($last_profile_name); |
2991 | + |
2992 | + #set active profile |
2993 | + if ( exists $settings_xml->{'general'}->{'last_profile_name'} ) { |
2994 | + if ( $settings_xml->{'general'}->{'last_profile_name'} eq $last_profile_name ) { |
2995 | + $combobox_settings_profiles->set_active($current_index); |
2996 | + $current_profile_indx = $current_index; |
2997 | + } |
2998 | + } |
2999 | + |
3000 | + push( @current_profiles, $last_profile_name ); |
3001 | + $current_index++; |
3002 | + } |
3003 | + $tooltips->set_tip( $combobox_settings_profiles, $d->get("Choose a profile") ); |
3004 | + |
3005 | + #set 0 if nothing is selected yet |
3006 | + if ( !$combobox_settings_profiles->get_active_text ) { |
3007 | + $combobox_settings_profiles->set_active(0); |
3008 | + $current_profile_indx = 0; |
3009 | + } |
3010 | + |
3011 | + #populate quick selector as well |
3012 | + &fct_update_profile_selectors($combobox_settings_profiles, \@current_profiles); |
3013 | + |
3014 | + my $button_profile_save = Gtk2::Button->new; |
3015 | + $button_profile_save->signal_connect( |
3016 | + 'clicked' => sub { |
3017 | + my $widget = shift; |
3018 | + &evt_save_profile( $widget, $combobox_settings_profiles, \@current_profiles ); |
3019 | + } |
3020 | + ); |
3021 | + $button_profile_save->set_image( Gtk2::Image->new_from_stock( 'gtk-save', 'button' ) ); |
3022 | + $tooltips->set_tip( $button_profile_save, $d->get("Save configuration as profile") ); |
3023 | + |
3024 | + my $button_profile_delete = Gtk2::Button->new; |
3025 | + $button_profile_delete->signal_connect( |
3026 | + 'clicked' => sub { |
3027 | + my $widget = shift; |
3028 | + &evt_delete_profile( $widget, $combobox_settings_profiles, \@current_profiles ); |
3029 | + } |
3030 | + ); |
3031 | + $button_profile_delete->set_image( Gtk2::Image->new_from_stock( 'gtk-delete', 'button' ) ); |
3032 | + $tooltips->set_tip( $button_profile_delete, $d->get("Delete profile") ); |
3033 | + my $button_profile_apply = Gtk2::Button->new; |
3034 | + $button_profile_apply->signal_connect( |
3035 | + 'clicked' => sub { |
3036 | + my $widget = shift; |
3037 | + &evt_apply_profile( $widget, $combobox_settings_profiles, \@current_profiles ); |
3038 | + } |
3039 | + ); |
3040 | + $button_profile_apply->set_image( Gtk2::Image->new_from_stock( 'gtk-apply', 'button' ) ); |
3041 | + $tooltips->set_tip( $button_profile_apply, $d->get("Load the selected profile's configuration") ); |
3042 | + |
3043 | + #-------------------------------------- |
3044 | + |
3045 | + |
3046 | + #frames and label for settings dialog |
3047 | + #-------------------------------------- |
3048 | + my $file_frame_label = Gtk2::Label->new; |
3049 | + $file_frame_label->set_markup( "<b>" . $d->get("Image format") . "</b>" ); |
3050 | + |
3051 | + my $file_frame = Gtk2::Frame->new(); |
3052 | + $file_frame->set_label_widget($file_frame_label); |
3053 | + $file_frame->set_shadow_type('none'); |
3054 | + |
3055 | + my $save_frame_label = Gtk2::Label->new; |
3056 | + $save_frame_label->set_markup( "<b>" . $d->get("Save") . "</b>" ); |
3057 | + |
3058 | + my $save_frame = Gtk2::Frame->new(); |
3059 | + $save_frame->set_label_widget($save_frame_label); |
3060 | + $save_frame->set_shadow_type('none'); |
3061 | + |
3062 | + my $window_frame_label = Gtk2::Label->new; |
3063 | + $window_frame_label->set_markup( "<b>" . $d->get("Window Preferences") . "</b>" ); |
3064 | + |
3065 | + my $window_frame = Gtk2::Frame->new(); |
3066 | + $window_frame->set_label_widget($window_frame_label); |
3067 | + $window_frame->set_shadow_type('none'); |
3068 | + |
3069 | + my $notify_frame_label = Gtk2::Label->new; |
3070 | + $notify_frame_label->set_markup( "<b>" . $d->get("Notifications") . "</b>" ); |
3071 | + |
3072 | + my $notify_frame = Gtk2::Frame->new(); |
3073 | + $notify_frame->set_label_widget($notify_frame_label); |
3074 | + $notify_frame->set_shadow_type('none'); |
3075 | + |
3076 | + my $trash_frame_label = Gtk2::Label->new; |
3077 | + $trash_frame_label->set_markup( "<b>" . $d->get("Trash") . "</b>" ); |
3078 | + |
3079 | + my $trash_frame = Gtk2::Frame->new(); |
3080 | + $trash_frame->set_label_widget($trash_frame_label); |
3081 | + $trash_frame->set_shadow_type('none'); |
3082 | + |
3083 | + my $keybinding_frame_label = Gtk2::Label->new; |
3084 | + $keybinding_frame_label->set_markup( "<b>" . $d->get("Gnome-Keybinding") . "</b>" ); |
3085 | + |
3086 | + my $keybinding_frame = Gtk2::Frame->new(); |
3087 | + $keybinding_frame->set_label_widget($keybinding_frame_label); |
3088 | + $keybinding_frame->set_shadow_type('none'); |
3089 | + |
3090 | + my $actions_frame_label = Gtk2::Label->new; |
3091 | + $actions_frame_label->set_markup( "<b>" . $d->get("Actions") . "</b>" ); |
3092 | + |
3093 | + my $actions_frame = Gtk2::Frame->new(); |
3094 | + $actions_frame->set_label_widget($actions_frame_label); |
3095 | + $actions_frame->set_shadow_type('none'); |
3096 | + |
3097 | + my $capture_frame_label = Gtk2::Label->new; |
3098 | + $capture_frame_label->set_markup( "<b>" . $d->get("Capture") . "</b>" ); |
3099 | + |
3100 | + my $capture_frame = Gtk2::Frame->new(); |
3101 | + $capture_frame->set_label_widget($capture_frame_label); |
3102 | + $capture_frame->set_shadow_type('none'); |
3103 | + |
3104 | + my $sel_capture_frame_label = Gtk2::Label->new; |
3105 | + $sel_capture_frame_label->set_markup( "<b>" . $d->get("Selection Capture") . "</b>" ); |
3106 | + |
3107 | + my $sel_capture_frame = Gtk2::Frame->new(); |
3108 | + $sel_capture_frame->set_label_widget($sel_capture_frame_label); |
3109 | + $sel_capture_frame->set_shadow_type('none'); |
3110 | + |
3111 | + my $asel_capture_frame_label = Gtk2::Label->new; |
3112 | + $asel_capture_frame_label->set_markup( "<b>" . $d->get("Advanced Selection Capture") . "</b>" ); |
3113 | + |
3114 | + my $asel_capture_frame = Gtk2::Frame->new(); |
3115 | + $asel_capture_frame->set_label_widget($asel_capture_frame_label); |
3116 | + $asel_capture_frame->set_shadow_type('none'); |
3117 | + |
3118 | + my $window_capture_frame_label = Gtk2::Label->new; |
3119 | + $window_capture_frame_label->set_markup( "<b>" . $d->get("Window Capture") . "</b>" ); |
3120 | + |
3121 | + my $window_capture_frame = Gtk2::Frame->new(); |
3122 | + $window_capture_frame->set_label_widget($window_capture_frame_label); |
3123 | + $window_capture_frame->set_shadow_type('none'); |
3124 | + |
3125 | + my $menu_capture_frame_label = Gtk2::Label->new; |
3126 | + $menu_capture_frame_label->set_markup( "<b>" . $d->get("Menu/Tooltip Capture") . "</b>" ); |
3127 | + |
3128 | + my $menu_capture_frame = Gtk2::Frame->new(); |
3129 | + $menu_capture_frame->set_label_widget($menu_capture_frame_label); |
3130 | + $menu_capture_frame->set_shadow_type('none'); |
3131 | + |
3132 | + my $web_capture_frame_label = Gtk2::Label->new; |
3133 | + $web_capture_frame_label->set_markup( "<b>" . $d->get("Website Capture") . "</b>" ); |
3134 | + |
3135 | + my $web_capture_frame = Gtk2::Frame->new(); |
3136 | + $web_capture_frame->set_label_widget($web_capture_frame_label); |
3137 | + $web_capture_frame->set_shadow_type('none'); |
3138 | + |
3139 | + my $accounts_frame_label = Gtk2::Label->new; |
3140 | + $accounts_frame_label->set_markup( "<b>" . $d->get("Accounts") . "</b>" ); |
3141 | + |
3142 | + my $accounts_frame = Gtk2::Frame->new(); |
3143 | + $accounts_frame->set_label_widget($accounts_frame_label); |
3144 | + $accounts_frame->set_shadow_type('none'); |
3145 | + |
3146 | + my $ftp_frame_label = Gtk2::Label->new; |
3147 | + $ftp_frame_label->set_markup( "<b>" . $d->get("File Transfer Protocol (FTP)") . "</b>" ); |
3148 | + |
3149 | + my $ftp_frame = Gtk2::Frame->new(); |
3150 | + $ftp_frame->set_label_widget($ftp_frame_label); |
3151 | + $ftp_frame->set_shadow_type('none'); |
3152 | + |
3153 | + my $transparent_frame_label = Gtk2::Label->new; |
3154 | + $transparent_frame_label->set_markup( "<b>" . $d->get("Transparent Parts") . "</b>" ); |
3155 | + |
3156 | + my $transparent_frame = Gtk2::Frame->new(); |
3157 | + $transparent_frame->set_label_widget($transparent_frame_label); |
3158 | + $transparent_frame->set_shadow_type('none'); |
3159 | + |
3160 | + #filename |
3161 | + #-------------------------------------- |
3162 | + my $filename_label = Gtk2::Label->new( $d->get("Filename") . ":" ); |
3163 | + |
3164 | + my $filename = Gtk2::Entry->new; |
3165 | + if ( defined $settings_xml->{'general'}->{'filename'} ) { |
3166 | + $filename->set_text( $settings_xml->{'general'}->{'filename'} ); |
3167 | + } else { |
3168 | + $filename->set_text("\$name_\%NNN"); |
3169 | + } |
3170 | + |
3171 | + #do some input validation |
3172 | + #here are all invalid char codes |
3173 | + my @invalid_codes = (47,92,63,42,58,124,34,60,62,44,59,35,38); |
3174 | + my $filename_hint = Gtk2::Label->new; |
3175 | + $filename_hint->set_no_show_all(TRUE); |
3176 | + $filename->signal_connect('key-press-event' => sub { |
3177 | + my $filename = shift; |
3178 | + my $event = shift; |
3179 | + |
3180 | + my $input = Gtk2::Gdk->keyval_to_unicode ($event->keyval); |
3181 | + |
3182 | + #invalid input |
3183 | + #~ print $input."\n"; |
3184 | + if(grep($input == $_, @invalid_codes)){ |
3185 | + my $char = chr($input); |
3186 | + $char = '&' if $char eq '&'; |
3187 | + $filename_hint->set_markup("<span size='small'>" . |
3188 | + sprintf($d->get("Reserved character %s is not allowed to be in a filename.") , "'".$char."'") |
3189 | + . "</span>"); |
3190 | + |
3191 | + $filename_hint->show; |
3192 | + return TRUE; |
3193 | + }else{ |
3194 | + #clear possible message when valid char is entered |
3195 | + $filename_hint->set_markup("<span size='small'></span>"); |
3196 | + $filename_hint->hide; |
3197 | + return FALSE; |
3198 | + } |
3199 | + }); |
3200 | + |
3201 | + my $filename_tooltip_string = |
3202 | + $d->get("There are several wildcards available, like\n"). |
3203 | + $d->get("%Y = year\n"). |
3204 | + $d->get("%m = month\n"). |
3205 | + $d->get("%d = day\n"). |
3206 | + $d->get("%T = time\n"). |
3207 | + $d->get("\$w = width\n"). |
3208 | + $d->get("\$h = height\n"). |
3209 | + $d->get("\$name = multi-purpose (e.g. window title)\n"). |
3210 | + $d->get("\$nb_name = like \$name but without blanks in resulting strings\n"). |
3211 | + $d->get("\$profile = name of current profile\n"). |
3212 | + $d->get("\$R = random char (e.g. \$RRRR = ag4r)\n"). |
3213 | + $d->get("%NN = counter"); |
3214 | + |
3215 | + $tooltips->set_tip($filename, $filename_tooltip_string); |
3216 | + $tooltips->set_tip($filename_label, $filename_tooltip_string); |
3217 | + |
3218 | + $filename_box->pack_start( $filename_label, FALSE, TRUE, 12 ); |
3219 | + $filename_box->pack_start( $filename, TRUE, TRUE, 0 ); |
3220 | + |
3221 | + #end - filename |
3222 | + #-------------------------------------- |
3223 | + |
3224 | + |
3225 | + #filetype and scale |
3226 | + #-------------------------------------- |
3227 | + my $scale = Gtk2::HScale->new_with_range( 0, 9, 1 ); |
3228 | + my $scale_label = Gtk2::Label->new( $d->get("Compression") . ":" ); |
3229 | + $scale->set_value_pos('right'); |
3230 | + $scale->set_value(1); |
3231 | + |
3232 | + #we don't need a default here because it will be set through signal handling (filetype) |
3233 | + if ( defined $settings_xml->{'general'}->{'quality'} ) { |
3234 | + $scale->set_value( $settings_xml->{'general'}->{'quality'} ); |
3235 | + } |
3236 | + |
3237 | + $tooltips->set_tip( $scale, |
3238 | + $d->get("Quality/Compression:\nHigh value means high size / high compression\n(depending on file format chosen)") ); |
3239 | + $tooltips->set_tip( $scale_label, |
3240 | + $d->get("Quality/Compression:\nHigh value means high size / high compression\n(depending on file format chosen)") ); |
3241 | + $scale_box->pack_start( $scale_label, FALSE, TRUE, 12 ); |
3242 | + $scale_box->pack_start( $scale, TRUE, TRUE, 0 ); |
3243 | + |
3244 | + #add compatile, writeable file types |
3245 | + my $combobox_type = Gtk2::ComboBox->new_text; |
3246 | + my ( $int_png, $int_jpeg, $int_bmp ) = ( -1, -1, -1 ); |
3247 | + my $format_counter = 0; |
3248 | + |
3249 | + foreach ( Gtk2::Gdk::Pixbuf->get_formats ) { |
3250 | + if ( $_->{name} eq "jpeg" |
3251 | + || $_->{name} eq "png" |
3252 | + || $_->{name} eq "bmp" ) |
3253 | + { |
3254 | + $combobox_type->append_text( $_->{name} . " - " . $_->{description} ); |
3255 | + |
3256 | + #a little ugly here, maybe the values are in alternative order on several machine... |
3257 | + #just remember the number when appending, so we can set png as default for example |
3258 | + if ( $_->{name} eq "jpeg" ) { |
3259 | + $int_jpeg = $format_counter; |
3260 | + } elsif ( $_->{name} eq "png" ) { |
3261 | + $int_png = $format_counter; |
3262 | + } elsif ( $_->{name} eq "bmp" ) { |
3263 | + $int_bmp = $format_counter; |
3264 | + } |
3265 | + |
3266 | + $format_counter++; |
3267 | + |
3268 | + } |
3269 | + } |
3270 | + $combobox_type->signal_connect( 'changed' => \&evt_value_changed, 'type_changed' ); |
3271 | + $scale->signal_connect( 'value-changed' => \&evt_value_changed, 'qvalue_changed' ); |
3272 | + |
3273 | + if ( defined $settings_xml->{'general'}->{'filetype'} ) { |
3274 | + |
3275 | + #migration from gscrot to shutter |
3276 | + #maybe we can drop this in future releases |
3277 | + # 0 := jpeg |
3278 | + # 1 := png |
3279 | + unless(defined $settings_xml->{'general'}->{'app_version'}){ |
3280 | + if($settings_xml->{'general'}->{'filetype'} == 0){ |
3281 | + $combobox_type->set_active($int_jpeg); |
3282 | + }elsif($settings_xml->{'general'}->{'filetype'} == 1){ |
3283 | + $combobox_type->set_active($int_png); |
3284 | + } |
3285 | + |
3286 | + #shutter |
3287 | + }else{ |
3288 | + $combobox_type->set_active($settings_xml->{'general'}->{'filetype'}); |
3289 | + } |
3290 | + |
3291 | + #set saved quality/compression value if there is one |
3292 | + if(defined $settings_xml->{'general'}->{'quality'}){ |
3293 | + $scale->set_value( $settings_xml->{'general'}->{'quality'} ); |
3294 | + } |
3295 | + |
3296 | + } else { |
3297 | + |
3298 | + #we will try to set a default value in this order |
3299 | + foreach ( @{ [ $int_png, $int_jpeg, $int_bmp ] } ) { |
3300 | + if ( $_ > -1 ) { |
3301 | + $combobox_type->set_active( $_ ); |
3302 | + last; |
3303 | + } |
3304 | + } |
3305 | + |
3306 | + } |
3307 | + |
3308 | + my $filetype_label = Gtk2::Label->new( $d->get("Image format") . ":" ); |
3309 | + $tooltips->set_tip( $combobox_type, $d->get("Select a file format") ); |
3310 | + $tooltips->set_tip( $filetype_label, $d->get("Select a file format") ); |
3311 | + $filetype_box->pack_start( $filetype_label, FALSE, TRUE, 12 ); |
3312 | + $filetype_box->pack_start( $combobox_type, TRUE, TRUE, 0 ); |
3313 | + |
3314 | + #end - filetype and scale |
3315 | + #-------------------------------------- |
3316 | + |
3317 | + #saveDir |
3318 | + #-------------------------------------- |
3319 | + my $saveDir_label = Gtk2::Label->new( $d->get("Directory") . ":" ); |
3320 | + my $saveDir_button = Gtk2::FileChooserButton->new( "Shutter - " . $d->get("Choose folder"), 'select-folder' ); |
3321 | + if ( defined $settings_xml->{'general'}->{'folder'} ) { |
3322 | + $saveDir_button->set_current_folder( $settings_xml->{'general'}->{'folder'} ); |
3323 | + } else { |
3324 | + $saveDir_button->set_current_folder( File::HomeDir->my_pictures ); |
3325 | + } |
3326 | + |
3327 | + $tooltips->set_tip( $saveDir_button, $d->get("Your screenshots will be saved to this directory") ); |
3328 | + $tooltips->set_tip( $saveDir_label, $d->get("Your screenshots will be saved to this directory") ); |
3329 | + $saveDir_box->pack_start( $saveDir_label, FALSE, TRUE, 12 ); |
3330 | + $saveDir_box->pack_start( $saveDir_button, TRUE, TRUE, 0 ); |
3331 | + |
3332 | + #end - saveDir |
3333 | + #-------------------------------------- |
3334 | + |
3335 | + #save options |
3336 | + #-------------------------------------- |
3337 | + my $save_ask_active = Gtk2::RadioButton->new_with_label(undef, $d->get("Browse for save folder every time") ); |
3338 | + $save_ask_box->pack_start( $save_ask_active, FALSE, TRUE, 12 ); |
3339 | + |
3340 | + $tooltips->set_tip( $save_ask_active, $d->get("Browse for save folder every time") ); |
3341 | + |
3342 | + my $save_auto_active = Gtk2::RadioButton->new_with_label($save_ask_active, $d->get("Automatically save file") ); |
3343 | + $save_auto_box->pack_start( $save_auto_active, FALSE, TRUE, 12 ); |
3344 | + |
3345 | + $tooltips->set_tip( $save_auto_active, $d->get("Automatically save file") ); |
3346 | + |
3347 | + $save_ask_active->signal_connect( |
3348 | + 'toggled' => \&evt_value_changed, |
3349 | + 'save_toggled' |
3350 | + ); |
3351 | + |
3352 | + $save_auto_active->signal_connect( |
3353 | + 'toggled' => \&evt_value_changed, |
3354 | + 'save_toggled' |
3355 | + ); |
3356 | + |
3357 | + #default state |
3358 | + $save_ask_active->set_active( FALSE ); |
3359 | + $save_auto_active->set_active( TRUE ); |
3360 | + |
3361 | + if ( defined $settings_xml->{'general'}->{'save_auto'} ) { |
3362 | + $save_auto_active->set_active( $settings_xml->{'general'}->{'save_auto'} ); |
3363 | + } |
3364 | + |
3365 | + if ( defined $settings_xml->{'general'}->{'save_ask'} ) { |
3366 | + $save_ask_active->set_active( $settings_xml->{'general'}->{'save_ask'} ); |
3367 | + } |
3368 | + |
3369 | + #end - save options |
3370 | + #-------------------------------------- |
3371 | + |
3372 | + #image_autocopy |
3373 | + #-------------------------------------- |
3374 | + my $image_autocopy_active = Gtk2::RadioButton->new_with_label(undef, $d->get("Automatically copy screenshot to clipboard") ); |
3375 | + $image_autocopy_box->pack_start( $image_autocopy_active, FALSE, TRUE, 12 ); |
3376 | + |
3377 | + if ( defined $settings_xml->{'general'}->{'image_autocopy'} ) { |
3378 | + $image_autocopy_active->set_active( $settings_xml->{'general'}->{'image_autocopy'} ); |
3379 | + } else { |
3380 | + $image_autocopy_active->set_active(TRUE); |
3381 | + } |
3382 | + |
3383 | + $tooltips->set_tip( $image_autocopy_active, $d->get("Automatically copy screenshot to clipboard") ); |
3384 | + |
3385 | + #end - image_autocopy |
3386 | + #-------------------------------------- |
3387 | + |
3388 | + #fname_autocopy |
3389 | + #-------------------------------------- |
3390 | + my $fname_autocopy_active = Gtk2::RadioButton->new_with_label($image_autocopy_active, $d->get("Automatically copy filename to clipboard") ); |
3391 | + $fname_autocopy_box->pack_start( $fname_autocopy_active, FALSE, TRUE, 12 ); |
3392 | + |
3393 | + if ( defined $settings_xml->{'general'}->{'fname_autocopy'} ) { |
3394 | + $fname_autocopy_active->set_active( $settings_xml->{'general'}->{'fname_autocopy'} ); |
3395 | + } else { |
3396 | + $fname_autocopy_active->set_active(FALSE); |
3397 | + } |
3398 | + |
3399 | + $tooltips->set_tip( $fname_autocopy_active, $d->get("Automatically copy filename to clipboard") ); |
3400 | + |
3401 | + #end - fname_autocopy |
3402 | + #-------------------------------------- |
3403 | + |
3404 | + #no_autocopy |
3405 | + #-------------------------------------- |
3406 | + my $no_autocopy_active = Gtk2::RadioButton->new_with_label($image_autocopy_active, $d->get("Do not copy anything to clipboard") ); |
3407 | + $no_autocopy_box->pack_start( $no_autocopy_active, FALSE, TRUE, 12 ); |
3408 | + |
3409 | + if ( defined $settings_xml->{'general'}->{'no_autocopy'} ) { |
3410 | + $no_autocopy_active->set_active( $settings_xml->{'general'}->{'no_autocopy'} ); |
3411 | + } else { |
3412 | + $no_autocopy_active->set_active(FALSE); |
3413 | + } |
3414 | + |
3415 | + $tooltips->set_tip( $no_autocopy_active, $d->get("Do not copy anything to clipboard") ); |
3416 | + |
3417 | + #end - no_autocopy |
3418 | + #-------------------------------------- |
3419 | + |
3420 | + #delay |
3421 | + #-------------------------------------- |
3422 | + |
3423 | + #delay statusbar |
3424 | + my $delay_status_label = Gtk2::Label->new( $d->get("Delay") .":" ); |
3425 | + my $delay_status = Gtk2::SpinButton->new_with_range( 0, 99, 1 ); |
3426 | + my $delay_status_vlabel = Gtk2::Label->new( $d->nget("second", "seconds", $delay_status->get_value) ); |
3427 | + $delay_status->signal_connect( |
3428 | + 'value-changed' => \&evt_value_changed, |
3429 | + 'delay_status_changed' |
3430 | + ); |
3431 | + |
3432 | + #delay settings dialog |
3433 | + my $delay_label = Gtk2::Label->new( $d->get("Capture after a delay of") ); |
3434 | + my $delay = Gtk2::SpinButton->new_with_range( 0, 99, 1 ); |
3435 | + my $delay_vlabel = Gtk2::Label->new( $d->nget("second", "seconds", $delay->get_value) ); |
3436 | + $delay->signal_connect( |
3437 | + 'value-changed' => \&evt_value_changed, |
3438 | + 'delay_changed' |
3439 | + ); |
3440 | + |
3441 | + if ( defined $settings_xml->{'general'}->{'delay'} ) { |
3442 | + $delay->set_value( $settings_xml->{'general'}->{'delay'} ); |
3443 | + } else { |
3444 | + $delay->set_value(0); |
3445 | + } |
3446 | + |
3447 | + $tooltips->set_tip( $delay, $d->get("Wait n seconds before taking a screenshot") ); |
3448 | + $tooltips->set_tip( $delay_label, $d->get("Wait n seconds before taking a screenshot") ); |
3449 | + $tooltips->set_tip( $delay_vlabel, $d->get("Wait n seconds before taking a screenshot") ); |
3450 | + |
3451 | + $tooltips->set_tip( $delay_status, $d->get("Wait n seconds before taking a screenshot") ); |
3452 | + $tooltips->set_tip( $delay_status_label, $d->get("Wait n seconds before taking a screenshot") ); |
3453 | + $tooltips->set_tip( $delay_status_vlabel, $d->get("Wait n seconds before taking a screenshot") ); |
3454 | + |
3455 | + $delay_box->pack_start( $delay_label, FALSE, FALSE, 12 ); |
3456 | + $delay_box->pack_start( $delay, FALSE, FALSE, 0 ); |
3457 | + $delay_box->pack_start( $delay_vlabel, FALSE, FALSE, 2 ); |
3458 | + |
3459 | + #end - delay |
3460 | + #-------------------------------------- |
3461 | + |
3462 | + #cursor |
3463 | + #-------------------------------------- |
3464 | + my $cursor_status_active = Gtk2::CheckButton->new_with_label( $d->get("Include Cursor") ); |
3465 | + $tooltips->set_tip( $cursor_status_active, $d->get("Include cursor when taking a screenshot") ); |
3466 | + $cursor_status_active->signal_connect( |
3467 | + 'toggled' => \&evt_value_changed, |
3468 | + 'cursor_status_toggled' |
3469 | + ); |
3470 | + |
3471 | + my $cursor_active = Gtk2::CheckButton->new_with_label( $d->get("Include cursor when taking a screenshot") ); |
3472 | + $tooltips->set_tip( $cursor_active, $d->get("Include cursor when taking a screenshot") ); |
3473 | + $cursor_active->signal_connect( |
3474 | + 'toggled' => \&evt_value_changed, |
3475 | + 'cursor_toggled' |
3476 | + ); |
3477 | + |
3478 | + $cursor_box->pack_start( $cursor_active, FALSE, TRUE, 12 ); |
3479 | + |
3480 | + if ( defined $settings_xml->{'general'}->{'cursor'} ) { |
3481 | + $cursor_active->set_active( $settings_xml->{'general'}->{'cursor'} ); |
3482 | + } else { |
3483 | + $cursor_active->set_active(TRUE); |
3484 | + } |
3485 | + |
3486 | + #end - cursor |
3487 | + #-------------------------------------- |
3488 | + |
3489 | + #program |
3490 | + #-------------------------------------- |
3491 | + my $model = &fct_get_program_model; |
3492 | + my $progname = Gtk2::ComboBox->new($model); |
3493 | + |
3494 | + #add pixbuf renderer for icon |
3495 | + my $renderer_pix = Gtk2::CellRendererPixbuf->new; |
3496 | + $progname->pack_start( $renderer_pix, FALSE ); |
3497 | + $progname->add_attribute( $renderer_pix, pixbuf => 0 ); |
3498 | + |
3499 | + #add text renderer for app name |
3500 | + my $renderer_text = Gtk2::CellRendererText->new; |
3501 | + $progname->pack_start( $renderer_text, FALSE ); |
3502 | + $progname->add_attribute( $renderer_text, text => 1 ); |
3503 | + |
3504 | + #try to set the saved value |
3505 | + if ( defined $settings_xml->{'general'}->{'prog'} ) { |
3506 | + $model->foreach( \&fct_iter_programs, $settings_xml->{'general'}->{'prog'} ); |
3507 | + } else { |
3508 | + $progname->set_active(0); |
3509 | + } |
3510 | + |
3511 | + #nothing has been set |
3512 | + if ( $progname->get_active == -1 ) { |
3513 | + $progname->set_active(0); |
3514 | + } |
3515 | + |
3516 | + my $progname_active = Gtk2::CheckButton->new; |
3517 | + $progname_active->set_active(TRUE); |
3518 | + $progname_active->signal_connect( |
3519 | + 'toggled' => \&evt_value_changed, |
3520 | + 'progname_toggled' |
3521 | + ); |
3522 | + if ( defined $settings_xml->{'general'}->{'prog_active'} ) { |
3523 | + $progname_active->set_active( $settings_xml->{'general'}->{'prog_active'} ); |
3524 | + } else { |
3525 | + $progname_active->set_active(FALSE); |
3526 | + } |
3527 | + my $progname_label = Gtk2::Label->new( $d->get("Open with") . ":" ); |
3528 | + $tooltips->set_tip( $progname, $d->get("Open your screenshot with this program after capturing") ); |
3529 | + $tooltips->set_tip( $progname_active, $d->get("Open your screenshot with this program after capturing") ); |
3530 | + $tooltips->set_tip( $progname_label, $d->get("Open your screenshot with this program after capturing") ); |
3531 | + $progname_box->pack_start( $progname_label, FALSE, TRUE, 12 ); |
3532 | + $progname_box->pack_start( $progname_active, FALSE, TRUE, 0 ); |
3533 | + $progname_box->pack_start( $progname, TRUE, TRUE, 0 ); |
3534 | + |
3535 | + #end - program |
3536 | + #-------------------------------------- |
3537 | + |
3538 | + #im_colors |
3539 | + #-------------------------------------- |
3540 | + my $combobox_im_colors = Gtk2::ComboBox->new_text; |
3541 | + $combobox_im_colors->insert_text( 0, $d->get("16 colors - (4bit) ") ); |
3542 | + $combobox_im_colors->insert_text( 1, $d->get("64 colors - (6bit) ") ); |
3543 | + $combobox_im_colors->insert_text( 2, $d->get("256 colors - (8bit) ") ); |
3544 | + $combobox_im_colors->signal_connect( |
3545 | + 'changed' => \&evt_value_changed, |
3546 | + 'im_colors_changed' |
3547 | + ); |
3548 | + |
3549 | + if ( defined $settings_xml->{'general'}->{'im_colors'} ) { |
3550 | + $combobox_im_colors->set_active( $settings_xml->{'general'}->{'im_colors'} ); |
3551 | + } else { |
3552 | + $combobox_im_colors->set_active(2); |
3553 | + } |
3554 | + |
3555 | + my $im_colors_active = Gtk2::CheckButton->new; |
3556 | + $im_colors_active->set_active(TRUE); |
3557 | + $im_colors_active->signal_connect( |
3558 | + 'toggled' => \&evt_value_changed, |
3559 | + 'im_colors_toggled' |
3560 | + ); |
3561 | + |
3562 | + if ( defined $settings_xml->{'general'}->{'im_colors_active'} ) { |
3563 | + $im_colors_active->set_active( $settings_xml->{'general'}->{'im_colors_active'} ); |
3564 | + } else { |
3565 | + $im_colors_active->set_active(FALSE); |
3566 | + } |
3567 | + |
3568 | + my $im_colors_label = Gtk2::Label->new( $d->get("Reduce colors") . ":" ); |
3569 | + $tooltips->set_tip( $combobox_im_colors, $d->get("Automatically reduce colors after taking a screenshot") ); |
3570 | + $tooltips->set_tip( $im_colors_active, $d->get("Automatically reduce colors after taking a screenshot") ); |
3571 | + $tooltips->set_tip( $im_colors_label, $d->get("Automatically reduce colors after taking a screenshot") ); |
3572 | + $im_colors_box->pack_start( $im_colors_label, FALSE, TRUE, 12 ); |
3573 | + $im_colors_box->pack_start( $im_colors_active, FALSE, TRUE, 0 ); |
3574 | + $im_colors_box->pack_start( $combobox_im_colors, TRUE, TRUE, 0 ); |
3575 | + |
3576 | + #end - colors |
3577 | + #-------------------------------------- |
3578 | + |
3579 | + #thumbnail |
3580 | + #-------------------------------------- |
3581 | + my $thumbnail_label = Gtk2::Label->new( $d->get("Thumbnail") . ":" ); |
3582 | + my $thumbnail = Gtk2::HScale->new_with_range( 1, 100, 1 ); |
3583 | + $thumbnail->signal_connect( |
3584 | + 'value-changed' => \&evt_value_changed, |
3585 | + 'thumbnail_changed' |
3586 | + ); |
3587 | + $thumbnail->set_value_pos('right'); |
3588 | + |
3589 | + if ( defined $settings_xml->{'general'}->{'thumbnail'} ) { |
3590 | + $thumbnail->set_value( $settings_xml->{'general'}->{'thumbnail'} ); |
3591 | + } else { |
3592 | + $thumbnail->set_value(50); |
3593 | + } |
3594 | + my $thumbnail_active = Gtk2::CheckButton->new; |
3595 | + $thumbnail_active->set_active(TRUE); |
3596 | + $thumbnail_active->signal_connect( |
3597 | + 'toggled' => \&evt_value_changed, |
3598 | + 'thumbnail_toggled' |
3599 | + ); |
3600 | + |
3601 | + if ( defined $settings_xml->{'general'}->{'thumbnail_active'} ) { |
3602 | + $thumbnail_active->set_active( $settings_xml->{'general'}->{'thumbnail_active'} ); |
3603 | + } else { |
3604 | + $thumbnail_active->set_active(FALSE); |
3605 | + } |
3606 | + $tooltips->set_tip( $thumbnail, |
3607 | + $d->get("Generate thumbnail too.\nselect the percentage of the original size for the thumbnail to be") ); |
3608 | + $tooltips->set_tip( $thumbnail_active, |
3609 | + $d->get("Generate thumbnail too.\nselect the percentage of the original size for the thumbnail to be") ); |
3610 | + $tooltips->set_tip( $thumbnail_label, |
3611 | + $d->get("Generate thumbnail too.\nselect the percentage of the original size for the thumbnail to be") ); |
3612 | + $thumbnail_box->pack_start( $thumbnail_label, FALSE, TRUE, 12 ); |
3613 | + $thumbnail_box->pack_start( $thumbnail_active, FALSE, FALSE, 0 ); |
3614 | + $thumbnail_box->pack_start( $thumbnail, TRUE, TRUE, 0 ); |
3615 | + |
3616 | + #end - thumbnail |
3617 | + #-------------------------------------- |
3618 | + |
3619 | + #bordereffect |
3620 | + #-------------------------------------- |
3621 | + my $bordereffect_active = Gtk2::CheckButton->new; |
3622 | + $bordereffect_active->set_active(TRUE); |
3623 | + |
3624 | + my $bordereffect_label = Gtk2::Label->new( $d->get("Border") . ":" ); |
3625 | + my $bordereffect = Gtk2::SpinButton->new_with_range( 1, 100, 1 ); |
3626 | + my $bordereffect_vlabel = Gtk2::Label->new( $d->get("pixels") ); |
3627 | + |
3628 | + my $bordereffect_clabel = Gtk2::Label->new( $d->get("Color") . ":" ); |
3629 | + my $bordereffect_cbtn = Gtk2::ColorButton->new(); |
3630 | + $bordereffect_cbtn->set_use_alpha(FALSE); |
3631 | + $bordereffect_cbtn->set_title( $d->get("Choose border color") ); |
3632 | + |
3633 | + $tooltips->set_tip( $bordereffect_active, |
3634 | + $d->get("Adds a border effect to the screenshot") ); |
3635 | + $tooltips->set_tip( $bordereffect, |
3636 | + $d->get("Adds a border effect to the screenshot") ); |
3637 | + $tooltips->set_tip( $bordereffect_label, |
3638 | + $d->get("Adds a border effect to the screenshot") ); |
3639 | + |
3640 | + $tooltips->set_tip( $bordereffect_clabel, |
3641 | + $d->get("Choose border color") ); |
3642 | + $tooltips->set_tip( $bordereffect_cbtn, |
3643 | + $d->get("Choose border color") ); |
3644 | + |
3645 | + $bordereffect_box->pack_start( $bordereffect_label, FALSE, TRUE, 12 ); |
3646 | + $bordereffect_box->pack_start( $bordereffect_active, FALSE, FALSE, 0 ); |
3647 | + $bordereffect_box->pack_start( $bordereffect, TRUE, TRUE, 2 ); |
3648 | + $bordereffect_box->pack_start( $bordereffect_vlabel, FALSE, FALSE, 2 ); |
3649 | + $bordereffect_box->pack_start( $bordereffect_clabel, FALSE, FALSE, 12 ); |
3650 | + $bordereffect_box->pack_start( $bordereffect_cbtn, FALSE, FALSE, 0 ); |
3651 | + |
3652 | + $bordereffect_active->signal_connect( |
3653 | + 'toggled' => \&evt_value_changed, |
3654 | + 'bordereffect_toggled' |
3655 | + ); |
3656 | + |
3657 | + $bordereffect->signal_connect( |
3658 | + 'value-changed' => \&evt_value_changed, |
3659 | + 'bordereffect_changed' |
3660 | + ); |
3661 | + |
3662 | + if ( defined $settings_xml->{'general'}->{'bordereffect_active'} ) { |
3663 | + $bordereffect_active->set_active( $settings_xml->{'general'}->{'bordereffect_active'} ); |
3664 | + } else { |
3665 | + $bordereffect_active->set_active(FALSE); |
3666 | + } |
3667 | + |
3668 | + if ( defined $settings_xml->{'general'}->{'bordereffect'} ) { |
3669 | + $bordereffect->set_value( $settings_xml->{'general'}->{'bordereffect'} ); |
3670 | + } else { |
3671 | + $bordereffect->set_value(2); |
3672 | + } |
3673 | + |
3674 | + if ( defined $settings_xml->{'general'}->{'bordereffect_col'} ){ |
3675 | + $bordereffect_cbtn->set_color(Gtk2::Gdk::Color->parse($settings_xml->{'general'}->{'bordereffect_col'})); |
3676 | + } else { |
3677 | + $bordereffect_cbtn->set_color( Gtk2::Gdk::Color->parse('black') ); |
3678 | + } |
3679 | + |
3680 | + #end - bordereffect |
3681 | + #-------------------------------------- |
3682 | + |
3683 | + #zoom window |
3684 | + #-------------------------------------- |
3685 | + my $zoom_active = Gtk2::CheckButton->new_with_label( $d->get("Enable zoom window") ); |
3686 | + |
3687 | + if ( defined $settings_xml->{'general'}->{'zoom_active'} ) { |
3688 | + $zoom_active->set_active( $settings_xml->{'general'}->{'zoom_active'} ); |
3689 | + } else { |
3690 | + $zoom_active->set_active(TRUE); |
3691 | + } |
3692 | + |
3693 | + $tooltips->set_tip( $zoom_active, $d->get("Enable zoom window") ); |
3694 | + |
3695 | + $zoom_box->pack_start( $zoom_active, FALSE, TRUE, 12 ); |
3696 | + |
3697 | + #end - zoom window |
3698 | + #-------------------------------------- |
3699 | + |
3700 | + #initial size for advanced selection tool |
3701 | + #-------------------------------------- |
3702 | + my $asel_size_label1 = Gtk2::Label->new( $d->get("Start with selection size of") ); |
3703 | + my $asel_size_label2 = Gtk2::Label->new( "x" ); |
3704 | + my $asel_size_label3 = Gtk2::Label->new( $d->get("at") ); |
3705 | + my $asel_size_label4 = Gtk2::Label->new( "," ); |
3706 | + my $asel_size1 = Gtk2::SpinButton->new_with_range( 0, 10000, 1 ); |
3707 | + my $asel_size2 = Gtk2::SpinButton->new_with_range( 0, 10000, 1 ); |
3708 | + my $asel_size3 = Gtk2::SpinButton->new_with_range( 0, 10000, 1 ); |
3709 | + my $asel_size4 = Gtk2::SpinButton->new_with_range( 0, 10000, 1 ); |
3710 | + my $asel_size_vlabel1 = Gtk2::Label->new( $d->get("pixels") ); |
3711 | + my $asel_size_vlabel2 = Gtk2::Label->new( $d->get("pixels") ); |
3712 | + |
3713 | + if ( defined $settings_xml->{'general'}->{'asel_x'} ) { |
3714 | + $asel_size3->set_value($settings_xml->{'general'}->{'asel_x'}); |
3715 | + } else { |
3716 | + $asel_size3->set_value(0); |
3717 | + } |
3718 | + if ( defined $settings_xml->{'general'}->{'asel_y'} ) { |
3719 | + $asel_size4->set_value($settings_xml->{'general'}->{'asel_y'}); |
3720 | + } else { |
3721 | + $asel_size4->set_value(0); |
3722 | + } |
3723 | + if ( defined $settings_xml->{'general'}->{'asel_w'} ) { |
3724 | + $asel_size1->set_value($settings_xml->{'general'}->{'asel_w'}); |
3725 | + } else { |
3726 | + $asel_size1->set_value(0); |
3727 | + } |
3728 | + if ( defined $settings_xml->{'general'}->{'asel_h'} ) { |
3729 | + $asel_size2->set_value($settings_xml->{'general'}->{'asel_h'}); |
3730 | + } else { |
3731 | + $asel_size2->set_value(0); |
3732 | + } |
3733 | + |
3734 | + $tooltips->set_tip( $asel_size_label1, $d->get("Start Advanced Selection Tool with a customized selection size") ); |
3735 | + $tooltips->set_tip( $asel_size_label2, $d->get("Start Advanced Selection Tool with a customized selection size") ); |
3736 | + $tooltips->set_tip( $asel_size_label3, $d->get("Start Advanced Selection Tool with a customized selection size") ); |
3737 | + $tooltips->set_tip( $asel_size_label4, $d->get("Start Advanced Selection Tool with a customized selection size") ); |
3738 | + $tooltips->set_tip( $asel_size1, $d->get("Start Advanced Selection Tool with a customized selection size") ); |
3739 | + $tooltips->set_tip( $asel_size2, $d->get("Start Advanced Selection Tool with a customized selection size") ); |
3740 | + $tooltips->set_tip( $asel_size3, $d->get("Start Advanced Selection Tool with a customized selection size") ); |
3741 | + $tooltips->set_tip( $asel_size4, $d->get("Start Advanced Selection Tool with a customized selection size") ); |
3742 | + $tooltips->set_tip( $asel_size_vlabel1, $d->get("Start Advanced Selection Tool with a customized selection size") ); |
3743 | + $tooltips->set_tip( $asel_size_vlabel2, $d->get("Start Advanced Selection Tool with a customized selection size") ); |
3744 | + |
3745 | + $asel_isize_box->pack_start( $asel_size_label1, FALSE, FALSE, 12 ); |
3746 | + $asel_isize_box->pack_start( $asel_size1, FALSE, FALSE, 0 ); |
3747 | + $asel_isize_box->pack_start( $asel_size_label2, FALSE, FALSE, 0 ); |
3748 | + $asel_isize_box->pack_start( $asel_size2, FALSE, FALSE, 0 ); |
3749 | + $asel_isize_box->pack_start( $asel_size_vlabel1, FALSE, FALSE, 2 ); |
3750 | + $asel_isize_box2->pack_start( $asel_size_label3, FALSE, FALSE, 12 ); |
3751 | + $asel_isize_box2->pack_start( $asel_size3, FALSE, FALSE, 0 ); |
3752 | + $asel_isize_box2->pack_start( $asel_size_label4, FALSE, FALSE, 0 ); |
3753 | + $asel_isize_box2->pack_start( $asel_size4, FALSE, FALSE, 0 ); |
3754 | + $asel_isize_box2->pack_start( $asel_size_vlabel2, FALSE, FALSE, 2 ); |
3755 | + |
3756 | + #end - initial size for advanced selection tool |
3757 | + #-------------------------------------- |
3758 | + |
3759 | + #show help text when using advanced selection tool |
3760 | + #-------------------------------------- |
3761 | + my $as_help_active = Gtk2::CheckButton->new_with_label( $d->get("Show help text") ); |
3762 | + |
3763 | + if ( defined $settings_xml->{'general'}->{'as_help_active'} ) { |
3764 | + $as_help_active->set_active( $settings_xml->{'general'}->{'as_help_active'} ); |
3765 | + } else { |
3766 | + $as_help_active->set_active(TRUE); |
3767 | + } |
3768 | + |
3769 | + $tooltips->set_tip( $as_help_active, $d->get("Enables the help text") ); |
3770 | + |
3771 | + $as_help_box->pack_start( $as_help_active, FALSE, TRUE, 12 ); |
3772 | + |
3773 | + #end - show help text when using advanced selection tool |
3774 | + #-------------------------------------- |
3775 | + |
3776 | + #border |
3777 | + #-------------------------------------- |
3778 | + my $border_active = Gtk2::CheckButton->new_with_label( $d->get("Include window decoration when capturing a window") ); |
3779 | + $tooltips->set_tip( $border_active, $d->get("Include window decoration when capturing a window") ); |
3780 | + |
3781 | + $border_box->pack_start( $border_active, FALSE, TRUE, 12 ); |
3782 | + |
3783 | + if ( defined $settings_xml->{'general'}->{'border'} ) { |
3784 | + $border_active->set_active( $settings_xml->{'general'}->{'border'} ); |
3785 | + } else { |
3786 | + $border_active->set_active(TRUE); |
3787 | + } |
3788 | + |
3789 | + #end - border |
3790 | + #-------------------------------------- |
3791 | + |
3792 | + #visible windows only |
3793 | + #-------------------------------------- |
3794 | + my $visible_windows_active = Gtk2::CheckButton->new_with_label( $d->get("Select only visible windows") ); |
3795 | + $tooltips->set_tip( $visible_windows_active, $d->get("Select only visible windows") ); |
3796 | + |
3797 | + $visible_windows_box->pack_start( $visible_windows_active, FALSE, TRUE, 12 ); |
3798 | + |
3799 | + if ( defined $settings_xml->{'general'}->{'visible_windows'} ) { |
3800 | + $visible_windows_active->set_active( $settings_xml->{'general'}->{'visible_windows'} ); |
3801 | + } else { |
3802 | + $visible_windows_active->set_active(FALSE); |
3803 | + } |
3804 | + |
3805 | + #end - visible windows only |
3806 | + #-------------------------------------- |
3807 | + |
3808 | + #menu capture delay |
3809 | + #-------------------------------------- |
3810 | + #delay settings dialog |
3811 | + my $menu_delay_label = Gtk2::Label->new( $d->get("Pre-Capture Delay") . ":" ); |
3812 | + my $menu_delay = Gtk2::SpinButton->new_with_range( 1, 99, 1 ); |
3813 | + my $menu_delay_vlabel = Gtk2::Label->new( $d->nget("second", "seconds", $delay->get_value) ); |
3814 | + $menu_delay->signal_connect( |
3815 | + 'value-changed' => \&evt_value_changed, |
3816 | + 'menu_delay_changed' |
3817 | + ); |
3818 | + |
3819 | + if ( defined $settings_xml->{'general'}->{'menu_delay'} ) { |
3820 | + $menu_delay->set_value( $settings_xml->{'general'}->{'menu_delay'} ); |
3821 | + } else { |
3822 | + $menu_delay->set_value(10); |
3823 | + } |
3824 | + |
3825 | + $tooltips->set_tip( $menu_delay, $d->get("Capture menu/tooltip after a delay of n seconds") ); |
3826 | + $tooltips->set_tip( $menu_delay_label, $d->get("Capture menu/tooltip after a delay of n seconds") ); |
3827 | + $tooltips->set_tip( $menu_delay_vlabel, $d->get("Capture menu/tooltip after a delay of n seconds") ); |
3828 | + |
3829 | + $menu_delay_box->pack_start( $menu_delay_label, FALSE, TRUE, 12 ); |
3830 | + $menu_delay_box->pack_start( $menu_delay, FALSE, TRUE, 0 ); |
3831 | + $menu_delay_box->pack_start( $menu_delay_vlabel, FALSE, TRUE, 2 ); |
3832 | + |
3833 | + #end - menu capture delay |
3834 | + #-------------------------------------- |
3835 | + |
3836 | + #menu/tooltip workaround |
3837 | + #-------------------------------------- |
3838 | + my $menu_waround_active = Gtk2::CheckButton->new_with_label( $d->get("Ignore possibly wrong type hints") ); |
3839 | + $tooltips->set_tip( $menu_waround_active, $d->get("The type hint constants specify hints for the window manager that indicate what type of function the window has. Sometimes these type hints are not correctly set. By enabling this option Shutter will not insist on the requested type hint.") ); |
3840 | + |
3841 | + $menu_waround_box->pack_start( $menu_waround_active, FALSE, TRUE, 12 ); |
3842 | + |
3843 | + if ( defined $settings_xml->{'general'}->{'menu_waround'} ) { |
3844 | + $menu_waround_active->set_active( $settings_xml->{'general'}->{'menu_waround'} ); |
3845 | + } else { |
3846 | + $menu_waround_active->set_active(TRUE); |
3847 | + } |
3848 | + |
3849 | + #end - menu/tooltip workaround |
3850 | + #-------------------------------------- |
3851 | + |
3852 | + #web width |
3853 | + #-------------------------------------- |
3854 | + my $web_width_label = Gtk2::Label->new( $d->get("Virtual browser width") . ":" ); |
3855 | + my $combobox_web_width = Gtk2::ComboBox->new_text; |
3856 | + $combobox_web_width->insert_text( 0, "640" ); |
3857 | + $combobox_web_width->insert_text( 1, "800" ); |
3858 | + $combobox_web_width->insert_text( 2, "1024" ); |
3859 | + $combobox_web_width->insert_text( 3, "1152" ); |
3860 | + $combobox_web_width->insert_text( 4, "1280" ); |
3861 | + $combobox_web_width->insert_text( 5, "1366" ); |
3862 | + $combobox_web_width->insert_text( 6, "1440" ); |
3863 | + $combobox_web_width->insert_text( 7, "1600" ); |
3864 | + $combobox_web_width->insert_text( 8, "1680" ); |
3865 | + $combobox_web_width->insert_text( 9, "1920" ); |
3866 | + $combobox_web_width->insert_text( 10, "2048" ); |
3867 | + my $web_width_vlabel = Gtk2::Label->new( $d->get("pixels") ); |
3868 | + |
3869 | + if ( defined $settings_xml->{'general'}->{'web_width'} ) { |
3870 | + $combobox_web_width->set_active( $settings_xml->{'general'}->{'web_width'} ); |
3871 | + } else { |
3872 | + $combobox_web_width->set_active(2); |
3873 | + } |
3874 | + |
3875 | + $tooltips->set_tip( $web_width_label, $d->get("Virtual browser width when taking a website screenshot") ); |
3876 | + $tooltips->set_tip( $combobox_web_width, $d->get("Virtual browser width when taking a website screenshot") ); |
3877 | + $tooltips->set_tip( $web_width_vlabel, $d->get("Virtual browser width when taking a website screenshot") ); |
3878 | + |
3879 | + $web_width_box->pack_start( $web_width_label, FALSE, TRUE, 12 ); |
3880 | + $web_width_box->pack_start( $combobox_web_width, FALSE, TRUE, 0 ); |
3881 | + $web_width_box->pack_start( $web_width_vlabel, FALSE, TRUE, 2 ); |
3882 | + |
3883 | + #end - web width |
3884 | + #-------------------------------------- |
3885 | + |
3886 | + #imageview |
3887 | + #-------------------------------------- |
3888 | + my $trans_check = Gtk2::RadioButton->new (undef, $d->get("Show as check pattern")); |
3889 | + my $trans_custom = Gtk2::RadioButton->new ($trans_check, $d->get("Show as custom color:")); |
3890 | + my $trans_custom_btn = Gtk2::ColorButton->new(); |
3891 | + $trans_custom_btn->set_use_alpha(FALSE); |
3892 | + $trans_custom_btn->set_title( $d->get("Choose fill color") ); |
3893 | + |
3894 | + my $trans_backg = Gtk2::RadioButton->new ($trans_custom, $d->get("Show as background")); |
3895 | + |
3896 | + $imageview_hbox1->pack_start( $trans_check, FALSE, TRUE, 12 ); |
3897 | + $imageview_hbox2->pack_start( $trans_custom, FALSE, TRUE, 12 ); |
3898 | + $imageview_hbox2->pack_start( $trans_custom_btn, FALSE, TRUE, 0 ); |
3899 | + $imageview_hbox3->pack_start( $trans_backg, FALSE, TRUE, 12 ); |
3900 | + |
3901 | + if ( defined $settings_xml->{'general'}->{'trans_custom_col'} ){ |
3902 | + $trans_custom_btn->set_color(Gtk2::Gdk::Color->parse($settings_xml->{'general'}->{'trans_custom_col'})); |
3903 | + } else { |
3904 | + $trans_custom_btn->set_color( Gtk2::Gdk::Color->parse('black') ); |
3905 | + } |
3906 | + |
3907 | + if ( defined $settings_xml->{'general'}->{'trans_check'} && defined $settings_xml->{'general'}->{'trans_custom'} && defined $settings_xml->{'general'}->{'trans_backg'}) { |
3908 | + $trans_check->set_active( $settings_xml->{'general'}->{'trans_check'} ); |
3909 | + $trans_custom->set_active( $settings_xml->{'general'}->{'trans_custom'} ); |
3910 | + $trans_backg->set_active( $settings_xml->{'general'}->{'trans_backg'} ); |
3911 | + } else { |
3912 | + $trans_check->set_active(TRUE); |
3913 | + } |
3914 | + |
3915 | + $tooltips->set_tip( $trans_check, $d->get("Displays any transparent parts of the image in a check pattern") ); |
3916 | + $tooltips->set_tip( $trans_custom, $d->get("Displays any transparent parts of the image in a solid color that you specify") ); |
3917 | + $tooltips->set_tip( $trans_backg, $d->get("Displays any transparent parts of the image in the background color of the application") ); |
3918 | + |
3919 | + #connect signals after restoring the saved state |
3920 | + $trans_check->signal_connect( |
3921 | + 'toggled' => \&evt_value_changed, |
3922 | + 'transp_toggled' |
3923 | + ); |
3924 | + |
3925 | + $trans_custom->signal_connect( |
3926 | + 'toggled' => \&evt_value_changed, |
3927 | + 'transp_toggled' |
3928 | + ); |
3929 | + |
3930 | + $trans_custom_btn->signal_connect( |
3931 | + 'color-set' => \&evt_value_changed, |
3932 | + 'transp_toggled' |
3933 | + ); |
3934 | + |
3935 | + $trans_backg->signal_connect( |
3936 | + 'toggled' => \&evt_value_changed, |
3937 | + 'transp_toggled' |
3938 | + ); |
3939 | + |
3940 | + #end - imageview |
3941 | + #-------------------------------------- |
3942 | + |
3943 | + #keybindings |
3944 | + #-------------------------------------- |
3945 | + my $capture_key = Gtk2::Entry->new; |
3946 | + if ( defined $settings_xml->{'general'}->{'capture_key'} ) { |
3947 | + $capture_key->set_text( $settings_xml->{'general'}->{'capture_key'} ); |
3948 | + } else { |
3949 | + $capture_key->set_text("Print"); |
3950 | + } |
3951 | + my $capture_label = Gtk2::Label->new( $d->get("Capture") . ":" ); |
3952 | + $tooltips->set_tip( |
3953 | + $capture_key, |
3954 | + $d->get( |
3955 | + "Configure global keybinding for capture\nThe format looks like \"<Control>a\" or \"<Shift><Alt>F1\". The parser is fairly liberal and allows lower or upper case, and also abbreviations such as \"<Ctl>\" and \"<Ctrl>\". If you set the option to the special string \"disabled\", then there will be no keybinding for this action. " |
3956 | + ) |
3957 | + ); |
3958 | + $tooltips->set_tip( |
3959 | + $capture_label, |
3960 | + $d->get( |
3961 | + "Configure global keybinding for capture\nThe format looks like \"<Control>a\" or \"<Shift><Alt>F1\". The parser is fairly liberal and allows lower or upper case, and also abbreviations such as \"<Ctl>\" and \"<Ctrl>\". If you set the option to the special string \"disabled\", then there will be no keybinding for this action. " |
3962 | + ) |
3963 | + ); |
3964 | + my $capture_sel_key = Gtk2::Entry->new; |
3965 | + if ( defined $settings_xml->{'general'}->{'capture_sel_key'} ) { |
3966 | + $capture_sel_key->set_text( $settings_xml->{'general'}->{'capture_sel_key'} ); |
3967 | + } else { |
3968 | + $capture_sel_key->set_text("<Alt>Print"); |
3969 | + } |
3970 | + |
3971 | + my $capture_sel_label = Gtk2::Label->new( $d->get("Capture with selection") . ":" ); |
3972 | + $tooltips->set_tip( |
3973 | + $capture_sel_key, |
3974 | + $d->get( |
3975 | + "Configure global keybinding for capture with selection\nThe format looks like \"<Control>a\" or \"<Shift><Alt>F1\". The parser is fairly liberal and allows lower or upper case, and also abbreviations such as \"<Ctl>\" and \"<Ctrl>\". If you set the option to the special string \"disabled\", then there will be no keybinding for this action. " |
3976 | + ) |
3977 | + ); |
3978 | + $tooltips->set_tip( |
3979 | + $capture_sel_label, |
3980 | + $d->get( |
3981 | + "Configure global keybinding for capture with selection\nThe format looks like \"<Control>a\" or \"<Shift><Alt>F1\". The parser is fairly liberal and allows lower or upper case, and also abbreviations such as \"<Ctl>\" and \"<Ctrl>\". If you set the option to the special string \"disabled\", then there will be no keybinding for this action. " |
3982 | + ) |
3983 | + ); |
3984 | + |
3985 | + #keybinding_mode |
3986 | + my $combobox_keybinding_mode = Gtk2::ComboBox->new_text; |
3987 | + $combobox_keybinding_mode->insert_text( 0, $d->get("Selection") ); |
3988 | + $combobox_keybinding_mode->insert_text( 1, $d->get("Select Window") ); |
3989 | + $combobox_keybinding_mode->insert_text( 2, $d->get("Active Window") ); |
3990 | + $combobox_keybinding_mode->insert_text( 3, $d->get("Section") ); |
3991 | + $combobox_keybinding_mode->insert_text( 4, $d->get("Menu") ); |
3992 | + $combobox_keybinding_mode->insert_text( 5, $d->get("Tooltip") ); |
3993 | + $combobox_keybinding_mode->insert_text( 6, $d->get("Web") ); |
3994 | + |
3995 | + if ( defined $settings_xml->{'general'}->{'keybinding_mode'} ) { |
3996 | + $combobox_keybinding_mode->set_active( $settings_xml->{'general'}->{'keybinding_mode'} ); |
3997 | + } else { |
3998 | + $combobox_keybinding_mode->set_active(1); |
3999 | + } |
4000 | + $tooltips->set_tip( |
4001 | + $combobox_keybinding_mode, |
4002 | + $d->get( |
4003 | + "Configure global keybinding for capture with selection\nThe format looks like \"<Control>a\" or \"<Shift><Alt>F1\". The parser is fairly liberal and allows lower or upper case, and also abbreviations such as \"<Ctl>\" and \"<Ctrl>\". If you set the option to the special string \"disabled\", then there will be no keybinding for this action. " |
4004 | + ) |
4005 | + ); |
4006 | + |
4007 | + $keybinding_mode_box->pack_start( Gtk2::Label->new, FALSE, FALSE, 0 ); |
4008 | + $keybinding_mode_box->pack_start( $combobox_keybinding_mode, TRUE, TRUE, 0 ); |
4009 | + |
4010 | + my $keybinding_active = Gtk2::CheckButton->new; |
4011 | + my $keybinding_sel_active = Gtk2::CheckButton->new; |
4012 | + |
4013 | + $key_box->pack_start( $capture_label, FALSE, TRUE, 12 ); |
4014 | + $key_box->pack_start( $keybinding_active, FALSE, FALSE, 0 ); |
4015 | + $key_box->pack_start( $capture_key, TRUE, TRUE, 0 ); |
4016 | + $key_sel_box->pack_start( $capture_sel_label, FALSE, TRUE, 12 ); |
4017 | + $key_sel_box->pack_start( $keybinding_sel_active, FALSE, FALSE, 0 ); |
4018 | + $key_sel_box->pack_start( $capture_sel_key, TRUE, TRUE, 0 ); |
4019 | + $keybinding_active->set_active(TRUE); |
4020 | + |
4021 | + #add signal handlers BEFORE settings are restored |
4022 | + $keybinding_active->signal_connect( |
4023 | + 'toggled' => \&evt_behavior_handle, |
4024 | + 'keybinding_toggled' |
4025 | + ); |
4026 | + |
4027 | + $keybinding_sel_active->signal_connect( |
4028 | + 'toggled' => \&evt_behavior_handle, |
4029 | + 'keybinding_sel_toggled' |
4030 | + ); |
4031 | + |
4032 | + if ( defined $settings_xml->{'general'}->{'keybinding'} ) { |
4033 | + $keybinding_active->set_active( $settings_xml->{'general'}->{'keybinding'} ); |
4034 | + } else { |
4035 | + $keybinding_active->set_active(FALSE); |
4036 | + } |
4037 | + $keybinding_sel_active->set_active(TRUE); |
4038 | + if ( defined $settings_xml->{'general'}->{'keybinding_sel'} ) { |
4039 | + $keybinding_sel_active->set_active( $settings_xml->{'general'}->{'keybinding_sel'} ); |
4040 | + } else { |
4041 | + $keybinding_sel_active->set_active(FALSE); |
4042 | + } |
4043 | + #end - keybindings |
4044 | + #-------------------------------------- |
4045 | + |
4046 | + #behavior |
4047 | + #-------------------------------------- |
4048 | + my $hide_active = Gtk2::CheckButton->new_with_label( $d->get("Autohide main window when taking a screenshot") ); |
4049 | + my $hide_time_label = Gtk2::Label->new($d->get("Redraw Delay"). ":"); |
4050 | + my $hide_time_vlabel = Gtk2::Label->new; |
4051 | + my $hide_time = Gtk2::SpinButton->new_with_range (0, 1000, 50); |
4052 | + $hide_time->signal_connect( |
4053 | + 'value-changed' => \&evt_value_changed, |
4054 | + 'hide_time_changed' |
4055 | + ); |
4056 | + |
4057 | + my $present_after_active = Gtk2::CheckButton->new_with_label( $d->get("Present main window after taking a screenshot") ); |
4058 | + my $close_at_close_active = Gtk2::CheckButton->new_with_label( $d->get("Minimize to tray when closing main window") ); |
4059 | + |
4060 | + my $notify_after_active = Gtk2::CheckButton->new_with_label( $d->get("Display pop-up notification after taking a screenshot") ); |
4061 | + my $notify_timeout_active = Gtk2::CheckButton->new_with_label( $d->get("Display pop-up notification when using a delay") ); |
4062 | + my $notify_ptimeout_active = Gtk2::CheckButton->new_with_label( $d->get("Display pop-up notification when using a pre-capture delay") ); |
4063 | + |
4064 | + my $ns_label = Gtk2::Label->new( $d->get("Notification agent") . ":" ); |
4065 | + my $combobox_ns = Gtk2::ComboBox->new_text; |
4066 | + $combobox_ns->append_text($d->get("Desktop Notifications")); |
4067 | + $combobox_ns->append_text($d->get("Built-In Notifications")); |
4068 | + |
4069 | + $combobox_ns->signal_connect( 'changed' => \&evt_value_changed, 'ns_changed' ); |
4070 | + |
4071 | + my $ask_on_delete_active = Gtk2::CheckButton->new_with_label( $d->get("Ask before moving files to trash") ); |
4072 | + my $delete_on_close_active = Gtk2::CheckButton->new_with_label( $d->get("Move file to trash when closing tab") ); |
4073 | + |
4074 | + $hide_active_hbox->pack_start( $hide_active, FALSE, TRUE, 12 ); |
4075 | + $pafter_active_hbox->pack_start( $present_after_active, FALSE, TRUE, 12 ); |
4076 | + $cac_hbox->pack_start( $close_at_close_active, FALSE, TRUE, 12 ); |
4077 | + $hide_time_hbox->pack_start( $hide_time_label, FALSE, TRUE, 12 ); |
4078 | + $hide_time_hbox->pack_start( $hide_time, FALSE, TRUE, 6 ); |
4079 | + $hide_time_hbox->pack_start( $hide_time_vlabel, FALSE, TRUE, 0 ); |
4080 | + $na_active_hbox->pack_start( $notify_after_active, FALSE, TRUE, 12 ); |
4081 | + $nt_active_hbox->pack_start( $notify_timeout_active, FALSE, TRUE, 12 ); |
4082 | + $npt_active_hbox->pack_start( $notify_ptimeout_active, FALSE, TRUE, 12 ); |
4083 | + $ns_combo_hbox->pack_start( $ns_label, FALSE, TRUE, 12 ); |
4084 | + $ns_combo_hbox->pack_start( $combobox_ns, FALSE, TRUE, 0 ); |
4085 | + $aod_active_hbox->pack_start( $ask_on_delete_active, FALSE, TRUE, 12 ); |
4086 | + $doc_active_hbox->pack_start( $delete_on_close_active, FALSE, TRUE, 12 ); |
4087 | + |
4088 | + if ( defined $settings_xml->{'general'}->{'autohide'} ) { |
4089 | + $hide_active->set_active( $settings_xml->{'general'}->{'autohide'} ); |
4090 | + } else { |
4091 | + $hide_active->set_active(TRUE); |
4092 | + } |
4093 | + |
4094 | + $tooltips->set_tip( $hide_active, $d->get("Autohide main window when taking a screenshot") ); |
4095 | + |
4096 | + if ( defined $settings_xml->{'general'}->{'autohide_time'} ) { |
4097 | + $hide_time->set_value( $settings_xml->{'general'}->{'autohide_time'} ); |
4098 | + } else { |
4099 | + $hide_time->set_value(400); |
4100 | + } |
4101 | + |
4102 | + $tooltips->set_tip( $hide_time_label, $d->get("Configure a short timeout to give the Xserver a chance to redraw areas that were obscured by Shutter's windows before taking a screenshot.") ); |
4103 | + $tooltips->set_tip( $hide_time, $d->get("Configure a short timeout to give the Xserver a chance to redraw areas that were obscured by Shutter's windows before taking a screenshot.") ); |
4104 | + $tooltips->set_tip( $hide_time_vlabel, $d->get("Configure a short timeout to give the Xserver a chance to redraw areas that were obscured by Shutter's windows before taking a screenshot.") ); |
4105 | + |
4106 | + if ( defined $settings_xml->{'general'}->{'present_after'} ) { |
4107 | + $present_after_active->set_active( $settings_xml->{'general'}->{'present_after'} ); |
4108 | + } else { |
4109 | + $present_after_active->set_active(TRUE); |
4110 | + } |
4111 | + |
4112 | + $tooltips->set_tip( $present_after_active, $d->get("Present main window after taking a screenshot") ); |
4113 | + |
4114 | + if ( defined $settings_xml->{'general'}->{'notify_after'} ) { |
4115 | + $notify_after_active->set_active( $settings_xml->{'general'}->{'notify_after'} ); |
4116 | + } else { |
4117 | + $notify_after_active->set_active(TRUE); |
4118 | + } |
4119 | + |
4120 | + $tooltips->set_tip( $notify_after_active, $d->get("Display pop-up notification after taking a screenshot") ); |
4121 | + |
4122 | + if ( defined $settings_xml->{'general'}->{'notify_timeout'} ) { |
4123 | + $notify_timeout_active->set_active( $settings_xml->{'general'}->{'notify_timeout'} ); |
4124 | + } else { |
4125 | + $notify_timeout_active->set_active(TRUE); |
4126 | + } |
4127 | + |
4128 | + $tooltips->set_tip( $notify_timeout_active, $d->get("Display pop-up notification when using a delay") ); |
4129 | + |
4130 | + if ( defined $settings_xml->{'general'}->{'notify_ptimeout'} ) { |
4131 | + $notify_ptimeout_active->set_active( $settings_xml->{'general'}->{'notify_ptimeout'} ); |
4132 | + } else { |
4133 | + $notify_ptimeout_active->set_active(TRUE); |
4134 | + } |
4135 | + |
4136 | + $tooltips->set_tip( $notify_timeout_active, $d->get("Display pop-up notification when using a delay") ); |
4137 | + |
4138 | + if ( defined $settings_xml->{'general'}->{'notify_agent'} ) { |
4139 | + $combobox_ns->set_active( $settings_xml->{'general'}->{'notify_agent'} ); |
4140 | + } else { |
4141 | + $combobox_ns->set_active(TRUE); |
4142 | + } |
4143 | + |
4144 | + $tooltips->set_tip( $ns_label, $d->get("You can either choose the system-wide desktop notifications (e.g. Ubuntu's Notify-OSD) or Shutter's built-in notification system") ); |
4145 | + $tooltips->set_tip( $combobox_ns, $d->get("You can either choose the system-wide desktop notifications (e.g. Ubuntu's Notify-OSD) or Shutter's built-in notification system") ); |
4146 | + |
4147 | + if ( defined $settings_xml->{'general'}->{'close_at_close'} ) { |
4148 | + $close_at_close_active->set_active( $settings_xml->{'general'}->{'close_at_close'} ); |
4149 | + } else { |
4150 | + $close_at_close_active->set_active(TRUE); |
4151 | + } |
4152 | + |
4153 | + $tooltips->set_tip( $close_at_close_active, $d->get("Minimize to tray when closing main window") ); |
4154 | + |
4155 | + if ( defined $settings_xml->{'general'}->{'ask_on_delete'} ) { |
4156 | + $ask_on_delete_active->set_active( $settings_xml->{'general'}->{'ask_on_delete'} ); |
4157 | + } else { |
4158 | + $ask_on_delete_active->set_active(FALSE); |
4159 | + } |
4160 | + |
4161 | + $tooltips->set_tip( $ask_on_delete_active, $d->get("Ask before moving files to trash") ); |
4162 | + |
4163 | + if ( defined $settings_xml->{'general'}->{'delete_on_close'} ) { |
4164 | + $delete_on_close_active->set_active( $settings_xml->{'general'}->{'delete_on_close'} ); |
4165 | + } else { |
4166 | + $delete_on_close_active->set_active(FALSE); |
4167 | + } |
4168 | + |
4169 | + $tooltips->set_tip( $delete_on_close_active, $d->get("Move file to trash when closing tab") ); |
4170 | + |
4171 | + #end - behavior |
4172 | + #-------------------------------------- |
4173 | + |
4174 | + #accounts |
4175 | + #-------------------------------------- |
4176 | + my $accounts_model = undef; |
4177 | + &fct_load_accounts_tree; |
4178 | + |
4179 | + my $accounts_tree = Gtk2::TreeView->new_with_model($accounts_model); |
4180 | + $tooltips->set_tip( |
4181 | + $accounts_tree, |
4182 | + $d->get( |
4183 | + "Entering your Accounts for specific hosting-sites is optional. If entered it will give you the same benefits as the upload on the website. If you leave these fields empty you will be able to upload to the specific hosting-partner as a guest." |
4184 | + ) |
4185 | + ); |
4186 | + |
4187 | + $accounts_tree->signal_connect( |
4188 | + 'row-activated' => \&evt_accounts, |
4189 | + 'row_activated' |
4190 | + ); |
4191 | + |
4192 | + &fct_set_model_accounts($accounts_tree); |
4193 | + |
4194 | + #ftp uri |
4195 | + my $ftp_entry_label = Gtk2::Label->new( $d->get("URI") . ":" ); |
4196 | + |
4197 | + my $ftp_remote_entry = Gtk2::Entry->new; |
4198 | + if ( defined $settings_xml->{'general'}->{'ftp_uri'} ) { |
4199 | + $ftp_remote_entry->set_text( $settings_xml->{'general'}->{'ftp_uri'} ); |
4200 | + } else { |
4201 | + $ftp_remote_entry->set_text("ftp://host:port/path"); |
4202 | + } |
4203 | + |
4204 | + $tooltips->set_tip( $ftp_entry_label, $d->get("URI\nExample: ftp://host:port/path") ); |
4205 | + |
4206 | + $tooltips->set_tip( $ftp_remote_entry, $d->get("URI\nExample: ftp://host:port/path") ); |
4207 | + |
4208 | + $ftp_hbox1->pack_start( $ftp_entry_label, FALSE, TRUE, 12 ); |
4209 | + $ftp_hbox1->pack_start( $ftp_remote_entry, TRUE, TRUE, 0 ); |
4210 | + |
4211 | + #connection mode |
4212 | + my $ftp_mode_label = Gtk2::Label->new( $d->get("Connection mode") . ":" ); |
4213 | + |
4214 | + my $ftp_mode_combo = Gtk2::ComboBox->new_text; |
4215 | + $ftp_mode_combo->insert_text( 0, $d->get("Active mode") ); |
4216 | + $ftp_mode_combo->insert_text( 1, $d->get("Passive mode") ); |
4217 | + if ( defined $settings_xml->{'general'}->{'ftp_mode'} ) { |
4218 | + $ftp_mode_combo->set_active( $settings_xml->{'general'}->{'ftp_mode'} ); |
4219 | + } else { |
4220 | + $ftp_mode_combo->set_active(0); |
4221 | + } |
4222 | + |
4223 | + $tooltips->set_tip( $ftp_mode_label, $d->get("Connection mode") ); |
4224 | + |
4225 | + $tooltips->set_tip( $ftp_mode_combo, $d->get("Connection mode") ); |
4226 | + |
4227 | + $ftp_hbox2->pack_start( $ftp_mode_label, FALSE, TRUE, 12 ); |
4228 | + $ftp_hbox2->pack_start( $ftp_mode_combo, TRUE, TRUE, 0 ); |
4229 | + |
4230 | + #username |
4231 | + my $ftp_username_label = Gtk2::Label->new( $d->get("Username") . ":" ); |
4232 | + |
4233 | + my $ftp_username_entry = Gtk2::Entry->new; |
4234 | + if ( defined $settings_xml->{'general'}->{'ftp_username'} ) { |
4235 | + $ftp_username_entry->set_text( $settings_xml->{'general'}->{'ftp_username'} ); |
4236 | + } else { |
4237 | + $ftp_username_entry->set_text(""); |
4238 | + } |
4239 | + |
4240 | + $tooltips->set_tip( $ftp_username_label, $d->get("Username") ); |
4241 | + |
4242 | + $tooltips->set_tip( $ftp_username_entry, $d->get("Username") ); |
4243 | + |
4244 | + $ftp_hbox3->pack_start( $ftp_username_label, FALSE, TRUE, 12 ); |
4245 | + $ftp_hbox3->pack_start( $ftp_username_entry, TRUE, TRUE, 0 ); |
4246 | + |
4247 | + #password |
4248 | + my $ftp_password_label = Gtk2::Label->new( $d->get("Password") . ":" ); |
4249 | + |
4250 | + my $ftp_password_entry = Gtk2::Entry->new; |
4251 | + $ftp_password_entry->set_invisible_char("*"); |
4252 | + $ftp_password_entry->set_visibility(FALSE); |
4253 | + if ( defined $settings_xml->{'general'}->{'ftp_password'} ) { |
4254 | + $ftp_password_entry->set_text( $settings_xml->{'general'}->{'ftp_password'} ); |
4255 | + } else { |
4256 | + $ftp_password_entry->set_text(""); |
4257 | + } |
4258 | + |
4259 | + $tooltips->set_tip( $ftp_password_label, $d->get("Password") ); |
4260 | + |
4261 | + $tooltips->set_tip( $ftp_password_entry, $d->get("Password") ); |
4262 | + |
4263 | + $ftp_hbox4->pack_start( $ftp_password_label, FALSE, TRUE, 12 ); |
4264 | + $ftp_hbox4->pack_start( $ftp_password_entry, TRUE, TRUE, 0 ); |
4265 | + |
4266 | + #website url |
4267 | + my $ftp_wurl_label = Gtk2::Label->new( $d->get("Website URL") . ":" ); |
4268 | + |
4269 | + my $ftp_wurl_entry = Gtk2::Entry->new; |
4270 | + if ( defined $settings_xml->{'general'}->{'ftp_wurl'} ) { |
4271 | + $ftp_wurl_entry->set_text( $settings_xml->{'general'}->{'ftp_wurl'} ); |
4272 | + } else { |
4273 | + $ftp_wurl_entry->set_text("http://example.com/screenshots"); |
4274 | + } |
4275 | + |
4276 | + $tooltips->set_tip( $ftp_wurl_label, $d->get("Website URL") ); |
4277 | + |
4278 | + $tooltips->set_tip( $ftp_wurl_entry, $d->get("Website URL") ); |
4279 | + |
4280 | + $ftp_hbox5->pack_start( $ftp_wurl_label, FALSE, TRUE, 12 ); |
4281 | + $ftp_hbox5->pack_start( $ftp_wurl_entry, TRUE, TRUE, 0 ); |
4282 | + |
4283 | + #-------------------------------------- |
4284 | + |
4285 | + #packing |
4286 | + #-------------------------------------- |
4287 | + |
4288 | + #settings main tab |
4289 | + my $label_basic = Gtk2::Label->new; |
4290 | + $label_basic->set_markup( $d->get("Main") ); |
4291 | + |
4292 | + $file_vbox->pack_start( $scale_box, TRUE, TRUE, 3 ); |
4293 | + $file_vbox->pack_start( $filetype_box, FALSE, TRUE, 3 ); |
4294 | + $file_frame->add($file_vbox); |
4295 | + |
4296 | + $save_vbox->pack_start( $save_ask_box, TRUE, TRUE, 3 ); |
4297 | + $save_vbox->pack_start( $save_auto_box, TRUE, TRUE, 3 ); |
4298 | + $save_vbox->pack_start( $filename_box, TRUE, TRUE, 3 ); |
4299 | + $save_vbox->pack_start( $saveDir_box, FALSE, TRUE, 3 ); |
4300 | + $save_vbox->pack_start( $filename_hint, TRUE, TRUE, 3 ); |
4301 | + $save_vbox->pack_start( $fname_autocopy_box, TRUE, TRUE, 3 ); |
4302 | + $save_vbox->pack_start( $image_autocopy_box, TRUE, TRUE, 3 ); |
4303 | + $save_vbox->pack_start( $no_autocopy_box, TRUE, TRUE, 3 ); |
4304 | + $save_frame->add($save_vbox); |
4305 | + |
4306 | + $capture_vbox->pack_start( $cursor_box, FALSE, TRUE, 3 ); |
4307 | + $capture_vbox->pack_start( $delay_box, TRUE, TRUE, 3 ); |
4308 | + $capture_frame->add($capture_vbox); |
4309 | + |
4310 | + #all labels = one size |
4311 | + $scale_label->set_alignment( 0, 0.5 ); |
4312 | + $filetype_label->set_alignment( 0, 0.5 ); |
4313 | + $filename_label->set_alignment( 0, 0.5 ); |
4314 | + $saveDir_label->set_alignment( 0, 0.5 ); |
4315 | + |
4316 | + my $sg_main = Gtk2::SizeGroup->new('horizontal'); |
4317 | + $sg_main->add_widget($scale_label); |
4318 | + $sg_main->add_widget($filetype_label); |
4319 | + $sg_main->add_widget($filename_label); |
4320 | + $sg_main->add_widget($saveDir_label); |
4321 | + |
4322 | + $vbox_basic->pack_start( $file_frame, FALSE, TRUE, 3 ); |
4323 | + $vbox_basic->pack_start( $save_frame, FALSE, TRUE, 3 ); |
4324 | + $vbox_basic->pack_start( $capture_frame, FALSE, TRUE, 3 ); |
4325 | + $vbox_basic->set_border_width(5); |
4326 | + |
4327 | + #settings actions tab |
4328 | + my $label_actions = Gtk2::Label->new; |
4329 | + $label_actions->set_markup( $d->get("Actions") ); |
4330 | + |
4331 | + $actions_vbox->pack_start( $progname_box, FALSE, TRUE, 3 ); |
4332 | + $actions_vbox->pack_start( $im_colors_box, FALSE, TRUE, 3 ); |
4333 | + $actions_vbox->pack_start( $thumbnail_box, FALSE, TRUE, 3 ); |
4334 | + $actions_vbox->pack_start( $bordereffect_box, FALSE, TRUE, 3 ); |
4335 | + $actions_frame->add($actions_vbox); |
4336 | + |
4337 | + #all labels = one size |
4338 | + $progname_label->set_alignment( 0, 0.5 ); |
4339 | + $im_colors_label->set_alignment( 0, 0.5 ); |
4340 | + $thumbnail_label->set_alignment( 0, 0.5 ); |
4341 | + $bordereffect_label->set_alignment( 0, 0.5 ); |
4342 | + |
4343 | + my $sg_actions = Gtk2::SizeGroup->new('horizontal'); |
4344 | + $sg_actions->add_widget($progname_label); |
4345 | + $sg_actions->add_widget($im_colors_label); |
4346 | + $sg_actions->add_widget($thumbnail_label); |
4347 | + $sg_actions->add_widget($bordereffect_label); |
4348 | + |
4349 | + $vbox_actions->pack_start( $actions_frame, FALSE, TRUE, 3 ); |
4350 | + $vbox_actions->set_border_width(5); |
4351 | + |
4352 | + #settings advanced tab |
4353 | + my $label_advanced = Gtk2::Label->new; |
4354 | + $label_advanced->set_markup( $d->get("Advanced") ); |
4355 | + |
4356 | + $sel_capture_vbox->pack_start( $zoom_box, FALSE, TRUE, 3 ); |
4357 | + $sel_capture_frame->add($sel_capture_vbox); |
4358 | + |
4359 | + #align labels (asel) |
4360 | + $asel_size_label3->set_alignment( 1, 0.5 ); |
4361 | + |
4362 | + my $sg_asel = Gtk2::SizeGroup->new('horizontal'); |
4363 | + $sg_asel->add_widget($asel_size_label1); |
4364 | + $sg_asel->add_widget($asel_size_label3); |
4365 | + |
4366 | + my $sg_asel2 = Gtk2::SizeGroup->new('horizontal'); |
4367 | + $sg_asel2->add_widget($asel_size_label2); |
4368 | + $sg_asel2->add_widget($asel_size_label4); |
4369 | + |
4370 | + $asel_capture_vbox->pack_start( $as_help_box, FALSE, TRUE, 3 ); |
4371 | + $asel_capture_vbox->pack_start( $asel_isize_box, FALSE, TRUE, 3 ); |
4372 | + $asel_capture_vbox->pack_start( $asel_isize_box2, FALSE, TRUE, 3 ); |
4373 | + $asel_capture_frame->add($asel_capture_vbox); |
4374 | + |
4375 | + $window_capture_vbox->pack_start( $border_box, FALSE, TRUE, 3 ); |
4376 | + $window_capture_vbox->pack_start( $visible_windows_box, FALSE, TRUE, 3 ); |
4377 | + $window_capture_frame->add($window_capture_vbox); |
4378 | + |
4379 | + $menu_capture_vbox->pack_start( $menu_delay_box, TRUE, TRUE, 3 ); |
4380 | + $menu_capture_vbox->pack_start( $menu_waround_box, TRUE, TRUE, 3 ); |
4381 | + $menu_capture_frame->add($menu_capture_vbox); |
4382 | + |
4383 | + $web_capture_vbox->pack_start( $web_width_box, FALSE, TRUE, 3 ); |
4384 | + $web_capture_frame->add($web_capture_vbox); |
4385 | + |
4386 | + #all labels = one size |
4387 | + $menu_delay_label->set_alignment( 0, 0.5 ); |
4388 | + $web_width_label->set_alignment( 0, 0.5 ); |
4389 | + |
4390 | + my $sg_adv = Gtk2::SizeGroup->new('horizontal'); |
4391 | + $sg_adv->add_widget($menu_delay_label); |
4392 | + $sg_adv->add_widget($web_width_label); |
4393 | + |
4394 | + $vbox_advanced->pack_start( $sel_capture_frame, FALSE, TRUE, 3 ); |
4395 | + $vbox_advanced->pack_start( $asel_capture_frame, FALSE, TRUE, 3 ); |
4396 | + $vbox_advanced->pack_start( $window_capture_frame, FALSE, TRUE, 3 ); |
4397 | + $vbox_advanced->pack_start( $menu_capture_frame, FALSE, TRUE, 3 ); |
4398 | + $vbox_advanced->pack_start( $web_capture_frame, FALSE, TRUE, 3 ); |
4399 | + $vbox_advanced->set_border_width(5); |
4400 | + |
4401 | + #settings image view tab |
4402 | + my $label_imageview = Gtk2::Label->new; |
4403 | + $label_imageview->set_markup( $d->get("Image View") ); |
4404 | + |
4405 | + $transparent_vbox->pack_start( $imageview_hbox1, TRUE, TRUE, 3 ); |
4406 | + $transparent_vbox->pack_start( $imageview_hbox2, TRUE, TRUE, 3 ); |
4407 | + $transparent_vbox->pack_start( $imageview_hbox3, TRUE, TRUE, 3 ); |
4408 | + $transparent_frame->add($transparent_vbox); |
4409 | + |
4410 | + $vbox_imageview->pack_start( $transparent_frame, FALSE, TRUE, 3 ); |
4411 | + $vbox_imageview->set_border_width(5); |
4412 | + |
4413 | + #settings behavior tab |
4414 | + my $label_behavior = Gtk2::Label->new; |
4415 | + $label_behavior->set_markup( $d->get("Behavior") ); |
4416 | + |
4417 | + $window_vbox->pack_start( $hide_active_hbox, TRUE, TRUE, 3 ); |
4418 | + $window_vbox->pack_start( $pafter_active_hbox, TRUE, TRUE, 3 ); |
4419 | + $window_vbox->pack_start( $cac_hbox, TRUE, TRUE, 3 ); |
4420 | + $window_vbox->pack_start( $hide_time_hbox, TRUE, TRUE, 3 ); |
4421 | + $window_frame->add($window_vbox); |
4422 | + |
4423 | + $notify_vbox->pack_start( $na_active_hbox, TRUE, TRUE, 3 ); |
4424 | + $notify_vbox->pack_start( $nt_active_hbox, TRUE, TRUE, 3 ); |
4425 | + $notify_vbox->pack_start( $npt_active_hbox, TRUE, TRUE, 3 ); |
4426 | + $notify_vbox->pack_start( $ns_combo_hbox, TRUE, TRUE, 3 ); |
4427 | + $notify_frame->add($notify_vbox); |
4428 | + |
4429 | + $trash_vbox->pack_start( $aod_active_hbox, TRUE, TRUE, 3 ); |
4430 | + $trash_vbox->pack_start( $doc_active_hbox, TRUE, TRUE, 3 ); |
4431 | + $trash_frame->add($trash_vbox); |
4432 | + |
4433 | + #all labels = one size |
4434 | + $hide_time_label->set_alignment( 0, 0.5 ); |
4435 | + |
4436 | + my $sg_behav = Gtk2::SizeGroup->new('horizontal'); |
4437 | + $sg_behav->add_widget($hide_time_label); |
4438 | + |
4439 | + $vbox_behavior->pack_start( $window_frame, FALSE, TRUE, 3 ); |
4440 | + $vbox_behavior->pack_start( $notify_frame, FALSE, TRUE, 3 ); |
4441 | + $vbox_behavior->pack_start( $trash_frame, FALSE, TRUE, 3 ); |
4442 | + $vbox_behavior->set_border_width(5); |
4443 | + |
4444 | + #settings keyboard tab |
4445 | + my $label_keyboard = Gtk2::Label->new; |
4446 | + $label_keyboard->set_markup( $d->get("Keyboard") ); |
4447 | + |
4448 | + #all labels = one size |
4449 | + $capture_label->set_alignment( 0, 0.5 ); |
4450 | + $capture_sel_label->set_alignment( 0, 0.5 ); |
4451 | + |
4452 | + my $sg_key = Gtk2::SizeGroup->new('horizontal'); |
4453 | + $sg_key->add_widget($capture_label); |
4454 | + $sg_key->add_widget($capture_sel_label); |
4455 | + |
4456 | + $keybinding_vbox->pack_start( $key_box, FALSE, TRUE, 3 ); |
4457 | + $keybinding_vbox->pack_start( $key_sel_box, FALSE, TRUE, 3 ); |
4458 | + $keybinding_vbox->pack_start( $keybinding_mode_box, FALSE, TRUE, 3 ); |
4459 | + $keybinding_frame->add($keybinding_vbox); |
4460 | + |
4461 | + $vbox_keyboard->pack_start( $keybinding_frame, FALSE, TRUE, 3 ); |
4462 | + $vbox_keyboard->set_border_width(5); |
4463 | + |
4464 | + #settings upload tab |
4465 | + my $label_accounts = Gtk2::Label->new; |
4466 | + $label_accounts->set_markup( $d->get("Upload") ); |
4467 | + |
4468 | + my $scrolled_accounts_window = Gtk2::ScrolledWindow->new; |
4469 | + $scrolled_accounts_window->set_policy( 'automatic', 'automatic' ); |
4470 | + $scrolled_accounts_window->set_shadow_type('in'); |
4471 | + $scrolled_accounts_window->add($accounts_tree); |
4472 | + $accounts_hbox->pack_start( $scrolled_accounts_window, TRUE, TRUE, 3 ); |
4473 | + $accounts_vbox->pack_start( $accounts_hbox, TRUE, TRUE, 3 ); |
4474 | + $accounts_frame->add($accounts_vbox); |
4475 | + |
4476 | + $ftp_vbox->pack_start( $ftp_hbox1, FALSE, TRUE, 3 ); |
4477 | + $ftp_vbox->pack_start( $ftp_hbox2, FALSE, TRUE, 3 ); |
4478 | + $ftp_vbox->pack_start( $ftp_hbox3, FALSE, TRUE, 3 ); |
4479 | + $ftp_vbox->pack_start( $ftp_hbox4, FALSE, TRUE, 3 ); |
4480 | + $ftp_vbox->pack_start( $ftp_hbox5, FALSE, TRUE, 3 ); |
4481 | + $ftp_frame->add($ftp_vbox); |
4482 | + |
4483 | + #all labels = one size |
4484 | + $ftp_entry_label->set_alignment( 0, 0.5 ); |
4485 | + $ftp_mode_label->set_alignment( 0, 0.5 ); |
4486 | + $ftp_username_label->set_alignment( 0, 0.5 ); |
4487 | + $ftp_password_label->set_alignment( 0, 0.5 ); |
4488 | + $ftp_wurl_label->set_alignment( 0, 0.5 ); |
4489 | + |
4490 | + my $sg_acc = Gtk2::SizeGroup->new('horizontal'); |
4491 | + $sg_acc->add_widget($ftp_entry_label); |
4492 | + $sg_acc->add_widget($ftp_mode_label); |
4493 | + $sg_acc->add_widget($ftp_username_label); |
4494 | + $sg_acc->add_widget($ftp_password_label); |
4495 | + $sg_acc->add_widget($ftp_wurl_label); |
4496 | + |
4497 | + $vbox_accounts->pack_start( $accounts_frame, TRUE, TRUE, 3 ); |
4498 | + $vbox_accounts->pack_start( $ftp_frame, FALSE, TRUE, 3 ); |
4499 | + $vbox_accounts->set_border_width(5); |
4500 | + |
4501 | + #append pages to notebook |
4502 | + $notebook_settings->append_page( $vbox_basic, $label_basic ); |
4503 | + $notebook_settings->append_page( $vbox_advanced, $label_advanced ); |
4504 | + $notebook_settings->append_page( $vbox_actions, $label_actions ); |
4505 | + $notebook_settings->append_page( $vbox_imageview, $label_imageview ); |
4506 | + $notebook_settings->append_page( $vbox_behavior, $label_behavior ); |
4507 | + $notebook_settings->append_page( $vbox_keyboard, $label_keyboard ); |
4508 | + $notebook_settings->append_page( $vbox_accounts, $label_accounts ); |
4509 | + |
4510 | + #plugins |
4511 | + #not used in a standalone environment |
4512 | + if ( keys(%plugins) > 0 && !$ENV{PAR_TEMP} ) { |
4513 | + |
4514 | + my $effects_tree = Gtk2::TreeView->new_with_model(&fct_load_plugin_tree); |
4515 | + &fct_set_model_plugins($effects_tree); |
4516 | + |
4517 | + my $scrolled_plugins_window = Gtk2::ScrolledWindow->new; |
4518 | + $scrolled_plugins_window->set_policy( 'automatic', 'automatic' ); |
4519 | + $scrolled_plugins_window->set_shadow_type('in'); |
4520 | + $scrolled_plugins_window->add($effects_tree); |
4521 | + |
4522 | + my $label_plugins = Gtk2::Label->new; |
4523 | + $label_plugins->set_markup( $d->get("Plugins") ); |
4524 | + |
4525 | + my $label_treeview = Gtk2::Label->new( $d->get("The following plugins are installed") ); |
4526 | + $label_treeview->set_alignment( 0, 0.5 ); |
4527 | + $effects_vbox->pack_start( $label_treeview, FALSE, TRUE, 1 ); |
4528 | + $effects_vbox->pack_start( $scrolled_plugins_window, TRUE, TRUE, 1 ); |
4529 | + |
4530 | + my $vbox_plugins = Gtk2::VBox->new( FALSE, 12 ); |
4531 | + $vbox_plugins->set_border_width(5); |
4532 | + $vbox_plugins->pack_start( $effects_vbox, TRUE, TRUE, 1 ); |
4533 | + |
4534 | + $notebook_settings->append_page( $vbox_plugins, $label_plugins ); |
4535 | + } |
4536 | + |
4537 | + #profiles |
4538 | + $profiles_box->pack_start( Gtk2::Label->new( $d->get("Profile") . ":" ), FALSE, TRUE, 1 ); |
4539 | + $profiles_box->pack_start( $combobox_settings_profiles, TRUE, TRUE, 6 ); |
4540 | + $profiles_box->pack_start( $button_profile_save, FALSE, TRUE, 1 ); |
4541 | + $profiles_box->pack_start( $button_profile_delete, FALSE, TRUE, 1 ); |
4542 | + $profiles_box->pack_start( $button_profile_apply, FALSE, TRUE, 1 ); |
4543 | + |
4544 | + $vbox_settings->pack_start( $profiles_box, FALSE, TRUE, 1 ); |
4545 | + $vbox_settings->pack_start( $notebook_settings, TRUE, TRUE, 1 ); |
4546 | + |
4547 | + #settings |
4548 | + $hbox_settings->pack_start( $vbox_settings, TRUE, TRUE, 6 ); |
4549 | + $settings_dialog->vbox->add($hbox_settings); |
4550 | + $settings_dialog->set_default_response('apply'); |
4551 | + |
4552 | + #~ #iconview |
4553 | + #~ my $iconview = Gtk2::IconView->new_with_model($session_start_screen{'first_page'}->{'model'}); |
4554 | + #~ $iconview->set_item_width (150); |
4555 | + #~ $iconview->set_pixbuf_column(0); |
4556 | + #~ $iconview->set_text_column(1); |
4557 | + #~ $iconview->set_selection_mode('multiple'); |
4558 | + #~ $iconview->signal_connect( 'selection-changed', \&evt_iconview_sel_changed ); |
4559 | + #~ $iconview->signal_connect( 'item-activated', \&evt_iconview_item_activated ); |
4560 | + #~ |
4561 | + #~ my $scrolled_window_view = Gtk2::ScrolledWindow->new; |
4562 | + #~ $scrolled_window_view->set_policy( 'automatic', 'automatic' ); |
4563 | + #~ $scrolled_window_view->set_shadow_type('in'); |
4564 | + #~ $scrolled_window_view->add($iconview); |
4565 | + #~ |
4566 | + #~ #add an event box to show a context menu on right-click |
4567 | + #~ my $view_event = Gtk2::EventBox->new; |
4568 | + #~ $view_event->add($scrolled_window_view); |
4569 | + #~ $view_event->signal_connect( 'button-press-event', \&evt_iconview_button_press, $iconview ); |
4570 | + #~ |
4571 | + #~ |
4572 | + #~ #pack notebook and iconview into vpaned# |
4573 | + #~ my $vpaned = Gtk2::VPaned->new; |
4574 | + #~ $vpaned->add1($notebook); |
4575 | + #~ $vpaned->add2($view_event); |
4576 | + #~ |
4577 | + #~ #vpaned into vbox |
4578 | + #~ $vbox->pack_start( $vpaned, TRUE, TRUE, 0 ); |
4579 | + |
4580 | + #notebook |
4581 | + $vbox->pack_start( $notebook, TRUE, TRUE, 0 ); |
4582 | + |
4583 | + #bottom toolbar |
4584 | + my $nav_toolbar = $st->create_btoolbar; |
4585 | + $vbox->pack_start( $nav_toolbar, FALSE, TRUE, 0 ); |
4586 | + |
4587 | + #signal handler |
4588 | + $st->{_back}->signal_connect( 'clicked' => sub { |
4589 | + $notebook->prev_page; |
4590 | + } |
4591 | + ); |
4592 | + $st->{_forw}->signal_connect( 'clicked' => sub{ |
4593 | + $notebook->next_page; |
4594 | + } |
4595 | + ); |
4596 | + $st->{_home}->signal_connect( 'clicked' => sub { |
4597 | + $notebook->set_current_page(0); |
4598 | + } |
4599 | + ); |
4600 | + |
4601 | + #pack statusbar |
4602 | + $status->pack_start( $cursor_status_active, FALSE, FALSE, 0 ); |
4603 | + $status->pack_start( Gtk2::HSeparator->new , FALSE, FALSE, 6 ); |
4604 | + |
4605 | + $status->pack_start( $delay_status_label, FALSE, FALSE, 0 ); |
4606 | + $status->pack_start( $delay_status, FALSE, FALSE, 0 ); |
4607 | + $status->pack_start( Gtk2::HSeparator->new , FALSE, FALSE, 6 ); |
4608 | + |
4609 | + $vbox->pack_start( $status, FALSE, FALSE, 0 ); |
4610 | + |
4611 | + #-------------------------------------- |
4612 | + |
4613 | + #restore session |
4614 | + #-------------------------------------- |
4615 | + &fct_load_session; |
4616 | + |
4617 | + #open init files (cmd arguments) |
4618 | + #-------------------------------------- |
4619 | + if(scalar @init_files > 0){ |
4620 | + &fct_open_files(@init_files); |
4621 | + } |
4622 | + |
4623 | + #unblock controls |
4624 | + &fct_control_signals('unblock'); |
4625 | + |
4626 | + #start minimized? |
4627 | + #-------------------------------------- |
4628 | + unless ( $sc->get_min ) { |
4629 | + &fct_control_main_window ('show'); |
4630 | + } else { |
4631 | + &fct_control_main_window ('hide'); |
4632 | + } |
4633 | + |
4634 | + #restore menu/toolbar settings |
4635 | + #-------------------------------------- |
4636 | + if(defined $settings_xml->{'gui'}->{'btoolbar_active'}){ |
4637 | + $sm->{_menuitem_btoolbar}->set_active($settings_xml->{'gui'}->{'btoolbar_active'}); |
4638 | + }else{ |
4639 | + $sm->{_menuitem_btoolbar}->set_active(FALSE); |
4640 | + } |
4641 | + |
4642 | + #-------------------------------------- |
4643 | + |
4644 | + #FIXME |
4645 | + #this is an ugly fix when 'tranparent parts' is set to background |
4646 | + #we don't get the corret background color until the main window is shown |
4647 | + #so we change it now |
4648 | + if($trans_backg->get_active){ |
4649 | + &evt_value_changed (undef, 'transp_toggled'); |
4650 | + } |
4651 | + |
4652 | + #update the first tab on startup |
4653 | + &fct_update_info_and_tray(); |
4654 | + |
4655 | + #load saved settings |
4656 | + #-------------------------------------- |
4657 | + my $folder_to_save = $settings_xml->{'general'}->{'folder'} || $ENV{'HOME'}; |
4658 | + my ($cmdname, $extra) = $sc->get_start_with; |
4659 | + if ( $cmdname && $folder_to_save ) { |
4660 | + &evt_take_screenshot( 'global_keybinding', $cmdname, $folder_to_save, $extra ); |
4661 | + } |
4662 | + |
4663 | + Gtk2->main; |
4664 | + |
4665 | + 0; |
4666 | + |
4667 | + #events |
4668 | + #-------------------------------------- |
4669 | + sub evt_value_changed { |
4670 | + my ( $widget, $data ) = @_; |
4671 | + print "\n$data was emitted by widget $widget\n" |
4672 | + if $sc->get_debug; |
4673 | + |
4674 | + return FALSE unless $data; |
4675 | + |
4676 | + #checkbox for "open with" -> entry active/inactive |
4677 | + if ( $data eq "progname_toggled" ) { |
4678 | + if ( $progname_active->get_active ) { |
4679 | + $progname->set_sensitive(TRUE); |
4680 | + } else { |
4681 | + $progname->set_sensitive(FALSE); |
4682 | + } |
4683 | + } |
4684 | + |
4685 | + #checkbox for "color depth" -> entry active/inactive |
4686 | + if ( $data eq "im_colors_toggled" ) { |
4687 | + if ( $im_colors_active->get_active ) { |
4688 | + $combobox_im_colors->set_sensitive(TRUE); |
4689 | + } else { |
4690 | + $combobox_im_colors->set_sensitive(FALSE); |
4691 | + } |
4692 | + } |
4693 | + |
4694 | + #radiobuttons for "transparent parts" |
4695 | + if ( $data eq "transp_toggled" ) { |
4696 | + |
4697 | + #Sets how the view should draw transparent parts of images with an alpha channel |
4698 | + my $color = $trans_custom_btn->get_color; |
4699 | + my $color_string = sprintf( "%02x%02x%02x", $color->red / 257, $color->green / 257, $color->blue / 257 ); |
4700 | + |
4701 | + my $mode; |
4702 | + if ( $trans_check->get_active ) { |
4703 | + $mode = 'grid'; |
4704 | + }elsif ( $trans_custom->get_active ) { |
4705 | + $mode = 'color'; |
4706 | + }elsif ( $trans_backg->get_active ) { |
4707 | + $mode = 'color'; |
4708 | + my $bg = $window->get_style->bg('normal'); |
4709 | + $color_string = sprintf( "%02x%02x%02x", $bg->red / 257, $bg->green / 257, $bg->blue / 257 ); |
4710 | + } |
4711 | + |
4712 | + #change all imageviews in session |
4713 | + foreach my $key (keys %session_screens){ |
4714 | + if($session_screens{$key}->{'image'}){ |
4715 | + $session_screens{$key}->{'image'}->set_transp($mode, hex $color_string); |
4716 | + } |
4717 | + } |
4718 | + |
4719 | + } |
4720 | + |
4721 | + #"save" toggled |
4722 | + if ( $data eq "save_toggled" ) { |
4723 | + $filename_label->set_sensitive($save_auto_active->get_active); |
4724 | + $filename->set_sensitive($save_auto_active->get_active); |
4725 | + $saveDir_label->set_sensitive($save_auto_active->get_active); |
4726 | + $saveDir_label->set_sensitive($save_auto_active->get_active); |
4727 | + $saveDir_button->set_sensitive($save_auto_active->get_active); |
4728 | + } |
4729 | + |
4730 | + #"cursor_status" toggled |
4731 | + if ( $data eq "cursor_status_toggled" ) { |
4732 | + $cursor_active->set_active($cursor_status_active->get_active); |
4733 | + } |
4734 | + |
4735 | + #"cursor" toggled |
4736 | + if ( $data eq "cursor_toggled" ) { |
4737 | + $cursor_status_active->set_active($cursor_active->get_active); |
4738 | + } |
4739 | + |
4740 | + #value for "delay" -> update text |
4741 | + if ( $data eq "delay_changed" ) { |
4742 | + $delay_status->set_value($delay->get_value); |
4743 | + $delay_vlabel->set_text($d->nget("second", "seconds", $delay->get_value) ); |
4744 | + } |
4745 | + |
4746 | + #value for "delay" -> update text |
4747 | + if ( $data eq "delay_status_changed" ) { |
4748 | + $delay->set_value($delay_status->get_value); |
4749 | + $delay_status_vlabel->set_text($d->nget("second", "seconds", $delay_status->get_value) ); |
4750 | + } |
4751 | + |
4752 | + #value for "menu_delay" -> update text |
4753 | + if ( $data eq "menu_delay_changed" ) { |
4754 | + $menu_delay_vlabel->set_text( $d->nget("second", "seconds", $menu_delay->get_value) ); |
4755 | + } |
4756 | + |
4757 | + #value for "hide_time" -> update text |
4758 | + if ( $data eq "hide_time_changed" ) { |
4759 | + $hide_time_vlabel->set_text( $d->nget("millisecond", "milliseconds", $hide_time->get_value) ); |
4760 | + } |
4761 | + |
4762 | + #checkbox for "thumbnail" -> HScale active/inactive |
4763 | + if ( $data eq "thumbnail_toggled" ) { |
4764 | + if ( $thumbnail_active->get_active ) { |
4765 | + $thumbnail->set_sensitive(TRUE); |
4766 | + } else { |
4767 | + $thumbnail->set_sensitive(FALSE); |
4768 | + } |
4769 | + } |
4770 | + |
4771 | + #quality value changed |
4772 | + if ( $data eq "qvalue_changed" ) { |
4773 | + my $settings = undef; |
4774 | + if(defined $sc->get_globalsettings_object){ |
4775 | + $settings = $sc->get_globalsettings_object; |
4776 | }else{ |
4777 | - #close last message with a short delay (less than a second) |
4778 | - Glib::Timeout->add (500, sub{ |
4779 | - $notify->close; |
4780 | - return FALSE; |
4781 | - }); |
4782 | - } |
4783 | - }#notify not activated |
4784 | - |
4785 | - #A short timeout to give the server a chance to |
4786 | - #redraw the area that was obscured by our dialog. |
4787 | - Glib::Timeout->add ($menu_delay->get_value * 1000, sub{ |
4788 | - &fct_take_screenshot($widget, $data, $folder_from_config); |
4789 | + $settings = Shutter::App::GlobalSettings->new(); |
4790 | + $sc->set_globalsettings_object($settings); |
4791 | + } |
4792 | + if ( $combobox_type->get_active_text =~ /jpeg/ ) { |
4793 | + $settings->set_jpg_quality($scale->get_value); |
4794 | + } elsif ( $combobox_type->get_active_text =~ /png/ ) { |
4795 | + $settings->set_png_quality($scale->get_value); |
4796 | + } else { |
4797 | + $settings->clear_quality_settings(); |
4798 | + } |
4799 | + } |
4800 | + |
4801 | + #checkbox for "bordereffect" -> HScale active/inactive |
4802 | + if ( $data eq "bordereffect_toggled" ) { |
4803 | + if ( $bordereffect_active->get_active ) { |
4804 | + $bordereffect->set_sensitive(TRUE); |
4805 | + } else { |
4806 | + $bordereffect->set_sensitive(FALSE); |
4807 | + } |
4808 | + } |
4809 | + |
4810 | + #value for "bordereffect" -> update text |
4811 | + if ( $data eq "bordereffect_changed" ) { |
4812 | + $bordereffect_vlabel->set_text( $d->nget("pixel", "pixels", $bordereffect->get_value) ); |
4813 | + } |
4814 | + |
4815 | + #filetype changed |
4816 | + if ( $data eq "type_changed" ) { |
4817 | + if ( $combobox_type->get_active_text =~ /jpeg/ ) { |
4818 | + $scale->set_sensitive(TRUE); |
4819 | + $scale_label->set_sensitive(TRUE); |
4820 | + $scale->set_range( 1, 100 ); |
4821 | + $scale->set_value(90); |
4822 | + $scale_label->set_text( $d->get("Quality") . ":" ); |
4823 | + } elsif ( $combobox_type->get_active_text =~ /png/ ) { |
4824 | + $scale->set_sensitive(TRUE); |
4825 | + $scale_label->set_sensitive(TRUE); |
4826 | + $scale->set_range( 0, 9 ); |
4827 | + $scale->set_value(9); |
4828 | + $scale_label->set_text( $d->get("Compression") . ":" ); |
4829 | + } else { |
4830 | + $scale->set_sensitive(FALSE); |
4831 | + $scale_label->set_sensitive(FALSE); |
4832 | + } |
4833 | + } |
4834 | + |
4835 | + #notify agent changed |
4836 | + if ( $data eq "ns_changed" ) { |
4837 | + if ( $combobox_ns->get_active == 0 ) { |
4838 | + $sc->set_notification_object(Shutter::App::Notification->new); |
4839 | + } else { |
4840 | + $sc->set_notification_object(Shutter::App::ShutterNotification->new($sc)); |
4841 | + } |
4842 | + } |
4843 | + |
4844 | + return TRUE; |
4845 | + } |
4846 | + |
4847 | + sub evt_take_screenshot { |
4848 | + my ( $widget, $data, $folder_from_config, $extra ) = @_; |
4849 | + |
4850 | + #get xid if any window was selected from the submenu... |
4851 | + my $selfcapture = FALSE; |
4852 | + if ( $data =~ /^shutter_window_direct(.*)/ ) { |
4853 | + my $xid = $1; |
4854 | + $selfcapture = TRUE if $xid == $window->window->XID; |
4855 | + } |
4856 | + |
4857 | + #hide mainwindow |
4858 | + if ( $hide_active->get_active && $data ne "web" && $data ne "tray_web" |
4859 | + && !$is_hidden |
4860 | + && !$selfcapture ) { |
4861 | + |
4862 | + &fct_control_main_window('hide'); |
4863 | + |
4864 | + }else{ |
4865 | + |
4866 | + #save current position of main window |
4867 | + ( $window->{x}, $window->{y} ) = $window->get_position; |
4868 | + |
4869 | + } |
4870 | + |
4871 | + #close last message displayed |
4872 | + my $notify = $sc->get_notification_object; |
4873 | + $notify->close; |
4874 | + |
4875 | + #disable signal-handler |
4876 | + &fct_control_signals('block'); |
4877 | + |
4878 | + if ( $data eq "web" || $data eq "tray_web" ){ |
4879 | + &fct_take_screenshot($widget, $data, $folder_from_config, $extra); |
4880 | #unblock signal handler |
4881 | &fct_control_signals('unblock'); |
4882 | - return FALSE; |
4883 | - }); |
4884 | - }else{ |
4885 | - #A short timeout to give the server a chance to |
4886 | - #redraw the area that was obscured by our dialog. |
4887 | - if($hide_active->get_active){ |
4888 | - Glib::Timeout->add ($hide_time->get_value, sub{ |
4889 | - &fct_take_screenshot($widget, $data, $folder_from_config); |
4890 | + }elsif ( $data eq "menu" || |
4891 | + $data eq "tray_menu" || |
4892 | + $data eq "tooltip" || |
4893 | + $data eq "tray_tooltip" ){ |
4894 | + |
4895 | + my $scd_text; |
4896 | + if ( $data eq "menu" || $data eq "tray_menu" ) { |
4897 | + $scd_text = $d->get("Please activate the menu you want to capture"); |
4898 | + }elsif( $data eq "tooltip" || $data eq "tray_tooltip" ) { |
4899 | + $scd_text = $d->get("Please activate the tooltip you want to capture"); |
4900 | + } |
4901 | + |
4902 | + #show notification messages displaying the countdown |
4903 | + if($notify_ptimeout_active->get_active){ |
4904 | + my $notify = $sc->get_notification_object; |
4905 | + my $ttw = $menu_delay->get_value; |
4906 | + |
4907 | + #first notification immediately |
4908 | + $notify->show( sprintf($d->nget("Screenshot will be taken in %s second", "Screenshot will be taken in %s seconds", $ttw) , $ttw), |
4909 | + $scd_text |
4910 | + ); |
4911 | + $ttw--; |
4912 | + |
4913 | + #delay is only 1 second |
4914 | + #do not show any further messages |
4915 | + if($ttw >= 1){ |
4916 | + #then controlled via timeout |
4917 | + Glib::Timeout->add (1000, sub{ |
4918 | + $notify->show( sprintf($d->nget("Screenshot will be taken in %s second", "Screenshot will be taken in %s seconds", $ttw) , $ttw), |
4919 | + $scd_text |
4920 | + ); |
4921 | + $ttw--; |
4922 | + if($ttw == 0){ |
4923 | + |
4924 | + #close last message with a short delay (less than a second) |
4925 | + Glib::Timeout->add (500, sub{ |
4926 | + $notify->close; |
4927 | + return FALSE; |
4928 | + }); |
4929 | + |
4930 | + return FALSE; |
4931 | + |
4932 | + }else{ |
4933 | + |
4934 | + return TRUE; |
4935 | + |
4936 | + } |
4937 | + }); |
4938 | + }else{ |
4939 | + #close last message with a short delay (less than a second) |
4940 | + Glib::Timeout->add (500, sub{ |
4941 | + $notify->close; |
4942 | + return FALSE; |
4943 | + }); |
4944 | + } |
4945 | + }#notify not activated |
4946 | + |
4947 | + #A short timeout to give the server a chance to |
4948 | + #redraw the area that was obscured by our dialog. |
4949 | + Glib::Timeout->add ($menu_delay->get_value * 1000, sub{ |
4950 | + &fct_take_screenshot($widget, $data, $folder_from_config, $extra); |
4951 | #unblock signal handler |
4952 | &fct_control_signals('unblock'); |
4953 | return FALSE; |
4954 | }); |
4955 | }else{ |
4956 | - &fct_take_screenshot($widget, $data, $folder_from_config); |
4957 | - #unblock signal handler |
4958 | - &fct_control_signals('unblock'); |
4959 | - } |
4960 | - } |
4961 | - |
4962 | - |
4963 | - return TRUE; |
4964 | -} |
4965 | - |
4966 | -sub evt_behavior_handle { |
4967 | - my ( $widget, $data ) = @_; |
4968 | - print "\n$data was emitted by widget $widget\n" |
4969 | - if $sc->get_debug; |
4970 | - |
4971 | - #checkbox for "keybinding" -> entry active/inactive |
4972 | - if ( $data eq "keybinding_toggled" ) { |
4973 | - if ( $keybinding_active->get_active ) { |
4974 | - $capture_key->set_sensitive(TRUE); |
4975 | - } else { |
4976 | - $capture_key->set_sensitive(FALSE); |
4977 | - } |
4978 | - } |
4979 | - |
4980 | - #checkbox for "keybinding_sel" -> entry active/inactive |
4981 | - if ( $data eq "keybinding_sel_toggled" ) { |
4982 | - if ( $keybinding_sel_active->get_active ) { |
4983 | - $capture_sel_key->set_sensitive(TRUE); |
4984 | - $combobox_keybinding_mode->set_sensitive(TRUE); |
4985 | - } else { |
4986 | - $capture_sel_key->set_sensitive(FALSE); |
4987 | - $combobox_keybinding_mode->set_sensitive(FALSE); |
4988 | - } |
4989 | - } |
4990 | - |
4991 | - return TRUE; |
4992 | -} |
4993 | - |
4994 | -sub evt_notebook_switch { |
4995 | - my ( $widget, $pointer, $int ) = @_; |
4996 | - |
4997 | - my $key = &fct_get_file_by_index($int); |
4998 | - if($key){ |
4999 | - |
5000 | - foreach (keys %session_screens){ |
The diff has been truncated for viewing.