ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/CV/bin/cv
Revision: 1.12
Committed: Wed Nov 5 01:30:33 2003 UTC (20 years, 8 months ago) by root
Branch: MAIN
Changes since 1.11: +59 -58 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 my $viewer;
10 my $schnauzer;
11
12 sub new_schnauzer {
13 my $w = new Gtk2::Window;
14 $w->add (my $s = new Gtk2::CV::Schnauzer);
15
16 $s->signal_connect (activate => sub { $viewer->load_image ($_[1]) });
17 $s->signal_connect_after (key_press_event => \&std_keys);
18
19 $s->set_dir (".");
20 $w->show_all;
21
22 $s;
23 }
24
25 sub std_keys {
26 my $key = $_[1]->keyval;
27 my $state = $_[1]->state;
28
29 my $ctrl = grep $_ eq "control-mask", @$state;
30
31 if ($key == $Gtk2::Gdk::Keysyms{q}) {
32 main_quit Gtk2;
33 } elsif ($ctrl && $key == $Gtk2::Gdk::Keysyms{v}) {
34 new_schnauzer;
35 } else {
36 $schnauzer->handle_key ($key, $state);
37 }
38
39 1;
40 }
41
42 $viewer = new Gtk2::CV::ImageWindow;
43 $viewer->signal_connect (key_press_event => \&std_keys);
44 $viewer->signal_connect (delete_event => sub { main_quit Gtk2 });
45
46 $schnauzer = new_schnauzer;
47
48 if (@ARGV) {
49 $viewer->load_image ($ARGV[0]);
50
51 if (@ARGV > 1) {
52 $schnauzer->set_paths (\@ARGV);
53 }
54 }
55
56 $viewer->show_all;
57
58 main Gtk2;
59
60 =head1 NAME
61
62 cv - a fast gtk+ image viewer modeled after xv
63
64 =head1 SYNOPSIS
65
66 cv [file...]
67
68 =head1 DESCRIPTION
69
70 None yet.
71
72 =head2 THE IMAGE WINDOW
73
74 You can use the following keys in the image window:
75
76 q quit the program
77 < half the image size
78 > double the image size
79 , shrink the image by 10%
80 . enlarge the image by 10%
81 n reset to normal size
82 m maximize to screensize
83 M maxime to screensize, respecting image aspect
84 u uncrop
85 r set scaling mode to 'nearest' (fastest)
86 s set scaling mode to 'bilinear' (default)
87 S set scaling mode to 'hyper' (slowest)
88 t rotate clockwise 90°
89 T rotate counterclockwise°
90 ctrl-v open a new visual schnauzer window for the current dir
91
92 The following keys are redirected to the default visual schnauzer window:
93
94 space next image
95 backspace last image
96
97 =head2 THE VISUAL SCHNAUZER
98
99 You can use the following keys in the schnauzer window:
100
101 space move to and display next image
102 backspace move to and display previous image
103 return display selected picture
104
105 cursor keys move selection
106 page-up move one page up
107 page-down move one page down
108 home move to first file
109 end move to last file
110
111 ctrl-g generate icons for the selected files
112 ctrl-d delete selected files WITHOUT ASKING AGAIN
113
114 =head1 BUGS/TODO
115
116 rotate on disk
117 print
118 lots of ui issues
119 save(?)
120 preferences
121 ctrl-u in schnauzer
122 shift-cursor in schnauzer
123
124 =head1 AUTHOR
125
126 Marc Lehmann <cv@plan9.de>.
127
128 =cut
129