summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/dialog/glyphs.cpp9
-rw-r--r--src/ui/dialog/swatches.cpp24
-rw-r--r--src/ui/widget/object-composite-settings.cpp16
-rw-r--r--src/ui/widget/selected-style.cpp26
4 files changed, 34 insertions, 41 deletions
diff --git a/src/ui/dialog/glyphs.cpp b/src/ui/dialog/glyphs.cpp
index 9bad90e7c..2b9053da9 100644
--- a/src/ui/dialog/glyphs.cpp
+++ b/src/ui/dialog/glyphs.cpp
@@ -709,13 +709,12 @@ void GlyphsPanel::readSelection( bool updateStyle, bool /*updateContent*/ )
calcCanInsert();
if (targetDesktop && updateStyle) {
- //SPStyle *query = sp_style_new(SP_ACTIVE_DOCUMENT);
+ //SPStyle query(SP_ACTIVE_DOCUMENT);
- //int result_family = sp_desktop_query_style(targetDesktop, query, QUERY_STYLE_PROPERTY_FONTFAMILY);
- //int result_style = sp_desktop_query_style(targetDesktop, query, QUERY_STYLE_PROPERTY_FONTSTYLE);
- //int result_numbers = sp_desktop_query_style(targetDesktop, query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
+ //int result_family = sp_desktop_query_style(targetDesktop, &query, QUERY_STYLE_PROPERTY_FONTFAMILY);
+ //int result_style = sp_desktop_query_style(targetDesktop, &query, QUERY_STYLE_PROPERTY_FONTSTYLE);
+ //int result_numbers = sp_desktop_query_style(targetDesktop, &query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
- //sp_style_unref(query);
}
}
diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp
index 772217fcd..8759039c3 100644
--- a/src/ui/dialog/swatches.cpp
+++ b/src/ui/dialog/swatches.cpp
@@ -125,12 +125,12 @@ static void editGradientImpl( SPDesktop* desktop, SPGradient* gr )
Inkscape::Selection *selection = desktop->getSelection();
GSList const *items = selection->itemList();
if (items) {
- SPStyle *query = sp_style_new( desktop->doc() );
- int result = objects_query_fillstroke(const_cast<GSList *>(items), query, true);
+ SPStyle query( desktop->doc() );
+ int result = objects_query_fillstroke(const_cast<GSList *>(items), &query, true);
if ( (result == QUERY_STYLE_MULTIPLE_SAME) || (result == QUERY_STYLE_SINGLE) ) {
// could be pertinent
- if (query->fill.isPaintserver()) {
- SPPaintServer* server = query->getFillPaintServer();
+ if (query.fill.isPaintserver()) {
+ SPPaintServer* server = query.getFillPaintServer();
if ( SP_IS_GRADIENT(server) ) {
SPGradient* grad = SP_GRADIENT(server);
if ( grad->isSwatch() && grad->getId() == gr->getId()) {
@@ -140,7 +140,6 @@ static void editGradientImpl( SPDesktop* desktop, SPGradient* gr )
}
}
}
- sp_style_unref(query);
}
}
@@ -1061,15 +1060,15 @@ void SwatchesPanel::_updateFromSelection()
Glib::ustring fillId;
Glib::ustring strokeId;
- SPStyle *tmpStyle = sp_style_new(_currentDesktop->getDocument());
- int result = sp_desktop_query_style( _currentDesktop, tmpStyle, QUERY_STYLE_PROPERTY_FILL );
+ SPStyle tmpStyle(_currentDesktop->getDocument());
+ int result = sp_desktop_query_style( _currentDesktop, &tmpStyle, QUERY_STYLE_PROPERTY_FILL );
switch (result) {
case QUERY_STYLE_SINGLE:
case QUERY_STYLE_MULTIPLE_AVERAGED:
case QUERY_STYLE_MULTIPLE_SAME:
{
- if (tmpStyle->fill.set && tmpStyle->fill.isPaintserver()) {
- SPPaintServer* server = tmpStyle->getFillPaintServer();
+ if (tmpStyle.fill.set && tmpStyle.fill.isPaintserver()) {
+ SPPaintServer* server = tmpStyle.getFillPaintServer();
if ( SP_IS_GRADIENT(server) ) {
SPGradient* target = 0;
SPGradient* grad = SP_GRADIENT(server);
@@ -1095,14 +1094,14 @@ void SwatchesPanel::_updateFromSelection()
}
}
- result = sp_desktop_query_style( _currentDesktop, tmpStyle, QUERY_STYLE_PROPERTY_STROKE );
+ result = sp_desktop_query_style( _currentDesktop, &tmpStyle, QUERY_STYLE_PROPERTY_STROKE );
switch (result) {
case QUERY_STYLE_SINGLE:
case QUERY_STYLE_MULTIPLE_AVERAGED:
case QUERY_STYLE_MULTIPLE_SAME:
{
- if (tmpStyle->stroke.set && tmpStyle->stroke.isPaintserver()) {
- SPPaintServer* server = tmpStyle->getStrokePaintServer();
+ if (tmpStyle.stroke.set && tmpStyle.stroke.isPaintserver()) {
+ SPPaintServer* server = tmpStyle.getStrokePaintServer();
if ( SP_IS_GRADIENT(server) ) {
SPGradient* target = 0;
SPGradient* grad = SP_GRADIENT(server);
@@ -1126,7 +1125,6 @@ void SwatchesPanel::_updateFromSelection()
break;
}
}
- sp_style_unref(tmpStyle);
for ( boost::ptr_vector<ColorItem>::iterator it = docPalette->_colors.begin(); it != docPalette->_colors.end(); ++it ) {
ColorItem* item = &*it;
diff --git a/src/ui/widget/object-composite-settings.cpp b/src/ui/widget/object-composite-settings.cpp
index 7439a402c..00a74c4fe 100644
--- a/src/ui/widget/object-composite-settings.cpp
+++ b/src/ui/widget/object-composite-settings.cpp
@@ -219,8 +219,8 @@ ObjectCompositeSettings::_subjectChanged() {
return;
_blocked = true;
- SPStyle *query = sp_style_new (desktop->getDocument());
- int result = _subject->queryStyle(query, QUERY_STYLE_PROPERTY_MASTEROPACITY);
+ SPStyle query(desktop->getDocument());
+ int result = _subject->queryStyle(&query, QUERY_STYLE_PROPERTY_MASTEROPACITY);
switch (result) {
case QUERY_STYLE_NOTHING:
@@ -231,19 +231,19 @@ ObjectCompositeSettings::_subjectChanged() {
case QUERY_STYLE_MULTIPLE_AVERAGED: // TODO: treat this slightly differently
case QUERY_STYLE_MULTIPLE_SAME:
_opacity_vbox.set_sensitive(true);
- _opacity_scale.get_adjustment()->set_value(100 * SP_SCALE24_TO_FLOAT(query->opacity.value));
+ _opacity_scale.get_adjustment()->set_value(100 * SP_SCALE24_TO_FLOAT(query.opacity.value));
break;
}
//query now for current filter mode and average blurring of selection
- const int blend_result = _subject->queryStyle(query, QUERY_STYLE_PROPERTY_BLEND);
+ const int blend_result = _subject->queryStyle(&query, QUERY_STYLE_PROPERTY_BLEND);
switch(blend_result) {
case QUERY_STYLE_NOTHING:
_fe_cb.set_sensitive(false);
break;
case QUERY_STYLE_SINGLE:
case QUERY_STYLE_MULTIPLE_SAME:
- _fe_cb.set_blend_mode(query->filter_blend_mode.value);
+ _fe_cb.set_blend_mode(query.filter_blend_mode.value);
_fe_cb.set_sensitive(true);
break;
case QUERY_STYLE_MULTIPLE_DIFFERENT:
@@ -253,7 +253,7 @@ ObjectCompositeSettings::_subjectChanged() {
}
if(blend_result == QUERY_STYLE_SINGLE || blend_result == QUERY_STYLE_MULTIPLE_SAME) {
- int blur_result = _subject->queryStyle(query, QUERY_STYLE_PROPERTY_BLUR);
+ int blur_result = _subject->queryStyle(&query, QUERY_STYLE_PROPERTY_BLUR);
switch (blur_result) {
case QUERY_STYLE_NOTHING: //no blurring
_fe_cb.set_blur_sensitive(false);
@@ -266,7 +266,7 @@ ObjectCompositeSettings::_subjectChanged() {
double perimeter = bbox->dimensions()[Geom::X] + bbox->dimensions()[Geom::Y]; // fixme: this is only half the perimeter, is that correct?
_fe_cb.set_blur_sensitive(true);
//update blur widget value
- float radius = query->filter_gaussianBlur_deviation.value;
+ float radius = query.filter_gaussianBlur_deviation.value;
float percent = radius * 400 / perimeter; // so that for a square, 100% == half side
_fe_cb.set_blur_value(percent);
}
@@ -274,8 +274,6 @@ ObjectCompositeSettings::_subjectChanged() {
}
}
- sp_style_unref(query);
-
_blocked = false;
}
diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp
index 93b4893f2..1fc67dcef 100644
--- a/src/ui/widget/selected-style.cpp
+++ b/src/ui/widget/selected-style.cpp
@@ -977,7 +977,7 @@ SelectedStyle::update()
return;
// create temporary style
- SPStyle *query = sp_style_new (_desktop->getDocument());
+ SPStyle query(_desktop->getDocument());
for (int i = SS_FILL; i <= SS_STROKE; i++) {
Gtk::EventBox *place = (i == SS_FILL)? &_fill_place : &_stroke_place;
@@ -995,7 +995,7 @@ SelectedStyle::update()
_popup_copy[i].set_sensitive(false);
// query style from desktop. 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,
+ int result = sp_desktop_query_style (_desktop, &query,
(i == SS_FILL)? QUERY_STYLE_PROPERTY_FILL : QUERY_STYLE_PROPERTY_STROKE);
switch (result) {
case QUERY_STYLE_NOTHING:
@@ -1020,12 +1020,12 @@ SelectedStyle::update()
}
SPIPaint *paint;
if (i == SS_FILL) {
- paint = &(query->fill);
+ paint = &(query.fill);
} else {
- paint = &(query->stroke);
+ paint = &(query.stroke);
}
if (paint->set && paint->isPaintserver()) {
- SPPaintServer *server = (i == SS_FILL)? SP_STYLE_FILL_SERVER (query) : SP_STYLE_STROKE_SERVER (query);
+ SPPaintServer *server = (i == SS_FILL)? SP_STYLE_FILL_SERVER (&query) : SP_STYLE_STROKE_SERVER (&query);
if ( server ) {
Inkscape::XML::Node *srepr = server->getRepr();
_paintserver_id[i] += "url(#";
@@ -1062,7 +1062,7 @@ SelectedStyle::update()
}
} else if (paint->set && paint->isColor()) {
guint32 color = paint->value.color.toRGBA32(
- SP_SCALE24_TO_FLOAT ((i == SS_FILL)? query->fill_opacity.value : query->stroke_opacity.value));
+ SP_SCALE24_TO_FLOAT ((i == SS_FILL)? query.fill_opacity.value : query.stroke_opacity.value));
_lastselected[i] = _thisselected[i];
_thisselected[i] = color; // include opacity
((Inkscape::UI::Widget::ColorPreview*)_color_preview[i])->setRgba32 (color);
@@ -1105,7 +1105,7 @@ SelectedStyle::update()
clearTooltip(_opacity_place);
clearTooltip(_opacity_sb);
- int result = sp_desktop_query_style (_desktop, query, QUERY_STYLE_PROPERTY_MASTEROPACITY);
+ int result = sp_desktop_query_style (_desktop, &query, QUERY_STYLE_PROPERTY_MASTEROPACITY);
switch (result) {
case QUERY_STYLE_NOTHING:
@@ -1122,16 +1122,16 @@ SelectedStyle::update()
_opacity_blocked = true;
_opacity_sb.set_sensitive(true);
#if WITH_GTKMM_3_0
- _opacity_adjustment->set_value(SP_SCALE24_TO_FLOAT(query->opacity.value) * 100);
+ _opacity_adjustment->set_value(SP_SCALE24_TO_FLOAT(query.opacity.value) * 100);
#else
- _opacity_adjustment.set_value(SP_SCALE24_TO_FLOAT(query->opacity.value) * 100);
+ _opacity_adjustment.set_value(SP_SCALE24_TO_FLOAT(query.opacity.value) * 100);
#endif
_opacity_blocked = false;
break;
}
// Now query stroke_width
- int result_sw = sp_desktop_query_style (_desktop, query, QUERY_STYLE_PROPERTY_STROKEWIDTH);
+ int result_sw = sp_desktop_query_style (_desktop, &query, QUERY_STYLE_PROPERTY_STROKEWIDTH);
switch (result_sw) {
case QUERY_STYLE_NOTHING:
_stroke_width.set_markup("");
@@ -1143,9 +1143,9 @@ SelectedStyle::update()
{
double w;
if (_sw_unit) {
- w = Inkscape::Util::Quantity::convert(query->stroke_width.computed, "px", _sw_unit);
+ w = Inkscape::Util::Quantity::convert(query.stroke_width.computed, "px", _sw_unit);
} else {
- w = query->stroke_width.computed;
+ w = query.stroke_width.computed;
}
current_stroke_width = w;
@@ -1168,8 +1168,6 @@ SelectedStyle::update()
default:
break;
}
-
- sp_style_unref(query);
}
void SelectedStyle::opacity_0(void) {_opacity_sb.set_value(0);}