diff options
| author | Ted Gould <ted@gould.cx> | 2008-10-27 18:03:09 +0000 |
|---|---|---|
| committer | Ted Gould <ted@canonical.com> | 2008-10-27 18:03:09 +0000 |
| commit | 7dbe11bc23efa5f51a9b84e7d0f6dd16e63e0902 (patch) | |
| tree | 7d3a2b95b84a03a19cb132cdf88bea0ab6dc4773 /src/ui | |
| parent | Merging from trunk (diff) | |
| download | inkscape-7dbe11bc23efa5f51a9b84e7d0f6dd16e63e0902.tar.gz inkscape-7dbe11bc23efa5f51a9b84e7d0f6dd16e63e0902.zip | |
From trunk
(bzr r6885)
Diffstat (limited to 'src/ui')
77 files changed, 1215 insertions, 1111 deletions
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 09521008b..e76af958f 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -863,7 +863,7 @@ bool ClipboardManagerImpl::_pasteImage() strftime(image_filename, 128, "inkscape_pasted_image_%Y%m%d_%H%M%S.png", localtime( &rawtime )); /// @todo Check whether the encoding is correct here Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - std::string save_folder = Glib::filename_from_utf8(prefs->getString("dialogs.save_as", "path")); + std::string save_folder = Glib::filename_from_utf8(prefs->getString("/dialogs/save_as/path")); gchar *image_path = g_build_filename(save_folder.data(), image_filename, NULL); img->save(image_path, "png"); diff --git a/src/ui/context-menu.cpp b/src/ui/context-menu.cpp index aa93ffed9..98ad9dc7b 100644 --- a/src/ui/context-menu.cpp +++ b/src/ui/context-menu.cpp @@ -50,11 +50,13 @@ sp_object_menu(SPObject *object, SPDesktop *desktop, GtkMenu *menu) #include "document.h" #include "desktop-handles.h" #include "selection.h" - +#include "selection-chemistry.h" #include "dialogs/item-properties.h" #include "dialogs/object-attributes.h" #include "sp-path.h" +#include "sp-clippath.h" +#include "sp-mask.h" static void sp_item_menu(SPObject *object, SPDesktop *desktop, GtkMenu *menu); @@ -85,7 +87,10 @@ sp_object_type_menu(GType type, SPObject *object, SPDesktop *desktop, GtkMenu *m static void sp_item_properties(GtkMenuItem *menuitem, SPItem *item); static void sp_item_select_this(GtkMenuItem *menuitem, SPItem *item); static void sp_item_create_link(GtkMenuItem *menuitem, SPItem *item); - +static void sp_set_mask(GtkMenuItem *menuitem, SPItem *item); +static void sp_release_mask(GtkMenuItem *menuitem, SPItem *item); +static void sp_set_clip(GtkMenuItem *menuitem, SPItem *item); +static void sp_release_clip(GtkMenuItem *menuitem, SPItem *item); /* Generate context menu item section */ static void @@ -123,6 +128,51 @@ sp_item_menu(SPObject *object, SPDesktop *desktop, GtkMenu *m) gtk_widget_set_sensitive(w, !SP_IS_ANCHOR(item)); gtk_widget_show(w); gtk_menu_append(GTK_MENU(m), w); + /* Set mask */ + w = gtk_menu_item_new_with_mnemonic(_("Set Mask")); + gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop); + gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_set_mask), item); + if ((item && item->mask_ref && item->mask_ref->getObject()) || (item->clip_ref && item->clip_ref->getObject())) { + gtk_widget_set_sensitive(w, FALSE); + } else { + gtk_widget_set_sensitive(w, TRUE); + } + gtk_widget_show(w); + gtk_menu_append(GTK_MENU(m), w); + /* Release mask */ + w = gtk_menu_item_new_with_mnemonic(_("Release Mask")); + gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop); + gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_release_mask), item); + if (item && item->mask_ref && item->mask_ref->getObject()) { + gtk_widget_set_sensitive(w, TRUE); + } else { + gtk_widget_set_sensitive(w, FALSE); + } + gtk_widget_show(w); + gtk_menu_append(GTK_MENU(m), w); + /* Set Clip */ + w = gtk_menu_item_new_with_mnemonic(_("Set Clip")); + gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop); + gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_set_clip), item); + if ((item && item->mask_ref && item->mask_ref->getObject()) || (item->clip_ref && item->clip_ref->getObject())) { + gtk_widget_set_sensitive(w, FALSE); + } else { + gtk_widget_set_sensitive(w, TRUE); + } + gtk_widget_show(w); + gtk_menu_append(GTK_MENU(m), w); + /* Release Clip */ + w = gtk_menu_item_new_with_mnemonic(_("Release Clip")); + gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop); + gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_release_clip), item); + if (item && item->clip_ref && item->clip_ref->getObject()) { + gtk_widget_set_sensitive(w, TRUE); + } else { + gtk_widget_set_sensitive(w, FALSE); + } + gtk_widget_show(w); + gtk_menu_append(GTK_MENU(m), w); + } static void @@ -140,6 +190,63 @@ sp_item_properties(GtkMenuItem *menuitem, SPItem *item) sp_item_dialog(); } + +static void +sp_set_mask(GtkMenuItem *menuitem, SPItem *item) +{ + SPDesktop *desktop; + + g_assert(SP_IS_ITEM(item)); + + desktop = (SPDesktop*)gtk_object_get_data(GTK_OBJECT(menuitem), "desktop"); + g_return_if_fail(desktop != NULL); + + sp_selection_set_mask(desktop, false, false); +} + + +static void +sp_release_mask(GtkMenuItem *menuitem, SPItem *item) +{ + SPDesktop *desktop; + + g_assert(SP_IS_ITEM(item)); + + desktop = (SPDesktop*)gtk_object_get_data(GTK_OBJECT(menuitem), "desktop"); + g_return_if_fail(desktop != NULL); + + sp_selection_unset_mask(desktop, false); +} + + +static void +sp_set_clip(GtkMenuItem *menuitem, SPItem *item) +{ + SPDesktop *desktop; + + g_assert(SP_IS_ITEM(item)); + + desktop = (SPDesktop*)gtk_object_get_data(GTK_OBJECT(menuitem), "desktop"); + g_return_if_fail(desktop != NULL); + + sp_selection_set_mask(desktop, true, false); +} + + +static void +sp_release_clip(GtkMenuItem *menuitem, SPItem *item) +{ + SPDesktop *desktop; + + g_assert(SP_IS_ITEM(item)); + + desktop = (SPDesktop*)gtk_object_get_data(GTK_OBJECT(menuitem), "desktop"); + g_return_if_fail(desktop != NULL); + + sp_selection_unset_mask(desktop, true); +} + + static void sp_item_select_this(GtkMenuItem *menuitem, SPItem *item) { @@ -322,12 +429,12 @@ sp_image_image_properties(GtkMenuItem */*menuitem*/, SPAnchor *anchor) static gchar* getImageEditorName() { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); gchar* value = 0; - Glib::ustring choices = prefs->getString("options.bitmapeditor", "choices"); + Glib::ustring choices = prefs->getString("/options/bitmapeditor/choices"); if (!choices.empty()) { gchar** splits = g_strsplit(choices.data(), ",", 0); gint numIems = g_strv_length(splits); - int setting = prefs->getIntLimited("options.bitmapeditor", "value", 0, 0, numIems); + int setting = prefs->getIntLimited("/options/bitmapeditor/value", 0, 0, numIems); value = g_strdup(splits[setting]); g_strfreev(splits); diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp index 9a17ed20c..261a586b4 100644 --- a/src/ui/dialog/aboutbox.cpp +++ b/src/ui/dialog/aboutbox.cpp @@ -1,7 +1,7 @@ -/** - * \brief AboutBox - the Inkscape about dialog - * - * Authors: +/** @file + * @brief Inkscape About box - implementation + */ +/* Authors: * Derek P. Moore <derekm@hackunix.org> * MenTaLguY <mental@rydia.net> * Kees Cook <kees@outflux.net> diff --git a/src/ui/dialog/aboutbox.h b/src/ui/dialog/aboutbox.h index ebd7e0a53..622b1324f 100644 --- a/src/ui/dialog/aboutbox.h +++ b/src/ui/dialog/aboutbox.h @@ -1,10 +1,10 @@ -/** - * \brief About Widget - Adds the "about" doc to the Gnome::UI::About Class +/** @file + * @brief Inkscape About box * * The standard Gnome::UI::About class doesn't include a place to stuff * a renderable View that holds the classic Inkscape "about.svg". - * - * Author: + */ +/* Author: * Kees Cook <kees@outflux.net> * * Copyright (C) 2005 Kees Cook diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index b8b59230a..367a744c7 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -1,7 +1,7 @@ -/** - * \brief Align and Distribute dialog - * - * Authors: +/** @file + * @brief Align and Distribute dialog - implementation + */ +/* Authors: * Bryce W. Harrington <bryce@bryceharrington.org> * Aubanel MONNIER <aubi@libertysurf.fr> * Frank Felfe <innerspace@iname.com> @@ -39,7 +39,7 @@ #include "desktop-handles.h" #include "macros.h" #include "sp-item-transform.h" -#include "prefs-utils.h" +#include "preferences.h" #include "enums.h" #include "sp-text.h" @@ -122,7 +122,8 @@ private : Inkscape::Selection *selection = sp_desktop_selection(desktop); if (!selection) return; - bool sel_as_group = (prefs_get_int_attribute("dialogs.align", "sel-as-groups", 0) != 0); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + bool sel_as_group = prefs->getBool("/dialogs/align/sel-as-groups"); using Inkscape::Util::GSListConstIterator; std::list<SPItem *> selected; @@ -211,8 +212,8 @@ private : // a selected original, they will be unmoved too, possibly contrary to user's // expecation. However this is a minor point compared to making align/distribute always // work as expected, and "unmoved" is the default option anyway. - int saved_compensation = prefs_get_int_attribute("options.clonecompensation", "value", SP_CLONE_COMPENSATION_UNMOVED); - prefs_set_int_attribute("options.clonecompensation", "value", SP_CLONE_COMPENSATION_UNMOVED); + int saved_compensation = prefs->getInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED); + prefs->setInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED); bool changed = false; boost::optional<Geom::Rect> b; @@ -239,7 +240,7 @@ private : } // restore compensation setting - prefs_set_int_attribute("options.clonecompensation", "value", saved_compensation); + prefs->setInt("/options/clonecompensation/value", saved_compensation); if (changed) { sp_document_done ( sp_desktop_document (desktop) , SP_VERB_DIALOG_ALIGN_DISTRIBUTE, @@ -339,8 +340,9 @@ private : std::sort(sorted.begin(), sorted.end()); // see comment in ActionAlign above - int saved_compensation = prefs_get_int_attribute("options.clonecompensation", "value", SP_CLONE_COMPENSATION_UNMOVED); - prefs_set_int_attribute("options.clonecompensation", "value", SP_CLONE_COMPENSATION_UNMOVED); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + int saved_compensation = prefs->getInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED); + prefs->setInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED); unsigned int len = sorted.size(); bool changed = false; @@ -397,7 +399,7 @@ private : } // restore compensation setting - prefs_set_int_attribute("options.clonecompensation", "value", saved_compensation); + prefs->setInt("/options/clonecompensation/value", saved_compensation); if (changed) { sp_document_done ( sp_desktop_document (desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, @@ -497,8 +499,9 @@ private : if (!_dialog.getDesktop()) return; // see comment in ActionAlign above - int saved_compensation = prefs_get_int_attribute("options.clonecompensation", "value", SP_CLONE_COMPENSATION_UNMOVED); - prefs_set_int_attribute("options.clonecompensation", "value", SP_CLONE_COMPENSATION_UNMOVED); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + int saved_compensation = prefs->getInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED); + prefs->setInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED); // xGap and yGap are the minimum space required between bounding rectangles. double const xGap = removeOverlapXGap.get_value(); @@ -507,7 +510,7 @@ private : xGap, yGap); // restore compensation setting - prefs_set_int_attribute("options.clonecompensation", "value", saved_compensation); + prefs->setInt("/options/clonecompensation/value", saved_compensation); sp_document_done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Remove overlaps")); @@ -531,13 +534,14 @@ private : if (!_dialog.getDesktop()) return; // see comment in ActionAlign above - int saved_compensation = prefs_get_int_attribute("options.clonecompensation", "value", SP_CLONE_COMPENSATION_UNMOVED); - prefs_set_int_attribute("options.clonecompensation", "value", SP_CLONE_COMPENSATION_UNMOVED); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + int saved_compensation = prefs->getInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED); + prefs->setInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED); graphlayout(sp_desktop_selection(_dialog.getDesktop())->itemList()); // restore compensation setting - prefs_set_int_attribute("options.clonecompensation", "value", saved_compensation); + prefs->setInt("/options/clonecompensation/value", saved_compensation); sp_document_done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Arrange connector network")); @@ -561,13 +565,14 @@ private : if (!_dialog.getDesktop()) return; // see comment in ActionAlign above - int saved_compensation = prefs_get_int_attribute("options.clonecompensation", "value", SP_CLONE_COMPENSATION_UNMOVED); - prefs_set_int_attribute("options.clonecompensation", "value", SP_CLONE_COMPENSATION_UNMOVED); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + int saved_compensation = prefs->getInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED); + prefs->setInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED); unclump ((GSList *) sp_desktop_selection(_dialog.getDesktop())->itemList()); // restore compensation setting - prefs_set_int_attribute("options.clonecompensation", "value", saved_compensation); + prefs->setInt("/options/clonecompensation/value", saved_compensation); sp_document_done (sp_desktop_document (_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Unclump")); @@ -615,8 +620,9 @@ private : } // see comment in ActionAlign above - int saved_compensation = prefs_get_int_attribute("options.clonecompensation", "value", SP_CLONE_COMPENSATION_UNMOVED); - prefs_set_int_attribute("options.clonecompensation", "value", SP_CLONE_COMPENSATION_UNMOVED); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + int saved_compensation = prefs->getInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED); + prefs->setInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED); for (std::list<SPItem *>::iterator it(selected.begin()); it != selected.end(); @@ -631,13 +637,13 @@ private : double y = _dialog.randomize_bbox->min()[Geom::Y] + (*item_box)[Geom::Y].extent()/2 + g_random_double_range (0, (*_dialog.randomize_bbox)[Geom::Y].extent() - (*item_box)[Geom::Y].extent()); // displacement is the new center minus old: - NR::Point t = NR::Point (x, y) - 0.5*(item_box->max() + item_box->min()); + Geom::Point t = Geom::Point (x, y) - 0.5*(item_box->max() + item_box->min()); sp_item_move_rel(*it, Geom::Translate(t)); } } // restore compensation setting - prefs_set_int_attribute("options.clonecompensation", "value", saved_compensation); + prefs->setInt("/options/clonecompensation/value", saved_compensation); sp_document_done (sp_desktop_document (desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Randomize positions")); @@ -783,7 +789,7 @@ void on_selection_changed(Inkscape::Application */*inkscape*/, Inkscape::Selecti AlignAndDistribute::AlignAndDistribute() - : UI::Widget::Panel ("", "dialogs.align", SP_VERB_DIALOG_ALIGN_DISTRIBUTE), + : UI::Widget::Panel ("", "/dialogs/align", SP_VERB_DIALOG_ALIGN_DISTRIBUTE), randomize_bbox(), _alignFrame(_("Align")), _distributeFrame(_("Distribute")), @@ -798,6 +804,7 @@ AlignAndDistribute::AlignAndDistribute() _anchorLabel(_("Relative to: ")), _selgrpLabel(_("Treat selection as group: ")) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); //Instanciate the align buttons addAlignButton("al_left_out", @@ -917,7 +924,7 @@ AlignAndDistribute::AlignAndDistribute() _combo.append_text(_("Drawing")); _combo.append_text(_("Selection")); - _combo.set_active(prefs_get_int_attribute("dialogs.align", "align-to", 6)); + _combo.set_active(prefs->getInt("/dialogs/align/align-to", 6)); _combo.signal_changed().connect(sigc::mem_fun(*this, &AlignAndDistribute::on_ref_change)); _anchorBox.pack_start(_anchorLabel); @@ -925,7 +932,7 @@ AlignAndDistribute::AlignAndDistribute() _selgrpBox.pack_start(_selgrpLabel); _selgrpBox.pack_start(_selgrp); - _selgrp.set_active(prefs_get_int_attribute("dialogs.align", "sel-as-groups", 0)); + _selgrp.set_active(prefs->getBool("/dialogs/align/sel-as-groups")); _selgrp.signal_toggled().connect(sigc::mem_fun(*this, &AlignAndDistribute::on_selgrp_toggled)); _alignBox.pack_start(_anchorBox); @@ -972,15 +979,15 @@ AlignAndDistribute::~AlignAndDistribute() } void AlignAndDistribute::on_ref_change(){ - - prefs_set_int_attribute("dialogs.align", "align-to", _combo.get_active_row_number()); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setInt("/dialogs/align/align-to", _combo.get_active_row_number()); //Make blink the master } void AlignAndDistribute::on_selgrp_toggled(){ - - prefs_set_int_attribute("dialogs.align", "sel-as-groups", _selgrp.get_active()); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setInt("/dialogs/align/sel-as-groups", _selgrp.get_active()); //Make blink the master } diff --git a/src/ui/dialog/align-and-distribute.h b/src/ui/dialog/align-and-distribute.h index e2bb68fe5..3d6b5984e 100644 --- a/src/ui/dialog/align-and-distribute.h +++ b/src/ui/dialog/align-and-distribute.h @@ -1,7 +1,7 @@ -/** - * \brief Align and Distribute dialog - * - * Authors: +/** @file + * @brief Align and Distribute dialog + */ +/* Authors: * Bryce W. Harrington <bryce@bryceharrington.org> * Aubanel MONNIER <aubi@libertysurf.fr> * Frank Felfe <innerspace@iname.com> diff --git a/src/ui/dialog/behavior.h b/src/ui/dialog/behavior.h index 4b5fe06b8..fbe42c2fb 100644 --- a/src/ui/dialog/behavior.h +++ b/src/ui/dialog/behavior.h @@ -1,7 +1,7 @@ -/** - * \brief Dialog behavior interface - * - * Author: +/** @file + * @brief Dialog behavior interface + */ +/* Author: * Gustav Broberg <broberg@kth.se> * * Copyright (C) 2007 Authors diff --git a/src/ui/dialog/dialog-manager.cpp b/src/ui/dialog/dialog-manager.cpp index 227814cd1..e73200a1f 100644 --- a/src/ui/dialog/dialog-manager.cpp +++ b/src/ui/dialog/dialog-manager.cpp @@ -45,6 +45,7 @@ #include "ui/dialog/floating-behavior.h" #include "ui/dialog/dock-behavior.h" +#include "preferences.h" namespace Inkscape { namespace UI { @@ -84,7 +85,8 @@ DialogManager::DialogManager() { using namespace Behavior; using namespace Inkscape::UI::Dialogs; // temporary - int dialogs_type = prefs_get_int_attribute_limited ("options.dialogtype", "value", DOCK, 0, 1); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + int dialogs_type = prefs->getIntLimited("/options/dialogtype/value", DOCK, 0, 1); if (dialogs_type == FLOATING) { @@ -150,7 +152,8 @@ DialogManager::~DialogManager() { DialogManager &DialogManager::getInstance() { - int dialogs_type = prefs_get_int_attribute_limited ("options.dialogtype", "value", DOCK, 0, 1); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + int dialogs_type = prefs->getIntLimited("/options/dialogtype/value", DOCK, 0, 1); /* Use singleton behavior for floating dialogs */ if (dialogs_type == FLOATING) { diff --git a/src/ui/dialog/dialog-manager.h b/src/ui/dialog/dialog-manager.h index 80070f19c..a97b58ce3 100644 --- a/src/ui/dialog/dialog-manager.h +++ b/src/ui/dialog/dialog-manager.h @@ -1,8 +1,8 @@ -/** - * \brief Object for managing a set of dialogs, including their signals and +/** @file + * @brief Object for managing a set of dialogs, including their signals and * construction/caching/destruction of them. - * - * Author: + */ +/* Author: * Bryce W. Harrington <bryce@bryceharrington.org> * Jon Phillips <jon@rejon.org> * diff --git a/src/ui/dialog/dialog.cpp b/src/ui/dialog/dialog.cpp index 1361b4977..2b39eb3c9 100644 --- a/src/ui/dialog/dialog.cpp +++ b/src/ui/dialog/dialog.cpp @@ -1,8 +1,7 @@ -/** - * \brief Base class for dialogs in Inkscape. This class provides certain - * common behaviors and styles wanted of all dialogs in the application. - * - * Authors: +/** @file + * @brief Base class for dialogs in Inkscape - implementation + */ +/* Authors: * Bryce W. Harrington <bryce@bryceharrington.org> * buliabyak@gmail.com * Johan Engelen <j.b.c.engelen@ewi.utwente.nl> @@ -30,7 +29,7 @@ #include "dialog-manager.h" #include "modifier-fns.h" #include "shortcuts.h" -#include "prefs-utils.h" +#include "preferences.h" #include "interface.h" #include "verbs.h" @@ -206,10 +205,11 @@ Dialog::read_geometry() { _user_hidden = false; - int x = prefs_get_int_attribute (_prefs_path, "x", -1000); - int y = prefs_get_int_attribute (_prefs_path, "y", -1000); - int w = prefs_get_int_attribute (_prefs_path, "w", 0); - int h = prefs_get_int_attribute (_prefs_path, "h", 0); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + int x = prefs->getInt(_prefs_path + "/x", -1000); + int y = prefs->getInt(_prefs_path + "/y", -1000); + int w = prefs->getInt(_prefs_path + "/w", 0); + int h = prefs->getInt(_prefs_path + "/h", 0); // g_print ("read %d %d %d %d\n", x, y, w, h); @@ -245,10 +245,11 @@ Dialog::save_geometry() if (x<0) x=0; if (y<0) y=0; - prefs_set_int_attribute (_prefs_path, "x", x); - prefs_set_int_attribute (_prefs_path, "y", y); - prefs_set_int_attribute (_prefs_path, "w", w); - prefs_set_int_attribute (_prefs_path, "h", h); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setInt(_prefs_path + "/x", x); + prefs->setInt(_prefs_path + "/y", y); + prefs->setInt(_prefs_path + "/w", w); + prefs->setInt(_prefs_path + "/h", h); } diff --git a/src/ui/dialog/dialog.h b/src/ui/dialog/dialog.h index a1229fb94..1a59a236c 100644 --- a/src/ui/dialog/dialog.h +++ b/src/ui/dialog/dialog.h @@ -1,9 +1,7 @@ -/** - * \brief Base class for dialogs in Inkscape. This class provides certain common behaviors and - * styles wanted of all dialogs in the application. Fundamental parts of the dialog's - * behavior is controlled by a Dialog::Behavior subclass instance connected to the dialog. - * - * Author: +/** @file + * @brief Base class for dialogs in Inkscape + */ +/* Authors: * Bryce W. Harrington <bryce@bryceharrington.org> * Gustav Broberg <broberg@kth.se> * @@ -38,6 +36,12 @@ void sp_retransientize(Inkscape::Application *inkscape, SPDesktop *desktop, gpoi gboolean sp_retransientize_again(gpointer dlgPtr); void sp_dialog_shutdown(GtkObject *object, gpointer dlgPtr); +/** + * @brief Base class for Inkscape dialogs + * This class provides certain common behaviors and styles wanted of all dialogs + * in the application. Fundamental parts of the dialog's behavior are controlled by + * a Dialog::Behavior subclass instance connected to the dialog. + */ class Dialog { public: @@ -83,7 +87,7 @@ public: bool retransientize_suppress; // when true, do not retransientize (prevents races when switching new windows too fast) protected: - const char *_prefs_path; + Glib::ustring const _prefs_path; int _verb_num; Glib::ustring _title; Glib::ustring _apply_label; diff --git a/src/ui/dialog/dock-behavior.cpp b/src/ui/dialog/dock-behavior.cpp index 6f3df89da..6b7a9b697 100644 --- a/src/ui/dialog/dock-behavior.cpp +++ b/src/ui/dialog/dock-behavior.cpp @@ -1,7 +1,7 @@ -/** - * \brief A dockable dialog implementation. - * - * Author: +/** @file + * @brief A dockable dialog implementation. + */ +/* Author: * Gustav Broberg <broberg@kth.se> * * Copyright (C) 2007 Authors @@ -22,7 +22,7 @@ #include "ui/widget/dock.h" #include "verbs.h" #include "dialog.h" -#include "prefs-utils.h" +#include "preferences.h" #include "dialogs/dialog-events.h" #include <gtkmm/invisible.h> @@ -44,7 +44,7 @@ DockBehavior::DockBehavior(Dialog &dialog) : (Inkscape::Verb::get(dialog._verb_num)->get_image() ? Inkscape::Verb::get(dialog._verb_num)->get_image() : ""), static_cast<Widget::DockItem::State>( - prefs_get_int_attribute (_dialog._prefs_path, "state", + Inkscape::Preferences::get()->getInt(_dialog._prefs_path + "/state", UI::Widget::DockItem::DOCKED_STATE))) { // Connect signals @@ -178,7 +178,8 @@ DockBehavior::_onHide() { _dialog.save_geometry(); _dialog._user_hidden = true; - prefs_set_int_attribute (_dialog._prefs_path, "state", _dock_item.getPrevState()); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setInt(_dialog._prefs_path + "/state", _dock_item.getPrevState()); } void @@ -186,7 +187,8 @@ DockBehavior::_onStateChanged(Widget::DockItem::State /*prev_state*/, Widget::DockItem::State new_state) { // TODO probably need to avoid window calls unless the state is different. Check. - prefs_set_int_attribute (_dialog._prefs_path, "state", new_state); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setInt(_dialog._prefs_path + "/state", new_state); if (new_state == Widget::DockItem::FLOATING_STATE) { if (Gtk::Window *floating_win = _dock_item.getWindow()) @@ -210,13 +212,15 @@ DockBehavior::onShowF12() void DockBehavior::onShutdown() { - prefs_set_int_attribute (_dialog._prefs_path, "state", _dock_item.getPrevState()); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setInt(_dialog._prefs_path + "/state", _dock_item.getPrevState()); } void DockBehavior::onDesktopActivated(SPDesktop *desktop) { - gint transient_policy = prefs_get_int_attribute_limited ( "options.transientpolicy", "value", 1, 0, 2); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + gint transient_policy = prefs->getIntLimited( "/options/transientpolicy/value", 1, 0, 2); #ifdef WIN32 // Win32 special code to enable transient dialogs transient_policy = 2; diff --git a/src/ui/dialog/dock-behavior.h b/src/ui/dialog/dock-behavior.h index d873bfb0a..7f0d0ece0 100644 --- a/src/ui/dialog/dock-behavior.h +++ b/src/ui/dialog/dock-behavior.h @@ -1,7 +1,7 @@ -/** - * \brief A dockable dialog implementation. - * - * Author: +/** @file + * @brief A dockable dialog implementation. + */ +/* Author: * Gustav Broberg <broberg@kth.se> * * Copyright (C) 2007 Authors diff --git a/src/ui/dialog/document-metadata.cpp b/src/ui/dialog/document-metadata.cpp index 5956cfb9b..32838309a 100644 --- a/src/ui/dialog/document-metadata.cpp +++ b/src/ui/dialog/document-metadata.cpp @@ -1,8 +1,7 @@ -/** \file - * - * Document metadata dialog, Gtkmm-style - * - * Authors: +/** @file + * @brief Document metadata dialog, Gtkmm-style + */ +/* Authors: * bulia byak <buliabyak@users.sf.net> * Bryce W. Harrington <bryce@bryceharrington.org> * Lauris Kaplinski <lauris@kaplinski.com> @@ -67,9 +66,8 @@ DocumentMetadata::getInstance() DocumentMetadata::DocumentMetadata() - : UI::Widget::Panel ("", "dialogs.documentmetadata", SP_VERB_DIALOG_METADATA), - _page_metadata1(1, 1), _page_metadata2(1, 1), - _prefs_path("dialogs.documentmetadata") + : UI::Widget::Panel ("", "/dialogs/documentmetadata", SP_VERB_DIALOG_METADATA), + _page_metadata1(1, 1), _page_metadata2(1, 1) { hide(); _tt.enable(); @@ -255,9 +253,9 @@ on_repr_attr_changed (Inkscape::XML::Node *, gchar const *, gchar const *, gchar Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/document-metadata.h b/src/ui/dialog/document-metadata.h index 1b5c08ce1..7f718e9f7 100644 --- a/src/ui/dialog/document-metadata.h +++ b/src/ui/dialog/document-metadata.h @@ -1,7 +1,7 @@ /** \file * \brief Document Metadata dialog - * - * Authors: + */ +/* Authors: * Ralf Stephan <ralf@ark.in-berlin.de> * Bryce W. Harrington <bryce@bryceharrington.org> * @@ -62,7 +62,6 @@ protected: RDElist _rdflist; Licensor _licensor; - gchar const *_prefs_path; Registry _wr; private: @@ -80,9 +79,9 @@ private: Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index a2d5b50ed..7c738c503 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -1,8 +1,7 @@ -/** \file - * - * Document properties dialog, Gtkmm-style - * - * Authors: +/** @file + * @brief Document properties dialog, Gtkmm-style + */ +/* Authors: * bulia byak <buliabyak@users.sf.net> * Bryce W. Harrington <bryce@bryceharrington.org> * Lauris Kaplinski <lauris@kaplinski.com> @@ -28,7 +27,7 @@ #include "xml/node-event-vector.h" #include "helper/units.h" -#include "prefs-utils.h" +#include "preferences.h" #include "inkscape.h" #include "verbs.h" @@ -81,7 +80,7 @@ DocumentProperties::getInstance() } DocumentProperties::DocumentProperties() - : UI::Widget::Panel ("", "dialogs.documentoptions", SP_VERB_DIALOG_NAMEDVIEW), + : UI::Widget::Panel ("", "/dialogs/documentoptions", SP_VERB_DIALOG_NAMEDVIEW), _page_page(1, 1, true, true), _page_guides(1, 1), _page_snap(1, 1), _page_snap_dtls(1, 1), //--------------------------------------------------------------- @@ -115,6 +114,7 @@ DocumentProperties::DocumentProperties() //--------------------------------------------------------------- //Applies to both nodes and guides, but not to bboxes, that's why its located here _rcbic( _("Rotation _center"), _("Consider the rotation center of an object when snapping"), "inkscape:snap-center", _wr), + _rcbsm( _("_Smooth nodes"), _("Snap to smooth nodes too, instead of only snapping to cusp nodes"), "inkscape:snap-smooth-nodes", _wr), _rcbsigg(_("_Grid with guides"), _("Snap to grid-guide intersections"), "inkscape:snap-intersection-grid-guide", _wr), _rcbsils(_("_Paths"), _("Snap to intersections of paths ('snap to paths' must be enabled, see the previous tab)"), "inkscape:snap-intersection-paths", _wr), @@ -123,9 +123,8 @@ DocumentProperties::DocumentProperties() //TRANSLATORS: In Grid|_New translate only the word _New. It ref to grid _grids_button_new(Q_("Grid|_New"), _("Create new grid.")), _grids_button_remove(_("_Remove"), _("Remove selected grid.")), - _grids_label_def("", Gtk::ALIGN_LEFT), + _grids_label_def("", Gtk::ALIGN_LEFT) //--------------------------------------------------------------- - _prefs_path("dialogs.documentoptions") { _tt.enable(); _getContents()->set_spacing (4); @@ -376,6 +375,7 @@ DocumentProperties::build_snap_dtls() 0, 0, label_m, 0, 0, &_rcbic, + 0, &_rcbsm }; attach_all(_page_snap_dtls.table(), array, G_N_ELEMENTS(array)); @@ -496,12 +496,13 @@ DocumentProperties::update() //-----------------------------------------------------------snap - _rcbsnbb.setActive (nv->snap_manager.getSnapModeBBox()); - _rcbsnn.setActive (nv->snap_manager.getSnapModeNode()); - _rcbsng.setActive (nv->snap_manager.getSnapModeGuide()); - _rcbic.setActive (nv->snap_manager.getIncludeItemCenter()); - _rcbsigg.setActive (nv->snap_manager.getSnapIntersectionGG()); - _rcbsils.setActive (nv->snap_manager.getSnapIntersectionCS()); + _rcbsnbb.setActive (nv->snap_manager.snapprefs.getSnapModeBBox()); + _rcbsnn.setActive (nv->snap_manager.snapprefs.getSnapModeNode()); + _rcbsng.setActive (nv->snap_manager.snapprefs.getSnapModeGuide()); + _rcbic.setActive (nv->snap_manager.snapprefs.getIncludeItemCenter()); + _rcbsm.setActive (nv->snap_manager.snapprefs.getSnapSmoothNodes()); + _rcbsigg.setActive (nv->snap_manager.snapprefs.getSnapIntersectionGG()); + _rcbsils.setActive (nv->snap_manager.snapprefs.getSnapIntersectionCS()); _rcbsnop.setActive(nv->snap_manager.object.getSnapToItemPath()); _rcbsnon.setActive(nv->snap_manager.object.getSnapToItemNode()); _rcbsnbbp.setActive(nv->snap_manager.object.getSnapToBBoxPath()); @@ -513,7 +514,7 @@ DocumentProperties::update() _rsu_gusn.setValue (nv->guidetolerance); - _rcbs.setActive (nv->snap_manager.getSnapEnabledGlobally()); + _rcbs.setActive (nv->snap_manager.snapprefs.getSnapEnabledGlobally()); _rcbsi.setActive (nv->snapindicator); //-----------------------------------------------------------grids page @@ -666,9 +667,9 @@ DocumentProperties::onRemoveGrid() Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/document-properties.h b/src/ui/dialog/document-properties.h index a8750a32b..ab70b0d07 100644 --- a/src/ui/dialog/document-properties.h +++ b/src/ui/dialog/document-properties.h @@ -1,7 +1,7 @@ /** \file * \brief Document Properties dialog - * - * Authors: + */ +/* Authors: * Ralf Stephan <ralf@ark.in-berlin.de> * Bryce W. Harrington <bryce@bryceharrington.org> * @@ -78,7 +78,7 @@ protected: RegisteredCheckButton _rcbsnon, _rcbsnbbp, _rcbsnbbn, _rcbsnpb; ToleranceSlider _rsu_sno, _rsu_sn, _rsu_gusn; //--------------------------------------------------------------- - RegisteredCheckButton _rcbic; + RegisteredCheckButton _rcbic, _rcbsm; RegisteredCheckButton _rcbsigg, _rcbsils; //--------------------------------------------------------------- Gtk::Notebook _grids_notebook; @@ -91,8 +91,6 @@ protected: Gtk::HBox _grids_space; //--------------------------------------------------------------- - gchar const *_prefs_path; - Gtk::HBox& _createPageTabLabel(const Glib::ustring& label, const char *label_image); private: @@ -114,9 +112,9 @@ private: Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/extension-editor.cpp b/src/ui/dialog/extension-editor.cpp index a92087668..c2f3426fd 100644 --- a/src/ui/dialog/extension-editor.cpp +++ b/src/ui/dialog/extension-editor.cpp @@ -1,7 +1,7 @@ -/** - * \brief Extension editor dialog - * - * Authors: +/** @file + * @brief Extension editor dialog + */ +/* Authors: * Bryce W. Harrington <bryce@bryceharrington.org> * Ted Gould <ted@gould.cx> * @@ -43,7 +43,7 @@ namespace Dialog { a new extension is selected, the notebooks are changed appropriately. */ ExtensionEditor::ExtensionEditor() - : UI::Widget::Panel ("", "dialogs.extensioneditor", SP_VERB_DIALOG_EXTENSIONEDITOR) + : UI::Widget::Panel ("", "/dialogs/extensioneditor", SP_VERB_DIALOG_EXTENSIONEDITOR) { _notebook_info.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); _notebook_help.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); @@ -85,7 +85,7 @@ ExtensionEditor::ExtensionEditor() Inkscape::Extension::db.foreach(dbfunc, this); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - Glib::ustring defaultext = prefs->getString("dialogs.extensioneditor", "selected-extension"); + Glib::ustring defaultext = prefs->getString("/dialogs/extensioneditor/selected-extension"); if (defaultext.empty()) defaultext = "org.inkscape.input.svg"; this->setExtension(defaultext); @@ -137,7 +137,7 @@ ExtensionEditor::on_pagelist_selection_changed (void) /* Set the selection in the preferences */ Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setString("dialogs.extensioneditor", "selected-extension", id); + prefs->setString("/dialogs/extensioneditor/selected-extension", id); /* Adjust the dialog's title */ gchar title[500]; diff --git a/src/ui/dialog/extension-editor.h b/src/ui/dialog/extension-editor.h index cfda36856..fe171f60c 100644 --- a/src/ui/dialog/extension-editor.h +++ b/src/ui/dialog/extension-editor.h @@ -1,7 +1,7 @@ -/** - * \brief Extension editor - * - * Authors: +/** @file + * @brief Extension editor dialog + */ +/* Authors: * Bryce W. Harrington <bryce@bryceharrington.org> * Ted Gould <ted@gould.cx> * diff --git a/src/ui/dialog/filedialog.cpp b/src/ui/dialog/filedialog.cpp index b1ea5dfee..172edf8a5 100644 --- a/src/ui/dialog/filedialog.cpp +++ b/src/ui/dialog/filedialog.cpp @@ -1,7 +1,7 @@ -/** - * Implementation of the file dialog interfaces defined in filedialog.h - * - * Authors: +/** @file + * @brief Implementation of the file dialog interfaces defined in filedialog.h + */ +/* Authors: * Bob Jamison * Joel Holdsworth * Other dudes from The Inkscape Organization @@ -194,4 +194,4 @@ void FileSaveDialog::appendExtension(Glib::ustring& path, Inkscape::Extension::O fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/filedialog.h b/src/ui/dialog/filedialog.h index eda8c4eb4..52dcd1b23 100644 --- a/src/ui/dialog/filedialog.h +++ b/src/ui/dialog/filedialog.h @@ -1,10 +1,7 @@ -#ifndef __FILE_DIALOG_H__ -#define __FILE_DIALOG_H__ -/** - * Defines the FileOpenDialog, FileSaveDialog, and FileExportDialog - * and their supporting classes. - * - * Authors: +/** @file + * @brief Virtual base definitions for native file dialogs + */ +/* Authors: * Bob Jamison <rwjj@earthlink.net> * Joel Holdsworth * Inkscape Guys @@ -16,6 +13,9 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#ifndef __FILE_DIALOG_H__ +#define __FILE_DIALOG_H__ + #include <glibmm.h> #include <vector> #include <set> diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp index 541eb388b..379d43fbf 100644 --- a/src/ui/dialog/filedialogimpl-gtkmm.cpp +++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp @@ -1,7 +1,7 @@ -/** - * Implementation of the file dialog interfaces defined in filedialogimpl.h - * - * Authors: +/** @file + * @brief Implementation of the file dialog interfaces defined in filedialogimpl.h + */ +/* Authors: * Bob Jamison * Joel Holdsworth * Bruno Dilly @@ -24,6 +24,7 @@ #include "interface.h" #include "io/sys.h" #include "path-prefix.h" +#include "preferences.h" #ifdef WITH_GNOME_VFS # include <libgnomevfs/gnome-vfs.h> @@ -570,9 +571,8 @@ SVGPreview::~SVGPreview() void FileDialogBaseGtk::internalSetup() { - bool enablePreview = - (bool)prefs_get_int_attribute( preferenceBase.c_str(), - "enable_preview", 1 ); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + bool enablePreview = prefs->getBool( preferenceBase + "/enable_preview", true); previewCheckbox.set_label( Glib::ustring(_("Enable preview")) ); previewCheckbox.set_active( enablePreview ); @@ -594,9 +594,9 @@ void FileDialogBaseGtk::internalSetup() void FileDialogBaseGtk::cleanup( bool showConfirmed ) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if ( showConfirmed ) - prefs_set_int_attribute( preferenceBase.c_str(), - "enable_preview", previewCheckbox.get_active() ); + prefs->setBool( preferenceBase + "/enable_preview", previewCheckbox.get_active() ); } @@ -643,7 +643,7 @@ FileOpenDialogImplGtk::FileOpenDialogImplGtk(Gtk::Window& parentWindow, const Glib::ustring &dir, FileDialogType fileTypes, const Glib::ustring &title) : - FileDialogBaseGtk(parentWindow, title, Gtk::FILE_CHOOSER_ACTION_OPEN, fileTypes, "dialogs.open") + FileDialogBaseGtk(parentWindow, title, Gtk::FILE_CHOOSER_ACTION_OPEN, fileTypes, "/dialogs/open") { @@ -851,7 +851,7 @@ FileSaveDialogImplGtk::FileSaveDialogImplGtk( Gtk::Window &parentWindow, const Glib::ustring &title, const Glib::ustring &/*default_key*/, const gchar* docTitle) : - FileDialogBaseGtk(parentWindow, title, Gtk::FILE_CHOOSER_ACTION_SAVE, fileTypes, "dialogs.save_as") + FileDialogBaseGtk(parentWindow, title, Gtk::FILE_CHOOSER_ACTION_SAVE, fileTypes, "/dialogs/save_as") { FileSaveDialog::myDocTitle = docTitle; @@ -887,9 +887,9 @@ FileSaveDialogImplGtk::FileSaveDialogImplGtk( Gtk::Window &parentWindow, //createFilterMenu(); //###### Do we want the .xxx extension automatically added? + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); fileTypeCheckbox.set_label(Glib::ustring(_("Append filename extension automatically"))); - fileTypeCheckbox.set_active( (bool)prefs_get_int_attribute("dialogs.save_as", - "append_extension", 1) ); + fileTypeCheckbox.set_active(prefs->getBool("/dialogs/save_as/append_extension", true)); createFileTypeMenu(); fileTypeComboBox.set_size_request(200,40); @@ -1071,27 +1071,23 @@ FileSaveDialogImplGtk::show() set_preview_widget_active(false); hide(); - if (b == Gtk::RESPONSE_OK) - { + if (b == Gtk::RESPONSE_OK) { updateNameAndExtension(); - + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + // Store changes of the "Append filename automatically" checkbox back to preferences. - prefs_set_int_attribute("dialogs.save_as", "append_extension", fileTypeCheckbox.get_active()); + prefs->setBool("/dialogs/save_as/append_extension", fileTypeCheckbox.get_active()); // Store the last used save-as filetype to preferences. - prefs_set_string_attribute("dialogs.save_as", "default", - ( extension != NULL ? extension->get_id() : "" )); + prefs->setString("/dialogs/save_as/default", ( extension != NULL ? extension->get_id() : "" )); cleanup( true ); return TRUE; - } - else - { + } else { cleanup( false ); - return FALSE; - } + } } @@ -1314,7 +1310,7 @@ FileExportDialogImpl::FileExportDialogImpl( Gtk::Window& parentWindow, FileDialogType fileTypes, const Glib::ustring &title, const Glib::ustring &/*default_key*/ ) : - FileDialogBaseGtk(parentWindow, title, Gtk::FILE_CHOOSER_ACTION_SAVE, fileTypes, "dialogs.export"), + FileDialogBaseGtk(parentWindow, title, Gtk::FILE_CHOOSER_ACTION_SAVE, fileTypes, "/dialogs/export"), sourceX0Spinner("X0", _("Left edge of source")), sourceY0Spinner("Y0", _("Top edge of source")), sourceX1Spinner("X1", _("Right edge of source")), @@ -1325,7 +1321,8 @@ FileExportDialogImpl::FileExportDialogImpl( Gtk::Window& parentWindow, destHeightSpinner("Height", _("Destination height")), destDPISpinner("DPI", _("Resolution (dots per inch)")) { - append_extension = (bool)prefs_get_int_attribute("dialogs.save_as", "append_extension", 1); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + append_extension = prefs->getBool("/dialogs/save_as/append_extension", true); /* One file at a time */ set_select_multiple(false); @@ -1534,9 +1531,9 @@ FileExportDialogImpl::show() // FIXME: Why do we have more code append_extension = checkbox.get_active(); - prefs_set_int_attribute("dialogs.save_as", "append_extension", append_extension); - prefs_set_string_attribute("dialogs.save_as", "default", - ( extension != NULL ? extension->get_id() : "" )); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setBool("/dialogs/save_as/append_extension", append_extension); + prefs->setBool("/dialogs/save_as/default", ( extension != NULL ? extension->get_id() : "" )); */ return TRUE; } @@ -1580,4 +1577,4 @@ FileExportDialogImpl::getFilename() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/filedialogimpl-gtkmm.h b/src/ui/dialog/filedialogimpl-gtkmm.h index 5137b8481..1ac259221 100644 --- a/src/ui/dialog/filedialogimpl-gtkmm.h +++ b/src/ui/dialog/filedialogimpl-gtkmm.h @@ -1,9 +1,9 @@ #ifndef __FILE_DIALOGIMPL_H__ #define __FILE_DIALOGIMPL_H__ -/** - * Implementation of the file dialog interfaces defined in filedialogimpl.h - * - * Authors: +/** @file + * @brief Implementation of the file dialog interfaces defined in filedialogimpl.h + */ +/* Authors: * Bob Jamison * Joel Holdsworth * Bruno Dilly @@ -39,18 +39,13 @@ //Another hack #include <gtk/gtkentry.h> #include <gtk/gtkexpander.h> -#ifdef WITH_GNOME_VFS -# include <libgnomevfs/gnome-vfs-init.h> // gnome_vfs_initialized -#endif //Inkscape includes -#include "prefs-utils.h" -#include <extension/input.h> -#include <extension/output.h> -#include <extension/db.h> +#include "extension/input.h" +#include "extension/output.h" +#include "extension/db.h" #include "inkscape.h" #include "svg-view-widget.h" -#include "gc-core.h" //For export dialog #include "ui/widget/scalar-unit.h" @@ -192,7 +187,7 @@ public: protected: void cleanup( bool showConfirmed ); - Glib::ustring preferenceBase; + Glib::ustring const preferenceBase; /** * What type of 'open' are we? (open, import, place, etc) */ @@ -571,9 +566,9 @@ private: }; -} -} -} +} // namespace Dialog +} // namespace UI +} // namespace Inkscape #endif /*__FILE_DIALOGIMPL_H__*/ @@ -586,4 +581,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp index e1479d3b4..77a42df99 100644 --- a/src/ui/dialog/filedialogimpl-win32.cpp +++ b/src/ui/dialog/filedialogimpl-win32.cpp @@ -1,7 +1,7 @@ -/** - * Implementation of the file dialog interfaces defined in filedialog.h for Win32 - * - * Authors: +/** @file + * @brief Implementation of native file dialogs for Win32 + */ +/* Authors: * Joel Holdsworth * The Inkscape Organization * @@ -29,7 +29,6 @@ //Inkscape includes #include "inkscape.h" -#include "prefs-utils.h" #include <dialogs/dialog-events.h> #include <extension/input.h> #include <extension/output.h> @@ -1710,4 +1709,4 @@ UINT_PTR CALLBACK FileSaveDialogImplWin32::GetSaveFileName_hookproc( fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/filedialogimpl-win32.h b/src/ui/dialog/filedialogimpl-win32.h index 3a0c3775b..bb026169a 100644 --- a/src/ui/dialog/filedialogimpl-win32.h +++ b/src/ui/dialog/filedialogimpl-win32.h @@ -1,7 +1,7 @@ -/** - * Implementation of the file dialog interfaces defined in filedialog.h for Win32 - * - * Authors: +/** @file + * @brief Implementation of native file dialogs for Win32 + */ +/* Authors: * Joel Holdsworth * The Inkscape Organization * @@ -367,4 +367,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/fill-and-stroke.cpp b/src/ui/dialog/fill-and-stroke.cpp index 50b2a5c79..a05c20b36 100644 --- a/src/ui/dialog/fill-and-stroke.cpp +++ b/src/ui/dialog/fill-and-stroke.cpp @@ -1,8 +1,9 @@ -/** - * \brief Fill and Stroke dialog, - * based on sp_object_properties_dialog +/** @file + * @brief Fill and Stroke dialog - implementation * - * Authors: + * Based on the old sp_object_properties_dialog. + */ +/* Authors: * Bryce W. Harrington <bryce@bryceharrington.org> * Gustav Broberg <broberg@kth.se> * @@ -11,10 +12,6 @@ * Released under GNU GPL. Read the file 'COPYING' for more information. */ -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - #include "desktop-handles.h" #include "desktop-style.h" #include "document.h" @@ -39,7 +36,7 @@ namespace UI { namespace Dialog { FillAndStroke::FillAndStroke() - : UI::Widget::Panel ("", "dialogs.fillstroke", SP_VERB_DIALOG_FILL_STROKE), + : UI::Widget::Panel ("", "/dialogs/fillstroke", SP_VERB_DIALOG_FILL_STROKE), _page_fill(1, 1, true, true), _page_stroke_paint(1, 1, true, true), _page_stroke_style(1, 1, true, true), diff --git a/src/ui/dialog/fill-and-stroke.h b/src/ui/dialog/fill-and-stroke.h index 37aa4ccc8..7dc892fea 100644 --- a/src/ui/dialog/fill-and-stroke.h +++ b/src/ui/dialog/fill-and-stroke.h @@ -1,8 +1,7 @@ -/** - * \brief Fill and Stroke dialog - * based on sp_object_properties_dialog - * - * Authors: +/** @file + * @brief Fill and Stroke dialog + */ +/* Authors: * Bryce W. Harrington <bryce@bryceharrington.org> * Gustav Broberg <broberg@kth.se> * diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index 06bc0dd73..d31331a0d 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -1,7 +1,7 @@ -/** - * \brief Filter Effects dialog - * - * Authors: +/** @file + * @brief Filter Effects dialog + */ +/* Authors: * Nicholas Bishop <nicholasbishop@gmail.org> * Rodrigo Kumpera <kumpera@gmail.com> * Felipe C. da S. Sanches <felipe.sanches@gmail.com> @@ -663,7 +663,7 @@ private: //# Get the current directory for finding files Inkscape::Preferences *prefs = Inkscape::Preferences::get(); Glib::ustring open_path; - Glib::ustring attr = prefs->getString("dialogs.open", "path"); + Glib::ustring attr = prefs->getString("/dialogs/open/path"); if (!attr.empty()) open_path = attr; @@ -708,7 +708,7 @@ private: open_path = fileName; open_path.append(G_DIR_SEPARATOR_S); - prefs->setString("dialogs.open", "path", open_path); + prefs->setString("/dialogs/open/path", open_path); _entry.set_text(fileName); } @@ -2090,7 +2090,7 @@ int FilterEffectsDialog::PrimitiveList::primitive_count() const /*** FilterEffectsDialog ***/ FilterEffectsDialog::FilterEffectsDialog() - : UI::Widget::Panel("", "dialogs.filtereffects", SP_VERB_DIALOG_FILTER_EFFECTS), + : UI::Widget::Panel("", "/dialogs/filtereffects", SP_VERB_DIALOG_FILTER_EFFECTS), _add_primitive_type(FPConverter), _add_primitive(_("Add Effect:")), _empty_settings(_("No effect selected"), Gtk::ALIGN_LEFT), @@ -2297,7 +2297,7 @@ void FilterEffectsDialog::add_primitive() void FilterEffectsDialog::update_primitive_infobox() { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - if (prefs->getBool("options.showfiltersinfobox", "value", true)){ + if (prefs->getBool("/options/showfiltersinfobox/value", true)){ _infobox_icon.show(); _infobox_desc.show(); } else { @@ -2482,7 +2482,7 @@ void FilterEffectsDialog::update_settings_view() _empty_settings.show(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - if (prefs->getBool("options.showfiltersinfobox", "value", true)){ + if (prefs->getBool("/options/showfiltersinfobox/value", true)){ _infobox_icon.show(); _infobox_desc.show(); } else { diff --git a/src/ui/dialog/filter-effects-dialog.h b/src/ui/dialog/filter-effects-dialog.h index 9e39de2bb..0522b7a99 100644 --- a/src/ui/dialog/filter-effects-dialog.h +++ b/src/ui/dialog/filter-effects-dialog.h @@ -1,7 +1,7 @@ -/** - * \brief Filter Effects dialog - * - * Authors: +/** @file + * @brief Filter Effects dialog + */ +/* Authors: * Nicholas Bishop <nicholasbishop@gmail.com> * Rodrigo Kumpera <kumpera@gmail.com> * diff --git a/src/ui/dialog/find.cpp b/src/ui/dialog/find.cpp index f59f2504c..b86234521 100644 --- a/src/ui/dialog/find.cpp +++ b/src/ui/dialog/find.cpp @@ -22,13 +22,12 @@ #include "helper/window.h" #include "macros.h" #include "inkscape.h" -#include "document.h" #include "desktop.h" +#include "document.h" #include "selection.h" #include "desktop-handles.h" #include "dialogs/dialog-events.h" -#include "prefs-utils.h" #include "verbs.h" #include "interface.h" #include "sp-text.h" @@ -49,7 +48,7 @@ #include "sp-use.h" #include "sp-image.h" #include "sp-offset.h" -#include <xml/repr.h> +#include "xml/repr.h" namespace Inkscape { @@ -57,7 +56,7 @@ namespace UI { namespace Dialog { Find::Find() - : UI::Widget::Panel("", "dialogs.find", SP_VERB_DIALOG_FIND), + : UI::Widget::Panel("", "/dialogs/find", SP_VERB_DIALOG_FIND), _entry_text(_("_Text: "), _("Find objects by their text content (exact or partial match)")), _entry_id(_("_ID: "), _("Find objects by the value of the id attribute (exact or partial match)")), _entry_style(_("_Style: "), _("Find objects by the value of the style attribute (exact or partial match)")), diff --git a/src/ui/dialog/find.h b/src/ui/dialog/find.h index 2d79b37ad..891df221f 100644 --- a/src/ui/dialog/find.h +++ b/src/ui/dialog/find.h @@ -1,7 +1,7 @@ -/** - * \brief Find dialog - * - * Authors: +/** @file + * @brief Find dialog + */ +/* Authors: * Bryce W. Harrington <bryce@bryceharrington.org> * * Copyright (C) 2004, 2005 Authors @@ -18,42 +18,14 @@ #include "ui/widget/button.h" #include "ui/widget/entry.h" #include <gtkmm/separator.h> +#include <glib.h> -#include "message-stack.h" -#include "helper/window.h" -#include "macros.h" -#include "inkscape.h" -#include "document.h" -#include "desktop.h" -#include "selection.h" -#include "desktop-handles.h" - -#include "dialogs/dialog-events.h" -#include "prefs-utils.h" -#include "verbs.h" -#include "interface.h" -#include "sp-text.h" -#include "sp-flowtext.h" -#include "text-editing.h" -#include "sp-tspan.h" -#include "selection-chemistry.h" -#include "sp-defs.h" -#include "sp-rect.h" -#include "sp-ellipse.h" -#include "sp-star.h" -#include "sp-spiral.h" -#include "sp-path.h" -#include "sp-line.h" -#include "sp-polyline.h" -#include "sp-item-group.h" -#include "sp-use.h" -#include "sp-image.h" -#include "sp-offset.h" -#include <xml/repr.h> - -using namespace Inkscape::UI::Widget; +class SPItem; +class SPObject; namespace Inkscape { +class Selection; + namespace UI { namespace Dialog { @@ -66,29 +38,29 @@ public: protected: // Widgets: - Entry _entry_text; - Entry _entry_id; - Entry _entry_style; - Entry _entry_attribute; - - CheckButton _check_search_selection; - CheckButton _check_search_layer; - CheckButton _check_include_hidden; - CheckButton _check_include_locked; + Inkscape::UI::Widget::Entry _entry_text; + Inkscape::UI::Widget::Entry _entry_id; + Inkscape::UI::Widget::Entry _entry_style; + Inkscape::UI::Widget::Entry _entry_attribute; + + Inkscape::UI::Widget::CheckButton _check_search_selection; + Inkscape::UI::Widget::CheckButton _check_search_layer; + Inkscape::UI::Widget::CheckButton _check_include_hidden; + Inkscape::UI::Widget::CheckButton _check_include_locked; // Type checkbutton widgets... - CheckButton _check_all; - CheckButton _check_all_shapes; - CheckButton _check_rects; - CheckButton _check_ellipses; - CheckButton _check_stars; - CheckButton _check_spirals; - CheckButton _check_paths; - CheckButton _check_texts; - CheckButton _check_groups; - CheckButton _check_clones; - CheckButton _check_images; - CheckButton _check_offsets; + Inkscape::UI::Widget::CheckButton _check_all; + Inkscape::UI::Widget::CheckButton _check_all_shapes; + Inkscape::UI::Widget::CheckButton _check_rects; + Inkscape::UI::Widget::CheckButton _check_ellipses; + Inkscape::UI::Widget::CheckButton _check_stars; + Inkscape::UI::Widget::CheckButton _check_spirals; + Inkscape::UI::Widget::CheckButton _check_paths; + Inkscape::UI::Widget::CheckButton _check_texts; + Inkscape::UI::Widget::CheckButton _check_groups; + Inkscape::UI::Widget::CheckButton _check_clones; + Inkscape::UI::Widget::CheckButton _check_images; + Inkscape::UI::Widget::CheckButton _check_offsets; // Button-click handlers void onClear(); @@ -115,8 +87,8 @@ private: Find(Find const &d); Find& operator=(Find const &d); - Button _button_clear; - Button _button_find; + Inkscape::UI::Widget::Button _button_clear; + Inkscape::UI::Widget::Button _button_find; }; } // namespace Dialog diff --git a/src/ui/dialog/floating-behavior.cpp b/src/ui/dialog/floating-behavior.cpp index 9f5571b4b..19147f2c7 100644 --- a/src/ui/dialog/floating-behavior.cpp +++ b/src/ui/dialog/floating-behavior.cpp @@ -1,7 +1,7 @@ -/** - * \brief A floating dialog implementation. - * - * Author: +/** @file + * @brief Floating dialog implementation. + */ +/* Author: * Gustav Broberg <broberg@kth.se> * * Copyright (C) 2007 Authors @@ -21,7 +21,7 @@ #include "desktop.h" #include "dialogs/dialog-events.h" #include "interface.h" -#include "prefs-utils.h" +#include "preferences.h" #include "verbs.h" namespace Inkscape { @@ -35,9 +35,9 @@ FloatingBehavior::FloatingBehavior(Dialog &dialog) : #if GTK_VERSION_GE(2, 12) ,_dialog_active(_d->property_is_active()) ,_steps(0) - ,_trans_focus(prefs_get_double_attribute_limited("dialogs.transparency", "on-focus", 0.95, 0.0, 1.0)) - ,_trans_blur(prefs_get_double_attribute_limited("dialogs.transparency", "on-blur", 0.50, 0.0, 1.0)) - ,_trans_time(prefs_get_int_attribute_limited("dialogs.transparency", "animate-time", 100, 0, 5000)) + ,_trans_focus(Inkscape::Preferences::get()->getDoubleLimited("/dialogs/transparency/on-focus", 0.95, 0.0, 1.0)) + ,_trans_blur(Inkscape::Preferences::get()->getDoubleLimited("/dialogs/transparency/on-blur", 0.50, 0.0, 1.0)) + ,_trans_time(Inkscape::Preferences::get()->getIntLimited("/dialogs/transparency/animate-time", 100, 0, 5000)) #endif { hide(); @@ -65,28 +65,30 @@ FloatingBehavior::FloatingBehavior(Dialog &dialog) : zero so that the transition happens instantaneously. This occurs on windows as opacity changes cause flicker there. */ -void FloatingBehavior::_focus_event (void) { - _steps = 0; - _trans_focus = prefs_get_double_attribute_limited("dialogs.transparency", "on-focus", 0.95, 0.0, 1.0); - _trans_blur = prefs_get_double_attribute_limited("dialogs.transparency", "on-blur", 0.50, 0.0, 1.0); - _trans_time = prefs_get_int_attribute_limited("dialogs.transparency", "animate-time", 100, 0, 5000); - - if (_trans_time != 0) { - float diff = _trans_focus - _trans_blur; - if (diff < 0.0) diff *= -1.0; - - while (diff > 0.05) { - _steps++; - diff = diff / 2.0; - } +void FloatingBehavior::_focus_event (void) +{ + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + _steps = 0; + _trans_focus = prefs->getDoubleLimited("/dialogs/transparency/on-focus", 0.95, 0.0, 1.0); + _trans_blur = prefs->getDoubleLimited("/dialogs/transparency/on-blur", 0.50, 0.0, 1.0); + _trans_time = prefs->getIntLimited("/dialogs/transparency/animate-time", 100, 0, 5000); + + if (_trans_time != 0) { + float diff = _trans_focus - _trans_blur; + if (diff < 0.0) diff *= -1.0; + + while (diff > 0.05) { + _steps++; + diff = diff / 2.0; + } - if (_steps != 0) { - Glib::signal_timeout().connect(sigc::mem_fun(this, &FloatingBehavior::_trans_timer), _trans_time / _steps); - } - } - _trans_timer(); + if (_steps != 0) { + Glib::signal_timeout().connect(sigc::mem_fun(this, &FloatingBehavior::_trans_timer), _trans_time / _steps); + } + } + _trans_timer(); - return; + return; } /** \brief Move the opacity of a window towards our goal @@ -177,7 +179,8 @@ FloatingBehavior::onShutdown() {} void FloatingBehavior::onDesktopActivated (SPDesktop *desktop) { - gint transient_policy = prefs_get_int_attribute_limited ( "options.transientpolicy", "value", 1, 0, 2); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + gint transient_policy = prefs->getIntLimited("/options/transientpolicy/value", 1, 0, 2); #ifdef WIN32 // Win32 special code to enable transient dialogs transient_policy = 2; diff --git a/src/ui/dialog/floating-behavior.h b/src/ui/dialog/floating-behavior.h index 0ab2d6981..0360ccf49 100644 --- a/src/ui/dialog/floating-behavior.h +++ b/src/ui/dialog/floating-behavior.h @@ -1,7 +1,7 @@ -/** - * \brief A floating dialog implementation. - * - * Author: +/** @file + * @brief A floating dialog implementation. + */ +/* Author: * Gustav Broberg <broberg@kth.se> * * Copyright (C) 2007 Authors diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index e2e717c53..d06d3a406 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -1,7 +1,7 @@ -/** - * \brief Inkscape Preferences dialog - * - * Authors: +/** @file + * @brief Inkscape Preferences dialog - implementation + */ +/* Authors: * Carl Hetherington * Marco Scholten * Johan Engelen <j.b.c.engelen@ewi.utwente.nl> @@ -28,7 +28,7 @@ #include "unit-constants.h" #include <iostream> #include "enums.h" -#include "inkscape.h" +// #include "inkscape.h" #include "desktop-handles.h" #include "message-stack.h" #include "style.h" @@ -37,6 +37,7 @@ #include "xml/repr.h" #include "ui/widget/style-swatch.h" #include "display/nr-filter-gaussian.h" +#include "display/nr-filter-types.h" #include "color-profile-fns.h" #include "display/canvas-grid.h" @@ -45,7 +46,7 @@ namespace UI { namespace Dialog { InkscapePreferences::InkscapePreferences() - : UI::Widget::Panel ("", "dialogs.preferences", SP_VERB_DIALOG_DISPLAY), + : UI::Widget::Panel ("", "/dialogs/preferences", SP_VERB_DIALOG_DISPLAY), _max_dialog_width(0), _max_dialog_height(0), _current_page(0) @@ -153,18 +154,18 @@ Gtk::TreeModel::iterator InkscapePreferences::AddPage(DialogPage& p, Glib::ustri void InkscapePreferences::initPageMouse() { this->AddPage(_page_mouse, _("Mouse"), PREFS_PAGE_MOUSE); - _mouse_sens.init ( "options.cursortolerance", "value", 0.0, 30.0, 1.0, 1.0, 8.0, true, false); + _mouse_sens.init ( "/options/cursortolerance/value", 0.0, 30.0, 1.0, 1.0, 8.0, true, false); _page_mouse.add_line( false, _("Grab sensitivity:"), _mouse_sens, _("pixels"), _("How close on the screen you need to be to an object to be able to grab it with mouse (in screen pixels)"), false); - _mouse_thres.init ( "options.dragtolerance", "value", 0.0, 20.0, 1.0, 1.0, 4.0, true, false); + _mouse_thres.init ( "/options/dragtolerance/value", 0.0, 20.0, 1.0, 1.0, 4.0, true, false); _page_mouse.add_line( false, _("Click/drag threshold:"), _mouse_thres, _("pixels"), _("Maximum mouse drag (in screen pixels) which is considered a click, not a drag"), false); - _mouse_use_ext_input.init( _("Use pressure-sensitive tablet (requires restart)"), "options.useextinput", "value", true); + _mouse_use_ext_input.init( _("Use pressure-sensitive tablet (requires restart)"), "/options/useextinput/value", true); _page_mouse.add_line(true, "",_mouse_use_ext_input, "", _("Use the capabilities of a tablet or other pressure-sensitive device. Disable this only if you have problems with the tablet (you can still use it as a mouse)")); - _mouse_switch_on_ext_input.init( _("Switch tool based on tablet device (requires restart)"), "options.switchonextinput", "value", false); + _mouse_switch_on_ext_input.init( _("Switch tool based on tablet device (requires restart)"), "/options/switchonextinput/value", false); _page_mouse.add_line(true, "",_mouse_switch_on_ext_input, "", _("Change tool as different devices are used on the tablet (pen, eraser, mouse)")); } @@ -172,27 +173,27 @@ void InkscapePreferences::initPageMouse() void InkscapePreferences::initPageScrolling() { this->AddPage(_page_scrolling, _("Scrolling"), PREFS_PAGE_SCROLLING); - _scroll_wheel.init ( "options.wheelscroll", "value", 0.0, 1000.0, 1.0, 1.0, 40.0, true, false); + _scroll_wheel.init ( "/options/wheelscroll/value", 0.0, 1000.0, 1.0, 1.0, 40.0, true, false); _page_scrolling.add_line( false, _("Mouse wheel scrolls by:"), _scroll_wheel, _("pixels"), _("One mouse wheel notch scrolls by this distance in screen pixels (horizontally with Shift)"), false); _page_scrolling.add_group_header( _("Ctrl+arrows")); - _scroll_arrow_px.init ( "options.keyscroll", "value", 0.0, 1000.0, 1.0, 1.0, 10.0, true, false); + _scroll_arrow_px.init ( "/options/keyscroll/value", 0.0, 1000.0, 1.0, 1.0, 10.0, true, false); _page_scrolling.add_line( true, _("Scroll by:"), _scroll_arrow_px, _("pixels"), _("Pressing Ctrl+arrow key scrolls by this distance (in screen pixels)"), false); - _scroll_arrow_acc.init ( "options.scrollingacceleration", "value", 0.0, 5.0, 0.01, 1.0, 0.35, false, false); + _scroll_arrow_acc.init ( "/options/scrollingacceleration/value", 0.0, 5.0, 0.01, 1.0, 0.35, false, false); _page_scrolling.add_line( true, _("Acceleration:"), _scroll_arrow_acc, "", _("Pressing and holding Ctrl+arrow will gradually speed up scrolling (0 for no acceleration)"), false); _page_scrolling.add_group_header( _("Autoscrolling")); - _scroll_auto_speed.init ( "options.autoscrollspeed", "value", 0.0, 5.0, 0.01, 1.0, 0.7, false, false); + _scroll_auto_speed.init ( "/options/autoscrollspeed/value", 0.0, 5.0, 0.01, 1.0, 0.7, false, false); _page_scrolling.add_line( true, _("Speed:"), _scroll_auto_speed, "", _("How fast the canvas autoscrolls when you drag beyond canvas edge (0 to turn autoscroll off)"), false); - _scroll_auto_thres.init ( "options.autoscrolldistance", "value", -600.0, 600.0, 1.0, 1.0, -10.0, true, false); + _scroll_auto_thres.init ( "/options/autoscrolldistance/value", -600.0, 600.0, 1.0, 1.0, -10.0, true, false); _page_scrolling.add_line( true, _("Threshold:"), _scroll_auto_thres, _("pixels"), _("How far (in screen pixels) you need to be from the canvas edge to trigger autoscroll; positive is outside the canvas, negative is within the canvas"), false); - _scroll_space.init ( _("Left mouse button pans when Space is pressed"), "options.spacepans", "value", false); + _scroll_space.init ( _("Left mouse button pans when Space is pressed"), "/options/spacepans/value", false); _page_scrolling.add_line( false, "", _scroll_space, "", _("When on, pressing and holding Space and dragging with left mouse button pans canvas (as in Adobe Illustrator). When off, Space temporarily switches to Selector tool (default).")); - _wheel_zoom.init ( _("Mouse wheel zooms by default"), "options.wheelzooms", "value", false); + _wheel_zoom.init ( _("Mouse wheel zooms by default"), "/options/wheelzooms/value", false); _page_scrolling.add_line( false, "", _wheel_zoom, "", _("When on, mouse wheel zooms without Ctrl and scrolls canvas with Ctrl; when off, it zooms with Ctrl and scrolls without Ctrl.")); } @@ -201,28 +202,28 @@ void InkscapePreferences::initPageSteps() { this->AddPage(_page_steps, _("Steps"), PREFS_PAGE_STEPS); - _steps_arrow.init ( "options.nudgedistance", "value", 0.0, 1000.0, 0.01, 1.0, 2.0, false, false); + _steps_arrow.init ( "/options/nudgedistance/value", 0.0, 1000.0, 0.01, 1.0, 2.0, false, false); //nudgedistance is limited to 1000 in select-context.cpp: use the same limit here _page_steps.add_line( false, _("Arrow keys move by:"), _steps_arrow, _("px"), _("Pressing an arrow key moves selected object(s) or node(s) by this distance (in px units)"), false); - _steps_scale.init ( "options.defaultscale", "value", 0.0, 1000.0, 0.01, 1.0, 2.0, false, false); + _steps_scale.init ( "/options/defaultscale/value", 0.0, 1000.0, 0.01, 1.0, 2.0, false, false); //defaultscale is limited to 1000 in select-context.cpp: use the same limit here _page_steps.add_line( false, _("> and < scale by:"), _steps_scale, _("px"), _("Pressing > or < scales selection up or down by this increment (in px units)"), false); - _steps_inset.init ( "options.defaultoffsetwidth", "value", 0.0, 3000.0, 0.01, 1.0, 2.0, false, false); + _steps_inset.init ( "/options/defaultoffsetwidth/value", 0.0, 3000.0, 0.01, 1.0, 2.0, false, false); _page_steps.add_line( false, _("Inset/Outset by:"), _steps_inset, _("px"), _("Inset and Outset commands displace the path by this distance (in px units)"), false); - _steps_compass.init ( _("Compass-like display of angles"), "options.compassangledisplay", "value", true); + _steps_compass.init ( _("Compass-like display of angles"), "/options/compassangledisplay/value", true); _page_steps.add_line( false, "", _steps_compass, "", _("When on, angles are displayed with 0 at north, 0 to 360 range, positive clockwise; otherwise with 0 at east, -180 to 180 range, positive counterclockwise")); int const num_items = 17; Glib::ustring labels[num_items] = {"90", "60", "45", "36", "30", "22.5", "18", "15", "12", "10", "7.5", "6", "3", "2", "1", "0.5", _("None")}; int values[num_items] = {2, 3, 4, 5, 6, 8, 10, 12, 15, 18, 24, 30, 60, 90, 180, 360, 0}; _steps_rot_snap.set_size_request(_sb_width); - _steps_rot_snap.init("options.rotationsnapsperpi", "value", labels, values, num_items, 12); + _steps_rot_snap.init("/options/rotationsnapsperpi/value", labels, values, num_items, 12); _page_steps.add_line( false, _("Rotation snaps every:"), _steps_rot_snap, _("degrees"), _("Rotating with Ctrl pressed snaps every that much degrees; also, pressing [ or ] rotates by this amount"), false); - _steps_zoom.init ( "options.zoomincrement", "value", 101.0, 500.0, 1.0, 1.0, 1.414213562, true, true); + _steps_zoom.init ( "/options/zoomincrement/value", 101.0, 500.0, 1.0, 1.0, 1.414213562, true, true); _page_steps.add_line( false, _("Zoom in/out by:"), _steps_zoom, _("%"), _("Zoom tool click, +/- keys, and middle click zoom in and out by this multiplier"), false); } @@ -230,34 +231,34 @@ void InkscapePreferences::initPageSteps() void InkscapePreferences::AddSelcueCheckbox(DialogPage &p, Glib::ustring const &prefs_path, bool def_value) { PrefCheckButton* cb = Gtk::manage( new PrefCheckButton); - cb->init ( _("Show selection cue"), prefs_path, "selcue", def_value); + cb->init ( _("Show selection cue"), prefs_path + "/selcue", def_value); p.add_line( false, "", *cb, "", _("Whether selected objects display a selection cue (the same as in selector)")); } void InkscapePreferences::AddGradientCheckbox(DialogPage &p, Glib::ustring const &prefs_path, bool def_value) { PrefCheckButton* cb = Gtk::manage( new PrefCheckButton); - cb->init ( _("Enable gradient editing"), prefs_path, "gradientdrag", def_value); + cb->init ( _("Enable gradient editing"), prefs_path + "/gradientdrag", def_value); p.add_line( false, "", *cb, "", _("Whether selected objects display gradient editing controls")); } void InkscapePreferences::AddConvertGuidesCheckbox(DialogPage &p, Glib::ustring const &prefs_path, bool def_value) { PrefCheckButton* cb = Gtk::manage( new PrefCheckButton); - cb->init ( _("Conversion to guides uses edges instead of bounding box"), prefs_path, "convertguides", def_value); + cb->init ( _("Conversion to guides uses edges instead of bounding box"), prefs_path + "/convertguides", def_value); p.add_line( false, "", *cb, "", _("Converting an object to guides places these along the object's true edges (imitating the object's shape), not along the bounding box.")); } void InkscapePreferences::AddDotSizeSpinbutton(DialogPage &p, Glib::ustring const &prefs_path, double def_value) { PrefSpinButton* sb = Gtk::manage( new PrefSpinButton); - sb->init ( prefs_path, "dot-size", 0.0, 1000.0, 0.1, 10.0, def_value, false, false); + sb->init ( prefs_path + "/dot-size", 0.0, 1000.0, 0.1, 10.0, def_value, false, false); p.add_line( false, _("Ctrl+click dot size:"), *sb, _("times current stroke width"), _("Size of dots created with Ctrl+click (relative to current stroke width)"), false ); } -void StyleFromSelectionToTool(gchar const *prefs_path, StyleSwatch *swatch) +void StyleFromSelectionToTool(Glib::ustring const &prefs_path, StyleSwatch *swatch) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; if (desktop == NULL) @@ -285,24 +286,22 @@ void StyleFromSelectionToTool(gchar const *prefs_path, StyleSwatch *swatch) if (!css) return; // only store text style for the text tool - if (!g_strrstr ((const gchar *) prefs_path, "text")) { + if (prefs_path == "/tools/text") { css = sp_css_attr_unset_text (css); } // we cannot store properties with uris - they will be invalid in other documents css = sp_css_attr_unset_uris (css); - sp_repr_css_change (inkscape_get_repr (INKSCAPE, prefs_path), css, "style"); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setStyle(prefs_path + "/style", css); sp_repr_css_attr_unref (css); // update the swatch if (swatch) { - Inkscape::XML::Node *tool_repr = inkscape_get_repr(INKSCAPE, prefs_path); - if (tool_repr) { - SPCSSAttr *css = sp_repr_css_attr_inherited(tool_repr, "style"); - swatch->setStyle (css); - sp_repr_css_attr_unref(css); - } + SPCSSAttr *css = prefs->getInheritedStyle(prefs_path + "/style"); + swatch->setStyle (css); + sp_repr_css_attr_unref(css); } } @@ -313,14 +312,14 @@ void InkscapePreferences::AddNewObjectsStyle(DialogPage &p, Glib::ustring const else p.add_group_header( _("Create new objects with:")); PrefRadioButton* current = Gtk::manage( new PrefRadioButton); - current->init ( _("Last used style"), prefs_path, "usecurrent", 1, true, 0); + current->init ( _("Last used style"), prefs_path + "/usecurrent", 1, true, 0); p.add_line( true, "", *current, "", _("Apply the style you last set on an object")); PrefRadioButton* own = Gtk::manage( new PrefRadioButton); Gtk::HBox* hb = Gtk::manage( new Gtk::HBox); Gtk::Alignment* align = Gtk::manage( new Gtk::Alignment); - own->init ( _("This tool's own style:"), prefs_path, "usecurrent", 0, false, current); + own->init ( _("This tool's own style:"), prefs_path + "/usecurrent", 0, false, current); align->set(0,0,0,0); align->add(*own); hb->add(*align); @@ -328,17 +327,16 @@ void InkscapePreferences::AddNewObjectsStyle(DialogPage &p, Glib::ustring const p.add_line( true, "", *hb, "", ""); // style swatch - Inkscape::XML::Node *tool_repr = inkscape_get_repr(INKSCAPE, prefs_path.c_str()); Gtk::Button* button = Gtk::manage( new Gtk::Button(_("Take from selection"),true)); StyleSwatch *swatch = 0; - if (tool_repr) { - SPCSSAttr *css = sp_repr_css_attr_inherited(tool_repr, "style"); - swatch = new StyleSwatch(css, _("This tool's style of new objects")); - hb->add(*swatch); - sp_repr_css_attr_unref(css); - } + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + + SPCSSAttr *css = prefs->getStyle(prefs_path + "/style"); + swatch = new StyleSwatch(css, _("This tool's style of new objects")); + hb->add(*swatch); + sp_repr_css_attr_unref(css); - button->signal_clicked().connect( sigc::bind( sigc::ptr_fun(StyleFromSelectionToTool), prefs_path.c_str(), swatch) ); + button->signal_clicked().connect( sigc::bind( sigc::ptr_fun(StyleFromSelectionToTool), prefs_path, swatch) ); own->changed_signal.connect( sigc::mem_fun(*button, &Gtk::Button::set_sensitive) ); p.add_line( true, "", *button, "", _("Remember the style of the (first) selected object as this tool's style")); @@ -350,167 +348,167 @@ void InkscapePreferences::initPageTools() _path_tools = _page_list.get_model()->get_path(iter_tools); _page_tools.add_group_header( _("Bounding box to use:")); - _t_bbox_visual.init ( _("Visual bounding box"), "tools", "bounding_box", "0", false, 0); // 0 means visual + _t_bbox_visual.init ( _("Visual bounding box"), "/tools/bounding_box", 0, false, 0); // 0 means visual _page_tools.add_line( true, "", _t_bbox_visual, "", _("This bounding box includes stroke width, markers, filter margins, etc.")); - _t_bbox_geometric.init ( _("Geometric bounding box"), "tools", "bounding_box", "1", true, &_t_bbox_visual); // 1 means geometric + _t_bbox_geometric.init ( _("Geometric bounding box"), "/tools/bounding_box", 1, true, &_t_bbox_visual); // 1 means geometric _page_tools.add_line( true, "", _t_bbox_geometric, "", _("This bounding box includes only the bare path")); _page_tools.add_group_header( _("Conversion to guides:")); - _t_cvg_keep_objects.init ( _("Keep objects after conversion to guides"), "tools", "cvg_keep_objects", false); + _t_cvg_keep_objects.init ( _("Keep objects after conversion to guides"), "/tools/cvg_keep_objects", false); _page_tools.add_line( true, "", _t_cvg_keep_objects, "", _("When converting an object to guides, don't delete the object after the conversion.")); - _t_cvg_convert_whole_groups.init ( _("Treat groups as a single object"), "tools", "cvg_convert_whole_groups", false); + _t_cvg_convert_whole_groups.init ( _("Treat groups as a single object"), "/tools/cvg_convert_whole_groups", false); _page_tools.add_line( true, "", _t_cvg_convert_whole_groups, "", _("Treat groups as a single object during conversion to guides rather than converting each child separately.")); - _calligrapy_use_abs_size.init ( _("Width is in absolute units"), "tools.calligraphic", "abs_width", false); - _calligrapy_keep_selected.init ( _("Select new path"), "tools.calligraphic", "keep_selected", true); - _connector_ignore_text.init( _("Don't attach connectors to text objects"), "tools.connector", "ignoretext", true); + _calligrapy_use_abs_size.init ( _("Width is in absolute units"), "/tools/calligraphic/abs_width", false); + _calligrapy_keep_selected.init ( _("Select new path"), "/tools/calligraphic/keep_selected", true); + _connector_ignore_text.init( _("Don't attach connectors to text objects"), "/tools/connector/ignoretext", true); //Selector this->AddPage(_page_selector, _("Selector"), iter_tools, PREFS_PAGE_TOOLS_SELECTOR); - AddSelcueCheckbox(_page_selector, "tools.select", false); + AddSelcueCheckbox(_page_selector, "/tools/select", false); _page_selector.add_group_header( _("When transforming, show:")); - _t_sel_trans_obj.init ( _("Objects"), "tools.select", "show", "content", true, 0); + _t_sel_trans_obj.init ( _("Objects"), "/tools/select/show", "content", true, 0); _page_selector.add_line( true, "", _t_sel_trans_obj, "", _("Show the actual objects when moving or transforming")); - _t_sel_trans_outl.init ( _("Box outline"), "tools.select", "show", "outline", false, &_t_sel_trans_obj); + _t_sel_trans_outl.init ( _("Box outline"), "/tools/select/show", "outline", false, &_t_sel_trans_obj); _page_selector.add_line( true, "", _t_sel_trans_outl, "", _("Show only a box outline of the objects when moving or transforming")); _page_selector.add_group_header( _("Per-object selection cue:")); - _t_sel_cue_none.init ( _("None"), "options.selcue", "value", Inkscape::SelCue::NONE, false, 0); + _t_sel_cue_none.init ( _("None"), "/options/selcue/value", Inkscape::SelCue::NONE, false, 0); _page_selector.add_line( true, "", _t_sel_cue_none, "", _("No per-object selection indication")); - _t_sel_cue_mark.init ( _("Mark"), "options.selcue", "value", Inkscape::SelCue::MARK, true, &_t_sel_cue_none); + _t_sel_cue_mark.init ( _("Mark"), "/options/selcue/value", Inkscape::SelCue::MARK, true, &_t_sel_cue_none); _page_selector.add_line( true, "", _t_sel_cue_mark, "", _("Each selected object has a diamond mark in the top left corner")); - _t_sel_cue_box.init ( _("Box"), "options.selcue", "value", Inkscape::SelCue::BBOX, false, &_t_sel_cue_none); + _t_sel_cue_box.init ( _("Box"), "/options/selcue/value", Inkscape::SelCue::BBOX, false, &_t_sel_cue_none); _page_selector.add_line( true, "", _t_sel_cue_box, "", _("Each selected object displays its bounding box")); //Node this->AddPage(_page_node, _("Node"), iter_tools, PREFS_PAGE_TOOLS_NODE); - AddSelcueCheckbox(_page_node, "tools.nodes", true); - AddGradientCheckbox(_page_node, "tools.nodes", true); + AddSelcueCheckbox(_page_node, "/tools/nodes", true); + AddGradientCheckbox(_page_node, "/tools/nodes", true); _page_node.add_group_header( _("Path outline:")); - _t_node_pathoutline_color.init(_("Path outline color"), "tools.nodes", "highlight_color", 0xff0000ff); + _t_node_pathoutline_color.init(_("Path outline color"), "/tools/nodes/highlight_color", 0xff0000ff); _page_node.add_line( false, _("Path outline color"), _t_node_pathoutline_color, "", _("Selects the color used for showing the path outline."), false); - _t_node_pathflash_enabled.init ( _("Path outline flash on mouse-over"), "tools.nodes", "pathflash_enabled", false); + _t_node_pathflash_enabled.init ( _("Path outline flash on mouse-over"), "/tools/nodes/pathflash_enabled", false); _page_node.add_line( true, "", _t_node_pathflash_enabled, "", _("When hovering over a path, briefly flash its outline.")); - _t_node_pathflash_timeout.init("tools.nodes", "pathflash_timeout", 0, 10000.0, 100.0, 100.0, 1000.0, true, false); + _t_node_pathflash_timeout.init("/tools/nodes/pathflash_timeout", 0, 10000.0, 100.0, 100.0, 1000.0, true, false); _page_node.add_line( false, _("Flash time"), _t_node_pathflash_timeout, "ms", _("Specifies how long the path outline will be visible after a mouse-over (in milliseconds). Specify 0 to have the outline shown until mouse leaves the path."), false); //Tweak this->AddPage(_page_tweak, _("Tweak"), iter_tools, PREFS_PAGE_TOOLS_TWEAK); - this->AddNewObjectsStyle(_page_tweak, "tools.tweak", _("Paint objects with:")); - AddSelcueCheckbox(_page_tweak, "tools.tweak", true); - AddGradientCheckbox(_page_tweak, "tools.tweak", false); + this->AddNewObjectsStyle(_page_tweak, "/tools/tweak", _("Paint objects with:")); + AddSelcueCheckbox(_page_tweak, "/tools/tweak", true); + AddGradientCheckbox(_page_tweak, "/tools/tweak", false); //Zoom this->AddPage(_page_zoom, _("Zoom"), iter_tools, PREFS_PAGE_TOOLS_ZOOM); - AddSelcueCheckbox(_page_zoom, "tools.zoom", true); - AddGradientCheckbox(_page_zoom, "tools.zoom", false); + AddSelcueCheckbox(_page_zoom, "/tools/zoom", true); + AddGradientCheckbox(_page_zoom, "/tools/zoom", false); //Shapes Gtk::TreeModel::iterator iter_shapes = this->AddPage(_page_shapes, _("Shapes"), iter_tools, PREFS_PAGE_TOOLS_SHAPES); _path_shapes = _page_list.get_model()->get_path(iter_shapes); - this->AddSelcueCheckbox(_page_shapes, "tools.shapes", true); - this->AddGradientCheckbox(_page_shapes, "tools.shapes", true); + this->AddSelcueCheckbox(_page_shapes, "/tools/shapes", true); + this->AddGradientCheckbox(_page_shapes, "/tools/shapes", true); //Rectangle this->AddPage(_page_rectangle, _("Rectangle"), iter_shapes, PREFS_PAGE_TOOLS_SHAPES_RECT); - this->AddNewObjectsStyle(_page_rectangle, "tools.shapes.rect"); - this->AddConvertGuidesCheckbox(_page_rectangle, "tools.shapes.rect", true); + this->AddNewObjectsStyle(_page_rectangle, "/tools/shapes/rect"); + this->AddConvertGuidesCheckbox(_page_rectangle, "/tools/shapes/rect", true); //3D box this->AddPage(_page_3dbox, _("3D Box"), iter_shapes, PREFS_PAGE_TOOLS_SHAPES_3DBOX); - this->AddNewObjectsStyle(_page_3dbox, "tools.shapes.3dbox"); - this->AddConvertGuidesCheckbox(_page_3dbox, "tools.shapes.3dbox", true); + this->AddNewObjectsStyle(_page_3dbox, "/tools/shapes/3dbox"); + this->AddConvertGuidesCheckbox(_page_3dbox, "/tools/shapes/3dbox", true); //ellipse this->AddPage(_page_ellipse, _("Ellipse"), iter_shapes, PREFS_PAGE_TOOLS_SHAPES_ELLIPSE); - this->AddNewObjectsStyle(_page_ellipse, "tools.shapes.arc"); + this->AddNewObjectsStyle(_page_ellipse, "/tools/shapes/arc"); //star this->AddPage(_page_star, _("Star"), iter_shapes, PREFS_PAGE_TOOLS_SHAPES_STAR); - this->AddNewObjectsStyle(_page_star, "tools.shapes.star"); + this->AddNewObjectsStyle(_page_star, "/tools/shapes/star"); //spiral this->AddPage(_page_spiral, _("Spiral"), iter_shapes, PREFS_PAGE_TOOLS_SHAPES_SPIRAL); - this->AddNewObjectsStyle(_page_spiral, "tools.shapes.spiral"); + this->AddNewObjectsStyle(_page_spiral, "/tools/shapes/spiral"); //Pencil this->AddPage(_page_pencil, _("Pencil"), iter_tools, PREFS_PAGE_TOOLS_PENCIL); - this->AddSelcueCheckbox(_page_pencil, "tools.freehand.pencil", true); - this->AddNewObjectsStyle(_page_pencil, "tools.freehand.pencil"); - this->AddDotSizeSpinbutton(_page_pencil, "tools.freehand.pencil", 3.0); + this->AddSelcueCheckbox(_page_pencil, "/tools/freehand/pencil", true); + this->AddNewObjectsStyle(_page_pencil, "/tools/freehand/pencil"); + this->AddDotSizeSpinbutton(_page_pencil, "/tools/freehand/pencil", 3.0); //Pen this->AddPage(_page_pen, _("Pen"), iter_tools, PREFS_PAGE_TOOLS_PEN); - this->AddSelcueCheckbox(_page_pen, "tools.freehand.pen", true); - this->AddNewObjectsStyle(_page_pen, "tools.freehand.pen"); - this->AddDotSizeSpinbutton(_page_pen, "tools.freehand.pen", 3.0); + this->AddSelcueCheckbox(_page_pen, "/tools/freehand/pen", true); + this->AddNewObjectsStyle(_page_pen, "/tools/freehand/pen"); + this->AddDotSizeSpinbutton(_page_pen, "/tools/freehand/pen", 3.0); //Calligraphy this->AddPage(_page_calligraphy, _("Calligraphy"), iter_tools, PREFS_PAGE_TOOLS_CALLIGRAPHY); - this->AddSelcueCheckbox(_page_calligraphy, "tools.calligraphic", false); - this->AddNewObjectsStyle(_page_calligraphy, "tools.calligraphic"); + this->AddSelcueCheckbox(_page_calligraphy, "/tools/calligraphic", false); + this->AddNewObjectsStyle(_page_calligraphy, "/tools/calligraphic"); _page_calligraphy.add_line( false, "", _calligrapy_use_abs_size, "", _("If on, pen width is in absolute units (px) independent of zoom; otherwise pen width depends on zoom so that it looks the same at any zoom")); _page_calligraphy.add_line( false, "", _calligrapy_keep_selected, "", _("If on, each newly created object will be selected (deselecting previous selection)")); //Paint Bucket this->AddPage(_page_paintbucket, _("Paint Bucket"), iter_tools, PREFS_PAGE_TOOLS_PAINTBUCKET); - this->AddSelcueCheckbox(_page_paintbucket, "tools.paintbucket", false); - this->AddNewObjectsStyle(_page_paintbucket, "tools.paintbucket"); + this->AddSelcueCheckbox(_page_paintbucket, "/tools/paintbucket", false); + this->AddNewObjectsStyle(_page_paintbucket, "/tools/paintbucket"); //Eraser this->AddPage(_page_eraser, _("Eraser"), iter_tools, PREFS_PAGE_TOOLS_ERASER); - this->AddNewObjectsStyle(_page_eraser, "tools.eraser"); + this->AddNewObjectsStyle(_page_eraser, "/tools/eraser"); //LPETool this->AddPage(_page_lpetool, _("LPE Tool"), iter_tools, PREFS_PAGE_TOOLS_LPETOOL); - this->AddNewObjectsStyle(_page_lpetool, "tools.lpetool"); + this->AddNewObjectsStyle(_page_lpetool, "/tools/lpetool"); //Text this->AddPage(_page_text, _("Text"), iter_tools, PREFS_PAGE_TOOLS_TEXT); - this->AddSelcueCheckbox(_page_text, "tools.text", true); - this->AddGradientCheckbox(_page_text, "tools.text", true); - this->AddNewObjectsStyle(_page_text, "tools.text"); + this->AddSelcueCheckbox(_page_text, "/tools/text", true); + this->AddGradientCheckbox(_page_text, "/tools/text", true); + this->AddNewObjectsStyle(_page_text, "/tools/text"); //Gradient this->AddPage(_page_gradient, _("Gradient"), iter_tools, PREFS_PAGE_TOOLS_GRADIENT); - this->AddSelcueCheckbox(_page_gradient, "tools.gradient", true); + this->AddSelcueCheckbox(_page_gradient, "/tools/gradient", true); //Connector this->AddPage(_page_connector, _("Connector"), iter_tools, PREFS_PAGE_TOOLS_CONNECTOR); - this->AddSelcueCheckbox(_page_connector, "tools.connector", true); + this->AddSelcueCheckbox(_page_connector, "/tools/connector", true); _page_connector.add_line(false, "", _connector_ignore_text, "", _("If on, connector attachment points will not be shown for text objects")); //Dropper this->AddPage(_page_dropper, _("Dropper"), iter_tools, PREFS_PAGE_TOOLS_DROPPER); - this->AddSelcueCheckbox(_page_dropper, "tools.dropper", true); - this->AddGradientCheckbox(_page_dropper, "tools.dropper", true); + this->AddSelcueCheckbox(_page_dropper, "/tools/dropper", true); + this->AddGradientCheckbox(_page_dropper, "/tools/dropper", true); } void InkscapePreferences::initPageWindows() { - _win_save_geom.init ( _("Save and restore window geometry for each document"), "options.savewindowgeometry", "value", 1, true, 0); - _win_save_geom_prefs.init ( _("Remember and use last window's geometry"), "options.savewindowgeometry", "value", 2, false, &_win_save_geom); - _win_save_geom_off.init ( _("Don't save window geometry"), "options.savewindowgeometry", "value", 0, false, &_win_save_geom); + _win_save_geom.init ( _("Save and restore window geometry for each document"), "/options/savewindowgeometry/value", 1, true, 0); + _win_save_geom_prefs.init ( _("Remember and use last window's geometry"), "/options/savewindowgeometry/value", 2, false, &_win_save_geom); + _win_save_geom_off.init ( _("Don't save window geometry"), "/options/savewindowgeometry/value", 0, false, &_win_save_geom); - _win_dockable.init ( _("Dockable"), "options.dialogtype", "value", 1, true, 0); - _win_floating.init ( _("Floating"), "options.dialogtype", "value", 0, false, &_win_dockable); + _win_dockable.init ( _("Dockable"), "/options/dialogtype/value", 1, true, 0); + _win_floating.init ( _("Floating"), "/options/dialogtype/value", 0, false, &_win_dockable); - _win_hide_task.init ( _("Dialogs are hidden in taskbar"), "options.dialogsskiptaskbar", "value", true); - _win_zoom_resize.init ( _("Zoom when window is resized"), "options.stickyzoom", "value", false); - _win_show_close.init ( _("Show close button on dialogs"), "dialogs", "showclose", false); - _win_ontop_none.init ( _("None"), "options.transientpolicy", "value", 0, false, 0); - _win_ontop_normal.init ( _("Normal"), "options.transientpolicy", "value", 1, true, &_win_ontop_none); - _win_ontop_agressive.init ( _("Aggressive"), "options.transientpolicy", "value", 2, false, &_win_ontop_none); + _win_hide_task.init ( _("Dialogs are hidden in taskbar"), "/options/dialogsskiptaskbar/value", true); + _win_zoom_resize.init ( _("Zoom when window is resized"), "/options/stickyzoom/value", false); + _win_show_close.init ( _("Show close button on dialogs"), "/dialogs/showclose", false); + _win_ontop_none.init ( _("None"), "/options/transientpolicy/value", 0, false, 0); + _win_ontop_normal.init ( _("Normal"), "/options/transientpolicy/value", 1, true, &_win_ontop_none); + _win_ontop_agressive.init ( _("Aggressive"), "/options/transientpolicy/value", 2, false, &_win_ontop_none); _page_windows.add_group_header( _("Saving window geometry (size and position):")); _page_windows.add_line( true, "", _win_save_geom_off, "", @@ -539,11 +537,11 @@ void InkscapePreferences::initPageWindows() #if GTK_VERSION_GE(2, 12) _page_windows.add_group_header( _("Dialog Transparency:")); - _win_trans_focus.init("dialogs.transparency", "on-focus", 0.5, 1.0, 0.01, 0.1, 1.0, false, false); + _win_trans_focus.init("/dialogs/transparency/on-focus", 0.5, 1.0, 0.01, 0.1, 1.0, false, false); _page_windows.add_line( true, _("Opacity when focused:"), _win_trans_focus, "", ""); - _win_trans_blur.init("dialogs.transparency", "on-blur", 0.0, 1.0, 0.01, 0.1, 0.5, false, false); + _win_trans_blur.init("/dialogs/transparency/on-blur", 0.0, 1.0, 0.01, 0.1, 0.5, false, false); _page_windows.add_line( true, _("Opacity when unfocused:"), _win_trans_blur, "", ""); - _win_trans_time.init("dialogs.transparency", "animate-time", 0, 1000, 10, 100, 100, true, false); + _win_trans_time.init("/dialogs/transparency/animate-time", 0, 1000, 10, 100, 100, true, false); _page_windows.add_line( true, _("Time of opacity change animation:"), _win_trans_time, "ms", ""); #endif @@ -561,15 +559,15 @@ void InkscapePreferences::initPageWindows() void InkscapePreferences::initPageClones() { - _clone_option_parallel.init ( _("Move in parallel"), "options.clonecompensation", "value", + _clone_option_parallel.init ( _("Move in parallel"), "/options/clonecompensation/value", SP_CLONE_COMPENSATION_PARALLEL, true, 0); - _clone_option_stay.init ( _("Stay unmoved"), "options.clonecompensation", "value", + _clone_option_stay.init ( _("Stay unmoved"), "/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED, false, &_clone_option_parallel); - _clone_option_transform.init ( _("Move according to transform"), "options.clonecompensation", "value", + _clone_option_transform.init ( _("Move according to transform"), "/options/clonecompensation/value", SP_CLONE_COMPENSATION_NONE, false, &_clone_option_parallel); - _clone_option_unlink.init ( _("Are unlinked"), "options.cloneorphans", "value", + _clone_option_unlink.init ( _("Are unlinked"), "/options/cloneorphans/value", SP_CLONE_ORPHANS_UNLINK, true, 0); - _clone_option_delete.init ( _("Are deleted"), "options.cloneorphans", "value", + _clone_option_delete.init ( _("Are deleted"), "/options/cloneorphans/value", SP_CLONE_ORPHANS_DELETE, false, &_clone_option_unlink); _page_clones.add_group_header( _("When the original moves, its clones and linked offsets:")); @@ -587,7 +585,7 @@ void InkscapePreferences::initPageClones() _page_clones.add_group_header( _("When duplicating original+clones:")); - _clone_relink_on_duplicate.init ( _("Relink duplicated clones"), "options.relinkclonesonduplicate", "value", false); + _clone_relink_on_duplicate.init ( _("Relink duplicated clones"), "/options/relinkclonesonduplicate/value", false); _page_clones.add_line(true, "", _clone_relink_on_duplicate, "", _("When duplicating a selection containing both a clone and its original (possibly in groups), relink the duplicated clone to the duplicated original instead of the old original")); @@ -597,10 +595,10 @@ void InkscapePreferences::initPageClones() void InkscapePreferences::initPageMasks() { - _mask_mask_on_top.init ( _("When applying, use the topmost selected object as clippath/mask"), "options.maskobject", "topmost", true); + _mask_mask_on_top.init ( _("When applying, use the topmost selected object as clippath/mask"), "/options/maskobject/topmost", true); _page_mask.add_line(true, "", _mask_mask_on_top, "", _("Uncheck this to use the bottom selected object as the clipping path or mask")); - _mask_mask_remove.init ( _("Remove clippath/mask object after applying"), "options.maskobject", "remove", true); + _mask_mask_remove.init ( _("Remove clippath/mask object after applying"), "/options/maskobject/remove", true); _page_mask.add_line(true, "", _mask_mask_remove, "", _("After applying, remove the object used as the clipping path or mask from the drawing")); this->AddPage(_page_mask, _("Clippaths and masks"), PREFS_PAGE_MASKS); @@ -608,12 +606,12 @@ void InkscapePreferences::initPageMasks() void InkscapePreferences::initPageTransforms() { - _trans_scale_stroke.init ( _("Scale stroke width"), "options.transform", "stroke", true); - _trans_scale_corner.init ( _("Scale rounded corners in rectangles"), "options.transform", "rectcorners", false); - _trans_gradient.init ( _("Transform gradients"), "options.transform", "gradient", true); - _trans_pattern.init ( _("Transform patterns"), "options.transform", "pattern", false); - _trans_optimized.init ( _("Optimized"), "options.preservetransform", "value", 0, true, 0); - _trans_preserved.init ( _("Preserved"), "options.preservetransform", "value", 1, false, &_trans_optimized); + _trans_scale_stroke.init ( _("Scale stroke width"), "/options/transform/stroke", true); + _trans_scale_corner.init ( _("Scale rounded corners in rectangles"), "/options/transform/rectcorners", false); + _trans_gradient.init ( _("Transform gradients"), "/options/transform/gradient", true); + _trans_pattern.init ( _("Transform patterns"), "/options/transform/pattern", false); + _trans_optimized.init ( _("Optimized"), "/options/preservetransform/value", 0, true, 0); + _trans_preserved.init ( _("Preserved"), "/options/preservetransform/value", 1, false, &_trans_optimized); _page_transforms.add_line( false, "", _trans_scale_stroke, "", _("When scaling objects, scale the stroke width by the same proportion")); @@ -634,15 +632,16 @@ void InkscapePreferences::initPageTransforms() void InkscapePreferences::initPageFilters() { - _blur_quality_best.init ( _("Best quality (slowest)"), "options.blurquality", "value", + /* blur quality */ + _blur_quality_best.init ( _("Best quality (slowest)"), "/options/blurquality/value", BLUR_QUALITY_BEST, false, 0); - _blur_quality_better.init ( _("Better quality (slower)"), "options.blurquality", "value", + _blur_quality_better.init ( _("Better quality (slower)"), "/options/blurquality/value", BLUR_QUALITY_BETTER, false, &_blur_quality_best); - _blur_quality_normal.init ( _("Average quality"), "options.blurquality", "value", + _blur_quality_normal.init ( _("Average quality"), "/options/blurquality/value", BLUR_QUALITY_NORMAL, true, &_blur_quality_best); - _blur_quality_worse.init ( _("Lower quality (faster)"), "options.blurquality", "value", + _blur_quality_worse.init ( _("Lower quality (faster)"), "/options/blurquality/value", BLUR_QUALITY_WORSE, false, &_blur_quality_best); - _blur_quality_worst.init ( _("Lowest quality (fastest)"), "options.blurquality", "value", + _blur_quality_worst.init ( _("Lowest quality (fastest)"), "/options/blurquality/value", BLUR_QUALITY_WORST, false, &_blur_quality_best); _page_filters.add_group_header( _("Gaussian blur quality for display:")); @@ -657,7 +656,32 @@ void InkscapePreferences::initPageFilters() _page_filters.add_line( true, "", _blur_quality_worst, "", _("Lowest quality (considerable artifacts), but display is fastest")); - _show_filters_info_box.init( _("Show filter primitives infobox"), "options.showfiltersinfobox", "value", true); + /* filter quality */ + _filter_quality_best.init ( _("Best quality (slowest)"), "/options/filterquality/value", + NR::FILTER_QUALITY_BEST, false, 0); + _filter_quality_better.init ( _("Better quality (slower)"), "/options/filterquality/value", + NR::FILTER_QUALITY_BETTER, false, &_filter_quality_best); + _filter_quality_normal.init ( _("Average quality"), "/options/filterquality/value", + NR::FILTER_QUALITY_NORMAL, true, &_filter_quality_best); + _filter_quality_worse.init ( _("Lower quality (faster)"), "/options/filterquality/value", + NR::FILTER_QUALITY_WORSE, false, &_filter_quality_best); + _filter_quality_worst.init ( _("Lowest quality (fastest)"), "/options/filterquality/value", + NR::FILTER_QUALITY_WORST, false, &_filter_quality_best); + + _page_filters.add_group_header( _("Filter effects quality for display:")); + _page_filters.add_line( true, "", _filter_quality_best, "", + _("Best quality, but display may be very slow at high zooms (bitmap export always uses best quality)")); + _page_filters.add_line( true, "", _filter_quality_better, "", + _("Better quality, but slower display")); + _page_filters.add_line( true, "", _filter_quality_normal, "", + _("Average quality, acceptable display speed")); + _page_filters.add_line( true, "", _filter_quality_worse, "", + _("Lower quality (some artifacts), but display is faster")); + _page_filters.add_line( true, "", _filter_quality_worst, "", + _("Lowest quality (considerable artifacts), but display is fastest")); + + /* show infobox */ + _show_filters_info_box.init( _("Show filter primitives infobox"), "/options/showfiltersinfobox/value", true); _page_filters.add_line(true, "", _show_filters_info_box, "", _("Show icons and descriptions for the filter primitives available at the filter effects dialog.")); @@ -667,12 +691,12 @@ void InkscapePreferences::initPageFilters() void InkscapePreferences::initPageSelecting() { - _sel_all.init ( _("Select in all layers"), "options.kbselection", "inlayer", PREFS_SELECTION_ALL, false, 0); - _sel_current.init ( _("Select only within current layer"), "options.kbselection", "inlayer", PREFS_SELECTION_LAYER, true, &_sel_all); - _sel_recursive.init ( _("Select in current layer and sublayers"), "options.kbselection", "inlayer", PREFS_SELECTION_LAYER_RECURSIVE, false, &_sel_all); - _sel_hidden.init ( _("Ignore hidden objects and layers"), "options.kbselection", "onlyvisible", true); - _sel_locked.init ( _("Ignore locked objects and layers"), "options.kbselection", "onlysensitive", true); - _sel_layer_deselects.init ( _("Deselect upon layer change"), "options.selection", "layerdeselect", true); + _sel_all.init ( _("Select in all layers"), "/options/kbselection/inlayer", PREFS_SELECTION_ALL, false, 0); + _sel_current.init ( _("Select only within current layer"), "/options/kbselection/inlayer", PREFS_SELECTION_LAYER, true, &_sel_all); + _sel_recursive.init ( _("Select in current layer and sublayers"), "/options/kbselection/inlayer", PREFS_SELECTION_LAYER_RECURSIVE, false, &_sel_all); + _sel_hidden.init ( _("Ignore hidden objects and layers"), "/options/kbselection/onlyvisible", true); + _sel_locked.init ( _("Ignore locked objects and layers"), "/options/kbselection/onlysensitive", true); + _sel_layer_deselects.init ( _("Deselect upon layer change"), "/options/selection/layerdeselect", true); _page_select.add_group_header( _("Ctrl+A, Tab, Shift+Tab:")); _page_select.add_line( true, "", _sel_all, "", @@ -695,16 +719,16 @@ void InkscapePreferences::initPageSelecting() void InkscapePreferences::initPageImportExport() { - _importexport_export.init("dialogs.export.defaultxdpi", "value", 0.0, 6000.0, 1.0, 1.0, PX_PER_IN, true, false); + _importexport_export.init("/dialogs/export/defaultxdpi/value", 0.0, 6000.0, 1.0, 1.0, PX_PER_IN, true, false); _page_importexport.add_line( false, _("Default export resolution:"), _importexport_export, _("dpi"), _("Default bitmap resolution (in dots per inch) in the Export dialog"), false); - _importexport_ocal_url.init("options.ocalurl", "str", true, g_strdup_printf("openclipart.org")); + _importexport_ocal_url.init("/options/ocalurl/str", true, g_strdup_printf("openclipart.org")); _page_importexport.add_line( false, _("Open Clip Art Library Server Name:"), _importexport_ocal_url, "", _("The server name of the Open Clip Art Library webdav server. It's used by the Import and Export to OCAL function."), true); - _importexport_ocal_username.init("options.ocalusername", "str", true); + _importexport_ocal_username.init("/options/ocalusername/str", true); _page_importexport.add_line( false, _("Open Clip Art Library Username:"), _importexport_ocal_username, "", _("The username used to log into Open Clip Art Library."), true); - _importexport_ocal_password.init("options.ocalpassword", "str", false); + _importexport_ocal_password.init("/options/ocalpassword/str", false); _page_importexport.add_line( false, _("Open Clip Art Library Password:"), _importexport_ocal_password, "", _("The password used to log into Open Clip Art Library."), true); @@ -717,13 +741,13 @@ static void profileComboChanged( Gtk::ComboBoxText* combo ) Inkscape::Preferences *prefs = Inkscape::Preferences::get(); int rowNum = combo->get_active_row_number(); if ( rowNum < 1 ) { - prefs->setString("options.displayprofile", "uri", ""); + prefs->setString("/options/displayprofile/uri", ""); } else { Glib::ustring active = combo->get_active_text(); Glib::ustring path = get_path_for_profile(active); if ( !path.empty() ) { - prefs->setString("options.displayprofile", "uri", path); + prefs->setString("/options/displayprofile/uri", path); } } } @@ -735,7 +759,7 @@ static void proofComboChanged( Gtk::ComboBoxText* combo ) if ( !path.empty() ) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setString("options.softproof", "uri", path); + prefs->setString("/options/softproof/uri", path); } } @@ -748,7 +772,7 @@ static void gamutColorChanged( Gtk::ColorButton* btn ) { gchar* tmp = g_strdup_printf("#%02x%02x%02x", (r >> 8), (g >> 8), (b >> 8) ); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setString("options.softproof", "gamutcolor", tmp); + prefs->setString("/options/softproof/gamutcolor", tmp); g_free(tmp); } #endif // ENABLE_LCMS @@ -771,7 +795,7 @@ void InkscapePreferences::initPageCMS() _page_cms.add_line( false, _("Display profile:"), _cms_display_profile, "", _("The ICC profile to use to calibrate display output."), false); - _cms_from_display.init( _("Retrieve profile from display"), "options.displayprofile", "from_display", false); + _cms_from_display.init( _("Retrieve profile from display"), "/options/displayprofile/from_display", false); _page_cms.add_line( false, "", _cms_from_display, "", #ifdef GDK_WINDOWING_X11 _("Retrieve profiles from those attached to displays via XICC."), false); @@ -780,21 +804,21 @@ void InkscapePreferences::initPageCMS() #endif // GDK_WINDOWING_X11 - _cms_intent.init("options.displayprofile", "intent", intentLabels, intentValues, numIntents, 0); + _cms_intent.init("/options/displayprofile/intent", intentLabels, intentValues, numIntents, 0); _page_cms.add_line( false, _("Display rendering intent:"), _cms_intent, "", _("The rendering intent to use to calibrate display output."), false); _page_cms.add_group_header( _("Proofing")); - _cms_softproof.init( _("Simulate output on screen"), "options.softproof", "enable", false); + _cms_softproof.init( _("Simulate output on screen"), "/options/softproof/enable", false); _page_cms.add_line( false, "", _cms_softproof, "", _("Simulates output of target device."), false); - _cms_gamutwarn.init( _("Mark out of gamut colors"), "options.softproof", "gamutwarn", false); + _cms_gamutwarn.init( _("Mark out of gamut colors"), "/options/softproof/gamutwarn", false); _page_cms.add_line( false, "", _cms_gamutwarn, "", _("Highlights colors that are out of gamut for the target device."), false); - Glib::ustring colorStr = prefs->getString("options.softproof", "gamutcolor"); + Glib::ustring colorStr = prefs->getString("/options/softproof/gamutcolor"); Gdk::Color tmpColor( colorStr.empty() ? "#00ff00" : colorStr); _cms_gamutcolor.set_color( tmpColor ); _page_cms.add_line( true, _("Out of gamut warning color:"), _cms_gamutcolor, "", @@ -803,15 +827,15 @@ void InkscapePreferences::initPageCMS() _page_cms.add_line( false, _("Device profile:"), _cms_proof_profile, "", _("The ICC profile to use to simulate device output."), false); - _cms_proof_intent.init("options.softproof", "intent", intentLabels, intentValues, numIntents, 0); + _cms_proof_intent.init("/options/softproof/intent", intentLabels, intentValues, numIntents, 0); _page_cms.add_line( false, _("Device rendering intent:"), _cms_proof_intent, "", _("The rendering intent to use to calibrate display output."), false); - _cms_proof_blackpoint.init( _("Black point compensation"), "options.softproof", "bpc", false); + _cms_proof_blackpoint.init( _("Black point compensation"), "/options/softproof/bpc", false); _page_cms.add_line( false, "", _cms_proof_blackpoint, "", _("Enables black point compensation."), false); - _cms_proof_preserveblack.init( _("Preserve black"), "options.softproof", "preserveblack", false); + _cms_proof_preserveblack.init( _("Preserve black"), "/options/softproof/preserveblack", false); _page_cms.add_line( false, "", _cms_proof_preserveblack, #if defined(cmsFLAGS_PRESERVEBLACK) "", @@ -828,7 +852,7 @@ void InkscapePreferences::initPageCMS() #if ENABLE_LCMS { std::vector<Glib::ustring> names = ::Inkscape::colorprofile_get_display_names(); - Glib::ustring current = prefs->getString( "options.displayprofile", "uri" ); + Glib::ustring current = prefs->getString( "/options/displayprofile/uri" ); gint index = 0; _cms_display_profile.append_text(_("<none>")); @@ -846,7 +870,7 @@ void InkscapePreferences::initPageCMS() } names = ::Inkscape::colorprofile_get_softproof_names(); - current = prefs->getString("options.softproof", "uri"); + current = prefs->getString("/options/softproof/uri"); index = 0; for ( std::vector<Glib::ustring>::iterator it = names.begin(); it != names.end(); ++it ) { _cms_proof_profile.append_text( *it ); @@ -883,7 +907,7 @@ void InkscapePreferences::initPageGrids() { _page_grids.add_group_header( _("Major grid line emphasizing")); - _grids_no_emphasize_on_zoom.init( _("Don't emphasize gridlines when zoomed out"), "options.grids", "no_emphasize_when_zoomedout", false); + _grids_no_emphasize_on_zoom.init( _("Don't emphasize gridlines when zoomed out"), "/options/grids/no_emphasize_when_zoomedout", false); _page_grids.add_line( false, "", _grids_no_emphasize_on_zoom, "", _("If set and zoomed out, the gridlines will be shown in normal color instead of major grid line color."), false); _page_grids.add_group_header( _("Default grid settings")); @@ -891,44 +915,44 @@ void InkscapePreferences::initPageGrids() _page_grids.add_line( false, "", _grids_notebook, "", "", false); _grids_notebook.append_page(_grids_xy, CanvasGrid::getName( GRID_RECTANGULAR )); _grids_notebook.append_page(_grids_axonom, CanvasGrid::getName( GRID_AXONOMETRIC )); - _grids_xy_units.init("options.grids.xy", "units"); + _grids_xy_units.init("/options/grids/units"); _grids_xy.add_line( false, _("Grid units:"), _grids_xy_units, "", "", false); - _grids_xy_origin_x.init("options.grids.xy", "origin_x", -10000.0, 10000.0, 0.1, 1.0, 0.0, false, false); - _grids_xy_origin_y.init("options.grids.xy", "origin_y", -10000.0, 10000.0, 0.1, 1.0, 0.0, false, false); + _grids_xy_origin_x.init("/options/grids/xy/origin_x", -10000.0, 10000.0, 0.1, 1.0, 0.0, false, false); + _grids_xy_origin_y.init("/options/grids/xy/origin_y", -10000.0, 10000.0, 0.1, 1.0, 0.0, false, false); _grids_xy.add_line( false, _("Origin X:"), _grids_xy_origin_x, "", _("X coordinate of grid origin"), false); _grids_xy.add_line( false, _("Origin Y:"), _grids_xy_origin_y, "", _("Y coordinate of grid origin"), false); - _grids_xy_spacing_x.init("options.grids.xy", "spacing_x", -10000.0, 10000.0, 0.1, 1.0, 1.0, false, false); - _grids_xy_spacing_y.init("options.grids.xy", "spacing_y", -10000.0, 10000.0, 0.1, 1.0, 1.0, false, false); + _grids_xy_spacing_x.init("/options/grids/xy/spacing_x", -10000.0, 10000.0, 0.1, 1.0, 1.0, false, false); + _grids_xy_spacing_y.init("/options/grids/xy/spacing_y", -10000.0, 10000.0, 0.1, 1.0, 1.0, false, false); _grids_xy.add_line( false, _("Spacing X:"), _grids_xy_spacing_x, "", _("Distance between vertical grid lines"), false); _grids_xy.add_line( false, _("Spacing Y:"), _grids_xy_spacing_y, "", _("Distance between horizontal grid lines"), false); - _grids_xy_color.init(_("Grid line color:"), "options.grids.xy", "color", 0x0000ff20); + _grids_xy_color.init(_("Grid line color:"), "/options/grids/xy/color", 0x0000ff20); _grids_xy.add_line( false, _("Grid line color:"), _grids_xy_color, "", _("Color used for normal grid lines"), false); - _grids_xy_empcolor.init(_("Major grid line color:"), "options.grids.xy", "empcolor", 0x0000ff40); + _grids_xy_empcolor.init(_("Major grid line color:"), "/options/grids/xy/empcolor", 0x0000ff40); _grids_xy.add_line( false, _("Major grid line color:"), _grids_xy_empcolor, "", _("Color used for major (highlighted) grid lines"), false); - _grids_xy_empspacing.init("options.grids.xy", "empspacing", 1.0, 1000.0, 1.0, 5.0, 5.0, true, false); + _grids_xy_empspacing.init("/options/grids/xy/empspacing", 1.0, 1000.0, 1.0, 5.0, 5.0, true, false); _grids_xy.add_line( false, _("Major grid line every:"), _grids_xy_empspacing, "", "", false); - _grids_xy_dotted.init( _("Show dots instead of lines"), "options.grids.xy", "dotted", false); + _grids_xy_dotted.init( _("Show dots instead of lines"), "/options/grids/xy/dotted", false); _grids_xy.add_line( false, "", _grids_xy_dotted, "", _("If set, display dots at gridpoints instead of gridlines"), false); // CanvasAxonomGrid properties: - _grids_axonom_units.init("options.grids.axonom", "units"); + _grids_axonom_units.init("/options/grids/axonom/units"); _grids_axonom.add_line( false, _("Grid units:"), _grids_axonom_units, "", "", false); - _grids_axonom_origin_x.init("options.grids.axonom", "origin_x", -10000.0, 10000.0, 0.1, 1.0, 0.0, false, false); - _grids_axonom_origin_y.init("options.grids.axonom", "origin_y", -10000.0, 10000.0, 0.1, 1.0, 0.0, false, false); + _grids_axonom_origin_x.init("/options/grids/axonom/origin_x", -10000.0, 10000.0, 0.1, 1.0, 0.0, false, false); + _grids_axonom_origin_y.init("/options/grids/axonom/origin_y", -10000.0, 10000.0, 0.1, 1.0, 0.0, false, false); _grids_axonom.add_line( false, _("Origin X:"), _grids_axonom_origin_x, "", _("X coordinate of grid origin"), false); _grids_axonom.add_line( false, _("Origin Y:"), _grids_axonom_origin_y, "", _("Y coordinate of grid origin"), false); - _grids_axonom_spacing_y.init("options.grids.axonom", "spacing_y", -10000.0, 10000.0, 0.1, 1.0, 1.0, false, false); + _grids_axonom_spacing_y.init("/options/grids/axonom/spacing_y", -10000.0, 10000.0, 0.1, 1.0, 1.0, false, false); _grids_axonom.add_line( false, _("Spacing Y:"), _grids_axonom_spacing_y, "", _("Base length of z-axis"), false); - _grids_axonom_angle_x.init("options.grids.axonom", "angle_x", -360.0, 360.0, 1.0, 10.0, 30.0, false, false); - _grids_axonom_angle_z.init("options.grids.axonom", "angle_z", -360.0, 360.0, 1.0, 10.0, 30.0, false, false); + _grids_axonom_angle_x.init("/options/grids/axonom/angle_x", -360.0, 360.0, 1.0, 10.0, 30.0, false, false); + _grids_axonom_angle_z.init("/options/grids/axonom/angle_z", -360.0, 360.0, 1.0, 10.0, 30.0, false, false); _grids_axonom.add_line( false, _("Angle X:"), _grids_axonom_angle_x, "", _("Angle of x-axis"), false); _grids_axonom.add_line( false, _("Angle Z:"), _grids_axonom_angle_z, "", _("Angle of z-axis"), false); - _grids_axonom_color.init(_("Grid line color:"), "options.grids.axonom", "color", 0x0000ff20); + _grids_axonom_color.init(_("Grid line color:"), "/options/grids/axonom/color", 0x0000ff20); _grids_axonom.add_line( false, _("Grid line color:"), _grids_axonom_color, "", _("Color used for normal grid lines"), false); - _grids_axonom_empcolor.init(_("Major grid line color:"), "options.grids.axonom", "empcolor", 0x0000ff40); + _grids_axonom_empcolor.init(_("Major grid line color:"), "/options/grids/axonom/empcolor", 0x0000ff40); _grids_axonom.add_line( false, _("Major grid line color:"), _grids_axonom_empcolor, "", _("Color used for major (highlighted) grid lines"), false); - _grids_axonom_empspacing.init("options.grids.axonom", "empspacing", 1.0, 1000.0, 1.0, 5.0, 5.0, true, false); + _grids_axonom_empspacing.init("/options/grids/axonom/empspacing", 1.0, 1000.0, 1.0, 5.0, 5.0, true, false); _grids_axonom.add_line( false, _("Major grid line every:"), _grids_axonom_empspacing, "", "", false); this->AddPage(_page_grids, _("Grids"), PREFS_PAGE_GRIDS); @@ -936,31 +960,31 @@ void InkscapePreferences::initPageGrids() void InkscapePreferences::initPageSVGOutput() { - _svgoutput_usenamedcolors.init( _("Use named colors"), "options.svgoutput", "usenamedcolors", false); + _svgoutput_usenamedcolors.init( _("Use named colors"), "/options/svgoutput/usenamedcolors", false); _page_svgoutput.add_line( false, "", _svgoutput_usenamedcolors, "", _("If set, write the CSS name of the color when available (e.g. 'red' or 'magenta') instead of the numeric value"), false); _page_svgoutput.add_group_header( _("XML formatting")); - _svgoutput_inlineattrs.init( _("Inline attributes"), "options.svgoutput", "inlineattrs", false); + _svgoutput_inlineattrs.init( _("Inline attributes"), "/options/svgoutput/inlineattrs", false); _page_svgoutput.add_line( false, "", _svgoutput_inlineattrs, "", _("Put attributes on the same line as the element tag"), false); - _svgoutput_indent.init("options.svgoutput", "indent", 0.0, 1000.0, 1.0, 2.0, 2.0, true, false); + _svgoutput_indent.init("/options/svgoutput/indent", 0.0, 1000.0, 1.0, 2.0, 2.0, true, false); _page_svgoutput.add_line( false, _("Indent, spaces:"), _svgoutput_indent, "", _("The number of spaces to use for indenting nested elements; set to 0 for no indentation"), false); _page_svgoutput.add_group_header( _("Path data")); - _svgoutput_allowrelativecoordinates.init( _("Allow relative coordinates"), "options.svgoutput", "allowrelativecoordinates", true); + _svgoutput_allowrelativecoordinates.init( _("Allow relative coordinates"), "/options/svgoutput/allowrelativecoordinates", true); _page_svgoutput.add_line( false, "", _svgoutput_allowrelativecoordinates, "", _("If set, relative coordinates may be used in path data"), false); - _svgoutput_forcerepeatcommands.init( _("Force repeat commands"), "options.svgoutput", "forcerepeatcommands", false); + _svgoutput_forcerepeatcommands.init( _("Force repeat commands"), "/options/svgoutput/forcerepeatcommands", false); _page_svgoutput.add_line( false, "", _svgoutput_forcerepeatcommands, "", _("Force repeating of the same path command (for example, 'L 1,2 L 3,4' instead of 'L 1,2 3,4')"), false); _page_svgoutput.add_group_header( _("Numbers")); - _svgoutput_numericprecision.init("options.svgoutput", "numericprecision", 1.0, 16.0, 1.0, 2.0, 8.0, true, false); + _svgoutput_numericprecision.init("/options/svgoutput/numericprecision", 1.0, 16.0, 1.0, 2.0, 8.0, true, false); _page_svgoutput.add_line( false, _("Numeric precision:"), _svgoutput_numericprecision, "", _("How many digits to write after the decimal dot"), false); - _svgoutput_minimumexponent.init("options.svgoutput", "minimumexponent", -32.0, -1, 1.0, 2.0, -8.0, true, false); + _svgoutput_minimumexponent.init("/options/svgoutput/minimumexponent", -32.0, -1, 1.0, 2.0, -8.0, true, false); _page_svgoutput.add_line( false, _("Minimum exponent:"), _svgoutput_minimumexponent, "", _("The smallest number written to SVG is 10 to the power of this exponent; anything smaller is written as zero."), false); this->AddPage(_page_svgoutput, _("SVG output"), PREFS_PAGE_SVGOUTPUT); @@ -971,19 +995,19 @@ void InkscapePreferences::initPageUI() Glib::ustring sizeLabels[] = {_("Normal"), _("Medium"), _("Small")}; int sizeValues[] = {0, 1, 2}; - _misc_small_toolbar.init( "toolbox", "small", sizeLabels, sizeValues, G_N_ELEMENTS(sizeLabels), 0 ); + _misc_small_toolbar.init( "/toolbox/small", sizeLabels, sizeValues, G_N_ELEMENTS(sizeLabels), 0 ); _page_ui.add_line( false, _("Commands bar icon size"), _misc_small_toolbar, "", _("Set the size for the commands toolbar to use (requires restart)"), false); - _misc_small_secondary.init( "toolbox", "secondary", sizeLabels, sizeValues, G_N_ELEMENTS(sizeLabels), 1 ); + _misc_small_secondary.init( "/toolbox/secondary", sizeLabels, sizeValues, G_N_ELEMENTS(sizeLabels), 1 ); _page_ui.add_line( false, _("Tool controls bar icon size"), _misc_small_secondary, "", _("Set the size for the secondary toolbar to use (requires restart)"), false); - _misc_small_tools.init( "toolbox.tools", "small", sizeLabels, sizeValues, G_N_ELEMENTS(sizeLabels), 0 ); + _misc_small_tools.init( "/toolbox/tools/small", sizeLabels, sizeValues, G_N_ELEMENTS(sizeLabels), 0 ); _page_ui.add_line( false, _("Main toolbar icon size"), _misc_small_tools, "", _("Set the size for the main tools to use (requires restart)"), false); - _misc_recent.init("options.maxrecentdocuments", "value", 0.0, 1000.0, 1.0, 1.0, 1.0, true, false); + _misc_recent.init("/options/maxrecentdocuments/value", 0.0, 1000.0, 1.0, 1.0, 1.0, true, false); _page_ui.add_line( false, _("Maximum documents in Open Recent:"), _misc_recent, "", _("The maximum length of the Open Recent list in the File menu"), false); @@ -998,13 +1022,13 @@ void InkscapePreferences::initPageUI() void InkscapePreferences::initPageAutosave() { // Autosave options - _autosave_autosave_enable.init( _("Enable autosave (requires restart)"), "options.autosave", "enable", false); + _autosave_autosave_enable.init( _("Enable autosave (requires restart)"), "/options/autosave/enable", false); _page_autosave.add_line(false, "", _autosave_autosave_enable, "", _("Automatically save the current document(s) at a given interval, thus minimizing loss in case of a crash"), false); - _autosave_autosave_interval.init("options.autosave", "interval", 1.0, 10800.0, 1.0, 10.0, 10.0, true, false); + _autosave_autosave_interval.init("/options/autosave/interval", 1.0, 10800.0, 1.0, 10.0, 10.0, true, false); _page_autosave.add_line(true, _("Interval (in minutes):"), _autosave_autosave_interval, "", _("Interval (in minutes) at which document will be autosaved"), false); - _autosave_autosave_path.init("options.autosave", "path", true); + _autosave_autosave_path.init("/options/autosave/path", true); _page_autosave.add_line(true, _("Path:"), _autosave_autosave_path, "", _("The directory where autosaves will be written"), false); - _autosave_autosave_max.init("options.autosave", "max", 1.0, 100.0, 1.0, 10.0, 10.0, true, false); + _autosave_autosave_max.init("/options/autosave/max", 1.0, 100.0, 1.0, 10.0, 10.0, true, false); _page_autosave.add_line(true, _("Maximum number of autosaves:"), _autosave_autosave_max, "", _("Maximum number of autosaved files; use this to limit the storage space used"), false); /* When changing the interval or enabling/disabling the autosave function, @@ -1012,9 +1036,7 @@ void InkscapePreferences::initPageAutosave() * * FIXME! * the inkscape_autosave_init should be called AFTER the values have been changed - * (which cannot be guaranteed from here) - * - * For now, autosave-settings will not change until restart + * (which cannot be guaranteed from here) - use a PrefObserver somewhere */ /* _autosave_autosave_enable.signal_toggled().connect( sigc::ptr_fun(inkscape_autosave_init), TRUE ); @@ -1032,15 +1054,15 @@ void InkscapePreferences::initPageBitmaps() Glib::ustring labels[] = {_("None"), _("2x2"), _("4x4"), _("8x8"), _("16x16")}; int values[] = {0, 1, 2, 3, 4}; _misc_overs_bitmap.set_size_request(_sb_width); - _misc_overs_bitmap.init("options.bitmapoversample", "value", labels, values, G_N_ELEMENTS(values), 1); + _misc_overs_bitmap.init("/options/bitmapoversample/value", labels, values, G_N_ELEMENTS(values), 1); _page_bitmaps.add_line( false, _("Oversample bitmaps:"), _misc_overs_bitmap, "", "", false); } - _misc_bitmap_autoreload.init(_("Automatically reload bitmaps"), "options.bitmapautoreload", "value", true); + _misc_bitmap_autoreload.init(_("Automatically reload bitmaps"), "/options/bitmapautoreload/value", true); _page_bitmaps.add_line( false, "", _misc_bitmap_autoreload, "", _("Automatically reload linked images when file is changed on disk")); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - Glib::ustring choices = prefs->getString("options.bitmapeditor", "choices"); + Glib::ustring choices = prefs->getString("/options/bitmapeditor/choices"); if (!choices.empty()) { gchar** splits = g_strsplit(choices.data(), ",", 0); gint numIems = g_strv_length(splits); @@ -1051,13 +1073,13 @@ void InkscapePreferences::initPageBitmaps() values[i] = i; labels[i] = splits[i]; } - _misc_bitmap_editor.init("options.bitmapeditor", "value", labels, values, numIems, 0); + _misc_bitmap_editor.init("/options/bitmapeditor/value", labels, values, numIems, 0); _page_bitmaps.add_line( false, _("Bitmap editor:"), _misc_bitmap_editor, "", "", false); g_strfreev(splits); } - _bitmap_copy_res.init("options.createbitmap", "resolution", 1.0, 6000.0, 1.0, 1.0, PX_PER_IN, true, false); + _bitmap_copy_res.init("/options/createbitmap/resolution", 1.0, 6000.0, 1.0, 1.0, PX_PER_IN, true, false); _page_bitmaps.add_line( false, _("Resolution for Create Bitmap Copy:"), _bitmap_copy_res, _("dpi"), _("Resolution used by the Create Bitmap Copy command"), false); @@ -1067,23 +1089,23 @@ void InkscapePreferences::initPageBitmaps() void InkscapePreferences::initPageMisc() { - _misc_comment.init( _("Add label comments to printing output"), "printing.debug", "show-label-comments", false); + _misc_comment.init( _("Add label comments to printing output"), "/printing/debug/show-label-comments", false); _page_misc.add_line( false, "", _misc_comment, "", _("When on, a comment will be added to the raw print output, marking the rendered output for an object with its label"), true); - _misc_forkvectors.init( _("Prevent sharing of gradient definitions"), "options.forkgradientvectors", "value", true); + _misc_forkvectors.init( _("Prevent sharing of gradient definitions"), "/options/forkgradientvectors/value", true); _page_misc.add_line( false, "", _misc_forkvectors, "", _("When on, shared gradient definitions are automatically forked on change; uncheck to allow sharing of gradient definitions so that editing one object may affect other objects using the same gradient"), true); - _misc_simpl.init("options.simplifythreshold", "value", 0.0001, 1.0, 0.0001, 0.0010, 0.0010, false, false); + _misc_simpl.init("/options/simplifythreshold/value", 0.0001, 1.0, 0.0001, 0.0010, 0.0010, false, false); _page_misc.add_line( false, _("Simplification threshold:"), _misc_simpl, "", _("How strong is the Simplify command by default. If you invoke this command several times in quick succession, it will act more and more aggressively; invoking it again after a pause restores the default threshold."), false); - _misc_latency_skew.init("debug.latency", "skew", 0.5, 2.0, 0.01, 0.10, 1.0, false, false); + _misc_latency_skew.init("/debug/latency/skew", 0.5, 2.0, 0.01, 0.10, 1.0, false, false); _page_misc.add_line( false, _("Latency skew:"), _misc_latency_skew, _("(requires restart)"), _("Factor by which the event clock is skewed from the actual time (0.9766 on some systems)."), false); - _misc_namedicon_delay.init( _("Pre-render named icons"), "options.iconrender", "named_nodelay", false); + _misc_namedicon_delay.init( _("Pre-render named icons"), "/options/iconrender/named_nodelay", false); _page_misc.add_line( false, "", _misc_namedicon_delay, "", _("When on, named icons will be rendered before displaying the ui. This is for working around bugs in GTK+ named icon notification"), true); @@ -1108,7 +1130,7 @@ bool InkscapePreferences::PresentPage(const Gtk::TreeModel::iterator& iter) { Gtk::TreeModel::Row row = *iter; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - int desired_page = prefs->getInt("dialogs.preferences", "page", 0); + int desired_page = prefs->getInt("/dialogs/preferences/page", 0); if (desired_page == row[_page_list_columns._col_id]) { if (desired_page >= PREFS_PAGE_TOOLS && desired_page <= PREFS_PAGE_TOOLS_DROPPER) @@ -1133,7 +1155,7 @@ void InkscapePreferences::on_pagelist_selection_changed() Gtk::TreeModel::Row row = *iter; _current_page = row[_page_list_columns._col_page]; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setInt("dialogs.preferences", "page", row[_page_list_columns._col_id]); + prefs->setInt("/dialogs/preferences/page", row[_page_list_columns._col_id]); _page_title.set_markup("<span size='large'><b>" + row[_page_list_columns._col_name] + "</b></span>"); _page_frame.add(*_current_page); _current_page->show(); diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index 02794d0e2..98ecda855 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -1,7 +1,7 @@ -/** - * brief Inkscape Preferences dialog - * - * Authors: +/** @file + * @brief Inkscape Preferences dialog + */ +/* Authors: * Carl Hetherington * Marco Scholten * Johan Engelen <j.b.c.engelen@ewi.utwente.nl> @@ -158,6 +158,7 @@ protected: PrefCheckButton _mask_mask_remove; PrefRadioButton _blur_quality_best, _blur_quality_better, _blur_quality_normal, _blur_quality_worse, _blur_quality_worst; + PrefRadioButton _filter_quality_best, _filter_quality_better, _filter_quality_normal, _filter_quality_worse, _filter_quality_worst; PrefCheckButton _show_filters_info_box; PrefCheckButton _trans_scale_stroke, _trans_scale_corner, _trans_gradient,_trans_pattern; diff --git a/src/ui/dialog/input.cpp b/src/ui/dialog/input.cpp index 25f123797..ae8594e50 100644 --- a/src/ui/dialog/input.cpp +++ b/src/ui/dialog/input.cpp @@ -1,4 +1,37 @@ +/** @file + * @brief Input devices dialog (new) - implementation + */ +/* Author: + * Jon A. Cruz + * + * Copyright (C) 2008 Author + * Released under GNU GPL. Read the file 'COPYING' for more information. + */ +#include <map> +#include <set> +#include <glib/gprintf.h> +#include <glibmm/i18n.h> +#include <gtkmm/comboboxtext.h> +#include <gtkmm/enums.h> +#include <gtkmm/eventbox.h> +#include <gtkmm/frame.h> +#include <gtkmm/image.h> +#include <gtkmm/menubar.h> +#include <gtkmm/notebook.h> +#include <gtkmm/paned.h> +#include <gtkmm/progressbar.h> +#include <gtkmm/scrolledwindow.h> +#include <gtkmm/table.h> +#include <gtkmm/treemodel.h> +#include <gtkmm/treemodelcolumn.h> +#include <gtkmm/treestore.h> +#include <gtkmm/treeview.h> + +#include "ui/widget/panel.h" +#include "device-manager.h" + +#include "input.h" /* XPM */ static char const * core_xpm[] = { @@ -282,35 +315,6 @@ static char const * axis_on_xpm[] = { " .................... ", " "}; - - - - -#include <map> -#include <set> -#include <glib/gprintf.h> -#include <glibmm/i18n.h> -#include <gtkmm/comboboxtext.h> -#include <gtkmm/enums.h> -#include <gtkmm/eventbox.h> -#include <gtkmm/frame.h> -#include <gtkmm/image.h> -#include <gtkmm/menubar.h> -#include <gtkmm/notebook.h> -#include <gtkmm/paned.h> -#include <gtkmm/progressbar.h> -#include <gtkmm/scrolledwindow.h> -#include <gtkmm/table.h> -#include <gtkmm/treemodel.h> -#include <gtkmm/treemodelcolumn.h> -#include <gtkmm/treestore.h> -#include <gtkmm/treeview.h> - -#include "ui/widget/panel.h" -#include "device-manager.h" - -#include "input.h" - using Inkscape::InputDevice; namespace Inkscape { diff --git a/src/ui/dialog/input.h b/src/ui/dialog/input.h index b3cd97a44..38666f52c 100644 --- a/src/ui/dialog/input.h +++ b/src/ui/dialog/input.h @@ -1,3 +1,12 @@ +/** @file + * @brief Input devices dialog (new) + */ +/* Author: + * Jon A. Cruz + * + * Copyright (C) 2008 Author + * Released under GNU GPL. Read the file 'COPYING' for more information. + */ #ifndef INKSCAPE_UI_DIALOG_INPUT_H #define INKSCAPE_UI_DIALOG_INPUT_H @@ -16,7 +25,7 @@ class InputDialog : public UI::Widget::Panel public: static InputDialog &getInstance(); - InputDialog() : UI::Widget::Panel("", "dialogs.inputdevices2", SP_VERB_DIALOG_INPUT2) {} + InputDialog() : UI::Widget::Panel("", "/dialogs/inputdevices2", SP_VERB_DIALOG_INPUT2) {} virtual ~InputDialog() {} }; diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index 73d26b67e..8a7e0adeb 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -1,13 +1,12 @@ -/** - * \brief LivePathEffect dialog - * - * Authors: +/** @file + * @brief Live Path Effect editing dialog - implementation + */ +/* Authors: * Johan Engelen <j.b.c.engelen@utwente.nl> * Steren Giannini <steren.giannini@gmail.com> * Bastien Bouclet <bgkweb@gmail.com> * - * Copyright (C) 2007 Author - * + * Copyright (C) 2007 Authors * Released under GNU GPL. Read the file 'COPYING' for more information. */ @@ -68,7 +67,7 @@ static void lpeeditor_selection_modified (Inkscape::Selection * selection, guint */ LivePathEffectEditor::LivePathEffectEditor() - : UI::Widget::Panel("", "dialogs.livepatheffect", SP_VERB_DIALOG_LIVE_PATH_EFFECT), + : UI::Widget::Panel("", "/dialogs/livepatheffect", SP_VERB_DIALOG_LIVE_PATH_EFFECT), lpe_list_locked(false), combo_effecttype(Inkscape::LivePathEffect::LPETypeConverter), effectwidget(NULL), diff --git a/src/ui/dialog/livepatheffect-editor.h b/src/ui/dialog/livepatheffect-editor.h index 49db74fca..370bd599a 100644 --- a/src/ui/dialog/livepatheffect-editor.h +++ b/src/ui/dialog/livepatheffect-editor.h @@ -1,11 +1,10 @@ -/** - * \brief LivePathEffect dialog - * - * Author: +/** @file + * @brief Live Path Effect editing dialog + */ +/* Author: * Johan Engelen <j.b.c.engelen@ewi.utwente.nl> * * Copyright (C) 2007 Author - * * Released under GNU GPL. Read the file 'COPYING' for more information. */ diff --git a/src/ui/dialog/memory.cpp b/src/ui/dialog/memory.cpp index 1931976d6..a80c7b449 100644 --- a/src/ui/dialog/memory.cpp +++ b/src/ui/dialog/memory.cpp @@ -1,7 +1,7 @@ -/** - * \brief Memory statistics dialog - * - * Authors: +/** @file + * @brief Memory statistics dialog + */ +/* Authors: * MenTaLguY <mental@rydia.net> * * Copyright (C) 2005 @@ -204,7 +204,7 @@ void Memory::Private::stop_update_task() { } Memory::Memory() - : UI::Widget::Panel ("", "dialogs.memory", SP_VERB_HELP_MEMORY, _("Recalculate")), + : UI::Widget::Panel ("", "/dialogs/memory", SP_VERB_HELP_MEMORY, _("Recalculate")), _private(*(new Memory::Private())) { _getContents()->add(_private.view); diff --git a/src/ui/dialog/memory.h b/src/ui/dialog/memory.h index 6f832f3e1..48dcc8f09 100644 --- a/src/ui/dialog/memory.h +++ b/src/ui/dialog/memory.h @@ -1,11 +1,10 @@ -/** - * \brief Memory statistics dialog - * - * Authors: +/** @file + * @brief Memory statistics dialog + */ +/* Authors: * MenTaLguY <mental@rydia.net> * * Copyright 2005 Authors - * * Released under GNU GPL. Read the file 'COPYING' for more information. */ diff --git a/src/ui/dialog/messages.cpp b/src/ui/dialog/messages.cpp index 7eaf23f50..958256310 100644 --- a/src/ui/dialog/messages.cpp +++ b/src/ui/dialog/messages.cpp @@ -1,9 +1,7 @@ -/* - * A very simple dialog for displaying Inkscape messages. Messages - * sent to g_log(), g_warning(), g_message(), ets, are routed here, - * in order to avoid messing with the startup console. - * - * Authors: +/** @file + * @brief Messages dialog - implementation + */ +/* Authors: * Bob Jamison * Other dudes from The Inkscape Organization * @@ -46,7 +44,7 @@ void Messages::clear() * Constructor */ Messages::Messages() - : UI::Widget::Panel("", "dialogs.messages", SP_VERB_DIALOG_DEBUG) + : UI::Widget::Panel("", "/dialogs/messages", SP_VERB_DIALOG_DEBUG) { Gtk::Box *contents = _getContents(); @@ -183,6 +181,13 @@ void Messages::releaseLogMessages() } //namespace UI } //namespace Inkscape -//######################################################################### -//## E N D O F F I L E -//######################################################################### +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/messages.h b/src/ui/dialog/messages.h index 8dcb718cc..b0a9d812b 100644 --- a/src/ui/dialog/messages.h +++ b/src/ui/dialog/messages.h @@ -1,16 +1,15 @@ -/* - * \brief Messages Dialog +/** @file + * @brief Messages dialog * * A very simple dialog for displaying Inkscape messages. Messages * sent to g_log(), g_warning(), g_message(), ets, are routed here, * in order to avoid messing with the startup console. - * - * Authors: + */ +/* Authors: * Bob Jamison * Other dudes from The Inkscape Organization * * Copyright (C) 2004, 2005 Authors - * * Released under GNU GPL, read the file 'COPYING' for more information */ diff --git a/src/ui/dialog/ocaldialogs.cpp b/src/ui/dialog/ocaldialogs.cpp index de22c16d6..ba572336c 100644 --- a/src/ui/dialog/ocaldialogs.cpp +++ b/src/ui/dialog/ocaldialogs.cpp @@ -1,7 +1,7 @@ -/** - * Implementation of the ocal dialog interfaces defined in ocaldialog.h - * - * Authors: +/** @file + * @brief Open Clip Art Library integration dialogs - implementation + */ +/* Authors: * Bruno Dilly * Other dudes from The Inkscape Organization * @@ -309,7 +309,7 @@ void FileListViewText::on_cursor_changed() //Inkscape::Preferences *prefs = Inkscape::Preferences::get(); //Glib::ustring fileUrl = "dav://"; //dav url - //fileUrl.append(prefs->getString("options.ocalurl", "str")); + //fileUrl.append(prefs->getString("/options/ocalurl/str")); //fileUrl.append("/dav.php/"); //fileUrl.append(get_text(posArray[0], 3)); //author dir //fileUrl.append("/"); @@ -425,7 +425,7 @@ void FileImportFromOCALDialog::searchTagEntryChangedCallback() Glib::ustring searchTag = searchTagEntry->get_text(); // create the ocal uri to get rss feed Glib::ustring uri = "http://"; - uri.append(prefs->getString("options.ocalurl", "str")); + uri.append(prefs->getString("/options/ocalurl/str")); uri.append("/media/feed/rss/"); uri.append(searchTag); if (!Glib::get_charset()) //If we are not utf8 diff --git a/src/ui/dialog/ocaldialogs.h b/src/ui/dialog/ocaldialogs.h index 0953e76bc..75d57fc59 100644 --- a/src/ui/dialog/ocaldialogs.h +++ b/src/ui/dialog/ocaldialogs.h @@ -1,17 +1,16 @@ -#ifndef __OCAL_DIALOG_H__ -#define __OCAL_DIALOG_H__ -/** - * Defines the FileExportToOCALDialog, FileImportFromOCALDialog and - * FileExportToOCALPasswordDialog and their supporting classes. - * - * Authors: +/** @file + * @brief Open Clip Art Library integration dialogs + */ +/* Authors: * Bruno Dilly <bruno.dilly@gmail.com> * Inkscape Guys * * Copyright (C) 2007 Bruno Dilly <bruno.dilly@gmail.com> - * * Released under GNU GPL, read the file 'COPYING' for more information */ + +#ifndef __OCAL_DIALOG_H__ +#define __OCAL_DIALOG_H__ #include <glibmm.h> #include <vector> @@ -45,7 +44,6 @@ #endif //Inkscape includes -#include "prefs-utils.h" #include <extension/input.h> #include <extension/output.h> #include <extension/db.h> diff --git a/src/ui/dialog/panel-dialog.h b/src/ui/dialog/panel-dialog.h index eebd323d6..f087f40e4 100644 --- a/src/ui/dialog/panel-dialog.h +++ b/src/ui/dialog/panel-dialog.h @@ -1,11 +1,10 @@ -/** - * \brief A panel holding dialog - * - * Authors: +/** @file + * @brief A panel holding dialog + */ +/* Authors: * Gustav Broberg <broberg@kth.se> * * Copyright (C) 2007 Authors - * * Released under GNU GPL. Read the file 'COPYING' for more information. */ @@ -23,7 +22,7 @@ #include "dialogs/swatches.h" #include "ui/dialog/floating-behavior.h" #include "ui/dialog/dock-behavior.h" -#include "prefs-utils.h" +#include "preferences.h" namespace Inkscape { namespace UI { @@ -147,7 +146,8 @@ PanelDialog<B>::PanelDialog(Panel &panel, char const *prefs_path, int const verb _document_replaced_connection = desktop->connectDocumentReplaced(sigc::mem_fun(*this, &PanelDialog::_propagateDocumentReplaced)); - if (prefs_get_int_attribute ("dialogs", "showclose", 0) || !apply_label.empty()) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + if (prefs->getBool("/dialogs/showclose") || !apply_label.empty()) { // TODO: make the order of buttons obey the global preference if (!apply_label.empty()) { panel.addResponseButton(apply_label, Gtk::RESPONSE_APPLY); @@ -198,7 +198,8 @@ PanelDialog<Behavior::FloatingBehavior>::PanelDialog(Panel &panel, char const *p _document_replaced_connection = desktop->connectDocumentReplaced(sigc::mem_fun(*this, &PanelDialog::_propagateDocumentReplaced)); - if (prefs_get_int_attribute ("dialogs", "showclose", 0) || !apply_label.empty()) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + if (prefs->getBool("/dialogs/showclose") || !apply_label.empty()) { // TODO: make the order of buttons obey the global preference if (!apply_label.empty()) { panel.addResponseButton(apply_label, Gtk::RESPONSE_APPLY); diff --git a/src/ui/dialog/print.cpp b/src/ui/dialog/print.cpp index 9e848bd6a..b2094f540 100644 --- a/src/ui/dialog/print.cpp +++ b/src/ui/dialog/print.cpp @@ -1,11 +1,10 @@ -/** - * \brief Print dialog - * - * Authors: +/** @file + * @brief Print dialog + */ +/* Authors: * Kees Cook <kees@outflux.net> * * Copyright (C) 2007 Kees Cook - * * Released under GNU GPL. Read the file 'COPYING' for more information. */ @@ -260,3 +259,14 @@ Gtk::PrintOperationResult Print::run(Gtk::PrintOperationAction, Gtk::Window &par } // namespace Dialog } // namespace UI } // namespace Inkscape + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/print.h b/src/ui/dialog/print.h index f6c69bdb8..ea89ebdf2 100644 --- a/src/ui/dialog/print.h +++ b/src/ui/dialog/print.h @@ -1,11 +1,10 @@ -/** - * \brief Print dialog - * - * Authors: +/** @file + * @brief Print dialog + */ +/* Authors: * Kees Cook <kees@outflux.net> * * Copyright (C) 2007 Kees Cook - * * Released under GNU GPL. Read the file 'COPYING' for more information. */ diff --git a/src/ui/dialog/scriptdialog.cpp b/src/ui/dialog/scriptdialog.cpp index 7b299b700..0e8a23baf 100644 --- a/src/ui/dialog/scriptdialog.cpp +++ b/src/ui/dialog/scriptdialog.cpp @@ -1,7 +1,7 @@ -/** - * Dialog for executing and monitoring script execution - * - * Author: +/** @file + * @brief Dialog for executing and monitoring script execution + */ +/* Author: * Bob Jamison * * Copyright (C) 2004-2008 Authors @@ -270,9 +270,13 @@ ScriptDialog &ScriptDialog::getInstance() } //namespace UI } //namespace Inkscape -//######################################################################### -//## E N D O F F I L E -//######################################################################### - - - +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/scriptdialog.h b/src/ui/dialog/scriptdialog.h index 780d44a92..d0021ce68 100644 --- a/src/ui/dialog/scriptdialog.h +++ b/src/ui/dialog/scriptdialog.h @@ -1,10 +1,10 @@ -#ifndef __SCRIPTDIALOG_H__ -#define __SCRIPTDIALOG_H__ -/* - * This dialog is for launching scripts whose main purpose if - * the scripting of Inkscape itself. +/** @file + * @brief Script dialog * - * Authors: + * This dialog is for launching scripts whose main purpose is + * the scripting of Inkscape itself. + */ +/* Authors: * Bob Jamison * Other dudes from The Inkscape Organization * @@ -13,6 +13,8 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#ifndef __SCRIPTDIALOG_H__ +#define __SCRIPTDIALOG_H__ #include "ui/widget/panel.h" #include "verbs.h" @@ -35,7 +37,7 @@ class ScriptDialog : public UI::Widget::Panel * Constructor */ ScriptDialog() : - UI::Widget::Panel("", "dialogs.script", SP_VERB_DIALOG_SCRIPT) + UI::Widget::Panel("", "/dialogs/script", SP_VERB_DIALOG_SCRIPT) {} @@ -62,8 +64,15 @@ class ScriptDialog : public UI::Widget::Panel } //namespace UI } //namespace Inkscape - - - #endif /* __DEBUGDIALOG_H__ */ +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/session-player.cpp b/src/ui/dialog/session-player.cpp index b378c0b5a..b9a44fd98 100644 --- a/src/ui/dialog/session-player.cpp +++ b/src/ui/dialog/session-player.cpp @@ -1,11 +1,10 @@ -/** - * Whiteboard session playback control dialog - * - * Authors: +/** @file + * @brief Whiteboard session playback control dialog - implementation + */ +/* Authors: * David Yip <yipdw@rose-hulman.edu> * * Copyright (c) 2005 Authors - * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -228,3 +227,14 @@ SessionPlaybackDialogImpl::_respCallback(int resp) } } + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/session-player.h b/src/ui/dialog/session-player.h index fd2945bb0..52377a73f 100644 --- a/src/ui/dialog/session-player.h +++ b/src/ui/dialog/session-player.h @@ -1,11 +1,10 @@ -/** - * Whiteboard session playback control dialog - * - * Authors: +/** @file + * @brief Whiteboard session playback control dialog + */ +/* Authors: * David Yip <yipdw@rose-hulman.edu> * * Copyright (c) 2005 Authors - * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -38,7 +37,7 @@ namespace Dialog { class SessionPlaybackDialog : public Dialog { public: - SessionPlaybackDialog() : Dialog("dialogs.session_playback", SP_VERB_DIALOG_WHITEBOARD_SESSIONPLAYBACK) + SessionPlaybackDialog() : Dialog("/dialogs/session_playback", SP_VERB_DIALOG_WHITEBOARD_SESSIONPLAYBACK) { } @@ -122,3 +121,14 @@ private: } #endif + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index fa81e84ca..6a27f6048 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -1,11 +1,10 @@ -/** - * \brief SVG Fonts dialog - * - * Authors: +/** @file + * @brief SVG Fonts dialog - implementation + */ +/* Authors: * Felipe C. da S. Sanches <felipe.sanches@gmail.com> * * Copyright (C) 2008 Authors - * * Released under GNU GPLv2 (or later). Read the file 'COPYING' for more information. */ @@ -249,12 +248,12 @@ Gtk::VBox* SvgFontsDialog::global_settings_tab(){ Gtk::VBox* global_vbox = Gtk::manage(new Gtk::VBox()); AttrEntry* familyname; - familyname = new AttrEntry(this, (gchar*) "Family Name", SP_PROP_FONT_FAMILY); + familyname = new AttrEntry(this, (gchar*) _("Family Name:"), SP_PROP_FONT_FAMILY); global_vbox->add(*familyname); - global_vbox->add(*AttrCombo((gchar*) "Style", SP_PROP_FONT_STYLE)); - global_vbox->add(*AttrCombo((gchar*) "Variant", SP_PROP_FONT_VARIANT)); - global_vbox->add(*AttrCombo((gchar*) "Weight", SP_PROP_FONT_WEIGHT)); + global_vbox->add(*AttrCombo((gchar*) _("Style:"), SP_PROP_FONT_STYLE)); + global_vbox->add(*AttrCombo((gchar*) _("Variant:"), SP_PROP_FONT_VARIANT)); + global_vbox->add(*AttrCombo((gchar*) _("Weight:"), SP_PROP_FONT_WEIGHT)); //Set Width (horiz_adv_x): Gtk::HBox* setwidth_hbox = Gtk::manage(new Gtk::HBox()); @@ -271,8 +270,8 @@ Gtk::VBox* SvgFontsDialog::global_settings_tab(){ Gtk::VBox* SvgFontsDialog::glyphs_tab(){ Gtk::VBox* glyphs_vbox = Gtk::manage(new Gtk::VBox()); - glyphs_vbox->add(*new SvgFontsDialog::AttrEntry(this, (gchar*) "Glyph Name", SP_ATTR_GLYPH_NAME)); - glyphs_vbox->add(*new SvgFontsDialog::AttrEntry(this, (gchar*) "Unicode", SP_ATTR_UNICODE)); + glyphs_vbox->add(*new SvgFontsDialog::AttrEntry(this, (gchar*) _("Glyph Name:"), SP_ATTR_GLYPH_NAME)); + glyphs_vbox->add(*new SvgFontsDialog::AttrEntry(this, (gchar*) _("Unicode:"), SP_ATTR_UNICODE)); //glyphs_vbox->add(*AttrSpin((gchar*) "Horizontal Advance"), SP_ATTR_HORIZ_ADV_X); //glyphs_vbox->add(*AttrCombo((gchar*) "Missing Glyph"), SP_ATTR_); ? return glyphs_vbox; @@ -309,7 +308,7 @@ Gtk::VBox* SvgFontsDialog::kerning_tab(){ } SvgFontsDialog::SvgFontsDialog() - : UI::Widget::Panel("", "dialogs.svgfonts", SP_VERB_DIALOG_SVG_FONTS) + : UI::Widget::Panel("", "/dialogs/svgfonts", SP_VERB_DIALOG_SVG_FONTS) { Gtk::HBox* hbox = Gtk::manage(new Gtk::HBox()); hbox->add(_font_list); diff --git a/src/ui/dialog/svg-fonts-dialog.h b/src/ui/dialog/svg-fonts-dialog.h index 8502a3468..f7d13a714 100644 --- a/src/ui/dialog/svg-fonts-dialog.h +++ b/src/ui/dialog/svg-fonts-dialog.h @@ -1,11 +1,10 @@ -/** - * \brief SVG Fonts dialog - * - * Authors: +/** @file + * @brief SVG Fonts dialog + */ +/* Authors: * Felipe Corrêa da Silva Sanches <felipe.sanches@gmail.com> * * Copyright (C) 2008 Authors - * * Released under GNU GPLv2 (or later). Read the file 'COPYING' for more information. */ diff --git a/src/ui/dialog/tracedialog.cpp b/src/ui/dialog/tracedialog.cpp index 84d7978fb..6ec2da5de 100644 --- a/src/ui/dialog/tracedialog.cpp +++ b/src/ui/dialog/tracedialog.cpp @@ -1,8 +1,7 @@ -/* - * A simple dialog for setting the parameters for autotracing a - * bitmap <image> into an svg <path> - * - * Authors: +/** @file + * @brief Bitmap tracing settings dialog - implementation + */ +/* Authors: * Bob Jamison <rjamison@titan.com> * Stéphane Gimenez <dev@gim.name> * Other dudes from The Inkscape Organization diff --git a/src/ui/dialog/tracedialog.h b/src/ui/dialog/tracedialog.h index 0933aee3b..9dc084cd6 100644 --- a/src/ui/dialog/tracedialog.h +++ b/src/ui/dialog/tracedialog.h @@ -1,18 +1,16 @@ -#ifndef __TRACEDIALOG_H__ -#define __TRACEDIALOG_H__ -/* - * A simple dialog for setting the parameters for autotracing a - * bitmap <image> into an svg <path> - * - * Authors: +/** @file + * @brief Bitmap tracing settings dialog + */ +/* Authors: * Bob Jamison * Other dudes from The Inkscape Organization * * Copyright (C) 2004, 2005 Authors - * * Released under GNU GPL, read the file 'COPYING' for more information */ +#ifndef __TRACEDIALOG_H__ +#define __TRACEDIALOG_H__ #include "verbs.h" #include "ui/widget/panel.h" @@ -34,7 +32,7 @@ public: * Constructor */ TraceDialog() : - UI::Widget::Panel("", "dialogs.trace", SP_VERB_SELECTION_TRACE) + UI::Widget::Panel("", "/dialogs/trace", SP_VERB_SELECTION_TRACE) {} @@ -56,8 +54,15 @@ public: } //namespace UI } //namespace Inkscape - - - #endif /* __TRACEDIALOG_H__ */ +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp index 5927dc740..899053cc9 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -1,12 +1,11 @@ -/** - * \brief Object Transformation dialog - * - * Authors: +/** @file + * \brief Transform dialog - implementation + */ +/* Authors: * Bryce W. Harrington <bryce@bryceharrington.org> * buliabyak@gmail.com * * Copyright (C) 2004, 2005 Authors - * * Released under GNU GPL. Read the file 'COPYING' for more information. */ @@ -26,7 +25,7 @@ #include "selection.h" #include "selection-chemistry.h" #include "verbs.h" -#include "prefs-utils.h" +#include "preferences.h" #include "sp-item-transform.h" #include "macros.h" #include "sp-item.h" @@ -74,7 +73,7 @@ void on_selection_modified( Inkscape::Application */*inkscape*/, * */ Transformation::Transformation() - : UI::Widget::Panel ("", "dialogs.transformation", SP_VERB_DIALOG_TRANSFORM), + : UI::Widget::Panel ("", "/dialogs/transformation", SP_VERB_DIALOG_TRANSFORM), _page_move (4, 2), _page_scale (4, 2), _page_rotate (4, 2), @@ -134,7 +133,8 @@ Transformation::Transformation() // Apply separately contents->pack_start(_check_apply_separately, true, true); - _check_apply_separately.set_active(prefs_get_int_attribute_limited ("dialogs.transformation", "applyseparately", 0, 0, 1)); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + _check_apply_separately.set_active(prefs->getBool("/dialogs/transformation/applyseparately")); _check_apply_separately.signal_toggled().connect(sigc::mem_fun(*this, &Transformation::onApplySeparatelyToggled)); // make sure all spinbuttons activate Apply on pressing Enter @@ -599,7 +599,8 @@ Transformation::applyPageMove(Inkscape::Selection *selection) double x = _scalar_move_horizontal.getValue("px"); double y = _scalar_move_vertical.getValue("px"); - if (prefs_get_int_attribute_limited ("dialogs.transformation", "applyseparately", 0, 0, 1) == 0) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + if (!prefs->getBool("/dialogs/transformation/applyseparately")) { // move selection as a whole if (_check_move_relative.get_active()) { sp_selection_move_relative(selection, x, y); @@ -686,7 +687,8 @@ Transformation::applyPageScale(Inkscape::Selection *selection) double scaleX = _scalar_scale_horizontal.getValue("px"); double scaleY = _scalar_scale_vertical.getValue("px"); - if (prefs_get_int_attribute_limited ("dialogs.transformation", "applyseparately", 0, 0, 1) == 1) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + if (prefs->getBool("/dialogs/transformation/applyseparately")) { for (GSList const *l = selection->itemList(); l != NULL; l = l->next) { SPItem *item = SP_ITEM(l->data); Geom::Scale scale (0,0); @@ -741,7 +743,8 @@ Transformation::applyPageRotate(Inkscape::Selection *selection) { double angle = _scalar_rotate.getValue("deg"); - if (prefs_get_int_attribute_limited ("dialogs.transformation", "applyseparately", 0, 0, 1) == 1) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + if (prefs->getBool("/dialogs/transformation/applyseparately")) { for (GSList const *l = selection->itemList(); l != NULL; l = l->next) { SPItem *item = SP_ITEM(l->data); sp_item_rotate_rel(item, Geom::Rotate (angle*M_PI/180.0)); @@ -760,7 +763,8 @@ Transformation::applyPageRotate(Inkscape::Selection *selection) void Transformation::applyPageSkew(Inkscape::Selection *selection) { - if (prefs_get_int_attribute_limited ("dialogs.transformation", "applyseparately", 0, 0, 1) == 1) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + if (prefs->getBool("/dialogs/transformation/applyseparately")) { for (GSList const *l = selection->itemList(); l != NULL; l = l->next) { SPItem *item = SP_ITEM(l->data); @@ -826,7 +830,7 @@ Transformation::applyPageTransform(Inkscape::Selection *selection) double e = _scalar_transform_e.getValue(); double f = _scalar_transform_f.getValue(); - NR::Matrix displayed(a, b, c, d, e, f); + Geom::Matrix displayed(a, b, c, d, e, f); if (_check_replace_matrix.get_active()) { for (GSList const *l = selection->itemList(); l != NULL; l = l->next) { @@ -1046,7 +1050,8 @@ Transformation::onClear() void Transformation::onApplySeparatelyToggled() { - prefs_set_int_attribute ("dialogs.transformation", "applyseparately", _check_apply_separately.get_active()? 1 : 0); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setBool("/dialogs/transformation/applyseparately", _check_apply_separately.get_active()); } @@ -1054,8 +1059,6 @@ Transformation::onApplySeparatelyToggled() } // namespace UI } // namespace Inkscape - - /* Local Variables: mode:c++ diff --git a/src/ui/dialog/transformation.h b/src/ui/dialog/transformation.h index e64353f5a..9d05713ad 100644 --- a/src/ui/dialog/transformation.h +++ b/src/ui/dialog/transformation.h @@ -1,11 +1,10 @@ -/** - * \brief Object Transformation dialog - * - * Author: +/** @file + * @brief Transform dialog + */ +/* Author: * Bryce W. Harrington <bryce@bryceharrington.org> * * Copyright (C) 2004, 2005 Authors - * * Released under GNU GPL. Read the file 'COPYING' for more information. */ diff --git a/src/ui/dialog/undo-history.cpp b/src/ui/dialog/undo-history.cpp index f2f51a780..2dec1e2d4 100644 --- a/src/ui/dialog/undo-history.cpp +++ b/src/ui/dialog/undo-history.cpp @@ -1,11 +1,10 @@ -/** - * \brief Undo History dialog - * - * Author: +/** @file + * @brief Undo History dialog - implementation + */ +/* Author: * Gustav Broberg <broberg@kth.se> * * Copyright (C) 2006 Authors - * * Released under GNU GPL. Read the file 'COPYING' for more information. */ @@ -125,7 +124,7 @@ UndoHistory::setDesktop(SPDesktop* desktop) } UndoHistory::UndoHistory() - : UI::Widget::Panel ("", "dialogs.undo-history", SP_VERB_DIALOG_UNDO_HISTORY), + : UI::Widget::Panel ("", "/dialogs/undo-history", SP_VERB_DIALOG_UNDO_HISTORY), _document (sp_desktop_document(getDesktop())), _event_log (getDesktop() ? getDesktop()->event_log : NULL), _columns (_event_log ? &_event_log->getColumns() : NULL), diff --git a/src/ui/dialog/undo-history.h b/src/ui/dialog/undo-history.h index 070a1eb22..82e04f3c9 100644 --- a/src/ui/dialog/undo-history.h +++ b/src/ui/dialog/undo-history.h @@ -1,16 +1,10 @@ -/** - * Undo History dialog - * - * \brief A dialog for presenting an event log of commited, undone and redone events. Allows the - * user to undo and redo multiple events in a more convenient way than repateaded ctrl-z, - * ctrl-shift-z. - * - * - * Author: +/** @file + * @brief Undo History dialog + */ +/* Author: * Gustav Broberg <broberg@kth.se> * * Copyright (C) 2006 Authors - * * Released under GNU GPL. Read the file 'COPYING' for more information. */ @@ -111,11 +105,12 @@ private: struct NoFilter : Filter { bool operator() (const int& /*x*/) const { return true; } }; }; - /** - * + * \brief Dialog for presenting document change history + * + * This dialog allows the user to undo and redo multiple events in a more convenient way + * than repateaded ctrl-z, ctrl-shift-z. */ - class UndoHistory : public Widget::Panel { public: virtual ~UndoHistory(); diff --git a/src/ui/dialog/whiteboard-connect.cpp b/src/ui/dialog/whiteboard-connect.cpp index f91d4a607..b18ed99d4 100644 --- a/src/ui/dialog/whiteboard-connect.cpp +++ b/src/ui/dialog/whiteboard-connect.cpp @@ -1,12 +1,15 @@ -/** - * Whiteboard connection establishment dialog - * - * Authors: - * David Yip <yipdw@rose-hulman.edu> - * Jason Segal, Jonas Collaros, Stephen Montgomery, Brandi Soggs, Matthew Weinstock (original C/Gtk version) +/** @file + * @brief Whiteboard connection dialog - implementation + */ +/* Authors: + * David Yip <yipdw@rose-hulman.edu> + * Jason Segal + * Jonas Collaros + * Stephen Montgomery + * Brandi Soggs + * Matthew Weinstock (original C/Gtk version) * * Copyright (c) 2004-2005 Authors - * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -83,11 +86,11 @@ WhiteboardConnectDialogImpl::_construct() this->_labels[3].set_mnemonic_widget(this->_port); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - this->_server.set_text(prefs->getString("whiteboard.server", "name")); + this->_server.set_text(prefs->getString("/whiteboard/server/name")); /// @todo Convert port to an integer preference? - this->_port.set_text(prefs->getString("whiteboard.server", "port")); - this->_username.set_text(prefs->getString("whiteboard.server", "username")); - this->_usessl.set_active(prefs->getBool("whiteboard.server", "ssl", false); + this->_port.set_text(prefs->getString("/whiteboard/server/port")); + this->_username.set_text(prefs->getString("/whiteboard/server/username")); + this->_usessl.set_active(prefs->getBool("/whiteboard/server/ssl", false); this->_layout.attach(this->_labels[0], 0, 1, 0, 1); this->_layout.attach(this->_labels[1], 0, 1, 1, 2); @@ -236,7 +239,7 @@ WhiteboardConnectDialogImpl::_respCallback(int resp) this->_desktop->messageStack()->flash(INFORMATION_MESSAGE, msg.data()); // Save preferences - prefs->setString(this->_prefs_path, "server", this->_server.get_text()); + prefs->setString(this->_prefs_path + "/server", this->_server.get_text()); break; default: break; @@ -274,7 +277,7 @@ WhiteboardConnectDialogImpl::_respCallback(int resp) this->_desktop->messageStack()->flash(INFORMATION_MESSAGE, msg.data()); // Save preferences - prefs->setString(this->_prefs_path, "server", this->_server.get_text()); + prefs->setString(this->_prefs_path + "/server", this->_server.get_text()); break; default: break; diff --git a/src/ui/dialog/whiteboard-connect.h b/src/ui/dialog/whiteboard-connect.h index b96f1ce3b..8b34215f9 100644 --- a/src/ui/dialog/whiteboard-connect.h +++ b/src/ui/dialog/whiteboard-connect.h @@ -1,12 +1,15 @@ -/** - * Whiteboard connection establishment dialog - * - * Authors: - * David Yip <yipdw@rose-hulman.edu> - * Jason Segal, Jonas Collaros, Stephen Montgomery, Brandi Soggs, Matthew Weinstock (original C/Gtk version) +/** @file + * @brief Whiteboard connection dialog + */ +/* Authors: + * David Yip <yipdw@rose-hulman.edu> + * Jason Segal + * Jonas Collaros + * Stephen Montgomery + * Brandi Soggs + * Matthew Weinstock (original C/Gtk version) * * Copyright (c) 2004-2005 Authors - * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -34,7 +37,7 @@ namespace Dialog { class WhiteboardConnectDialog : public Dialog { public: - WhiteboardConnectDialog() : Dialog("dialogs.whiteboard_connect", SP_VERB_DIALOG_WHITEBOARD_CONNECT) + WhiteboardConnectDialog() : Dialog("/dialogs/whiteboard_connect", SP_VERB_DIALOG_WHITEBOARD_CONNECT) { } diff --git a/src/ui/dialog/whiteboard-sharewithchat.cpp b/src/ui/dialog/whiteboard-sharewithchat.cpp index 4e9ea7abf..3315a7029 100644 --- a/src/ui/dialog/whiteboard-sharewithchat.cpp +++ b/src/ui/dialog/whiteboard-sharewithchat.cpp @@ -1,13 +1,15 @@ -/** - * @file - * @brief Whiteboard share with chatroom dialog - * - * Authors: - * David Yip <yipdw@rose-hulman.edu> - * Jason Segal, Jonas Collaros, Stephen Montgomery, Brandi Soggs, Matthew Weinstock (original C/Gtk version) +/** @file + * @brief Whiteboard share with chatroom dialog - implementation + */ +/* Authors: + * David Yip <yipdw@rose-hulman.edu> + * Jason Segal + * Jonas Collaros + * Stephen Montgomery + * Brandi Soggs + * Matthew Weinstock (original C/Gtk version) * * Copyright (c) 2004-2005 Authors - * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -82,9 +84,9 @@ WhiteboardShareWithChatroomDialogImpl::_construct() this->_labels[3].set_mnemonic_widget(this->_handle); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - this->_roomname.set_text(prefs->getString("whiteboard.room", "name")); - this->_confserver.set_text(prefs->getString("whiteboard.room", "server")); - this->_handle.set_text(prefs->getString("whiteboard.server", "username")); + this->_roomname.set_text(prefs->getString("/whiteboard/room/name")); + this->_confserver.set_text(prefs->getString("/whiteboard/room/server")); + this->_handle.set_text(prefs->getString("/whiteboard/server/username")); // Pack table this->_layout.attach(this->_labels[0], 0, 1, 0, 1); diff --git a/src/ui/dialog/whiteboard-sharewithchat.h b/src/ui/dialog/whiteboard-sharewithchat.h index 898f8da26..4a6c2fc89 100644 --- a/src/ui/dialog/whiteboard-sharewithchat.h +++ b/src/ui/dialog/whiteboard-sharewithchat.h @@ -1,12 +1,15 @@ -/** - * Whiteboard share with chatroom dialog - * - * Authors: - * David Yip <yipdw@rose-hulman.edu> - * Jason Segal, Jonas Collaros, Stephen Montgomery, Brandi Soggs, Matthew Weinstock (original C/Gtk version) +/** @file + * @brief Whiteboard share with chatroom dialog + */ +/* Authors: + * David Yip <yipdw@rose-hulman.edu> + * Jason Segal + * Jonas Collaros + * Stephen Montgomery + * Brandi Soggs + * Matthew Weinstock (original C/Gtk version) * * Copyright (c) 2004-2005 Authors - * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -35,7 +38,7 @@ namespace Dialog { class WhiteboardShareWithChatroomDialog : public Dialog { public: - WhiteboardShareWithChatroomDialog() : Dialog("dialogs.whiteboard_sharewithuser", SP_VERB_DIALOG_WHITEBOARD_SHAREWITHUSER) + WhiteboardShareWithChatroomDialog() : Dialog("/dialogs/whiteboard_sharewithuser", SP_VERB_DIALOG_WHITEBOARD_SHAREWITHUSER) { } diff --git a/src/ui/dialog/whiteboard-sharewithuser.cpp b/src/ui/dialog/whiteboard-sharewithuser.cpp index ebe91f0f3..bb3761f31 100644 --- a/src/ui/dialog/whiteboard-sharewithuser.cpp +++ b/src/ui/dialog/whiteboard-sharewithuser.cpp @@ -1,7 +1,7 @@ -/** - * Whiteboard share with user dialog - * - * Authors: +/** @file + * Whiteboard share with user dialog - implementation + */ +/* Authors: * David Yip <yipdw@rose-hulman.edu> * Jason Segal, Jonas Collaros, Stephen Montgomery, Brandi Soggs, Matthew Weinstock (original C/Gtk version) * diff --git a/src/ui/dialog/whiteboard-sharewithuser.h b/src/ui/dialog/whiteboard-sharewithuser.h index ad0870707..24ec91be5 100644 --- a/src/ui/dialog/whiteboard-sharewithuser.h +++ b/src/ui/dialog/whiteboard-sharewithuser.h @@ -1,7 +1,7 @@ -/** - * Whiteboard share with user dialog - * - * Authors: +/** @file + * @brief Whiteboard share with user dialog + */ +/* Authors: * David Yip <yipdw@rose-hulman.edu> * Jason Segal, Jonas Collaros, Stephen Montgomery, Brandi Soggs, Matthew Weinstock (original C/Gtk version) * @@ -33,7 +33,7 @@ namespace Inkscape { class WhiteboardShareWithUserDialog : public Dialog { public: - WhiteboardShareWithUserDialog() : Dialog("dialogs.whiteboard_sharewithuser", SP_VERB_DIALOG_WHITEBOARD_SHAREWITHUSER) + WhiteboardShareWithUserDialog() : Dialog("/dialogs/whiteboard_sharewithuser", SP_VERB_DIALOG_WHITEBOARD_SHAREWITHUSER) { } diff --git a/src/ui/view/edit-widget.cpp b/src/ui/view/edit-widget.cpp index 67091fc40..5e7713044 100644 --- a/src/ui/view/edit-widget.cpp +++ b/src/ui/view/edit-widget.cpp @@ -46,7 +46,7 @@ #include "macros.h" #include "path-prefix.h" -#include "prefs-utils.h" +#include "preferences.h" #include "file.h" #include "application/editor.h" #include "edit-widget.h" @@ -1056,9 +1056,9 @@ EditWidget::initRightScrollbar() void EditWidget::initStickyZoom() { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); _viewport_table.attach(_sticky_zoom, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK); - - _sticky_zoom.set_active (prefs_get_int_attribute ("options.stickyzoom", "value", 0) != 0); + _sticky_zoom.set_active (prefs->getBool("/options/stickyzoom/value")); _tooltips.set_tip (_sticky_zoom, _("Zoom drawing if window size changes")); /// \todo icon not implemented @@ -1437,30 +1437,32 @@ EditWidget::updateScrollbars (double scale) void EditWidget::toggleRulers() { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if (_top_ruler.is_visible()) { _top_ruler.hide_all(); _left_ruler.hide_all(); - prefs_set_int_attribute (_desktop->is_fullscreen() ? "fullscreen.rulers" : "window.rulers", "state", 0); + prefs->setBool(_desktop->is_fullscreen() ? "/fullscreen/rulers/state" : "/window/rulers/state", false); } else { _top_ruler.show_all(); _left_ruler.show_all(); - prefs_set_int_attribute (_desktop->is_fullscreen() ? "fullscreen.rulers" : "window.rulers", "state", 1); + prefs->setBool(_desktop->is_fullscreen() ? "/fullscreen/rulers/state" : "/window/rulers/state", true); } } void EditWidget::toggleScrollbars() { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if (_bottom_scrollbar.is_visible()) { _bottom_scrollbar.hide_all(); _right_scrollbar.hide_all(); - prefs_set_int_attribute (_desktop->is_fullscreen() ? "fullscreen.scrollbars" : "window.scrollbars", "state", 0); + prefs->setBool(_desktop->is_fullscreen() ? "/fullscreen/scrollbars/state" : "/window/scrollbars/state", false); } else { _bottom_scrollbar.show_all(); _right_scrollbar.show_all(); - prefs_set_int_attribute (_desktop->is_fullscreen() ? "fullscreen.scrollbars" : "window.scrollbars", "state", 1); + prefs->setBool(_desktop->is_fullscreen() ? "/fullscreen/scrollbars/state" : "/window/scrollbars/state", true); } } @@ -1662,8 +1664,8 @@ EditWidget::onWindowSizeAllocate (Gtk::Allocation &newall) void EditWidget::onWindowRealize() { - NR::Rect d(Geom::Point(0, 0), - Geom::Point(sp_document_width(_desktop->doc()), sp_document_height(_desktop->doc()))); + NR::Rect d( Geom::Point(0, 0), + Geom::Point(sp_document_width(_desktop->doc()), sp_document_height(_desktop->doc())) ); if (d.isEmpty(1.0)) { return; diff --git a/src/ui/widget/dock-item.cpp b/src/ui/widget/dock-item.cpp index e61b8080e..12a0686f0 100644 --- a/src/ui/widget/dock-item.cpp +++ b/src/ui/widget/dock-item.cpp @@ -12,7 +12,7 @@ #include "dock-item.h" #include "desktop.h" #include "inkscape.h" -#include "prefs-utils.h" +#include "preferences.h" #include "ui/widget/dock.h" #include "widgets/icon.h" @@ -37,11 +37,11 @@ DockItem::DockItem(Dock& dock, const Glib::ustring& name, const Glib::ustring& l _gdl_dock_item(0), _dock_item_action_area(0) { - + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); GdlDockItemBehavior gdl_dock_behavior = - (prefs_get_int_attribute_limited ("options.dock", "cancenterdock", 1, 0, 1) == 0 ? - GDL_DOCK_ITEM_BEH_CANT_DOCK_CENTER - : GDL_DOCK_ITEM_BEH_NORMAL); + (prefs->getBool("/options/dock/cancenterdock", true) ? + GDL_DOCK_ITEM_BEH_NORMAL : + GDL_DOCK_ITEM_BEH_CANT_DOCK_CENTER); if (!icon_name.empty()) { Gtk::Widget *icon = sp_icon_get_icon(icon_name, Inkscape::ICON_SIZE_MENU); diff --git a/src/ui/widget/dock.cpp b/src/ui/widget/dock.cpp index 563ed8e98..3608c3551 100644 --- a/src/ui/widget/dock.cpp +++ b/src/ui/widget/dock.cpp @@ -1,7 +1,7 @@ -/** - * \brief A desktop dock pane to dock dialogs. - * - * Author: +/** @file + * @brief A desktop dock pane to dock dialogs. + */ +/* Author: * Gustav Broberg <broberg@kth.se> * * Copyright (C) 2007 Authors @@ -10,7 +10,7 @@ */ #include "inkscape.h" -#include "prefs-utils.h" +#include "preferences.h" #include "desktop.h" #include "dock.h" @@ -74,8 +74,9 @@ Dock::Dock(Gtk::Orientation orientation) _scrolled_window->set_size_request(0); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); GdlSwitcherStyle gdl_switcher_style = - static_cast<GdlSwitcherStyle>(prefs_get_int_attribute_limited("options.dock", "switcherstyle", + static_cast<GdlSwitcherStyle>(prefs->getIntLimited("/options/dock/switcherstyle", GDL_SWITCHER_STYLE_BOTH, 0, 4)); g_object_set (GDL_DOCK_OBJECT(_gdl_dock)->master, @@ -84,7 +85,7 @@ Dock::Dock(Gtk::Orientation orientation) NULL); GdlDockBarStyle gdl_dock_bar_style = - static_cast<GdlDockBarStyle>(prefs_get_int_attribute_limited("options.dock", "dockbarstyle", + static_cast<GdlDockBarStyle>(prefs->getIntLimited("/options/dock/dockbarstyle", GDL_DOCK_BAR_BOTH, 0, 3)); gdl_dock_bar_set_style(_gdl_dock_bar, gdl_dock_bar_style); diff --git a/src/ui/widget/dock.h b/src/ui/widget/dock.h index dd501f186..c49d71268 100644 --- a/src/ui/widget/dock.h +++ b/src/ui/widget/dock.h @@ -1,7 +1,7 @@ -/** - * \brief A desktop dock pane to dock dialogs, a custom wrapper around gdl-dock. - * - * Author: +/** @file + * @brief A desktop dock pane to dock dialogs, a custom wrapper around gdl-dock. + */ +/* Author: * Gustav Broberg <broberg@kth.se> * * Copyright (C) 2007 Authors diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index 9333ffc35..9811cc89c 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -26,7 +26,7 @@ #include "panel.h" #include "icon-size.h" -#include "prefs-utils.h" +#include "preferences.h" #include "desktop-handles.h" #include "inkscape.h" #include "dialogs/eek-preview.h" @@ -94,50 +94,40 @@ void Panel::_init() Glib::ustring tmp("<"); _anchor = Gtk::ANCHOR_CENTER; - guint panel_size = 0; - if (_prefs_path) { - panel_size = prefs_get_int_attribute_limited( _prefs_path, "panel_size", 1, 0, static_cast<long long>(PREVIEW_SIZE_HUGE) ); - } - - guint panel_mode = 0; - if (_prefs_path) { - panel_mode = prefs_get_int_attribute_limited( _prefs_path, "panel_mode", 1, 0, 10 ); - } - - guint panel_wrap = 0; - if (_prefs_path) { - panel_wrap = prefs_get_int_attribute_limited( _prefs_path, "panel_wrap", 0, 0, 1 ); - } - - guint panel_ratio = 100; - if (_prefs_path) { - panel_ratio = prefs_get_int_attribute_limited( _prefs_path, "panel_ratio", 100, 0, 500 ); + guint panel_size = 0, panel_mode = 0, panel_ratio = 100; + bool panel_wrap = 0; + if (!_prefs_path.empty()) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + panel_wrap = prefs->getBool(_prefs_path + "/panel_wrap"); + panel_size = prefs->getIntLimited(_prefs_path + "/panel_size", 1, 0, PREVIEW_SIZE_HUGE); + panel_mode = prefs->getIntLimited(_prefs_path + "/panel_mode", 1, 0, 10); + panel_ratio = prefs->getIntLimited(_prefs_path + "/panel_ratio", 100, 0, 500 ); } _menu = new Gtk::Menu(); { - Gtk::RadioMenuItem::Group group; - Glib::ustring one_label(_("List")); - Glib::ustring two_label(_("Grid")); - Gtk::RadioMenuItem *one = manage(new Gtk::RadioMenuItem(group, one_label)); - Gtk::RadioMenuItem *two = manage(new Gtk::RadioMenuItem(group, two_label)); - - if (panel_mode == 0) { - one->set_active(true); - } else if (panel_mode == 1) { - two->set_active(true); - } - - _menu->append(*one); - _non_horizontal.push_back(one); - _menu->append(*two); - _non_horizontal.push_back(two); - Gtk::MenuItem* sep = manage(new Gtk::SeparatorMenuItem()); - _menu->append(*sep); - _non_horizontal.push_back(sep); - one->signal_activate().connect(sigc::bind<int, int>(sigc::mem_fun(*this, &Panel::_bounceCall), PANEL_SETTING_MODE, 0)); - two->signal_activate().connect(sigc::bind<int, int>(sigc::mem_fun(*this, &Panel::_bounceCall), PANEL_SETTING_MODE, 1)); + Gtk::RadioMenuItem::Group group; + Glib::ustring one_label(_("List")); + Glib::ustring two_label(_("Grid")); + Gtk::RadioMenuItem *one = manage(new Gtk::RadioMenuItem(group, one_label)); + Gtk::RadioMenuItem *two = manage(new Gtk::RadioMenuItem(group, two_label)); + + if (panel_mode == 0) { + one->set_active(true); + } else if (panel_mode == 1) { + two->set_active(true); + } + + _menu->append(*one); + _non_horizontal.push_back(one); + _menu->append(*two); + _non_horizontal.push_back(two); + Gtk::MenuItem* sep = manage(new Gtk::SeparatorMenuItem()); + _menu->append(*sep); + _non_horizontal.push_back(sep); + one->signal_activate().connect(sigc::bind<int, int>(sigc::mem_fun(*this, &Panel::_bounceCall), PANEL_SETTING_MODE, 0)); + two->signal_activate().connect(sigc::bind<int, int>(sigc::mem_fun(*this, &Panel::_bounceCall), PANEL_SETTING_MODE, 1)); } { @@ -336,21 +326,14 @@ void Panel::present() void Panel::restorePanelPrefs() { - guint panel_size = 0; - if (_prefs_path) { - panel_size = prefs_get_int_attribute_limited(_prefs_path, "panel_size", 1, 0, static_cast<long long>(PREVIEW_SIZE_HUGE)); - } - guint panel_mode = 0; - if (_prefs_path) { - panel_mode = prefs_get_int_attribute_limited(_prefs_path, "panel_mode", 1, 0, 10); - } - guint panel_wrap = 0; - if (_prefs_path) { - panel_wrap = prefs_get_int_attribute_limited(_prefs_path, "panel_wrap", 0, 0, 1 ); - } - guint panel_ratio = 100; - if (_prefs_path) { - panel_ratio = prefs_get_int_attribute_limited(_prefs_path, "panel_ratio", 000, 0, 500 ); + guint panel_size = 0, panel_mode = 0, panel_ratio = 100; + bool panel_wrap = 0; + if (!_prefs_path.empty()) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + panel_wrap = prefs->getBool(_prefs_path + "/panel_wrap"); + panel_size = prefs->getIntLimited(_prefs_path + "/panel_size", 1, 0, PREVIEW_SIZE_HUGE); + panel_mode = prefs->getIntLimited(_prefs_path + "/panel_mode", 1, 0, 10); + panel_ratio = prefs->getIntLimited(_prefs_path + "/panel_ratio", 000, 0, 500 ); } _bounceCall(PANEL_SETTING_SIZE, panel_size); _bounceCall(PANEL_SETTING_MODE, panel_mode); @@ -375,8 +358,9 @@ void Panel::_bounceCall(int i, int j) _menu->set_active(0); switch (i) { case PANEL_SETTING_SIZE: - if (_prefs_path) { - prefs_set_int_attribute(_prefs_path, "panel_size", j); + if (!_prefs_path.empty()) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setInt(_prefs_path + "/panel_size", j); } if (_fillable) { ViewType curr_type = _fillable->getPreviewType(); @@ -413,8 +397,9 @@ void Panel::_bounceCall(int i, int j) } break; case PANEL_SETTING_MODE: - if (_prefs_path) { - prefs_set_int_attribute (_prefs_path, "panel_mode", j); + if (!_prefs_path.empty()) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setInt(_prefs_path + "/panel_mode", j); } if (_fillable) { ::PreviewSize curr_size = _fillable->getPreviewSize(); @@ -436,8 +421,9 @@ void Panel::_bounceCall(int i, int j) } break; case PANEL_SETTING_SHAPE: - if (_prefs_path) { - prefs_set_int_attribute (_prefs_path, "panel_ratio", j); + if (!_prefs_path.empty()) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setInt(_prefs_path + "/panel_ratio", j); } if ( _fillable ) { ViewType curr_type = _fillable->getPreviewType(); @@ -446,8 +432,9 @@ void Panel::_bounceCall(int i, int j) } break; case PANEL_SETTING_WRAP: - if (_prefs_path) { - prefs_set_int_attribute (_prefs_path, "panel_wrap", j ? 1 : 0); + if (!_prefs_path.empty()) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setBool(_prefs_path + "/panel_wrap", j); } if ( _fillable ) { _fillable->setWrap(j); @@ -468,7 +455,7 @@ void Panel::_wrapToggled(Gtk::CheckMenuItem* toggler) gchar const *Panel::getPrefsPath() const { - return _prefs_path; + return _prefs_path.data(); } Glib::ustring const &Panel::getLabel() const diff --git a/src/ui/widget/panel.h b/src/ui/widget/panel.h index 1062ee58e..d42548f16 100644 --- a/src/ui/widget/panel.h +++ b/src/ui/widget/panel.h @@ -92,7 +92,7 @@ protected: /** Tooltips object for all descendants to use */ Gtk::Tooltips _tooltips; - const gchar *_prefs_path; + Glib::ustring const _prefs_path; bool _menu_desired; Gtk::AnchorType _anchor; diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index b11ca2e93..72df1baab 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -128,13 +128,12 @@ void DialogPage::set_tip(Gtk::Widget& widget, Glib::ustring const &tip) } void PrefCheckButton::init(Glib::ustring const &label, Glib::ustring const &prefs_path, - Glib::ustring const &attr, bool default_value) + bool default_value) { _prefs_path = prefs_path; - _attr = attr; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); this->set_label(label); - this->set_active( prefs->getBool(_prefs_path, _attr, default_value) ); + this->set_active( prefs->getBool(_prefs_path, default_value) ); } void PrefCheckButton::on_toggled() @@ -142,15 +141,14 @@ void PrefCheckButton::on_toggled() if (this->is_visible()) //only take action if the user toggled it { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setBool(_prefs_path, _attr, this->get_active()); + prefs->setBool(_prefs_path, this->get_active()); } } void PrefRadioButton::init(Glib::ustring const &label, Glib::ustring const &prefs_path, - Glib::ustring const &attr, Glib::ustring const &string_value, bool default_value, PrefRadioButton* group_member) + Glib::ustring const &string_value, bool default_value, PrefRadioButton* group_member) { _prefs_path = prefs_path; - _attr = attr; _value_type = VAL_STRING; _string_value = string_value; (void)default_value; @@ -161,7 +159,7 @@ void PrefRadioButton::init(Glib::ustring const &label, Glib::ustring const &pref this->set_group(rbg); } Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - Glib::ustring val = prefs->getString(_prefs_path, _attr); + Glib::ustring val = prefs->getString(_prefs_path); if ( !val.empty() ) this->set_active(val == _string_value); else @@ -169,10 +167,9 @@ void PrefRadioButton::init(Glib::ustring const &label, Glib::ustring const &pref } void PrefRadioButton::init(Glib::ustring const &label, Glib::ustring const &prefs_path, - Glib::ustring const &attr, int int_value, bool default_value, PrefRadioButton* group_member) + int int_value, bool default_value, PrefRadioButton* group_member) { _prefs_path = prefs_path; - _attr = attr; _value_type = VAL_INT; _int_value = int_value; this->set_label(label); @@ -183,9 +180,9 @@ void PrefRadioButton::init(Glib::ustring const &label, Glib::ustring const &pref } Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if (default_value) - this->set_active( prefs->getInt(_prefs_path, _attr, int_value) == _int_value ); + this->set_active( prefs->getInt(_prefs_path, int_value) == _int_value ); else - this->set_active( prefs->getInt(_prefs_path, _attr, int_value + 1) == _int_value ); + this->set_active( prefs->getInt(_prefs_path, int_value + 1) == _int_value ); } void PrefRadioButton::on_toggled() @@ -196,30 +193,29 @@ void PrefRadioButton::on_toggled() if (this->is_visible() && this->get_active() ) //only take action if toggled by user (to active) { if ( _value_type == VAL_STRING ) - prefs->setString(_prefs_path, _attr, _string_value); + prefs->setString(_prefs_path, _string_value); else if ( _value_type == VAL_INT ) - prefs->setInt(_prefs_path, _attr, _int_value); + prefs->setInt(_prefs_path, _int_value); } } -void PrefSpinButton::init(Glib::ustring const &prefs_path, Glib::ustring const &attr, +void PrefSpinButton::init(Glib::ustring const &prefs_path, double lower, double upper, double step_increment, double page_increment, double default_value, bool is_int, bool is_percent) { _prefs_path = prefs_path; - _attr = attr; _is_int = is_int; _is_percent = is_percent; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); double value; if (is_int) { if (is_percent) { - value = 100 * prefs->getDoubleLimited(prefs_path, attr, default_value, lower/100.0, upper/100.0); + value = 100 * prefs->getDoubleLimited(prefs_path, default_value, lower/100.0, upper/100.0); } else { - value = (double) prefs->getIntLimited(prefs_path, attr, (int) default_value, (int) lower, (int) upper); + value = (double) prefs->getIntLimited(prefs_path, (int) default_value, (int) lower, (int) upper); } } else { - value = prefs->getDoubleLimited(prefs_path, attr, default_value, lower, upper); + value = prefs->getDoubleLimited(prefs_path, default_value, lower, upper); } this->set_range (lower, upper); @@ -243,12 +239,12 @@ void PrefSpinButton::on_value_changed() { if (_is_int) { if (_is_percent) { - prefs->setDouble(_prefs_path, _attr, this->get_value()/100.0); + prefs->setDouble(_prefs_path, this->get_value()/100.0); } else { - prefs->setInt(_prefs_path, _attr, (int) this->get_value()); + prefs->setInt(_prefs_path, (int) this->get_value()); } } else { - prefs->setDouble(_prefs_path, _attr, this->get_value()); + prefs->setDouble(_prefs_path, this->get_value()); } } } @@ -273,7 +269,7 @@ void ZoomCorrRuler::set_size(int x, int y) // The following two functions are borrowed from 2geom's toy-framework-2; if they are useful in // other locations, we should perhaps make them (or adapted versions of them) publicly available static void -draw_text(cairo_t *cr, Geom::Point loc, const char* txt, bool bottom = "false", +draw_text(cairo_t *cr, Geom::Point loc, const char* txt, bool bottom = false, double fontsize = ZoomCorrRuler::textsize, std::string fontdesc = "Sans") { PangoLayout* layout = pango_cairo_create_layout (cr); pango_layout_set_text(layout, txt, -1); @@ -306,7 +302,7 @@ draw_number(cairo_t *cr, Geom::Point pos, double num) { void ZoomCorrRuler::draw_marks(Cairo::RefPtr<Cairo::Context> cr, double dist, int major_interval) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - const double zoomcorr = prefs->getDouble("options.zoomcorrection", "value", 1.0); + const double zoomcorr = prefs->getDouble("/options/zoomcorrection/value", 1.0); double mark = 0; int i = 0; while (mark <= _drawing_width) { @@ -347,7 +343,7 @@ ZoomCorrRuler::redraw() { cr->line_to (_drawing_width, _height); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - Glib::ustring abbr = prefs->getString("options.zoomcorrection", "unit"); + Glib::ustring abbr = prefs->getString("/options/zoomcorrection/unit"); if (abbr == "cm") { draw_marks(cr, 0.1, 10); } else if (abbr == "ft") { @@ -383,7 +379,7 @@ ZoomCorrRulerSlider::on_slider_value_changed() { freeze = true; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setDouble("options.zoomcorrection", "value", _slider.get_value() / 100.0); + prefs->setDouble("/options/zoomcorrection/value", _slider.get_value() / 100.0); _sb.set_value(_slider.get_value()); _ruler.redraw(); freeze = false; @@ -397,7 +393,7 @@ ZoomCorrRulerSlider::on_spinbutton_value_changed() { freeze = true; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setDouble("options.zoomcorrection", "value", _sb.get_value() / 100.0); + prefs->setDouble("/options/zoomcorrection/value", _sb.get_value() / 100.0); _slider.set_value(_sb.get_value()); _ruler.redraw(); freeze = false; @@ -412,7 +408,7 @@ ZoomCorrRulerSlider::on_unit_changed() { return; } Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setString("options.zoomcorrection", "unit", _unit.getUnitAbbr()); + prefs->setString("/options/zoomcorrection/unit", _unit.getUnitAbbr()); double conv = _unit.getConversion(_unit.getUnitAbbr(), "px"); _ruler.set_unit_conversion(conv); if (_ruler.is_visible()) { @@ -425,7 +421,7 @@ ZoomCorrRulerSlider::init(int ruler_width, int ruler_height, double lower, doubl double step_increment, double page_increment, double default_value) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - double value = prefs->getDoubleLimited("options.zoomcorrection", "value", default_value, lower, upper) * 100.0; + double value = prefs->getDoubleLimited("/options/zoomcorrection/value", default_value, lower, upper) * 100.0; freeze = false; @@ -449,7 +445,7 @@ ZoomCorrRulerSlider::init(int ruler_width, int ruler_height, double lower, doubl _unit.set_data("sensitive", GINT_TO_POINTER(0)); _unit.setUnitType(UNIT_TYPE_LINEAR); _unit.set_data("sensitive", GINT_TO_POINTER(1)); - _unit.setUnit(prefs->getString("options.zoomcorrection", "unit")); + _unit.setUnit(prefs->getString("/options/zoomcorrection/unit")); Gtk::Table *table = Gtk::manage(new Gtk::Table()); Gtk::Alignment *alignment1 = Gtk::manage(new Gtk::Alignment(0.5,1,0,0)); @@ -465,14 +461,13 @@ ZoomCorrRulerSlider::init(int ruler_width, int ruler_height, double lower, doubl this->pack_start(*table, Gtk::PACK_EXPAND_WIDGET); } -void PrefCombo::init(Glib::ustring const &prefs_path, Glib::ustring const &attr, +void PrefCombo::init(Glib::ustring const &prefs_path, Glib::ustring labels[], int values[], int num_items, int default_value) { _prefs_path = prefs_path; - _attr = attr; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); int row = 0; - int value = prefs->getInt(_prefs_path, _attr, default_value); + int value = prefs->getInt(_prefs_path, default_value); for (int i = 0 ; i < num_items; ++i) { @@ -489,22 +484,21 @@ void PrefCombo::on_changed() if (this->is_visible()) //only take action if user changed value { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setInt(_prefs_path, _attr, _values[this->get_active_row_number()]); + prefs->setInt(_prefs_path, _values[this->get_active_row_number()]); } } -void PrefEntryButtonHBox::init(Glib::ustring const &prefs_path, Glib::ustring const &attr, +void PrefEntryButtonHBox::init(Glib::ustring const &prefs_path, bool visibility, Glib::ustring const &default_string) { _prefs_path = prefs_path; - _attr = attr; _default_string = default_string; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); relatedEntry = new Gtk::Entry(); relatedButton = new Gtk::Button(_("Reset")); relatedEntry->set_invisible_char('*'); relatedEntry->set_visibility(visibility); - relatedEntry->set_text(prefs->getString(_prefs_path, _attr)); + relatedEntry->set_text(prefs->getString(_prefs_path)); this->pack_start(*relatedEntry); this->pack_start(*relatedButton); relatedButton->signal_clicked().connect( @@ -518,7 +512,7 @@ void PrefEntryButtonHBox::onRelatedEntryChangedCallback() if (this->is_visible()) //only take action if user changed value { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setString(_prefs_path, _attr, relatedEntry->get_text()); + prefs->setString(_prefs_path, relatedEntry->get_text()); } } @@ -527,18 +521,17 @@ void PrefEntryButtonHBox::onRelatedButtonClickedCallback() if (this->is_visible()) //only take action if user changed value { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setString(_prefs_path, _attr, _default_string); + prefs->setString(_prefs_path, _default_string); relatedEntry->set_text(_default_string); } } -void PrefFileButton::init(Glib::ustring const &prefs_path, Glib::ustring const &attr) +void PrefFileButton::init(Glib::ustring const &prefs_path) { _prefs_path = prefs_path; - _attr = attr; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - select_filename(Glib::filename_from_utf8(prefs->getString(_prefs_path, _attr))); + select_filename(Glib::filename_from_utf8(prefs->getString(_prefs_path))); signal_selection_changed().connect(sigc::mem_fun(*this, &PrefFileButton::onFileChanged)); } @@ -546,18 +539,16 @@ void PrefFileButton::init(Glib::ustring const &prefs_path, Glib::ustring const & void PrefFileButton::onFileChanged() { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setString(_prefs_path, _attr, Glib::filename_to_utf8(get_filename())); + prefs->setString(_prefs_path, Glib::filename_to_utf8(get_filename())); } -void PrefEntry::init(Glib::ustring const &prefs_path, Glib::ustring const &attr, - bool visibility) +void PrefEntry::init(Glib::ustring const &prefs_path, bool visibility) { _prefs_path = prefs_path; - _attr = attr; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); this->set_invisible_char('*'); this->set_visibility(visibility); - this->set_text(prefs->getString(_prefs_path, _attr)); + this->set_text(prefs->getString(_prefs_path)); } void PrefEntry::on_changed() @@ -565,18 +556,17 @@ void PrefEntry::on_changed() if (this->is_visible()) //only take action if user changed value { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setString(_prefs_path, _attr, this->get_text()); + prefs->setString(_prefs_path, this->get_text()); } } -void PrefColorPicker::init(Glib::ustring const &label, Glib::ustring const &prefs_path, Glib::ustring const &attr, +void PrefColorPicker::init(Glib::ustring const &label, Glib::ustring const &prefs_path, guint32 default_rgba) { _prefs_path = prefs_path; - _attr = attr; _title = label; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - this->setRgba32( prefs->getInt(_prefs_path, _attr, (int)default_rgba) ); + this->setRgba32( prefs->getInt(_prefs_path, (int)default_rgba) ); } void PrefColorPicker::on_changed (guint32 rgba) @@ -584,17 +574,16 @@ void PrefColorPicker::on_changed (guint32 rgba) if (this->is_visible()) //only take action if the user toggled it { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setInt(_prefs_path, _attr, (int) rgba); + prefs->setInt(_prefs_path, (int) rgba); } } -void PrefUnit::init(Glib::ustring const &prefs_path, Glib::ustring const &attr) +void PrefUnit::init(Glib::ustring const &prefs_path) { _prefs_path = prefs_path; - _attr = attr; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); setUnitType(UNIT_TYPE_LINEAR); - setUnit(prefs->getString(_prefs_path, _attr)); + setUnit(prefs->getString(_prefs_path)); } void PrefUnit::on_changed() @@ -602,7 +591,7 @@ void PrefUnit::on_changed() if (this->is_visible()) //only take action if user changed value { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setString(_prefs_path, _attr, getUnitAbbr()); + prefs->setString(_prefs_path, getUnitAbbr()); } } diff --git a/src/ui/widget/preferences-widget.h b/src/ui/widget/preferences-widget.h index da07db5d9..dbc319c1a 100644 --- a/src/ui/widget/preferences-widget.h +++ b/src/ui/widget/preferences-widget.h @@ -39,25 +39,23 @@ namespace Widget { class PrefCheckButton : public Gtk::CheckButton { public: - void init(Glib::ustring const &label, Glib::ustring const &prefs_path, Glib::ustring const &attr, + void init(Glib::ustring const &label, Glib::ustring const &prefs_path, bool default_value); protected: Glib::ustring _prefs_path; - Glib::ustring _attr; void on_toggled(); }; class PrefRadioButton : public Gtk::RadioButton { public: - void init(Glib::ustring const &label, Glib::ustring const &prefs_path, Glib::ustring const &attr, + void init(Glib::ustring const &label, Glib::ustring const &prefs_path, int int_value, bool default_value, PrefRadioButton* group_member); - void init(Glib::ustring const &label, Glib::ustring const &prefs_path, Glib::ustring const &attr, + void init(Glib::ustring const &label, Glib::ustring const &prefs_path, Glib::ustring const &string_value, bool default_value, PrefRadioButton* group_member); sigc::signal<void, bool> changed_signal; protected: Glib::ustring _prefs_path; - Glib::ustring _attr; Glib::ustring _string_value; int _value_type; enum @@ -72,12 +70,11 @@ protected: class PrefSpinButton : public Gtk::SpinButton { public: - void init(Glib::ustring const &prefs_path, Glib::ustring const &attr, + void init(Glib::ustring const &prefs_path, double lower, double upper, double step_increment, double page_increment, double default_value, bool is_int, bool is_percent); protected: Glib::ustring _prefs_path; - Glib::ustring _attr; bool _is_int; bool _is_percent; void on_value_changed(); @@ -128,11 +125,10 @@ private: class PrefCombo : public Gtk::ComboBoxText { public: - void init(Glib::ustring const &prefs_path, Glib::ustring const &attr, + void init(Glib::ustring const &prefs_path, Glib::ustring labels[], int values[], int num_items, int default_value); protected: Glib::ustring _prefs_path; - Glib::ustring _attr; std::vector<int> _values; void on_changed(); }; @@ -140,22 +136,19 @@ protected: class PrefEntry : public Gtk::Entry { public: - void init(Glib::ustring const &prefs_path, Glib::ustring const &attr, - bool mask); + void init(Glib::ustring const &prefs_path, bool mask); protected: Glib::ustring _prefs_path; - Glib::ustring _attr; void on_changed(); }; class PrefEntryButtonHBox : public Gtk::HBox { public: - void init(Glib::ustring const &prefs_path, Glib::ustring const &attr, + void init(Glib::ustring const &prefs_path, bool mask, Glib::ustring const &default_string); protected: Glib::ustring _prefs_path; - Glib::ustring _attr; Glib::ustring _default_string; Gtk::Button *relatedButton; Gtk::Entry *relatedEntry; @@ -166,11 +159,10 @@ protected: class PrefFileButton : public Gtk::FileChooserButton { public: - void init(Glib::ustring const &prefs_path, Glib::ustring const &attr); + void init(Glib::ustring const &prefs_path); protected: Glib::ustring _prefs_path; - Glib::ustring _attr; void onFileChanged(); }; @@ -180,22 +172,20 @@ public: PrefColorPicker() : ColorPicker("", "", 0, false) {}; virtual ~PrefColorPicker() {}; - void init(Glib::ustring const &abel, Glib::ustring const &prefs_path, Glib::ustring const &attr, + void init(Glib::ustring const &abel, Glib::ustring const &prefs_path, guint32 default_rgba); protected: Glib::ustring _prefs_path; - Glib::ustring _attr; virtual void on_changed (guint32 rgba); }; class PrefUnit : public UnitMenu { public: - void init(Glib::ustring const &prefs_path, Glib::ustring const &attr); + void init(Glib::ustring const &prefs_path); protected: Glib::ustring _prefs_path; - Glib::ustring _attr; void on_changed(); }; diff --git a/src/ui/widget/registered-widget.cpp b/src/ui/widget/registered-widget.cpp index 2cc6e3c62..95ddec286 100644 --- a/src/ui/widget/registered-widget.cpp +++ b/src/ui/widget/registered-widget.cpp @@ -155,6 +155,8 @@ RegisteredScalarUnit::RegisteredScalarUnit (const Glib::ustring& label, const Gl { init_parent(key, wr, repr_in, doc_in); + setProgrammatically = false; + initScalar (-1e6, 1e6); setUnit (rum.getUnitMenu()->getUnitAbbr()); setDigits (2); @@ -203,6 +205,8 @@ RegisteredScalar::RegisteredScalar ( const Glib::ustring& label, const Glib::ust { init_parent(key, wr, repr_in, doc_in); + setProgrammatically = false; + setRange (-1e6, 1e6); setDigits (2); setIncrements(0.1, 1.0); @@ -249,6 +253,8 @@ RegisteredText::RegisteredText ( const Glib::ustring& label, const Glib::ustring { init_parent(key, wr, repr_in, doc_in); + setProgrammatically = false; + setText(""); _activate_connection = signal_activate().connect (sigc::mem_fun (*this, &RegisteredText::on_activate)); } @@ -597,6 +603,8 @@ RegisteredRandom::RegisteredRandom ( const Glib::ustring& label, const Glib::ust { init_parent(key, wr, repr_in, doc_in); + setProgrammatically = false; + setRange (-1e6, 1e6); setDigits (2); setIncrements(0.1, 1.0); diff --git a/src/ui/widget/style-swatch.cpp b/src/ui/widget/style-swatch.cpp index 807c21de5..47f6292e3 100644 --- a/src/ui/widget/style-swatch.cpp +++ b/src/ui/widget/style-swatch.cpp @@ -1,10 +1,11 @@ -/** - * \brief Static style swatch (fill, stroke, opacity) - * - * Author: +/** @file + * @brief Static style swatch (fill, stroke, opacity) + */ +/* Authors: * buliabyak@gmail.com + * Krzysztof Kosiński <tweenk.pl@gmail.com> * - * Copyright (C) 2005 author + * Copyright (C) 2005-2008 Authors * * Released under GNU GPL. Read the file 'COPYING' for more information. */ @@ -26,10 +27,10 @@ #include "sp-radial-gradient-fns.h" #include "sp-pattern.h" #include "xml/repr.h" -#include "xml/node-event-vector.h" #include "widgets/widget-sizes.h" #include "helper/units.h" #include "helper/action.h" +#include "preferences.h" #include "inkscape.h" enum { @@ -37,74 +38,80 @@ enum { SS_STROKE }; -static void style_swatch_attr_changed( Inkscape::XML::Node *repr, gchar const *name, - gchar const */*old_value*/, gchar const */*new_value*/, - bool /*is_interactive*/, gpointer data) -{ - Inkscape::UI::Widget::StyleSwatch *ss = (Inkscape::UI::Widget::StyleSwatch *) data; - - if (!strcmp (name, "style")) { // FIXME: watching only for the style attr, no CSS attrs - SPCSSAttr *css = sp_repr_css_attr_inherited(repr, "style"); - ss->setStyle (css); - } -} - +namespace Inkscape { +namespace UI { +namespace Widget { -static Inkscape::XML::NodeEventVector style_swatch_repr_events = -{ - NULL, /* child_added */ - NULL, /* child_removed */ - style_swatch_attr_changed, - NULL, /* content_changed */ - NULL /* order_changed */ +/** + * @brief Watches whether the tool uses the current style + */ +class StyleSwatch::ToolObserver : public Inkscape::Preferences::Observer { +public: + ToolObserver(Glib::ustring const &path, StyleSwatch &ss) : + Observer(path), + _style_swatch(ss) + {} + virtual void notify(Inkscape::Preferences::Entry const &val); +private: + StyleSwatch &_style_swatch; }; +/** + * @brief Watches for changes in the observed style pref + */ +class StyleSwatch::StyleObserver : public Inkscape::Preferences::Observer { +public: + StyleObserver(Glib::ustring const &path, StyleSwatch &ss) : + Observer(path), + _style_swatch(ss) + { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + this->notify(prefs->getEntry(path)); + } + virtual void notify(Inkscape::Preferences::Entry const &val) { + SPCSSAttr *css = val.getInheritedStyle(); + _style_swatch.setStyle(css); + sp_repr_css_attr_unref(css); + } +private: + StyleSwatch &_style_swatch; +}; -static void style_swatch_tool_attr_changed( Inkscape::XML::Node */*repr*/, gchar const *name, - gchar const */*old_value*/, gchar const *new_value, - bool /*is_interactive*/, gpointer data) +void StyleSwatch::ToolObserver::notify(Inkscape::Preferences::Entry const &val) { - Inkscape::UI::Widget::StyleSwatch *ss = (Inkscape::UI::Widget::StyleSwatch *) data; + bool usecurrent = val.getBool(); - if (!strcmp (name, "usecurrent")) { // FIXME: watching only for the style attr, no CSS attrs - if (!strcmp (new_value, "1")) { - ss->setWatched (inkscape_get_repr(INKSCAPE, "desktop"), inkscape_get_repr(INKSCAPE, ss->_tool_path)); - } else { - ss->setWatched (inkscape_get_repr(INKSCAPE, ss->_tool_path), NULL); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + if (_style_swatch._style_obs) delete _style_swatch._style_obs; + + if (usecurrent) { + _style_swatch._style_obs = new StyleObserver("/desktop/style", _style_swatch); + + // If desktop's last-set style is empty, a tool uses its own fixed style even if set to use + // last-set (so long as it's empty). To correctly show this, we get the tool's style + // if the desktop's style is empty. + SPCSSAttr *css = prefs->getStyle("/desktop/style"); + if (!css->attributeList()) { + SPCSSAttr *css2 = prefs->getInheritedStyle(_style_swatch._tool_path + "/style"); + _style_swatch.setStyle(css2); + sp_repr_css_attr_unref(css2); } - // UGLY HACK: we have to reconnect to the watched tool repr again, retrieving it from the stored - // tool_path, because the actual repr keeps shifting with each change, no idea why - ss->setWatchedTool(ss->_tool_path, false); + sp_repr_css_attr_unref(css); + } else { + _style_swatch._style_obs = new StyleObserver(_style_swatch._tool_path + "/style", _style_swatch); } + prefs->addObserver(*_style_swatch._style_obs); } -static Inkscape::XML::NodeEventVector style_swatch_tool_repr_events = -{ - NULL, /* child_added */ - NULL, /* child_removed */ - style_swatch_tool_attr_changed, - NULL, /* content_changed */ - NULL /* order_changed */ -}; - -namespace Inkscape { -namespace UI { -namespace Widget { - StyleSwatch::StyleSwatch(SPCSSAttr *css, gchar const *main_tip) : - _tool_path(NULL), - _desktop(0), - _verb_t(0), - _css (NULL), - - _watched(NULL), - _watched_tool(NULL), - + _desktop(NULL), + _verb_t(NULL), + _css(NULL), + _tool_obs(NULL), + _style_obs(NULL), _table(2, 6), - _sw_unit(NULL), - _tooltips () { _label[SS_FILL].set_markup(_("Fill:")); @@ -185,72 +192,33 @@ StyleSwatch::~StyleSwatch() delete _color_preview[i]; } - if (_watched) { - sp_repr_remove_listener_by_data(_watched, this); - Inkscape::GC::release(_watched); - _watched = NULL; - } - - if (_watched_tool) { - sp_repr_remove_listener_by_data(_watched_tool, this); - Inkscape::GC::release(_watched_tool); - _watched_tool = NULL; - _tool_path = NULL; - } -} - -void -StyleSwatch::setWatched(Inkscape::XML::Node *watched, Inkscape::XML::Node *secondary) -{ - if (_watched) { - sp_repr_remove_listener_by_data(_watched, this); - Inkscape::GC::release(_watched); - _watched = NULL; - } - - if (watched) { - _watched = watched; - Inkscape::GC::anchor(_watched); - sp_repr_add_listener(_watched, &style_swatch_repr_events, this); - sp_repr_synthesize_events(_watched, &style_swatch_repr_events, this); - - // If desktop's last-set style is empty, a tool uses its own fixed style even if set to use - // last-set (so long as it's empty). To correctly show this, we're passed the second repr, - // that of the tool prefs node, from which we now setStyle if the watched repr's style is - // empty. - if (secondary) { - SPCSSAttr *css = sp_repr_css_attr_inherited(watched, "style"); - if (!css->attributeList()) { // is css empty? - SPCSSAttr *css_secondary = sp_repr_css_attr_inherited(secondary, "style"); - this->setStyle (css_secondary); - } - } - } + if (_style_obs) delete _style_obs; + if (_tool_obs) delete _tool_obs; } void StyleSwatch::setWatchedTool(const char *path, bool synthesize) { - if (_watched_tool) { - sp_repr_remove_listener_by_data(_watched_tool, this); - Inkscape::GC::release(_watched_tool); - _watched_tool = NULL; - _tool_path = NULL; + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + + if (_tool_obs) { + delete _tool_obs; + _tool_obs = NULL; } if (path) { - _tool_path = (char *) path; - Inkscape::XML::Node *watched_tool = inkscape_get_repr(INKSCAPE, path); - if (watched_tool) { - _watched_tool = watched_tool; - Inkscape::GC::anchor(_watched_tool); - sp_repr_add_listener(_watched_tool, &style_swatch_tool_repr_events, this); - if (synthesize) { - sp_repr_synthesize_events(_watched_tool, &style_swatch_tool_repr_events, this); - } - } + _tool_path = path; + _tool_obs = new ToolObserver(_tool_path + "/usecurrent", *this); + prefs->addObserver(*_tool_obs); + } else { + _tool_path = ""; + } + + // hack until there is a real synthesize events function for prefs, + // which shouldn't be hard to write once there is sufficient need for it + if (synthesize && _tool_obs) { + _tool_obs->notify(prefs->getEntry(_tool_path + "/usecurrent")); } - } diff --git a/src/ui/widget/style-swatch.h b/src/ui/widget/style-swatch.h index 5efd561f3..dfbbe13d3 100644 --- a/src/ui/widget/style-swatch.h +++ b/src/ui/widget/style-swatch.h @@ -1,10 +1,11 @@ -/** - * \brief Static style swatch (fill, stroke, opacity) - * - * Author: +/** @file + * @brief Static style swatch (fill, stroke, opacity) + */ +/* Authors: * buliabyak@gmail.com + * Krzysztof Kosiński <tweenk.pl@gmail.com> * - * Copyright (C) 2005 author + * Copyright (C) 2005-2008 Authors * * Released under GNU GPL. Read the file 'COPYING' for more information. */ @@ -20,22 +21,16 @@ #include <glibmm/i18n.h> -#include <desktop.h> -#include <verbs.h> - +#include "desktop.h" +#include "verbs.h" #include "button.h" +#include "preferences.h" class SPUnit; class SPStyle; class SPCSSAttr; namespace Inkscape { -namespace XML { -class Node; -} -} - -namespace Inkscape { namespace UI { namespace Widget { @@ -50,40 +45,32 @@ public: void setStyle(SPCSSAttr *attr); SPCSSAttr *getStyle(); - void setWatched (Inkscape::XML::Node *watched, Inkscape::XML::Node *secondary); void setWatchedTool (const char *path, bool synthesize); void setClickVerb(sp_verb_t verb_t); void setDesktop(SPDesktop *desktop); bool on_click(GdkEventButton *event); - char *_tool_path; +private: + class ToolObserver; + class StyleObserver; -protected: SPDesktop *_desktop; - sp_verb_t _verb_t; - SPCSSAttr *_css; - - Inkscape::XML::Node *_watched; - Inkscape::XML::Node *_watched_tool; + ToolObserver *_tool_obs; + StyleObserver *_style_obs; + Glib::ustring _tool_path; Gtk::EventBox _swatch; - Gtk::Table _table; - Gtk::Label _label[2]; - Gtk::EventBox _place[2]; Gtk::EventBox _opacity_place; - Gtk::Label _value[2]; Gtk::Label _opacity_value; - Gtk::Widget *_color_preview[2]; Glib::ustring __color[2]; - Gtk::HBox _stroke; Gtk::EventBox _stroke_width_place; Gtk::Label _stroke_width; @@ -91,6 +78,8 @@ protected: SPUnit *_sw_unit; Gtk::Tooltips _tooltips; + +friend class ToolObserver; }; |
