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

Comparing CV/bin/cv (file contents):
Revision 1.32 by root, Sun Oct 31 21:01:40 2004 UTC vs.
Revision 1.43 by root, Tue Jun 28 21:26:04 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;
29 (File::Spec->splitpath ($_[1]))[2], 35 (File::Spec->splitpath ($_[1]))[2],
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 });
40 $s->signal_connect (chdir => sub {
41 my ($self, $dir) = @_;
42
43 my $path = Cwd::abs_path $dir;
44
45 $self->realize;
46 $self->window->property_change (
47 Gtk2::Gdk::Atom->intern ("_X_CWD", 0),
48 Gtk2::Gdk::Atom->intern ("UTF8_STRING", 0),
49 Gtk2::Gdk::CHARS, 'replace',
50 Encode::encode_utf8 $path,
51 );
52 });
53
54 Gtk2::CV::Plugin->call (new_schnauzer => $s);
34 55
35 $s; 56 $s;
36} 57}
37 58
38sub std_keys { 59sub std_keys {
68 $h->load_string (do { local $/; <DATA> }); 89 $h->load_string (do { local $/; <DATA> });
69 } 90 }
70 91
71 $help->show_all; 92 $help->show_all;
72 } else { 93 } else {
73 #$mainwin->show_all; 94 return 0;
74 $schnauzer->handle_key ($key, $state);
75 } 95 }
76 96
77 1; 97 1
78} 98}
79 99
80{ 100{
81 $viewer = new Gtk2::CV::ImageWindow; 101 $viewer = new Gtk2::CV::ImageWindow;
82 102
83 $viewer->set_title ("CV: Image"); 103 $viewer->set_title ("CV: Image");
84 104
85 $viewer->signal_connect (key_press_event => \&std_keys); 105 $viewer->signal_connect (key_press_event => sub {
106 &std_keys
107 or $schnauzer->signal_emit (key_press_event => $_[1])
108 });
86 $viewer->signal_connect (delete_event => sub { main_quit Gtk2 }); 109 $viewer->signal_connect (delete_event => sub { main_quit Gtk2 });
87 110
88 $viewer->signal_connect (button3_press_event => sub { 111 $viewer->signal_connect (button3_press_event => sub {
89 $mainwin->visible 112 $mainwin->visible
90 ? $mainwin->hide 113 ? $mainwin->hide
91 : $mainwin->show_all; 114 : $mainwin->show_all;
92 1; 115 1;
93 }); 116 });
94 117
118 Gtk2::CV::Plugin->call (new_imagewindow => $viewer);
119
95 $schnauzer = new_schnauzer; 120 $schnauzer = new_schnauzer;
96 121
97 $mainwin = new Gtk2::Window; 122 $mainwin = new Gtk2::Window;
98 $mainwin->set_title ("CV"); 123 $mainwin->set_title ("CV");
99 $mainwin->add (my $vbox = new Gtk2::VBox); 124 $mainwin->add (my $vbox = new Gtk2::VBox);
102 $vbox->add ($schnauzer); 127 $vbox->add ($schnauzer);
103 $vbox->pack_end (my $frame = new Gtk2::Frame, 0, 0, 0); 128 $vbox->pack_end (my $frame = new Gtk2::Frame, 0, 0, 0);
104 $frame->add (my $hbox = new Gtk2::HBox 0, 0); 129 $frame->add (my $hbox = new Gtk2::HBox 0, 0);
105 $hbox->pack_start ((new Gtk2::Label "Info"), 0, 0, 0); 130 $hbox->pack_start ((new Gtk2::Label "Info"), 0, 0, 0);
106 $hbox->pack_start (($info = new Gtk2::Label), 1, 1, 0); 131 $hbox->pack_start (($info = new Gtk2::Label), 1, 1, 0);
132 $info->set (wrap => 1);
107 133
108 $schnauzer->set_geometry_hints; 134 $schnauzer->set_geometry_hints;
109} 135}
110 136
111if (@ARGV) { 137if (@ARGV) {
112 $_ = Glib::filename_to_unicode $_ for @ARGV; 138 $schnauzer->set_paths ([map Glib::filename_to_unicode $_, @ARGV]);
113 $schnauzer->set_paths (\@ARGV);
114 $schnauzer->show_all; 139 $schnauzer->show_all;
115 $schnauzer->handle_key ($Gtk2::Gdk::Keysyms{space}, []); 140 $schnauzer->handle_key ($Gtk2::Gdk::Keysyms{space}, []);
116} else { 141} else {
117 $schnauzer->set_dir (File::Spec->curdir); 142 $schnauzer->set_dir (File::Spec->curdir);
118 $mainwin->show_all; 143 $mainwin->show_all;
144 $viewer->show_all;
119} 145}
120 146
121$viewer->show_all; 147$viewer->show_all;
122 148
123main Gtk2; 149main Gtk2;
157 T rotate counterclockwise° 183 T rotate counterclockwise°
158 ctrl-v open a new visual schnauzer window for the current dir 184 ctrl-v open a new visual schnauzer window for the current dir
159 ctrl-s rescan visual schnauzer files for updates/deletes etc. 185 ctrl-s rescan visual schnauzer files for updates/deletes etc.
160 ctrl-e run an editor ($CV_EDITOR or "gimp") on the current image. 186 ctrl-e run an editor ($CV_EDITOR or "gimp") on the current image.
161 187
188And when playing movies, these additional keys are active:
189
190 left rewind by 10 seconds
191 right forward by 10 seconds
192 down rewind by 60 seconds
193 up forward by 60 seconds
194 pg_up rewind by 600 seconds
195 pg_down forward by 600 seconds
196 o toggle on-screen display
197 p pause/unpause
198 escape stop playing
199 9 turn volume down
200 0 turn volume up
201
162The following keys are redirected to the default visual schnauzer window: 202The following keys are redirected to the default visual schnauzer window:
163 203
164 space next image 204 space next image
165 backspace last image 205 backspace last image
166 206
185 225
186=head1 ENVIRONMENT 226=head1 ENVIRONMENT
187 227
188=over 4 228=over 4
189 229
230=item CV_EDITOR
231
232The program that gets executed when the user presses C<CTRL-e> in the
233Schnauzer or image window. The default is C<gimp>.
234
190=item CV_PRINT_DESTINATION 235=item CV_PRINT_DESTINATION
191 236
192The default (perl-style) destination to use in the print dialog. 237The default (perl-style) destination to use in the print dialog.
238
239=item CV_TRASHCAN
240
241When set, must point to a directory where all files that are deleted are
242moved to. If unset, files that are deleted are really being deleted.
193 243
194=back 244=back
195 245
196=head1 SECURITY CONSIDERATIONS 246=head1 SECURITY CONSIDERATIONS
197 247

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines