arc-context.cpp revision c5424ab93868fb819e42ef2daa8f5031cf43d130
40N/A#ifdef HAVE_CONFIG_H
40N/A#include "display/sp-canvas.h"
40N/A#include "sp-ellipse.h"
40N/A#include "document.h"
40N/A#include "document-undo.h"
40N/A#include "sp-namedview.h"
40N/A#include "selection.h"
70N/A#include "desktop-handles.h"
40N/A#include "pixmaps/cursor-ellipse.xpm"
40N/A#include "sp-metrics.h"
40N/A#include "xml/node-event-vector.h"
40N/A#include "preferences.h"
40N/A#include "message-context.h"
40N/A#include "desktop-style.h"
40N/A#include "context-fns.h"
40N/A#include "shape-editor.h"
40N/A#include "event-context.h"
47N/A#include "arc-context.h"
40N/A#include "display/sp-canvas-item.h"
40N/A#include "tool-factory.h"
40N/A return new SPArcContext();
40N/A bool arcContextRegistered = ToolFactory::instance().registerObject("/tools/shapes/arc", createArcContext);
47N/A this->_message_context = 0;
40N/A this->within_tolerance = false;
40N/A this->finishItem();
40N/A this->enableGrDrag(false);
40N/A delete this->shape_editor;
40N/A this->finishItem();
40N/A delete this->_message_context;
40N/A this->enableSelectionCue();
40N/A this->enableGrDrag();
40N/A case GDK_BUTTON_PRESS:
40N/A// ret = (SP_EVENT_CONTEXT_CLASS(sp_arc_context_parent_class))->item_handler(event_context, item, event);
static bool dragging;
case GDK_BUTTON_PRESS:
dragging = true;
m.unSetup();
case GDK_MOTION_NOTIFY:
if ( this->within_tolerance
this->within_tolerance = false;
} else if (!sp_event_context_knot_mouseover(this)){
m.unSetup();
case GDK_BUTTON_RELEASE:
dragging = false;
if (!this->within_tolerance) {
this->finishItem();
} else if (this->item_to_select) {
this->xp = 0;
this->yp = 0;
case GDK_KEY_PRESS:
case GDK_KEY_Alt_L:
case GDK_KEY_Alt_R:
case GDK_KEY_Control_L:
case GDK_KEY_Control_R:
case GDK_KEY_Shift_L:
case GDK_KEY_Shift_R:
case GDK_KEY_Meta_R:
if (!dragging) {
NULL);
case GDK_KEY_Up:
case GDK_KEY_Down:
case GDK_KEY_KP_Up:
case GDK_KEY_KP_Down:
case GDK_KEY_x:
case GDK_KEY_X:
case GDK_KEY_Escape:
if (dragging) {
dragging = false;
this->cancel();
case GDK_KEY_space:
if (dragging) {
dragging = false;
if (!this->within_tolerance) {
this->finishItem();
case GDK_KEY_Delete:
case GDK_KEY_KP_Delete:
case GDK_KEY_BackSpace:
case GDK_KEY_RELEASE:
case GDK_KEY_Alt_L:
case GDK_KEY_Alt_R:
case GDK_KEY_Control_L:
case GDK_KEY_Control_R:
case GDK_KEY_Shift_L:
case GDK_KEY_Shift_R:
case GDK_KEY_Meta_R:
if (!ret) {
return ret;
if (!this->arc) {
bool ctrl_save = false;
ctrl_save = true;
if (ctrl_save) {
if (!ctrl_save) {
this->_message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Ellipse</b>: %s × %s (constrained to ratio %d:%d); with <b>Shift</b> to draw around the starting point"), xs->str, ys->str, ratio_x, ratio_y);
this->_message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Ellipse</b>: %s × %s; with <b>Ctrl</b> to make square or integer-ratio ellipse; with <b>Shift</b> to draw around the starting point"), xs->str, ys->str);
this->cancel(); // Don't allow the creating of zero sized arc, for example when the start and and point snap to the snap grid point
this->within_tolerance = false;
this->xp = 0;
this->yp = 0;