summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2014-12-26 18:49:12 +0000
committertavmjong-free <tavmjong@free.fr>2014-12-26 18:49:12 +0000
commit74f6d0cf39c974ca1980a7be7742f2154d2025f2 (patch)
treef98b503be33ccc32c1074c5c670a0cd9b5fb5332 /src/widgets
parentDocumentation. Fix for bug #1405653 (Outdated links in hacking doc). (diff)
parentSPStyle ref counting clean up. (diff)
downloadinkscape-74f6d0cf39c974ca1980a7be7742f2154d2025f2.tar.gz
inkscape-74f6d0cf39c974ca1980a7be7742f2154d2025f2.zip
Replace sp_style_xxx functions with SPStyle member functions.
Fix a bunch of memory leaks. One leak still remaining in Layout::appendText. (bzr r13824)
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/dash-selector.cpp12
-rw-r--r--src/widgets/fill-style.cpp23
-rw-r--r--src/widgets/stroke-style.cpp24
-rw-r--r--src/widgets/text-toolbar.cpp139
4 files changed, 90 insertions, 108 deletions
diff --git a/src/widgets/dash-selector.cpp b/src/widgets/dash-selector.cpp
index 479895022..9d591d33d 100644
--- a/src/widgets/dash-selector.cpp
+++ b/src/widgets/dash-selector.cpp
@@ -118,18 +118,18 @@ void SPDashSelector::init_dashes() {
int pos = 0;
if (!dash_prefs.empty()) {
- SPStyle *style = sp_style_new (NULL);
+ SPStyle style;
dashes = g_new (double *, dash_prefs.size() + 2); // +1 for custom slot, +1 for terminator slot
for (std::vector<Glib::ustring>::iterator i = dash_prefs.begin(); i != dash_prefs.end(); ++i) {
- sp_style_read_from_prefs(style, *i);
+ style.readFromPrefs( *i );
- if (!style->stroke_dasharray.values.empty()) {
- dashes[pos] = g_new (double, style->stroke_dasharray.values.size() + 1);
+ if (!style.stroke_dasharray.values.empty()) {
+ dashes[pos] = g_new (double, style.stroke_dasharray.values.size() + 1);
double *d = dashes[pos];
unsigned i = 0;
- for (; i < style->stroke_dasharray.values.size(); i++) {
- d[i] = style->stroke_dasharray.values[i];
+ for (; i < style.stroke_dasharray.values.size(); i++) {
+ d[i] = style.stroke_dasharray.values[i];
}
d[i] = -1;
} else {
diff --git a/src/widgets/fill-style.cpp b/src/widgets/fill-style.cpp
index fcdc9a36b..d60a92b8b 100644
--- a/src/widgets/fill-style.cpp
+++ b/src/widgets/fill-style.cpp
@@ -252,13 +252,13 @@ void FillNStroke::performUpdate()
update = true;
// create temporary style
- SPStyle *query = sp_style_new(desktop->doc());
+ SPStyle query(desktop->doc());
// 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 = sp_desktop_query_style(desktop, query, (kind == FILL) ? QUERY_STYLE_PROPERTY_FILL : QUERY_STYLE_PROPERTY_STROKE);
+ int result = sp_desktop_query_style(desktop, &query, (kind == FILL) ? QUERY_STYLE_PROPERTY_FILL : QUERY_STYLE_PROPERTY_STROKE);
- SPIPaint &targPaint = (kind == FILL) ? query->fill : query->stroke;
- SPIScale24 &targOpacity = (kind == FILL) ? query->fill_opacity : query->stroke_opacity;
+ SPIPaint &targPaint = (kind == FILL) ? query.fill : query.stroke;
+ SPIScale24 &targOpacity = (kind == FILL) ? query.fill_opacity : query.stroke_opacity;
switch (result) {
case QUERY_STYLE_NOTHING:
@@ -272,11 +272,11 @@ void FillNStroke::performUpdate()
case QUERY_STYLE_MULTIPLE_AVERAGED: // TODO: treat this slightly differently, e.g. display "averaged" somewhere in paint selector
case QUERY_STYLE_MULTIPLE_SAME:
{
- SPPaintSelector::Mode pselmode = SPPaintSelector::getModeForStyle(*query, kind);
+ SPPaintSelector::Mode pselmode = SPPaintSelector::getModeForStyle(query, kind);
psel->setMode(pselmode);
if (kind == FILL) {
- psel->setFillrule(query->fill_rule.computed == ART_WIND_RULE_NONZERO?
+ psel->setFillrule(query.fill_rule.computed == ART_WIND_RULE_NONZERO?
SPPaintSelector::FILLRULE_NONZERO : SPPaintSelector::FILLRULE_EVENODD);
}
@@ -284,7 +284,7 @@ void FillNStroke::performUpdate()
psel->setColorAlpha(targPaint.value.color, SP_SCALE24_TO_FLOAT(targOpacity.value));
} else if (targPaint.set && targPaint.isPaintserver()) {
- SPPaintServer *server = (kind == FILL) ? query->getFillPaintServer() : query->getStrokePaintServer();
+ SPPaintServer *server = (kind == FILL) ? query.getFillPaintServer() : query.getStrokePaintServer();
if (server && SP_IS_GRADIENT(server) && SP_GRADIENT(server)->getVector()->isSwatch()) {
SPGradient *vector = SP_GRADIENT(server)->getVector();
@@ -318,8 +318,6 @@ void FillNStroke::performUpdate()
}
}
- sp_style_unref(query);
-
update = false;
}
@@ -562,10 +560,10 @@ void FillNStroke::updateFromPaint()
if (!vector) {
/* No vector in paint selector should mean that we just changed mode */
- SPStyle *query = sp_style_new(desktop->doc());
- int result = objects_query_fillstroke(const_cast<GSList *>(items), query, kind == FILL);
+ SPStyle query(desktop->doc());
+ int result = objects_query_fillstroke(const_cast<GSList *>(items), &query, kind == FILL);
if (result == QUERY_STYLE_MULTIPLE_SAME) {
- SPIPaint &targPaint = (kind == FILL) ? query->fill : query->stroke;
+ SPIPaint &targPaint = (kind == FILL) ? query.fill : query.stroke;
SPColor common;
if (!targPaint.isColor()) {
common = sp_desktop_get_color(desktop, kind == FILL);
@@ -577,7 +575,6 @@ void FillNStroke::updateFromPaint()
vector->setSwatch();
}
}
- sp_style_unref(query);
for (GSList const *i = items; i != NULL; i = i->next) {
//FIXME: see above
diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp
index 755489e12..5ca06a795 100644
--- a/src/widgets/stroke-style.cpp
+++ b/src/widgets/stroke-style.cpp
@@ -815,13 +815,13 @@ StrokeStyle::updateLine()
FillOrStroke kind = GPOINTER_TO_INT(get_data("kind")) ? FILL : STROKE;
// create temporary style
- SPStyle *query = sp_style_new (SP_ACTIVE_DOCUMENT);
+ SPStyle query(SP_ACTIVE_DOCUMENT);
// query into it
- int result_sw = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_STROKEWIDTH);
- int result_ml = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_STROKEMITERLIMIT);
- int result_cap = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_STROKECAP);
- int result_join = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_STROKEJOIN);
- SPIPaint &targPaint = (kind == FILL) ? query->fill : query->stroke;
+ int result_sw = sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_STROKEWIDTH);
+ int result_ml = sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_STROKEMITERLIMIT);
+ int result_cap = sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_STROKECAP);
+ int result_join = sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_STROKEJOIN);
+ SPIPaint &targPaint = (kind == FILL) ? query.fill : query.stroke;
if (!sel || sel->isEmpty()) {
// Nothing selected, grey-out all controls in the stroke-style dialog
@@ -846,7 +846,7 @@ StrokeStyle::updateLine()
Inkscape::Util::Unit const *unit = unitSelector->getUnit();
if (unit->type == Inkscape::Util::UNIT_TYPE_LINEAR) {
- double avgwidth = Inkscape::Util::Quantity::convert(query->stroke_width.computed, "px", unit);
+ double avgwidth = Inkscape::Util::Quantity::convert(query.stroke_width.computed, "px", unit);
#if WITH_GTKMM_3_0
(*widthAdj)->set_value(avgwidth);
#else
@@ -879,27 +879,25 @@ StrokeStyle::updateLine()
if (result_ml != QUERY_STYLE_NOTHING)
#if WITH_GTKMM_3_0
- (*miterLimitAdj)->set_value(query->stroke_miterlimit.value); // TODO: reflect averagedness?
+ (*miterLimitAdj)->set_value(query.stroke_miterlimit.value); // TODO: reflect averagedness?
#else
- miterLimitAdj->set_value(query->stroke_miterlimit.value); // TODO: reflect averagedness?
+ miterLimitAdj->set_value(query.stroke_miterlimit.value); // TODO: reflect averagedness?
#endif
if (result_join != QUERY_STYLE_MULTIPLE_DIFFERENT &&
result_join != QUERY_STYLE_NOTHING ) {
- setJoinType(query->stroke_linejoin.value);
+ setJoinType(query.stroke_linejoin.value);
} else {
setJoinButtons(NULL);
}
if (result_cap != QUERY_STYLE_MULTIPLE_DIFFERENT &&
result_cap != QUERY_STYLE_NOTHING ) {
- setCapType (query->stroke_linecap.value);
+ setCapType (query.stroke_linecap.value);
} else {
setCapButtons(NULL);
}
- sp_style_unref(query);
-
if (!sel || sel->isEmpty())
return;
diff --git a/src/widgets/text-toolbar.cpp b/src/widgets/text-toolbar.cpp
index d113d5c28..3d2e6eef8 100644
--- a/src/widgets/text-toolbar.cpp
+++ b/src/widgets/text-toolbar.cpp
@@ -220,9 +220,9 @@ static void sp_text_fontsize_value_changed( Ink_ComboBoxEntry_Action *act, GObje
sp_desktop_set_style (desktop, css, true, true);
// If no selected objects, set default.
- SPStyle *query = sp_style_new (SP_ACTIVE_DOCUMENT);
+ SPStyle query(SP_ACTIVE_DOCUMENT);
int result_numbers =
- sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
+ sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
if (result_numbers == QUERY_STYLE_NOTHING)
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
@@ -233,8 +233,6 @@ static void sp_text_fontsize_value_changed( Ink_ComboBoxEntry_Action *act, GObje
_("Text: Change font size"));
}
- sp_style_unref(query);
-
sp_repr_css_attr_unref (css);
g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
@@ -292,8 +290,8 @@ static void sp_text_script_changed( InkToggleAction* act, GObject *tbl )
#endif
// Query baseline
- SPStyle *query = sp_style_new (SP_ACTIVE_DOCUMENT);
- int result_baseline = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_BASELINES);
+ SPStyle query(SP_ACTIVE_DOCUMENT);
+ int result_baseline = sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_BASELINES);
bool setSuper = false;
bool setSub = false;
@@ -307,14 +305,14 @@ static void sp_text_script_changed( InkToggleAction* act, GObject *tbl )
}
} else {
// Superscript
- gboolean superscriptSet = (query->baseline_shift.set &&
- query->baseline_shift.type == SP_BASELINE_SHIFT_LITERAL &&
- query->baseline_shift.literal == SP_CSS_BASELINE_SHIFT_SUPER );
+ gboolean superscriptSet = (query.baseline_shift.set &&
+ query.baseline_shift.type == SP_BASELINE_SHIFT_LITERAL &&
+ query.baseline_shift.literal == SP_CSS_BASELINE_SHIFT_SUPER );
// Subscript
- gboolean subscriptSet = (query->baseline_shift.set &&
- query->baseline_shift.type == SP_BASELINE_SHIFT_LITERAL &&
- query->baseline_shift.literal == SP_CSS_BASELINE_SHIFT_SUB );
+ gboolean subscriptSet = (query.baseline_shift.set &&
+ query.baseline_shift.type == SP_BASELINE_SHIFT_LITERAL &&
+ query.baseline_shift.literal == SP_CSS_BASELINE_SHIFT_SUB );
setSuper = !superscriptSet && prop == 0;
setSub = !subscriptSet && prop == 1;
@@ -473,10 +471,9 @@ static void sp_text_align_mode_changed( EgeSelectOneAction *act, GObject *tbl )
}
}
- SPStyle *query =
- sp_style_new (SP_ACTIVE_DOCUMENT);
+ SPStyle query(SP_ACTIVE_DOCUMENT);
int result_numbers =
- sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
+ sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
// If querying returned nothing, update default style.
if (result_numbers == QUERY_STYLE_NOTHING)
@@ -485,8 +482,6 @@ static void sp_text_align_mode_changed( EgeSelectOneAction *act, GObject *tbl )
prefs->mergeStyle("/tools/text/style", css);
}
- sp_style_unref(query);
-
sp_desktop_set_style (desktop, css, true, true);
if (result_numbers != QUERY_STYLE_NOTHING)
{
@@ -538,15 +533,14 @@ static void sp_text_lineheight_value_changed( GtkAdjustment *adj, GObject *tbl )
}
// If no selected objects, set default.
- SPStyle *query = sp_style_new (SP_ACTIVE_DOCUMENT);
+ SPStyle query(SP_ACTIVE_DOCUMENT);
int result_numbers =
- sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
+ sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
if (result_numbers == QUERY_STYLE_NOTHING)
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->mergeStyle("/tools/text/style", css);
}
- sp_style_unref(query);
sp_repr_css_attr_unref (css);
@@ -573,9 +567,9 @@ static void sp_text_wordspacing_value_changed( GtkAdjustment *adj, GObject *tbl
sp_desktop_set_style (desktop, css, true, false);
// If no selected objects, set default.
- SPStyle *query = sp_style_new (SP_ACTIVE_DOCUMENT);
+ SPStyle query(SP_ACTIVE_DOCUMENT);
int result_numbers =
- sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
+ sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
if (result_numbers == QUERY_STYLE_NOTHING)
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
@@ -585,7 +579,6 @@ static void sp_text_wordspacing_value_changed( GtkAdjustment *adj, GObject *tbl
DocumentUndo::maybeDone(SP_ACTIVE_DESKTOP->getDocument(), "ttb:word-spacing", SP_VERB_NONE,
_("Text: Change word-spacing"));
}
- sp_style_unref(query);
sp_repr_css_attr_unref (css);
@@ -612,9 +605,9 @@ static void sp_text_letterspacing_value_changed( GtkAdjustment *adj, GObject *tb
sp_desktop_set_style (desktop, css, true, false);
// If no selected objects, set default.
- SPStyle *query = sp_style_new (SP_ACTIVE_DOCUMENT);
+ SPStyle query(SP_ACTIVE_DOCUMENT);
int result_numbers =
- sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
+ sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
if (result_numbers == QUERY_STYLE_NOTHING)
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
@@ -627,8 +620,6 @@ static void sp_text_letterspacing_value_changed( GtkAdjustment *adj, GObject *tb
_("Text: Change letter-spacing"));
}
- sp_style_unref(query);
-
sp_repr_css_attr_unref (css);
g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
@@ -765,10 +756,9 @@ static void sp_text_orientation_mode_changed( EgeSelectOneAction *act, GObject *
}
}
- SPStyle *query =
- sp_style_new (SP_ACTIVE_DOCUMENT);
+ SPStyle query(SP_ACTIVE_DOCUMENT);
int result_numbers =
- sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
+ sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
// If querying returned nothing, update default style.
if (result_numbers == QUERY_STYLE_NOTHING)
@@ -892,11 +882,11 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/
* Numbers (font-size, letter-spacing, word-spacing, line-height, text-anchor, writing-mode)
* Font specification (Inkscape private attribute)
*/
- SPStyle *query = sp_style_new (SP_ACTIVE_DOCUMENT);
- 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_baseline = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_BASELINES);
+ SPStyle query(SP_ACTIVE_DOCUMENT);
+ 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_baseline = sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_BASELINES);
/*
* If no text in selection (querying returned nothing), read the style from
@@ -905,14 +895,13 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/
*/
if (result_family == QUERY_STYLE_NOTHING || result_style == QUERY_STYLE_NOTHING || result_numbers == QUERY_STYLE_NOTHING) {
// There are no texts in selection, read from preferences.
- sp_style_read_from_prefs(query, "/tools/text");
+ query.readFromPrefs("/tools/text");
#ifdef DEBUG_TEXT
std::cout << " read style from prefs:" << std::endl;
- sp_print_font( query );
+ sp_print_font( &query );
#endif
if (g_object_get_data(tbl, "text_style_from_prefs")) {
// Do not reset the toolbar style from prefs if we already did it last time
- sp_style_unref(query);
g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
#ifdef DEBUG_TEXT
std::cout << " text_style_from_prefs: toolbar already set" << std:: endl;
@@ -937,7 +926,7 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/
// Size (average of text selected)
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);
//gchar size_text[G_ASCII_DTOSTR_BUF_SIZE];
//g_ascii_dtostr (size_text, sizeof (size_text), size);
@@ -961,9 +950,9 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/
// Superscript
gboolean superscriptSet =
((result_baseline == QUERY_STYLE_SINGLE || result_baseline == QUERY_STYLE_MULTIPLE_SAME ) &&
- query->baseline_shift.set &&
- query->baseline_shift.type == SP_BASELINE_SHIFT_LITERAL &&
- query->baseline_shift.literal == SP_CSS_BASELINE_SHIFT_SUPER );
+ query.baseline_shift.set &&
+ query.baseline_shift.type == SP_BASELINE_SHIFT_LITERAL &&
+ query.baseline_shift.literal == SP_CSS_BASELINE_SHIFT_SUPER );
InkToggleAction* textSuperscriptAction = INK_TOGGLE_ACTION( g_object_get_data( tbl, "TextSuperscriptAction" ) );
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(textSuperscriptAction), superscriptSet );
@@ -972,9 +961,9 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/
// Subscript
gboolean subscriptSet =
((result_baseline == QUERY_STYLE_SINGLE || result_baseline == QUERY_STYLE_MULTIPLE_SAME ) &&
- query->baseline_shift.set &&
- query->baseline_shift.type == SP_BASELINE_SHIFT_LITERAL &&
- query->baseline_shift.literal == SP_CSS_BASELINE_SHIFT_SUB );
+ query.baseline_shift.set &&
+ query.baseline_shift.type == SP_BASELINE_SHIFT_LITERAL &&
+ query.baseline_shift.literal == SP_CSS_BASELINE_SHIFT_SUB );
InkToggleAction* textSubscriptAction = INK_TOGGLE_ACTION( g_object_get_data( tbl, "TextSubscriptAction" ) );
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(textSubscriptAction), subscriptSet );
@@ -1001,26 +990,26 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/
// ege_select_one_action_set_sensitive( textAlignAction, 3, isFlow );
int activeButton = 0;
- if (query->text_align.computed == SP_CSS_TEXT_ALIGN_JUSTIFY)
+ if (query.text_align.computed == SP_CSS_TEXT_ALIGN_JUSTIFY)
{
activeButton = 3;
} else {
- if (query->text_anchor.computed == SP_CSS_TEXT_ANCHOR_START) activeButton = 0;
- if (query->text_anchor.computed == SP_CSS_TEXT_ANCHOR_MIDDLE) activeButton = 1;
- if (query->text_anchor.computed == SP_CSS_TEXT_ANCHOR_END) activeButton = 2;
+ if (query.text_anchor.computed == SP_CSS_TEXT_ANCHOR_START) activeButton = 0;
+ if (query.text_anchor.computed == SP_CSS_TEXT_ANCHOR_MIDDLE) activeButton = 1;
+ if (query.text_anchor.computed == SP_CSS_TEXT_ANCHOR_END) activeButton = 2;
}
ege_select_one_action_set_active( textAlignAction, activeButton );
// Line height (spacing)
double height;
- if (query->line_height.normal) {
+ 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;
+ if (query.line_height.unit == SP_CSS_UNIT_PERCENT) {
+ height = query.line_height.value;
} else {
- height = query->line_height.computed;
+ height = query.line_height.computed;
}
}
@@ -1032,8 +1021,8 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/
// Word spacing
double wordSpacing;
- if (query->word_spacing.normal) wordSpacing = 0.0;
- else wordSpacing = query->word_spacing.computed; // Assume no units (change in desktop-style.cpp)
+ if (query.word_spacing.normal) wordSpacing = 0.0;
+ else wordSpacing = query.word_spacing.computed; // Assume no units (change in desktop-style.cpp)
GtkAction* wordSpacingAction = GTK_ACTION( g_object_get_data( tbl, "TextWordSpacingAction" ) );
GtkAdjustment *wordSpacingAdjustment =
@@ -1043,8 +1032,8 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/
// Letter spacing
double letterSpacing;
- if (query->letter_spacing.normal) letterSpacing = 0.0;
- else letterSpacing = query->letter_spacing.computed; // Assume no units (change in desktop-style.cpp)
+ if (query.letter_spacing.normal) letterSpacing = 0.0;
+ else letterSpacing = query.letter_spacing.computed; // Assume no units (change in desktop-style.cpp)
GtkAction* letterSpacingAction = GTK_ACTION( g_object_get_data( tbl, "TextLetterSpacingAction" ) );
GtkAdjustment *letterSpacingAdjustment =
@@ -1053,7 +1042,7 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/
// Orientation
- int activeButton2 = (query->writing_mode.computed == SP_CSS_WRITING_MODE_LR_TB ? 0 : 1);
+ int activeButton2 = (query.writing_mode.computed == SP_CSS_WRITING_MODE_LR_TB ? 0 : 1);
EgeSelectOneAction* textOrientationAction =
EGE_SELECT_ONE_ACTION( g_object_get_data( tbl, "TextOrientationAction" ) );
@@ -1064,27 +1053,25 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/
#ifdef DEBUG_TEXT
std::cout << " GUI: fontfamily.value: "
- << (query->font_family.value ? query->font_family.value : "No value")
+ << (query.font_family.value ? query.font_family.value : "No value")
<< std::endl;
- std::cout << " GUI: font_size.computed: " << query->font_size.computed << std::endl;
- std::cout << " GUI: font_weight.computed: " << query->font_weight.computed << std::endl;
- std::cout << " GUI: font_style.computed: " << query->font_style.computed << std::endl;
- std::cout << " GUI: text_anchor.computed: " << query->text_anchor.computed << std::endl;
- std::cout << " GUI: text_align.computed: " << query->text_align.computed << std::endl;
- std::cout << " GUI: line_height.computed: " << query->line_height.computed
- << " line_height.value: " << query->line_height.value
- << " line_height.unit: " << query->line_height.unit << std::endl;
- std::cout << " GUI: word_spacing.computed: " << query->word_spacing.computed
- << " word_spacing.value: " << query->word_spacing.value
- << " word_spacing.unit: " << query->word_spacing.unit << std::endl;
- std::cout << " GUI: letter_spacing.computed: " << query->letter_spacing.computed
- << " letter_spacing.value: " << query->letter_spacing.value
- << " letter_spacing.unit: " << query->letter_spacing.unit << std::endl;
- std::cout << " GUI: writing_mode.computed: " << query->writing_mode.computed << std::endl;
+ std::cout << " GUI: font_size.computed: " << query.font_size.computed << std::endl;
+ std::cout << " GUI: font_weight.computed: " << query.font_weight.computed << std::endl;
+ std::cout << " GUI: font_style.computed: " << query.font_style.computed << std::endl;
+ std::cout << " GUI: text_anchor.computed: " << query.text_anchor.computed << std::endl;
+ std::cout << " GUI: text_align.computed: " << query.text_align.computed << std::endl;
+ std::cout << " GUI: line_height.computed: " << query.line_height.computed
+ << " line_height.value: " << query.line_height.value
+ << " line_height.unit: " << query.line_height.unit << std::endl;
+ std::cout << " GUI: word_spacing.computed: " << query.word_spacing.computed
+ << " word_spacing.value: " << query.word_spacing.value
+ << " word_spacing.unit: " << query.word_spacing.unit << std::endl;
+ std::cout << " GUI: letter_spacing.computed: " << query.letter_spacing.computed
+ << " letter_spacing.value: " << query.letter_spacing.value
+ << " letter_spacing.unit: " << query.letter_spacing.unit << std::endl;
+ std::cout << " GUI: writing_mode.computed: " << query.writing_mode.computed << std::endl;
#endif
- sp_style_unref(query);
-
// Kerning (xshift), yshift, rotation. NB: These are not CSS attributes.
if( SP_IS_TEXT_CONTEXT((SP_ACTIVE_DESKTOP)->event_context) ) {
Inkscape::UI::Tools::TextTool *const tc = SP_TEXT_CONTEXT((SP_ACTIVE_DESKTOP)->event_context);