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