summaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/text-edit.cpp
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2014-12-24 10:09:33 +0000
committertavmjong-free <tavmjong@free.fr>2014-12-24 10:09:33 +0000
commitf4cfff3d186fd61221b3f771bf2794725e619ff7 (patch)
treecf924e794bfcbcef5f409856e8b41f9d5d325716 /src/ui/dialog/text-edit.cpp
parentRemove sp_style_new_from_object() (diff)
downloadinkscape-f4cfff3d186fd61221b3f771bf2794725e619ff7.tar.gz
inkscape-f4cfff3d186fd61221b3f771bf2794725e619ff7.zip
Add missing SPStyle::readFromPrefs(), remove sp_style_read_from_prefs().
(bzr r13822.1.2)
Diffstat (limited to 'src/ui/dialog/text-edit.cpp')
-rw-r--r--src/ui/dialog/text-edit.cpp31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp
index 229e82af4..a8be8b543 100644
--- a/src/ui/dialog/text-edit.cpp
+++ b/src/ui/dialog/text-edit.cpp
@@ -325,18 +325,18 @@ void TextEdit::onReadSelection ( gboolean dostyle, gboolean /*docontent*/ )
if (dostyle) {
// create temporary style
- SPStyle *query = sp_style_new (SP_ACTIVE_DOCUMENT);
+ SPStyle query(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_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);
+ //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);
// If querying returned nothing, read the style from the text tool prefs (default style for new texts)
// (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) {
- sp_style_read_from_prefs(query, "/tools/text");
+ query.readFromPrefs("/tools/text");
}
// FIXME: process result_family/style == QUERY_STYLE_MULTIPLE_DIFFERENT by showing "Many" in the lists
@@ -351,40 +351,39 @@ void TextEdit::onReadSelection ( gboolean dostyle, gboolean /*docontent*/ )
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
int unit = prefs->getInt("/options/font/unitType", SP_CSS_UNIT_PT);
- double size = sp_style_css_size_px_to_units(query->font_size.computed, unit);
+ double size = sp_style_css_size_px_to_units(query.font_size.computed, unit);
sp_font_selector_set_fontspec(fsel, fontspec, size );
setPreviewText (fontspec, phrase);
- if (query->text_anchor.computed == SP_CSS_TEXT_ANCHOR_START) {
- if (query->text_align.computed == SP_CSS_TEXT_ALIGN_JUSTIFY) {
+ if (query.text_anchor.computed == SP_CSS_TEXT_ANCHOR_START) {
+ if (query.text_align.computed == SP_CSS_TEXT_ALIGN_JUSTIFY) {
align_justify.set_active();
} else {
align_left.set_active();
}
- } else if (query->text_anchor.computed == SP_CSS_TEXT_ANCHOR_MIDDLE) {
+ } else if (query.text_anchor.computed == SP_CSS_TEXT_ANCHOR_MIDDLE) {
align_center.set_active();
} else {
align_right.set_active();
}
- if (query->writing_mode.computed == SP_CSS_WRITING_MODE_LR_TB) {
+ if (query.writing_mode.computed == SP_CSS_WRITING_MODE_LR_TB) {
text_horizontal.set_active();
} else {
text_vertical.set_active();
}
double height;
- if (query->line_height.normal) height = Inkscape::Text::Layout::LINE_HEIGHT_NORMAL;
- else if (query->line_height.unit == SP_CSS_UNIT_PERCENT)
- height = query->line_height.value;
- else height = query->line_height.computed;
+ if (query.line_height.normal) height = Inkscape::Text::Layout::LINE_HEIGHT_NORMAL;
+ else if (query.line_height.unit == SP_CSS_UNIT_PERCENT)
+ height = query.line_height.value;
+ else height = query.line_height.computed;
gchar *sstr = g_strdup_printf ("%d%%", (int) floor(height * 100 + 0.5));
gtk_entry_set_text ((GtkEntry *) gtk_bin_get_child ((GtkBin *) spacing_combo), sstr);
g_free(sstr);
- sp_style_unref(query);
}
blocked = false;
}