[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: GTK/RENDER: more information



On Tue, Mar 01, 2005 at 09:41:16AM -0600, Bill Wilson wrote:
> On Tue, 01 Mar 2005 13:51:58 +0000
> "Daniel Nilsson" <daniel@xxxxxxxxxxxxxxx> wrote:
> 
> > If you edit gui-top-window.c and make the gui_output_set_name_label function
> > look like this you can even load a layout into PCB !
> 
> I saw your post yesterday and the tarball up since last night has this fixed.
> 
> It also has the 'v' key and cursor warping that Harry mentioned.

Great !

I've got to say, I'm impressed with the amount of work you have put in
the port the GUI code to GTK+. I think this is going to be very
important for PCB in the future, it makes the GUI code more
maintainable and in my mind makes the application more interesting to
a lot of people.

I was wondering how you solved the problem of outputting the
actual graphical layout elements ? I take it you didn't rewrite this
portion of the code ? Was that already stored in memory in such a way
that it could easily be put in the gdk_drawing_area ?

In your first mail you wondered about the rotation of text. The
application I've written in GTK+ does use Pango to render text onto a
Pixmap. This is not that hard to do, I guess the issue is rather with
the rotation. 

Owen Taylor put in some work related to this, and I believe it is now
supported to render rotated text using Pango. The whole thing is
pretty well desctribed on the mailing lists so I'll just point you to
his blog where it's all described.

http://fishsoup.net/blog/

I did a simple test myself using just a rotated GtkLabel and that
works as expected. This does however require GTK+ 2.6 or above I
think, I attached the simple test case in case someone is inclined to
try it out against older GTK+ versions.

I guess another way to solve this would be to render the text normally
onto a Pixmap and then rotate the pixmap before you then place the
pixmap onto the drawing area. Not sure what the performance
implications would be of doing so though.

-- 
Daniel Nilsson
 
#include <gtk/gtk.h>

int main( int   argc, char *argv[] )
{
    GtkWidget *window;
    GtkWidget *label;
    
    gtk_init (&argc, &argv);
    
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
        
    label = gtk_label_new("Test label");
    gtk_label_set_angle((GtkLabel*) label, 90.0);

    gtk_container_add (GTK_CONTAINER (window), label);
    
    gtk_widget_show (label);
    gtk_widget_show (window);
    
    gtk_main ();
    
    return 0;
}