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

Comparing CV/bin/cv (file contents):
Revision 1.20 by root, Fri Nov 7 14:01:45 2003 UTC vs.
Revision 1.35 by root, Tue Feb 8 02:54:59 2005 UTC

14 14
15my $mainwin; 15my $mainwin;
16my $viewer; 16my $viewer;
17my $schnauzer; 17my $schnauzer;
18my $info; 18my $info;
19my $help;
20
21my $schnauzer_idx = 0;
19 22
20sub new_schnauzer { 23sub new_schnauzer {
21 my $s = new Gtk2::CV::Schnauzer; 24 my $s = new Gtk2::CV::Schnauzer;
22 25
23 $s->signal_connect_after (key_press_event => \&std_keys); 26 $s->signal_connect_after (key_press_event => \&std_keys);
34 37
35sub std_keys { 38sub std_keys {
36 my $key = $_[1]->keyval; 39 my $key = $_[1]->keyval;
37 my $state = $_[1]->state; 40 my $state = $_[1]->state;
38 41
39 my $ctrl = grep $_ eq "control-mask", @$state; 42 my $ctrl = $state * "control-mask";
40 43
41 if ($key == $Gtk2::Gdk::Keysyms{q}) { 44 if ($key == $Gtk2::Gdk::Keysyms{q}) {
42 main_quit Gtk2; 45 main_quit Gtk2;
43 } elsif ($ctrl && $key == $Gtk2::Gdk::Keysyms{v}) { 46 } elsif ($ctrl && $key == $Gtk2::Gdk::Keysyms{v}) {
44 my $w = new Gtk2::Window; 47 my $w = new Gtk2::Window;
48
49 $w->set_title ("CV: Schnauzer");
45 $w->add (my $s = new_schnauzer); 50 $w->add (my $s = new_schnauzer);
46 $s->set_dir (File::Spec->curdir); 51 $s->set_dir (File::Spec->curdir);
52 $s->set_geometry_hints;
47 $w->show_all 53 $w->show_all;
54
55 } elsif ($ctrl && $key == $Gtk2::Gdk::Keysyms{h}) {
56 unless ($help) {
57 require Gtk2::PodViewer;
58
59 $help = new Gtk2::Window;
60 $help->set_title ("CV: Help");
61 $help->set_default_size (500, 300);
62 $help->signal_connect (delete_event => sub { $help->hide; 1 });
63
64 $help->add (my $sw = new Gtk2::ScrolledWindow);
65 $sw->add (my $h = new Gtk2::PodViewer);
66
67 #binmode DATA, ":utf8";
68 $h->load_string (do { local $/; <DATA> });
69 }
70
71 $help->show_all;
48 } else { 72 } else {
49 #$mainwin->show_all; 73 #$mainwin->show_all;
50 $schnauzer->handle_key ($key, $state); 74 $schnauzer->handle_key ($key, $state);
51 } 75 }
52 76
63 87
64 $viewer->signal_connect (button3_press_event => sub { 88 $viewer->signal_connect (button3_press_event => sub {
65 $mainwin->visible 89 $mainwin->visible
66 ? $mainwin->hide 90 ? $mainwin->hide
67 : $mainwin->show_all; 91 : $mainwin->show_all;
92 1;
68 }); 93 });
69 94
70 $schnauzer = new_schnauzer; 95 $schnauzer = new_schnauzer;
71 96
72 $mainwin = new Gtk2::Window; 97 $mainwin = new Gtk2::Window;
73 $mainwin->set_title ("CV"); 98 $mainwin->set_title ("CV");
74 $mainwin->add (my $vbox = new Gtk2::VBox); 99 $mainwin->add (my $vbox = new Gtk2::VBox);
100 $mainwin->signal_connect (delete_event => sub { $mainwin->hide; 1; });
75 101
76 $vbox->add ($schnauzer); 102 $vbox->add ($schnauzer);
77 $vbox->add (my $frame = new Gtk2::Frame); 103 $vbox->pack_end (my $frame = new Gtk2::Frame, 0, 0, 0);
78 $frame->add (my $hbox = new Gtk2::HBox 0, 0); 104 $frame->add (my $hbox = new Gtk2::HBox 0, 0);
79 $hbox->pack_start ((new Gtk2::Label "Info"), 0, 0, 0); 105 $hbox->pack_start ((new Gtk2::Label "Info"), 0, 0, 0);
80 $hbox->pack_start (($info = new Gtk2::Label), 1, 1, 0); 106 $hbox->pack_start (($info = new Gtk2::Label), 1, 1, 0);
107
108 $schnauzer->set_geometry_hints;
81} 109}
82 110
83if (@ARGV) { 111if (@ARGV) {
112 $_ = Glib::filename_to_unicode $_ for @ARGV;
84 $schnauzer->set_paths (\@ARGV); 113 $schnauzer->set_paths (\@ARGV);
114 $schnauzer->show_all;
85 $schnauzer->handle_key ($Gtk2::Gdk::Keysyms{space}, []); 115 $schnauzer->handle_key ($Gtk2::Gdk::Keysyms{space}, []);
86} else { 116} else {
87 $schnauzer->set_dir (File::Spec->curdir); 117 $schnauzer->set_dir (File::Spec->curdir);
88 $mainwin->show_all; 118 $mainwin->show_all;
119 $viewer->show_all;
89} 120}
90 121
91$viewer->show_all; 122$viewer->show_all;
92 123
93main Gtk2; 124main Gtk2;
125
126__DATA__
94 127
95=head1 NAME 128=head1 NAME
96 129
97cv - a fast gtk+ image viewer modeled after xv 130cv - a fast gtk+ image viewer modeled after xv
98 131
114 , shrink the image by 10% 147 , shrink the image by 10%
115 . enlarge the image by 10% 148 . enlarge the image by 10%
116 n reset to normal size 149 n reset to normal size
117 m maximize to screensize 150 m maximize to screensize
118 M maxime to screensize, respecting image aspect 151 M maxime to screensize, respecting image aspect
152 ctrl-m toggle maxpect-always mode
119 u uncrop 153 u uncrop
120 r set scaling mode to 'nearest' (fastest) 154 r set scaling mode to 'nearest' (fastest)
121 s set scaling mode to 'bilinear' (default) 155 s set scaling mode to 'bilinear' (default)
122 S set scaling mode to 'hyper' (slowest) 156 S set scaling mode to 'hyper' (slowest)
123 t rotate clockwise 90° 157 t rotate clockwise 90°
124 T rotate counterclockwise° 158 T rotate counterclockwise°
125 ctrl-v open a new visual schnauzer window for the current dir 159 ctrl-v open a new visual schnauzer window for the current dir
160 ctrl-s rescan visual schnauzer files for updates/deletes etc.
161 ctrl-e run an editor ($CV_EDITOR or "gimp") on the current image.
162
163And when playing movies, these additional keys are active:
164
165 left rewind by 10 seconds
166 right forward by 10 seconds
167 down rewind by 60 seconds
168 up forward by 60 seconds
169 pg_up rewind by 600 seconds
170 pg_down forward by 600 seconds
171 o toggle on-screen display
172 p pause/unpause
173 escape stop playing
174 9 turn volume down
175 0 turn volume up
126 176
127The following keys are redirected to the default visual schnauzer window: 177The following keys are redirected to the default visual schnauzer window:
128 178
129 space next image 179 space next image
130 backspace last image 180 backspace last image
141 page-up move one page up 191 page-up move one page up
142 page-down move one page down 192 page-down move one page down
143 home move to first file 193 home move to first file
144 end move to last file 194 end move to last file
145 195
196 ctrl-d delete selected files WITHOUT ASKING AGAIN
146 ctrl-g generate icons for the selected files 197 ctrl-g generate icons for the selected files
147 ctrl-d delete selected files WITHOUT ASKING AGAIN 198 ctrl-u update selected (or all) icons if neccessary
199 ctrl-a select all files
200
201=head1 ENVIRONMENT
202
203=over 4
204
205=item CV_PRINT_DESTINATION
206
207The default (perl-style) destination to use in the print dialog.
208
209=back
210
211=head1 SECURITY CONSIDERATIONS
212
213CV uses Pixbuf to load images. Pixbuf is not considered safe for this
214purpose, though (from the gtk-2.2 release notes):
215
216"While efforts have been made to make gdk-pixbuf robust against invalid
217images, using gdk-pixbuf to load untrusted data is not recommended, due to
218the likelyhood that there are additional problems where an invalid image
219could cause gdk-pixbuf to crash or worse."
148 220
149=head1 BUGS/TODO 221=head1 BUGS/TODO
222
223 Pixbuf doesn't honor G_BROKEN_FILENAMES, so accessing files with names
224 incompatible with utf-8 fails.
150 225
151 rotate on disk 226 rotate on disk
152 print 227 print
153 lots of ui issues 228 lots of ui issues
154 save(?) 229 save(?)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines