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

Comparing CV/bin/cv (file contents):
Revision 1.29 by root, Fri Nov 14 00:38:43 2003 UTC vs.
Revision 1.45 by root, Sun Jul 17 04:41:29 2005 UTC

1#!/opt/bin/perl 1#!/opt/bin/perl
2
3use Cwd ();
4use Encode ();
2 5
3use Gtk2 -init; 6use Gtk2 -init;
4use Gtk2::Gdk::Keysyms; 7use Gtk2::Gdk::Keysyms;
5 8
6use Gtk2::CV::ImageWindow; 9use Gtk2::CV::ImageWindow;
9use Gtk2::CV; 12use Gtk2::CV;
10 13
11Gtk2::Rc->parse (Gtk2::CV::find_rcfile "gtkrc"); 14Gtk2::Rc->parse (Gtk2::CV::find_rcfile "gtkrc");
12 15
13use File::Spec; 16use File::Spec;
17
18require Gtk2::CV::Plugin;
19require "$ENV{HOME}/.cvrc" if -r "$ENV{HOME}/.cvrc";
14 20
15my $mainwin; 21my $mainwin;
16my $viewer; 22my $viewer;
17my $schnauzer; 23my $schnauzer;
18my $info; 24my $info;
30 -s $_[1]; 36 -s $_[1];
31 $info->set_label ($label); 37 $info->set_label ($label);
32 $viewer->load_image ($_[1]); 38 $viewer->load_image ($_[1]);
33 }); 39 });
34 40
41 Gtk2::CV::Plugin->call (new_schnauzer => $s);
42
35 $s; 43 $s;
36} 44}
37 45
38sub std_keys { 46sub std_keys {
39 my $key = $_[1]->keyval; 47 my $key = $_[1]->keyval;
68 $h->load_string (do { local $/; <DATA> }); 76 $h->load_string (do { local $/; <DATA> });
69 } 77 }
70 78
71 $help->show_all; 79 $help->show_all;
72 } else { 80 } else {
73 #$mainwin->show_all; 81 return 0;
74 $schnauzer->handle_key ($key, $state);
75 } 82 }
76 83
77 1; 84 1
78} 85}
79 86
80{ 87{
81 $viewer = new Gtk2::CV::ImageWindow; 88 $viewer = new Gtk2::CV::ImageWindow;
82 89
83 $viewer->set_title ("CV: Image"); 90 $viewer->set_title ("CV: Image");
84 91
85 $viewer->signal_connect (key_press_event => \&std_keys); 92 $viewer->signal_connect (key_press_event => sub {
93 &std_keys
94 or $schnauzer->signal_emit (key_press_event => $_[1])
95 });
86 $viewer->signal_connect (delete_event => sub { main_quit Gtk2 }); 96 $viewer->signal_connect (delete_event => sub { main_quit Gtk2 });
87 97
88 $viewer->signal_connect (button3_press_event => sub { 98 $viewer->signal_connect (button3_press_event => sub {
89 $mainwin->visible 99 $mainwin->visible
90 ? $mainwin->hide 100 ? $mainwin->hide
91 : $mainwin->show_all; 101 : $mainwin->show_all;
92 1; 102 1;
93 }); 103 });
94 104
105 Gtk2::CV::Plugin->call (new_imagewindow => $viewer);
106
95 $schnauzer = new_schnauzer; 107 $schnauzer = new_schnauzer;
96 108
97 $mainwin = new Gtk2::Window; 109 $mainwin = new Gtk2::Window;
98 $mainwin->set_title ("CV"); 110 $mainwin->set_title ("CV");
99 $mainwin->add (my $vbox = new Gtk2::VBox); 111 $mainwin->add (my $vbox = new Gtk2::VBox);
100 $mainwin->signal_connect (delete_event => sub { $mainwin->hide; 1; }); 112 $mainwin->signal_connect (delete_event => sub { $mainwin->hide; 1; });
101 113
102 $vbox->add ($schnauzer); 114 $vbox->add ($schnauzer);
103 $vbox->pack_end (my $frame = new Gtk2::Frame, 0, 0, 0); 115 $vbox->pack_end (my $frame = new Gtk2::Frame, 0, 0, 0);
104 $frame->add (my $hbox = new Gtk2::HBox 0, 0); 116 $frame->add (my $hbox = new Gtk2::HBox 0, 0);
105 $hbox->pack_start ((new Gtk2::Label "Info"), 0, 0, 0); 117 $hbox->pack_start ((new Gtk2::Label "Info: "), 0, 0, 0);
106 $hbox->pack_start (($info = new Gtk2::Label), 1, 1, 0); 118 $hbox->pack_end (my $labelwindow = new Gtk2::EventBox, 1, 1, 0);
119 $labelwindow->add ($info = new Gtk2::Label);
120 $labelwindow->signal_connect_after (size_request => sub { $_[1]->width (0); 0 });
121 $info->set (selectable => 1, xalign => 0, justify => "left");
107 122
108 $schnauzer->set_geometry_hints; 123 $schnauzer->set_geometry_hints;
109} 124}
110 125
111if (@ARGV) { 126if (@ARGV) {
112 $schnauzer->set_paths (\@ARGV); 127 $schnauzer->set_paths ([map Glib::filename_to_unicode $_, @ARGV]);
128 $schnauzer->show_all;
113 $schnauzer->handle_key ($Gtk2::Gdk::Keysyms{space}, []); 129 $schnauzer->handle_key ($Gtk2::Gdk::Keysyms{space}, []);
114
115 $viewer->load_image ($ARGV[0]);
116} else { 130} else {
117 $schnauzer->set_dir (File::Spec->curdir); 131 $schnauzer->set_dir (File::Spec->curdir);
118 $mainwin->show_all; 132 $mainwin->show_all;
133 $viewer->show_all;
119} 134}
120 135
121$viewer->show_all; 136$viewer->show_all;
122 137
123main Gtk2; 138main Gtk2;
155 S set scaling mode to 'hyper' (slowest) 170 S set scaling mode to 'hyper' (slowest)
156 t rotate clockwise 90° 171 t rotate clockwise 90°
157 T rotate counterclockwise° 172 T rotate counterclockwise°
158 ctrl-v open a new visual schnauzer window for the current dir 173 ctrl-v open a new visual schnauzer window for the current dir
159 ctrl-s rescan visual schnauzer files for updates/deletes etc. 174 ctrl-s rescan visual schnauzer files for updates/deletes etc.
175 ctrl-e run an editor ($CV_EDITOR or "gimp") on the current image.
176
177And when playing movies, these additional keys are active:
178
179 left rewind by 10 seconds
180 right forward by 10 seconds
181 down rewind by 60 seconds
182 up forward by 60 seconds
183 pg_up rewind by 600 seconds
184 pg_down forward by 600 seconds
185 o toggle on-screen display
186 p pause/unpause
187 escape stop playing
188 9 turn volume down
189 0 turn volume up
160 190
161The following keys are redirected to the default visual schnauzer window: 191The following keys are redirected to the default visual schnauzer window:
162 192
163 space next image 193 space next image
164 backspace last image 194 backspace last image
178 end move to last file 208 end move to last file
179 209
180 ctrl-d delete selected files WITHOUT ASKING AGAIN 210 ctrl-d delete selected files WITHOUT ASKING AGAIN
181 ctrl-g generate icons for the selected files 211 ctrl-g generate icons for the selected files
182 ctrl-u update selected (or all) icons if neccessary 212 ctrl-u update selected (or all) icons if neccessary
213 ctrl-a select all files
183 214
184=head1 ENVIRONMENT 215=head1 ENVIRONMENT
185 216
186=over 4 217=over 4
187 218
219=item CV_EDITOR
220
221The program that gets executed when the user presses C<CTRL-e> in the
222Schnauzer or image window. The default is C<gimp>.
223
188=item CV_PRINT_DESTINATION 224=item CV_PRINT_DESTINATION
189 225
190The default (perl-style) destination to use in the print dialog. 226The default (perl-style) destination to use in the print dialog.
227
228=item CV_TRASHCAN
229
230When set, must point to a directory where all files that are deleted are
231moved to. If unset, files that are deleted are really being deleted.
191 232
192=back 233=back
193 234
194=head1 SECURITY CONSIDERATIONS 235=head1 SECURITY CONSIDERATIONS
195 236

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines