Still has update and drawing problems with view.c.
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)
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
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)
libglabels/Makefile
libglabels/${LIBGLABELS_BRANCH}.pc
src/Makefile
+src/cursors/Makefile
src/pixmaps/Makefile
data/Makefile
data/desktop/Makefile
-SUBDIRS= ../libglabels pixmaps
+SUBDIRS= ../libglabels pixmaps cursors
bin_PROGRAMS = glabels-3 glabels-3-batch
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);
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;
}
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);
}
}
/* "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;
}
--- /dev/null
+
+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
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);
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;
}
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);
}
}
/* "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;
}
gpointer user_data);
static void page_changed_cb (GtkNotebook *notebook,
- GtkNotebookPage *page,
+ GtkWidget *page,
guint page_num,
gpointer user_data);
/*--------------------------------------------------------------------------*/
static void
page_changed_cb (GtkNotebook *notebook,
- GtkNotebookPage *page,
+ GtkWidget *page,
guint page_num,
gpointer user_data)
{
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),
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);
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;
}
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);
}
}
/* "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;
}
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,
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);
/* 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;
}
static void
redraw (glMiniPreview *this)
{
- GdkWindow *window;
- GdkRegion *region;
+ GdkWindow *window;
+ GtkAllocation allocation;
gl_debug (DEBUG_MINI_PREVIEW, "START");
{
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);
}
}
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);
#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"
/* Private macros and constants. */
/*========================================================*/
+#define X_HOTSPOT 7
+#define Y_HOTSPOT 7
+
/*========================================================*/
/* Private types. */
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");
#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"
/* Private macros and constants. */
/*========================================================*/
+#define X_HOTSPOT 7
+#define Y_HOTSPOT 7
+
/*========================================================*/
/* Private types. */
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");
#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"
/* Private macros and constants. */
/*========================================================*/
+#define X_HOTSPOT 7
+#define Y_HOTSPOT 7
+
/*========================================================*/
/* Private types. */
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");
#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"
/* Private macros and constants. */
/*========================================================*/
+#define X_HOTSPOT 7
+#define Y_HOTSPOT 7
+
/*========================================================*/
/* Private types. */
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");
#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"
/* Private macros and constants. */
/*========================================================*/
+#define X_HOTSPOT 7
+#define Y_HOTSPOT 7
+
/*========================================================*/
/* Private types. */
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");
#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"
/* Private macros and constants. */
/*========================================================*/
+#define X_HOTSPOT 7
+#define Y_HOTSPOT 7
+
/*========================================================*/
/* Private types. */
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");
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);
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",
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");
/* 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;
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;
{
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);
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
}
points[2] = buf;
}
+#if 0
gtk_paint_polygon (gtk_widget_get_style (widget),
gtk_widget_get_window (widget),
GTK_STATE_NORMAL,
points,
3,
FALSE);
+#endif
return TRUE;
}
/*===========================================================================*/
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);
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");
}
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) {
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");