0N/A#include "display/sp-canvas.h"
781N/A#include "document.h"
781N/A#include "document-undo.h"
781N/A#include "sp-namedview.h"
0N/A#include "selection.h"
419N/A#include "selection-chemistry.h"
0N/A#include "desktop-style.h"
781N/A#include "message-context.h"
0N/A#include "pixmaps/cursor-rect.xpm"
781N/A#include "ui/tools/rect-tool.h"
781N/A#include "xml/node-event-vector.h"
781N/A#include "preferences.h"
0N/A#include "context-fns.h"
0N/A#include "ui/shape-editor.h"
0N/A#include "display/sp-canvas-item.h"
419N/A this->finishItem();
0N/A this->enableGrDrag(false);
781N/A delete this->shape_editor;
781N/A this->finishItem();
781N/A this->enableSelectionCue();
781N/A this->enableGrDrag();
781N/A case GDK_BUTTON_PRESS:
781N/A case GDK_BUTTON_PRESS:
781N/A this->within_tolerance = true;
781N/A this->item_to_select = sp_event_context_find_item (desktop, button_w, event->button.state & GDK_MOD1_MASK, TRUE);
419N/A case GDK_MOTION_NOTIFY:
0N/A if ( this->within_tolerance
419N/A this->within_tolerance = false;
0N/A } else if (!this->sp_event_context_knot_mouseover()) {
0N/A case GDK_BUTTON_RELEASE:
419N/A if (!this->within_tolerance) {
419N/A this->finishItem();
419N/A } else if (this->item_to_select) {
781N/A case GDK_KEY_PRESS:
0N/A case GDK_KEY_Alt_L:
419N/A case GDK_KEY_Alt_R:
0N/A case GDK_KEY_Control_L:
0N/A case GDK_KEY_Control_R:
419N/A case GDK_KEY_Shift_L:
0N/A case GDK_KEY_Shift_R:
0N/A case GDK_KEY_Meta_R:
419N/A case GDK_KEY_Up:
419N/A case GDK_KEY_Down:
419N/A case GDK_KEY_KP_Up:
781N/A case GDK_KEY_KP_Down:
419N/A case GDK_KEY_Escape:
419N/A case GDK_KEY_space:
419N/A if (!this->within_tolerance) {
419N/A this->finishItem();
0N/A case GDK_KEY_Delete:
419N/A case GDK_KEY_KP_Delete:
419N/A case GDK_KEY_BackSpace:
0N/A case GDK_KEY_RELEASE:
419N/A case GDK_KEY_Alt_L:
419N/A case GDK_KEY_Alt_R:
419N/A case GDK_KEY_Control_L:
419N/A case GDK_KEY_Control_R:
419N/A case GDK_KEY_Shift_L:
419N/A case GDK_KEY_Shift_R:
419N/A case GDK_KEY_Meta_R:
419N/A Geom::Rect const r = Inkscape::snap_rectangular_box(desktop, this->rect, pt, this->center, state);
419N/A this->rect->setPosition(r.min()[Geom::X], r.min()[Geom::Y], r.dimensions()[Geom::X], r.dimensions()[Geom::Y]);
419N/A this->rect->setRy(true, CLAMP(this->ry, 0, MIN(r.dimensions()[Geom::X], r.dimensions()[Geom::Y])/2));
419N/A is_golden_ratio = true;
419N/A is_golden_ratio = true;
419N/A if (!is_golden_ratio) {
419N/A this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Rectangle</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);
419N/A this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Rectangle</b>: %s × %s (constrained to golden ratio 1.618 : 1); with <b>Shift</b> to draw around the starting point"), xs->str, ys->str);
419N/A this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Rectangle</b>: %s × %s (constrained to golden ratio 1 : 1.618); with <b>Shift</b> to draw around the starting point"), xs->str, ys->str);
419N/A this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Rectangle</b>: %s × %s; with <b>Ctrl</b> to make square or integer-ratio rectangle; with <b>Shift</b> to draw around the starting point"), xs->str, ys->str);
419N/A this->cancel(); // Don't allow the creating of zero sized rectangle, for example when the start and and point snap to the snap grid point
419N/A DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_RECT, _("Create rectangle"));
419N/A this->within_tolerance = false;