index 4ba31b4130d7e0f4df6abae620df4681ff20510b..e213a8abac65e25201b6d194d28d0effc3ab75cb 100644 (file)
-#define __SP_TEXT_EDIT_C__
-
-/**
- * \brief Text editing dialog
- *
- * Authors:
+/** @file
+ * @brief Text editing dialog
+ */
+/* Authors:
* Lauris Kaplinski <lauris@ximian.com>
* bulia byak <buliabyak@users.sf.net>
* Johan Engelen <goejendaagh@zonnet.nl>
#endif
#include <libnrtype/font-instance.h>
-
#include <gtk/gtk.h>
#ifdef WITH_GTKSPELL
#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"
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 +101,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
}
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;
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);
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 */
// create temporary style
SPStyle *query = sp_style_new (SP_ACTIVE_DOCUMENT);
// query style from desktop into it. This returns a result flag and fills query with the style of subselection, if any, or selection
- int result_fontspec = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONT_SPECIFICATION);
+ //int result_fontspec = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONT_SPECIFICATION);
int result_family = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTFAMILY);
int result_style = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTSTYLE);
int result_numbers = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
// (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