From: ellson Date: Fri, 11 Aug 2006 14:49:05 +0000 (+0000) Subject: enable -Tgtk plugin X-Git-Tag: LAST_LIBGRAPH~32^2~5983 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=19a099278f62353f024be6430e182717f3deb765;p=graphviz enable -Tgtk plugin --- diff --git a/configure.ac b/configure.ac index 97803b67c..5de7775bb 100644 --- a/configure.ac +++ b/configure.ac @@ -1895,6 +1895,7 @@ AC_CONFIG_FILES(Makefile plugin/dot_layout/Makefile plugin/neato_layout/Makefile plugin/xlib/Makefile + plugin/gtk/Makefile cmd/Makefile cmd/dot/Makefile cmd/tools/Makefile diff --git a/plugin/Makefile.am b/plugin/Makefile.am index b82d36a6e..0a2c2cc78 100644 --- a/plugin/Makefile.am +++ b/plugin/Makefile.am @@ -1,6 +1,6 @@ # $Id$ $Revision$ ## Process this file with automake to produce Makefile.in -SUBDIRS = core gd pango dot_layout neato_layout xlib +SUBDIRS = core gd pango dot_layout neato_layout xlib gtk EXTRA_DIST = Makefile.old diff --git a/plugin/gtk/gvdevice_gtk.c b/plugin/gtk/gvdevice_gtk.c index d59376039..785b7e29d 100644 --- a/plugin/gtk/gvdevice_gtk.c +++ b/plugin/gtk/gvdevice_gtk.c @@ -19,9 +19,14 @@ #endif #include +#include "gvplugin_device.h" + +#ifdef HAVE_GTK #include -#include "gvplugin_device.h" +#include +#ifdef CAIRO_HAS_XLIB_SURFACE +#include #include "interface.h" #include "support.h" @@ -55,15 +60,11 @@ attr_value_edited_cb(GtkCellRendererText *renderer, gchar *pathStr, gchar *newTe static void initialize_gtk(GVJ_t *firstjob) { -} - -static void finalize_gtk(GVJ_t *firstjob) -{ - GVJ_t *job; - GtkWidget *window1, *drawingarea1, *drawingarea2, *treeview2; - GtkListStore *attr_store; - GtkCellRenderer *value_renderer; - GdkScreen *scr; + Display *dpy; + const char *display_name = NULL; + int scr; +// GdkScreen *scr1; +// GtkWidget *window1; #if 0 #ifdef ENABLE_NLS @@ -79,6 +80,30 @@ static void finalize_gtk(GVJ_t *firstjob) // add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps"); +// window1 = create_window1 (); + +// scr = gdk_drawable_get_screen (window1); +// firstjob->device_dpi.x = gdk_screen_get_width(scr) * 25.4 / gdk_screen_get_width_mm(scr); /* pixels_per_inch */ +// firstjob->device_dpi.y = gdk_screen_get_height(scr) * 25.4 / gdk_screen_get_height_mm(scr); + dpy = XOpenDisplay(display_name); + if (dpy == NULL) { + fprintf(stderr, "Failed to open XLIB display: %s\n", + XDisplayName(NULL)); + return; + } + scr = DefaultScreen(dpy); + firstjob->device_dpi.x = DisplayWidth(dpy, scr) * 25.4 / DisplayWidthMM(dpy, scr); + firstjob->device_dpi.y = DisplayHeight(dpy, scr) * 25.4 / DisplayHeightMM(dpy, scr); + firstjob->device_sets_dpi = true; +} + +static void finalize_gtk(GVJ_t *firstjob) +{ + GVJ_t *job; + GtkWidget *window1, *drawingarea1, *drawingarea2, *treeview2; + GtkListStore *attr_store; + GtkCellRenderer *value_renderer; + for (job = firstjob; job; job = job->next_active) { window1 = create_window1 (); @@ -109,14 +134,6 @@ static void finalize_gtk(GVJ_t *firstjob) g_object_set_data(G_OBJECT(drawingarea1), "attr_store", attr_store); gtk_widget_show (window1); - - scr = gdk_drawable_get_screen (drawingarea1->window); - job->dpi.x = gdk_screen_get_width(scr) * 25.4 / gdk_screen_get_width_mm(scr); /* pixels_per_inch */ - job->dpi.y = gdk_screen_get_height(scr) * 25.4 / gdk_screen_get_height_mm(scr); - - /* adjust width/height for real dpi */ - job->width *= job->dpi.x / POINTS_PER_INCH; - job->height *= job->dpi.y / POINTS_PER_INCH; } gtk_main(); @@ -126,9 +143,15 @@ static gvdevice_engine_t device_engine_gtk = { initialize_gtk, finalize_gtk, }; +#endif +#endif gvplugin_installed_t gvdevice_types_gtk[] = { +#ifdef HAVE_GTK +#ifdef CAIRO_HAS_XLIB_SURFACE {0, "gtk", 0, &device_engine_gtk, NULL}, +#endif +#endif {0, NULL, 0, NULL, NULL} };