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

File Contents

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