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/dialogs | |
| parent | Merging from trunk (diff) | |
| download | inkscape-7dbe11bc23efa5f51a9b84e7d0f6dd16e63e0902.tar.gz inkscape-7dbe11bc23efa5f51a9b84e7d0f6dd16e63e0902.zip | |
From trunk
(bzr r6885)
Diffstat (limited to 'src/dialogs')
| -rw-r--r-- | src/dialogs/clonetiler.cpp | 260 | ||||
| -rw-r--r-- | src/dialogs/dialog-events.cpp | 10 | ||||
| -rw-r--r-- | src/dialogs/export.cpp | 28 | ||||
| -rw-r--r-- | src/dialogs/fill-style.cpp | 28 | ||||
| -rw-r--r-- | src/dialogs/find.cpp | 22 | ||||
| -rw-r--r-- | src/dialogs/iconpreview.cpp | 60 | ||||
| -rw-r--r-- | src/dialogs/input.cpp | 173 | ||||
| -rw-r--r-- | src/dialogs/item-properties.cpp | 23 | ||||
| -rw-r--r-- | src/dialogs/layers-panel.cpp | 7 | ||||
| -rw-r--r-- | src/dialogs/stroke-style.cpp | 9 | ||||
| -rw-r--r-- | src/dialogs/swatches.cpp | 8 | ||||
| -rw-r--r-- | src/dialogs/swatches.h | 2 | ||||
| -rw-r--r-- | src/dialogs/text-edit.cpp | 37 | ||||
| -rw-r--r-- | src/dialogs/tiledialog.cpp | 155 | ||||
| -rw-r--r-- | src/dialogs/xml-tree.cpp | 22 |
15 files changed, 402 insertions, 442 deletions
diff --git a/src/dialogs/clonetiler.cpp b/src/dialogs/clonetiler.cpp index c27c2b666..ce0fc15df 100644 --- a/src/dialogs/clonetiler.cpp +++ b/src/dialogs/clonetiler.cpp @@ -68,7 +68,7 @@ static win_data wd; // impossible original values to make sure they are read from prefs static gint x = -1000, y = -1000, w = 0, h = 0; -static gchar const *prefs_path = "dialogs.clonetiler"; +static Glib::ustring const prefs_path = "/dialogs/clonetiler/"; #define SB_MARGIN 1 #define VB_MARGIN 4 @@ -125,10 +125,10 @@ clonetiler_dialog_delete (GtkObject */*object*/, GdkEvent * /*event*/, gpointer if (y<0) y=0; 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); + prefs->setInt(prefs_path + "x", x); + prefs->setInt(prefs_path + "y", y); + prefs->setInt(prefs_path + "w", w); + prefs->setInt(prefs_path + "h", h); return FALSE; // which means, go ahead and destroy it @@ -151,7 +151,7 @@ on_picker_color_changed (guint rgba) gchar c[32]; sp_svg_write_color(c, sizeof(c), rgba); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setString(prefs_path, "initial_color", c); + prefs->setString(prefs_path + "initial_color", c); is_updating = false; } @@ -1134,89 +1134,87 @@ clonetiler_apply( GtkWidget */*widget*/, void * ) clonetiler_remove (NULL, NULL, false); - double shiftx_per_i = 0.01 * prefs->getDoubleLimited(prefs_path, "shiftx_per_i", 0, -10000, 10000); - double shifty_per_i = 0.01 * prefs->getDoubleLimited(prefs_path, "shifty_per_i", 0, -10000, 10000); - double shiftx_per_j = 0.01 * prefs->getDoubleLimited(prefs_path, "shiftx_per_j", 0, -10000, 10000); - double shifty_per_j = 0.01 * prefs->getDoubleLimited(prefs_path, "shifty_per_j", 0, -10000, 10000); - double shiftx_rand = 0.01 * prefs->getDoubleLimited(prefs_path, "shiftx_rand", 0, 0, 1000); - double shifty_rand = 0.01 * prefs->getDoubleLimited(prefs_path, "shifty_rand", 0, 0, 1000); - double shiftx_exp = prefs->getDoubleLimited(prefs_path, "shiftx_exp", 1, 0, 10); - double shifty_exp = prefs->getDoubleLimited(prefs_path, "shifty_exp", 1, 0, 10); - bool shiftx_alternate = prefs->getBool(prefs_path, "shiftx_alternate"); - bool shifty_alternate = prefs->getBool(prefs_path, "shifty_alternate"); - bool shiftx_cumulate = prefs->getBool(prefs_path, "shiftx_cumulate"); - bool shifty_cumulate = prefs->getBool(prefs_path, "shifty_cumulate"); - bool shiftx_excludew = prefs->getBool(prefs_path, "shiftx_excludew"); - bool shifty_excludeh = prefs->getBool(prefs_path, "shifty_excludeh"); - - double scalex_per_i = 0.01 * prefs->getDoubleLimited(prefs_path, "scalex_per_i", 0, -100, 1000); - double scaley_per_i = 0.01 * prefs->getDoubleLimited(prefs_path, "scaley_per_i", 0, -100, 1000); - double scalex_per_j = 0.01 * prefs->getDoubleLimited(prefs_path, "scalex_per_j", 0, -100, 1000); - double scaley_per_j = 0.01 * prefs->getDoubleLimited(prefs_path, "scaley_per_j", 0, -100, 1000); - double scalex_rand = 0.01 * prefs->getDoubleLimited(prefs_path, "scalex_rand", 0, 0, 1000); - double scaley_rand = 0.01 * prefs->getDoubleLimited(prefs_path, "scaley_rand", 0, 0, 1000); - double scalex_exp = prefs->getDoubleLimited(prefs_path, "scalex_exp", 1, 0, 10); - double scaley_exp = prefs->getDoubleLimited(prefs_path, "scaley_exp", 1, 0, 10); - double scalex_log = prefs->getDoubleLimited(prefs_path, "scalex_log", 0, 0, 10); - double scaley_log = prefs->getDoubleLimited(prefs_path, "scaley_log", 0, 0, 10); - bool scalex_alternate = prefs->getBool(prefs_path, "scalex_alternate"); - bool scaley_alternate = prefs->getBool(prefs_path, "scaley_alternate"); - bool scalex_cumulate = prefs->getBool(prefs_path, "scalex_cumulate"); - bool scaley_cumulate = prefs->getBool(prefs_path, "scaley_cumulate"); - - double rotate_per_i = prefs->getDoubleLimited(prefs_path, "rotate_per_i", 0, -180, 180); - double rotate_per_j = prefs->getDoubleLimited(prefs_path, "rotate_per_j", 0, -180, 180); - double rotate_rand = 0.01 * prefs->getDoubleLimited(prefs_path, "rotate_rand", 0, 0, 100); - bool rotate_alternatei = prefs->getBool(prefs_path, "rotate_alternatei"); - bool rotate_alternatej = prefs->getBool(prefs_path, "rotate_alternatej"); - bool rotate_cumulatei = prefs->getBool(prefs_path, "rotate_cumulatei"); - bool rotate_cumulatej = prefs->getBool(prefs_path, "rotate_cumulatej"); - - double blur_per_i = 0.01 * prefs->getDoubleLimited(prefs_path, "blur_per_i", 0, 0, 100); - double blur_per_j = 0.01 * prefs->getDoubleLimited(prefs_path, "blur_per_j", 0, 0, 100); - bool blur_alternatei = prefs->getBool(prefs_path, "blur_alternatei"); - bool blur_alternatej = prefs->getBool(prefs_path, "blur_alternatej"); - double blur_rand = 0.01 * prefs->getDoubleLimited(prefs_path, "blur_rand", 0, 0, 100); - - double opacity_per_i = 0.01 * prefs->getDoubleLimited(prefs_path, "opacity_per_i", 0, 0, 100); - double opacity_per_j = 0.01 * prefs->getDoubleLimited(prefs_path, "opacity_per_j", 0, 0, 100); - bool opacity_alternatei = prefs->getBool(prefs_path, "opacity_alternatei"); - bool opacity_alternatej = prefs->getBool(prefs_path, "opacity_alternatej"); - double opacity_rand = 0.01 * prefs->getDoubleLimited(prefs_path, "opacity_rand", 0, 0, 100); - - Glib::ustring initial_color = prefs->getString(prefs_path, "initial_color"); - double hue_per_j = 0.01 * prefs->getDoubleLimited(prefs_path, "hue_per_j", 0, -100, 100); - double hue_per_i = 0.01 * prefs->getDoubleLimited(prefs_path, "hue_per_i", 0, -100, 100); - double hue_rand = 0.01 * prefs->getDoubleLimited(prefs_path, "hue_rand", 0, 0, 100); - double saturation_per_j = 0.01 * prefs->getDoubleLimited(prefs_path, "saturation_per_j", 0, -100, 100); - double saturation_per_i = 0.01 * prefs->getDoubleLimited(prefs_path, "saturation_per_i", 0, -100, 100); - double saturation_rand = 0.01 * prefs->getDoubleLimited(prefs_path, "saturation_rand", 0, 0, 100); - double lightness_per_j = 0.01 * prefs->getDoubleLimited(prefs_path, "lightness_per_j", 0, -100, 100); - double lightness_per_i = 0.01 * prefs->getDoubleLimited(prefs_path, "lightness_per_i", 0, -100, 100); - double lightness_rand = 0.01 * prefs->getDoubleLimited(prefs_path, "lightness_rand", 0, 0, 100); - bool color_alternatej = prefs->getBool(prefs_path, "color_alternatej"); - bool color_alternatei = prefs->getBool(prefs_path, "color_alternatei"); - - int type = prefs->getInt(prefs_path, "symmetrygroup", 0); - - bool keepbbox = prefs->getBool(prefs_path, "keepbbox", true); - - int imax = prefs->getInt(prefs_path, "imax", 2); - int jmax = prefs->getInt(prefs_path, "jmax", 2); - - bool fillrect = prefs->getBool(prefs_path, "fillrect"); - double fillwidth = prefs->getDoubleLimited(prefs_path, "fillwidth", 50, 0, 1e6); - double fillheight = prefs->getDoubleLimited(prefs_path, "fillheight", 50, 0, 1e6); - - bool dotrace = prefs->getBool(prefs_path, "dotrace"); - int pick = prefs->getInt(prefs_path, "pick"); - bool pick_to_presence = prefs->getBool(prefs_path, "pick_to_presence"); - bool pick_to_size = prefs->getBool(prefs_path, "pick_to_size"); - bool pick_to_color = prefs->getBool(prefs_path, "pick_to_color"); - bool pick_to_opacity = prefs->getBool(prefs_path, "pick_to_opacity"); - double rand_picked = 0.01 * prefs->getDoubleLimited(prefs_path, "rand_picked", 0, 0, 100); - bool invert_picked = prefs->getBool(prefs_path, "invert_picked"); - double gamma_picked = prefs->getDoubleLimited(prefs_path, "gamma_picked", 0, -10, 10); + double shiftx_per_i = 0.01 * prefs->getDoubleLimited(prefs_path + "shiftx_per_i", 0, -10000, 10000); + double shifty_per_i = 0.01 * prefs->getDoubleLimited(prefs_path + "shifty_per_i", 0, -10000, 10000); + double shiftx_per_j = 0.01 * prefs->getDoubleLimited(prefs_path + "shiftx_per_j", 0, -10000, 10000); + double shifty_per_j = 0.01 * prefs->getDoubleLimited(prefs_path + "shifty_per_j", 0, -10000, 10000); + double shiftx_rand = 0.01 * prefs->getDoubleLimited(prefs_path + "shiftx_rand", 0, 0, 1000); + double shifty_rand = 0.01 * prefs->getDoubleLimited(prefs_path + "shifty_rand", 0, 0, 1000); + double shiftx_exp = prefs->getDoubleLimited(prefs_path + "shiftx_exp", 1, 0, 10); + double shifty_exp = prefs->getDoubleLimited(prefs_path + "shifty_exp", 1, 0, 10); + bool shiftx_alternate = prefs->getBool(prefs_path + "shiftx_alternate"); + bool shifty_alternate = prefs->getBool(prefs_path + "shifty_alternate"); + bool shiftx_cumulate = prefs->getBool(prefs_path + "shiftx_cumulate"); + bool shifty_cumulate = prefs->getBool(prefs_path + "shifty_cumulate"); + bool shiftx_excludew = prefs->getBool(prefs_path + "shiftx_excludew"); + bool shifty_excludeh = prefs->getBool(prefs_path + "shifty_excludeh"); + + double scalex_per_i = 0.01 * prefs->getDoubleLimited(prefs_path + "scalex_per_i", 0, -100, 1000); + double scaley_per_i = 0.01 * prefs->getDoubleLimited(prefs_path + "scaley_per_i", 0, -100, 1000); + double scalex_per_j = 0.01 * prefs->getDoubleLimited(prefs_path + "scalex_per_j", 0, -100, 1000); + double scaley_per_j = 0.01 * prefs->getDoubleLimited(prefs_path + "scaley_per_j", 0, -100, 1000); + double scalex_rand = 0.01 * prefs->getDoubleLimited(prefs_path + "scalex_rand", 0, 0, 1000); + double scaley_rand = 0.01 * prefs->getDoubleLimited(prefs_path + "scaley_rand", 0, 0, 1000); + double scalex_exp = prefs->getDoubleLimited(prefs_path + "scalex_exp", 1, 0, 10); + double scaley_exp = prefs->getDoubleLimited(prefs_path + "scaley_exp", 1, 0, 10); + double scalex_log = prefs->getDoubleLimited(prefs_path + "scalex_log", 0, 0, 10); + double scaley_log = prefs->getDoubleLimited(prefs_path + "scaley_log", 0, 0, 10); + bool scalex_alternate = prefs->getBool(prefs_path + "scalex_alternate"); + bool scaley_alternate = prefs->getBool(prefs_path + "scaley_alternate"); + bool scalex_cumulate = prefs->getBool(prefs_path + "scalex_cumulate"); + bool scaley_cumulate = prefs->getBool(prefs_path + "scaley_cumulate"); + + double rotate_per_i = prefs->getDoubleLimited(prefs_path + "rotate_per_i", 0, -180, 180); + double rotate_per_j = prefs->getDoubleLimited(prefs_path + "rotate_per_j", 0, -180, 180); + double rotate_rand = 0.01 * prefs->getDoubleLimited(prefs_path + "rotate_rand", 0, 0, 100); + bool rotate_alternatei = prefs->getBool(prefs_path + "rotate_alternatei"); + bool rotate_alternatej = prefs->getBool(prefs_path + "rotate_alternatej"); + bool rotate_cumulatei = prefs->getBool(prefs_path + "rotate_cumulatei"); + bool rotate_cumulatej = prefs->getBool(prefs_path + "rotate_cumulatej"); + + double blur_per_i = 0.01 * prefs->getDoubleLimited(prefs_path + "blur_per_i", 0, 0, 100); + double blur_per_j = 0.01 * prefs->getDoubleLimited(prefs_path + "blur_per_j", 0, 0, 100); + bool blur_alternatei = prefs->getBool(prefs_path + "blur_alternatei"); + bool blur_alternatej = prefs->getBool(prefs_path + "blur_alternatej"); + double blur_rand = 0.01 * prefs->getDoubleLimited(prefs_path + "blur_rand", 0, 0, 100); + + double opacity_per_i = 0.01 * prefs->getDoubleLimited(prefs_path + "opacity_per_i", 0, 0, 100); + double opacity_per_j = 0.01 * prefs->getDoubleLimited(prefs_path + "opacity_per_j", 0, 0, 100); + bool opacity_alternatei = prefs->getBool(prefs_path + "opacity_alternatei"); + bool opacity_alternatej = prefs->getBool(prefs_path + "opacity_alternatej"); + double opacity_rand = 0.01 * prefs->getDoubleLimited(prefs_path + "opacity_rand", 0, 0, 100); + + Glib::ustring initial_color = prefs->getString(prefs_path + "initial_color"); + double hue_per_j = 0.01 * prefs->getDoubleLimited(prefs_path + "hue_per_j", 0, -100, 100); + double hue_per_i = 0.01 * prefs->getDoubleLimited(prefs_path + "hue_per_i", 0, -100, 100); + double hue_rand = 0.01 * prefs->getDoubleLimited(prefs_path + "hue_rand", 0, 0, 100); + double saturation_per_j = 0.01 * prefs->getDoubleLimited(prefs_path + "saturation_per_j", 0, -100, 100); + double saturation_per_i = 0.01 * prefs->getDoubleLimited(prefs_path + "saturation_per_i", 0, -100, 100); + double saturation_rand = 0.01 * prefs->getDoubleLimited(prefs_path + "saturation_rand", 0, 0, 100); + double lightness_per_j = 0.01 * prefs->getDoubleLimited(prefs_path + "lightness_per_j", 0, -100, 100); + double lightness_per_i = 0.01 * prefs->getDoubleLimited(prefs_path + "lightness_per_i", 0, -100, 100); + double lightness_rand = 0.01 * prefs->getDoubleLimited(prefs_path + "lightness_rand", 0, 0, 100); + bool color_alternatej = prefs->getBool(prefs_path + "color_alternatej"); + bool color_alternatei = prefs->getBool(prefs_path + "color_alternatei"); + + int type = prefs->getInt(prefs_path + "symmetrygroup", 0); + bool keepbbox = prefs->getBool(prefs_path + "keepbbox", true); + int imax = prefs->getInt(prefs_path + "imax", 2); + int jmax = prefs->getInt(prefs_path + "jmax", 2); + + bool fillrect = prefs->getBool(prefs_path + "fillrect"); + double fillwidth = prefs->getDoubleLimited(prefs_path + "fillwidth", 50, 0, 1e6); + double fillheight = prefs->getDoubleLimited(prefs_path + "fillheight", 50, 0, 1e6); + + bool dotrace = prefs->getBool(prefs_path + "dotrace"); + int pick = prefs->getInt(prefs_path + "pick"); + bool pick_to_presence = prefs->getBool(prefs_path + "pick_to_presence"); + bool pick_to_size = prefs->getBool(prefs_path + "pick_to_size"); + bool pick_to_color = prefs->getBool(prefs_path + "pick_to_color"); + bool pick_to_opacity = prefs->getBool(prefs_path + "pick_to_opacity"); + double rand_picked = 0.01 * prefs->getDoubleLimited(prefs_path + "rand_picked", 0, 0, 100); + bool invert_picked = prefs->getBool(prefs_path + "invert_picked"); + double gamma_picked = prefs->getDoubleLimited(prefs_path + "gamma_picked", 0, -10, 10); if (dotrace) { clonetiler_trace_setup (sp_desktop_document(desktop), 1.0, SP_ITEM (obj)); @@ -1245,7 +1243,7 @@ clonetiler_apply( GtkWidget */*widget*/, void * ) x0 = sp_repr_get_double_attribute (obj_repr, "inkscape:tile-x0", 0); y0 = sp_repr_get_double_attribute (obj_repr, "inkscape:tile-y0", 0); } else { - bool prefs_bbox = prefs->getBool("tools", "bounding_box", false); + bool prefs_bbox = prefs->getBool("/tools/bounding_box", false); SPItem::BBoxType bbox_type = ( prefs_bbox ? SPItem::APPROXIMATE_BBOX : SPItem::GEOMETRIC_BBOX ); boost::optional<Geom::Rect> r = SP_ITEM(obj)->getBounds(sp_item_i2doc_affine(SP_ITEM(obj)), @@ -1546,7 +1544,7 @@ clonetiler_checkbox_toggled (GtkToggleButton *tb, gpointer *data) { const gchar *attr = (const gchar *) data; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setBool(prefs_path, attr, gtk_toggle_button_get_active(tb)); + prefs->setBool(prefs_path + attr, gtk_toggle_button_get_active(tb)); } static GtkWidget * @@ -1558,7 +1556,7 @@ clonetiler_checkbox (GtkTooltips *tt, const char *tip, const char *attr) gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), b, tip, NULL); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - bool value = prefs->getBool(prefs_path, attr); + bool value = prefs->getBool(prefs_path + attr); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(b), value); gtk_box_pack_end (GTK_BOX (hb), b, FALSE, TRUE, 0); @@ -1576,7 +1574,7 @@ clonetiler_value_changed (GtkAdjustment *adj, gpointer data) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); const gchar *pref = (const gchar *) data; - prefs->setDouble(prefs_path, pref, adj->value); + prefs->setDouble(prefs_path + pref, adj->value); } static GtkWidget * @@ -1602,7 +1600,7 @@ clonetiler_spinbox (GtkTooltips *tt, const char *tip, const char *attr, double l gtk_box_pack_start (GTK_BOX (hb), sb, FALSE, FALSE, SB_MARGIN); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - double value = prefs->getDoubleLimited(prefs_path, attr, exponent? 1.0 : 0.0, lower, upper); + double value = prefs->getDoubleLimited(prefs_path + attr, exponent? 1.0 : 0.0, lower, upper); gtk_adjustment_set_value (GTK_ADJUSTMENT (a), value); gtk_signal_connect(GTK_OBJECT(a), "value_changed", GTK_SIGNAL_FUNC(clonetiler_value_changed), (gpointer) attr); @@ -1628,7 +1626,7 @@ clonetiler_symgroup_changed( GtkMenuItem */*item*/, gpointer data ) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); gint group_new = GPOINTER_TO_INT (data); - prefs->setInt(prefs_path, "symmetrygroup", group_new); + prefs->setInt(prefs_path + "symmetrygroup", group_new); } static void @@ -1636,14 +1634,14 @@ clonetiler_xy_changed (GtkAdjustment *adj, gpointer data) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); const gchar *pref = (const gchar *) data; - prefs->setInt(prefs_path, pref, (int) floor(adj->value + 0.5)); + prefs->setInt(prefs_path + pref, (int) floor(adj->value + 0.5)); } static void clonetiler_keep_bbox_toggled( GtkToggleButton *tb, gpointer /*data*/ ) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setBool(prefs_path, "keepbbox", gtk_toggle_button_get_active(tb)); + prefs->setBool(prefs_path + "keepbbox", gtk_toggle_button_get_active(tb)); } static void @@ -1651,7 +1649,7 @@ clonetiler_pick_to (GtkToggleButton *tb, gpointer data) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); const gchar *pref = (const gchar *) data; - prefs->setBool(prefs_path, pref, gtk_toggle_button_get_active(tb)); + prefs->setBool(prefs_path + pref, gtk_toggle_button_get_active(tb)); } @@ -1752,7 +1750,7 @@ clonetiler_pick_switched( GtkToggleButton */*tb*/, gpointer data ) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); guint v = GPOINTER_TO_INT (data); - prefs->setInt(prefs_path, "pick", v); + prefs->setInt(prefs_path + "pick", v); } @@ -1770,7 +1768,7 @@ clonetiler_switch_to_create( GtkToggleButton */*tb*/, GtkWidget *dlg ) } Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setBool(prefs_path, "fillrect", false); + prefs->setBool(prefs_path + "fillrect", false); } @@ -1788,7 +1786,7 @@ clonetiler_switch_to_fill( GtkToggleButton */*tb*/, GtkWidget *dlg ) } Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setBool(prefs_path, "fillrect", true); + prefs->setBool(prefs_path + "fillrect", true); } @@ -1802,7 +1800,7 @@ clonetiler_fill_width_changed (GtkAdjustment *adj, GtkWidget *u) gdouble const pixels = sp_units_get_pixels (raw_dist, unit); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setDouble(prefs_path, "fillwidth", pixels); + prefs->setDouble(prefs_path + "fillwidth", pixels); } static void @@ -1813,7 +1811,7 @@ clonetiler_fill_height_changed (GtkAdjustment *adj, GtkWidget *u) gdouble const pixels = sp_units_get_pixels (raw_dist, unit); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setDouble(prefs_path, "fillheight", pixels); + prefs->setDouble(prefs_path + "fillheight", pixels); } @@ -1823,7 +1821,7 @@ clonetiler_do_pick_toggled( GtkToggleButton *tb, gpointer /*data*/ ) GtkWidget *vvb = (GtkWidget *) g_object_get_data (G_OBJECT(dlg), "dotrace"); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setBool(prefs_path, "dotrace", gtk_toggle_button_get_active (tb)); + prefs->setBool(prefs_path + "dotrace", gtk_toggle_button_get_active (tb)); if (vvb) gtk_widget_set_sensitive (vvb, gtk_toggle_button_get_active (tb)); @@ -1843,13 +1841,13 @@ clonetiler_dialog (void) dlg = sp_window_new (title, TRUE); if (x == -1000 || y == -1000) { - x = prefs->getInt(prefs_path, "x", -1000); - y = prefs->getInt(prefs_path, "y", -1000); + x = prefs->getInt(prefs_path + "x", -1000); + y = prefs->getInt(prefs_path + "y", -1000); } if (w ==0 || h == 0) { - w = prefs->getInt(prefs_path, "w", 0); - h = prefs->getInt(prefs_path, "h", 0); + w = prefs->getInt(prefs_path + "w", 0); + h = prefs->getInt(prefs_path + "h", 0); } // if (x<0) x=0; @@ -1913,7 +1911,7 @@ clonetiler_dialog (void) gtk_box_pack_start (GTK_BOX (vb), om, FALSE, FALSE, SB_MARGIN); GtkWidget *m = gtk_menu_new (); - int current = prefs->getInt(prefs_path, "symmetrygroup", 0); + int current = prefs->getInt(prefs_path + "symmetrygroup", 0); struct SymGroups { int group; @@ -2461,7 +2459,7 @@ clonetiler_dialog (void) GtkWidget *l = gtk_label_new (_("Initial color: ")); gtk_box_pack_start (GTK_BOX (hb), l, FALSE, FALSE, 0); - guint32 rgba = 0x000000ff | sp_svg_read_color (prefs->getString(prefs_path, "initial_color").data(), 0x000000ff); + guint32 rgba = 0x000000ff | sp_svg_read_color (prefs->getString(prefs_path + "initial_color").data(), 0x000000ff); color_picker = new Inkscape::UI::Widget::ColorPicker (*new Glib::ustring(_("Initial color of tiled clones")), *new Glib::ustring(_("Initial color for clones (works only if the original has unset fill or stroke)")), rgba, false); _color_changed_connection = color_picker->connectChanged (sigc::ptr_fun(on_picker_color_changed)); @@ -2593,7 +2591,7 @@ clonetiler_dialog (void) GtkWidget *b = gtk_check_button_new_with_label (_("Trace the drawing under the tiles")); g_object_set_data (G_OBJECT(b), "uncheckable", GINT_TO_POINTER(TRUE)); - bool old = prefs->getBool(prefs_path, "dotrace"); + bool old = prefs->getBool(prefs_path + "dotrace"); gtk_toggle_button_set_active ((GtkToggleButton *) b, old); gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), b, _("For each clone, pick a value from the drawing in that clone's location and apply it to the clone"), NULL); gtk_box_pack_start (GTK_BOX (hb), b, FALSE, FALSE, 0); @@ -2625,7 +2623,7 @@ clonetiler_dialog (void) clonetiler_table_attach (table, radio, 0.0, 1, 1); gtk_signal_connect (GTK_OBJECT (radio), "toggled", GTK_SIGNAL_FUNC (clonetiler_pick_switched), GINT_TO_POINTER(PICK_COLOR)); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path, "pick", 0) == PICK_COLOR); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_COLOR); } { radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), _("Opacity")); @@ -2633,7 +2631,7 @@ clonetiler_dialog (void) clonetiler_table_attach (table, radio, 0.0, 2, 1); gtk_signal_connect (GTK_OBJECT (radio), "toggled", GTK_SIGNAL_FUNC (clonetiler_pick_switched), GINT_TO_POINTER(PICK_OPACITY)); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path, "pick", 0) == PICK_OPACITY); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_OPACITY); } { radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), _("R")); @@ -2641,7 +2639,7 @@ clonetiler_dialog (void) clonetiler_table_attach (table, radio, 0.0, 1, 2); gtk_signal_connect (GTK_OBJECT (radio), "toggled", GTK_SIGNAL_FUNC (clonetiler_pick_switched), GINT_TO_POINTER(PICK_R)); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path, "pick", 0) == PICK_R); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_R); } { radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), _("G")); @@ -2649,7 +2647,7 @@ clonetiler_dialog (void) clonetiler_table_attach (table, radio, 0.0, 2, 2); gtk_signal_connect (GTK_OBJECT (radio), "toggled", GTK_SIGNAL_FUNC (clonetiler_pick_switched), GINT_TO_POINTER(PICK_G)); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path, "pick", 0) == PICK_G); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_G); } { radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), _("B")); @@ -2657,7 +2655,7 @@ clonetiler_dialog (void) clonetiler_table_attach (table, radio, 0.0, 3, 2); gtk_signal_connect (GTK_OBJECT (radio), "toggled", GTK_SIGNAL_FUNC (clonetiler_pick_switched), GINT_TO_POINTER(PICK_B)); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path, "pick", 0) == PICK_B); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_B); } { //TRANSLATORS: only translate "string" in "context|string". @@ -2667,7 +2665,7 @@ clonetiler_dialog (void) clonetiler_table_attach (table, radio, 0.0, 1, 3); gtk_signal_connect (GTK_OBJECT (radio), "toggled", GTK_SIGNAL_FUNC (clonetiler_pick_switched), GINT_TO_POINTER(PICK_H)); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path, "pick", 0) == PICK_H); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_H); } { //TRANSLATORS: only translate "string" in "context|string". @@ -2677,7 +2675,7 @@ clonetiler_dialog (void) clonetiler_table_attach (table, radio, 0.0, 2, 3); gtk_signal_connect (GTK_OBJECT (radio), "toggled", GTK_SIGNAL_FUNC (clonetiler_pick_switched), GINT_TO_POINTER(PICK_S)); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path, "pick", 0) == PICK_S); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_S); } { //TRANSLATORS: only translate "string" in "context|string". @@ -2687,7 +2685,7 @@ clonetiler_dialog (void) clonetiler_table_attach (table, radio, 0.0, 3, 3); gtk_signal_connect (GTK_OBJECT (radio), "toggled", GTK_SIGNAL_FUNC (clonetiler_pick_switched), GINT_TO_POINTER(PICK_L)); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path, "pick", 0) == PICK_L); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_L); } } @@ -2748,7 +2746,7 @@ clonetiler_dialog (void) { GtkWidget *b = gtk_check_button_new_with_label (_("Presence")); - bool old = prefs->getBool(prefs_path, "pick_to_presence", true); + bool old = prefs->getBool(prefs_path + "pick_to_presence", true); gtk_toggle_button_set_active ((GtkToggleButton *) b, old); gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), b, _("Each clone is created with the probability determined by the picked value in that point"), NULL); clonetiler_table_attach (table, b, 0.0, 1, 1); @@ -2758,7 +2756,7 @@ clonetiler_dialog (void) { GtkWidget *b = gtk_check_button_new_with_label (_("Size")); - bool old = prefs->getBool(prefs_path, "pick_to_size"); + bool old = prefs->getBool(prefs_path + "pick_to_size"); gtk_toggle_button_set_active ((GtkToggleButton *) b, old); gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), b, _("Each clone's size is determined by the picked value in that point"), NULL); clonetiler_table_attach (table, b, 0.0, 2, 1); @@ -2768,7 +2766,7 @@ clonetiler_dialog (void) { GtkWidget *b = gtk_check_button_new_with_label (_("Color")); - bool old = prefs->getBool(prefs_path, "pick_to_color", 0); + bool old = prefs->getBool(prefs_path + "pick_to_color", 0); gtk_toggle_button_set_active ((GtkToggleButton *) b, old); gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), b, _("Each clone is painted by the picked color (the original must have unset fill or stroke)"), NULL); clonetiler_table_attach (table, b, 0.0, 1, 2); @@ -2778,7 +2776,7 @@ clonetiler_dialog (void) { GtkWidget *b = gtk_check_button_new_with_label (_("Opacity")); - bool old = prefs->getBool(prefs_path, "pick_to_opacity", 0); + bool old = prefs->getBool(prefs_path + "pick_to_opacity", 0); gtk_toggle_button_set_active ((GtkToggleButton *) b, old); gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), b, _("Each clone's opacity is determined by the picked value in that point"), NULL); clonetiler_table_attach (table, b, 0.0, 2, 2); @@ -2786,7 +2784,7 @@ clonetiler_dialog (void) GTK_SIGNAL_FUNC(clonetiler_pick_to), (gpointer) "pick_to_opacity"); } } - gtk_widget_set_sensitive (vvb, prefs->getBool(prefs_path, "dotrace")); + gtk_widget_set_sensitive (vvb, prefs->getBool(prefs_path + "dotrace")); } } @@ -2804,7 +2802,7 @@ clonetiler_dialog (void) { GtkObject *a = gtk_adjustment_new(0.0, 1, 500, 1, 10, 10); - int value = prefs->getInt(prefs_path, "jmax", 2); + int value = prefs->getInt(prefs_path + "jmax", 2); gtk_adjustment_set_value (GTK_ADJUSTMENT (a), value); GtkWidget *sb = gtk_spin_button_new (GTK_ADJUSTMENT (a), 1.0, 0); gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), sb, _("How many rows in the tiling"), NULL); @@ -2824,7 +2822,7 @@ clonetiler_dialog (void) { GtkObject *a = gtk_adjustment_new(0.0, 1, 500, 1, 10, 10); - int value = prefs->getInt(prefs_path, "imax", 2); + int value = prefs->getInt(prefs_path + "imax", 2); gtk_adjustment_set_value (GTK_ADJUSTMENT (a), value); GtkWidget *sb = gtk_spin_button_new (GTK_ADJUSTMENT (a), 1.0, 0); gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), sb, _("How many columns in the tiling"), NULL); @@ -2851,7 +2849,7 @@ clonetiler_dialog (void) GtkObject *a = gtk_adjustment_new (0.0, -1e6, 1e6, 1.0, 10.0, 10.0); sp_unit_selector_add_adjustment (SP_UNIT_SELECTOR (u), GTK_ADJUSTMENT (a)); - double value = prefs->getDouble(prefs_path, "fillwidth", 50.0); + double value = prefs->getDouble(prefs_path + "fillwidth", 50.0); SPUnit const &unit = *sp_unit_selector_get_unit(SP_UNIT_SELECTOR(u)); gdouble const units = sp_pixels_get_units (value, unit); gtk_adjustment_set_value (GTK_ADJUSTMENT (a), units); @@ -2875,7 +2873,7 @@ clonetiler_dialog (void) GtkObject *a = gtk_adjustment_new (0.0, -1e6, 1e6, 1.0, 10.0, 10.0); sp_unit_selector_add_adjustment (SP_UNIT_SELECTOR (u), GTK_ADJUSTMENT (a)); - double value = prefs->getDouble(prefs_path, "fillheight", 50.0); + double value = prefs->getDouble(prefs_path + "fillheight", 50.0); SPUnit const &unit = *sp_unit_selector_get_unit(SP_UNIT_SELECTOR(u)); gdouble const units = sp_pixels_get_units (value, unit); gtk_adjustment_set_value (GTK_ADJUSTMENT (a), units); @@ -2902,7 +2900,7 @@ clonetiler_dialog (void) clonetiler_table_attach (table, radio, 0.0, 1, 1); gtk_signal_connect (GTK_OBJECT (radio), "toggled", GTK_SIGNAL_FUNC (clonetiler_switch_to_create), (gpointer) dlg); } - if (!prefs->getBool(prefs_path, "fillrect")) { + if (!prefs->getBool(prefs_path + "fillrect")) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE); gtk_toggle_button_toggled (GTK_TOGGLE_BUTTON (radio)); } @@ -2912,7 +2910,7 @@ clonetiler_dialog (void) clonetiler_table_attach (table, radio, 0.0, 2, 1); gtk_signal_connect (GTK_OBJECT (radio), "toggled", GTK_SIGNAL_FUNC (clonetiler_switch_to_fill), (gpointer) dlg); } - if (prefs->getBool(prefs_path, "fillrect")) { + if (prefs->getBool(prefs_path + "fillrect")) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE); gtk_toggle_button_toggled (GTK_TOGGLE_BUTTON (radio)); } @@ -2925,7 +2923,7 @@ clonetiler_dialog (void) gtk_box_pack_start (GTK_BOX (mainbox), hb, FALSE, FALSE, 0); GtkWidget *b = gtk_check_button_new_with_label (_("Use saved size and position of the tile")); - bool keepbbox = prefs->getBool(prefs_path, "keepbbox", true); + bool keepbbox = prefs->getBool(prefs_path + "keepbbox", true); gtk_toggle_button_set_active ((GtkToggleButton *) b, keepbbox); gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), b, _("Pretend that the size and position of the tile are the same as the last time you tiled it (if any), instead of using the current size"), NULL); gtk_box_pack_start (GTK_BOX (hb), b, FALSE, FALSE, 0); diff --git a/src/dialogs/dialog-events.cpp b/src/dialogs/dialog-events.cpp index dc9f4ac2a..b306e42d6 100644 --- a/src/dialogs/dialog-events.cpp +++ b/src/dialogs/dialog-events.cpp @@ -21,7 +21,7 @@ #include <gtk/gtk.h> #include "desktop.h" #include "inkscape-private.h" -#include "prefs-utils.h" +#include "preferences.h" #include "event-context.h" #include "dialog-events.h" @@ -172,16 +172,17 @@ sp_dialog_event_handler (GtkWindow *win, GdkEvent *event, gpointer data) void sp_transientize (GtkWidget *dialog) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); #ifndef WIN32 // FIXME: Temporary Win32 special code to enable transient dialogs // _set_skip_taskbar_hint makes transient dialogs NON-transient! When dialogs // are made transient (_set_transient_for), they are already removed from // the taskbar in Win32. - if (prefs_get_int_attribute ( "options.dialogsskiptaskbar", "value", 0)) { + if (prefs->getBool( "/options/dialogsskiptaskbar/value")) { gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dialog), TRUE); } #endif - gint transient_policy = prefs_get_int_attribute_limited ( "options.transientpolicy", "value", 1, 0, 2 ); + gint transient_policy = prefs->getIntLimited("/options/transientpolicy/value", 1, 0, 2); #ifdef WIN32 // Win32 special code to enable transient dialogs transient_policy = 2; @@ -207,7 +208,8 @@ void sp_transientize_callback ( Inkscape::Application * /*inkscape*/, SPDesktop *desktop, win_data *wd ) { - 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/dialogs/export.cpp b/src/dialogs/export.cpp index 816a50754..dc337ef8e 100644 --- a/src/dialogs/export.cpp +++ b/src/dialogs/export.cpp @@ -114,7 +114,7 @@ static void sp_export_filename_modified (GtkObject * object, gpointer data); static inline void sp_export_find_default_selection(GtkWidget * dlg); static void sp_export_detect_size(GtkObject * base); -static const gchar *prefs_path = "dialogs.export"; +static Glib::ustring const prefs_path = "/dialogs/export/"; // these all need to be reinitialized to their defaults during dialog_destroy static GtkWidget *dlg = NULL; @@ -171,10 +171,10 @@ sp_export_dialog_delete ( GtkObject */*object*/, GdkEvent */*event*/, gpointer / if (y<0) y=0; 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); + prefs->setInt(prefs_path + "x", x); + prefs->setInt(prefs_path + "y", y); + prefs->setInt(prefs_path + "w", w); + prefs->setInt(prefs_path + "h", h); return FALSE; // which means, go ahead and destroy it @@ -400,13 +400,13 @@ sp_export_dialog (void) dlg = sp_window_new (title, TRUE); if (x == -1000 || y == -1000) { - x = prefs->getInt(prefs_path, "x", 0); - y = prefs->getInt(prefs_path, "y", 0); + x = prefs->getInt(prefs_path + "x", 0); + y = prefs->getInt(prefs_path + "y", 0); } if (w ==0 || h == 0) { - w = prefs->getInt(prefs_path, "w", 0); - h = prefs->getInt(prefs_path, "h", 0); + w = prefs->getInt(prefs_path + "w", 0); + h = prefs->getInt(prefs_path + "h", 0); } // if (x<0) x=0; @@ -484,7 +484,7 @@ sp_export_dialog (void) dlg ); sp_export_spinbutton_new ( "xdpi", - prefs->getDouble("dialogs.export.defaultxdpi", "value", DPI_BASE), + prefs->getDouble("/dialogs/export/defaultxdpi/value", DPI_BASE), 0.01, 100000.0, 0.1, 1.0, NULL, GTK_WIDGET(t->gobj()), 3, 0, NULL, _("dp_i"), 2, 1, G_CALLBACK (sp_export_xdpi_value_changed), @@ -501,7 +501,7 @@ sp_export_dialog (void) * Needs fixing: there's no way to set ydpi currently, so we use * the defaultxdpi value here, too... */ - sp_export_spinbutton_new ( "ydpi", prefs->getDouble("dialogs.export.defaultxdpi", "value", DPI_BASE), + sp_export_spinbutton_new ( "ydpi", prefs->getDouble("/dialogs/export/defaultxdpi/value", DPI_BASE), 0.01, 100000.0, 0.1, 1.0, NULL, GTK_WIDGET(t->gobj()), 3, 1, NULL, _("dpi"), 2, 0, NULL, dlg ); @@ -703,7 +703,7 @@ sp_export_find_default_selection(GtkWidget * dlg) Inkscape::Preferences *prefs = Inkscape::Preferences::get(); int i = SELECTION_NUMBER_OF; - Glib::ustring what = prefs->getString("dialogs.export.exportarea", "value"); + Glib::ustring what = prefs->getString("/dialogs/export/exportarea/value"); if (!what.empty()) { for (i = 0; i < SELECTION_NUMBER_OF; i++) { @@ -881,7 +881,7 @@ sp_export_area_toggled (GtkToggleButton *tb, GtkObject *base) // remember area setting Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setString("dialogs.export.exportarea", "value", selection_names[key]); + prefs->setString("/dialogs/export/exportarea/value", selection_names[key]); if ( key != SELECTION_CUSTOM && bbox ) { sp_export_set_area (base, bbox->min()[Geom::X], @@ -1796,7 +1796,7 @@ sp_export_xdpi_value_changed (GtkAdjustment */*adj*/, GtkObject *base) // remember xdpi setting Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setDouble("dialogs.export.defaultxdpi", "value", xdpi); + prefs->setDouble("/dialogs/export/defaultxdpi/value", xdpi); bmwidth = (x1 - x0) * xdpi / DPI_BASE; diff --git a/src/dialogs/fill-style.cpp b/src/dialogs/fill-style.cpp index ebf2d4bdd..e095425a9 100644 --- a/src/dialogs/fill-style.cpp +++ b/src/dialogs/fill-style.cpp @@ -21,21 +21,21 @@ #endif -#include <widgets/sp-widget.h> -#include <sp-linear-gradient.h> -#include <sp-pattern.h> -#include <sp-radial-gradient.h> -#include <widgets/paint-selector.h> -#include <style.h> -#include <gradient-chemistry.h> -#include <desktop-style.h> -#include <desktop-handles.h> -#include <selection.h> -#include <inkscape.h> -#include <document-private.h> -#include <xml/repr.h> +#include "widgets/sp-widget.h" +#include "sp-linear-gradient.h" +#include "sp-pattern.h" +#include "sp-radial-gradient.h" +#include "widgets/paint-selector.h" +#include "style.h" +#include "gradient-chemistry.h" +#include "desktop-style.h" +#include "desktop-handles.h" +#include "selection.h" +#include "inkscape.h" +#include "document-private.h" +#include "xml/repr.h" #include <glibmm/i18n.h> -#include <display/sp-canvas.h> +#include "display/sp-canvas.h" // These can be deleted once we sort out the libart dependence. diff --git a/src/dialogs/find.cpp b/src/dialogs/find.cpp index 6f9eca0d7..96a630553 100644 --- a/src/dialogs/find.cpp +++ b/src/dialogs/find.cpp @@ -44,7 +44,7 @@ sp_find_dialog(){ #include "desktop-handles.h" #include "dialog-events.h" -#include "../prefs-utils.h" +#include "../preferences.h" #include "../verbs.h" #include "../interface.h" #include "../sp-text.h" @@ -77,7 +77,7 @@ static win_data wd; // impossible original values to make sure they are read from prefs static gint x = -1000, y = -1000, w = 0, h = 0; -static gchar const *prefs_path = "dialogs.find"; +static Glib::ustring const prefs_path = "/dialogs/find/"; @@ -99,10 +99,11 @@ static gboolean sp_find_dialog_delete(GtkObject *, GdkEvent *, gpointer /*data*/ 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); return FALSE; // which means, go ahead and destroy it } @@ -647,15 +648,16 @@ sp_find_dialog_old (void) { gchar title[500]; sp_ui_dialog_title_string (Inkscape::Verb::get(SP_VERB_DIALOG_FIND), title); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); dlg = sp_window_new (title, TRUE); if (x == -1000 || y == -1000) { - x = prefs_get_int_attribute (prefs_path, "x", -1000); - y = prefs_get_int_attribute (prefs_path, "y", -1000); + x = prefs->getInt(prefs_path + "x", -1000); + y = prefs->getInt(prefs_path + "y", -1000); } if (w ==0 || h == 0) { - w = prefs_get_int_attribute (prefs_path, "w", 0); - h = prefs_get_int_attribute (prefs_path, "h", 0); + w = prefs->getInt(prefs_path + "w", 0); + h = prefs->getInt(prefs_path + "h", 0); } // if (x<0) x=0; diff --git a/src/dialogs/iconpreview.cpp b/src/dialogs/iconpreview.cpp index c3d15d830..f31914e3e 100644 --- a/src/dialogs/iconpreview.cpp +++ b/src/dialogs/iconpreview.cpp @@ -25,7 +25,7 @@ #include <gtkmm/buttonbox.h> #include <gtkmm/stock.h> -#include "prefs-utils.h" +#include "preferences.h" #include "inkscape.h" #include "document.h" #include "desktop-handles.h" @@ -50,7 +50,7 @@ namespace Dialogs { IconPreviewPanel& IconPreviewPanel::getInstance() { - IconPreviewPanel &instance = *new IconPreviewPanel(); + static IconPreviewPanel &instance = *new IconPreviewPanel(); instance.refreshPreview(); @@ -82,39 +82,32 @@ void IconPreviewPanel::on_button_clicked(int which) * Constructor */ IconPreviewPanel::IconPreviewPanel() : - UI::Widget::Panel("", "dialogs.iconpreview", SP_VERB_VIEW_ICON_PREVIEW), + UI::Widget::Panel("", "/dialogs/iconpreview", SP_VERB_VIEW_ICON_PREVIEW), hot(1), refreshButton(0), selectionButton(0) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); numEntries = 0; - Inkscape::XML::Node *things = inkscape_get_repr(INKSCAPE, "iconpreview.sizes.default"); - if (things) { - std::vector<int> rawSizes; - for ( Inkscape::XML::Node *child = things->firstChild(); child; child = child->next() ) - { - gchar const *id = child->attribute("id"); - if ( id ) - { - std::string path("iconpreview.sizes.default."); - path += id; - gint show = prefs_get_int_attribute_limited( path.c_str(), "show", 1, 0, 1 ); - gint sizeVal = prefs_get_int_attribute( path.c_str(), "value", -1 ); - if ( show && (sizeVal > 0) ) - { - rawSizes.push_back( sizeVal ); - } + + std::vector<Glib::ustring> pref_sizes = prefs->getAllDirs("/iconpreview/sizes/default"); + std::vector<int> rawSizes; + + for (std::vector<Glib::ustring>::iterator i = pref_sizes.begin(); i != pref_sizes.end(); ++i) { + if (prefs->getBool(*i + "/show", true)) { + int sizeVal = prefs->getInt(*i + "/value", -1); + if (sizeVal > 0) { + rawSizes.push_back(sizeVal); } } + } - if ( !rawSizes.empty() ) - { - numEntries = rawSizes.size(); - sizes = new int[numEntries]; - int i = 0; - for ( std::vector<int>::iterator it = rawSizes.begin(); it != rawSizes.end(); ++it, ++i ) { - sizes[i] = *it; - } + if ( !rawSizes.empty() ) { + numEntries = rawSizes.size(); + sizes = new int[numEntries]; + int i = 0; + for ( std::vector<int>::iterator it = rawSizes.begin(); it != rawSizes.end(); ++it, ++i ) { + sizes[i] = *it; } } @@ -189,7 +182,7 @@ IconPreviewPanel::IconPreviewPanel() : tips.set_tip((*selectionButton), _("Selection only or whole document")); selectionButton->signal_clicked().connect( sigc::mem_fun(*this, &IconPreviewPanel::modeToggled) ); - gint val = prefs_get_int_attribute_limited( "iconpreview", "selectionOnly", 0, 0, 1 ); + gint val = prefs->getBool("/iconpreview/selectionOnly"); selectionButton->set_active( val != 0 ); refreshButton = new Gtk::Button(Gtk::Stock::REFRESH); // , GTK_RESPONSE_APPLY @@ -248,7 +241,8 @@ void IconPreviewPanel::refreshPreview() void IconPreviewPanel::modeToggled() { - prefs_set_int_attribute( "iconpreview", "selectionOnly", (selectionButton && selectionButton->get_active()) ? 1 : 0 ); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setBool("/iconpreview/selectionOnly", (selectionButton && selectionButton->get_active())); refreshPreview(); } @@ -307,13 +301,9 @@ void IconPreviewPanel::updateMagnify() 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=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : - -//######################################################################### -//## E N D O F F I L E -//######################################################################### +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : diff --git a/src/dialogs/input.cpp b/src/dialogs/input.cpp index f4690623e..e23fcc848 100644 --- a/src/dialogs/input.cpp +++ b/src/dialogs/input.cpp @@ -1,9 +1,9 @@ #define __SP_INPUT_C__ -/* - * Extended input devices dialog - * - * Authors: +/** @file + * @brief Extended input devices dialog + */ +/* Authors: * Nicklas Lindgren <nili@lysator.liu.se> * Johan Engelen <goejendaagh@zonnet.nl> * @@ -19,14 +19,14 @@ #include <gtk/gtkinputdialog.h> #include <glibmm/ustring.h> -#include "../inkscape.h" -#include "../macros.h" -#include "../verbs.h" -#include "../interface.h" -#include "../xml/repr.h" +#include "macros.h" +#include "verbs.h" +#include "inkscape.h" +#include "interface.h" +#include "xml/repr.h" -#include "dialog-events.h" -#include "../prefs-utils.h" +#include "dialogs/dialog-events.h" +#include "preferences.h" #define MIN_ONSCREEN_DISTANCE 50 @@ -35,7 +35,7 @@ static win_data wd; // impossible original values to make sure they are read from prefs static gint x = -1000, y = -1000, w = 0, h = 0; -static const gchar *prefs_path = "dialogs.input"; +static Glib::ustring const prefs_path = "/dialogs/input/"; static void sp_input_dialog_destroy (GtkObject */*object*/, gpointer /*data*/) @@ -48,16 +48,17 @@ sp_input_dialog_destroy (GtkObject */*object*/, gpointer /*data*/) static gboolean sp_input_dialog_delete (GtkObject */*object*/, GdkEvent */*event*/, gpointer /*data*/) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); gtk_window_get_position ((GtkWindow *) dlg, &x, &y); gtk_window_get_size ((GtkWindow *) dlg, &w, &h); 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); + prefs->setInt(prefs_path + "x", x); + prefs->setInt(prefs_path + "y", y); + prefs->setInt(prefs_path + "w", w); + prefs->setInt(prefs_path + "h", h); return FALSE; // which means, go ahead and destroy it @@ -70,25 +71,21 @@ static const gchar *axis_use_strings[GDK_AXIS_LAST] = { void sp_input_load_from_preferences (void) { - Inkscape::XML::Node *devices = inkscape_get_repr(INKSCAPE, "devices"); - if (devices == NULL) - return; + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - Inkscape::XML::Node *repr; - GList *list_ptr; - - for (list_ptr = gdk_devices_list(); list_ptr != NULL; list_ptr = list_ptr->next) { + for (GList *list_ptr = gdk_devices_list(); list_ptr != NULL; list_ptr = list_ptr->next) { GdkDevice *device = static_cast<GdkDevice *>(list_ptr->data); - repr = sp_repr_lookup_child(devices, "id", device->name); - if (repr != NULL) { + //repr = sp_repr_lookup_child(devices, "id", device->name); + Glib::ustring device_path = Glib::ustring("/devices/") + device->name; + if (/*repr != NULL*/ 1) { GdkInputMode mode; - const gchar *attribute = repr->attribute("mode"); + Glib::ustring device_mode = prefs->getString(device_path + "/mode"); - if (attribute == NULL) + if (device_mode.empty()) mode = GDK_MODE_DISABLED; - else if (!strcmp(attribute, "screen")) + else if (device_mode == "screen") mode = GDK_MODE_SCREEN; - else if (!strcmp(attribute, "window")) + else if (device_mode == "window") mode = GDK_MODE_WINDOW; else mode = GDK_MODE_DISABLED; @@ -97,50 +94,40 @@ sp_input_load_from_preferences (void) gdk_device_set_mode(device, mode); } - const gchar *temp_ptr; - Glib::ustring::size_type pos0; - Glib::ustring::size_type pos1; - gint i; - gint j; - + Glib::ustring::size_type pos0, pos1; GdkAxisUse axis_use; - temp_ptr = repr->attribute("axes"); - if (temp_ptr != NULL) { - const Glib::ustring temp_str = temp_ptr; - pos0 = pos1 = 0; - for (i=0; i < device->num_axes; i++) { - pos1 = temp_str.find(";", pos0); - if (pos1 == Glib::ustring::npos) - break; // Too few axis specifications - - axis_use = GDK_AXIS_IGNORE; - for (j=0; j < GDK_AXIS_LAST; j++) - if (!strcmp(temp_str.substr(pos0, pos1-pos0).c_str(), axis_use_strings[j])) { - axis_use = static_cast<GdkAxisUse>(j); - break; - } - gdk_device_set_axis_use(device, i, axis_use); - pos0 = pos1 + 1; - } + //temp_ptr = repr->attribute("axes"); + Glib::ustring const axes_str = prefs->getString(device_path + "/axes"); + pos0 = pos1 = 0; + for (gint i=0; i < device->num_axes; i++) { + pos1 = axes_str.find(';', pos0); + if (pos1 == Glib::ustring::npos) + break; // Too few axis specifications + + axis_use = GDK_AXIS_IGNORE; + for (gint j=0; j < GDK_AXIS_LAST; j++) + if (!strcmp(axes_str.substr(pos0, pos1-pos0).c_str(), axis_use_strings[j])) { + axis_use = static_cast<GdkAxisUse>(j); + break; + } + gdk_device_set_axis_use(device, i, axis_use); + pos0 = pos1 + 1; } guint keyval; GdkModifierType modifier; - temp_ptr = repr->attribute("keys"); - if (temp_ptr != NULL) { - const Glib::ustring temp_str = temp_ptr; - pos0 = pos1 = 0; - for (i=0; i < device->num_keys; i++) { - pos1 = temp_str.find(";", pos0); - if (pos1 == Glib::ustring::npos) - break; // Too few key specifications - - gtk_accelerator_parse(temp_str.substr(pos0, pos1-pos0).c_str(), &keyval, &modifier); - gdk_device_set_key(device, i, keyval, modifier); - pos0 = pos1 + 1; - } + Glib::ustring const keys_str = prefs->getString(device_path + "/keys"); + pos0 = pos1 = 0; + for (gint i=0; i < device->num_keys; i++) { + pos1 = keys_str.find(';', pos0); + if (pos1 == Glib::ustring::npos) + break; // Too few key specifications + + gtk_accelerator_parse(keys_str.substr(pos0, pos1-pos0).c_str(), &keyval, &modifier); + gdk_device_set_key(device, i, keyval, modifier); + pos0 = pos1 + 1; } } } @@ -149,56 +136,43 @@ sp_input_load_from_preferences (void) void sp_input_save_to_preferences (void) { - Inkscape::XML::Node *devices = inkscape_get_repr(INKSCAPE, "devices"); - if (devices == NULL) - // TODO: find a clean way to add a node to the preferences root, or - // give an error message - return; - - Inkscape::XML::Node *repr; - GList *list_ptr; - - for (list_ptr = gdk_devices_list(); list_ptr != NULL; list_ptr = list_ptr->next) { - gint i; - Glib::ustring temp_attribute; + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + + for (GList *list_ptr = gdk_devices_list(); list_ptr != NULL; list_ptr = list_ptr->next) { GdkDevice *device = static_cast<GdkDevice *>(list_ptr->data); - repr = sp_repr_lookup_child(devices, "id", device->name); - if (repr == NULL) { - repr = devices->document()->createElement("group"); - repr->setAttribute("id", device->name); - devices->appendChild(repr); - Inkscape::GC::release(repr); - } + //repr = sp_repr_lookup_child(devices, "id", device->name); + Glib::ustring device_path = Glib::ustring("/devices/") + device->name; + switch (device->mode) { default: case GDK_MODE_DISABLED: { - repr->setAttribute("mode", "disabled"); + prefs->setString(device_path + "/mode", "disabled"); break; } case GDK_MODE_SCREEN: { - repr->setAttribute("mode", "screen"); + prefs->setString(device_path + "/mode", "screen"); break; } case GDK_MODE_WINDOW: { - repr->setAttribute("mode", "window"); + prefs->setString(device_path + "/mode", "window"); break; } } - temp_attribute = ""; - for (i=0; i < device->num_axes; i++) { + Glib::ustring temp_attribute = ""; + for (gint i=0; i < device->num_axes; i++) { temp_attribute += axis_use_strings[device->axes[i].use]; temp_attribute += ";"; } - repr->setAttribute("axes", temp_attribute.c_str()); + prefs->setString(device_path + "/axes", temp_attribute); temp_attribute = ""; - for (i=0; i < device->num_keys; i++) { + for (gint i=0; i < device->num_keys; i++) { temp_attribute += gtk_accelerator_name(device->keys[i].keyval, device->keys[i].modifiers); temp_attribute += ";"; } - repr->setAttribute("keys", temp_attribute.c_str()); + prefs->setString(device_path + "/keys", temp_attribute); } } @@ -208,14 +182,11 @@ sp_input_save_button (GtkObject */*object*/, gpointer /*data*/) sp_input_save_to_preferences(); } -/** - * \brief Dialog - * - */ void sp_input_dialog (void) { if (dlg == NULL) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); gchar title[500]; sp_ui_dialog_title_string (Inkscape::Verb::get(SP_VERB_DIALOG_INPUT), title); @@ -223,13 +194,13 @@ sp_input_dialog (void) dlg = gtk_input_dialog_new(); if (x == -1000 || y == -1000) { - x = prefs_get_int_attribute (prefs_path, "x", -1000); - y = prefs_get_int_attribute (prefs_path, "y", -1000); + x = prefs->getInt(prefs_path + "x", -1000); + y = prefs->getInt(prefs_path + "y", -1000); } if (w ==0 || h == 0) { - w = prefs_get_int_attribute (prefs_path, "w", 0); - h = prefs_get_int_attribute (prefs_path, "h", 0); + w = prefs->getInt(prefs_path + "w", 0); + h = prefs->getInt(prefs_path + "h", 0); } // if (x<0) x=0; diff --git a/src/dialogs/item-properties.cpp b/src/dialogs/item-properties.cpp index 9b816436b..808775786 100644 --- a/src/dialogs/item-properties.cpp +++ b/src/dialogs/item-properties.cpp @@ -40,7 +40,7 @@ #include "../interface.h" #include "dialog-events.h" -#include "../prefs-utils.h" +#include "../preferences.h" #define MIN_ONSCREEN_DISTANCE 50 @@ -49,7 +49,7 @@ static win_data wd; // impossible original values to make sure they are read from prefs static gint x = -1000, y = -1000, w = 0, h = 0; -static gchar const *prefs_path = "dialogs.object"; +static Glib::ustring const prefs_path = "/dialogs/object/"; static void sp_item_widget_modify_selection (SPWidget *spw, Inkscape::Selection *selection, guint flags, GtkWidget *itemw); static void sp_item_widget_change_selection (SPWidget *spw, Inkscape::Selection *selection, GtkWidget *itemw); @@ -75,10 +75,11 @@ sp_item_dialog_delete( GtkObject */*object*/, GdkEvent */*event*/, gpointer /*da 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); return FALSE; // which means, go ahead and destroy it @@ -479,16 +480,16 @@ sp_item_dialog (void) gchar title[500]; sp_ui_dialog_title_string (Inkscape::Verb::get(SP_VERB_DIALOG_ITEM), title); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); dlg = sp_window_new (title, TRUE); if (x == -1000 || y == -1000) { - x = prefs_get_int_attribute (prefs_path, "x", -1000); - y = prefs_get_int_attribute (prefs_path, "y", -1000); + x = prefs->getInt(prefs_path + "x", -1000); + y = prefs->getInt(prefs_path + "y", -1000); } - if (w ==0 || h == 0) { - w = prefs_get_int_attribute (prefs_path, "w", 0); - h = prefs_get_int_attribute (prefs_path, "h", 0); + w = prefs->getInt(prefs_path + "w", 0); + h = prefs->getInt(prefs_path + "h", 0); } // if (x<0) x=0; diff --git a/src/dialogs/layers-panel.cpp b/src/dialogs/layers-panel.cpp index a8c55f9de..1b754c606 100644 --- a/src/dialogs/layers-panel.cpp +++ b/src/dialogs/layers-panel.cpp @@ -36,7 +36,7 @@ #include "widgets/icon.h" #include "ui/widget/imagetoggler.h" #include <gtkmm/widget.h> -#include "prefs-utils.h" +#include "preferences.h" #include "xml/repr.h" #include "svg/css-ostringstream.h" #include "desktop-style.h" @@ -581,7 +581,7 @@ bool LayersPanel::_rowSelectFunction( Glib::RefPtr<Gtk::TreeModel> const & /*mod * Constructor */ LayersPanel::LayersPanel() : - UI::Widget::Panel("", "dialogs.layers", SP_VERB_DIALOG_LAYERS), + UI::Widget::Panel("", "/dialogs/layers", SP_VERB_DIALOG_LAYERS), _maxNestDepth(20), _mgr(0), _desktop(0), @@ -590,7 +590,8 @@ LayersPanel::LayersPanel() : _toggleEvent(0), _compositeSettings(SP_VERB_DIALOG_LAYERS, "layers", UI::Widget::SimpleFilterModifier::BLEND) { - _maxNestDepth = prefs_get_int_attribute_limited("dialogs.layers", "maxDepth", 20, 1, 1000); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + _maxNestDepth = prefs->getIntLimited("/dialogs/layers/maxDepth", 20, 1, 1000); ModelColumns *zoop = new ModelColumns(); _model = zoop; diff --git a/src/dialogs/stroke-style.cpp b/src/dialogs/stroke-style.cpp index 00e308278..c7173ad1e 100644 --- a/src/dialogs/stroke-style.cpp +++ b/src/dialogs/stroke-style.cpp @@ -8,6 +8,7 @@ * Bryce Harrington <brycehar@bryceharrington.org> * bulia byak <buliabyak@users.sf.net> * Maximilian Albert <maximilian.albert@gmail.com> + * Josh Andler <scislac@users.sf.net> * * Copyright (C) 2001-2005 authors * Copyright (C) 2001 Ximian, Inc. @@ -59,6 +60,7 @@ #include "helper/stock-items.h" #include "io/sys.h" #include "ui/cache/svg_preview_cache.h" +#include "xml/repr.h" #include "dialogs/stroke-style.h" @@ -1080,7 +1082,7 @@ sp_stroke_style_line_widget_new(void) gint i = 0; /* Stroke width */ - spw_label(t, _("Width:"), 0, i); + spw_label(t, Q_("StrokeWidth|Width:"), 0, i); hb = spw_hbox(t, 3, 1, i); @@ -1209,7 +1211,7 @@ sp_stroke_style_line_widget_new(void) /* Dash */ spw_label(t, _("Dashes:"), 0, i); - ds = manage(new SPDashSelector(inkscape_get_repr(INKSCAPE, "palette.dashes"))); + ds = manage(new SPDashSelector); ds->show(); t->attach(*ds, 1, 4, i, i+1, (Gtk::EXPAND | Gtk::FILL), static_cast<Gtk::AttachOptions>(0), 0, 0); @@ -1227,6 +1229,7 @@ sp_stroke_style_line_widget_new(void) // (arrowheads, bullets, faces, whatever) to the start, end, or middle nodes of a path. spw_label(t, _("Start Markers:"), 0, i); marker_start_menu = ink_marker_menu(spw ,"marker-start", sandbox); + tt->set_tip(*marker_start_menu, _("Start Markers are drawn on the first node of a path or shape")); marker_start_menu_connection = marker_start_menu->signal_changed().connect( sigc::bind<Gtk::OptionMenu *, Gtk::Container *, SPMarkerLoc>( sigc::ptr_fun(&sp_marker_select), marker_start_menu, spw, SP_MARKER_LOC_START)); @@ -1237,6 +1240,7 @@ sp_stroke_style_line_widget_new(void) i++; spw_label(t, _("Mid Markers:"), 0, i); marker_mid_menu = ink_marker_menu(spw ,"marker-mid", sandbox); + tt->set_tip(*marker_mid_menu, _("Mid Markers are drawn on every node of a path or shape except the first and last nodes")); marker_mid_menu_connection = marker_mid_menu->signal_changed().connect( sigc::bind<Gtk::OptionMenu *, Gtk::Container *, SPMarkerLoc>( sigc::ptr_fun(&sp_marker_select), marker_mid_menu,spw, SP_MARKER_LOC_MID)); @@ -1247,6 +1251,7 @@ sp_stroke_style_line_widget_new(void) i++; spw_label(t, _("End Markers:"), 0, i); marker_end_menu = ink_marker_menu(spw ,"marker-end", sandbox); + tt->set_tip(*marker_end_menu, _("End Markers are drawn on the last node of a path or shape")); marker_end_menu_connection = marker_end_menu->signal_changed().connect( sigc::bind<Gtk::OptionMenu *, Gtk::Container *, SPMarkerLoc>( sigc::ptr_fun(&sp_marker_select), marker_end_menu, spw, SP_MARKER_LOC_END)); diff --git a/src/dialogs/swatches.cpp b/src/dialogs/swatches.cpp index 5d76cc8f6..71c16d87a 100644 --- a/src/dialogs/swatches.cpp +++ b/src/dialogs/swatches.cpp @@ -1047,9 +1047,9 @@ SwatchesPanel::SwatchesPanel(gchar const* prefsPath) : if ( !possible.empty() ) { JustForNow* first = 0; Glib::ustring targetName; - if ( _prefs_path ) { + if ( !_prefs_path.empty() ) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - targetName = prefs->getString(_prefs_path, "palette"); + targetName = prefs->getString(_prefs_path + "/palette"); if (!targetName.empty()) { for ( std::vector<JustForNow*>::iterator iter = possible.begin(); iter != possible.end(); ++iter ) { if ( (*iter)->_name == targetName ) { @@ -1123,9 +1123,9 @@ void SwatchesPanel::_handleAction( int setId, int itemId ) _holder->clear(); JustForNow* curr = possible[itemId]; - if ( _prefs_path ) { + if ( !_prefs_path.empty() ) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setString(_prefs_path, "palette", curr->_name); + prefs->setString(_prefs_path + "/palette", curr->_name); } if ( curr->_prefWidth > 0 ) { diff --git a/src/dialogs/swatches.h b/src/dialogs/swatches.h index 310272b1c..630fada7c 100644 --- a/src/dialogs/swatches.h +++ b/src/dialogs/swatches.h @@ -90,7 +90,7 @@ private: class SwatchesPanel : public Inkscape::UI::Widget::Panel { public: - SwatchesPanel(gchar const* prefsPath = "dialogs.swatches"); + SwatchesPanel(gchar const* prefsPath = "/dialogs/swatches"); virtual ~SwatchesPanel(); static SwatchesPanel& getInstance(); diff --git a/src/dialogs/text-edit.cpp b/src/dialogs/text-edit.cpp index 8f4d1b8bd..1f8395c95 100644 --- a/src/dialogs/text-edit.cpp +++ b/src/dialogs/text-edit.cpp @@ -45,7 +45,7 @@ extern "C" { #include <libnrtype/font-style-to-pos.h> #include "dialog-events.h" -#include "../prefs-utils.h" +#include "../preferences.h" #include "../verbs.h" #include "../interface.h" #include "svg/css-ostringstream.h" @@ -80,7 +80,7 @@ static GtkWidget *dlg = NULL; static win_data wd; // impossible original values to make sure they are read from prefs static gint x = -1000, y = -1000, w = 0, h = 0; -static gchar const *prefs_path = "dialogs.textandfont"; +static Glib::ustring const prefs_path = "/dialogs/textandfont/"; @@ -104,10 +104,11 @@ sp_text_edit_dialog_delete( GtkObject */*object*/, GdkEvent */*event*/, gpointer 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); return FALSE; // which means, go ahead and destroy it } @@ -142,16 +143,16 @@ sp_text_edit_dialog (void) gchar title[500]; sp_ui_dialog_title_string (Inkscape::Verb::get(SP_VERB_DIALOG_TEXT), title); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); dlg = sp_window_new (title, TRUE); if (x == -1000 || y == -1000) { - x = prefs_get_int_attribute (prefs_path, "x", -1000); - y = prefs_get_int_attribute (prefs_path, "y", -1000); + x = prefs->getInt(prefs_path + "x", -1000); + y = prefs->getInt(prefs_path + "y", -1000); } - if (w ==0 || h == 0) { - w = prefs_get_int_attribute (prefs_path, "w", 0); - h = prefs_get_int_attribute (prefs_path, "h", 0); + w = prefs->getInt(prefs_path + "w", 0); + h = prefs->getInt(prefs_path + "h", 0); } // if (x<0) x=0; @@ -608,9 +609,10 @@ sp_text_edit_dialog_set_default( GtkButton */*button*/, GtkWidget *dlg ) GtkWidget *def = (GtkWidget*)g_object_get_data (G_OBJECT (dlg), "default"); SPCSSAttr *css = sp_get_text_dialog_style (); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); g_object_set_data (G_OBJECT (dlg), "blocked", GINT_TO_POINTER (TRUE)); - sp_repr_css_change (inkscape_get_repr (INKSCAPE, "tools.text"), css, "style"); + prefs->mergeStyle("/tools/text/style", css); g_object_set_data (G_OBJECT (dlg), "blocked", GINT_TO_POINTER (FALSE)); sp_repr_css_attr_unref (css); @@ -650,7 +652,8 @@ sp_text_edit_dialog_apply( GtkButton */*button*/, GtkWidget *dlg ) if (items == 0) { // no text objects; apply style to prefs for new objects - sp_repr_css_change (inkscape_get_repr (INKSCAPE, "tools.text"), css, "style"); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->mergeStyle("/tools/text/style", css); gtk_widget_set_sensitive (def, FALSE); } else if (items == 1) { /* exactly one text object; now set its text, too */ @@ -749,13 +752,7 @@ sp_text_edit_dialog_read_selection ( GtkWidget *dlg, // (Ok to not get a font specification - must just rely on the family and style in that case) if (result_family == QUERY_STYLE_NOTHING || result_style == QUERY_STYLE_NOTHING || result_numbers == QUERY_STYLE_NOTHING) { - repr = inkscape_get_repr (INKSCAPE, "tools.text"); - if (repr) { - gtk_widget_set_sensitive (notebook, TRUE); - sp_style_read_from_repr (query, repr); - } else { - gtk_widget_set_sensitive (notebook, FALSE); - } + sp_style_read_from_prefs(query, "/tools/text"); } // FIXME: process result_family/style == QUERY_STYLE_MULTIPLE_DIFFERENT by showing "Many" in the lists diff --git a/src/dialogs/tiledialog.cpp b/src/dialogs/tiledialog.cpp index 1643057e8..f597c601b 100644 --- a/src/dialogs/tiledialog.cpp +++ b/src/dialogs/tiledialog.cpp @@ -24,7 +24,7 @@ #include <gtkmm/stock.h> #include "verbs.h" -#include "prefs-utils.h" +#include "preferences.h" #include "inkscape.h" #include "desktop-handles.h" #include "selection.h" @@ -383,7 +383,8 @@ void TileDialog::on_row_spinbutton_changed() double PerCol = ceil(selcount / NoOfColsSpinner.get_value()); NoOfRowsSpinner.set_value(PerCol); - prefs_set_double_attribute ("dialogs.gridtiler", "NoOfCols", NoOfColsSpinner.get_value()); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setDouble("/dialogs/gridtiler/NoOfCols", NoOfColsSpinner.get_value()); updating=false; } @@ -407,7 +408,8 @@ void TileDialog::on_col_spinbutton_changed() double PerRow = ceil(selcount / NoOfRowsSpinner.get_value()); NoOfColsSpinner.set_value(PerRow); - prefs_set_double_attribute ("dialogs.gridtiler", "NoOfCols", PerRow); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setDouble("/dialogs/gridtiler/NoOfCols", PerRow); updating=false; } @@ -417,8 +419,8 @@ void TileDialog::on_col_spinbutton_changed() */ void TileDialog::on_xpad_spinbutton_changed() { - - prefs_set_double_attribute ("dialogs.gridtiler", "XPad", XPadSpinner.get_value()); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setDouble("/dialogs/gridtiler/XPad", XPadSpinner.get_value()); } @@ -427,9 +429,8 @@ void TileDialog::on_xpad_spinbutton_changed() */ void TileDialog::on_ypad_spinbutton_changed() { - - prefs_set_double_attribute ("dialogs.gridtiler", "YPad", YPadSpinner.get_value()); - + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setDouble("/dialogs/gridtiler/YPad", YPadSpinner.get_value()); } @@ -438,13 +439,13 @@ void TileDialog::on_ypad_spinbutton_changed() */ void TileDialog::on_RowSize_checkbutton_changed() { - - if (RowHeightButton.get_active()) { - prefs_set_double_attribute ("dialogs.gridtiler", "AutoRowSize", 20); - } else { - prefs_set_double_attribute ("dialogs.gridtiler", "AutoRowSize", -20); - } - RowHeightBox.set_sensitive ( !RowHeightButton.get_active()); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + if (RowHeightButton.get_active()) { + prefs->setDouble("/dialogs/gridtiler/AutoRowSize", 20); + } else { + prefs->setDouble("/dialogs/gridtiler/AutoRowSize", -20); + } + RowHeightBox.set_sensitive ( !RowHeightButton.get_active()); } /** @@ -452,14 +453,13 @@ void TileDialog::on_RowSize_checkbutton_changed() */ void TileDialog::on_ColSize_checkbutton_changed() { - - if (ColumnWidthButton.get_active()) { - prefs_set_double_attribute ("dialogs.gridtiler", "AutoColSize", 20); - } else { - prefs_set_double_attribute ("dialogs.gridtiler", "AutoColSize", -20); - } - ColumnWidthBox.set_sensitive ( !ColumnWidthButton.get_active()); - + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + if (ColumnWidthButton.get_active()) { + prefs->setDouble("/dialogs/gridtiler/AutoColSize", 20); + } else { + prefs->setDouble("/dialogs/gridtiler/AutoColSize", -20); + } + ColumnWidthBox.set_sensitive ( !ColumnWidthButton.get_active()); } /** @@ -474,7 +474,8 @@ void TileDialog::on_rowSize_spinbutton_changed() // in turn, prevent listener from responding updating = true; - prefs_set_double_attribute ("dialogs.gridtiler", "RowHeight", RowHeightSpinner.get_value()); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setDouble("/dialogs/gridtiler/RowHeight", RowHeightSpinner.get_value()); updating=false; } @@ -491,7 +492,8 @@ void TileDialog::on_colSize_spinbutton_changed() // in turn, prevent listener from responding updating = true; - prefs_set_double_attribute ("dialogs.gridtiler", "ColWidth", ColumnWidthSpinner.get_value()); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setDouble("/dialogs/gridtiler/ColWidth", ColumnWidthSpinner.get_value()); updating=false; } @@ -501,13 +503,14 @@ void TileDialog::on_colSize_spinbutton_changed() */ void TileDialog::Spacing_button_changed() { - if (SpaceManualRadioButton.get_active()) { - prefs_set_double_attribute ("dialogs.gridtiler", "SpacingType", 20); - } else { - prefs_set_double_attribute ("dialogs.gridtiler", "SpacingType", -20); - } + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + if (SpaceManualRadioButton.get_active()) { + prefs->setDouble("/dialogs/gridtiler/SpacingType", 20); + } else { + prefs->setDouble("/dialogs/gridtiler/SpacingType", -20); + } - SizesHBox.set_sensitive ( SpaceManualRadioButton.get_active()); + SizesHBox.set_sensitive ( SpaceManualRadioButton.get_active()); } /** @@ -515,17 +518,17 @@ void TileDialog::Spacing_button_changed() */ void TileDialog::VertAlign_changed() { - if (VertTopRadioButton.get_active()) { - VertAlign = 0; - prefs_set_double_attribute ("dialogs.gridtiler", "VertAlign", 0); - } else if (VertCentreRadioButton.get_active()){ - VertAlign = 1; - prefs_set_double_attribute ("dialogs.gridtiler", "VertAlign", 1); - } else if (VertBotRadioButton.get_active()){ - VertAlign = 2; - prefs_set_double_attribute ("dialogs.gridtiler", "VertAlign", 2); - } - + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + if (VertTopRadioButton.get_active()) { + VertAlign = 0; + prefs->setInt("/dialogs/gridtiler/VertAlign", 0); + } else if (VertCentreRadioButton.get_active()){ + VertAlign = 1; + prefs->setInt("/dialogs/gridtiler/VertAlign", 1); + } else if (VertBotRadioButton.get_active()){ + VertAlign = 2; + prefs->setInt("/dialogs/gridtiler/VertAlign", 2); + } } /** @@ -533,17 +536,17 @@ void TileDialog::VertAlign_changed() */ void TileDialog::HorizAlign_changed() { - if (HorizLeftRadioButton.get_active()) { - HorizAlign = 0; - prefs_set_double_attribute ("dialogs.gridtiler", "HorizAlign", 0); - } else if (HorizCentreRadioButton.get_active()){ - HorizAlign = 1; - prefs_set_double_attribute ("dialogs.gridtiler", "HorizAlign", 1); - } else if (HorizRightRadioButton.get_active()){ - HorizAlign = 2; - prefs_set_double_attribute ("dialogs.gridtiler", "HorizAlign", 2); - } - + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + if (HorizLeftRadioButton.get_active()) { + HorizAlign = 0; + prefs->setInt("/dialogs/gridtiler/HorizAlign", 0); + } else if (HorizCentreRadioButton.get_active()){ + HorizAlign = 1; + prefs->setInt("/dialogs/gridtiler/HorizAlign", 1); + } else if (HorizRightRadioButton.get_active()){ + HorizAlign = 2; + prefs->setInt("/dialogs/gridtiler/HorizAlign", 2); + } } /** @@ -551,14 +554,14 @@ void TileDialog::HorizAlign_changed() */ void TileDialog::updateSelection() { - double col_width, row_height; // quit if run by the attr_changed listener if (updating) { - return; - } + return; + } - col_width=0; - row_height=0; + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + double col_width = 0; + double row_height = 0; // in turn, prevent listener from responding updating = true; SPDesktop *desktop = getDesktop(); @@ -575,14 +578,14 @@ void TileDialog::updateSelection() if (selcount<NoOfColsSpinner.get_value()) { double NoOfCols = ceil(selcount / NoOfRowsSpinner.get_value()); NoOfColsSpinner.set_value(NoOfCols); - prefs_set_double_attribute ("dialogs.gridtiler", "NoOfCols", NoOfCols); + prefs->setInt("/dialogs/gridtiler/NoOfCols", NoOfCols); } } else { double PerRow = ceil(sqrt(selcount)); double PerCol = ceil(sqrt(selcount)); NoOfRowsSpinner.set_value(PerRow); NoOfColsSpinner.set_value(PerCol); - prefs_set_double_attribute ("dialogs.gridtiler", "NoOfCols", PerCol); + prefs->setInt("/dialogs/gridtiler/NoOfCols", static_cast<int>(PerCol)); } @@ -610,10 +613,11 @@ static void updateSelectionCallback(Inkscape::Application */*inkscape*/, Inkscap * Constructor */ TileDialog::TileDialog() - : UI::Widget::Panel("", "dialogs.gridtiler", SP_VERB_SELECTION_GRIDTILE) + : UI::Widget::Panel("", "/dialogs/gridtiler", SP_VERB_SELECTION_GRIDTILE) { // bool used by spin button callbacks to stop loops where they change each other. updating = false; + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); // could not do this in gtkmm - there's no Gtk::SizeGroup public constructor (!) GtkSizeGroup *_col1 = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); @@ -663,7 +667,7 @@ TileDialog::TileDialog() gtk_size_group_add_widget(_col1, (GtkWidget *) NoOfRowsBox.gobj()); RowHeightButton.set_label(_("Equal height")); - double AutoRow = prefs_get_double_attribute ("dialogs.gridtiler", "AutoRowSize", 15); + double AutoRow = prefs->getDouble("/dialogs/gridtiler/AutoRowSize", 15); if (AutoRow>0) AutoRowSize=true; else @@ -693,7 +697,7 @@ TileDialog::TileDialog() VertBotRadioButton.signal_toggled().connect(sigc::mem_fun(*this, &TileDialog::VertAlign_changed)); VertAlignVBox.pack_start(VertBotRadioButton, false, false, 0); - VertAlign = prefs_get_double_attribute ("dialogs.gridtiler", "VertAlign", 1); + VertAlign = prefs->getInt("/dialogs/gridtiler/VertAlign", 1); if (VertAlign == 0) { VertTopRadioButton.set_active(TRUE); } @@ -733,7 +737,7 @@ TileDialog::TileDialog() gtk_size_group_add_widget(_col3, (GtkWidget *) NoOfColsBox.gobj()); ColumnWidthButton.set_label(_("Equal width")); - double AutoCol = prefs_get_double_attribute ("dialogs.gridtiler", "AutoColSize", 15); + double AutoCol = prefs->getDouble("/dialogs/gridtiler/AutoColSize", 15); if (AutoCol>0) AutoColSize=true; else @@ -767,7 +771,7 @@ TileDialog::TileDialog() HorizAlignHBox.pack_start(*(new Gtk::HBox()), true, true, 0); // centering strut - HorizAlign = prefs_get_double_attribute ("dialogs.gridtiler", "HorizAlign", 1); + HorizAlign = prefs->getInt("/dialogs/gridtiler/HorizAlign", 1); if (HorizAlign == 0) { HorizLeftRadioButton.set_active(TRUE); } @@ -810,7 +814,7 @@ TileDialog::TileDialog() YPadSpinner.set_digits(1); YPadSpinner.set_increments(0.2, 2); YPadSpinner.set_range(-10000, 10000); - double YPad = prefs_get_double_attribute ("dialogs.gridtiler", "YPad", 15); + double YPad = prefs->getDouble("/dialogs/gridtiler/YPad", 15); YPadSpinner.set_value(YPad); YPadBox.pack_start(YPadSpinner, true, true, MARGIN); tips.set_tip(YPadSpinner, _("Vertical spacing between rows (px units)")); @@ -835,7 +839,7 @@ TileDialog::TileDialog() XPadSpinner.set_digits(1); XPadSpinner.set_increments(0.2, 2); XPadSpinner.set_range(-10000, 10000); - double XPad = prefs_get_double_attribute ("dialogs.gridtiler", "XPad", 15); + double XPad = prefs->getDouble("/dialogs/gridtiler/XPad", 15); XPadSpinner.set_value(XPad); XPadBox.pack_start(XPadSpinner, true, true, MARGIN); tips.set_tip(XPadSpinner, _("Horizontal spacing between columns (px units)")); @@ -850,7 +854,7 @@ TileDialog::TileDialog() contents->pack_start(TileBox); - double SpacingType = prefs_get_double_attribute ("dialogs.gridtiler", "SpacingType", 15); + double SpacingType = prefs->getDouble("/dialogs/gridtiler/SpacingType", 15); if (SpacingType>0) { ManualSpacing=true; } else { @@ -867,20 +871,10 @@ TileDialog::TileDialog() show_all_children(); } - - - - - } //namespace Dialog } //namespace UI } //namespace Inkscape -//######################################################################### -//## E N D O F F I L E -//######################################################################### - - /* Local Variables: mode:c++ @@ -890,7 +884,4 @@ TileDialog::TileDialog() 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/dialogs/xml-tree.cpp b/src/dialogs/xml-tree.cpp index 89892aab4..06103e9b3 100644 --- a/src/dialogs/xml-tree.cpp +++ b/src/dialogs/xml-tree.cpp @@ -54,7 +54,7 @@ #include "widgets/icon.h" #include "dialog-events.h" -#include "../prefs-utils.h" +#include "../preferences.h" #include "../verbs.h" #include "../interface.h" @@ -78,7 +78,7 @@ static sigc::connection document_replaced_connection; static win_data wd; // impossible original values to make sure they are read from prefs static gint x = -1000, y = -1000, w = 0, h = 0; -static gchar const *const prefs_path = "dialogs.xml"; +static Glib::ustring const prefs_path = "/dialogs/xml/"; static GtkWidget *status = NULL; static Inkscape::MessageStack *_message_stack = NULL; static Inkscape::MessageContext *_message_context = NULL; @@ -212,13 +212,14 @@ void sp_xml_tree_dialog() gtk_tooltips_enable(tooltips); dlg = sp_window_new("", TRUE); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if (x == -1000 || y == -1000) { - x = prefs_get_int_attribute(prefs_path, "x", -1000); - y = prefs_get_int_attribute(prefs_path, "y", -1000); + x = prefs->getInt(prefs_path + "x", -1000); + y = prefs->getInt(prefs_path + "y", -1000); } if (w ==0 || h == 0) { - w = prefs_get_int_attribute(prefs_path, "w", 0); - h = prefs_get_int_attribute(prefs_path, "h", 0); + w = prefs->getInt(prefs_path + "w", 0); + h = prefs->getInt(prefs_path + "h", 0); } // if (x<0) x=0; @@ -924,10 +925,11 @@ static gboolean on_delete(GtkObject */*object*/, GdkEvent */*event*/, gpointer / 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); return FALSE; // which means, go ahead and destroy it } |
