[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: NSTableView, rows in reverse order
From: |
Fred Kiefer |
Subject: |
Re: NSTableView, rows in reverse order |
Date: |
Thu, 24 Jul 2008 08:57:55 +0200 |
I think what you are seeing is the correct behaviour. It should even be the
same on MacOSX, but I am unable to test at the moment.
What happens is that you draw into a view you just created and this view isn't
flipped, whereas an NSTableView is flipped. That way the rows show up in the
wrong order. You should be able to correct this by using a flipped view instead.
My main question to you code is different, why are you doing it that way after
all? Why don't you just ask the NSTableView for a PS representation? I am not
saying this will be working completely correct, but it surely is better to go
in that direction and fix any problems you encounter.
Fred
-------- Original-Nachricht --------
> Datum: Wed, 23 Jul 2008 22:48:41 +0000 (GMT)
> Von: Marko Riedel <markoriedelde@yahoo.de>
> An: DISCUSS GNUstep <discuss-gnustep@gnu.org>
> Betreff: NSTableView, rows in reverse order
> Hi all,
>
> I've come across something where I'm not sure if it's a bug or a feature.
>
> The following code fragment draws an existing tableview into a bitmap, for
> later export as TIFF and conversion to PostScript.
>
> NSRect box = [table bounds],
> hbox = [[table headerView] bounds];
>
> NSRect winrect = box;
> winrect.size.height += hbox.size.height;
>
> NSWindow *win =
> [[NSWindow alloc]
> initWithContentRect:winrect
> styleMask:0
> backing:NSBackingStoreRetained
> defer:NO];
>
> [[win contentView] lockFocus];
>
> [table drawRect:box];
>
> [NSGraphicsContext saveGraphicsState];
>
> PStranslate(0, box.size.height);
> [[table headerView] drawRect:hbox];
>
> [NSGraphicsContext restoreGraphicsState];
>
> NSBitmapImageRep
> *boxRep = [NSBitmapImageRep alloc];
> [boxRep
> initWithFocusedViewRect:[[win contentView] bounds]];
> AUTORELEASE(boxRep);
>
> [[win contentView] unlockFocus];
>
> I guess I could replace the last "[[win contentView] bounds]" with
> "winrect" but that's not relevant here.
>
> The phenomenon I'm observing is that the tableview draws the rows in
> reverse order, from bottom to top instead of from top to bottom. So the output
> does not match what the user sees on screen. The row that comes first on
> screen is drawn last in the bitmap.
>
> Curious, to say the least.
>
> Best regards,
>
> Marko
>
>
> +-------------------------------------------------------------+
> | Marko Riedel, EDV Neue Arbeit gGmbH, markoriedelde@yahoo.de |
> | http://www.geocities.com/markoriedelde/index.html |
> +-------------------------------------------------------------+
>
>
> __________________________________________________________
> Gesendet von Yahoo! Mail.
> Dem pfiffigeren Posteingang.
> http://de.overview.mail.yahoo.com
>
>
> _______________________________________________
> Discuss-gnustep mailing list
> Discuss-gnustep@gnu.org
> http://lists.gnu.org/mailman/listinfo/discuss-gnustep
--
GMX Kostenlose Spiele: Einfach online spielen und Spaß haben mit Pastry Passion!
http://games.entertainment.gmx.net/de/entertainment/games/free/puzzle/6169196