summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarkus Engel <markus.engel@tum.de>2013-08-04 13:09:03 +0000
committerMarkus Engel <markus.engel@tum.de>2013-08-04 13:09:03 +0000
commitef3c72e61987caa06a105c70cec83089892581ed (patch)
treec524370af58fede78145448bfdaef7e5ececeac9 /src
parentCleaned up. (diff)
downloadinkscape-ef3c72e61987caa06a105c70cec83089892581ed.tar.gz
inkscape-ef3c72e61987caa06a105c70cec83089892581ed.zip
Cleaned up once more.
(bzr r11608.1.118)
Diffstat (limited to 'src')
-rw-r--r--src/draw-context.cpp131
-rw-r--r--src/draw-context.h1
-rw-r--r--src/dropper-context.h9
-rw-r--r--src/lpe-tool-context.cpp112
-rw-r--r--src/lpe-tool-context.h5
-rw-r--r--src/pen-context.cpp155
-rw-r--r--src/pen-context.h5
-rw-r--r--src/pencil-context.cpp54
-rw-r--r--src/pencil-context.h5
-rw-r--r--src/text-context.cpp791
10 files changed, 552 insertions, 716 deletions
diff --git a/src/draw-context.cpp b/src/draw-context.cpp
index fed757c0e..c33bb780c 100644
--- a/src/draw-context.cpp
+++ b/src/draw-context.cpp
@@ -67,134 +67,108 @@ static void spdc_reset_white(SPDrawContext *dc);
static void spdc_free_colors(SPDrawContext *dc);
SPDrawContext::SPDrawContext() : SPEventContext() {
- SPDrawContext* dc = this;
+ this->selection = 0;
+ this->grab = 0;
+ this->anchor_statusbar = false;
- dc->selection = 0;
- dc->grab = 0;
- dc->anchor_statusbar = false;
+ this->attach = FALSE;
- dc->attach = FALSE;
+ this->red_color = 0xff00007f;
+ this->blue_color = 0x0000ff7f;
+ this->green_color = 0x00ff007f;
+ this->red_curve_is_valid = false;
- dc->red_color = 0xff00007f;
- dc->blue_color = 0x0000ff7f;
- dc->green_color = 0x00ff007f;
- dc->red_curve_is_valid = false;
+ this->red_bpath = NULL;
+ this->red_curve = NULL;
- dc->red_bpath = NULL;
- dc->red_curve = NULL;
+ this->blue_bpath = NULL;
+ this->blue_curve = NULL;
- dc->blue_bpath = NULL;
- dc->blue_curve = NULL;
+ this->green_bpaths = NULL;
+ this->green_curve = NULL;
+ this->green_anchor = NULL;
+ this->green_closed = false;
- dc->green_bpaths = NULL;
- dc->green_curve = NULL;
- dc->green_anchor = NULL;
- dc->green_closed = false;
+ this->white_item = NULL;
+ this->white_curves = NULL;
+ this->white_anchors = NULL;
- dc->white_item = NULL;
- dc->white_curves = NULL;
- dc->white_anchors = NULL;
+ this->sa = NULL;
+ this->ea = NULL;
- dc->sa = NULL;
- dc->ea = NULL;
-
- dc->waiting_LPE_type = Inkscape::LivePathEffect::INVALID_LPE;
-
- //new (&dc->sel_changed_connection) sigc::connection();
- //new (&dc->sel_modified_connection) sigc::connection();
+ this->waiting_LPE_type = Inkscape::LivePathEffect::INVALID_LPE;
}
SPDrawContext::~SPDrawContext() {
- SPDrawContext *dc = SP_DRAW_CONTEXT(this);
-
- //dc->sel_changed_connection.~connection();
- //dc->sel_modified_connection.~connection();
-
- if (dc->grab) {
- sp_canvas_item_ungrab(dc->grab, GDK_CURRENT_TIME);
- dc->grab = NULL;
+ if (this->grab) {
+ sp_canvas_item_ungrab(this->grab, GDK_CURRENT_TIME);
+ this->grab = NULL;
}
- if (dc->selection) {
- dc->selection = NULL;
+ if (this->selection) {
+ this->selection = NULL;
}
- spdc_free_colors(dc);
-
- //G_OBJECT_CLASS(sp_draw_context_parent_class)->dispose(object);
+ spdc_free_colors(this);
}
void SPDrawContext::setup() {
- SPEventContext* ec = this;
-
- SPDrawContext *dc = SP_DRAW_CONTEXT(ec);
- SPDesktop *dt = ec->desktop;
-
-// if ((SP_EVENT_CONTEXT_CLASS(sp_draw_context_parent_class))->setup) {
-// (SP_EVENT_CONTEXT_CLASS(sp_draw_context_parent_class))->setup(ec);
-// }
SPEventContext::setup();
- dc->selection = sp_desktop_selection(dt);
+ this->selection = sp_desktop_selection(desktop);
// Connect signals to track selection changes
- dc->sel_changed_connection = dc->selection->connectChanged(
- sigc::bind(sigc::ptr_fun(&spdc_selection_changed), dc)
+ this->sel_changed_connection = this->selection->connectChanged(
+ sigc::bind(sigc::ptr_fun(&spdc_selection_changed), this)
);
- dc->sel_modified_connection = dc->selection->connectModified(
- sigc::bind(sigc::ptr_fun(&spdc_selection_modified), dc)
+ this->sel_modified_connection = this->selection->connectModified(
+ sigc::bind(sigc::ptr_fun(&spdc_selection_modified), this)
);
// Create red bpath
- dc->red_bpath = sp_canvas_bpath_new(sp_desktop_sketch(ec->desktop), NULL);
- sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(dc->red_bpath), dc->red_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
+ this->red_bpath = sp_canvas_bpath_new(sp_desktop_sketch(this->desktop), NULL);
+ sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(this->red_bpath), this->red_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
// Create red curve
- dc->red_curve = new SPCurve();
+ this->red_curve = new SPCurve();
// Create blue bpath
- dc->blue_bpath = sp_canvas_bpath_new(sp_desktop_sketch(ec->desktop), NULL);
- sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(dc->blue_bpath), dc->blue_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
+ this->blue_bpath = sp_canvas_bpath_new(sp_desktop_sketch(this->desktop), NULL);
+ sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(this->blue_bpath), this->blue_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
// Create blue curve
- dc->blue_curve = new SPCurve();
+ this->blue_curve = new SPCurve();
// Create green curve
- dc->green_curve = new SPCurve();
+ this->green_curve = new SPCurve();
// No green anchor by default
- dc->green_anchor = NULL;
- dc->green_closed = FALSE;
+ this->green_anchor = NULL;
+ this->green_closed = FALSE;
- dc->attach = TRUE;
- spdc_attach_selection(dc, dc->selection);
+ this->attach = TRUE;
+ spdc_attach_selection(this, this->selection);
}
void SPDrawContext::finish() {
- SPEventContext* ec = this;
+ this->sel_changed_connection.disconnect();
+ this->sel_modified_connection.disconnect();
- SPDrawContext *dc = SP_DRAW_CONTEXT(ec);
-
- dc->sel_changed_connection.disconnect();
- dc->sel_modified_connection.disconnect();
-
- if (dc->grab) {
- sp_canvas_item_ungrab(dc->grab, GDK_CURRENT_TIME);
+ if (this->grab) {
+ sp_canvas_item_ungrab(this->grab, GDK_CURRENT_TIME);
}
- if (dc->selection) {
- dc->selection = NULL;
+ if (this->selection) {
+ this->selection = NULL;
}
- spdc_free_colors(dc);
+ spdc_free_colors(this);
}
void SPDrawContext::set(const Inkscape::Preferences::Entry& value) {
}
bool SPDrawContext::root_handler(GdkEvent* event) {
- SPEventContext* ec = this;
-
gint ret = FALSE;
switch (event->type) {
@@ -218,9 +192,6 @@ bool SPDrawContext::root_handler(GdkEvent* event) {
}
if (!ret) {
-// if ((SP_EVENT_CONTEXT_CLASS(sp_draw_context_parent_class))->root_handler) {
-// ret = (SP_EVENT_CONTEXT_CLASS(sp_draw_context_parent_class))->root_handler(ec, event);
-// }
ret = SPEventContext::root_handler(event);
}
diff --git a/src/draw-context.h b/src/draw-context.h
index 96f38ea27..be3d08637 100644
--- a/src/draw-context.h
+++ b/src/draw-context.h
@@ -80,6 +80,7 @@ public:
bool anchor_statusbar;
+protected:
virtual void setup();
virtual void finish();
virtual void set(const Inkscape::Preferences::Entry& val);
diff --git a/src/dropper-context.h b/src/dropper-context.h
index a6ddf7305..4007c391f 100644
--- a/src/dropper-context.h
+++ b/src/dropper-context.h
@@ -29,14 +29,15 @@ public:
static const std::string prefsPath;
- virtual void setup();
- virtual void finish();
- virtual bool root_handler(GdkEvent* event);
-
virtual const std::string& getPrefsPath();
guint32 get_color();
+protected:
+ virtual void setup();
+ virtual void finish();
+ virtual bool root_handler(GdkEvent* event);
+
private:
double R;
double G;
diff --git a/src/lpe-tool-context.cpp b/src/lpe-tool-context.cpp
index a1c812049..0ae5058d7 100644
--- a/src/lpe-tool-context.cpp
+++ b/src/lpe-tool-context.cpp
@@ -75,75 +75,61 @@ const std::string& SPLPEToolContext::getPrefsPath() {
const std::string SPLPEToolContext::prefsPath = "/tools/lpetool";
SPLPEToolContext::SPLPEToolContext() : SPPenContext() {
- SPLPEToolContext* lc = this;
+ this->mode = Inkscape::LivePathEffect::BEND_PATH;
+ this->shape_editor = 0;
- lc->mode = Inkscape::LivePathEffect::BEND_PATH;
- lc->shape_editor = 0;
+ this->cursor_shape = cursor_crosshairs_xpm;
+ this->hot_x = 7;
+ this->hot_y = 7;
- lc->cursor_shape = cursor_crosshairs_xpm;
- lc->hot_x = 7;
- lc->hot_y = 7;
-
- lc->canvas_bbox = NULL;
- lc->measuring_items = new std::map<SPPath *, SPCanvasItem*>;
-
- //new (&lc->sel_changed_connection) sigc::connection();
+ this->canvas_bbox = NULL;
+ this->measuring_items = new std::map<SPPath *, SPCanvasItem*>;
}
SPLPEToolContext::~SPLPEToolContext() {
- SPLPEToolContext *lc = SP_LPETOOL_CONTEXT(this);
- delete lc->shape_editor;
+ delete this->shape_editor;
+ this->shape_editor = NULL;
- if (lc->canvas_bbox) {
- sp_canvas_item_destroy(SP_CANVAS_ITEM(lc->canvas_bbox));
- lc->canvas_bbox = NULL;
+ if (this->canvas_bbox) {
+ sp_canvas_item_destroy(SP_CANVAS_ITEM(this->canvas_bbox));
+ this->canvas_bbox = NULL;
}
- lpetool_delete_measuring_items(lc);
- delete lc->measuring_items;
- lc->measuring_items = NULL;
+ lpetool_delete_measuring_items(this);
+ delete this->measuring_items;
+ this->measuring_items = NULL;
- lc->sel_changed_connection.disconnect();
- //lc->sel_changed_connection.~connection();
-
-
- //G_OBJECT_CLASS(sp_lpetool_context_parent_class)->dispose(object);
+ this->sel_changed_connection.disconnect();
}
void SPLPEToolContext::setup() {
- SPEventContext* ec = this;
-
- SPLPEToolContext *lc = SP_LPETOOL_CONTEXT(ec);
-
-// if (((SPEventContextClass *) sp_lpetool_context_parent_class)->setup)
-// ((SPEventContextClass *) sp_lpetool_context_parent_class)->setup(ec);
SPPenContext::setup();
- Inkscape::Selection *selection = sp_desktop_selection (ec->desktop);
+ Inkscape::Selection *selection = sp_desktop_selection (this->desktop);
SPItem *item = selection->singleItem();
- lc->sel_changed_connection.disconnect();
- lc->sel_changed_connection =
- selection->connectChanged(sigc::bind(sigc::ptr_fun(&sp_lpetool_context_selection_changed), (gpointer)lc));
+ this->sel_changed_connection.disconnect();
+ this->sel_changed_connection =
+ selection->connectChanged(sigc::bind(sigc::ptr_fun(&sp_lpetool_context_selection_changed), (gpointer)this));
- lc->shape_editor = new ShapeEditor(ec->desktop);
+ this->shape_editor = new ShapeEditor(this->desktop);
- lpetool_context_switch_mode(lc, Inkscape::LivePathEffect::INVALID_LPE);
- lpetool_context_reset_limiting_bbox(lc);
- lpetool_create_measuring_items(lc);
+ lpetool_context_switch_mode(this, Inkscape::LivePathEffect::INVALID_LPE);
+ lpetool_context_reset_limiting_bbox(this);
+ lpetool_create_measuring_items(this);
// TODO temp force:
- ec->enableSelectionCue();
+ this->enableSelectionCue();
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
if (item) {
- lc->shape_editor->set_item(item, SH_NODEPATH);
- lc->shape_editor->set_item(item, SH_KNOTHOLDER);
+ this->shape_editor->set_item(item, SH_NODEPATH);
+ this->shape_editor->set_item(item, SH_KNOTHOLDER);
}
if (prefs->getBool("/tools/lpetool/selcue")) {
- ec->enableSelectionCue();
+ this->enableSelectionCue();
}
}
@@ -161,31 +147,20 @@ void sp_lpetool_context_selection_changed(Inkscape::Selection *selection, gpoint
}
void SPLPEToolContext::set(const Inkscape::Preferences::Entry& val) {
- SPEventContext* ec = this;
-
if (val.getEntryName() == "mode") {
Inkscape::Preferences::get()->setString("/tools/geometric/mode", "drag");
- SP_PEN_CONTEXT(ec)->mode = SPPenContext::MODE_DRAG;
- }
-
- /*
- //pass on up to parent class to handle common attributes.
- if ( sp_lpetool_context_parent_class->set ) {
- sp_lpetool_context_parent_class->set(ec, key, val);
+ SP_PEN_CONTEXT(this)->mode = SPPenContext::MODE_DRAG;
}
- */
}
bool SPLPEToolContext::item_handler(SPItem* item, GdkEvent* event) {
- SPEventContext* ec = this;
-
gint ret = FALSE;
switch (event->type) {
case GDK_BUTTON_PRESS:
{
// select the clicked item but do nothing else
- Inkscape::Selection * const selection = sp_desktop_selection(ec->desktop);
+ Inkscape::Selection * const selection = sp_desktop_selection(this->desktop);
selection->clear();
selection->add(item);
ret = TRUE;
@@ -200,8 +175,6 @@ bool SPLPEToolContext::item_handler(SPItem* item, GdkEvent* event) {
}
if (!ret) {
-// if (((SPEventContextClass *) sp_lpetool_context_parent_class)->item_handler)
-// ret = ((SPEventContextClass *) sp_lpetool_context_parent_class)->item_handler(ec, item, event);
ret = SPPenContext::item_handler(item, event);
}
@@ -209,25 +182,21 @@ bool SPLPEToolContext::item_handler(SPItem* item, GdkEvent* event) {
}
bool SPLPEToolContext::root_handler(GdkEvent* event) {
- SPEventContext* event_context = this;
-
- SPLPEToolContext *lc = SP_LPETOOL_CONTEXT(event_context);
- SPDesktop *desktop = event_context->desktop;
Inkscape::Selection *selection = sp_desktop_selection (desktop);
bool ret = false;
- if (sp_pen_context_has_waiting_LPE(lc)) {
+ if (sp_pen_context_has_waiting_LPE(this)) {
// quit when we are waiting for a LPE to be applied
//ret = ((SPEventContextClass *) sp_lpetool_context_parent_class)->root_handler(event_context, event);
- ret = event_context->root_handler(event);
+ ret = this->root_handler(event);
return ret;
}
switch (event->type) {
case GDK_BUTTON_PRESS:
- if (event->button.button == 1 && !event_context->space_panning) {
- if (lc->mode == Inkscape::LivePathEffect::INVALID_LPE) {
+ if (event->button.button == 1 && !this->space_panning) {
+ if (this->mode == Inkscape::LivePathEffect::INVALID_LPE) {
// don't do anything for now if we are inactive (except clearing the selection
// since this was a click into empty space)
selection->clear();
@@ -237,9 +206,9 @@ bool SPLPEToolContext::root_handler(GdkEvent* event) {
}
// save drag origin
- event_context->xp = (gint) event->button.x;
- event_context->yp = (gint) event->button.y;
- event_context->within_tolerance = true;
+ this->xp = (gint) event->button.x;
+ this->yp = (gint) event->button.y;
+ this->within_tolerance = true;
using namespace Inkscape::LivePathEffect;
@@ -249,11 +218,11 @@ bool SPLPEToolContext::root_handler(GdkEvent* event) {
//bool over_stroke = lc->shape_editor->is_over_stroke(Geom::Point(event->button.x, event->button.y), true);
- sp_pen_context_wait_for_LPE_mouse_clicks(lc, type, Inkscape::LivePathEffect::Effect::acceptsNumClicks(type));
+ sp_pen_context_wait_for_LPE_mouse_clicks(this, type, Inkscape::LivePathEffect::Effect::acceptsNumClicks(type));
// we pass the mouse click on to pen tool as the first click which it should collect
//ret = ((SPEventContextClass *) sp_lpetool_context_parent_class)->root_handler(event_context, event);
- ret = event_context->root_handler(event);
+ ret = this->root_handler(event);
}
break;
@@ -289,9 +258,6 @@ bool SPLPEToolContext::root_handler(GdkEvent* event) {
}
if (!ret) {
-// if (((SPEventContextClass *) sp_lpetool_context_parent_class)->root_handler) {
-// ret = ((SPEventContextClass *) sp_lpetool_context_parent_class)->root_handler(event_context, event);
-// }
ret = SPPenContext::root_handler(event);
}
diff --git a/src/lpe-tool-context.h b/src/lpe-tool-context.h
index 6d36594fe..11758ad0c 100644
--- a/src/lpe-tool-context.h
+++ b/src/lpe-tool-context.h
@@ -58,12 +58,13 @@ public:
static const std::string prefsPath;
+ virtual const std::string& getPrefsPath();
+
+protected:
virtual void setup();
virtual void set(const Inkscape::Preferences::Entry& val);
virtual bool root_handler(GdkEvent* event);
virtual bool item_handler(SPItem* item, GdkEvent* event);
-
- virtual const std::string& getPrefsPath();
};
int lpetool_mode_to_index(Inkscape::LivePathEffect::EffectType const type);
diff --git a/src/pen-context.cpp b/src/pen-context.cpp
index fbcb6dae5..1221c7ec7 100644
--- a/src/pen-context.cpp
+++ b/src/pen-context.cpp
@@ -90,59 +90,51 @@ const std::string& SPPenContext::getPrefsPath() {
const std::string SPPenContext::prefsPath = "/tools/freehand/pen";
SPPenContext::SPPenContext() : SPDrawContext() {
- SPPenContext* pc = this;
+ this->polylines_only = false;
+ this->polylines_paraxial = false;
+ this->expecting_clicks_for_LPE = 0;
- pc->polylines_only = false;
- pc->polylines_paraxial = false;
- pc->expecting_clicks_for_LPE = 0;
+ this->cursor_shape = cursor_pen_xpm;
+ this->hot_x = 4;
+ this->hot_y = 4;
- SPEventContext *event_context = SP_EVENT_CONTEXT(pc);
-
- event_context->cursor_shape = cursor_pen_xpm;
- event_context->hot_x = 4;
- event_context->hot_y = 4;
-
- pc->npoints = 0;
- pc->mode = MODE_CLICK;
- pc->state = POINT;
+ this->npoints = 0;
+ this->mode = MODE_CLICK;
+ this->state = POINT;
- pc->c0 = NULL;
- pc->c1 = NULL;
- pc->cl0 = NULL;
- pc->cl1 = NULL;
+ this->c0 = NULL;
+ this->c1 = NULL;
+ this->cl0 = NULL;
+ this->cl1 = NULL;
- pc->events_disabled = 0;
+ this->events_disabled = 0;
- pc->num_clicks = 0;
- pc->waiting_LPE = NULL;
- pc->waiting_item = NULL;
+ this->num_clicks = 0;
+ this->waiting_LPE = NULL;
+ this->waiting_item = NULL;
}
SPPenContext::~SPPenContext() {
- SPPenContext *pc = SP_PEN_CONTEXT(this);
-
- if (pc->c0) {
- sp_canvas_item_destroy(pc->c0);
- pc->c0 = NULL;
+ if (this->c0) {
+ sp_canvas_item_destroy(this->c0);
+ this->c0 = NULL;
}
- if (pc->c1) {
- sp_canvas_item_destroy(pc->c1);
- pc->c1 = NULL;
+ if (this->c1) {
+ sp_canvas_item_destroy(this->c1);
+ this->c1 = NULL;
}
- if (pc->cl0) {
- sp_canvas_item_destroy(pc->cl0);
- pc->cl0 = NULL;
+ if (this->cl0) {
+ sp_canvas_item_destroy(this->cl0);
+ this->cl0 = NULL;
}
- if (pc->cl1) {
- sp_canvas_item_destroy(pc->cl1);
- pc->cl1 = NULL;
+ if (this->cl1) {
+ sp_canvas_item_destroy(this->cl1);
+ this->cl1 = NULL;
}
- //G_OBJECT_CLASS(sp_pen_context_parent_class)->dispose(object);
-
- if (pc->expecting_clicks_for_LPE > 0) {
+ if (this->expecting_clicks_for_LPE > 0) {
// we received too few clicks to sanely set the parameter path so we remove the LPE from the item
- sp_lpe_item_remove_current_path_effect(pc->waiting_item, false);
+ sp_lpe_item_remove_current_path_effect(this->waiting_item, false);
}
}
@@ -157,42 +149,34 @@ void sp_pen_context_set_polyline_mode(SPPenContext *const pc) {
* Callback to initialize SPPenContext object.
*/
void SPPenContext::setup() {
- SPEventContext* ec = this;
-
- SPPenContext *pc = SP_PEN_CONTEXT(ec);
-
-// if (((SPEventContextClass *) sp_pen_context_parent_class)->setup) {
-// ((SPEventContextClass *) sp_pen_context_parent_class)->setup(ec);
-// }
SPDrawContext::setup();
ControlManager &mgr = ControlManager::getManager();
// Pen indicators
- pc->c0 = mgr.createControl(sp_desktop_controls(SP_EVENT_CONTEXT_DESKTOP(ec)), Inkscape::CTRL_TYPE_ADJ_HANDLE);
- mgr.track(pc->c0);
+ this->c0 = mgr.createControl(sp_desktop_controls(SP_EVENT_CONTEXT_DESKTOP(this)), Inkscape::CTRL_TYPE_ADJ_HANDLE);
+ mgr.track(this->c0);
- pc->c1 = mgr.createControl(sp_desktop_controls(SP_EVENT_CONTEXT_DESKTOP(ec)), Inkscape::CTRL_TYPE_ADJ_HANDLE);
- mgr.track(pc->c1);
+ this->c1 = mgr.createControl(sp_desktop_controls(SP_EVENT_CONTEXT_DESKTOP(this)), Inkscape::CTRL_TYPE_ADJ_HANDLE);
+ mgr.track(this->c1);
- pc->cl0 = mgr.createControlLine(sp_desktop_controls(SP_EVENT_CONTEXT_DESKTOP(ec)));
- pc->cl1 = mgr.createControlLine(sp_desktop_controls(SP_EVENT_CONTEXT_DESKTOP(ec)));
+ this->cl0 = mgr.createControlLine(sp_desktop_controls(SP_EVENT_CONTEXT_DESKTOP(this)));
+ this->cl1 = mgr.createControlLine(sp_desktop_controls(SP_EVENT_CONTEXT_DESKTOP(this)));
+ sp_canvas_item_hide(this->c0);
+ sp_canvas_item_hide(this->c1);
+ sp_canvas_item_hide(this->cl0);
+ sp_canvas_item_hide(this->cl1);
- sp_canvas_item_hide(pc->c0);
- sp_canvas_item_hide(pc->c1);
- sp_canvas_item_hide(pc->cl0);
- sp_canvas_item_hide(pc->cl1);
-
- sp_event_context_read(ec, "mode");
+ sp_event_context_read(this, "mode");
- pc->anchor_statusbar = false;
+ this->anchor_statusbar = false;
- sp_pen_context_set_polyline_mode(pc);
+ sp_pen_context_set_polyline_mode(this);
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
if (prefs->getBool("/tools/freehand/pen/selcue")) {
- ec->enableSelectionCue();
+ this->enableSelectionCue();
}
}
@@ -215,19 +199,12 @@ static void pen_cancel (SPPenContext *const pc)
* Finalization callback.
*/
void SPPenContext::finish() {
- SPEventContext* ec = this;
-
- SPPenContext *pc = SP_PEN_CONTEXT(ec);
-
- sp_event_context_discard_delayed_snap_event(ec);
+ sp_event_context_discard_delayed_snap_event(this);
- if (pc->npoints != 0) {
- pen_cancel (pc);
+ if (this->npoints != 0) {
+ pen_cancel(this);
}
-// if (((SPEventContextClass *) sp_pen_context_parent_class)->finish) {
-// ((SPEventContextClass *) sp_pen_context_parent_class)->finish(ec);
-// }
SPDrawContext::finish();
}
@@ -235,16 +212,13 @@ void SPPenContext::finish() {
* Callback that sets key to value in pen context.
*/
void SPPenContext::set(const Inkscape::Preferences::Entry& val) {
- SPEventContext* ec = this;
-
- SPPenContext *pc = SP_PEN_CONTEXT(ec);
Glib::ustring name = val.getEntryName();
if (name == "mode") {
if ( val.getString() == "drag" ) {
- pc->mode = MODE_DRAG;
+ this->mode = MODE_DRAG;
} else {
- pc->mode = MODE_CLICK;
+ this->mode = MODE_CLICK;
}
}
}
@@ -292,26 +266,20 @@ static void spdc_endpoint_snap_handle(SPPenContext const *const pc, Geom::Point
}
bool SPPenContext::item_handler(SPItem* item, GdkEvent* event) {
- SPEventContext* ec = this;
-
- SPPenContext *const pc = SP_PEN_CONTEXT(ec);
-
gint ret = FALSE;
switch (event->type) {
case GDK_BUTTON_PRESS:
- ret = pen_handle_button_press(pc, event->button);
+ ret = pen_handle_button_press(this, event->button);
break;
case GDK_BUTTON_RELEASE:
- ret = pen_handle_button_release(pc, event->button);
+ ret = pen_handle_button_release(this, event->button);
break;
default:
break;
}
if (!ret) {
-// if (((SPEventContextClass *) sp_pen_context_parent_class)->item_handler)
-// ret = ((SPEventContextClass *) sp_pen_context_parent_class)->item_handler(ec, item, event);
ret = SPDrawContext::item_handler(item, event);
}
@@ -322,31 +290,27 @@ bool SPPenContext::item_handler(SPItem* item, GdkEvent* event) {
* Callback to handle all pen events.
*/
bool SPPenContext::root_handler(GdkEvent* event) {
- SPEventContext* ec = this;
-
- SPPenContext *const pc = SP_PEN_CONTEXT(ec);
-
gint ret = FALSE;
switch (event->type) {
case GDK_BUTTON_PRESS:
- ret = pen_handle_button_press(pc, event->button);
+ ret = pen_handle_button_press(this, event->button);
break;
case GDK_MOTION_NOTIFY:
- ret = pen_handle_motion_notify(pc, event->motion);
+ ret = pen_handle_motion_notify(this, event->motion);
break;
case GDK_BUTTON_RELEASE:
- ret = pen_handle_button_release(pc, event->button);
+ ret = pen_handle_button_release(this, event->button);
break;
case GDK_2BUTTON_PRESS:
- ret = pen_handle_2button_press(pc, event->button);
+ ret = pen_handle_2button_press(this, event->button);
break;
case GDK_KEY_PRESS:
- ret = pen_handle_key_press(pc, event);
+ ret = pen_handle_key_press(this, event);
break;
default:
@@ -354,11 +318,6 @@ bool SPPenContext::root_handler(GdkEvent* event) {
}
if (!ret) {
-// gint (*const parent_root_handler)(SPEventContext *, GdkEvent *)
-// = ((SPEventContextClass *) sp_pen_context_parent_class)->root_handler;
-// if (parent_root_handler) {
-// ret = parent_root_handler(ec, event);
-// }
ret = SPDrawContext::root_handler(event);
}
diff --git a/src/pen-context.h b/src/pen-context.h
index 070d33a26..3c83f3b7f 100644
--- a/src/pen-context.h
+++ b/src/pen-context.h
@@ -60,13 +60,14 @@ public:
static const std::string prefsPath;
+ virtual const std::string& getPrefsPath();
+
+protected:
virtual void setup();
virtual void finish();
virtual void set(const Inkscape::Preferences::Entry& val);
virtual bool root_handler(GdkEvent* event);
virtual bool item_handler(SPItem* item, GdkEvent* event);
-
- virtual const std::string& getPrefsPath();
};
inline bool sp_pen_context_has_waiting_LPE(SPPenContext *pc) {
diff --git a/src/pencil-context.cpp b/src/pencil-context.cpp
index c7257ff10..94310ea31 100644
--- a/src/pencil-context.cpp
+++ b/src/pencil-context.cpp
@@ -81,42 +81,31 @@ const std::string& SPPencilContext::getPrefsPath() {
const std::string SPPencilContext::prefsPath = "/tools/freehand/pencil";
SPPencilContext::SPPencilContext() : SPDrawContext() {
- SPPencilContext* pc = this;
+ this->is_drawing = false;
- pc->is_drawing = false;
+ this->cursor_shape = cursor_pencil_xpm;
+ this->hot_x = 4;
+ this->hot_y = 4;
- SPEventContext *event_context = SP_EVENT_CONTEXT(pc);
-
- event_context->cursor_shape = cursor_pencil_xpm;
- event_context->hot_x = 4;
- event_context->hot_y = 4;
-
- pc->npoints = 0;
- pc->state = SP_PENCIL_CONTEXT_IDLE;
- pc->req_tangent = Geom::Point(0, 0);
+ this->npoints = 0;
+ this->state = SP_PENCIL_CONTEXT_IDLE;
+ this->req_tangent = Geom::Point(0, 0);
// since SPPencilContext is not properly constructed...
- pc->sketch_interpolation = Geom::Piecewise<Geom::D2<Geom::SBasis> >();
- pc->sketch_n = 0;
+ this->sketch_interpolation = Geom::Piecewise<Geom::D2<Geom::SBasis> >();
+ this->sketch_n = 0;
}
void SPPencilContext::setup() {
- SPEventContext* ec = this;
-
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
if (prefs->getBool("/tools/freehand/pencil/selcue")) {
- ec->enableSelectionCue();
+ this->enableSelectionCue();
}
-// if (((SPEventContextClass *) sp_pencil_context_parent_class)->setup) {
-// ((SPEventContextClass *) sp_pencil_context_parent_class)->setup(ec);
-// }
SPDrawContext::setup();
- SPPencilContext *const pc = SP_PENCIL_CONTEXT(ec);
- pc->is_drawing = false;
-
- pc->anchor_statusbar = false;
+ this->is_drawing = false;
+ this->anchor_statusbar = false;
}
SPPencilContext::~SPPencilContext() {
@@ -144,31 +133,27 @@ spdc_endpoint_snap(SPPencilContext const *pc, Geom::Point &p, guint const state)
* Callback for handling all pencil context events.
*/
bool SPPencilContext::root_handler(GdkEvent* event) {
- SPEventContext* ec = this;
-
- SPPencilContext *const pc = SP_PENCIL_CONTEXT(ec);
-
gint ret = FALSE;
switch (event->type) {
case GDK_BUTTON_PRESS:
- ret = pencil_handle_button_press(pc, event->button);
+ ret = pencil_handle_button_press(this, event->button);
break;
case GDK_MOTION_NOTIFY:
- ret = pencil_handle_motion_notify(pc, event->motion);
+ ret = pencil_handle_motion_notify(this, event->motion);
break;
case GDK_BUTTON_RELEASE:
- ret = pencil_handle_button_release(pc, event->button);
+ ret = pencil_handle_button_release(this, event->button);
break;
case GDK_KEY_PRESS:
- ret = pencil_handle_key_press(pc, get_group0_keyval (&event->key), event->key.state);
+ ret = pencil_handle_key_press(this, get_group0_keyval (&event->key), event->key.state);
break;
case GDK_KEY_RELEASE:
- ret = pencil_handle_key_release(pc, get_group0_keyval (&event->key), event->key.state);
+ ret = pencil_handle_key_release(this, get_group0_keyval (&event->key), event->key.state);
break;
default:
@@ -176,11 +161,6 @@ bool SPPencilContext::root_handler(GdkEvent* event) {
}
if (!ret) {
-// gint (*const parent_root_handler)(SPEventContext *, GdkEvent *)
-// = ((SPEventContextClass *) sp_pencil_context_parent_class)->root_handler;
-// if (parent_root_handler) {
-// ret = parent_root_handler(ec, event);
-// }
ret = SPDrawContext::root_handler(event);
}
diff --git a/src/pencil-context.h b/src/pencil-context.h
index a0d2effe6..a3e7a2ef0 100644
--- a/src/pencil-context.h
+++ b/src/pencil-context.h
@@ -39,10 +39,11 @@ public:
static const std::string prefsPath;
+ virtual const std::string& getPrefsPath();
+
+protected:
virtual void setup();
virtual bool root_handler(GdkEvent* event);
-
- virtual const std::string& getPrefsPath();
};
#endif /* !SEEN_PENCIL_CONTEXT_H */
diff --git a/src/text-context.cpp b/src/text-context.cpp
index 1d1511470..c83321c93 100644
--- a/src/text-context.cpp
+++ b/src/text-context.cpp
@@ -91,107 +91,79 @@ const std::string SPTextContext::prefsPath = "/tools/text";
SPTextContext::SPTextContext() : SPEventContext() {
- SPTextContext* tc = this;
-
- tc->preedit_string = 0;
- tc->unipos = 0;
-
- SPEventContext *event_context = SP_EVENT_CONTEXT(tc);
-
- event_context->cursor_shape = cursor_text_xpm;
- event_context->hot_x = 7;
- event_context->hot_y = 7;
-
- event_context->xp = 0;
- event_context->yp = 0;
- event_context->tolerance = 0;
- event_context->within_tolerance = false;
-
- tc->imc = NULL;
-
- tc->text = NULL;
- tc->pdoc = Geom::Point(0, 0);
- //new (&tc->text_sel_start) Inkscape::Text::Layout::iterator();
- //new (&tc->text_sel_end) Inkscape::Text::Layout::iterator();
- //new (&tc->text_selection_quads) std::vector<SPCanvasItem*>();
-
- tc->unimode = false;
-
- tc->cursor = NULL;
- tc->indicator = NULL;
- tc->frame = NULL;
- tc->grabbed = NULL;
- tc->timeout = 0;
- tc->show = FALSE;
- tc->phase = 0;
- tc->nascent_object = 0;
- tc->over_text = 0;
- tc->dragging = 0;
- tc->creating = 0;
-
- //new (&tc->sel_changed_connection) sigc::connection();
- //new (&tc->sel_modified_connection) sigc::connection();
- //new (&tc->style_set_connection) sigc::connection();
- //new (&tc->style_query_connection) sigc::connection();
+ this->preedit_string = 0;
+ this->unipos = 0;
+
+ this->cursor_shape = cursor_text_xpm;
+ this->hot_x = 7;
+ this->hot_y = 7;
+
+ this->xp = 0;
+ this->yp = 0;
+ this->tolerance = 0;
+ this->within_tolerance = false;
+
+ this->imc = NULL;
+
+ this->text = NULL;
+ this->pdoc = Geom::Point(0, 0);
+
+ this->unimode = false;
+
+ this->cursor = NULL;
+ this->indicator = NULL;
+ this->frame = NULL;
+ this->grabbed = NULL;
+ this->timeout = 0;
+ this->show = FALSE;
+ this->phase = 0;
+ this->nascent_object = 0;
+ this->over_text = 0;
+ this->dragging = 0;
+ this->creating = 0;
}
SPTextContext::~SPTextContext() {
- SPTextContext *tc = SP_TEXT_CONTEXT(this);
- SPEventContext *ec = SP_EVENT_CONTEXT(tc);
-// tc->style_query_connection.~connection();
-// tc->style_set_connection.~connection();
-// tc->sel_changed_connection.~connection();
-// tc->sel_modified_connection.~connection();
-
- delete ec->shape_editor;
- ec->shape_editor = NULL;
-
-// tc->text_sel_end.~iterator();
-// tc->text_sel_start.~iterator();
-// tc->text_selection_quads.~vector();
-// //if (G_OBJECT_CLASS(sp_text_context_parent_class)->dispose) {
- // G_OBJECT_CLASS(sp_text_context_parent_class)->dispose(obj);
- //}
- if (tc->grabbed) {
- sp_canvas_item_ungrab(tc->grabbed, GDK_CURRENT_TIME);
- tc->grabbed = NULL;
+ delete this->shape_editor;
+ this->shape_editor = NULL;
+
+ if (this->grabbed) {
+ sp_canvas_item_ungrab(this->grabbed, GDK_CURRENT_TIME);
+ this->grabbed = NULL;
}
- Inkscape::Rubberband::get(ec->desktop)->stop();
+ Inkscape::Rubberband::get(this->desktop)->stop();
}
void SPTextContext::setup() {
- SPEventContext* ec = this;
-
- SPTextContext *tc = SP_TEXT_CONTEXT(ec);
- SPDesktop *desktop = ec->desktop;
GtkSettings* settings = gtk_settings_get_default();
gint timeout = 0;
g_object_get( settings, "gtk-cursor-blink-time", &timeout, NULL );
+
if (timeout < 0) {
timeout = 200;
} else {
timeout /= 2;
}
- tc->cursor = ControlManager::getManager().createControlLine(sp_desktop_controls(desktop), Geom::Point(100, 0), Geom::Point(100, 100));
- tc->cursor->setRgba32(0x000000ff);
- sp_canvas_item_hide(tc->cursor);
+ this->cursor = ControlManager::getManager().createControlLine(sp_desktop_controls(desktop), Geom::Point(100, 0), Geom::Point(100, 100));
+ this->cursor->setRgba32(0x000000ff);
+ sp_canvas_item_hide(this->cursor);
- tc->indicator = sp_canvas_item_new(sp_desktop_controls(desktop), SP_TYPE_CTRLRECT, NULL);
- SP_CTRLRECT(tc->indicator)->setRectangle(Geom::Rect(Geom::Point(0, 0), Geom::Point(100, 100)));
- SP_CTRLRECT(tc->indicator)->setColor(0x0000ff7f, false, 0);
- sp_canvas_item_hide(tc->indicator);
+ this->indicator = sp_canvas_item_new(sp_desktop_controls(desktop), SP_TYPE_CTRLRECT, NULL);
+ SP_CTRLRECT(this->indicator)->setRectangle(Geom::Rect(Geom::Point(0, 0), Geom::Point(100, 100)));
+ SP_CTRLRECT(this->indicator)->setColor(0x0000ff7f, false, 0);
+ sp_canvas_item_hide(this->indicator);
- tc->frame = sp_canvas_item_new(sp_desktop_controls(desktop), SP_TYPE_CTRLRECT, NULL);
- SP_CTRLRECT(tc->frame)->setRectangle(Geom::Rect(Geom::Point(0, 0), Geom::Point(100, 100)));
- SP_CTRLRECT(tc->frame)->setColor(0x0000ff7f, false, 0);
- sp_canvas_item_hide(tc->frame);
+ this->frame = sp_canvas_item_new(sp_desktop_controls(desktop), SP_TYPE_CTRLRECT, NULL);
+ SP_CTRLRECT(this->frame)->setRectangle(Geom::Rect(Geom::Point(0, 0), Geom::Point(100, 100)));
+ SP_CTRLRECT(this->frame)->setColor(0x0000ff7f, false, 0);
+ sp_canvas_item_hide(this->frame);
- tc->timeout = g_timeout_add(timeout, (GSourceFunc) sp_text_context_timeout, ec);
+ this->timeout = g_timeout_add(timeout, (GSourceFunc) sp_text_context_timeout, this);
- tc->imc = gtk_im_multicontext_new();
- if (tc->imc) {
+ this->imc = gtk_im_multicontext_new();
+ if (this->imc) {
GtkWidget *canvas = GTK_WIDGET(sp_desktop_canvas(desktop));
/* im preedit handling is very broken in inkscape for
@@ -200,203 +172,194 @@ void SPTextContext::setup() {
* just take in the characters when they're finished being
* entered.
*/
- gtk_im_context_set_use_preedit(tc->imc, FALSE);
- gtk_im_context_set_client_window(tc->imc,
+ gtk_im_context_set_use_preedit(this->imc, FALSE);
+ gtk_im_context_set_client_window(this->imc,
gtk_widget_get_window (canvas));
- g_signal_connect(G_OBJECT(canvas), "focus_in_event", G_CALLBACK(sptc_focus_in), tc);
- g_signal_connect(G_OBJECT(canvas), "focus_out_event", G_CALLBACK(sptc_focus_out), tc);
- g_signal_connect(G_OBJECT(tc->imc), "commit", G_CALLBACK(sptc_commit), tc);
+ g_signal_connect(G_OBJECT(canvas), "focus_in_event", G_CALLBACK(sptc_focus_in), this);
+ g_signal_connect(G_OBJECT(canvas), "focus_out_event", G_CALLBACK(sptc_focus_out), this);
+ g_signal_connect(G_OBJECT(this->imc), "commit", G_CALLBACK(sptc_commit), this);
if (gtk_widget_has_focus(canvas)) {
- sptc_focus_in(canvas, NULL, tc);
+ sptc_focus_in(canvas, NULL, this);
}
}
-// if ((SP_EVENT_CONTEXT_CLASS(sp_text_context_parent_class))->setup)
-// (SP_EVENT_CONTEXT_CLASS(sp_text_context_parent_class))->setup(ec);
SPEventContext::setup();
- ec->shape_editor = new ShapeEditor(ec->desktop);
+ this->shape_editor = new ShapeEditor(this->desktop);
- SPItem *item = sp_desktop_selection(ec->desktop)->singleItem();
+ SPItem *item = sp_desktop_selection(this->desktop)->singleItem();
if (item && SP_IS_FLOWTEXT(item) && SP_FLOWTEXT(item)->has_internal_frame()) {
- ec->shape_editor->set_item(item, SH_KNOTHOLDER);
+ this->shape_editor->set_item(item, SH_KNOTHOLDER);
}
- tc->sel_changed_connection = sp_desktop_selection(desktop)->connectChanged(
- sigc::bind(sigc::ptr_fun(&sp_text_context_selection_changed), tc)
- );
- tc->sel_modified_connection = sp_desktop_selection(desktop)->connectModified(
- sigc::bind(sigc::ptr_fun(&sp_text_context_selection_modified), tc)
- );
- tc->style_set_connection = desktop->connectSetStyle(
- sigc::bind(sigc::ptr_fun(&sp_text_context_style_set), tc)
- );
- tc->style_query_connection = desktop->connectQueryStyle(
- sigc::bind(sigc::ptr_fun(&sp_text_context_style_query), tc)
- );
-
- sp_text_context_selection_changed(sp_desktop_selection(desktop), tc);
+ this->sel_changed_connection = sp_desktop_selection(desktop)->connectChanged(
+ sigc::bind(sigc::ptr_fun(&sp_text_context_selection_changed), this)
+ );
+ this->sel_modified_connection = sp_desktop_selection(desktop)->connectModified(
+ sigc::bind(sigc::ptr_fun(&sp_text_context_selection_modified), this)
+ );
+ this->style_set_connection = desktop->connectSetStyle(
+ sigc::bind(sigc::ptr_fun(&sp_text_context_style_set), this)
+ );
+ this->style_query_connection = desktop->connectQueryStyle(
+ sigc::bind(sigc::ptr_fun(&sp_text_context_style_query), this)
+ );
+
+ sp_text_context_selection_changed(sp_desktop_selection(desktop), this);
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
if (prefs->getBool("/tools/text/selcue")) {
- ec->enableSelectionCue();
+ this->enableSelectionCue();
}
if (prefs->getBool("/tools/text/gradientdrag")) {
- ec->enableGrDrag();
+ this->enableGrDrag();
}
}
void SPTextContext::finish() {
- SPEventContext* ec = this;
-
- SPTextContext *tc = SP_TEXT_CONTEXT(ec);
-
- if (ec->desktop) {
- sp_signal_disconnect_by_data(sp_desktop_canvas(ec->desktop), tc);
+ if (this->desktop) {
+ sp_signal_disconnect_by_data(sp_desktop_canvas(this->desktop), this);
}
- ec->enableGrDrag(false);
+ this->enableGrDrag(false);
- tc->style_set_connection.disconnect();
- tc->style_query_connection.disconnect();
- tc->sel_changed_connection.disconnect();
- tc->sel_modified_connection.disconnect();
+ this->style_set_connection.disconnect();
+ this->style_query_connection.disconnect();
+ this->sel_changed_connection.disconnect();
+ this->sel_modified_connection.disconnect();
- sp_text_context_forget_text(SP_TEXT_CONTEXT(ec));
+ sp_text_context_forget_text(SP_TEXT_CONTEXT(this));
- if (tc->imc) {
- g_object_unref(G_OBJECT(tc->imc));
- tc->imc = NULL;
+ if (this->imc) {
+ g_object_unref(G_OBJECT(this->imc));
+ this->imc = NULL;
}
- if (tc->timeout) {
- g_source_remove(tc->timeout);
- tc->timeout = 0;
+ if (this->timeout) {
+ g_source_remove(this->timeout);
+ this->timeout = 0;
}
- if (tc->cursor) {
- sp_canvas_item_destroy(tc->cursor);
- tc->cursor = NULL;
+ if (this->cursor) {
+ sp_canvas_item_destroy(this->cursor);
+ this->cursor = NULL;
}
- if (tc->indicator) {
- sp_canvas_item_destroy(tc->indicator);
- tc->indicator = NULL;
+ if (this->indicator) {
+ sp_canvas_item_destroy(this->indicator);
+ this->indicator = NULL;
}
- if (tc->frame) {
- sp_canvas_item_destroy(tc->frame);
- tc->frame = NULL;
+ if (this->frame) {
+ sp_canvas_item_destroy(this->frame);
+ this->frame = NULL;
}
- for (std::vector<SPCanvasItem*>::iterator it = tc->text_selection_quads.begin() ;
- it != tc->text_selection_quads.end() ; ++it) {
+ for (std::vector<SPCanvasItem*>::iterator it = this->text_selection_quads.begin() ;
+ it != this->text_selection_quads.end() ; ++it) {
sp_canvas_item_hide(*it);
sp_canvas_item_destroy(*it);
}
- tc->text_selection_quads.clear();
+
+ this->text_selection_quads.clear();
}
bool SPTextContext::item_handler(SPItem* item, GdkEvent* event) {
- SPEventContext* event_context = this;
-
- SPTextContext *tc = SP_TEXT_CONTEXT(event_context);
- SPDesktop *desktop = event_context->desktop;
SPItem *item_ungrouped;
gint ret = FALSE;
- sp_text_context_validate_cursor_iterators(tc);
- Inkscape::Text::Layout::iterator old_start = tc->text_sel_start;
+ sp_text_context_validate_cursor_iterators(this);
+ Inkscape::Text::Layout::iterator old_start = this->text_sel_start;
switch (event->type) {
case GDK_BUTTON_PRESS:
- if (event->button.button == 1 && !event_context->space_panning) {
+ if (event->button.button == 1 && !this->space_panning) {
// find out clicked item, disregarding groups
item_ungrouped = desktop->getItemAtPoint(Geom::Point(event->button.x, event->button.y), TRUE);
if (SP_IS_TEXT(item_ungrouped) || SP_IS_FLOWTEXT(item_ungrouped)) {
sp_desktop_selection(desktop)->set(item_ungrouped);
- if (tc->text) {
+ if (this->text) {
// find out click point in document coordinates
Geom::Point p = desktop->w2d(Geom::Point(event->button.x, event->button.y));
// set the cursor closest to that point
if (event->button.state & GDK_SHIFT_MASK) {
- tc->text_sel_start = old_start;
- tc->text_sel_end = sp_te_get_position_by_coords(tc->text, p);
+ this->text_sel_start = old_start;
+ this->text_sel_end = sp_te_get_position_by_coords(this->text, p);
} else {
- tc->text_sel_start = tc->text_sel_end = sp_te_get_position_by_coords(tc->text, p);
+ this->text_sel_start = this->text_sel_end = sp_te_get_position_by_coords(this->text, p);
}
// update display
- sp_text_context_update_cursor(tc);
- sp_text_context_update_text_selection(tc);
- tc->dragging = 1;
+ sp_text_context_update_cursor(this);
+ sp_text_context_update_text_selection(this);
+ this->dragging = 1;
}
ret = TRUE;
}
}
break;
case GDK_2BUTTON_PRESS:
- if (event->button.button == 1 && tc->text) {
- Inkscape::Text::Layout const *layout = te_get_layout(tc->text);
+ if (event->button.button == 1 && this->text) {
+ Inkscape::Text::Layout const *layout = te_get_layout(this->text);
if (layout) {
- if (!layout->isStartOfWord(tc->text_sel_start))
- tc->text_sel_start.prevStartOfWord();
- if (!layout->isEndOfWord(tc->text_sel_end))
- tc->text_sel_end.nextEndOfWord();
- sp_text_context_update_cursor(tc);
- sp_text_context_update_text_selection(tc);
- tc->dragging = 2;
+ if (!layout->isStartOfWord(this->text_sel_start))
+ this->text_sel_start.prevStartOfWord();
+ if (!layout->isEndOfWord(this->text_sel_end))
+ this->text_sel_end.nextEndOfWord();
+ sp_text_context_update_cursor(this);
+ sp_text_context_update_text_selection(this);
+ this->dragging = 2;
ret = TRUE;
}
}
break;
case GDK_3BUTTON_PRESS:
- if (event->button.button == 1 && tc->text) {
- tc->text_sel_start.thisStartOfLine();
- tc->text_sel_end.thisEndOfLine();
- sp_text_context_update_cursor(tc);
- sp_text_context_update_text_selection(tc);
- tc->dragging = 3;
+ if (event->button.button == 1 && this->text) {
+ this->text_sel_start.thisStartOfLine();
+ this->text_sel_end.thisEndOfLine();
+ sp_text_context_update_cursor(this);
+ sp_text_context_update_text_selection(this);
+ this->dragging = 3;
ret = TRUE;
}
break;
case GDK_BUTTON_RELEASE:
- if (event->button.button == 1 && tc->dragging && !event_context->space_panning) {
- tc->dragging = 0;
- sp_event_context_discard_delayed_snap_event(event_context);
+ if (event->button.button == 1 && this->dragging && !this->space_panning) {
+ this->dragging = 0;
+ sp_event_context_discard_delayed_snap_event(this);
ret = TRUE;
}
break;
case GDK_MOTION_NOTIFY:
- if ((event->motion.state & GDK_BUTTON1_MASK) && tc->dragging && !event_context->space_panning) {
- Inkscape::Text::Layout const *layout = te_get_layout(tc->text);
+ if ((event->motion.state & GDK_BUTTON1_MASK) && this->dragging && !this->space_panning) {
+ Inkscape::Text::Layout const *layout = te_get_layout(this->text);
if (!layout) break;
// find out click point in document coordinates
Geom::Point p = desktop->w2d(Geom::Point(event->button.x, event->button.y));
// set the cursor closest to that point
- Inkscape::Text::Layout::iterator new_end = sp_te_get_position_by_coords(tc->text, p);
- if (tc->dragging == 2) {
+ Inkscape::Text::Layout::iterator new_end = sp_te_get_position_by_coords(this->text, p);
+ if (this->dragging == 2) {
// double-click dragging: go by word
- if (new_end < tc->text_sel_start) {
+ if (new_end < this->text_sel_start) {
if (!layout->isStartOfWord(new_end))
new_end.prevStartOfWord();
} else
if (!layout->isEndOfWord(new_end))
new_end.nextEndOfWord();
- } else if (tc->dragging == 3) {
+ } else if (this->dragging == 3) {
// triple-click dragging: go by line
- if (new_end < tc->text_sel_start)
+ if (new_end < this->text_sel_start)
new_end.thisStartOfLine();
else
new_end.thisEndOfLine();
}
// update display
- if (tc->text_sel_end != new_end) {
- tc->text_sel_end = new_end;
- sp_text_context_update_cursor(tc);
- sp_text_context_update_text_selection(tc);
+ if (this->text_sel_end != new_end) {
+ this->text_sel_end = new_end;
+ sp_text_context_update_cursor(this);
+ sp_text_context_update_text_selection(this);
}
gobble_motion_events(GDK_BUTTON1_MASK);
ret = TRUE;
@@ -408,21 +371,21 @@ bool SPTextContext::item_handler(SPItem* item, GdkEvent* event) {
Inkscape::Text::Layout const *layout = te_get_layout(item_ungrouped);
if (layout->inputTruncated()) {
- SP_CTRLRECT(tc->indicator)->setColor(0xff0000ff, false, 0);
+ SP_CTRLRECT(this->indicator)->setColor(0xff0000ff, false, 0);
} else {
- SP_CTRLRECT(tc->indicator)->setColor(0x0000ff7f, false, 0);
+ SP_CTRLRECT(this->indicator)->setColor(0x0000ff7f, false, 0);
}
Geom::OptRect ibbox = item_ungrouped->desktopVisualBounds();
if (ibbox) {
- SP_CTRLRECT(tc->indicator)->setRectangle(*ibbox);
+ SP_CTRLRECT(this->indicator)->setRectangle(*ibbox);
}
- sp_canvas_item_show(tc->indicator);
+ sp_canvas_item_show(this->indicator);
- event_context->cursor_shape = cursor_text_insert_xpm;
- event_context->hot_x = 7;
- event_context->hot_y = 10;
- event_context->sp_event_context_update_cursor();
- sp_text_context_update_text_selection(tc);
+ this->cursor_shape = cursor_text_insert_xpm;
+ this->hot_x = 7;
+ this->hot_y = 10;
+ this->sp_event_context_update_cursor();
+ sp_text_context_update_text_selection(this);
if (SP_IS_TEXT (item_ungrouped)) {
desktop->event_context->defaultMessageContext()->set(Inkscape::NORMAL_MESSAGE, _("<b>Click</b> to edit the text, <b>drag</b> to select part of the text."));
@@ -430,7 +393,7 @@ bool SPTextContext::item_handler(SPItem* item, GdkEvent* event) {
desktop->event_context->defaultMessageContext()->set(Inkscape::NORMAL_MESSAGE, _("<b>Click</b> to edit the flowed text, <b>drag</b> to select part of the text."));
}
- tc->over_text = true;
+ this->over_text = true;
ret = TRUE;
}
@@ -440,8 +403,6 @@ bool SPTextContext::item_handler(SPItem* item, GdkEvent* event) {
}
if (!ret) {
-// if ((SP_EVENT_CONTEXT_CLASS(sp_text_context_parent_class))->item_handler)
-// ret = (SP_EVENT_CONTEXT_CLASS(sp_text_context_parent_class))->item_handler(event_context, item, event);
ret = SPEventContext::item_handler(item, event);
}
@@ -564,31 +525,25 @@ static void show_curr_uni_char(SPTextContext *const tc)
}
bool SPTextContext::root_handler(GdkEvent* event) {
- SPEventContext* event_context = this;
-
- SPTextContext *const tc = SP_TEXT_CONTEXT(event_context);
-
- SPDesktop *desktop = event_context->desktop;
+ sp_canvas_item_hide(this->indicator);
- sp_canvas_item_hide(tc->indicator);
-
- sp_text_context_validate_cursor_iterators(tc);
+ sp_text_context_validate_cursor_iterators(this);
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- event_context->tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100);
+ this->tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100);
switch (event->type) {
case GDK_BUTTON_PRESS:
- if (event->button.button == 1 && !event_context->space_panning) {
+ if (event->button.button == 1 && !this->space_panning) {
if (Inkscape::have_viable_layer(desktop, desktop->messageStack()) == false) {
return TRUE;
}
// save drag origin
- event_context->xp = (gint) event->button.x;
- event_context->yp = (gint) event->button.y;
- event_context->within_tolerance = true;
+ this->xp = (gint) event->button.x;
+ this->yp = (gint) event->button.y;
+ this->within_tolerance = true;
Geom::Point const button_pt(event->button.x, event->button.y);
Geom::Point button_dt(desktop->w2d(button_pt));
@@ -598,39 +553,39 @@ bool SPTextContext::root_handler(GdkEvent* event) {
m.freeSnapReturnByRef(button_dt, Inkscape::SNAPSOURCE_NODE_HANDLE);
m.unSetup();
- tc->p0 = button_dt;
- Inkscape::Rubberband::get(desktop)->start(desktop, tc->p0);
+ this->p0 = button_dt;
+ Inkscape::Rubberband::get(desktop)->start(desktop, this->p0);
sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate),
GDK_KEY_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK,
NULL, event->button.time);
- tc->grabbed = SP_CANVAS_ITEM(desktop->acetate);
- tc->creating = 1;
+ this->grabbed = SP_CANVAS_ITEM(desktop->acetate);
+ this->creating = 1;
/* Processed */
return TRUE;
}
break;
case GDK_MOTION_NOTIFY:
- if (tc->over_text) {
- tc->over_text = 0;
+ if (this->over_text) {
+ this->over_text = 0;
// update cursor and statusbar: we are not over a text object now
- event_context->cursor_shape = cursor_text_xpm;
- event_context->hot_x = 7;
- event_context->hot_y = 7;
- event_context->sp_event_context_update_cursor();
+ this->cursor_shape = cursor_text_xpm;
+ this->hot_x = 7;
+ this->hot_y = 7;
+ this->sp_event_context_update_cursor();
desktop->event_context->defaultMessageContext()->clear();
}
- if (tc->creating && (event->motion.state & GDK_BUTTON1_MASK) && !event_context->space_panning) {
- if ( event_context->within_tolerance
- && ( abs( (gint) event->motion.x - event_context->xp ) < event_context->tolerance )
- && ( abs( (gint) event->motion.y - event_context->yp ) < event_context->tolerance ) ) {
+ if (this->creating && (event->motion.state & GDK_BUTTON1_MASK) && !this->space_panning) {
+ if ( this->within_tolerance
+ && ( abs( (gint) event->motion.x - this->xp ) < this->tolerance )
+ && ( abs( (gint) event->motion.y - this->yp ) < this->tolerance ) ) {
break; // do not drag if we're within tolerance from origin
}
// Once the user has moved farther than tolerance from the original location
// (indicating they intend to draw, not click), then always process the
// motion notify coordinates as given (no snapping back to origin)
- event_context->within_tolerance = false;
+ this->within_tolerance = false;
Geom::Point const motion_pt(event->motion.x, event->motion.y);
Geom::Point p = desktop->w2d(motion_pt);
@@ -644,13 +599,13 @@ bool SPTextContext::root_handler(GdkEvent* event) {
gobble_motion_events(GDK_BUTTON1_MASK);
// status text
- GString *xs = SP_PX_TO_METRIC_STRING(fabs((p - tc->p0)[Geom::X]), desktop->namedview->getDefaultMetric());
- GString *ys = SP_PX_TO_METRIC_STRING(fabs((p - tc->p0)[Geom::Y]), desktop->namedview->getDefaultMetric());
- event_context->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Flowed text frame</b>: %s &#215; %s"), xs->str, ys->str);
+ GString *xs = SP_PX_TO_METRIC_STRING(fabs((p - this->p0)[Geom::X]), desktop->namedview->getDefaultMetric());
+ GString *ys = SP_PX_TO_METRIC_STRING(fabs((p - this->p0)[Geom::Y]), desktop->namedview->getDefaultMetric());
+ this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Flowed text frame</b>: %s &#215; %s"), xs->str, ys->str);
g_string_free(xs, FALSE);
g_string_free(ys, FALSE);
- } else if (!sp_event_context_knot_mouseover(event_context)) {
+ } else if (!sp_event_context_knot_mouseover(this)) {
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop);
@@ -661,8 +616,8 @@ bool SPTextContext::root_handler(GdkEvent* event) {
}
break;
case GDK_BUTTON_RELEASE:
- if (event->button.button == 1 && !event_context->space_panning) {
- sp_event_context_discard_delayed_snap_event(event_context);
+ if (event->button.button == 1 && !this->space_panning) {
+ sp_event_context_discard_delayed_snap_event(this);
Geom::Point p1 = desktop->w2d(Geom::Point(event->button.x, event->button.y));
@@ -671,46 +626,46 @@ bool SPTextContext::root_handler(GdkEvent* event) {
m.freeSnapReturnByRef(p1, Inkscape::SNAPSOURCE_NODE_HANDLE);
m.unSetup();
- if (tc->grabbed) {
- sp_canvas_item_ungrab(tc->grabbed, GDK_CURRENT_TIME);
- tc->grabbed = NULL;
+ if (this->grabbed) {
+ sp_canvas_item_ungrab(this->grabbed, GDK_CURRENT_TIME);
+ this->grabbed = NULL;
}
Inkscape::Rubberband::get(desktop)->stop();
- if (tc->creating && event_context->within_tolerance) {
+ if (this->creating && this->within_tolerance) {
/* Button 1, set X & Y & new item */
sp_desktop_selection(desktop)->clear();
- tc->pdoc = desktop->dt2doc(p1);
- tc->show = TRUE;
- tc->phase = 1;
- tc->nascent_object = 1; // new object was just created
+ this->pdoc = desktop->dt2doc(p1);
+ this->show = TRUE;
+ this->phase = 1;
+ this->nascent_object = 1; // new object was just created
/* Cursor */
- sp_canvas_item_show(tc->cursor);
+ sp_canvas_item_show(this->cursor);
// Cursor height is defined by the new text object's font size; it needs to be set
// artificially here, for the text object does not exist yet:
double cursor_height = sp_desktop_get_font_size_tool(desktop);
- tc->cursor->setCoords(p1, p1 + Geom::Point(0, cursor_height));
- if (tc->imc) {
+ this->cursor->setCoords(p1, p1 + Geom::Point(0, cursor_height));
+ if (this->imc) {
GdkRectangle im_cursor;
- Geom::Point const top_left = SP_EVENT_CONTEXT(tc)->desktop->get_display_area().corner(3);
+ Geom::Point const top_left = SP_EVENT_CONTEXT(this)->desktop->get_display_area().corner(3);
Geom::Point const cursor_size(0, cursor_height);
- Geom::Point const im_position = SP_EVENT_CONTEXT(tc)->desktop->d2w(p1 + cursor_size - top_left);
+ Geom::Point const im_position = SP_EVENT_CONTEXT(this)->desktop->d2w(p1 + cursor_size - top_left);
im_cursor.x = (int) floor(im_position[Geom::X]);
im_cursor.y = (int) floor(im_position[Geom::Y]);
im_cursor.width = 0;
- im_cursor.height = (int) -floor(SP_EVENT_CONTEXT(tc)->desktop->d2w(cursor_size)[Geom::Y]);
- gtk_im_context_set_cursor_location(tc->imc, &im_cursor);
+ im_cursor.height = (int) -floor(SP_EVENT_CONTEXT(this)->desktop->d2w(cursor_size)[Geom::Y]);
+ gtk_im_context_set_cursor_location(this->imc, &im_cursor);
}
- event_context->message_context->set(Inkscape::NORMAL_MESSAGE, _("Type text; <b>Enter</b> to start new line.")); // FIXME:: this is a copy of a string from _update_cursor below, do not desync
+ this->message_context->set(Inkscape::NORMAL_MESSAGE, _("Type text; <b>Enter</b> to start new line.")); // FIXME:: this is a copy of a string from _update_cursor below, do not desync
- event_context->within_tolerance = false;
- } else if (tc->creating) {
+ this->within_tolerance = false;
+ } else if (this->creating) {
double cursor_height = sp_desktop_get_font_size_tool(desktop);
- if (fabs(p1[Geom::Y] - tc->p0[Geom::Y]) > cursor_height) {
+ if (fabs(p1[Geom::Y] - this->p0[Geom::Y]) > cursor_height) {
// otherwise even one line won't fit; most probably a slip of hand (even if bigger than tolerance)
- SPItem *ft = create_flowtext_with_internal_frame (desktop, tc->p0, p1);
+ SPItem *ft = create_flowtext_with_internal_frame (desktop, this->p0, p1);
/* Set style */
sp_desktop_apply_style_tool(desktop, ft->getRepr(), "/tools/text", true);
sp_desktop_selection(desktop)->set(ft);
@@ -721,7 +676,7 @@ bool SPTextContext::root_handler(GdkEvent* event) {
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("The frame is <b>too small</b> for the current font size. Flowed text not created."));
}
}
- tc->creating = false;
+ this->creating = false;
return TRUE;
}
break;
@@ -734,16 +689,16 @@ bool SPTextContext::root_handler(GdkEvent* event) {
break; // otherwise pass on keypad +/- so they can zoom
}
- if ((tc->text) || (tc->nascent_object)) {
+ if ((this->text) || (this->nascent_object)) {
// there is an active text object in this context, or a new object was just created
- if (tc->unimode || !tc->imc
+ if (this->unimode || !this->imc
|| (MOD__CTRL(event) && MOD__SHIFT(event)) // input methods tend to steal this for unimode,
// but we have our own so make sure they don't swallow it
- || !gtk_im_context_filter_keypress(tc->imc, (GdkEventKey*) event)) {
+ || !gtk_im_context_filter_keypress(this->imc, (GdkEventKey*) event)) {
//IM did not consume the key, or we're in unimode
- if (!MOD__CTRL_ONLY(event) && tc->unimode) {
+ if (!MOD__CTRL_ONLY(event) && this->unimode) {
/* TODO: ISO 14755 (section 3 Definitions) says that we should also
accept the first 6 characters of alphabets other than the latin
alphabet "if the Latin alphabet is not used". The below is also
@@ -754,39 +709,39 @@ bool SPTextContext::root_handler(GdkEvent* event) {
switch (group0_keyval) {
case GDK_KEY_space:
case GDK_KEY_KP_Space: {
- if (tc->unipos) {
- insert_uni_char(tc);
+ if (this->unipos) {
+ insert_uni_char(this);
}
/* Stay in unimode. */
- show_curr_uni_char(tc);
+ show_curr_uni_char(this);
return TRUE;
}
case GDK_KEY_BackSpace: {
- g_return_val_if_fail(tc->unipos < sizeof(tc->uni), TRUE);
- if (tc->unipos) {
- tc->uni[--tc->unipos] = '\0';
+ g_return_val_if_fail(this->unipos < sizeof(this->uni), TRUE);
+ if (this->unipos) {
+ this->uni[--this->unipos] = '\0';
}
- show_curr_uni_char(tc);
+ show_curr_uni_char(this);
return TRUE;
}
case GDK_KEY_Return:
case GDK_KEY_KP_Enter: {
- if (tc->unipos) {
- insert_uni_char(tc);
+ if (this->unipos) {
+ insert_uni_char(this);
}
/* Exit unimode. */
- tc->unimode = false;
- event_context->defaultMessageContext()->clear();
+ this->unimode = false;
+ this->defaultMessageContext()->clear();
return TRUE;
}
case GDK_KEY_Escape: {
// Cancel unimode.
- tc->unimode = false;
- gtk_im_context_reset(tc->imc);
- event_context->defaultMessageContext()->clear();
+ this->unimode = false;
+ gtk_im_context_reset(this->imc);
+ this->defaultMessageContext()->clear();
return TRUE;
}
@@ -796,10 +751,10 @@ bool SPTextContext::root_handler(GdkEvent* event) {
default: {
if (g_ascii_isxdigit(group0_keyval)) {
- g_return_val_if_fail(tc->unipos < sizeof(tc->uni) - 1, TRUE);
- tc->uni[tc->unipos++] = group0_keyval;
- tc->uni[tc->unipos] = '\0';
- if (tc->unipos == 8) {
+ g_return_val_if_fail(this->unipos < sizeof(this->uni) - 1, TRUE);
+ this->uni[this->unipos++] = group0_keyval;
+ this->uni[this->unipos] = '\0';
+ if (this->unipos == 8) {
/* This behaviour is partly to allow us to continue to
use a fixed-length buffer for tc->uni. Reason for
choosing the number 8 is that it's the length of
@@ -807,9 +762,9 @@ bool SPTextContext::root_handler(GdkEvent* event) {
An advantage over choosing 6 is that it allows using
backspace for typos & misremembering when entering a
6-digit number. */
- insert_uni_char(tc);
+ insert_uni_char(this);
}
- show_curr_uni_char(tc);
+ show_curr_uni_char(this);
return TRUE;
} else {
/* The intent is to ignore but consume characters that could be
@@ -823,12 +778,12 @@ bool SPTextContext::root_handler(GdkEvent* event) {
}
}
- Inkscape::Text::Layout::iterator old_start = tc->text_sel_start;
- Inkscape::Text::Layout::iterator old_end = tc->text_sel_end;
+ Inkscape::Text::Layout::iterator old_start = this->text_sel_start;
+ Inkscape::Text::Layout::iterator old_end = this->text_sel_end;
bool cursor_moved = false;
int screenlines = 1;
- if (tc->text) {
- double spacing = sp_te_get_average_linespacing(tc->text);
+ if (this->text) {
+ double spacing = sp_te_get_average_linespacing(this->text);
Geom::Rect const d = desktop->get_display_area();
screenlines = (int) floor(fabs(d.min()[Geom::Y] - d.max()[Geom::Y])/spacing) - 1;
if (screenlines <= 0)
@@ -847,13 +802,13 @@ bool SPTextContext::root_handler(GdkEvent* event) {
case GDK_KEY_space:
if (MOD__CTRL_ONLY(event)) {
/* No-break space */
- if (!tc->text) { // printable key; create text if none (i.e. if nascent_object)
- sp_text_context_setup_text(tc);
- tc->nascent_object = 0; // we don't need it anymore, having created a real <text>
+ if (!this->text) { // printable key; create text if none (i.e. if nascent_object)
+ sp_text_context_setup_text(this);
+ this->nascent_object = 0; // we don't need it anymore, having created a real <text>
}
- tc->text_sel_start = tc->text_sel_end = sp_te_replace(tc->text, tc->text_sel_start, tc->text_sel_end, "\302\240");
- sp_text_context_update_cursor(tc);
- sp_text_context_update_text_selection(tc);
+ this->text_sel_start = this->text_sel_end = sp_te_replace(this->text, this->text_sel_start, this->text_sel_end, "\302\240");
+ sp_text_context_update_cursor(this);
+ sp_text_context_update_text_selection(this);
desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("No-break space"));
DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
_("Insert no-break space"));
@@ -863,24 +818,24 @@ bool SPTextContext::root_handler(GdkEvent* event) {
case GDK_KEY_U:
case GDK_KEY_u:
if (MOD__CTRL_ONLY(event) || (MOD__CTRL(event) && MOD__SHIFT(event))) {
- if (tc->unimode) {
- tc->unimode = false;
- event_context->defaultMessageContext()->clear();
+ if (this->unimode) {
+ this->unimode = false;
+ this->defaultMessageContext()->clear();
} else {
- tc->unimode = true;
- tc->unipos = 0;
- event_context->defaultMessageContext()->set(Inkscape::NORMAL_MESSAGE, _("Unicode (<b>Enter</b> to finish): "));
+ this->unimode = true;
+ this->unipos = 0;
+ this->defaultMessageContext()->set(Inkscape::NORMAL_MESSAGE, _("Unicode (<b>Enter</b> to finish): "));
}
- if (tc->imc) {
- gtk_im_context_reset(tc->imc);
+ if (this->imc) {
+ gtk_im_context_reset(this->imc);
}
return TRUE;
}
break;
case GDK_KEY_B:
case GDK_KEY_b:
- if (MOD__CTRL_ONLY(event) && tc->text) {
- SPStyle const *style = sp_te_style_at_position(tc->text, std::min(tc->text_sel_start, tc->text_sel_end));
+ if (MOD__CTRL_ONLY(event) && this->text) {
+ SPStyle const *style = sp_te_style_at_position(this->text, std::min(this->text_sel_start, this->text_sel_end));
SPCSSAttr *css = sp_repr_css_attr_new();
if (style->font_weight.computed == SP_CSS_FONT_WEIGHT_NORMAL
|| style->font_weight.computed == SP_CSS_FONT_WEIGHT_100
@@ -890,43 +845,43 @@ bool SPTextContext::root_handler(GdkEvent* event) {
sp_repr_css_set_property(css, "font-weight", "bold");
else
sp_repr_css_set_property(css, "font-weight", "normal");
- sp_te_apply_style(tc->text, tc->text_sel_start, tc->text_sel_end, css);
+ sp_te_apply_style(this->text, this->text_sel_start, this->text_sel_end, css);
sp_repr_css_attr_unref(css);
DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
_("Make bold"));
- sp_text_context_update_cursor(tc);
- sp_text_context_update_text_selection(tc);
+ sp_text_context_update_cursor(this);
+ sp_text_context_update_text_selection(this);
return TRUE;
}
break;
case GDK_KEY_I:
case GDK_KEY_i:
- if (MOD__CTRL_ONLY(event) && tc->text) {
- SPStyle const *style = sp_te_style_at_position(tc->text, std::min(tc->text_sel_start, tc->text_sel_end));
+ if (MOD__CTRL_ONLY(event) && this->text) {
+ SPStyle const *style = sp_te_style_at_position(this->text, std::min(this->text_sel_start, this->text_sel_end));
SPCSSAttr *css = sp_repr_css_attr_new();
if (style->font_style.computed != SP_CSS_FONT_STYLE_NORMAL)
sp_repr_css_set_property(css, "font-style", "normal");
else
sp_repr_css_set_property(css, "font-style", "italic");
- sp_te_apply_style(tc->text, tc->text_sel_start, tc->text_sel_end, css);
+ sp_te_apply_style(this->text, this->text_sel_start, this->text_sel_end, css);
sp_repr_css_attr_unref(css);
DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
_("Make italic"));
- sp_text_context_update_cursor(tc);
- sp_text_context_update_text_selection(tc);
+ sp_text_context_update_cursor(this);
+ sp_text_context_update_text_selection(this);
return TRUE;
}
break;
case GDK_KEY_A:
case GDK_KEY_a:
- if (MOD__CTRL_ONLY(event) && tc->text) {
- Inkscape::Text::Layout const *layout = te_get_layout(tc->text);
+ if (MOD__CTRL_ONLY(event) && this->text) {
+ Inkscape::Text::Layout const *layout = te_get_layout(this->text);
if (layout) {
- tc->text_sel_start = layout->begin();
- tc->text_sel_end = layout->end();
- sp_text_context_update_cursor(tc);
- sp_text_context_update_text_selection(tc);
+ this->text_sel_start = layout->begin();
+ this->text_sel_end = layout->end();
+ sp_text_context_update_cursor(this);
+ sp_text_context_update_text_selection(this);
return TRUE;
}
}
@@ -935,101 +890,101 @@ bool SPTextContext::root_handler(GdkEvent* event) {
case GDK_KEY_Return:
case GDK_KEY_KP_Enter:
{
- if (!tc->text) { // printable key; create text if none (i.e. if nascent_object)
- sp_text_context_setup_text(tc);
- tc->nascent_object = 0; // we don't need it anymore, having created a real <text>
+ if (!this->text) { // printable key; create text if none (i.e. if nascent_object)
+ sp_text_context_setup_text(this);
+ this->nascent_object = 0; // we don't need it anymore, having created a real <text>
}
iterator_pair enter_pair;
- bool success = sp_te_delete(tc->text, tc->text_sel_start, tc->text_sel_end, enter_pair);
+ bool success = sp_te_delete(this->text, this->text_sel_start, this->text_sel_end, enter_pair);
(void)success; // TODO cleanup
- tc->text_sel_start = tc->text_sel_end = enter_pair.first;
+ this->text_sel_start = this->text_sel_end = enter_pair.first;
- tc->text_sel_start = tc->text_sel_end = sp_te_insert_line(tc->text, tc->text_sel_start);
+ this->text_sel_start = this->text_sel_end = sp_te_insert_line(this->text, this->text_sel_start);
- sp_text_context_update_cursor(tc);
- sp_text_context_update_text_selection(tc);
+ sp_text_context_update_cursor(this);
+ sp_text_context_update_text_selection(this);
DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
_("New line"));
return TRUE;
}
case GDK_KEY_BackSpace:
- if (tc->text) { // if nascent_object, do nothing, but return TRUE; same for all other delete and move keys
+ if (this->text) { // if nascent_object, do nothing, but return TRUE; same for all other delete and move keys
bool noSelection = false;
if (MOD__CTRL(event)) {
- tc->text_sel_start = tc->text_sel_end;
+ this->text_sel_start = this->text_sel_end;
}
- if (tc->text_sel_start == tc->text_sel_end) {
+ if (this->text_sel_start == this->text_sel_end) {
if (MOD__CTRL(event)) {
- tc->text_sel_start.prevStartOfWord();
+ this->text_sel_start.prevStartOfWord();
} else {
- tc->text_sel_start.prevCursorPosition();
+ this->text_sel_start.prevCursorPosition();
}
noSelection = true;
}
iterator_pair bspace_pair;
- bool success = sp_te_delete(tc->text, tc->text_sel_start, tc->text_sel_end, bspace_pair);
+ bool success = sp_te_delete(this->text, this->text_sel_start, this->text_sel_end, bspace_pair);
if (noSelection) {
if (success) {
- tc->text_sel_start = tc->text_sel_end = bspace_pair.first;
+ this->text_sel_start = this->text_sel_end = bspace_pair.first;
} else { // nothing deleted
- tc->text_sel_start = tc->text_sel_end = bspace_pair.second;
+ this->text_sel_start = this->text_sel_end = bspace_pair.second;
}
} else {
if (success) {
- tc->text_sel_start = tc->text_sel_end = bspace_pair.first;
+ this->text_sel_start = this->text_sel_end = bspace_pair.first;
} else { // nothing deleted
- tc->text_sel_start = bspace_pair.first;
- tc->text_sel_end = bspace_pair.second;
+ this->text_sel_start = bspace_pair.first;
+ this->text_sel_end = bspace_pair.second;
}
}
- sp_text_context_update_cursor(tc);
- sp_text_context_update_text_selection(tc);
+ sp_text_context_update_cursor(this);
+ sp_text_context_update_text_selection(this);
DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
_("Backspace"));
}
return TRUE;
case GDK_KEY_Delete:
case GDK_KEY_KP_Delete:
- if (tc->text) {
+ if (this->text) {
bool noSelection = false;
if (MOD__CTRL(event)) {
- tc->text_sel_start = tc->text_sel_end;
+ this->text_sel_start = this->text_sel_end;
}
- if (tc->text_sel_start == tc->text_sel_end) {
+ if (this->text_sel_start == this->text_sel_end) {
if (MOD__CTRL(event)) {
- tc->text_sel_end.nextEndOfWord();
+ this->text_sel_end.nextEndOfWord();
} else {
- tc->text_sel_end.nextCursorPosition();
+ this->text_sel_end.nextCursorPosition();
}
noSelection = true;
}
iterator_pair del_pair;
- bool success = sp_te_delete(tc->text, tc->text_sel_start, tc->text_sel_end, del_pair);
+ bool success = sp_te_delete(this->text, this->text_sel_start, this->text_sel_end, del_pair);
if (noSelection) {
- tc->text_sel_start = tc->text_sel_end = del_pair.first;
+ this->text_sel_start = this->text_sel_end = del_pair.first;
} else {
if (success) {
- tc->text_sel_start = tc->text_sel_end = del_pair.first;
+ this->text_sel_start = this->text_sel_end = del_pair.first;
} else { // nothing deleted
- tc->text_sel_start = del_pair.first;
- tc->text_sel_end = del_pair.second;
+ this->text_sel_start = del_pair.first;
+ this->text_sel_end = del_pair.second;
}
}
- sp_text_context_update_cursor(tc);
- sp_text_context_update_text_selection(tc);
+ sp_text_context_update_cursor(this);
+ sp_text_context_update_text_selection(this);
DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
_("Delete"));
}
@@ -1037,23 +992,23 @@ bool SPTextContext::root_handler(GdkEvent* event) {
case GDK_KEY_Left:
case GDK_KEY_KP_Left:
case GDK_KEY_KP_4:
- if (tc->text) {
+ if (this->text) {
if (MOD__ALT(event)) {
gint mul = 1 + gobble_key_events(
get_group0_keyval(&event->key), 0); // with any mask
if (MOD__SHIFT(event))
- sp_te_adjust_kerning_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, Geom::Point(mul*-10, 0));
+ sp_te_adjust_kerning_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, Geom::Point(mul*-10, 0));
else
- sp_te_adjust_kerning_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, Geom::Point(mul*-1, 0));
- sp_text_context_update_cursor(tc);
- sp_text_context_update_text_selection(tc);
+ sp_te_adjust_kerning_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, Geom::Point(mul*-1, 0));
+ sp_text_context_update_cursor(this);
+ sp_text_context_update_text_selection(this);
DocumentUndo::maybeDone(sp_desktop_document(desktop), "kern:left", SP_VERB_CONTEXT_TEXT,
_("Kern to the left"));
} else {
if (MOD__CTRL(event))
- tc->text_sel_end.cursorLeftWithControl();
+ this->text_sel_end.cursorLeftWithControl();
else
- tc->text_sel_end.cursorLeft();
+ this->text_sel_end.cursorLeft();
cursor_moved = true;
break;
}
@@ -1062,23 +1017,23 @@ bool SPTextContext::root_handler(GdkEvent* event) {
case GDK_KEY_Right:
case GDK_KEY_KP_Right:
case GDK_KEY_KP_6:
- if (tc->text) {
+ if (this->text) {
if (MOD__ALT(event)) {
gint mul = 1 + gobble_key_events(
get_group0_keyval(&event->key), 0); // with any mask
if (MOD__SHIFT(event))
- sp_te_adjust_kerning_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, Geom::Point(mul*10, 0));
+ sp_te_adjust_kerning_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, Geom::Point(mul*10, 0));
else
- sp_te_adjust_kerning_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, Geom::Point(mul*1, 0));
- sp_text_context_update_cursor(tc);
- sp_text_context_update_text_selection(tc);
+ sp_te_adjust_kerning_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, Geom::Point(mul*1, 0));
+ sp_text_context_update_cursor(this);
+ sp_text_context_update_text_selection(this);
DocumentUndo::maybeDone(sp_desktop_document(desktop), "kern:right", SP_VERB_CONTEXT_TEXT,
_("Kern to the right"));
} else {
if (MOD__CTRL(event))
- tc->text_sel_end.cursorRightWithControl();
+ this->text_sel_end.cursorRightWithControl();
else
- tc->text_sel_end.cursorRight();
+ this->text_sel_end.cursorRight();
cursor_moved = true;
break;
}
@@ -1087,23 +1042,23 @@ bool SPTextContext::root_handler(GdkEvent* event) {
case GDK_KEY_Up:
case GDK_KEY_KP_Up:
case GDK_KEY_KP_8:
- if (tc->text) {
+ if (this->text) {
if (MOD__ALT(event)) {
gint mul = 1 + gobble_key_events(
get_group0_keyval(&event->key), 0); // with any mask
if (MOD__SHIFT(event))
- sp_te_adjust_kerning_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, Geom::Point(0, mul*-10));
+ sp_te_adjust_kerning_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, Geom::Point(0, mul*-10));
else
- sp_te_adjust_kerning_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, Geom::Point(0, mul*-1));
- sp_text_context_update_cursor(tc);
- sp_text_context_update_text_selection(tc);
+ sp_te_adjust_kerning_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, Geom::Point(0, mul*-1));
+ sp_text_context_update_cursor(this);
+ sp_text_context_update_text_selection(this);
DocumentUndo::maybeDone(sp_desktop_document(desktop), "kern:up", SP_VERB_CONTEXT_TEXT,
_("Kern up"));
} else {
if (MOD__CTRL(event))
- tc->text_sel_end.cursorUpWithControl();
+ this->text_sel_end.cursorUpWithControl();
else
- tc->text_sel_end.cursorUp();
+ this->text_sel_end.cursorUp();
cursor_moved = true;
break;
}
@@ -1112,23 +1067,23 @@ bool SPTextContext::root_handler(GdkEvent* event) {
case GDK_KEY_Down:
case GDK_KEY_KP_Down:
case GDK_KEY_KP_2:
- if (tc->text) {
+ if (this->text) {
if (MOD__ALT(event)) {
gint mul = 1 + gobble_key_events(
get_group0_keyval(&event->key), 0); // with any mask
if (MOD__SHIFT(event))
- sp_te_adjust_kerning_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, Geom::Point(0, mul*10));
+ sp_te_adjust_kerning_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, Geom::Point(0, mul*10));
else
- sp_te_adjust_kerning_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, Geom::Point(0, mul*1));
- sp_text_context_update_cursor(tc);
- sp_text_context_update_text_selection(tc);
+ sp_te_adjust_kerning_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, Geom::Point(0, mul*1));
+ sp_text_context_update_cursor(this);
+ sp_text_context_update_text_selection(this);
DocumentUndo::maybeDone(sp_desktop_document(desktop), "kern:down", SP_VERB_CONTEXT_TEXT,
_("Kern down"));
} else {
if (MOD__CTRL(event))
- tc->text_sel_end.cursorDownWithControl();
+ this->text_sel_end.cursorDownWithControl();
else
- tc->text_sel_end.cursorDown();
+ this->text_sel_end.cursorDown();
cursor_moved = true;
break;
}
@@ -1136,143 +1091,143 @@ bool SPTextContext::root_handler(GdkEvent* event) {
return TRUE;
case GDK_KEY_Home:
case GDK_KEY_KP_Home:
- if (tc->text) {
+ if (this->text) {
if (MOD__CTRL(event))
- tc->text_sel_end.thisStartOfShape();
+ this->text_sel_end.thisStartOfShape();
else
- tc->text_sel_end.thisStartOfLine();
+ this->text_sel_end.thisStartOfLine();
cursor_moved = true;
break;
}
return TRUE;
case GDK_KEY_End:
case GDK_KEY_KP_End:
- if (tc->text) {
+ if (this->text) {
if (MOD__CTRL(event))
- tc->text_sel_end.nextStartOfShape();
+ this->text_sel_end.nextStartOfShape();
else
- tc->text_sel_end.thisEndOfLine();
+ this->text_sel_end.thisEndOfLine();
cursor_moved = true;
break;
}
return TRUE;
case GDK_KEY_Page_Down:
case GDK_KEY_KP_Page_Down:
- if (tc->text) {
- tc->text_sel_end.cursorDown(screenlines);
+ if (this->text) {
+ this->text_sel_end.cursorDown(screenlines);
cursor_moved = true;
break;
}
return TRUE;
case GDK_KEY_Page_Up:
case GDK_KEY_KP_Page_Up:
- if (tc->text) {
- tc->text_sel_end.cursorUp(screenlines);
+ if (this->text) {
+ this->text_sel_end.cursorUp(screenlines);
cursor_moved = true;
break;
}
return TRUE;
case GDK_KEY_Escape:
- if (tc->creating) {
- tc->creating = 0;
- if (tc->grabbed) {
- sp_canvas_item_ungrab(tc->grabbed, GDK_CURRENT_TIME);
- tc->grabbed = NULL;
+ if (this->creating) {
+ this->creating = 0;
+ if (this->grabbed) {
+ sp_canvas_item_ungrab(this->grabbed, GDK_CURRENT_TIME);
+ this->grabbed = NULL;
}
Inkscape::Rubberband::get(desktop)->stop();
} else {
sp_desktop_selection(desktop)->clear();
}
- tc->nascent_object = FALSE;
+ this->nascent_object = FALSE;
return TRUE;
case GDK_KEY_bracketleft:
- if (tc->text) {
+ if (this->text) {
if (MOD__ALT(event) || MOD__CTRL(event)) {
if (MOD__ALT(event)) {
if (MOD__SHIFT(event)) {
// FIXME: alt+shift+[] does not work, don't know why
- sp_te_adjust_rotation_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, -10);
+ sp_te_adjust_rotation_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, -10);
} else {
- sp_te_adjust_rotation_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, -1);
+ sp_te_adjust_rotation_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, -1);
}
} else {
- sp_te_adjust_rotation(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, -90);
+ sp_te_adjust_rotation(this->text, this->text_sel_start, this->text_sel_end, desktop, -90);
}
DocumentUndo::maybeDone(sp_desktop_document(desktop), "textrot:ccw", SP_VERB_CONTEXT_TEXT,
_("Rotate counterclockwise"));
- sp_text_context_update_cursor(tc);
- sp_text_context_update_text_selection(tc);
+ sp_text_context_update_cursor(this);
+ sp_text_context_update_text_selection(this);
return TRUE;
}
}
break;
case GDK_KEY_bracketright:
- if (tc->text) {
+ if (this->text) {
if (MOD__ALT(event) || MOD__CTRL(event)) {
if (MOD__ALT(event)) {
if (MOD__SHIFT(event)) {
// FIXME: alt+shift+[] does not work, don't know why
- sp_te_adjust_rotation_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, 10);
+ sp_te_adjust_rotation_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, 10);
} else {
- sp_te_adjust_rotation_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, 1);
+ sp_te_adjust_rotation_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, 1);
}
} else {
- sp_te_adjust_rotation(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, 90);
+ sp_te_adjust_rotation(this->text, this->text_sel_start, this->text_sel_end, desktop, 90);
}
DocumentUndo::maybeDone(sp_desktop_document(desktop), "textrot:cw", SP_VERB_CONTEXT_TEXT,
_("Rotate clockwise"));
- sp_text_context_update_cursor(tc);
- sp_text_context_update_text_selection(tc);
+ sp_text_context_update_cursor(this);
+ sp_text_context_update_text_selection(this);
return TRUE;
}
}
break;
case GDK_KEY_less:
case GDK_KEY_comma:
- if (tc->text) {
+ if (this->text) {
if (MOD__ALT(event)) {
if (MOD__CTRL(event)) {
if (MOD__SHIFT(event))
- sp_te_adjust_linespacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, -10);
+ sp_te_adjust_linespacing_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, -10);
else
- sp_te_adjust_linespacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, -1);
+ sp_te_adjust_linespacing_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, -1);
DocumentUndo::maybeDone(sp_desktop_document(desktop), "linespacing:dec", SP_VERB_CONTEXT_TEXT,
_("Contract line spacing"));
} else {
if (MOD__SHIFT(event))
- sp_te_adjust_tspan_letterspacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, -10);
+ sp_te_adjust_tspan_letterspacing_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, -10);
else
- sp_te_adjust_tspan_letterspacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, -1);
+ sp_te_adjust_tspan_letterspacing_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, -1);
DocumentUndo::maybeDone(sp_desktop_document(desktop), "letterspacing:dec", SP_VERB_CONTEXT_TEXT,
_("Contract letter spacing"));
}
- sp_text_context_update_cursor(tc);
- sp_text_context_update_text_selection(tc);
+ sp_text_context_update_cursor(this);
+ sp_text_context_update_text_selection(this);
return TRUE;
}
}
break;
case GDK_KEY_greater:
case GDK_KEY_period:
- if (tc->text) {
+ if (this->text) {
if (MOD__ALT(event)) {
if (MOD__CTRL(event)) {
if (MOD__SHIFT(event))
- sp_te_adjust_linespacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, 10);
+ sp_te_adjust_linespacing_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, 10);
else
- sp_te_adjust_linespacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, 1);
+ sp_te_adjust_linespacing_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, 1);
DocumentUndo::maybeDone(sp_desktop_document(desktop), "linespacing:inc", SP_VERB_CONTEXT_TEXT,
_("Expand line spacing"));
} else {
if (MOD__SHIFT(event))
- sp_te_adjust_tspan_letterspacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, 10);
+ sp_te_adjust_tspan_letterspacing_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, 10);
else
- sp_te_adjust_tspan_letterspacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, 1);
+ sp_te_adjust_tspan_letterspacing_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, 1);
DocumentUndo::maybeDone(sp_desktop_document(desktop), "letterspacing:inc", SP_VERB_CONTEXT_TEXT,
_("Expand letter spacing"));\
}
- sp_text_context_update_cursor(tc);
- sp_text_context_update_text_selection(tc);
+ sp_text_context_update_cursor(this);
+ sp_text_context_update_text_selection(this);
return TRUE;
}
}
@@ -1283,10 +1238,10 @@ bool SPTextContext::root_handler(GdkEvent* event) {
if (cursor_moved) {
if (!MOD__SHIFT(event))
- tc->text_sel_start = tc->text_sel_end;
- if (old_start != tc->text_sel_start || old_end != tc->text_sel_end) {
- sp_text_context_update_cursor(tc);
- sp_text_context_update_text_selection(tc);
+ this->text_sel_start = this->text_sel_end;
+ if (old_start != this->text_sel_start || old_end != this->text_sel_end) {
+ sp_text_context_update_cursor(this);
+ sp_text_context_update_text_selection(this);
}
return TRUE;
}
@@ -1301,11 +1256,11 @@ bool SPTextContext::root_handler(GdkEvent* event) {
&& !MOD__CTRL_ONLY(event)) {
return TRUE;
} else if (group0_keyval == GDK_KEY_Escape) { // cancel rubberband
- if (tc->creating) {
- tc->creating = 0;
- if (tc->grabbed) {
- sp_canvas_item_ungrab(tc->grabbed, GDK_CURRENT_TIME);
- tc->grabbed = NULL;
+ if (this->creating) {
+ this->creating = 0;
+ if (this->grabbed) {
+ sp_canvas_item_ungrab(this->grabbed, GDK_CURRENT_TIME);
+ this->grabbed = NULL;
}
Inkscape::Rubberband::get(desktop)->stop();
}
@@ -1318,7 +1273,7 @@ bool SPTextContext::root_handler(GdkEvent* event) {
}
case GDK_KEY_RELEASE:
- if (!tc->unimode && tc->imc && gtk_im_context_filter_keypress(tc->imc, (GdkEventKey*) event)) {
+ if (!this->unimode && this->imc && gtk_im_context_filter_keypress(this->imc, (GdkEventKey*) event)) {
return TRUE;
}
break;