… | |
… | |
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) { |
158 | @ARGV == 1 && -d $ARGV[0] |
165 | my $show_first = sub { |
159 | ? $schnauzer->set_dir (Glib::filename_to_unicode shift) |
|
|
160 | : $schnauzer->set_paths ([map Glib::filename_to_unicode $_, @ARGV]); |
|
|
161 | $schnauzer->show_all; |
166 | $schnauzer->show_all; |
162 | $schnauzer->handle_key ($Gtk2::Gdk::Keysyms{space}, []); |
167 | $schnauzer->handle_key ($Gtk2::Gdk::Keysyms{space}, []); |
|
|
168 | $viewer->show_all; |
|
|
169 | }; |
|
|
170 | |
|
|
171 | if (@ARGV == 1 && $ARGV[0] eq "-0r") { |
|
|
172 | local $/; |
|
|
173 | $schnauzer->set_paths ([map Glib::filename_to_unicode $_, split /\x00/, <STDIN>], 1, $show_first); |
|
|
174 | } elsif (@ARGV == 1 && -d $ARGV[0]) { |
|
|
175 | $schnauzer->set_dir (Glib::filename_to_unicode shift, $show_first); |
|
|
176 | } else { |
|
|
177 | $schnauzer->set_paths ([map Glib::filename_to_unicode $_, @ARGV], 1, $show_first); |
|
|
178 | } |
163 | } else { |
179 | } else { |
164 | $schnauzer->set_dir (File::Spec->curdir); |
180 | $schnauzer->set_dir (File::Spec->curdir, sub { |
165 | $mainwin->show_all; |
181 | $mainwin->show_all; |
166 | } |
|
|
167 | |
|
|
168 | $viewer->show_all; |
182 | $viewer->show_all; |
|
|
183 | }); |
|
|
184 | } |
169 | |
185 | |
170 | main Gtk2; |
186 | main Gtk2; |
|
|
187 | |
|
|
188 | Gtk2::CV::flush_aio; |
171 | |
189 | |
172 | __DATA__ |
190 | __DATA__ |
173 | |
191 | |
174 | =encoding utf-8 |
192 | =encoding utf-8 |
175 | |
193 | |
… | |
… | |
292 | r set scaling mode to 'nearest' (fastest) |
310 | r set scaling mode to 'nearest' (fastest) |
293 | s set scaling mode to 'bilinear' (default) |
311 | s set scaling mode to 'bilinear' (default) |
294 | shift-s set scaling mode to 'hyper' (slowest) |
312 | shift-s set scaling mode to 'hyper' (slowest) |
295 | t rotate clockwise 90° |
313 | t rotate clockwise 90° |
296 | T rotate counterclockwise° |
314 | T rotate counterclockwise° |
|
|
315 | a apply all rotations loslessly to a jpeg file (using exiftran) |
297 | ctrl-v open a new visual schnauzer window for the current dir |
316 | ctrl-v open a new visual schnauzer window for the current dir |
|
|
317 | ctrl-c clone the current image window |
298 | ctrl-e run an editor ($CV_EDITOR or "gimp") on the current image |
318 | ctrl-e run an editor ($CV_EDITOR or "gimp") on the current image |
299 | ctrl-p fire up the print dialog |
319 | ctrl-p fire up the print dialog |
300 | escape cancel a crop action |
320 | escape cancel a crop action |
301 | |
321 | |
302 | And when playing movies, these additional keys are active: |
322 | And when playing movies, these additional keys are active: |
… | |
… | |
319 | Left-clicking into the image window will let you crop the image (usually |
339 | Left-clicking into the image window will let you crop the image (usually |
320 | to zoom into large images that CV scales down). |
340 | to zoom into large images that CV scales down). |
321 | |
341 | |
322 | =head2 THE VISUAL SCHNAUZER |
342 | =head2 THE VISUAL SCHNAUZER |
323 | |
343 | |
|
|
344 | Any image-loading action in a schnauzer window acts on the |
|
|
345 | "last-recently-activated" imagewindow, which currently is simply the last |
|
|
346 | image window that received a keypress. |
|
|
347 | |
324 | You can use the following keys in the schnauzer window: |
348 | You can use the following keys in the schnauzer window: |
325 | |
349 | |
326 | ctrl-space, |
350 | ctrl-space, |
327 | space move to and display next image |
351 | space move to and display next image |
328 | ctrl-backspace, |
352 | ctrl-backspace, |
… | |
… | |
409 | =item CV_EDITOR |
433 | =item CV_EDITOR |
410 | |
434 | |
411 | The program that gets executed when the user presses C<CTRL-e> in the |
435 | The program that gets executed when the user presses C<CTRL-e> in the |
412 | Schnauzer or image window. The default is C<gimp>. |
436 | Schnauzer or image window. The default is C<gimp>. |
413 | |
437 | |
|
|
438 | =item CV_AUDIO_PLAYER |
|
|
439 | |
|
|
440 | Program used to play all sorts of audio (wav, aif, mp3, ogg...), default "play". |
|
|
441 | Will be called like C<< $CV_AUDIO_PLAYER -- <path> >>. |
|
|
442 | |
414 | =item CV_PRINT_DESTINATION |
443 | =item CV_PRINT_DESTINATION |
415 | |
444 | |
416 | The default (perl-style) destination to use in the print dialog. |
445 | The default (perl-style) destination to use in the print dialog. |
417 | |
446 | |
418 | =item CV_TRASHCAN |
447 | =item CV_TRASHCAN |