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