From 13890bf7f96e6881a42da1e9254279770e1ff73e Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Tue, 2 May 2017 00:32:57 +0200 Subject: Calligraphy mode: creates dots on single click. Fixed bugs: - https://launchpad.net/bugs/263166 (bzr r15658) --- src/ui/tools/calligraphic-tool.cpp | 3 +++ src/ui/tools/freehand-base.cpp | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/calligraphic-tool.cpp b/src/ui/tools/calligraphic-tool.cpp index c2b86b538..7228a52bc 100644 --- a/src/ui/tools/calligraphic-tool.cpp +++ b/src/ui/tools/calligraphic-tool.cpp @@ -60,6 +60,7 @@ #include "verbs.h" #include "ui/tools/calligraphic-tool.h" +#include "ui/tools/freehand-base.h" using Inkscape::DocumentUndo; @@ -771,6 +772,8 @@ bool CalligraphicTool::root_handler(GdkEvent* event) { this->message_context->clear(); ret = TRUE; + } else if (!this->dragging && event->button.button == 1 && !this->space_panning){ + spdc_create_single_dot(this, this->desktop->w2d(motion_w), "/tools/calligraphic", event->button.state); } break; } diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index 056c723ee..4af70a816 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -913,7 +913,8 @@ static void spdc_free_colors(FreehandBase *dc) } void spdc_create_single_dot(ToolBase *ec, Geom::Point const &pt, char const *tool, guint event_state) { - g_return_if_fail(!strcmp(tool, "/tools/freehand/pen") || !strcmp(tool, "/tools/freehand/pencil")); + g_return_if_fail(!strcmp(tool, "/tools/freehand/pen") || !strcmp(tool, "/tools/freehand/pencil") + || !strcmp(tool, "/tools/calligraphic") ); Glib::ustring tool_path = tool; SPDesktop *desktop = ec->desktop; @@ -937,7 +938,8 @@ void spdc_create_single_dot(ToolBase *ec, Geom::Point const &pt, char const *too // unset stroke and set fill color to former stroke color gchar * str; - str = g_strdup_printf("fill:#%06x;stroke:none;", sp_desktop_get_color_tool(desktop, tool, false) >> 8); + str = strcmp(tool, "/tools/calligraphic") ? g_strdup_printf("fill:#%06x;stroke:none;", sp_desktop_get_color_tool(desktop, tool, false) >> 8) + : g_strdup_printf("fill:#%06x;stroke:#%06x;", sp_desktop_get_color_tool(desktop, tool, true) >> 8, sp_desktop_get_color_tool(desktop, tool, false) >> 8); repr->setAttribute("style", str); g_free(str); @@ -948,6 +950,8 @@ void spdc_create_single_dot(ToolBase *ec, Geom::Point const &pt, char const *too Geom::Affine const i2d (item->i2dt_affine ()); Geom::Point pp = pt * i2d.inverse(); double rad = 0.5 * prefs->getDouble(tool_path + "/dot-size", 3.0); + if (!strcmp(tool, "/tools/calligraphic")) + rad = 0.1 * prefs->getDouble(tool_path + "/width", 3.0) / desktop->current_zoom(); 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, -- cgit v1.2.3 From bd5644d34e87bf7f402beee7dac7cc1d0c4510f5 Mon Sep 17 00:00:00 2001 From: ospite <> Date: Tue, 2 May 2017 21:27:27 +0200 Subject: Add control point at center of stars Fixed bugs: - https://launchpad.net/bugs/481506 (bzr r15659) --- src/ui/object-edit.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src/ui') diff --git a/src/ui/object-edit.cpp b/src/ui/object-edit.cpp index b76e97c15..c1d85a896 100644 --- a/src/ui/object-edit.cpp +++ b/src/ui/object-edit.cpp @@ -1071,6 +1071,12 @@ public: virtual void knot_click(unsigned int state); }; +class StarKnotHolderEntityCenter : public KnotHolderEntity { +public: + virtual Geom::Point knot_get() const; + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state); +}; + void StarKnotHolderEntity1::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, unsigned int state) { @@ -1128,6 +1134,17 @@ StarKnotHolderEntity2::knot_set(Geom::Point const &p, Geom::Point const &/*origi } } +void +StarKnotHolderEntityCenter::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, unsigned int state) +{ + SPStar *star = dynamic_cast(item); + g_assert(star != NULL); + + star->center = snap_knot_position(p, state); + + item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); +} + Geom::Point StarKnotHolderEntity1::knot_get() const { @@ -1151,6 +1168,17 @@ StarKnotHolderEntity2::knot_get() const return sp_star_get_xy(star, SP_STAR_POINT_KNOT2, 0); } +Geom::Point +StarKnotHolderEntityCenter::knot_get() const +{ + g_assert(item != NULL); + + SPStar const *star = dynamic_cast(item); + g_assert(star != NULL); + + return star->center; +} + static void sp_star_knot_click(SPItem *item, unsigned int state) { @@ -1202,6 +1230,12 @@ StarKnotHolder::StarKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderRel entity.push_back(entity2); } + StarKnotHolderEntityCenter *entity_center = new StarKnotHolderEntityCenter(); + entity_center->create(desktop, item, this, Inkscape::CTRL_TYPE_POINT, + _("Move the star"), + SP_KNOT_SHAPE_CROSS); + entity.push_back(entity_center); + add_pattern_knotholder(); } -- cgit v1.2.3 From 561ec7df77bc2e499dc525d987a8be4552e9ea41 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Fri, 5 May 2017 16:41:34 +0200 Subject: Improve responsive from LPE Fixed bugs: - https://launchpad.net/bugs/1688168 (bzr r15662) --- src/ui/dialog/livepatheffect-editor.cpp | 15 ++++++++++++++- src/ui/dialog/livepatheffect-editor.h | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index 45fde9096..82c5a075f 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -53,12 +53,16 @@ void lpeeditor_selection_changed (Inkscape::Selection * selection, gpointer data { LivePathEffectEditor *lpeeditor = static_cast(data); lpeeditor->lpe_list_locked = false; + lpeeditor->lpe_changed = true; lpeeditor->onSelectionChanged(selection); } void lpeeditor_selection_modified (Inkscape::Selection * selection, guint /*flags*/, gpointer data) { - lpeeditor_selection_changed (selection, data); + + LivePathEffectEditor *lpeeditor = static_cast(data); + lpeeditor->lpe_list_locked = false; + lpeeditor->onSelectionChanged(selection); } static void lpe_style_button(Gtk::Button& btn, char const* iconName) @@ -81,6 +85,7 @@ LivePathEffectEditor::LivePathEffectEditor() : UI::Widget::Panel("", "/dialogs/livepatheffect", SP_VERB_DIALOG_LIVE_PATH_EFFECT), deskTrack(), lpe_list_locked(false), + lpe_changed(true), effectwidget(NULL), status_label("", Gtk::ALIGN_CENTER), effectcontrol_frame(""), @@ -191,6 +196,11 @@ LivePathEffectEditor::~LivePathEffectEditor() void LivePathEffectEditor::showParams(LivePathEffect::Effect& effect) { + if (!effect.upd_params && !lpe_changed) { + lpe_changed = false; + return; + } + std::cout << "trialara\n"; if (effectwidget) { effectcontrol_vbox.remove(*effectwidget); delete effectwidget; @@ -209,6 +219,8 @@ LivePathEffectEditor::showParams(LivePathEffect::Effect& effect) effectcontrol_frame.show(); effectcontrol_vbox.show_all_children(); // fixme: add resizing of dialog + effect.upd_params = false; + lpe_changed = false; } void @@ -540,6 +552,7 @@ void LivePathEffectEditor::on_effect_selection_changed() current_lperef = lperef; LivePathEffect::Effect * effect = lperef->lpeobject->get_lpe(); if (effect) { + lpe_changed = true; showParams(*effect); } } diff --git a/src/ui/dialog/livepatheffect-editor.h b/src/ui/dialog/livepatheffect-editor.h index b18d434c5..7f6f56fd2 100644 --- a/src/ui/dialog/livepatheffect-editor.h +++ b/src/ui/dialog/livepatheffect-editor.h @@ -96,7 +96,7 @@ private: }; bool lpe_list_locked; - + bool lpe_changed; //Inkscape::UI::Widget::ComboBoxEnum combo_effecttype; Gtk::Widget * effectwidget; -- cgit v1.2.3