summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4110509)
raw | patch | inline | side by side (parent: 4110509)
author | cilix42 <cilix42@users.sourceforge.net> | |
Thu, 14 Aug 2008 21:35:32 +0000 (21:35 +0000) | ||
committer | cilix42 <cilix42@users.sourceforge.net> | |
Thu, 14 Aug 2008 21:35:32 +0000 (21:35 +0000) |
diff --git a/src/eraser-context.cpp b/src/eraser-context.cpp
index 9a8e07e668dc918b557f1bb81cf1c915bffed4e3..bec3326d62ab1f2876ce404685238bb3dee22fb0 100644 (file)
--- a/src/eraser-context.cpp
+++ b/src/eraser-context.cpp
dc->repr = NULL;
}
- Inkscape::Rubberband::get()->start(desktop, button_dt);
- Inkscape::Rubberband::get()->setMode(RUBBERBAND_MODE_TOUCHPATH);
+ Inkscape::Rubberband::get(desktop)->start(desktop, button_dt);
+ Inkscape::Rubberband::get(desktop)->setMode(RUBBERBAND_MODE_TOUCHPATH);
/* initialize first point */
dc->npoints = 0;
}
ret = TRUE;
}
- Inkscape::Rubberband::get()->move(motion_dt);
+ Inkscape::Rubberband::get(desktop)->move(motion_dt);
}
break;
if (dc->dragging && event->button.button == 1 && !event_context->space_panning) {
dc->dragging = FALSE;
- boost::optional<NR::Rect> const b = Inkscape::Rubberband::get()->getRectangle();
+ boost::optional<NR::Rect> const b = Inkscape::Rubberband::get(desktop)->getRectangle();
sp_eraser_apply(dc, motion_dt);
dc->repr = NULL;
}
- Inkscape::Rubberband::get()->stop();
+ Inkscape::Rubberband::get(desktop)->stop();
dc->_message_context->clear();
ret = TRUE;
}
}
break;
case GDK_Escape:
- Inkscape::Rubberband::get()->stop();
+ Inkscape::Rubberband::get(desktop)->stop();
if (dc->is_drawing) {
// if drawing, cancel, otherwise pass it up for deselecting
eraser_cancel (dc);
if ( eraserMode ) {
toWorkOn = sp_document_partial_items_in_box(sp_desktop_document(desktop), desktop->dkey, bounds);
} else {
- Inkscape::Rubberband::Rubberband *r = Inkscape::Rubberband::get();
+ Inkscape::Rubberband::Rubberband *r = Inkscape::Rubberband::get(desktop);
toWorkOn = sp_document_items_at_points(sp_desktop_document(desktop), desktop->dkey, r->getPoints());
}
toWorkOn = g_slist_remove( toWorkOn, acid );
diff --git a/src/event-context.cpp b/src/event-context.cpp
index 22c91e4505c8f66f508b090406fd5fcc5ac8ce9f..450d1994d03746a4b94da51dc9c933eef4890fbb 100644 (file)
--- a/src/event-context.cpp
+++ b/src/event-context.cpp
@@ -457,10 +457,10 @@ static gint sp_event_context_private_root_handler(SPEventContext *event_context,
// motion notify coordinates as given (no snapping back to origin)
within_tolerance = false;
- if (Inkscape::Rubberband::get()->is_started()) {
- Inkscape::Rubberband::get()->move(motion_dt);
+ if (Inkscape::Rubberband::get(desktop)->is_started()) {
+ Inkscape::Rubberband::get(desktop)->move(motion_dt);
} else {
- Inkscape::Rubberband::get()->start(desktop, motion_dt);
+ Inkscape::Rubberband::get(desktop)->start(desktop, motion_dt);
}
if (zoom_rb == 2)
gobble_motion_events(GDK_BUTTON2_MASK);
@@ -497,8 +497,8 @@ static gint sp_event_context_private_root_handler(SPEventContext *event_context,
ret = TRUE;
} else if (zoom_rb == event->button.button) {
zoom_rb = 0;
- boost::optional<NR::Rect> const b = Inkscape::Rubberband::get()->getRectangle();
- Inkscape::Rubberband::get()->stop();
+ boost::optional<NR::Rect> const b = Inkscape::Rubberband::get(desktop)->getRectangle();
+ Inkscape::Rubberband::get(desktop)->stop();
if (b && !within_tolerance) {
desktop->set_display_area(*b, 10);
}
diff --git a/src/flood-context.cpp b/src/flood-context.cpp
index 634ee4732d1a529ebddd3818dd8d3effe1212daf..a9ca7073f906669c637a05a654d6c6a1e548bd2f 100644 (file)
--- a/src/flood-context.cpp
+++ b/src/flood-context.cpp
@@ -922,7 +922,7 @@ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *even
if (is_point_fill) {
fill_points.push_back(NR::Point(event->button.x, event->button.y));
} else {
- Inkscape::Rubberband::Rubberband *r = Inkscape::Rubberband::get();
+ Inkscape::Rubberband::Rubberband *r = Inkscape::Rubberband::get(desktop);
fill_points = r->getPoints();
}
@@ -1199,8 +1199,8 @@ static gint sp_flood_context_root_handler(SPEventContext *event_context, GdkEven
dragging = true;
NR::Point const p(desktop->w2d(button_w));
- Inkscape::Rubberband::get()->setMode(RUBBERBAND_MODE_TOUCHPATH);
- Inkscape::Rubberband::get()->start(desktop, p);
+ Inkscape::Rubberband::get(desktop)->setMode(RUBBERBAND_MODE_TOUCHPATH);
+ Inkscape::Rubberband::get(desktop)->start(desktop, p);
}
}
}
@@ -1218,8 +1218,8 @@ static gint sp_flood_context_root_handler(SPEventContext *event_context, GdkEven
NR::Point const motion_pt(event->motion.x, event->motion.y);
NR::Point const p(desktop->w2d(motion_pt));
- if (Inkscape::Rubberband::get()->is_started()) {
- Inkscape::Rubberband::get()->move(p);
+ if (Inkscape::Rubberband::get(desktop)->is_started()) {
+ Inkscape::Rubberband::get(desktop)->move(p);
event_context->defaultMessageContext()->set(Inkscape::NORMAL_MESSAGE, _("<b>Draw over</b> areas to add to fill, hold <b>Alt</b> for touch fill"));
gobble_motion_events(GDK_BUTTON1_MASK);
}
@@ -1228,7 +1228,7 @@ static gint sp_flood_context_root_handler(SPEventContext *event_context, GdkEven
case GDK_BUTTON_RELEASE:
if (event->button.button == 1 && !event_context->space_panning) {
- Inkscape::Rubberband::Rubberband *r = Inkscape::Rubberband::get();
+ Inkscape::Rubberband::Rubberband *r = Inkscape::Rubberband::get(desktop);
if (r->is_started()) {
// set "busy" cursor
desktop->setWaitingCursor();
index f2cd9e03a7f8b5a7d8ff32fd3890172136b3cb17..e6932c71004cef1aed92394adaa3f99ab9a16166 100644 (file)
--- a/src/gradient-context.cpp
+++ b/src/gradient-context.cpp
@@ -544,7 +544,7 @@ sp_gradient_context_root_handler(SPEventContext *event_context, GdkEvent *event)
Geom::Point button_dt = to_2geom(desktop->w2d(button_w));
if (event->button.state & GDK_SHIFT_MASK) {
- Inkscape::Rubberband::get()->start(desktop, from_2geom(button_dt));
+ Inkscape::Rubberband::get(desktop)->start(desktop, from_2geom(button_dt));
} else {
// remember clicked item, disregarding groups, honoring Alt; do nothing with Crtl to
// enable Ctrl+doubleclick of exactly the selected item(s)
@@ -579,8 +579,8 @@ sp_gradient_context_root_handler(SPEventContext *event_context, GdkEvent *event)
event->motion.y);
NR::Point const motion_dt = event_context->desktop->w2d(motion_w);
- if (Inkscape::Rubberband::get()->is_started()) {
- Inkscape::Rubberband::get()->move(motion_dt);
+ if (Inkscape::Rubberband::get(desktop)->is_started()) {
+ Inkscape::Rubberband::get(desktop)->move(motion_dt);
event_context->defaultMessageContext()->set(Inkscape::NORMAL_MESSAGE, _("<b>Draw around</b> handles to select them"));
} else {
sp_gradient_drag(*rc, motion_dt, event->motion.state, event->motion.time);
@@ -637,7 +637,7 @@ sp_gradient_context_root_handler(SPEventContext *event_context, GdkEvent *event)
if (!event_context->within_tolerance) {
// we've been dragging, either do nothing (grdrag handles that),
// or rubberband-select if we have rubberband
- Inkscape::Rubberband::Rubberband *r = Inkscape::Rubberband::get();
+ Inkscape::Rubberband::Rubberband *r = Inkscape::Rubberband::get(desktop);
if (r->is_started() && !event_context->within_tolerance) {
// this was a rubberband drag
if (r->getMode() == RUBBERBAND_MODE_RECT) {
@@ -665,7 +665,7 @@ sp_gradient_context_root_handler(SPEventContext *event_context, GdkEvent *event)
event_context->item_to_select = NULL;
ret = TRUE;
}
- Inkscape::Rubberband::get()->stop();
+ Inkscape::Rubberband::get(desktop)->stop();
}
break;
case GDK_KEY_PRESS:
diff --git a/src/node-context.cpp b/src/node-context.cpp
index b205b86d5d8973fb1d7f8bb6e4c77cb5a5a9eb3b..9f026c3f24030e6fa6009846c60645b1eb58057c 100644 (file)
--- a/src/node-context.cpp
+++ b/src/node-context.cpp
NR::Point const button_w(event->button.x,
event->button.y);
NR::Point const button_dt(desktop->w2d(button_w));
- Inkscape::Rubberband::get()->start(desktop, button_dt);
+ Inkscape::Rubberband::get(desktop)->start(desktop, button_dt);
nc->current_state = SP_NODE_CONTEXT_INACTIVE;
desktop->updateNow();
ret = TRUE;
break;
}
case SP_NODE_CONTEXT_RUBBERBAND_DRAGGING:
- if (Inkscape::Rubberband::get()->is_started()) {
+ if (Inkscape::Rubberband::get(desktop)->is_started()) {
NR::Point const motion_w(event->motion.x,
event->motion.y);
NR::Point const motion_dt(desktop->w2d(motion_w));
- Inkscape::Rubberband::get()->move(motion_dt);
+ Inkscape::Rubberband::get(desktop)->move(motion_dt);
}
break;
}
selection->set(item_clicked);
desktop->updateNow();
}
- Inkscape::Rubberband::get()->stop();
+ Inkscape::Rubberband::get(desktop)->stop();
ret = TRUE;
break;
}
if (event->type == GDK_BUTTON_RELEASE) {
event_context->xp = event_context->yp = 0;
if (event->button.button == 1) {
- boost::optional<NR::Rect> b = Inkscape::Rubberband::get()->getRectangle();
+ boost::optional<NR::Rect> b = Inkscape::Rubberband::get(desktop)->getRectangle();
if (nc->shape_editor->hits_curve() && !event_context->within_tolerance) { //drag curve
nc->shape_editor->finish_drag();
}
}
ret = TRUE;
- Inkscape::Rubberband::get()->stop();
+ Inkscape::Rubberband::get(desktop)->stop();
desktop->updateNow();
nc->rb_escaped = false;
nc->drag = FALSE;
break;
case GDK_Escape:
{
- boost::optional<NR::Rect> const b = Inkscape::Rubberband::get()->getRectangle();
+ boost::optional<NR::Rect> const b = Inkscape::Rubberband::get(desktop)->getRectangle();
if (b) {
- Inkscape::Rubberband::get()->stop();
+ Inkscape::Rubberband::get(desktop)->stop();
nc->current_state = SP_NODE_CONTEXT_INACTIVE;
nc->rb_escaped = true;
} else {
diff --git a/src/rubberband.cpp b/src/rubberband.cpp
index 73333a555278f76a182104790bd6219f2c331d34..bfe73a43db4b4ea286b2a72f288bfe09c53ca895 100644 (file)
--- a/src/rubberband.cpp
+++ b/src/rubberband.cpp
#include "display/sodipodi-ctrlrect.h"
#include "desktop.h"
-#include "inkscape.h"
#include "desktop-handles.h"
#include "rubberband.h"
#include "display/canvas-bpath.h"
Inkscape::Rubberband *Inkscape::Rubberband::_instance = NULL;
-Inkscape::Rubberband::Rubberband()
- : _desktop(SP_ACTIVE_DESKTOP), _rect(NULL), _touchpath(NULL), _started(false)
+Inkscape::Rubberband::Rubberband(SPDesktop *dt)
+ : _desktop(dt), _rect(NULL), _touchpath(NULL), _started(false)
{
_points.clear();
_mode = RUBBERBAND_MODE_RECT;
return NR::Rect(_start, _end);
}
-Inkscape::Rubberband *Inkscape::Rubberband::get()
+Inkscape::Rubberband *Inkscape::Rubberband::get(SPDesktop *desktop)
{
if (_instance == NULL) {
- _instance = new Inkscape::Rubberband;
+ _instance = new Inkscape::Rubberband(desktop);
}
return _instance;
diff --git a/src/rubberband.h b/src/rubberband.h
index 7734a65fa98d2c309d620189f57269f79437ca6c..f9adc7b3b5d839f3e9e108b61f1508a5b639c9d9 100644 (file)
--- a/src/rubberband.h
+++ b/src/rubberband.h
void setMode(int mode);
- static Rubberband* get();
+ static Rubberband* get(SPDesktop *desktop);
private:
- Rubberband();
+ Rubberband(SPDesktop *desktop);
static Rubberband* _instance;
SPDesktop *_desktop;
diff --git a/src/select-context.cpp b/src/select-context.cpp
index 22b358dc7ea55985bd9af6bef81946c30639db7c..7c966c9b9114f44adbf2a123da7d8c3de4761b80 100644 (file)
--- a/src/select-context.cpp
+++ b/src/select-context.cpp
return true;
}
} else {
- if (Inkscape::Rubberband::get()->is_started()) {
- Inkscape::Rubberband::get()->stop();
+ if (Inkscape::Rubberband::get(desktop)->is_started()) {
+ Inkscape::Rubberband::get(desktop)->stop();
rb_escaped = 1;
SP_EVENT_CONTEXT(sc)->defaultMessageContext()->clear();
SP_EVENT_CONTEXT(sc)->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Selection canceled."));
NR::Point const button_pt(event->button.x, event->button.y);
NR::Point const p(desktop->w2d(button_pt));
if (event->button.state & GDK_MOD1_MASK)
- Inkscape::Rubberband::get()->setMode(RUBBERBAND_MODE_TOUCHPATH);
- Inkscape::Rubberband::get()->start(desktop, p);
+ Inkscape::Rubberband::get(desktop)->setMode(RUBBERBAND_MODE_TOUCHPATH);
+ Inkscape::Rubberband::get(desktop)->start(desktop, p);
if (sc->grabbed) {
sp_canvas_item_ungrab(sc->grabbed, event->button.time);
sc->grabbed = NULL;
/* User has dragged fast, so we get events on root (lauris)*/
// not only that; we will end up here when ctrl-dragging as well
// and also when we started within tolerance, but trespassed tolerance outside of item
- Inkscape::Rubberband::get()->stop();
+ Inkscape::Rubberband::get(desktop)->stop();
SP_EVENT_CONTEXT(sc)->defaultMessageContext()->clear();
item_at_point = desktop->item_at_point(NR::Point(event->button.x, event->button.y), FALSE);
if (!item_at_point) // if no item at this point, try at the click point (bug 1012200)
sp_canvas_end_forced_full_redraws(desktop->canvas);
}
} else {
- if (Inkscape::Rubberband::get()->is_started()) {
- Inkscape::Rubberband::get()->move(p);
- if (Inkscape::Rubberband::get()->getMode() == RUBBERBAND_MODE_TOUCHPATH) {
+ if (Inkscape::Rubberband::get(desktop)->is_started()) {
+ Inkscape::Rubberband::get(desktop)->move(p);
+ if (Inkscape::Rubberband::get(desktop)->getMode() == RUBBERBAND_MODE_TOUCHPATH) {
event_context->defaultMessageContext()->set(Inkscape::NORMAL_MESSAGE, _("<b>Draw over</b> objects to select them; release <b>Alt</b> to switch to rubberband selection"));
} else {
event_context->defaultMessageContext()->set(Inkscape::NORMAL_MESSAGE, _("<b>Drag around</b> objects to select them; press <b>Alt</b> to switch to touch selection"));
}
sc->item = NULL;
} else {
- Inkscape::Rubberband::Rubberband *r = Inkscape::Rubberband::get();
+ Inkscape::Rubberband::Rubberband *r = Inkscape::Rubberband::get(desktop);
if (r->is_started() && !within_tolerance) {
// this was a rubberband drag
GSList *items = NULL;
desktop->updateNow();
}
if (event->button.button == 1) {
- Inkscape::Rubberband::get()->stop(); // might have been started in another tool!
+ Inkscape::Rubberband::get(desktop)->stop(); // might have been started in another tool!
}
sc->button_press_shift = false;
sc->button_press_ctrl = false;
@@ -692,10 +692,10 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
if (!key_is_a_modifier (keyval)) {
event_context->defaultMessageContext()->clear();
} else if (sc->grabbed || seltrans->isGrabbed()) {
- if (Inkscape::Rubberband::get()->is_started()) {
+ if (Inkscape::Rubberband::get(desktop)->is_started()) {
// if Alt then change cursor to moving cursor:
if (alt) {
- Inkscape::Rubberband::get()->setMode(RUBBERBAND_MODE_TOUCHPATH);
+ Inkscape::Rubberband::get(desktop)->setMode(RUBBERBAND_MODE_TOUCHPATH);
}
} else {
// do not change the statusbar text when mousekey is down to move or transform the object,
@@ -922,10 +922,10 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
|| (keyval == GDK_Meta_L)
|| (keyval == GDK_Meta_R));
- if (Inkscape::Rubberband::get()->is_started()) {
+ if (Inkscape::Rubberband::get(desktop)->is_started()) {
// if Alt then change cursor to moving cursor:
if (alt) {
- Inkscape::Rubberband::get()->setMode(RUBBERBAND_MODE_RECT);
+ Inkscape::Rubberband::get(desktop)->setMode(RUBBERBAND_MODE_RECT);
}
}
}
diff --git a/src/text-context.cpp b/src/text-context.cpp
index 6d26bee2b98422b0bbc92dc5330c91da7f0b893c..4c3329fb72e73e8fdaf74dd150f6d9679382231b 100644 (file)
--- a/src/text-context.cpp
+++ b/src/text-context.cpp
tc->grabbed = NULL;
}
- Inkscape::Rubberband::get()->stop();
+ Inkscape::Rubberband::get(ec->desktop)->stop();
if (ec->shape_knot_holder) {
delete ec->shape_knot_holder;
@@ -613,7 +613,7 @@ sp_text_context_root_handler(SPEventContext *const event_context, GdkEvent *cons
NR::Point const button_pt(event->button.x, event->button.y);
tc->p0 = desktop->w2d(button_pt);
- Inkscape::Rubberband::get()->start(desktop, tc->p0);
+ Inkscape::Rubberband::get(desktop)->start(desktop, tc->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);
@@ -649,7 +649,7 @@ sp_text_context_root_handler(SPEventContext *const event_context, GdkEvent *cons
NR::Point const motion_pt(event->motion.x, event->motion.y);
NR::Point const p = desktop->w2d(motion_pt);
- Inkscape::Rubberband::get()->move(p);
+ Inkscape::Rubberband::get(desktop)->move(p);
gobble_motion_events(GDK_BUTTON1_MASK);
// status text
@@ -669,7 +669,7 @@ sp_text_context_root_handler(SPEventContext *const event_context, GdkEvent *cons
tc->grabbed = NULL;
}
- Inkscape::Rubberband::get()->stop();
+ Inkscape::Rubberband::get(desktop)->stop();
if (tc->creating && event_context->within_tolerance) {
/* Button 1, set X & Y & new item */
@@ -1151,7 +1151,7 @@ sp_text_context_root_handler(SPEventContext *const event_context, GdkEvent *cons
sp_canvas_item_ungrab(tc->grabbed, GDK_CURRENT_TIME);
tc->grabbed = NULL;
}
- Inkscape::Rubberband::get()->stop();
+ Inkscape::Rubberband::get(desktop)->stop();
} else {
sp_desktop_selection(desktop)->clear();
}
@@ -1283,7 +1283,7 @@ sp_text_context_root_handler(SPEventContext *const event_context, GdkEvent *cons
sp_canvas_item_ungrab(tc->grabbed, GDK_CURRENT_TIME);
tc->grabbed = NULL;
}
- Inkscape::Rubberband::get()->stop();
+ Inkscape::Rubberband::get(desktop)->stop();
}
}
}
diff --git a/src/zoom-context.cpp b/src/zoom-context.cpp
index 56eeb69cb9e93aa0644e601826a307111023e37e..8c6400189a59816420aa5fb9bb6c4952d286bf1b 100644 (file)
--- a/src/zoom-context.cpp
+++ b/src/zoom-context.cpp
@@ -133,7 +133,7 @@ static gint sp_zoom_context_root_handler(SPEventContext *event_context, GdkEvent
yp = (gint) event->button.y;
within_tolerance = true;
- Inkscape::Rubberband::get()->start(desktop, button_dt);
+ Inkscape::Rubberband::get(desktop)->start(desktop, button_dt);
escaped = false;
@@ -164,7 +164,7 @@ static gint sp_zoom_context_root_handler(SPEventContext *event_context, GdkEvent
NR::Point const motion_w(event->motion.x, event->motion.y);
NR::Point const motion_dt(desktop->w2d(motion_w));
- Inkscape::Rubberband::get()->move(motion_dt);
+ Inkscape::Rubberband::get(desktop)->move(motion_dt);
gobble_motion_events(GDK_BUTTON1_MASK);
}
break;
@@ -174,7 +174,7 @@ static gint sp_zoom_context_root_handler(SPEventContext *event_context, GdkEvent
NR::Point const button_w(event->button.x, event->button.y);
NR::Point const button_dt(desktop->w2d(button_w));
if ( event->button.button == 1 && !event_context->space_panning) {
- boost::optional<NR::Rect> const b = Inkscape::Rubberband::get()->getRectangle();
+ boost::optional<NR::Rect> const b = Inkscape::Rubberband::get(desktop)->getRectangle();
if (b && !within_tolerance) {
desktop->set_display_area(*b, 10);
} else if (!escaped) {
@@ -185,7 +185,7 @@ static gint sp_zoom_context_root_handler(SPEventContext *event_context, GdkEvent
}
ret = TRUE;
}
- Inkscape::Rubberband::get()->stop();
+ Inkscape::Rubberband::get(desktop)->stop();
xp = yp = 0;
escaped = false;
break;
@@ -193,7 +193,7 @@ static gint sp_zoom_context_root_handler(SPEventContext *event_context, GdkEvent
case GDK_KEY_PRESS:
switch (get_group0_keyval (&event->key)) {
case GDK_Escape:
- Inkscape::Rubberband::get()->stop();
+ Inkscape::Rubberband::get(desktop)->stop();
xp = yp = 0;
escaped = true;
ret = TRUE;