ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/CV/bin/cv
Revision: 1.20
Committed: Fri Nov 7 14:01:45 2003 UTC (20 years, 8 months ago) by root
Branch: MAIN
Changes since 1.19: +40 -20 lines
Log Message:
*** empty log message ***

File Contents

# Content
1 #!/opt/bin/perl
2
3 use Gtk2 -init;
4 use Gtk2::Gdk::Keysyms;
5
6 use Gtk2::CV::ImageWindow;
7 use Gtk2::CV::Schnauzer;
8
9 use Gtk2::CV;
10
11 Gtk2::Rc->parse (Gtk2::CV::find_rcfile "gtkrc");
12
13 use File::Spec;
14
15 my $mainwin;
16 my $viewer;
17 my $schnauzer;
18 my $info;
19
20 sub new_schnauzer {
21 my $s = new Gtk2::CV::Schnauzer;
22
23 $s->signal_connect_after (key_press_event => \&std_keys);
24 $s->signal_connect (activate => sub {
25 my $label = sprintf "%s (%d)",
26 (File::Spec->splitpath ($_[1]))[2],
27 -s $_[1];
28 $info->set_label ($label);
29 $viewer->load_image ($_[1]);
30 });
31
32 $s;
33 }
34
35 sub std_keys {
36 my $key = $_[1]->keyval;
37 my $state = $_[1]->state;
38
39 my $ctrl = grep $_ eq "control-mask", @$state;
40
41 if ($key == $Gtk2::Gdk::Keysyms{q}) {
42 main_quit Gtk2;
43 } elsif ($ctrl && $key == $Gtk2::Gdk::Keysyms{v}) {
44 my $w = new Gtk2::Window;
45 $w->add (my $s = new_schnauzer);
46 $s->set_dir (File::Spec->curdir);
47 $w->show_all
48 } else {
49 #$mainwin->show_all;
50 $schnauzer->handle_key ($key, $state);
51 }
52
53 1;
54 }
55
56 {
57 $viewer = new Gtk2::CV::ImageWindow;
58
59 $viewer->set_title ("CV: Image");
60
61 $viewer->signal_connect (key_press_event => \&std_keys);
62 $viewer->signal_connect (delete_event => sub { main_quit Gtk2 });
63
64 $viewer->signal_connect (button3_press_event => sub {
65 $mainwin->visible
66 ? $mainwin->hide
67 : $mainwin->show_all;
68 });
69
70 $schnauzer = new_schnauzer;
71
72 $mainwin = new Gtk2::Window;
73 $mainwin->set_title ("CV");
74 $mainwin->add (my $vbox = new Gtk2::VBox);
75
76 $vbox->add ($schnauzer);
77 $vbox->add (my $frame = new Gtk2::Frame);
78 $frame->add (my $hbox = new Gtk2::HBox 0, 0);
79 $hbox->pack_start ((new Gtk2::Label "Info"), 0, 0, 0);
80 $hbox->pack_start (($info = new Gtk2::Label), 1, 1, 0);
81 }
82
83 if (@ARGV) {
84 $schnauzer->set_paths (\@ARGV);
85 $schnauzer->handle_key ($Gtk2::Gdk::Keysyms{space}, []);
86 } else {
87 $schnauzer->set_dir (File::Spec->curdir);
88 $mainwin->show_all;
89 }
90
91 $viewer->show_all;
92
93 main Gtk2;
94
95 =head1 NAME
96
97 cv - a fast gtk+ image viewer modeled after xv
98
99 =head1 SYNOPSIS
100
101 cv [file...]
102
103 =head1 DESCRIPTION
104
105 None yet.
106
107 =head2 THE IMAGE WINDOW
108
109 You can use the following keys in the image window:
110
111 q quit the program
112 < half the image size
113 > double the image size
114 , shrink the image by 10%
115 . enlarge the image by 10%
116 n reset to normal size
117 m maximize to screensize
118 M maxime to screensize, respecting image aspect
119 u uncrop
120 r set scaling mode to 'nearest' (fastest)
121 s set scaling mode to 'bilinear' (default)
122 S set scaling mode to 'hyper' (slowest)
123 t rotate clockwise 90°
124 T rotate counterclockwise°
125 ctrl-v open a new visual schnauzer window for the current dir
126
127 The following keys are redirected to the default visual schnauzer window:
128
129 space next image
130 backspace last image
131
132 =head2 THE VISUAL SCHNAUZER
133
134 You can use the following keys in the schnauzer window:
135
136 space move to and display next image
137 backspace move to and display previous image
138 return display selected picture
139
140 cursor keys move selection
141 page-up move one page up
142 page-down move one page down
143 home move to first file
144 end move to last file
145
146 ctrl-g generate icons for the selected files
147 ctrl-d delete selected files WITHOUT ASKING AGAIN
148
149 =head1 BUGS/TODO
150
151 rotate on disk
152 print
153 lots of ui issues
154 save(?)
155 preferences
156 ctrl-u in schnauzer
157 shift-cursor in schnauzer
158
159 =head1 AUTHOR
160
161 Marc Lehmann <cv@plan9.de>.
162
163 =cut
164