[genius: 1/3] Port to Gtk3, GtkSourceView 4 and Vte 2.91
- From: Jiri (George) Lebl <jirka src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [genius: 1/3] Port to Gtk3, GtkSourceView 4 and Vte 2.91
- Date: Sun, 16 Feb 2020 17:33:49 +0000 (UTC)
commit fde14045fd0ff49d820150b01fdba49f6192d474
Author: Yavor Doganov <yavor gnu org>
Date: Thu Nov 14 23:46:55 2019 +0200
Port to Gtk3, GtkSourceView 4 and Vte 2.91
Makefile.am | 2 +-
configure.ac | 31 +-
gtkextra/Makefile.am | 2 -
gtkextra/gtkextra.c | 4 +-
gtkextra/gtkextra.h | 1 -
gtkextra/gtkplot.c | 460 ++++++-------
gtkextra/gtkplot.h | 96 ++-
gtkextra/gtkplot3d.c | 199 +++---
gtkextra/gtkplot3d.h | 32 +-
gtkextra/gtkplotbar.c | 9 +-
gtkextra/gtkplotbox.c | 9 +-
gtkextra/gtkplotcairo.c | 73 +-
gtkextra/gtkplotcairo.h | 4 +-
gtkextra/gtkplotcandle.c | 49 +-
gtkextra/gtkplotcandle.h | 8 +-
gtkextra/gtkplotcanvas.c | 473 ++++++-------
gtkextra/gtkplotcanvas.h | 14 +-
gtkextra/gtkplotcanvasellipse.c | 89 ++-
gtkextra/gtkplotcanvasellipse.h | 10 +-
gtkextra/gtkplotcanvasline.c | 124 ++--
gtkextra/gtkplotcanvasline.h | 4 +-
gtkextra/gtkplotcanvaspixmap.c | 39 +-
gtkextra/gtkplotcanvaspixmap.h | 6 +-
gtkextra/gtkplotcanvasplot.c | 19 +-
gtkextra/gtkplotcanvasrectangle.c | 15 +-
gtkextra/gtkplotcanvasrectangle.h | 10 +-
gtkextra/gtkplotcanvastext.c | 15 +-
gtkextra/gtkplotcanvastext.h | 8 +-
gtkextra/gtkplotcsurface.c | 44 +-
gtkextra/gtkplotcsurface.h | 8 +-
gtkextra/gtkplotdata.c | 210 +++---
gtkextra/gtkplotdata.h | 64 +-
gtkextra/gtkplotdt.c | 26 +-
gtkextra/gtkplotdt.h | 6 +-
gtkextra/gtkplotflux.c | 20 +-
gtkextra/gtkplotpc.c | 73 +-
gtkextra/gtkplotpc.h | 48 +-
gtkextra/gtkplotpixmap.c | 49 +-
gtkextra/gtkplotpixmap.h | 16 +-
gtkextra/gtkplotpolar.c | 24 +-
gtkextra/gtkplotpolar.h | 8 +-
gtkextra/gtkplotprint.c | 14 +-
gtkextra/gtkplotps.c | 109 +--
gtkextra/gtkplotps.h | 4 +-
gtkextra/gtkplotsurface.c | 67 +-
gtkextra/gtkplotsurface.h | 16 +-
gtkextra/gtkpsfont.c | 88 ---
gtkextra/gtkpsfont.h | 8 -
po/POTFILES.in | 1 +
src/Makefile.am | 3 -
src/genius.lang | 128 ++--
src/gnome-genius.c | 1341 ++++++++++++++++---------------------
src/gnome-genius.h | 2 +-
src/graphing.c | 317 +++++----
src/graphing.h | 2 +-
ve/ve-miscui.c | 66 +-
56 files changed, 2095 insertions(+), 2472 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 1c1dac0d..3b682091 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
ACLOCAL_AMFLAGS = -I m4 --install
-SUBDIRS = ve vte gtkextra src pixmaps examples lib po help
+SUBDIRS = ve gtkextra src pixmaps examples lib po help
mimeinfodir = $(datadir)/mime-info
mimeinfo_DATA = genius.keys genius.mime
diff --git a/configure.ac b/configure.ac
index f85bdbad..b66e67ec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,11 +17,10 @@ AC_PROG_INTLTOOL([0.21])
dnl ================= Requirements ================================================
-GTK_REQUIRED=2.20.0
-GLIB_REQUIRED=2.26.0
+GTK_REQUIRED=3.21.4
+GLIB_REQUIRED=2.41.1
PANGO_REQUIRED=1.22.0
-GTKSOURCEVIEW_REQUIRED=0.3.0
-GTKSOURCEVIEW2_REQUIRED=2.0.2
+GTKSOURCEVIEW4_REQUIRED=3.99.7
GIO_REQUIRED=2.16.0
dnl ===============================================================================
@@ -122,7 +121,7 @@ PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_REQUIRED)
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
-GENIUS_MODULES="gtk+-2.0 >= $GTK_REQUIRED gio-2.0 >= $GIO_REQUIRED"
+GENIUS_MODULES="amtk-5 gtk+-3.0 >= $GTK_REQUIRED gio-2.0 >= $GIO_REQUIRED"
if test "x$use_gnome" = "xyes" ; then
echo "
@@ -133,17 +132,10 @@ Note:
PKG_CHECK_MODULES(GENIUS, $GENIUS_MODULES)
if test "x$use_gtksourceview" = "xyes" ; then
- PKG_CHECK_MODULES(GSV, gtksourceview-2.0 >= $GTKSOURCEVIEW2_REQUIRED, have_gtksourceview2=yes,
have_gtksourceview2=no)
+ PKG_CHECK_MODULES(GSV, gtksourceview-4 >= $GTKSOURCEVIEW4_REQUIRED, have_gtksourceview4=yes,
have_gtksourceview4=no)
- if test "x$have_gtksourceview2" != "xyes"; then
- PKG_CHECK_MODULES(GSV, gtksourceview-1.0 >= $GTKSOURCEVIEW_REQUIRED, have_gtksourceview=yes,
have_gtksourceview=no)
- fi
-
- if test "x$have_gtksourceview2" = "xyes"; then
- AC_DEFINE(HAVE_GTKSOURCEVIEW,[1],[have gtksourceview])
- AC_DEFINE(HAVE_GTKSOURCEVIEW2,[1],[have gtksourceview2])
- elif test "x$have_gtksourceview" = "xyes"; then
- AC_DEFINE(HAVE_GTKSOURCEVIEW,[1],[have gtksourceview])
+ if test "x$have_gtksourceview4" = "xyes"; then
+ AC_DEFINE(HAVE_GTKSOURCEVIEW,[1],[have gtksourceview4])
else
use_gtksourceview=no
fi
@@ -151,7 +143,7 @@ Note:
PKG_CHECK_MODULES(GENIUS, $GENIUS_MODULES)
fi
- VICIOUS_MODULES="gtk+-2.0 >= $GTK_REQUIRED"
+ VICIOUS_MODULES="gtk+-3.0 >= $GTK_REQUIRED"
VICIOUS_UI_LIBS="libviciousui.a"
GNOME_GENIUS="gnome-genius\$(EXEEXT)"
@@ -342,14 +334,14 @@ esac
# We have a direct dependency on X11 on gdk-x11, see bug #613525
AC_MSG_CHECKING([for GDK target])
-GDK_TARGET="$($PKG_CONFIG --variable target gdk-2.0)"
+GDK_TARGET="$($PKG_CONFIG --variable target gdk-3.0)"
AC_MSG_RESULT([$GDK_TARGET])
case "$GDK_TARGET" in
x11) PLATFORM_PKGS="x11 cairo-xlib" ;;
*) PLATFORM_PKGS="" ;;
esac
-VTE_PKGS="glib-2.0 >= $GLIB_REQUIRED gobject-2.0 pango >= $PANGO_REQUIRED gtk+-2.0 >= $GTK_REQUIRED
gobject-2.0 gio-2.0 gio-unix-2.0 $PLATFORM_PKGS"
+VTE_PKGS="vte-2.91"
PKG_CHECK_MODULES([VTE],[$VTE_PKGS])
AC_SUBST([VTE_PKGS])
@@ -391,9 +383,6 @@ lib/statistics/Makefile
lib/symbolic/Makefile
lib/commutative_algebra/Makefile
ve/Makefile
-vte/Makefile
-vte/src/Makefile
-vte/termcaps/Makefile
gtkextra/Makefile
examples/Makefile
pixmaps/Makefile
diff --git a/gtkextra/Makefile.am b/gtkextra/Makefile.am
index 46433722..9bf672b6 100644
--- a/gtkextra/Makefile.am
+++ b/gtkextra/Makefile.am
@@ -60,7 +60,6 @@ public_h_sources = \
gtkplotdata.h \
gtkplotdt.h \
gtkplotflux.h \
- gtkplotgdk.h \
gtkplotcairo.h \
gtkplotpc.h \
gtkplotpixmap.h \
@@ -94,7 +93,6 @@ libgtkextra_genius_a_SOURCES = \
gtkplotdata.c \
gtkplotdt.c \
gtkplotflux.c \
- gtkplotgdk.c \
gtkplotcairo.c \
gtkplotpc.c \
gtkplotpixmap.c \
diff --git a/gtkextra/gtkextra.c b/gtkextra/gtkextra.c
index eb06d80a..3f0ce989 100644
--- a/gtkextra/gtkextra.c
+++ b/gtkextra/gtkextra.c
@@ -79,9 +79,9 @@ _gtkextra_signal_test(GtkObject *object, guint signal_id, gint arg1, gint arg2,
}
*/
-void _gtkextra_signal_emit(GtkObject *object, guint signal_id, ...);
+void _gtkextra_signal_emit(GObject *object, guint signal_id, ...);
void
-_gtkextra_signal_emit(GtkObject *object, guint signal_id, ...)
+_gtkextra_signal_emit(GObject *object, guint signal_id, ...)
{
gboolean *result;
GValue ret = { 0, };
diff --git a/gtkextra/gtkextra.h b/gtkextra/gtkextra.h
index 7fa3b6e8..f892dd5b 100644
--- a/gtkextra/gtkextra.h
+++ b/gtkextra/gtkextra.h
@@ -62,7 +62,6 @@
#include <gtkextra/gtkplotflux.h>
/* #include <gtkextra/gtkplotsegment.h> */
#include <gtkextra/gtkplotpixmap.h>
-#include <gtkextra/gtkplotgdk.h>
#include <gtkextra/gtkplotpc.h>
#include <gtkextra/gtkplotprint.h>
#include <gtkextra/gtkplotps.h>
diff --git a/gtkextra/gtkplot.c b/gtkextra/gtkplot.c
index add338cd..fe8fa511 100644
--- a/gtkextra/gtkplot.c
+++ b/gtkextra/gtkplot.c
@@ -36,7 +36,6 @@
#include "gtkplot.h"
#include "gtkplotdata.h"
#include "gtkpsfont.h"
-#include "gtkplotgdk.h"
#include "gtkplotcairo.h"
#include "gtkextra-marshal.h"
@@ -52,7 +51,7 @@ static gchar DEFAULT_FONT[] = "Helvetica";
/* Signals */
extern void
-_gtkextra_signal_emit(GtkObject *object, guint signal_id, ...);
+_gtkextra_signal_emit(GObject *object, guint signal_id, ...);
enum
{
@@ -202,12 +201,16 @@ static void gtk_plot_axis_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
-static void gtk_plot_destroy (GtkObject *object);
-static void gtk_plot_axis_destroy (GtkObject *object);
+static void gtk_plot_destroy (GtkWidget *object);
+static void gtk_plot_axis_destroy (GtkWidget *object);
static void gtk_plot_real_set_pc (GtkPlot *plot, GtkPlotPC *pc);
-static void gtk_plot_real_set_drawable (GtkPlot *plot, GdkDrawable *drawable);
-static void gtk_plot_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
+static void gtk_plot_real_set_drawable (GtkPlot *plot, cairo_surface_t *drawable);
+static void gtk_plot_get_preferred_width (GtkWidget *widget,
+ gint *min,
+ gint *nat);
+static void gtk_plot_get_preferred_height (GtkWidget *widget,
+ gint *min,
+ gint *nat);
static void gtk_plot_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void gtk_plot_show_all (GtkWidget *widget);
@@ -247,7 +250,7 @@ gtk_plot_get_type (void)
if (!plot_type)
{
plot_type = g_type_register_static_simple (
- gtk_misc_get_type (),
+ gtk_widget_get_type (),
"GtkPlot",
sizeof (GtkPlotClass),
(GClassInitFunc) gtk_plot_class_init,
@@ -261,19 +264,20 @@ gtk_plot_get_type (void)
static void
gtk_plot_class_init (GtkPlotClass *klass)
{
- GtkObjectClass *object_class;
+ GObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkPlotClass *plot_class;
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
parent_class = g_type_class_ref (gtk_widget_get_type ());
- object_class = (GtkObjectClass *) klass;
+ object_class = (GObjectClass *) klass;
widget_class = (GtkWidgetClass *) klass;
plot_class = (GtkPlotClass *) klass;
widget_class->show_all = gtk_plot_show_all;
- widget_class->size_request = gtk_plot_size_request;
+ widget_class->get_preferred_width = gtk_plot_get_preferred_width;
+ widget_class->get_preferred_height = gtk_plot_get_preferred_height;
widget_class->size_allocate = gtk_plot_size_allocate;
@@ -374,7 +378,7 @@ gtk_plot_class_init (GtkPlotClass *klass)
gtkextra_BOOL__POINTER,
G_TYPE_BOOLEAN, 1, G_TYPE_PLOT_AXIS);
- object_class->destroy = gtk_plot_destroy;
+ widget_class->destroy = gtk_plot_destroy;
gobject_class->set_property = gtk_plot_set_property;
gobject_class->get_property = gtk_plot_get_property;
@@ -998,7 +1002,7 @@ gtk_plot_axis_get_type (void)
if (!axis_type)
{
axis_type = g_type_register_static_simple (
- gtk_object_get_type(),
+ gtk_widget_get_type(),
"GtkPlotAxis",
sizeof (GtkPlotAxisClass),
(GClassInitFunc) gtk_plot_axis_class_init,
@@ -1013,11 +1017,11 @@ gtk_plot_axis_get_type (void)
static void
gtk_plot_axis_class_init (GtkPlotAxisClass *klass)
{
- GtkObjectClass *object_class;
+ GtkWidgetClass *object_class;
GtkPlotAxisClass *axis_class;
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
- object_class = (GtkObjectClass *) klass;
+ object_class = (GtkWidgetClass *) klass;
axis_class = (GtkPlotAxisClass *) klass;
/**
@@ -1585,21 +1589,18 @@ gtk_plot_axis_class_init (GtkPlotAxisClass *klass)
static void
axis_changed(GtkPlotAxis *axis, GtkPlot *plot)
{
- g_signal_emit (GTK_OBJECT(plot), plot_signals[CHANGED], 0);
+ g_signal_emit (plot, plot_signals[CHANGED], 0);
}
static void
gtk_plot_init (GtkPlot *plot)
{
- GtkWidget *widget;
+ GdkRGBA black, white;
gtk_widget_set_has_window(GTK_WIDGET(plot), FALSE);
- widget = GTK_WIDGET(plot);
- gdk_color_black(gtk_widget_get_colormap(widget),
- >k_widget_get_style(widget)->black);
- gdk_color_white(gtk_widget_get_colormap(widget),
- >k_widget_get_style(widget)->white);
+ gdk_rgba_parse(&black, "black");
+ gdk_rgba_parse(&white, "white");
plot->bg_pixmap = NULL;
plot->transparent = FALSE;
@@ -1620,28 +1621,28 @@ gtk_plot_init (GtkPlot *plot)
plot->show_y0 = FALSE;
plot->right = GTK_PLOT_AXIS(gtk_plot_axis_new(GTK_PLOT_AXIS_Y));
- g_object_ref(GTK_OBJECT(plot->right));
- g_object_ref_sink(GTK_OBJECT(plot->right));
- g_object_unref(GTK_OBJECT(plot->right));
- g_signal_connect(GTK_OBJECT(plot->right), "changed",
+ g_object_ref(plot->right);
+ g_object_ref_sink(plot->right);
+ g_object_unref(plot->right);
+ g_signal_connect(plot->right, "changed",
(void *)axis_changed, plot);
plot->left = GTK_PLOT_AXIS(gtk_plot_axis_new(GTK_PLOT_AXIS_Y));
- g_object_ref(GTK_OBJECT(plot->left));
- g_object_ref_sink(GTK_OBJECT(plot->left));
- g_object_unref(GTK_OBJECT(plot->left));
- g_signal_connect(GTK_OBJECT(plot->left), "changed",
+ g_object_ref(plot->left);
+ g_object_ref_sink(plot->left);
+ g_object_unref(plot->left);
+ g_signal_connect(plot->left, "changed",
(void *)axis_changed, plot);
plot->top = GTK_PLOT_AXIS(gtk_plot_axis_new(GTK_PLOT_AXIS_X));
- g_object_ref(GTK_OBJECT(plot->top));
- g_object_ref_sink(GTK_OBJECT(plot->top));
- g_object_unref(GTK_OBJECT(plot->top));
- g_signal_connect(GTK_OBJECT(plot->top), "changed",
+ g_object_ref(plot->top);
+ g_object_ref_sink(plot->top);
+ g_object_unref(plot->top);
+ g_signal_connect(plot->top, "changed",
(void *)axis_changed, plot);
plot->bottom = GTK_PLOT_AXIS(gtk_plot_axis_new(GTK_PLOT_AXIS_X));
- g_object_ref(GTK_OBJECT(plot->bottom));
- g_object_ref_sink(GTK_OBJECT(plot->bottom));
- g_object_unref(GTK_OBJECT(plot->bottom));
- g_signal_connect(GTK_OBJECT(plot->bottom), "changed",
+ g_object_ref(plot->bottom);
+ g_object_ref_sink(plot->bottom);
+ g_object_unref(plot->bottom);
+ g_signal_connect(plot->bottom, "changed",
(void *)axis_changed, plot);
plot->left->labels_attr.justification = GTK_JUSTIFY_RIGHT;
@@ -1662,13 +1663,13 @@ gtk_plot_init (GtkPlot *plot)
plot->x0_line.cap_style = 0;
plot->x0_line.join_style = 0;
plot->x0_line.line_width = 0;
- plot->x0_line.color = gtk_widget_get_style(widget)->black;
+ plot->x0_line.color = black;
plot->y0_line.line_style = GTK_PLOT_LINE_SOLID;
plot->y0_line.line_width = 0;
plot->y0_line.cap_style = 0;
plot->y0_line.join_style = 0;
- plot->y0_line.color = gtk_widget_get_style(widget)->black;
+ plot->y0_line.color = black;
plot->legends_x = .6;
plot->legends_y = .1;
@@ -1682,14 +1683,14 @@ gtk_plot_init (GtkPlot *plot)
plot->legends_attr.text = NULL;
plot->legends_attr.font = g_strdup(DEFAULT_FONT);
plot->legends_attr.height = DEFAULT_FONT_HEIGHT;
- plot->legends_attr.fg = gtk_widget_get_style(widget)->black;
- plot->legends_attr.bg = gtk_widget_get_style(widget)->white;
+ plot->legends_attr.fg = black;
+ plot->legends_attr.bg = white;
plot->legends_attr.transparent = FALSE;
plot->legends_attr.border = 0;
plot->legends_attr.border_width = 0;
plot->legends_attr.shadow_width = 0;
- plot->background = gtk_widget_get_style(widget)->white;
+ plot->background = white;
plot->xscale = GTK_PLOT_SCALE_LINEAR;
plot->yscale = GTK_PLOT_SCALE_LINEAR;
@@ -1716,16 +1717,16 @@ gtk_plot_get_property (GObject *object,
switch(prop_id){
case ARG_BOTTOM:
- g_value_set_object(value, GTK_OBJECT(plot->bottom));
+ g_value_set_object(value, plot->bottom);
break;
case ARG_TOP:
- g_value_set_object(value, GTK_OBJECT(plot->top));
+ g_value_set_object(value, plot->top);
break;
case ARG_LEFT:
- g_value_set_object(value, GTK_OBJECT(plot->left));
+ g_value_set_object(value, plot->left);
break;
case ARG_RIGHT:
- g_value_set_object(value, GTK_OBJECT(plot->right));
+ g_value_set_object(value, plot->right);
break;
case ARG_ALLOCATION_X:
g_value_set_int(value, plot->internal_allocation.x);
@@ -1887,9 +1888,9 @@ gtk_plot_set_property (GObject *object,
plot->use_pixmap = g_value_get_boolean(value);
break;
case ARG_BG_PIXMAP:
- if(plot->bg_pixmap) gdk_pixmap_unref(plot->bg_pixmap);
- plot->bg_pixmap = (GdkPixmap *)g_value_get_pointer(value);
- if(plot->bg_pixmap) gdk_pixmap_ref(plot->bg_pixmap);
+ if(plot->bg_pixmap) cairo_surface_destroy(plot->bg_pixmap);
+ plot->bg_pixmap = (cairo_surface_t *)g_value_get_pointer(value);
+ if(plot->bg_pixmap) cairo_surface_reference(plot->bg_pixmap);
break;
case ARG_TRANSPARENT:
plot->transparent = g_value_get_boolean(value);
@@ -1901,7 +1902,7 @@ gtk_plot_set_property (GObject *object,
plot->clip_data = g_value_get_boolean(value);
break;
case ARG_BG:
- plot->background = *((GdkColor *)g_value_get_pointer(value));
+ plot->background = *((GdkRGBA *)g_value_get_pointer(value));
break;
case ARG_GRIDS_ON_TOP:
plot->grids_on_top = g_value_get_boolean(value);
@@ -2017,35 +2018,35 @@ gtk_plot_set_property (GObject *object,
void
gtk_plot_set_pc(GtkPlot *plot, GtkPlotPC *pc)
{
- GTK_PLOT_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(plot)))->set_pc(plot, pc);
+ GTK_PLOT_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(plot)))->set_pc(plot, pc);
}
static void
gtk_plot_real_set_pc(GtkPlot *plot, GtkPlotPC *pc)
{
if(plot->pc)
- g_object_unref(GTK_OBJECT(plot->pc));
+ g_object_unref(plot->pc);
if(!pc){
plot->pc = (GtkPlotPC *)gtk_plot_cairo_new(NULL);
- g_object_ref(GTK_OBJECT(plot->pc));
- g_object_ref_sink(GTK_OBJECT(plot->pc));
- g_object_unref(GTK_OBJECT(plot->pc));
+ g_object_ref(plot->pc);
+ g_object_ref_sink(plot->pc);
+ g_object_unref(plot->pc);
} else {
plot->pc = pc;
- g_object_ref(GTK_OBJECT(plot->pc));
- g_object_ref_sink(GTK_OBJECT(plot->pc));
- g_object_unref(GTK_OBJECT(plot->pc));
+ g_object_ref(plot->pc);
+ g_object_ref_sink(plot->pc);
+ g_object_unref(plot->pc);
}
}
static void
gtk_plot_axis_init (GtkPlotAxis *axis)
{
- GdkColor black, white;
+ GdkRGBA black, white;
- gdk_color_black(gdk_colormap_get_system(), &black);
- gdk_color_white(gdk_colormap_get_system(), &white);
+ gdk_rgba_parse(&black, "black");
+ gdk_rgba_parse(&white, "white");
axis->ticks.nmajorticks = 0;
axis->ticks.nminorticks = 0;
@@ -2410,7 +2411,7 @@ gtk_plot_axis_get_property (GObject *object,
break;
case ARG_TICK_LABELS:
if(axis->tick_labels)
- g_value_set_object(value, GTK_OBJECT(axis->tick_labels));
+ g_value_set_object(value, axis->tick_labels);
else
g_value_set_object(value, NULL);
break;
@@ -2421,7 +2422,7 @@ gtk_plot_axis_get_property (GObject *object,
}
static void
-gtk_plot_destroy (GtkObject *object)
+gtk_plot_destroy (GtkWidget *object)
{
GtkPlot *plot;
GList *list;
@@ -2432,13 +2433,13 @@ gtk_plot_destroy (GtkObject *object)
plot = GTK_PLOT (object);
if (plot->top)
- g_object_unref(GTK_OBJECT(plot->top));
+ g_object_unref(plot->top);
if (plot->bottom)
- g_object_unref(GTK_OBJECT(plot->bottom));
+ g_object_unref(plot->bottom);
if (plot->left)
- g_object_unref(GTK_OBJECT(plot->left));
+ g_object_unref(plot->left);
if (plot->right)
- g_object_unref(GTK_OBJECT(plot->right));
+ g_object_unref(plot->right);
plot->top = plot->bottom = plot->left = plot->right = NULL;
if(plot->legends_attr.font) g_free (plot->legends_attr.font);
@@ -2471,18 +2472,18 @@ gtk_plot_destroy (GtkObject *object)
}
plot->data_sets = NULL;
- if ( GTK_OBJECT_CLASS (parent_class)->destroy )
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+ if ( GTK_WIDGET_CLASS (parent_class)->destroy )
+ (* GTK_WIDGET_CLASS (parent_class)->destroy) (object);
if(plot->pc)
- g_object_unref(GTK_OBJECT(plot->pc));
+ g_object_unref(plot->pc);
plot->pc = NULL;
gtk_psfont_unref();
}
static void
-gtk_plot_axis_destroy (GtkObject *object)
+gtk_plot_axis_destroy (GtkWidget *object)
{
GtkPlotAxis *axis;
@@ -2546,7 +2547,7 @@ gtk_plot_paint (GtkPlot *plot)
if(!plot->drawable) return;
gtk_plot_pc_init(plot->pc);
- GTK_PLOT_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(plot)))->plot_paint(GTK_WIDGET(plot));
+ GTK_PLOT_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(plot)))->plot_paint(GTK_WIDGET(plot));
gtk_plot_pc_leave(plot->pc);
}
@@ -2579,7 +2580,8 @@ gtk_plot_real_paint (GtkWidget *widget)
gint pwidth, pheight;
gdouble scale_x, scale_y;
- gdk_window_get_size(plot->bg_pixmap, &pwidth, &pheight);
+ pwidth = cairo_image_surface_get_width(plot->bg_pixmap);
+ pheight = cairo_image_surface_get_height(plot->bg_pixmap);
scale_x = (gdouble)width / (gdouble)pwidth;
scale_y = (gdouble)height / (gdouble)pheight;
@@ -2705,59 +2707,21 @@ gtk_plot_real_paint (GtkWidget *widget)
text = text->next;
}
- GTK_PLOT_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(plot)))->draw_legends(GTK_WIDGET(plot));
+ GTK_PLOT_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(plot)))->draw_legends(GTK_WIDGET(plot));
gtk_plot_pc_grestore(plot->pc);
}
-/**
- * gtk_plot_refresh:
- * @plot: a #GtkPlot widget
- * @drawing_area: a GdkRectangle
- *
- *
- */
-void
-gtk_plot_refresh (GtkPlot *plot, GdkRectangle *drawing_area)
+static void
+gtk_plot_get_preferred_width (GtkWidget *widget, gint *min, gint *nat)
{
- GtkWidget *widget;
- GdkPixmap *pixmap;
- GdkRectangle area;
- GtkAllocation allocation;
-
- widget = GTK_WIDGET(plot);
- if(!gtk_widget_get_visible(widget)) return;
-
- if(!plot->drawable) return;
- pixmap = plot->drawable;
-
- gtk_widget_get_allocation(widget, &allocation);
- if(drawing_area == NULL){
- area.x = allocation.x;
- area.y = allocation.y;
- area.width = allocation.width;
- area.height = allocation.height;
- } else {
- area = *drawing_area;
- }
-
- gdk_draw_pixmap(gtk_widget_get_window(widget),
- gtk_widget_get_style(widget)->fg_gc[GTK_STATE_NORMAL],
- pixmap,
- area.x,
- area.y,
- allocation.x,
- allocation.y,
- allocation.width,
- allocation.height);
-
+ *min = *nat = DEFAULT_WIDTH;
}
static void
-gtk_plot_size_request (GtkWidget *widget, GtkRequisition *requisition)
+gtk_plot_get_preferred_height (GtkWidget *widget, gint *min, gint *nat)
{
- requisition->width = DEFAULT_WIDTH;
- requisition->height = DEFAULT_HEIGHT;
+ *min = *nat = DEFAULT_HEIGHT;
}
static void
@@ -2776,7 +2740,7 @@ gtk_plot_size_allocate (GtkWidget *widget, GtkAllocation *arg_allocation)
plot->internal_allocation.width = roundint(plot->width * allocation.width);
plot->internal_allocation.height = roundint(plot->height * allocation.height);
- g_signal_emit (GTK_OBJECT(plot), plot_signals[UPDATE], 0, FALSE);
+ g_signal_emit (plot, plot_signals[UPDATE], 0, FALSE);
}
/**
@@ -2787,16 +2751,16 @@ gtk_plot_size_allocate (GtkWidget *widget, GtkAllocation *arg_allocation)
*
* Return value:
*/
-GtkObject*
+GtkWidget*
gtk_plot_axis_new (GtkPlotOrientation orientation)
{
- GtkObject *axis;
+ GtkWidget *axis;
axis = g_object_new (gtk_plot_axis_get_type (), NULL);
gtk_plot_axis_construct(GTK_PLOT_AXIS(axis), orientation);
- return GTK_OBJECT (axis);
+ return axis;
}
/**
@@ -2861,7 +2825,7 @@ gtk_plot_axis_construct(GtkPlotAxis *axis, GtkPlotOrientation orientation)
* Return value:
*/
GtkWidget*
-gtk_plot_new (GdkDrawable *drawable)
+gtk_plot_new (cairo_surface_t *drawable)
{
GtkWidget *plot;
@@ -2880,7 +2844,7 @@ gtk_plot_new (GdkDrawable *drawable)
*
*/
void
-gtk_plot_construct(GtkPlot *plot, GdkDrawable *drawable)
+gtk_plot_construct(GtkPlot *plot, cairo_surface_t *drawable)
{
GtkAllocation allocation;
gtk_plot_set_drawable(plot, drawable);
@@ -2920,7 +2884,7 @@ gtk_plot_construct(GtkPlot *plot, GdkDrawable *drawable)
* Returns: the plot widget
*/
GtkWidget*
-gtk_plot_new_with_size (GdkDrawable *drawable, gdouble width, gdouble height)
+gtk_plot_new_with_size (cairo_surface_t *drawable, gdouble width, gdouble height)
{
GtkWidget *plot;
@@ -2942,7 +2906,7 @@ gtk_plot_new_with_size (GdkDrawable *drawable, gdouble width, gdouble height)
*/
void
gtk_plot_construct_with_size (GtkPlot *plot,
- GdkDrawable *drawable,
+ cairo_surface_t *drawable,
gdouble width, gdouble height)
{
gtk_plot_construct(plot, drawable);
@@ -2958,13 +2922,13 @@ gtk_plot_construct_with_size (GtkPlot *plot,
*
*/
void
-gtk_plot_set_drawable (GtkPlot *plot, GdkDrawable *drawable)
+gtk_plot_set_drawable (GtkPlot *plot, cairo_surface_t *drawable)
{
- GTK_PLOT_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(plot)))->set_drawable(plot, drawable);
+ GTK_PLOT_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(plot)))->set_drawable(plot, drawable);
}
static void
-gtk_plot_real_set_drawable (GtkPlot *plot, GdkDrawable *drawable)
+gtk_plot_real_set_drawable (GtkPlot *plot, cairo_surface_t *drawable)
{
plot->drawable = drawable;
@@ -2982,7 +2946,7 @@ gtk_plot_real_set_drawable (GtkPlot *plot, GdkDrawable *drawable)
*
* Return value: (transfer none) the #GdkDrawable of the plot
*/
-GdkDrawable *
+cairo_surface_t *
gtk_plot_get_drawable (GtkPlot *plot)
{
return(plot->drawable);
@@ -2996,12 +2960,12 @@ gtk_plot_get_drawable (GtkPlot *plot)
*
*/
void
-gtk_plot_set_background_pixmap (GtkPlot *plot, GdkPixmap *pixmap)
+gtk_plot_set_background_pixmap (GtkPlot *plot, cairo_surface_t *pixmap)
{
- if(plot->bg_pixmap) gdk_pixmap_unref(plot->bg_pixmap);
+ if(plot->bg_pixmap) cairo_surface_destroy(plot->bg_pixmap);
plot->bg_pixmap = pixmap;
- if(pixmap) gdk_pixmap_ref(pixmap);
+ if(pixmap) cairo_surface_reference(pixmap);
}
/**
@@ -3295,7 +3259,7 @@ gtk_plot_draw_labels(GtkPlot *plot,
else
{
veto = FALSE;
- _gtkextra_signal_emit(GTK_OBJECT(axis), axis_signals[TICK_LABEL],
+ _gtkextra_signal_emit(G_OBJECT(axis), axis_signals[TICK_LABEL],
&x_tick, label, &veto);
if(!veto) {
if(axis->tick_labels){
@@ -3404,31 +3368,31 @@ gtk_plot_set_line_attributes(GtkPlot *plot,
break;
case GTK_PLOT_LINE_DOTTED:
gtk_plot_pc_set_lineattr(plot->pc, line.line_width,
- GDK_LINE_ON_OFF_DASH,
+ 1,
line.cap_style, line.join_style);
gtk_plot_pc_set_dash(plot->pc, 0, dot, 2);
break;
case GTK_PLOT_LINE_DASHED:
gtk_plot_pc_set_lineattr(plot->pc, line.line_width,
- GDK_LINE_ON_OFF_DASH,
+ 1,
line.cap_style, line.join_style);
gtk_plot_pc_set_dash(plot->pc, 0, dash, 2);
break;
case GTK_PLOT_LINE_DOT_DASH:
gtk_plot_pc_set_lineattr(plot->pc, line.line_width,
- GDK_LINE_ON_OFF_DASH,
+ 1,
line.cap_style, line.join_style);
gtk_plot_pc_set_dash(plot->pc, 0, dot_dash, 4);
break;
case GTK_PLOT_LINE_DOT_DOT_DASH:
gtk_plot_pc_set_lineattr(plot->pc, line.line_width,
- GDK_LINE_ON_OFF_DASH,
+ 1,
line.cap_style, line.join_style);
gtk_plot_pc_set_dash(plot->pc, 0, dot_dot_dash, 6);
break;
case GTK_PLOT_LINE_DOT_DASH_DASH:
gtk_plot_pc_set_lineattr(plot->pc, line.line_width,
- GDK_LINE_ON_OFF_DASH,
+ 1,
line.cap_style, line.join_style);
gtk_plot_pc_set_dash(plot->pc, 0, dot_dash_dash, 6);
break;
@@ -3484,8 +3448,8 @@ gtk_plot_draw_legends (GtkWidget *widget)
if(gtk_widget_get_visible(GTK_WIDGET(dataset)) && dataset->show_legend)
{
- GTK_PLOT_DATA_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(dataset)))->get_legend_size(dataset, &lwidth,
&lheight);
- GTK_PLOT_DATA_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(dataset)))->draw_legend(dataset, x, y);
+ GTK_PLOT_DATA_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(dataset)))->get_legend_size(dataset, &lwidth,
&lheight);
+ GTK_PLOT_DATA_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(dataset)))->draw_legend(dataset, x, y);
y += lheight;
height += lheight;
}
@@ -3530,7 +3494,7 @@ gtk_plot_draw_legends (GtkWidget *widget)
if(gtk_widget_get_visible(GTK_WIDGET(dataset)) && dataset->show_gradient)
{
- GTK_PLOT_DATA_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(dataset)))->draw_gradient(dataset);
+ GTK_PLOT_DATA_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(dataset)))->draw_gradient(dataset);
}
datasets=datasets->next;
}
@@ -3748,7 +3712,7 @@ gtk_plot_parse_label(GtkPlotAxis *axis, gdouble val, gint precision, gint style,
gdouble auxval;
gint intspace = 0;
gint power = 0.0;
- gfloat v = 0.0;
+ gdouble v = 0.0;
GtkPlotScale scale = axis->ticks.scale;
auxval = fabs(val);
@@ -3845,7 +3809,7 @@ gtk_plot_paint_text(GtkPlot *plot,
text.justification,
text.text);
- g_signal_emit (GTK_OBJECT(plot), plot_signals[CHANGED],0);
+ g_signal_emit (plot, plot_signals[CHANGED],0);
}
/**
@@ -4305,13 +4269,13 @@ gtk_plot_get_internal_allocation (GtkPlot *plot)
*
*/
void
-gtk_plot_set_background(GtkPlot *plot, const GdkColor *bg_color)
+gtk_plot_set_background(GtkPlot *plot, const GdkRGBA *bg_color)
{
plot->background = *bg_color;
gtk_plot_paint(plot);
- g_signal_emit (GTK_OBJECT(plot), plot_signals[CHANGED],0);
+ g_signal_emit (plot, plot_signals[CHANGED],0);
}
/**
@@ -4327,7 +4291,7 @@ gtk_plot_move (GtkPlot *plot, gdouble x, gdouble y)
gboolean veto = TRUE;
GtkAllocation allocation;
- _gtkextra_signal_emit (GTK_OBJECT(plot), plot_signals[MOVED],
+ _gtkextra_signal_emit (G_OBJECT(plot), plot_signals[MOVED],
&x, &y, &veto);
if(!veto) return;
@@ -4350,7 +4314,7 @@ gtk_plot_move (GtkPlot *plot, gdouble x, gdouble y)
plot->internal_allocation.width = roundint(plot->width * allocation.width);
plot->internal_allocation.height = roundint(plot->height * allocation.height);
- g_signal_emit (GTK_OBJECT(plot), plot_signals[CHANGED], 0);
+ g_signal_emit (plot, plot_signals[CHANGED], 0);
}
/**
@@ -4367,7 +4331,7 @@ gtk_plot_resize (GtkPlot *plot, gdouble width, gdouble height)
gboolean veto = TRUE;
GtkAllocation allocation;
- _gtkextra_signal_emit (GTK_OBJECT(plot), plot_signals[RESIZED],
+ _gtkextra_signal_emit (G_OBJECT(plot), plot_signals[RESIZED],
&width, &height, &veto);
if(!veto) return;
@@ -4388,8 +4352,8 @@ gtk_plot_resize (GtkPlot *plot, gdouble width, gdouble height)
plot->internal_allocation.width = roundint(plot->width * allocation.width);
plot->internal_allocation.height = roundint(plot->height * allocation.height);
- g_signal_emit (GTK_OBJECT(plot), plot_signals[UPDATE], 0, FALSE);
- g_signal_emit (GTK_OBJECT(plot), plot_signals[CHANGED], 0);
+ g_signal_emit (plot, plot_signals[UPDATE], 0, FALSE);
+ g_signal_emit (plot, plot_signals[CHANGED], 0);
}
/**
@@ -4412,8 +4376,8 @@ gtk_plot_set_magnification (GtkPlot *plot, gdouble magnification)
plot->internal_allocation.width = roundint(plot->width * allocation.width);
plot->internal_allocation.height = roundint(plot->height * allocation.height);
- g_signal_emit (GTK_OBJECT(plot), plot_signals[UPDATE], 0, FALSE);
- g_signal_emit (GTK_OBJECT(plot), plot_signals[CHANGED], 0);
+ g_signal_emit (plot, plot_signals[UPDATE], 0, FALSE);
+ g_signal_emit (plot, plot_signals[CHANGED], 0);
}
/**
@@ -4434,7 +4398,7 @@ gtk_plot_move_resize (GtkPlot *plot,
gtk_plot_move(plot, x, y);
gtk_plot_resize(plot, width, height);
- g_signal_emit (GTK_OBJECT(plot), plot_signals[CHANGED], 0);
+ g_signal_emit (plot, plot_signals[CHANGED], 0);
}
/**
@@ -4450,7 +4414,7 @@ gtk_plot_move_resize (GtkPlot *plot,
void
gtk_plot_get_pixel(GtkPlot *plot, gdouble xx, gdouble yy, gdouble *x, gdouble *y)
{
- GTK_PLOT_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(plot)))->get_pixel (GTK_WIDGET(plot), xx, yy, x, y);
+ GTK_PLOT_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(plot)))->get_pixel (GTK_WIDGET(plot), xx, yy, x, y);
}
/**
@@ -4466,7 +4430,7 @@ gtk_plot_get_pixel(GtkPlot *plot, gdouble xx, gdouble yy, gdouble *x, gdouble *y
void
gtk_plot_get_point(GtkPlot *plot, gint x, gint y, gdouble *xx, gdouble *yy)
{
- GTK_PLOT_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(plot)))->get_point (GTK_WIDGET(plot), x, y, xx, yy);
+ GTK_PLOT_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(plot)))->get_point (GTK_WIDGET(plot), x, y, xx, yy);
}
@@ -4554,8 +4518,8 @@ gtk_plot_set_xrange (GtkPlot *plot,
plot->top->ticks.min = xmin;
plot->top->ticks.max = xmax;
- g_signal_emit (GTK_OBJECT(plot), plot_signals[UPDATE], 0, TRUE);
- g_signal_emit (GTK_OBJECT(plot), plot_signals[CHANGED], 0);
+ g_signal_emit (plot, plot_signals[UPDATE], 0, TRUE);
+ g_signal_emit (plot, plot_signals[CHANGED], 0);
}
/**
@@ -4580,8 +4544,8 @@ gtk_plot_set_yrange (GtkPlot *plot,
plot->right->ticks.min = ymin;
plot->right->ticks.max = ymax;
- g_signal_emit (GTK_OBJECT(plot), plot_signals[UPDATE], 0, TRUE);
- g_signal_emit (GTK_OBJECT(plot), plot_signals[CHANGED], 0);
+ g_signal_emit (plot, plot_signals[UPDATE], 0, TRUE);
+ g_signal_emit (plot, plot_signals[CHANGED], 0);
}
@@ -4620,8 +4584,8 @@ gtk_plot_set_range (GtkPlot *plot,
gtk_plot_axis_ticks_recalc(plot->top);
gtk_plot_axis_ticks_recalc(plot->left);
gtk_plot_axis_ticks_recalc(plot->right);
- g_signal_emit (GTK_OBJECT(plot), plot_signals[UPDATE], 0, TRUE);
- g_signal_emit (GTK_OBJECT(plot), plot_signals[CHANGED], 0);
+ g_signal_emit (plot, plot_signals[UPDATE], 0, TRUE);
+ g_signal_emit (plot, plot_signals[CHANGED], 0);
}
/**
@@ -4760,8 +4724,8 @@ gtk_plot_autoscale(GtkPlot *plot)
plot->ymin = plot->left->ticks.min;
plot->ymax = plot->left->ticks.max;
- g_signal_emit (GTK_OBJECT(plot), plot_signals[UPDATE], 0, TRUE);
- g_signal_emit (GTK_OBJECT(plot), plot_signals[CHANGED], 0);
+ g_signal_emit (plot, plot_signals[UPDATE], 0, TRUE);
+ g_signal_emit (plot, plot_signals[CHANGED], 0);
}
/**
@@ -4810,8 +4774,8 @@ gtk_plot_set_xscale (GtkPlot *plot, GtkPlotScale scale_type)
plot->bottom->ticks.scale = scale_type;
plot->top->ticks.scale = scale_type;
- g_signal_emit (GTK_OBJECT(plot), plot_signals[UPDATE], 0, FALSE);
- g_signal_emit (GTK_OBJECT(plot), plot_signals[CHANGED], 0);
+ g_signal_emit (plot, plot_signals[UPDATE], 0, FALSE);
+ g_signal_emit (plot, plot_signals[CHANGED], 0);
}
/**
@@ -4828,8 +4792,8 @@ gtk_plot_set_yscale (GtkPlot *plot, GtkPlotScale scale_type)
plot->left->ticks.scale = scale_type;
plot->right->ticks.scale = scale_type;
- g_signal_emit (GTK_OBJECT(plot), plot_signals[UPDATE], 0, FALSE);
- g_signal_emit (GTK_OBJECT(plot), plot_signals[CHANGED], 0);
+ g_signal_emit (plot, plot_signals[UPDATE], 0, FALSE);
+ g_signal_emit (plot, plot_signals[CHANGED], 0);
}
/**
@@ -4951,17 +4915,19 @@ gtk_plot_thaw (GtkPlot *plot)
GtkPlotText *
gtk_plot_put_text (GtkPlot *plot, gdouble x, gdouble y,
const gchar *font, gint height, gint angle,
- const GdkColor *fg, const GdkColor *bg,
+ const GdkRGBA *fg, const GdkRGBA *bg,
gboolean transparent,
GtkJustification justification,
const gchar *text)
{
GtkWidget *widget;
+ GtkStyleContext *ctxt;
GtkPlotText *text_attr;
GtkAllocation allocation;
widget = GTK_WIDGET(plot);
+ ctxt = gtk_widget_get_style_context(widget);
text_attr = g_new0(GtkPlotText, 1);
@@ -4971,8 +4937,11 @@ gtk_plot_put_text (GtkPlot *plot, gdouble x, gdouble y,
text_attr->y = y;
text_attr->angle = angle;
text_attr->justification = justification;
- text_attr->fg = gtk_widget_get_style(widget)->black;
- text_attr->bg = gtk_widget_get_style(widget)->white;
+ gtk_style_context_get(ctxt, GTK_STATE_FLAG_NORMAL,
+ GTK_STYLE_PROPERTY_COLOR,
+ &text_attr->fg,
+ GTK_STYLE_PROPERTY_BACKGROUND_COLOR,
+ &text_attr->bg, NULL);
text_attr->transparent = transparent;
text_attr->border = 0;
text_attr->border_space = 2;
@@ -4999,7 +4968,7 @@ gtk_plot_put_text (GtkPlot *plot, gdouble x, gdouble y,
plot->text = g_list_append(plot->text, text_attr);
gtk_plot_draw_text(plot, *text_attr);
- g_signal_emit (GTK_OBJECT(plot), plot_signals[CHANGED], 0);
+ g_signal_emit (plot, plot_signals[CHANGED], 0);
return text_attr;
}
@@ -5022,15 +4991,15 @@ gtk_plot_text_set_attributes (GtkPlotText *text_attr,
const gchar *font,
gint height,
gint angle,
- const GdkColor *fg,
- const GdkColor *bg,
+ const GdkRGBA *fg,
+ const GdkRGBA *bg,
gboolean transparent,
GtkJustification justification,
const gchar *text)
{
text_attr->angle = angle;
- gdk_color_black(gdk_colormap_get_system(), &text_attr->fg);
- gdk_color_white(gdk_colormap_get_system(), &text_attr->bg);
+ gdk_rgba_parse(&text_attr->fg, "black");
+ gdk_rgba_parse(&text_attr->bg, "white");
text_attr->justification = justification;
text_attr->transparent = transparent;
@@ -5307,7 +5276,7 @@ gtk_plot_axis_set_visible (GtkPlotAxis *axis, gboolean visible)
aux->is_visible = visible;
- g_signal_emit (GTK_OBJECT(axis), axis_signals[AXIS_CHANGED], 0);
+ g_signal_emit (axis, axis_signals[AXIS_CHANGED], 0);
}
/**
@@ -5344,7 +5313,7 @@ gtk_plot_axis_set_title (GtkPlotAxis *axis, const gchar *title)
aux->title.text = g_strdup(title);
- g_signal_emit (GTK_OBJECT(axis), axis_signals[AXIS_CHANGED], 0);
+ g_signal_emit (axis, axis_signals[AXIS_CHANGED], 0);
}
/**
@@ -5360,7 +5329,7 @@ gtk_plot_axis_show_title (GtkPlotAxis *axis)
aux->title_visible = TRUE;
- g_signal_emit (GTK_OBJECT(axis), axis_signals[AXIS_CHANGED], 0);
+ g_signal_emit (axis, axis_signals[AXIS_CHANGED], 0);
}
/**
@@ -5376,7 +5345,7 @@ gtk_plot_axis_hide_title (GtkPlotAxis *axis)
aux->title_visible = FALSE;
- g_signal_emit (GTK_OBJECT(axis), axis_signals[AXIS_CHANGED], 0);
+ g_signal_emit (axis, axis_signals[AXIS_CHANGED], 0);
}
/**
@@ -5397,7 +5366,7 @@ gtk_plot_axis_move_title (GtkPlotAxis *axis, gint angle, gdouble x, gdouble y)
aux->title.x = x;
aux->title.y = y;
- g_signal_emit (GTK_OBJECT(axis), axis_signals[AXIS_CHANGED], 0);
+ g_signal_emit (axis, axis_signals[AXIS_CHANGED], 0);
}
/**
@@ -5414,7 +5383,7 @@ gtk_plot_axis_justify_title (GtkPlotAxis *axis, GtkJustification justification)
aux->title.justification = justification;
- g_signal_emit (GTK_OBJECT(axis), axis_signals[AXIS_CHANGED], 0);
+ g_signal_emit (axis, axis_signals[AXIS_CHANGED], 0);
}
/**
@@ -5427,7 +5396,7 @@ gtk_plot_axis_justify_title (GtkPlotAxis *axis, GtkJustification justification)
*/
void
gtk_plot_axis_set_attributes (GtkPlotAxis *axis,
- gfloat width, const GdkColor *color)
+ gfloat width, const GdkRGBA *color)
{
GtkPlotAxis *aux = axis;
@@ -5435,7 +5404,7 @@ gtk_plot_axis_set_attributes (GtkPlotAxis *axis,
aux->line.color = *color;
- g_signal_emit (GTK_OBJECT(axis), axis_signals[AXIS_CHANGED], 0);
+ g_signal_emit (axis, axis_signals[AXIS_CHANGED], 0);
}
/**
@@ -5448,7 +5417,7 @@ gtk_plot_axis_set_attributes (GtkPlotAxis *axis,
*/
void
gtk_plot_axis_get_attributes (GtkPlotAxis *axis,
- gfloat *width, GdkColor *color)
+ gfloat *width, GdkRGBA *color)
{
GtkPlotAxis *aux = axis;
@@ -5472,7 +5441,7 @@ gtk_plot_axis_set_ticks (GtkPlotAxis *axis,
axis->ticks.step = major_step;
axis->ticks.nminor = nminor;
gtk_plot_axis_ticks_recalc(axis);
- g_signal_emit (GTK_OBJECT(axis), axis_signals[AXIS_CHANGED], 0);
+ g_signal_emit (axis, axis_signals[AXIS_CHANGED], 0);
}
/**
@@ -5488,7 +5457,7 @@ gtk_plot_axis_set_major_ticks (GtkPlotAxis *axis,
{
axis->ticks.step = major_step;
gtk_plot_axis_ticks_recalc(axis);
- g_signal_emit (GTK_OBJECT(axis), axis_signals[AXIS_CHANGED], 0);
+ g_signal_emit (axis, axis_signals[AXIS_CHANGED], 0);
}
/**
@@ -5504,7 +5473,7 @@ gtk_plot_axis_set_minor_ticks (GtkPlotAxis *axis,
{
axis->ticks.nminor = nminor;
gtk_plot_axis_ticks_recalc(axis);
- g_signal_emit (GTK_OBJECT(axis), axis_signals[AXIS_CHANGED], 0);
+ g_signal_emit (axis, axis_signals[AXIS_CHANGED], 0);
}
/**
@@ -5519,7 +5488,7 @@ gtk_plot_axis_set_ticks_length (GtkPlotAxis *axis, gint length)
{
GtkPlotAxis *aux = axis;
aux->ticks_length = length;
- g_signal_emit (GTK_OBJECT(axis), axis_signals[AXIS_CHANGED], 0);
+ g_signal_emit (axis, axis_signals[AXIS_CHANGED], 0);
}
/**
@@ -5535,7 +5504,7 @@ gtk_plot_axis_set_ticks_width (GtkPlotAxis *axis, gfloat width)
GtkPlotAxis *aux = axis;
aux->ticks_width = width;
- g_signal_emit (GTK_OBJECT(axis), axis_signals[AXIS_CHANGED], 0);
+ g_signal_emit (axis, axis_signals[AXIS_CHANGED], 0);
}
/**
@@ -5556,7 +5525,7 @@ gtk_plot_axis_show_ticks (GtkPlotAxis *axis,
aux->major_mask = major_mask;
aux->minor_mask = minor_mask;
- g_signal_emit (GTK_OBJECT(axis), axis_signals[AXIS_CHANGED], 0);
+ g_signal_emit (axis, axis_signals[AXIS_CHANGED], 0);
}
/**
@@ -5578,7 +5547,7 @@ gtk_plot_axis_set_ticks_limits (GtkPlotAxis *axis,
axis->ticks.set_limits = TRUE;
gtk_plot_axis_ticks_recalc(axis);
- g_signal_emit (GTK_OBJECT(axis), axis_signals[AXIS_CHANGED], 0);
+ g_signal_emit (axis, axis_signals[AXIS_CHANGED], 0);
}
/**
@@ -5593,7 +5562,7 @@ gtk_plot_axis_unset_ticks_limits (GtkPlotAxis *axis)
axis->ticks.set_limits = FALSE;
gtk_plot_axis_ticks_recalc(axis);
- g_signal_emit (GTK_OBJECT(axis), axis_signals[AXIS_CHANGED], 0);
+ g_signal_emit (axis, axis_signals[AXIS_CHANGED], 0);
}
/**
@@ -5645,7 +5614,7 @@ gtk_plot_axis_set_break (GtkPlotAxis *axis,
axis->ticks.break_scale = scale_after;
gtk_plot_axis_ticks_recalc(axis);
- g_signal_emit (GTK_OBJECT(axis), axis_signals[AXIS_CHANGED], 0);
+ g_signal_emit (axis, axis_signals[AXIS_CHANGED], 0);
}
/**
@@ -5658,7 +5627,7 @@ void
gtk_plot_axis_remove_break (GtkPlotAxis *axis)
{
axis->ticks.apply_break = FALSE;
- g_signal_emit (GTK_OBJECT(axis), axis_signals[AXIS_CHANGED], 0);
+ g_signal_emit (axis, axis_signals[AXIS_CHANGED], 0);
}
/**
@@ -5675,7 +5644,7 @@ gtk_plot_axis_show_labels (GtkPlotAxis *axis, gint labels_mask)
aux->label_mask = labels_mask;
- g_signal_emit (GTK_OBJECT(axis), axis_signals[AXIS_CHANGED], 0);
+ g_signal_emit (axis, axis_signals[AXIS_CHANGED], 0);
}
@@ -5697,8 +5666,8 @@ gtk_plot_axis_title_set_attributes (GtkPlotAxis *axis,
const gchar *font,
gint height,
gint angle,
- const GdkColor *fg,
- const GdkColor *bg,
+ const GdkRGBA *fg,
+ const GdkRGBA *bg,
gboolean transparent,
GtkJustification justification)
{
@@ -5715,8 +5684,8 @@ gtk_plot_axis_title_set_attributes (GtkPlotAxis *axis,
aux->title.height = height;
}
- gdk_color_black(gdk_colormap_get_system(), &axis->title.fg);
- gdk_color_white(gdk_colormap_get_system(), &axis->title.bg);
+ gdk_rgba_parse(&axis->title.fg, "black");
+ gdk_rgba_parse(&axis->title.bg, "white");
if(fg) aux->title.fg = *fg;
if(bg) aux->title.bg = *bg;
@@ -5725,7 +5694,7 @@ gtk_plot_axis_title_set_attributes (GtkPlotAxis *axis,
aux->title.transparent = transparent;
aux->title.justification = justification;
- g_signal_emit (GTK_OBJECT(axis), axis_signals[AXIS_CHANGED], 0);
+ g_signal_emit (axis, axis_signals[AXIS_CHANGED], 0);
}
/**
@@ -5742,7 +5711,7 @@ gtk_plot_axis_set_labels_offset (GtkPlotAxis *axis,
GtkPlotAxis *aux = axis;
aux->labels_offset = offset;
- g_signal_emit (GTK_OBJECT(axis), axis_signals[AXIS_CHANGED], 0);
+ g_signal_emit (axis, axis_signals[AXIS_CHANGED], 0);
}
/**
@@ -5779,8 +5748,8 @@ gtk_plot_axis_set_labels_attributes (GtkPlotAxis *axis,
const gchar *font,
gint height,
gint angle,
- const GdkColor *fg,
- const GdkColor *bg,
+ const GdkRGBA *fg,
+ const GdkRGBA *bg,
gboolean transparent,
GtkJustification justification)
{
@@ -5799,8 +5768,8 @@ gtk_plot_axis_set_labels_attributes (GtkPlotAxis *axis,
aux->labels_attr.angle = angle;
- gdk_color_black(gdk_colormap_get_system(), &axis->labels_attr.fg);
- gdk_color_white(gdk_colormap_get_system(), &axis->labels_attr.bg);
+ gdk_rgba_parse(&axis->labels_attr.fg, "black");
+ gdk_rgba_parse(&axis->labels_attr.bg, "white");
if(fg) aux->labels_attr.fg = *fg;
if(bg) aux->labels_attr.bg = *bg;
@@ -5808,7 +5777,7 @@ gtk_plot_axis_set_labels_attributes (GtkPlotAxis *axis,
aux->labels_attr.transparent = transparent;
aux->labels_attr.justification = justification;
- g_signal_emit (GTK_OBJECT(axis), axis_signals[AXIS_CHANGED], 0);
+ g_signal_emit (axis, axis_signals[AXIS_CHANGED], 0);
}
/**
@@ -5829,7 +5798,7 @@ gtk_plot_axis_set_labels_style (GtkPlotAxis *axis,
aux->label_style = style;
aux->label_precision = precision;
- g_signal_emit (GTK_OBJECT(axis), axis_signals[AXIS_CHANGED], 0);
+ g_signal_emit (axis, axis_signals[AXIS_CHANGED], 0);
}
/**
@@ -5845,7 +5814,7 @@ gtk_plot_axis_use_custom_tick_labels (GtkPlotAxis *axis,
{
axis->custom_labels = use;
- g_signal_emit (GTK_OBJECT(axis), axis_signals[AXIS_CHANGED], 0);
+ g_signal_emit (axis, axis_signals[AXIS_CHANGED], 0);
}
/**
@@ -5866,7 +5835,7 @@ gtk_plot_axis_set_labels_prefix (GtkPlotAxis *axis,
else
axis->labels_prefix = NULL;
- g_signal_emit (GTK_OBJECT(axis), axis_signals[AXIS_CHANGED], 0);
+ g_signal_emit (axis, axis_signals[AXIS_CHANGED], 0);
}
/**
@@ -5887,7 +5856,7 @@ gtk_plot_axis_set_labels_suffix (GtkPlotAxis *axis,
else
axis->labels_suffix = NULL;
- g_signal_emit (GTK_OBJECT(axis), axis_signals[AXIS_CHANGED], 0);
+ g_signal_emit (axis, axis_signals[AXIS_CHANGED], 0);
}
/**
@@ -5939,7 +5908,7 @@ gtk_plot_x0_set_visible(GtkPlot *plot, gboolean visible)
{
plot->show_x0 = visible;
- g_signal_emit (GTK_OBJECT(plot), plot_signals[CHANGED], 0);
+ g_signal_emit (plot, plot_signals[CHANGED], 0);
}
/**
@@ -5968,7 +5937,7 @@ gtk_plot_y0_set_visible(GtkPlot *plot, gboolean visible)
{
plot->show_y0 = visible;
- g_signal_emit (GTK_OBJECT(plot), plot_signals[CHANGED], 0);
+ g_signal_emit (plot, plot_signals[CHANGED], 0);
}
/**
@@ -6032,7 +6001,7 @@ gtk_plot_grids_set_visible(GtkPlot *plot,
plot->left->show_major_grid = hmajor;
plot->left->show_minor_grid = hminor;
- g_signal_emit (GTK_OBJECT(plot), plot_signals[CHANGED], 0);
+ g_signal_emit (plot, plot_signals[CHANGED], 0);
}
/**
@@ -6069,13 +6038,13 @@ void
gtk_plot_x0line_set_attributes(GtkPlot *plot,
GtkPlotLineStyle line_style,
gfloat width,
- const GdkColor *color)
+ const GdkRGBA *color)
{
plot->x0_line.line_style = line_style;
plot->x0_line.line_width = width;
if(color) plot->x0_line.color = *color;
- g_signal_emit (GTK_OBJECT(plot), plot_signals[CHANGED], 0);
+ g_signal_emit (plot, plot_signals[CHANGED], 0);
}
/**
@@ -6091,13 +6060,13 @@ void
gtk_plot_y0line_set_attributes(GtkPlot *plot,
GtkPlotLineStyle line_style,
gfloat width,
- const GdkColor *color)
+ const GdkRGBA *color)
{
plot->y0_line.line_style = line_style;
plot->y0_line.line_width = width;
if(color) plot->y0_line.color = *color;
- g_signal_emit (GTK_OBJECT(plot), plot_signals[CHANGED], 0);
+ g_signal_emit (plot, plot_signals[CHANGED], 0);
}
/**
@@ -6113,13 +6082,13 @@ void
gtk_plot_major_vgrid_set_attributes(GtkPlot *plot,
GtkPlotLineStyle line_style,
gfloat width,
- const GdkColor *color)
+ const GdkRGBA *color)
{
plot->bottom->major_grid.line_style = line_style;
plot->bottom->major_grid.line_width = width;
if(color) plot->bottom->major_grid.color = *color;
- g_signal_emit (GTK_OBJECT(plot), plot_signals[CHANGED], 0);
+ g_signal_emit (plot, plot_signals[CHANGED], 0);
}
/**
@@ -6135,13 +6104,13 @@ void
gtk_plot_minor_vgrid_set_attributes(GtkPlot *plot,
GtkPlotLineStyle line_style,
gfloat width,
- const GdkColor *color)
+ const GdkRGBA *color)
{
plot->bottom->minor_grid.line_style = line_style;
plot->bottom->minor_grid.line_width = width;
if(color) plot->bottom->minor_grid.color = *color;
- g_signal_emit (GTK_OBJECT(plot), plot_signals[CHANGED], 0);
+ g_signal_emit (plot, plot_signals[CHANGED], 0);
}
/**
@@ -6157,13 +6126,13 @@ void
gtk_plot_major_hgrid_set_attributes(GtkPlot *plot,
GtkPlotLineStyle line_style,
gfloat width,
- const GdkColor *color)
+ const GdkRGBA *color)
{
plot->left->major_grid.line_style = line_style;
plot->left->major_grid.line_width = width;
if(color) plot->left->major_grid.color = *color;
- g_signal_emit (GTK_OBJECT(plot), plot_signals[CHANGED], 0);
+ g_signal_emit (plot, plot_signals[CHANGED], 0);
}
/**
@@ -6179,13 +6148,13 @@ void
gtk_plot_minor_hgrid_set_attributes(GtkPlot *plot,
GtkPlotLineStyle line_style,
gfloat width,
- const GdkColor *color)
+ const GdkRGBA *color)
{
plot->left->minor_grid.line_style = line_style;
plot->left->minor_grid.line_width = width;
if(color) plot->left->minor_grid.color = *color;
- g_signal_emit (GTK_OBJECT(plot), plot_signals[CHANGED], 0);
+ g_signal_emit (plot, plot_signals[CHANGED], 0);
}
/******************************************
@@ -6210,7 +6179,7 @@ gtk_plot_show_legends(GtkPlot *plot)
{
plot->show_legends = TRUE;
- g_signal_emit (GTK_OBJECT(plot), plot_signals[CHANGED], 0);
+ g_signal_emit (plot, plot_signals[CHANGED], 0);
}
/**
@@ -6224,7 +6193,7 @@ gtk_plot_hide_legends(GtkPlot *plot)
{
plot->show_legends = FALSE;
- g_signal_emit (GTK_OBJECT(plot), plot_signals[CHANGED], 0);
+ g_signal_emit (plot, plot_signals[CHANGED], 0);
}
/**
@@ -6243,7 +6212,7 @@ gtk_plot_set_legends_border(GtkPlot *plot,
plot->legends_border = legends_border;
plot->legends_shadow_width = shadow_width;
- g_signal_emit (GTK_OBJECT(plot), plot_signals[CHANGED], 0);
+ g_signal_emit (plot, plot_signals[CHANGED], 0);
}
/**
@@ -6260,7 +6229,7 @@ gtk_plot_legends_move(GtkPlot *plot, gdouble x, gdouble y)
plot->legends_x = x;
plot->legends_y = y;
- g_signal_emit (GTK_OBJECT(plot), plot_signals[CHANGED], 0);
+ g_signal_emit (plot, plot_signals[CHANGED], 0);
}
/**
@@ -6314,7 +6283,7 @@ gtk_plot_legends_get_allocation(GtkPlot *plot)
if(gtk_widget_get_visible(GTK_WIDGET(dataset)) && dataset->show_legend)
{
- GTK_PLOT_DATA_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(dataset)))->get_legend_size(dataset, &lwidth,
&lheight);
+ GTK_PLOT_DATA_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(dataset)))->get_legend_size(dataset, &lwidth,
&lheight);
width = MAX(width, lwidth);
height += lheight;
}
@@ -6342,8 +6311,9 @@ gtk_plot_legends_get_allocation(GtkPlot *plot)
*/
void
gtk_plot_legends_set_attributes(GtkPlot *plot, const gchar *font, gint height,
- const GdkColor *foreground, const GdkColor *background)
+ const GdkRGBA *foreground, const GdkRGBA *background)
{
+ GtkStyleContext *ctxt;
g_free(plot->legends_attr.font);
@@ -6354,8 +6324,12 @@ gtk_plot_legends_set_attributes(GtkPlot *plot, const gchar *font, gint height,
plot->legends_attr.font = g_strdup(font);
plot->legends_attr.height = height;
}
- plot->legends_attr.fg = gtk_widget_get_style(GTK_WIDGET(plot))->black;
- plot->legends_attr.bg = gtk_widget_get_style(GTK_WIDGET(plot))->white;
+ ctxt = gtk_widget_get_style_context(GTK_WIDGET(plot));
+ gtk_style_context_get(ctxt, GTK_STATE_FLAG_NORMAL,
+ GTK_STYLE_PROPERTY_COLOR,
+ &plot->legends_attr.fg,
+ GTK_STYLE_PROPERTY_BACKGROUND_COLOR,
+ &plot->legends_attr.bg, NULL);
if(foreground != NULL)
plot->legends_attr.fg = *foreground;
@@ -6366,7 +6340,7 @@ gtk_plot_legends_set_attributes(GtkPlot *plot, const gchar *font, gint height,
plot->legends_attr.transparent = FALSE;
}
- g_signal_emit (GTK_OBJECT(plot), plot_signals[CHANGED], 0);
+ g_signal_emit (plot, plot_signals[CHANGED], 0);
}
/**
@@ -6382,16 +6356,16 @@ gtk_plot_add_data(GtkPlot *plot,
{
gboolean veto = TRUE;
- _gtkextra_signal_emit (GTK_OBJECT(plot), plot_signals[ADD_DATA], dataset, &veto);
+ _gtkextra_signal_emit (G_OBJECT(plot), plot_signals[ADD_DATA], dataset, &veto);
plot->data_sets = g_list_append(plot->data_sets, dataset);
g_object_ref(GTK_WIDGET(dataset));
- g_object_ref_sink(GTK_OBJECT(dataset));
- g_object_unref(GTK_OBJECT(dataset));
+ g_object_ref_sink(dataset);
+ g_object_unref(dataset);
dataset->plot = plot;
- g_signal_emit_by_name (GTK_OBJECT(dataset), "add_to_plot", plot, &veto);
- g_signal_emit (GTK_OBJECT(plot), plot_signals[CHANGED], 0);
+ g_signal_emit_by_name (dataset, "add_to_plot", plot, &veto);
+ g_signal_emit (plot, plot_signals[CHANGED], 0);
}
/**
@@ -6439,7 +6413,7 @@ gtk_plot_remove_data(GtkPlot *plot, GtkPlotData *dataset)
g_object_unref(GTK_WIDGET(dataset));
plot->data_sets = g_list_remove_link(plot->data_sets, datasets);
g_list_free_1(datasets);
- g_signal_emit (GTK_OBJECT(plot), plot_signals[CHANGED], 0);
+ g_signal_emit (plot, plot_signals[CHANGED], 0);
return TRUE;
}
datasets = datasets->next;
@@ -6472,7 +6446,7 @@ gtk_plot_remove_text(GtkPlot *plot, GtkPlotText *text)
if((GtkPlotText *)data == text){
plot->text = g_list_remove_link(plot->text, list);
g_list_free_1(list);
- g_signal_emit (GTK_OBJECT(plot), plot_signals[CHANGED], 0);
+ g_signal_emit (plot, plot_signals[CHANGED], 0);
return TRUE;
}
list = list->next;
@@ -6732,7 +6706,7 @@ update_datasets(GtkPlot *plot, gboolean new_range)
list = plot->data_sets;
while(list) {
- g_signal_emit_by_name(GTK_OBJECT(list->data), "update", new_range);
+ g_signal_emit_by_name(list->data, "update", new_range);
list = list->next;
}
diff --git a/gtkextra/gtkplot.h b/gtkextra/gtkplot.h
index 4cf021b4..9c7ce61c 100644
--- a/gtkextra/gtkplot.h
+++ b/gtkextra/gtkplot.h
@@ -221,8 +221,8 @@ struct _GtkPlotText
/*< private >*/
gdouble x, y;
gint angle; /* 0, 90, 180, 270 */
- GdkColor fg;
- GdkColor bg;
+ GdkRGBA fg;
+ GdkRGBA bg;
gboolean transparent;
@@ -249,11 +249,11 @@ struct _GtkPlotLine
{
/*< private >*/
GtkPlotLineStyle line_style;
- GdkCapStyle cap_style;
- GdkJoinStyle join_style;
+ cairo_line_cap_t cap_style;
+ cairo_line_join_t join_style;
- gfloat line_width;
- GdkColor color;
+ gdouble line_width;
+ GdkRGBA color;
};
/**
@@ -270,7 +270,7 @@ struct _GtkPlotSymbol
gint size;
- GdkColor color;
+ GdkRGBA color;
GtkPlotLine border;
};
@@ -359,7 +359,7 @@ typedef void (*GtkPlotParseLabelFunc)(GtkPlotAxis *axis,
struct _GtkPlotAxis
{
/*< private >*/
- GtkObject object;
+ GtkWidget object;
gboolean is_visible;
@@ -470,13 +470,13 @@ struct _GtkPlotData
gdouble y_step;
gdouble z_step;
- GdkColor color_min, color_max;
- GdkColor color_lt_min, color_gt_max;
+ GdkRGBA color_min, color_max;
+ GdkRGBA color_lt_min, color_gt_max;
gboolean gradient_show_lt_gt;
gint gradient_mask;
GtkPlotAxis *gradient;
gboolean gradient_custom;
- GdkColor *gradient_colors;
+ GdkRGBA *gradient_colors;
gboolean show_gradient;
gint legends_precision;
@@ -506,9 +506,9 @@ struct _GtkPlot
GtkAllocation internal_allocation;
- GdkDrawable *drawable;
+ cairo_surface_t *drawable;
- GdkPixmap *bg_pixmap;
+ cairo_surface_t *bg_pixmap;
gboolean use_pixmap;
gboolean transparent;
@@ -517,7 +517,7 @@ struct _GtkPlot
gboolean clip_data;
- GdkColor background;
+ GdkRGBA background;
gboolean grids_on_top;
gboolean show_x0;
@@ -539,10 +539,10 @@ struct _GtkPlot
gboolean reflect_x;
gboolean reflect_y;
- gfloat bottom_align;
- gfloat top_align;
- gfloat left_align;
- gfloat right_align;
+ gdouble bottom_align;
+ gdouble top_align;
+ gdouble left_align;
+ gdouble right_align;
GtkPlotLine x0_line;
GtkPlotLine y0_line;
@@ -568,7 +568,7 @@ struct _GtkPlotClass
GtkWidgetClass parent_class;
void (*set_pc)(GtkPlot *plot, GtkPlotPC *pc);
- void (*set_drawable)(GtkPlot *plot, GdkDrawable *drawable);
+ void (*set_drawable)(GtkPlot *plot, cairo_surface_t *drawable);
gboolean(*add_data)(GtkPlot *plot, GtkPlotData *data);
void (*update)(GtkPlot *plot, gboolean new_range);
void (*changed)(GtkPlot *plot);
@@ -629,7 +629,7 @@ struct _GtkPlotDataClass
struct _GtkPlotAxisClass
{
- GtkObjectClass parent_class;
+ GtkWidgetClass parent_class;
gboolean(*tick_label)(GtkPlotAxis *axis,
gdouble *tick,
@@ -641,21 +641,21 @@ struct _GtkPlotAxisClass
/* Plot */
GType gtk_plot_get_type(void);
-GtkWidget *gtk_plot_new(GdkDrawable *drawable);
-GtkWidget *gtk_plot_new_with_size(GdkDrawable *drawable,
+GtkWidget *gtk_plot_new(cairo_surface_t *drawable);
+GtkWidget *gtk_plot_new_with_size(cairo_surface_t *drawable,
gdouble width, gdouble height);
void gtk_plot_construct(GtkPlot *plot,
- GdkDrawable *drawable);
+ cairo_surface_t *drawable);
void gtk_plot_construct_with_size(GtkPlot *plot,
- GdkDrawable *drawable,
+ cairo_surface_t *drawable,
gdouble width, gdouble height);
void gtk_plot_set_drawable(GtkPlot *plot,
- GdkDrawable *drawable);
-GdkDrawable *gtk_plot_get_drawable(GtkPlot *plot);
+ cairo_surface_t *drawable);
+cairo_surface_t *gtk_plot_get_drawable(GtkPlot *plot);
void gtk_plot_set_pc(GtkPlot *plot,
GtkPlotPC *pc);
void gtk_plot_set_background_pixmap(GtkPlot *plot,
- GdkPixmap *pixmap);
+ cairo_surface_t *pixmap);
void gtk_plot_set_transparent(GtkPlot *plot,
gboolean transparent);
gboolean gtk_plot_is_transparent(GtkPlot *plot);
@@ -666,10 +666,8 @@ void gtk_plot_get_size(GtkPlot *plot,
gdouble *height);
GtkAllocation gtk_plot_get_internal_allocation(GtkPlot *plot);
void gtk_plot_set_background(GtkPlot *plot,
- const GdkColor *bg_color);
+ const GdkRGBA *bg_color);
void gtk_plot_paint(GtkPlot *plot);
-void gtk_plot_refresh(GtkPlot *plot,
- GdkRectangle *drawing_area);
void gtk_plot_move(GtkPlot *plot,
gdouble x, gdouble y);
void gtk_plot_resize(GtkPlot *plot,
@@ -715,8 +713,8 @@ GtkPlotText *gtk_plot_put_text(GtkPlot *plot,
const gchar *font,
gint height,
gint angle,
- const GdkColor *fg,
- const GdkColor *bg,
+ const GdkRGBA *fg,
+ const GdkRGBA *bg,
gboolean transparent,
GtkJustification justification,
const gchar *text);
@@ -740,8 +738,8 @@ void gtk_plot_text_set_attributes(GtkPlotText *text_attr,
const gchar *font,
gint height,
gint angle,
- const GdkColor *fg,
- const GdkColor *bg,
+ const GdkRGBA *fg,
+ const GdkRGBA *bg,
gboolean transparent,
GtkJustification justification,
const gchar *text);
@@ -784,7 +782,7 @@ void gtk_plot_thaw (GtkPlot *plot);
/* Axis */
GType gtk_plot_axis_get_type(void);
-GtkObject *gtk_plot_axis_new(GtkPlotOrientation orientation);
+GtkWidget *gtk_plot_axis_new(GtkPlotOrientation orientation);
void gtk_plot_axis_construct(GtkPlotAxis *axis,
GtkPlotOrientation orientation);
GtkPlotAxis *gtk_plot_get_axis(GtkPlot *plot,
@@ -803,10 +801,10 @@ void gtk_plot_axis_justify_title(GtkPlotAxis *axis,
GtkJustification justification);
void gtk_plot_axis_set_attributes(GtkPlotAxis *axis,
gfloat width,
- const GdkColor *color);
+ const GdkRGBA *color);
void gtk_plot_axis_get_attributes(GtkPlotAxis *axis,
gfloat *width,
- GdkColor *color);
+ GdkRGBA *color);
void gtk_plot_axis_set_ticks(GtkPlotAxis *axis,
gdouble major_step,
gint nminor);
@@ -840,8 +838,8 @@ void gtk_plot_axis_title_set_attributes
const gchar *font,
gint height,
gint angle,
- const GdkColor *fg,
- const GdkColor *bg,
+ const GdkRGBA *fg,
+ const GdkRGBA *bg,
gboolean transparent,
GtkJustification justification);
void gtk_plot_axis_set_labels_attributes
@@ -849,8 +847,8 @@ void gtk_plot_axis_set_labels_attributes
const gchar *font,
gint height,
gint angle,
- const GdkColor *fg,
- const GdkColor *bg,
+ const GdkRGBA *fg,
+ const GdkRGBA *bg,
gboolean transparent,
GtkJustification justification);
#define gtk_plot_axis_set_labels_numbers gtk_plot_axis_set_labels_style
@@ -911,27 +909,27 @@ void gtk_plot_grids_visible(GtkPlot *plot,
void gtk_plot_y0line_set_attributes(GtkPlot *plot,
GtkPlotLineStyle line_style,
gfloat width,
- const GdkColor *color);
+ const GdkRGBA *color);
void gtk_plot_x0line_set_attributes(GtkPlot *plot,
GtkPlotLineStyle line_style,
gfloat width,
- const GdkColor *color);
+ const GdkRGBA *color);
void gtk_plot_major_vgrid_set_attributes(GtkPlot *plot,
GtkPlotLineStyle style,
gfloat width,
- const GdkColor *color);
+ const GdkRGBA *color);
void gtk_plot_minor_vgrid_set_attributes(GtkPlot *plot,
GtkPlotLineStyle line_style,
gfloat width,
- const GdkColor *color);
+ const GdkRGBA *color);
void gtk_plot_major_hgrid_set_attributes(GtkPlot *plot,
GtkPlotLineStyle line_style,
gfloat width,
- const GdkColor *color);
+ const GdkRGBA *color);
void gtk_plot_minor_hgrid_set_attributes(GtkPlot *plot,
GtkPlotLineStyle line_style,
gfloat width,
- const GdkColor *color);
+ const GdkRGBA *color);
/* Legends */
@@ -948,8 +946,8 @@ GtkAllocation gtk_plot_legends_get_allocation(GtkPlot *plot);
void gtk_plot_legends_set_attributes(GtkPlot *plot,
const gchar *font,
gint height,
- const GdkColor *foreground,
- const GdkColor *background);
+ const GdkRGBA *foreground,
+ const GdkRGBA *background);
void gtk_plot_set_line_attributes(GtkPlot *plot,
GtkPlotLine line);
/* Datasets */
diff --git a/gtkextra/gtkplot3d.c b/gtkextra/gtkplot3d.c
index 270003ab..e04369df 100644
--- a/gtkextra/gtkplot3d.c
+++ b/gtkextra/gtkplot3d.c
@@ -106,7 +106,7 @@ enum
static void gtk_plot3d_class_init (GtkPlot3DClass *klass);
static void gtk_plot3d_init (GtkPlot3D *plot);
-static void gtk_plot3d_destroy (GtkObject *object);
+static void gtk_plot3d_destroy (GtkWidget *object);
static void gtk_plot3d_set_property (GObject *object,
guint prop_id,
const GValue *value,
@@ -121,7 +121,7 @@ static void gtk_plot3d_draw_plane (GtkPlot3D *plot,
GtkPlotVector v2,
GtkPlotVector v3,
GtkPlotVector v4,
- GdkColor background);
+ GdkRGBA background);
static void gtk_plot3d_draw_grids (GtkPlot3D *plot,
GtkPlotAxis *axis,
GtkPlotVector origin);
@@ -165,14 +165,14 @@ gtk_plot3d_get_type (void)
static void
gtk_plot3d_class_init (GtkPlot3DClass *klass)
{
- GtkObjectClass *object_class;
+ GtkWidgetClass *object_class;
GtkPlotClass *plot_class;
GtkPlot3DClass *plot3d_class;
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_ref (gtk_plot_get_type ());
- object_class = (GtkObjectClass *) klass;
+ object_class = (GtkWidgetClass *) klass;
plot_class = (GtkPlotClass *) klass;
plot3d_class = (GtkPlot3DClass *) klass;
@@ -803,8 +803,7 @@ gtk_plot3d_class_init (GtkPlot3DClass *klass)
static void
gtk_plot3d_init (GtkPlot3D *plot)
{
- GtkWidget *widget;
- GdkColor color;
+ GdkRGBA color, black, white;
gint i;
gtk_widget_set_has_window(GTK_WIDGET(plot), FALSE);
@@ -814,11 +813,8 @@ gtk_plot3d_init (GtkPlot3D *plot)
plot->nsin[i] = sin(i*PI/180.);
}
- widget = GTK_WIDGET(plot);
- gdk_color_black(gtk_widget_get_colormap(widget),
- >k_widget_get_style(widget)->black);
- gdk_color_white(gtk_widget_get_colormap(widget),
- >k_widget_get_style(widget)->white);
+ gdk_rgba_parse(&black, "black");
+ gdk_rgba_parse(&white, "white");
GTK_PLOT(plot)->legends_x = .8;
@@ -929,11 +925,11 @@ gtk_plot3d_init (GtkPlot3D *plot)
plot->az->line.line_style = GTK_PLOT_LINE_SOLID;
plot->az->line.line_width = 2;
- plot->az->line.color = gtk_widget_get_style(widget)->black;
+ plot->az->line.color = black;
plot->az->labels_attr.text = NULL;
plot->az->labels_attr.height = DEFAULT_FONT_HEIGHT;
- plot->az->labels_attr.fg = gtk_widget_get_style(widget)->black;
- plot->az->labels_attr.bg = gtk_widget_get_style(widget)->white;
+ plot->az->labels_attr.fg = black;
+ plot->az->labels_attr.bg = white;
plot->az->labels_attr.transparent = TRUE;
plot->az->labels_attr.justification = GTK_JUSTIFY_CENTER;
plot->az->labels_attr.angle = 0;
@@ -943,18 +939,18 @@ gtk_plot3d_init (GtkPlot3D *plot)
plot->az->title.angle = 90;
plot->az->title.justification = GTK_JUSTIFY_CENTER;
plot->az->title.height = DEFAULT_FONT_HEIGHT;
- plot->az->title.fg = gtk_widget_get_style(widget)->black;
- plot->az->title.bg = gtk_widget_get_style(widget)->white;
+ plot->az->title.fg = black;
+ plot->az->title.bg = white;
plot->az->title.transparent = TRUE;
plot->az->title_visible = TRUE;
plot->ax->line.line_style = GTK_PLOT_LINE_SOLID;
plot->ax->line.line_width = 2;
- plot->ax->line.color = gtk_widget_get_style(widget)->black;
+ plot->ax->line.color = black;
plot->ax->labels_attr.text = NULL;
plot->ax->labels_attr.height = DEFAULT_FONT_HEIGHT;
- plot->ax->labels_attr.fg = gtk_widget_get_style(widget)->black;
- plot->ax->labels_attr.bg = gtk_widget_get_style(widget)->white;
+ plot->ax->labels_attr.fg = black;
+ plot->ax->labels_attr.bg = white;
plot->ax->labels_attr.transparent = TRUE;
plot->ax->labels_attr.justification = GTK_JUSTIFY_CENTER;
plot->ax->labels_attr.angle = 0;
@@ -964,18 +960,18 @@ gtk_plot3d_init (GtkPlot3D *plot)
plot->ax->title.angle = 0;
plot->ax->title.justification = GTK_JUSTIFY_CENTER;
plot->ax->title.height = DEFAULT_FONT_HEIGHT;
- plot->ax->title.fg = gtk_widget_get_style(widget)->black;
- plot->ax->title.bg = gtk_widget_get_style(widget)->white;
+ plot->ax->title.fg = black;
+ plot->ax->title.bg = white;
plot->ax->title.transparent = TRUE;
plot->ax->title_visible = TRUE;
plot->ay->line.line_style = GTK_PLOT_LINE_SOLID;
plot->ay->line.line_width = 2;
- plot->ay->line.color = gtk_widget_get_style(widget)->black;
+ plot->ay->line.color = black;
plot->ay->labels_attr.text = NULL;
plot->ay->labels_attr.height = DEFAULT_FONT_HEIGHT;
- plot->ay->labels_attr.fg = gtk_widget_get_style(widget)->black;
- plot->ay->labels_attr.bg = gtk_widget_get_style(widget)->white;
+ plot->ay->labels_attr.fg = black;
+ plot->ay->labels_attr.bg = white;
plot->ay->labels_attr.transparent = TRUE;
plot->ay->labels_attr.angle = 0;
plot->ay->label_mask = GTK_PLOT_LABEL_OUT;
@@ -985,8 +981,8 @@ gtk_plot3d_init (GtkPlot3D *plot)
plot->ay->title.angle = 0;
plot->ay->title.justification = GTK_JUSTIFY_CENTER;
plot->ay->title.height = DEFAULT_FONT_HEIGHT;
- plot->ay->title.fg = gtk_widget_get_style(widget)->black;
- plot->ay->title.bg = gtk_widget_get_style(widget)->white;
+ plot->ay->title.fg = black;
+ plot->ay->title.bg = white;
plot->ay->title.transparent = TRUE;
plot->ay->title_visible = TRUE;
@@ -999,23 +995,29 @@ gtk_plot3d_init (GtkPlot3D *plot)
plot->zscale = GTK_PLOT_SCALE_LINEAR;
plot->xy = GTK_PLOT_AXIS(gtk_plot_axis_new(GTK_PLOT_AXIS_X));
- gtk_object_ref (GTK_OBJECT (plot->xy));
- gtk_object_sink (GTK_OBJECT (plot->xy));
+ g_object_ref (plot->xy);
+ g_object_ref_sink (plot->xy);
+ g_object_unref (plot->xy);
plot->xz = GTK_PLOT_AXIS(gtk_plot_axis_new(GTK_PLOT_AXIS_X));
- gtk_object_ref (GTK_OBJECT (plot->xz));
- gtk_object_sink (GTK_OBJECT (plot->xz));
+ g_object_ref (plot->xz);
+ g_object_ref_sink (plot->xz);
+ g_object_unref (plot->xz);
plot->yx = GTK_PLOT_AXIS(gtk_plot_axis_new(GTK_PLOT_AXIS_Y));
- gtk_object_ref (GTK_OBJECT (plot->yx));
- gtk_object_sink (GTK_OBJECT (plot->yx));
+ g_object_ref (plot->yx);
+ g_object_ref_sink (plot->yx);
+ g_object_unref (plot->yx);
plot->yz = GTK_PLOT_AXIS(gtk_plot_axis_new(GTK_PLOT_AXIS_Y));
- gtk_object_ref (GTK_OBJECT (plot->yz));
- gtk_object_sink (GTK_OBJECT (plot->yz));
+ g_object_ref (plot->yz);
+ g_object_ref_sink (plot->yz);
+ g_object_unref (plot->yz);
plot->zx = GTK_PLOT_AXIS(gtk_plot_axis_new(GTK_PLOT_AXIS_Z));
- gtk_object_ref (GTK_OBJECT (plot->zx));
- gtk_object_sink (GTK_OBJECT (plot->zx));
+ g_object_ref (plot->zx);
+ g_object_ref_sink (plot->zx);
+ g_object_unref (plot->zx);
plot->zy = GTK_PLOT_AXIS(gtk_plot_axis_new(GTK_PLOT_AXIS_Z));
- gtk_object_ref (GTK_OBJECT (plot->zy));
- gtk_object_sink (GTK_OBJECT (plot->zy));
+ g_object_ref (plot->zy);
+ g_object_ref_sink (plot->zy);
+ g_object_unref (plot->zy);
plot->xy->major_mask = plot->ax->major_mask;
plot->xy->minor_mask = plot->ax->minor_mask;
@@ -1043,29 +1045,26 @@ gtk_plot3d_init (GtkPlot3D *plot)
plot->zx->title_visible = plot->az->title_visible;
plot->zy->title_visible = plot->az->title_visible;
- plot->frame.color = gtk_widget_get_style(widget)->black;
+ plot->frame.color = black;
plot->frame.line_width = 1;
plot->frame.line_style = GTK_PLOT_LINE_SOLID;
plot->corner_visible = FALSE;
plot->corner.line_style = GTK_PLOT_LINE_SOLID;
plot->corner.line_width = 0;
- plot->corner.color = gtk_widget_get_style(widget)->black;
+ plot->corner.color = black;
plot->ax->direction = plot->e1;
plot->ay->direction = plot->e2;
plot->az->direction = plot->e3;
- gdk_color_parse("gray95", &color);
- gdk_color_alloc(gtk_widget_get_colormap(widget), &color);
+ gdk_rgba_parse(&color, "gray95");
plot->color_xy = color;
- gdk_color_parse("gray80", &color);
- gdk_color_alloc(gtk_widget_get_colormap(widget), &color);
+ gdk_rgba_parse(&color, "gray80");
plot->color_yz = color;
- gdk_color_parse("gray65", &color);
- gdk_color_alloc(gtk_widget_get_colormap(widget), &color);
+ gdk_rgba_parse(&color, "gray65");
plot->color_zx = color;
plot->titles_offset = 60;
@@ -1081,26 +1080,26 @@ gtk_plot3d_init (GtkPlot3D *plot)
}
static void
-gtk_plot3d_destroy (GtkObject *object)
+gtk_plot3d_destroy (GtkWidget *object)
{
GtkPlot3D *plot = GTK_PLOT3D(object);
gtk_psfont_unref();
if (plot->xy)
- gtk_object_unref(GTK_OBJECT(plot->xy));
+ g_object_unref(plot->xy);
if (plot->xz)
- gtk_object_unref(GTK_OBJECT(plot->xz));
+ g_object_unref(plot->xz);
if (plot->yx)
- gtk_object_unref(GTK_OBJECT(plot->yx));
+ g_object_unref(plot->yx);
if (plot->yz)
- gtk_object_unref(GTK_OBJECT(plot->yz));
+ g_object_unref(plot->yz);
if (plot->zx)
- gtk_object_unref(GTK_OBJECT(plot->zx));
+ g_object_unref(plot->zx);
if (plot->zy)
- gtk_object_unref(GTK_OBJECT(plot->zy));
+ g_object_unref(plot->zy);
- if ( GTK_OBJECT_CLASS (parent_class)->destroy )
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+ if ( GTK_WIDGET_CLASS (parent_class)->destroy )
+ (* GTK_WIDGET_CLASS (parent_class)->destroy) (object);
}
static void
@@ -1141,13 +1140,13 @@ gtk_plot3d_set_property (GObject *object,
plot->zx_visible = g_value_get_boolean(value);
break;
case PROP_COLOR_XY:
- plot->color_xy = *((GdkColor *)g_value_get_pointer(value));
+ plot->color_xy = *((GdkRGBA *)g_value_get_pointer(value));
break;
case PROP_COLOR_YZ:
- plot->color_yz = *((GdkColor *)g_value_get_pointer(value));
+ plot->color_yz = *((GdkRGBA *)g_value_get_pointer(value));
break;
case PROP_COLOR_ZX:
- plot->color_zx = *((GdkColor *)g_value_get_pointer(value));
+ plot->color_zx = *((GdkRGBA *)g_value_get_pointer(value));
break;
case PROP_FRAME:
plot->frame = *((GtkPlotLine *)g_value_get_pointer(value));
@@ -1734,7 +1733,7 @@ gtk_plot3d_real_paint (GtkWidget *widget)
text = text->next;
}
- GTK_PLOT_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(plot)))->draw_legends(GTK_WIDGET(plot));
+ GTK_PLOT_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(plot)))->draw_legends(GTK_WIDGET(plot));
gtk_plot_pc_grestore(pc);
}
@@ -1748,7 +1747,7 @@ gtk_plot3d_real_paint (GtkWidget *widget)
* Return value:
*/
GtkWidget*
-gtk_plot3d_new (GdkDrawable *drawable)
+gtk_plot3d_new (cairo_surface_t *drawable)
{
GtkWidget *plot;
@@ -1767,7 +1766,7 @@ gtk_plot3d_new (GdkDrawable *drawable)
*
*/
void
-gtk_plot3d_construct(GtkPlot3D *plot, GdkDrawable *drawable)
+gtk_plot3d_construct(GtkPlot3D *plot, cairo_surface_t *drawable)
{
GTK_PLOT(plot)->drawable = drawable;
}
@@ -1783,7 +1782,7 @@ gtk_plot3d_construct(GtkPlot3D *plot, GdkDrawable *drawable)
* Return value:
*/
GtkWidget*
-gtk_plot3d_new_with_size (GdkDrawable *drawable, gdouble width, gdouble height)
+gtk_plot3d_new_with_size (cairo_surface_t *drawable, gdouble width, gdouble height)
{
GtkWidget *plot;
@@ -1804,7 +1803,7 @@ gtk_plot3d_new_with_size (GdkDrawable *drawable, gdouble width, gdouble height)
*
*/
void
-gtk_plot3d_construct_with_size(GtkPlot3D *plot, GdkDrawable *drawable,
+gtk_plot3d_construct_with_size(GtkPlot3D *plot, cairo_surface_t *drawable,
gdouble width, gdouble height)
{
gtk_plot3d_construct(plot, drawable);
@@ -1828,7 +1827,7 @@ gtk_plot3d_draw_plane(GtkPlot3D *plot,
GtkPlotVector v2,
GtkPlotVector v3,
GtkPlotVector v4,
- GdkColor background)
+ GdkRGBA background)
{
GtkWidget *widget;
GtkPlotPC *pc;
@@ -1859,7 +1858,7 @@ gtk_plot3d_draw_plane(GtkPlot3D *plot,
gtk_plot_pc_set_lineattr(pc,
plot->frame.line_width,
- plot->frame.line_style == GTK_PLOT_LINE_SOLID ? GDK_LINE_SOLID :
GDK_LINE_ON_OFF_DASH,
+ plot->frame.line_style == GTK_PLOT_LINE_SOLID ? 0 : 1,
0, 0);
if(plot->frame.line_style != GTK_PLOT_LINE_NONE)
@@ -2105,7 +2104,7 @@ gtk_plot3d_draw_labels(GtkPlot3D *plot,
}
else
{
- g_signal_emit_by_name(GTK_OBJECT(axis), "tick_label",
+ g_signal_emit_by_name(axis, "tick_label",
&tick_value, label, &veto);
if(!veto)
gtk_plot_axis_parse_label(axis, tick_value, axis->label_precision, axis->label_style, label);
@@ -2235,8 +2234,8 @@ gtk_plot3d_autoscale(GtkPlot3D *plot)
plot->zmin = plot->az->ticks.min;
plot->zmax = plot->az->ticks.max;
- g_signal_emit_by_name(GTK_OBJECT(plot), "update", TRUE);
- g_signal_emit_by_name(GTK_OBJECT(plot), "changed");
+ g_signal_emit_by_name(plot, "update", TRUE);
+ g_signal_emit_by_name(plot, "changed");
}
@@ -2256,8 +2255,8 @@ gtk_plot3d_rotate(GtkPlot3D *plot, gdouble angle_x, gdouble angle_y, gdouble ang
gtk_plot3d_rotate_vector(plot, &plot->e2, angle_x, angle_y, angle_z);
gtk_plot3d_rotate_vector(plot, &plot->e3, angle_x, angle_y, angle_z);
- g_signal_emit_by_name(GTK_OBJECT(plot), "update", FALSE);
- g_signal_emit_by_name(GTK_OBJECT(plot), "changed");
+ g_signal_emit_by_name(plot, "update", FALSE);
+ g_signal_emit_by_name(plot, "changed");
}
/**
@@ -2326,7 +2325,7 @@ gtk_plot3d_get_pixel(GtkPlot3D *plot,
gdouble x, gdouble y, gdouble z,
gdouble *px, gdouble *py, gdouble *pz)
{
- GTK_PLOT3D_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(plot)))->get_pixel(GTK_WIDGET(plot), x, y, z, px, py, pz);
+ GTK_PLOT3D_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(plot)))->get_pixel(GTK_WIDGET(plot), x, y, z, px, py, pz);
}
static void
@@ -2404,8 +2403,8 @@ gtk_plot3d_set_xrange(GtkPlot3D *plot, gdouble min, gdouble max)
plot->ax->ticks.max = max;
gtk_plot_axis_ticks_recalc(plot->ax);
- g_signal_emit_by_name(GTK_OBJECT(plot), "update", TRUE);
- g_signal_emit_by_name(GTK_OBJECT(plot), "changed");
+ g_signal_emit_by_name(plot, "update", TRUE);
+ g_signal_emit_by_name(plot, "changed");
}
/**
@@ -2428,8 +2427,8 @@ gtk_plot3d_set_yrange(GtkPlot3D *plot, gdouble min, gdouble max)
plot->ay->ticks.max = max;
gtk_plot_axis_ticks_recalc(plot->ay);
- g_signal_emit_by_name(GTK_OBJECT(plot), "update", TRUE);
- g_signal_emit_by_name(GTK_OBJECT(plot), "changed");
+ g_signal_emit_by_name(plot, "update", TRUE);
+ g_signal_emit_by_name(plot, "changed");
}
/**
* gtk_plot3d_set_zrange:
@@ -2450,8 +2449,8 @@ gtk_plot3d_set_zrange(GtkPlot3D *plot, gdouble min, gdouble max)
plot->az->ticks.max = max;
gtk_plot_axis_ticks_recalc(plot->az);
- g_signal_emit_by_name(GTK_OBJECT(plot), "update", TRUE);
- g_signal_emit_by_name(GTK_OBJECT(plot), "changed");
+ g_signal_emit_by_name(plot, "update", TRUE);
+ g_signal_emit_by_name(plot, "changed");
}
/**
@@ -2478,8 +2477,8 @@ gtk_plot3d_set_xfactor(GtkPlot3D *plot, gdouble xfactor)
plot->ax->direction = plot->e1;
- g_signal_emit_by_name(GTK_OBJECT(plot), "update", FALSE);
- g_signal_emit_by_name(GTK_OBJECT(plot), "changed");
+ g_signal_emit_by_name(plot, "update", FALSE);
+ g_signal_emit_by_name(plot, "changed");
}
/**
@@ -2506,8 +2505,8 @@ gtk_plot3d_set_yfactor(GtkPlot3D *plot, gdouble yfactor)
plot->ay->direction = plot->e1;
- g_signal_emit_by_name(GTK_OBJECT(plot), "update", FALSE);
- g_signal_emit_by_name(GTK_OBJECT(plot), "changed");
+ g_signal_emit_by_name(plot, "update", FALSE);
+ g_signal_emit_by_name(plot, "changed");
}
/**
@@ -2534,8 +2533,8 @@ gtk_plot3d_set_zfactor(GtkPlot3D *plot, gdouble zfactor)
plot->az->direction = plot->e1;
- g_signal_emit_by_name(GTK_OBJECT(plot), "update", FALSE);
- g_signal_emit_by_name(GTK_OBJECT(plot), "changed");
+ g_signal_emit_by_name(plot, "update", FALSE);
+ g_signal_emit_by_name(plot, "changed");
}
/**
@@ -2597,7 +2596,7 @@ gtk_plot3d_get_zfactor(GtkPlot3D *plot)
void
gtk_plot3d_plane_set_color (GtkPlot3D *plot,
GtkPlotPlane plane,
- const GdkColor *color)
+ const GdkRGBA *color)
{
switch(plane){
@@ -2741,7 +2740,7 @@ void
gtk_plot3d_corner_set_attributes (GtkPlot3D *plot,
GtkPlotLineStyle style,
gfloat width,
- const GdkColor *color)
+ const GdkRGBA *color)
{
plot->corner.line_style = style;
plot->corner.line_width = width;
@@ -2761,7 +2760,7 @@ void
gtk_plot3d_corner_get_attributes (GtkPlot3D *plot,
GtkPlotLineStyle *style,
gfloat *width,
- GdkColor *color)
+ GdkRGBA *color)
{
*style = plot->corner.line_style;
*width = plot->corner.line_width;
@@ -2781,7 +2780,7 @@ void
gtk_plot3d_frame_set_attributes (GtkPlot3D *plot,
GtkPlotLineStyle style,
gfloat width,
- const GdkColor *color)
+ const GdkRGBA *color)
{
plot->frame.line_style = style;
plot->frame.line_width = width;
@@ -2801,7 +2800,7 @@ void
gtk_plot3d_frame_get_attributes (GtkPlot3D *plot,
GtkPlotLineStyle *style,
gfloat *width,
- GdkColor *color)
+ GdkRGBA *color)
{
*style = plot->frame.line_style;
*width = plot->frame.line_width;
@@ -3234,7 +3233,7 @@ void
gtk_plot3d_major_zgrid_set_attributes (GtkPlot3D *plot,
GtkPlotLineStyle style,
gfloat width,
- const GdkColor *color)
+ const GdkRGBA *color)
{
plot->az->major_grid.line_style = style;
plot->az->major_grid.line_width = width;
@@ -3254,7 +3253,7 @@ void
gtk_plot3d_minor_zgrid_set_attributes (GtkPlot3D *plot,
GtkPlotLineStyle style,
gfloat width,
- const GdkColor *color)
+ const GdkRGBA *color)
{
plot->az->minor_grid.line_style = style;
plot->az->minor_grid.line_width = width;
@@ -3274,7 +3273,7 @@ void
gtk_plot3d_major_zgrid_get_attributes (GtkPlot3D *plot,
GtkPlotLineStyle *style,
gfloat *width,
- GdkColor *color)
+ GdkRGBA *color)
{
*style = plot->az->major_grid.line_style;
*width = plot->az->major_grid.line_width;
@@ -3294,7 +3293,7 @@ void
gtk_plot3d_minor_zgrid_get_attributes (GtkPlot3D *plot,
GtkPlotLineStyle *style,
gfloat *width,
- GdkColor *color)
+ GdkRGBA *color)
{
*style = plot->az->minor_grid.line_style;
*width = plot->az->minor_grid.line_width;
@@ -3330,8 +3329,8 @@ gtk_plot3d_reset_angles(GtkPlot3D *plot)
plot->e3.y = 0.;
plot->e3.z = -plot->zfactor;
- g_signal_emit_by_name(GTK_OBJECT(plot), "update", FALSE);
- g_signal_emit_by_name(GTK_OBJECT(plot), "changed");
+ g_signal_emit_by_name(plot, "update", FALSE);
+ g_signal_emit_by_name(plot, "changed");
}
/**
@@ -3393,8 +3392,8 @@ gtk_plot3d_rotate_x(GtkPlot3D *plot, gdouble angle)
plot->e3.y *= plot->zfactor;
plot->e3.z *= plot->zfactor;
- g_signal_emit_by_name(GTK_OBJECT(plot), "update", FALSE);
- g_signal_emit_by_name(GTK_OBJECT(plot), "changed");
+ g_signal_emit_by_name(plot, "update", FALSE);
+ g_signal_emit_by_name(plot, "changed");
}
/**
@@ -3456,8 +3455,8 @@ gtk_plot3d_rotate_y(GtkPlot3D *plot, gdouble angle)
plot->e3.y *= plot->zfactor;
plot->e3.z *= plot->zfactor;
- g_signal_emit_by_name(GTK_OBJECT(plot), "update", FALSE);
- g_signal_emit_by_name(GTK_OBJECT(plot), "changed");
+ g_signal_emit_by_name(plot, "update", FALSE);
+ g_signal_emit_by_name(plot, "changed");
}
/**
@@ -3518,8 +3517,8 @@ gtk_plot3d_rotate_z(GtkPlot3D *plot, gdouble angle)
plot->e3.y *= plot->zfactor;
plot->e3.z *= plot->zfactor;
- g_signal_emit_by_name(GTK_OBJECT(plot), "update", FALSE);
- g_signal_emit_by_name(GTK_OBJECT(plot), "changed");
+ g_signal_emit_by_name(plot, "update", FALSE);
+ g_signal_emit_by_name(plot, "changed");
}
/**
diff --git a/gtkextra/gtkplot3d.h b/gtkextra/gtkplot3d.h
index b48079d8..cefacfaf 100644
--- a/gtkextra/gtkplot3d.h
+++ b/gtkextra/gtkplot3d.h
@@ -85,9 +85,9 @@ struct _GtkPlot3D
gboolean yz_visible;
gboolean zx_visible;
- GdkColor color_xy;
- GdkColor color_yz;
- GdkColor color_zx;
+ GdkRGBA color_xy;
+ GdkRGBA color_yz;
+ GdkRGBA color_zx;
GtkPlotLine frame;
GtkPlotLine corner;
@@ -117,13 +117,13 @@ struct _GtkPlot3DClass
/* Plot3D */
GType gtk_plot3d_get_type (void);
-GtkWidget* gtk_plot3d_new (GdkDrawable *drawable);
-GtkWidget* gtk_plot3d_new_with_size (GdkDrawable *drawable,
+GtkWidget* gtk_plot3d_new (cairo_surface_t *drawable);
+GtkWidget* gtk_plot3d_new_with_size (cairo_surface_t *drawable,
gdouble width, gdouble height);
void gtk_plot3d_construct (GtkPlot3D *plot,
- GdkDrawable *drawable);
+ cairo_surface_t *drawable);
void gtk_plot3d_construct_with_size (GtkPlot3D *plot,
- GdkDrawable *drawable,
+ cairo_surface_t *drawable,
gdouble width, gdouble height);
void gtk_plot3d_autoscale (GtkPlot3D *plot);
/* rotations around global axes */
@@ -172,7 +172,7 @@ gdouble gtk_plot3d_get_zfactor (GtkPlot3D *plot);
/* Planes */
void gtk_plot3d_plane_set_color (GtkPlot3D *plot,
GtkPlotPlane plane,
- const GdkColor *color);
+ const GdkRGBA *color);
void gtk_plot3d_plane_set_visible (GtkPlot3D *plot,
GtkPlotPlane plane,
gboolean visible);
@@ -185,19 +185,19 @@ gboolean gtk_plot3d_corner_visible (GtkPlot3D *plot);
void gtk_plot3d_corner_set_attributes(GtkPlot3D *plot,
GtkPlotLineStyle style,
gfloat width,
- const GdkColor *color);
+ const GdkRGBA *color);
void gtk_plot3d_corner_get_attributes(GtkPlot3D *plot,
GtkPlotLineStyle *style,
gfloat *width,
- GdkColor *color);
+ GdkRGBA *color);
void gtk_plot3d_frame_set_attributes (GtkPlot3D *plot,
GtkPlotLineStyle style,
gfloat width,
- const GdkColor *color);
+ const GdkRGBA *color);
void gtk_plot3d_frame_get_attributes (GtkPlot3D *plot,
GtkPlotLineStyle *style,
gfloat *width,
- GdkColor *color);
+ GdkRGBA *color);
/* Axes */
@@ -265,19 +265,19 @@ void gtk_plot3d_minor_grids_visible (GtkPlot3D *plot,
gboolean *z);
void gtk_plot3d_major_zgrid_set_attributes (GtkPlot3D *plot,
GtkPlotLineStyle style,
gfloat width,
- const GdkColor *color);
+ const GdkRGBA *color);
void gtk_plot3d_major_zgrid_get_attributes (GtkPlot3D *plot,
GtkPlotLineStyle *style,
gfloat *width,
- GdkColor *color);
+ GdkRGBA *color);
void gtk_plot3d_minor_zgrid_set_attributes (GtkPlot3D *plot,
GtkPlotLineStyle style,
gfloat width,
- const GdkColor *color);
+ const GdkRGBA *color);
void gtk_plot3d_minor_zgrid_get_attributes (GtkPlot3D *plot,
GtkPlotLineStyle *style,
gfloat *width,
- GdkColor *color);
+ GdkRGBA *color);
diff --git a/gtkextra/gtkplotbar.c b/gtkextra/gtkplotbar.c
index 62a89709..d40de168 100644
--- a/gtkextra/gtkplotbar.c
+++ b/gtkextra/gtkplotbar.c
@@ -175,14 +175,11 @@ gtk_plot_bar_get_property (GObject *object,
static void
gtk_plot_bar_init (GtkPlotBar *dataset)
{
- GdkColor black, white;
- GdkColormap *colormap;
+ GdkRGBA black, white;
GtkPlotArray *dim;
- colormap = gdk_colormap_get_system();
-
- gdk_color_black(colormap, &black);
- gdk_color_white(colormap, &white);
+ gdk_rgba_parse(&black, "black");
+ gdk_rgba_parse(&white, "white");
GTK_PLOT_DATA(dataset)->symbol.symbol_style = GTK_PLOT_SYMBOL_FILLED;
GTK_PLOT_DATA(dataset)->symbol.color = white;
diff --git a/gtkextra/gtkplotbox.c b/gtkextra/gtkplotbox.c
index f16ba627..c64410bd 100644
--- a/gtkextra/gtkplotbox.c
+++ b/gtkextra/gtkplotbox.c
@@ -163,13 +163,10 @@ gtk_plot_box_get_property (GObject *object,
static void
gtk_plot_box_init (GtkPlotBox *dataset)
{
- GdkColor black, white;
- GdkColormap *colormap;
+ GdkRGBA black, white;
- colormap = gdk_colormap_get_system();
-
- gdk_color_black(colormap, &black);
- gdk_color_white(colormap, &white);
+ gdk_rgba_parse(&black, "black");
+ gdk_rgba_parse(&white, "white");
GTK_PLOT_DATA(dataset)->symbol.symbol_style = GTK_PLOT_SYMBOL_FILLED;
GTK_PLOT_DATA(dataset)->symbol.color = white;
diff --git a/gtkextra/gtkplotcairo.c b/gtkextra/gtkplotcairo.c
index 8b7cfd87..63357ec9 100644
--- a/gtkextra/gtkplotcairo.c
+++ b/gtkextra/gtkplotcairo.c
@@ -55,14 +55,14 @@ static void gtk_plot_cairo_clip (GtkPlotPC *pc,
static void gtk_plot_cairo_clip_mask (GtkPlotPC *pc,
gdouble x,
gdouble y,
- const GdkBitmap *mask);
+ cairo_pattern_t *mask);
static void gtk_plot_cairo_set_color (GtkPlotPC *pc,
- const GdkColor *color);
+ const GdkRGBA *color);
static void gtk_plot_cairo_set_lineattr (GtkPlotPC *pc,
- gfloat line_width,
- GdkLineStyle line_style,
- GdkCapStyle cap_style,
- GdkJoinStyle join_style);
+ gdouble line_width,
+ guint line_style,
+ cairo_line_cap_t cap_style,
+ cairo_line_join_t join_style);
static void gtk_plot_cairo_set_dash (GtkPlotPC *pc,
gdouble offset_,
gdouble *values,
@@ -99,8 +99,8 @@ static void gtk_plot_cairo_set_font (GtkPlotPC *pc,
static void gtk_plot_cairo_draw_string (GtkPlotPC *pc,
gint x, gint y,
gint angle,
- const GdkColor *fg,
- const GdkColor *bg,
+ const GdkRGBA *fg,
+ const GdkRGBA *bg,
gboolean transparent,
gint border,
gint border_space,
@@ -111,8 +111,8 @@ static void gtk_plot_cairo_draw_string (GtkPlotPC *pc,
GtkJustification just,
const gchar *text);
static void gtk_plot_cairo_draw_pixmap (GtkPlotPC *pc,
- GdkPixmap *pixmap,
- GdkBitmap *mask,
+ cairo_surface_t *pixmap,
+ cairo_pattern_t *mask,
gint xsrc, gint ysrc,
gint xdest, gint ydest,
gint width, gint height,
@@ -226,10 +226,10 @@ gtk_plot_cairo_class_init (GtkPlotCairoClass *klass)
*
* Return value:
*/
-GtkObject *
+GtkWidget *
gtk_plot_cairo_new (cairo_t *cairo)
{
- GtkObject *object;
+ GtkWidget *object;
object = g_object_new(gtk_plot_cairo_get_type(), NULL);
gtk_plot_cairo_construct(GTK_PLOT_CAIRO(object), cairo, NULL);
@@ -246,14 +246,14 @@ gtk_plot_cairo_new (cairo_t *cairo)
*
* Return value:
*/
-GtkObject *
-gtk_plot_cairo_new_with_drawable (GdkDrawable *drawable)
+GtkWidget *
+gtk_plot_cairo_new_with_drawable (cairo_surface_t *drawable)
{
- GtkObject *object;
+ GtkWidget *object;
cairo_t *cairo = NULL;
object = g_object_new(gtk_plot_cairo_get_type(), NULL);
- if(drawable) cairo = gdk_cairo_create(drawable);
+ if(drawable) cairo = cairo_create(drawable);
gtk_plot_cairo_construct(GTK_PLOT_CAIRO(object), cairo, NULL);
GTK_PLOT_CAIRO(object)->destroy_cairo = TRUE;
@@ -386,7 +386,7 @@ static void
gtk_plot_cairo_clip_mask (GtkPlotPC *pc,
gdouble x,
gdouble y,
- const GdkBitmap *mask)
+ cairo_pattern_t *mask)
{
/* TBD: Currently no support for clip mask */
return;
@@ -394,16 +394,12 @@ gtk_plot_cairo_clip_mask (GtkPlotPC *pc,
static void
gtk_plot_cairo_set_color (GtkPlotPC *pc,
- const GdkColor *color)
+ const GdkRGBA *color)
{
cairo_t *cairo = GTK_PLOT_CAIRO(pc)->cairo; /* Shortcut */
if (!cairo)
return;
- cairo_set_source_rgba(cairo,
- 1.0/65535 * color->red,
- 1.0/65535 * color->green,
- 1.0/65535 * color->blue,
- 1.0); // TBD fix alpha
+ gdk_cairo_set_source_rgba(cairo, color);
}
static void
@@ -434,16 +430,16 @@ gtk_plot_cairo_set_dash (GtkPlotPC *pc,
}
static void gtk_plot_cairo_set_lineattr (GtkPlotPC *pc,
- gfloat line_width,
- GdkLineStyle line_style,
- GdkCapStyle cap_style,
- GdkJoinStyle join_style)
+ gdouble line_width,
+ guint line_style,
+ cairo_line_cap_t cap_style,
+ cairo_line_join_t join_style)
{
cairo_t *cairo = GTK_PLOT_CAIRO(pc)->cairo; /* Shortcut */
if (!cairo)
return;
- if (line_style == GDK_LINE_SOLID)
+ if (line_style == 0)
cairo_set_dash(cairo,
NULL, 0, 0);
@@ -452,10 +448,7 @@ static void gtk_plot_cairo_set_lineattr (GtkPlotPC *pc,
cairo_set_line_width(cairo,
line_width);
- if(cap_style == GDK_CAP_NOT_LAST || cap_style == GDK_CAP_PROJECTING)
- cairo_set_line_cap(cairo, CAIRO_LINE_CAP_SQUARE);
- if(cap_style == GDK_CAP_BUTT) cairo_set_line_cap(cairo, CAIRO_LINE_CAP_BUTT);
- if(cap_style == GDK_CAP_ROUND) cairo_set_line_cap(cairo, CAIRO_LINE_CAP_ROUND);
+ cairo_set_line_cap(cairo, cap_style);
cairo_set_line_join(cairo,
(cairo_line_join_t)join_style);
@@ -653,8 +646,8 @@ static void
gtk_plot_cairo_draw_string (GtkPlotPC *pc,
gint tx, gint ty,
gint angle,
- const GdkColor *fg,
- const GdkColor *bg,
+ const GdkRGBA *fg,
+ const GdkRGBA *bg,
gboolean transparent,
gint border,
gint border_space,
@@ -687,8 +680,8 @@ gtk_plot_cairo_draw_string (GtkPlotPC *pc,
gchar num[4];
PangoRectangle rect;
PangoLayout *layout = NULL;
- GdkColor real_fg = *fg;
- GdkColor real_bg = *bg;
+ GdkRGBA real_fg = *fg;
+ GdkRGBA real_bg = *bg;
gint sign_x = 1, sign_y = 0;
gint old_tx = tx, old_ty = ty;
@@ -1095,8 +1088,8 @@ gtk_plot_cairo_draw_string (GtkPlotPC *pc,
}
static void gtk_plot_cairo_draw_pixmap (GtkPlotPC *pc,
- GdkPixmap *pixmap,
- GdkBitmap *mask,
+ cairo_surface_t *pixmap,
+ cairo_pattern_t *mask,
gint xsrc, gint ysrc,
gint xdest, gint ydest,
gint width, gint height,
@@ -1114,7 +1107,7 @@ static void gtk_plot_cairo_draw_pixmap (GtkPlotPC *pc,
image_surface = cairo_image_surface_create(CAIRO_FORMAT_RGB24, (width-xsrc)*scale_x,
(height-ysrc)*scale_y);
cr = cairo_create(image_surface);
cairo_scale(cr,scale_x,scale_y);
- gdk_cairo_set_source_pixmap(cr,pixmap,xsrc,ysrc);
+ cairo_set_source_surface(cr, pixmap, xsrc, ysrc);
cairo_paint(cr);
cairo_destroy(cr);
@@ -1131,7 +1124,7 @@ static void gtk_plot_cairo_draw_pixmap (GtkPlotPC *pc,
cr = cairo_create(mask_surface);
cairo_set_source_rgb(cr,0,0,0);
cairo_scale(cr,scale_x,scale_y);
- gdk_cairo_set_source_pixmap(cr,pixmap,xsrc,ysrc);
+ cairo_set_source_surface(cr, pixmap, xsrc, ysrc);
cairo_mask_surface(cr,mask_surface,0,0);
cairo_fill(cr);
cairo_destroy(cr);
diff --git a/gtkextra/gtkplotcairo.h b/gtkextra/gtkplotcairo.h
index 505d4034..8cec387b 100644
--- a/gtkextra/gtkplotcairo.h
+++ b/gtkextra/gtkplotcairo.h
@@ -68,8 +68,8 @@ extern "C" {
};
GType gtk_plot_cairo_get_type (void);
- GtkObject *gtk_plot_cairo_new (cairo_t *cairo);
- GtkObject *gtk_plot_cairo_new_with_drawable (GdkDrawable *drawable);
+ GtkWidget *gtk_plot_cairo_new (cairo_t *cairo);
+ GtkWidget *gtk_plot_cairo_new_with_drawable (cairo_surface_t *drawable);
void gtk_plot_cairo_construct(GtkPlotCairo *pc,
cairo_t *cairo,
PangoContext *context);
diff --git a/gtkextra/gtkplotcandle.c b/gtkextra/gtkplotcandle.c
index 406708c2..6e5a0a68 100644
--- a/gtkextra/gtkplotcandle.c
+++ b/gtkextra/gtkplotcandle.c
@@ -47,26 +47,28 @@ gint roundint (gdouble x);
static GtkPlotDataClass *parent_class = NULL;
-GtkType
+GType
gtk_plot_candle_get_type (void)
{
- static GtkType data_type = 0;
+ static GType data_type = 0;
if (!data_type)
{
- GtkTypeInfo data_info =
+ GTypeInfo data_info =
{
- "GtkPlotCandle",
- sizeof (GtkPlotCandle),
sizeof (GtkPlotCandleClass),
- (GtkClassInitFunc) gtk_plot_candle_class_init,
- (GtkObjectInitFunc) gtk_plot_candle_init,
- /* reserved 1*/ NULL,
- /* reserved 2 */ NULL,
- (GtkClassInitFunc) NULL,
+ NULL,
+ NULL,
+ (GClassInitFunc) gtk_plot_candle_class_init,
+ NULL,
+ NULL,
+ sizeof (GtkPlotCandle),
+ 0,
+ (GInstanceInitFunc) gtk_plot_candle_init,
};
- data_type = gtk_type_unique (gtk_plot_data_get_type(), &data_info);
+ data_type = g_type_register_static (gtk_plot_data_get_type (),
+ "GtkPlotCandle", &data_info, 0);
}
return data_type;
}
@@ -76,7 +78,7 @@ gtk_plot_candle_class_init (GtkPlotCandleClass *klass)
{
GtkPlotDataClass *data_class;
- parent_class = gtk_type_class (gtk_plot_data_get_type ());
+ parent_class = g_type_class_peek (gtk_plot_data_get_type ());
data_class = (GtkPlotDataClass *) klass;
@@ -91,14 +93,11 @@ gtk_plot_candle_class_init (GtkPlotCandleClass *klass)
static void
gtk_plot_candle_init (GtkPlotCandle *dataset)
{
- GdkColor black, white;
- GdkColormap *colormap;
+ GdkRGBA black, white;
GtkPlotArray *dim;
- colormap = gdk_colormap_get_system();
-
- gdk_color_black(colormap, &black);
- gdk_color_white(colormap, &white);
+ gdk_rgba_parse(&black, "black");
+ gdk_rgba_parse(&white, "white");
GTK_PLOT_DATA(dataset)->symbol.symbol_style = GTK_PLOT_SYMBOL_FILLED;
GTK_PLOT_DATA(dataset)->symbol.color = white;
@@ -128,7 +127,7 @@ gtk_plot_candle_new (void)
{
GtkWidget *widget;
- widget = gtk_type_new (gtk_plot_candle_get_type ());
+ widget = g_object_new (gtk_plot_candle_get_type (), NULL);
return (widget);
}
@@ -221,19 +220,21 @@ gtk_plot_candle_draw_legend(GtkPlotData *data, gint x, gint y)
{
GtkPlot *plot = NULL;
GtkPlotText legend;
+ GtkAllocation allocation;
GdkRectangle area;
gint lascent, ldescent, lheight, lwidth;
gdouble m;
g_return_if_fail(data->plot != NULL);
g_return_if_fail(GTK_IS_PLOT(data->plot));
- if(!GTK_WIDGET_REALIZED(data->plot)) return;
+ if(!gtk_widget_get_realized(GTK_WIDGET(data->plot))) return;
plot = data->plot;
- area.x = GTK_WIDGET(plot)->allocation.x;
- area.y = GTK_WIDGET(plot)->allocation.y;
- area.width = GTK_WIDGET(plot)->allocation.width;
- area.height = GTK_WIDGET(plot)->allocation.height;
+ gtk_widget_get_allocation(GTK_WIDGET(plot), &allocation);
+ area.x = allocation.x;
+ area.y = allocation.y;
+ area.width = allocation.width;
+ area.height = allocation.height;
m = plot->magnification;
legend = plot->legends_attr;
diff --git a/gtkextra/gtkplotcandle.h b/gtkextra/gtkplotcandle.h
index 2197632c..52739efc 100644
--- a/gtkextra/gtkplotcandle.h
+++ b/gtkextra/gtkplotcandle.h
@@ -26,10 +26,10 @@ extern "C" {
#include "gtkplot.h"
-#define GTK_PLOT_CANDLE(obj) GTK_CHECK_CAST (obj, gtk_plot_candle_get_type (), GtkPlotCandle)
+#define GTK_PLOT_CANDLE(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, gtk_plot_candle_get_type (),
GtkPlotCandle)
#define GTK_TYPE_PLOT_CANDLE (gtk_plot_candle_get_type ())
-#define GTK_PLOT_CANDLE_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_plot_candle_get_type(),
GtkPlotCandleClass)
-#define GTK_IS_PLOT_CANDLE(obj) GTK_CHECK_TYPE (obj, gtk_plot_candle_get_type ())
+#define GTK_PLOT_CANDLE_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, gtk_plot_candle_get_type(),
GtkPlotCandleClass)
+#define GTK_IS_PLOT_CANDLE(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, gtk_plot_candle_get_type ())
typedef struct _GtkPlotCandle GtkPlotCandle;
typedef struct _GtkPlotCandleClass GtkPlotCandleClass;
@@ -45,7 +45,7 @@ struct _GtkPlotCandleClass
};
-GtkType gtk_plot_candle_get_type (void);
+GType gtk_plot_candle_get_type (void);
GtkWidget* gtk_plot_candle_new (void);
#ifdef __cplusplus
diff --git a/gtkextra/gtkplotcanvas.c b/gtkextra/gtkplotcanvas.c
index b957595c..80f1596f 100644
--- a/gtkextra/gtkplotcanvas.c
+++ b/gtkextra/gtkplotcanvas.c
@@ -26,7 +26,6 @@
#include "gtkextra-compat.h"
#include "gtkplotcairo.h"
#include "gtkplotcanvas.h"
-#include "gtkplotgdk.h"
#include "gtkplotps.h"
#include "gtkextra-marshal.h"
@@ -98,10 +97,14 @@ static void gtk_plot_canvas_child_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
-static void gtk_plot_canvas_destroy (GtkObject *object);
+static void gtk_plot_canvas_destroy (GtkWidget *object);
static void gtk_plot_canvas_map (GtkWidget *widget);
-static void gtk_plot_canvas_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
+static void gtk_plot_canvas_get_preferred_width (GtkWidget *widget,
+ gint *min,
+ gint *nat);
+static void gtk_plot_canvas_get_preferred_height (GtkWidget *widget,
+ gint *min,
+ gint *nat);
static gint gtk_plot_canvas_motion (GtkWidget *widget,
GdkEventMotion *event);
static gint gtk_plot_canvas_button_press (GtkWidget *widget,
@@ -123,20 +126,22 @@ static GtkPlotCanvasPos gtk_plot_canvas_child_button_press
static void gtk_plot_canvas_child_button_release(GtkPlotCanvas *canvas,
GtkPlotCanvasChild *child);
/* Drawing functions */
-static gint gtk_plot_canvas_expose (GtkWidget *widget,
- GdkEventExpose *event);
+static gboolean gtk_plot_canvas_draw (GtkWidget *widget,
+ cairo_t *cr);
static void gtk_plot_canvas_create_pixmap (GtkWidget *widget,
gint width, gint height);
static void gtk_plot_canvas_child_draw (GtkPlotCanvas *canvas,
GtkPlotCanvasChild *child);
-static void gtk_plot_canvas_child_draw_selection(GtkPlotCanvas *canvas,
+static void gtk_plot_canvas_child_draw_selection(cairo_t *cr,
+ GtkPlotCanvas *canvas,
GtkPlotCanvasChild *child,
GtkAllocation area);
-static void draw_selection (GtkPlotCanvas *canvas,
+static void draw_selection (cairo_t *cr,
+ GtkPlotCanvas *canvas,
GtkPlotCanvasChild *child,
GtkAllocation area);
static void draw_marker (GtkPlotCanvas *canvas,
- GdkGC *gc, gint x, gint y);
+ cairo_t *cr, gint x, gint y);
static void gtk_plot_canvas_draw_grid (GtkPlotCanvas *canvas);
static void gtk_plot_canvas_child_draw (GtkPlotCanvas *canvas,
@@ -150,7 +155,7 @@ gint roundint (gdouble x);
/* Signals */
extern void
-_gtkextra_signal_emit(GtkObject *object, guint signal_id, ...);
+_gtkextra_signal_emit(GObject *object, guint signal_id, ...);
enum {
SELECT_ITEM,
@@ -163,18 +168,18 @@ enum {
LAST_SIGNAL
};
-typedef gboolean (*GtkPlotCanvasSignal1) (GtkObject *object,
+typedef gboolean (*GtkPlotCanvasSignal1) (GObject *object,
gpointer arg1,
gdouble arg2,
gdouble arg3,
gpointer user_data);
-typedef gboolean (*GtkPlotCanvasSignal2) (GtkObject *object,
+typedef gboolean (*GtkPlotCanvasSignal2) (GObject *object,
gpointer arg1,
gpointer arg2,
gpointer user_data);
-typedef gboolean (*GtkPlotCanvasSignal3) (GtkObject *object,
+typedef gboolean (*GtkPlotCanvasSignal3) (GObject *object,
gdouble arg1,
gdouble arg2,
gdouble arg3,
@@ -212,7 +217,7 @@ gtk_plot_canvas_child_get_type (void)
{
plot_canvas_child_type = g_type_register_static_simple (
- gtk_object_get_type(),
+ gtk_widget_get_type(),
"GtkPlotCanvasChild",
sizeof(GtkPlotCanvasChildClass),
(GClassInitFunc) gtk_plot_canvas_child_class_init,
@@ -492,13 +497,13 @@ gtk_plot_canvas_child_init(GtkPlotCanvasChild *child)
static void
gtk_plot_canvas_class_init (GtkPlotCanvasClass *klass)
{
- GtkObjectClass *object_class;
+ GtkWidgetClass *object_class;
GtkWidgetClass *widget_class;
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
parent_class = g_type_class_ref (gtk_fixed_get_type ());
- object_class = (GtkObjectClass *) klass;
+ object_class = (GtkWidgetClass *) klass;
widget_class = (GtkWidgetClass *) klass;
@@ -644,8 +649,9 @@ gtk_plot_canvas_class_init (GtkPlotCanvasClass *klass)
gobject_class->set_property = gtk_plot_canvas_set_property;
widget_class->map = gtk_plot_canvas_map;
- widget_class->expose_event = gtk_plot_canvas_expose;
- widget_class->size_request = gtk_plot_canvas_size_request;
+ widget_class->draw = gtk_plot_canvas_draw;
+ widget_class->get_preferred_width = gtk_plot_canvas_get_preferred_width;
+ widget_class->get_preferred_height = gtk_plot_canvas_get_preferred_height;
widget_class->focus_in_event = gtk_plot_canvas_focus_in;
widget_class->focus_out_event = gtk_plot_canvas_focus_out;
widget_class->motion_notify_event = gtk_plot_canvas_motion;
@@ -847,7 +853,7 @@ gtk_plot_canvas_set_property (GObject *object,
canvas->grid = *((GtkPlotLine *)g_value_get_pointer(value));
break;
case ARG_CANVAS_COLOR_BG:
- canvas->background = *((GdkColor *)g_value_get_pointer(value));
+ canvas->background = *((GdkRGBA *)g_value_get_pointer(value));
break;
case ARG_CANVAS_TRANSPARENT:
canvas->transparent = g_value_get_boolean(value);
@@ -859,24 +865,23 @@ static void
gtk_plot_canvas_init (GtkPlotCanvas *plot_canvas)
{
GtkWidget *widget;
- GdkColor color;
+ GdkRGBA color, black, white;
widget = GTK_WIDGET(plot_canvas);
gtk_widget_set_can_focus(GTK_WIDGET(widget), TRUE);
- gdk_color_black(gtk_widget_get_colormap(widget),
- >k_widget_get_style(widget)->black);
- gdk_color_white(gtk_widget_get_colormap(widget),
- >k_widget_get_style(widget)->white);
+ gdk_rgba_parse(&black, "black");
+ gdk_rgba_parse(&white, "white");
gtk_widget_set_events (widget, gtk_widget_get_events(widget)|
GRAPH_MASK);
plot_canvas->freeze_count = 0;
- plot_canvas->cursor = gdk_cursor_new(GDK_TOP_LEFT_ARROW);
+ plot_canvas->cursor = gdk_cursor_new_for_display(gdk_display_get_default(),
+ GDK_TOP_LEFT_ARROW);
- plot_canvas->background = gtk_widget_get_style(widget)->white;
+ plot_canvas->background = white;
plot_canvas->transparent = TRUE;
plot_canvas->flags = 0;
@@ -889,8 +894,7 @@ gtk_plot_canvas_init (GtkPlotCanvas *plot_canvas)
plot_canvas->grid.line_style = GTK_PLOT_LINE_SOLID;
plot_canvas->grid.line_width = 0;
- gdk_color_parse("grey90", &color);
- gdk_color_alloc(gdk_colormap_get_system(), &color);
+ gdk_rgba_parse(&color, "grey90");
plot_canvas->grid.color = color;
plot_canvas->drag_x = plot_canvas->drag_y = 0;
@@ -915,21 +919,20 @@ void
gtk_plot_canvas_set_pc(GtkPlotCanvas *canvas, GtkPlotPC *pc)
{
if(canvas->pc)
- g_object_unref(GTK_OBJECT(canvas->pc));
+ g_object_unref(canvas->pc);
if(!pc){
canvas->pc = (GtkPlotPC *)gtk_plot_cairo_new(NULL);
- g_object_ref(GTK_OBJECT(canvas->pc));
- gtk_object_sink(GTK_OBJECT(canvas->pc));
+ g_object_ref (canvas->pc);
+ g_object_ref_sink (canvas->pc);
+ g_object_unref (canvas->pc);
} else {
canvas->pc = pc;
- g_object_ref(GTK_OBJECT(pc));
- gtk_object_sink(GTK_OBJECT(pc));
+ g_object_ref (pc);
+ g_object_ref_sink (pc);
+ g_object_unref (pc);
}
- if(canvas->pc && GTK_IS_PLOT_GDK(canvas->pc)){
- GTK_PLOT_GDK(canvas->pc)->drawable = canvas->pixmap;
- }
gtk_plot_pc_set_viewport(canvas->pc, canvas->pixmap_width, canvas->pixmap_height);
}
@@ -977,7 +980,7 @@ gtk_plot_canvas_construct(GtkPlotCanvas *canvas,
canvas->pixmap_height = roundint(height * m);
gtk_plot_canvas_set_magnification(canvas, m);
- gtk_fixed_set_has_window (GTK_FIXED(canvas), TRUE);
+ gtk_widget_set_has_window (GTK_WIDGET(canvas), TRUE);
}
/**
@@ -1006,7 +1009,7 @@ gtk_plot_canvas_thaw(GtkPlotCanvas *canvas)
}
static void
-gtk_plot_canvas_destroy (GtkObject *object)
+gtk_plot_canvas_destroy (GtkWidget *object)
{
GtkPlotCanvas *plot_canvas;
GList *list;
@@ -1019,10 +1022,10 @@ gtk_plot_canvas_destroy (GtkObject *object)
list = plot_canvas->childs;
while(list){
- g_signal_emit(GTK_OBJECT(plot_canvas), canvas_signals[DELETE_ITEM], 0,
+ g_signal_emit(plot_canvas, canvas_signals[DELETE_ITEM], 0,
GTK_PLOT_CANVAS_CHILD(list->data), &veto);
- g_object_unref(GTK_OBJECT(list->data));
+ g_object_unref(list->data);
plot_canvas->childs = g_list_remove_link(plot_canvas->childs, list);
g_list_free_1(list);
@@ -1033,22 +1036,22 @@ gtk_plot_canvas_destroy (GtkObject *object)
plot_canvas->childs = NULL;
if( plot_canvas->cursor ){
- gdk_cursor_destroy(plot_canvas->cursor);
+ g_object_unref(plot_canvas->cursor);
plot_canvas->cursor = NULL;
}
if( plot_canvas->pc ){
- g_object_unref(GTK_OBJECT(plot_canvas->pc));
+ g_object_unref(plot_canvas->pc);
plot_canvas->pc = NULL;
}
/* Added by Jacek Sieka jsieka at memphite.se , from Memphite AB */
if( plot_canvas->pixmap ){
- gdk_pixmap_unref(plot_canvas->pixmap);
+ cairo_surface_destroy(plot_canvas->pixmap);
plot_canvas->pixmap = NULL;
}
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (*GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+ if (GTK_WIDGET_CLASS (parent_class)->destroy)
+ (*GTK_WIDGET_CLASS (parent_class)->destroy) (object);
gtk_psfont_unref();
}
@@ -1072,12 +1075,12 @@ gtk_plot_canvas_remove_child(GtkPlotCanvas *canvas, GtkPlotCanvasChild *child)
if(list->data == child){
gboolean veto = TRUE;
- _gtkextra_signal_emit(GTK_OBJECT(canvas), canvas_signals[DELETE_ITEM],
+ _gtkextra_signal_emit (G_OBJECT(canvas), canvas_signals[DELETE_ITEM],
child, &veto);
if(veto){
child->parent = NULL;
- g_object_unref(GTK_OBJECT(child));
+ g_object_unref(child);
canvas->childs = g_list_remove_link(canvas->childs, list);
g_list_free_1(list);
}
@@ -1128,8 +1131,8 @@ gtk_plot_canvas_paint (GtkPlotCanvas *canvas)
if(!GTK_IS_PLOT_PS(canvas->pc) || !canvas->transparent){
if(canvas->transparent){
- GdkColor white;
- gdk_color_white(gtk_widget_get_colormap(GTK_WIDGET(canvas)), &white);
+ GdkRGBA white;
+ gdk_rgba_parse(&white, "white");
gtk_plot_pc_set_color(canvas->pc, &white);
} else
gtk_plot_pc_set_color(canvas->pc, &canvas->background);
@@ -1163,29 +1166,13 @@ gtk_plot_canvas_paint (GtkPlotCanvas *canvas)
void
gtk_plot_canvas_refresh(GtkPlotCanvas *canvas)
{
- GList *children = NULL;
- GtkFixed *fixed = GTK_FIXED(canvas);
-
if(!gtk_widget_get_realized(GTK_WIDGET(canvas))) return;
if(!canvas->pixmap) return;
if(canvas->freeze_count > 0) return;
+ gtk_widget_queue_draw(GTK_WIDGET(canvas));
- gdk_draw_drawable(gtk_widget_get_window(GTK_WIDGET(canvas)),
- gtk_widget_get_style(GTK_WIDGET(canvas))->fg_gc[GTK_STATE_NORMAL],
- canvas->pixmap,
- 0, 0,
- 0, 0,
- -1, -1);
-
- children = fixed->children;
- while (children)
- {
- GtkFixedChild *child;
- child = children->data;
- gtk_widget_queue_draw(child->widget);
- children = children->next;
- }
-
+ gtk_container_foreach(GTK_CONTAINER(canvas),
+ (GtkCallback) gtk_widget_queue_draw, NULL);
}
static void
@@ -1253,6 +1240,7 @@ gtk_plot_canvas_motion (GtkWidget *widget, GdkEventMotion *event)
{
GtkPlotCanvas *canvas;
GtkAllocation area;
+ GdkSeat *seat;
gint x, y;
gint new_x = 0, new_y = 0;
gint new_width = 0, new_height = 0;
@@ -1260,7 +1248,10 @@ gtk_plot_canvas_motion (GtkWidget *widget, GdkEventMotion *event)
gint pivot_x, pivot_y;
canvas = GTK_PLOT_CANVAS(widget);
- gtk_widget_get_pointer(widget, &x, &y);
+ seat = gdk_display_get_default_seat(gdk_display_get_default());
+ gdk_window_get_device_position(gtk_widget_get_window(widget),
+ gdk_seat_get_pointer(seat),
+ &x, &y, NULL);
if(canvas->active_item && canvas->active_item->flags == GTK_PLOT_CANVAS_FROZEN) return TRUE;
@@ -1320,9 +1311,10 @@ gtk_plot_canvas_motion (GtkWidget *widget, GdkEventMotion *event)
cursor = GDK_TOP_LEFT_ARROW;
}
- if(cursor != canvas->cursor->type){
- gdk_cursor_destroy(canvas->cursor);
- canvas->cursor = gdk_cursor_new(cursor);
+ if(cursor != gdk_cursor_get_cursor_type(canvas->cursor)){
+ g_object_unref(canvas->cursor);
+ canvas->cursor
+ = gdk_cursor_new_for_display(gdk_display_get_default(), cursor);
gdk_window_set_cursor(gtk_widget_get_window(widget), canvas->cursor);
}
@@ -1334,15 +1326,15 @@ gtk_plot_canvas_motion (GtkWidget *widget, GdkEventMotion *event)
if(canvas->active_item && canvas->active_item->flags & GTK_PLOT_CANVAS_CAN_MOVE){
gint dx, dy;
- gtk_plot_canvas_child_draw_selection(canvas, canvas->active_item, canvas->drag_area);
+ gtk_widget_queue_draw(GTK_WIDGET(canvas));
canvas->pointer_x = x;
canvas->pointer_y = y;
dx = x - canvas->drag_x;
dy = y - canvas->drag_y;
area.x = canvas->active_item->drag_area.x + dx;
area.y = canvas->active_item->drag_area.y + dy;
- gtk_plot_canvas_child_draw_selection(canvas, canvas->active_item, area);
canvas->drag_area = area;
+ gtk_widget_queue_draw(GTK_WIDGET(canvas));
}
break;
case GTK_PLOT_CANVAS_ACTION_RESIZE:
@@ -1358,8 +1350,10 @@ gtk_plot_canvas_motion (GtkWidget *widget, GdkEventMotion *event)
new_y = MIN(y, pivot_y);
new_height = abs(y - pivot_y);
}
- gdk_cursor_destroy(canvas->cursor);
- canvas->cursor = gdk_cursor_new(cursor);
+ g_object_unref(canvas->cursor);
+ canvas->cursor
+ = gdk_cursor_new_for_display(gdk_display_get_default(),
+ cursor);
gdk_window_set_cursor(gtk_widget_get_window(widget), canvas->cursor);
break;
case GTK_PLOT_CANVAS_BOTTOM_LEFT:
@@ -1391,7 +1385,7 @@ gtk_plot_canvas_motion (GtkWidget *widget, GdkEventMotion *event)
if(canvas->active_item && new_width >= canvas->active_item->min_width &&
new_height >= canvas->active_item->min_height){
- gtk_plot_canvas_child_draw_selection(canvas, canvas->active_item, canvas->drag_area);
+ gtk_widget_queue_draw(GTK_WIDGET(canvas));
canvas->pointer_x = x;
canvas->pointer_y = y;
if(canvas->active_item->flags & GTK_PLOT_CANVAS_CAN_MOVE || canvas->active_item->flags &
GTK_PLOT_CANVAS_CAN_RESIZE){
@@ -1402,14 +1396,14 @@ gtk_plot_canvas_motion (GtkWidget *widget, GdkEventMotion *event)
area.width = new_width;
area.height = new_height;
}
- gtk_plot_canvas_child_draw_selection(canvas, canvas->active_item, area);
canvas->drag_area = area;
+ gtk_widget_queue_draw(GTK_WIDGET(canvas));
}
break;
case GTK_PLOT_CANVAS_ACTION_SELECTION:
- draw_selection(canvas, NULL, canvas->drag_area);
+ gtk_widget_queue_draw(GTK_WIDGET(canvas));
canvas->pointer_x = x;
canvas->pointer_y = y;
area.x = MIN(canvas->pointer_x, canvas->drag_x);
@@ -1417,7 +1411,7 @@ gtk_plot_canvas_motion (GtkWidget *widget, GdkEventMotion *event)
area.width = abs(x - canvas->drag_x);
area.height = abs(y - canvas->drag_y);
canvas->drag_area = area;
- draw_selection(canvas, NULL, canvas->drag_area);
+ gtk_widget_queue_draw(GTK_WIDGET(canvas));
break;
case GTK_PLOT_CANVAS_ACTION_INACTIVE:
default:
@@ -1451,13 +1445,18 @@ gtk_plot_canvas_button_press(GtkWidget *widget, GdkEventButton *event)
GtkPlotCanvas *canvas = NULL;
GtkPlotCanvasChild *active_item = NULL;
GList *childs = NULL;
+ GdkWindow *window;
+ GdkDevice *pointer;
GdkModifierType mods;
gint x = 0, y = 0;
gboolean veto;
gboolean new_item = FALSE;
GtkPlotCanvasPos pos = GTK_PLOT_CANVAS_OUT;
- gdk_window_get_pointer(gtk_widget_get_window(widget), NULL, NULL, &mods);
+ window = gtk_widget_get_window(widget);
+ pointer = gdk_seat_get_pointer(gdk_display_get_default_seat
+ (gdk_display_get_default()));
+ gdk_window_get_device_position(window, pointer, NULL, NULL, &mods);
if(!(mods & GDK_BUTTON1_MASK)) return FALSE;
canvas = GTK_PLOT_CANVAS(widget);
@@ -1471,7 +1470,7 @@ gtk_plot_canvas_button_press(GtkWidget *widget, GdkEventButton *event)
if(!gtk_widget_has_focus(widget)) gtk_widget_grab_focus(widget);
- gtk_widget_get_pointer(widget, &x, &y);
+ gdk_window_get_device_position(window, pointer, &x, &y, NULL);
/**********************************************************************/
@@ -1481,7 +1480,7 @@ gtk_plot_canvas_button_press(GtkWidget *widget, GdkEventButton *event)
{
GtkPlotCanvasChild *child = GTK_PLOT_CANVAS_CHILD(childs->data);
- pos = GTK_PLOT_CANVAS_CHILD_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(child)))->button_press(canvas,
child, x, y);
+ pos = GTK_PLOT_CANVAS_CHILD_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(child)))->button_press(canvas,
child, x, y);
if(pos != GTK_PLOT_CANVAS_OUT && child->state == GTK_STATE_SELECTED){
active_item = child;
break;
@@ -1497,7 +1496,7 @@ gtk_plot_canvas_button_press(GtkWidget *widget, GdkEventButton *event)
veto = TRUE;
if(active_item && active_item->state == GTK_STATE_SELECTED)
- _gtkextra_signal_emit(GTK_OBJECT(canvas), canvas_signals[SELECT_ITEM],
+ _gtkextra_signal_emit(G_OBJECT(canvas), canvas_signals[SELECT_ITEM],
event, active_item, &veto);
if(new_item){
@@ -1516,7 +1515,7 @@ gtk_plot_canvas_button_press(GtkWidget *widget, GdkEventButton *event)
canvas->pointer_x = x;
canvas->pointer_y = y;
- gtk_plot_canvas_child_draw_selection(canvas, active_item, active_item->drag_area);
+ gtk_widget_queue_draw(GTK_WIDGET(canvas));
if(active_item->mode == GTK_PLOT_CANVAS_SELECT_CLICK_2)
return TRUE;
@@ -1560,7 +1559,7 @@ gtk_plot_canvas_button_press(GtkWidget *widget, GdkEventButton *event)
if(GTK_PLOT_CANVAS_CAN_SELECT(canvas)){
veto = TRUE;
- _gtkextra_signal_emit(GTK_OBJECT(canvas), canvas_signals[SELECT_ITEM],
+ _gtkextra_signal_emit(G_OBJECT(canvas), canvas_signals[SELECT_ITEM],
event, NULL, &veto);
if(veto){
canvas->active_item = NULL;
@@ -1582,7 +1581,7 @@ gtk_plot_canvas_button_press(GtkWidget *widget, GdkEventButton *event)
GDK_BUTTON_RELEASE_MASK,
NULL, NULL, event->time);
*/
- draw_selection(canvas, NULL, canvas->drag_area);
+ gtk_widget_queue_draw(GTK_WIDGET(canvas));
}
}
@@ -1641,8 +1640,9 @@ gtk_plot_canvas_button_release(GtkWidget *widget, GdkEventButton *event)
*/
if(gtk_widget_get_mapped(widget)){
- gdk_cursor_destroy(canvas->cursor);
- canvas->cursor = gdk_cursor_new(GDK_TOP_LEFT_ARROW);
+ g_object_unref(canvas->cursor);
+ canvas->cursor = gdk_cursor_new_for_display(gdk_display_get_default(),
+ GDK_TOP_LEFT_ARROW);
gdk_window_set_cursor(gtk_widget_get_window(widget),
canvas->cursor);
}
@@ -1679,22 +1679,22 @@ gtk_plot_canvas_button_release(GtkWidget *widget, GdkEventButton *event)
y2 = y1 + new_height;
if(canvas->action == GTK_PLOT_CANVAS_ACTION_DRAG){
- _gtkextra_signal_emit(GTK_OBJECT(canvas), canvas_signals[MOVE_ITEM],
+ _gtkextra_signal_emit(G_OBJECT(canvas), canvas_signals[MOVE_ITEM],
child,
x1, y1, &veto);
}
if(canvas->action == GTK_PLOT_CANVAS_ACTION_RESIZE){
- _gtkextra_signal_emit(GTK_OBJECT(canvas),
+ _gtkextra_signal_emit(G_OBJECT(canvas),
canvas_signals[RESIZE_ITEM],
child, new_width, new_height, &veto);
}
if(canvas->action != GTK_PLOT_CANVAS_ACTION_INACTIVE && veto) {
- if(GTK_PLOT_CANVAS_CHILD_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(canvas->active_item)))->button_release)
-
GTK_PLOT_CANVAS_CHILD_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(canvas->active_item)))->button_release(canvas,
canvas->active_item);
+ if(GTK_PLOT_CANVAS_CHILD_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(canvas->active_item)))->button_release)
+
GTK_PLOT_CANVAS_CHILD_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(canvas->active_item)))->button_release(canvas,
canvas->active_item);
- g_signal_emit (GTK_OBJECT(canvas), canvas_signals[CHANGED], 0);
+ g_signal_emit (canvas, canvas_signals[CHANGED], 0);
canvas->pointer_x = canvas->pointer_y = canvas->drag_x = canvas->drag_y = 0;
- gtk_plot_canvas_child_draw_selection(canvas, canvas->active_item, canvas->active_item->drag_area);
+ gtk_widget_queue_draw(GTK_WIDGET(canvas));
canvas->action = GTK_PLOT_CANVAS_ACTION_INACTIVE;
return TRUE;
} else {
@@ -1710,8 +1710,8 @@ gtk_plot_canvas_button_release(GtkWidget *widget, GdkEventButton *event)
&x2, &y2);
new_width = abs(canvas->pointer_x - canvas->drag_x);
new_height = abs(canvas->pointer_y - canvas->drag_y);
- draw_selection(canvas, NULL, canvas->drag_area);
- g_signal_emit(GTK_OBJECT(canvas), canvas_signals[SELECT_REGION], 0,
+ gtk_widget_queue_draw(GTK_WIDGET(canvas));
+ g_signal_emit(canvas, canvas_signals[SELECT_REGION], 0,
x1, y1, x2, y2);
canvas->state = GTK_STATE_NORMAL;
canvas->action = GTK_PLOT_CANVAS_ACTION_INACTIVE;
@@ -1732,7 +1732,7 @@ gtk_plot_canvas_button_release(GtkWidget *widget, GdkEventButton *event)
static gint
gtk_plot_canvas_focus_in(GtkWidget *widget, GdkEventFocus *event)
{
- GTK_WIDGET_SET_FLAGS(widget, GTK_HAS_FOCUS);
+ gtk_widget_set_can_focus(widget, TRUE);
return FALSE;
}
@@ -1740,7 +1740,7 @@ gtk_plot_canvas_focus_in(GtkWidget *widget, GdkEventFocus *event)
static gint
gtk_plot_canvas_focus_out(GtkWidget *widget, GdkEventFocus *event)
{
- GTK_WIDGET_UNSET_FLAGS(widget, GTK_HAS_FOCUS);
+ gtk_widget_set_can_focus(widget, FALSE);
gtk_plot_canvas_unselect(GTK_PLOT_CANVAS(widget));
return FALSE;
}
@@ -1786,7 +1786,7 @@ gtk_plot_canvas_transparent (GtkPlotCanvas *canvas)
*
*/
void
-gtk_plot_canvas_set_background (GtkPlotCanvas *canvas, const GdkColor *bg_color)
+gtk_plot_canvas_set_background (GtkPlotCanvas *canvas, const GdkRGBA *bg_color)
{
g_return_if_fail (canvas != NULL);
@@ -1803,7 +1803,7 @@ gtk_plot_canvas_set_background (GtkPlotCanvas *canvas, const GdkColor *bg_color)
if(gtk_widget_get_realized(GTK_WIDGET(canvas)))
gtk_plot_canvas_paint(canvas);
- g_signal_emit (GTK_OBJECT(canvas), canvas_signals[CHANGED], 0);
+ g_signal_emit (canvas, canvas_signals[CHANGED], 0);
}
/**
@@ -1853,24 +1853,23 @@ gtk_plot_canvas_unselect (GtkPlotCanvas *plot_canvas)
{
if(plot_canvas->state == GTK_STATE_SELECTED){
- if(plot_canvas->active_item)
- gtk_plot_canvas_child_draw_selection(plot_canvas, plot_canvas->active_item, plot_canvas->drag_area);
- else
- draw_selection(plot_canvas, NULL, plot_canvas->drag_area);
+ gtk_widget_queue_draw(GTK_WIDGET(plot_canvas));
}
plot_canvas->action = GTK_PLOT_CANVAS_ACTION_INACTIVE;
plot_canvas->state = GTK_STATE_NORMAL;
if(plot_canvas->active_item){
plot_canvas->active_item->state = GTK_STATE_NORMAL;
- if(GTK_PLOT_CANVAS_CHILD_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(plot_canvas->active_item)))->unselect)
-
GTK_PLOT_CANVAS_CHILD_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(plot_canvas->active_item)))->unselect(plot_canvas,
plot_canvas->active_item);
+ if(GTK_PLOT_CANVAS_CHILD_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(plot_canvas->active_item)))->unselect)
+
GTK_PLOT_CANVAS_CHILD_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(plot_canvas->active_item)))->unselect(plot_canvas,
plot_canvas->active_item);
}
plot_canvas->active_item = NULL;
if(gtk_widget_get_mapped(GTK_WIDGET(plot_canvas))){
- gdk_cursor_destroy(plot_canvas->cursor);
- plot_canvas->cursor = gdk_cursor_new(GDK_TOP_LEFT_ARROW);
+ g_object_unref(plot_canvas->cursor);
+ plot_canvas->cursor
+ = gdk_cursor_new_for_display(gdk_display_get_default(),
+ GDK_TOP_LEFT_ARROW);
gdk_window_set_cursor(gtk_widget_get_window(GTK_WIDGET(plot_canvas)),
plot_canvas->cursor);
}
@@ -1989,33 +1988,43 @@ gtk_plot_canvas_set_size(GtkPlotCanvas *canvas, gint width, gint height)
list = canvas->childs;
while(list){
GtkPlotCanvasChild *child = GTK_PLOT_CANVAS_CHILD(list->data);
- if(GTK_PLOT_CANVAS_CHILD_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(child)))->size_allocate)
- GTK_PLOT_CANVAS_CHILD_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(child)))->size_allocate(canvas, child);
+ if(GTK_PLOT_CANVAS_CHILD_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(child)))->size_allocate)
+ GTK_PLOT_CANVAS_CHILD_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(child)))->size_allocate(canvas, child);
list = list->next;
}
- g_signal_emit (GTK_OBJECT(canvas), canvas_signals[CHANGED], 0);
+ g_signal_emit (canvas, canvas_signals[CHANGED], 0);
}
static void
gtk_plot_canvas_create_pixmap(GtkWidget *widget, gint width, gint height)
{
GtkPlotCanvas *canvas;
+ GdkWindow *window;
gint pixmap_width, pixmap_height;
+ int scale;
canvas = GTK_PLOT_CANVAS(widget);
+ window = gtk_widget_get_window(widget);
+ scale = gdk_window_get_scale_factor(window);
if (!canvas->pixmap){
- canvas->pixmap = gdk_pixmap_new (gtk_widget_get_window(widget),
- width,
- height, -1);
+ canvas->pixmap = gdk_window_create_similar_image_surface(window,
+ CAIRO_FORMAT_RGB24,
+ width,
+ height,
+ scale);
}else{
- gdk_window_get_size(canvas->pixmap, &pixmap_width, &pixmap_height);
+ pixmap_width = cairo_image_surface_get_width(canvas->pixmap);
+ pixmap_height = cairo_image_surface_get_height(canvas->pixmap);
if(width != pixmap_width || height != pixmap_height){
- gdk_pixmap_unref(canvas->pixmap);
- canvas->pixmap = gdk_pixmap_new (gtk_widget_get_window(widget),
- width,
- height, -1);
+ cairo_surface_destroy(canvas->pixmap);
+ canvas->pixmap
+ = gdk_window_create_similar_image_surface(window,
+ CAIRO_FORMAT_RGB24,
+ width,
+ height,
+ scale);
}
}
@@ -2023,17 +2032,14 @@ gtk_plot_canvas_create_pixmap(GtkWidget *widget, gint width, gint height)
gtk_plot_canvas_set_pc(canvas, GTK_PLOT_PC(gtk_plot_cairo_new_with_drawable(canvas->pixmap)));
}
- if(canvas->pc && GTK_IS_PLOT_GDK(canvas->pc)){
- GTK_PLOT_GDK(canvas->pc)->drawable = canvas->pixmap;
- }
gtk_plot_pc_set_viewport(canvas->pc, width, height);
}
-static gint
-gtk_plot_canvas_expose(GtkWidget *widget, GdkEventExpose *event)
+static gboolean
+gtk_plot_canvas_draw (GtkWidget *widget, cairo_t *cr)
{
GtkPlotCanvas *canvas;
- GdkPixmap *pixmap;
+ cairo_surface_t *pixmap;
if(!gtk_widget_is_drawable(widget)) return FALSE;
@@ -2048,16 +2054,30 @@ gtk_plot_canvas_expose(GtkWidget *widget, GdkEventExpose *event)
}
pixmap = canvas->pixmap;
- gdk_draw_pixmap(gtk_widget_get_window(GTK_WIDGET(canvas)),
- gtk_widget_get_style(widget)->fg_gc[GTK_STATE_NORMAL],
- pixmap,
- event->area.x,
- event->area.y,
- event->area.x,
- event->area.y,
- event->area.width, event->area.height);
- GTK_WIDGET_CLASS(parent_class)->expose_event(widget, event);
+ cairo_set_source_surface(cr, pixmap, 0, 0);
+ cairo_paint(cr);
+
+ GTK_WIDGET_CLASS(parent_class)->draw (widget, cr);
+
+ switch(canvas->action){
+ case GTK_PLOT_CANVAS_ACTION_DRAG:
+ case GTK_PLOT_CANVAS_ACTION_RESIZE:
+ if(canvas->active_item)
+ gtk_plot_canvas_child_draw_selection(cr, canvas, canvas->active_item,
+ canvas->drag_area);
+ break;
+ case GTK_PLOT_CANVAS_ACTION_INACTIVE:
+ if(canvas->active_item && canvas->state == GTK_STATE_SELECTED)
+ gtk_plot_canvas_child_draw_selection(cr, canvas, canvas->active_item,
+ canvas->active_item->drag_area);
+ break;
+ case GTK_PLOT_CANVAS_ACTION_SELECTION:
+ draw_selection(cr, canvas, NULL, canvas->drag_area);
+ break;
+ default:
+ break;
+ }
return FALSE;
@@ -2065,19 +2085,30 @@ gtk_plot_canvas_expose(GtkWidget *widget, GdkEventExpose *event)
static void
-gtk_plot_canvas_size_request (GtkWidget *widget, GtkRequisition *requisition)
+gtk_plot_canvas_get_preferred_width (GtkWidget *widget, gint *min, gint *nat)
{
GtkPlotCanvas *canvas;
- canvas = GTK_PLOT_CANVAS(widget);
+ canvas = GTK_PLOT_CANVAS (widget);
- GTK_WIDGET_CLASS(parent_class)->size_request(widget, requisition);
+ GTK_WIDGET_CLASS (parent_class)->get_preferred_width (widget, min, nat);
- gtk_widget_set_size_request(widget,
- MAX(canvas->pixmap_width, requisition->width),
- MAX(canvas->pixmap_height, requisition->height));
+ *min = MAX (canvas->pixmap_width, *min);
+ *nat = MAX (canvas->pixmap_width, *nat);
}
+static void
+gtk_plot_canvas_get_preferred_height (GtkWidget *widget, gint *min, gint *nat)
+{
+ GtkPlotCanvas *canvas;
+
+ canvas = GTK_PLOT_CANVAS (widget);
+
+ GTK_WIDGET_CLASS (parent_class)->get_preferred_width (widget, min, nat);
+
+ *min = MAX (canvas->pixmap_height, *min);
+ *nat = MAX (canvas->pixmap_height, *nat);
+}
/**
* gtk_plot_canvas_set_magnification:
@@ -2098,8 +2129,8 @@ gtk_plot_canvas_set_magnification(GtkPlotCanvas *canvas,
while(list){
GtkPlotCanvasChild *child = GTK_PLOT_CANVAS_CHILD(list->data);
- if(GTK_PLOT_CANVAS_CHILD_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(child)))->set_magnification)
- GTK_PLOT_CANVAS_CHILD_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(child)))->set_magnification(canvas, child,
magnification);
+ if(GTK_PLOT_CANVAS_CHILD_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(child)))->set_magnification)
+ GTK_PLOT_CANVAS_CHILD_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(child)))->set_magnification(canvas, child,
magnification);
list = list->next;
}
@@ -2107,31 +2138,22 @@ gtk_plot_canvas_set_magnification(GtkPlotCanvas *canvas,
gtk_plot_canvas_set_size(canvas,
canvas->width,
canvas->height);
- g_signal_emit (GTK_OBJECT(canvas), canvas_signals[CHANGED], 0);
+ g_signal_emit (canvas, canvas_signals[CHANGED], 0);
}
static void
-gtk_plot_canvas_child_draw_selection(GtkPlotCanvas *canvas, GtkPlotCanvasChild *child, GtkAllocation area)
+gtk_plot_canvas_child_draw_selection(cairo_t *cr, GtkPlotCanvas *canvas, GtkPlotCanvasChild *child,
GtkAllocation area)
{
- if(GTK_PLOT_CANVAS_CHILD_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(child)))->draw_selection)
- GTK_PLOT_CANVAS_CHILD_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(child)))->draw_selection(canvas, child,
area);
+ if(GTK_PLOT_CANVAS_CHILD_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(child)))->draw_selection)
+ GTK_PLOT_CANVAS_CHILD_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(child)))->draw_selection(cr, canvas, child,
area);
}
static void
-draw_selection(GtkPlotCanvas *canvas, GtkPlotCanvasChild *child, GtkAllocation area)
+draw_selection(cairo_t *cr, GtkPlotCanvas *canvas, GtkPlotCanvasChild *child, GtkAllocation area)
{
- GdkGC *xor_gc = NULL;
- GdkGCValues values;
-
- gdk_gc_get_values(gtk_widget_get_style(GTK_WIDGET(canvas))->fg_gc[0], &values);
- values.function = GDK_INVERT;
- values.foreground = gtk_widget_get_style(GTK_WIDGET(canvas))->white;
- values.subwindow_mode = GDK_INCLUDE_INFERIORS;
- xor_gc = gdk_gc_new_with_values(gtk_widget_get_window(GTK_WIDGET(canvas)),
- &values,
- GDK_GC_FOREGROUND |
- GDK_GC_FUNCTION |
- GDK_GC_SUBWINDOW);
+ const double dashes[] = { 5., 5. };
+
+ cairo_set_source_rgb(cr, 0, 0, 0);
if(canvas->active_item){
if(canvas->active_item->selection == GTK_PLOT_CANVAS_SELECT_TARGET){
@@ -2139,73 +2161,57 @@ draw_selection(GtkPlotCanvas *canvas, GtkPlotCanvasChild *child, GtkAllocation a
area.y += area.height / 2 - 10;
area.width = 20;
area.height = 20;
- gdk_draw_rectangle (gtk_widget_get_window(GTK_WIDGET(canvas)),
- xor_gc,
- FALSE,
- area.x, area.y,
- area.width, area.height);
-
- gdk_draw_line(gtk_widget_get_window(GTK_WIDGET(canvas)), xor_gc,
- area.x + 1, area.y + area.height/2,
- area.x + 6, area.y + area.height/2);
- gdk_draw_line(gtk_widget_get_window(GTK_WIDGET(canvas)), xor_gc,
- area.x + area.width - 1, area.y + area.height / 2,
- area.x + area.width - 6, area.y + area.height / 2);
- gdk_draw_line(gtk_widget_get_window(GTK_WIDGET(canvas)), xor_gc,
- area.x + area.width/2, area.y + 1,
- area.x + area.width/2, area.y + 6);
- gdk_draw_line(gtk_widget_get_window(GTK_WIDGET(canvas)), xor_gc,
- area.x + area.width/2, area.y + area.height - 1,
- area.x + area.width/2, area.y + area.height - 6);
-
- if(xor_gc) gdk_gc_destroy(xor_gc);
+ cairo_rectangle(cr, area.x, area.y, area.width, area.height);
+ cairo_stroke(cr);
+
+ cairo_set_line_width(cr, 1);
+ cairo_move_to(cr, area.x + 1, area.y + area.height / 2);
+ cairo_line_to(cr, area.x + 6, area.y + area.height / 2);
+ cairo_move_to(cr, area.x + area.width - 1, area.y + area.height / 2);
+ cairo_line_to(cr, area.x + area.width - 6, area.y + area.height / 2);
+ cairo_move_to(cr, area.x + area.width / 2, area.y + 1);
+ cairo_line_to(cr, area.x + area.width / 2, area.y + 6);
+ cairo_move_to(cr, area.x + area.width / 2, area.y + area.height - 1);
+ cairo_line_to(cr, area.x + area.width / 2, area.y + area.height - 6);
+ cairo_stroke(cr);
return;
}
if(canvas->active_item->selection == GTK_PLOT_CANVAS_SELECT_MARKERS){
- gdk_draw_rectangle (gtk_widget_get_window(GTK_WIDGET(canvas)),
- xor_gc,
- FALSE,
- area.x, area.y,
- area.width, area.height);
- draw_marker(canvas, xor_gc, area.x, area.y);
- draw_marker(canvas, xor_gc, area.x, area.y + area.height);
- draw_marker(canvas, xor_gc, area.x + area.width, area.y);
- draw_marker(canvas, xor_gc, area.x + area.width, area.y + area.height);
+ cairo_rectangle(cr, area.x, area.y, area.width, area.height);
+ cairo_stroke(cr);
+ draw_marker(canvas, cr, area.x, area.y);
+ draw_marker(canvas, cr, area.x, area.y + area.height);
+ draw_marker(canvas, cr, area.x + area.width, area.y);
+ draw_marker(canvas, cr, area.x + area.width, area.y + area.height);
if(area.height > DEFAULT_MARKER_SIZE * 2){
- draw_marker(canvas, xor_gc, area.x, area.y + area.height / 2);
- draw_marker(canvas, xor_gc, area.x + area.width,
+ draw_marker(canvas, cr, area.x, area.y + area.height / 2);
+ draw_marker(canvas, cr, area.x + area.width,
area.y + area.height / 2);
}
if(area.width > DEFAULT_MARKER_SIZE * 2){
- draw_marker(canvas, xor_gc, area.x + area.width / 2, area.y);
- draw_marker(canvas, xor_gc, area.x + area.width / 2,
+ draw_marker(canvas, cr, area.x + area.width / 2, area.y);
+ draw_marker(canvas, cr, area.x + area.width / 2,
area.y + area.height);
}
}
} else {
- gdk_gc_set_line_attributes(xor_gc, 1, 1, 0 ,0 );
-
- gdk_draw_rectangle (gtk_widget_get_window(GTK_WIDGET(canvas)),
- xor_gc,
- FALSE,
- area.x, area.y,
- area.width, area.height);
+ cairo_set_dash(cr, dashes, 2, 0);
+ cairo_set_line_width(cr, 1);
+
+ cairo_rectangle(cr, area.x + 0.5, area.y + 0.5, area.width, area.height);
+ cairo_stroke(cr);
}
- if(xor_gc) gdk_gc_unref(xor_gc);
}
static void
-draw_marker(GtkPlotCanvas *canvas, GdkGC *gc, gint x, gint y)
+draw_marker(GtkPlotCanvas *canvas, cairo_t *cr, gint x, gint y)
{
- GdkDrawable *darea;
-
- darea = gtk_widget_get_window(GTK_WIDGET(canvas));
-
- gdk_draw_rectangle(darea, gc, TRUE,
- x - DEFAULT_MARKER_SIZE / 2, y - DEFAULT_MARKER_SIZE / 2,
- DEFAULT_MARKER_SIZE + 1, DEFAULT_MARKER_SIZE + 1);
+ cairo_rectangle(cr,
+ x - DEFAULT_MARKER_SIZE / 2, y - DEFAULT_MARKER_SIZE / 2,
+ DEFAULT_MARKER_SIZE + 1, DEFAULT_MARKER_SIZE + 1);
+ cairo_fill(cr);
}
/* FIXME:: Is this private or public */
@@ -2275,7 +2281,7 @@ void
gtk_plot_canvas_grid_set_visible(GtkPlotCanvas *canvas, gboolean visible)
{
canvas->show_grid= visible;
- g_signal_emit (GTK_OBJECT(canvas), canvas_signals[CHANGED], 0);
+ g_signal_emit (canvas, canvas_signals[CHANGED], 0);
}
/**
@@ -2289,7 +2295,7 @@ void
gtk_plot_canvas_grid_set_step(GtkPlotCanvas *canvas, gdouble step)
{
canvas->grid_step = step;
- g_signal_emit (GTK_OBJECT(canvas), canvas_signals[CHANGED], 0);
+ g_signal_emit (canvas, canvas_signals[CHANGED], 0);
}
/**
@@ -2305,13 +2311,13 @@ void
gtk_plot_canvas_grid_set_attributes(GtkPlotCanvas *canvas,
GtkPlotLineStyle style,
gint width,
- const GdkColor *color)
+ const GdkRGBA *color)
{
if(color)
canvas->grid.color = *color;
canvas->grid.line_width = width;
canvas->grid.line_style = style;
- g_signal_emit (GTK_OBJECT(canvas), canvas_signals[CHANGED], 0);
+ g_signal_emit (canvas, canvas_signals[CHANGED], 0);
}
/**********************************************************************/
@@ -2339,16 +2345,17 @@ gtk_plot_canvas_put_child(GtkPlotCanvas *canvas,
child->parent = canvas;
canvas->childs = g_list_append(canvas->childs, child);
- g_object_ref(GTK_OBJECT(child));
- gtk_object_sink(GTK_OBJECT(child));
+ g_object_ref(child);
+ g_object_ref_sink(child);
+ g_object_unref(child);
- if(GTK_PLOT_CANVAS_CHILD_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(child)))->size_allocate)
- GTK_PLOT_CANVAS_CHILD_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(child)))->size_allocate(canvas, child);
+ if(GTK_PLOT_CANVAS_CHILD_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(child)))->size_allocate)
+ GTK_PLOT_CANVAS_CHILD_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(child)))->size_allocate(canvas, child);
if(gtk_widget_get_realized(GTK_WIDGET(canvas)) &&
gtk_widget_get_visible(GTK_WIDGET(canvas)))
gtk_plot_canvas_child_draw(canvas, child);
- g_signal_emit (GTK_OBJECT(canvas), canvas_signals[CHANGED], 0);
- g_signal_emit(GTK_OBJECT(canvas), canvas_signals[ADD_ITEM], 0, child);
+ g_signal_emit (canvas, canvas_signals[CHANGED], 0);
+ g_signal_emit (canvas, canvas_signals[ADD_ITEM], 0, child);
}
/**
@@ -2370,12 +2377,12 @@ gtk_plot_canvas_child_move(GtkPlotCanvas *canvas,
child->rx1 = x1;
child->ry1 = y1;
- if(GTK_PLOT_CANVAS_CHILD_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(child)))->move)
- GTK_PLOT_CANVAS_CHILD_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(child)))->move(canvas, child, x1, y1);
- GTK_PLOT_CANVAS_CHILD_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(child)))->size_allocate(canvas, child);
+ if(GTK_PLOT_CANVAS_CHILD_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(child)))->move)
+ GTK_PLOT_CANVAS_CHILD_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(child)))->move(canvas, child, x1, y1);
+ GTK_PLOT_CANVAS_CHILD_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(child)))->size_allocate(canvas, child);
gtk_plot_canvas_paint(canvas);
gtk_plot_canvas_refresh(canvas);
- g_signal_emit (GTK_OBJECT(canvas), canvas_signals[CHANGED], 0);
+ g_signal_emit (canvas, canvas_signals[CHANGED], 0);
}
/**
@@ -2399,12 +2406,12 @@ gtk_plot_canvas_child_move_resize(GtkPlotCanvas *canvas,
child->rx2 = x2;
child->ry2 = y2;
- if(GTK_PLOT_CANVAS_CHILD_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(child)))->move_resize)
- GTK_PLOT_CANVAS_CHILD_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(child)))->move_resize(canvas, child, x1, y1,
x2, y2);
- GTK_PLOT_CANVAS_CHILD_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(child)))->size_allocate(canvas, child);
+ if(GTK_PLOT_CANVAS_CHILD_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(child)))->move_resize)
+ GTK_PLOT_CANVAS_CHILD_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(child)))->move_resize(canvas, child, x1, y1,
x2, y2);
+ GTK_PLOT_CANVAS_CHILD_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(child)))->size_allocate(canvas, child);
gtk_plot_canvas_paint(canvas);
gtk_plot_canvas_refresh(canvas);
- g_signal_emit (GTK_OBJECT(canvas), canvas_signals[CHANGED], 0);
+ g_signal_emit (canvas, canvas_signals[CHANGED], 0);
}
static void
@@ -2465,7 +2472,7 @@ gtk_plot_canvas_child_draw(GtkPlotCanvas *canvas,
gtk_plot_pc_gsave(canvas->pc);
- GTK_PLOT_CANVAS_CHILD_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(child)))->draw(canvas, child);
+ GTK_PLOT_CANVAS_CHILD_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(child)))->draw(canvas, child);
gtk_plot_pc_grestore(canvas->pc);
}
@@ -2494,26 +2501,26 @@ gtk_plot_canvas_set_line_attributes(GtkPlotCanvas *canvas, GtkPlotLine line)
break;
case GTK_PLOT_LINE_DOTTED:
gtk_plot_pc_set_lineattr(canvas->pc, line.line_width,
- GDK_LINE_ON_OFF_DASH, 0, 0);
+ 1, 0, 0);
gtk_plot_pc_set_dash(canvas->pc, 0, dot, 2);
break;
case GTK_PLOT_LINE_DASHED:
gtk_plot_pc_set_lineattr(canvas->pc, line.line_width,
- GDK_LINE_ON_OFF_DASH, 0, 0);
+ 1, 0, 0);
gtk_plot_pc_set_dash(canvas->pc, 0, dash, 2);
case GTK_PLOT_LINE_DOT_DASH:
gtk_plot_pc_set_lineattr(canvas->pc, line.line_width,
- GDK_LINE_ON_OFF_DASH, 0, 0);
+ 1, 0, 0);
gtk_plot_pc_set_dash(canvas->pc, 0, dot_dash, 4);
break;
case GTK_PLOT_LINE_DOT_DOT_DASH:
gtk_plot_pc_set_lineattr(canvas->pc, line.line_width,
- GDK_LINE_ON_OFF_DASH, 0, 0);
+ 1, 0, 0);
gtk_plot_pc_set_dash(canvas->pc, 0, dot_dot_dash, 6);
break;
case GTK_PLOT_LINE_DOT_DASH_DASH:
gtk_plot_pc_set_lineattr(canvas->pc, line.line_width,
- GDK_LINE_ON_OFF_DASH, 0, 0);
+ 1, 0, 0);
gtk_plot_pc_set_dash(canvas->pc, 0, dot_dash_dash, 6);
break;
case GTK_PLOT_LINE_NONE:
diff --git a/gtkextra/gtkplotcanvas.h b/gtkextra/gtkplotcanvas.h
index 8e0c1b97..b3b186b4 100644
--- a/gtkextra/gtkplotcanvas.h
+++ b/gtkextra/gtkplotcanvas.h
@@ -117,7 +117,7 @@ typedef struct _GtkPlotCanvasChildClass GtkPlotCanvasChildClass;
*/
struct _GtkPlotCanvasChild
{
- GtkObject object;
+ GtkWidget object;
GtkPlotCanvas *parent;
@@ -136,10 +136,10 @@ struct _GtkPlotCanvasChild
struct _GtkPlotCanvasChildClass
{
- GtkObjectClass parent_class;
+ GtkWidgetClass parent_class;
void (*draw) (GtkPlotCanvas *canvas, GtkPlotCanvasChild *child);
- void (*draw_selection) (GtkPlotCanvas *canvas, GtkPlotCanvasChild *child, GtkAllocation allocation);
+ void (*draw_selection) (cairo_t *cr, GtkPlotCanvas *canvas, GtkPlotCanvasChild *child, GtkAllocation
allocation);
void (*size_allocate) (GtkPlotCanvas *canvas, GtkPlotCanvasChild *child);
void (*move) (GtkPlotCanvas *canvas, GtkPlotCanvasChild *child,
gdouble x, gdouble y);
@@ -180,9 +180,9 @@ struct _GtkPlotCanvas
GtkPlotCanvasAction action;
- GdkPixmap *pixmap;
+ cairo_surface_t *pixmap;
- GdkColor background;
+ GdkRGBA background;
gboolean transparent;
gdouble active_x, active_y;
@@ -250,7 +250,7 @@ void gtk_plot_canvas_grid_set_step (GtkPlotCanvas *canvas,
void gtk_plot_canvas_grid_set_attributes(GtkPlotCanvas *canvas,
GtkPlotLineStyle style,
gint width,
- const GdkColor *color);
+ const GdkRGBA *color);
void gtk_plot_canvas_cancel_action (GtkPlotCanvas *plot_canvas);
void gtk_plot_canvas_unselect (GtkPlotCanvas *plot_canvas);
@@ -264,7 +264,7 @@ void gtk_plot_canvas_set_transparent (GtkPlotCanvas *canvas,
gboolean transparent);
gboolean gtk_plot_canvas_transparent (GtkPlotCanvas *canvas);
void gtk_plot_canvas_set_background (GtkPlotCanvas *canvas,
- const GdkColor *bg_color);
+ const GdkRGBA *bg_color);
void gtk_plot_canvas_get_pixel (GtkPlotCanvas *canvas,
gdouble px, gdouble py,
gint *x, gint *y);
diff --git a/gtkextra/gtkplotcanvasellipse.c b/gtkextra/gtkplotcanvasellipse.c
index e08d7c60..4dbee33a 100644
--- a/gtkextra/gtkplotcanvasellipse.c
+++ b/gtkextra/gtkplotcanvasellipse.c
@@ -26,7 +26,6 @@
#include "gtkplot.h"
#include "gtkplotcanvas.h"
#include "gtkplotcanvasellipse.h"
-#include "gtkplotgdk.h"
#include "gtkplotps.h"
/**
@@ -51,7 +50,8 @@ static void gtk_plot_canvas_ellipse_init (GtkPlotCanvasEllipse *ellipse);
static void gtk_plot_canvas_ellipse_class_init (GtkPlotCanvasChildClass *klass);
static void gtk_plot_canvas_ellipse_draw (GtkPlotCanvas *canvas,
GtkPlotCanvasChild *child);
-static void gtk_plot_canvas_ellipse_select (GtkPlotCanvas *canvas,
+static void gtk_plot_canvas_ellipse_select (cairo_t *cr,
+ GtkPlotCanvas *canvas,
GtkPlotCanvasChild *child,
GtkAllocation area);
static void gtk_plot_canvas_ellipse_move (GtkPlotCanvas *canvas,
@@ -96,8 +96,8 @@ gtk_plot_canvas_ellipse_get_type (void)
GtkPlotCanvasChild*
gtk_plot_canvas_ellipse_new (GtkPlotLineStyle style,
gfloat width,
- const GdkColor *fg,
- const GdkColor *bg,
+ const GdkRGBA *fg,
+ const GdkRGBA *bg,
gboolean fill)
{
GtkPlotCanvasEllipse *ellipse;
@@ -115,8 +115,8 @@ gtk_plot_canvas_ellipse_new (GtkPlotLineStyle style,
static void
gtk_plot_canvas_ellipse_init (GtkPlotCanvasEllipse *ellipse)
{
- gdk_color_black(gdk_colormap_get_system(), &ellipse->line.color);
- gdk_color_white(gdk_colormap_get_system(), &ellipse->bg);
+ gdk_rgba_parse(&ellipse->line.color, "black");
+ gdk_rgba_parse(&ellipse->bg, "white");
ellipse->line.line_style = GTK_PLOT_LINE_SOLID;
ellipse->line.line_width = 0;
@@ -215,7 +215,7 @@ gtk_plot_canvas_ellipse_set_property (GObject *object,
ellipse->filled = g_value_get_boolean(value);
break;
case ARG_BG:
- ellipse->bg = *((GdkColor *)g_value_get_pointer(value));
+ ellipse->bg = *((GdkRGBA *)g_value_get_pointer(value));
break;
}
}
@@ -245,60 +245,47 @@ gtk_plot_canvas_ellipse_draw (GtkPlotCanvas *canvas,
}
static void
-draw_marker(GtkPlotCanvas *canvas, GdkGC *gc, gint x, gint y)
+draw_marker(GtkPlotCanvas *canvas, cairo_t *cr, gint x, gint y)
{
- GdkDrawable *darea;
-
- darea = gtk_widget_get_window(GTK_WIDGET(canvas));
-
- gdk_draw_rectangle(darea, gc, TRUE,
- x - DEFAULT_MARKER_SIZE / 2, y - DEFAULT_MARKER_SIZE / 2,
- DEFAULT_MARKER_SIZE + 1, DEFAULT_MARKER_SIZE + 1);
+ cairo_rectangle(cr,
+ x - DEFAULT_MARKER_SIZE / 2, y - DEFAULT_MARKER_SIZE / 2,
+ DEFAULT_MARKER_SIZE + 1, DEFAULT_MARKER_SIZE + 1);
+ cairo_fill(cr);
}
static void
-gtk_plot_canvas_ellipse_select(GtkPlotCanvas *canvas, GtkPlotCanvasChild *child, GtkAllocation area)
+gtk_plot_canvas_ellipse_select(cairo_t *cr, GtkPlotCanvas *canvas, GtkPlotCanvasChild *child, GtkAllocation
area)
{
- GdkGC *xor_gc = NULL;
- GdkGCValues values;
-
- gdk_gc_get_values(gtk_widget_get_style(GTK_WIDGET(canvas))->fg_gc[0], &values);
- values.function = GDK_INVERT;
- values.foreground = gtk_widget_get_style(GTK_WIDGET(canvas))->white;
- values.subwindow_mode = GDK_INCLUDE_INFERIORS;
- xor_gc = gdk_gc_new_with_values(gtk_widget_get_window(GTK_WIDGET(canvas)),
- &values,
- GDK_GC_FOREGROUND |
- GDK_GC_FUNCTION |
- GDK_GC_SUBWINDOW);
-
- gdk_draw_rectangle (gtk_widget_get_window(GTK_WIDGET(canvas)),
- xor_gc,
- FALSE,
- area.x, area.y,
- area.width, area.height);
- draw_marker(canvas, xor_gc, area.x, area.y);
- draw_marker(canvas, xor_gc, area.x, area.y + area.height);
- draw_marker(canvas, xor_gc, area.x + area.width, area.y);
- draw_marker(canvas, xor_gc, area.x + area.width, area.y + area.height);
+ const double dashes[] = { 5., 5. };
+
+ cairo_set_source_rgb(cr, 0, 0, 0);
+
+ cairo_rectangle(cr, area.x, area.y, area.width, area.height);
+ cairo_stroke(cr);
+ draw_marker(canvas, cr, area.x, area.y);
+ draw_marker(canvas, cr, area.x, area.y + area.height);
+ draw_marker(canvas, cr, area.x + area.width, area.y);
+ draw_marker(canvas, cr, area.x + area.width, area.y + area.height);
if(area.height > DEFAULT_MARKER_SIZE * 2){
- draw_marker(canvas, xor_gc, area.x, area.y + area.height / 2);
- draw_marker(canvas, xor_gc, area.x + area.width,
+ draw_marker(canvas, cr, area.x, area.y + area.height / 2);
+ draw_marker(canvas, cr, area.x + area.width,
area.y + area.height / 2);
}
if(area.width > DEFAULT_MARKER_SIZE * 2){
- draw_marker(canvas, xor_gc, area.x + area.width / 2, area.y);
- draw_marker(canvas, xor_gc, area.x + area.width / 2,
+ draw_marker(canvas, cr, area.x + area.width / 2, area.y);
+ draw_marker(canvas, cr, area.x + area.width / 2,
area.y + area.height);
}
- gdk_gc_set_line_attributes(xor_gc, 1, 1, 0, 0);
- gdk_draw_arc (gtk_widget_get_window(GTK_WIDGET(canvas)), xor_gc,
- FALSE,
- roundint(area.x), roundint(area.y),
- roundint(area.width), roundint(area.height), 0, 25000);
-
- if(xor_gc) gdk_gc_unref(xor_gc);
+ cairo_set_line_width(cr, 1);
+ cairo_set_dash(cr, dashes, 2, 0);
+ cairo_save(cr);
+ cairo_translate(cr, roundint (area.x) + roundint (area.width) / 2,
+ roundint (area.y) + roundint (area.height) / 2);
+ cairo_scale(cr, roundint (area.width) / 2, roundint (area.height) / 2);
+ cairo_arc(cr, 0, 0, 1, 0, 2 * M_PI);
+ cairo_restore(cr);
+ cairo_stroke(cr);
}
@@ -334,8 +321,8 @@ void
gtk_plot_canvas_ellipse_set_attributes (GtkPlotCanvasEllipse *ellipse,
GtkPlotLineStyle style,
gdouble width,
- const GdkColor *fg,
- const GdkColor *bg,
+ const GdkRGBA *fg,
+ const GdkRGBA *bg,
gboolean fill)
{
if(fg) ellipse->line.color = *fg;
diff --git a/gtkextra/gtkplotcanvasellipse.h b/gtkextra/gtkplotcanvasellipse.h
index 21667599..244f6314 100644
--- a/gtkextra/gtkplotcanvasellipse.h
+++ b/gtkextra/gtkplotcanvasellipse.h
@@ -49,7 +49,7 @@ struct _GtkPlotCanvasEllipse
GtkPlotLine line;
gboolean filled;
- GdkColor bg;
+ GdkRGBA bg;
};
struct _GtkPlotCanvasEllipseClass
@@ -61,15 +61,15 @@ GType gtk_plot_canvas_ellipse_get_type (void);
GtkPlotCanvasChild *
gtk_plot_canvas_ellipse_new (GtkPlotLineStyle style,
gfloat width,
- const GdkColor *fg,
- const GdkColor *bg,
+ const GdkRGBA *fg,
+ const GdkRGBA *bg,
gboolean fill);
void gtk_plot_canvas_ellipse_set_attributes(
GtkPlotCanvasEllipse *ellipse,
GtkPlotLineStyle style,
gdouble width,
- const GdkColor *fg,
- const GdkColor *bg,
+ const GdkRGBA *fg,
+ const GdkRGBA *bg,
gboolean fill);
#ifdef __cplusplus
diff --git a/gtkextra/gtkplotcanvasline.c b/gtkextra/gtkplotcanvasline.c
index 39cd495b..8bb38a1d 100644
--- a/gtkextra/gtkplotcanvasline.c
+++ b/gtkextra/gtkplotcanvasline.c
@@ -26,7 +26,6 @@
#include "gtkplot.h"
#include "gtkplotcanvas.h"
#include "gtkplotcanvasline.h"
-#include "gtkplotgdk.h"
#include "gtkplotps.h"
/**
@@ -56,7 +55,8 @@ enum{
static void gtk_plot_canvas_line_init (GtkPlotCanvasLine *line);
static void gtk_plot_canvas_line_class_init (GtkPlotCanvasChildClass *klass);
-static void gtk_plot_canvas_line_draw_selection (GtkPlotCanvas *canvas,
+static void gtk_plot_canvas_line_draw_selection (cairo_t *cr,
+ GtkPlotCanvas *canvas,
GtkPlotCanvasChild *child,
GtkAllocation area);
static void gtk_plot_canvas_line_draw (GtkPlotCanvas *canvas,
@@ -110,7 +110,7 @@ gtk_plot_canvas_line_get_type (void)
GtkPlotCanvasChild*
gtk_plot_canvas_line_new (GtkPlotLineStyle style,
gfloat width,
- const GdkColor *color,
+ const GdkRGBA *color,
GtkPlotCanvasArrow arrow_mask)
{
GtkPlotCanvasLine *line;
@@ -127,7 +127,7 @@ gtk_plot_canvas_line_new (GtkPlotLineStyle style,
static void
gtk_plot_canvas_line_init (GtkPlotCanvasLine *line)
{
- gdk_color_black(gdk_colormap_get_system(), &line->line.color);
+ gdk_rgba_parse(&line->line.color, "black");
line->line.line_style = GTK_PLOT_LINE_SOLID;
line->line.line_width = 0;
@@ -447,88 +447,76 @@ gtk_plot_canvas_line_draw (GtkPlotCanvas *canvas,
}
static void
-gtk_plot_canvas_line_draw_selection (GtkPlotCanvas *canvas,
+gtk_plot_canvas_line_draw_selection (cairo_t *cr, GtkPlotCanvas *canvas,
GtkPlotCanvasChild *child,
GtkAllocation area)
{
GtkPlotCanvasLine *line = GTK_PLOT_CANVAS_LINE(child);
- GdkGC *xor_gc = NULL;
- GdkGCValues values;
gint x1, y1;
gint x2, y2;
gint dx, dy;
+ const double dashes[] = { 5., 5. };
dx = canvas->pointer_x - canvas->drag_x;
dy = canvas->pointer_y - canvas->drag_y;
-
- gdk_gc_get_values(gtk_widget_get_style(GTK_WIDGET(canvas))->fg_gc[0], &values);
- values.function = GDK_INVERT;
- values.foreground = gtk_widget_get_style(GTK_WIDGET(canvas))->white;
- values.subwindow_mode = GDK_INCLUDE_INFERIORS;
- xor_gc = gdk_gc_new_with_values(gtk_widget_get_window(GTK_WIDGET(canvas)),
- &values,
- GDK_GC_FOREGROUND |
- GDK_GC_FUNCTION |
- GDK_GC_SUBWINDOW);
gtk_plot_canvas_get_pixel(canvas, line->x1, line->y1, &x1, &y1);
gtk_plot_canvas_get_pixel(canvas, line->x2, line->y2, &x2, &y2);
+ cairo_set_source_rgb(cr, 0, 0, 0);
+
if(line->pos == GTK_PLOT_CANVAS_TOP_LEFT){
- gdk_draw_rectangle(gtk_widget_get_window(GTK_WIDGET(canvas)),
- xor_gc, TRUE,
- x2 - DEFAULT_MARKER_SIZE / 2,
- y2 - DEFAULT_MARKER_SIZE / 2,
- DEFAULT_MARKER_SIZE + 1, DEFAULT_MARKER_SIZE + 1);
-
- gdk_draw_rectangle(gtk_widget_get_window(GTK_WIDGET(canvas)),
- xor_gc, TRUE,
- x1 + dx - DEFAULT_MARKER_SIZE / 2,
- y1 + dy - DEFAULT_MARKER_SIZE / 2,
- DEFAULT_MARKER_SIZE + 1, DEFAULT_MARKER_SIZE + 1);
-
- gdk_gc_set_line_attributes(xor_gc, 1, 1, 0, 0);
- gdk_draw_line(gtk_widget_get_window(GTK_WIDGET(canvas)),
- xor_gc, x2, y2, x1 + dx, y1 + dy);
+ cairo_rectangle(cr, x2 - DEFAULT_MARKER_SIZE / 2,
+ y2 - DEFAULT_MARKER_SIZE / 2,
+ DEFAULT_MARKER_SIZE + 1, DEFAULT_MARKER_SIZE + 1);
+ cairo_fill(cr);
+
+ cairo_rectangle(cr, x1 + dx - DEFAULT_MARKER_SIZE / 2,
+ y1 + dy - DEFAULT_MARKER_SIZE / 2,
+ DEFAULT_MARKER_SIZE + 1, DEFAULT_MARKER_SIZE + 1);
+ cairo_fill(cr);
+
+ cairo_set_line_width(cr, 1);
+ cairo_set_dash(cr, dashes, 2, 0);
+ cairo_move_to(cr, x2, y2);
+ cairo_line_to(cr, x1 + dx, y1 + dy);
+ cairo_stroke(cr);
} else if(line->pos == GTK_PLOT_CANVAS_BOTTOM_RIGHT){
- gdk_draw_rectangle(gtk_widget_get_window(GTK_WIDGET(canvas)),
- xor_gc, TRUE,
- x1 - DEFAULT_MARKER_SIZE / 2,
- y1 - DEFAULT_MARKER_SIZE / 2,
- DEFAULT_MARKER_SIZE + 1, DEFAULT_MARKER_SIZE + 1);
-
- gdk_draw_rectangle(gtk_widget_get_window(GTK_WIDGET(canvas)),
- xor_gc, TRUE,
- x2 + dx - DEFAULT_MARKER_SIZE / 2,
- y2 + dy - DEFAULT_MARKER_SIZE / 2,
- DEFAULT_MARKER_SIZE + 1, DEFAULT_MARKER_SIZE + 1);
-
- gdk_gc_set_line_attributes(xor_gc, 1, 1, 0, 0);
- gdk_draw_line(gtk_widget_get_window(GTK_WIDGET(canvas)),
- xor_gc, x1, y1, x2 + dx, y2 + dy);
+ cairo_rectangle(cr, x1 - DEFAULT_MARKER_SIZE / 2,
+ y1 - DEFAULT_MARKER_SIZE / 2,
+ DEFAULT_MARKER_SIZE + 1, DEFAULT_MARKER_SIZE + 1);
+ cairo_fill(cr);
+
+ cairo_rectangle(cr, x2 + dx - DEFAULT_MARKER_SIZE / 2,
+ y2 + dy - DEFAULT_MARKER_SIZE / 2,
+ DEFAULT_MARKER_SIZE + 1, DEFAULT_MARKER_SIZE + 1);
+ cairo_fill(cr);
+
+ cairo_set_line_width(cr, 1);
+ cairo_set_dash(cr, dashes, 2, 0);
+ cairo_move_to(cr, x1, y1);
+ cairo_line_to(cr, x2 + dx, y2 + dy);
+ cairo_stroke(cr);
} else {
- gdk_draw_rectangle(gtk_widget_get_window(GTK_WIDGET(canvas)),
- xor_gc, TRUE,
- x1 + dx - DEFAULT_MARKER_SIZE / 2,
- y1 + dy - DEFAULT_MARKER_SIZE / 2,
- DEFAULT_MARKER_SIZE + 1, DEFAULT_MARKER_SIZE + 1);
-
- gdk_draw_rectangle(gtk_widget_get_window(GTK_WIDGET(canvas)),
- xor_gc, TRUE,
- x2 + dx - DEFAULT_MARKER_SIZE / 2,
- y2 + dy - DEFAULT_MARKER_SIZE / 2,
- DEFAULT_MARKER_SIZE + 1, DEFAULT_MARKER_SIZE + 1);
-
- gdk_gc_set_line_attributes(xor_gc, 1, 1, 0, 0);
- gdk_draw_line(gtk_widget_get_window(GTK_WIDGET(canvas)), xor_gc,
- x1 + dx, y1 + dy, x2 + dx, y2 + dy);
+ cairo_rectangle(cr, x1 + dx - DEFAULT_MARKER_SIZE / 2,
+ y1 + dy - DEFAULT_MARKER_SIZE / 2,
+ DEFAULT_MARKER_SIZE + 1, DEFAULT_MARKER_SIZE + 1);
+ cairo_fill(cr);
+
+ cairo_rectangle(cr, x2 + dx - DEFAULT_MARKER_SIZE / 2,
+ y2 + dy - DEFAULT_MARKER_SIZE / 2,
+ DEFAULT_MARKER_SIZE + 1, DEFAULT_MARKER_SIZE + 1);
+ cairo_fill(cr);
+
+ cairo_set_line_width(cr, 1);
+ cairo_set_dash(cr, dashes, 2, 0);
+ cairo_move_to(cr, x1 + dx, y1 + dy);
+ cairo_line_to(cr, x2 + dx, y2 + dy);
+ cairo_stroke(cr);
}
-
-
- if(xor_gc) gdk_gc_unref(xor_gc);
}
static GtkPlotCanvasPos
@@ -615,7 +603,7 @@ gtk_plot_canvas_line_resize (GtkPlotCanvas *canvas,
line->x2 = x2;
line->y2 = y2;
- GTK_PLOT_CANVAS_CHILD_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(child)))->size_allocate(canvas, child);
+ GTK_PLOT_CANVAS_CHILD_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(child)))->size_allocate(canvas, child);
gtk_plot_canvas_paint(canvas);
gtk_plot_canvas_refresh(canvas);
}
@@ -648,7 +636,7 @@ gtk_plot_canvas_line_button_release (GtkPlotCanvas *canvas,
child->rx2 = line->x2;
child->ry2 = line->y2;
- GTK_PLOT_CANVAS_CHILD_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(child)))->size_allocate(canvas, child);
+ GTK_PLOT_CANVAS_CHILD_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(child)))->size_allocate(canvas, child);
gtk_plot_canvas_paint(canvas);
gtk_plot_canvas_refresh(canvas);
}
@@ -666,7 +654,7 @@ void
gtk_plot_canvas_line_set_attributes(GtkPlotCanvasLine *line,
GtkPlotLineStyle style,
gfloat width,
- const GdkColor *color)
+ const GdkRGBA *color)
{
if(color) line->line.color = *color;
line->line.line_width = width;
diff --git a/gtkextra/gtkplotcanvasline.h b/gtkextra/gtkplotcanvasline.h
index 11dca3d8..91b84511 100644
--- a/gtkextra/gtkplotcanvasline.h
+++ b/gtkextra/gtkplotcanvasline.h
@@ -74,13 +74,13 @@ GType gtk_plot_canvas_line_get_type (void);
GtkPlotCanvasChild *
gtk_plot_canvas_line_new (GtkPlotLineStyle style,
gfloat width,
- const GdkColor *color,
+ const GdkRGBA *color,
GtkPlotCanvasArrow arrow_mask);
void gtk_plot_canvas_line_set_attributes
(GtkPlotCanvasLine *line,
GtkPlotLineStyle style,
gfloat width,
- const GdkColor *color);
+ const GdkRGBA *color);
void gtk_plot_canvas_line_set_arrow (GtkPlotCanvasLine *line,
GtkPlotSymbolStyle style,
gfloat width, gfloat length,
diff --git a/gtkextra/gtkplotcanvaspixmap.c b/gtkextra/gtkplotcanvaspixmap.c
index 9d84baa2..a53b1b2c 100644
--- a/gtkextra/gtkplotcanvaspixmap.c
+++ b/gtkextra/gtkplotcanvaspixmap.c
@@ -26,7 +26,6 @@
#include "gtkplot.h"
#include "gtkplotcanvas.h"
#include "gtkplotcanvaspixmap.h"
-#include "gtkplotgdk.h"
#include "gtkplotps.h"
/**
@@ -46,7 +45,7 @@ enum {
static void gtk_plot_canvas_pixmap_init (GtkPlotCanvasPixmap *pixmap);
static void gtk_plot_canvas_pixmap_class_init(GtkPlotCanvasChildClass *klass);
-static void gtk_plot_canvas_pixmap_destroy (GtkObject *object);
+static void gtk_plot_canvas_pixmap_destroy (GtkWidget *object);
static void gtk_plot_canvas_pixmap_draw (GtkPlotCanvas *canvas,
GtkPlotCanvasChild *child);
static void gtk_plot_canvas_pixmap_move (GtkPlotCanvas *canvas,
@@ -96,7 +95,7 @@ gtk_plot_canvas_pixmap_get_type (void)
* Return value:
*/
GtkPlotCanvasChild*
-gtk_plot_canvas_pixmap_new (GdkPixmap *_pixmap, GdkBitmap *mask)
+gtk_plot_canvas_pixmap_new (cairo_surface_t *_pixmap, cairo_pattern_t *mask)
{
GtkPlotCanvasPixmap *pixmap;
@@ -105,8 +104,8 @@ gtk_plot_canvas_pixmap_new (GdkPixmap *_pixmap, GdkBitmap *mask)
pixmap->pixmap = _pixmap;
pixmap->mask = mask;
- if(_pixmap) gdk_pixmap_ref(_pixmap);
- if(mask) gdk_bitmap_ref(mask);
+ if(_pixmap) cairo_surface_reference(_pixmap);
+ if(mask) cairo_pattern_reference(mask);
return GTK_PLOT_CANVAS_CHILD (pixmap);
}
@@ -119,12 +118,12 @@ gtk_plot_canvas_pixmap_init (GtkPlotCanvasPixmap *pixmap)
}
static void
-gtk_plot_canvas_pixmap_destroy(GtkObject *object)
+gtk_plot_canvas_pixmap_destroy(GtkWidget *object)
{
GtkPlotCanvasPixmap *pixmap = GTK_PLOT_CANVAS_PIXMAP(object);
- if(pixmap->pixmap) gdk_pixmap_unref(pixmap->pixmap);
- if(pixmap->mask) gdk_bitmap_unref(pixmap->mask);
+ if(pixmap->pixmap) cairo_surface_destroy(pixmap->pixmap);
+ if(pixmap->mask) cairo_pattern_destroy(pixmap->mask);
pixmap->pixmap = NULL;
pixmap->mask = NULL;
}
@@ -132,7 +131,7 @@ gtk_plot_canvas_pixmap_destroy(GtkObject *object)
static void
gtk_plot_canvas_pixmap_class_init (GtkPlotCanvasChildClass *klass)
{
- GtkObjectClass *object_class = (GtkObjectClass *)klass;
+ GtkWidgetClass *object_class = (GtkWidgetClass *)klass;
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
parent_class = g_type_class_ref (gtk_plot_canvas_child_get_type ());
@@ -188,14 +187,14 @@ gtk_plot_canvas_pixmap_set_property (GObject *object,
switch(prop_id){
case ARG_PIXMAP:
- if(pixmap->pixmap) gdk_pixmap_unref(pixmap->pixmap);
- pixmap->pixmap = (GdkPixmap *)g_value_get_pointer(value);
- if(pixmap->pixmap) gdk_pixmap_ref(pixmap->pixmap);
+ if(pixmap->pixmap) cairo_surface_destroy(pixmap->pixmap);
+ pixmap->pixmap = (cairo_surface_t *)g_value_get_pointer(value);
+ if(pixmap->pixmap) cairo_surface_reference(pixmap->pixmap);
break;
case ARG_MASK:
- if(pixmap->mask) gdk_bitmap_unref(pixmap->mask);
- pixmap->mask = (GdkBitmap *)g_value_get_pointer(value);
- if(pixmap->mask) gdk_bitmap_ref(pixmap->mask);
+ if(pixmap->mask) cairo_pattern_destroy(pixmap->mask);
+ pixmap->mask = (cairo_pattern_t *)g_value_get_pointer(value);
+ if(pixmap->mask) cairo_pattern_reference(pixmap->mask);
break;
}
}
@@ -212,7 +211,8 @@ gtk_plot_canvas_pixmap_draw (GtkPlotCanvas *canvas,
gdouble scale_x, scale_y;
gint width, height;
- gdk_window_get_size(pixmap->pixmap, &width, &height);
+ width = cairo_image_surface_get_width(pixmap->pixmap);
+ height = cairo_image_surface_get_height(pixmap->pixmap);
scale_x = (gdouble)child->allocation.width / (gdouble)width;
scale_y = (gdouble)child->allocation.height / (gdouble)height;
@@ -225,11 +225,10 @@ gtk_plot_canvas_pixmap_draw (GtkPlotCanvas *canvas,
scale_x, scale_y);
} else {
- GdkColormap *colormap = gdk_colormap_get_system();
- GdkColor black, white;
+ GdkRGBA black, white;
- gdk_color_black(colormap, &black);
- gdk_color_white(colormap, &white);
+ gdk_rgba_parse(&black, "black");
+ gdk_rgba_parse(&white, "white");
gtk_plot_pc_set_color(canvas->pc, &white);
gtk_plot_pc_draw_rectangle(canvas->pc, TRUE,
diff --git a/gtkextra/gtkplotcanvaspixmap.h b/gtkextra/gtkplotcanvaspixmap.h
index 4ac93219..8cd305c8 100644
--- a/gtkextra/gtkplotcanvaspixmap.h
+++ b/gtkextra/gtkplotcanvaspixmap.h
@@ -46,8 +46,8 @@ struct _GtkPlotCanvasPixmap
{
GtkPlotCanvasChild parent;
- GdkPixmap *pixmap;
- GdkBitmap *mask;
+ cairo_surface_t *pixmap;
+ cairo_pattern_t *mask;
};
struct _GtkPlotCanvasPixmapClass
@@ -57,7 +57,7 @@ struct _GtkPlotCanvasPixmapClass
GType gtk_plot_canvas_pixmap_get_type (void);
GtkPlotCanvasChild *
- gtk_plot_canvas_pixmap_new(GdkPixmap *_pixmap, GdkBitmap *mask);
+ gtk_plot_canvas_pixmap_new(cairo_surface_t *_pixmap, cairo_pattern_t *mask);
#ifdef __cplusplus
}
diff --git a/gtkextra/gtkplotcanvasplot.c b/gtkextra/gtkplotcanvasplot.c
index 585bea68..0cf6f4c2 100644
--- a/gtkextra/gtkplotcanvasplot.c
+++ b/gtkextra/gtkplotcanvasplot.c
@@ -35,14 +35,13 @@
#include "gtkplotdata.h"
#include "gtkplotcanvas.h"
#include "gtkplotcanvasplot.h"
-#include "gtkplotgdk.h"
#include "gtkplotps.h"
#define DEFAULT_MARKER_SIZE 6
static void gtk_plot_canvas_plot_init (GtkPlotCanvasPlot *plot);
static void gtk_plot_canvas_plot_class_init(GtkPlotCanvasChildClass *klass);
-static void gtk_plot_canvas_plot_destroy (GtkObject *object);
+static void gtk_plot_canvas_plot_destroy (GtkWidget *object);
static void gtk_plot_canvas_plot_draw (GtkPlotCanvas *canvas,
GtkPlotCanvasChild *child);
static void gtk_plot_canvas_plot_move (GtkPlotCanvas *canvas,
@@ -126,7 +125,7 @@ gtk_plot_canvas_plot_init (GtkPlotCanvasPlot *plot)
static void
gtk_plot_canvas_plot_class_init (GtkPlotCanvasChildClass *klass)
{
- GtkObjectClass *object_class = (GtkObjectClass *)klass;
+ GtkWidgetClass *object_class = (GtkWidgetClass *)klass;
parent_class = g_type_class_ref (gtk_plot_canvas_child_get_type ());
@@ -143,13 +142,9 @@ gtk_plot_canvas_plot_class_init (GtkPlotCanvasChildClass *klass)
}
static void
-gtk_plot_canvas_plot_destroy(GtkObject *object)
+gtk_plot_canvas_plot_destroy(GtkWidget *object)
{
- GtkWidget *widget = GTK_WIDGET(GTK_PLOT_CANVAS_PLOT(object)->plot);
- if (widget != NULL) {
- widget->parent = NULL;
- g_object_unref(widget);
- }
+ gtk_widget_destroy(object);
}
static void
@@ -226,7 +221,7 @@ gtk_plot_canvas_plot_resize (GtkPlotCanvas *canvas,
if(!plot) return;
gtk_plot_move_resize(plot, x1, y1, fabs(x2-x1), fabs(y2-y1));
- GTK_PLOT_CANVAS_CHILD_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(child)))->size_allocate(canvas, child);
+ GTK_PLOT_CANVAS_CHILD_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(child)))->size_allocate(canvas, child);
gtk_plot_canvas_paint(canvas);
gtk_plot_canvas_refresh(canvas);
}
@@ -368,7 +363,7 @@ gtk_plot_canvas_plot_button_release (GtkPlotCanvas *canvas,
child->drag_area = canvas->drag_area;
gtk_plot_move_resize(plot,
x1, y1, fabs(x2-x1), fabs(y2-y1));
- GTK_PLOT_CANVAS_CHILD_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(child)))->size_allocate(canvas, child);
+ GTK_PLOT_CANVAS_CHILD_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(child)))->size_allocate(canvas, child);
break;
}
gtk_plot_canvas_paint(canvas);
@@ -402,7 +397,7 @@ gtk_plot_canvas_plot_size_allocate (GtkPlotCanvas *canvas,
allocation.height = canvas->pixmap_height;
gtk_widget_set_allocation(GTK_WIDGET(plot), &allocation);
- if(!GTK_WIDGET(plot)->parent)
+ if(!gtk_widget_get_parent(GTK_WIDGET(plot)))
gtk_widget_set_parent(GTK_WIDGET(plot), GTK_WIDGET(canvas));
gtk_plot_move_resize(plot, child->rx1, child->ry1,
diff --git a/gtkextra/gtkplotcanvasrectangle.c b/gtkextra/gtkplotcanvasrectangle.c
index d5a767c4..1b1deb49 100644
--- a/gtkextra/gtkplotcanvasrectangle.c
+++ b/gtkextra/gtkplotcanvasrectangle.c
@@ -33,7 +33,6 @@
#include "gtkplot.h"
#include "gtkplotcanvas.h"
#include "gtkplotcanvasrectangle.h"
-#include "gtkplotgdk.h"
#include "gtkplotps.h"
#define P_(string) string
@@ -139,7 +138,7 @@ gtk_plot_canvas_rectangle_set_property (GObject *object,
rectangle->shadow_width = g_value_get_int(value);
break;
case ARG_BG:
- rectangle->bg = *((GdkColor *)g_value_get_pointer(value));
+ rectangle->bg = *((GdkRGBA *)g_value_get_pointer(value));
break;
}
}
@@ -147,8 +146,8 @@ gtk_plot_canvas_rectangle_set_property (GObject *object,
GtkPlotCanvasChild*
gtk_plot_canvas_rectangle_new (GtkPlotLineStyle style,
gfloat width,
- const GdkColor *fg,
- const GdkColor *bg,
+ const GdkRGBA *fg,
+ const GdkRGBA *bg,
GtkPlotBorderStyle border,
gboolean fill)
{
@@ -168,8 +167,8 @@ gtk_plot_canvas_rectangle_new (GtkPlotLineStyle style,
static void
gtk_plot_canvas_rectangle_init (GtkPlotCanvasRectangle *rectangle)
{
- gdk_color_black(gdk_colormap_get_system(), &rectangle->line.color);
- gdk_color_white(gdk_colormap_get_system(), &rectangle->bg);
+ gdk_rgba_parse(&rectangle->line.color, "black");
+ gdk_rgba_parse(&rectangle->bg, "white");
rectangle->line.line_style = GTK_PLOT_LINE_SOLID;
rectangle->line.line_width = 0;
@@ -328,8 +327,8 @@ void
gtk_plot_canvas_rectangle_set_attributes(GtkPlotCanvasRectangle *rectangle,
GtkPlotLineStyle style,
gfloat width,
- const GdkColor *fg,
- const GdkColor *bg,
+ const GdkRGBA *fg,
+ const GdkRGBA *bg,
GtkPlotBorderStyle border,
gboolean fill)
{
diff --git a/gtkextra/gtkplotcanvasrectangle.h b/gtkextra/gtkplotcanvasrectangle.h
index b5196e99..63949124 100644
--- a/gtkextra/gtkplotcanvasrectangle.h
+++ b/gtkextra/gtkplotcanvasrectangle.h
@@ -52,7 +52,7 @@ struct _GtkPlotCanvasRectangle
GtkPlotBorderStyle border;
gint shadow_width;
- GdkColor bg;
+ GdkRGBA bg;
};
struct _GtkPlotCanvasRectangleClass
@@ -64,16 +64,16 @@ GType gtk_plot_canvas_rectangle_get_type (void);
GtkPlotCanvasChild *
gtk_plot_canvas_rectangle_new (GtkPlotLineStyle style,
gfloat width,
- const GdkColor *fg,
- const GdkColor *bg,
+ const GdkRGBA *fg,
+ const GdkRGBA *bg,
GtkPlotBorderStyle border,
gboolean fill);
void gtk_plot_canvas_rectangle_set_attributes(
GtkPlotCanvasRectangle *rectangle,
GtkPlotLineStyle style,
gfloat width,
- const GdkColor *fg,
- const GdkColor *bg,
+ const GdkRGBA *fg,
+ const GdkRGBA *bg,
GtkPlotBorderStyle border,
gboolean fill);
diff --git a/gtkextra/gtkplotcanvastext.c b/gtkextra/gtkplotcanvastext.c
index 11ce8529..a5765368 100644
--- a/gtkextra/gtkplotcanvastext.c
+++ b/gtkextra/gtkplotcanvastext.c
@@ -26,7 +26,6 @@
#include "gtkplot.h"
#include "gtkplotcanvas.h"
#include "gtkplotcanvastext.h"
-#include "gtkplotgdk.h"
#include "gtkplotps.h"
/**
@@ -46,7 +45,7 @@ enum {
};
static void gtk_plot_canvas_text_init (GtkPlotCanvasText *text);
-static void gtk_plot_canvas_text_destroy (GtkObject *object);
+static void gtk_plot_canvas_text_destroy (GtkWidget *object);
static void gtk_plot_canvas_text_class_init(GtkPlotCanvasChildClass *klass);
static void gtk_plot_canvas_text_draw (GtkPlotCanvas *canvas,
GtkPlotCanvasChild *child);
@@ -100,7 +99,7 @@ gtk_plot_canvas_text_get_type (void)
*/
GtkPlotCanvasChild*
gtk_plot_canvas_text_new (const gchar *font, gint height, gint angle,
- const GdkColor *fg, const GdkColor *bg,
+ const GdkRGBA *fg, const GdkRGBA *bg,
gboolean transparent,
GtkJustification justification,
const gchar *real_text)
@@ -147,8 +146,8 @@ gtk_plot_canvas_text_init (GtkPlotCanvasText *text)
text_attr = &text->text;
text_attr->angle = 0;
- gdk_color_black(gdk_colormap_get_system(), &text_attr->fg);
- gdk_color_white(gdk_colormap_get_system(), &text_attr->bg);
+ gdk_rgba_parse(&text_attr->fg, "black");
+ gdk_rgba_parse(&text_attr->bg, "white");
text_attr->justification = GTK_JUSTIFY_LEFT;
text_attr->transparent = TRUE;
text_attr->border = 0;
@@ -163,7 +162,7 @@ gtk_plot_canvas_text_init (GtkPlotCanvasText *text)
static void
gtk_plot_canvas_text_class_init (GtkPlotCanvasChildClass *klass)
{
- GtkObjectClass *object_class = (GtkObjectClass *)klass;
+ GtkWidgetClass *object_class = (GtkWidgetClass *)klass;
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
parent_class = g_type_class_ref (gtk_plot_canvas_child_get_type ());
@@ -226,7 +225,7 @@ gtk_plot_canvas_text_set_property (GObject *object,
static void
-gtk_plot_canvas_text_destroy (GtkObject *object)
+gtk_plot_canvas_text_destroy (GtkWidget *object)
{
GtkPlotCanvasText *text = GTK_PLOT_CANVAS_TEXT(object);
@@ -319,7 +318,7 @@ gtk_plot_canvas_text_size_allocate(GtkPlotCanvas *canvas, GtkPlotCanvasChild *ch
void
gtk_plot_canvas_text_set_attributes(GtkPlotCanvasText *text,
const gchar *font, gint height, gint angle,
- const GdkColor *fg, const GdkColor *bg,
+ const GdkRGBA *fg, const GdkRGBA *bg,
gboolean transparent,
GtkJustification justification,
const gchar *real_text)
diff --git a/gtkextra/gtkplotcanvastext.h b/gtkextra/gtkplotcanvastext.h
index b9fbd909..b2f6e311 100644
--- a/gtkextra/gtkplotcanvastext.h
+++ b/gtkextra/gtkplotcanvastext.h
@@ -59,8 +59,8 @@ GtkPlotCanvasChild *
gtk_plot_canvas_text_new (const gchar *font,
gint height,
gint angle,
- const GdkColor *fg,
- const GdkColor *bg,
+ const GdkRGBA *fg,
+ const GdkRGBA *bg,
gboolean transparent,
GtkJustification justification,
const gchar *real_text);
@@ -70,8 +70,8 @@ void gtk_plot_canvas_text_set_attributes
const gchar *font,
gint height,
gint angle,
- const GdkColor *fg,
- const GdkColor *bg,
+ const GdkRGBA *fg,
+ const GdkRGBA *bg,
gboolean transparent,
GtkJustification justification,
const gchar *real_text);
diff --git a/gtkextra/gtkplotcsurface.c b/gtkextra/gtkplotcsurface.c
index 3ed3f2be..ca7fd85c 100644
--- a/gtkextra/gtkplotcsurface.c
+++ b/gtkextra/gtkplotcsurface.c
@@ -66,7 +66,7 @@ typedef struct
static void gtk_plot_csurface_class_init (GtkPlotCSurfaceClass *klass);
static void gtk_plot_csurface_init (GtkPlotCSurface *data);
-static void gtk_plot_csurface_destroy (GtkObject *object);
+static void gtk_plot_csurface_destroy (GtkWidget *object);
static void gtk_plot_csurface_get_property (GObject *object,
guint prop_id,
GValue *value,
@@ -90,8 +90,8 @@ static void gtk_plot_csurface_draw_lines (GtkPlotData *data);
static void gtk_plot_csurface_draw_polygons (GtkPlotSurface *surface);
static void gtk_plot_csurface_real_draw_polygons (GtkPlotSurface *surface,
GtkPlotProjection p);
-static void gtk_plot_csurface_lighting (GdkColor *a,
- GdkColor *b,
+static void gtk_plot_csurface_lighting (GdkRGBA *a,
+ GdkRGBA *b,
gdouble normal,
gdouble ambient);
static void clear_polygons (GtkPlotCSurface *surface);
@@ -145,14 +145,14 @@ gtk_plot_csurface_get_type (void)
static void
gtk_plot_csurface_class_init (GtkPlotCSurfaceClass *klass)
{
- GtkObjectClass *object_class;
+ GtkWidgetClass *object_class;
GtkPlotDataClass *data_class;
GtkPlotSurfaceClass *surface_class;
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
parent_class = g_type_class_ref (gtk_plot_surface_get_type ());
- object_class = (GtkObjectClass *) klass;
+ object_class = (GtkWidgetClass *) klass;
data_class = (GtkPlotDataClass *) klass;
surface_class = (GtkPlotSurfaceClass *) klass;
@@ -303,7 +303,7 @@ gtk_plot_csurface_set_property (GObject *object,
data->levels_line.line_width = g_value_get_double(value);
break;
case ARG_LEVELS_COLOR:
- data->levels_line.color = *((GdkColor *)g_value_get_pointer(value));
+ data->levels_line.color = *((GdkRGBA *)g_value_get_pointer(value));
break;
case ARG_SUBLEVELS_STYLE:
data->sublevels_line.line_style = g_value_get_int(value);
@@ -312,7 +312,7 @@ gtk_plot_csurface_set_property (GObject *object,
data->sublevels_line.line_width = g_value_get_double(value);
break;
case ARG_SUBLEVELS_COLOR:
- data->sublevels_line.color = *((GdkColor *)g_value_get_pointer(value));
+ data->sublevels_line.color = *((GdkRGBA *)g_value_get_pointer(value));
break;
}
}
@@ -362,7 +362,7 @@ gtk_plot_csurface_get_property (GObject *object,
static void
update_data (GtkPlotData *data)
{
- GTK_PLOT_SURFACE_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(data)))->build_polygons(GTK_PLOT_SURFACE(data));
+ GTK_PLOT_SURFACE_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(data)))->build_polygons(GTK_PLOT_SURFACE(data));
data->redraw_pending = TRUE;
}
@@ -397,7 +397,7 @@ gtk_plot_csurface_init (GtkPlotCSurface *dataset)
}
static void
-gtk_plot_csurface_destroy (GtkObject *object)
+gtk_plot_csurface_destroy (GtkWidget *object)
{
GtkPlotCSurface *surface;
@@ -405,7 +405,7 @@ gtk_plot_csurface_destroy (GtkObject *object)
clear_polygons(surface);
- GTK_OBJECT_CLASS(parent_class)->destroy(object);
+ GTK_WIDGET_CLASS(parent_class)->destroy(object);
}
GtkWidget*
@@ -641,7 +641,7 @@ gtk_plot_csurface_draw_lines(GtkPlotData *data)
GtkPlotCSurface *csurface = GTK_PLOT_CSURFACE(data);
GtkPlot *plot = GTK_PLOT(data->plot);
GtkPlotPoint *contour = NULL;
- GdkColor color;
+ GdkRGBA color;
//gboolean closed;
gint n1;
GList *list, *lines = NULL;
@@ -984,8 +984,8 @@ gtk_plot_csurface_real_draw_polygons (GtkPlotSurface *surface, GtkPlotProjection
GtkPlotPoint t[4];
GtkPlotDTtriangle *triangle;
GtkPlotVector points[3], side[3], light, normal;
- GdkColor color;
- GdkColor real_color;
+ GdkRGBA color;
+ GdkRGBA real_color;
gdouble factor, norm;
GList *list;
@@ -1680,7 +1680,7 @@ gtk_plot_csurface_draw_legend(GtkPlotData *data, gint x, gint y)
}
static void
-gtk_plot_csurface_lighting (GdkColor *a, GdkColor *b,
+gtk_plot_csurface_lighting (GdkRGBA *a, GdkRGBA *b,
gdouble normal, gdouble ambient)
{
gdouble red, green, blue;
@@ -1771,10 +1771,6 @@ hsv_to_rgb (gdouble h, gdouble s, gdouble v,
break;
}
}
-
- *r *= 65535.;
- *g *= 65535.;
- *b *= 65535.;
}
static void
@@ -1783,10 +1779,6 @@ rgb_to_hsv (gdouble r, gdouble g, gdouble b,
{
double max, min, delta;
- r /= 65535.;
- g /= 65535.;
- b /= 65535.;
-
max = r;
if (g > max)
max = g;
@@ -1898,7 +1890,7 @@ void
gtk_plot_csurface_set_levels_attributes (GtkPlotCSurface *dataset,
GtkPlotLineStyle style,
gfloat width,
- const GdkColor *color)
+ const GdkRGBA *color)
{
dataset->levels_line.line_style = style;
dataset->levels_line.line_width = width;
@@ -1918,7 +1910,7 @@ void
gtk_plot_csurface_set_sublevels_attributes (GtkPlotCSurface *dataset,
GtkPlotLineStyle style,
gfloat width,
- const GdkColor *color)
+ const GdkRGBA *color)
{
dataset->sublevels_line.line_style = style;
dataset->sublevels_line.line_width = width;
@@ -1938,7 +1930,7 @@ void
gtk_plot_csurface_get_levels_attributes (GtkPlotCSurface *dataset,
GtkPlotLineStyle *style,
gfloat *width,
- GdkColor *color)
+ GdkRGBA *color)
{
*style = dataset->levels_line.line_style;
*width = dataset->levels_line.line_width;
@@ -1958,7 +1950,7 @@ void
gtk_plot_csurface_get_sublevels_attributes (GtkPlotCSurface *dataset,
GtkPlotLineStyle *style,
gfloat *width,
- GdkColor *color)
+ GdkRGBA *color)
{
*style = dataset->sublevels_line.line_style;
*width = dataset->sublevels_line.line_width;
diff --git a/gtkextra/gtkplotcsurface.h b/gtkextra/gtkplotcsurface.h
index ca529ebf..45479568 100644
--- a/gtkextra/gtkplotcsurface.h
+++ b/gtkextra/gtkplotcsurface.h
@@ -97,19 +97,19 @@ GtkPlotProjection gtk_plot_csurface_projection (GtkPlotCSurface *csurface);
void gtk_plot_csurface_set_levels_attributes (GtkPlotCSurface *dataset,
GtkPlotLineStyle style,
gfloat width,
- const GdkColor *color);
+ const GdkRGBA *color);
void gtk_plot_csurface_set_sublevels_attributes (GtkPlotCSurface *dataset,
GtkPlotLineStyle style,
gfloat width,
- const GdkColor *color);
+ const GdkRGBA *color);
void gtk_plot_csurface_get_levels_attributes (GtkPlotCSurface *dataset,
GtkPlotLineStyle *style,
gfloat *width,
- GdkColor *color);
+ GdkRGBA *color);
void gtk_plot_csurface_get_sublevels_attributes (GtkPlotCSurface *dataset,
GtkPlotLineStyle *style,
gfloat *width,
- GdkColor *color);
+ GdkRGBA *color);
#ifdef __cplusplus
}
diff --git a/gtkextra/gtkplotdata.c b/gtkextra/gtkplotdata.c
index 120119ab..26c66916 100644
--- a/gtkextra/gtkplotdata.c
+++ b/gtkextra/gtkplotdata.c
@@ -44,7 +44,7 @@ static gchar DEFAULT_FONT[] = "Helvetica";
static void gtk_plot_data_class_init (GtkPlotDataClass *klass);
static void gtk_plot_data_init (GtkPlotData *data);
-static void gtk_plot_data_destroy (GtkObject *object);
+static void gtk_plot_data_destroy (GtkWidget *object);
static void gtk_plot_data_get_property (GObject *object,
guint prop_id,
GValue *value,
@@ -304,13 +304,13 @@ gtk_plot_data_get_type (void)
static void
gtk_plot_data_class_init (GtkPlotDataClass *klass)
{
- GtkObjectClass *object_class;
+ GtkWidgetClass *object_class;
GtkPlotDataClass *data_class;
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
parent_class = g_type_class_ref (gtk_widget_get_type ());
- object_class = (GtkObjectClass *) klass;
+ object_class = (GtkWidgetClass *) klass;
data_class = (GtkPlotDataClass *) klass;
object_class->destroy = gtk_plot_data_destroy;
@@ -1494,31 +1494,25 @@ gtk_plot_data_class_init (GtkPlotDataClass *klass)
static void
gtk_plot_data_init (GtkPlotData *dataset)
{
- GtkWidget *widget;
- GdkColormap *colormap;
- GdkColor black, white, color;
+ GdkRGBA black, white, color;
gtk_widget_set_has_window(GTK_WIDGET(dataset), FALSE);
- widget = GTK_WIDGET(dataset);
- colormap = gtk_widget_get_colormap(widget);
-
- gdk_color_black(colormap, &black);
- gdk_color_white(colormap, &white);
+ gdk_rgba_parse(&black, "black");
+ gdk_rgba_parse(&white, "white");
dataset->gradient = GTK_PLOT_AXIS(gtk_plot_axis_new(GTK_PLOT_AXIS_Y));
- g_object_ref(GTK_OBJECT(dataset->gradient));
- gtk_object_sink(GTK_OBJECT(dataset->gradient));
+ g_object_ref(dataset->gradient);
+ g_object_ref_sink(dataset->gradient);
+ g_object_unref(dataset->gradient);
dataset->color_lt_min = white;
dataset->color_gt_max = white;
- gdk_color_parse("red", &color);
- gdk_color_alloc(colormap, &color);
+ gdk_rgba_parse(&color, "red");
dataset->color_max = color;
- gdk_color_parse("blue", &color);
- gdk_color_alloc(colormap, &color);
+ gdk_rgba_parse(&color, "blue");
dataset->color_min = color;
dataset->gradient_colors = NULL;
@@ -1546,8 +1540,8 @@ gtk_plot_data_init (GtkPlotData *dataset)
dataset->gradient_y = .05;
dataset->gradient->orientation = GTK_ORIENTATION_VERTICAL;
dataset->gradient->label_mask = GTK_PLOT_LABEL_OUT;
- dataset->gradient->labels_attr.fg = gtk_widget_get_style(widget)->black;
- dataset->gradient->labels_attr.bg = gtk_widget_get_style(widget)->white;
+ dataset->gradient->labels_attr.fg = black;
+ dataset->gradient->labels_attr.bg = white;
dataset->gradient->labels_attr.transparent = FALSE;
dataset->gradient->labels_attr.border = 0;
dataset->gradient->labels_attr.border_width = 0;
@@ -1668,7 +1662,7 @@ gtk_plot_data_init (GtkPlotData *dataset)
}
static void
-gtk_plot_data_destroy (GtkObject *object)
+gtk_plot_data_destroy (GtkWidget *object)
{
GtkPlotData *data;
@@ -1686,7 +1680,7 @@ gtk_plot_data_destroy (GtkObject *object)
if(data->name) g_free(data->name);
data->name = NULL;
- if(data->gradient) g_object_unref(GTK_OBJECT(data->gradient));
+ if(data->gradient) g_object_unref(data->gradient);
data->gradient = NULL;
if(data->gradient_colors){
@@ -1701,13 +1695,13 @@ gtk_plot_data_destroy (GtkObject *object)
data->data = NULL;
}
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (*GTK_OBJECT_CLASS (parent_class)->destroy) (GTK_OBJECT(data));
+ if (GTK_WIDGET_CLASS (parent_class)->destroy)
+ (*GTK_WIDGET_CLASS (parent_class)->destroy) (GTK_WIDGET(data));
gtk_psfont_unref();
- if ( GTK_OBJECT_CLASS (parent_class)->destroy )
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+ if ( GTK_WIDGET_CLASS (parent_class)->destroy )
+ (* GTK_WIDGET_CLASS (parent_class)->destroy) (object);
}
static void
@@ -1762,13 +1756,13 @@ gtk_plot_data_set_property (GObject *object,
data->symbol.size = g_value_get_int(value);
break;
case ARG_SYMBOL_COLOR:
- data->symbol.color = *((GdkColor *)g_value_get_pointer(value));
+ data->symbol.color = *((GdkRGBA *)g_value_get_pointer(value));
break;
case ARG_SYMBOL_BORDER_WIDTH:
data->symbol.border.line_width = g_value_get_double(value);
break;
case ARG_SYMBOL_BORDER_COLOR:
- data->symbol.border.color = *((GdkColor *)g_value_get_pointer(value));
+ data->symbol.border.color = *((GdkRGBA *)g_value_get_pointer(value));
break;
case ARG_LINE_STYLE:
data->line.line_style = g_value_get_int(value);
@@ -1783,7 +1777,7 @@ gtk_plot_data_set_property (GObject *object,
data->line.line_width = g_value_get_double(value);
break;
case ARG_LINE_COLOR:
- data->line.color = *((GdkColor *)g_value_get_pointer(value));
+ data->line.color = *((GdkRGBA *)g_value_get_pointer(value));
break;
case ARG_LINE_CONNECTOR:
data->line_connector = g_value_get_int(value);
@@ -1801,7 +1795,7 @@ gtk_plot_data_set_property (GObject *object,
data->x_line.line_width = g_value_get_double(value);
break;
case ARG_XLINE_COLOR:
- data->x_line.color = *((GdkColor *)g_value_get_pointer(value));
+ data->x_line.color = *((GdkRGBA *)g_value_get_pointer(value));
break;
case ARG_YLINE_STYLE:
data->y_line.line_style = g_value_get_int(value);
@@ -1816,7 +1810,7 @@ gtk_plot_data_set_property (GObject *object,
data->y_line.line_width = g_value_get_double(value);
break;
case ARG_YLINE_COLOR:
- data->y_line.color = *((GdkColor *)g_value_get_pointer(value));
+ data->y_line.color = *((GdkRGBA *)g_value_get_pointer(value));
break;
case ARG_ZLINE_STYLE:
data->z_line.line_style = g_value_get_int(value);
@@ -1831,7 +1825,7 @@ gtk_plot_data_set_property (GObject *object,
data->z_line.line_width = g_value_get_double(value);
break;
case ARG_ZLINE_COLOR:
- data->z_line.color = *((GdkColor *)g_value_get_pointer(value));
+ data->z_line.color = *((GdkRGBA *)g_value_get_pointer(value));
break;
case ARG_SHOW_XERRBARS:
data->show_xerrbars = g_value_get_boolean(value);
@@ -1891,10 +1885,10 @@ gtk_plot_data_set_property (GObject *object,
data->labels_attr.shadow_width = g_value_get_int(value);
break;
case ARG_LABELS_FG:
- data->labels_attr.fg = *((GdkColor *)g_value_get_pointer(value));
+ data->labels_attr.fg = *((GdkRGBA *)g_value_get_pointer(value));
break;
case ARG_LABELS_BG:
- data->labels_attr.bg = *((GdkColor *)g_value_get_pointer(value));
+ data->labels_attr.bg = *((GdkRGBA *)g_value_get_pointer(value));
break;
case ARG_LABELS_OFFSET:
data->labels_offset = g_value_get_int(value);
@@ -1923,16 +1917,16 @@ gtk_plot_data_set_property (GObject *object,
data->gradient_show_lt_gt = g_value_get_boolean(value);
break;
case ARG_COLOR_MIN:
- data->color_min = *((GdkColor *)g_value_get_pointer(value));
+ data->color_min = *((GdkRGBA *)g_value_get_pointer(value));
break;
case ARG_COLOR_MAX:
- data->color_max = *((GdkColor *)g_value_get_pointer(value));
+ data->color_max = *((GdkRGBA *)g_value_get_pointer(value));
break;
case ARG_COLOR_LT_MIN:
- data->color_lt_min = *((GdkColor *)g_value_get_pointer(value));
+ data->color_lt_min = *((GdkRGBA *)g_value_get_pointer(value));
break;
case ARG_COLOR_GT_MAX:
- data->color_gt_max = *((GdkColor *)g_value_get_pointer(value));
+ data->color_gt_max = *((GdkRGBA *)g_value_get_pointer(value));
break;
case ARG_GRADIENT_MAX:
if(!data->gradient) return;
@@ -2276,7 +2270,7 @@ gtk_plot_data_get_property (GObject *object,
g_value_set_double(value, data->gradient->ticks.break_position);
break;
case ARG_GRADIENT:
- g_value_set_object(value, GTK_OBJECT(data->gradient));
+ g_value_set_object(value, data->gradient);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -2371,7 +2365,7 @@ gtk_plot_data_construct_iterator (GtkPlotData *data,
void
gtk_plot_data_clone (GtkPlotData *data, GtkPlotData *copy)
{
- GTK_PLOT_DATA_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(data)))->clone(data, copy);
+ GTK_PLOT_DATA_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(data)))->clone(data, copy);
}
/**
@@ -2383,7 +2377,7 @@ gtk_plot_data_clone (GtkPlotData *data, GtkPlotData *copy)
void
gtk_plot_data_update(GtkPlotData *data)
{
- GTK_PLOT_DATA_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(data)))->update(data, TRUE);
+ GTK_PLOT_DATA_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(data)))->update(data, TRUE);
}
static void
@@ -2414,8 +2408,7 @@ static void
draw_marker(GtkPlotData *data, GtkPlotMarker *marker)
{
GtkPlot *plot;
- GdkColor black;
- GdkColormap *colormap = NULL;
+ GdkRGBA black;
GtkPlotPoint p[6];
gdouble x, y, z, a, dx, dy, dz, da;
gchar *label;
@@ -2434,8 +2427,7 @@ draw_marker(GtkPlotData *data, GtkPlotMarker *marker)
gtk_plot_get_pixel(plot, x, y, &px, &py);
- colormap = gdk_colormap_get_system();
- gdk_color_black(colormap, &black);
+ gdk_rgba_parse(&black, "black");
gtk_plot_pc_set_color(plot->pc, &black);
gtk_plot_pc_set_lineattr(plot->pc, 1, 0, 0, 0);
@@ -2462,7 +2454,7 @@ draw_marker(GtkPlotData *data, GtkPlotMarker *marker)
void
gtk_plot_data_paint (GtkPlotData *data)
{
- g_signal_emit(GTK_OBJECT(data), data_signals[DRAW_DATA], 0, NULL);
+ g_signal_emit(data, data_signals[DRAW_DATA], 0, NULL);
data->redraw_pending = FALSE;
}
@@ -2716,14 +2708,14 @@ gtk_plot_data_real_real_draw (GtkPlotData *dataset,
if(!plot->clip_data ||
(plot->clip_data && GTK_IS_PLOT_POLAR(plot) && x >= GTK_PLOT_POLAR(plot)->r->ticks.min && x <=
GTK_PLOT_POLAR(plot)->r->ticks.max) ||
(plot->clip_data && x >= plot->xmin && x <= plot->xmax)){
- GdkColor symbol_color, border_color;
+ GdkRGBA symbol_color, border_color;
gint symbol_size;
symbol_color = dataset->symbol.color;
border_color = dataset->symbol.border.color;
symbol_size = dataset->symbol.size;
if(array_da){
- GdkColor level_color;
+ GdkRGBA level_color;
gtk_plot_data_get_gradient_level(dataset, da, &level_color);
dataset->symbol.color = level_color;
dataset->symbol.border.color = level_color;
@@ -2735,7 +2727,7 @@ gtk_plot_data_real_real_draw (GtkPlotData *dataset,
dataset->symbol.size = fabs((px - px0)/plot->magnification);
dataset->symbol.size *= fabs(a_scale);
}
- GTK_PLOT_DATA_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(dataset)))->draw_symbol(dataset, x, y*y_scale,
z*z_scale, a, dx, dy, dz, da);
+ GTK_PLOT_DATA_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(dataset)))->draw_symbol(dataset, x, y*y_scale,
z*z_scale, a, dx, dy, dz, da);
dataset->symbol.color = symbol_color;
dataset->symbol.border.color = border_color;
dataset->symbol.size = symbol_size;
@@ -2879,7 +2871,7 @@ draw_gradient_vertical(GtkPlotData *data, gdouble px, gdouble py)
GtkPlotText legend;
gchar text[100], new_label[100];
GdkRectangle area;
- GdkColor color;
+ GdkRGBA color;
gint lascent, ldescent, lheight, lwidth;
gint minascent, mindescent, minheight, minwidth;
gint maxascent, maxdescent, maxheight, maxwidth;
@@ -2919,7 +2911,7 @@ draw_gradient_vertical(GtkPlotData *data, gdouble px, gdouble py)
m = plot->magnification;
legend = data->gradient->labels_attr;
- GTK_PLOT_DATA_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(data)))->get_gradient_size(data, &width, &height);
+ GTK_PLOT_DATA_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(data)))->get_gradient_size(data, &width, &height);
if(!data->gradient->labels_attr.transparent){
gtk_plot_pc_set_color(plot->pc, &data->gradient->labels_attr.bg);
@@ -3218,7 +3210,7 @@ draw_gradient_horizontal(GtkPlotData *data, gdouble px, gdouble py)
GtkPlotText legend;
gchar text[100], new_label[100];
GdkRectangle area;
- GdkColor color;
+ GdkRGBA color;
gint lascent, ldescent, lheight, lwidth;
gint minascent, mindescent, minheight, minwidth;
gint maxascent, maxdescent, maxheight, maxwidth;
@@ -3259,7 +3251,7 @@ draw_gradient_horizontal(GtkPlotData *data, gdouble px, gdouble py)
m = plot->magnification;
legend = data->gradient->labels_attr;
- GTK_PLOT_DATA_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(data)))->get_gradient_size(data, &width, &height);
+ GTK_PLOT_DATA_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(data)))->get_gradient_size(data, &width, &height);
if(!data->gradient->labels_attr.transparent){
gtk_plot_pc_set_color(plot->pc, &data->gradient->labels_attr.bg);
@@ -3612,7 +3604,7 @@ gtk_plot_data_move_gradient(GtkPlotData *data, gdouble x, gdouble y)
{
data->gradient_x = x;
data->gradient_y = y;
- g_signal_emit(GTK_OBJECT(data), data_signals[GRADIENT_CHANGED], 0);
+ g_signal_emit(data, data_signals[GRADIENT_CHANGED], 0);
}
/**
@@ -3637,7 +3629,7 @@ gtk_plot_data_get_gradient_allocation(GtkPlotData *data)
allocation.x = roundint(area.x + plot->internal_allocation.x + plot->internal_allocation.width *
data->gradient_x);
allocation.y = roundint(area.y + plot->internal_allocation.y + plot->internal_allocation.height *
data->gradient_y);
- GTK_PLOT_DATA_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(data)))->get_gradient_size(data, &width, &height);
+ GTK_PLOT_DATA_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(data)))->get_gradient_size(data, &width, &height);
allocation.width = width;
allocation.height = height;
@@ -4309,6 +4301,7 @@ gtk_plot_data_draw_lines (GtkPlotData *dataset,
{
GtkPlot *plot;
GtkWidget *widget;
+ GtkAllocation allocation;
int beg = 0;
int i, j;
int lx1, lx2, ly1, ly2;
@@ -4316,11 +4309,12 @@ gtk_plot_data_draw_lines (GtkPlotData *dataset,
plot = dataset->plot;
widget = GTK_WIDGET (plot);
+ gtk_widget_get_allocation (widget, &allocation);
- lx1 = widget->allocation.x;
- lx2 = lx1 + widget->allocation.width;
- ly1 = widget->allocation.y;
- ly2 = ly1 + widget->allocation.height;
+ lx1 = allocation.x;
+ lx2 = lx1 + allocation.width;
+ ly1 = allocation.y;
+ ly2 = ly1 + allocation.height;
j = 0;
for(i = 0; i < numpoints; i++){
@@ -4368,16 +4362,18 @@ gtk_plot_data_draw_just_the_points (GtkPlotData *dataset,
{
GtkPlot *plot;
GtkWidget *widget;
+ GtkAllocation allocation;
int i;
int lx1, lx2, ly1, ly2;
plot = dataset->plot;
widget = GTK_WIDGET (plot);
+ gtk_widget_get_allocation (widget, &allocation);
- lx1 = widget->allocation.x;
- lx2 = lx1 + widget->allocation.width;
- ly1 = widget->allocation.y;
- ly2 = ly1 + widget->allocation.height;
+ lx1 = allocation.x;
+ lx2 = lx1 + allocation.width;
+ ly1 = allocation.y;
+ ly2 = ly1 + allocation.height;
for(i = 0; i < numpoints; i++){
if (points[i].x >= lx1 && points[i].y >= ly1 &&
@@ -5705,8 +5701,8 @@ gtk_plot_data_labels_set_attributes (GtkPlotData *data,
const gchar *font,
gint height,
gint angle,
- const GdkColor *fg,
- const GdkColor *bg)
+ const GdkRGBA *fg,
+ const GdkRGBA *bg)
{
if(!font){
/* Use previous font */
@@ -5779,7 +5775,7 @@ gtk_plot_data_set_symbol (GtkPlotData *dataset,
GtkPlotSymbolType type,
GtkPlotSymbolStyle style,
gint size, gfloat line_width,
- const GdkColor *color, const GdkColor *border_color)
+ const GdkRGBA *color, const GdkRGBA *border_color)
{
dataset->symbol.symbol_type = type;
dataset->symbol.symbol_style = style;
@@ -5806,7 +5802,7 @@ gtk_plot_data_get_symbol (GtkPlotData *dataset,
GtkPlotSymbolType *type,
GtkPlotSymbolStyle *style,
gint *size, gfloat *line_width,
- GdkColor *color, GdkColor *border_color)
+ GdkRGBA *color, GdkRGBA *border_color)
{
*type = dataset->symbol.symbol_type;
*style = dataset->symbol.symbol_style;
@@ -5830,10 +5826,10 @@ gtk_plot_data_get_symbol (GtkPlotData *dataset,
void
gtk_plot_data_set_line_attributes (GtkPlotData *dataset,
GtkPlotLineStyle style,
- GdkCapStyle cap_style,
- GdkJoinStyle join_style,
+ cairo_line_cap_t cap_style,
+ cairo_line_join_t join_style,
gfloat width,
- const GdkColor *color)
+ const GdkRGBA *color)
{
dataset->line.line_style = style;
dataset->line.cap_style = cap_style;
@@ -5856,10 +5852,10 @@ gtk_plot_data_set_line_attributes (GtkPlotData *dataset,
void
gtk_plot_data_get_line_attributes (GtkPlotData *dataset,
GtkPlotLineStyle *style,
- GdkCapStyle *cap_style,
- GdkJoinStyle *join_style,
+ cairo_line_cap_t *cap_style,
+ cairo_line_join_t *join_style,
gfloat *width,
- GdkColor *color)
+ GdkRGBA *color)
{
*style = dataset->line.line_style;
*cap_style = dataset->line.cap_style;
@@ -5911,10 +5907,10 @@ gtk_plot_data_get_connector (GtkPlotData *dataset)
void
gtk_plot_data_set_x_attributes (GtkPlotData *dataset,
GtkPlotLineStyle style,
- GdkCapStyle cap_style,
- GdkJoinStyle join_style,
+ cairo_line_cap_t cap_style,
+ cairo_line_join_t join_style,
gfloat width,
- const GdkColor *color)
+ const GdkRGBA *color)
{
dataset->x_line.line_style = style;
dataset->x_line.cap_style = cap_style;
@@ -5937,10 +5933,10 @@ gtk_plot_data_set_x_attributes (GtkPlotData *dataset,
void
gtk_plot_data_set_y_attributes (GtkPlotData *dataset,
GtkPlotLineStyle style,
- GdkCapStyle cap_style,
- GdkJoinStyle join_style,
+ cairo_line_cap_t cap_style,
+ cairo_line_join_t join_style,
gfloat width,
- const GdkColor *color)
+ const GdkRGBA *color)
{
dataset->y_line.line_style = style;
dataset->y_line.cap_style = cap_style;
@@ -5963,10 +5959,10 @@ gtk_plot_data_set_y_attributes (GtkPlotData *dataset,
void
gtk_plot_data_set_z_attributes (GtkPlotData *dataset,
GtkPlotLineStyle style,
- GdkCapStyle cap_style,
- GdkJoinStyle join_style,
+ cairo_line_cap_t cap_style,
+ cairo_line_join_t join_style,
gfloat width,
- const GdkColor *color)
+ const GdkRGBA *color)
{
dataset->z_line.line_style = style;
dataset->z_line.cap_style = cap_style;
@@ -6207,7 +6203,7 @@ void
gtk_plot_data_set_gradient_show_lt_gt (GtkPlotData *data, gboolean show)
{
data->gradient_show_lt_gt = show;
- g_signal_emit(GTK_OBJECT(data), data_signals[GRADIENT_COLORS_CHANGED], 0);
+ g_signal_emit(data, data_signals[GRADIENT_COLORS_CHANGED], 0);
}
/**
@@ -6235,7 +6231,7 @@ void
gtk_plot_data_set_gradient_mask (GtkPlotData *data, gint mask)
{
data->gradient_mask = mask;
- g_signal_emit(GTK_OBJECT(data), data_signals[GRADIENT_COLORS_CHANGED], 0);
+ g_signal_emit(data, data_signals[GRADIENT_COLORS_CHANGED], 0);
}
/**
@@ -6399,12 +6395,12 @@ real_autoscale_gradient(GtkPlotData *data, gdouble xmin, gdouble xmax)
*/
void
gtk_plot_data_set_gradient_colors (GtkPlotData *data,
- const GdkColor *min,
- const GdkColor *max)
+ const GdkRGBA *min,
+ const GdkRGBA *max)
{
data->color_min= *min;
data->color_max = *max;
- g_signal_emit(GTK_OBJECT(data), data_signals[GRADIENT_COLORS_CHANGED], 0);
+ g_signal_emit(data, data_signals[GRADIENT_COLORS_CHANGED], 0);
}
/**
@@ -6417,8 +6413,8 @@ gtk_plot_data_set_gradient_colors (GtkPlotData *data,
*/
void
gtk_plot_data_get_gradient_colors (GtkPlotData *data,
- GdkColor *min,
- GdkColor *max)
+ GdkRGBA *min,
+ GdkRGBA *max)
{
min = &data->color_min;
max = &data->color_max;
@@ -6435,13 +6431,13 @@ gtk_plot_data_get_gradient_colors (GtkPlotData *data,
void
gtk_plot_data_set_gradient_nth_color (GtkPlotData *data,
guint level,
- GdkColor *color)
+ GdkRGBA *color)
{
if(!data->gradient_custom) return;
if(level > data->gradient->ticks.nticks) return;
data->gradient_colors[level] = *color;
- g_signal_emit(GTK_OBJECT(data), data_signals[GRADIENT_COLORS_CHANGED], 0);
+ g_signal_emit(data, data_signals[GRADIENT_COLORS_CHANGED], 0);
}
/**
@@ -6453,7 +6449,7 @@ gtk_plot_data_set_gradient_nth_color (GtkPlotData *data,
*
* Return value:
*/
-const GdkColor *
+const GdkRGBA *
gtk_plot_data_get_gradient_nth_color (GtkPlotData *data,
guint level)
{
@@ -6471,12 +6467,12 @@ gtk_plot_data_get_gradient_nth_color (GtkPlotData *data,
*/
void
gtk_plot_data_set_gradient_outer_colors (GtkPlotData *data,
- const GdkColor *min,
- const GdkColor *max)
+ const GdkRGBA *min,
+ const GdkRGBA *max)
{
data->color_lt_min = *min;
data->color_gt_max = *max;
- g_signal_emit(GTK_OBJECT(data), data_signals[GRADIENT_COLORS_CHANGED], 0);
+ g_signal_emit(data, data_signals[GRADIENT_COLORS_CHANGED], 0);
}
/**
@@ -6489,8 +6485,8 @@ gtk_plot_data_set_gradient_outer_colors (GtkPlotData *data,
*/
void
gtk_plot_data_get_gradient_outer_colors (GtkPlotData *data,
- GdkColor *min,
- GdkColor *max)
+ GdkRGBA *min,
+ GdkRGBA *max)
{
min = &data->color_lt_min;
max = &data->color_gt_max;
@@ -6551,9 +6547,9 @@ gtk_plot_data_get_gradient (GtkPlotData *data,
*
*/
void
-gtk_plot_data_get_gradient_level (GtkPlotData *data, gdouble level, GdkColor *color)
+gtk_plot_data_get_gradient_level (GtkPlotData *data, gdouble level, GdkRGBA *color)
{
- GdkColor min, max;
+ GdkRGBA min, max;
gdouble red, green, blue;
gdouble h, s, v;
gdouble h1, s1, v1;
@@ -6622,7 +6618,7 @@ gtk_plot_data_get_gradient_level (GtkPlotData *data, gdouble level, GdkColor *co
color->red = red;
color->green = green;
color->blue = blue;
- gdk_color_alloc(gtk_widget_get_colormap(GTK_WIDGET(data)), color);
+ color->alpha = 1.0;
}
/**
@@ -6716,10 +6712,6 @@ hsv_to_rgb (gdouble h, gdouble s, gdouble v,
break;
}
}
-
- *r *= 65535.;
- *g *= 65535.;
- *b *= 65535.;
}
@@ -6729,10 +6721,6 @@ rgb_to_hsv (gdouble r, gdouble g, gdouble b,
{
double max, min, delta;
- r /= 65535.;
- g /= 65535.;
- b /= 65535.;
-
max = r;
if (g > max)
max = g;
@@ -6850,7 +6838,7 @@ gtk_plot_data_reset_gradient(GtkPlotData *data)
data->gradient->ticks.values[0].value = min;
data->gradient->ticks.values[data->gradient->ticks.nticks-1].value = max;
*/
- g_signal_emit(GTK_OBJECT(data), data_signals[GRADIENT_CHANGED], 0);
+ g_signal_emit(data, data_signals[GRADIENT_CHANGED], 0);
gtk_plot_data_reset_gradient_colors(data);
}
@@ -6869,7 +6857,7 @@ gtk_plot_data_reset_gradient_colors(GtkPlotData *data)
gint nminor = 0;
gint i;
gboolean custom;
- GdkColor color;
+ GdkRGBA color;
gdouble value;
ticks = &data->gradient->ticks;
@@ -6886,7 +6874,7 @@ gtk_plot_data_reset_gradient_colors(GtkPlotData *data)
}
data->gradient_custom = FALSE;
- data->gradient_colors = g_new0(GdkColor, ticks->nticks + 1);
+ data->gradient_colors = g_new0(GdkRGBA, ticks->nticks + 1);
data->gradient->ticks.max = ticks->values[ticks->nticks-1].value;
data->gradient->ticks.min = ticks->values[1].value;
data->gradient->ticks.nminor = 0;
@@ -6903,7 +6891,7 @@ gtk_plot_data_reset_gradient_colors(GtkPlotData *data)
data->gradient->ticks.min = min;
data->gradient_custom = custom;
data->gradient->ticks.nminor = nminor;
- g_signal_emit(GTK_OBJECT(data), data_signals[GRADIENT_COLORS_CHANGED], 0);
+ g_signal_emit(data, data_signals[GRADIENT_COLORS_CHANGED], 0);
}
/**
diff --git a/gtkextra/gtkplotdata.h b/gtkextra/gtkplotdata.h
index 231def9f..7c4defe7 100644
--- a/gtkextra/gtkplotdata.h
+++ b/gtkextra/gtkplotdata.h
@@ -147,8 +147,8 @@ void gtk_plot_data_labels_set_attributes (GtkPlotData *data,
const gchar *font,
gint height,
gint angle,
- const GdkColor *fg,
- const GdkColor *bg);
+ const GdkRGBA *fg,
+ const GdkRGBA *bg);
void gtk_plot_data_set_numpoints (GtkPlotData *dataset,
gint num_points);
gint gtk_plot_data_get_numpoints (GtkPlotData *data);
@@ -157,48 +157,48 @@ void gtk_plot_data_set_symbol (GtkPlotData *dataset,
GtkPlotSymbolStyle style,
gint size,
gfloat line_width,
- const GdkColor *color,
- const GdkColor *border_color);
+ const GdkRGBA *color,
+ const GdkRGBA *border_color);
void gtk_plot_data_get_symbol (GtkPlotData *dataset,
GtkPlotSymbolType *type,
GtkPlotSymbolStyle *style,
gint *size,
gfloat *line_width,
- GdkColor *color,
- GdkColor *border_color);
+ GdkRGBA *color,
+ GdkRGBA *border_color);
void gtk_plot_data_set_connector (GtkPlotData *dataset,
GtkPlotConnector connector);
gint gtk_plot_data_get_connector (GtkPlotData *dataset);
void gtk_plot_data_set_line_attributes (GtkPlotData *dataset,
GtkPlotLineStyle style,
- GdkCapStyle cap_style,
- GdkJoinStyle join_style,
+ cairo_line_cap_t cap_style,
+ cairo_line_join_t join_style,
gfloat width,
- const GdkColor *color);
+ const GdkRGBA *color);
void gtk_plot_data_get_line_attributes (GtkPlotData *dataset,
GtkPlotLineStyle *style,
- GdkCapStyle *cap_style,
- GdkJoinStyle *join_style,
+ cairo_line_cap_t *cap_style,
+ cairo_line_join_t *join_style,
gfloat *width,
- GdkColor *color);
+ GdkRGBA *color);
void gtk_plot_data_set_x_attributes (GtkPlotData *dataset,
GtkPlotLineStyle style,
- GdkCapStyle cap_style,
- GdkJoinStyle join_style,
+ cairo_line_cap_t cap_style,
+ cairo_line_join_t join_style,
gfloat width,
- const GdkColor *color);
+ const GdkRGBA *color);
void gtk_plot_data_set_y_attributes (GtkPlotData *dataset,
GtkPlotLineStyle style,
- GdkCapStyle cap_style,
- GdkJoinStyle join_style,
+ cairo_line_cap_t cap_style,
+ cairo_line_join_t join_style,
gfloat width,
- const GdkColor *color);
+ const GdkRGBA *color);
void gtk_plot_data_set_z_attributes (GtkPlotData *dataset,
GtkPlotLineStyle style,
- GdkCapStyle cap_style,
- GdkJoinStyle join_style,
+ cairo_line_cap_t cap_style,
+ cairo_line_join_t join_style,
gfloat width,
- const GdkColor *color);
+ const GdkRGBA *color);
void gtk_plot_data_show_xerrbars (GtkPlotData *dataset);
void gtk_plot_data_show_yerrbars (GtkPlotData *dataset);
void gtk_plot_data_show_zerrbars (GtkPlotData *dataset);
@@ -238,22 +238,22 @@ void gtk_plot_data_gradient_autoscale_a (GtkPlotData *data);
void gtk_plot_data_gradient_autoscale_da (GtkPlotData *data);
void gtk_plot_data_gradient_autoscale_z (GtkPlotData *data);
void gtk_plot_data_set_gradient_colors (GtkPlotData *data,
- const GdkColor *min,
- const GdkColor *max);
+ const GdkRGBA *min,
+ const GdkRGBA *max);
void gtk_plot_data_get_gradient_colors (GtkPlotData *data,
- GdkColor *min,
- GdkColor *max);
+ GdkRGBA *min,
+ GdkRGBA *max);
void gtk_plot_data_set_gradient_nth_color (GtkPlotData *data,
guint level,
- GdkColor *color);
-const GdkColor *gtk_plot_data_get_gradient_nth_color (GtkPlotData *data,
+ GdkRGBA *color);
+const GdkRGBA *gtk_plot_data_get_gradient_nth_color (GtkPlotData *data,
guint level);
void gtk_plot_data_set_gradient_outer_colors (GtkPlotData *data,
- const GdkColor *min,
- const GdkColor *max);
+ const GdkRGBA *min,
+ const GdkRGBA *max);
void gtk_plot_data_get_gradient_outer_colors (GtkPlotData *data,
- GdkColor *min,
- GdkColor *max);
+ GdkRGBA *min,
+ GdkRGBA *max);
void gtk_plot_data_set_gradient (GtkPlotData *data,
gdouble min,
gdouble max,
@@ -266,7 +266,7 @@ void gtk_plot_data_get_gradient (GtkPlotData *data,
gint *nsublevels);
void gtk_plot_data_get_gradient_level (GtkPlotData *data,
gdouble level,
- GdkColor *color);
+ GdkRGBA *color);
void gtk_plot_data_gradient_set_style (GtkPlotData *data,
GtkPlotLabelStyle style,
gint precision);
diff --git a/gtkextra/gtkplotdt.c b/gtkextra/gtkplotdt.c
index e47d6b97..b9c56792 100644
--- a/gtkextra/gtkplotdt.c
+++ b/gtkextra/gtkplotdt.c
@@ -42,7 +42,7 @@ typedef struct {
static void gtk_plot_dt_class_init (GtkPlotDTClass *klass);
static void gtk_plot_dt_init (GtkPlotDT *data);
-static void gtk_plot_dt_destroy (GtkObject *object);
+static void gtk_plot_dt_destroy (GtkWidget *object);
static gboolean gtk_plot_dt_real_add_node (GtkPlotDT *dt,
GtkPlotDTnode node);
static GtkPlotDTnode *gtk_plot_dt_real_get_node (GtkPlotDT *dt,
@@ -52,7 +52,7 @@ static void gtk_plot_dt_real_clear (GtkPlotDT *dt);
static gboolean gtk_plot_dt_triangulate_tryquad (GtkPlotDT *dt);
static void gtk_plot_dt_clear_triangles (GtkPlotDT *data);
-static GtkObjectClass *parent_class = NULL;
+static GtkWidgetClass *parent_class = NULL;
GType
@@ -63,7 +63,7 @@ gtk_plot_dt_get_type (void)
if (!data_type)
{
data_type = g_type_register_static_simple (
- gtk_object_get_type(),
+ gtk_widget_get_type(),
"GtkPlotDT",
sizeof (GtkPlotDTClass),
(GClassInitFunc) gtk_plot_dt_class_init,
@@ -77,12 +77,12 @@ gtk_plot_dt_get_type (void)
static void
gtk_plot_dt_class_init (GtkPlotDTClass *klass)
{
- GtkObjectClass *object_class;
+ GtkWidgetClass *object_class;
GtkPlotDTClass *dt_class;
- parent_class = g_type_class_ref (gtk_object_get_type ());
+ parent_class = g_type_class_ref (gtk_widget_get_type ());
- object_class = (GtkObjectClass *) klass;
+ object_class = (GtkWidgetClass *) klass;
dt_class = (GtkPlotDTClass *) klass;
object_class->destroy = gtk_plot_dt_destroy;
@@ -131,10 +131,10 @@ gtk_plot_dt_expand(GtkPlotDT *data, gint num)
*
* Return value:
*/
-GtkObject*
+GtkWidget*
gtk_plot_dt_new (gint num)
{
- GtkObject *object;
+ GtkWidget *object;
object = g_object_new (gtk_plot_dt_get_type (), NULL);
@@ -160,7 +160,7 @@ gtk_plot_dt_init (GtkPlotDT *data)
}
static void
-gtk_plot_dt_destroy(GtkObject *object)
+gtk_plot_dt_destroy(GtkWidget *object)
{
GtkPlotDT *data;
@@ -180,7 +180,7 @@ gtk_plot_dt_destroy(GtkObject *object)
void
gtk_plot_dt_clear(GtkPlotDT *data)
{
- GTK_PLOT_DT_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(data)))->clear(data);
+ GTK_PLOT_DT_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(data)))->clear(data);
}
/**
@@ -194,7 +194,7 @@ gtk_plot_dt_clear(GtkPlotDT *data)
gboolean
gtk_plot_dt_add_node(GtkPlotDT *data, GtkPlotDTnode node)
{
- return(GTK_PLOT_DT_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(data)))->add_node(data, node));
+ return(GTK_PLOT_DT_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(data)))->add_node(data, node));
}
/**
@@ -207,7 +207,7 @@ gtk_plot_dt_add_node(GtkPlotDT *data, GtkPlotDTnode node)
GtkPlotDTnode *
gtk_plot_dt_get_node(GtkPlotDT *data, gint idx)
{
- return(GTK_PLOT_DT_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(data)))->get_node(data, idx));
+ return(GTK_PLOT_DT_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(data)))->get_node(data, idx));
}
/**
@@ -221,7 +221,7 @@ gtk_plot_dt_get_node(GtkPlotDT *data, gint idx)
gboolean
gtk_plot_dt_triangulate(GtkPlotDT *data)
{
- return(GTK_PLOT_DT_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(data)))->triangulate(data));
+ return(GTK_PLOT_DT_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(data)))->triangulate(data));
}
static void
diff --git a/gtkextra/gtkplotdt.h b/gtkextra/gtkplotdt.h
index 4572147a..5e44e738 100644
--- a/gtkextra/gtkplotdt.h
+++ b/gtkextra/gtkplotdt.h
@@ -89,7 +89,7 @@ typedef gint (*GtkPlotDTprogressbarFunc) (double progress);
*/
struct _GtkPlotDT
{
- GtkObject object;
+ GtkWidget object;
gboolean quadrilateral;
gboolean subsampling;
@@ -108,7 +108,7 @@ struct _GtkPlotDT
struct _GtkPlotDTClass
{
- GtkObjectClass parent_class;
+ GtkWidgetClass parent_class;
gboolean (* add_node) (GtkPlotDT *data,
GtkPlotDTnode node);
@@ -119,7 +119,7 @@ struct _GtkPlotDTClass
};
GType gtk_plot_dt_get_type (void);
-GtkObject* gtk_plot_dt_new (gint num);
+GtkWidget* gtk_plot_dt_new (gint num);
void gtk_plot_dt_set_quadrilateral (GtkPlotDT *dt,
gboolean set);
void gtk_plot_dt_set_subsampling (GtkPlotDT *dt,
diff --git a/gtkextra/gtkplotflux.c b/gtkextra/gtkplotflux.c
index bdb491e1..52132964 100644
--- a/gtkextra/gtkplotflux.c
+++ b/gtkextra/gtkplotflux.c
@@ -39,7 +39,7 @@
static void gtk_plot_flux_class_init (GtkPlotFluxClass *klass);
static void gtk_plot_flux_init (GtkPlotFlux *data);
-static void gtk_plot_flux_destroy (GtkObject *data);
+static void gtk_plot_flux_destroy (GtkWidget *data);
static void gtk_plot_flux_get_property (GObject *object,
guint prop_id,
GValue *value,
@@ -108,13 +108,13 @@ gtk_plot_flux_get_type (void)
static void
gtk_plot_flux_class_init (GtkPlotFluxClass *klass)
{
- GtkObjectClass *object_class;
+ GtkWidgetClass *object_class;
GtkPlotDataClass *data_class;
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
parent_class = g_type_class_ref (gtk_plot_data_get_type ());
- object_class = (GtkObjectClass *) klass;
+ object_class = (GtkWidgetClass *) klass;
data_class = (GtkPlotDataClass *) klass;
gobject_class->set_property = gtk_plot_flux_set_property;
@@ -274,14 +274,10 @@ gtk_plot_flux_class_init (GtkPlotFluxClass *klass)
static void
gtk_plot_flux_init (GtkPlotFlux *dataset)
{
- GdkColor black, white;
- GdkColormap *colormap;
+ GdkRGBA black;
GtkPlotArray *dim;
- colormap = gdk_colormap_get_system();
-
- gdk_color_black(colormap, &black);
- gdk_color_white(colormap, &white);
+ gdk_rgba_parse(&black, "black");
GTK_PLOT_DATA(dataset)->symbol.symbol_style = GTK_PLOT_SYMBOL_EMPTY;
GTK_PLOT_DATA(dataset)->symbol.color = black;
@@ -437,7 +433,7 @@ gtk_plot_flux_new ()
}
static void
-gtk_plot_flux_destroy(GtkObject *object)
+gtk_plot_flux_destroy(GtkWidget *object)
{
GtkPlotFlux *flux = GTK_PLOT_FLUX(object);
@@ -446,8 +442,8 @@ gtk_plot_flux_destroy(GtkObject *object)
if(flux->labels_suffix) g_free(flux->labels_suffix);
flux->labels_suffix = NULL;
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (*GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+ if (GTK_WIDGET_CLASS (parent_class)->destroy)
+ (*GTK_WIDGET_CLASS (parent_class)->destroy) (object);
}
static void
diff --git a/gtkextra/gtkplotpc.c b/gtkextra/gtkplotpc.c
index 732a9aeb..f76f983c 100644
--- a/gtkextra/gtkplotpc.c
+++ b/gtkextra/gtkplotpc.c
@@ -33,7 +33,6 @@
#include <gtk/gtk.h>
#include "gtkplotpc.h"
-#include "gtkplotgdk.h"
#include "gtkplot.h"
#include "gtkpsfont.h"
#include "gtkplotcanvas.h"
@@ -41,7 +40,7 @@
static void gtk_plot_pc_class_init (GtkPlotPCClass *klass);
static void gtk_plot_pc_real_init (GtkPlotPC *pc);
-static GtkObjectClass *parent_class = NULL;
+static GtkWidgetClass *parent_class = NULL;
GType
gtk_plot_pc_get_type (void)
@@ -52,7 +51,7 @@ gtk_plot_pc_get_type (void)
{
pc_type = g_type_register_static_simple (
- gtk_object_get_type(),
+ gtk_widget_get_type(),
"GtkPlotPC",
sizeof (GtkPlotPCClass),
(GClassInitFunc) gtk_plot_pc_class_init,
@@ -66,13 +65,13 @@ gtk_plot_pc_get_type (void)
static void
gtk_plot_pc_class_init (GtkPlotPCClass *klass)
{
- parent_class = g_type_class_ref (gtk_object_get_type ());
+ parent_class = g_type_class_ref (gtk_widget_get_type ());
}
static void
gtk_plot_pc_real_init (GtkPlotPC *pc)
{
- gdk_color_black(gdk_colormap_get_system(), &pc->color);
+ gdk_rgba_parse(&pc->color, "black");
pc->width = pc->height = 0;
@@ -80,10 +79,10 @@ gtk_plot_pc_real_init (GtkPlotPC *pc)
pc->use_pixmap = TRUE;
}
-GtkObject *
+GtkWidget *
gtk_plot_pc_new (void)
{
- GtkObject *object;
+ GtkWidget *object;
object = g_object_new (gtk_plot_pc_get_type(), NULL);
@@ -103,7 +102,7 @@ gboolean gtk_plot_pc_init (GtkPlotPC *pc)
pc->init_count++;
if(pc->init_count > 1) return TRUE;
- return(GTK_PLOT_PC_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(pc)))->init(pc));
+ return(GTK_PLOT_PC_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(pc)))->init(pc));
}
/**
@@ -117,7 +116,7 @@ void gtk_plot_pc_leave (GtkPlotPC *pc)
pc->init_count--;
if(pc->init_count > 0) return;
- GTK_PLOT_PC_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(pc)))->leave(pc);
+ GTK_PLOT_PC_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(pc)))->leave(pc);
}
/**
@@ -132,7 +131,7 @@ void gtk_plot_pc_set_viewport (GtkPlotPC *pc, gdouble w, gdouble h)
{
pc->width = w;
pc->height = h;
- GTK_PLOT_PC_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(pc)))->set_viewport(pc, w, h);
+ GTK_PLOT_PC_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(pc)))->set_viewport(pc, w, h);
}
/**
@@ -143,7 +142,7 @@ void gtk_plot_pc_set_viewport (GtkPlotPC *pc, gdouble w, gdouble h)
*/
void gtk_plot_pc_gsave (GtkPlotPC *pc)
{
- GTK_PLOT_PC_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(pc)))->gsave(pc);
+ GTK_PLOT_PC_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(pc)))->gsave(pc);
}
/**
@@ -154,7 +153,7 @@ void gtk_plot_pc_gsave (GtkPlotPC *pc)
*/
void gtk_plot_pc_grestore (GtkPlotPC *pc)
{
- GTK_PLOT_PC_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(pc)))->grestore(pc);
+ GTK_PLOT_PC_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(pc)))->grestore(pc);
}
/**
@@ -167,7 +166,7 @@ void gtk_plot_pc_grestore (GtkPlotPC *pc)
void gtk_plot_pc_clip (GtkPlotPC *pc,
GdkRectangle *area)
{
- GTK_PLOT_PC_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(pc)))->clip(pc, area);
+ GTK_PLOT_PC_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(pc)))->clip(pc, area);
}
/**
@@ -182,9 +181,9 @@ void gtk_plot_pc_clip (GtkPlotPC *pc,
void gtk_plot_pc_clip_mask (GtkPlotPC *pc,
gdouble x,
gdouble y,
- GdkBitmap *mask)
+ cairo_pattern_t *mask)
{
- GTK_PLOT_PC_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(pc)))->clip_mask(pc, x, y, mask);
+ GTK_PLOT_PC_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(pc)))->clip_mask(pc, x, y, mask);
}
/**
@@ -195,10 +194,10 @@ void gtk_plot_pc_clip_mask (GtkPlotPC *pc,
*
*/
void gtk_plot_pc_set_color (GtkPlotPC *pc,
- GdkColor *color)
+ GdkRGBA *color)
{
pc->color = *color;
- GTK_PLOT_PC_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(pc)))->set_color(pc, color);
+ GTK_PLOT_PC_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(pc)))->set_color(pc, color);
}
/**
@@ -212,12 +211,12 @@ void gtk_plot_pc_set_color (GtkPlotPC *pc,
*
*/
void gtk_plot_pc_set_lineattr (GtkPlotPC *pc,
- gfloat line_width,
- GdkLineStyle line_style,
- GdkCapStyle cap_style,
- GdkJoinStyle join_style)
+ gdouble line_width,
+ guint line_style,
+ cairo_line_cap_t cap_style,
+ cairo_line_join_t join_style)
{
- GTK_PLOT_PC_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(pc)))->set_lineattr(pc, line_width, line_style,
cap_style, join_style);
+ GTK_PLOT_PC_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(pc)))->set_lineattr(pc, line_width, line_style,
cap_style, join_style);
}
/**
@@ -234,7 +233,7 @@ void gtk_plot_pc_set_dash (GtkPlotPC *pc,
gdouble *values,
gint num_values)
{
- GTK_PLOT_PC_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(pc)))->set_dash(pc, offset_, values, num_values);
+ GTK_PLOT_PC_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(pc)))->set_dash(pc, offset_, values, num_values);
}
/**
@@ -251,7 +250,7 @@ void gtk_plot_pc_draw_line (GtkPlotPC *pc,
gdouble x1, gdouble y1,
gdouble x2, gdouble y2)
{
- GTK_PLOT_PC_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(pc)))->draw_line(pc, x1, y1, x2, y2);
+ GTK_PLOT_PC_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(pc)))->draw_line(pc, x1, y1, x2, y2);
}
/**
@@ -266,7 +265,7 @@ void gtk_plot_pc_draw_lines (GtkPlotPC *pc,
gint numpoints)
{
if(!points || numpoints <= 1) return;
- GTK_PLOT_PC_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(pc)))->draw_lines(pc, points, numpoints);
+ GTK_PLOT_PC_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(pc)))->draw_lines(pc, points, numpoints);
}
/**
@@ -280,7 +279,7 @@ void gtk_plot_pc_draw_lines (GtkPlotPC *pc,
void gtk_plot_pc_draw_point (GtkPlotPC *pc,
gdouble x, gdouble y)
{
- GTK_PLOT_PC_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(pc)))->draw_point(pc, x, y);
+ GTK_PLOT_PC_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(pc)))->draw_point(pc, x, y);
}
/**
@@ -300,7 +299,7 @@ void gtk_plot_pc_draw_rectangle (GtkPlotPC *pc,
gdouble width,
gdouble height)
{
- GTK_PLOT_PC_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(pc)))->draw_rectangle(pc, filled, x, y, width, height);
+ GTK_PLOT_PC_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(pc)))->draw_rectangle(pc, filled, x, y, width, height);
}
/**
@@ -317,7 +316,7 @@ void gtk_plot_pc_draw_polygon (GtkPlotPC *pc,
gint numpoints)
{
if(!points || numpoints < 1) return;
- GTK_PLOT_PC_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(pc)))->draw_polygon(pc, filled, points, numpoints);
+ GTK_PLOT_PC_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(pc)))->draw_polygon(pc, filled, points, numpoints);
}
/**
@@ -335,7 +334,7 @@ void gtk_plot_pc_draw_circle (GtkPlotPC *pc,
gdouble x, gdouble y,
gdouble size)
{
- GTK_PLOT_PC_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(pc)))->draw_circle(pc, filled, x, y, size);
+ GTK_PLOT_PC_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(pc)))->draw_circle(pc, filled, x, y, size);
}
/**
@@ -355,7 +354,7 @@ void gtk_plot_pc_draw_ellipse (GtkPlotPC *pc,
gdouble width,
gdouble height)
{
- GTK_PLOT_PC_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(pc)))->draw_ellipse(pc, filled, x, y, width, height);
+ GTK_PLOT_PC_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(pc)))->draw_ellipse(pc, filled, x, y, width, height);
}
/**
@@ -370,7 +369,7 @@ void gtk_plot_pc_set_font (GtkPlotPC *pc,
GtkPSFont *psfont,
gint height)
{
- GTK_PLOT_PC_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(pc)))->set_font(pc, psfont, height);
+ GTK_PLOT_PC_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(pc)))->set_font(pc, psfont, height);
}
/**
@@ -396,8 +395,8 @@ void gtk_plot_pc_set_font (GtkPlotPC *pc,
void gtk_plot_pc_draw_string (GtkPlotPC *pc,
gint x, gint y,
gint angle,
- const GdkColor *fg,
- const GdkColor *bg,
+ const GdkRGBA *fg,
+ const GdkRGBA *bg,
gboolean transparent,
gint border,
gint border_space,
@@ -412,7 +411,7 @@ void gtk_plot_pc_draw_string (GtkPlotPC *pc,
if(!text) return;
if(text[0] == '\0') return;
- GTK_PLOT_PC_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(pc)))->draw_string(pc, x, y,
+ GTK_PLOT_PC_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(pc)))->draw_string(pc, x, y,
angle,
fg,
bg,
@@ -445,14 +444,14 @@ void gtk_plot_pc_draw_string (GtkPlotPC *pc,
*
*/
void gtk_plot_pc_draw_pixmap (GtkPlotPC *pc,
- GdkPixmap *pixmap,
- GdkBitmap *mask,
+ cairo_surface_t *pixmap,
+ cairo_pattern_t *mask,
gint xsrc, gint ysrc,
gint xdest, gint ydest,
gint width, gint height,
gdouble scale_x, gdouble scale_y)
{
- GTK_PLOT_PC_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(pc)))->draw_pixmap(pc,
+ GTK_PLOT_PC_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(pc)))->draw_pixmap(pc,
pixmap,
mask,
xsrc, ysrc,
diff --git a/gtkextra/gtkplotpc.h b/gtkextra/gtkplotpc.h
index 8b23ff0e..c9fe2624 100644
--- a/gtkextra/gtkplotpc.h
+++ b/gtkextra/gtkplotpc.h
@@ -91,10 +91,10 @@ struct _GtkPlotPoint
struct _GtkPlotPC
{
- GtkObject object;
+ GtkWidget object;
gdouble width, height; /* viewport */
- GdkColor color;
+ GdkRGBA color;
gint init_count;
gboolean use_pixmap;
@@ -103,7 +103,7 @@ struct _GtkPlotPC
struct _GtkPlotPCClass
{
- GtkObjectClass parent_class;
+ GtkWidgetClass parent_class;
gboolean (* init) (GtkPlotPC *pc);
@@ -121,16 +121,16 @@ struct _GtkPlotPCClass
void (* clip_mask) (GtkPlotPC *pc,
gdouble x,
gdouble y,
- const GdkBitmap *mask);
+ cairo_pattern_t *mask);
void (* set_color) (GtkPlotPC *pc,
- const GdkColor *color);
+ const GdkRGBA *color);
void (* set_lineattr) (GtkPlotPC *pc,
- gfloat line_width,
- GdkLineStyle line_style,
- GdkCapStyle cap_style,
- GdkJoinStyle join_style);
+ gdouble line_width,
+ guint line_style,
+ cairo_line_cap_t cap_style,
+ cairo_line_join_t join_style);
void (* set_dash) (GtkPlotPC *pc,
gdouble offset_,
@@ -177,8 +177,8 @@ struct _GtkPlotPCClass
void (* draw_string) (GtkPlotPC *pc,
gint x, gint y,
gint angle,
- const GdkColor *fg,
- const GdkColor *bg,
+ const GdkRGBA *fg,
+ const GdkRGBA *bg,
gboolean transparent,
gint border,
gint border_space,
@@ -190,8 +190,8 @@ struct _GtkPlotPCClass
const gchar *text);
void (* draw_pixmap) (GtkPlotPC *pc,
- GdkPixmap *pixmap,
- GdkBitmap *mask,
+ cairo_surface_t *pixmap,
+ cairo_pattern_t *mask,
gint xsrc, gint ysrc,
gint xdest, gint ydest,
gint width,
@@ -201,7 +201,7 @@ struct _GtkPlotPCClass
};
GType gtk_plot_pc_get_type (void);
-GtkObject *gtk_plot_pc_new (void);
+GtkWidget *gtk_plot_pc_new (void);
gboolean gtk_plot_pc_init (GtkPlotPC *pc);
@@ -218,16 +218,16 @@ void gtk_plot_pc_clip (GtkPlotPC *pc,
void gtk_plot_pc_clip_mask (GtkPlotPC *pc,
gdouble x,
gdouble y,
- GdkBitmap *mask);
+ cairo_pattern_t *mask);
void gtk_plot_pc_set_color (GtkPlotPC *pc,
- GdkColor *color);
+ GdkRGBA *color);
void gtk_plot_pc_set_lineattr (GtkPlotPC *pc,
- gfloat line_width,
- GdkLineStyle line_style,
- GdkCapStyle cap_style,
- GdkJoinStyle join_style);
+ gdouble line_width,
+ guint line_style,
+ cairo_line_cap_t cap_style,
+ cairo_line_join_t join_style);
void gtk_plot_pc_set_dash (GtkPlotPC *pc,
gdouble offset_,
@@ -274,8 +274,8 @@ void gtk_plot_pc_set_font (GtkPlotPC *pc,
void gtk_plot_pc_draw_string (GtkPlotPC *pc,
gint x, gint y,
gint angle,
- const GdkColor *fg,
- const GdkColor *bg,
+ const GdkRGBA *fg,
+ const GdkRGBA *bg,
gboolean transparent,
gint border,
gint border_space,
@@ -287,8 +287,8 @@ void gtk_plot_pc_draw_string (GtkPlotPC *pc,
const gchar *text);
void gtk_plot_pc_draw_pixmap (GtkPlotPC *pc,
- GdkPixmap *pixmap,
- GdkBitmap *mask,
+ cairo_surface_t *pixmap,
+ cairo_pattern_t *mask,
gint xsrc, gint ysrc,
gint xdest, gint ydest,
gint width,
diff --git a/gtkextra/gtkplotpixmap.c b/gtkextra/gtkplotpixmap.c
index a4547197..64005280 100644
--- a/gtkextra/gtkplotpixmap.c
+++ b/gtkextra/gtkplotpixmap.c
@@ -47,7 +47,7 @@ enum {
static void gtk_plot_pixmap_class_init (GtkPlotPixmapClass *klass);
static void gtk_plot_pixmap_init (GtkPlotPixmap *data);
-static void gtk_plot_pixmap_destroy (GtkObject *object);
+static void gtk_plot_pixmap_destroy (GtkWidget *object);
static void gtk_plot_pixmap_draw_symbol (GtkPlotData *data,
gdouble x,
gdouble y,
@@ -100,13 +100,13 @@ gtk_plot_pixmap_get_type (void)
static void
gtk_plot_pixmap_class_init (GtkPlotPixmapClass *klass)
{
- GtkObjectClass *object_class;
+ GtkWidgetClass *object_class;
GtkPlotDataClass *data_class;
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
parent_class = g_type_class_ref (gtk_plot_data_get_type ());
- object_class = (GtkObjectClass *) klass;
+ object_class = (GtkWidgetClass *) klass;
data_class = (GtkPlotDataClass *) klass;
data_class->clone = gtk_plot_pixmap_clone;
@@ -162,14 +162,14 @@ gtk_plot_pixmap_set_property (GObject *object,
switch(prop_id){
case ARG_PIXMAP:
- if(pixmap->pixmap) gdk_pixmap_unref(pixmap->pixmap);
- pixmap->pixmap = (GdkPixmap *)g_value_get_pointer(value);
- if(pixmap->pixmap) gdk_pixmap_ref(pixmap->pixmap);
+ if(pixmap->pixmap) cairo_surface_destroy(pixmap->pixmap);
+ pixmap->pixmap = (cairo_surface_t *)g_value_get_pointer(value);
+ if(pixmap->pixmap) cairo_surface_reference(pixmap->pixmap);
break;
case ARG_MASK:
- if(pixmap->mask) gdk_bitmap_unref(pixmap->mask);
- pixmap->mask = (GdkBitmap *)g_value_get_pointer(value);
- if(pixmap->mask) gdk_bitmap_ref(pixmap->mask);
+ if(pixmap->mask) cairo_pattern_destroy(pixmap->mask);
+ pixmap->mask = (cairo_pattern_t *)g_value_get_pointer(value);
+ if(pixmap->mask) cairo_pattern_reference(pixmap->mask);
break;
}
}
@@ -188,7 +188,7 @@ gtk_plot_pixmap_init (GtkPlotPixmap *dataset)
* Return value: a new GtkWidget.
*/
GtkWidget*
-gtk_plot_pixmap_new (GdkPixmap *pixmap, GdkBitmap *mask)
+gtk_plot_pixmap_new (cairo_surface_t *pixmap, cairo_pattern_t *mask)
{
GtkWidget *widget;
@@ -208,24 +208,24 @@ gtk_plot_pixmap_new (GdkPixmap *pixmap, GdkBitmap *mask)
*
*/
void
-gtk_plot_pixmap_construct(GtkPlotPixmap *data, GdkPixmap *pixmap, GdkBitmap *mask)
+gtk_plot_pixmap_construct(GtkPlotPixmap *data, cairo_surface_t *pixmap, cairo_pattern_t *mask)
{
data->pixmap = pixmap;
data->mask = mask;
if(pixmap)
- gdk_pixmap_ref(pixmap);
+ cairo_surface_reference(pixmap);
if(mask)
- gdk_bitmap_ref(mask);
+ cairo_pattern_reference(mask);
}
static void
-gtk_plot_pixmap_destroy(GtkObject *object)
+gtk_plot_pixmap_destroy(GtkWidget *object)
{
GtkPlotPixmap *pixmap = GTK_PLOT_PIXMAP(object);
- if(pixmap->pixmap) gdk_pixmap_unref(pixmap->pixmap);
- if(pixmap->mask) gdk_bitmap_unref(pixmap->mask);
+ if(pixmap->pixmap) cairo_surface_destroy(pixmap->pixmap);
+ if(pixmap->mask) cairo_pattern_destroy(pixmap->mask);
pixmap->pixmap = NULL;
pixmap->mask = NULL;
}
@@ -236,9 +236,9 @@ gtk_plot_pixmap_clone(GtkPlotData *data, GtkPlotData *copy)
GTK_PLOT_DATA_CLASS(parent_class)->clone(data, copy);
GTK_PLOT_PIXMAP(copy)->pixmap = GTK_PLOT_PIXMAP(data)->pixmap;
- gdk_pixmap_ref(GTK_PLOT_PIXMAP(data)->pixmap);
+ cairo_surface_reference(GTK_PLOT_PIXMAP(data)->pixmap);
GTK_PLOT_PIXMAP(copy)->mask = GTK_PLOT_PIXMAP(data)->mask;
- gdk_bitmap_ref(GTK_PLOT_PIXMAP(data)->mask);
+ cairo_pattern_reference(GTK_PLOT_PIXMAP(data)->mask);
}
static void
@@ -259,7 +259,8 @@ gtk_plot_pixmap_draw_symbol(GtkPlotData *data,
scale_x = scale_y = data->plot->magnification;;
- gdk_window_get_size(image->pixmap, &width, &height);
+ width = cairo_image_surface_get_width(image->pixmap);
+ height = cairo_image_surface_get_height(image->pixmap);
width = roundint(scale_x * width);
height = roundint(scale_y * height);
@@ -318,7 +319,8 @@ gtk_plot_pixmap_draw_legend(GtkPlotData *data, gint x, gint y)
m = plot->magnification;
legend = plot->legends_attr;
- gdk_window_get_size(pixmap->pixmap, &width, &height);
+ width = cairo_image_surface_get_width(pixmap->pixmap);
+ height = cairo_image_surface_get_height(pixmap->pixmap);
width = roundint(m * width);
height = roundint(m * height);
@@ -386,7 +388,8 @@ gtk_plot_pixmap_get_legend_size(GtkPlotData *data, gint *width, gint *height)
else
legend.text = "";
- gdk_window_get_size(pixmap->pixmap, &pwidth, &pheight);
+ pwidth = cairo_image_surface_get_width(pixmap->pixmap);
+ pheight = cairo_image_surface_get_height(pixmap->pixmap);
pwidth = roundint(m * pwidth);
pheight = roundint(m * pheight);
@@ -410,7 +413,7 @@ gtk_plot_pixmap_get_legend_size(GtkPlotData *data, gint *width, gint *height)
*
* Return value: (transfer none) the #GdkPixmap
*/
-GdkPixmap *
+cairo_surface_t *
gtk_plot_pixmap_get_pixmap (GtkPlotPixmap *pixmap)
{
return(pixmap->pixmap);
@@ -424,7 +427,7 @@ gtk_plot_pixmap_get_pixmap (GtkPlotPixmap *pixmap)
*
* Return value: (transfer none) the #GdkBitmap
*/
-GdkBitmap *
+cairo_pattern_t *
gtk_plot_pixmap_get_mask (GtkPlotPixmap *pixmap)
{
return(pixmap->mask);
diff --git a/gtkextra/gtkplotpixmap.h b/gtkextra/gtkplotpixmap.h
index 7a274a28..5d2c1ae1 100644
--- a/gtkextra/gtkplotpixmap.h
+++ b/gtkextra/gtkplotpixmap.h
@@ -44,8 +44,8 @@ struct _GtkPlotPixmap
{
GtkPlotData data;
- GdkPixmap *pixmap;
- GdkBitmap *mask;
+ cairo_surface_t *pixmap;
+ cairo_pattern_t *mask;
};
struct _GtkPlotPixmapClass
@@ -55,15 +55,15 @@ struct _GtkPlotPixmapClass
GType gtk_plot_pixmap_get_type (void);
-GtkWidget* gtk_plot_pixmap_new (GdkPixmap *pixmap,
- GdkBitmap *mask);
+GtkWidget* gtk_plot_pixmap_new (cairo_surface_t *pixmap,
+ cairo_pattern_t *mask);
void gtk_plot_pixmap_construct (GtkPlotPixmap *data,
- GdkPixmap *pixmap,
- GdkBitmap *mask);
+ cairo_surface_t *pixmap,
+ cairo_pattern_t *mask);
-GdkPixmap* gtk_plot_pixmap_get_pixmap (GtkPlotPixmap *pixmap);
-GdkBitmap* gtk_plot_pixmap_get_mask (GtkPlotPixmap *pixmap);
+cairo_surface_t* gtk_plot_pixmap_get_pixmap (GtkPlotPixmap *pixmap);
+cairo_pattern_t* gtk_plot_pixmap_get_mask (GtkPlotPixmap *pixmap);
#ifdef __cplusplus
}
diff --git a/gtkextra/gtkplotpolar.c b/gtkextra/gtkplotpolar.c
index fc9b64e4..0d2aadc6 100644
--- a/gtkextra/gtkplotpolar.c
+++ b/gtkextra/gtkplotpolar.c
@@ -271,7 +271,7 @@ gtk_plot_polar_real_paint (GtkWidget *widget)
tick_direction.x = 1.;
tick_direction.y = 0.;
- plot->left->origin.x = (gfloat)width*plot->left_align;
+ plot->left->origin.x = width*plot->left_align;
plot->left->origin.y = height;
gtk_plot_polar_draw_axis(GTK_PLOT_POLAR(plot), plot->left, tick_direction);
gtk_plot_polar_draw_labels(GTK_PLOT_POLAR(plot), plot->left, tick_direction);
@@ -287,7 +287,7 @@ gtk_plot_polar_real_paint (GtkWidget *widget)
plot->left->direction.x = 1;
plot->left->direction.y = 0;
plot->left->origin.x = 0;
- plot->left->origin.y = (gfloat)height*plot->left_align;
+ plot->left->origin.y = height*plot->left_align;
gtk_plot_polar_draw_axis(GTK_PLOT_POLAR(plot), plot->left, tick_direction);
gtk_plot_polar_draw_labels(GTK_PLOT_POLAR(plot), plot->left, tick_direction);
plot->left->direction.x = 0;
@@ -304,7 +304,7 @@ gtk_plot_polar_real_paint (GtkWidget *widget)
dataset = plot->data_sets;
while(dataset)
{
-
GTK_PLOT_DATA_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(dataset->data)))->draw_data(GTK_PLOT_DATA(dataset->data));
+
GTK_PLOT_DATA_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(dataset->data)))->draw_data(GTK_PLOT_DATA(dataset->data));
dataset = dataset->next;
}
@@ -316,7 +316,7 @@ gtk_plot_polar_real_paint (GtkWidget *widget)
text = text->next;
}
- GTK_PLOT_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(plot)))->draw_legends(widget);
+ GTK_PLOT_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(plot)))->draw_legends(widget);
gtk_plot_pc_grestore(plot->pc);
}
@@ -331,7 +331,7 @@ gtk_plot_polar_real_paint (GtkWidget *widget)
* Return value:
*/
GtkWidget*
-gtk_plot_polar_new (GdkDrawable *drawable)
+gtk_plot_polar_new (cairo_surface_t *drawable)
{
GtkWidget* plot;
@@ -353,7 +353,7 @@ gtk_plot_polar_new (GdkDrawable *drawable)
* Return value:
*/
GtkWidget*
-gtk_plot_polar_new_with_size (GdkDrawable *drawable, gdouble width, gdouble height)
+gtk_plot_polar_new_with_size (cairo_surface_t *drawable, gdouble width, gdouble height)
{
GtkWidget *plot;
@@ -372,7 +372,7 @@ gtk_plot_polar_new_with_size (GdkDrawable *drawable, gdouble width, gdouble heig
*
*/
void
-gtk_plot_polar_construct(GtkPlotPolar *plot, GdkDrawable *drawable)
+gtk_plot_polar_construct(GtkPlotPolar *plot, cairo_surface_t *drawable)
{
GTK_PLOT(plot)->drawable = drawable;
}
@@ -387,7 +387,7 @@ gtk_plot_polar_construct(GtkPlotPolar *plot, GdkDrawable *drawable)
*
*/
void
-gtk_plot_polar_construct_with_size(GtkPlotPolar *plot, GdkDrawable *drawable, gdouble width, gdouble height)
+gtk_plot_polar_construct_with_size(GtkPlotPolar *plot, cairo_surface_t *drawable, gdouble width, gdouble
height)
{
GTK_PLOT(plot)->drawable = drawable;
gtk_plot_resize (GTK_PLOT(plot), width, height);
@@ -695,7 +695,7 @@ gtk_plot_polar_draw_labels(GtkPlotPolar *polar,
}
else
{
- g_signal_emit_by_name(GTK_OBJECT(axis), "tick_label",
+ g_signal_emit_by_name(axis, "tick_label",
&x_tick, label, &veto);
if(!veto)
gtk_plot_axis_parse_label(axis, x_tick, axis->label_precision, axis->label_style, label);
@@ -811,7 +811,7 @@ gtk_plot_polar_draw_circle(GtkPlotPolar *polar)
}
else
{
- g_signal_emit_by_name(GTK_OBJECT(axis), "tick_label",
+ g_signal_emit_by_name(axis, "tick_label",
&x_tick, label, &veto);
if(!veto)
gtk_plot_axis_parse_label(axis, x_tick, axis->label_precision, axis->label_style, label);
@@ -1004,8 +1004,8 @@ gtk_plot_polar_rotate(GtkPlotPolar *polar, gdouble angle)
{
polar->rotation = angle;
- g_signal_emit_by_name(GTK_OBJECT(polar), "update", TRUE);
- g_signal_emit_by_name(GTK_OBJECT(polar), "changed");
+ g_signal_emit_by_name(polar, "update", TRUE);
+ g_signal_emit_by_name(polar, "changed");
}
/**
diff --git a/gtkextra/gtkplotpolar.h b/gtkextra/gtkplotpolar.h
index 2c958f28..d4a6d276 100644
--- a/gtkextra/gtkplotpolar.h
+++ b/gtkextra/gtkplotpolar.h
@@ -65,13 +65,13 @@ struct _GtkPlotPolarClass
/* PlotPolar */
GType gtk_plot_polar_get_type (void);
-GtkWidget* gtk_plot_polar_new (GdkDrawable *drawable);
-GtkWidget* gtk_plot_polar_new_with_size (GdkDrawable *drawable,
+GtkWidget* gtk_plot_polar_new (cairo_surface_t *drawable);
+GtkWidget* gtk_plot_polar_new_with_size (cairo_surface_t *drawable,
gdouble width, gdouble height);
void gtk_plot_polar_construct (GtkPlotPolar *plot,
- GdkDrawable *drawable);
+ cairo_surface_t *drawable);
void gtk_plot_polar_construct_with_size (GtkPlotPolar *plot,
- GdkDrawable *drawable,
+ cairo_surface_t *drawable,
gdouble width,
gdouble height);
diff --git a/gtkextra/gtkplotprint.c b/gtkextra/gtkplotprint.c
index ae1ed909..42baf94a 100644
--- a/gtkextra/gtkplotprint.c
+++ b/gtkextra/gtkplotprint.c
@@ -105,7 +105,7 @@ gtk_plot_export_ps (GtkPlot *plot,
plot->pc = pc;
plot->magnification = m;
- gtk_object_destroy(GTK_OBJECT(ps));
+ gtk_widget_destroy(GTK_WIDGET(ps));
recalc_pixels(plot);
return TRUE;
@@ -173,7 +173,7 @@ gtk_plot_export_ps_with_size (GtkPlot *plot,
plot->pc = pc;
plot->magnification = m;
recalc_pixels(plot);
- gtk_object_destroy(GTK_OBJECT(ps));
+ gtk_widget_destroy(GTK_WIDGET(ps));
return TRUE;
}
@@ -201,7 +201,7 @@ gtk_plot_canvas_export_ps (GtkPlotCanvas *canvas,
GtkPlotPS *ps;
gdouble scalex, scaley;
gdouble m;
- GdkPixmap *pixmap;
+ cairo_surface_t *pixmap;
m = canvas->magnification;
@@ -234,7 +234,7 @@ gtk_plot_canvas_export_ps (GtkPlotCanvas *canvas,
canvas->pixmap = pixmap;
canvas->pc = pc;
- gtk_object_destroy(GTK_OBJECT(ps));
+ gtk_widget_destroy(GTK_WIDGET(ps));
return TRUE;
}
@@ -266,7 +266,7 @@ gtk_plot_canvas_export_ps_with_size (GtkPlotCanvas *canvas,
GtkPlotPS *ps;
gdouble scalex, scaley;
gdouble m;
- GdkPixmap *pixmap;
+ cairo_surface_t *pixmap;
m = canvas->magnification;
@@ -302,7 +302,7 @@ gtk_plot_canvas_export_ps_with_size (GtkPlotCanvas *canvas,
canvas->pixmap = pixmap;
canvas->pc = pc;
- gtk_object_destroy(GTK_OBJECT(ps));
+ gtk_widget_destroy(GTK_WIDGET(ps));
return TRUE;
}
@@ -353,7 +353,7 @@ gboolean
gtk_plot_canvas_export_cairo (GtkPlotCanvas *canvas,
cairo_t *cairo)
{
- GdkPixmap *pixmap;
+ cairo_surface_t *pixmap;
GtkPlotPC *pc, *new_pc;
gdouble m;
diff --git a/gtkextra/gtkplotps.c b/gtkextra/gtkplotps.c
index f36dff2f..626f402c 100644
--- a/gtkextra/gtkplotps.c
+++ b/gtkextra/gtkplotps.c
@@ -51,7 +51,7 @@
static void gtk_plot_ps_class_init (GtkPlotPSClass *klass);
static void gtk_plot_ps_init (GtkPlotPS *ps);
-static void gtk_plot_ps_destroy (GtkObject *object);
+static void gtk_plot_ps_destroy (GtkWidget *object);
/*********************************************************************/
/* Postscript specific functions */
static gboolean psinit (GtkPlotPC *pc);
@@ -64,7 +64,7 @@ static void psclip (GtkPlotPC *pc,
const GdkRectangle *area);
static void psclipmask (GtkPlotPC *pc,
gdouble x, gdouble y,
- const GdkBitmap *mask);
+ cairo_pattern_t *mask);
static void psdrawlines (GtkPlotPC *pc,
GtkPlotPoint *points,
gint numpoints);
@@ -90,17 +90,17 @@ static void psdrawellipse (GtkPlotPC *pc,
gdouble x, gdouble y,
gdouble width, gdouble height);
static void pssetcolor (GtkPlotPC *pc,
- const GdkColor *color);
+ const GdkRGBA *color);
static void pssetlineattr (GtkPlotPC *pc,
- gfloat line_width,
- GdkLineStyle line_style,
- GdkCapStyle cap_style,
- GdkJoinStyle join_style);
+ gdouble line_width,
+ guint line_style,
+ cairo_line_cap_t cap_style,
+ cairo_line_join_t join_style);
static void psdrawstring (GtkPlotPC *pc,
gint x, gint y,
gint angle,
- const GdkColor *fg,
- const GdkColor *bg,
+ const GdkRGBA *fg,
+ const GdkRGBA *bg,
gboolean transparent,
gint border,
gint border_space,
@@ -118,8 +118,8 @@ static void pssetdash (GtkPlotPC *pc,
gdouble *values,
gint num_values);
static void psdrawpixmap (GtkPlotPC *pc,
- GdkPixmap *pixmap,
- GdkBitmap *mask,
+ cairo_surface_t *pixmap,
+ cairo_pattern_t *mask,
gint xsrc, gint ysrc,
gint xdest, gint ydest,
gint width, gint height,
@@ -164,12 +164,12 @@ gtk_plot_ps_init (GtkPlotPS *ps)
static void
gtk_plot_ps_class_init (GtkPlotPSClass *klass)
{
- GtkObjectClass *object_class;
+ GtkWidgetClass *object_class;
GtkPlotPCClass *pc_class;
parent_class = g_type_class_ref (gtk_plot_pc_get_type ());
- object_class = (GtkObjectClass *) klass;
+ object_class = (GtkWidgetClass *) klass;
pc_class = (GtkPlotPCClass *) klass;
pc_class->init = psinit;
@@ -197,7 +197,7 @@ gtk_plot_ps_class_init (GtkPlotPSClass *klass)
}
static void
-gtk_plot_ps_destroy(GtkObject *object)
+gtk_plot_ps_destroy(GtkWidget *object)
{
GtkPlotPS *ps;
@@ -223,7 +223,7 @@ gtk_plot_ps_destroy(GtkObject *object)
*
* Return value: a new GtkObject.
*/
-GtkObject *
+GtkWidget *
gtk_plot_ps_new (const gchar *psname,
gint orientation,
gint epsflag,
@@ -231,7 +231,7 @@ gtk_plot_ps_new (const gchar *psname,
gdouble scalex,
gdouble scaley)
{
- GtkObject *object;
+ GtkWidget *object;
GtkPlotPS *ps;
object = g_object_new(gtk_plot_ps_get_type(), NULL);
@@ -309,7 +309,7 @@ gtk_plot_ps_construct (GtkPlotPS *ps,
*
* Return value: a new GtkObject.
*/
-GtkObject *
+GtkWidget *
gtk_plot_ps_new_with_size (const gchar *psname,
gint orientation,
gint epsflag,
@@ -317,7 +317,7 @@ gtk_plot_ps_new_with_size (const gchar *psname,
gdouble width, gdouble height,
gdouble scalex, gdouble scaley)
{
- GtkObject *object;
+ GtkWidget *object;
GtkPlotPS *ps;
object = g_object_new(gtk_plot_ps_get_type(), NULL);
@@ -425,10 +425,10 @@ static void pssetviewport (GtkPlotPC *pc,
}
static void pssetlineattr (GtkPlotPC *pc,
- gfloat line_width,
- GdkLineStyle line_style,
- GdkCapStyle cap_style,
- GdkJoinStyle join_style)
+ gdouble line_width,
+ guint line_style,
+ cairo_line_cap_t cap_style,
+ cairo_line_join_t join_style)
{
FILE *psout = GTK_PLOT_PS(pc)->psfile;
@@ -701,14 +701,14 @@ static void ps_reencode_font(FILE *file, char *fontname)
"definefont pop\n", fontname, fontname);
}
-static void pssetcolor(GtkPlotPC *pc, const GdkColor *color)
+static void pssetcolor(GtkPlotPC *pc, const GdkRGBA *color)
{
FILE *psout = GTK_PLOT_PS(pc)->psfile;
fprintf(psout, "%g %g %g setrgbcolor\n",
- (gdouble) color->red / 65535.0,
- (gdouble) color->green / 65535.0,
- (gdouble) color->blue / 65535.0);
+ (gdouble) color->red,
+ (gdouble) color->green,
+ (gdouble) color->blue);
}
static void
@@ -893,8 +893,8 @@ static void
psdrawstring (GtkPlotPC *pc,
gint x, gint y,
gint angle,
- const GdkColor *fg,
- const GdkColor *bg,
+ const GdkRGBA *fg,
+ const GdkRGBA *bg,
gboolean transparent,
gint border,
gint border_space,
@@ -1285,7 +1285,7 @@ psgrestore(GtkPlotPC *pc)
}
static void
-psclipmask(GtkPlotPC *pc, gdouble x, gdouble y, const GdkBitmap *mask)
+psclipmask(GtkPlotPC *pc, gdouble x, gdouble y, cairo_pattern_t *mask)
{
FILE *psout = GTK_PLOT_PS(pc)->psfile;
gint width, height;
@@ -1293,21 +1293,29 @@ psclipmask(GtkPlotPC *pc, gdouble x, gdouble y, const GdkBitmap *mask)
gint npoints = 0;
gint i;
GtkPlotVector *points;
- GdkImage *image;
+ cairo_surface_t *surface;
+ unsigned char *rawdata;
+ guint32 *pixel;
+ int stride;
if(!mask){
fprintf(psout,"grestore\n");
return;
}
- gdk_window_get_size((GdkWindow *)mask, &width, &height);
- image = gdk_image_get((GdkWindow *)mask, 0, 0, width, height);
+ cairo_pattern_get_surface(mask, &surface);
+ cairo_surface_flush(surface);
+ width = cairo_image_surface_get_width(surface);
+ height = cairo_image_surface_get_height(surface);
+ stride = cairo_image_surface_get_stride(surface);
+ rawdata = cairo_image_surface_get_data(surface);
points = (GtkPlotVector *)g_malloc(width*height*sizeof(GtkPlotVector));
for(px = 0; px < width; px++){
for(py = 0; py < height; py++){
- if(gdk_image_get_pixel(image, px, py)){
+ pixel = (guint32 *) (rawdata + py * stride);
+ if(pixel[px] > 0){
points[npoints].x = px;
points[npoints].y = py;
npoints++;
@@ -1317,7 +1325,8 @@ psclipmask(GtkPlotPC *pc, gdouble x, gdouble y, const GdkBitmap *mask)
}
for(py = points[npoints-1].y; py < height; py++){
for(px = width - 1; px >= 0; px--){
- if(gdk_image_get_pixel(image, px, py)){
+ pixel = (guint32 *) (rawdata + py * stride);
+ if(pixel[px] > 0){
points[npoints].x = px;
points[npoints].y = py;
npoints++;
@@ -1327,7 +1336,8 @@ psclipmask(GtkPlotPC *pc, gdouble x, gdouble y, const GdkBitmap *mask)
}
for(px = points[npoints-1].x; px >= 0; px--){
for(py = height - 1; py >= 0; py--){
- if(gdk_image_get_pixel(image, px, py)){
+ pixel = (guint32 *) (rawdata + py * stride);
+ if(pixel[px] > 0){
points[npoints].x = px;
points[npoints].y = py;
npoints++;
@@ -1337,7 +1347,8 @@ psclipmask(GtkPlotPC *pc, gdouble x, gdouble y, const GdkBitmap *mask)
}
for(py = points[npoints-1].y; py >= 0; py--){
for(px = 0; px < width; px++){
- if(gdk_image_get_pixel(image, px, py)){
+ pixel = (guint32 *) (rawdata + py * stride);
+ if(pixel[px] > 0){
points[npoints].x = px;
points[npoints].y = py;
npoints++;
@@ -1358,7 +1369,6 @@ psclipmask(GtkPlotPC *pc, gdouble x, gdouble y, const GdkBitmap *mask)
fprintf(psout,"clip\n");
g_free(points);
- gdk_image_destroy(image);
}
static void
@@ -1379,27 +1389,21 @@ psclip(GtkPlotPC *pc, const GdkRectangle *clip)
static void
psdrawpixmap (GtkPlotPC *pc,
- GdkPixmap *pixmap,
- GdkBitmap *mask,
+ cairo_surface_t *pixmap,
+ cairo_pattern_t *mask,
gint xsrc, gint ysrc,
gint xdest, gint ydest,
gint width, gint height,
gdouble scale_x, gdouble scale_y)
{
FILE *psout = GTK_PLOT_PS(pc)->psfile;
- GdkColormap *colormap;
-
- colormap = gdk_colormap_get_system ();
fprintf(psout, "gsave\n");
if(pixmap){
- GdkImage *image;
+ unsigned char *rawdata;
+ int stride;
gint x, y;
- image = gdk_image_get(pixmap,
- xsrc, ysrc,
- width, height);
-
if(mask) gtk_plot_pc_clip_mask(pc, xdest, ydest, mask);
fprintf(psout, "%d %g translate\n", xdest, ydest + height * scale_y);
@@ -1409,14 +1413,20 @@ psdrawpixmap (GtkPlotPC *pc,
fprintf(psout, "{ currentfile scanline readhexstring pop } false 3\n");
fprintf(psout, "colorimage\n");
+ cairo_surface_flush(pixmap);
+ rawdata = cairo_image_surface_get_data(pixmap);
+ stride = cairo_image_surface_get_stride(pixmap);
for(y = 0; y < height; y++){
for(x = 0; x < width; x++){
GdkColor color;
+ guint32 *pixel;
gchar string[7];
- color.pixel = gdk_image_get_pixel(image, x, y);
- gdk_colormap_query_color(colormap, color.pixel, &color);
+ pixel = (guint32 *) (rawdata + y * stride);
+ color.red = pixel[x] >> 8;
+ color.green = pixel[x];
+ color.blue = pixel[x] << 8;
color_to_hex(color, string);
fprintf(psout,"%s",string);
if(fmod(x + 1, 13) == 0) fprintf(psout, "\n");
@@ -1424,7 +1434,6 @@ psdrawpixmap (GtkPlotPC *pc,
fprintf(psout,"\n");
}
- gdk_image_destroy(image);
if(mask) gtk_plot_pc_clip_mask(pc, xdest, ydest, NULL);
}
diff --git a/gtkextra/gtkplotps.h b/gtkextra/gtkplotps.h
index 7c46e005..39c879e1 100644
--- a/gtkextra/gtkplotps.h
+++ b/gtkextra/gtkplotps.h
@@ -69,14 +69,14 @@ struct _GtkPlotPSClass
};
GType gtk_plot_ps_get_type (void);
-GtkObject *gtk_plot_ps_new (const gchar *psname,
+GtkWidget *gtk_plot_ps_new (const gchar *psname,
gint orientation,
gint epsflag,
gint page_size,
gdouble scalex,
gdouble scaley);
-GtkObject *gtk_plot_ps_new_with_size (const gchar *psname,
+GtkWidget *gtk_plot_ps_new_with_size (const gchar *psname,
gint orientation,
gint epsflag,
gint units,
diff --git a/gtkextra/gtkplotsurface.c b/gtkextra/gtkplotsurface.c
index 3fbb0adc..b44b9019 100644
--- a/gtkextra/gtkplotsurface.c
+++ b/gtkextra/gtkplotsurface.c
@@ -41,7 +41,7 @@
static void gtk_plot_surface_class_init (GtkPlotSurfaceClass *klass);
static void gtk_plot_surface_init (GtkPlotSurface *data);
-static void gtk_plot_surface_destroy (GtkObject *object);
+static void gtk_plot_surface_destroy (GtkWidget *object);
static void gtk_plot_surface_get_property (GObject *object,
guint prop_id,
GValue *value,
@@ -66,8 +66,8 @@ static void gtk_plot_surface_draw_legend (GtkPlotData *data,
static void gtk_plot_surface_get_legend_size (GtkPlotData *data,
gint *width, gint *height);
static void gtk_plot_surface_draw_polygons (GtkPlotSurface *surface);
-static void gtk_plot_surface_lighting (GdkColor *a,
- GdkColor *b,
+static void gtk_plot_surface_lighting (GdkRGBA *a,
+ GdkRGBA *b,
gdouble normal,
gdouble ambient);
static void clear_polygons (GtkPlotSurface *surface);
@@ -142,14 +142,14 @@ gtk_plot_surface_get_type (void)
static void
gtk_plot_surface_class_init (GtkPlotSurfaceClass *klass)
{
- GtkObjectClass *object_class;
+ GtkWidgetClass *object_class;
GtkPlotDataClass *data_class;
GtkPlotSurfaceClass *surface_class;
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
parent_class = g_type_class_ref (gtk_plot_data_get_type ());
- object_class = (GtkObjectClass *) klass;
+ object_class = (GtkWidgetClass *) klass;
data_class = (GtkPlotDataClass *) klass;
surface_class = (GtkPlotSurfaceClass *) klass;
@@ -402,7 +402,7 @@ gtk_plot_surface_set_property (GObject *object,
data->mesh_line.line_width = g_value_get_double(value);
break;
case ARG_MESH_COLOR:
- data->mesh_line.color = *((GdkColor *)g_value_get_pointer(value));
+ data->mesh_line.color = *((GdkRGBA *)g_value_get_pointer(value));
break;
}
}
@@ -583,30 +583,21 @@ gtk_plot_surface_add_to_plot (GtkPlotData *data, GtkPlot *plot)
static void
gtk_plot_surface_init (GtkPlotSurface *dataset)
{
- GtkWidget *widget;
- GdkColormap *colormap;
- GdkColor color;
+ GdkRGBA color;
GtkPlotArray *dim;
gtk_widget_set_has_window(GTK_WIDGET(dataset), FALSE);
- widget = GTK_WIDGET(dataset);
- colormap = gtk_widget_get_colormap(widget);
-
- gdk_color_parse("black", &color);
- gdk_color_alloc(colormap, &color);
+ gdk_rgba_parse(&color, "black");
dataset->grid_foreground = color;
- gdk_color_parse("dark green", &color);
- gdk_color_alloc(colormap, &color);
+ gdk_rgba_parse(&color, "dark green");
dataset->grid_background = color;
- gdk_color_parse("gray30", &color);
- gdk_color_alloc(colormap, &color);
+ gdk_rgba_parse(&color, "gray30");
dataset->shadow = color;
- gdk_color_parse("blue", &color);
- gdk_color_alloc(colormap, &color);
+ gdk_rgba_parse(&color, "blue");
dataset->color = color;
dataset->light.x = 0.;
@@ -691,21 +682,21 @@ gtk_plot_surface_construct_function(GtkPlotSurface *surface,
*
*/
void
-gtk_plot_surface_destroy(GtkObject *object)
+gtk_plot_surface_destroy(GtkWidget *object)
{
GtkPlotSurface *surface;
surface = GTK_PLOT_SURFACE(object);
if(surface->dt){
- gtk_object_destroy(GTK_OBJECT(surface->dt));
+ gtk_widget_destroy(GTK_WIDGET(surface->dt));
surface->dt = NULL;
}
clear_polygons(surface);
- if ( GTK_OBJECT_CLASS (parent_class)->destroy )
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+ if ( GTK_WIDGET_CLASS (parent_class)->destroy )
+ (* GTK_WIDGET_CLASS (parent_class)->destroy) (object);
}
static void
@@ -774,7 +765,7 @@ gtk_plot_surface_draw_private (GtkPlotData *data)
if(data->redraw_pending) gtk_plot_surface_update_range(data);
gtk_plot_pc_gsave(plot->pc);
- GTK_PLOT_SURFACE_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(surface)))->draw_polygons(surface);
+ GTK_PLOT_SURFACE_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(surface)))->draw_polygons(surface);
gtk_plot_pc_grestore(plot->pc);
}
@@ -787,7 +778,7 @@ gtk_plot_surface_draw_polygons (GtkPlotSurface *surface)
GtkPlotDTtriangle *triangle;
gboolean visible = TRUE;
GtkPlotVector side1, side2, light, normal;
- GdkColor color, real_color;
+ GdkRGBA color, real_color;
GtkPlotVector points[3];
gdouble factor, norm;
GList *list;
@@ -1018,7 +1009,7 @@ gtk_plot_surface_draw_legend(GtkPlotData *data, gint x, gint y)
step = (data->gradient->ticks.max - data->gradient->ticks.min) / 10;
lstep = roundint(plot->legends_line_width * m / 10.);
for(level = data->gradient->ticks.min; level < data->gradient->ticks.max; level += step){
- GdkColor color;
+ GdkRGBA color;
gtk_plot_data_get_gradient_level(data, level, &color);
gtk_plot_pc_set_color(plot->pc, &color);
@@ -1041,7 +1032,7 @@ gtk_plot_surface_draw_legend(GtkPlotData *data, gint x, gint y)
}
static void
-gtk_plot_surface_lighting (GdkColor *a, GdkColor *b,
+gtk_plot_surface_lighting (GdkRGBA *a, GdkRGBA *b,
gdouble normal, gdouble ambient)
{
gdouble red, green, blue;
@@ -1134,10 +1125,6 @@ hsv_to_rgb (gdouble h, gdouble s, gdouble v,
break;
}
}
-
- *r *= 65535.;
- *g *= 65535.;
- *b *= 65535.;
}
static void
@@ -1146,10 +1133,6 @@ rgb_to_hsv (gdouble r, gdouble g, gdouble b,
{
double max, min, delta;
- r /= 65535.;
- g /= 65535.;
- b /= 65535.;
-
max = r;
if (g > max)
max = g;
@@ -1209,7 +1192,7 @@ rgb_to_hsv (gdouble r, gdouble g, gdouble b,
*/
void
gtk_plot_surface_set_color (GtkPlotSurface *data,
- GdkColor *color)
+ GdkRGBA *color)
{
data->color = *color;
}
@@ -1223,7 +1206,7 @@ gtk_plot_surface_set_color (GtkPlotSurface *data,
*/
void
gtk_plot_surface_set_shadow (GtkPlotSurface *data,
- GdkColor *color)
+ GdkRGBA *color)
{
data->shadow = *color;
}
@@ -1237,7 +1220,7 @@ gtk_plot_surface_set_shadow (GtkPlotSurface *data,
*/
void
gtk_plot_surface_set_grid_foreground (GtkPlotSurface *data,
- GdkColor *foreground)
+ GdkRGBA *foreground)
{
data->grid_foreground = *foreground;
}
@@ -1251,7 +1234,7 @@ gtk_plot_surface_set_grid_foreground (GtkPlotSurface *data,
*/
void
gtk_plot_surface_set_grid_background (GtkPlotSurface *data,
- GdkColor *background)
+ GdkRGBA *background)
{
data->grid_background = *background;
}
@@ -1906,7 +1889,7 @@ gtk_plot_surface_real_build_mesh(GtkPlotSurface *surface)
}
gtk_plot_dt_triangulate(surface->dt);
- GTK_PLOT_SURFACE_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(surface)))->build_polygons(surface);
+ GTK_PLOT_SURFACE_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(surface)))->build_polygons(surface);
gtk_plot_surface_recalc_nodes(surface);
surface->recalc_dt = FALSE;
@@ -1995,7 +1978,7 @@ gtk_plot_surface_recalc_nodes(GtkPlotSurface *surface)
list = list->next;
};
- GTK_PLOT_SURFACE_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(surface)))->sort_polygons(surface);
+ GTK_PLOT_SURFACE_CLASS(GTK_WIDGET_GET_CLASS(GTK_WIDGET(surface)))->sort_polygons(surface);
}
diff --git a/gtkextra/gtkplotsurface.h b/gtkextra/gtkplotsurface.h
index facdbafc..b6d624e0 100644
--- a/gtkextra/gtkplotsurface.h
+++ b/gtkextra/gtkplotsurface.h
@@ -63,10 +63,10 @@ struct _GtkPlotSurface
{
GtkPlotData data;
- GdkColor color;
- GdkColor shadow;
- GdkColor grid_foreground;
- GdkColor grid_background;
+ GdkRGBA color;
+ GdkRGBA shadow;
+ GdkRGBA grid_foreground;
+ GdkRGBA grid_background;
gboolean use_height_gradient;
gboolean use_amplitud;
@@ -108,13 +108,13 @@ void gtk_plot_surface_construct_function (GtkPlotSurface *surface,
GtkPlotFunc3D function);
void gtk_plot_surface_set_color (GtkPlotSurface *data,
- GdkColor *color);
+ GdkRGBA *color);
void gtk_plot_surface_set_shadow (GtkPlotSurface *data,
- GdkColor *color);
+ GdkRGBA *color);
void gtk_plot_surface_set_grid_foreground (GtkPlotSurface *data,
- GdkColor *foreground);
+ GdkRGBA *foreground);
void gtk_plot_surface_set_grid_background (GtkPlotSurface *data,
- GdkColor *background);
+ GdkRGBA *background);
void gtk_plot_surface_set_grid_visible (GtkPlotSurface *data,
gboolean visible);
gboolean gtk_plot_surface_get_grid_visible (GtkPlotSurface *data);
diff --git a/gtkextra/gtkpsfont.c b/gtkextra/gtkpsfont.c
index 69ffa2e6..51fff9c5 100644
--- a/gtkextra/gtkpsfont.c
+++ b/gtkextra/gtkpsfont.c
@@ -447,46 +447,6 @@ gtk_psfont_get_by_name(const gchar *name)
return font;
}
-/**
- * gtk_psfont_get_by_gdkfont:
- * @font: a #GtkPSFont
- * @height: font height
- *
- * Get #GdkFOnt by PS Font.
- *
- * Returns: a #GdkFont pointer.
- */
-GdkFont *
-gtk_psfont_get_gdkfont(GtkPSFont *font, gint height)
-{
- PangoFontDescription *font_desc;
- GdkFont *gdkfont;
-
- g_return_val_if_fail (font != NULL, NULL);
-
- if (height <= 0) height = 1;
-
- font_desc = gtk_psfont_get_font_description(font, height);
- gdkfont = font_desc ? gdk_font_from_description(font_desc) : NULL;
- if (font_desc)
- pango_font_description_free(font_desc);
-
- if (!gdkfont) {
- font_desc = gtk_psfont_get_font_description(find_psfont(default_font), height);
- gdkfont = font_desc ? gdk_font_from_description(font_desc) : NULL;
- if (font_desc)
- pango_font_description_free(font_desc);
-
- if (gdkfont)
- g_message ("Pango font %s %i (PS font %s) not found, using %s instead.",
- font->pango_description, height, font->fontname, default_font);
- else
- g_warning ("Error, couldn't locate default font. Shouldn't happen.");
- }
-
- return gdkfont;
-}
-
/**
* gtk_psfont_get_font_description:
* @font: a #GtkPSFont
@@ -793,51 +753,3 @@ gtk_psfont_get_families(GList **families, gint *num_families)
*families = psfont_families;
*num_families = numf;
}
-
-/* get the width, ascent and descent of a character. */
-
-/**
- * gtk_psfont_get_char_size:
- * @psfont: a #GtkPSFont
- * @font: a #GdkFont
- * @latin_font: a #GdkFont
- * @wc: a #GdkWchar
- * @width: font width
- * @ascent: font ascent
- * @descent: font descent
- *
- * Get font character size.
- */
-void
-gtk_psfont_get_char_size(GtkPSFont *psfont,
- GdkFont *font,
- GdkFont *latin_font,
- GdkWChar wc,
- gint *width,
- gint *ascent,
- gint *descent)
-{
- GdkFont *dfont;
- gint w, a, d, w0;
-
- if (psfont->i18n_latinfamily && psfont->vertical && (0 > wc || wc > 0x7f)) {
- /* vertical-writing CJK postscript fonts. */
- w = (font->ascent + font->descent);
- w0 = gdk_char_width_wc(font, wc);
- d = w0 * font->descent / w;
- a = w0 - d;
- } else {
- if (psfont->i18n_latinfamily && 0 <= wc && wc <= 0x7f)
- dfont = latin_font;
- else
- dfont = font;
- w = gdk_char_width_wc(dfont, wc);
- a = dfont->ascent;
- d = dfont->descent;
- }
-
- if (width != NULL) *width = w;
- if (ascent != NULL) *ascent = a;
- if (descent != NULL) *descent = d;
-}
-
diff --git a/gtkextra/gtkpsfont.h b/gtkextra/gtkpsfont.h
index e00fb401..e4ff943e 100644
--- a/gtkextra/gtkpsfont.h
+++ b/gtkextra/gtkpsfont.h
@@ -98,7 +98,6 @@ GtkPSFont* gtk_psfont_get_by_name (const gchar *name);
GtkPSFont* gtk_psfont_get_by_family (const gchar *family_name,
gboolean italic,
gboolean bold);
-GdkFont* gtk_psfont_get_gdkfont (GtkPSFont *font, gint height);
PangoFontDescription* gtk_psfont_get_font_description (GtkPSFont *font,
gint height);
const gchar * gtk_psfont_get_psfontname (GtkPSFont *psfont);
@@ -117,13 +116,6 @@ void gtk_psfont_add_i18n_font (const char *fontname,
gboolean bold,
gboolean vertical);
void gtk_psfont_get_families (GList **families, gint *num_families);
-void gtk_psfont_get_char_size (GtkPSFont *psfont,
- GdkFont *font,
- GdkFont *latin_font,
- GdkWChar wc,
- gint *width,
- gint *ascent,
- gint *descent);
#ifdef __cplusplus
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 75d234aa..4a00aa68 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -36,4 +36,5 @@ src/plugin.c
src/symbolic.c
src/testplugin.c
src/util.c
+ve/ve-miscui.c
ve/ve-nongnome.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 9290a4aa..8408becd 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -18,11 +18,9 @@ AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/ve \
-I$(top_srcdir)/gtkextra \
- -I$(top_srcdir)/vte/src \
-I$(top_builddir) \
-I$(top_builddir)/ve \
-I$(top_builddir)/gtkextra \
- -I$(top_builddir)/vte/src \
$(WARN_CFLAGS) \
$(VTE_CFLAGS) \
$(BINRELOC_CFLAGS) \
@@ -98,7 +96,6 @@ gnome_genius_SOURCES = \
gnome_genius_LDADD = \
$(top_builddir)/ve/libviciousui.a \
$(top_builddir)/gtkextra/libgtkextra-genius.a \
- $(top_builddir)/vte/src/libvte.a \
-lm \
@GMP_LIB@ \
-lmpfr \
diff --git a/src/genius.lang b/src/genius.lang
index caace09c..75f35e8a 100644
--- a/src/genius.lang
+++ b/src/genius.lang
@@ -1,67 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE language SYSTEM "language.dtd">
-<language _name="Genius" version="1.0" _section="Scripts" mimetypes="text/x-genius">
-
- <escape-char>\</escape-char>
+<language id="genius" _name="Genius" version="2.0" _section="Script">
- <string _name = "String" style = "String" end-at-line-end = "TRUE">
- <start-regex>"</start-regex>
- <end-regex>"</end-regex>
- </string>
+<metadata>
+ <property name="mimetypes">text/x-genius</property>
+ <property name="globs">*.gel</property>
+</metadata>
- <line-comment _name = "Line Comment" style= "Comment">
- <start-regex>#</start-regex>
- </line-comment>
+<styles>
+ <style id="escaped-character" name="Escaped Character" map-to="def:special-char"/>
+ <style id="comment" name="Line Comment" map-to="def:comment"/>
+ <style id="keyword" name="Keyword" map-to="def:keyword"/>
+ <style id="command" name="Command" map-to="def:function"/>
+ <style id="string" name="String" map-to="def:string"/>
+</styles>
- <pattern-item _name = "Base-N Integers" style = "Base-N Integer">
- <regex>\b(([1-3][0-9]|[1-9])\\[0-9a-zA-Z]+|0x[0-9a-fA-F]+|0[0-7]+)\b</regex>
- </pattern-item>
+<definitions>
+ <context id="genius">
+ <include>
+ <context id="string" end-at-line-end="true" style-ref="string">
+ <start>"</start>
+ <end>"</end>
+ <include>
+ <context id="escape" style-ref="escaped-character">
+ <match>\\</match>
+ </context>
+ </include>
+ </context>
- <pattern-item _name = "Decimal Integers" style = "Decimal">
- <regex>\b([1-9][0-9]*|0)\b</regex>
- </pattern-item>
+ <context id="comment" style-ref="comment">
+ <start>#</start>
+ <end>$</end>
+ </context>
- <pattern-item _name = "Floats" style = "Floating Point">
- <regex>\b([0-9]*\.[0-9]+[eE@][-+]?[0-9]+|[0-9]+[eE@][-+]?[0-9]+|[0-9]*\.[0-9]+)\b</regex>
- </pattern-item>
+ <context ref="def:decimal"/>
+ <context ref="def:float"/>
- <keyword-list _name = "Commands" style = "Others" case-sensitive="TRUE"
- beginning-regex = "^">
- <keyword>load</keyword>
- <keyword>plugin</keyword>
- <keyword>cd</keyword>
- <keyword>ls</keyword>
- <keyword>pwd</keyword>
- <keyword>help</keyword>
- </keyword-list>
-
- <keyword-list _name = "Keywords" style = "Keyword" case-sensitive="TRUE">
- <keyword>not</keyword>
- <keyword>and</keyword>
- <keyword>xor</keyword>
- <keyword>or</keyword>
- <keyword>while</keyword>
- <keyword>until</keyword>
- <keyword>for</keyword>
- <keyword>sum</keyword>
- <keyword>prod</keyword>
- <keyword>do</keyword>
- <keyword>to</keyword>
- <keyword>by</keyword>
- <keyword>in</keyword>
- <keyword>if</keyword>
- <keyword>then</keyword>
- <keyword>else</keyword>
- <keyword>function</keyword>
- <keyword>parameter</keyword>
- <keyword>call</keyword>
- <keyword>return</keyword>
- <keyword>bailout</keyword>
- <keyword>exception</keyword>
- <keyword>continue</keyword>
- <keyword>break</keyword>
- <keyword>mod</keyword>
- <keyword>null</keyword>
- </keyword-list>
+ <context id="command" style-ref="command">
+ <prefix>^</prefix>
+ <keyword>load</keyword>
+ <keyword>plugin</keyword>
+ <keyword>cd</keyword>
+ <keyword>ls</keyword>
+ <keyword>pwd</keyword>
+ <keyword>help</keyword>
+ </context>
+ <context id="keyword" style-ref="keyword">
+ <keyword>not</keyword>
+ <keyword>and</keyword>
+ <keyword>xor</keyword>
+ <keyword>or</keyword>
+ <keyword>while</keyword>
+ <keyword>until</keyword>
+ <keyword>for</keyword>
+ <keyword>sum</keyword>
+ <keyword>prod</keyword>
+ <keyword>do</keyword>
+ <keyword>to</keyword>
+ <keyword>by</keyword>
+ <keyword>in</keyword>
+ <keyword>if</keyword>
+ <keyword>then</keyword>
+ <keyword>else</keyword>
+ <keyword>function</keyword>
+ <keyword>parameter</keyword>
+ <keyword>call</keyword>
+ <keyword>return</keyword>
+ <keyword>bailout</keyword>
+ <keyword>exception</keyword>
+ <keyword>continue</keyword>
+ <keyword>break</keyword>
+ <keyword>mod</keyword>
+ <keyword>null</keyword>
+ </context>
+ </include>
+ </context>
+</definitions>
</language>
diff --git a/src/gnome-genius.c b/src/gnome-genius.c
index 04860c4b..6432c17b 100644
--- a/src/gnome-genius.c
+++ b/src/gnome-genius.c
@@ -21,11 +21,9 @@
#include "config.h"
-#include <gdk/gdk.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtk.h>
+#include <amtk/amtk.h>
-#include "vte.h"
+#include <vte/vte.h>
#include <string.h>
#include <unistd.h>
@@ -60,14 +58,7 @@
#include <readline/history.h>
#ifdef HAVE_GTKSOURCEVIEW
-#include <gtksourceview/gtksourceview.h>
-#include <gtksourceview/gtksourcelanguage.h>
-#ifdef HAVE_GTKSOURCEVIEW2
-#include <gtksourceview/gtksourcelanguagemanager.h>
-#else
-#include <gtksourceview/gtksourcelanguagesmanager.h>
-#include <gtksourceview/gtksourceprintjob.h>
-#endif
+#include <gtksourceview/gtksource.h>
#endif
#include <gio/gio.h>
@@ -112,7 +103,9 @@ extern const char *genius_toplevels[];
GtkWidget *genius_window = NULL;
GtkWidget *genius_window_statusbar = NULL;
-GtkUIManager *genius_ui = NULL;
+GtkWidget *example_menu;
+GtkWidget *plugin_menu;
+GtkWidget *prog_menu;
int gel_calc_running = 0;
@@ -169,26 +162,26 @@ enum {
};
#define TERMINAL_PALETTE_SIZE 16
-const GdkColor
+const GdkRGBA
terminal_palette_black_on_white[TERMINAL_PALETTE_SIZE] =
{
- { 0, 0x0000, 0x0000, 0x0000 },
- { 0, 0xaaaa, 0x0000, 0x0000 },
- { 0, 0x0000, 0x8888, 0x0000 },
- { 0, 0xaaaa, 0x5555, 0x0000 },
- { 0, 0x0000, 0x0000, 0xaaaa },
- { 0, 0xaaaa, 0x0000, 0xaaaa },
- { 0, 0x0000, 0xaaaa, 0xaaaa },
- { 0, 0xaaaa, 0xaaaa, 0xaaaa },
-
- { 0, 0x0000, 0x0000, 0x0000 },
- { 0, 0xaaaa, 0x0000, 0x0000 },
- { 0, 0x0000, 0x8888, 0x0000 },
- { 0, 0xaaaa, 0x5555, 0x0000 },
- { 0, 0x0000, 0x0000, 0xaaaa },
- { 0, 0xaaaa, 0x0000, 0xaaaa },
- { 0, 0x0000, 0x8888, 0xaaaa },
- { 0, 0xaaaa, 0xaaaa, 0xaaaa },
+ { 0, 0, 0, 1 },
+ { 0.666, 0, 0, 1 },
+ { 0, 0.533, 0, 1 },
+ { 0.666, 0.333, 0, 1 },
+ { 0, 0, 0.666, 1 },
+ { 0.666, 0, 0.666, 1 },
+ { 0, 0.666, 0.666, 1 },
+ { 0.666, 0.666, 0.666, 1 },
+
+ { 0, 0, 0, 1 },
+ { 0.666, 0, 0, 1 },
+ { 0, 0.533, 0, 1 },
+ { 0.666, 0.333, 0, 1 },
+ { 0, 0, 0.666, 1 },
+ { 0.666, 0, 0.666, 1 },
+ { 0, 0.533, 0.666, 1 },
+ { 0.666, 0.666, 0.666, 1 },
};
static GtkTargetEntry drag_types[] = {
@@ -212,44 +205,45 @@ static char *fromrlfifo = NULL;
static char *arg0 = NULL;
-static void new_callback (GtkWidget *menu_item, gpointer data);
-static void open_callback (GtkWidget *w);
-static void save_callback (GtkWidget *w);
-static void save_all_cb (GtkWidget *w);
-static void save_console_cb (GtkWidget *w);
-static void save_as_callback (GtkWidget *w);
-static void close_callback (GtkWidget *menu_item, gpointer data);
-static void load_cb (GtkWidget *w);
-static void reload_cb (GtkWidget *w);
-static void quitapp (GtkWidget * widget, gpointer data);
+static void new_callback (GSimpleAction *a, GVariant *param, gpointer data);
+static void open_callback (GSimpleAction *a, GVariant *param, gpointer data);
+static void save_callback (GSimpleAction *a, GVariant *param, gpointer data);
+static void save_all_cb (GSimpleAction *a, GVariant *param, gpointer data);
+static void save_console_cb (GSimpleAction *a, GVariant *param, gpointer data);
+static void save_as_callback (GSimpleAction *a, GVariant *param, gpointer data);
+static void close_callback (GSimpleAction *a, GVariant *param, gpointer data);
+static void load_cb (GSimpleAction *a, GVariant *param, gpointer data);
+static void reload_cb (GSimpleAction *a, GVariant *param, gpointer data);
+static void quitapp (GSimpleAction *a, GVariant *param, gpointer data);
#ifdef HAVE_GTKSOURCEVIEW
static void setup_undo_redo (void);
-static void undo_callback (GtkWidget *menu_item, gpointer data);
-static void redo_callback (GtkWidget *menu_item, gpointer data);
+static void undo_callback (GSimpleAction *a, GVariant *param, gpointer data);
+static void redo_callback (GSimpleAction *a, GVariant *param, gpointer data);
#endif
-static void cut_callback (GtkWidget *menu_item, gpointer data);
-static void copy_callback (GtkWidget *menu_item, gpointer data);
-static void paste_callback (GtkWidget *menu_item, gpointer data);
+static void cut_callback (GSimpleAction *a, GVariant *param, gpointer data);
+static void copy_callback (GSimpleAction *a, GVariant *param, gpointer data);
+static void paste_callback (GSimpleAction *a, GVariant *param, gpointer data);
static void clear_cb (GtkClipboard *clipboard, gpointer owner);
static void copy_cb (GtkClipboard *clipboard, GtkSelectionData *data,
guint info, gpointer owner);
static void copy_answer (void);
-static void copy_as_plain (GtkWidget *menu_item, gpointer data);
-static void copy_as_latex (GtkWidget *menu_item, gpointer data);
-static void copy_as_troff (GtkWidget *menu_item, gpointer data);
-static void copy_as_mathml (GtkWidget *menu_item, gpointer data);
-static void next_tab (GtkWidget *menu_item, gpointer data);
-static void prev_tab (GtkWidget *menu_item, gpointer data);
+static void copy_as_plain (GSimpleAction *a, GVariant *param, gpointer data);
+static void copy_as_latex (GSimpleAction *a, GVariant *param, gpointer data);
+static void copy_as_troff (GSimpleAction *a, GVariant *param, gpointer data);
+static void copy_as_mathml (GSimpleAction *a, GVariant *param, gpointer data);
+static void next_tab (GSimpleAction *a, GVariant *param, gpointer data);
+static void prev_tab (GSimpleAction *a, GVariant *param, gpointer data);
+static void show_console (GSimpleAction *a, GVariant *param, gpointer data);
static void prog_menu_activated (GtkWidget *item, gpointer data);
-static void setup_calc (GtkWidget *widget, gpointer data);
-static void run_program (GtkWidget *menu_item, gpointer data);
-static void show_user_vars (GtkWidget *menu_item, gpointer data);
-static void monitor_user_var (GtkWidget *menu_item, gpointer data);
-static void full_answer (GtkWidget *menu_item, gpointer data);
-static void warranty_call (GtkWidget *widget, gpointer data);
-static void aboutcb (GtkWidget * widget, gpointer data);
-static void help_cb (GtkWidget *menuitem, gpointer data);
-static void help_on_function (GtkWidget *menuitem, gpointer data);
+static void setup_calc (GSimpleAction *a, GVariant *param, gpointer data);
+static void run_program (GSimpleAction *a, GVariant *param, gpointer data);
+static void show_user_vars (GSimpleAction *a, GVariant *param, gpointer data);
+static void monitor_user_var (GSimpleAction *a, GVariant *param, gpointer data);
+static void full_answer (GSimpleAction *a, GVariant *param, gpointer data);
+static void warranty_call (GSimpleAction *a, GVariant *param, gpointer data);
+static void aboutcb (GSimpleAction *a, GVariant *param, gpointer data);
+static void help_cb (GSimpleAction *a, GVariant *param, gpointer data);
+static void help_on_function (GSimpleAction *a, GVariant *param, gpointer data);
static void executing_warning (void);
static void display_warning (GtkWidget *parent, const char *warn);
@@ -260,304 +254,100 @@ static void fork_helper_setup_comm (void);
static void new_program (const char *filename,
gboolean example);
-static GtkActionEntry entries[] = {
- { "FileMenu", NULL, N_("_File") }, /* name, stock id, label */
- { "EditMenu", NULL, N_("_Edit") }, /* name, stock id, label */
- { "CalculatorMenu", NULL, N_("_Calculator") }, /* name, stock id, label */
- { "PluginsMenu", NULL, N_("P_lugins") }, /* name, stock id, label */
- { "ExamplesMenu", NULL, N_("E_xamples") }, /* name, stock id, label */
- { "ProgramsMenu", NULL, N_("_Programs") }, /* name, stock id, label */
- { "SettingsMenu", NULL, N_("_Settings") }, /* name, stock id, label */
- { "HelpMenu", NULL, N_("_Help") }, /* name, stock id, label */
- { "New", GTK_STOCK_NEW, /* name, stock id */
- N_("_New Program"), "<control>N", /* label, accelerator */
- N_("Create new program tab"), /* tooltip */
- G_CALLBACK (new_callback) },
- { "ToolbarNew", GTK_STOCK_NEW,
- N_("New"), "",
- N_("Create new program tab"),
- G_CALLBACK (new_callback) },
- { "Open", GTK_STOCK_OPEN, /* name, stock id */
- N_("_Open..."), "<control>O", /* label, accelerator */
- N_("Open a file"), /* tooltip */
- G_CALLBACK (open_callback) },
- { "ToolbarOpen", GTK_STOCK_OPEN,
- N_("Open"), "",
- N_("Open a file"),
- G_CALLBACK (open_callback) },
- { "OpenRecent", NULL, N_("Open R_ecent") }, /* name, stock id, label */
- { "Save", GTK_STOCK_SAVE, /* name, stock id */
- N_("_Save"), "<control>S", /* label, accelerator */
- N_("Save current file"), /* tooltip */
- G_CALLBACK (save_callback) },
- { "SaveAll", GTK_STOCK_SAVE,
- N_("Save All _Unsaved"), "",
- N_("Save all unsaved programs"),
- G_CALLBACK (save_all_cb) },
- { "SaveAs", GTK_STOCK_SAVE,
- N_("Save _As..."), "<shift><control>S",
- N_("Save to a file"),
- G_CALLBACK (save_as_callback) },
- { "Reload", GTK_STOCK_REVERT_TO_SAVED,
- N_("_Reload from Disk"), "",
- N_("Reload the selected program from disk"),
- G_CALLBACK (reload_cb) },
- { "Close", GTK_STOCK_CLOSE,
- N_("_Close"), "<control>W",
- N_("Close the current file"),
- G_CALLBACK (close_callback) },
- { "LoadRun", GTK_STOCK_OPEN,
- N_("_Load and Run..."), "",
- N_("Load and execute a file in genius"),
- G_CALLBACK (load_cb) },
- { "SaveConsoleOutput", GTK_STOCK_SAVE,
- N_("Save Console Ou_tput..."), "",
- N_("Save what is visible on the console (including scrollback) to a text file"),
- G_CALLBACK (save_console_cb) },
- { "Quit", GTK_STOCK_QUIT,
- N_("_Quit"), "<control>Q",
- N_("Quit"),
- G_CALLBACK (quitapp) },
-#ifdef HAVE_GTKSOURCEVIEW
- { "Undo", GTK_STOCK_UNDO,
- N_("_Undo"), "<control>Z",
- N_("Undo the last action"),
- G_CALLBACK (undo_callback) },
- { "Redo", GTK_STOCK_REDO,
- N_("_Redo"), "<shift><control>Z",
- N_("Redo the undone action"),
- G_CALLBACK (redo_callback) },
-#endif
- { "Cut", GTK_STOCK_CUT,
- N_("Cu_t"), "<control>X",
- N_("Cut the selection"),
- G_CALLBACK (cut_callback) },
- { "Copy", GTK_STOCK_COPY,
- N_("_Copy"), "<control>C",
- N_("Copy the selection"),
- G_CALLBACK (copy_callback) },
- { "Paste", GTK_STOCK_PASTE,
- N_("_Paste"), "<control>V",
- N_("Paste the clipboard"),
- G_CALLBACK (paste_callback) },
- { "CopyPlain", GTK_STOCK_COPY,
- N_("Copy Answer As Plain Te_xt"), "",
- N_("Copy last answer into the clipboard in plain text"),
- G_CALLBACK (copy_as_plain) },
- { "CopyLaTeX", GTK_STOCK_COPY,
- N_("Copy Answer As _LaTeX"), "",
- N_("Copy last answer into the clipboard as LaTeX"),
- G_CALLBACK (copy_as_latex) },
- { "CopyMathML", GTK_STOCK_COPY,
- N_("Copy Answer As _MathML"), "",
- N_("Copy last answer into the clipboard as MathML"),
- G_CALLBACK (copy_as_mathml) },
- { "CopyTroff", GTK_STOCK_COPY,
- N_("Copy Answer As T_roff"), "",
- N_("Copy last answer into the clipboard as Troff eqn"),
- G_CALLBACK (copy_as_troff) },
- { "Run", GTK_STOCK_EXECUTE,
- N_("_Run"), "<control>R",
- N_("Run current program"),
- G_CALLBACK (run_program) },
- { "Interrupt", GTK_STOCK_STOP,
- N_("_Interrupt"), "<control>I",
- N_("Interrupt current calculation"),
- G_CALLBACK (genius_interrupt_calc) },
- { "ShowFullAnswer", GTK_STOCK_DIALOG_INFO,
- N_("Show _Full Answer"), "",
- N_("Show the full text of last answer"),
- G_CALLBACK (full_answer) },
- { "ShowUserVariables", GTK_STOCK_DIALOG_INFO,
- N_("Show User _Variables"), "",
- N_("Show the current value of all user variables"),
- G_CALLBACK (show_user_vars) },
- { "MonitorVariable", GTK_STOCK_DIALOG_INFO,
- N_("_Monitor a Variable"), "",
- N_("Monitor a variable continuously"),
- G_CALLBACK (monitor_user_var) },
- { "Plot", "genius-stock-plot",
- N_("_Plot..."), "",
- N_("Plot functions, vector fields, surfaces, etc..."),
- G_CALLBACK (genius_plot_dialog) },
- { "ToolbarPlot", "genius-stock-plot",
- N_("_Plot"), "",
- N_("Plot functions, vector fields, surfaces, etc..."),
- G_CALLBACK (genius_plot_dialog) },
- { "NextTab", GTK_STOCK_GO_FORWARD,
- N_("_Next Tab"), "<control>Page_Down",
- N_("Go to next tab"),
- G_CALLBACK (next_tab) },
- { "PreviousTab", GTK_STOCK_GO_BACK,
- N_("_Previous Tab"), "<control>Page_Up",
- N_("Go to previous tab"),
- G_CALLBACK (prev_tab) },
- { "Console", NULL,
- N_("_Console"), "",
- N_("Go to the console tab"),
- G_CALLBACK (prog_menu_activated) },
- { "Preferences", GTK_STOCK_PREFERENCES,
- N_("_Preferences"), "",
- N_("Configure Genius"),
- G_CALLBACK (setup_calc) },
- { "Contents", GTK_STOCK_HELP,
- N_("_Contents"), "F1",
- N_("View the Genius manual"),
- G_CALLBACK (help_cb) },
- { "HelpOnFunction", GTK_STOCK_HELP,
- N_("_Help on Function"), "",
- N_("Help on a function or a command"),
- G_CALLBACK (help_on_function) },
- { "Warranty", GTK_STOCK_HELP,
- N_("_Warranty"), "",
- N_("Display warranty information"),
- G_CALLBACK (warranty_call) },
- { "About", GTK_STOCK_ABOUT,
- N_("_About"), "",
- N_("About Genius"),
- G_CALLBACK (aboutcb) },
- /* Kind of a placeholder for empty menu,
- * FIXME: probably a bad hack */
- { "NoPlugin", NULL,
- "No Plugins", "",
- "No Plugins",
- NULL },
- /* Kind of a placeholder for empty menu,
- * FIXME: probably a bad hack */
- { "NoExample", NULL,
- "No Examples", "",
- "No Examples",
- NULL },
+static AmtkActionInfoStore *info_store = NULL;
+
+static const AmtkActionInfoEntry file_entries[] = {
+ { "app.new", "document-new", N_("_New Program"),
+ "<Control>n", N_("Create new program tab") },
+ { "app.open", "document-open", N_("_Open..."),
+ "<Control>o", N_("Open a file") },
+ { "app.save", "document-save", N_("_Save"),
+ "<Control>s", N_("Save current file") },
+ { "app.save-all", "document-save", N_("Save All _Unsaved"),
+ NULL, N_("Save all unsaved programs") },
+ { "app.save-as", "document-save", N_("Save _As..."),
+ "<Shift><Control>s", N_("Save to a file") },
+ { "app.reload", "document-revert", N_("_Reload from Disk"),
+ NULL, N_("Reload the selected program from disk") },
+ { "app.close", "window-close", N_("_Close"),
+ "<Control>w", N_("Close the current file") },
+ { "app.load-run", "document-open", N_("_Load and Run..."),
+ NULL, N_("Load and execute a file in genius") },
+ { "app.save-console", "document-save", N_("Save Console Ou_tput..."),
+ NULL, N_("Save what is visible on the console "
+ "(including scrollback) to a text file") },
+ { "app.quit", "application-exit", N_("_Quit"),
+ "<Control>q", N_("Quit") },
+ { NULL }
};
-static guint n_entries = G_N_ELEMENTS (entries);
-
-static const gchar *ui_info =
-"<ui>"
-" <menubar name='MenuBar'>"
-" <menu action='FileMenu'>"
-" <menuitem action='New'/>"
-" <menuitem action='Open'/>"
-" <menuitem action='OpenRecent'/>"
-" <menuitem action='Save'/>"
-" <menuitem action='SaveAll'/>"
-" <menuitem action='SaveAs'/>"
-" <menuitem action='Reload'/>"
-" <menuitem action='Close'/>"
-" <separator/>"
-" <menuitem action='LoadRun'/>"
-" <separator/>"
-" <menuitem action='SaveConsoleOutput'/>"
-" <separator/>"
-" <menuitem action='Quit'/>"
-" </menu>"
-" <menu action='EditMenu'>"
+
+static const AmtkActionInfoEntry edit_entries[] = {
#ifdef HAVE_GTKSOURCEVIEW
-" <menuitem action='Undo'/>"
-" <menuitem action='Redo'/>"
-" <separator/>"
+ { "app.undo", "edit-undo", N_("_Undo"),
+ "<Control>z", N_("Undo the last action") },
+ { "app.redo", "edit-redo", N_("_Redo"),
+ "<Shift><Control>z", N_("Redo the undone action") },
#endif
-" <menuitem action='Cut'/>"
-" <menuitem action='Copy'/>"
-" <menuitem action='Paste'/>"
-" <separator/>"
-" <menuitem action='CopyPlain'/>"
-" <menuitem action='CopyLaTeX'/>"
-" <menuitem action='CopyMathML'/>"
-" <menuitem action='CopyTroff'/>"
-" </menu>"
-" <menu action='CalculatorMenu'>"
-" <menuitem action='Run'/>"
-" <menuitem action='Interrupt'/>"
-" <separator/>"
-" <menuitem action='ShowFullAnswer'/>"
-" <menuitem action='ShowUserVariables'/>"
-" <menuitem action='MonitorVariable'/>"
-" <separator/>"
-" <menuitem action='Plot'/>"
-" </menu>"
-" <menu action='ExamplesMenu'>"
-" <menuitem action='NoExample'/>"
-" </menu>"
-" <menu action='PluginsMenu'>"
-" <menuitem action='NoPlugin'/>"
-" </menu>"
-" <menu action='ProgramsMenu'>"
-" <menuitem action='NextTab'/>"
-" <menuitem action='PreviousTab'/>"
-" <separator/>"
-" <menuitem action='Console'/>"
-" </menu>"
-" <menu action='SettingsMenu'>"
-" <menuitem action='Preferences'/>"
-" </menu>"
-" <menu action='HelpMenu'>"
-" <menuitem action='Contents'/>"
-" <menuitem action='HelpOnFunction'/>"
-" <menuitem action='Warranty'/>"
-" <menuitem action='About'/>"
-" </menu>"
-" </menubar>"
-" <toolbar name='ToolBar'>"
-" <toolitem action='Interrupt'/>"
-" <toolitem action='Run'/>"
-" <toolitem action='ToolbarNew'/>"
-" <toolitem action='ToolbarOpen'/>"
-" <toolitem action='ToolbarPlot'/>"
-" <toolitem action='Quit'/>"
-" </toolbar>"
-"</ui>";
-
-static void
-menu_item_select_cb (GtkMenuItem *proxy, gpointer data)
-{
- GtkAction *action;
- char *message;
-
- action = gtk_activatable_get_related_action (GTK_ACTIVATABLE (proxy));
- g_return_if_fail (action != NULL);
-
- g_object_get (G_OBJECT (action), "tooltip", &message, NULL);
- if (message) {
- gtk_statusbar_push (GTK_STATUSBAR (data), 0 /* context */,
- message);
- g_free (message);
- }
-}
+ { "app.cut", "edit-cut", N_("Cu_t"),
+ "<Control>x", N_("Cut the selection") },
+ { "app.copy", "edit-copy", N_("_Copy"),
+ "<Control>c", N_("Copy the selection") },
+ { "app.paste", "edit-paste", N_("_Paste"),
+ "<Control>v", N_("Paste the clipboard") },
+ { "app.copy-plain", "edit-copy", N_("Copy Answer As Plain Te_xt"),
+ NULL, N_("Copy last answer into the clipboard in plain text") },
+ { "app.copy-latex", "edit-copy", N_("Copy Answer As _LaTeX"),
+ NULL, N_("Copy last answer into the clipboard as LaTeX") },
+ { "app.copy-mathml", "edit-copy", N_("Copy Answer As _MathML"),
+ NULL, N_("Copy last answer into the clipboard as MathML") },
+ { "app.copy-troff", "edit-copy", N_("Copy Answer As T_roff"),
+ NULL, N_("Copy last answer into the clipboard as Troff eqn") },
+ { NULL }
+};
-static void
-menu_item_deselect_cb (GtkMenuItem *proxy, gpointer data)
-{
- gtk_statusbar_pop (GTK_STATUSBAR (data), 0 /* context */);
-}
+static const AmtkActionInfoEntry calc_entries[] = {
+ { "app.run", "system-run", N_("_Run"),
+ "<Control>r", N_("Run current program") },
+ { "app.stop", "process-stop", N_("_Interrupt"),
+ "<Control>i", N_("Interrupt current calculation") },
+ { "app.answer", "dialog-information", N_("Show _Full Answer"),
+ NULL, N_("Show the full text of last answer") },
+ { "app.vars", "dialog-information", N_("Show User _Variables"),
+ NULL, N_("Show the current value of all user variables") },
+ { "app.monitor", "dialog-information", N_("_Monitor a Variable"),
+ NULL, N_("Monitor a variable continuously") },
+ { "app.plot", "genius-stock-plot", N_("_Plot..."),
+ NULL, N_("Plot functions, vector fields, surfaces, etc...") },
+ { NULL }
+};
-static void
-disconnect_proxy_cb (GtkUIManager *manager,
- GtkAction *action,
- GtkWidget *proxy,
- gpointer data)
-{
- if (GTK_IS_MENU_ITEM (proxy)) {
- g_signal_handlers_disconnect_by_func
- (proxy, G_CALLBACK (menu_item_select_cb), data);
- g_signal_handlers_disconnect_by_func
- (proxy, G_CALLBACK (menu_item_deselect_cb), data);
- }
-}
+static const AmtkActionInfoEntry prog_entries[] = {
+ { "app.next", "go-next", N_("_Next Tab"),
+ "<Control>Page_Down", N_("Go to next tab") },
+ { "app.previous", "go-previous", N_("_Previous Tab"),
+ "<Control>Page_Up", N_("Go to previous tab") },
+ { "app.console", NULL, N_("_Console"),
+ NULL, N_("Go to the console tab") },
+ { NULL }
+};
+static const AmtkActionInfoEntry pref_entries[] = {
+ { "app.prefs", "preferences-system", N_("_Preferences"),
+ NULL, N_("Configure Genius") },
+ { NULL }
+};
-static void
-connect_proxy_cb (GtkUIManager *manager,
- GtkAction *action,
- GtkWidget *proxy,
- gpointer data)
-{
- if (GTK_IS_MENU_ITEM (proxy)) {
- g_signal_connect (proxy, "select",
- G_CALLBACK (menu_item_select_cb), data);
- g_signal_connect (proxy, "deselect",
- G_CALLBACK (menu_item_deselect_cb), data);
- }
-}
+static const AmtkActionInfoEntry help_entries[] = {
+ { "app.help", "help-browser", N_("_Contents"),
+ "F1", N_("View the Genius manual") },
+ { "app.help-func", "help-browser", N_("_Help on Function"),
+ NULL, N_("Help on a function or a command") },
+ { "app.warranty", "help-browser", N_("_Warranty"),
+ NULL, N_("Display warranty information") },
+ { "app.about", "help-about", N_("_About"),
+ NULL, N_("About Genius") },
+ { NULL }
+};
static void
simple_menu_item_select_cb (GtkMenuItem *item, gpointer data)
@@ -576,51 +366,17 @@ simple_menu_item_deselect_cb (GtkMenuItem *item, gpointer data)
gtk_statusbar_pop (GTK_STATUSBAR (genius_window_statusbar), 0 /* context */);
}
-static const struct {
- const char *stock_id;
- const char *icon;
-} stock_icons [] = {
- { "genius-stock-plot", "genius-stock-plot" }
-};
-
-static const GtkStockItem stock_items [] = {
- { (char *)"genius-stock-plot", (char *)N_("_Plot"), 0, 0, (char *)GETTEXT_PACKAGE },
-};
-
static void
-stock_init (void)
+enable_action (const gchar *name, gboolean enabled)
{
- GtkIconFactory *factory;
- GtkIconSource *source;
- static gboolean stock_initialized = FALSE;
- guint i;
-
- if (stock_initialized)
- return;
- stock_initialized = TRUE;
-
- gtk_stock_add_static (stock_items, G_N_ELEMENTS (stock_items));
-
- factory = gtk_icon_factory_new ();
- gtk_icon_factory_add_default (factory);
+ static GApplication *app = NULL;
+ GAction *action;
- source = gtk_icon_source_new ();
-
- for (i = 0; i < G_N_ELEMENTS (stock_icons); i++) {
- GtkIconSet *set;
-
- gtk_icon_source_set_icon_name (source, stock_icons [i].icon);
-
- set = gtk_icon_set_new ();
- gtk_icon_set_add_source (set, source);
-
- gtk_icon_factory_add (factory, stock_icons [i].stock_id, set);
- gtk_icon_set_unref (set);
- }
+ if (!app)
+ app = g_application_get_default ();
- gtk_icon_source_free (source);
-
- g_object_unref (factory);
+ action = g_action_map_lookup_action (G_ACTION_MAP (app), name);
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), enabled);
}
static GtkWidget *
@@ -694,84 +450,142 @@ recent_add (const char *uri)
static void
add_main_window_contents (GtkWidget *window, GtkWidget *notebook)
{
+ AmtkFactory *factory;
+ AmtkApplicationWindow *win;
GtkWidget *box1, *recent_menu;
- GtkActionGroup *actions;
- GError *error = NULL;
- GtkAction *act;
-
- stock_init ();
-
- actions = gtk_action_group_new ("Actions");
- gtk_action_group_set_translation_domain (actions, GETTEXT_PACKAGE);
- gtk_action_group_add_actions (actions, entries, n_entries, NULL);
-
- /* FIXME: I have no clue if this is correct, but I can't find any docs
- * on this */
- act = gtk_action_group_get_action (actions, "Interrupt");
- gtk_action_set_is_important (act, TRUE);
- act = gtk_action_group_get_action (actions, "Run");
- gtk_action_set_is_important (act, TRUE);
- act = gtk_action_group_get_action (actions, "ToolbarNew");
- gtk_action_set_is_important (act, TRUE);
- act = gtk_action_group_get_action (actions, "ToolbarOpen");
- gtk_action_set_is_important (act, TRUE);
- act = gtk_action_group_get_action (actions, "ToolbarPlot");
- gtk_action_set_is_important (act, TRUE);
- act = gtk_action_group_get_action (actions, "Quit");
- gtk_action_set_is_important (act, TRUE);
-
- genius_ui = gtk_ui_manager_new ();
+ GtkWidget *menubar;
+ GtkWidget *toolbar;
+ GtkWidget *menu;
+ GtkWidget *submenu;
+ GtkWidget *item;
+ GtkToolItem *button;
+ gint order = 0;
+
+ factory = amtk_factory_new_with_default_application ();
+
+ menubar = gtk_menu_bar_new ();
+
+ menu = gtk_menu_item_new_with_mnemonic (_("_File"));
+ submenu = amtk_factory_create_simple_menu (factory, file_entries, -1);
+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu), submenu);
+ item = gtk_menu_item_new_with_mnemonic (_("Open R_ecent"));
+ recent_menu = recent_create_menu ();
+ g_signal_connect (G_OBJECT (recent_menu), "item-activated",
+ G_CALLBACK (file_open_recent), NULL);
+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), recent_menu);
+ gtk_menu_shell_insert (GTK_MENU_SHELL (submenu), item, 2);
+ item = gtk_separator_menu_item_new ();
+ gtk_menu_shell_insert (GTK_MENU_SHELL (submenu), item, 8);
+ item = gtk_separator_menu_item_new ();
+ gtk_menu_shell_insert (GTK_MENU_SHELL (submenu), item, 10);
+ item = gtk_separator_menu_item_new ();
+ gtk_menu_shell_insert (GTK_MENU_SHELL (submenu), item, 12);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menu);
+
+ menu = gtk_menu_item_new_with_mnemonic (_("_Edit"));
+ submenu = amtk_factory_create_simple_menu (factory, edit_entries, -1);
+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu), submenu);
+#ifdef HAVE_GTKSOURCEVIEW
+ order = 3;
+ item = gtk_separator_menu_item_new ();
+ gtk_menu_shell_insert (GTK_MENU_SHELL (submenu), item, order - 1);
+#endif
+ item = gtk_separator_menu_item_new ();
+ gtk_menu_shell_insert (GTK_MENU_SHELL (submenu), item, order + 3);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menu);
+
+ menu = gtk_menu_item_new_with_mnemonic (_("_Calculator"));
+ submenu = amtk_factory_create_simple_menu (factory, calc_entries, -1);
+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu), submenu);
+ item = gtk_separator_menu_item_new ();
+ gtk_menu_shell_insert (GTK_MENU_SHELL (submenu), item, 2);
+ item = gtk_separator_menu_item_new ();
+ gtk_menu_shell_insert (GTK_MENU_SHELL (submenu), item, 6);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menu);
+
+ example_menu = gtk_menu_item_new_with_mnemonic (_("E_xamples"));
+ gtk_menu_shell_append (GTK_MENU_SHELL (menubar), example_menu);
+
+ plugin_menu = gtk_menu_item_new_with_mnemonic (_("P_lugins"));
+ gtk_menu_shell_append (GTK_MENU_SHELL (menubar), plugin_menu);
+
+ prog_menu = gtk_menu_item_new_with_mnemonic (_("_Programs"));
+ submenu = amtk_factory_create_simple_menu (factory, prog_entries, -1);
+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (prog_menu), submenu);
+ item = gtk_separator_menu_item_new ();
+ gtk_menu_shell_insert (GTK_MENU_SHELL (submenu), item, 2);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menubar), prog_menu);
+
+ menu = gtk_menu_item_new_with_mnemonic (_("_Settings"));
+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu),
+ amtk_factory_create_simple_menu
+ (factory, pref_entries, -1));
+ gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menu);
+
+ menu = gtk_menu_item_new_with_mnemonic (_("_Help"));
+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu),
+ amtk_factory_create_simple_menu
+ (factory, help_entries, -1));
+ gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menu);
+
+ toolbar = gtk_toolbar_new ();
+ gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_BOTH);
+ gtk_toolbar_insert (GTK_TOOLBAR (toolbar),
+ amtk_factory_create_tool_button
+ (factory, "app.stop"), -1);
+ gtk_toolbar_insert (GTK_TOOLBAR (toolbar),
+ amtk_factory_create_tool_button
+ (factory, "app.run"), -1);
+ button = amtk_factory_create_tool_button (factory, "app.new");
+ gtk_tool_button_set_label (GTK_TOOL_BUTTON (button), _("New"));
+ gtk_toolbar_insert (GTK_TOOLBAR (toolbar), button, -1);
+ button = amtk_factory_create_tool_button (factory, "app.open");
+ gtk_tool_button_set_label (GTK_TOOL_BUTTON (button), _("Open"));
+ gtk_toolbar_insert (GTK_TOOLBAR (toolbar), button, -1);
+ button = amtk_factory_create_tool_button (factory, "app.plot");
+ gtk_tool_button_set_label (GTK_TOOL_BUTTON (button), _("_Plot"));
+ gtk_toolbar_insert (GTK_TOOLBAR (toolbar), button, -1);
+ gtk_toolbar_insert (GTK_TOOLBAR (toolbar),
+ amtk_factory_create_tool_button
+ (factory, "app.quit"), -1);
+
genius_window_statusbar = gtk_statusbar_new ();
- g_signal_connect (genius_ui, "connect_proxy",
- G_CALLBACK (connect_proxy_cb), genius_window_statusbar);
- g_signal_connect (genius_ui, "disconnect_proxy",
- G_CALLBACK (disconnect_proxy_cb), genius_window_statusbar);
-
- gtk_ui_manager_insert_action_group (genius_ui, actions, 0);
- g_object_unref (actions);
- gtk_window_add_accel_group (GTK_WINDOW (window),
- gtk_ui_manager_get_accel_group (genius_ui));
- gtk_container_set_border_width (GTK_CONTAINER (window), 0);
+ win = amtk_application_window_get_from_gtk_application_window
+ (GTK_APPLICATION_WINDOW (window));
+ amtk_application_window_set_statusbar (win, GTK_STATUSBAR
+ (genius_window_statusbar));
+ amtk_application_window_connect_menu_to_statusbar (win, GTK_MENU_SHELL
+ (menubar));
- if ( ! gtk_ui_manager_add_ui_from_string (genius_ui, ui_info, -1, &error)) {
- /* FIXME: */
- g_message ("building menus failed: %s", error->message);
- g_error_free (error);
- }
+ gtk_container_set_border_width (GTK_CONTAINER (window), 0);
- box1 = gtk_vbox_new (FALSE, 0);
+ box1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), box1);
gtk_box_pack_start (GTK_BOX (box1),
- gtk_ui_manager_get_widget (genius_ui, "/MenuBar"),
+ menubar,
FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (box1),
- gtk_ui_manager_get_widget (genius_ui, "/ToolBar"),
+ toolbar,
FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (box1), notebook, TRUE, TRUE, 0);
- gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (genius_window_statusbar), TRUE);
gtk_box_pack_start (GTK_BOX (box1), genius_window_statusbar, FALSE, TRUE, 0);
-
- recent_menu = recent_create_menu ();
- g_signal_connect (G_OBJECT (recent_menu), "item-activated",
- G_CALLBACK (file_open_recent), NULL);
- gtk_menu_item_set_submenu
- (GTK_MENU_ITEM (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/FileMenu/OpenRecent")),
- recent_menu);
-
+ g_object_unref (factory);
+ amtk_action_info_store_check_all_used (info_store);
}
void
genius_setup_window_cursor (GtkWidget *win, GdkCursorType type)
{
- GdkCursor *cursor = gdk_cursor_new (type);
+ GdkCursor *cursor
+ = gdk_cursor_new_for_display (gdk_display_get_default (), type);
if (win != NULL && gtk_widget_get_window (win) != NULL)
gdk_window_set_cursor (gtk_widget_get_window (win), cursor);
- gdk_cursor_unref (cursor);
+ g_object_unref (cursor);
}
void
@@ -815,8 +629,8 @@ static void
setup_term_color (void)
{
if (genius_setup.black_on_white) {
- GdkColor black = {0, 0, 0, 0};
- GdkColor white = {0, 65535, 65535, 65535};
+ const GdkRGBA black = {0, 0, 0, 1};
+ const GdkRGBA white = {1, 1, 1, 1};
vte_terminal_set_colors (VTE_TERMINAL (term),
&black,
&white,
@@ -843,11 +657,8 @@ gel_ask_buttons (const char *query, GSList *buttonlist)
int i;
int ret;
- d = gtk_dialog_new_with_buttons
- (_("Genius"),
- NULL /*GTK_WINDOW (genius_window)*/ /* parent */,
- 0 /* flags */,
- NULL);
+ d = gtk_dialog_new ();
+ gtk_window_set_title (GTK_WINDOW (d), _("Genius"));
i = 1;
for (li = buttonlist; li != NULL; li = li->next) {
@@ -857,14 +668,13 @@ gel_ask_buttons (const char *query, GSList *buttonlist)
i++;
}
- box = gtk_vbox_new (FALSE, GENIUS_PAD);
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, GENIUS_PAD);
gtk_container_set_border_width (GTK_CONTAINER (box), GENIUS_PAD);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (d))),
box,
TRUE, TRUE, 0);
- gtk_dialog_set_has_separator (GTK_DIALOG (d), FALSE);
gtk_box_pack_start (GTK_BOX (box),
gtk_label_new (ve_sure_string(query)),
FALSE, FALSE, 0);
@@ -892,20 +702,19 @@ gel_ask_string (const char *query, const char *def)
(_("Genius"),
NULL /*GTK_WINDOW (genius_window)*/ /* parent */,
0 /* flags */,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK, GTK_RESPONSE_OK,
+ _("_Cancel"), GTK_RESPONSE_CANCEL,
+ _("_OK"), GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (d), GTK_RESPONSE_OK);
- box = gtk_vbox_new (FALSE, GENIUS_PAD);
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, GENIUS_PAD);
gtk_container_set_border_width (GTK_CONTAINER (box), GENIUS_PAD);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (d))),
box,
TRUE, TRUE, 0);
- gtk_dialog_set_has_separator (GTK_DIALOG (d), FALSE);
gtk_box_pack_start (GTK_BOX (box),
gtk_label_new (ve_sure_string(query)),
FALSE, FALSE, 0);
@@ -934,13 +743,13 @@ gel_ask_string (const char *query, const char *def)
}
static void
-help_cb (GtkWidget *menuitem, gpointer data)
+help_cb (GSimpleAction *action, GVariant *param, gpointer data)
{
actually_open_help (NULL /* id */);
}
static void
-help_on_function (GtkWidget *menuitem, gpointer data)
+help_on_function (GSimpleAction *action, GVariant *param, gpointer data)
{
GtkWidget *d;
GtkWidget *e;
@@ -957,15 +766,13 @@ help_on_function (GtkWidget *menuitem, gpointer data)
(_("Help on Function"),
GTK_WINDOW (genius_window) /* parent */,
0 /* flags */,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK, GTK_RESPONSE_OK,
+ _("_Cancel"), GTK_RESPONSE_CANCEL,
+ _("_OK"), GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (d), GTK_RESPONSE_OK);
- gtk_dialog_set_has_separator (GTK_DIALOG (d), FALSE);
-
- box = gtk_vbox_new (FALSE, GENIUS_PAD);
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, GENIUS_PAD);
gtk_container_set_border_width (GTK_CONTAINER (box), GENIUS_PAD);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (d))),
box,
@@ -1084,6 +891,9 @@ geniusbox (gboolean error,
GtkWidget *tv;
GtkTextBuffer *buffer;
GtkTextIter iter;
+ GdkDisplay *display;
+ GdkMonitor *monitor;
+ GdkRectangle geom;
const char *title;
if (textbox_title != NULL)
@@ -1099,9 +909,8 @@ geniusbox (gboolean error,
GTK_WINDOW (genius_window) :
NULL /* parent */,
0 /* flags */,
- GTK_STOCK_OK, GTK_RESPONSE_OK,
+ _("_OK"), GTK_RESPONSE_OK,
NULL);
- gtk_dialog_set_has_separator (GTK_DIALOG (mb), FALSE);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
@@ -1136,10 +945,13 @@ geniusbox (gboolean error,
/* FIXME:
* Perhaps should be smaller with smaller font ...
* ... */
+ display = gdk_display_get_default ();
+ monitor = gdk_display_get_primary_monitor (display);
+ gdk_monitor_get_geometry (monitor, &geom);
gtk_window_set_default_size
(GTK_WINDOW (mb),
- MIN (gdk_screen_width ()-50, 800),
- MIN (gdk_screen_height ()-50, 450));
+ MIN (geom.width - 50, 800),
+ MIN (geom.height - 50, 450));
}
if (bind_response) {
g_signal_connect (G_OBJECT (mb), "response",
@@ -1308,12 +1120,14 @@ var_box_response (GtkWidget *widget, gint resp, gpointer data)
static void
-show_user_vars (GtkWidget *menu_item, gpointer data)
+show_user_vars (GSimpleAction *action, GVariant *param, gpointer data)
{
static GtkWidget *var_box = NULL;
GtkWidget *sw;
GtkWidget *tv;
static GtkTextBuffer *buffer = NULL;
+ GdkMonitor *monitor;
+ GdkRectangle geom;
if (var_box != NULL) {
populate_var_box (buffer);
@@ -1324,10 +1138,9 @@ show_user_vars (GtkWidget *menu_item, gpointer data)
(_("User Variable Listing"),
GTK_WINDOW (genius_window) /* parent */,
0 /* flags */,
- GTK_STOCK_REFRESH, 1,
- GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
+ _("_Refresh"), 1,
+ _("_Close"), GTK_RESPONSE_CLOSE,
NULL);
- gtk_dialog_set_has_separator (GTK_DIALOG (var_box), FALSE);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
@@ -1345,10 +1158,12 @@ show_user_vars (GtkWidget *menu_item, gpointer data)
/* FIXME:
* Perhaps should be smaller with smaller font ...
* ... */
+ monitor = gdk_display_get_primary_monitor (gdk_display_get_default ());
+ gdk_monitor_get_geometry (monitor, &geom);
gtk_window_set_default_size
(GTK_WINDOW (var_box),
- MIN (gdk_screen_width ()-50, 800),
- MIN (gdk_screen_height ()-50, 450));
+ MIN (geom.width - 50, 800),
+ MIN (geom.height - 50, 450));
g_signal_connect (G_OBJECT (var_box), "response",
G_CALLBACK (var_box_response),
buffer);
@@ -1529,12 +1344,10 @@ run_monitor (const char *var)
(s,
GTK_WINDOW (genius_window) /* parent */,
0 /* flags */,
- GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
+ _("_Close"), GTK_RESPONSE_CLOSE,
NULL);
g_free (s);
- gtk_dialog_set_has_separator (GTK_DIALOG (d), FALSE);
-
g_signal_connect (G_OBJECT (d), "response",
G_CALLBACK (gtk_widget_destroy),
NULL);
@@ -1595,7 +1408,7 @@ run_monitor (const char *var)
}
static void
-monitor_user_var (GtkWidget *menu_item, gpointer data)
+monitor_user_var (GSimpleAction *action, GVariant *param, gpointer data)
{
GtkWidget *d;
GtkWidget *e;
@@ -1606,19 +1419,18 @@ monitor_user_var (GtkWidget *menu_item, gpointer data)
(_("Monitor a Variable"),
GTK_WINDOW (genius_window) /* parent */,
0 /* flags */,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK, GTK_RESPONSE_OK,
+ _("_Cancel"), GTK_RESPONSE_CANCEL,
+ _("_OK"), GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (d), GTK_RESPONSE_OK);
- box = gtk_vbox_new (FALSE, GENIUS_PAD);
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, GENIUS_PAD);
gtk_container_set_border_width (GTK_CONTAINER (box), GENIUS_PAD);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (d))),
box,
TRUE, TRUE, 0);
- gtk_dialog_set_has_separator (GTK_DIALOG (d), FALSE);
gtk_box_pack_start (GTK_BOX (box),
gtk_label_new (_("Variable name:")),
FALSE, FALSE, 0);
@@ -1643,7 +1455,7 @@ monitor_user_var (GtkWidget *menu_item, gpointer data)
}
static void
-full_answer (GtkWidget *menu_item, gpointer data)
+full_answer (GSimpleAction *action, GVariant *param, gpointer data)
{
GelOutput *out;
const char *s;
@@ -1889,7 +1701,7 @@ actually_open_help (const char *id)
}
}
- gtk_show_uri (NULL, str, GDK_CURRENT_TIME, &error);
+ gtk_show_uri_on_window (NULL, str, GDK_CURRENT_TIME, &error);
if (error != NULL) {
char *err = g_strdup_printf
@@ -1999,7 +1811,7 @@ geniusinfo(const char *s)
/*about box*/
static void
-aboutcb(GtkWidget * widget, gpointer data)
+aboutcb (GSimpleAction *action, GVariant *param, gpointer data)
{
static const char *authors[] = {
"Jiřà (George) Lebl, Ph.D. <jirka 5z com>",
@@ -2254,7 +2066,7 @@ any_changed (void)
/* quit */
static void
-quitapp (GtkWidget * widget, gpointer data)
+quitapp (GSimpleAction *action, GVariant *param, gpointer data)
{
if (any_changed ()) {
if (gel_calc_running) {
@@ -2287,7 +2099,7 @@ quitapp (GtkWidget * widget, gpointer data)
}
}
- gtk_main_quit ();
+ g_application_quit (G_APPLICATION (data));
}
/*exact answer callback*/
@@ -2308,10 +2120,10 @@ optioncb (GtkWidget * widget, int *data)
}
static void
-fontsetcb (GtkWidget *fb, char **font)
+fontsetcb (GtkFontButton *fb, char **font)
{
g_free(*font);
- *font = g_strdup (gtk_font_button_get_font_name (GTK_FONT_BUTTON (fb)));
+ *font = gtk_font_chooser_get_font (GTK_FONT_CHOOSER (fb));
}
@@ -2324,6 +2136,8 @@ static GeniusSetup cancelsetup={0};
static void
setup_response (GtkWidget *widget, gint resp, gpointer data)
{
+ PangoFontDescription *desc;
+
if (resp == GTK_RESPONSE_HELP) {
actually_open_help ("genius-prefs");
return;
@@ -2349,11 +2163,12 @@ setup_response (GtkWidget *widget, gint resp, gpointer data)
gel_set_new_calcstate (curstate);
vte_terminal_set_scrollback_lines (VTE_TERMINAL (term),
genius_setup.scrollback);
- vte_terminal_set_font_from_string
- (VTE_TERMINAL (term),
- ve_string_empty (genius_setup.font) ?
- default_console_font :
- genius_setup.font);
+ desc = pango_font_description_from_string
+ (ve_string_empty (genius_setup.font)
+ ? default_console_font
+ : genius_setup.font);
+ vte_terminal_set_font (VTE_TERMINAL (term), desc);
+ pango_font_description_free (desc);
setup_term_color ();
vte_terminal_set_cursor_blink_mode
(VTE_TERMINAL (term),
@@ -2369,7 +2184,7 @@ setup_response (GtkWidget *widget, gint resp, gpointer data)
}
static void
-setup_calc(GtkWidget *widget, gpointer data)
+setup_calc (GSimpleAction *action, GVariant *param, gpointer data)
{
GtkWidget *mainbox,*frame;
GtkWidget *box;
@@ -2398,18 +2213,17 @@ setup_calc(GtkWidget *widget, gpointer data)
(_("Genius Setup"),
GTK_WINDOW (genius_window) /* parent */,
0 /* flags */,
- GTK_STOCK_HELP, GTK_RESPONSE_HELP,
- GTK_STOCK_APPLY, GTK_RESPONSE_APPLY,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK, GTK_RESPONSE_OK,
+ _("_Help"), GTK_RESPONSE_HELP,
+ _("_Apply"), GTK_RESPONSE_APPLY,
+ _("_Cancel"), GTK_RESPONSE_CANCEL,
+ _("_OK"), GTK_RESPONSE_OK,
NULL);
- gtk_dialog_set_has_separator (GTK_DIALOG (setupdialog), FALSE);
notebookw = gtk_notebook_new ();
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (setupdialog))),
notebookw, TRUE, TRUE, 0);
- mainbox = gtk_vbox_new(FALSE, GENIUS_PAD);
+ mainbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, GENIUS_PAD);
gtk_container_set_border_width(GTK_CONTAINER(mainbox), GENIUS_PAD);
gtk_notebook_append_page (GTK_NOTEBOOK (notebookw),
mainbox,
@@ -2418,12 +2232,12 @@ setup_calc(GtkWidget *widget, gpointer data)
frame=gtk_frame_new(_("Number/Expression output options"));
gtk_box_pack_start(GTK_BOX(mainbox),frame,FALSE,FALSE,0);
- box=gtk_vbox_new(FALSE, GENIUS_PAD);
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, GENIUS_PAD);
gtk_container_set_border_width(GTK_CONTAINER(box), GENIUS_PAD);
gtk_container_add(GTK_CONTAINER(frame),box);
- b=gtk_hbox_new(FALSE, GENIUS_PAD);
+ b = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, GENIUS_PAD);
gtk_box_pack_start(GTK_BOX(box),b,FALSE,FALSE,0);
gtk_box_pack_start(GTK_BOX(b),
gtk_label_new(_("Maximum digits to output (0=unlimited)")),
@@ -2478,7 +2292,7 @@ setup_calc(GtkWidget *widget, gpointer data)
G_CALLBACK (optioncb),
(gpointer)&tmpstate.mixed_fractions);
- b=gtk_hbox_new(FALSE, GENIUS_PAD);
+ b = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, GENIUS_PAD);
gtk_box_pack_start(GTK_BOX(box),b,FALSE,FALSE,0);
gtk_box_pack_start(GTK_BOX(b),
gtk_label_new(_("Display 0.0 when floating point number is less than 10^-x "
@@ -2501,7 +2315,7 @@ setup_calc(GtkWidget *widget, gpointer data)
g_signal_connect (G_OBJECT (adj), "value_changed",
G_CALLBACK (intspincb), &tmpstate.chop);
- b=gtk_hbox_new(FALSE, GENIUS_PAD);
+ b = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, GENIUS_PAD);
gtk_box_pack_start(GTK_BOX(box),b,FALSE,FALSE,0);
gtk_box_pack_start(GTK_BOX(b),
gtk_label_new(_("Only chop numbers when another number is greater than 10^-x")),
@@ -2540,7 +2354,7 @@ setup_calc(GtkWidget *widget, gpointer data)
frame=gtk_frame_new(_("Error/Info output options"));
gtk_box_pack_start(GTK_BOX(mainbox),frame,FALSE,FALSE,0);
- box=gtk_vbox_new(FALSE, GENIUS_PAD);
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, GENIUS_PAD);
gtk_container_add(GTK_CONTAINER(frame),box);
gtk_container_set_border_width(GTK_CONTAINER(box), GENIUS_PAD);
@@ -2562,7 +2376,7 @@ setup_calc(GtkWidget *widget, gpointer data)
G_CALLBACK (optioncb),
(gpointer)&tmpsetup.info_box);
- b=gtk_hbox_new(FALSE, GENIUS_PAD);
+ b = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, GENIUS_PAD);
gtk_box_pack_start(GTK_BOX(box),b,FALSE,FALSE,0);
gtk_box_pack_start(GTK_BOX(b),
gtk_label_new(_("Maximum errors to display (0=unlimited)")),
@@ -2585,7 +2399,7 @@ setup_calc(GtkWidget *widget, gpointer data)
G_CALLBACK (intspincb),&tmpstate.max_errors);
- mainbox = gtk_vbox_new(FALSE, GENIUS_PAD);
+ mainbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, GENIUS_PAD);
gtk_container_set_border_width(GTK_CONTAINER(mainbox), GENIUS_PAD);
gtk_notebook_append_page (GTK_NOTEBOOK (notebookw),
mainbox,
@@ -2594,7 +2408,7 @@ setup_calc(GtkWidget *widget, gpointer data)
frame=gtk_frame_new(_("Floating point precision"));
gtk_box_pack_start(GTK_BOX(mainbox),frame,FALSE,FALSE,0);
- box=gtk_vbox_new(FALSE, GENIUS_PAD);
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, GENIUS_PAD);
gtk_container_set_border_width(GTK_CONTAINER(box), GENIUS_PAD);
gtk_container_add(GTK_CONTAINER(frame),box);
@@ -2605,7 +2419,7 @@ setup_calc(GtkWidget *widget, gpointer data)
FALSE,FALSE,0);
- b=gtk_hbox_new(FALSE, GENIUS_PAD);
+ b = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, GENIUS_PAD);
gtk_box_pack_start(GTK_BOX(box),b,FALSE,FALSE,0);
gtk_box_pack_start(GTK_BOX(b),
gtk_label_new(_("Floating point precision (bits)")),
@@ -2640,7 +2454,7 @@ setup_calc(GtkWidget *widget, gpointer data)
"be remembered for next session."));
- mainbox = gtk_vbox_new(FALSE, GENIUS_PAD);
+ mainbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, GENIUS_PAD);
gtk_container_set_border_width(GTK_CONTAINER(mainbox), GENIUS_PAD);
gtk_notebook_append_page (GTK_NOTEBOOK (notebookw),
mainbox,
@@ -2648,11 +2462,11 @@ setup_calc(GtkWidget *widget, gpointer data)
frame=gtk_frame_new(_("Terminal options"));
gtk_box_pack_start(GTK_BOX(mainbox),frame,FALSE,FALSE,0);
- box=gtk_vbox_new(FALSE, GENIUS_PAD);
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, GENIUS_PAD);
gtk_container_set_border_width(GTK_CONTAINER(box), GENIUS_PAD);
gtk_container_add(GTK_CONTAINER(frame),box);
- b=gtk_hbox_new(FALSE, GENIUS_PAD);
+ b = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, GENIUS_PAD);
gtk_box_pack_start(GTK_BOX(box),b,FALSE,FALSE,0);
gtk_box_pack_start(GTK_BOX(b),
gtk_label_new(_("Scrollback lines")),
@@ -2675,7 +2489,7 @@ setup_calc(GtkWidget *widget, gpointer data)
G_CALLBACK (intspincb), &tmpsetup.scrollback);
- b=gtk_hbox_new(FALSE, GENIUS_PAD);
+ b = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, GENIUS_PAD);
gtk_box_pack_start(GTK_BOX(box),b,FALSE,FALSE,0);
gtk_box_pack_start(GTK_BOX(b),
gtk_label_new(_("Font:")),
@@ -2706,7 +2520,7 @@ setup_calc(GtkWidget *widget, gpointer data)
(gpointer)&tmpsetup.blinking_cursor);
- mainbox = gtk_vbox_new (FALSE, GENIUS_PAD);
+ mainbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, GENIUS_PAD);
gtk_container_set_border_width (GTK_CONTAINER (mainbox), GENIUS_PAD);
gtk_notebook_append_page (GTK_NOTEBOOK (notebookw),
mainbox,
@@ -2715,7 +2529,7 @@ setup_calc(GtkWidget *widget, gpointer data)
frame=gtk_frame_new(_("Limits"));
gtk_box_pack_start(GTK_BOX(mainbox),frame,FALSE,FALSE,0);
- box=gtk_vbox_new (FALSE, GENIUS_PAD);
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, GENIUS_PAD);
gtk_container_set_border_width (GTK_CONTAINER (box), GENIUS_PAD);
gtk_container_add(GTK_CONTAINER(frame),box);
@@ -2726,7 +2540,7 @@ setup_calc(GtkWidget *widget, gpointer data)
FALSE,FALSE,0);
- b=gtk_hbox_new(FALSE, GENIUS_PAD);
+ b = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, GENIUS_PAD);
gtk_box_pack_start(GTK_BOX(box),b,FALSE,FALSE,0);
gtk_box_pack_start(GTK_BOX(b),
gtk_label_new(_("Maximum number of nodes to allocate")),
@@ -2757,7 +2571,7 @@ setup_calc(GtkWidget *widget, gpointer data)
}
void
-genius_interrupt_calc (void)
+genius_interrupt_calc (GSimpleAction *action, GVariant *param, gpointer data)
{
gel_interrupted = TRUE;
if ( ! gel_calc_running) {
@@ -2775,7 +2589,7 @@ executing_warning (void)
}
static void
-warranty_call (GtkWidget *widget, gpointer data)
+warranty_call (GSimpleAction *action, GVariant *param, gpointer data)
{
if (gel_calc_running) {
executing_warning ();
@@ -2878,7 +2692,7 @@ really_load_cb (GtkFileChooser *fs, int response, gpointer data)
}
static void
-load_cb (GtkWidget *w)
+load_cb (GSimpleAction *action, GVariant *param, gpointer data)
{
static GtkWidget *fs = NULL;
@@ -2890,7 +2704,7 @@ load_cb (GtkWidget *w)
fs = gtk_file_chooser_dialog_new (_("Load and Run"),
GTK_WINDOW (genius_window),
GTK_FILE_CHOOSER_ACTION_OPEN,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ _("_Cancel"), GTK_RESPONSE_CANCEL,
_("_Load"), GTK_RESPONSE_OK,
NULL);
@@ -2934,15 +2748,13 @@ setup_undo_redo_idle (gpointer data)
p = g_object_get_data (G_OBJECT (w), "program");
if (p == NULL) {
- gtk_widget_set_sensitive (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/EditMenu/Undo"),
- FALSE);
- gtk_widget_set_sensitive (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/EditMenu/Redo"),
- FALSE);
+ enable_action ("undo", FALSE);
+ enable_action ("redo", FALSE);
} else {
- gtk_widget_set_sensitive (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/EditMenu/Undo"),
+ enable_action ("undo",
gtk_source_buffer_can_undo
(GTK_SOURCE_BUFFER (p->buffer)));
- gtk_widget_set_sensitive (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/EditMenu/Redo"),
+ enable_action ("redo",
gtk_source_buffer_can_redo
(GTK_SOURCE_BUFFER (p->buffer)));
}
@@ -2960,7 +2772,7 @@ setup_undo_redo (void)
static void
-undo_callback (GtkWidget *menu_item, gpointer data)
+undo_callback (GSimpleAction *action, GVariant *param, gpointer data)
{
int page = gtk_notebook_get_current_page (GTK_NOTEBOOK (genius_notebook));
GtkWidget *w;
@@ -2984,7 +2796,7 @@ undo_callback (GtkWidget *menu_item, gpointer data)
}
static void
-redo_callback (GtkWidget *menu_item, gpointer data)
+redo_callback (GSimpleAction *action, GVariant *param, gpointer data)
{
int page = gtk_notebook_get_current_page (GTK_NOTEBOOK (genius_notebook));
GtkWidget *w;
@@ -3009,7 +2821,7 @@ redo_callback (GtkWidget *menu_item, gpointer data)
#endif
static void
-cut_callback (GtkWidget *menu_item, gpointer data)
+cut_callback (GSimpleAction *action, GVariant *param, gpointer data)
{
int page = gtk_notebook_get_current_page (GTK_NOTEBOOK (genius_notebook));
GtkWidget *w;
@@ -3034,7 +2846,7 @@ cut_callback (GtkWidget *menu_item, gpointer data)
static void
-copy_callback (GtkWidget *menu_item, gpointer data)
+copy_callback (GSimpleAction *action, GVariant *param, gpointer data)
{
int page = gtk_notebook_get_current_page (GTK_NOTEBOOK (genius_notebook));
GtkWidget *w;
@@ -3047,7 +2859,8 @@ copy_callback (GtkWidget *menu_item, gpointer data)
p = g_object_get_data (G_OBJECT (w), "program");
if (p == NULL) {
- vte_terminal_copy_clipboard (VTE_TERMINAL (term));
+ vte_terminal_copy_clipboard_format (VTE_TERMINAL (term),
+ VTE_FORMAT_TEXT);
} else {
gtk_text_buffer_copy_clipboard
(p->buffer,
@@ -3056,7 +2869,7 @@ copy_callback (GtkWidget *menu_item, gpointer data)
}
static void
-paste_callback (GtkWidget *menu_item, gpointer data)
+paste_callback (GSimpleAction *action, GVariant *param, gpointer data)
{
int page = gtk_notebook_get_current_page (GTK_NOTEBOOK (genius_notebook));
GtkWidget *w;
@@ -3143,7 +2956,7 @@ copy_answer (void)
static void
-copy_as_plain (GtkWidget *menu_item, gpointer data)
+copy_as_plain (GSimpleAction *action, GVariant *param, gpointer data)
{
if (gel_calc_running) {
executing_warning ();
@@ -3162,7 +2975,7 @@ copy_as_plain (GtkWidget *menu_item, gpointer data)
}
static void
-copy_as_latex (GtkWidget *menu_item, gpointer data)
+copy_as_latex (GSimpleAction *action, GVariant *param, gpointer data)
{
if (gel_calc_running) {
executing_warning ();
@@ -3181,7 +2994,7 @@ copy_as_latex (GtkWidget *menu_item, gpointer data)
}
static void
-copy_as_troff (GtkWidget *menu_item, gpointer data)
+copy_as_troff (GSimpleAction *action, GVariant *param, gpointer data)
{
if (gel_calc_running) {
executing_warning ();
@@ -3200,7 +3013,7 @@ copy_as_troff (GtkWidget *menu_item, gpointer data)
}
static void
-copy_as_mathml (GtkWidget *menu_item, gpointer data)
+copy_as_mathml (GSimpleAction *action, GVariant *param, gpointer data)
{
if (gel_calc_running) {
executing_warning ();
@@ -3255,17 +3068,24 @@ setup_label (Program *p)
}
static void
-next_tab (GtkWidget *menu_item, gpointer data)
+next_tab (GSimpleAction *action, GVariant *param, gpointer data)
{
gtk_notebook_next_page (GTK_NOTEBOOK (genius_notebook));
}
static void
-prev_tab (GtkWidget *menu_item, gpointer data)
+prev_tab (GSimpleAction *action, GVariant *param, gpointer data)
{
gtk_notebook_prev_page (GTK_NOTEBOOK (genius_notebook));
}
+static void
+show_console (GSimpleAction *action, GVariant *param, gpointer data)
+{
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (genius_notebook),
+ get_console_pagenum ());
+}
+
static void
prog_menu_activated (GtkWidget *item, gpointer data)
{
@@ -3291,7 +3111,7 @@ build_program_menu (void)
prog_menu_items = g_list_remove_link (prog_menu_items, prog_menu_items);
}
- menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (gtk_ui_manager_get_widget (genius_ui,
"/MenuBar/ProgramsMenu")));
+ menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (prog_menu));
for (i = 0; i < n; i++) {
GtkWidget *item;
@@ -3411,7 +3231,7 @@ get_contents_vfs (const char *filename)
}
static void
-reload_cb (GtkWidget *menu_item)
+reload_cb (GSimpleAction *action, GVariant *param, gpointer data)
{
GtkTextIter iter, iter_end;
char *contents;
@@ -3482,7 +3302,6 @@ move_cursor (GtkTextBuffer *buffer,
}
#ifdef HAVE_GTKSOURCEVIEW
-#ifdef HAVE_GTKSOURCEVIEW2
static GtkSourceLanguageManager*
get_source_language_manager (void)
{
@@ -3513,7 +3332,6 @@ get_source_language_manager (void)
return lm;
}
#endif
-#endif
static gboolean
file_exists (const char *fname)
@@ -3579,16 +3397,10 @@ whack_program (Program *p)
if (selected_program == p) {
p->selected = FALSE;
selected_program = NULL;
- gtk_widget_set_sensitive (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/FileMenu/Reload"),
- FALSE);
- gtk_widget_set_sensitive (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/FileMenu/Save"),
- FALSE);
- gtk_widget_set_sensitive (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/FileMenu/SaveAs"),
- FALSE);
- gtk_widget_set_sensitive (gtk_ui_manager_get_widget (genius_ui, "/ToolBar/Run"),
- FALSE);
- gtk_widget_set_sensitive (gtk_ui_manager_get_widget (genius_ui,
"/MenuBar/CalculatorMenu/Run"),
- FALSE);
+ enable_action ("reload", FALSE);
+ enable_action ("save", FALSE);
+ enable_action ("save-as", FALSE);
+ enable_action ("run", FALSE);
}
g_free (p->name);
g_free (p->vname);
@@ -3638,18 +3450,11 @@ new_program (const char *filename, gboolean example)
GtkWidget *tv;
GtkWidget *sw;
GtkWidget *b, *cl, *im;
- GtkRcStyle *rcstyle;
GtkTextBuffer *buffer;
Program *p;
#ifdef HAVE_GTKSOURCEVIEW
-#ifdef HAVE_GTKSOURCEVIEW2
GtkSourceLanguage *lang;
GtkSourceLanguageManager *lm;
-#else
- GtkSourceLanguage *lang;
- GtkSourceLanguagesManager *lm;
- GList lang_dirs;
-#endif
#endif
sw = gtk_scrolled_window_new (NULL, NULL);
@@ -3657,7 +3462,6 @@ new_program (const char *filename, gboolean example)
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
#ifdef HAVE_GTKSOURCEVIEW
-#ifdef HAVE_GTKSOURCEVIEW2
tv = gtk_source_view_new ();
gtk_source_view_set_show_line_numbers (GTK_SOURCE_VIEW (tv), TRUE);
gtk_source_view_set_auto_indent (GTK_SOURCE_VIEW (tv), TRUE);
@@ -3679,35 +3483,6 @@ new_program (const char *filename, gboolean example)
G_CALLBACK (setup_undo_redo), NULL);
g_signal_connect (G_OBJECT (buffer), "notify::can-redo",
G_CALLBACK (setup_undo_redo), NULL);
-#else
- tv = gtk_source_view_new ();
- gtk_source_view_set_show_line_numbers (GTK_SOURCE_VIEW (tv), TRUE);
- gtk_source_view_set_auto_indent (GTK_SOURCE_VIEW (tv), TRUE);
- /*gtk_source_view_set_tabs_width (GTK_SOURCE_VIEW (tv), 8);
- gtk_source_view_set_insert_spaces_instead_of_tabs
- (GTK_SOURCE_VIEW (tv), TRUE);*/
- buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tv));
- lang_dirs.data = genius_datadir_sourceview;
- lang_dirs.prev = NULL;
- lang_dirs.next = NULL;
- lm = GTK_SOURCE_LANGUAGES_MANAGER
- (g_object_new (GTK_TYPE_SOURCE_LANGUAGES_MANAGER,
- "lang_files_dirs", &lang_dirs,
- NULL));
-
- lang = gtk_source_languages_manager_get_language_from_mime_type
- (lm, "text/x-genius");
- if (lang != NULL) {
- g_object_set (G_OBJECT (buffer), "highlight", TRUE, NULL);
- gtk_source_buffer_set_language
- (GTK_SOURCE_BUFFER (buffer), lang);
- }
-
- g_signal_connect (G_OBJECT (buffer), "can-undo",
- G_CALLBACK (setup_undo_redo), NULL);
- g_signal_connect (G_OBJECT (buffer), "can-redo",
- G_CALLBACK (setup_undo_redo), NULL);
-#endif
#else
tv = gtk_text_view_new ();
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tv));
@@ -3800,28 +3575,22 @@ new_program (const char *filename, gboolean example)
p->label = gtk_label_new (p->vname);
p->mlabel = gtk_label_new (p->vname);
- b = gtk_hbox_new (FALSE, 0);
+ b = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start (GTK_BOX (b), p->label, FALSE, FALSE, 0);
cl = gtk_button_new ();
gtk_container_set_border_width (GTK_CONTAINER (cl), 0);
gtk_button_set_relief (GTK_BUTTON (cl), GTK_RELIEF_NONE);
- gtk_button_set_focus_on_click (GTK_BUTTON (cl), FALSE);
- im = gtk_image_new_from_stock (GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU);
+ gtk_widget_set_focus_on_click (cl, FALSE);
+ im = gtk_image_new_from_icon_name ("window-close", GTK_ICON_SIZE_MENU);
gtk_container_add (GTK_CONTAINER (cl), im);
g_signal_connect (G_OBJECT (cl), "clicked",
G_CALLBACK (close_button_clicked), p);
- rcstyle = gtk_rc_style_new ();
- rcstyle->xthickness = 0;
- rcstyle->ythickness = 0;
- gtk_widget_modify_style (cl, rcstyle);
- g_object_unref (rcstyle);
-
gtk_box_pack_start (GTK_BOX (b), cl, FALSE, FALSE, 3);
gtk_widget_show_all (b);
- gtk_misc_set_alignment (GTK_MISC (p->mlabel), 0.0, 0.5);
+ gtk_label_set_xalign (GTK_LABEL (p->mlabel), 0.0);
gtk_notebook_append_page_menu (GTK_NOTEBOOK (genius_notebook), sw,
b, p->mlabel);
@@ -3842,7 +3611,7 @@ new_program (const char *filename, gboolean example)
}
static void
-new_callback (GtkWidget *menu_item, gpointer data)
+new_callback (GSimpleAction *action, GVariant *param, gpointer data)
{
new_program (NULL, FALSE);
}
@@ -3873,7 +3642,7 @@ really_open_cb (GtkFileChooser *fs, int response, gpointer data)
}
static void
-open_callback (GtkWidget *w)
+open_callback (GSimpleAction *action, GVariant *param, gpointer data)
{
static GtkWidget *fs = NULL;
@@ -3885,8 +3654,8 @@ open_callback (GtkWidget *w)
fs = gtk_file_chooser_dialog_new (_("Open..."),
GTK_WINDOW (genius_window),
GTK_FILE_CHOOSER_ACTION_OPEN,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OPEN, GTK_RESPONSE_OK,
+ _("_Cancel"), GTK_RESPONSE_CANCEL,
+ _("_Open"), GTK_RESPONSE_OK,
NULL);
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (fs), FALSE);
@@ -3946,10 +3715,8 @@ save_program (Program *p, const char *new_fname, GError **error)
p->changed = FALSE;
if (selected_program == p) {
- gtk_widget_set_sensitive (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/FileMenu/Reload"),
- TRUE);
- gtk_widget_set_sensitive (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/FileMenu/Save"),
- TRUE);
+ enable_action ("reload", TRUE);
+ enable_action ("save", TRUE);
}
setup_label (p);
@@ -3958,7 +3725,7 @@ save_program (Program *p, const char *new_fname, GError **error)
}
static void
-save_callback (GtkWidget *w)
+save_callback (GSimpleAction *action, GVariant *param, gpointer data)
{
GError *error = NULL;
@@ -3987,7 +3754,7 @@ save_callback (GtkWidget *w)
}
static void
-save_all_cb (GtkWidget *ww)
+save_all_cb (GSimpleAction *action, GVariant *param, gpointer data)
{
int n = gtk_notebook_get_n_pages (GTK_NOTEBOOK (genius_notebook));
int i;
@@ -4099,7 +3866,7 @@ really_save_as_cb (GtkFileChooser *fs, int response, gpointer data)
}
static void
-save_as_callback (GtkWidget *w)
+save_as_callback (GSimpleAction *action, GVariant *param, gpointer data)
{
static GtkWidget *fs = NULL;
@@ -4118,8 +3885,8 @@ save_as_callback (GtkWidget *w)
fs = gtk_file_chooser_dialog_new (_("Save As..."),
GTK_WINDOW (genius_window),
GTK_FILE_CHOOSER_ACTION_SAVE,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_SAVE, GTK_RESPONSE_OK,
+ _("_Cancel"), GTK_RESPONSE_CANCEL,
+ _("_Save"), GTK_RESPONSE_OK,
NULL);
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (fs), FALSE);
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (fs),
@@ -4237,7 +4004,7 @@ really_save_console_cb (GtkFileChooser *fs, int response, gpointer data)
}
static void
-save_console_cb (GtkWidget *w)
+save_console_cb (GSimpleAction *action, GVariant *param, gpointer data)
{
static GtkWidget *fs = NULL;
@@ -4252,8 +4019,8 @@ save_console_cb (GtkWidget *w)
fs = gtk_file_chooser_dialog_new (_("Save Console Output..."),
GTK_WINDOW (genius_window),
GTK_FILE_CHOOSER_ACTION_SAVE,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_SAVE, GTK_RESPONSE_OK,
+ _("_Cancel"), GTK_RESPONSE_CANCEL,
+ _("_Save"), GTK_RESPONSE_OK,
NULL);
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (fs), FALSE);
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (fs),
@@ -4282,7 +4049,7 @@ save_console_cb (GtkWidget *w)
static void
-close_callback (GtkWidget *menu_item, gpointer data)
+close_callback (GSimpleAction *action, GVariant *param, gpointer data)
{
GtkWidget *w;
Program *p;
@@ -4446,7 +4213,7 @@ run_program_idle (gpointer data)
}
static void
-run_program (GtkWidget *menu_item, gpointer data)
+run_program (GSimpleAction *action, GVariant *param, gpointer data)
{
g_idle_add (run_program_idle, NULL);
}
@@ -4454,39 +4221,44 @@ run_program (GtkWidget *menu_item, gpointer data)
static gboolean
delete_event (GtkWidget *w, GdkEventAny *e, gpointer data)
{
- quitapp (w, data);
+ GActionMap *map = G_ACTION_MAP (data);
+
+ g_action_activate (g_action_map_lookup_action (map, "quit"), NULL);
return TRUE;
}
static void
-create_main_window (GtkWidget *notebook)
+create_main_window (GtkWidget *notebook, GApplication *app)
{
+ GdkMonitor *monitor;
+ GdkRectangle geom;
char *s;
int width;
int height;
- genius_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ genius_window = gtk_application_window_new (GTK_APPLICATION (app));
s = g_strdup_printf (_("Genius %s"), VERSION);
gtk_window_set_title (GTK_WINDOW (genius_window), s);
g_free (s);
- gtk_window_set_wmclass (GTK_WINDOW (genius_window), "gnome-genius", "gnome-genius");
add_main_window_contents (genius_window, notebook);
/* Set default_size */
width = 800;
height = 600;
- if (width > gdk_screen_width () * 0.75)
- width = gdk_screen_width () * 0.75;
- if (height > gdk_screen_height () * 0.75)
- height = gdk_screen_height () * 0.75;
+ monitor = gdk_display_get_primary_monitor (gdk_display_get_default ());
+ gdk_monitor_get_geometry (monitor, &geom);
+ if (width > geom.width * 0.75)
+ width = geom.width * 0.75;
+ if (height > geom.height * 0.75)
+ height = geom.height * 0.75;
gtk_window_set_default_size (GTK_WINDOW (genius_window), width, height);
g_signal_connect (G_OBJECT (genius_window), "delete_event",
- G_CALLBACK (delete_event), NULL);
+ G_CALLBACK (delete_event), app);
}
static void
@@ -4715,7 +4487,7 @@ catch_interrupts (GtkWidget *w, GdkEvent *e)
e->key.keyval == GDK_KEY_c &&
#endif
e->key.state & GDK_CONTROL_MASK) {
- genius_interrupt_calc ();
+ genius_interrupt_calc (NULL, NULL, NULL);
return TRUE;
}
return FALSE;
@@ -4733,28 +4505,28 @@ open_plugin_cb (GtkWidget *w, GelPlugin * plug)
gel_open_plugin (plug);
}
-static pid_t
-my_fork_command (VteTerminal *terminal, char **argv)
+static void
+fork_done (VteTerminal *terminal, GPid pid, GError *error, gpointer data)
{
- gboolean ret;
- GPid child_pid;
-
- ret = vte_terminal_fork_command_full (terminal,
- VTE_PTY_DEFAULT | VTE_PTY_NO_LASTLOG | VTE_PTY_NO_UTMP |
VTE_PTY_NO_WTMP | VTE_PTY_NO_HELPER,
- NULL,
- argv,
- NULL,
- (GSpawnFlags)(G_SPAWN_CHILD_INHERITS_STDIN |
G_SPAWN_SEARCH_PATH),
- NULL,
- NULL,
- &child_pid,
- NULL);
-
- if (ret)
- return (pid_t) child_pid;
- else
- return -1;
+ helper_pid = (pid_t) pid;
+}
+static void
+my_fork_command (VteTerminal *terminal, char **argv)
+{
+ vte_terminal_spawn_async (terminal,
+ VTE_PTY_DEFAULT | VTE_PTY_NO_LASTLOG | VTE_PTY_NO_UTMP | VTE_PTY_NO_WTMP |
VTE_PTY_NO_HELPER,
+ NULL,
+ argv,
+ NULL,
+ G_SPAWN_CHILD_INHERITS_STDIN | G_SPAWN_SEARCH_PATH,
+ NULL,
+ NULL,
+ NULL,
+ -1,
+ NULL,
+ fork_done,
+ NULL);
}
static void
@@ -4831,7 +4603,7 @@ fork_a_helper (void)
argv[3] = NULL;
- helper_pid = my_fork_command (VTE_TERMINAL (term), argv);
+ my_fork_command (VTE_TERMINAL (term), argv);
g_free (libexecdir);
g_free (foo);
@@ -4983,8 +4755,7 @@ selection_changed (void)
if (page == 0) {
gboolean can_copy =
vte_terminal_get_has_selection (VTE_TERMINAL (term));
- gtk_widget_set_sensitive (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/EditMenu/Copy"),
- can_copy);
+ enable_action ("copy", can_copy);
}
}
@@ -4999,29 +4770,16 @@ switch_page (GtkNotebook *notebook, gpointer page, guint page_num)
if (p == NULL) {
/* console */
- gtk_widget_set_sensitive (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/FileMenu/Close"),
- FALSE);
+ enable_action ("close", FALSE);
if (selected_program == NULL) {
- gtk_widget_set_sensitive
- (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/CalculatorMenu/Run"),
- FALSE);
- gtk_widget_set_sensitive
- (gtk_ui_manager_get_widget (genius_ui, "/ToolBar/Run"),
- FALSE);
- gtk_widget_set_sensitive
- (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/FileMenu/Reload"),
- FALSE);
- gtk_widget_set_sensitive
- (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/FileMenu/Save"),
- FALSE);
- gtk_widget_set_sensitive
- (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/FileMenu/SaveAs"),
- FALSE);
+ enable_action ("run", FALSE);
+ enable_action ("reload", FALSE);
+ enable_action ("save", FALSE);
+ enable_action ("save-as", FALSE);
}
/* selection changed updates the copy item sensitivity */
selection_changed ();
- gtk_widget_set_sensitive (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/EditMenu/Cut"),
- FALSE);
+ enable_action ("cut", FALSE);
#ifdef HAVE_GTKSOURCEVIEW
setup_undo_redo ();
#endif
@@ -5031,18 +4789,11 @@ switch_page (GtkNotebook *notebook, gpointer page, guint page_num)
char *s;
/* something else */
- gtk_widget_set_sensitive (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/EditMenu/Cut"),
- TRUE);
- gtk_widget_set_sensitive (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/EditMenu/Copy"),
- TRUE);
- gtk_widget_set_sensitive (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/FileMenu/Close"),
- TRUE);
- gtk_widget_set_sensitive (gtk_ui_manager_get_widget (genius_ui,
"/MenuBar/CalculatorMenu/Run"),
- TRUE);
- gtk_widget_set_sensitive (gtk_ui_manager_get_widget (genius_ui, "/ToolBar/Run"),
- TRUE);
- gtk_widget_set_sensitive (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/FileMenu/SaveAs"),
- TRUE);
+ enable_action ("cut", TRUE);
+ enable_action ("copy", TRUE);
+ enable_action ("close", TRUE);
+ enable_action ("run", TRUE);
+ enable_action ("save-as", TRUE);
if (selected_program != NULL) {
selected_program->selected = FALSE;
@@ -5054,10 +4805,8 @@ switch_page (GtkNotebook *notebook, gpointer page, guint page_num)
setup_label (selected_program);
- gtk_widget_set_sensitive (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/FileMenu/Reload"),
- selected_program->real_file);
- gtk_widget_set_sensitive (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/FileMenu/Save"),
- selected_program->real_file);
+ enable_action ("reload", selected_program->real_file);
+ enable_action ("save", selected_program->real_file);
gtk_statusbar_pop (GTK_STATUSBAR (genius_window_statusbar),
0 /* context */);
@@ -5088,18 +4837,17 @@ get_version_details (void)
}
static void
-loadup_files_from_cmdline (int argc, char *argv[])
+loadup_files_from_cmdline (GApplication *app, GFile **files, gint n_files,
+ gchar *hint, gpointer data)
{
int i;
- for (i = 1; i < argc && argv[i] != NULL; i++) {
- GFile *file;
+ g_application_activate (app);
+
+ for (i = 0; i < n_files; i++) {
char *uri;
- file = g_file_new_for_commandline_arg (argv[i]);
- uri = g_file_get_uri (file);
-
- g_object_unref (file);
+ uri = g_file_get_uri (files[i]);
new_program (uri, FALSE);
@@ -5133,15 +4881,19 @@ update_term_geometry (void)
GdkGeometry hints;
int char_width;
int char_height;
- GtkBorder *border = NULL;
+ GtkBorder border;
+ GtkStyleContext *ctxt;
char_width = vte_terminal_get_char_width (VTE_TERMINAL (term));
char_height = vte_terminal_get_char_height (VTE_TERMINAL (term));
- gtk_widget_style_get (GTK_WIDGET (term), "inner-border", &border, NULL);
- hints.base_width = border->left + border->right;
- hints.base_height = border->top + border->bottom;
- gtk_border_free (border);
+ ctxt = gtk_widget_get_style_context (term);
+ gtk_style_context_get_padding (ctxt,
+ gtk_style_context_get_state (ctxt),
+ &border);
+
+ hints.base_width = border.left + border.right;
+ hints.base_height = border.top + border.bottom;
#define MIN_WIDTH_CHARS 10
#define MIN_HEIGHT_CHARS 4
@@ -5161,9 +4913,8 @@ update_term_geometry (void)
GDK_HINT_BASE_SIZE);
}
-
-int
-main (int argc, char *argv[])
+static void
+activate (GApplication *app, gpointer data)
{
GtkWidget *hbox;
GtkWidget *w;
@@ -5172,11 +4923,6 @@ main (int argc, char *argv[])
int example_count = 0;
gboolean give_no_lib_error_after_init = FALSE;
- arg0 = g_strdup (argv[0]);
-
- g_set_prgname ("gnome-genius");
- g_set_application_name (_("GNOME Genius"));
-
/* kind of a hack to find out if we are being run from the
* directory we were built in */
file = g_get_current_dir ();
@@ -5190,10 +4936,6 @@ main (int argc, char *argv[])
gbr_init (NULL);
}
g_free (file);
-
- bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
genius_datadir = gbr_find_data_dir (DATADIR);
/* Test the datadir */
@@ -5220,9 +4962,6 @@ main (int argc, char *argv[])
G_DIR_SEPARATOR_S,
NULL);
- gtk_init (&argc, &argv);
- /* FIXME: handle errors */
-
if (give_no_lib_error_after_init) {
genius_display_error (NULL /* parent */,
_("Cannot find the library file, genius installation may be
incorrect"));
@@ -5256,7 +4995,7 @@ main (int argc, char *argv[])
gtk_notebook_popup_enable (GTK_NOTEBOOK (genius_notebook));
/*set up the top level window*/
- create_main_window (genius_notebook);
+ create_main_window (genius_notebook, app);
/* Drag and drop support */
gtk_drag_dest_set (GTK_WIDGET (genius_window),
@@ -5275,7 +5014,7 @@ main (int argc, char *argv[])
G_CALLBACK (switch_page), NULL);
/*the main box to put everything in*/
- hbox = gtk_hbox_new(FALSE,0);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
term = vte_terminal_new ();
vte_terminal_set_scrollback_lines (VTE_TERMINAL (term),
@@ -5283,8 +5022,8 @@ main (int argc, char *argv[])
vte_terminal_set_audible_bell (VTE_TERMINAL (term), TRUE);
vte_terminal_set_scroll_on_keystroke (VTE_TERMINAL (term), TRUE);
vte_terminal_set_scroll_on_output (VTE_TERMINAL (term), FALSE);
- vte_terminal_set_word_chars (VTE_TERMINAL (term),
- "-A-Za-z0-9/_:.,?+%=");
+ vte_terminal_set_word_char_exceptions (VTE_TERMINAL (term),
+ "-/_:.,?+%=");
vte_terminal_set_backspace_binding (VTE_TERMINAL (term),
VTE_ERASE_ASCII_BACKSPACE);
/* FIXME: how come does backspace and not delete */
@@ -5299,8 +5038,9 @@ main (int argc, char *argv[])
gtk_box_pack_start (GTK_BOX (hbox), term, TRUE, TRUE, 0);
- w = gtk_vscrollbar_new
- (vte_terminal_get_adjustment (VTE_TERMINAL (term)));
+ w = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL,
+ gtk_scrollable_get_vadjustment
+ (GTK_SCROLLABLE (term)));
gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0);
/*set up the main window*/
@@ -5319,35 +5059,38 @@ main (int argc, char *argv[])
/* Try to deduce the standard font size, kind of evil, but sorta
* works. The user can always set the font themselves. */
{
- GtkStyle *style = gtk_widget_get_style (genius_window);
- int sz = (style == NULL ||
- style->font_desc == NULL) ? 10 :
- pango_font_description_get_size (style->font_desc) / PANGO_SCALE;
+ GtkStyleContext *ctxt;
+ PangoFontDescription *desc;
+ gint sz;
+
+ ctxt = gtk_widget_get_style_context (genius_window);
+ gtk_style_context_get (ctxt, GTK_STATE_FLAG_NORMAL,
+ GTK_STYLE_PROPERTY_FONT, &desc, NULL);
+ sz = pango_font_description_get_size (desc) / PANGO_SCALE;
+ pango_font_description_free (desc);
if (sz == 0) sz = 10;
default_console_font = g_strdup_printf ("Monospace %d", sz);
+ desc = pango_font_description_from_string
+ (ve_string_empty (genius_setup.font)
+ ? default_console_font
+ : genius_setup.font);
+ vte_terminal_set_font (VTE_TERMINAL (term), desc);
+ pango_font_description_free (desc);
}
- /* for some reason we must set the font here and not above
- * or the "monospace 12" (or default terminal font or whatnot)
- * will get used */
- vte_terminal_set_font_from_string (VTE_TERMINAL (term),
- ve_string_empty (genius_setup.font) ?
- default_console_font :
- genius_setup.font);
setup_term_color ();
vte_terminal_set_cursor_blink_mode
(VTE_TERMINAL (term),
genius_setup.blinking_cursor ?
VTE_CURSOR_BLINK_SYSTEM :
VTE_CURSOR_BLINK_OFF);
- vte_terminal_set_encoding (VTE_TERMINAL (term), "UTF-8");
update_term_geometry ();
g_signal_connect (G_OBJECT (term), "char-size-changed",
G_CALLBACK (update_term_geometry), NULL);
- gtk_widget_hide (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/PluginsMenu"));
- gtk_widget_hide (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/ExamplesMenu"));
+ gtk_widget_hide (plugin_menu);
+ gtk_widget_hide (example_menu);
/* Show the window now before going on with the
* setup */
@@ -5382,7 +5125,10 @@ main (int argc, char *argv[])
if (gel_plugin_list != NULL) {
GSList *li;
int i;
- GtkWidget *menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (gtk_ui_manager_get_widget
(genius_ui, "/MenuBar/PluginsMenu")));
+ GtkWidget *menu;
+
+ menu = gtk_menu_new ();
+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (plugin_menu), menu);
for (i = 0, li = gel_plugin_list;
li != NULL;
@@ -5408,10 +5154,9 @@ main (int argc, char *argv[])
}
/* if no plugins, hide the menu */
if (plugin_count == 0) {
- gtk_widget_hide (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/PluginsMenu"));
+ gtk_widget_hide (plugin_menu);
} else {
- gtk_widget_show (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/PluginsMenu"));
- gtk_widget_hide (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/PluginsMenu/NoPlugin"));
+ gtk_widget_show (plugin_menu);
}
@@ -5478,9 +5223,6 @@ main (int argc, char *argv[])
start_cb_p_expression (genius_got_etree, torlfp);
- /* Load all given files */
- loadup_files_from_cmdline (argc, argv);
-
/* check events so that we setup the examples menu only
* once everything is shown */
check_events();
@@ -5489,7 +5231,10 @@ main (int argc, char *argv[])
gel_read_example_list ();
if (gel_example_list != NULL) {
GSList *li, *l;
- GtkWidget *menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (gtk_ui_manager_get_widget
(genius_ui, "/MenuBar/ExamplesMenu")));
+ GtkWidget *menu;
+
+ menu = gtk_menu_new ();
+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (example_menu), menu);
for (li = gel_example_categories_list;
li != NULL;
@@ -5528,16 +5273,106 @@ main (int argc, char *argv[])
}
/* if no exampleials, hide the menu */
if (example_count == 0) {
- gtk_widget_hide (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/ExamplesMenu"));
+ gtk_widget_hide (example_menu);
} else {
- gtk_widget_show (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/ExamplesMenu"));
- gtk_widget_hide (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/ExamplesMenu/NoExample"));
+ gtk_widget_show (example_menu);
}
+}
- /*
- * Main loop
- */
- gtk_main ();
+static void
+startup (GApplication *app, gpointer data)
+{
+ const GActionEntry entries[] = {
+ { "new", new_callback },
+ { "open", open_callback },
+ { "save", save_callback },
+ { "save-all", save_all_cb },
+ { "save-as", save_as_callback },
+ { "reload", reload_cb },
+ { "close", close_callback },
+ { "load-run", load_cb },
+ { "save-console", save_console_cb },
+ { "quit", quitapp },
+#ifdef HAVE_GTKSOURCEVIEW
+ { "undo", undo_callback },
+ { "redo", redo_callback },
+#endif
+ { "cut", cut_callback },
+ { "copy", copy_callback },
+ { "paste", paste_callback },
+ { "copy-plain", copy_as_plain },
+ { "copy-latex", copy_as_latex },
+ { "copy-mathml", copy_as_mathml },
+ { "copy-troff", copy_as_troff },
+ { "run", run_program },
+ { "stop", genius_interrupt_calc },
+ { "answer", full_answer },
+ { "vars", show_user_vars },
+ { "monitor", monitor_user_var },
+ { "plot", genius_plot_dialog },
+ { "next", next_tab },
+ { "previous", prev_tab },
+ { "console", show_console },
+ { "prefs", setup_calc },
+ { "help", help_cb },
+ { "help-func", help_on_function },
+ { "warranty", warranty_call },
+ { "about", aboutcb },
+ { NULL }
+ };
+
+ g_set_application_name (_("GNOME Genius"));
+
+ g_assert (info_store == NULL);
+ info_store = amtk_action_info_store_new ();
+
+ amtk_action_info_store_add_entries (info_store, file_entries,
+ -1, GETTEXT_PACKAGE);
+ amtk_action_info_store_add_entries (info_store, edit_entries,
+ -1, GETTEXT_PACKAGE);
+ amtk_action_info_store_add_entries (info_store, calc_entries,
+ -1, GETTEXT_PACKAGE);
+ amtk_action_info_store_add_entries (info_store, prog_entries,
+ -1, GETTEXT_PACKAGE);
+ amtk_action_info_store_add_entries (info_store, pref_entries,
+ -1, GETTEXT_PACKAGE);
+ amtk_action_info_store_add_entries (info_store, help_entries,
+ -1, GETTEXT_PACKAGE);
+ amtk_action_map_add_action_entries_check_dups (G_ACTION_MAP (app),
+ entries, -1, app);
+}
+
+int
+main (int argc, char *argv[])
+{
+ GtkApplication *app;
+ int status;
+
+ arg0 = g_strdup (argv[0]);
+
+ bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ textdomain (GETTEXT_PACKAGE);
+
+ amtk_init ();
+#ifdef HAVE_GTKSOURCEVIEW
+ gtk_source_init ();
+#endif
+
+ app = gtk_application_new ("org.gnome.genius",
+ G_APPLICATION_HANDLES_OPEN);
+ g_signal_connect (app, "startup", G_CALLBACK (startup), NULL);
+ g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
+ g_signal_connect (app, "open",
+ G_CALLBACK (loadup_files_from_cmdline), NULL);
+ status = g_application_run (G_APPLICATION (app), argc, argv);
+
+ amtk_finalize ();
+#ifdef HAVE_GTKSOURCEVIEW
+ gtk_source_finalize ();
+#endif
+ g_object_unref (app);
+ g_clear_object (&info_store);
/*
* Save properties and plugins
@@ -5551,5 +5386,5 @@ main (int argc, char *argv[])
unlink (fromrlfifo);
unlink (torlfifo);
- return 0;
+ return status;
}
diff --git a/src/gnome-genius.h b/src/gnome-genius.h
index 8f48249f..175afde7 100644
--- a/src/gnome-genius.h
+++ b/src/gnome-genius.h
@@ -38,7 +38,7 @@ extern GtkWidget *genius_window;
extern int gel_calc_running;
extern long total_errors;
-void genius_interrupt_calc (void);
+void genius_interrupt_calc (GSimpleAction *a, GVariant *param, gpointer data);
void genius_setup_window_cursor (GtkWidget *win, GdkCursorType type);
void genius_unsetup_window_cursor (GtkWidget *win);
diff --git a/src/graphing.c b/src/graphing.c
index 79f075b0..7310c092 100644
--- a/src/graphing.c
+++ b/src/graphing.c
@@ -421,14 +421,6 @@ init_var_names (void)
sp_z_name = g_strdup ("z");
}
-static void
-color_alloc (GdkColor *color)
-{
- GdkColormap *colormap = gdk_colormap_get_system();
- gdk_colormap_alloc_color (colormap, color, FALSE /* writable */, TRUE /* best_match */);
- /* errors? */
-}
-
/* FIXME: This seems like a rather ugly hack, am I missing something about
* spinboxes or are they really this stupid */
static void
@@ -610,19 +602,17 @@ rotate_cb (GtkWidget *item, gpointer data)
(_("Rotate") /* title */,
GTK_WINDOW (graph_window) /* parent */,
GTK_DIALOG_MODAL /* flags */,
- GTK_STOCK_CLOSE,
+ _("_Close"),
GTK_RESPONSE_CLOSE,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (req),
GTK_RESPONSE_CLOSE);
- gtk_dialog_set_has_separator (GTK_DIALOG (req), FALSE);
-
sg = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
/* X dir */
- hbox = gtk_hbox_new (FALSE, GENIUS_PAD);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, GENIUS_PAD);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (req))),
hbox, TRUE, TRUE, 0);
@@ -637,21 +627,23 @@ rotate_cb (GtkWidget *item, gpointer data)
b = gtk_button_new ();
gtk_box_pack_start (GTK_BOX (hbox), b, FALSE, FALSE, 0);
gtk_container_add (GTK_CONTAINER (b),
- gtk_arrow_new (GTK_ARROW_LEFT, GTK_SHADOW_NONE));
+ gtk_image_new_from_icon_name ("pan-start-symbolic",
+ GTK_ICON_SIZE_BUTTON));
g_signal_connect (G_OBJECT (b), "clicked",
G_CALLBACK (rotate_x_cb),
GINT_TO_POINTER (360-10));
b = gtk_button_new ();
gtk_box_pack_start (GTK_BOX (hbox), b, FALSE, FALSE, 0);
gtk_container_add (GTK_CONTAINER (b),
- gtk_arrow_new (GTK_ARROW_RIGHT, GTK_SHADOW_NONE));
+ gtk_image_new_from_icon_name ("pan-end-symbolic",
+ GTK_ICON_SIZE_BUTTON));
g_signal_connect (G_OBJECT (b), "clicked",
G_CALLBACK (rotate_x_cb),
GINT_TO_POINTER (10));
/* Y dir */
- hbox = gtk_hbox_new (FALSE, GENIUS_PAD);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, GENIUS_PAD);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (req))),
hbox, TRUE, TRUE, 0);
@@ -666,21 +658,23 @@ rotate_cb (GtkWidget *item, gpointer data)
b = gtk_button_new ();
gtk_box_pack_start (GTK_BOX (hbox), b, FALSE, FALSE, 0);
gtk_container_add (GTK_CONTAINER (b),
- gtk_arrow_new (GTK_ARROW_LEFT, GTK_SHADOW_NONE));
+ gtk_image_new_from_icon_name ("pan-start-symbolic",
+ GTK_ICON_SIZE_BUTTON));
g_signal_connect (G_OBJECT (b), "clicked",
G_CALLBACK (rotate_y_cb),
GINT_TO_POINTER (360-10));
b = gtk_button_new ();
gtk_box_pack_start (GTK_BOX (hbox), b, FALSE, FALSE, 0);
gtk_container_add (GTK_CONTAINER (b),
- gtk_arrow_new (GTK_ARROW_RIGHT, GTK_SHADOW_NONE));
+ gtk_image_new_from_icon_name ("pan-end-symbolic",
+ GTK_ICON_SIZE_BUTTON));
g_signal_connect (G_OBJECT (b), "clicked",
G_CALLBACK (rotate_y_cb),
GINT_TO_POINTER (10));
/* Z dir */
- hbox = gtk_hbox_new (FALSE, GENIUS_PAD);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, GENIUS_PAD);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (req))),
hbox, TRUE, TRUE, 0);
@@ -691,14 +685,16 @@ rotate_cb (GtkWidget *item, gpointer data)
b = gtk_button_new ();
gtk_box_pack_start (GTK_BOX (hbox), b, FALSE, FALSE, 0);
gtk_container_add (GTK_CONTAINER (b),
- gtk_arrow_new (GTK_ARROW_LEFT, GTK_SHADOW_NONE));
+ gtk_image_new_from_icon_name ("pan-start-symbolic",
+ GTK_ICON_SIZE_BUTTON));
g_signal_connect (G_OBJECT (b), "clicked",
G_CALLBACK (rotate_z_cb),
GINT_TO_POINTER (360-10));
b = gtk_button_new ();
gtk_box_pack_start (GTK_BOX (hbox), b, FALSE, FALSE, 0);
gtk_container_add (GTK_CONTAINER (b),
- gtk_arrow_new (GTK_ARROW_RIGHT, GTK_SHADOW_NONE));
+ gtk_image_new_from_icon_name ("pan-end-symbolic",
+ GTK_ICON_SIZE_BUTTON));
g_signal_connect (G_OBJECT (b), "clicked",
G_CALLBACK (rotate_z_cb),
GINT_TO_POINTER (10));
@@ -834,17 +830,15 @@ plot_print_cb (void)
(_("Print") /* title */,
GTK_WINDOW (graph_window) /* parent */,
GTK_DIALOG_MODAL /* flags */,
- GTK_STOCK_CANCEL,
+ _("_Cancel"),
GTK_RESPONSE_CANCEL,
- GTK_STOCK_PRINT,
+ _("_Print"),
GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (req),
GTK_RESPONSE_OK);
- gtk_dialog_set_has_separator (GTK_DIALOG (req), FALSE);
-
- hbox = gtk_hbox_new (FALSE, GENIUS_PAD);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, GENIUS_PAD);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (req))),
hbox, TRUE, TRUE, 0);
@@ -1153,12 +1147,10 @@ really_export_png_cb (GtkFileChooser *fs, int response, gpointer data)
genius_display_error (graph_window, _("Export failed"));
return;
}
- pix = gdk_pixbuf_get_from_drawable
- (NULL /* dest */,
- GTK_PLOT_CANVAS (plot_canvas)->pixmap,
- NULL /* cmap */,
+
+ pix = gdk_pixbuf_get_from_surface
+ (GTK_PLOT_CANVAS (plot_canvas)->pixmap,
0 /* src x */, 0 /* src y */,
- 0 /* dest x */, 0 /* dest y */,
GTK_PLOT_CANVAS (plot_canvas)->pixmap_width,
GTK_PLOT_CANVAS (plot_canvas)->pixmap_height);
@@ -1212,8 +1204,8 @@ do_export_cb (int export_type)
fs = gtk_file_chooser_dialog_new (title,
GTK_WINDOW (graph_window),
GTK_FILE_CHOOSER_ACTION_SAVE,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_SAVE, GTK_RESPONSE_OK,
+ _("_Cancel"), GTK_RESPONSE_CANCEL,
+ _("_Save"), GTK_RESPONSE_OK,
NULL);
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (fs), TRUE);
@@ -1951,7 +1943,7 @@ solver_cb (GtkWidget *item, gpointer data)
(_("Solver") /* title */,
GTK_WINDOW (graph_window) /* parent */,
0 /* flags */,
- GTK_STOCK_CLOSE,
+ _("_Close"),
GTK_RESPONSE_CLOSE,
_("Clea_r solutions"),
RESPONSE_CLEAR,
@@ -1969,9 +1961,7 @@ solver_cb (GtkWidget *item, gpointer data)
gtk_dialog_set_default_response (GTK_DIALOG (solver_dialog),
RESPONSE_PLOT);
- gtk_dialog_set_has_separator (GTK_DIALOG (solver_dialog), FALSE);
-
- box = gtk_vbox_new (FALSE, GENIUS_PAD);
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, GENIUS_PAD);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (solver_dialog))),
box, TRUE, TRUE, 0);
gtk_container_set_border_width (GTK_CONTAINER (box), GENIUS_PAD);
@@ -2067,13 +2057,13 @@ static gboolean
plot_canvas_key_press_event (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
{
switch (event->keyval) {
- case GDK_Up:
+ case GDK_KEY_Up:
lineplot_move_graph (0.0, 0.1);
break;
- case GDK_Down:
+ case GDK_KEY_Down:
lineplot_move_graph (0.0, -0.1);
break;
- case GDK_Left:
+ case GDK_KEY_Left:
lineplot_move_graph (-0.1, 0.0);
if (plot_mode == MODE_SURFACE &&
@@ -2085,7 +2075,7 @@ plot_canvas_key_press_event (GtkWidget *widget, GdkEventKey *event, gpointer use
gtk_plot_canvas_refresh (GTK_PLOT_CANVAS (plot_canvas));
}
break;
- case GDK_Right:
+ case GDK_KEY_Right:
lineplot_move_graph (0.1, 0.0);
if (plot_mode == MODE_SURFACE &&
@@ -2122,16 +2112,16 @@ ensure_window (gboolean do_window_present)
accel_group = gtk_accel_group_new ();
gtk_accel_map_add_entry ("<Genius-Plot>/Zoom/Zoom out",
- GDK_minus,
+ GDK_KEY_minus,
GDK_CONTROL_MASK);
gtk_accel_map_add_entry ("<Genius-Plot>/Zoom/Zoom in",
- GDK_plus,
+ GDK_KEY_plus,
GDK_CONTROL_MASK);
gtk_accel_map_add_entry ("<Genius-Plot>/Zoom/Fit dependent axis",
- GDK_f,
+ GDK_KEY_f,
GDK_CONTROL_MASK);
gtk_accel_map_add_entry ("<Genius-Plot>/Zoom/Reset to original zoom",
- GDK_r,
+ GDK_KEY_r,
GDK_CONTROL_MASK);
first_time = FALSE;
}
@@ -2155,9 +2145,9 @@ ensure_window (gboolean do_window_present)
(_("Plot") /* title */,
NULL /*GTK_WINDOW (genius_window)*/ /* parent */,
0 /* flags */,
- GTK_STOCK_STOP,
+ _("_Stop"),
RESPONSE_STOP,
- GTK_STOCK_CLOSE,
+ _("_Close"),
GTK_RESPONSE_CLOSE,
NULL);
gtk_window_set_type_hint (GTK_WINDOW (graph_window),
@@ -2338,10 +2328,10 @@ ensure_window (gboolean do_window_present)
GTK_WIDGET (plot_canvas), TRUE, TRUE, 0);
gtk_widget_show (plot_canvas);
- errors_label_box = gtk_hbox_new (FALSE, GENIUS_PAD);
+ errors_label_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, GENIUS_PAD);
gtk_box_pack_start
(GTK_BOX (errors_label_box),
- GTK_WIDGET (gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING,
GTK_ICON_SIZE_SMALL_TOOLBAR)),
+ GTK_WIDGET (gtk_image_new_from_icon_name ("dialog-warning", GTK_ICON_SIZE_SMALL_TOOLBAR)),
FALSE, FALSE, 0);
gtk_box_pack_start
(GTK_BOX (errors_label_box),
@@ -2490,7 +2480,7 @@ plot_setup_axis (void)
int xprec, yprec, xstyle, ystyle;
double xtick, ytick;
GtkPlotAxis *axis;
- GdkColor gray;
+ GdkRGBA gray;
int xfontheight, yfontheight;
get_ticks (plotx1, plotx2, &xtick, &xprec, &xstyle, &xfontheight);
@@ -2513,8 +2503,7 @@ plot_setup_axis (void)
TRUE /* vmajor */,
FALSE /* vminor */);
- gdk_color_parse ("gray75", &gray);
- color_alloc (&gray);
+ gdk_rgba_parse (&gray, "gray75");
gtk_plot_x0line_set_attributes (GTK_PLOT (line_plot),
GTK_PLOT_LINE_SOLID,
@@ -3810,7 +3799,7 @@ parametric_get_value (double *x, double *y, double t)
}
static GtkPlotData *
-draw_line (double *x, double *y, int len, int thickness, GdkColor *color,
+draw_line (double *x, double *y, int len, int thickness, GdkRGBA *color,
char *legend, gboolean filled)
{
GtkPlotData *data;
@@ -3828,12 +3817,10 @@ draw_line (double *x, double *y, int len, int thickness, GdkColor *color,
gtk_plot_data_set_legend (data,
legend);
- color_alloc (color);
-
gtk_plot_data_set_line_attributes (data,
GTK_PLOT_LINE_SOLID,
- GDK_CAP_ROUND,
- GDK_JOIN_ROUND,
+ CAIRO_LINE_CAP_ROUND,
+ CAIRO_LINE_JOIN_ROUND,
thickness, color);
gtk_plot_data_fill_area (data, filled);
@@ -3848,7 +3835,7 @@ draw_line (double *x, double *y, int len, int thickness, GdkColor *color,
}
static GtkPlotData *
-draw_points (double *x, double *y, int len, int thickness, GdkColor *color,
+draw_points (double *x, double *y, int len, int thickness, GdkRGBA *color,
char *legend)
{
GtkPlotData *data;
@@ -3866,12 +3853,10 @@ draw_points (double *x, double *y, int len, int thickness, GdkColor *color,
gtk_plot_data_set_legend (data,
legend);
- color_alloc (color);
-
gtk_plot_data_set_line_attributes (data,
GTK_PLOT_LINE_SOLID,
- GDK_CAP_ROUND,
- GDK_JOIN_ROUND,
+ CAIRO_LINE_CAP_ROUND,
+ CAIRO_LINE_JOIN_ROUND,
thickness, color);
gtk_plot_data_set_connector (data, GTK_PLOT_CONNECT_NONE);
@@ -3886,7 +3871,7 @@ draw_points (double *x, double *y, int len, int thickness, GdkColor *color,
static GtkPlotData *
draw_surface_line (double *x, double *y, double *z,
- int len, int thickness, GdkColor *color, char *legend)
+ int len, int thickness, GdkRGBA *color, char *legend)
{
GtkPlotData *data;
@@ -3908,12 +3893,10 @@ draw_surface_line (double *x, double *y, double *z,
gtk_plot_data_set_legend (data,
legend);
- color_alloc (color);
-
gtk_plot_data_set_line_attributes (data,
GTK_PLOT_LINE_SOLID,
- GDK_CAP_ROUND,
- GDK_JOIN_ROUND,
+ CAIRO_LINE_CAP_ROUND,
+ CAIRO_LINE_JOIN_ROUND,
thickness, color);
gtk_widget_show (GTK_WIDGET (data));
@@ -3926,7 +3909,7 @@ draw_surface_line (double *x, double *y, double *z,
static GtkPlotData *
draw_surface_points (double *x, double *y, double *z,
- int len, int thickness, GdkColor *color, char *legend)
+ int len, int thickness, GdkRGBA *color, char *legend)
{
GtkPlotData *data;
@@ -3948,12 +3931,10 @@ draw_surface_points (double *x, double *y, double *z,
gtk_plot_data_set_legend (data,
legend);
- color_alloc (color);
-
gtk_plot_data_set_line_attributes (data,
GTK_PLOT_LINE_SOLID,
- GDK_CAP_ROUND,
- GDK_JOIN_ROUND,
+ CAIRO_LINE_CAP_ROUND,
+ CAIRO_LINE_JOIN_ROUND,
thickness, color);
gtk_plot_data_set_connector (data, GTK_PLOT_CONNECT_NONE);
@@ -4029,7 +4010,7 @@ slopefield_draw_solution (double x, double y, double dx, gboolean is_gui)
double cx, cy;
int len1, len2, len;
int i;
- GdkColor color;
+ GdkRGBA color;
GQueue points1 = G_QUEUE_INIT;
GSList *points2 = NULL;
GList *li;
@@ -4044,7 +4025,7 @@ slopefield_draw_solution (double x, double y, double dx, gboolean is_gui)
gel_calc_running ++;
plot_window_setup ();
- gdk_color_parse ("red", &color);
+ gdk_rgba_parse (&color, "red");
fudgey = (ploty2-ploty1)/100;
@@ -4185,7 +4166,7 @@ vectorfield_draw_solution (double x, double y, double dt, double tlen, gboolean
double cx, cy, t;
int len;
int i;
- GdkColor color;
+ GdkRGBA color;
GtkPlotData *data;
gboolean ex;
@@ -4199,7 +4180,7 @@ vectorfield_draw_solution (double x, double y, double dt, double tlen, gboolean
gel_calc_running ++;
plot_window_setup ();
- gdk_color_parse ("red", &color);
+ gdk_rgba_parse (&color, "red");
len = (int)(tlen / dt) + 2;
xx = g_new0 (double, len);
@@ -4287,7 +4268,7 @@ replot_fields (void)
if (slopefield_func != NULL) {
get_slopefield_points ();
if (plot_points_num > 0) {
- GdkColor color;
+ GdkRGBA color;
if (slopefield_data == NULL) {
char *label, *tmp;
@@ -4295,13 +4276,12 @@ replot_fields (void)
slopefield_data = GTK_PLOT_DATA(gtk_plot_flux_new());
gtk_plot_add_data (GTK_PLOT (line_plot),
slopefield_data);
- gdk_color_parse ("blue", &color);
- color_alloc (&color);
+ gdk_rgba_parse (&color, "blue");
gtk_plot_data_set_line_attributes
(slopefield_data,
GTK_PLOT_LINE_NONE,
- GDK_CAP_ROUND,
- GDK_JOIN_ROUND,
+ CAIRO_LINE_CAP_ROUND,
+ CAIRO_LINE_JOIN_ROUND,
1 /* thickness */,
&color);
gtk_plot_data_set_symbol (slopefield_data,
@@ -4353,7 +4333,7 @@ replot_fields (void)
if (vectorfield_func_x != NULL && vectorfield_func_y != NULL) {
get_vectorfield_points ();
if (plot_points_num > 0) {
- GdkColor color;
+ GdkRGBA color;
if (vectorfield_data == NULL) {
char *l1, *l2, *tmp;
@@ -4361,13 +4341,12 @@ replot_fields (void)
vectorfield_data = GTK_PLOT_DATA(gtk_plot_flux_new());
gtk_plot_add_data (GTK_PLOT (line_plot),
vectorfield_data);
- gdk_color_parse ("blue", &color);
- color_alloc (&color);
+ gdk_rgba_parse (&color, "blue");
gtk_plot_data_set_line_attributes
(vectorfield_data,
GTK_PLOT_LINE_NONE,
- GDK_CAP_ROUND,
- GDK_JOIN_ROUND,
+ CAIRO_LINE_CAP_ROUND,
+ CAIRO_LINE_JOIN_ROUND,
1 /* thickess */,
&color);
gtk_plot_data_set_symbol (vectorfield_data,
@@ -4854,7 +4833,7 @@ plot_functions (gboolean do_window_present,
color_i = 0;
for (i = 0; i < MAXFUNC && plot_func[i] != NULL; i++) {
- GdkColor color;
+ GdkRGBA color;
char *label;
line_data[i] = GTK_PLOT_DATA (gtk_plot_data_new ());
@@ -4863,12 +4842,11 @@ plot_functions (gboolean do_window_present,
gtk_widget_show (GTK_WIDGET (line_data[i]));
- gdk_color_parse (colors[color_i++], &color);
- color_alloc (&color);
+ gdk_rgba_parse (&color, colors[color_i++]);
gtk_plot_data_set_line_attributes (line_data[i],
GTK_PLOT_LINE_SOLID,
- GDK_CAP_ROUND,
- GDK_JOIN_ROUND,
+ CAIRO_LINE_CAP_ROUND,
+ CAIRO_LINE_JOIN_ROUND,
2, &color);
label = label_func (i, plot_func[i],
@@ -4901,7 +4879,7 @@ plot_functions (gboolean do_window_present,
if ((parametric_func_x != NULL && parametric_func_y != NULL) ||
(parametric_func_z != NULL)) {
- GdkColor color;
+ GdkRGBA color;
char *label;
int len;
double *x, *y;
@@ -4942,12 +4920,11 @@ plot_functions (gboolean do_window_present,
gtk_widget_show (GTK_WIDGET (parametric_data));
- gdk_color_parse (colors[color_i++], &color);
- color_alloc (&color);
+ gdk_rgba_parse (&color, colors[color_i++]);
gtk_plot_data_set_line_attributes (parametric_data,
GTK_PLOT_LINE_SOLID,
- GDK_CAP_ROUND,
- GDK_JOIN_ROUND,
+ CAIRO_LINE_CAP_ROUND,
+ CAIRO_LINE_JOIN_ROUND,
2, &color);
if (parametric_name != NULL) {
@@ -5219,7 +5196,7 @@ create_range_spinboxes (const char *title, GtkWidget **titlew,
GtkWidget *b, *w;
GtkAdjustment *adj;
- b = gtk_hbox_new (FALSE, GENIUS_PAD);
+ b = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, GENIUS_PAD);
w = gtk_label_new(title);
if (titlew != NULL) {
*titlew = w;
@@ -5322,7 +5299,7 @@ create_int_spinbox (const char *title, int *val, int min, int max)
GtkWidget *b, *w;
GtkAdjustment *adj;
- b = gtk_hbox_new (FALSE, GENIUS_PAD);
+ b = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, GENIUS_PAD);
w = gtk_label_new(title);
gtk_box_pack_start (GTK_BOX (b), w, FALSE, FALSE, 0);
adj = (GtkAdjustment *)gtk_adjustment_new (*val,
@@ -5355,7 +5332,7 @@ create_expression_box (const char *label,
GtkWidget *b;
GtkWidget *l;
- b = gtk_hbox_new (FALSE, GENIUS_PAD);
+ b = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, GENIUS_PAD);
l = gtk_label_new (label);
if (labelw != NULL) {
@@ -5386,7 +5363,7 @@ create_simple_expression_box (const char *label,
GtkWidget *b;
GtkWidget *l;
- b = gtk_hbox_new (FALSE, GENIUS_PAD);
+ b = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, GENIUS_PAD);
l = gtk_label_new (label);
if (labelw != NULL)
@@ -5666,17 +5643,15 @@ change_lineplot_varnames (GtkWidget *button, gpointer data)
(_("Change variable names") /* title */,
GTK_WINDOW (graph_window) /* parent */,
GTK_DIALOG_MODAL /* flags */,
- GTK_STOCK_OK,
+ _("_OK"),
GTK_RESPONSE_OK,
- GTK_STOCK_CANCEL,
+ _("_Cancel"),
GTK_RESPONSE_CANCEL,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (req),
GTK_RESPONSE_OK);
- gtk_dialog_set_has_separator (GTK_DIALOG (req), FALSE);
-
sg = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
errlabel = gtk_label_new (_("Some values were illegal"));
@@ -5685,7 +5660,7 @@ change_lineplot_varnames (GtkWidget *button, gpointer data)
b = create_simple_expression_box (_("independent variable (x):"),
&l, &xe);
- gtk_misc_set_alignment (GTK_MISC (l), 0.0, 0.5);
+ gtk_label_set_xalign (GTK_LABEL (l), 0.0);
gtk_size_group_add_widget (sg, l);
gtk_entry_set_text (GTK_ENTRY (xe), lp_x_name);
g_signal_connect (G_OBJECT (xe), "activate",
@@ -5695,7 +5670,7 @@ change_lineplot_varnames (GtkWidget *button, gpointer data)
b = create_simple_expression_box (_("dependent variable (y):"),
&l, &ye);
- gtk_misc_set_alignment (GTK_MISC (l), 0.0, 0.5);
+ gtk_label_set_xalign (GTK_LABEL (l), 0.0);
gtk_size_group_add_widget (sg, l);
gtk_entry_set_text (GTK_ENTRY (ye), lp_y_name);
g_signal_connect (G_OBJECT (ye), "activate",
@@ -5705,7 +5680,7 @@ change_lineplot_varnames (GtkWidget *button, gpointer data)
b = create_simple_expression_box (_("complex variable (z = x+iy):"),
&l, &ze);
- gtk_misc_set_alignment (GTK_MISC (l), 0.0, 0.5);
+ gtk_label_set_xalign (GTK_LABEL (l), 0.0);
gtk_size_group_add_widget (sg, l);
gtk_entry_set_text (GTK_ENTRY (ze), lp_z_name);
g_signal_connect (G_OBJECT (ze), "activate",
@@ -5715,7 +5690,7 @@ change_lineplot_varnames (GtkWidget *button, gpointer data)
b = create_simple_expression_box (_("parameter variable (t):"),
&l, &te);
- gtk_misc_set_alignment (GTK_MISC (l), 0.0, 0.5);
+ gtk_label_set_xalign (GTK_LABEL (l), 0.0);
gtk_size_group_add_widget (sg, l);
gtk_entry_set_text (GTK_ENTRY (te), lp_t_name);
g_signal_connect (G_OBJECT (te), "activate",
@@ -5785,17 +5760,15 @@ change_surface_varnames (GtkWidget *button, gpointer data)
(_("Change variable names") /* title */,
GTK_WINDOW (graph_window) /* parent */,
GTK_DIALOG_MODAL /* flags */,
- GTK_STOCK_OK,
+ _("_OK"),
GTK_RESPONSE_OK,
- GTK_STOCK_CANCEL,
+ _("_Cancel"),
GTK_RESPONSE_CANCEL,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (req),
GTK_RESPONSE_OK);
- gtk_dialog_set_has_separator (GTK_DIALOG (req), FALSE);
-
sg = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
errlabel = gtk_label_new (_("Some values were illegal"));
@@ -5804,7 +5777,7 @@ change_surface_varnames (GtkWidget *button, gpointer data)
b = create_simple_expression_box (_("independent variable (x):"),
&l, &xe);
- gtk_misc_set_alignment (GTK_MISC (l), 0.0, 0.5);
+ gtk_label_set_xalign (GTK_LABEL (l), 0.0);
gtk_size_group_add_widget (sg, l);
gtk_entry_set_text (GTK_ENTRY (xe), sp_x_name);
g_signal_connect (G_OBJECT (xe), "activate",
@@ -5814,7 +5787,7 @@ change_surface_varnames (GtkWidget *button, gpointer data)
b = create_simple_expression_box (_("independent variable (y):"),
&l, &ye);
- gtk_misc_set_alignment (GTK_MISC (l), 0.0, 0.5);
+ gtk_label_set_xalign (GTK_LABEL (l), 0.0);
gtk_size_group_add_widget (sg, l);
gtk_entry_set_text (GTK_ENTRY (ye), sp_y_name);
g_signal_connect (G_OBJECT (ye), "activate",
@@ -5824,7 +5797,7 @@ change_surface_varnames (GtkWidget *button, gpointer data)
b = create_simple_expression_box (_("independent complex variable (z = x+iy):"),
&l, &ze);
- gtk_misc_set_alignment (GTK_MISC (l), 0.0, 0.5);
+ gtk_label_set_xalign (GTK_LABEL (l), 0.0);
gtk_size_group_add_widget (sg, l);
gtk_entry_set_text (GTK_ENTRY (ze), sp_z_name);
g_signal_connect (G_OBJECT (ze), "activate",
@@ -5931,11 +5904,13 @@ create_lineplot_box (void)
{
GtkWidget *mainbox, *frame;
GtkWidget *box, *hbox, *b, *fb, *w;
+ GdkMonitor *monitor;
+ GdkRectangle geom;
int i;
init_var_names ();
- mainbox = gtk_vbox_new (FALSE, GENIUS_PAD);
+ mainbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, GENIUS_PAD);
gtk_container_set_border_width (GTK_CONTAINER (mainbox), GENIUS_PAD);
function_notebook = gtk_notebook_new ();
@@ -5944,11 +5919,12 @@ create_lineplot_box (void)
/*
* Line plot entries
*/
- box = gtk_vbox_new (FALSE, GENIUS_PAD);
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, GENIUS_PAD);
gtk_container_set_border_width (GTK_CONTAINER (box), GENIUS_PAD);
lineplot_info_label = gtk_label_new ("");
- gtk_misc_set_alignment (GTK_MISC (lineplot_info_label), 0.0, 0.5);
+ gtk_label_set_xalign (GTK_LABEL (lineplot_info_label), 0.0);
gtk_label_set_line_wrap (GTK_LABEL (lineplot_info_label), TRUE);
+ gtk_label_set_max_width_chars (GTK_LABEL (lineplot_info_label), 30);
gtk_widget_set_size_request (lineplot_info_label, 610, -1);
gtk_box_pack_start (GTK_BOX (box), lineplot_info_label, FALSE, FALSE, 0);
g_signal_connect (G_OBJECT (lineplot_info_label),
@@ -5958,7 +5934,9 @@ create_lineplot_box (void)
fb = box;
- if (gdk_screen_height () < 800) {
+ monitor = gdk_display_get_primary_monitor (gdk_display_get_default ());
+ gdk_monitor_get_geometry (monitor, &geom);
+ if (geom.height < 800) {
w = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (w),
GTK_POLICY_NEVER,
@@ -5968,7 +5946,7 @@ create_lineplot_box (void)
b = gtk_viewport_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (w), b);
- fb = gtk_vbox_new (FALSE, GENIUS_PAD);
+ fb = gtk_box_new (GTK_ORIENTATION_VERTICAL, GENIUS_PAD);
gtk_container_set_border_width (GTK_CONTAINER (fb), GENIUS_PAD);
gtk_container_add (GTK_CONTAINER (b), fb);
@@ -5992,11 +5970,12 @@ create_lineplot_box (void)
* Parametric plot entries
*/
- box = gtk_vbox_new (FALSE, GENIUS_PAD);
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, GENIUS_PAD);
gtk_container_set_border_width (GTK_CONTAINER (box), GENIUS_PAD);
parametric_info_label = gtk_label_new ("");
- gtk_misc_set_alignment (GTK_MISC (parametric_info_label), 0.0, 0.5);
+ gtk_label_set_xalign (GTK_LABEL (parametric_info_label), 0.0);
gtk_label_set_line_wrap (GTK_LABEL (parametric_info_label), TRUE);
+ gtk_label_set_max_width_chars (GTK_LABEL (parametric_info_label), 30);
gtk_widget_set_size_request (parametric_info_label, 610, -1);
gtk_box_pack_start (GTK_BOX (box), parametric_info_label, FALSE, FALSE, 0);
g_signal_connect (G_OBJECT (parametric_info_label),
@@ -6019,7 +5998,7 @@ create_lineplot_box (void)
gtk_box_pack_start (GTK_BOX (box), b, FALSE, FALSE, 0);
w = gtk_label_new (_("or"));
- gtk_misc_set_alignment (GTK_MISC (w), 0.0, 0.5);
+ gtk_label_set_xalign (GTK_LABEL (w), 0.0);
gtk_box_pack_start (GTK_BOX (box), w, FALSE, FALSE, 0);
/* z */
@@ -6054,12 +6033,13 @@ create_lineplot_box (void)
* Slopefield
*/
- box = gtk_vbox_new (FALSE, GENIUS_PAD);
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, GENIUS_PAD);
gtk_container_set_border_width (GTK_CONTAINER (box), GENIUS_PAD);
slopefield_info_label = gtk_label_new ("");
- gtk_misc_set_alignment (GTK_MISC (slopefield_info_label), 0.0, 0.5);
+ gtk_label_set_xalign (GTK_LABEL (slopefield_info_label), 0.0);
gtk_label_set_line_wrap (GTK_LABEL (slopefield_info_label), TRUE);
+ gtk_label_set_max_width_chars (GTK_LABEL (slopefield_info_label), 30);
gtk_widget_set_size_request (slopefield_info_label, 610, -1);
gtk_box_pack_start (GTK_BOX (box), slopefield_info_label, FALSE, FALSE, 0);
g_signal_connect (G_OBJECT (slopefield_info_label),
@@ -6090,12 +6070,13 @@ create_lineplot_box (void)
* Vectorfield
*/
- box = gtk_vbox_new (FALSE, GENIUS_PAD);
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, GENIUS_PAD);
gtk_container_set_border_width (GTK_CONTAINER (box), GENIUS_PAD);
vectorfield_info_label = gtk_label_new ("");
- gtk_misc_set_alignment (GTK_MISC (vectorfield_info_label), 0.0, 0.5);
+ gtk_label_set_xalign (GTK_LABEL (vectorfield_info_label), 0.0);
gtk_label_set_line_wrap (GTK_LABEL (vectorfield_info_label), TRUE);
+ gtk_label_set_max_width_chars (GTK_LABEL (vectorfield_info_label), 30);
gtk_widget_set_size_request (vectorfield_info_label, 610, -1);
gtk_box_pack_start (GTK_BOX (box), vectorfield_info_label, FALSE, FALSE, 0);
g_signal_connect (G_OBJECT (vectorfield_info_label),
@@ -6142,7 +6123,7 @@ create_lineplot_box (void)
* Below notebook
*/
- hbox = gtk_hbox_new (FALSE, GENIUS_PAD);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, GENIUS_PAD);
gtk_box_pack_start (GTK_BOX (mainbox), hbox, FALSE, FALSE, 0);
/* draw legend? */
@@ -6174,7 +6155,7 @@ create_lineplot_box (void)
/* plot window */
frame = gtk_frame_new (_("Plot Window"));
gtk_box_pack_start (GTK_BOX (mainbox), frame, FALSE, FALSE, 0);
- box = gtk_vbox_new (FALSE, GENIUS_PAD);
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, GENIUS_PAD);
gtk_container_set_border_width (GTK_CONTAINER (box), GENIUS_PAD);
gtk_container_add (GTK_CONTAINER (frame), box);
@@ -6246,22 +6227,24 @@ create_surface_box (void)
init_var_names ();
- mainbox = gtk_vbox_new (FALSE, GENIUS_PAD);
+ mainbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, GENIUS_PAD);
gtk_container_set_border_width (GTK_CONTAINER (mainbox), GENIUS_PAD);
frame = gtk_frame_new (_("Function / Expression"));
gtk_box_pack_start (GTK_BOX (mainbox), frame, FALSE, FALSE, 0);
- box = gtk_vbox_new (FALSE, GENIUS_PAD);
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, GENIUS_PAD);
gtk_container_set_border_width (GTK_CONTAINER (box), GENIUS_PAD);
gtk_container_add (GTK_CONTAINER (frame), box);
surface_info_label = gtk_label_new ("");
- gtk_misc_set_alignment (GTK_MISC (surface_info_label), 0.0, 0.5);
+ gtk_label_set_xalign (GTK_LABEL (surface_info_label), 0.0);
+ gtk_label_set_line_wrap (GTK_LABEL (surface_info_label), TRUE);
+ gtk_label_set_max_width_chars (GTK_LABEL (surface_info_label), 30);
gtk_widget_set_size_request (surface_info_label, 610, -1);
gtk_label_set_line_wrap (GTK_LABEL (surface_info_label), TRUE);
gtk_box_pack_start (GTK_BOX (box), surface_info_label, FALSE, FALSE, 0);
- b = gtk_hbox_new (FALSE, GENIUS_PAD);
+ b = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, GENIUS_PAD);
gtk_box_pack_start (GTK_BOX (box), b, FALSE, FALSE, 0);
surface_entry = gtk_entry_new ();
@@ -6272,7 +6255,7 @@ create_surface_box (void)
surface_entry_status = gtk_image_new ();
gtk_box_pack_start (GTK_BOX (b), surface_entry_status, FALSE, FALSE, 0);
- hbox = gtk_hbox_new (FALSE, GENIUS_PAD);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, GENIUS_PAD);
gtk_box_pack_start (GTK_BOX (mainbox), hbox, FALSE, FALSE, 0);
/* draw legend? */
@@ -6297,7 +6280,7 @@ create_surface_box (void)
frame = gtk_frame_new (_("Plot Window"));
gtk_box_pack_start (GTK_BOX (mainbox), frame, FALSE, FALSE, 0);
- box = gtk_vbox_new (FALSE, GENIUS_PAD);
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, GENIUS_PAD);
gtk_container_set_border_width (GTK_CONTAINER (box), GENIUS_PAD);
gtk_container_add (GTK_CONTAINER (frame), box);
@@ -6510,14 +6493,14 @@ get_func_from_entry (GtkWidget *entry, GtkWidget *status,
const char *str = gtk_entry_get_text (GTK_ENTRY (entry));
f = function_from_expression (str, var, ex);
if (f != NULL) {
- gtk_image_set_from_stock
+ gtk_image_set_from_icon_name
(GTK_IMAGE (status),
- GTK_STOCK_YES,
+ "gtk-yes",
GTK_ICON_SIZE_MENU);
} else if (*ex) {
- gtk_image_set_from_stock
+ gtk_image_set_from_icon_name
(GTK_IMAGE (status),
- GTK_STOCK_DIALOG_WARNING,
+ "dialog-warning",
GTK_ICON_SIZE_MENU);
f = NULL;
} else {
@@ -6540,14 +6523,14 @@ get_func_from_entry2 (GtkWidget *entry, GtkWidget *status,
const char *str = gtk_entry_get_text (GTK_ENTRY (entry));
f = function_from_expression2 (str, xname, yname, zname, ex);
if (f != NULL) {
- gtk_image_set_from_stock
+ gtk_image_set_from_icon_name
(GTK_IMAGE (status),
- GTK_STOCK_YES,
+ "gtk-yes",
GTK_ICON_SIZE_MENU);
} else if (*ex) {
- gtk_image_set_from_stock
+ gtk_image_set_from_icon_name
(GTK_IMAGE (status),
- GTK_STOCK_DIALOG_WARNING,
+ "dialog-warning",
GTK_ICON_SIZE_MENU);
f = NULL;
} else {
@@ -7241,7 +7224,7 @@ plot_dialog_response (GtkWidget *w, int response, gpointer data)
}
void
-genius_plot_dialog (void)
+genius_plot_dialog (GSimpleAction *action, GVariant *param, gpointer data)
{
GtkWidget *insides;
@@ -7254,7 +7237,7 @@ genius_plot_dialog (void)
(_("Create Plot") /* title */,
NULL /*GTK_WINDOW (genius_window)*/ /* parent */,
0 /* flags */,
- GTK_STOCK_CLOSE,
+ _("_Close"),
GTK_RESPONSE_CLOSE,
_("_Plot"),
RESPONSE_PLOT,
@@ -7264,7 +7247,6 @@ genius_plot_dialog (void)
gtk_dialog_set_default_response (GTK_DIALOG (plot_dialog),
RESPONSE_PLOT);
- gtk_dialog_set_has_separator (GTK_DIALOG (plot_dialog), FALSE);
g_signal_connect (G_OBJECT (plot_dialog),
"destroy",
G_CALLBACK (gtk_widget_destroyed),
@@ -8411,12 +8393,17 @@ static GelETree *
LinePlotMouseLocation_op (GelCtx *ctx, GelETree * * a, int *exception)
{
if (line_plot != NULL) {
+ GdkSeat *s;
GelETree *n;
GelMatrixW *m;
int xx, yy;
double x, y;
- gtk_widget_get_pointer (GTK_WIDGET (line_plot), &xx, &yy);
+ s = gdk_display_get_default_seat (gdk_display_get_default ());
+ gdk_window_get_device_position (gtk_widget_get_window
+ (GTK_WIDGET (line_plot)),
+ gdk_seat_get_pointer (s),
+ &xx, &yy, NULL);
gtk_plot_get_point (GTK_PLOT (line_plot), xx, yy, &x, &y);
/*make us a new empty node*/
@@ -8747,7 +8734,7 @@ get_surface_line_numbers (GelETree *a,
static void
draw_arrowhead (double xx1, double yy1, double xx2, double yy2,
- int thickness, GdkColor *color)
+ int thickness, GdkRGBA *color)
{
double x1, x2, y1, y2, xm, ym;
double *ax, *ay;
@@ -8784,21 +8771,21 @@ draw_arrowhead (double xx1, double yy1, double xx2, double yy2,
}
static gboolean
-get_color (GelETree *a, GdkColor *c, const char *funcname)
+get_color (GelETree *a, GdkRGBA *c, const char *funcname)
{
if (a == NULL) {
gel_errorout (_("%s: No color specified"),
funcname);
return FALSE;
} else if (a->type == GEL_STRING_NODE) {
- if ( ! gdk_color_parse (a->str.str, c)) {
+ if ( ! gdk_rgba_parse (c, a->str.str)) {
gel_errorout (_("%s: Cannot parse color '%s'"),
funcname, a->str.str);
return FALSE;
}
return TRUE;
} else if (a->type == GEL_IDENTIFIER_NODE) {
- if ( ! gdk_color_parse (a->id.id->token, c)) {
+ if ( ! gdk_rgba_parse (c, a->id.id->token)) {
gel_errorout (_("%s: Cannot parse color '%s'"),
funcname, a->id.id->token);
return FALSE;
@@ -8837,9 +8824,10 @@ get_color (GelETree *a, GdkColor *c, const char *funcname)
g = MAX(MIN(g,1.0),0.0);
b = MAX(MIN(b,1.0),0.0);
- c->red = MAX(MIN(r*65535,65535),0);
- c->green = MAX(MIN(g*65535,65535),0);
- c->blue = MAX(MIN(b*65535,65535),0);
+ c->red = r;
+ c->green = g;
+ c->blue = b;
+ c->alpha = 1.0;
return TRUE;
}
@@ -8859,7 +8847,7 @@ LinePlotDrawLine_op (GelCtx *ctx, GelETree * * a, int *exception)
int nextarg;
double *x, *y;
double minx = 0, miny = 0, maxx = 0, maxy = 0;
- GdkColor color;
+ GdkRGBA color;
int thickness;
gboolean arrow_origin = FALSE;
gboolean arrow_end = FALSE;
@@ -8911,7 +8899,7 @@ LinePlotDrawLine_op (GelCtx *ctx, GelETree * * a, int *exception)
maxy = MAX(y1,y2);
}
- gdk_color_parse ("black", &color);
+ gdk_rgba_parse (&color, "black");
thickness = 2;
for (i = nextarg; a[i] != NULL; i++) {
@@ -9149,7 +9137,7 @@ LinePlotDrawPoints_op (GelCtx *ctx, GelETree * * a, int *exception)
int nextarg;
double *x, *y;
double minx = 0, miny = 0, maxx = 0, maxy = 0;
- GdkColor color;
+ GdkRGBA color;
int thickness;
int i;
gboolean update = FALSE;
@@ -9194,7 +9182,7 @@ LinePlotDrawPoints_op (GelCtx *ctx, GelETree * * a, int *exception)
maxy = y1;
}
- gdk_color_parse ("black", &color);
+ gdk_rgba_parse (&color, "black");
thickness = 2;
for (i = nextarg; a[i] != NULL; i++) {
@@ -9368,7 +9356,7 @@ SurfacePlotDrawLine_op (GelCtx *ctx, GelETree * * a, int *exception)
int nextarg;
double *x, *y, *z;
double minx = 0, miny = 0, maxx = 0, maxy = 0, minz = 0, maxz = 0;
- GdkColor color;
+ GdkRGBA color;
int thickness;
int i;
gboolean update = FALSE;
@@ -9426,7 +9414,7 @@ SurfacePlotDrawLine_op (GelCtx *ctx, GelETree * * a, int *exception)
maxz = MAX(z1,z2);
}
- gdk_color_parse ("black", &color);
+ gdk_rgba_parse (&color, "black");
thickness = 2;
for (i = nextarg; a[i] != NULL; i++) {
@@ -9608,7 +9596,7 @@ SurfacePlotDrawPoints_op (GelCtx *ctx, GelETree * * a, int *exception)
int nextarg;
double *x, *y, *z;
double minx = 0, miny = 0, maxx = 0, maxy = 0, minz = 0, maxz = 0;
- GdkColor color;
+ GdkRGBA color;
int thickness;
int i;
gboolean update = FALSE;
@@ -9660,7 +9648,7 @@ SurfacePlotDrawPoints_op (GelCtx *ctx, GelETree * * a, int *exception)
maxz = z1;
}
- gdk_color_parse ("black", &color);
+ gdk_rgba_parse (&color, "black");
thickness = 2;
for (i = nextarg; a[i] != NULL; i++) {
@@ -10313,12 +10301,9 @@ ExportPlot_op (GelCtx *ctx, GelETree * * a, int *exception)
return NULL;
}
- pix = gdk_pixbuf_get_from_drawable
- (NULL /* dest */,
- GTK_PLOT_CANVAS (plot_canvas)->pixmap,
- NULL /* cmap */,
+ pix = gdk_pixbuf_get_from_surface
+ (GTK_PLOT_CANVAS (plot_canvas)->pixmap,
0 /* src x */, 0 /* src y */,
- 0 /* dest x */, 0 /* dest y */,
GTK_PLOT_CANVAS (plot_canvas)->pixmap_width,
GTK_PLOT_CANVAS (plot_canvas)->pixmap_height);
diff --git a/src/graphing.h b/src/graphing.h
index ae392c59..39fc867d 100644
--- a/src/graphing.h
+++ b/src/graphing.h
@@ -25,7 +25,7 @@
/* only doable in gui mode */
void gel_add_graph_functions (void);
-void genius_plot_dialog (void);
+void genius_plot_dialog (GSimpleAction *a, GVariant *param, gpointer data);
void gel_plot_canvas_thaw_completely (void);
diff --git a/ve/ve-miscui.c b/ve/ve-miscui.c
index 2e1ac1d6..380310fc 100644
--- a/ve/ve-miscui.c
+++ b/ve/ve-miscui.c
@@ -30,22 +30,29 @@
void
ve_entry_set_red (GtkWidget *w, gboolean state)
{
- if (state) {
- GtkStyle *ns;
- GdkColor red = { 0, 65535, 0, 0 };
-
- ns = gtk_style_copy (gtk_widget_get_style (w));
- g_object_ref (G_OBJECT (ns));
+ GtkCssProvider *provider;
+ GtkStyleContext *ctxt;
+ static gboolean css_installed = FALSE;
+ const gchar *css = ".red { color: red; }";
+
+ if (!css_installed) {
+ provider = gtk_css_provider_new ();
+ gtk_css_provider_load_from_data (provider, css, -1, NULL);
+ gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
+ GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ g_object_unref (provider);
+ css_installed = TRUE;
+ }
- ns->fg[GTK_STATE_NORMAL] = red;
- ns->text[GTK_STATE_NORMAL] = red;
+ ctxt = gtk_widget_get_style_context (w);
- gtk_widget_set_style (w, ns);
- g_object_unref (G_OBJECT (ns));
+ if (state) {
+ gtk_style_context_add_class (ctxt, "red");
gtk_widget_queue_draw (w);
} else {
- gtk_widget_set_style (w, NULL);
+ gtk_style_context_remove_class (ctxt, "red");
}
}
@@ -62,7 +69,6 @@ ve_hig_dialog_new (GtkWindow *parent,
{
GtkWidget *dialog;
GtkWidget *dialog_vbox;
- GtkWidget *dialog_action_area;
GtkWidget *hbox;
GtkWidget *vbox;
GtkWidget *label;
@@ -88,7 +94,6 @@ ve_hig_dialog_new (GtkWindow *parent,
dialog = gtk_dialog_new ();
- gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
gtk_window_set_title (GTK_WINDOW (dialog), "");
@@ -96,19 +101,19 @@ ve_hig_dialog_new (GtkWindow *parent,
dialog_vbox = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
gtk_box_set_spacing (GTK_BOX (dialog_vbox), 12);
- hbox = gtk_hbox_new (FALSE, 12);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start (GTK_BOX (dialog_vbox), hbox, FALSE, FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
gtk_widget_show (hbox);
if (type == GTK_MESSAGE_ERROR) {
- image = gtk_image_new_from_stock ("gtk-dialog-error", GTK_ICON_SIZE_DIALOG);
+ image = gtk_image_new_from_icon_name ("dialog-error", GTK_ICON_SIZE_DIALOG);
} else if (type == GTK_MESSAGE_QUESTION) {
- image = gtk_image_new_from_stock ("gtk-dialog-question", GTK_ICON_SIZE_DIALOG);
+ image = gtk_image_new_from_icon_name ("dialog-question", GTK_ICON_SIZE_DIALOG);
} else if (type == GTK_MESSAGE_INFO) {
- image = gtk_image_new_from_stock ("gtk-dialog-info", GTK_ICON_SIZE_DIALOG);
+ image = gtk_image_new_from_icon_name ("dialog-information", GTK_ICON_SIZE_DIALOG);
} else if (type == GTK_MESSAGE_WARNING) {
- image = gtk_image_new_from_stock ("gtk-dialog-warning", GTK_ICON_SIZE_DIALOG);
+ image = gtk_image_new_from_icon_name ("dialog-warning", GTK_ICON_SIZE_DIALOG);
} else {
image = NULL;
g_assert_not_reached ();
@@ -116,7 +121,7 @@ ve_hig_dialog_new (GtkWindow *parent,
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
gtk_widget_show (image);
- vbox = gtk_vbox_new (FALSE, 6);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
gtk_widget_show (vbox);
@@ -126,7 +131,7 @@ ve_hig_dialog_new (GtkWindow *parent,
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+ gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_widget_show (label);
g_free (title);
@@ -137,13 +142,10 @@ ve_hig_dialog_new (GtkWindow *parent,
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+ gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_widget_show (label);
}
- dialog_action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
- gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area), GTK_BUTTONBOX_END);
-
switch (buttons)
{
case GTK_BUTTONS_NONE:
@@ -151,7 +153,7 @@ ve_hig_dialog_new (GtkWindow *parent,
case GTK_BUTTONS_OK:
- button = gtk_button_new_from_stock (GTK_STOCK_OK);
+ button = gtk_button_new_with_mnemonic (_("_OK"));
gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, GTK_RESPONSE_OK);
gtk_widget_set_can_default (button, TRUE);
gtk_widget_show (button);
@@ -162,7 +164,7 @@ ve_hig_dialog_new (GtkWindow *parent,
case GTK_BUTTONS_CLOSE:
- button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
+ button = gtk_button_new_with_mnemonic (_("_Close"));
gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, GTK_RESPONSE_CLOSE);
gtk_widget_set_can_default (button, TRUE);
gtk_widget_show (button);
@@ -173,7 +175,7 @@ ve_hig_dialog_new (GtkWindow *parent,
case GTK_BUTTONS_CANCEL:
- button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
+ button = gtk_button_new_with_mnemonic (_("_Cancel"));
gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, GTK_RESPONSE_CANCEL);
gtk_widget_set_can_default (button, TRUE);
gtk_widget_show (button);
@@ -184,12 +186,12 @@ ve_hig_dialog_new (GtkWindow *parent,
case GTK_BUTTONS_YES_NO:
- button = gtk_button_new_from_stock (GTK_STOCK_NO);
+ button = gtk_button_new_with_mnemonic (_("_No"));
gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, GTK_RESPONSE_NO);
gtk_widget_set_can_default (button, TRUE);
gtk_widget_show (button);
- button = gtk_button_new_from_stock (GTK_STOCK_YES);
+ button = gtk_button_new_with_mnemonic (_("_Yes"));
gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, GTK_RESPONSE_YES);
gtk_widget_set_can_default (button, TRUE);
gtk_widget_show (button);
@@ -201,12 +203,12 @@ ve_hig_dialog_new (GtkWindow *parent,
case GTK_BUTTONS_OK_CANCEL:
- button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
+ button = gtk_button_new_with_mnemonic (_("_Cancel"));
gtk_widget_show (button);
gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, GTK_RESPONSE_CANCEL);
gtk_widget_set_can_default (button, TRUE);
- button = gtk_button_new_from_stock (GTK_STOCK_OK);
+ button = gtk_button_new_with_mnemonic (_("_OK"));
gtk_widget_show (button);
gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, GTK_RESPONSE_OK);
gtk_widget_set_can_default (button, TRUE);
@@ -337,9 +339,7 @@ ve_dialog_run_nonmodal (GtkDialog *dialog)
ri.loop = g_main_loop_new (NULL, FALSE);
- GDK_THREADS_LEAVE ();
g_main_loop_run (ri.loop);
- GDK_THREADS_ENTER ();
g_main_loop_unref (ri.loop);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]