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.46 by root, Sun Jul 17 05:01:30 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;
129$viewer->show_all;
113 $schnauzer->handle_key ($Gtk2::Gdk::Keysyms{space}, []); 130 $schnauzer->handle_key ($Gtk2::Gdk::Keysyms{space}, []);
114
115 $viewer->load_image ($ARGV[0]);
116} else { 131} else {
117 $schnauzer->set_dir (File::Spec->curdir); 132 $schnauzer->set_dir (File::Spec->curdir);
118 $mainwin->show_all; 133 $mainwin->show_all;
134 $viewer->show_all;
119} 135}
120 136
121$viewer->show_all; 137$viewer->show_all;
122 138
123main Gtk2; 139main Gtk2;
155 S set scaling mode to 'hyper' (slowest) 171 S set scaling mode to 'hyper' (slowest)
156 t rotate clockwise 90° 172 t rotate clockwise 90°
157 T rotate counterclockwise° 173 T rotate counterclockwise°
158 ctrl-v open a new visual schnauzer window for the current dir 174 ctrl-v open a new visual schnauzer window for the current dir
159 ctrl-s rescan visual schnauzer files for updates/deletes etc. 175 ctrl-s rescan visual schnauzer files for updates/deletes etc.
176 ctrl-e run an editor ($CV_EDITOR or "gimp") on the current image.
177
178And when playing movies, these additional keys are active:
179
180 left rewind by 10 seconds
181 right forward by 10 seconds
182 down rewind by 60 seconds
183 up forward by 60 seconds
184 pg_up rewind by 600 seconds
185 pg_down forward by 600 seconds
186 o toggle on-screen display
187 p pause/unpause
188 escape stop playing
189 9 turn volume down
190 0 turn volume up
160 191
161The following keys are redirected to the default visual schnauzer window: 192The following keys are redirected to the default visual schnauzer window:
162 193
163 space next image 194 space next image
164 backspace last image 195 backspace last image
178 end move to last file 209 end move to last file
179 210
180 ctrl-d delete selected files WITHOUT ASKING AGAIN 211 ctrl-d delete selected files WITHOUT ASKING AGAIN
181 ctrl-g generate icons for the selected files 212 ctrl-g generate icons for the selected files
182 ctrl-u update selected (or all) icons if neccessary 213 ctrl-u update selected (or all) icons if neccessary
214 ctrl-a select all files
183 215
184=head1 ENVIRONMENT 216=head1 ENVIRONMENT
185 217
186=over 4 218=over 4
187 219
220=item CV_EDITOR
221
222The program that gets executed when the user presses C<CTRL-e> in the
223Schnauzer or image window. The default is C<gimp>.
224
188=item CV_PRINT_DESTINATION 225=item CV_PRINT_DESTINATION
189 226
190The default (perl-style) destination to use in the print dialog. 227The default (perl-style) destination to use in the print dialog.
228
229=item CV_TRASHCAN
230
231When set, must point to a directory where all files that are deleted are
232moved to. If unset, files that are deleted are really being deleted.
191 233
192=back 234=back
193 235
194=head1 SECURITY CONSIDERATIONS 236=head1 SECURITY CONSIDERATIONS
195 237

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines