ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/CV/bin/cv
(Generate patch)

Comparing CV/bin/cv (file contents):
Revision 1.63 by root, Tue Oct 4 05:06:39 2005 UTC vs.
Revision 1.73 by root, Thu Nov 22 08:52:57 2007 UTC

1#!/opt/bin/perl 1#!/opt/bin/perl
2 2
3use Cwd (); 3use Cwd ();
4use Encode (); 4use Encode ();
5use File::Glob ();
5 6
6use Gtk2 -init; 7use Gtk2 -init;
7use Gtk2::Gdk::Keysyms; 8use Gtk2::Gdk::Keysyms;
8 9
9use Gtk2::CV; 10use Gtk2::CV;
103 if ($key == $Gtk2::Gdk::Keysyms{q}) { 104 if ($key == $Gtk2::Gdk::Keysyms{q}) {
104 $viewer->destroy; 105 $viewer->destroy;
105 } elsif ($ctrl && $key == $Gtk2::Gdk::Keysyms{v}) { 106 } elsif ($ctrl && $key == $Gtk2::Gdk::Keysyms{v}) {
106 my $w = new Gtk2::Window; 107 my $w = new Gtk2::Window;
107 108
109 $w->set_role ("schnauzer");
108 $w->set_title ("CV: Schnauzer"); 110 $w->set_title ("CV: Schnauzer");
109 $w->add (my $s = new_schnauzer); 111 $w->add (my $s = new_schnauzer);
110 $s->set_dir (File::Spec->curdir); 112 $s->set_dir (File::Spec->curdir);
111 $s->set_geometry_hints; 113 $s->set_geometry_hints;
112 $w->show_all; 114 $w->show_all;
113 115
114 } elsif ($ctrl && $key == $Gtk2::Gdk::Keysyms{h}) { 116 } elsif ($ctrl && $key == $Gtk2::Gdk::Keysyms{h}) {
115 unless ($help) { 117 unless ($help) {
116 require Gtk2::PodViewer; 118 require Gtk2::Ex::PodViewer;
117 119
118 $help = new Gtk2::Window; 120 $help = new Gtk2::Window;
121 $help->set_role ("help");
119 $help->set_title ("CV: Help"); 122 $help->set_title ("CV: Help");
120 $help->set_default_size (500, 300); 123 $help->set_default_size (500, 300);
121 $help->signal_connect (delete_event => sub { $help->hide; 1 }); 124 $help->signal_connect (delete_event => sub { $help->hide; 1 });
122 125
123 $help->add (my $sw = new Gtk2::ScrolledWindow); 126 $help->add (my $sw = new Gtk2::ScrolledWindow);
124 $sw->add (my $h = new Gtk2::PodViewer); 127 $sw->add (my $h = new Gtk2::Ex::PodViewer);
125 128
126 #binmode DATA, ":utf8"; 129 #binmode DATA, ":utf8";
127 $h->load_string (do { local $/; <DATA> }); 130 $h->load_string (do { local $/; <DATA> });
128 } 131 }
129 132
140 $::cur_viewer = $viewer; 143 $::cur_viewer = $viewer;
141 144
142 $schnauzer = new_schnauzer; 145 $schnauzer = new_schnauzer;
143 146
144 $mainwin = new Gtk2::Window; 147 $mainwin = new Gtk2::Window;
148 $mainwin->set_role ("main");
145 $mainwin->set_title ("CV"); 149 $mainwin->set_title ("CV");
146 $mainwin->add (my $vbox = new Gtk2::VBox); 150 $mainwin->add (my $vbox = new Gtk2::VBox);
147 $mainwin->signal_connect (delete_event => sub { $mainwin->hide; 1 }); 151 $mainwin->signal_connect (delete_event => sub { $mainwin->hide; 1 });
148 152
149 $vbox->add ($schnauzer); 153 $vbox->add ($schnauzer);
157 161
158 $schnauzer->set_geometry_hints; 162 $schnauzer->set_geometry_hints;
159} 163}
160 164
161if (@ARGV) { 165if (@ARGV) {
162 @ARGV == 1 && -d $ARGV[0] 166 my $show_first = sub {
163 ? $schnauzer->set_dir (Glib::filename_to_unicode shift)
164 : $schnauzer->set_paths ([map Glib::filename_to_unicode $_, @ARGV]);
165 $schnauzer->show_all; 167 $schnauzer->show_all;
166 $schnauzer->handle_key ($Gtk2::Gdk::Keysyms{space}, []); 168 $schnauzer->handle_key ($Gtk2::Gdk::Keysyms{space}, []);
169 $viewer->show_all;
170 };
171
172 if (@ARGV == 1 && $ARGV[0] eq "-0r") {
173 local $/;
174 $schnauzer->set_paths ([map Glib::filename_to_unicode $_, split /\x00/, <STDIN>], 1, $show_first);
175 } elsif (@ARGV == 1 && -d $ARGV[0]) {
176 $schnauzer->set_dir (Glib::filename_to_unicode shift, $show_first);
177 } else {
178 if ($ARGV[0] eq "-g") {
179 shift @ARGV;
180 @ARGV = map +(File::Glob::bsd_glob $_, File::Glob::GLOB_BRACE | File::Glob::GLOB_QUOTE), @ARGV;
181 }
182 $schnauzer->set_paths ([map Glib::filename_to_unicode $_, @ARGV], 1, $show_first);
183 }
167} else { 184} else {
168 $schnauzer->set_dir (File::Spec->curdir); 185 $schnauzer->set_dir (File::Spec->curdir, sub {
169 $mainwin->show_all; 186 $mainwin->show_all;
170}
171
172$viewer->show_all; 187 $viewer->show_all;
188 });
189}
173 190
174main Gtk2; 191main Gtk2;
192
193Gtk2::CV::flush_aio;
175 194
176__DATA__ 195__DATA__
177 196
178=encoding utf-8 197=encoding utf-8
179 198
296 r set scaling mode to 'nearest' (fastest) 315 r set scaling mode to 'nearest' (fastest)
297 s set scaling mode to 'bilinear' (default) 316 s set scaling mode to 'bilinear' (default)
298 shift-s set scaling mode to 'hyper' (slowest) 317 shift-s set scaling mode to 'hyper' (slowest)
299 t rotate clockwise 90° 318 t rotate clockwise 90°
300 T rotate counterclockwise° 319 T rotate counterclockwise°
320 a apply all rotations loslessly to a jpeg file (using exiftran)
301 ctrl-v open a new visual schnauzer window for the current dir 321 ctrl-v open a new visual schnauzer window for the current dir
302 ctrl-c clone the current image window 322 ctrl-c clone the current image window
303 ctrl-e run an editor ($CV_EDITOR or "gimp") on the current image 323 ctrl-e run an editor ($CV_EDITOR or "gimp") on the current image
304 ctrl-p fire up the print dialog 324 ctrl-p fire up the print dialog
305 escape cancel a crop action 325 escape cancel a crop action
418=item CV_EDITOR 438=item CV_EDITOR
419 439
420The program that gets executed when the user presses C<CTRL-e> in the 440The program that gets executed when the user presses C<CTRL-e> in the
421Schnauzer or image window. The default is C<gimp>. 441Schnauzer or image window. The default is C<gimp>.
422 442
443=item CV_AUDIO_PLAYER
444
445Program used to play all sorts of audio (wav, aif, mp3, ogg...), default "play".
446Will be called like C<< $CV_AUDIO_PLAYER -- <path> >>.
447
423=item CV_PRINT_DESTINATION 448=item CV_PRINT_DESTINATION
424 449
425The default (perl-style) destination to use in the print dialog. 450The default (perl-style) destination to use in the print dialog.
426 451
427=item CV_TRASHCAN 452=item CV_TRASHCAN

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines