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

Comparing CV/bin/cv (file contents):
Revision 1.37 by root, Fri Mar 18 03:45:29 2005 UTC vs.
Revision 1.45 by root, Sun Jul 17 04:41:29 2005 UTC

12use Gtk2::CV; 12use Gtk2::CV;
13 13
14Gtk2::Rc->parse (Gtk2::CV::find_rcfile "gtkrc"); 14Gtk2::Rc->parse (Gtk2::CV::find_rcfile "gtkrc");
15 15
16use File::Spec; 16use File::Spec;
17
18require Gtk2::CV::Plugin;
19require "$ENV{HOME}/.cvrc" if -r "$ENV{HOME}/.cvrc";
17 20
18my $mainwin; 21my $mainwin;
19my $viewer; 22my $viewer;
20my $schnauzer; 23my $schnauzer;
21my $info; 24my $info;
32 (File::Spec->splitpath ($_[1]))[2], 35 (File::Spec->splitpath ($_[1]))[2],
33 -s $_[1]; 36 -s $_[1];
34 $info->set_label ($label); 37 $info->set_label ($label);
35 $viewer->load_image ($_[1]); 38 $viewer->load_image ($_[1]);
36 }); 39 });
37 $s->signal_connect (chdir => sub {
38 my ($self, $dir) = @_;
39 40
40 my $path = Cwd::abs_path $dir; 41 Gtk2::CV::Plugin->call (new_schnauzer => $s);
41
42 $self->realize;
43 $self->window->property_change (
44 Gtk2::Gdk::Atom->intern ("_X_CWD", 0),
45 Gtk2::Gdk::Atom->intern ("UTF8_STRING", 0),
46 Gtk2::Gdk::CHARS, 'replace',
47 Encode::encode_utf8 $path,
48 );
49 });
50 42
51 $s; 43 $s;
52} 44}
53 45
54sub std_keys { 46sub std_keys {
84 $h->load_string (do { local $/; <DATA> }); 76 $h->load_string (do { local $/; <DATA> });
85 } 77 }
86 78
87 $help->show_all; 79 $help->show_all;
88 } else { 80 } else {
89 #$mainwin->show_all; 81 return 0;
90 $schnauzer->handle_key ($key, $state);
91 } 82 }
92 83
93 1; 84 1
94} 85}
95 86
96{ 87{
97 $viewer = new Gtk2::CV::ImageWindow; 88 $viewer = new Gtk2::CV::ImageWindow;
98 89
99 $viewer->set_title ("CV: Image"); 90 $viewer->set_title ("CV: Image");
100 91
101 $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 });
102 $viewer->signal_connect (delete_event => sub { main_quit Gtk2 }); 96 $viewer->signal_connect (delete_event => sub { main_quit Gtk2 });
103 97
104 $viewer->signal_connect (button3_press_event => sub { 98 $viewer->signal_connect (button3_press_event => sub {
105 $mainwin->visible 99 $mainwin->visible
106 ? $mainwin->hide 100 ? $mainwin->hide
107 : $mainwin->show_all; 101 : $mainwin->show_all;
108 1; 102 1;
109 }); 103 });
110 104
105 Gtk2::CV::Plugin->call (new_imagewindow => $viewer);
106
111 $schnauzer = new_schnauzer; 107 $schnauzer = new_schnauzer;
112 108
113 $mainwin = new Gtk2::Window; 109 $mainwin = new Gtk2::Window;
114 $mainwin->set_title ("CV"); 110 $mainwin->set_title ("CV");
115 $mainwin->add (my $vbox = new Gtk2::VBox); 111 $mainwin->add (my $vbox = new Gtk2::VBox);
116 $mainwin->signal_connect (delete_event => sub { $mainwin->hide; 1; }); 112 $mainwin->signal_connect (delete_event => sub { $mainwin->hide; 1; });
117 113
118 $vbox->add ($schnauzer); 114 $vbox->add ($schnauzer);
119 $vbox->pack_end (my $frame = new Gtk2::Frame, 0, 0, 0); 115 $vbox->pack_end (my $frame = new Gtk2::Frame, 0, 0, 0);
120 $frame->add (my $hbox = new Gtk2::HBox 0, 0); 116 $frame->add (my $hbox = new Gtk2::HBox 0, 0);
121 $hbox->pack_start ((new Gtk2::Label "Info"), 0, 0, 0); 117 $hbox->pack_start ((new Gtk2::Label "Info: "), 0, 0, 0);
122 $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");
123 122
124 $schnauzer->set_geometry_hints; 123 $schnauzer->set_geometry_hints;
125} 124}
126 125
127if (@ARGV) { 126if (@ARGV) {
215 214
216=head1 ENVIRONMENT 215=head1 ENVIRONMENT
217 216
218=over 4 217=over 4
219 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
220=item CV_PRINT_DESTINATION 224=item CV_PRINT_DESTINATION
221 225
222The 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.
223 232
224=back 233=back
225 234
226=head1 SECURITY CONSIDERATIONS 235=head1 SECURITY CONSIDERATIONS
227 236

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines