diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2017-05-05 14:45:16 +0000 |
|---|---|---|
| committer | jabiertxof <info@marker.es> | 2017-05-05 14:45:16 +0000 |
| commit | 89ecd445f13b21093aef1ac00c1ecbc1b9f33697 (patch) | |
| tree | 561f8b478eded4d89477290ff6b8a4f4015c4807 /src/ui | |
| parent | Remove couts (diff) | |
| parent | Improve responsive from LPE (diff) | |
| download | inkscape-89ecd445f13b21093aef1ac00c1ecbc1b9f33697.tar.gz inkscape-89ecd445f13b21093aef1ac00c1ecbc1b9f33697.zip | |
Update to trunk
(bzr r15620.1.17)
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/dialog/livepatheffect-editor.cpp | 15 | ||||
| -rw-r--r-- | src/ui/dialog/livepatheffect-editor.h | 2 | ||||
| -rw-r--r-- | src/ui/object-edit.cpp | 34 | ||||
| -rw-r--r-- | src/ui/tools/calligraphic-tool.cpp | 3 | ||||
| -rw-r--r-- | src/ui/tools/freehand-base.cpp | 8 |
5 files changed, 58 insertions, 4 deletions
diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index 916c61488..bb9b61504 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<LivePathEffectEditor *>(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<LivePathEffectEditor *>(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,8 +196,13 @@ LivePathEffectEditor::~LivePathEffectEditor() void LivePathEffectEditor::showParams(LivePathEffect::Effect& effect) { + if (!effect.upd_params && !lpe_changed) { + lpe_changed = false; + return; + } bool expanderopen = false; Gtk::Widget * defaultswidget = effect.defaultParamSet(); + if (effectwidget) { if (defaultswidget) { Gtk::Expander * expander = NULL; @@ -228,6 +238,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 @@ -559,6 +571,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<LivePathEffect::EffectType> combo_effecttype; Gtk::Widget * effectwidget; 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<SPStar *>(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<SPStar const *>(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(); } 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, |
