diff options
Diffstat (limited to 'src/widgets')
| -rw-r--r-- | src/widgets/arc-toolbar.cpp | 33 | ||||
| -rw-r--r-- | src/widgets/connector-toolbar.cpp | 16 | ||||
| -rw-r--r-- | src/widgets/dash-selector.h | 4 | ||||
| -rw-r--r-- | src/widgets/desktop-widget.cpp | 4 | ||||
| -rw-r--r-- | src/widgets/desktop-widget.h | 8 | ||||
| -rw-r--r-- | src/widgets/ege-adjustment-action.cpp | 2 | ||||
| -rw-r--r-- | src/widgets/fill-style.cpp | 36 | ||||
| -rw-r--r-- | src/widgets/gradient-toolbar.cpp | 15 | ||||
| -rw-r--r-- | src/widgets/gradient-vector.cpp | 1 | ||||
| -rw-r--r-- | src/widgets/icon.cpp | 4 | ||||
| -rw-r--r-- | src/widgets/mesh-toolbar.cpp | 10 | ||||
| -rw-r--r-- | src/widgets/paint-selector.cpp | 22 | ||||
| -rw-r--r-- | src/widgets/rect-toolbar.cpp | 18 | ||||
| -rw-r--r-- | src/widgets/shrink-wrap-button.cpp | 4 | ||||
| -rw-r--r-- | src/widgets/sp-attribute-widget.h | 4 | ||||
| -rw-r--r-- | src/widgets/spiral-toolbar.cpp | 16 | ||||
| -rw-r--r-- | src/widgets/spw-utilities.cpp | 4 | ||||
| -rw-r--r-- | src/widgets/star-toolbar.cpp | 38 | ||||
| -rw-r--r-- | src/widgets/stroke-marker-selector.h | 8 | ||||
| -rw-r--r-- | src/widgets/stroke-style.cpp | 30 | ||||
| -rw-r--r-- | src/widgets/stroke-style.h | 2 | ||||
| -rw-r--r-- | src/widgets/swatch-selector.h | 8 | ||||
| -rw-r--r-- | src/widgets/text-toolbar.cpp | 48 | ||||
| -rw-r--r-- | src/widgets/toolbox.cpp | 4 |
24 files changed, 146 insertions, 193 deletions
diff --git a/src/widgets/arc-toolbar.cpp b/src/widgets/arc-toolbar.cpp index 8a64854be..71418e238 100644 --- a/src/widgets/arc-toolbar.cpp +++ b/src/widgets/arc-toolbar.cpp @@ -97,12 +97,9 @@ sp_arctb_startend_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const *v gchar* namespaced_name = g_strconcat("sodipodi:", value_name, NULL); bool modmade = false; - for (GSList const *items = desktop->getSelection()->itemList(); - items != NULL; - items = items->next) - { - SPItem *item = SP_ITEM(items->data); - + std::vector<SPItem*> itemlist=desktop->getSelection()->itemList(); + for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end();i++){ + SPItem *item = *i; if (SP_IS_GENERICELLIPSE(item)) { SPGenericEllipse *ge = SP_GENERICELLIPSE(item); @@ -166,11 +163,9 @@ static void sp_arctb_open_state_changed( EgeSelectOneAction *act, GObject *tbl ) bool modmade = false; if ( ege_select_one_action_get_active(act) != 0 ) { - for (GSList const *items = desktop->getSelection()->itemList(); - items != NULL; - items = items->next) - { - SPItem *item = reinterpret_cast<SPItem*>(items->data); + std::vector<SPItem*> itemlist=desktop->getSelection()->itemList(); + for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end();i++){ + SPItem *item = *i; if (SP_IS_GENERICELLIPSE(item)) { Inkscape::XML::Node *repr = item->getRepr(); repr->setAttribute("sodipodi:open", "true"); @@ -179,11 +174,9 @@ static void sp_arctb_open_state_changed( EgeSelectOneAction *act, GObject *tbl ) } } } else { - for (GSList const *items = desktop->getSelection()->itemList(); - items != NULL; - items = items->next) - { - SPItem *item = reinterpret_cast<SPItem *>(items->data); + std::vector<SPItem*> itemlist=desktop->getSelection()->itemList(); + for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end();i++){ + SPItem *item = *i; if (SP_IS_GENERICELLIPSE(item)) { Inkscape::XML::Node *repr = item->getRepr(); repr->setAttribute("sodipodi:open", NULL); @@ -271,11 +264,9 @@ static void sp_arc_toolbox_selection_changed(Inkscape::Selection *selection, GOb purge_repr_listener( tbl, tbl ); - for (GSList const *items = selection->itemList(); - items != NULL; - items = items->next) - { - SPItem *item = reinterpret_cast<SPItem *>(items->data); + std::vector<SPItem*> itemlist=selection->itemList(); + for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end();i++){ + SPItem *item = *i; if (SP_IS_GENERICELLIPSE(item)) { n_selected++; repr = item->getRepr(); diff --git a/src/widgets/connector-toolbar.cpp b/src/widgets/connector-toolbar.cpp index c906f7de4..1c99f283d 100644 --- a/src/widgets/connector-toolbar.cpp +++ b/src/widgets/connector-toolbar.cpp @@ -76,7 +76,6 @@ static void sp_connector_path_set_ignore(void) static void sp_connector_orthogonal_toggled( GtkToggleAction* act, GObject *tbl ) { SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data( tbl, "desktop" )); - Inkscape::Selection * selection = desktop->getSelection(); SPDocument *doc = desktop->getDocument(); if (!DocumentUndo::getUndoSensitive(doc)) { @@ -98,9 +97,9 @@ static void sp_connector_orthogonal_toggled( GtkToggleAction* act, GObject *tbl gchar *value = is_orthog ? orthog_str : polyline_str ; bool modmade = false; - GSList *l = (GSList *) selection->itemList(); - while (l) { - SPItem *item = SP_ITEM(l->data); + std::vector<SPItem*> itemlist=desktop->getSelection()->itemList(); + for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end();i++){ + SPItem *item = *i; if (Inkscape::UI::Tools::cc_item_is_connector(item)) { item->setAttribute( "inkscape:connector-type", @@ -108,7 +107,6 @@ static void sp_connector_orthogonal_toggled( GtkToggleAction* act, GObject *tbl item->avoidRef->handleSettingChange(); modmade = true; } - l = l->next; } if (!modmade) { @@ -126,7 +124,6 @@ static void sp_connector_orthogonal_toggled( GtkToggleAction* act, GObject *tbl static void connector_curvature_changed(GtkAdjustment *adj, GObject* tbl) { SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data( tbl, "desktop" )); - Inkscape::Selection * selection = desktop->getSelection(); SPDocument *doc = desktop->getDocument(); if (!DocumentUndo::getUndoSensitive(doc)) { @@ -147,9 +144,9 @@ static void connector_curvature_changed(GtkAdjustment *adj, GObject* tbl) g_ascii_dtostr(value, G_ASCII_DTOSTR_BUF_SIZE, newValue); bool modmade = false; - GSList *l = (GSList *) selection->itemList(); - while (l) { - SPItem *item = SP_ITEM(l->data); + std::vector<SPItem*> itemlist=desktop->getSelection()->itemList(); + for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end();i++){ + SPItem *item = *i; if (Inkscape::UI::Tools::cc_item_is_connector(item)) { item->setAttribute( "inkscape:connector-curvature", @@ -157,7 +154,6 @@ static void connector_curvature_changed(GtkAdjustment *adj, GObject* tbl) item->avoidRef->handleSettingChange(); modmade = true; } - l = l->next; } if (!modmade) { diff --git a/src/widgets/dash-selector.h b/src/widgets/dash-selector.h index 5b9ebfa2b..ec5a1cbd5 100644 --- a/src/widgets/dash-selector.h +++ b/src/widgets/dash-selector.h @@ -14,10 +14,6 @@ # include <config.h> #endif -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include <glibmm/threads.h> -#endif - #include <gtkmm/box.h> #include <gtkmm/combobox.h> #include <gtkmm/liststore.h> diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index fd3756220..e19f56e48 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -1433,8 +1433,10 @@ sp_desktop_widget_maximize(SPDesktopWidget *dtw) if (!dtw->desktop->is_iconified() && !dtw->desktop->is_fullscreen()) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - gint w, h, x, y; + gint w = -1; + gint h, x, y; dtw->getWindowGeometry(x, y, w, h); + g_assert(w != -1); prefs->setInt("/desktop/geometry/width", w); prefs->setInt("/desktop/geometry/height", h); prefs->setInt("/desktop/geometry/x", x); diff --git a/src/widgets/desktop-widget.h b/src/widgets/desktop-widget.h index a77d56fc3..489217d9a 100644 --- a/src/widgets/desktop-widget.h +++ b/src/widgets/desktop-widget.h @@ -12,14 +12,6 @@ * ? -2004 */ -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include <glibmm/threads.h> -#endif - #include <gtkmm/window.h> #include "message.h" #include "ui/view/view-widget.h" diff --git a/src/widgets/ege-adjustment-action.cpp b/src/widgets/ege-adjustment-action.cpp index d89a6e3f1..a91149f4c 100644 --- a/src/widgets/ege-adjustment-action.cpp +++ b/src/widgets/ege-adjustment-action.cpp @@ -742,7 +742,7 @@ static GtkWidget* create_popup_number_menu( EgeAdjustmentAction* act ) if ( act->private_data->descriptions ) { gdouble value = ((EgeAdjustmentDescr*)act->private_data->descriptions->data)->value; - addOns = flush_explicit_items( addOns, G_CALLBACK(process_menu_action), BUMP_CUSTOM, menu, act, &single, &group, value ); + flush_explicit_items( addOns, G_CALLBACK(process_menu_action), BUMP_CUSTOM, menu, act, &single, &group, value ); } return menu; diff --git a/src/widgets/fill-style.cpp b/src/widgets/fill-style.cpp index d60a92b8b..b1f812338 100644 --- a/src/widgets/fill-style.cpp +++ b/src/widgets/fill-style.cpp @@ -22,10 +22,6 @@ # include "config.h" #endif -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include <glibmm/threads.h> -#endif - #include <gtkmm/box.h> #include <glibmm/i18n.h> @@ -481,7 +477,7 @@ void FillNStroke::updateFromPaint() SPDocument *document = desktop->getDocument(); Inkscape::Selection *selection = desktop->getSelection(); - GSList const *items = selection->itemList(); + std::vector<SPItem*> const items = selection->itemList(); switch (psel->mode) { case SPPaintSelector::MODE_EMPTY: @@ -543,7 +539,7 @@ void FillNStroke::updateFromPaint() case SPPaintSelector::MODE_GRADIENT_LINEAR: case SPPaintSelector::MODE_GRADIENT_RADIAL: case SPPaintSelector::MODE_SWATCH: - if (items) { + if (!items.empty()) { SPGradientType const gradient_type = ( psel->mode != SPPaintSelector::MODE_GRADIENT_RADIAL ? SP_GRADIENT_TYPE_LINEAR : SP_GRADIENT_TYPE_RADIAL ); @@ -561,7 +557,7 @@ void FillNStroke::updateFromPaint() /* No vector in paint selector should mean that we just changed mode */ SPStyle query(desktop->doc()); - int result = objects_query_fillstroke(const_cast<GSList *>(items), &query, kind == FILL); + int result = objects_query_fillstroke(items, &query, kind == FILL); if (result == QUERY_STYLE_MULTIPLE_SAME) { SPIPaint &targPaint = (kind == FILL) ? query.fill : query.stroke; SPColor common; @@ -576,39 +572,39 @@ void FillNStroke::updateFromPaint() } } - for (GSList const *i = items; i != NULL; i = i->next) { + for(std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();i++){ //FIXME: see above if (kind == FILL) { - sp_repr_css_change_recursive(reinterpret_cast<SPObject*>(i->data)->getRepr(), css, "style"); + sp_repr_css_change_recursive((*i)->getRepr(), css, "style"); } if (!vector) { SPGradient *gr = sp_gradient_vector_for_object( document, desktop, - reinterpret_cast<SPObject*>(i->data), + reinterpret_cast<SPObject*>(*i), (kind == FILL) ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE, createSwatch ); if ( gr && createSwatch ) { gr->setSwatch(); } - sp_item_set_gradient(SP_ITEM(i->data), + sp_item_set_gradient(*i, gr, gradient_type, (kind == FILL) ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE); } else { - sp_item_set_gradient(SP_ITEM(i->data), vector, gradient_type, (kind == FILL) ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE); + sp_item_set_gradient(*i, vector, gradient_type, (kind == FILL) ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE); } } } else { // We have changed from another gradient type, or modified spread/units within // this gradient type. vector = sp_gradient_ensure_vector_normalized(vector); - for (GSList const *i = items; i != NULL; i = i->next) { + for(std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();i++){ //FIXME: see above if (kind == FILL) { - sp_repr_css_change_recursive(reinterpret_cast<SPObject*>(i->data)->getRepr(), css, "style"); + sp_repr_css_change_recursive((*i)->getRepr(), css, "style"); } - SPGradient *gr = sp_item_set_gradient(SP_ITEM(i->data), vector, gradient_type, (kind == FILL) ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE); + SPGradient *gr = sp_item_set_gradient(*i, vector, gradient_type, (kind == FILL) ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE); psel->pushAttrsToGradient( gr ); } } @@ -625,7 +621,7 @@ void FillNStroke::updateFromPaint() case SPPaintSelector::MODE_PATTERN: - if (items) { + if (!items.empty()) { SPPattern *pattern = psel->getPattern(); if (!pattern) { @@ -648,12 +644,12 @@ void FillNStroke::updateFromPaint() // cannot just call sp_desktop_set_style, because we don't want to touch those // objects who already have the same root pattern but through a different href // chain. FIXME: move this to a sp_item_set_pattern - for (GSList const *i = items; i != NULL; i = i->next) { - Inkscape::XML::Node *selrepr = reinterpret_cast<SPObject*>(i->data)->getRepr(); + for(std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();i++){ + Inkscape::XML::Node *selrepr = (*i)->getRepr(); if ( (kind == STROKE) && !selrepr) { continue; } - SPObject *selobj = reinterpret_cast<SPObject*>(i->data); + SPObject *selobj = *i; SPStyle *style = selobj->style; if (style && ((kind == FILL) ? style->fill : style->stroke).isPaintserver()) { @@ -686,7 +682,7 @@ void FillNStroke::updateFromPaint() break; case SPPaintSelector::MODE_UNSET: - if (items) { + if (!items.empty()) { SPCSSAttr *css = sp_repr_css_attr_new(); if (kind == FILL) { sp_repr_css_unset_property(css, "fill"); diff --git a/src/widgets/gradient-toolbar.cpp b/src/widgets/gradient-toolbar.cpp index 7ce04403b..6743dd23a 100644 --- a/src/widgets/gradient-toolbar.cpp +++ b/src/widgets/gradient-toolbar.cpp @@ -116,8 +116,9 @@ void gr_apply_gradient(Inkscape::Selection *selection, GrDrag *drag, SPGradient } // If no drag or no dragger selected, act on selection - for (GSList const* i = selection->itemList(); i != NULL; i = i->next) { - gr_apply_gradient_to_item(SP_ITEM(i->data), gr, initialType, initialMode, initialMode); + std::vector<SPItem*> itemlist=selection->itemList(); + for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end();i++){ + gr_apply_gradient_to_item(*i, gr, initialType, initialMode, initialMode); } } @@ -217,8 +218,9 @@ void gr_get_dt_selected_gradient(Inkscape::Selection *selection, SPGradient *&gr { SPGradient *gradient = 0; - for (GSList const* i = selection->itemList(); i; i = i->next) { - SPItem *item = SP_ITEM(i->data); // get the items gradient, not the getVector() version + std::vector<SPItem*> itemlist=selection->itemList(); + for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end();i++){ + SPItem *item = *i;// get the items gradient, not the getVector() version SPStyle *style = item->style; SPPaintServer *server = 0; @@ -284,8 +286,9 @@ void gr_read_selection( Inkscape::Selection *selection, } // If no selected dragger, read desktop selection - for (GSList const* i = selection->itemList(); i; i = i->next) { - SPItem *item = SP_ITEM(i->data); + std::vector<SPItem*> itemlist=selection->itemList(); + for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end();i++){ + SPItem *item = *i; SPStyle *style = item->style; if (style && (style->fill.isPaintserver())) { diff --git a/src/widgets/gradient-vector.cpp b/src/widgets/gradient-vector.cpp index d2c46ffec..10d1cc107 100644 --- a/src/widgets/gradient-vector.cpp +++ b/src/widgets/gradient-vector.cpp @@ -548,6 +548,7 @@ static void verify_grad(SPGradient *gradient) child->setAttribute("style", os.str().c_str()); gradient->getRepr()->addChild(child, NULL); Inkscape::GC::release(child); + return; } if (i < 2) { sp_repr_set_css_double(stop->getRepr(), "offset", 0.0); diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp index afc4fcfb0..542d16797 100644 --- a/src/widgets/icon.cpp +++ b/src/widgets/icon.cpp @@ -16,10 +16,6 @@ # include "config.h" #endif -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include <glibmm/threads.h> -#endif - #include <gtkmm/icontheme.h> #include <cstring> #include <glib.h> diff --git a/src/widgets/mesh-toolbar.cpp b/src/widgets/mesh-toolbar.cpp index bf406e632..1af55d9cd 100644 --- a/src/widgets/mesh-toolbar.cpp +++ b/src/widgets/mesh-toolbar.cpp @@ -87,8 +87,9 @@ void ms_read_selection( Inkscape::Selection *selection, bool first = true; ms_type = SP_MESH_TYPE_COONS; - for (GSList const* i = selection->itemList(); i; i = i->next) { - SPItem *item = SP_ITEM(i->data); + std::vector<SPItem*> itemlist=selection->itemList(); + for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end();i++){ + SPItem *item = *i; SPStyle *style = item->style; if (style && (style->fill.isPaintserver())) { @@ -213,8 +214,9 @@ void ms_get_dt_selected_gradient(Inkscape::Selection *selection, SPMesh *&ms_sel { SPMesh *gradient = 0; - for (GSList const* i = selection->itemList(); i; i = i->next) { - SPItem *item = SP_ITEM(i->data); // get the items gradient, not the getVector() version + std::vector<SPItem*> itemlist=selection->itemList(); + for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end();i++){ + SPItem *item = *i;// get the items gradient, not the getVector() version SPStyle *style = item->style; SPPaintServer *server = 0; diff --git a/src/widgets/paint-selector.cpp b/src/widgets/paint-selector.cpp index 948c80db3..221344296 100644 --- a/src/widgets/paint-selector.cpp +++ b/src/widgets/paint-selector.cpp @@ -24,10 +24,6 @@ #include <cstring> #include <string> -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include <glibmm/threads.h> -#endif - #include "widgets/swatch-selector.h" #include "sp-pattern.h" #include <glibmm/i18n.h> @@ -39,6 +35,7 @@ #include "sp-linear-gradient.h" #include "sp-radial-gradient.h" #include "sp-mesh.h" +#include "sp-stop.h" /* fixme: Move it from dialogs to here */ #include "gradient-selector.h" #include <inkscape.h> @@ -662,6 +659,20 @@ sp_paint_selector_color_changed(SPColorSelector *csel, SPPaintSelector *psel) static void sp_paint_selector_set_mode_color(SPPaintSelector *psel, SPPaintSelector::Mode /*mode*/) { GtkWidget *csel; + + SPColor newcolor = psel->color; + float newalpha = psel->alpha; + + if ((psel->mode == SPPaintSelector::MODE_SWATCH) + || (psel->mode == SPPaintSelector::MODE_GRADIENT_LINEAR) + || (psel->mode == SPPaintSelector::MODE_GRADIENT_RADIAL) ) { + SPGradientSelector *gsel = getGradientFromData(psel); + if (gsel) { + SPGradient *gradient = gsel->getVector(); + newcolor = gradient->getFirstStop()->specified_color; + newalpha = gradient->getFirstStop()->opacity; + } + } sp_paint_selector_set_style_buttons(psel, psel->solid); gtk_widget_set_sensitive(psel->style, TRUE); @@ -697,8 +708,7 @@ static void sp_paint_selector_set_mode_color(SPPaintSelector *psel, SPPaintSelec psel->selector = vb; /* Set color */ - SP_COLOR_SELECTOR( csel )->base->setColorAlpha( psel->color, psel->alpha ); - + SP_COLOR_SELECTOR( csel )->base->setColorAlpha( newcolor, newalpha ); } gtk_label_set_markup(GTK_LABEL(psel->label), _("<b>Flat color</b>")); diff --git a/src/widgets/rect-toolbar.cpp b/src/widgets/rect-toolbar.cpp index 46f6d1c23..96ba699dc 100644 --- a/src/widgets/rect-toolbar.cpp +++ b/src/widgets/rect-toolbar.cpp @@ -106,12 +106,13 @@ static void sp_rtb_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const * bool modmade = false; Inkscape::Selection *selection = desktop->getSelection(); - for (GSList const *items = selection->itemList(); items != NULL; items = items->next) { - if (SP_IS_RECT(items->data)) { + std::vector<SPItem*> itemlist=selection->itemList(); + for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end();i++){ + if (SP_IS_RECT(*i)) { if (gtk_adjustment_get_value(adj) != 0) { - (SP_RECT(items->data)->*setter)(Quantity::convert(gtk_adjustment_get_value(adj), unit, "px")); + (SP_RECT(*i)->*setter)(Quantity::convert(gtk_adjustment_get_value(adj), unit, "px")); } else { - SP_OBJECT(items->data)->getRepr()->setAttribute(value_name, NULL); + (*i)->getRepr()->setAttribute(value_name, NULL); } modmade = true; } @@ -242,12 +243,11 @@ static void sp_rect_toolbox_selection_changed(Inkscape::Selection *selection, GO } purge_repr_listener( tbl, tbl ); - for (GSList const *items = selection->itemList(); - items != NULL; - items = items->next) { - if (SP_IS_RECT(reinterpret_cast<SPItem *>(items->data))) { + std::vector<SPItem*> itemlist=selection->itemList(); + for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end();i++){ + if (SP_IS_RECT(*i)) { n_selected++; - item = reinterpret_cast<SPItem *>(items->data); + item = *i; repr = item->getRepr(); } } diff --git a/src/widgets/shrink-wrap-button.cpp b/src/widgets/shrink-wrap-button.cpp index 3558780ed..941a0466c 100644 --- a/src/widgets/shrink-wrap-button.cpp +++ b/src/widgets/shrink-wrap-button.cpp @@ -13,10 +13,6 @@ #include "config.h" #endif -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include <glibmm/threads.h> -#endif - #include <gtkmm/button.h> #include <gtk/gtk.h> diff --git a/src/widgets/sp-attribute-widget.h b/src/widgets/sp-attribute-widget.h index 4bd6c6959..d9b972201 100644 --- a/src/widgets/sp-attribute-widget.h +++ b/src/widgets/sp-attribute-widget.h @@ -19,10 +19,6 @@ # include "config.h" #endif -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include <glibmm/threads.h> -#endif - #include <gtkmm/widget.h> #include <stddef.h> #include <sigc++/connection.h> diff --git a/src/widgets/spiral-toolbar.cpp b/src/widgets/spiral-toolbar.cpp index 3fb0015c1..751a60f06 100644 --- a/src/widgets/spiral-toolbar.cpp +++ b/src/widgets/spiral-toolbar.cpp @@ -79,11 +79,9 @@ static void sp_spl_tb_value_changed(GtkAdjustment *adj, GObject *tbl, Glib::ustr gchar* namespaced_name = g_strconcat("sodipodi:", value_name.data(), NULL); bool modmade = false; - for (GSList const *items = desktop->getSelection()->itemList(); - items != NULL; - items = items->next) - { - SPItem *item = reinterpret_cast<SPItem*>(items->data); + std::vector<SPItem*> itemlist=desktop->getSelection()->itemList(); + for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end();i++){ + SPItem *item = *i; if (SP_IS_SPIRAL(item)) { Inkscape::XML::Node *repr = item->getRepr(); sp_repr_set_svg_double( repr, namespaced_name, @@ -197,11 +195,9 @@ static void sp_spiral_toolbox_selection_changed(Inkscape::Selection *selection, purge_repr_listener( tbl, tbl ); - for (GSList const *items = selection->itemList(); - items != NULL; - items = items->next) - { - SPItem *item = reinterpret_cast<SPItem*>(items->data); + std::vector<SPItem*> itemlist=selection->itemList(); + for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end();i++){ + SPItem *item = *i; if (SP_IS_SPIRAL(item)) { n_selected++; repr = item->getRepr(); diff --git a/src/widgets/spw-utilities.cpp b/src/widgets/spw-utilities.cpp index f87889bb1..7030753a5 100644 --- a/src/widgets/spw-utilities.cpp +++ b/src/widgets/spw-utilities.cpp @@ -17,10 +17,6 @@ #include <cstring> #include <string> -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include <glibmm/threads.h> -#endif - #include <gtkmm/box.h> #include <gtkmm/label.h> diff --git a/src/widgets/star-toolbar.cpp b/src/widgets/star-toolbar.cpp index cf12391c1..96005d7df 100644 --- a/src/widgets/star-toolbar.cpp +++ b/src/widgets/star-toolbar.cpp @@ -83,9 +83,9 @@ static void sp_stb_magnitude_value_changed( GtkAdjustment *adj, GObject *dataKlu bool modmade = false; Inkscape::Selection *selection = desktop->getSelection(); - GSList const *items = selection->itemList(); - for (; items != NULL; items = items->next) { - SPItem *item = reinterpret_cast<SPItem*>(items->data); + std::vector<SPItem*> itemlist=selection->itemList(); + for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end();i++){ + SPItem *item = *i; if (SP_IS_STAR(item)) { Inkscape::XML::Node *repr = item->getRepr(); sp_repr_set_int(repr,"sodipodi:sides", @@ -128,9 +128,9 @@ static void sp_stb_proportion_value_changed( GtkAdjustment *adj, GObject *dataKl bool modmade = false; Inkscape::Selection *selection = desktop->getSelection(); - GSList const *items = selection->itemList(); - for (; items != NULL; items = items->next) { - SPItem *item = reinterpret_cast<SPItem *>(items->data); + std::vector<SPItem*> itemlist=selection->itemList(); + for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end();i++){ + SPItem *item = *i; if (SP_IS_STAR(item)) { Inkscape::XML::Node *repr = item->getRepr(); @@ -178,7 +178,6 @@ static void sp_stb_sides_flat_state_changed( EgeSelectOneAction *act, GObject *d g_object_set_data( dataKludge, "freeze", GINT_TO_POINTER(TRUE) ); Inkscape::Selection *selection = desktop->getSelection(); - GSList const *items = selection->itemList(); GtkAction* prop_action = GTK_ACTION( g_object_get_data( dataKludge, "prop_action" ) ); bool modmade = false; @@ -186,8 +185,9 @@ static void sp_stb_sides_flat_state_changed( EgeSelectOneAction *act, GObject *d gtk_action_set_sensitive( prop_action, !flat ); } - for (; items != NULL; items = items->next) { - SPItem *item = reinterpret_cast<SPItem *>(items->data); + std::vector<SPItem*> itemlist=selection->itemList(); + for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end();i++){ + SPItem *item = *i; if (SP_IS_STAR(item)) { Inkscape::XML::Node *repr = item->getRepr(); repr->setAttribute("inkscape:flatsided", flat ? "true" : "false" ); @@ -224,9 +224,9 @@ static void sp_stb_rounded_value_changed( GtkAdjustment *adj, GObject *dataKludg bool modmade = false; Inkscape::Selection *selection = desktop->getSelection(); - GSList const *items = selection->itemList(); - for (; items != NULL; items = items->next) { - SPItem *item = reinterpret_cast<SPItem*>(items->data); + std::vector<SPItem*> itemlist=selection->itemList(); + for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end();i++){ + SPItem *item = *i; if (SP_IS_STAR(item)) { Inkscape::XML::Node *repr = item->getRepr(); sp_repr_set_svg_double(repr, "inkscape:rounded", @@ -264,9 +264,9 @@ static void sp_stb_randomized_value_changed( GtkAdjustment *adj, GObject *dataKl bool modmade = false; Inkscape::Selection *selection = desktop->getSelection(); - GSList const *items = selection->itemList(); - for (; items != NULL; items = items->next) { - SPItem *item = reinterpret_cast<SPItem *>(items->data); + std::vector<SPItem*> itemlist=selection->itemList(); + for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end();i++){ + SPItem *item = *i; if (SP_IS_STAR(item)) { Inkscape::XML::Node *repr = item->getRepr(); sp_repr_set_svg_double(repr, "inkscape:randomized", @@ -367,11 +367,9 @@ sp_star_toolbox_selection_changed(Inkscape::Selection *selection, GObject *tbl) purge_repr_listener( tbl, tbl ); - for (GSList const *items = selection->itemList(); - items != NULL; - items = items->next) - { - SPItem* item = reinterpret_cast<SPItem *>(items->data); + std::vector<SPItem*> itemlist=selection->itemList(); + for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end();i++){ + SPItem *item = *i; if (SP_IS_STAR(item)) { n_selected++; repr = item->getRepr(); diff --git a/src/widgets/stroke-marker-selector.h b/src/widgets/stroke-marker-selector.h index 27ac76d6f..a7ee788b8 100644 --- a/src/widgets/stroke-marker-selector.h +++ b/src/widgets/stroke-marker-selector.h @@ -10,14 +10,6 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include <glibmm/threads.h> -#endif - #include <gtkmm/box.h> #include <gtkmm/combobox.h> #include <gtkmm/liststore.h> diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp index 5ca06a795..482ca7af4 100644 --- a/src/widgets/stroke-style.cpp +++ b/src/widgets/stroke-style.cpp @@ -475,9 +475,9 @@ void StrokeStyle::markerSelectCB(MarkerComboBox *marker_combo, StrokeStyle *spw, //spw->updateMarkerHist(which); Inkscape::Selection *selection = spw->desktop->getSelection(); - GSList const *items = selection->itemList(); - for (; items != NULL; items = items->next) { - SPItem *item = reinterpret_cast<SPItem *>(items->data); + std::vector<SPItem*> itemlist=selection->itemList(); + for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end();i++){ + SPItem *item = *i; if (!SP_IS_SHAPE(item) || SP_IS_RECT(item)) { // can't set marker to rect, until it's converted to using <path> continue; } @@ -901,8 +901,8 @@ StrokeStyle::updateLine() if (!sel || sel->isEmpty()) return; - GSList const *objects = sel->itemList(); - SPObject * const object = SP_OBJECT(objects->data); + std::vector<SPItem*> const objects = sel->itemList(); + SPObject * const object = objects[0]; SPStyle * const style = object->style; /* Markers */ @@ -957,13 +957,12 @@ StrokeStyle::scaleLine() SPDocument *document = desktop->getDocument(); Inkscape::Selection *selection = desktop->getSelection(); - - GSList const *items = selection->itemList(); + std::vector<SPItem*> items=selection->itemList(); /* TODO: Create some standardized method */ SPCSSAttr *css = sp_repr_css_attr_new(); - if (items) { + if (!items.empty()) { #if WITH_GTKMM_3_0 double width_typed = (*widthAdj)->get_value(); double const miterlimit = (*miterLimitAdj)->get_value(); @@ -978,13 +977,13 @@ StrokeStyle::scaleLine() int ndash; dashSelector->get_dash(&ndash, &dash, &offset); - for (GSList const *i = items; i != NULL; i = i->next) { + for(std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();i++){ /* Set stroke width */ double width; if (unit->type == Inkscape::Util::UNIT_TYPE_LINEAR) { width = Inkscape::Util::Quantity::convert(width_typed, unit, "px"); } else { // percentage - gdouble old_w = SP_OBJECT(i->data)->style->stroke_width.computed; + gdouble old_w = (*i)->style->stroke_width.computed; width = old_w * width_typed / 100; } @@ -1003,7 +1002,7 @@ StrokeStyle::scaleLine() /* Set dash */ setScaledDash(css, ndash, dash, offset, width); - sp_desktop_apply_css_recursive (SP_OBJECT(i->data), css, true); + sp_desktop_apply_css_recursive ((*i), css, true); } g_free(dash); @@ -1144,7 +1143,7 @@ StrokeStyle::setCapButtons(Gtk::ToggleButton *active) * that marker. */ void -StrokeStyle::updateAllMarkers(GSList const *objects) +StrokeStyle::updateAllMarkers(std::vector<SPItem*> const &objects) { struct { MarkerComboBox *key; int loc; } const keyloc[] = { { startMarkerCombo, SP_MARKER_LOC_START }, @@ -1153,9 +1152,10 @@ StrokeStyle::updateAllMarkers(GSList const *objects) }; bool all_texts = true; - for (GSList *i = (GSList *) objects; i != NULL; i = i->next) { - if (!SP_IS_TEXT (i->data)) { + for(std::vector<SPItem*>::const_iterator i=objects.begin();i!=objects.end();i++){ + if (!SP_IS_TEXT (*i)) { all_texts = false; + break; } } @@ -1167,7 +1167,7 @@ StrokeStyle::updateAllMarkers(GSList const *objects) // We show markers of the first object in the list only // FIXME: use the first in the list that has the marker of each type, if any - SPObject *object = SP_OBJECT(objects->data); + SPObject *object = objects[0]; for (unsigned i = 0; i < G_N_ELEMENTS(keyloc); ++i) { // For all three marker types, diff --git a/src/widgets/stroke-style.h b/src/widgets/stroke-style.h index 83048cb76..2605e1acf 100644 --- a/src/widgets/stroke-style.h +++ b/src/widgets/stroke-style.h @@ -153,7 +153,7 @@ private: }; void updateLine(); - void updateAllMarkers(GSList const *objects); + void updateAllMarkers(std::vector<SPItem*> const &objects); void updateMarkerHist(SPMarkerLoc const which); void setDashSelectorFromStyle(SPDashSelector *dsel, SPStyle *style); void setJoinType (unsigned const jointype); diff --git a/src/widgets/swatch-selector.h b/src/widgets/swatch-selector.h index c8c9983a6..4b7aa483f 100644 --- a/src/widgets/swatch-selector.h +++ b/src/widgets/swatch-selector.h @@ -1,14 +1,6 @@ #ifndef SEEN_SP_SWATCH_SELECTOR_H #define SEEN_SP_SWATCH_SELECTOR_H -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include <glibmm/threads.h> -#endif - #include <gtkmm/box.h> class SPDocument; diff --git a/src/widgets/text-toolbar.cpp b/src/widgets/text-toolbar.cpp index 3d2e6eef8..7b22e4af7 100644 --- a/src/widgets/text-toolbar.cpp +++ b/src/widgets/text-toolbar.cpp @@ -162,11 +162,17 @@ static void sp_text_fontfamily_value_changed( Ink_ComboBoxEntry_Action *act, GOb fontlister->fill_css( css ); SPDesktop *desktop = SP_ACTIVE_DESKTOP; - sp_desktop_set_style (desktop, css, true, true); // Results in selection change called twice. + if( desktop->getSelection()->isEmpty() ) { + // Update default + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->mergeStyle("/tools/text/style", css); + } else { + // If there is a selection, update + sp_desktop_set_style (desktop, css, true, true); // Results in selection change called twice. + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT, + _("Text: Change font family")); + } sp_repr_css_attr_unref (css); - - DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT, - _("Text: Change font family")); } // unfreeze @@ -366,9 +372,10 @@ static void sp_text_align_mode_changed( EgeSelectOneAction *act, GObject *tbl ) // move the x of all texts to preserve the same bbox Inkscape::Selection *selection = desktop->getSelection(); - for (GSList const *items = selection->itemList(); items != NULL; items = items->next) { - if (SP_IS_TEXT(SP_ITEM(items->data))) { - SPItem *item = SP_ITEM(items->data); + std::vector<SPItem*> itemlist=selection->itemList(); + for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end();i++){ + if (SP_IS_TEXT(*i)) { + SPItem *item = *i; unsigned writing_mode = item->style->writing_mode.value; // below, variable names suggest horizontal move, but we check the writing direction @@ -517,11 +524,11 @@ static void sp_text_lineheight_value_changed( GtkAdjustment *adj, GObject *tbl ) // Until deprecated sodipodi:linespacing purged: Inkscape::Selection *selection = desktop->getSelection(); - GSList const *items = selection->itemList(); bool modmade = false; - for (; items != NULL; items = items->next) { - if (SP_IS_TEXT (items->data)) { - SP_OBJECT(items->data)->getRepr()->setAttribute("sodipodi:linespacing", sp_repr_css_property (css, "line-height", NULL)); + std::vector<SPItem*> itemlist=selection->itemList(); + for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end();i++){ + if (SP_IS_TEXT (*i)) { + (*i)->getRepr()->setAttribute("sodipodi:linespacing", sp_repr_css_property (css, "line-height", NULL)); modmade = true; } } @@ -863,12 +870,11 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/ // Only flowed text can be justified, only normal text can be kerned... // Find out if we have flowed text now so we can use it several places gboolean isFlow = false; - for (GSList const *items = SP_ACTIVE_DESKTOP->getSelection()->itemList(); - items != NULL; - items = items->next) { + std::vector<SPItem*> itemlist=SP_ACTIVE_DESKTOP->getSelection()->itemList(); + for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end();i++){ // const gchar* id = reinterpret_cast<SPItem *>(items->data)->getId(); // std::cout << " " << id << std::endl; - if( SP_IS_FLOWTEXT(SP_ITEM(items->data))) { + if( SP_IS_FLOWTEXT(*i)) { isFlow = true; // std::cout << " Found flowed text" << std::endl; break; @@ -1153,14 +1159,14 @@ static void sp_text_toolbox_select_cb( GtkEntry* entry, GtkEntryIconPosition /*p //std::cout << "text_toolbox_missing_font_cb: selecting: " << family << std::endl; // Get all items with matching font-family set (not inherited!). - GSList *selectList = NULL; + std::vector<SPItem*> selectList; SPDesktop *desktop = SP_ACTIVE_DESKTOP; SPDocument *document = desktop->getDocument(); - GSList *allList = get_all_items(NULL, document->getRoot(), desktop, false, false, true, NULL); - for (GSList *i = allList; i != NULL; i = i->next) { - - SPItem *item = SP_ITEM(i->data); + std::vector<SPItem*> x,y; + std::vector<SPItem*> allList = get_all_items(x, document->getRoot(), desktop, false, false, true, y); + for(std::vector<SPItem*>::const_reverse_iterator i=allList.rbegin();i!=allList.rend();i++){ + SPItem *item = *i; SPStyle *style = item->style; if (style) { @@ -1177,7 +1183,7 @@ static void sp_text_toolbox_select_cb( GtkEntry* entry, GtkEntryIconPosition /*p if (family_style.compare( family ) == 0 ) { //std::cout << " found: " << item->getId() << std::endl; - selectList = g_slist_prepend (selectList, item); + selectList.push_back(item); } } } diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 5d52db6f2..d56b91f5e 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -29,10 +29,6 @@ # include "config.h" #endif -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include <glibmm/threads.h> -#endif - #include <gtkmm/box.h> #include <gtkmm/action.h> #include <gtkmm/actiongroup.h> |
