Re: image file iconic view

From: Paul Archer <tigger_at_io.com>
Date: Tue, 4 Oct 2005 11:50:18 -0500 (CDT)
To: Anton Berezin <tobez_at_tobez.org>

10:00am, Anton Berezin wrote:

> On Mon, Oct 03, 2005 at 09:52:47PM -0500, Paul Archer wrote:
>> My goal in learning/using Prima is to write an image viewing/cataloging
>> application like ACDSee (www.acdsystems.com) or Thumbsplus
>> (www.cerious.com). That might be biting off more than I can chew, but I'm
>> willing to try.
>
> That sounds interesting! I hope you are going to release it as an open
> source application? :-)
>
That's the plan!

>> Anyway, can anyone (Dmitri?) give me some pointers on what widget(s) to use
>> to implement a file list/icon view like these programs have? (See
>> www.acdsystems.com/images/products/acdsee/features/acdsee-tour-1-lg.jpg for
>> an example of what I mean.)
>
> The easiest would probably be to slightly override ListViewer (it is
> meant to be overridden). Below is a small, but complete script which
> uses notifications to that effect, altough you would probably want to do
> a proper subclassing.
>
Thanks for the tip/script.
I've got a couple of questions about it. First, I noticed that the list
reads top to bottom first, instead of left to right. In other words, you
get:
1 4 7
2 5 8
3 6 9

Is there an easy way to make it do:
1 2 3
4 5 6
7 8 9

And the ListViewer box doesn't resize when the main window resizes. Does it
just need a packing option or similar to make it resize automatically?

Thanks,

Paul

> use strict;
> use warnings;
> use lib qw(/home/tobez/src/Prima);
> use Prima qw( Lists Application );
>
> my $w = Prima::MainWindow->create(
> name => "IVL",
> origin => [ 100, 100],
> size => [ 600, 400],
> text => "Funny list",
> );
>
> $w-> insert(ListViewer =>
> origin => [10,10],
> size => [580,380],
> hScroll => 1,
> vScroll => 1,
> multiSelect => 0,
> extendedSelect => 1,
> name => 'ILB',
> multiColumn => 1,
> itemWidth => 100,
> itemHeight => 60,
> onDrawItem => \&draw_item,
> onMeasureItem => sub { ${$_[2]} = 100 },
> items => [1..40],
> gridColor => cl::LightGray,
> hiliteBackColor=> cl::LightCyan,
> );
>
> sub draw_item
> {
> my ($me, $p, $i, $x1, $y1, $x2, $y2, $sel, $foc) = @_;
>
> my $fore = cl::Black;
> my $back = ($sel || $foc) ? $me->colorIndex(ci::Hilite) : $me->backColor;
>
> # of course, you are supposed to paint your thumbnail images here
> $p->color($back);
> $p->bar($x1, $y1, $x2, $y2);
> $p->color($fore);
> $p->rectangle($x1+1, $y1+1, $x2-1, $y2-1);
> my $h = $p->font->height;
> my $s = "Image $i";
> my $w = $p->get_text_width($s);
> $p->text_out($s, ($x2+$x1-$w)/2, ($y2+$y1-$h)/2);
> }
>
> run Prima;
>
> Hope this helps,
> \Anton.
> --
> An undefined problem has an infinite number of solutions.
> -- Robert A. Humphrey
>

-----------------
       WWJD?
      JWRTFM
-----------------
Received on Tue 04 Oct 2005 - 18:50:25 CEST

This archive was generated by hypermail 2.2.0 : Sat 19 Mar 2011 - 18:35:06 CET