summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2017-04-26 19:00:04 +0000
committerjabiertxof <info@marker.es>2017-04-26 19:00:04 +0000
commitabda18047008ae28d9711729521fef7bbff8a241 (patch)
tree8cab4b4d53db4a3ac884fea3400743f992a61dc9
parentUpdate to trunk (diff)
downloadinkscape-abda18047008ae28d9711729521fef7bbff8a241.tar.gz
inkscape-abda18047008ae28d9711729521fef7bbff8a241.zip
Start adding GUI to prefs
(bzr r15620.1.3)
-rw-r--r--src/live_effects/effect.h3
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp40
-rw-r--r--src/ui/dialog/inkscape-preferences.h2
3 files changed, 42 insertions, 3 deletions
diff --git a/src/live_effects/effect.h b/src/live_effects/effect.h
index c509db387..d7f9ab2e7 100644
--- a/src/live_effects/effect.h
+++ b/src/live_effects/effect.h
@@ -136,7 +136,8 @@ public:
bool upd_params;
BoolParam is_visible;
SPCurve * sp_curve;
-
+ std::vector<Parameter *> getParamVector() { return param_vector; }
+
Geom::PathVector pathvector_before_effect;
protected:
Effect(LivePathEffectObject *lpeobject);
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp
index 646439613..2f962a7ac 100644
--- a/src/ui/dialog/inkscape-preferences.cpp
+++ b/src/ui/dialog/inkscape-preferences.cpp
@@ -27,7 +27,10 @@
#include "preferences.h"
#include "verbs.h"
#include "selcue.h"
-
+#include "live_effects/effect-enum.h"
+#include "live_effects/effect.h"
+#include "live_effects/lpeobject.h"
+#include "sp-defs.h"
#include "extension/internal/gdkpixbuf-input.h"
#include "message-stack.h"
#include "style.h"
@@ -820,6 +823,39 @@ void InkscapePreferences::initPageUI()
this->AddPage(_page_grids, _("Grids"), iter_ui, PREFS_PAGE_UI_GRIDS);
initKeyboardShortcuts(iter_ui);
+
+ _page_le.add_group_header( _("Live Effects"));
+ SPDocument * doc = SP_ACTIVE_DOCUMENT;
+ Inkscape::XML::Document *xml_doc = doc->getReprDoc();
+ Inkscape::XML::Node *lpe_repr = xml_doc->createElement("inkscape:path-effect");
+ lpe_repr->setAttribute("id", "deleteme");
+ SPObject *lpeo = SP_OBJECT(doc->getDefs()->appendChildRepr(lpe_repr));
+ Inkscape::GC::release(lpe_repr);
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ for ( int le = Inkscape::LivePathEffect::EffectType::BEND_PATH; le != Inkscape::LivePathEffect::EffectType::INVALID_LPE; le++ ){
+ Inkscape::LivePathEffect::EffectType lpenr = static_cast<Inkscape::LivePathEffect::EffectType>(le);
+ Glib::ustring effectname = (Glib::ustring)Inkscape::LivePathEffect::LPETypeConverter.get_label(lpenr);
+ Glib::ustring effectkey = (Glib::ustring)Inkscape::LivePathEffect::LPETypeConverter.get_key(lpenr);
+ bool is_text_label_lpe = effectkey == (Glib::ustring)"text_label";
+ if (!effectname.empty() && !is_text_label_lpe){
+ lpeo->setAttribute("effect", effectkey.c_str());
+ LivePathEffectObject * lpeobj = dynamic_cast<LivePathEffectObject *>(lpeo);
+ Glib::ustring liveeffect = effectname +(Glib::ustring)_(":");
+ _page_le.add_group_header(liveeffect.c_str());
+ Inkscape::LivePathEffect::Effect* effect = Inkscape::LivePathEffect::Effect::New(lpenr, lpeobj);
+ std::vector<Inkscape::LivePathEffect::Parameter *> param_vector = effect->getParamVector();
+ std::vector<Inkscape::LivePathEffect::Parameter *>::iterator it = param_vector.begin();
+ while (it != param_vector.end()) {
+ Inkscape::LivePathEffect::Parameter * param = *it;
+ const gchar * key = param->param_key.c_str();
+ const gchar * value = param->param_label.c_str();
+ _page_le.add_group_header(value);
+ ++it;
+ }
+ }
+ }
+ lpeo->deleteObject();
+ this->AddPage(_page_le, _("Live Effects"), iter_ui, PREFS_PAGE_UI_LE);
}
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
@@ -2042,7 +2078,7 @@ bool InkscapePreferences::PresentPage(const Gtk::TreeModel::iterator& iter)
_page_list.expand_row(_path_tools, false);
if (desired_page >= PREFS_PAGE_TOOLS_SHAPES && desired_page <= PREFS_PAGE_TOOLS_SHAPES_SPIRAL)
_page_list.expand_row(_path_shapes, false);
- if (desired_page >= PREFS_PAGE_UI && desired_page <= PREFS_PAGE_UI_KEYBOARD_SHORTCUTS)
+ if (desired_page >= PREFS_PAGE_UI && desired_page <= PREFS_PAGE_UI_LE)
_page_list.expand_row(_path_ui, false);
if (desired_page >= PREFS_PAGE_BEHAVIOR && desired_page <= PREFS_PAGE_BEHAVIOR_MASKS)
_page_list.expand_row(_path_behavior, false);
diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h
index e6ba4e4b2..2e42252d9 100644
--- a/src/ui/dialog/inkscape-preferences.h
+++ b/src/ui/dialog/inkscape-preferences.h
@@ -73,6 +73,7 @@ enum {
PREFS_PAGE_UI_WINDOWS,
PREFS_PAGE_UI_GRIDS,
PREFS_PAGE_UI_KEYBOARD_SHORTCUTS,
+ PREFS_PAGE_UI_LE,
PREFS_PAGE_BEHAVIOR,
PREFS_PAGE_BEHAVIOR_SELECTING,
PREFS_PAGE_BEHAVIOR_TRANSFORMS,
@@ -187,6 +188,7 @@ protected:
UI::Widget::DialogPage _page_spellcheck;
UI::Widget::DialogPage _page_keyshortcuts;
+ UI::Widget::DialogPage _page_le;
UI::Widget::PrefSpinButton _mouse_sens;
UI::Widget::PrefSpinButton _mouse_thres;