summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 22ecc66)
raw | patch | inline | side by side (parent: 22ecc66)
author | joncruz <joncruz@users.sourceforge.net> | |
Tue, 20 May 2008 07:21:30 +0000 (07:21 +0000) | ||
committer | joncruz <joncruz@users.sourceforge.net> | |
Tue, 20 May 2008 07:21:30 +0000 (07:21 +0000) |
src/dyna-draw-context.cpp | patch | blob | history | |
src/dyna-draw-context.h | patch | blob | history | |
src/eraser-context.cpp | patch | blob | history | |
src/eraser-context.h | patch | blob | history |
index cc79dfd2e04d6d3e73ef2539eb6b4e7dce743120..9574d2cad0daf3db717fd2b936925dd18923855d 100644 (file)
static SPEventContextClass *parent_class;
-GtkType
-sp_dyna_draw_context_get_type(void)
+GType sp_dyna_draw_context_get_type(void)
{
static GType type = 0;
if (!type) {
GTypeInfo info = {
sizeof(SPDynaDrawContextClass),
- NULL, NULL,
- (GClassInitFunc) sp_dyna_draw_context_class_init,
- NULL, NULL,
+ 0, // base_init
+ 0, // base_finalize
+ (GClassInitFunc)sp_dyna_draw_context_class_init,
+ 0, // class_finalize
+ 0, // class_data
sizeof(SPDynaDrawContext),
- 4,
- (GInstanceInitFunc) sp_dyna_draw_context_init,
- NULL, /* value_table */
+ 0, // n_preallocs
+ (GInstanceInitFunc)sp_dyna_draw_context_init,
+ 0 // value_table
};
- type = g_type_register_static(SP_TYPE_EVENT_CONTEXT, "SPDynaDrawContext", &info, (GTypeFlags)0);
+ type = g_type_register_static(SP_TYPE_EVENT_CONTEXT, "SPDynaDrawContext", &info, static_cast<GTypeFlags>(0));
}
return type;
}
index 40e6c6376386fb69fa08db10428a9fefde02cc20..0e83f6b506e85c08a7d8e72220815715c6e602ce 100644 (file)
--- a/src/dyna-draw-context.h
+++ b/src/dyna-draw-context.h
-#ifndef __SP_DYNA_DRAW_CONTEXT_H__
-#define __SP_DYNA_DRAW_CONTEXT_H__
+#ifndef SP_DYNA_DRAW_CONTEXT_H_SEEN
+#define SP_DYNA_DRAW_CONTEXT_H_SEEN
/*
* Handwriting-like drawing mode
SPEventContextClass parent_class;
};
-GtkType sp_dyna_draw_context_get_type(void);
+GType sp_dyna_draw_context_get_type(void);
-#endif
+#endif // SP_DYNA_DRAW_CONTEXT_H_SEEN
/*
Local Variables:
diff --git a/src/eraser-context.cpp b/src/eraser-context.cpp
index 3fe661f99b1b6a414c32e13439218de4811c41a2..f30b004eae24d172b589ce85706e4d2185c6cbe2 100644 (file)
--- a/src/eraser-context.cpp
+++ b/src/eraser-context.cpp
@@ -104,24 +104,25 @@ static NR::Point sp_eraser_get_vpoint(SPEraserContext const *erc, NR::Point n);
static void draw_temporary_box(SPEraserContext *dc);
-static SPEventContextClass *parent_class;
+static SPEventContextClass *eraser_parent_class = 0;
-GtkType
-sp_eraser_context_get_type(void)
+GType sp_eraser_context_get_type(void)
{
static GType type = 0;
if (!type) {
GTypeInfo info = {
sizeof(SPEraserContextClass),
- NULL, NULL,
- (GClassInitFunc) sp_eraser_context_class_init,
- NULL, NULL,
+ 0, // base_init
+ 0, // base_finalize
+ (GClassInitFunc)sp_eraser_context_class_init,
+ 0, // class_finalize
+ 0, // class_data
sizeof(SPEraserContext),
- 4,
- (GInstanceInitFunc) sp_eraser_context_init,
- NULL, /* value_table */
+ 0, // n_preallocs
+ (GInstanceInitFunc)sp_eraser_context_init,
+ 0 // value_table
};
- type = g_type_register_static(SP_TYPE_EVENT_CONTEXT, "SPEraserContext", &info, (GTypeFlags)0);
+ type = g_type_register_static(SP_TYPE_EVENT_CONTEXT, "SPEraserContext", &info, static_cast<GTypeFlags>(0));
}
return type;
}
GObjectClass *object_class = (GObjectClass *) klass;
SPEventContextClass *event_context_class = (SPEventContextClass *) klass;
- parent_class = (SPEventContextClass*)g_type_class_peek_parent(klass);
+ eraser_parent_class = (SPEventContextClass*)g_type_class_peek_parent(klass);
object_class->dispose = sp_eraser_context_dispose;
erc->_message_context = 0;
}
- G_OBJECT_CLASS(parent_class)->dispose(object);
+ G_OBJECT_CLASS(eraser_parent_class)->dispose(object);
}
static void
{
SPEraserContext *erc = SP_ERASER_CONTEXT(ec);
- if (((SPEventContextClass *) parent_class)->setup)
- ((SPEventContextClass *) parent_class)->setup(ec);
+ if (((SPEventContextClass *) eraser_parent_class)->setup)
+ ((SPEventContextClass *) eraser_parent_class)->setup(ec);
erc->accumulated = new SPCurve(32);
erc->currentcurve = new SPCurve(4);
}
if (!ret) {
- if (((SPEventContextClass *) parent_class)->root_handler) {
- ret = ((SPEventContextClass *) parent_class)->root_handler(event_context, event);
+ if (((SPEventContextClass *) eraser_parent_class)->root_handler) {
+ ret = ((SPEventContextClass *) eraser_parent_class)->root_handler(event_context, event);
}
}
diff --git a/src/eraser-context.h b/src/eraser-context.h
index bc862012d9d772650f1f4aa82ded083e4a2119f3..b47c21b577cab1b48f04d3a85a79320d6e8cbdae 100644 (file)
--- a/src/eraser-context.h
+++ b/src/eraser-context.h
#define ERC_MAX_TILT 1.0
#define ERC_DEFAULT_TILT 0.0
-struct SPEraserContext
-{
- SPEventContext event_context;
-
+struct SPEraserContext : public SPEventContext {
/** accumulated shape which ultimately goes in svg:path */
SPCurve *accumulated;
/** left edge of the stroke; combined to get accumulated */
SPCurve *cal1;
+
/** right edge of the stroke; combined to get accumulated */
SPCurve *cal2;
/** left edge points for this segment */
NR::Point point1[SAMPLING_SIZE];
+
/** right edge points for this segment */
NR::Point point2[SAMPLING_SIZE];
+
/** number of edge points for this segment */
gint npoints;
NR::Point ang;
NR::Point last;
NR::Point del;
+
/* extended input data */
gdouble pressure;
gdouble xtilt;
gdouble ytilt;
+
/* attributes */
guint dragging : 1; /* mouse state: mouse is dragging */
guint usepressure : 1;
bool abs_width;
};
-struct SPEraserContextClass
-{
- SPEventContextClass parent_class;
-};
+struct SPEraserContextClass : public SPEventContextClass{};
-GtkType sp_eraser_context_get_type(void);
+GType sp_eraser_context_get_type(void);
#endif // SP_ERASER_CONTEXT_H_SEEN