… | |
… | |
70 | } else { |
70 | } else { |
71 | &std_keys |
71 | &std_keys |
72 | or $schnauzer->signal_emit (key_press_event => $_[1]) |
72 | or $schnauzer->signal_emit (key_press_event => $_[1]) |
73 | } |
73 | } |
74 | }); |
74 | }); |
|
|
75 | $self->signal_connect (delete_event => sub { $_[0]->destroy; 0 }); |
75 | $self->signal_connect (destroy => sub { |
76 | $self->signal_connect (destroy => sub { |
76 | $viewer = undef if $viewer == $_[0]; |
77 | $viewer = undef if $viewer == $_[0]; |
77 | |
78 | |
78 | main_quit Gtk2 unless --$viewer_count; |
79 | main_quit Gtk2 unless --$viewer_count; |
|
|
80 | |
|
|
81 | 0 |
79 | }); |
82 | }); |
80 | |
83 | |
81 | $self->signal_connect (button3_press_event => sub { |
84 | $self->signal_connect (button3_press_event => sub { |
82 | $mainwin->visible |
85 | $mainwin->visible |
83 | ? $mainwin->hide |
86 | ? $mainwin->hide |
84 | : $mainwin->show_all; |
87 | : $mainwin->show_all; |
|
|
88 | |
85 | 1 |
89 | 1 |
86 | }); |
90 | }); |
87 | |
91 | |
88 | Gtk2::CV::Plugin->call (new_imagewindow => $self); |
92 | Gtk2::CV::Plugin->call (new_imagewindow => $self); |
89 | |
93 | |
… | |
… | |
99 | if ($key == $Gtk2::Gdk::Keysyms{q}) { |
103 | if ($key == $Gtk2::Gdk::Keysyms{q}) { |
100 | $viewer->destroy; |
104 | $viewer->destroy; |
101 | } elsif ($ctrl && $key == $Gtk2::Gdk::Keysyms{v}) { |
105 | } elsif ($ctrl && $key == $Gtk2::Gdk::Keysyms{v}) { |
102 | my $w = new Gtk2::Window; |
106 | my $w = new Gtk2::Window; |
103 | |
107 | |
|
|
108 | $w->set_role ("schnauzer"); |
104 | $w->set_title ("CV: Schnauzer"); |
109 | $w->set_title ("CV: Schnauzer"); |
105 | $w->add (my $s = new_schnauzer); |
110 | $w->add (my $s = new_schnauzer); |
106 | $s->set_dir (File::Spec->curdir); |
111 | $s->set_dir (File::Spec->curdir); |
107 | $s->set_geometry_hints; |
112 | $s->set_geometry_hints; |
108 | $w->show_all; |
113 | $w->show_all; |
… | |
… | |
110 | } elsif ($ctrl && $key == $Gtk2::Gdk::Keysyms{h}) { |
115 | } elsif ($ctrl && $key == $Gtk2::Gdk::Keysyms{h}) { |
111 | unless ($help) { |
116 | unless ($help) { |
112 | require Gtk2::PodViewer; |
117 | require Gtk2::PodViewer; |
113 | |
118 | |
114 | $help = new Gtk2::Window; |
119 | $help = new Gtk2::Window; |
|
|
120 | $help->set_role ("help"); |
115 | $help->set_title ("CV: Help"); |
121 | $help->set_title ("CV: Help"); |
116 | $help->set_default_size (500, 300); |
122 | $help->set_default_size (500, 300); |
117 | $help->signal_connect (delete_event => sub { $help->hide; 1 }); |
123 | $help->signal_connect (delete_event => sub { $help->hide; 1 }); |
118 | |
124 | |
119 | $help->add (my $sw = new Gtk2::ScrolledWindow); |
125 | $help->add (my $sw = new Gtk2::ScrolledWindow); |
… | |
… | |
136 | $::cur_viewer = $viewer; |
142 | $::cur_viewer = $viewer; |
137 | |
143 | |
138 | $schnauzer = new_schnauzer; |
144 | $schnauzer = new_schnauzer; |
139 | |
145 | |
140 | $mainwin = new Gtk2::Window; |
146 | $mainwin = new Gtk2::Window; |
|
|
147 | $mainwin->set_role ("main"); |
141 | $mainwin->set_title ("CV"); |
148 | $mainwin->set_title ("CV"); |
142 | $mainwin->add (my $vbox = new Gtk2::VBox); |
149 | $mainwin->add (my $vbox = new Gtk2::VBox); |
143 | $mainwin->signal_connect (delete_event => sub { $mainwin->hide; 1 }); |
150 | $mainwin->signal_connect (delete_event => sub { $mainwin->hide; 1 }); |
144 | |
151 | |
145 | $vbox->add ($schnauzer); |
152 | $vbox->add ($schnauzer); |
… | |
… | |
153 | |
160 | |
154 | $schnauzer->set_geometry_hints; |
161 | $schnauzer->set_geometry_hints; |
155 | } |
162 | } |
156 | |
163 | |
157 | if (@ARGV) { |
164 | if (@ARGV) { |
|
|
165 | my $show_first = sub { |
|
|
166 | $schnauzer->show_all; |
|
|
167 | $schnauzer->handle_key ($Gtk2::Gdk::Keysyms{space}, []); |
|
|
168 | $viewer->show_all; |
|
|
169 | }; |
|
|
170 | |
158 | @ARGV == 1 && -d $ARGV[0] |
171 | @ARGV == 1 && -d $ARGV[0] |
159 | ? $schnauzer->set_dir (Glib::filename_to_unicode shift) |
172 | ? $schnauzer->set_dir (Glib::filename_to_unicode shift, $show_first) |
160 | : $schnauzer->set_paths ([map Glib::filename_to_unicode $_, @ARGV]); |
173 | : $schnauzer->set_paths ([map Glib::filename_to_unicode $_, @ARGV], 1, $show_first); |
161 | $schnauzer->show_all; |
|
|
162 | $schnauzer->handle_key ($Gtk2::Gdk::Keysyms{space}, []); |
|
|
163 | } else { |
174 | } else { |
164 | $schnauzer->set_dir (File::Spec->curdir); |
175 | $schnauzer->set_dir (File::Spec->curdir, sub { |
165 | $mainwin->show_all; |
176 | $mainwin->show_all; |
166 | } |
|
|
167 | |
|
|
168 | $viewer->show_all; |
177 | $viewer->show_all; |
|
|
178 | }); |
|
|
179 | } |
169 | |
180 | |
170 | main Gtk2; |
181 | main Gtk2; |
|
|
182 | |
|
|
183 | Gtk2::CV::flush_aio; |
171 | |
184 | |
172 | __DATA__ |
185 | __DATA__ |
173 | |
186 | |
174 | =encoding utf-8 |
187 | =encoding utf-8 |
175 | |
188 | |
… | |
… | |
292 | r set scaling mode to 'nearest' (fastest) |
305 | r set scaling mode to 'nearest' (fastest) |
293 | s set scaling mode to 'bilinear' (default) |
306 | s set scaling mode to 'bilinear' (default) |
294 | shift-s set scaling mode to 'hyper' (slowest) |
307 | shift-s set scaling mode to 'hyper' (slowest) |
295 | t rotate clockwise 90° |
308 | t rotate clockwise 90° |
296 | T rotate counterclockwise° |
309 | T rotate counterclockwise° |
|
|
310 | a apply all rotations loslessly to a jpeg file (using exiftran) |
297 | ctrl-v open a new visual schnauzer window for the current dir |
311 | ctrl-v open a new visual schnauzer window for the current dir |
|
|
312 | ctrl-c clone the current image window |
298 | ctrl-e run an editor ($CV_EDITOR or "gimp") on the current image |
313 | ctrl-e run an editor ($CV_EDITOR or "gimp") on the current image |
299 | ctrl-p fire up the print dialog |
314 | ctrl-p fire up the print dialog |
300 | escape cancel a crop action |
315 | escape cancel a crop action |
301 | |
316 | |
302 | And when playing movies, these additional keys are active: |
317 | And when playing movies, these additional keys are active: |
… | |
… | |
319 | Left-clicking into the image window will let you crop the image (usually |
334 | Left-clicking into the image window will let you crop the image (usually |
320 | to zoom into large images that CV scales down). |
335 | to zoom into large images that CV scales down). |
321 | |
336 | |
322 | =head2 THE VISUAL SCHNAUZER |
337 | =head2 THE VISUAL SCHNAUZER |
323 | |
338 | |
|
|
339 | Any image-loading action in a schnauzer window acts on the |
|
|
340 | "last-recently-activated" imagewindow, which currently is simply the last |
|
|
341 | image window that received a keypress. |
|
|
342 | |
324 | You can use the following keys in the schnauzer window: |
343 | You can use the following keys in the schnauzer window: |
325 | |
344 | |
326 | ctrl-space, |
345 | ctrl-space, |
327 | space move to and display next image |
346 | space move to and display next image |
328 | ctrl-backspace, |
347 | ctrl-backspace, |
… | |
… | |
409 | =item CV_EDITOR |
428 | =item CV_EDITOR |
410 | |
429 | |
411 | The program that gets executed when the user presses C<CTRL-e> in the |
430 | The program that gets executed when the user presses C<CTRL-e> in the |
412 | Schnauzer or image window. The default is C<gimp>. |
431 | Schnauzer or image window. The default is C<gimp>. |
413 | |
432 | |
|
|
433 | =item CV_AUDIO_PLAYER |
|
|
434 | |
|
|
435 | Program used to play all sorts of audio (wav, aif, mp3, ogg...), default "play". |
|
|
436 | Will be called like C<< $CV_AUDIO_PLAYER -- <path> >>. |
|
|
437 | |
414 | =item CV_PRINT_DESTINATION |
438 | =item CV_PRINT_DESTINATION |
415 | |
439 | |
416 | The default (perl-style) destination to use in the print dialog. |
440 | The default (perl-style) destination to use in the print dialog. |
417 | |
441 | |
418 | =item CV_TRASHCAN |
442 | =item CV_TRASHCAN |