]> git.sur5r.net Git - glabels/commitdiff
Initial port to GTK3.
authorJim Evins <evins@snaught.com>
Mon, 4 Oct 2010 02:24:28 +0000 (22:24 -0400)
committerJim Evins <evins@snaught.com>
Mon, 4 Oct 2010 02:24:28 +0000 (22:24 -0400)
Still has update and drawing problems with view.c.

25 files changed:
configure.ac
src/Makefile.am
src/color-swatch.c
src/cursors/Makefile.am [new file with mode: 0644]
src/cursors/cursor_barcode.png [new file with mode: 0644]
src/cursors/cursor_box.png [new file with mode: 0644]
src/cursors/cursor_ellipse.png [new file with mode: 0644]
src/cursors/cursor_image.png [new file with mode: 0644]
src/cursors/cursor_line.png [new file with mode: 0644]
src/cursors/cursor_text.png [new file with mode: 0644]
src/font-sample.c
src/media-select.c
src/merge-properties-dialog.c
src/mini-label-preview.c
src/mini-preview.c
src/prefs-dialog.c
src/view-barcode.c
src/view-box.c
src/view-ellipse.c
src/view-image.c
src/view-line.c
src/view-text.c
src/view.c
src/wdgt-chain-button.c
src/window.c

index 645fd2f6e340ed41d0774a3fe53a57af2926f6aa..2a595204b6b1620b14007649d7b195a94b1e1984 100644 (file)
@@ -30,6 +30,7 @@ AC_PROG_INSTALL
 GNOME_COMPILE_WARNINGS
 
 AC_PATH_PROG(GLIB_GENMARSHAL,         glib-genmarshal)
+AC_PATH_PROG(GDK_PIXBUF_CSOURCE,      gdk-pixbuf-csource)
 AC_PATH_PROG(UPDATE_MIME_DATABASE,    update-mime-database)
 AC_PATH_PROG(UPDATE_DESKTOP_DATABASE, update-desktop-database)
 AC_PATH_PROG(GTK_UPDATE_ICON_CACHE,   gtk-update-icon-cache)
@@ -72,13 +73,13 @@ dnl ---------------------------------------------------------------------------
 dnl - Library dependencies
 dnl ---------------------------------------------------------------------------
 dnl Required dependencies
-GLIB_REQUIRED=2.25.11
-GTK_REQUIRED=2.20.0
-LIBXML_REQUIRED=2.7.0
-LIBRSVG_REQUIRED=2.26.0
+GLIB_REQUIRED=2.27.1
+GTK_REQUIRED=2.91.1
+LIBXML_REQUIRED=2.7.7
+LIBRSVG_REQUIRED=2.26.3
 
 dnl Optional dependencies
-LIBEBOOK_REQUIRED=2.28.0
+LIBEBOOK_REQUIRED=2.30.3
 LIBBARCODE_REQUIRED=0.98
 LIBQRENCODE_REQUIRED=3.1.0
 LIBIEC16022_REQUIRED=0.2.4
@@ -100,9 +101,9 @@ dnl - GLABELS prerequisites
 dnl ---------------------------------------------------------------------------
 PKG_CHECK_MODULES(GLABELS, [\
        glib-2.0 >= $GLIB_REQUIRED \
-       gtk+-2.0 >= $GTK_REQUIRED \
+       gtk+-3.0 >= $GTK_REQUIRED \
        libxml-2.0 >= $LIBXML_REQUIRED \
-       librsvg-2.0 > $LIBRSVG_REQUIRED \
+       librsvg-2.0 >= $LIBRSVG_REQUIRED \
 ])
 
 AC_SUBST(GLABELS_CFLAGS)
@@ -270,6 +271,7 @@ Makefile
 libglabels/Makefile
 libglabels/${LIBGLABELS_BRANCH}.pc
 src/Makefile
+src/cursors/Makefile
 src/pixmaps/Makefile
 data/Makefile
 data/desktop/Makefile
index aac2b7ef1f522319a0c1f1d369e39018f4f6dc56..4c464deed1e33ccba581ffb3ff143eff63a89d5f 100644 (file)
@@ -1,5 +1,5 @@
 
-SUBDIRS= ../libglabels pixmaps
+SUBDIRS= ../libglabels pixmaps cursors
 
 bin_PROGRAMS = glabels-3 glabels-3-batch
 
index 19f4ed691899a620adc631cea75262dd625be9ba..b36fdc29e464a912d4fd66a867584b6002505f57 100644 (file)
@@ -58,8 +58,8 @@ static void       style_set_cb                (GtkWidget      *widget,
 
 static void       redraw                      (glColorSwatch  *this);
 
-static gboolean   expose_event_cb             (GtkWidget      *widget,
-                                               GdkEventExpose *event);
+static gboolean   draw_cb                     (GtkWidget      *widget,
+                                               cairo_t        *cr);
 
 static void       draw_swatch                 (glColorSwatch  *this,
                                                cairo_t        *cr);
@@ -85,8 +85,8 @@ gl_color_swatch_class_init (glColorSwatchClass *class)
 
        gobject_class->finalize    = gl_color_swatch_finalize;
 
-        widget_class->expose_event = expose_event_cb;
         widget_class->style_set    = style_set_cb;
+        widget_class->draw         = draw_cb;
 }
 
 
@@ -172,17 +172,15 @@ style_set_cb (GtkWidget        *widget,
 static void
 redraw (glColorSwatch  *this)
 {
-        GdkWindow *window;
-       GdkRegion *region;
+        GdkWindow     *window;
+        GtkAllocation  allocation;
 
         window = gtk_widget_get_window (GTK_WIDGET (this));
 
         if (window)
         {
-                /* redraw the cairo canvas forcing an expose event */
-                region = gdk_drawable_get_clip_region (window);
-                gdk_window_invalidate_region (window, region, TRUE);
-                gdk_region_destroy (region);
+                gtk_widget_get_allocation (GTK_WIDGET (this), &allocation);
+                gdk_window_invalidate_rect (window, &allocation, FALSE);
         }
 }
 
@@ -191,29 +189,13 @@ redraw (glColorSwatch  *this)
 /* "Expose event" callback.                                                  */
 /*****************************************************************************/
 static gboolean
-expose_event_cb (GtkWidget      *widget,
-                 GdkEventExpose *event)
+draw_cb (GtkWidget      *widget,
+         cairo_t        *cr)
 {
-        GdkWindow     *window;
-       cairo_t       *cr;
         GtkAllocation  allocation;
 
-        window = gtk_widget_get_window (widget);
-
-       cr = gdk_cairo_create (window);
-
-       cairo_rectangle (cr,
-                       event->area.x, event->area.y,
-                       event->area.width, event->area.height);
-       cairo_clip (cr);
-
-        gtk_widget_get_allocation (widget, &allocation);
-        cairo_translate (cr, allocation.x, allocation.y);
-
        draw_swatch (GL_COLOR_SWATCH (widget), cr);
 
-       cairo_destroy (cr);
-
        return FALSE;
 }
 
diff --git a/src/cursors/Makefile.am b/src/cursors/Makefile.am
new file mode 100644 (file)
index 0000000..6a01d8e
--- /dev/null
@@ -0,0 +1,26 @@
+
+CURSOR_IMAGES =                                \
+       cursor_barcode.png              \
+       cursor_box.png                  \
+       cursor_ellipse.png              \
+       cursor_image.png                \
+       cursor_line.png                 \
+       cursor_text.png
+
+VARIABLES1 = \
+       cursor_barcode_pixdata  $(srcdir)/cursor_barcode.png    \
+       cursor_box_pixdata      $(srcdir)/cursor_box.png        \
+       cursor_ellipse_pixdata  $(srcdir)/cursor_ellipse.png    \
+       cursor_image_pixdata    $(srcdir)/cursor_image.png      \
+       cursor_line_pixdata     $(srcdir)/cursor_line.png       \
+       cursor_text_pixdata     $(srcdir)/cursor_text.png
+
+noinst_DATA = cursor_pixdata.h
+CLEANFILES = $(noinst_DATA)
+
+cursor_pixdata.h: $(CURSOR_IMAGES)
+       $(AM_V_GEN) $(GDK_PIXBUF_CSOURCE) \
+          --struct --build-list $(VARIABLES1) > $(srcdir)/cursor_pixdata.h || \
+           ( rm -f $(srcdir)/cursor_pixdata.h && false )
+
+EXTRA_DIST = $(CURSOR_IMAGES) cursor_pixdata.h
diff --git a/src/cursors/cursor_barcode.png b/src/cursors/cursor_barcode.png
new file mode 100644 (file)
index 0000000..59ba928
Binary files /dev/null and b/src/cursors/cursor_barcode.png differ
diff --git a/src/cursors/cursor_box.png b/src/cursors/cursor_box.png
new file mode 100644 (file)
index 0000000..c30c0d4
Binary files /dev/null and b/src/cursors/cursor_box.png differ
diff --git a/src/cursors/cursor_ellipse.png b/src/cursors/cursor_ellipse.png
new file mode 100644 (file)
index 0000000..40924af
Binary files /dev/null and b/src/cursors/cursor_ellipse.png differ
diff --git a/src/cursors/cursor_image.png b/src/cursors/cursor_image.png
new file mode 100644 (file)
index 0000000..e5b4781
Binary files /dev/null and b/src/cursors/cursor_image.png differ
diff --git a/src/cursors/cursor_line.png b/src/cursors/cursor_line.png
new file mode 100644 (file)
index 0000000..31d8c6e
Binary files /dev/null and b/src/cursors/cursor_line.png differ
diff --git a/src/cursors/cursor_text.png b/src/cursors/cursor_text.png
new file mode 100644 (file)
index 0000000..cda6b21
Binary files /dev/null and b/src/cursors/cursor_text.png differ
index ea1f5b7ace3c23a33861b6e26c4799ba406f456f..fbda823050f614913a9a69638bd66755a3553212 100644 (file)
@@ -61,8 +61,8 @@ static void       style_set_cb                (GtkWidget      *widget,
 
 static void       redraw                      (glFontSample   *this);
 
-static gboolean   expose_event_cb             (GtkWidget      *widget,
-                                               GdkEventExpose *event);
+static gboolean   draw_cb                     (GtkWidget      *widget,
+                                               cairo_t        *cr);
 
 static void       draw_sample                 (glFontSample   *this,
                                                cairo_t        *cr);
@@ -88,8 +88,8 @@ gl_font_sample_class_init (glFontSampleClass *class)
 
        gobject_class->finalize    = gl_font_sample_finalize;
 
-        widget_class->expose_event = expose_event_cb;
         widget_class->style_set    = style_set_cb;
+        widget_class->draw         = draw_cb;
 }
 
 
@@ -163,17 +163,15 @@ style_set_cb (GtkWidget        *widget,
 static void
 redraw (glFontSample  *this)
 {
-        GdkWindow *window;
-       GdkRegion *region;
+        GdkWindow     *window;
+        GtkAllocation  allocation;
 
         window = gtk_widget_get_window (GTK_WIDGET (this));
 
         if (window)
         {
-                /* redraw the cairo canvas forcing an expose event */
-                region = gdk_drawable_get_clip_region (window);
-                gdk_window_invalidate_region (window, region, TRUE);
-                gdk_region_destroy (region);
+                gtk_widget_get_allocation (GTK_WIDGET (this), &allocation);
+                gdk_window_invalidate_rect (window, &allocation, FALSE);
         }
 }
 
@@ -182,29 +180,13 @@ redraw (glFontSample  *this)
 /* "Expose event" callback.                                                  */
 /*****************************************************************************/
 static gboolean
-expose_event_cb (GtkWidget      *widget,
-                 GdkEventExpose *event)
+draw_cb (GtkWidget      *widget,
+         cairo_t        *cr)
 {
-        GdkWindow     *window;
-       cairo_t       *cr;
         GtkAllocation  allocation;
 
-        window = gtk_widget_get_window (widget);
-
-       cr = gdk_cairo_create (window);
-
-       cairo_rectangle (cr,
-                       event->area.x, event->area.y,
-                       event->area.width, event->area.height);
-       cairo_clip (cr);
-
-        gtk_widget_get_allocation (widget, &allocation);
-        cairo_translate (cr, allocation.x, allocation.y);
-
        draw_sample (GL_FONT_SAMPLE (widget), cr);
 
-       cairo_destroy (cr);
-
        return FALSE;
 }
 
index e6f1c534d02aab34f7b2e1e68e2ec985a0c13ed3..4391d3c0ce4435ef867cc5f46a4b8060690f79ea 100644 (file)
@@ -132,7 +132,7 @@ static void   custom_delete_clicked_cb   (GtkButton              *button,
                                           gpointer                user_data);
 
 static void   page_changed_cb            (GtkNotebook            *notebook,
-                                          GtkNotebookPage        *page,
+                                          GtkWidget              *page,
                                           guint                   page_num,
                                           gpointer                user_data);
 
@@ -648,7 +648,7 @@ custom_delete_clicked_cb (GtkButton  *button,
 /*--------------------------------------------------------------------------*/
 static void
 page_changed_cb (GtkNotebook            *notebook,
-                 GtkNotebookPage        *page,
+                 GtkWidget              *page,
                  guint                   page_num,
                  gpointer                user_data)
 {
index bce6508f51e4842da3e5cd9af8b776a92df67a1b..e6f3d69cc4ca636584c5141bb8678913171de3f4 100644 (file)
@@ -154,7 +154,6 @@ gl_merge_properties_dialog_init (glMergePropertiesDialog *dialog)
 
         vbox = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
 
-       gtk_dialog_set_has_separator (GTK_DIALOG(dialog), FALSE);
        gtk_dialog_add_button (GTK_DIALOG (dialog),
                                GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
        dialog->priv->ok_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
index d1f06c7eb26c8b373b33960f8f4db2f6f7b23afb..ad7565e83d4e2c0f89a57495b1faf9f41f1e1139 100644 (file)
@@ -63,8 +63,8 @@ static void       style_set_cb                   (GtkWidget            *widget,
 
 static void       redraw                         (glMiniLabelPreview   *this);
 
-static gboolean   expose_event_cb                (GtkWidget            *widget,
-                                                  GdkEventExpose       *event);
+static gboolean   draw_cb                        (GtkWidget            *widget,
+                                                  cairo_t              *cr);
 
 static void       draw_preview                   (glMiniLabelPreview   *this,
                                                   cairo_t              *cr);
@@ -89,8 +89,8 @@ gl_mini_label_preview_class_init (glMiniLabelPreviewClass *class)
 
        gobject_class->finalize    = gl_mini_label_preview_finalize;
 
-        widget_class->expose_event = expose_event_cb;
         widget_class->style_set    = style_set_cb;
+        widget_class->draw         = draw_cb;
 }
 
 
@@ -181,17 +181,15 @@ style_set_cb (GtkWidget        *widget,
 static void
 redraw (glMiniLabelPreview  *this)
 {
-        GdkWindow *window;
-       GdkRegion *region;
+        GdkWindow     *window;
+        GtkAllocation  allocation;
 
         window = gtk_widget_get_window (GTK_WIDGET (this));
 
         if (window)
         {
-                /* redraw the cairo canvas forcing an expose event */
-                region = gdk_drawable_get_clip_region (window);
-                gdk_window_invalidate_region (window, region, TRUE);
-                gdk_region_destroy (region);
+                gtk_widget_get_allocation (GTK_WIDGET (this), &allocation);
+                gdk_window_invalidate_rect (window, &allocation, FALSE);
         }
 }
 
@@ -200,29 +198,12 @@ redraw (glMiniLabelPreview  *this)
 /* "Expose event" callback.                                                  */
 /*****************************************************************************/
 static gboolean
-expose_event_cb (GtkWidget      *widget,
-                 GdkEventExpose *event)
+draw_cb (GtkWidget      *widget,
+         cairo_t        *cr)
 {
-        GdkWindow     *window;
-       cairo_t       *cr;
-        GtkAllocation  allocation;
-
-        window = gtk_widget_get_window (widget);
-
-       cr = gdk_cairo_create (window);
-
-       cairo_rectangle (cr,
-                       event->area.x, event->area.y,
-                       event->area.width, event->area.height);
-       cairo_clip (cr);
-
-        gtk_widget_get_allocation (widget, &allocation);
-        cairo_translate (cr, allocation.x, allocation.y);
 
        draw_preview (GL_MINI_LABEL_PREVIEW (widget), cr);
 
-       cairo_destroy (cr);
-
        return FALSE;
 }
 
index 11741046fcf396e0537439549fcce2bc42197367..3ea0956d6b0f786a26e8d7a6f44e34b6c5dd6f30 100644 (file)
@@ -120,8 +120,8 @@ static gboolean button_release_event_cb        (GtkWidget              *widget,
                                                 GdkEventButton         *event);
 
 
-static gboolean expose_event_cb                (GtkWidget              *widget,
-                                                GdkEventExpose         *event,
+static gboolean draw_cb                        (GtkWidget              *widget,
+                                                cairo_t                *cr,
                                                 glMiniPreview          *this);
 static void     style_set_cb                   (GtkWidget              *widget,
                                                 GtkStyle               *previous_style,
@@ -237,8 +237,8 @@ gl_mini_preview_init (glMiniPreview *this)
         gtk_widget_set_has_window(this->priv->canvas, FALSE);
         gtk_container_add (GTK_CONTAINER (this), this->priv->canvas);
 
-        g_signal_connect (G_OBJECT (this->priv->canvas), "expose-event",
-                          G_CALLBACK (expose_event_cb), this);
+        g_signal_connect (G_OBJECT (this->priv->canvas), "draw",
+                          G_CALLBACK (draw_cb), this);
         g_signal_connect (G_OBJECT (this->priv->canvas), "style-set",
                           G_CALLBACK (style_set_cb), this);
 
@@ -788,34 +788,15 @@ find_closest_label (glMiniPreview      *this,
 /* Expose event handler.                                                    */
 /*--------------------------------------------------------------------------*/
 static gboolean
-expose_event_cb (GtkWidget       *widget,
-                 GdkEventExpose  *event,
-                 glMiniPreview   *this)
+draw_cb (GtkWidget       *widget,
+         cairo_t         *cr,
+         glMiniPreview   *this)
 {
-        GdkWindow     *window;
-        cairo_t       *cr;
-        GtkAllocation  allocation;
-
         gl_debug (DEBUG_MINI_PREVIEW, "START");
 
         this->priv->update_scheduled_flag = FALSE;
-
-        window = gtk_widget_get_window (widget);
-
-        cr = gdk_cairo_create (window);
-
-        cairo_rectangle (cr,
-                        event->area.x, event->area.y,
-                        event->area.width, event->area.height);
-        cairo_clip (cr);
-
-        gtk_widget_get_allocation (widget, &allocation);
-        cairo_translate (cr, allocation.x, allocation.y);
-
         draw (this, cr);
 
-        cairo_destroy (cr);
-
         gl_debug (DEBUG_MINI_PREVIEW, "END");
         return FALSE;
 }
@@ -843,8 +824,8 @@ style_set_cb (GtkWidget        *widget,
 static void
 redraw (glMiniPreview      *this)
 {
-        GdkWindow *window;
-        GdkRegion *region;
+        GdkWindow     *window;
+        GtkAllocation  allocation;
 
         gl_debug (DEBUG_MINI_PREVIEW, "START");
 
@@ -857,9 +838,8 @@ redraw (glMiniPreview      *this)
                 {
                         this->priv->update_scheduled_flag = TRUE;
 
-                        region = gdk_drawable_get_clip_region (window);
-                        gdk_window_invalidate_region (window, region, TRUE);
-                        gdk_region_destroy (region);
+                        gtk_widget_get_allocation (GTK_WIDGET (this), &allocation);
+                        gdk_window_invalidate_rect (window, &allocation, FALSE);
                 }
         }
 
index 9dc288310e3aadeefa175ced5832c97b3f336d5f..dd3bcca152165a7c2988236c0fd0ecd89fbd0f47 100644 (file)
@@ -158,7 +158,6 @@ gl_prefs_dialog_init (glPrefsDialog *dialog)
                return;
        }
 
-       gtk_dialog_set_has_separator (GTK_DIALOG(dialog), FALSE);
        gtk_dialog_add_button (GTK_DIALOG(dialog), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
        gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE);
 
index 3f87b5bd432a2d3e8495bd929fe8cb6c6a184c27..6510e770dfdc04a15e4c1bf4162d396f47742a20 100644 (file)
 
 #include "view-barcode.h"
 
-#include "label-barcode.h"
+#include <gdk-pixbuf/gdk-pixdata.h>
 
-#include "pixmaps/cursor_barcode.xbm"
-#include "pixmaps/cursor_barcode_mask.xbm"
+#include "label-barcode.h"
+#include "cursors/cursor_pixdata.h"
 
 #include "debug.h"
 
@@ -34,6 +34,9 @@
 /* Private macros and constants.                          */
 /*========================================================*/
 
+#define X_HOTSPOT 7
+#define Y_HOTSPOT 7
+
 
 /*========================================================*/
 /* Private types.                                         */
@@ -57,23 +60,13 @@ GdkCursor *
 gl_view_barcode_get_create_cursor (void)
 {
        GdkCursor       *cursor = NULL;
-       GdkPixmap       *pixmap_data, *pixmap_mask;
-       GdkColor         fg = { 0, 0, 0, 0 };
-       GdkColor         bg = { 0, 65535, 65535, 65535 };
+       GdkPixbuf       *pixbuf;
 
        gl_debug (DEBUG_VIEW, "START");
 
-        pixmap_data = gdk_bitmap_create_from_data (NULL,
-                                                   (gchar *)cursor_barcode_bits,
-                                                   cursor_barcode_width,
-                                                   cursor_barcode_height);
-        pixmap_mask = gdk_bitmap_create_from_data (NULL,
-                                                   (gchar *)cursor_barcode_mask_bits,
-                                                   cursor_barcode_mask_width,
-                                                   cursor_barcode_mask_height);
-        cursor = gdk_cursor_new_from_pixmap (pixmap_data, pixmap_mask, &fg,
-                                             &bg, cursor_barcode_x_hot,
-                                             cursor_barcode_y_hot);
+        pixbuf = gdk_pixbuf_from_pixdata (&cursor_barcode_pixdata, FALSE, NULL);
+        cursor = gdk_cursor_new_from_pixbuf (gdk_display_get_default (), pixbuf, X_HOTSPOT, Y_HOTSPOT);
+        g_object_unref (pixbuf);
 
        gl_debug (DEBUG_VIEW, "END");
 
index 3c3921943c8ce6135b79afb4c92327abb7bc2ed4..a69bfd1cb0a6620c00bb65ac550d66cbb2cbea14 100644 (file)
 
 #include "view-box.h"
 
-#include "label-box.h"
+#include <gdk-pixbuf/gdk-pixdata.h>
 
-#include "pixmaps/cursor_box.xbm"
-#include "pixmaps/cursor_box_mask.xbm"
+#include "label-box.h"
+#include "cursors/cursor_pixdata.h"
 
 #include "debug.h"
 
@@ -34,6 +34,9 @@
 /* Private macros and constants.                          */
 /*========================================================*/
 
+#define X_HOTSPOT 7
+#define Y_HOTSPOT 7
+
 
 /*========================================================*/
 /* Private types.                                         */
@@ -57,23 +60,13 @@ GdkCursor *
 gl_view_box_get_create_cursor (void)
 {
        GdkCursor       *cursor = NULL;
-       GdkPixmap       *pixmap_data, *pixmap_mask;
-       GdkColor         fg = { 0, 0, 0, 0 };
-       GdkColor         bg = { 0, 65535, 65535, 65535 };
+       GdkPixbuf       *pixbuf;
 
        gl_debug (DEBUG_VIEW, "START");
 
-        pixmap_data = gdk_bitmap_create_from_data (NULL,
-                                                   (gchar *)cursor_box_bits,
-                                                   cursor_box_width,
-                                                   cursor_box_height);
-        pixmap_mask = gdk_bitmap_create_from_data (NULL,
-                                                   (gchar *)cursor_box_mask_bits,
-                                                   cursor_box_mask_width,
-                                                   cursor_box_mask_height);
-        cursor = gdk_cursor_new_from_pixmap (pixmap_data, pixmap_mask, &fg,
-                                             &bg, cursor_box_x_hot,
-                                             cursor_box_y_hot);
+        pixbuf = gdk_pixbuf_from_pixdata (&cursor_box_pixdata, FALSE, NULL);
+        cursor = gdk_cursor_new_from_pixbuf (gdk_display_get_default (), pixbuf, X_HOTSPOT, Y_HOTSPOT);
+        g_object_unref (pixbuf);
 
        gl_debug (DEBUG_VIEW, "END");
 
index 1f0707cc992970eaead728b8aeff7c88f5901382..7de5cd76de61e71fd4a0326776d1509e492f00d4 100644 (file)
 
 #include "view-ellipse.h"
 
-#include "label-ellipse.h"
+#include <gdk-pixbuf/gdk-pixdata.h>
 
-#include "pixmaps/cursor_ellipse.xbm"
-#include "pixmaps/cursor_ellipse_mask.xbm"
+#include "label-ellipse.h"
+#include "cursors/cursor_pixdata.h"
 
 #include "debug.h"
 
@@ -34,6 +34,9 @@
 /* Private macros and constants.                          */
 /*========================================================*/
 
+#define X_HOTSPOT 7
+#define Y_HOTSPOT 7
+
 
 /*========================================================*/
 /* Private types.                                         */
@@ -57,23 +60,13 @@ GdkCursor *
 gl_view_ellipse_get_create_cursor (void)
 {
        GdkCursor       *cursor = NULL;
-       GdkPixmap       *pixmap_data, *pixmap_mask;
-       GdkColor         fg = { 0, 0, 0, 0 };
-       GdkColor         bg = { 0, 65535, 65535, 65535 };
+       GdkPixbuf       *pixbuf;
 
        gl_debug (DEBUG_VIEW, "START");
 
-        pixmap_data = gdk_bitmap_create_from_data (NULL,
-                                                   (gchar *)cursor_ellipse_bits,
-                                                   cursor_ellipse_width,
-                                                   cursor_ellipse_height);
-        pixmap_mask = gdk_bitmap_create_from_data (NULL,
-                                                   (gchar *)cursor_ellipse_mask_bits,
-                                                   cursor_ellipse_mask_width,
-                                                   cursor_ellipse_mask_height);
-        cursor = gdk_cursor_new_from_pixmap (pixmap_data, pixmap_mask, &fg,
-                                             &bg, cursor_ellipse_x_hot,
-                                             cursor_ellipse_y_hot);
+        pixbuf = gdk_pixbuf_from_pixdata (&cursor_ellipse_pixdata, FALSE, NULL);
+        cursor = gdk_cursor_new_from_pixbuf (gdk_display_get_default (), pixbuf, X_HOTSPOT, Y_HOTSPOT);
+        g_object_unref (pixbuf);
 
        gl_debug (DEBUG_VIEW, "END");
 
index d3351707bee61bed7f134b584f9ede2bb04758d4..e6bd8ae41d8304f77a3b80fb6d25e9401eb42eeb 100644 (file)
 
 #include "view-image.h"
 
-#include "label-image.h"
+#include <gdk-pixbuf/gdk-pixdata.h>
 
-#include "pixmaps/cursor_image.xbm"
-#include "pixmaps/cursor_image_mask.xbm"
+#include "label-image.h"
+#include "cursors/cursor_pixdata.h"
 
 #include "debug.h"
 
@@ -34,6 +34,9 @@
 /* Private macros and constants.                          */
 /*========================================================*/
 
+#define X_HOTSPOT 7
+#define Y_HOTSPOT 7
+
 
 /*========================================================*/
 /* Private types.                                         */
@@ -56,23 +59,13 @@ GdkCursor *
 gl_view_image_get_create_cursor (void)
 {
        GdkCursor       *cursor = NULL;
-       GdkPixmap       *pixmap_data, *pixmap_mask;
-       GdkColor         fg = { 0, 0, 0, 0 };
-       GdkColor         bg = { 0, 65535, 65535, 65535 };
+       GdkPixbuf       *pixbuf;
 
        gl_debug (DEBUG_VIEW, "START");
 
-        pixmap_data = gdk_bitmap_create_from_data (NULL,
-                                                   (gchar *)cursor_image_bits,
-                                                   cursor_image_width,
-                                                   cursor_image_height);
-        pixmap_mask = gdk_bitmap_create_from_data (NULL,
-                                                   (gchar *)cursor_image_mask_bits,
-                                                   cursor_image_mask_width,
-                                                   cursor_image_mask_height);
-        cursor = gdk_cursor_new_from_pixmap (pixmap_data, pixmap_mask, &fg,
-                                             &bg, cursor_image_x_hot,
-                                             cursor_image_y_hot);
+        pixbuf = gdk_pixbuf_from_pixdata (&cursor_image_pixdata, FALSE, NULL);
+        cursor = gdk_cursor_new_from_pixbuf (gdk_display_get_default (), pixbuf, X_HOTSPOT, Y_HOTSPOT);
+        g_object_unref (pixbuf);
 
        gl_debug (DEBUG_VIEW, "END");
 
index 5a91234c85fc7e349fc51cc12c716f1756d68f72..9da709e1ba99e3b4a64047b4c5c3be004b17c6a0 100644 (file)
 
 #include "view-line.h"
 
-#include "label-line.h"
+#include <gdk-pixbuf/gdk-pixdata.h>
 
-#include "pixmaps/cursor_line.xbm"
-#include "pixmaps/cursor_line_mask.xbm"
+#include "label-line.h"
+#include "cursors/cursor_pixdata.h"
 
 #include "debug.h"
 
@@ -34,6 +34,9 @@
 /* Private macros and constants.                          */
 /*========================================================*/
 
+#define X_HOTSPOT 7
+#define Y_HOTSPOT 7
+
 
 /*========================================================*/
 /* Private types.                                         */
@@ -57,23 +60,13 @@ GdkCursor *
 gl_view_line_get_create_cursor (void)
 {
        GdkCursor       *cursor = NULL;
-       GdkPixmap       *pixmap_data, *pixmap_mask;
-       GdkColor         fg = { 0, 0, 0, 0 };
-       GdkColor         bg = { 0, 65535, 65535, 65535 };
+       GdkPixbuf       *pixbuf;
 
        gl_debug (DEBUG_VIEW, "START");
 
-        pixmap_data = gdk_bitmap_create_from_data (NULL,
-                                                   (gchar *)cursor_line_bits,
-                                                   cursor_line_width,
-                                                   cursor_line_height);
-        pixmap_mask = gdk_bitmap_create_from_data (NULL,
-                                                   (gchar *)cursor_line_mask_bits,
-                                                   cursor_line_mask_width,
-                                                   cursor_line_mask_height);
-        cursor = gdk_cursor_new_from_pixmap (pixmap_data, pixmap_mask, &fg,
-                                             &bg, cursor_line_x_hot,
-                                             cursor_line_y_hot);
+        pixbuf = gdk_pixbuf_from_pixdata (&cursor_line_pixdata, FALSE, NULL);
+        cursor = gdk_cursor_new_from_pixbuf (gdk_display_get_default (), pixbuf, X_HOTSPOT, Y_HOTSPOT);
+        g_object_unref (pixbuf);
 
        gl_debug (DEBUG_VIEW, "END");
 
index 9668b790ddaefce64cea5ad558fb353fca6aeee8..4757991976f4a8c9b390ab0b0c76f5b2aa8b2ba2 100644 (file)
 #include "view-text.h"
 
 #include <glib/gi18n.h>
+#include <gdk-pixbuf/gdk-pixdata.h>
 
 #include "label-text.h"
-
-#include "pixmaps/cursor_text.xbm"
-#include "pixmaps/cursor_text_mask.xbm"
+#include "cursors/cursor_pixdata.h"
 
 #include "debug.h"
 
@@ -36,6 +35,9 @@
 /* Private macros and constants.                          */
 /*========================================================*/
 
+#define X_HOTSPOT 7
+#define Y_HOTSPOT 7
+
 
 /*========================================================*/
 /* Private types.                                         */
@@ -59,23 +61,13 @@ GdkCursor *
 gl_view_text_get_create_cursor (void)
 {
        GdkCursor       *cursor = NULL;
-       GdkPixmap       *pixmap_data, *pixmap_mask;
-       GdkColor         fg = { 0, 0, 0, 0 };
-       GdkColor         bg = { 0, 65535, 65535, 65535 };
+       GdkPixbuf       *pixbuf;
 
        gl_debug (DEBUG_VIEW, "START");
 
-        pixmap_data = gdk_bitmap_create_from_data (NULL,
-                                                   (gchar *)cursor_text_bits,
-                                                   cursor_text_width,
-                                                   cursor_text_height);
-        pixmap_mask = gdk_bitmap_create_from_data (NULL,
-                                                   (gchar *)cursor_text_mask_bits,
-                                                   cursor_text_mask_width,
-                                                   cursor_text_mask_height);
-        cursor = gdk_cursor_new_from_pixmap (pixmap_data, pixmap_mask, &fg,
-                                             &bg, cursor_text_x_hot,
-                                             cursor_text_y_hot);
+        pixbuf = gdk_pixbuf_from_pixdata (&cursor_text_pixdata, FALSE, NULL);
+        cursor = gdk_cursor_new_from_pixbuf (gdk_display_get_default (), pixbuf, X_HOTSPOT, Y_HOTSPOT);
+        g_object_unref (pixbuf);
 
        gl_debug (DEBUG_VIEW, "END");
 
index 31bfec996b1dd7106dc8f171212a5f420621f67a..3ea2ed957f30f7a9834fd977f07d4bd5845ad3e2 100644 (file)
@@ -125,8 +125,8 @@ static gdouble    get_home_scale                  (glView         *view);
 
 static void       prefs_changed_cb                (glView         *view);
 
-static gboolean   expose_cb                       (glView         *view,
-                                                   GdkEventExpose *event);
+static gboolean   draw_cb                         (glView         *view,
+                                                   cairo_t        *cr);
 
 static void       realize_cb                      (glView         *view);
 
@@ -308,8 +308,8 @@ gl_view_init (glView *view)
 
         g_signal_connect_swapped (G_OBJECT (gl_prefs), "changed",
                                   G_CALLBACK (prefs_changed_cb), view);
-       g_signal_connect_swapped (G_OBJECT (view->canvas), "expose-event",
-                                 G_CALLBACK (expose_cb), view);
+       g_signal_connect_swapped (G_OBJECT (view->canvas), "draw",
+                                 G_CALLBACK (draw_cb), view);
        g_signal_connect_swapped (G_OBJECT (view->canvas), "realize",
                                  G_CALLBACK (realize_cb), view);
        g_signal_connect_swapped (G_OBJECT (view->canvas), "size-allocate",
@@ -472,23 +472,24 @@ prefs_changed_cb (glView         *view)
 void
 gl_view_update (glView  *view)
 {
-        GdkWindow *window;
-       GdkRegion *region;
-       
+        GdkWindow     *window;
+        GtkAllocation  allocation;
+
        gl_debug (DEBUG_VIEW, "START");
 
         window = gtk_widget_get_window (GTK_WIDGET (view->canvas));
         
-       if (!window) return;
-
-        if ( !view->update_scheduled_flag )
+       if (window)
         {
-                view->update_scheduled_flag = TRUE;
 
-                region = gdk_drawable_get_clip_region (window);
-                /* redraw the cairo canvas completely by exposing it */
-                gdk_window_invalidate_region (window, region, TRUE);
-                gdk_region_destroy (region);
+                if ( !view->update_scheduled_flag )
+                {
+                        view->update_scheduled_flag = TRUE;
+
+                        gtk_widget_get_allocation (GTK_WIDGET (view->canvas), &allocation);
+                        gdk_window_invalidate_rect (window, &allocation, TRUE);
+                }
+
         }
 
        gl_debug (DEBUG_VIEW, "END");
@@ -536,28 +537,14 @@ gl_view_update_region (glView        *view,
 /* PRIVATE.  Expose handler.                                                 */
 /*---------------------------------------------------------------------------*/
 static gboolean
-expose_cb (glView         *view,
-           GdkEventExpose *event)
+draw_cb (glView         *view,
+         cairo_t        *cr)
 {
-        GdkWindow *bin_window;
-       cairo_t   *cr;
-
        gl_debug (DEBUG_VIEW, "START");
 
         view->update_scheduled_flag = FALSE;
-
-        bin_window = gtk_layout_get_bin_window (GTK_LAYOUT (view->canvas));
-       cr = gdk_cairo_create (bin_window);
-
-       cairo_rectangle (cr,
-                       event->area.x, event->area.y,
-                       event->area.width, event->area.height);
-       cairo_clip (cr);
-       
        draw_layers (view, cr);
 
-       cairo_destroy (cr);
-
        gl_debug (DEBUG_VIEW, "END");
 
        return FALSE;
@@ -705,7 +692,8 @@ draw_layers (glView  *view,
         scale = view->home_scale * view->zoom;
         gtk_layout_set_size (GTK_LAYOUT (view->canvas), w*scale+8, h*scale+8);
 
-        gdk_drawable_get_size (bin_window, &canvas_w, &canvas_h);
+        canvas_w = gdk_window_get_width (bin_window);
+        canvas_h = gdk_window_get_height (bin_window);
 
         view->x0 = (canvas_w/scale - w) / 2.0;
         view->y0 = (canvas_h/scale - h) / 2.0;
@@ -1822,24 +1810,24 @@ key_press_event_cb (glView            *view,
         {
                 switch (event->keyval) {
 
-                case GDK_Left:
-                case GDK_KP_Left:
+                case GDK_KEY_Left:
+                case GDK_KEY_KP_Left:
                         gl_label_move_selection (view->label, -1.0 / (view->zoom), 0.0);
                         break;
-                case GDK_Up:
-                case GDK_KP_Up:
+                case GDK_KEY_Up:
+                case GDK_KEY_KP_Up:
                         gl_label_move_selection (view->label, 0.0, -1.0 / (view->zoom));
                         break;
-                case GDK_Right:
-                case GDK_KP_Right:
+                case GDK_KEY_Right:
+                case GDK_KEY_KP_Right:
                         gl_label_move_selection (view->label, 1.0 / (view->zoom), 0.0);
                         break;
-                case GDK_Down:
-                case GDK_KP_Down:
+                case GDK_KEY_Down:
+                case GDK_KEY_KP_Down:
                         gl_label_move_selection (view->label, 0.0, 1.0 / (view->zoom));
                         break;
-                case GDK_Delete:
-                case GDK_KP_Delete:
+                case GDK_KEY_Delete:
+                case GDK_KEY_KP_Delete:
                         gl_label_delete_selection (view->label);
                         cursor = gdk_cursor_new (GDK_LEFT_PTR);
                         gdk_window_set_cursor (window, cursor);
index c9f7ad23c89ef9a8033fc577c01aa322d7b9e3aa..a290e21ce89e76ff7b44cf4d1ea20731044fd791 100644 (file)
@@ -98,12 +98,14 @@ gl_wdgt_chain_button_init (glWdgtChainButton *button)
        g_signal_connect (button->button, "clicked",
                          G_CALLBACK (gl_wdgt_chain_button_clicked_callback),
                          button);
+#if 0
        g_signal_connect (button->line1, "expose_event",
                          G_CALLBACK (gl_wdgt_chain_button_draw_lines),
                          button);
        g_signal_connect (button->line2, "expose_event",
                          G_CALLBACK (gl_wdgt_chain_button_draw_lines),
                          button);
+#endif
 }
 
 
@@ -307,6 +309,7 @@ gl_wdgt_chain_button_draw_lines (GtkWidget         *widget,
       points[2] = buf;
     }
 
+#if 0
   gtk_paint_polygon (gtk_widget_get_style (widget),
                     gtk_widget_get_window (widget),
                     GTK_STATE_NORMAL,
@@ -317,6 +320,7 @@ gl_wdgt_chain_button_draw_lines (GtkWidget         *widget,
                     points,
                     3,
                     FALSE);
+#endif
 
   return TRUE;
 }
index 2359a1b13b902c3d90369c989156fbbae8ccb168..e2acbeda3877b07fa40e92a7e5c2fe4b99baf4d6 100644 (file)
@@ -59,7 +59,7 @@ static GList *window_list = NULL;
 /*===========================================================================*/
 
 static void     gl_window_finalize     (GObject       *object);
-static void     gl_window_destroy      (GtkObject     *gtk_object);
+static void     gl_window_dispose      (GObject       *object);
 
 static void     set_window_title       (glWindow *window,
                                        glLabel  *label);
@@ -119,15 +119,13 @@ static void
 gl_window_class_init (glWindowClass *class)
 {
        GObjectClass   *object_class     = G_OBJECT_CLASS (class);
-       GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (class);
 
        gl_debug (DEBUG_WINDOW, "START");
 
        gl_window_parent_class = g_type_class_peek_parent (class);
 
        object_class->finalize = gl_window_finalize;
-
-       gtk_object_class->destroy = gl_window_destroy;
+       object_class->dispose  = gl_window_dispose;
 
        gl_debug (DEBUG_WINDOW, "END");
 }
@@ -232,17 +230,17 @@ gl_window_finalize (GObject *object)
 
 
 static void
-gl_window_destroy (GtkObject *gtk_object)
+gl_window_dispose (GObject *object)
 {
        glWindow          *window;
         GtkClipboard      *clipboard;
 
        gl_debug (DEBUG_WINDOW, "START");
 
-       g_return_if_fail (gtk_object != NULL);
-       g_return_if_fail (GL_IS_WINDOW (gtk_object));
+       g_return_if_fail (object != NULL);
+       g_return_if_fail (GL_IS_WINDOW (object));
 
-       window = GL_WINDOW (gtk_object);
+       window = GL_WINDOW (object);
        window_list = g_list_remove (window_list, window);
 
         if (window->ui) {
@@ -262,8 +260,8 @@ gl_window_destroy (GtkObject *gtk_object)
                g_object_unref (window->label);
         }
 
-       if (GTK_OBJECT_CLASS (gl_window_parent_class)->destroy) {
-               GTK_OBJECT_CLASS (gl_window_parent_class)->destroy (gtk_object);
+       if (G_OBJECT_CLASS (gl_window_parent_class)->dispose) {
+               G_OBJECT_CLASS (gl_window_parent_class)->dispose (object);
        }
 
        gl_debug (DEBUG_WINDOW, "END");