summaryrefslogtreecommitdiffstats
path: root/src/sp-path.cpp
diff options
context:
space:
mode:
authorMaximilian Albert <maximilian.albert@gmail.com>2008-01-20 15:44:52 +0000
committercilix42 <cilix42@users.sourceforge.net>2008-01-20 15:44:52 +0000
commit58d14f1b5925e2b86cbced557e867885b6e5c18c (patch)
treeea1a44bdc79595b1bb6b194aa9525b4ece023159 /src/sp-path.cpp
parent* [INTL: sl] Slovenian translation updated by Martin Srebotnjak (closes: #184... (diff)
downloadinkscape-58d14f1b5925e2b86cbced557e867885b6e5c18c.tar.gz
inkscape-58d14f1b5925e2b86cbced557e867885b6e5c18c.zip
Ctrl+click in pen/pencil tool: Created dots are now selected; Alt is used for randomness, Shift doubles dot size; clearer preferences labels
(bzr r4568)
Diffstat (limited to 'src/sp-path.cpp')
-rw-r--r--src/sp-path.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/sp-path.cpp b/src/sp-path.cpp
index 29a5910b9..26396c8f0 100644
--- a/src/sp-path.cpp
+++ b/src/sp-path.cpp
@@ -41,6 +41,7 @@
#include "style.h"
#include "message-stack.h"
#include "prefs-utils.h"
+#include "selection.h"
#define noPATH_VERBOSE
@@ -512,7 +513,7 @@ sp_path_get_curve_reference (SPPath *path)
}
/* Create a single dot represented by a circle */
-void freehand_create_single_dot(SPEventContext *ec, NR::Point const &pt, char const *tool, bool randomize) {
+void freehand_create_single_dot(SPEventContext *ec, NR::Point const &pt, char const *tool, guint event_state) {
g_return_if_fail(!strcmp(tool, "tools.freehand.pen") || !strcmp(tool, "tools.freehand.pencil"));
SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(ec);
@@ -547,13 +548,17 @@ void freehand_create_single_dot(SPEventContext *ec, NR::Point const &pt, char co
NR::Matrix const i2d (sp_item_i2d_affine (item));
NR::Point pp = pt * i2d;
double rad = 0.5 * prefs_get_double_attribute(tool, "dot-size", 3.0);
- if (randomize) {
+ if (event_state & GDK_MOD1_MASK) {
/* TODO: We vary the dot size between 0.5*rad and 1.5*rad, where rad is the dot size
as specified in prefs. Very simple, but it might be sufficient in practice. If not,
we need to devise something more sophisticated. */
double s = g_random_double_range(-0.5, 0.5);
rad *= (1 + s);
}
+ if (event_state & GDK_SHIFT_MASK) {
+ // double the point size
+ rad *= 2;
+ }
sp_repr_set_svg_double (repr, "sodipodi:cx", pp[NR::X]);
sp_repr_set_svg_double (repr, "sodipodi:cy", pp[NR::Y]);
@@ -561,6 +566,8 @@ void freehand_create_single_dot(SPEventContext *ec, NR::Point const &pt, char co
sp_repr_set_svg_double (repr, "sodipodi:ry", rad * stroke_width);
item->updateRepr();
+ sp_desktop_selection(desktop)->set(item);
+
unsigned int tool_code = !strcmp(tool, "tools.freehand.pencil") ? SP_VERB_CONTEXT_PENCIL : SP_VERB_CONTEXT_PEN;
desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Creating single dot"));