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

Comparing CV/bin/cv (file contents):
Revision 1.35 by root, Tue Feb 8 02:54:59 2005 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 $_ = Glib::filename_to_unicode $_ for @ARGV; 127 $schnauzer->set_paths ([map Glib::filename_to_unicode $_, @ARGV]);
113 $schnauzer->set_paths (\@ARGV);
114 $schnauzer->show_all; 128 $schnauzer->show_all;
129$viewer->show_all;
115 $schnauzer->handle_key ($Gtk2::Gdk::Keysyms{space}, []); 130 $schnauzer->handle_key ($Gtk2::Gdk::Keysyms{space}, []);
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;
119 $viewer->show_all; 134 $viewer->show_all;
200 215
201=head1 ENVIRONMENT 216=head1 ENVIRONMENT
202 217
203=over 4 218=over 4
204 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
205=item CV_PRINT_DESTINATION 225=item CV_PRINT_DESTINATION
206 226
207The 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.
208 233
209=back 234=back
210 235
211=head1 SECURITY CONSIDERATIONS 236=head1 SECURITY CONSIDERATIONS
212 237

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines