From ba53ac1874168fcf6ac849071b7dd5467190e65f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Krzysztof=20Kosi=C5=84ski?= Date: Sun, 31 Jan 2010 20:31:21 +0100 Subject: [PATCH] Add pref settings that control updating the display of paths when dragging or transforming nodes them. --- src/preferences-skeleton.h | 2 +- src/ui/dialog/inkscape-preferences.cpp | 4 ++++ src/ui/dialog/inkscape-preferences.h | 2 ++ src/ui/tool/multi-path-manipulator.cpp | 22 ++++++++++++++++++++++ src/ui/tool/multi-path-manipulator.h | 4 ++++ src/ui/tool/node-tool.cpp | 8 ++++++++ src/ui/tool/node-tool.h | 2 ++ src/ui/tool/path-manipulator.cpp | 26 ++++++++++++++++++++++++-- src/ui/tool/path-manipulator.h | 4 ++++ 9 files changed, 71 insertions(+), 3 deletions(-) diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h index e73c17535..297d19c10 100644 --- a/src/preferences-skeleton.h +++ b/src/preferences-skeleton.h @@ -113,7 +113,7 @@ static char const preferences_skeleton[] = " font_sample=\"AaBbCcIiPpQq12369$\342\202\254\302\242?.;/()\"\n" " show_sample_in_list=\"1\"\n" " style=\"fill:black;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;font-style:normal;font-weight:normal;font-size:40px;\" selcue=\"1\"/>\n" -" \n" +" \n" " \n" " \n" " \n" diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 2e4a72f66..961c7dff7 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -438,6 +438,10 @@ void InkscapePreferences::initPageTools() _page_node.add_line( false, "", _t_node_pathoutline_color, "", _("Selects the color used for showing the path outline."), false); _t_node_show_outline.init(_("Always show outline"), "/tools/nodes/show_outline", false); _page_node.add_line( true, "", _t_node_show_outline, "", _("Show outlines for all paths, not only invisible paths")); + _t_node_live_outline.init(_("Update outline when dragging nodes"), "/tools/nodes/live_outline", false); + _page_node.add_line( true, "", _t_node_live_outline, "", _("Update the outline when dragging or transforming nodes. If this is off, the outline will only update when completing a drag.")); + _t_node_live_objects.init(_("Update paths when dragging nodes"), "/tools/nodes/live_objects", false); + _page_node.add_line( true, "", _t_node_live_objects, "", _("Update pahs when dragging or transforming nodes. If this is off, paths will only be updated when completing a drag.")); _t_node_show_path_direction.init(_("Show path direction on outlines"), "/tools/nodes/show_path_direction", false); _page_node.add_line( true, "", _t_node_show_path_direction, "", _("Visualize the direction of selected paths by drawing small arrows in the middle of each outline segment")); _t_node_pathflash_enabled.init ( _("Show temporary path outline"), "/tools/nodes/pathflash_enabled", false); diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index 46542b0e1..49c847287 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -142,6 +142,8 @@ protected: _t_sel_cue_box, _t_bbox_visual, _t_bbox_geometric; PrefCheckButton _t_cvg_keep_objects, _t_cvg_convert_whole_groups; PrefCheckButton _t_node_show_outline; + PrefCheckButton _t_node_live_outline; + PrefCheckButton _t_node_live_objects; PrefCheckButton _t_node_pathflash_enabled; PrefCheckButton _t_node_pathflash_selected; PrefSpinButton _t_node_pathflash_timeout; diff --git a/src/ui/tool/multi-path-manipulator.cpp b/src/ui/tool/multi-path-manipulator.cpp index d1138abd5..734ddf15b 100644 --- a/src/ui/tool/multi-path-manipulator.cpp +++ b/src/ui/tool/multi-path-manipulator.cpp @@ -174,6 +174,8 @@ void MultiPathManipulator::setItems(std::set const &s) // always show outlines for clips and masks newpm->showOutline(_show_outline || r.role != SHAPE_ROLE_NORMAL); newpm->showPathDirection(_show_path_direction); + newpm->setLiveOutline(_live_outline); + newpm->setLiveObjects(_live_objects); _mmap.insert(std::make_pair(r, newpm)); } } @@ -394,6 +396,26 @@ void MultiPathManipulator::showPathDirection(bool show) _show_path_direction = show; } +/** @brief Set live outline update status + * When set to true, outline will be updated continuously when dragging + * or transforming nodes. Otherwise it will only update when changes are committed + * to XML. */ +void MultiPathManipulator::setLiveOutline(bool set) +{ + invokeForAll(&PathManipulator::setLiveOutline, set); + _live_outline = set; +} + +/** @brief Set live object update status + * When set to true, objects will be updated continuously when dragging + * or transforming nodes. Otherwise they will only update when changes are committed + * to XML. */ +void MultiPathManipulator::setLiveObjects(bool set) +{ + invokeForAll(&PathManipulator::setLiveObjects, set); + _live_objects = set; +} + void MultiPathManipulator::updateOutlineColors() { //for (MapType::iterator i = _mmap.begin(); i != _mmap.end(); ++i) { diff --git a/src/ui/tool/multi-path-manipulator.h b/src/ui/tool/multi-path-manipulator.h index 151e153ec..121818f97 100644 --- a/src/ui/tool/multi-path-manipulator.h +++ b/src/ui/tool/multi-path-manipulator.h @@ -65,6 +65,8 @@ public: void showOutline(bool show); void showHandles(bool show); void showPathDirection(bool show); + void setLiveOutline(bool set); + void setLiveObjects(bool set); void updateOutlineColors(); sigc::signal signal_coords_changed; /// Emitted whenever the coordinates @@ -111,6 +113,8 @@ private: bool _show_handles; bool _show_outline; bool _show_path_direction; + bool _live_outline; + bool _live_objects; friend class PathManipulator; }; diff --git a/src/ui/tool/node-tool.cpp b/src/ui/tool/node-tool.cpp index 08d893855..0c4599e52 100644 --- a/src/ui/tool/node-tool.cpp +++ b/src/ui/tool/node-tool.cpp @@ -286,6 +286,8 @@ void ink_node_tool_setup(SPEventContext *ec) // read prefs before adding items to selection to prevent momentarily showing the outline sp_event_context_read(nt, "show_handles"); sp_event_context_read(nt, "show_outline"); + sp_event_context_read(nt, "live_outline"); + sp_event_context_read(nt, "live_objects"); sp_event_context_read(nt, "show_path_direction"); sp_event_context_read(nt, "show_transform_handles"); sp_event_context_read(nt, "single_node_transform_handles"); @@ -316,6 +318,12 @@ void ink_node_tool_set(SPEventContext *ec, Inkscape::Preferences::Entry *value) } else if (entry_name == "show_outline") { nt->show_outline = value->getBool(); nt->_multipath->showOutline(nt->show_outline); + } else if (entry_name == "live_outline") { + nt->live_outline = value->getBool(); + nt->_multipath->setLiveOutline(nt->live_outline); + } else if (entry_name == "live_objects") { + nt->live_objects = value->getBool(); + nt->_multipath->setLiveObjects(nt->live_objects); } else if (entry_name == "show_path_direction") { nt->show_path_direction = value->getBool(); nt->_multipath->showPathDirection(nt->show_path_direction); diff --git a/src/ui/tool/node-tool.h b/src/ui/tool/node-tool.h index 65b16ff72..130e16198 100644 --- a/src/ui/tool/node-tool.h +++ b/src/ui/tool/node-tool.h @@ -58,6 +58,8 @@ struct InkNodeTool : public SPEventContext unsigned cursor_drag : 1; unsigned show_outline : 1; + unsigned live_outline : 1; + unsigned live_objects : 1; unsigned show_path_direction : 1; unsigned show_transform_handles : 1; unsigned single_node_transform_handles : 1; diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 2d4df86f3..0ce02aa95 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -98,6 +98,9 @@ PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path, , _num_selected(0) , _show_handles(true) , _show_outline(false) + , _show_path_direction(false) + , _live_outline(true) + , _live_objects(true) , _lpe_key(lpe_key) { if (_lpe_key.empty()) { @@ -190,6 +193,13 @@ void PathManipulator::writeXML() _path = 0; } _observer->unblock(); + + if (!empty()) { + if (!_live_outline) + _updateOutline(); + if (!_live_objects) + _setGeometry(); + } } /** Remove all nodes from the path. */ @@ -754,6 +764,16 @@ void PathManipulator::showPathDirection(bool show) _updateOutline(); } +void PathManipulator::setLiveOutline(bool set) +{ + _live_outline = set; +} + +void PathManipulator::setLiveObjects(bool set) +{ + _live_objects = set; +} + void PathManipulator::setControlsTransform(Geom::Matrix const &tnew) { Geom::Matrix delta = _i2d_transform.inverse() * _edit_transform.inverse() * tnew * _i2d_transform; @@ -1016,8 +1036,10 @@ void PathManipulator::_createGeometryFromControlPoints() } builder.finish(); _spcurve->set_pathvector(builder.peek() * (_edit_transform * _i2d_transform).inverse()); - _updateOutline(); - _setGeometry(); + if (_live_outline) + _updateOutline(); + if (_live_objects) + _setGeometry(); } /** Build one segment of the geometric representation. diff --git a/src/ui/tool/path-manipulator.h b/src/ui/tool/path-manipulator.h index 4c7313a5f..6b69e226a 100644 --- a/src/ui/tool/path-manipulator.h +++ b/src/ui/tool/path-manipulator.h @@ -79,6 +79,8 @@ public: void showOutline(bool show); void showHandles(bool show); void showPathDirection(bool show); + void setLiveOutline(bool set); + void setLiveObjects(bool set); void setControlsTransform(Geom::Matrix const &); void hideDragPoint(); @@ -130,6 +132,8 @@ private: bool _show_handles; bool _show_outline; bool _show_path_direction; + bool _live_outline; + bool _live_objects; Glib::ustring _lpe_key; friend class PathManipulatorObserver; -- 2.30.2