diff options
Diffstat (limited to 'src')
56 files changed, 763 insertions, 509 deletions
diff --git a/src/display/drawing-text.cpp b/src/display/drawing-text.cpp index f37f4d3c4..f652a2970 100644 --- a/src/display/drawing-text.cpp +++ b/src/display/drawing-text.cpp @@ -67,13 +67,11 @@ unsigned DrawingGlyphs::_updateItem(Geom::IntRect const &/*area*/, UpdateContext _pick_bbox = Geom::IntRect(); _bbox = Geom::IntRect(); - Geom::OptRect b; - /* orignally it did the one line below, but it did not handle ws characters at all, and it had problems with scaling for overline/underline. Replaced with the section below, which seems to be much more stable. - b = bounds_exact_transformed(*_font->PathVector(_glyph), ctx.ctm); + Geom::OptRect b = bounds_exact_transformed(*_font->PathVector(_glyph), ctx.ctm); */ /* Make a bounding box that is a little taller and lower (currently 10% extra) than the font's drawing box. Extra space is to hold overline or underline, if present. All characters in a font use the same ascent and descent, @@ -81,37 +79,37 @@ unsigned DrawingGlyphs::_updateItem(Geom::IntRect const &/*area*/, UpdateContext the bounding box is limited to the box surrounding the drawn parts of visible glyphs only, and draws outside are ignored. */ - float scale = 1.0; - if(_transform){ scale /= _transform->descrim(); } - - Geom::Rect bigbox(Geom::Point(0.0, _asc*scale*1.1),Geom::Point(_width*scale, -_dsc*scale*1.1)); - b = bigbox * ctx.ctm; + float scale_bigbox = 1.0; + if (_transform) { + scale_bigbox /= _transform->descrim(); + } - if (b && (ggroup->_nrstyle.stroke.type != NRStyle::PAINT_NONE)) { - float width, scale; + Geom::Rect bigbox(Geom::Point(0.0, _asc*scale_bigbox*1.1),Geom::Point(_width*scale_bigbox, -_dsc*scale_bigbox*1.1)); + Geom::Rect b = bigbox * ctx.ctm; + if (ggroup->_nrstyle.stroke.type != NRStyle::PAINT_NONE) { // this expands the selection box for cases where the stroke is "thick" - scale = ctx.ctm.descrim(); + float scale = ctx.ctm.descrim(); if (_transform) { scale /= _transform->descrim(); // FIXME temporary hack } - width = MAX(0.125, ggroup->_nrstyle.stroke_width * scale); + float width = MAX(0.125, ggroup->_nrstyle.stroke_width * scale); if ( fabs(ggroup->_nrstyle.stroke_width * scale) > 0.01 ) { // FIXME: this is always true - b->expandBy(0.5 * width); + b.expandBy(0.5 * width); } // save bbox without miters for picking - _pick_bbox = b->roundOutwards(); + _pick_bbox = b.roundOutwards(); float miterMax = width * ggroup->_nrstyle.miter_limit; if ( miterMax > 0.01 ) { // grunt mode. we should compute the various miters instead // (one for each point on the curve) - b->expandBy(miterMax); + b.expandBy(miterMax); } - _bbox = b->roundOutwards(); - } else if (b) { - _bbox = b->roundOutwards(); + _bbox = b.roundOutwards(); + } else { + _bbox = b.roundOutwards(); _pick_bbox = *_bbox; } /* diff --git a/src/display/snap-indicator.cpp b/src/display/snap-indicator.cpp index 1dd3022c7..627bfb2ab 100644 --- a/src/display/snap-indicator.cpp +++ b/src/display/snap-indicator.cpp @@ -262,36 +262,38 @@ SnapIndicator::set_new_snaptarget(Inkscape::SnappedPoint const &p, bool pre_snap // Display the tooltip, which reveals the type of snap source and the type of snap target gchar *tooltip_str = NULL; - if (p.getSource() != SNAPSOURCE_GRID_PITCH) { + if ( (p.getSource() != SNAPSOURCE_GRID_PITCH) && (p.getTarget() != SNAPTARGET_UNDEFINED) ) { tooltip_str = g_strconcat(source_name, _(" to "), target_name, NULL); - } else { + } else if (p.getSource() != SNAPSOURCE_UNDEFINED) { tooltip_str = g_strdup(source_name); } double fontsize = prefs->getInt("/tools/measure/fontsize"); - Geom::Point tooltip_pos = p.getPoint(); - if (tools_isactive(_desktop, TOOLS_MEASURE)) { - // Make sure that the snap tooltips do not overlap the ones from the measure tool - tooltip_pos += _desktop->w2d(Geom::Point(0, -3*fontsize)); - } else { - tooltip_pos += _desktop->w2d(Geom::Point(0, -2*fontsize)); + if (tooltip_str) { + Geom::Point tooltip_pos = p.getPoint(); + if (tools_isactive(_desktop, TOOLS_MEASURE)) { + // Make sure that the snap tooltips do not overlap the ones from the measure tool + tooltip_pos += _desktop->w2d(Geom::Point(0, -3*fontsize)); + } else { + tooltip_pos += _desktop->w2d(Geom::Point(0, -2*fontsize)); + } + + SPCanvasItem *canvas_tooltip = sp_canvastext_new(sp_desktop_tempgroup(_desktop), _desktop, tooltip_pos, tooltip_str); + sp_canvastext_set_fontsize(SP_CANVASTEXT(canvas_tooltip), fontsize); + SP_CANVASTEXT(canvas_tooltip)->rgba = 0xffffffff; + SP_CANVASTEXT(canvas_tooltip)->outline = false; + SP_CANVASTEXT(canvas_tooltip)->background = true; + if (pre_snap) { + SP_CANVASTEXT(canvas_tooltip)->rgba_background = 0x33337f40; + } else { + SP_CANVASTEXT(canvas_tooltip)->rgba_background = 0x33337f7f; + } + SP_CANVASTEXT(canvas_tooltip)->anchor_position = TEXT_ANCHOR_CENTER; + g_free(tooltip_str); + + _snaptarget_tooltip = _desktop->add_temporary_canvasitem(canvas_tooltip, timeout_val); } - SPCanvasItem *canvas_tooltip = sp_canvastext_new(sp_desktop_tempgroup(_desktop), _desktop, tooltip_pos, tooltip_str); - sp_canvastext_set_fontsize(SP_CANVASTEXT(canvas_tooltip), fontsize); - SP_CANVASTEXT(canvas_tooltip)->rgba = 0xffffffff; - SP_CANVASTEXT(canvas_tooltip)->outline = false; - SP_CANVASTEXT(canvas_tooltip)->background = true; - if (pre_snap) { - SP_CANVASTEXT(canvas_tooltip)->rgba_background = 0x33337f40; - } else { - SP_CANVASTEXT(canvas_tooltip)->rgba_background = 0x33337f7f; - } - SP_CANVASTEXT(canvas_tooltip)->anchor_position = TEXT_ANCHOR_CENTER; - g_free(tooltip_str); - - _snaptarget_tooltip = _desktop->add_temporary_canvasitem(canvas_tooltip, timeout_val); - // Display the bounding box, if we snapped to one Geom::OptRect const bbox = p.getTargetBBox(); if (bbox) { diff --git a/src/dom/ucd.cpp b/src/dom/ucd.cpp index f9c36ad19..f74af3956 100644 --- a/src/dom/ucd.cpp +++ b/src/dom/ucd.cpp @@ -2308,6 +2308,8 @@ typedef struct int map[3]; } CaseMapEntry; +/* + static CaseMapEntry caseMap[] = { { 0x1fc2, 2, { 0xffff, 0x0159 } }, @@ -2426,7 +2428,7 @@ static CaseMapEntry caseMap[] = }; - +*/ diff --git a/src/ege-adjustment-action.cpp b/src/ege-adjustment-action.cpp index 7f844ec4b..9491468dc 100644 --- a/src/ege-adjustment-action.cpp +++ b/src/ege-adjustment-action.cpp @@ -48,6 +48,7 @@ #include "icon-size.h" #include "ege-adjustment-action.h" #include "ui/widget/gimpspinscale.h" +#include "ui/icon-names.h" static void ege_adjustment_action_finalize( GObject* object ); @@ -81,11 +82,11 @@ enum { /* TODO need to have appropriate icons setup for these: */ static const gchar *floogles[] = { - GTK_STOCK_REMOVE, - GTK_STOCK_ADD, - GTK_STOCK_GO_DOWN, - GTK_STOCK_ABOUT, - GTK_STOCK_GO_UP, + INKSCAPE_ICON("list-remove"), + INKSCAPE_ICON("list-add"), + INKSCAPE_ICON("go-down"), + INKSCAPE_ICON("help-about"), + INKSCAPE_ICON("go-up"), 0}; typedef struct _EgeAdjustmentDescr EgeAdjustmentDescr; @@ -982,7 +983,7 @@ static gboolean process_tab( GtkWidget* widget, int direction ) if ( mid && GTK_IS_TOOL_ITEM(mid->data) ) { /* potential target */ GtkWidget* child = gtk_bin_get_child( GTK_BIN(mid->data) ); - if ( child && GTK_IS_HBOX(child) ) { /* could be ours */ + if ( child && GTK_IS_BOX(child) ) { /* could be ours */ GList* subChildren = gtk_container_get_children( GTK_CONTAINER(child) ); if ( subChildren ) { GList* last = g_list_last(subChildren); @@ -1100,3 +1101,13 @@ gboolean keypress_cb( GtkWidget *widget, GdkEventKey *event, gpointer data ) return wasConsumed; } +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ege-output-action.cpp b/src/ege-output-action.cpp index 214bd4b29..9a7d7e318 100644 --- a/src/ege-output-action.cpp +++ b/src/ege-output-action.cpp @@ -221,7 +221,7 @@ void fixup_labels( GObject *gobject, GParamSpec *arg1, gpointer user_data ) /* Search for the things we built up in create_tool_item() */ GList* children = gtk_container_get_children( GTK_CONTAINER(proxies->data) ); if ( children && children->data ) { - if ( GTK_IS_HBOX(children->data) ) { + if ( GTK_IS_BOX(children->data) ) { children = gtk_container_get_children( GTK_CONTAINER(children->data) ); if ( children && g_list_next(children) ) { GtkWidget* child = GTK_WIDGET( g_list_next(children)->data ); diff --git a/src/ege-select-one-action.cpp b/src/ege-select-one-action.cpp index 184d1afb4..3facf7242 100644 --- a/src/ege-select-one-action.cpp +++ b/src/ege-select-one-action.cpp @@ -866,7 +866,7 @@ void resync_active( EgeSelectOneAction* act, gint active, gboolean override ) } else if ( gtk_combo_box_get_active(combo) != active ) { gtk_combo_box_set_active( combo, active ); } - } else if ( GTK_IS_HBOX(children->data) ) { + } else if ( GTK_IS_BOX(children->data) ) { gpointer data = g_object_get_data( G_OBJECT(children->data), "ege-proxy_action-group" ); if ( data ) { GSList* group = (GSList*)data; @@ -921,7 +921,7 @@ void resync_sensitive( EgeSelectOneAction* act ) } if ( GTK_IS_COMBO_BOX(combodata) ) { /* Not implemented */ - } else if ( GTK_IS_HBOX(children->data) ) { + } else if ( GTK_IS_BOX(children->data) ) { gpointer data = g_object_get_data( G_OBJECT(children->data), "ege-proxy_action-group" ); if ( data ) { GSList* group = (GSList*)data; diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp index 3f37e4402..870e4061c 100644 --- a/src/extension/internal/wmf-inout.cpp +++ b/src/extension/internal/wmf-inout.cpp @@ -321,7 +321,7 @@ Wmf::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filena /* WMF has no worldTransform, so this always returns 1.0. Retain it to keep WMF and WMF in sync as much as possible.*/ -double Wmf::current_scale(PWMF_CALLBACK_DATA d){ +double Wmf::current_scale(PWMF_CALLBACK_DATA /*d*/){ return 1.0; } @@ -341,7 +341,7 @@ std::string Wmf::current_matrix(PWMF_CALLBACK_DATA d, double x, double y, int us } /* WMF has no worldTransform, so this always returns 0. Retain it to keep WMF and WMF in sync as much as possible.*/ -double Wmf::current_rotation(PWMF_CALLBACK_DATA d){ +double Wmf::current_rotation(PWMF_CALLBACK_DATA /*d*/){ return 0.0; } @@ -1025,7 +1025,7 @@ Wmf::_pix_y_to_point(PWMF_CALLBACK_DATA d, double py) double -Wmf::pix_to_x_point(PWMF_CALLBACK_DATA d, double px, double py) +Wmf::pix_to_x_point(PWMF_CALLBACK_DATA d, double px, double /*py*/) { double x = _pix_x_to_point(d, px); @@ -1033,7 +1033,7 @@ Wmf::pix_to_x_point(PWMF_CALLBACK_DATA d, double px, double py) } double -Wmf::pix_to_y_point(PWMF_CALLBACK_DATA d, double px, double py) +Wmf::pix_to_y_point(PWMF_CALLBACK_DATA d, double /*px*/, double py) { double y = _pix_y_to_point(d, py); diff --git a/src/file.cpp b/src/file.cpp index cec634c9b..babc4df99 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -843,38 +843,30 @@ sp_file_save_dialog(Gtk::Window &parentWindow, SPDocument *doc, Inkscape::Extens if (extension) filename_extension = extension->get_extension(); - Glib::ustring save_path; - Glib::ustring save_loc; - - save_path = Inkscape::Extension::get_file_save_path(doc, save_method); + Glib::ustring save_path = Inkscape::Extension::get_file_save_path(doc, save_method); if (!Inkscape::IO::file_test(save_path.c_str(), (GFileTest)(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) - save_path = ""; + save_path.clear(); - if (save_path.size()<1) + if (save_path.empty()) save_path = g_get_home_dir(); - save_loc = save_path; + Glib::ustring save_loc = save_path; save_loc.append(G_DIR_SEPARATOR_S); - // TODO fixed buffer is bad: - char formatBuf[256]; int i = 1; if ( !doc->getURI() ) { // We are saving for the first time; create a unique default filename - snprintf(formatBuf, 255, _("drawing%s"), filename_extension.c_str()); - save_loc.append(formatBuf); + save_loc = save_loc + Glib::ustring(_("drawing")) + filename_extension; while (Inkscape::IO::file_test(save_loc.c_str(), G_FILE_TEST_EXISTS)) { save_loc = save_path; save_loc.append(G_DIR_SEPARATOR_S); - snprintf(formatBuf, 255, _("drawing-%d%s"), i++, filename_extension.c_str()); - save_loc.append(formatBuf); + save_loc = save_loc + Glib::ustring::compose(_("drawing-%1"), i++) + filename_extension; } } else { - snprintf(formatBuf, 255, _("%s"), Glib::path_get_basename(doc->getURI()).c_str()); - save_loc.append(formatBuf); + save_loc.append(Glib::path_get_basename(doc->getURI())); } // convert save_loc from utf-8 to locale @@ -882,7 +874,7 @@ sp_file_save_dialog(Gtk::Window &parentWindow, SPDocument *doc, Inkscape::Extens // Inkscape::IO? Glib::ustring save_loc_local = Glib::filename_from_utf8(save_loc); - if ( save_loc_local.size() > 0) + if (!save_loc_local.empty()) save_loc = save_loc_local; //# Show the SaveAs dialog @@ -909,28 +901,27 @@ sp_file_save_dialog(Gtk::Window &parentWindow, SPDocument *doc, Inkscape::Extens bool success = saveDialog->show(); if (!success) { delete saveDialog; + if(doc_title) g_free(doc_title); return success; } // set new title here (call RDF to ensure metadata and title element are updated) rdf_set_work_entity(doc, rdf_find_entity("title"), saveDialog->getDocTitle().c_str()); - // free up old string - if(doc_title) g_free(doc_title); Glib::ustring fileName = saveDialog->getFilename(); Inkscape::Extension::Extension *selectionType = saveDialog->getSelectionType(); delete saveDialog; - saveDialog = 0; + if(doc_title) g_free(doc_title); - if (fileName.size() > 0) { + if (!fileName.empty()) { Glib::ustring newFileName = Glib::filename_to_utf8(fileName); - if ( newFileName.size()>0 ) + if (!newFileName.empty()) fileName = newFileName; else - g_warning( "Error converting save filename to UTF-8." ); + g_warning( "Error converting filename for saving to UTF-8." ); Inkscape::Extension::Output *omod = dynamic_cast<Inkscape::Extension::Output *>(selectionType); if (omod) { diff --git a/src/helper-fns.h b/src/helper-fns.h index 95de4a1b0..699fbbe11 100644 --- a/src/helper-fns.h +++ b/src/helper-fns.h @@ -107,6 +107,7 @@ inline std::vector<gdouble> helperfns_read_vector(const gchar* value){ // We could leave this out, too. If strtod can't convert // anything, it will return zero. ret = 0; + break; } v.push_back(ret); diff --git a/src/helper/geom.cpp b/src/helper/geom.cpp index df0e4fcf2..c9148a634 100644 --- a/src/helper/geom.cpp +++ b/src/helper/geom.cpp @@ -495,13 +495,13 @@ pathv_to_linear_and_cubic_beziers( Geom::PathVector const &pathv ) /* * Converts all segments in all paths to Geom::LineSegment. There is an intermediate * stage where some may be converted to beziers. maxdisp is the maximum displacement from - * the line segment to the bezier curve. + * the line segment to the bezier curve; ** maxdisp is not used at this moment **. * * This is NOT a terribly fast method, but it should give a solution close to the one with the * fewest points. */ Geom::PathVector -pathv_to_linear( Geom::PathVector const &pathv, double maxdisp) +pathv_to_linear( Geom::PathVector const &pathv, double /*maxdisp*/) { Geom::PathVector output; Geom::PathVector tmppath = pathv_to_linear_and_cubic_beziers(pathv); @@ -536,12 +536,11 @@ pathv_to_linear( Geom::PathVector const &pathv, double maxdisp) pointlist, 0); pointlist.push_back(D); - Geom::Point r0; Geom::Point r1 = pointlist[0]; for (unsigned int i=1; i<pointlist.size();i++){ - r0 = r1; + Geom::Point prev_r1 = r1; r1 = pointlist[i]; - Geom::LineSegment ls(r0, r1); + Geom::LineSegment ls(prev_r1, r1); output.back().append(ls); } pointlist.clear(); diff --git a/src/ink-comboboxentry-action.cpp b/src/ink-comboboxentry-action.cpp index 320472347..06ccc3739 100644 --- a/src/ink-comboboxentry-action.cpp +++ b/src/ink-comboboxentry-action.cpp @@ -31,6 +31,7 @@ #include <gdk/gdkkeysyms.h> #include "ink-comboboxentry-action.h" +#include "ui/icon-names.h" // Must handle both tool and menu items! static GtkWidget* create_tool_item( GtkAction* action ); @@ -535,18 +536,9 @@ gboolean ink_comboboxentry_action_set_active_text( Ink_ComboBoxEntry_Action* act if( action->warning != NULL ) { Glib::ustring missing = check_comma_separated_text( action ); if( !missing.empty() ) { - - GtkStockItem item; - gboolean isStock = gtk_stock_lookup( GTK_STOCK_DIALOG_WARNING, &item ); - if (isStock) { - gtk_entry_set_icon_from_stock( action->entry, - GTK_ENTRY_ICON_SECONDARY, - GTK_STOCK_DIALOG_WARNING ); - } else { gtk_entry_set_icon_from_icon_name( action->entry, GTK_ENTRY_ICON_SECONDARY, - GTK_STOCK_DIALOG_WARNING ); - } + INKSCAPE_ICON("dialog-warning") ); // Can't add tooltip until icon set Glib::ustring warning = action->warning; warning += ": "; @@ -579,10 +571,7 @@ gboolean ink_comboboxentry_action_set_active_text( Ink_ComboBoxEntry_Action* act if( !set && action->info != NULL ) { gtk_entry_set_icon_from_icon_name( GTK_ENTRY(action->entry), GTK_ENTRY_ICON_SECONDARY, - GTK_STOCK_SELECT_ALL ); - gtk_entry_set_icon_from_stock( GTK_ENTRY(action->entry), - GTK_ENTRY_ICON_SECONDARY, - GTK_STOCK_SELECT_ALL ); + INKSCAPE_ICON("edit-select-all") ); gtk_entry_set_icon_tooltip_text( action->entry, GTK_ENTRY_ICON_SECONDARY, action->info ); @@ -610,9 +599,6 @@ gboolean ink_comboboxentry_action_set_active_text( Ink_ComboBoxEntry_Action* act gtk_entry_set_icon_from_icon_name( GTK_ENTRY(action->entry), GTK_ENTRY_ICON_SECONDARY, NULL ); - gtk_entry_set_icon_from_stock( GTK_ENTRY(action->entry), - GTK_ENTRY_ICON_SECONDARY, - NULL ); } } diff --git a/src/inkview.cpp b/src/inkview.cpp index e65638df6..82bd08e34 100644 --- a/src/inkview.cpp +++ b/src/inkview.cpp @@ -70,6 +70,8 @@ Inkscape::Application *inkscape; #define bind_textdomain_codeset(p,c) #endif +#include "ui/icon-names.h" + extern char *optarg; extern int optind, opterr; @@ -353,16 +355,44 @@ static GtkWidget* sp_svgview_control_show(struct SPSlideShow *ss) #endif gtk_container_add(GTK_CONTAINER(ctrlwin), t); - GtkWidget *b = gtk_button_new_from_stock(GTK_STOCK_GOTO_FIRST); + +#if GTK_CHECK_VERSION(3,10,0) + GtkWidget *b = gtk_button_new_from_icon_name(INKSCAPE_ICON("go-first"), GTK_ICON_SIZE_BUTTON); +#else + GtkWidget *b = gtk_button_new(); + GtkWidget *img = gtk_image_new_from_icon_name(INKSCAPE_ICON("go-first"), GTK_ICON_SIZE_BUTTON); + gtk_button_set_image(GTK_BUTTON(b), img); +#endif gtk_container_add(GTK_CONTAINER(t), b); + g_signal_connect(G_OBJECT(b), "clicked", (GCallback) sp_svgview_goto_first_cb, ss); - b = gtk_button_new_from_stock(GTK_STOCK_GO_BACK); +#if GTK_CHECK_VERSION(3,10,0) + b = gtk_button_new_from_icon_name(INKSCAPE_ICON("go-previous"), GTK_ICON_SIZE_BUTTON); +#else + b = gtk_button_new(); + img = gtk_image_new_from_icon_name(INKSCAPE_ICON("go-previous"), GTK_ICON_SIZE_BUTTON); + gtk_button_set_image(GTK_BUTTON(b), img); +#endif gtk_container_add(GTK_CONTAINER(t), b); + g_signal_connect(G_OBJECT(b), "clicked", (GCallback) sp_svgview_show_prev_cb, ss); - b = gtk_button_new_from_stock(GTK_STOCK_GO_FORWARD); +#if GTK_CHECK_VERSION(3,10,0) + b = gtk_button_new_from_icon_name(INKSCAPE_ICON("go-next"), GTK_ICON_SIZE_BUTTON); +#else + b = gtk_button_new(); + img = gtk_image_new_from_icon_name(INKSCAPE_ICON("go-next"), GTK_ICON_SIZE_BUTTON); + gtk_button_set_image(GTK_BUTTON(b), img); +#endif gtk_container_add(GTK_CONTAINER(t), b); + g_signal_connect(G_OBJECT(b), "clicked", (GCallback) sp_svgview_show_next_cb, ss); - b = gtk_button_new_from_stock(GTK_STOCK_GOTO_LAST); +#if GTK_CHECK_VERSION(3,10,0) + b = gtk_button_new_from_icon_name(INKSCAPE_ICON("go-last"), GTK_ICON_SIZE_BUTTON); +#else + b = gtk_button_new(); + img = gtk_image_new_from_icon_name(INKSCAPE_ICON("go-last"), GTK_ICON_SIZE_BUTTON); + gtk_button_set_image(GTK_BUTTON(b), img); +#endif gtk_container_add(GTK_CONTAINER(t), b); g_signal_connect(G_OBJECT(b), "clicked", (GCallback) sp_svgview_goto_last_cb, ss); gtk_widget_show_all(ctrlwin); diff --git a/src/interface.cpp b/src/interface.cpp index 5d4022e7b..bdbedd311 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -1392,7 +1392,7 @@ sp_ui_overwrite_file(gchar const *filename) dirName ); gtk_dialog_add_buttons( GTK_DIALOG(dialog), - GTK_STOCK_CANCEL, GTK_RESPONSE_NO, + _("_Cancel"), GTK_RESPONSE_NO, _("Replace"), GTK_RESPONSE_YES, NULL ); gtk_dialog_set_default_response( GTK_DIALOG(dialog), GTK_RESPONSE_YES ); @@ -1418,13 +1418,13 @@ sp_ui_menu_item_set_name(GtkWidget *data, Glib::ustring const &name) if (data || GTK_IS_BIN (data)) { void *child = gtk_bin_get_child (GTK_BIN (data)); //child is either - //- a GtkHBox, whose first child is a label displaying name if the menu + //- a GtkBox, whose first child is a label displaying name if the menu //item has an accel key //- a GtkLabel if the menu has no accel key if (child != NULL){ if (GTK_IS_LABEL(child)) { gtk_label_set_markup_with_mnemonic(GTK_LABEL (child), name.c_str()); - } else if (GTK_IS_HBOX(child)) { + } else if (GTK_IS_BOX(child)) { gtk_label_set_markup_with_mnemonic( GTK_LABEL (gtk_container_get_children(GTK_CONTAINER (child))->data), name.c_str()); diff --git a/src/libcroco/cr-sel-eng.c b/src/libcroco/cr-sel-eng.c index 5bc58a96c..77bf5b177 100644 --- a/src/libcroco/cr-sel-eng.c +++ b/src/libcroco/cr-sel-eng.c @@ -150,9 +150,7 @@ lang_pseudo_class_handler (CRSelEng *const a_this, for (; node; node = get_next_parent_element_node (node_iface, node)) { char *val = node_iface->getProp (node, "lang"); if (val) { - if (!strqcmp (val, - a_sel->content.pseudo->extra->stryng->str, - a_sel->content.pseudo->extra->stryng->len)) { + if (!strcasecmp(val, a_sel->content.pseudo->extra->stryng->str)) { result = TRUE; break; } diff --git a/src/livarot/ShapeRaster.cpp b/src/livarot/ShapeRaster.cpp index 4c5bdc1ac..2b35c9666 100644 --- a/src/livarot/ShapeRaster.cpp +++ b/src/livarot/ShapeRaster.cpp @@ -1241,8 +1241,8 @@ void Shape::QuickScan(float &pos, int &curP, float to, FloatLigne* line, float s if ( nbQRas > 1 ) { int curW = 0; - float lastX = 0; - float lastY = 0; + // float lastX = 0; + // float lastY = 0; int lastGuess = -1; int lastB = -1; @@ -1270,8 +1270,8 @@ void Shape::QuickScan(float &pos, int &curP, float to, FloatLigne* line, float s } else if ( curW%2 != 0 && oW%2 == 0 ) { - lastX = swrData[cb].curX; - lastY = swrData[cb].curY; + // lastX = swrData[cb].curX; + // lastY = swrData[cb].curY; lastB = cb; swrData[cb].guess = -1; diff --git a/src/live_effects/parameter/originalpath.cpp b/src/live_effects/parameter/originalpath.cpp index 6e1d9476d..6c4f2a100 100644 --- a/src/live_effects/parameter/originalpath.cpp +++ b/src/live_effects/parameter/originalpath.cpp @@ -29,6 +29,7 @@ #include "inkscape.h" #include "desktop-handles.h" #include "selection.h" +#include "ui/icon-names.h" namespace Inkscape { @@ -59,7 +60,7 @@ OriginalPathParam::param_newWidget() } { // Paste path to link button - Gtk::Widget *pIcon = Gtk::manage( sp_icon_get_icon( GTK_STOCK_PASTE, Inkscape::ICON_SIZE_BUTTON) ); + Gtk::Widget *pIcon = Gtk::manage( sp_icon_get_icon( INKSCAPE_ICON("edit-paste"), Inkscape::ICON_SIZE_BUTTON) ); Gtk::Button *pButton = Gtk::manage(new Gtk::Button()); pButton->set_relief(Gtk::RELIEF_NONE); pIcon->show(); diff --git a/src/live_effects/parameter/path.cpp b/src/live_effects/parameter/path.cpp index 77f7eabcc..cdbbef1db 100644 --- a/src/live_effects/parameter/path.cpp +++ b/src/live_effects/parameter/path.cpp @@ -46,6 +46,7 @@ #include <gtkmm/button.h> #include <gtkmm/label.h> +#include "ui/icon-names.h" namespace Inkscape { @@ -153,7 +154,7 @@ PathParam::param_newWidget() static_cast<Gtk::HBox*>(_widget)->pack_start(*pLabel, true, true); pLabel->set_tooltip_text(param_tooltip); - Gtk::Widget* pIcon = Gtk::manage( sp_icon_get_icon( "tool-node-editor", Inkscape::ICON_SIZE_BUTTON) ); + Gtk::Widget* pIcon = Gtk::manage( sp_icon_get_icon( INKSCAPE_ICON("tool-node-editor"), Inkscape::ICON_SIZE_BUTTON) ); Gtk::Button * pButton = Gtk::manage(new Gtk::Button()); pButton->set_relief(Gtk::RELIEF_NONE); pIcon->show(); @@ -163,7 +164,7 @@ PathParam::param_newWidget() static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true); pButton->set_tooltip_text(_("Edit on-canvas")); - pIcon = Gtk::manage( sp_icon_get_icon( GTK_STOCK_COPY, Inkscape::ICON_SIZE_BUTTON) ); + pIcon = Gtk::manage( sp_icon_get_icon( INKSCAPE_ICON("edit-copy"), Inkscape::ICON_SIZE_BUTTON) ); pButton = Gtk::manage(new Gtk::Button()); pButton->set_relief(Gtk::RELIEF_NONE); pIcon->show(); @@ -173,7 +174,7 @@ PathParam::param_newWidget() static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true); pButton->set_tooltip_text(_("Copy path")); - pIcon = Gtk::manage( sp_icon_get_icon( GTK_STOCK_PASTE, Inkscape::ICON_SIZE_BUTTON) ); + pIcon = Gtk::manage( sp_icon_get_icon( INKSCAPE_ICON("edit-paste"), Inkscape::ICON_SIZE_BUTTON) ); pButton = Gtk::manage(new Gtk::Button()); pButton->set_relief(Gtk::RELIEF_NONE); pIcon->show(); @@ -183,7 +184,7 @@ PathParam::param_newWidget() static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true); pButton->set_tooltip_text(_("Paste path")); - pIcon = Gtk::manage( sp_icon_get_icon( "edit-clone", Inkscape::ICON_SIZE_BUTTON) ); + pIcon = Gtk::manage( sp_icon_get_icon( INKSCAPE_ICON("edit-clone"), Inkscape::ICON_SIZE_BUTTON) ); pButton = Gtk::manage(new Gtk::Button()); pButton->set_relief(Gtk::RELIEF_NONE); pIcon->show(); diff --git a/src/preferences.cpp b/src/preferences.cpp index 0dcebbb90..b4b873dc8 100644 --- a/src/preferences.cpp +++ b/src/preferences.cpp @@ -668,6 +668,9 @@ Inkscape::XML::Node *Preferences::_getNode(Glib::ustring const &pref_key, bool c // No longer necessary, can cause problems with input devices which have a dot in the name // g_assert( pref_key.find('.') == Glib::ustring::npos ); + if (_prefs_doc == NULL){ + return NULL; + } Inkscape::XML::Node *node = _prefs_doc->root(); Inkscape::XML::Node *child = NULL; gchar **splits = g_strsplit(pref_key.c_str(), "/", 0); diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index aa8c1d222..f9649d62f 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -3072,8 +3072,9 @@ void sp_selection_unsymbol(SPDesktop *desktop) // Need to delete <symbol>; all other <use> elements that referenced <symbol> should // auto-magically reference <g>. - symbol->deleteObject(true); + symbol->setAttribute("id","todelete"); group->setAttribute("id",id.c_str()); // After we delete symbol with same id. + symbol->deleteObject(true); parent->getRepr()->appendChild(group); SPItem *group_item = static_cast<SPItem *>(sp_desktop_document(desktop)->getObjectByRepr(group)); diff --git a/src/selection.cpp b/src/selection.cpp index 7c696daf0..17b7253f2 100644 --- a/src/selection.cpp +++ b/src/selection.cpp @@ -154,6 +154,7 @@ bool Selection::includes(SPObject *obj) const { void Selection::add(SPObject *obj, bool persist_selection_context/* = false */) { g_return_if_fail(obj != NULL); g_return_if_fail(SP_IS_OBJECT(obj)); + g_return_if_fail(obj->document != NULL); if (includes(obj)) { return; diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index 7e5dda871..697b80608 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -506,6 +506,11 @@ void SPGenericEllipse::set_shape() Geom::Affine SPGenericEllipse::set_transform(Geom::Affine const &xform) { + // Allow live effects + if (hasPathEffect() && pathEffectsEnabled()) { + return xform; + } + /* Calculate ellipse start in parent coords. */ Geom::Point pos(Geom::Point(this->cx.computed, this->cy.computed) * xform); diff --git a/src/sp-filter.cpp b/src/sp-filter.cpp index 9d45c92fc..c3e7d217e 100644 --- a/src/sp-filter.cpp +++ b/src/sp-filter.cpp @@ -220,7 +220,7 @@ Inkscape::XML::Node* SPFilter::write(Inkscape::XML::Document *doc, Inkscape::XML // Original from sp-item-group.cpp if (flags & SP_OBJECT_WRITE_BUILD) { if (!repr) { - repr = doc->createElement("svg:this"); + repr = doc->createElement("svg:filter"); } GSList *l = NULL; diff --git a/src/sp-font.cpp b/src/sp-font.cpp index 4ac3278d7..62cf521d3 100644 --- a/src/sp-font.cpp +++ b/src/sp-font.cpp @@ -179,7 +179,7 @@ void SPFont::update(SPCtx *ctx, guint flags) { Inkscape::XML::Node* SPFont::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - repr = xml_doc->createElement("svg:this"); + repr = xml_doc->createElement("svg:font"); } sp_repr_set_svg_double(repr, "horiz-origin-x", this->horiz_origin_x); diff --git a/src/sp-item-transform.cpp b/src/sp-item-transform.cpp index 2d1dd8193..250713beb 100644 --- a/src/sp-item-transform.cpp +++ b/src/sp-item-transform.cpp @@ -226,6 +226,7 @@ Geom::Affine get_scale_transform_for_uniform_stroke(Geom::Rect const &bbox_visua * @param bbox_visual Current visual bounding box * @param bbox_geometric Current geometric bounding box (allows for calculating the strokewidth of each edge) * @param transform_stroke If true then the stroke will be scaled proportional to the square root of the area of the geometric bounding box + * @param preserve If true then the transform element will be preserved in XML, and evaluated after stroke is applied * @param x0 Coordinate of the target visual bounding box * @param y0 Coordinate of the target visual bounding box * @param x1 Coordinate of the target visual bounding box @@ -234,7 +235,7 @@ Geom::Affine get_scale_transform_for_uniform_stroke(Geom::Rect const &bbox_visua * not possible here because it will only allow for a positive width and height, and therefore cannot mirror * @return */ -Geom::Affine get_scale_transform_for_variable_stroke(Geom::Rect const &bbox_visual, Geom::Rect const &bbox_geom, bool transform_stroke, gdouble x0, gdouble y0, gdouble x1, gdouble y1) +Geom::Affine get_scale_transform_for_variable_stroke(Geom::Rect const &bbox_visual, Geom::Rect const &bbox_geom, bool transform_stroke, bool preserve, gdouble x0, gdouble y0, gdouble x1, gdouble y1) { Geom::Affine p2o = Geom::Translate (-bbox_visual.min()); Geom::Affine o2n = Geom::Translate (x0, y0); @@ -272,79 +273,10 @@ Geom::Affine get_scale_transform_for_variable_stroke(Geom::Rect const &bbox_visu return Geom::Affine(); } - Geom::Affine direct; - gdouble ratio_x = 1; - gdouble ratio_y = 1; - gdouble scale_x = 1; - gdouble scale_y = 1; - gdouble r1h = r0h; - gdouble r1w = r0w; - - if (fabs(w0 - r0w) < 1e-6) { // We have a vertical line at hand - direct = Geom::Scale(flip_x, flip_y * h1 / h0); - ratio_x = 1; - ratio_y = (h1 - r0h) / (h0 - r0h); - r1h = transform_stroke ? r0h * sqrt(h1/h0) : r0h; - scale_x = 1; - scale_y = (h1 - r1h)/(h0 - r0h); - } else if (fabs(h0 - r0h) < 1e-6) { // We have a horizontal line at hand - direct = Geom::Scale(flip_x * w1 / w0, flip_y); - ratio_x = (w1 - r0w) / (w0 - r0w); - ratio_y = 1; - r1w = transform_stroke ? r0w * sqrt(w1/w0) : r0w; - scale_x = (w1 - r1w)/(w0 - r0w); - scale_y = 1; - } else { // We have a true 2D object at hand - direct = Geom::Scale(flip_x * w1 / w0, flip_y* h1 / h0); // Scaling of the visual bounding box - ratio_x = (w1 - r0w) / (w0 - r0w); // Only valid when the stroke is kept constant, in which case r1 = r0 - ratio_y = (h1 - r0h) / (h0 - r0h); - /* Initial area of the geometric bounding box: A0 = (w0-r0w)*(h0-r0h) - * Desired area of the geometric bounding box: A1 = (w1-r1w)*(h1-r1h) - * This is how the stroke should scale: r1w^2 = A1/A0 * r0w^2, AND - * r1h^2 = A1/A0 * r0h^2 - * Now we have to solve this set of two equations and find r1w and r1h; this too complicated to do by hand, - * so I used wxMaxima for that (http://wxmaxima.sourceforge.net/). These lines can be copied into Maxima - * - * A1: (w1-r1w)*(h1-r1h); - * s: A1/A0; - * expr1a: r1w^2 = s*r0w^2; - * expr1b: r1h^2 = s*r0h^2; - * sol: solve([expr1a, expr1b], [r1h, r1w]); - * sol[1][1]; sol[2][1]; sol[3][1]; sol[4][1]; - * sol[1][2]; sol[2][2]; sol[3][2]; sol[4][2]; - * - * PS1: The last two lines are only needed for readability of the output, and can be omitted if desired - * PS2: A0 is known beforehand and assumed to be constant, instead of using A0 = (w0-r0w)*(h0-r0h). This reduces the - * length of the results significantly - * PS3: You'll get 8 solutions, 4 for each of the strokewidths r1w and r1h. Some experiments quickly showed which of the solutions - * lead to meaningful strokewidths - * */ - gdouble r0h2 = r0h*r0h; - gdouble r0h3 = r0h2*r0h; - gdouble r0w2 = r0w*r0w; - gdouble w12 = w1*w1; - gdouble h12 = h1*h1; - gdouble A0 = bbox_geom.area(); - gdouble A02 = A0*A0; - - gdouble operant = 4*h1*w1*A0+r0h2*w12-2*h1*r0h*r0w*w1+h12*r0w2; - if (operant >= 0) { - // Of the eight roots, I verified experimentally that these are the two we need - r1h = fabs((r0h*sqrt(operant)-r0h2*w1-h1*r0h*r0w)/(2*A0-2*r0h*r0w)); - r1w = fabs(-((h1*r0w*A0+r0h2*r0w*w1)*sqrt(operant)+(-3*h1*r0h*r0w*w1-h12*r0w2)*A0-r0h3*r0w*w12+h1*r0h2*r0w2*w1)/((r0h*A0-r0h2*r0w)*sqrt(operant)-2*h1*A02+(3*h1*r0h*r0w-r0h2*w1)*A0+r0h3*r0w*w1-h1*r0h2*r0w2)); - // If w1 < 0 then the scale will be wrong if we just assume that scale_x = (w1 - r1)/(w0 - r0); - // Therefore we here need the absolute values of w0, w1, h0, h1, and r0, as taken care of earlier - scale_x = (w1 - r1w)/(w0 - r0w); - scale_y = (h1 - r1h)/(h0 - r0h); - } else { // Can't find the roots of the quadratic equation. Likely the input parameters are invalid? - scale_x = w1 / w0; - scale_y = h1 / h0; - } - } - // Check whether the stroke is negative; i.e. the geometric bounding box is larger than the visual bounding box, which // occurs for example for clipped objects (see launchpad bug #811819) if (r0w < 0 || r0h < 0) { + Geom::Affine direct = Geom::Scale(flip_x * w1 / w0, flip_y* h1 / h0); // Scaling of the visual bounding box // How should we handle the stroke width scaling of clipped object? I don't know if we can/should handle this, // so for now we simply return the direct scaling return (p2o * direct * o2n); @@ -356,21 +288,95 @@ Geom::Affine get_scale_transform_for_variable_stroke(Geom::Rect const &bbox_visu gdouble stroke_ratio_w = fabs(r0w) < 1e-6 ? 1 : (bbox_geom[Geom::X].min() - bbox_visual[Geom::X].min())/r0w; gdouble stroke_ratio_h = fabs(r0h) < 1e-6 ? 1 : (bbox_geom[Geom::Y].min() - bbox_visual[Geom::Y].min())/r0h; - // If the stroke is not kept constant however, the scaling of the geometric bbox is more difficult to find - if (transform_stroke && r0w != 0 && r0w != Geom::infinity() && r0h != 0 && r0h != Geom::infinity()) { // Check if there's stroke, and we need to scale it - // Now we account for mirroring by flipping if needed - scale *= Geom::Scale(flip_x * scale_x, flip_y * scale_y); - // Make sure that the lower-left corner of the visual bounding box stays where it is, even though the stroke width has changed - unbudge *= Geom::Translate (-flip_x * stroke_ratio_w * (r0w * scale_x - r1w), -flip_y * stroke_ratio_h * (r0h * scale_y - r1h)); - } else { // The stroke should not be scaled, or is zero (or infinite) - if (r0w == 0 || r0w == Geom::infinity() || r0h == 0 || r0h == Geom::infinity()) { // can't calculate, because apparently strokewidth is zero or infinite - scale *= direct; - } else { - scale *= Geom::Scale(flip_x * ratio_x, flip_y * ratio_y); // Scaling of the geometric bounding box for constant stroke width - unbudge *= Geom::Translate (flip_x * stroke_ratio_w * r0w * (1 - ratio_x), flip_y * stroke_ratio_h * r0h * (1 - ratio_y)); + gdouble scale_x = 1; + gdouble scale_y = 1; + gdouble r1h = r0h; + gdouble r1w = r0w; + + if ((fabs(w0 - r0w) < 1e-6) || w1 == 0) { // We have a vertical line at hand + r1h = transform_stroke ? r0h * sqrt(h1/h0) : r0h; + scale_x = 1; + scale_y = preserve ? h1/h0 : (h1 - r1h)/(h0 - r0h); + } else if ((fabs(h0 - r0h) < 1e-6) || h1 == 0) { // We have a horizontal line at hand + r1w = transform_stroke ? r0w * sqrt(w1/w0) : r0w; + scale_x = preserve ? w1/w0 : (w1 - r1w)/(w0 - r0w); + scale_y = 1; + } else { // We have a true 2D object at hand + if (transform_stroke && !preserve) { + /* Initial area of the geometric bounding box: A0 = (w0-r0w)*(h0-r0h) + * Desired area of the geometric bounding box: A1 = (w1-r1w)*(h1-r1h) + * This is how the stroke should scale: r1w^2 = A1/A0 * r0w^2, AND + * r1h^2 = A1/A0 * r0h^2 + * Now we have to solve this set of two equations and find r1w and r1h; this too complicated to do by hand, + * so I used wxMaxima for that (http://wxmaxima.sourceforge.net/). These lines can be copied into Maxima + * + * A1: (w1-r1w)*(h1-r1h); + * s: A1/A0; + * expr1a: r1w^2 = s*r0w^2; + * expr1b: r1h^2 = s*r0h^2; + * sol: solve([expr1a, expr1b], [r1h, r1w]); + * sol[1][1]; sol[2][1]; sol[3][1]; sol[4][1]; + * sol[1][2]; sol[2][2]; sol[3][2]; sol[4][2]; + * + * PS1: The last two lines are only needed for readability of the output, and can be omitted if desired + * PS2: A0 is known beforehand and assumed to be constant, instead of using A0 = (w0-r0w)*(h0-r0h). This reduces the + * length of the results significantly + * PS3: You'll get 8 solutions, 4 for each of the strokewidths r1w and r1h. Some experiments quickly showed which of the solutions + * lead to meaningful strokewidths + * */ + gdouble r0h2 = r0h*r0h; + gdouble r0h3 = r0h2*r0h; + gdouble r0w2 = r0w*r0w; + gdouble w12 = w1*w1; + gdouble h12 = h1*h1; + gdouble A0 = bbox_geom.area(); + gdouble A02 = A0*A0; + + gdouble operant = 4*h1*w1*A0+r0h2*w12-2*h1*r0h*r0w*w1+h12*r0w2; + if (operant < 0) { + g_message("variable stroke scaling error : %d, %d, %f, %f, %f, %f, %f, %f", transform_stroke, preserve, r0w, r0h, w0, h0, w1, h1); + } else { + // Of the eight roots, I verified experimentally that these are the two we need + r1h = fabs((r0h*sqrt(operant)-r0h2*w1-h1*r0h*r0w)/(2*A0-2*r0h*r0w)); + r1w = fabs(-((h1*r0w*A0+r0h2*r0w*w1)*sqrt(operant)+(-3*h1*r0h*r0w*w1-h12*r0w2)*A0-r0h3*r0w*w12+h1*r0h2*r0w2*w1)/((r0h*A0-r0h2*r0w)*sqrt(operant)-2*h1*A02+(3*h1*r0h*r0w-r0h2*w1)*A0+r0h3*r0w*w1-h1*r0h2*r0w2)); + // If w1 < 0 then the scale will be wrong if we just assume that scale_x = (w1 - r1)/(w0 - r0); + // Therefore we here need the absolute values of w0, w1, h0, h1, and r0, as taken care of earlier + scale_x = (w1 - r1w)/(w0 - r0w); + scale_y = (h1 - r1h)/(h0 - r0h); + // Make sure that the lower-left corner of the visual bounding box stays where it is, even though the stroke width has changed + unbudge *= Geom::Translate (-flip_x * stroke_ratio_w * (r0w * scale_x - r1w), -flip_y * stroke_ratio_h * (r0h * scale_y - r1h)); + } + } else if (!transform_stroke && !preserve) { // scale the geometric bbox with constant stroke + scale_x = (w1 - r0w) / (w0 - r0w); + scale_y = (h1 - r0h) / (h0 - r0h); + unbudge *= Geom::Translate (-flip_x * stroke_ratio_w * r0w * (scale_x - 1), -flip_y * stroke_ratio_h * r0h * (scale_y - 1)); + } else if (!transform_stroke) { // 'Preserve Transforms' was chosen. + // geometric mean of r0w and r0h will be preserved + // new_r0w = r0w*sqrt(scale_x/scale_y) + // new_r0h = r0h*sqrt(scale_y/scale_x) + // scale_x = (w1 - new_r0w)/(w0 - r0w) + // scale_y = (h1 - new_r0h)/(h0 - r0h) + gdouble A = h1*(w0 - r0w); + gdouble B = (h0*r0w - w0*r0h); + gdouble C = -w1*(h0 - r0h); + gdouble Sx_div_Sy; // Sx_div_Sy = sqrt(scale_x/scale_y) + if (B*B - 4*A*C < 0) { + g_message("variable stroke scaling error : %d, %d, %f, %f, %f, %f, %f, %f", transform_stroke, preserve, r0w, r0h, w0, h0, w1, h1); + } else { + Sx_div_Sy = (-B + sqrt(B*B - 4*A*C))/2/A; + scale_x = (w1 - r0w*Sx_div_Sy)/(w0 - r0w); + scale_y = (h1 - r0h/Sx_div_Sy)/(h0 - r0h); + unbudge *= Geom::Translate (-flip_x * stroke_ratio_w * r0w * scale_x * (1.0 - sqrt(1.0/scale_x/scale_y)), -flip_y * stroke_ratio_h * r0h * scale_y * (1.0 - sqrt(1.0/scale_x/scale_y))); + } + } else { // 'Preserve Transforms' was chosen, and stroke is scaled + scale_x = w1 / w0; + scale_y = h1 / h0; } } + // Now we account for mirroring by flipping if needed + scale *= Geom::Scale(flip_x * scale_x, flip_y * scale_y); + return (p2o * scale * unbudge * o2n); } diff --git a/src/sp-item-transform.h b/src/sp-item-transform.h index a8e2bd755..230d5a3dd 100644 --- a/src/sp-item-transform.h +++ b/src/sp-item-transform.h @@ -12,7 +12,7 @@ void sp_item_skew_rel (SPItem *item, double skewX, double skewY); void sp_item_move_rel(SPItem *item, Geom::Translate const &tr); Geom::Affine get_scale_transform_for_uniform_stroke (Geom::Rect const &bbox_visual, gdouble stroke_x, gdouble stroke_y, bool transform_stroke, bool preserve, gdouble x0, gdouble y0, gdouble x1, gdouble y1); -Geom::Affine get_scale_transform_for_variable_stroke (Geom::Rect const &bbox_visual, Geom::Rect const &bbox_geom, bool transform_stroke, gdouble x0, gdouble y0, gdouble x1, gdouble y1); +Geom::Affine get_scale_transform_for_variable_stroke (Geom::Rect const &bbox_visual, Geom::Rect const &bbox_geom, bool transform_stroke, bool preserve, gdouble x0, gdouble y0, gdouble x1, gdouble y1); Geom::Rect get_visual_bbox (Geom::OptRect const &initial_geom_bbox, Geom::Affine const &abs_affine, gdouble const initial_strokewidth, bool const transform_stroke); diff --git a/src/sp-object.cpp b/src/sp-object.cpp index 4a32c9470..0e6eef6ae 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -119,7 +119,7 @@ SPObject::SPObject() _successor(NULL), _collection_policy(SPObject::COLLECT_WITH_PARENT), _label(NULL), _default_label(NULL) { - debug("id=%x, typename=%s",this, g_type_name_from_instance((GTypeInstance*)object)); + debug("id=%p, typename=%s",this, g_type_name_from_instance((GTypeInstance*)this)); //used XML Tree here. this->getRepr(); // TODO check why this call is made @@ -607,14 +607,14 @@ void SPObject::child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref) void SPObject::release() { SPObject* object = this; - debug("id=%x, typename=%s", object, g_type_name_from_instance((GTypeInstance*)object)); + debug("id=%p, typename=%s", object, g_type_name_from_instance((GTypeInstance*)object)); while (object->children) { object->detach(object->children); } } void SPObject::remove_child(Inkscape::XML::Node* child) { - debug("id=%x, typename=%s", this, g_type_name_from_instance((GTypeInstance*)this)); + debug("id=%p, typename=%s", this, g_type_name_from_instance((GTypeInstance*)this)); SPObject *ochild = this->get_child_by_repr(child); @@ -638,7 +638,7 @@ void SPObject::build(SPDocument *document, Inkscape::XML::Node *repr) { SPObject* object = this; /* Nothing specific here */ - debug("id=%x, typename=%s", object, g_type_name_from_instance((GTypeInstance*)object)); + debug("id=%p, typename=%s", object, g_type_name_from_instance((GTypeInstance*)object)); object->readAttr("xml:space"); object->readAttr("inkscape:label"); @@ -665,7 +665,7 @@ void SPObject::build(SPDocument *document, Inkscape::XML::Node *repr) { void SPObject::invoke_build(SPDocument *document, Inkscape::XML::Node *repr, unsigned int cloned) { - debug("id=%x, typename=%s", this, g_type_name_from_instance((GTypeInstance*)this)); + debug("id=%p, typename=%s", this, g_type_name_from_instance((GTypeInstance*)this)); //g_assert(object != NULL); //g_assert(SP_IS_OBJECT(object)); diff --git a/src/sp-spiral.cpp b/src/sp-spiral.cpp index ffb875f2a..9ef73d56d 100644 --- a/src/sp-spiral.cpp +++ b/src/sp-spiral.cpp @@ -440,6 +440,11 @@ Geom::Affine SPSpiral::set_transform(Geom::Affine const &xform) return xform; } + // Allow live effects + if (hasPathEffect() && pathEffectsEnabled()) { + return xform; + } + /* Calculate spiral start in parent coords. */ Geom::Point pos( Geom::Point(this->cx, this->cy) * xform ); diff --git a/src/sp-star.cpp b/src/sp-star.cpp index da10eeaa3..eac33ed7b 100644 --- a/src/sp-star.cpp +++ b/src/sp-star.cpp @@ -520,6 +520,11 @@ Geom::Affine SPStar::set_transform(Geom::Affine const &xform) return xform; } + // Allow live effects + if (hasPathEffect() && pathEffectsEnabled()) { + return xform; + } + /* Calculate star start in parent coords. */ Geom::Point pos( this->center * xform ); diff --git a/src/sp-string.cpp b/src/sp-string.cpp index be450b248..08755a5fc 100644 --- a/src/sp-string.cpp +++ b/src/sp-string.cpp @@ -108,7 +108,7 @@ void SPString::read_content() { object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } -void SPString::update(SPCtx *ctx, unsigned flags) { +void SPString::update(SPCtx * /*ctx*/, unsigned /*flags*/) { // SPObject::onUpdate(ctx, flags); // if (flags & (SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_MODIFIED_FLAG)) { diff --git a/src/sp-text.cpp b/src/sp-text.cpp index d2f433eba..ef46e890f 100644 --- a/src/sp-text.cpp +++ b/src/sp-text.cpp @@ -235,7 +235,7 @@ void SPText::modified(guint flags) { Inkscape::XML::Node *SPText::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { if (flags & SP_OBJECT_WRITE_BUILD) { if (!repr) { - repr = xml_doc->createElement("svg:this"); + repr = xml_doc->createElement("svg:text"); } GSList *l = NULL; diff --git a/src/text-chemistry.cpp b/src/text-chemistry.cpp index 532d19e02..aa2d81427 100644 --- a/src/text-chemistry.cpp +++ b/src/text-chemistry.cpp @@ -246,6 +246,7 @@ text_remove_all_kerns_recursively(SPObject *o) for (SPObject *i = o->firstChild(); i != NULL; i = i->getNext()) { text_remove_all_kerns_recursively(i); + i->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_TEXT_LAYOUT_MODIFIED_FLAG); } } diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 32f23d55f..d324d2d1b 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -57,6 +57,7 @@ #include <gtkmm/table.h> #include <2geom/transforms.h> +#include "ui/icon-names.h" using std::pair; @@ -609,10 +610,22 @@ void DocumentProperties::build_cms() label_avail->set_markup (_("<b>Available Color Profiles:</b>")); _link_btn.set_tooltip_text(_("Link Profile")); - _link_btn.set_image(*manage(Glib::wrap(gtk_image_new_from_stock ( GTK_STOCK_ADD, GTK_ICON_SIZE_SMALL_TOOLBAR ) ))); +#if GTK_CHECK_VERSION(3,10,0) + _link_btn.set_image_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR); +#else + Gtk::Image *image_link = Gtk::manage(new Gtk::Image()); + image_link->set_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR); + _link_btn.set_image(*image_link); +#endif _unlink_btn.set_tooltip_text(_("Unlink Profile")); - _unlink_btn.set_image(*manage(Glib::wrap(gtk_image_new_from_stock ( GTK_STOCK_REMOVE, GTK_ICON_SIZE_SMALL_TOOLBAR ) ))); +#if GTK_CHECK_VERSION(3,10,0) + _unlink_btn.set_image_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR); +#else + Gtk::Image *image_unlink = Gtk::manage(new Gtk::Image()); + image_unlink->set_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR); + _unlink_btn.set_image(*image_unlink); +#endif _page_cms->set_spacing(4); gint row = 0; @@ -734,11 +747,22 @@ void DocumentProperties::build_scripting() label_external->set_markup (_("<b>External script files:</b>")); _external_add_btn.set_tooltip_text(_("Add the current file name or browse for a file")); - _external_add_btn.set_image(*manage(Glib::wrap(gtk_image_new_from_stock ( GTK_STOCK_ADD, GTK_ICON_SIZE_SMALL_TOOLBAR ) ))); +#if GTK_CHECK_VERSION(3,10,0) + _external_add_btn.set_image_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR); +#else + Gtk::Image *image_ext_add = Gtk::manage(new Gtk::Image()); + image_ext_add->set_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR); + _external_add_btn.set_image(*image_ext_add); +#endif _external_remove_btn.set_tooltip_text(_("Remove")); - _external_remove_btn.set_image(*manage(Glib::wrap(gtk_image_new_from_stock ( GTK_STOCK_REMOVE, GTK_ICON_SIZE_SMALL_TOOLBAR ) ))); - +#if GTK_CHECK_VERSION(3,10,0) + _external_remove_btn.set_image_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR); +#else + Gtk::Image *image_ext_rm = Gtk::manage(new Gtk::Image()); + image_ext_rm->set_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR); + _external_remove_btn.set_image(*image_ext_rm); +#endif _page_external_scripts->set_spacing(4); gint row = 0; @@ -812,10 +836,22 @@ void DocumentProperties::build_scripting() label_embedded->set_markup (_("<b>Embedded script files:</b>")); _embed_new_btn.set_tooltip_text(_("New")); - _embed_new_btn.set_image(*manage(Glib::wrap(gtk_image_new_from_stock ( GTK_STOCK_ADD, GTK_ICON_SIZE_SMALL_TOOLBAR ) ))); +#if GTK_CHECK_VERSION(3,10,0) + _embed_new_btn.set_image_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR); +#else + Gtk::Image *image_embed_new = Gtk::manage(new Gtk::Image()); + image_embed_new->set_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR); + _embed_new_btn.set_image(*image_embed_new); +#endif _embed_remove_btn.set_tooltip_text(_("Remove")); - _embed_remove_btn.set_image(*manage(Glib::wrap(gtk_image_new_from_stock ( GTK_STOCK_REMOVE, GTK_ICON_SIZE_SMALL_TOOLBAR ) ))); +#if GTK_CHECK_VERSION(3,10,0) + _embed_remove_btn.set_image_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR); +#else + Gtk::Image *image_embed_rm = Gtk::manage(new Gtk::Image()); + image_embed_rm->set_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR); + _embed_remove_btn.set_image(*image_embed_rm); +#endif #if !WITH_GTKMM_3_0 // TODO: This has been removed from Gtkmm 3.0. Check that diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index 2cfdacb3d..e896b9840 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -1295,8 +1295,8 @@ void Export::onBrowse () fs = gtk_file_chooser_dialog_new (_("Select a filename for exporting"), (GtkWindow*)desktop->getToplevel(), GTK_FILE_CHOOSER_ACTION_SAVE, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, + _("_Cancel"), GTK_RESPONSE_CANCEL, + _("_Save"), GTK_RESPONSE_ACCEPT, NULL ); #ifdef WITH_GNOME_VFS diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index 12fdf6b7d..381810f1e 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -881,30 +881,30 @@ LayersPanel::LayersPanel() : SPDesktop* targetDesktop = getDesktop(); Gtk::Button* btn = manage( new Gtk::Button() ); - _styleButton( *btn, targetDesktop, SP_VERB_LAYER_NEW, GTK_STOCK_ADD, C_("Layers", "New") ); + _styleButton( *btn, targetDesktop, SP_VERB_LAYER_NEW, INKSCAPE_ICON("list-add"), C_("Layers", "New") ); btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_NEW) ); _buttonsSecondary.pack_start(*btn, Gtk::PACK_SHRINK); btn = manage( new Gtk::Button() ); - _styleButton( *btn, targetDesktop, SP_VERB_LAYER_TO_BOTTOM, GTK_STOCK_GOTO_BOTTOM, C_("Layers", "Bot") ); + _styleButton( *btn, targetDesktop, SP_VERB_LAYER_TO_BOTTOM, INKSCAPE_ICON("go-bottom"), C_("Layers", "Bot") ); btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_BOTTOM) ); _watchingNonBottom.push_back( btn ); _buttonsPrimary.pack_end(*btn, Gtk::PACK_SHRINK); btn = manage( new Gtk::Button() ); - _styleButton( *btn, targetDesktop, SP_VERB_LAYER_LOWER, GTK_STOCK_GO_DOWN, C_("Layers", "Dn") ); + _styleButton( *btn, targetDesktop, SP_VERB_LAYER_LOWER, INKSCAPE_ICON("go-down"), C_("Layers", "Dn") ); btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_DOWN) ); _watchingNonBottom.push_back( btn ); _buttonsPrimary.pack_end(*btn, Gtk::PACK_SHRINK); btn = manage( new Gtk::Button() ); - _styleButton( *btn, targetDesktop, SP_VERB_LAYER_RAISE, GTK_STOCK_GO_UP, C_("Layers", "Up") ); + _styleButton( *btn, targetDesktop, SP_VERB_LAYER_RAISE, INKSCAPE_ICON("go-up"), C_("Layers", "Up") ); btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_UP) ); _watchingNonTop.push_back( btn ); _buttonsPrimary.pack_end(*btn, Gtk::PACK_SHRINK); btn = manage( new Gtk::Button() ); - _styleButton( *btn, targetDesktop, SP_VERB_LAYER_TO_TOP, GTK_STOCK_GOTO_TOP, C_("Layers", "Top") ); + _styleButton( *btn, targetDesktop, SP_VERB_LAYER_TO_TOP, INKSCAPE_ICON("go-top"), C_("Layers", "Top") ); btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_TOP) ); _watchingNonTop.push_back( btn ); _buttonsPrimary.pack_end(*btn, Gtk::PACK_SHRINK); @@ -914,7 +914,7 @@ LayersPanel::LayersPanel() : // _buttonsRow.add( *btn ); btn = manage( new Gtk::Button() ); - _styleButton( *btn, targetDesktop, SP_VERB_LAYER_DELETE, GTK_STOCK_REMOVE, _("X") ); + _styleButton( *btn, targetDesktop, SP_VERB_LAYER_DELETE, INKSCAPE_ICON("list-remove"), _("X") ); btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_DELETE) ); _watching.push_back( btn ); _buttonsSecondary.pack_start(*btn, Gtk::PACK_SHRINK); @@ -944,8 +944,8 @@ LayersPanel::LayersPanel() : _popupMenu.append(*manage(new Gtk::SeparatorMenuItem())); - _watchingNonTop.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_RAISE, GTK_STOCK_GO_UP, "Up", (int)BUTTON_UP ) ); - _watchingNonBottom.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_LOWER, GTK_STOCK_GO_DOWN, "Down", (int)BUTTON_DOWN ) ); + _watchingNonTop.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_RAISE, INKSCAPE_ICON("go-up"), "Up", (int)BUTTON_UP ) ); + _watchingNonBottom.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_LOWER, INKSCAPE_ICON("go-down"), "Down", (int)BUTTON_DOWN ) ); _popupMenu.show_all_children(); } diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index 30b16cee0..b81b300e2 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -107,19 +107,43 @@ LivePathEffectEditor::LivePathEffectEditor() effectcontrol_frame.add(effectcontrol_vbox); button_add.set_tooltip_text(_("Add path effect")); - button_add.set_image(*manage(Glib::wrap(gtk_image_new_from_stock ( GTK_STOCK_ADD, GTK_ICON_SIZE_SMALL_TOOLBAR ) ))); +#if GTK_CHECK_VERSION(3,10,0) + button_add.set_image_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR); +#else + Gtk::Image *image_add = Gtk::manage(new Gtk::Image()); + image_add->set_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR); + button_add.set_image(*image_add); +#endif button_add.set_relief(Gtk::RELIEF_NONE); button_remove.set_tooltip_text(_("Delete current path effect")); - button_remove.set_image(*manage(Glib::wrap(gtk_image_new_from_stock ( GTK_STOCK_REMOVE, GTK_ICON_SIZE_SMALL_TOOLBAR ) ))); +#if GTK_CHECK_VERSION(3,10,0) + button_remove.set_image_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR); +#else + Gtk::Image *image_remove = Gtk::manage(new Gtk::Image()); + image_remove->set_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR); + button_remove.set_image(*image_remove); +#endif button_remove.set_relief(Gtk::RELIEF_NONE); button_up.set_tooltip_text(_("Raise the current path effect")); - button_up.set_image(*manage(Glib::wrap(gtk_image_new_from_stock ( GTK_STOCK_GO_UP, GTK_ICON_SIZE_SMALL_TOOLBAR ) ))); +#if GTK_CHECK_VERSION(3,10,0) + button_up.set_image_from_icon_name(INKSCAPE_ICON("go-up"), Gtk::ICON_SIZE_SMALL_TOOLBAR); +#else + Gtk::Image *image_up = Gtk::manage(new Gtk::Image()); + image_up->set_from_icon_name(INKSCAPE_ICON("go-up"), Gtk::ICON_SIZE_SMALL_TOOLBAR); + button_up.set_image(*image_up); +#endif button_up.set_relief(Gtk::RELIEF_NONE); button_down.set_tooltip_text(_("Lower the current path effect")); - button_down.set_image(*manage(Glib::wrap(gtk_image_new_from_stock ( GTK_STOCK_GO_DOWN, GTK_ICON_SIZE_SMALL_TOOLBAR ) ))); +#if GTK_CHECK_VERSION(3,10,0) + button_down.set_image_from_icon_name(INKSCAPE_ICON("go-down"), Gtk::ICON_SIZE_SMALL_TOOLBAR); +#else + Gtk::Image *image_down = Gtk::manage(new Gtk::Image()); + image_down->set_from_icon_name(INKSCAPE_ICON("go-down"), Gtk::ICON_SIZE_SMALL_TOOLBAR); + button_down.set_image(*image_down); +#endif button_down.set_relief(Gtk::RELIEF_NONE); // Add toolbar items to toolbar diff --git a/src/ui/dialog/ocaldialogs.cpp b/src/ui/dialog/ocaldialogs.cpp index 417df9a27..93fcab863 100644 --- a/src/ui/dialog/ocaldialogs.cpp +++ b/src/ui/dialog/ocaldialogs.cpp @@ -43,6 +43,7 @@ #include <glibmm/main.h> #include <glibmm/markup.h> #include <glibmm/miscutils.h> +#include "ui/icon-names.h" namespace Inkscape { @@ -578,8 +579,8 @@ SearchEntry::SearchEntry() : Gtk::Entry() signal_changed().connect(sigc::mem_fun(*this, &SearchEntry::_on_changed)); signal_icon_press().connect(sigc::mem_fun(*this, &SearchEntry::_on_icon_pressed)); - set_icon_from_stock(Gtk::Stock::FIND, Gtk::ENTRY_ICON_PRIMARY); - gtk_entry_set_icon_from_stock(gobj(), GTK_ENTRY_ICON_SECONDARY, NULL); + set_icon_from_icon_name(INKSCAPE_ICON("edit-find"), Gtk::ENTRY_ICON_PRIMARY); + gtk_entry_set_icon_from_icon_name(gobj(), GTK_ENTRY_ICON_SECONDARY, NULL); } void SearchEntry::_on_icon_pressed(Gtk::EntryIconPosition icon_position, const GdkEventButton* /*event*/) @@ -596,9 +597,9 @@ void SearchEntry::_on_icon_pressed(Gtk::EntryIconPosition icon_position, const G void SearchEntry::_on_changed() { if (get_text().empty()) { - gtk_entry_set_icon_from_stock(gobj(), GTK_ENTRY_ICON_SECONDARY, NULL); + gtk_entry_set_icon_from_icon_name(gobj(), GTK_ENTRY_ICON_SECONDARY, NULL); } else { - set_icon_from_stock(Gtk::Stock::CLEAR, Gtk::ENTRY_ICON_SECONDARY); + set_icon_from_icon_name(INKSCAPE_ICON("edit-clear"), Gtk::ENTRY_ICON_SECONDARY); } } #endif diff --git a/src/ui/dialog/pixelartdialog.cpp b/src/ui/dialog/pixelartdialog.cpp index ec2bfb822..ce5b6584d 100644 --- a/src/ui/dialog/pixelartdialog.cpp +++ b/src/ui/dialog/pixelartdialog.cpp @@ -159,7 +159,7 @@ PixelArtDialogImpl::PixelArtDialogImpl() : // Heuristics { - curvesMultiplierLabel.set_label(_("_Curves (multiplier)")); + curvesMultiplierLabel.set_label(_("_Curves (multiplier):")); curvesMultiplierLabel.set_use_underline(true); curvesMultiplierLabel.set_mnemonic_widget(curvesMultiplierSpinner); curvesMultiplierLabel.set_tooltip_text(_("Favors connections that are part of a long curve")); @@ -173,7 +173,7 @@ PixelArtDialogImpl::PixelArtDialogImpl() : curvesMultiplierHBox.pack_end(curvesMultiplierSpinner, false, false); heuristicsVBox.pack_start(curvesMultiplierHBox, false, false); - islandsWeightLabel.set_label(_("_Islands (weight)")); + islandsWeightLabel.set_label(_("_Islands (weight):")); islandsWeightLabel.set_use_underline(true); islandsWeightLabel.set_mnemonic_widget(islandsWeightSpinner); islandsWeightLabel.set_tooltip_text(_("Avoid single disconnected pixels")); @@ -188,7 +188,7 @@ PixelArtDialogImpl::PixelArtDialogImpl() : islandsWeightHBox.pack_end(islandsWeightSpinner, false, false); heuristicsVBox.pack_start(islandsWeightHBox, false, false); - sparsePixelsRadiusLabel.set_label(_("Sparse pixels (window _radius)")); + sparsePixelsRadiusLabel.set_label(_("Sparse pixels (window _radius):")); sparsePixelsRadiusLabel.set_use_underline(true); sparsePixelsRadiusLabel.set_mnemonic_widget(sparsePixelsRadiusSpinner); @@ -198,7 +198,7 @@ PixelArtDialogImpl::PixelArtDialogImpl() : .connect(sigc::mem_fun(*this, &PixelArtDialogImpl::updatePreview)); sparsePixelsRadiusSpinner.set_tooltip_text(_("The radius of the window analyzed")); - sparsePixelsMultiplierLabel.set_label(_("Sparse pixels (_multiplier)")); + sparsePixelsMultiplierLabel.set_label(_("Sparse pixels (_multiplier):")); sparsePixelsMultiplierLabel.set_use_underline(true); sparsePixelsMultiplierLabel.set_mnemonic_widget(sparsePixelsMultiplierSpinner); diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index 6427eb9cc..fb353fec1 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -271,6 +271,10 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : sigc::mem_fun(*this, &SymbolsDialog::selectionChanged)); instanceConns.push_back(selectionChangedConn); + sigc::connection documentReplacedConn = currentDesktop->connectDocumentReplaced( + sigc::mem_fun(*this, &SymbolsDialog::documentReplaced)); + instanceConns.push_back(documentReplacedConn); + get_symbols(); draw_symbols( currentDocument ); /* Defaults to current document */ @@ -378,6 +382,11 @@ void SymbolsDialog::selectionChanged(Inkscape::Selection *selection) { } } +void SymbolsDialog::documentReplaced(SPDesktop */*desktop*/, SPDocument */*document*/) +{ + rebuild(); +} + SPDocument* SymbolsDialog::selectedSymbols() { /* OK, we know symbol name... now we need to copy it to clipboard, bon chance! */ Glib::ustring symbolSetString = symbolSet->get_active_text(); diff --git a/src/ui/dialog/symbols.h b/src/ui/dialog/symbols.h index 54b1a3ab0..074af6764 100644 --- a/src/ui/dialog/symbols.h +++ b/src/ui/dialog/symbols.h @@ -72,6 +72,7 @@ private: void revertSymbol(); void defsModified(SPObject *object, guint flags); void selectionChanged(Inkscape::Selection *selection); + void documentReplaced(SPDesktop *desktop, SPDocument *document); SPDocument* selectedSymbols(); Glib::ustring selectedSymbolId(); void iconChanged(); diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp index 9124681a0..17c29c69f 100644 --- a/src/ui/dialog/text-edit.cpp +++ b/src/ui/dialog/text-edit.cpp @@ -94,10 +94,10 @@ TextEdit::TextEdit() fontsel_hbox.pack_start(*Gtk::manage(Glib::wrap(fontsel)), true, true); /* Align buttons */ - styleButton(&align_left, _("Align left"), GTK_STOCK_JUSTIFY_LEFT, NULL); - styleButton(&align_center, _("Align center"), GTK_STOCK_JUSTIFY_CENTER, &align_left); - styleButton(&align_right, _("Align right"), GTK_STOCK_JUSTIFY_RIGHT, &align_left); - styleButton(&align_justify, _("Justify (only flowed text)"), GTK_STOCK_JUSTIFY_FILL, &align_left); + styleButton(&align_left, _("Align left"), INKSCAPE_ICON("format-justify-left"), NULL); + styleButton(&align_center, _("Align center"), INKSCAPE_ICON("format-justify-center"), &align_left); + styleButton(&align_right, _("Align right"), INKSCAPE_ICON("format-justify-right"), &align_left); + styleButton(&align_justify, _("Justify (only flowed text)"), INKSCAPE_ICON("format-justify-fill"), &align_left); #if WITH_GTKMM_3_0 align_sep.set_orientation(Gtk::ORIENTATION_VERTICAL); @@ -237,7 +237,7 @@ void TextEdit::styleButton(Gtk::RadioButton *button, gchar const *tooltip, gchar { GtkWidget *icon = sp_icon_new( Inkscape::ICON_SIZE_SMALL_TOOLBAR, icon_name ); if (!GTK_IS_IMAGE(icon)) { - icon = gtk_image_new_from_stock ( icon_name, GTK_ICON_SIZE_SMALL_TOOLBAR ); + icon = gtk_image_new_from_icon_name ( icon_name, GTK_ICON_SIZE_SMALL_TOOLBAR ); } if (group_button) { diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp index ce8af3f1f..a7f0b068e 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -813,7 +813,8 @@ void Transformation::applyPageScale(Inkscape::Selection *selection) double scaleY = _scalar_scale_vertical.getValue("px"); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - int transform_stroke = prefs->getBool("/options/transform/stroke", true) ? 1 : 0; + bool transform_stroke = prefs->getBool("/options/transform/stroke", true); + bool preserve = prefs->getBool("/options/preservetransform/value", false); if (prefs->getBool("/dialogs/transformation/applyseparately")) { for (GSList const *l = selection->itemList(); l != NULL; l = l->next) { SPItem *item = SP_ITEM(l->data); @@ -835,7 +836,7 @@ void Transformation::applyPageScale(Inkscape::Selection *selection) double x1 = bbox_pref->midpoint()[Geom::X] + new_width/2; double y1 = bbox_pref->midpoint()[Geom::Y] + new_height/2; - Geom::Affine scaler = get_scale_transform_for_variable_stroke (*bbox_pref, *bbox_geom, transform_stroke, x0, y0, x1, y1); + Geom::Affine scaler = get_scale_transform_for_variable_stroke (*bbox_pref, *bbox_geom, transform_stroke, preserve, x0, y0, x1, y1); item->set_i2d_affine(item->i2dt_affine() * scaler); item->doWriteTransform(item->getRepr(), item->transform); } @@ -858,7 +859,7 @@ void Transformation::applyPageScale(Inkscape::Selection *selection) double y0 = bbox_pref->midpoint()[Geom::Y] - new_height/2; double x1 = bbox_pref->midpoint()[Geom::X] + new_width/2; double y1 = bbox_pref->midpoint()[Geom::Y] + new_height/2; - Geom::Affine scaler = get_scale_transform_for_variable_stroke (*bbox_pref, *bbox_geom, transform_stroke, x0, y0, x1, y1); + Geom::Affine scaler = get_scale_transform_for_variable_stroke (*bbox_pref, *bbox_geom, transform_stroke, preserve, x0, y0, x1, y1); sp_selection_apply_affine(selection, scaler); } diff --git a/src/ui/widget/gimpspinscale.c b/src/ui/widget/gimpspinscale.c index f9f9a3807..d99646a64 100644 --- a/src/ui/widget/gimpspinscale.c +++ b/src/ui/widget/gimpspinscale.c @@ -174,6 +174,13 @@ gimp_spin_scale_init (GimpSpinScale *scale) { GimpSpinScalePrivate *private = GET_PRIVATE (scale); + gtk_widget_add_events (GTK_WIDGET (scale), + GDK_BUTTON_PRESS_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_POINTER_MOTION_MASK | + GDK_BUTTON1_MOTION_MASK | + GDK_LEAVE_NOTIFY_MASK); + gtk_entry_set_alignment (GTK_ENTRY (scale), 1.0); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (scale), TRUE); @@ -218,26 +225,20 @@ gimp_spin_scale_set_property (GObject *object, GParamSpec *pspec) { GimpSpinScalePrivate *private = GET_PRIVATE (object); + GimpSpinScale *scale = GIMP_SPIN_SCALE (object); switch (property_id) { case PROP_LABEL: - g_free (private->label); - private->label = g_value_dup_string (value); - if (private->layout) - { - g_object_unref (private->layout); - private->layout = NULL; - } - gtk_widget_queue_resize (GTK_WIDGET (object)); + gimp_spin_scale_set_label (scale, g_value_get_string (value)); break; case PROP_FOCUS_WIDGET: - { + { /* TODO unhook prior */ - private->focusWidget = (GtkWidget*)g_value_get_pointer( value ); - } - break; + private->focusWidget = GTK_WIDGET (g_value_get_pointer (value)); + } + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -252,16 +253,17 @@ gimp_spin_scale_get_property (GObject *object, GParamSpec *pspec) { GimpSpinScalePrivate *private = GET_PRIVATE (object); + GimpSpinScale *scale = GIMP_SPIN_SCALE (object); switch (property_id) { case PROP_LABEL: - g_value_set_string (value, private->label); + g_value_set_string (value, gimp_spin_scale_get_label (scale)); break; case PROP_FOCUS_WIDGET: - g_value_set_pointer( value, private->focusWidget ); - break; + g_value_set_pointer (value, private->focusWidget); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -292,47 +294,24 @@ gimp_spin_scale_set_appearance( GtkWidget *widget, const gchar *appearance) } } +#if GTK_CHECK_VERSION(3,0,0) static void -#if WITH_GTKMM_3_0 gimp_spin_scale_get_preferred_width (GtkWidget *widget, gint *minimum_width, gint *natural_width) -#else -gimp_spin_scale_size_request (GtkWidget *widget, - GtkRequisition *requisition) -#endif { GimpSpinScalePrivate *private = GET_PRIVATE (widget); - GtkStyle *style = gtk_widget_get_style (widget); PangoContext *context = gtk_widget_get_pango_context (widget); PangoFontMetrics *metrics; -#if WITH_GTKMM_3_0 GTK_WIDGET_CLASS (parent_class)->get_preferred_width (widget, - minimum_width, - natural_width); -#else - gint height; - GTK_WIDGET_CLASS (parent_class)->size_request (widget, requisition); -#endif + minimum_width, + natural_width); - metrics = pango_context_get_metrics (context, style->font_desc, + metrics = pango_context_get_metrics (context, + pango_context_get_font_description (context), pango_context_get_language (context)); -#if WITH_GTKMM_3_0 -#else - height = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) + - pango_font_metrics_get_descent (metrics)); - - if (private->appearanceMode == APPEARANCE_COMPACT) { - requisition->height += 1; - } else { - requisition->height += height; - } - -#endif - - if (private->label) { gint char_width; @@ -343,26 +322,19 @@ gimp_spin_scale_size_request (GtkWidget *widget, digit_width = pango_font_metrics_get_approximate_digit_width (metrics); char_pixels = PANGO_PIXELS (MAX (char_width, digit_width)); -#if WITH_GTKMM_3_0 + /* ~3 chars for the ellipse */ *minimum_width += char_pixels * 3; *natural_width += char_pixels * 3; -#else - /* ~3 chars for the ellipses */ - requisition->width += char_pixels * 3; -#endif - } pango_font_metrics_unref (metrics); } -#if WITH_GTKMM_3_0 static void gimp_spin_scale_get_preferred_height (GtkWidget *widget, gint *minimum_height, gint *natural_height) { - GtkStyle *style = gtk_widget_get_style (widget); PangoContext *context = gtk_widget_get_pango_context (widget); PangoFontMetrics *metrics; //gint height; @@ -371,7 +343,8 @@ gimp_spin_scale_get_preferred_height (GtkWidget *widget, minimum_height, natural_height); - metrics = pango_context_get_metrics (context, style->font_desc, + metrics = pango_context_get_metrics (context, + pango_context_get_font_description (context), pango_context_get_language (context)); //height = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) + @@ -382,6 +355,47 @@ gimp_spin_scale_get_preferred_height (GtkWidget *widget, pango_font_metrics_unref (metrics); } +#else +static void +gimp_spin_scale_size_request (GtkWidget *widget, + GtkRequisition *requisition) +{ + GimpSpinScalePrivate *private = GET_PRIVATE (widget); + GtkStyle *style = gtk_widget_get_style (widget); + PangoContext *context = gtk_widget_get_pango_context (widget); + PangoFontMetrics *metrics; + gint height; + + GTK_WIDGET_CLASS (parent_class)->size_request (widget, requisition); + + metrics = pango_context_get_metrics (context, style->font_desc, + pango_context_get_language (context)); + + height = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) + + pango_font_metrics_get_descent (metrics)); + + if (private->appearanceMode == APPEARANCE_COMPACT) { + requisition->height += 1; + } else { + requisition->height += height; + } + + if (private->label) + { + gint char_width; + gint digit_width; + gint char_pixels; + + char_width = pango_font_metrics_get_approximate_char_width (metrics); + digit_width = pango_font_metrics_get_approximate_digit_width (metrics); + char_pixels = PANGO_PIXELS (MAX (char_width, digit_width)); + + /* ~3 chars for the ellipses */ + requisition->width += char_pixels * 3; + } + + pango_font_metrics_unref (metrics); +} #endif static void @@ -401,67 +415,81 @@ gimp_spin_scale_style_set (GtkWidget *widget, static gboolean - -#if WITH_GTKMM_3_0 - gimp_spin_scale_draw (GtkWidget *widget, cairo_t *cr) +#if GTK_CHECK_VERSION(3,0,0) + gimp_spin_scale_draw (GtkWidget *widget, + cairo_t *cr) #else - gimp_spin_scale_expose (GtkWidget *widget, GdkEventExpose *event) + gimp_spin_scale_expose (GtkWidget *widget, + GdkEventExpose *event) #endif { - GimpSpinScalePrivate *private = GET_PRIVATE (widget); - -#if WITH_GTKMM_3_0 - GtkStyleContext *style = gtk_widget_get_style_context(widget); - GtkAllocation allocation; - GdkRGBA color; + GimpSpinScalePrivate *private = GET_PRIVATE (widget); +#if GTK_CHECK_VERSION(3,0,0) + GtkStyleContext *style = gtk_widget_get_style_context(widget); + GtkAllocation allocation; + GdkRGBA color; - cairo_save (cr); - GTK_WIDGET_CLASS (parent_class)->draw (widget, cr); - cairo_restore (cr); + cairo_save (cr); + GTK_WIDGET_CLASS (parent_class)->draw (widget, cr); + cairo_restore (cr); - gtk_widget_get_allocation (widget, &allocation); + gtk_widget_get_allocation (widget, &allocation); #else - GtkStyle *style = gtk_widget_get_style (widget); - cairo_t *cr; - gint w; + GtkStyle *style = gtk_widget_get_style (widget); + cairo_t *cr; + gint w; - GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event); + GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event); - cr = gdk_cairo_create (event->window); - gdk_cairo_region (cr, event->region); - cairo_clip (cr); + cr = gdk_cairo_create (event->window); + gdk_cairo_region (cr, event->region); + cairo_clip (cr); - w = gdk_window_get_width (event->window); + w = gdk_window_get_width (event->window); #endif - cairo_set_line_width (cr, 1.0); + cairo_set_line_width (cr, 1.0); - -#if WITH_GTKMM_3_0 - if (private->label) - { - GdkRectangle text_area; - gint minimum_width; - gint natural_width; +#if GTK_CHECK_VERSION(3,0,0) + if (private->label) + { + GdkRectangle text_area; + gint minimum_width; + gint natural_width; #else - if (private->label && - gtk_widget_is_drawable (widget) && - event->window == gtk_entry_get_text_window (GTK_ENTRY (widget))) - { - GtkRequisition requisition; - GtkAllocation allocation; + if (private->label && + gtk_widget_is_drawable (widget) && + event->window == gtk_entry_get_text_window (GTK_ENTRY (widget))) + { + GtkRequisition requisition; + GtkAllocation allocation; #endif - PangoRectangle logical; gint layout_offset_x; gint layout_offset_y; +#if GTK_CHECK_VERSION(3,0,0) + GtkStateFlags state; + GdkRGBA text_color; + GdkRGBA bar_text_color; +#else + GtkStateType state; + GdkColor text_color; + GdkColor bar_text_color; + gint window_width; + gint window_height; +#endif + gdouble progress_fraction; + gint progress_x; + gint progress_y; + gint progress_width; + gint progress_height; -#if WITH_GTKMM_3_0 +#if GTK_CHECK_VERSION(3,0,0) gtk_entry_get_text_area (GTK_ENTRY (widget), &text_area); GTK_WIDGET_CLASS (parent_class)->get_preferred_width (widget, - &minimum_width, - &natural_width); + &minimum_width, + &natural_width); #else GTK_WIDGET_CLASS (parent_class)->size_request (widget, &requisition); gtk_widget_get_allocation (widget, &allocation); @@ -476,17 +504,17 @@ static gboolean pango_layout_set_width (private->layout, PANGO_SCALE * -#if WITH_GTKMM_3_0 - (allocation.width - minimum_width + 10)); +#if GTK_CHECK_VERSION(3,0,0) + (allocation.width - minimum_width)); #else - (allocation.width - requisition.width + 10)); + (allocation.width - requisition.width)); #endif pango_layout_get_pixel_extents (private->layout, NULL, &logical); gtk_entry_get_layout_offsets (GTK_ENTRY (widget), NULL, &layout_offset_y); if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) -#if WITH_GTKMM_3_0 +#if GTK_CHECK_VERSION(3,0,0) layout_offset_x = text_area.x + text_area.width - logical.width - 4; #else layout_offset_x = w - logical.width - 4; @@ -496,25 +524,97 @@ static gboolean layout_offset_x -= logical.x; -#if WITH_GTKMM_3_0 +#if GTK_CHECK_VERSION(3,0,0) + state = gtk_widget_get_state_flags (widget); + + gtk_style_context_get_color (style, state, &text_color); + + gtk_style_context_save (style); + gtk_style_context_add_class (style, GTK_STYLE_CLASS_PROGRESSBAR); + gtk_style_context_get_color (style, state, &bar_text_color); + gtk_style_context_restore (style); +#else + state = GTK_STATE_SELECTED; + if (! gtk_widget_get_sensitive (widget)) + state = GTK_STATE_INSENSITIVE; + text_color = style->text[gtk_widget_get_state (widget)]; + bar_text_color = style->fg[state]; + + window_width = gdk_window_get_width (event->window); + window_height = gdk_window_get_height (event->window); +#endif + + progress_fraction = gtk_entry_get_progress_fraction (GTK_ENTRY (widget)); + + if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) + { + progress_fraction = 1.0 - progress_fraction; + +#if GTK_CHECK_VERSION(3,0,0) + progress_x = text_area.width * progress_fraction; +#else + progress_x = window_width * progress_fraction; +#endif + progress_y = 0; +#if GTK_CHECK_VERSION(3,0,0) + progress_width = text_area.width - progress_x; + progress_height = text_area.height; +#else + progress_width = window_width - progress_x; + progress_height = window_height; +#endif + } + else + { + progress_x = 0; + progress_y = 0; +#if GTK_CHECK_VERSION(3,0,0) + progress_width = text_area.width * progress_fraction; + progress_height = text_area.height; +#else + progress_width = window_width * progress_fraction; + progress_height = window_height; +#endif + } + + cairo_save (cr); + + cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD); +#if GTK_CHECK_VERSION(3,0,0) + cairo_rectangle (cr, 0, 0, text_area.width, text_area.height); +#else + cairo_rectangle (cr, 0, 0, window_width, window_height); +#endif + cairo_rectangle (cr, progress_x, progress_y, + progress_width, progress_height); + cairo_clip (cr); + cairo_set_fill_rule (cr, CAIRO_FILL_RULE_WINDING); + +#if GTK_CHECK_VERSION(3,0,0) cairo_move_to (cr, layout_offset_x, text_area.y + layout_offset_y-3); - - gtk_style_context_get_color (style, gtk_widget_get_state_flags (widget), - &color); - - gdk_cairo_set_source_rgba (cr, &color); + gdk_cairo_set_source_rgba (cr, &text_color); #else cairo_move_to (cr, layout_offset_x, layout_offset_y-3); - - gdk_cairo_set_source_color (cr, - &style->text[gtk_widget_get_state (widget)]); + gdk_cairo_set_source_color (cr, &text_color); #endif + pango_cairo_show_layout (cr, private->layout); + cairo_restore (cr); + + cairo_rectangle (cr, progress_x, progress_y, + progress_width, progress_height); + cairo_clip (cr); +#if GTK_CHECK_VERSION(3,0,0) + cairo_move_to (cr, layout_offset_x, text_area.y + layout_offset_y-3); + gdk_cairo_set_source_rgba (cr, &bar_text_color); +#else + cairo_move_to (cr, layout_offset_x, layout_offset_y-3); + gdk_cairo_set_source_color (cr, &bar_text_color); +#endif pango_cairo_show_layout (cr, private->layout); } -#if WITH_GTKMM_3_0 -#else +#if !GTK_CHECK_VERSION(3,0,0) cairo_destroy (cr); #endif @@ -845,6 +945,9 @@ gimp_spin_scale_motion_notify (GtkWidget *widget, GdkEventMotion *event) { GimpSpinScalePrivate *private = GET_PRIVATE (widget); + + gdk_event_request_motions (event); + #if WITH_GTKMM_3_0 gint x, y; @@ -973,7 +1076,6 @@ gimp_spin_scale_value_changed (GtkSpinButton *spin_button) value = CLAMP (gtk_adjustment_get_value (adjustment), lower, upper); - gtk_entry_set_progress_fraction (GTK_ENTRY (spin_button), pow ((value - lower) / (upper - lower), 1.0 / private->gamma)); @@ -1003,6 +1105,41 @@ gimp_spin_scale_new (GtkAdjustment *adjustment, } void +gimp_spin_scale_set_label (GimpSpinScale *scale, + const gchar *label) +{ + GimpSpinScalePrivate *private; + + g_return_if_fail (GIMP_IS_SPIN_SCALE (scale)); + + private = GET_PRIVATE (scale); + + if (label == private->label) + return; + + g_free (private->label); + private->label = g_strdup (label); + + if (private->layout) + { + g_object_unref (private->layout); + private->layout = NULL; + } + + gtk_widget_queue_resize (GTK_WIDGET (scale)); + + g_object_notify (G_OBJECT (scale), "label"); +} + +const gchar * +gimp_spin_scale_get_label (GimpSpinScale *scale) +{ + g_return_val_if_fail (GIMP_IS_SPIN_SCALE (scale), NULL); + + return GET_PRIVATE (scale)->label; +} + +void gimp_spin_scale_set_scale_limits (GimpSpinScale *scale, gdouble lower, gdouble upper) @@ -1029,33 +1166,6 @@ gimp_spin_scale_set_scale_limits (GimpSpinScale *scale, } void -gimp_spin_scale_set_gamma (GimpSpinScale *scale, - gdouble gamma) -{ - GimpSpinScalePrivate *private; - - g_return_if_fail (GIMP_IS_SPIN_SCALE (scale)); - - private = GET_PRIVATE (scale); - - private->gamma = gamma; - - gimp_spin_scale_value_changed (GTK_SPIN_BUTTON (scale)); -} - -gdouble -gimp_spin_scale_get_gamma (GimpSpinScale *scale) -{ - GimpSpinScalePrivate *private; - - g_return_val_if_fail (GIMP_IS_SPIN_SCALE (scale), 1.0); - - private = GET_PRIVATE (scale); - - return private->gamma; -} - -void gimp_spin_scale_unset_scale_limits (GimpSpinScale *scale) { GimpSpinScalePrivate *private; @@ -1090,3 +1200,26 @@ gimp_spin_scale_get_scale_limits (GimpSpinScale *scale, return private->scale_limits_set; } + +void +gimp_spin_scale_set_gamma (GimpSpinScale *scale, + gdouble gamma) +{ + GimpSpinScalePrivate *private; + + g_return_if_fail (GIMP_IS_SPIN_SCALE (scale)); + + private = GET_PRIVATE (scale); + + private->gamma = gamma; + + gimp_spin_scale_value_changed (GTK_SPIN_BUTTON (scale)); +} + +gdouble +gimp_spin_scale_get_gamma (GimpSpinScale *scale) +{ + g_return_val_if_fail (GIMP_IS_SPIN_SCALE (scale), 1.0); + + return GET_PRIVATE(scale)->gamma; +} diff --git a/src/ui/widget/gimpspinscale.h b/src/ui/widget/gimpspinscale.h index ad63625ac..b42a0faf8 100644 --- a/src/ui/widget/gimpspinscale.h +++ b/src/ui/widget/gimpspinscale.h @@ -49,27 +49,33 @@ struct _GimpSpinScaleClass }; -GType gimp_spin_scale_get_type (void) G_GNUC_CONST; +GType gimp_spin_scale_get_type (void) G_GNUC_CONST; -GtkWidget * gimp_spin_scale_new (GtkAdjustment *adjustment, - const gchar *label, - gint digits); +GtkWidget * gimp_spin_scale_new (GtkAdjustment *adjustment, + const gchar *label, + gint digits); -void gimp_spin_scale_set_scale_limits (GimpSpinScale *scale, - gdouble lower, - gdouble upper); -void gimp_spin_scale_unset_scale_limits (GimpSpinScale *scale); -gboolean gimp_spin_scale_get_scale_limits (GimpSpinScale *scale, - gdouble *lower, - gdouble *upper); +void gimp_spin_scale_set_label (GimpSpinScale *scale, + const gchar *label); +const gchar * gimp_spin_scale_get_label (GimpSpinScale *scale); -void gimp_spin_scale_set_gamma (GimpSpinScale *scale, - gdouble gamma); -gdouble gimp_spin_scale_get_gamma (GimpSpinScale *scale); +void gimp_spin_scale_set_scale_limits (GimpSpinScale *scale, + gdouble lower, + gdouble upper); +void gimp_spin_scale_unset_scale_limits (GimpSpinScale *scale); +gboolean gimp_spin_scale_get_scale_limits (GimpSpinScale *scale, + gdouble *lower, + gdouble *upper); -void gimp_spin_scale_set_focuswidget( GtkWidget *scale, GtkWidget* widget ); +void gimp_spin_scale_set_gamma (GimpSpinScale *scale, + gdouble gamma); +gdouble gimp_spin_scale_get_gamma (GimpSpinScale *scale); -void gimp_spin_scale_set_appearance( GtkWidget *scale, const gchar *appearance); +void gimp_spin_scale_set_focuswidget (GtkWidget *scale, + GtkWidget *widget); + +void gimp_spin_scale_set_appearance (GtkWidget *scale, + const gchar *appearance); G_END_DECLS diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp index aa617353c..d29554c41 100644 --- a/src/ui/widget/selected-style.cpp +++ b/src/ui/widget/selected-style.cpp @@ -107,7 +107,7 @@ typedef enum { // pointers/types used need to be read-only. So until we correct the using // code, those warnings are actually desired. They say "Hey! Fix this". We // definitely don't want to hide/ignore them. --JonCruz -static GtkTargetEntry ui_drop_target_entries [] = { +static const GtkTargetEntry ui_drop_target_entries [] = { {"application/x-color", 0, APP_X_COLOR} }; diff --git a/src/verbs.cpp b/src/verbs.cpp index 329e63115..8b333383f 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -2353,19 +2353,19 @@ Verb *Verb::_base_verbs[] = { // File new FileVerb(SP_VERB_FILE_NEW, "FileNew", N_("Default"), N_("Create new document from the default template"), - GTK_STOCK_NEW ), + INKSCAPE_ICON("document-new")), new FileVerb(SP_VERB_FILE_OPEN, "FileOpen", N_("_Open..."), - N_("Open an existing document"), GTK_STOCK_OPEN ), + N_("Open an existing document"), INKSCAPE_ICON("document-open")), new FileVerb(SP_VERB_FILE_REVERT, "FileRevert", N_("Re_vert"), - N_("Revert to the last saved version of document (changes will be lost)"), GTK_STOCK_REVERT_TO_SAVED ), + N_("Revert to the last saved version of document (changes will be lost)"), INKSCAPE_ICON("document-revert")), new FileVerb(SP_VERB_FILE_SAVE, "FileSave", N_("_Save"), N_("Save document"), - GTK_STOCK_SAVE ), + INKSCAPE_ICON("document-save")), new FileVerb(SP_VERB_FILE_SAVE_AS, "FileSaveAs", N_("Save _As..."), - N_("Save document under a new name"), GTK_STOCK_SAVE_AS ), + N_("Save document under a new name"), INKSCAPE_ICON("document-save-as")), new FileVerb(SP_VERB_FILE_SAVE_A_COPY, "FileSaveACopy", N_("Save a Cop_y..."), N_("Save a copy of the document under a new name"), NULL ), new FileVerb(SP_VERB_FILE_PRINT, "FilePrint", N_("_Print..."), N_("Print document"), - GTK_STOCK_PRINT ), + INKSCAPE_ICON("document-print")), // TRANSLATORS: "Vacuum Defs" means "Clean up defs" (so as to remove unused definitions) new FileVerb(SP_VERB_FILE_VACUUM, "FileVacuum", N_("Clean _up document"), N_("Remove unused definitions (such as gradients or clipping paths) from the <defs> of the document"), INKSCAPE_ICON("document-cleanup") ), @@ -2381,22 +2381,22 @@ Verb *Verb::_base_verbs[] = { new FileVerb(SP_VERB_FILE_PREV_DESKTOP, "PrevWindow", N_("P_revious Window"), N_("Switch to the previous document window"), INKSCAPE_ICON("window-previous")), new FileVerb(SP_VERB_FILE_CLOSE_VIEW, "FileClose", N_("_Close"), - N_("Close this document window"), GTK_STOCK_CLOSE), - new FileVerb(SP_VERB_FILE_QUIT, "FileQuit", N_("_Quit"), N_("Quit Inkscape"), GTK_STOCK_QUIT), + N_("Close this document window"), INKSCAPE_ICON("window-close")), + new FileVerb(SP_VERB_FILE_QUIT, "FileQuit", N_("_Quit"), N_("Quit Inkscape"), INKSCAPE_ICON("application-exit")), new FileVerb(SP_VERB_FILE_TEMPLATES, "FileTemplates", N_("_Templates..."), N_("Create new project from template"), INKSCAPE_ICON("dialog-templates")), // Edit new EditVerb(SP_VERB_EDIT_UNDO, "EditUndo", N_("_Undo"), N_("Undo last action"), - GTK_STOCK_UNDO), + INKSCAPE_ICON("edit-undo")), new EditVerb(SP_VERB_EDIT_REDO, "EditRedo", N_("_Redo"), - N_("Do again the last undone action"), GTK_STOCK_REDO), + N_("Do again the last undone action"), INKSCAPE_ICON("edit-redo")), new EditVerb(SP_VERB_EDIT_CUT, "EditCut", N_("Cu_t"), - N_("Cut selection to clipboard"), GTK_STOCK_CUT), + N_("Cut selection to clipboard"), INKSCAPE_ICON("edit-cut")), new EditVerb(SP_VERB_EDIT_COPY, "EditCopy", N_("_Copy"), - N_("Copy selection to clipboard"), GTK_STOCK_COPY), + N_("Copy selection to clipboard"), INKSCAPE_ICON("edit-copy")), new EditVerb(SP_VERB_EDIT_PASTE, "EditPaste", N_("_Paste"), - N_("Paste objects from clipboard to mouse point, or paste text"), GTK_STOCK_PASTE), + N_("Paste objects from clipboard to mouse point, or paste text"), INKSCAPE_ICON("edit-paste")), new EditVerb(SP_VERB_EDIT_PASTE_STYLE, "EditPasteStyle", N_("Paste _Style"), N_("Apply the style of the copied object to selection"), INKSCAPE_ICON("edit-paste-style")), new EditVerb(SP_VERB_EDIT_PASTE_SIZE, "EditPasteSize", N_("Paste Si_ze"), @@ -2420,7 +2420,7 @@ Verb *Verb::_base_verbs[] = { new EditVerb(SP_VERB_EDIT_REMOVE_FILTER, "RemoveFilter", N_("_Remove Filters"), N_("Remove any filters from selected objects"), NULL), new EditVerb(SP_VERB_EDIT_DELETE, "EditDelete", N_("_Delete"), - N_("Delete selection"), GTK_STOCK_DELETE), + N_("Delete selection"), INKSCAPE_ICON("edit-delete")), new EditVerb(SP_VERB_EDIT_DUPLICATE, "EditDuplicate", N_("Duplic_ate"), N_("Duplicate selected objects"), INKSCAPE_ICON("edit-duplicate")), new EditVerb(SP_VERB_EDIT_CLONE, "EditClone", N_("Create Clo_ne"), @@ -2448,19 +2448,19 @@ Verb *Verb::_base_verbs[] = { new EditVerb(SP_VERB_EDIT_CLEAR_ALL, "EditClearAll", N_("Clea_r All"), N_("Delete all objects from document"), NULL), new EditVerb(SP_VERB_EDIT_SELECT_ALL, "EditSelectAll", N_("Select Al_l"), - N_("Select all objects or all nodes"), GTK_STOCK_SELECT_ALL), + N_("Select all objects or all nodes"), INKSCAPE_ICON("edit-select-all")), new EditVerb(SP_VERB_EDIT_SELECT_ALL_IN_ALL_LAYERS, "EditSelectAllInAllLayers", N_("Select All in All La_yers"), N_("Select all objects in all visible and unlocked layers"), INKSCAPE_ICON("edit-select-all-layers")), new EditVerb(SP_VERB_EDIT_SELECT_SAME_FILL_STROKE, "EditSelectSameFillStroke", N_("Fill _and Stroke"), - N_("Select all objects with the same fill and stroke as the selected objects"), GTK_STOCK_SELECT_ALL), + N_("Select all objects with the same fill and stroke as the selected objects"), INKSCAPE_ICON("edit-select-all")), new EditVerb(SP_VERB_EDIT_SELECT_SAME_FILL_COLOR, "EditSelectSameFillColor", N_("_Fill Color"), - N_("Select all objects with the same fill as the selected objects"), GTK_STOCK_SELECT_ALL), + N_("Select all objects with the same fill as the selected objects"), INKSCAPE_ICON("edit-select-all")), new EditVerb(SP_VERB_EDIT_SELECT_SAME_STROKE_COLOR, "EditSelectSameStrokeColor", N_("_Stroke Color"), - N_("Select all objects with the same stroke as the selected objects"), GTK_STOCK_SELECT_ALL), + N_("Select all objects with the same stroke as the selected objects"), INKSCAPE_ICON("edit-select-all")), new EditVerb(SP_VERB_EDIT_SELECT_SAME_STROKE_STYLE, "EditSelectSameStrokeStyle", N_("Stroke St_yle"), - N_("Select all objects with the same stroke style (width, dash, markers) as the selected objects"), GTK_STOCK_SELECT_ALL), + N_("Select all objects with the same stroke style (width, dash, markers) as the selected objects"), INKSCAPE_ICON("edit-select-all")), new EditVerb(SP_VERB_EDIT_SELECT_SAME_OBJECT_TYPE, "EditSelectSameObjectType", N_("_Object Type"), - N_("Select all objects with the same object type (rect, arc, text, path, bitmap etc) as the selected objects"), GTK_STOCK_SELECT_ALL), + N_("Select all objects with the same object type (rect, arc, text, path, bitmap etc) as the selected objects"), INKSCAPE_ICON("edit-select-all")), new EditVerb(SP_VERB_EDIT_INVERT, "EditInvert", N_("In_vert Selection"), N_("Invert selection (unselect what is selected and select everything else)"), INKSCAPE_ICON("edit-select-invert")), new EditVerb(SP_VERB_EDIT_INVERT_IN_ALL_LAYERS, "EditInvertInAllLayers", N_("Invert in All Layers"), @@ -2808,18 +2808,20 @@ Verb *Verb::_base_verbs[] = { // Dialogs new DialogVerb(SP_VERB_DIALOG_DISPLAY, "DialogPreferences", N_("P_references..."), - N_("Edit global Inkscape preferences"), GTK_STOCK_PREFERENCES ), + N_("Edit global Inkscape preferences"), INKSCAPE_ICON("preferences-system")), new DialogVerb(SP_VERB_DIALOG_NAMEDVIEW, "DialogDocumentProperties", N_("_Document Properties..."), - N_("Edit properties of this document (to be saved with the document)"), GTK_STOCK_PROPERTIES ), + N_("Edit properties of this document (to be saved with the document)"), INKSCAPE_ICON("document-properties")), new DialogVerb(SP_VERB_DIALOG_METADATA, "DialogMetadata", N_("Document _Metadata..."), N_("Edit document metadata (to be saved with the document)"), INKSCAPE_ICON("document-metadata") ), new DialogVerb(SP_VERB_DIALOG_FILL_STROKE, "DialogFillStroke", N_("_Fill and Stroke..."), N_("Edit objects' colors, gradients, arrowheads, and other fill and stroke properties..."), INKSCAPE_ICON("dialog-fill-and-stroke")), + // FIXME: Probably better to either use something from the icon naming spec or ship our own "select-font" icon new DialogVerb(SP_VERB_DIALOG_GLYPHS, "DialogGlyphs", N_("Gl_yphs..."), - N_("Select characters from a glyphs palette"), GTK_STOCK_SELECT_FONT), + N_("Select characters from a glyphs palette"), INKSCAPE_ICON("gtk-select-font")), + // FIXME: Probably better to either use something from the icon naming spec or ship our own "select-color" icon // TRANSLATORS: "Swatches" means: color samples new DialogVerb(SP_VERB_DIALOG_SWATCHES, "DialogSwatches", N_("S_watches..."), - N_("Select colors from a swatches palette"), GTK_STOCK_SELECT_COLOR), + N_("Select colors from a swatches palette"), INKSCAPE_ICON("gtk-select-color")), new DialogVerb(SP_VERB_DIALOG_SYMBOLS, "DialogSymbols", N_("S_ymbols..."), N_("Select symbol from a symbols palette"), INKSCAPE_ICON("symbols")), new DialogVerb(SP_VERB_DIALOG_TRANSFORM, "DialogTransform", N_("Transfor_m..."), @@ -2835,11 +2837,11 @@ Verb *Verb::_base_verbs[] = { new DialogVerb(SP_VERB_DIALOG_XML_EDITOR, "DialogXMLEditor", N_("_XML Editor..."), N_("View and edit the XML tree of the document"), INKSCAPE_ICON("dialog-xml-editor")), new DialogVerb(SP_VERB_DIALOG_FIND, "DialogFind", N_("_Find/Replace..."), - N_("Find objects in document"), GTK_STOCK_FIND ), + N_("Find objects in document"), INKSCAPE_ICON("edit-find")), new DialogVerb(SP_VERB_DIALOG_FINDREPLACE, "DialogFindReplace", N_("Find and _Replace Text..."), - N_("Find and replace text in document"), GTK_STOCK_FIND_AND_REPLACE ), + N_("Find and replace text in document"), INKSCAPE_ICON("edit-find-replace")), new DialogVerb(SP_VERB_DIALOG_SPELLCHECK, "DialogSpellcheck", N_("Check Spellin_g..."), - N_("Check spelling of text in document"), GTK_STOCK_SPELL_CHECK ), + N_("Check spelling of text in document"), INKSCAPE_ICON("tools-check-spelling")), new DialogVerb(SP_VERB_DIALOG_DEBUG, "DialogDebug", N_("_Messages..."), N_("View debug messages"), INKSCAPE_ICON("dialog-messages")), new DialogVerb(SP_VERB_DIALOG_TOGGLE, "DialogsToggle", N_("Show/Hide D_ialogs"), diff --git a/src/widgets/calligraphy-toolbar.cpp b/src/widgets/calligraphy-toolbar.cpp index 9f08d3462..73484d1b5 100644 --- a/src/widgets/calligraphy-toolbar.cpp +++ b/src/widgets/calligraphy-toolbar.cpp @@ -638,7 +638,7 @@ void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions InkAction* inky = ink_action_new( "ProfileEditAction", _("Add/Edit Profile"), _("Add or edit calligraphic profile"), - GTK_STOCK_PROPERTIES, + INKSCAPE_ICON("document-properties"), Inkscape::ICON_SIZE_DECORATION ); g_object_set( inky, "short_label", _("Edit"), NULL ); g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_ddc_edit_profile), (GObject*)holder ); diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 7e254cdcd..e5568787b 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -1123,8 +1123,8 @@ SPDesktopWidget::shutdown() gtk_widget_show(close_button); gtk_dialog_add_action_widget(GTK_DIALOG(dialog), close_button, GTK_RESPONSE_NO); - gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); - gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_SAVE, GTK_RESPONSE_YES); + gtk_dialog_add_button(GTK_DIALOG(dialog), _("_Cancel"), GTK_RESPONSE_CANCEL); + gtk_dialog_add_button(GTK_DIALOG(dialog), _("_Save"), GTK_RESPONSE_YES); gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_YES); gint response; @@ -1185,7 +1185,7 @@ SPDesktopWidget::shutdown() gtk_widget_show(save_button); gtk_dialog_add_action_widget(GTK_DIALOG(dialog), close_button, GTK_RESPONSE_NO); - gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); + gtk_dialog_add_button(GTK_DIALOG(dialog), _("_Cancel"), GTK_RESPONSE_CANCEL); gtk_dialog_add_action_widget(GTK_DIALOG(dialog), save_button, GTK_RESPONSE_YES); gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_YES); diff --git a/src/widgets/gradient-selector.cpp b/src/widgets/gradient-selector.cpp index 5ac994509..871d1ee4c 100644 --- a/src/widgets/gradient-selector.cpp +++ b/src/widgets/gradient-selector.cpp @@ -36,6 +36,7 @@ #include "paint-selector.h" #include "style.h" #include "id-clash.h" +#include "ui/icon-names.h" enum { GRABBED, @@ -196,8 +197,13 @@ static void sp_gradient_selector_init(SPGradientSelector *sel) //sel->nonsolid.push_back(hb); gtk_box_pack_start( GTK_BOX(sel), hb, FALSE, FALSE, 0 ); +#if GTK_CHECK_VERSION(3,10,0) + sel->add = gtk_button_new_from_icon_name(INKSCAPE_ICON("list-add"), GTK_ICON_SIZE_SMALL_TOOLBAR); +#else sel->add = gtk_button_new (); - gtk_button_set_image(GTK_BUTTON(sel->add), gtk_image_new_from_stock ( GTK_STOCK_ADD, GTK_ICON_SIZE_SMALL_TOOLBAR ) ); + GtkWidget *img = gtk_image_new_from_icon_name(INKSCAPE_ICON("list-add"), GTK_ICON_SIZE_SMALL_TOOLBAR); + gtk_button_set_image(GTK_BUTTON(sel->add), img); +#endif sel->nonsolid.push_back(sel->add); gtk_box_pack_start (GTK_BOX (hb), sel->add, FALSE, FALSE, 0); @@ -207,8 +213,14 @@ static void sp_gradient_selector_init(SPGradientSelector *sel) gtk_button_set_relief(GTK_BUTTON(sel->add), GTK_RELIEF_NONE); gtk_widget_set_tooltip_text( sel->add, _("Create a duplicate gradient")); + // FIXME: Probably better to either use something from the icon naming spec or ship our own "edit-gradient" icon +#if GTK_CHECK_VERSION(3,10,0) + sel->edit = gtk_button_new_from_icon_name(INKSCAPE_ICON("gtk-edit"), GTK_ICON_SIZE_SMALL_TOOLBAR); +#else sel->edit = gtk_button_new (); - gtk_button_set_image(GTK_BUTTON(sel->edit), gtk_image_new_from_stock ( GTK_STOCK_EDIT, GTK_ICON_SIZE_SMALL_TOOLBAR ) ); + img = gtk_image_new_from_icon_name(INKSCAPE_ICON("gtk-edit"), GTK_ICON_SIZE_SMALL_TOOLBAR); + gtk_button_set_image(GTK_BUTTON(sel->edit), img); +#endif sel->nonsolid.push_back(sel->edit); gtk_box_pack_start (GTK_BOX (hb), sel->edit, FALSE, FALSE, 0); @@ -217,8 +229,13 @@ static void sp_gradient_selector_init(SPGradientSelector *sel) gtk_button_set_relief(GTK_BUTTON(sel->edit), GTK_RELIEF_NONE); gtk_widget_set_tooltip_text( sel->edit, _("Edit gradient")); +#if GTK_CHECK_VERSION(3,10,0) + sel->del = gtk_button_new_from_icon_name(INKSCAPE_ICON("list-remove"), GTK_ICON_SIZE_SMALL_TOOLBAR); +#else sel->del = gtk_button_new (); - gtk_button_set_image(GTK_BUTTON(sel->del), gtk_image_new_from_stock ( GTK_STOCK_REMOVE, GTK_ICON_SIZE_SMALL_TOOLBAR ) ); + img = gtk_image_new_from_icon_name(INKSCAPE_ICON("list-remove"), GTK_ICON_SIZE_SMALL_TOOLBAR); + gtk_button_set_image(GTK_BUTTON(sel->del), img); +#endif sel->swatch_widgets.push_back(sel->del); gtk_box_pack_start (GTK_BOX (hb), sel->del, FALSE, FALSE, 0); diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp index 23e9b9c72..92ebf32a8 100644 --- a/src/widgets/icon.cpp +++ b/src/widgets/icon.cpp @@ -45,6 +45,7 @@ #include "util/units.h" #include "icon.h" +#include "ui/icon-names.h" struct IconImpl { static GtkWidget *newFull( Inkscape::IconSize lsize, gchar const *name ); @@ -171,8 +172,8 @@ sp_icon_init(SPIcon *icon) gtk_widget_set_has_window (GTK_WIDGET (icon), FALSE); icon->lsize = Inkscape::ICON_SIZE_BUTTON; icon->psize = 0; - icon->name = 0; - icon->pb = 0; + icon->name = NULL; + icon->pb = NULL; } void IconImpl::dispose(GObject *object) @@ -181,7 +182,7 @@ void IconImpl::dispose(GObject *object) clear(icon); if ( icon->name ) { g_free( icon->name ); - icon->name = 0; + icon->name = NULL; } (G_OBJECT_CLASS(sp_icon_parent_class))->dispose(object); @@ -324,7 +325,7 @@ void IconImpl::fetchPixbuf( SPIcon *icon ) GdkPixbuf* IconImpl::renderup( gchar const* name, Inkscape::IconSize lsize, unsigned psize ) { GtkIconTheme *theme = gtk_icon_theme_get_default(); - GdkPixbuf *pb = 0; + GdkPixbuf *pb = NULL; if (gtk_icon_theme_has_icon(theme, name)) { pb = gtk_icon_theme_load_icon(theme, name, psize, (GtkIconLookupFlags) 0, NULL); } @@ -451,13 +452,13 @@ void IconImpl::validateCache() std::string present; { - gchar *contents = 0; + gchar *contents = NULL; if ( g_file_get_contents(iconCacheFile.c_str(), &contents, 0, 0) ) { if ( contents ) { present = contents; } g_free(contents); - contents = 0; + contents = NULL; } } bool cacheValid = (present == wanted); @@ -784,53 +785,29 @@ GtkWidget *IconImpl::newFull( Inkscape::IconSize lsize, gchar const *name ) { static bool dump = Inkscape::Preferences::get()->getBool("/debug/icons/dumpGtk"); - GtkWidget *widget = 0; + GtkWidget *widget = NULL; gint trySize = CLAMP( static_cast<gint>(lsize), 0, static_cast<gint>(G_N_ELEMENTS(iconSizeLookup) - 1) ); if ( !sizeMapDone ) { injectCustomSize(); } GtkIconSize mappedSize = iconSizeLookup[trySize]; - GtkStockItem stock; - gboolean stockFound = gtk_stock_lookup( name, &stock ); - - GtkWidget *img = 0; if ( legacyNames.empty() ) { setupLegacyNaming(); } - if ( stockFound ) { - img = gtk_image_new_from_stock( name, mappedSize ); - } else { - img = gtk_image_new_from_icon_name( name, mappedSize ); - if ( dump ) { - g_message("gtk_image_new_from_icon_name( '%s', %d ) = %p", name, mappedSize, img); - GtkImageType thing = gtk_image_get_storage_type(GTK_IMAGE(img)); - g_message(" Type is %d %s", (int)thing, (thing == GTK_IMAGE_EMPTY ? "Empty" : "ok")); - } + GtkWidget *img = gtk_image_new_from_icon_name( name, mappedSize ); + if ( dump ) { + g_message("gtk_image_new_from_icon_name( '%s', %d ) = %p", name, mappedSize, img); + GtkImageType thing = gtk_image_get_storage_type(GTK_IMAGE(img)); + g_message(" Type is %d %s", (int)thing, (thing == GTK_IMAGE_EMPTY ? "Empty" : "ok")); } if ( img ) { GtkImageType type = gtk_image_get_storage_type( GTK_IMAGE(img) ); - if ( type == GTK_IMAGE_STOCK ) { - if ( !stockFound ) { - // It's not showing as a stock ID, so assume it will be present internally - addPreRender( mappedSize, name ); - - // Add a hook to render if set visible before prerender is done. - g_signal_connect( G_OBJECT(img), "map", G_CALLBACK(imageMapCB), GINT_TO_POINTER(static_cast<int>(mappedSize)) ); - if ( dump ) { - g_message(" connecting %p for imageMapCB for [%s] %d", img, name, (int)mappedSize); - } - } - widget = GTK_WIDGET(img); - img = 0; - if ( dump ) { - g_message( "loaded gtk '%s' %d (GTK_IMAGE_STOCK) %s on %p", name, mappedSize, (stockFound ? "STOCK" : "local"), widget ); - } - } else if ( type == GTK_IMAGE_ICON_NAME ) { + if ( type == GTK_IMAGE_ICON_NAME ) { widget = GTK_WIDGET(img); - img = 0; + img = NULL; // Add a hook to render if set visible before prerender is done. g_signal_connect( G_OBJECT(widget), "map", G_CALLBACK(imageMapNamedCB), GINT_TO_POINTER(0) ); @@ -843,10 +820,10 @@ GtkWidget *IconImpl::newFull( Inkscape::IconSize lsize, gchar const *name ) } } else { if ( dump ) { - g_message( "skipped gtk '%s' %d (not GTK_IMAGE_STOCK)", name, lsize ); + g_message( "skipped gtk '%s' %d (not GTK_IMAGE_ICON_NAME)", name, lsize ); } //g_object_unref(G_OBJECT(img)); - img = 0; + img = NULL; } } @@ -879,7 +856,7 @@ GdkPixbuf *sp_pixbuf_new( Inkscape::IconSize lsize, gchar const *name ) // PUBLIC CALL: Gtk::Widget *sp_icon_get_icon( Glib::ustring const &oid, Inkscape::IconSize size ) { - Gtk::Widget *result = 0; + Gtk::Widget *result = NULL; GtkWidget *widget = IconImpl::newFull( static_cast<Inkscape::IconSize>(Inkscape::getRegisteredIconSize(size)), oid.c_str() ); if ( widget ) { @@ -1034,7 +1011,7 @@ int IconImpl::getPhysSize(int size) // "The rendered pixbuf may not even correspond to the width/height returned by // gtk_icon_size_lookup(), because themes are free to render the pixbuf however // they like, including changing the usual size." - gchar const *id = GTK_STOCK_OPEN; + gchar const *id = INKSCAPE_ICON("document-open"); GdkPixbuf *pb = gtk_widget_render_icon( icon, id, gtkSizes[i], NULL); if (pb) { width = gdk_pixbuf_get_width(pb); @@ -1266,7 +1243,7 @@ Glib::ustring icon_cache_key(Glib::ustring const & name, unsigned psize) } GdkPixbuf *get_cached_pixbuf(Glib::ustring const &key) { - GdkPixbuf* pb = 0; + GdkPixbuf* pb = NULL; std::map<Glib::ustring, GdkPixbuf *>::iterator found = pb_cache.find(key); if ( found != pb_cache.end() ) { pb = found->second; @@ -1300,7 +1277,7 @@ guchar *IconImpl::load_svg_pixels(std::list<Glib::ustring> const &names, guchar *px = NULL; for (std::list<gchar*>::iterator i = sources.begin(); (i != sources.end()) && !px; ++i) { gchar *doc_filename = *i; - SVGDocCache *info = 0; + SVGDocCache *info = NULL; // Did we already load this doc? Glib::ustring key(doc_filename); @@ -1335,9 +1312,9 @@ guchar *IconImpl::load_svg_pixels(std::list<Glib::ustring> const &names, static void addToIconSet(GdkPixbuf* pb, gchar const* name, GtkIconSize lsize, unsigned psize) { static bool dump = Inkscape::Preferences::get()->getBool("/debug/icons/dumpGtk"); - GtkStockItem stock; - gboolean stockFound = gtk_stock_lookup( name, &stock ); - if ( !stockFound ) { + Glib::RefPtr<Gtk::IconTheme> icon_theme = Gtk::IconTheme::get_default(); + bool icon_found = icon_theme->has_icon(name); + if ( !icon_found ) { Gtk::IconTheme::add_builtin_icon( name, psize, Glib::wrap(pb) ); if (dump) { g_message(" set in a builtin for %s:%d:%d", name, lsize, psize); @@ -1347,10 +1324,8 @@ static void addToIconSet(GdkPixbuf* pb, gchar const* name, GtkIconSize lsize, un void Inkscape::queueIconPrerender( Glib::ustring const &name, Inkscape::IconSize lsize ) { - GtkStockItem stock; - gboolean stockFound = gtk_stock_lookup( name.c_str(), &stock ); gboolean themedFound = gtk_icon_theme_has_icon(gtk_icon_theme_get_default(), name.c_str()); - if (!stockFound && !themedFound ) { + if ( !themedFound ) { gint trySize = CLAMP( static_cast<gint>(lsize), 0, static_cast<gint>(G_N_ELEMENTS(iconSizeLookup) - 1) ); if ( !sizeMapDone ) { IconImpl::injectCustomSize(); @@ -1616,9 +1591,9 @@ gboolean IconImpl::prerenderTask(gpointer /*data*/) { void IconImpl::imageMapCB(GtkWidget* widget, gpointer user_data) { - gchar* id = 0; + gchar const* id = NULL; GtkIconSize size = GTK_ICON_SIZE_INVALID; - gtk_image_get_stock(GTK_IMAGE(widget), &id, &size); + gtk_image_get_icon_name(GTK_IMAGE(widget), &id, &size); GtkIconSize lsize = static_cast<GtkIconSize>(GPOINTER_TO_INT(user_data)); if ( id ) { int psize = getPhysSize(lsize); @@ -1643,33 +1618,34 @@ void IconImpl::imageMapCB(GtkWidget* widget, gpointer user_data) void IconImpl::imageMapNamedCB(GtkWidget* widget, gpointer user_data) { GtkImage* img = GTK_IMAGE(widget); - gchar const* iconName = 0; + gchar const* iconName = NULL; GtkIconSize size = GTK_ICON_SIZE_INVALID; gtk_image_get_icon_name(img, &iconName, &size); if ( iconName ) { GtkImageType type = gtk_image_get_storage_type( GTK_IMAGE(img) ); if ( type == GTK_IMAGE_ICON_NAME ) { - gint iconSize = 0; - gchar* iconName = 0; + GtkIconSize iconSize = GTK_ICON_SIZE_INVALID; + gchar const* iconName_two = NULL; { g_object_get(G_OBJECT(widget), - "icon-name", &iconName, + "icon-name", &iconName_two, "icon-size", &iconSize, NULL); } for ( std::vector<preRenderItem>::iterator it = pendingRenders.begin(); it != pendingRenders.end(); ++it ) { - if ( (it->_name == iconName) && (it->_lsize == size) ) { - int psize = getPhysSize(size); - prerenderIcon(iconName, size, psize); + /// @todo fix pointer string comparison here!!! "it->_name == iconName_two", that seems very bug-prone + if ( (it->_name == iconName_two) && (it->_lsize == iconSize) ) { + int psize = getPhysSize(iconSize); + prerenderIcon(iconName_two, iconSize, psize); pendingRenders.erase(it); break; } } - gtk_image_set_from_icon_name(img, "", (GtkIconSize)iconSize); - gtk_image_set_from_icon_name(img, iconName, (GtkIconSize)iconSize); + gtk_image_set_from_icon_name(img, "", iconSize); + gtk_image_set_from_icon_name(img, iconName_two, iconSize); } else { g_warning("UNEXPECTED TYPE of %d", (int)type); } diff --git a/src/widgets/node-toolbar.cpp b/src/widgets/node-toolbar.cpp index 6a0968424..a4ea52287 100644 --- a/src/widgets/node-toolbar.cpp +++ b/src/widgets/node-toolbar.cpp @@ -244,7 +244,7 @@ static void sp_node_toolbox_coord_changed(gpointer /*shape_editor*/, GObject *tb Unit const *unit = tracker->getActiveUnit(); NodeTool *nt = get_node_tool(); - if (!nt || nt->_selected_nodes->empty()) { + if (!nt || !(nt->_selected_nodes) ||nt->_selected_nodes->empty()) { // no path selected gtk_action_set_sensitive(xact, FALSE); gtk_action_set_sensitive(yact, FALSE); diff --git a/src/widgets/paintbucket-toolbar.cpp b/src/widgets/paintbucket-toolbar.cpp index 8c4de2b32..a9962b209 100644 --- a/src/widgets/paintbucket-toolbar.cpp +++ b/src/widgets/paintbucket-toolbar.cpp @@ -232,7 +232,7 @@ void sp_paintbucket_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions GtkAction* act = gtk_action_new( "PaintbucketResetAction", _("Defaults"), _("Reset paint bucket parameters to defaults (use Inkscape Preferences > Tools to change defaults)"), - GTK_STOCK_CLEAR ); + INKSCAPE_ICON("edit-clear")); g_signal_connect_after( G_OBJECT(act), "activate", G_CALLBACK(paintbucket_defaults), holder ); gtk_action_group_add_action( mainActions, act ); gtk_action_set_sensitive( act, TRUE ); diff --git a/src/widgets/pencil-toolbar.cpp b/src/widgets/pencil-toolbar.cpp index 3289ed181..faaa4d44e 100644 --- a/src/widgets/pencil-toolbar.cpp +++ b/src/widgets/pencil-toolbar.cpp @@ -326,7 +326,7 @@ void sp_pencil_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb InkAction* inky = ink_action_new( "PencilResetAction", _("Defaults"), _("Reset pencil parameters to defaults (use Inkscape Preferences > Tools to change defaults)"), - GTK_STOCK_CLEAR, + INKSCAPE_ICON("edit-clear"), Inkscape::ICON_SIZE_SMALL_TOOLBAR ); g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_pencil_tb_defaults), holder ); gtk_action_group_add_action( mainActions, GTK_ACTION(inky) ); diff --git a/src/widgets/select-toolbar.cpp b/src/widgets/select-toolbar.cpp index cf772320f..1cd4347d6 100644 --- a/src/widgets/select-toolbar.cpp +++ b/src/widgets/select-toolbar.cpp @@ -249,11 +249,12 @@ sp_object_layout_any_value_changed(GtkAdjustment *adj, SPWidget *spw) // FIXME: fix for GTK breakage, see comment in SelectedStyle::on_opacity_changed sp_desktop_canvas(desktop)->forceFullRedrawAfterInterruptions(0); - int transform_stroke = prefs->getBool("/options/transform/stroke", true) ? 1 : 0; + bool transform_stroke = prefs->getBool("/options/transform/stroke", true); + bool preserve = prefs->getBool("/options/preservetransform/value", false); Geom::Affine scaler; if (bbox_type == SPItem::VISUAL_BBOX) { - scaler = get_scale_transform_for_variable_stroke (*bbox_vis, *bbox_geom, transform_stroke, x0, y0, x1, y1); + scaler = get_scale_transform_for_variable_stroke (*bbox_vis, *bbox_geom, transform_stroke, preserve, x0, y0, x1, y1); } else { // 1) We could have use the newer get_scale_transform_for_variable_stroke() here, but to avoid regressions // we'll just use the old get_scale_transform_for_uniform_stroke() for now. diff --git a/src/widgets/spiral-toolbar.cpp b/src/widgets/spiral-toolbar.cpp index 7fc6d1b34..b95c1c41e 100644 --- a/src/widgets/spiral-toolbar.cpp +++ b/src/widgets/spiral-toolbar.cpp @@ -299,7 +299,7 @@ void sp_spiral_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb InkAction* inky = ink_action_new( "SpiralResetAction", _("Defaults"), _("Reset shape parameters to defaults (use Inkscape Preferences > Tools to change defaults)"), - GTK_STOCK_CLEAR, + INKSCAPE_ICON("edit-clear"), secondarySize ); g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_spl_tb_defaults), holder ); gtk_action_group_add_action( mainActions, GTK_ACTION(inky) ); diff --git a/src/widgets/star-toolbar.cpp b/src/widgets/star-toolbar.cpp index bac0271db..1691a9b25 100644 --- a/src/widgets/star-toolbar.cpp +++ b/src/widgets/star-toolbar.cpp @@ -571,7 +571,7 @@ void sp_star_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje GtkAction* act = gtk_action_new( "StarResetAction", _("Defaults"), _("Reset shape parameters to defaults (use Inkscape Preferences > Tools to change defaults)"), - GTK_STOCK_CLEAR ); + INKSCAPE_ICON("edit-clear")); g_signal_connect_after( G_OBJECT(act), "activate", G_CALLBACK(sp_stb_defaults), holder ); gtk_action_group_add_action( mainActions, act ); gtk_action_set_sensitive( act, TRUE ); diff --git a/src/widgets/text-toolbar.cpp b/src/widgets/text-toolbar.cpp index 750fa1de6..6d5d54871 100644 --- a/src/widgets/text-toolbar.cpp +++ b/src/widgets/text-toolbar.cpp @@ -1348,7 +1348,7 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje gtk_list_store_set( model, &iter, 0, _("Align left"), 1, _("Align left"), - 2, GTK_STOCK_JUSTIFY_LEFT, + 2, INKSCAPE_ICON("format-justify-left"), 3, true, -1 ); @@ -1356,7 +1356,7 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje gtk_list_store_set( model, &iter, 0, _("Align center"), 1, _("Align center"), - 2, GTK_STOCK_JUSTIFY_CENTER, + 2, INKSCAPE_ICON("format-justify-center"), 3, true, -1 ); @@ -1364,7 +1364,7 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje gtk_list_store_set( model, &iter, 0, _("Align right"), 1, _("Align right"), - 2, GTK_STOCK_JUSTIFY_RIGHT, + 2, INKSCAPE_ICON("format-justify-right"), 3, true, -1 ); @@ -1372,14 +1372,14 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje gtk_list_store_set( model, &iter, 0, _("Justify"), 1, _("Justify (only flowed text)"), - 2, GTK_STOCK_JUSTIFY_FILL, + 2, INKSCAPE_ICON("format-justify-fill"), 3, false, -1 ); EgeSelectOneAction* act = ege_select_one_action_new( "TextAlignAction", // Name _("Alignment"), // Label _("Text alignment"), // Tooltip - NULL, // StockID + NULL, // Icon name GTK_TREE_MODEL(model) ); // Model g_object_set( act, "short_label", "NotUsed", NULL ); gtk_action_group_add_action( mainActions, GTK_ACTION(act) ); @@ -1420,7 +1420,7 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje EgeSelectOneAction* act = ege_select_one_action_new( "TextOrientationAction", // Name _("Orientation"), // Label _("Text orientation"), // Tooltip - NULL, // StockID + NULL, // Icon name GTK_TREE_MODEL(model) ); // Model g_object_set( act, "short_label", "NotUsed", NULL ); |
