summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorJabiertxof <jtx@jtx>2017-01-24 14:16:06 +0000
committerJabiertxof <jtx@jtx>2017-01-24 14:16:06 +0000
commitb25ebda10578c5d697db9716e3c2b70950d33e45 (patch)
tree4635b8b3f65600cfd54b5465b906ae42165b0674 /src/ui
parentFix some bugs (diff)
parentfix nodes reverting back during editing (diff)
downloadinkscape-b25ebda10578c5d697db9716e3c2b70950d33e45.tar.gz
inkscape-b25ebda10578c5d697db9716e3c2b70950d33e45.zip
fixing to new trunk
(bzr r15142.1.38)
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/clipboard.cpp40
-rw-r--r--src/ui/dialog/aboutbox.cpp5
-rw-r--r--src/ui/dialog/align-and-distribute.cpp4
-rw-r--r--src/ui/dialog/calligraphic-profile-rename.cpp9
-rw-r--r--src/ui/dialog/clonetiler.cpp2
-rw-r--r--src/ui/dialog/dialog.cpp1
-rw-r--r--src/ui/dialog/dock-behavior.cpp3
-rw-r--r--src/ui/dialog/document-properties.cpp9
-rw-r--r--src/ui/dialog/export.cpp30
-rw-r--r--src/ui/dialog/export.h4
-rw-r--r--src/ui/dialog/filedialogimpl-gtkmm.cpp15
-rw-r--r--src/ui/dialog/filter-effects-dialog.cpp5
-rw-r--r--src/ui/dialog/floating-behavior.cpp1
-rw-r--r--src/ui/dialog/grid-arrange-tab.cpp321
-rw-r--r--src/ui/dialog/guides.cpp8
-rw-r--r--src/ui/dialog/icon-preview.cpp1
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp2
-rw-r--r--src/ui/dialog/knot-properties.cpp12
-rw-r--r--src/ui/dialog/knot-properties.h11
-rw-r--r--src/ui/dialog/layer-properties.cpp9
-rw-r--r--src/ui/dialog/livepatheffect-add.cpp6
-rw-r--r--src/ui/dialog/livepatheffect-editor.cpp7
-rw-r--r--src/ui/dialog/lpe-fillet-chamfer-properties.cpp11
-rw-r--r--src/ui/dialog/lpe-powerstroke-properties.cpp7
-rw-r--r--src/ui/dialog/objects.cpp1
-rw-r--r--src/ui/dialog/ocaldialogs.cpp10
-rw-r--r--src/ui/dialog/panel-dialog.h6
-rw-r--r--src/ui/dialog/pixelartdialog.cpp5
-rw-r--r--src/ui/dialog/svg-fonts-dialog.cpp10
-rw-r--r--src/ui/dialog/text-edit.cpp5
-rw-r--r--src/ui/dialog/text-edit.h1
-rw-r--r--src/ui/dialog/tracedialog.cpp5
-rw-r--r--src/ui/dialog/transformation.cpp5
-rw-r--r--src/ui/dialog/undo-history.cpp10
-rw-r--r--src/ui/dialog/xml-tree.cpp1
-rw-r--r--src/ui/interface.cpp6
-rw-r--r--src/ui/object-edit.cpp2
-rw-r--r--src/ui/tool/node.cpp10
-rw-r--r--src/ui/tool/path-manipulator.cpp11
-rw-r--r--src/ui/tool/transform-handle-set.cpp5
-rw-r--r--src/ui/tools/calligraphic-tool.cpp4
-rw-r--r--src/ui/tools/eraser-tool.cpp12
-rw-r--r--src/ui/tools/flood-tool.cpp10
-rw-r--r--src/ui/tools/gradient-tool.cpp18
-rw-r--r--src/ui/tools/mesh-tool.cpp412
-rw-r--r--src/ui/tools/mesh-tool.h27
-rw-r--r--src/ui/tools/node-tool.cpp34
-rw-r--r--src/ui/tools/node-tool.h9
-rw-r--r--src/ui/tools/spray-tool.cpp4
-rw-r--r--src/ui/tools/tweak-tool.cpp185
-rw-r--r--src/ui/widget/dock-item.cpp10
-rw-r--r--src/ui/widget/dock.cpp2
-rw-r--r--src/ui/widget/font-button.cpp3
-rw-r--r--src/ui/widget/font-button.h1
-rw-r--r--src/ui/widget/frame.cpp30
-rw-r--r--src/ui/widget/frame.h3
-rw-r--r--src/ui/widget/panel.cpp20
-rw-r--r--src/ui/widget/panel.h5
-rw-r--r--src/ui/widget/preferences-widget.cpp6
-rw-r--r--src/ui/widget/registered-widget.h2
-rw-r--r--src/ui/widget/selected-style.cpp51
61 files changed, 787 insertions, 677 deletions
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp
index a8e708597..c1e824c1e 100644
--- a/src/ui/clipboard.cpp
+++ b/src/ui/clipboard.cpp
@@ -643,7 +643,6 @@ Glib::ustring ClipboardManagerImpl::getShapeOrTextObjectId(SPDesktop *desktop)
return svgd;
}
-
/**
* Iterate over a list of items and copy them to the clipboard.
*/
@@ -689,25 +688,6 @@ void ClipboardManagerImpl::_copySelection(ObjectSet *selection)
else
obj_copy = _copyNode(obj, _doc, _clipnode);
- // For lpe items, copy lpe stack if applicable
- SPLPEItem *lpeitem = dynamic_cast<SPLPEItem *>(item);
- if (lpeitem) {
- Inkscape::SVGOStringStream os;
- if (lpeitem->hasPathEffect()) {
- for (PathEffectList::iterator it = lpeitem->path_effect_list->begin(); it != lpeitem->path_effect_list->end(); ++it)
- {
- LivePathEffectObject *lpeobj = (*it)->lpeobject;
- if (lpeobj) {
- Inkscape::XML::Node * lpeobjcopy = _copyNode(lpeobj->getRepr(), _doc, _defs);
- gchar *new_conflict_id = sp_object_get_unique_id(lpeobj, lpeobj->getAttribute("id"));
- lpeobjcopy->setAttribute("id", new_conflict_id);
- g_free(new_conflict_id);
- os << "#" << lpeobjcopy->attribute("id") << ";";
- }
- }
- }
- obj_copy->setAttribute("inkscape:path-effect", os.str().c_str());
- }
// copy complete inherited style
SPCSSAttr *css = sp_repr_css_attr_inherited(obj, "style");
sp_repr_css_set(obj_copy, css, "style");
@@ -739,6 +719,13 @@ void ClipboardManagerImpl::_copySelection(ObjectSet *selection)
sp_repr_css_set(_clipnode, style, "style");
sp_repr_css_attr_unref(style);
}
+ // copy path effect from the first path
+ if (object) {
+ gchar const *effect =object->getRepr()->attribute("inkscape:path-effect");
+ if (effect) {
+ _clipnode->setAttribute("inkscape:path-effect", effect);
+ }
+ }
}
Geom::OptRect size = selection->visualBounds();
@@ -841,6 +828,19 @@ void ClipboardManagerImpl::_copyUsedDefs(SPItem *item)
}
}
+ // For lpe items, copy lpe stack if applicable
+ SPLPEItem *lpeitem = dynamic_cast<SPLPEItem *>(item);
+ if (lpeitem) {
+ if (lpeitem->hasPathEffect()) {
+ for (PathEffectList::iterator it = lpeitem->path_effect_list->begin(); it != lpeitem->path_effect_list->end(); ++it){
+ LivePathEffectObject *lpeobj = (*it)->lpeobject;
+ if (lpeobj) {
+ _copyNode(lpeobj->getRepr(), _doc, _defs);
+ }
+ }
+ }
+ }
+
// recurse
for(auto& o: item->children) {
SPItem *childItem = dynamic_cast<SPItem *>(&o);
diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp
index 552500fe8..8f0545e96 100644
--- a/src/ui/dialog/aboutbox.cpp
+++ b/src/ui/dialog/aboutbox.cpp
@@ -27,7 +27,6 @@
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/aspectframe.h>
#include <gtkmm/textview.h>
-#include <gtkmm/stock.h>
#include "path-prefix.h"
#include "document.h"
@@ -39,8 +38,6 @@
#include "inkscape-version.h"
-
-
namespace Inkscape {
namespace UI {
namespace Dialog {
@@ -102,7 +99,7 @@ AboutBox::AboutBox() : Gtk::Dialog(_("About Inkscape")) {
tabs->show_all();
- add_button(Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE);
+ add_button(_("_Close"), Gtk::RESPONSE_CLOSE);
set_default_response(Gtk::RESPONSE_CLOSE);
Gtk::Label *label=new Gtk::Label();
diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp
index 236832beb..1c88fc849 100644
--- a/src/ui/dialog/align-and-distribute.cpp
+++ b/src/ui/dialog/align-and-distribute.cpp
@@ -614,7 +614,7 @@ private :
}
};
-// instantiae the private static member
+// instantiate the private static member
boost::optional<Geom::Point> ActionExchangePositions::center;
class ActionUnclump : public Action {
@@ -928,7 +928,7 @@ AlignAndDistribute::AlignAndDistribute()
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- //Instanciate the align buttons
+ //Instantiate the align buttons
addAlignButton(INKSCAPE_ICON("align-horizontal-right-to-anchor"),
_("Align right edges of objects to the left edge of the anchor"),
0, 0);
diff --git a/src/ui/dialog/calligraphic-profile-rename.cpp b/src/ui/dialog/calligraphic-profile-rename.cpp
index 50dae0fd8..36570e769 100644
--- a/src/ui/dialog/calligraphic-profile-rename.cpp
+++ b/src/ui/dialog/calligraphic-profile-rename.cpp
@@ -15,7 +15,6 @@
#include "calligraphic-profile-rename.h"
#include <glibmm/i18n.h>
-#include <gtkmm/stock.h>
#include <gtkmm/grid.h>
#include "desktop.h"
@@ -46,17 +45,17 @@ CalligraphicProfileRename::CalligraphicProfileRename() :
mainVBox->pack_start(*_layout_table, false, false, 4);
// Buttons
- _close_button.set_use_stock(true);
- _close_button.set_label(Gtk::Stock::CANCEL.id);
+ _close_button.set_use_underline();
+ _close_button.set_label(_("_Cancel"));
_close_button.set_can_default();
_delete_button.set_use_underline(true);
- _delete_button.set_label(_("Delete"));
+ _delete_button.set_label(_("_Delete"));
_delete_button.set_can_default();
_delete_button.set_visible(false);
_apply_button.set_use_underline(true);
- _apply_button.set_label(_("Save"));
+ _apply_button.set_label(_("_Save"));
_apply_button.set_can_default();
_close_button.signal_clicked()
diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp
index 8e9d3dbbf..3cdcf594a 100644
--- a/src/ui/dialog/clonetiler.cpp
+++ b/src/ui/dialog/clonetiler.cpp
@@ -936,7 +936,7 @@ CloneTiler::CloneTiler () :
auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN);
gtk_box_set_homogeneous(GTK_BOX(hb), FALSE);
gtk_box_pack_start (GTK_BOX (mainbox), hb, FALSE, FALSE, 0);
- GtkWidget *l = gtk_label_new(_(""));
+ GtkWidget *l = gtk_label_new("");
gtk_label_set_markup (GTK_LABEL(l), _("Apply to tiled clones:"));
gtk_box_pack_start (GTK_BOX (hb), l, FALSE, FALSE, 0);
}
diff --git a/src/ui/dialog/dialog.cpp b/src/ui/dialog/dialog.cpp
index d0b618c65..27a6e55d9 100644
--- a/src/ui/dialog/dialog.cpp
+++ b/src/ui/dialog/dialog.cpp
@@ -19,7 +19,6 @@
#include "dialog-manager.h"
#include <gtkmm/dialog.h>
-#include <gtkmm/stock.h>
#include <gdk/gdkkeysyms.h>
#include "inkscape.h"
diff --git a/src/ui/dialog/dock-behavior.cpp b/src/ui/dialog/dock-behavior.cpp
index ec630c08f..02955b9a8 100644
--- a/src/ui/dialog/dock-behavior.cpp
+++ b/src/ui/dialog/dock-behavior.cpp
@@ -25,9 +25,6 @@
#include "dialog.h"
#include "ui/dialog-events.h"
-#include <gtkmm/invisible.h>
-#include <gtkmm/stock.h>
-
namespace Inkscape {
namespace UI {
namespace Dialog {
diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp
index 053549b73..8593223c1 100644
--- a/src/ui/dialog/document-properties.cpp
+++ b/src/ui/dialog/document-properties.cpp
@@ -44,9 +44,6 @@
#include "color-profile.h"
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
-#include <gtkmm/stock.h>
-#include <gtkmm/imagemenuitem.h>
-
#include "ui/icon-names.h"
using std::pair;
@@ -558,7 +555,7 @@ void DocumentProperties::linked_profiles_list_button_release(GdkEventButton* eve
void DocumentProperties::cms_create_popup_menu(Gtk::Widget& parent, sigc::slot<void> rem)
{
- Gtk::MenuItem* mi = Gtk::manage(new Gtk::ImageMenuItem(Gtk::Stock::REMOVE));
+ Gtk::MenuItem* mi = Gtk::manage(new Gtk::MenuItem(_("_Remove"), true));
_EmbProfContextMenu.append(*mi);
mi->signal_activate().connect(rem);
mi->show();
@@ -568,7 +565,7 @@ void DocumentProperties::cms_create_popup_menu(Gtk::Widget& parent, sigc::slot<v
void DocumentProperties::external_create_popup_menu(Gtk::Widget& parent, sigc::slot<void> rem)
{
- Gtk::MenuItem* mi = Gtk::manage(new Gtk::ImageMenuItem(Gtk::Stock::REMOVE));
+ Gtk::MenuItem* mi = Gtk::manage(new Gtk::MenuItem(_("_Remove"), true));
_ExternalScriptsContextMenu.append(*mi);
mi->signal_activate().connect(rem);
mi->show();
@@ -577,7 +574,7 @@ void DocumentProperties::external_create_popup_menu(Gtk::Widget& parent, sigc::s
void DocumentProperties::embedded_create_popup_menu(Gtk::Widget& parent, sigc::slot<void> rem)
{
- Gtk::MenuItem* mi = Gtk::manage(new Gtk::ImageMenuItem(Gtk::Stock::REMOVE));
+ Gtk::MenuItem* mi = Gtk::manage(new Gtk::MenuItem(_("_Remove"), true));
_EmbeddedScriptsContextMenu.append(*mi);
mi->signal_activate().connect(rem);
mi->show();
diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp
index c38e798ec..b7207fd50 100644
--- a/src/ui/dialog/export.cpp
+++ b/src/ui/dialog/export.cpp
@@ -26,7 +26,6 @@
#include <gtkmm/entry.h>
#include <gtkmm/grid.h>
#include <gtkmm/spinbutton.h>
-#include <gtkmm/stock.h>
#ifdef WITH_GNOME_VFS
# include <libgnomevfs/gnome-vfs-init.h> // gnome_vfs_initialized
@@ -142,7 +141,7 @@ Export::Export (void) :
units_label(_("Units:")),
filename_box(false, 5),
browse_label(_("_Export As..."), 1),
- browse_image(Gtk::StockID(Gtk::Stock::INDEX), Gtk::ICON_SIZE_BUTTON),
+ browse_image(),
batch_box(false, 5),
batch_export(_("B_atch export all selected objects"), _("Export each selected object into its own PNG file, using export hints if any (caution, overwrites without asking!)")),
interlacing(_("Use interlacing"),_("Enables ADAM7 interlacing for PNG output. This results in slightly heavier images, but big images will look better sooner when loading the file")),
@@ -152,12 +151,12 @@ Export::Export (void) :
zlib_compression(),
pHYs_label(_("pHYs dpi")),
pHYs_sb(pHYs_adj, 1.0, 2),
+ antialiasing_label(_("Antialiasing")),
+ antialiasing_cb(),
hide_box(false, 5),
- hide_export(_("Hide a_ll except selected"), _("In the exported image, hide all objects except those that are selected")),
+ hide_export(_("Hide all except selected"), _("In the exported image, hide all objects except those that are selected")),
closeWhenDone(_("Close when complete"), _("Once the export completes, close this dialog")),
button_box(false, 3),
- export_label(_("_Export"), 1),
- export_image(Gtk::StockID(Gtk::Stock::APPLY), Gtk::ICON_SIZE_BUTTON),
_prog(),
prog_dlg(NULL),
interrupted(false),
@@ -290,6 +289,7 @@ Export::Export (void) :
filename_box.pack_start (filename_entry, true, true, 0);
Gtk::HBox* browser_im_label = new Gtk::HBox(false, 3);
+ browse_image.set_from_icon_name("folder", Gtk::ICON_SIZE_BUTTON);
browser_im_label->pack_start(browse_image);
browser_im_label->pack_start(browse_label);
browse_button.add(*browser_im_label);
@@ -318,11 +318,8 @@ Export::Export (void) :
/* Export Button row */
button_box.set_border_width(3);
- Gtk::HBox* export_image_label = new Gtk::HBox(false, 3);
- export_image_label->pack_start(export_image);
- export_image_label->pack_start(export_label);
-
- export_button.add(*export_image_label);
+ export_button.set_label(_("_Export"));
+ export_button.set_use_underline();
export_button.set_tooltip_text (_("Export the bitmap file with these settings"));
button_box.pack_start(closeWhenDone, true, true, 0 );
@@ -345,6 +342,10 @@ Export::Export (void) :
pHYs_sb.set_width_chars(7);
pHYs_sb.set_tooltip_text( _("Will force-set the physical dpi for the png file. Set this to 72 if you're planning to work on your png with Photoshop") );
zlib_compression.set_hexpand();
+ const char* const antialising_list[] = {"CAIRO_ANTIALIAS_NONE","CAIRO_ANTIALIAS_FAST","CAIRO_ANTIALIAS_GOOD (default)","CAIRO_ANTIALIAS_BEST"};
+ for(int i=0; i<4; ++i)
+ antialiasing_cb.append(antialising_list[i]);
+ antialiasing_cb.set_active_text(antialising_list[2]);
auto table = new Gtk::Grid();
gtk_container_add(GTK_CONTAINER(expander.gobj()), (GtkWidget*)(table->gobj()));
table->attach(interlacing,0,0,1,1);
@@ -354,6 +355,8 @@ Export::Export (void) :
table->attach(zlib_compression,1,2,1,1);
table->attach(pHYs_label,0,3,1,1);
table->attach(pHYs_sb,1,3,1,1);
+ table->attach(antialiasing_label,0,4,1,1);
+ table->attach(antialiasing_cb,1,4,1,1);
table->show();
/* Main dialog */
@@ -906,7 +909,7 @@ Gtk::Dialog * Export::create_progress_dialog (Glib::ustring progress_text) {
auto CA = dlg->get_content_area();
CA->pack_start(*prg, FALSE, FALSE, 4);
- Gtk::Button* btn = dlg->add_button (Gtk::Stock::CANCEL,Gtk::RESPONSE_CANCEL );
+ Gtk::Button* btn = dlg->add_button (_("_Cancel"),Gtk::RESPONSE_CANCEL );
btn->signal_clicked().connect( sigc::mem_fun(*this, &Export::onProgressCancel) );
dlg->signal_delete_event().connect( sigc::mem_fun(*this, &Export::onProgressDelete) );
@@ -991,6 +994,7 @@ void Export::onExport ()
int bitdepths[] = {1,2,4,8,16,8,16,8,16,8,16};
int color_type = colortypes[bitdepth_cb.get_active_row_number()] ;
int bit_depth = bitdepths[bitdepth_cb.get_active_row_number()] ;
+ int antialiasing = antialiasing_cb.get_active_row_number();
if (batch_export.get_active ()) {
@@ -1060,7 +1064,7 @@ void Export::onExport ()
onProgressCallback, (void*)prog_dlg,
TRUE, // overwrite without asking
hide ? selected : x,
- do_interlace, color_type, bit_depth, zlib
+ do_interlace, color_type, bit_depth, zlib, antialiasing
)) {
gchar * error = g_strdup_printf(_("Could not export to filename %s.\n"), safeFile);
@@ -1156,7 +1160,7 @@ void Export::onExport ()
onProgressCallback, (void*)prog_dlg,
FALSE,
hide ? selected : x,
- do_interlace, color_type, bit_depth, zlib
+ do_interlace, color_type, bit_depth, zlib, antialiasing
);
if (status == EXPORT_ERROR) {
gchar * safeFile = Inkscape::IO::sanitizeString(path.c_str());
diff --git a/src/ui/dialog/export.h b/src/ui/dialog/export.h
index 112f42312..1f8e87dbc 100644
--- a/src/ui/dialog/export.h
+++ b/src/ui/dialog/export.h
@@ -327,12 +327,12 @@ private:
Gtk::Label pHYs_label;
Glib::RefPtr<Gtk::Adjustment> pHYs_adj;
Gtk::SpinButton pHYs_sb;
+ Gtk::Label antialiasing_label;
+ Gtk::ComboBoxText antialiasing_cb;
/* Export Button widgets */
Gtk::HBox button_box;
Gtk::Button export_button;
- Gtk::Label export_label;
- Gtk::Image export_image;
Gtk::ProgressBar _prog;
diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp
index e8c1bf723..92e9ce834 100644
--- a/src/ui/dialog/filedialogimpl-gtkmm.cpp
+++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp
@@ -35,7 +35,6 @@
#endif
#include <gtkmm/expander.h>
-#include <gtkmm/stock.h>
#include <glibmm/convert.h>
#include <glibmm/fileutils.h>
@@ -555,7 +554,7 @@ bool SVGPreview::set(Glib::ustring &fileName, int dialogType)
Glib::ustring fileNameUtf8 = Glib::filename_to_utf8(fileName);
gchar *fName = const_cast<gchar *>(
fileNameUtf8.c_str()); // const-cast probably not necessary? (not necessary on Windows version of stat())
- struct stat info;
+ GStatBuf info;
if (g_stat(fName, &info)) // stat returns 0 upon success
{
g_warning("SVGPreview::set() : %s : %s", fName, strerror(errno));
@@ -735,8 +734,8 @@ FileOpenDialogImplGtk::FileOpenDialogImplGtk(Gtk::Window &parentWindow, const Gl
//###### Add the file types menu
createFilterMenu();
- add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
- set_default(*add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK));
+ add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL);
+ set_default(*add_button(_("_Open"), Gtk::RESPONSE_OK));
//###### Allow easy access to our examples folder
if (Inkscape::IO::file_test(INKSCAPE_EXAMPLESDIR, G_FILE_TEST_EXISTS) &&
@@ -1050,8 +1049,8 @@ FileSaveDialogImplGtk::FileSaveDialogImplGtk(Gtk::Window &parentWindow, const Gl
// if (extension == NULL)
// checkbox.set_sensitive(FALSE);
- add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
- set_default(*add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK));
+ add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL);
+ set_default(*add_button(_("_Save"), Gtk::RESPONSE_OK));
show_all_children();
}
@@ -1597,8 +1596,8 @@ FileExportDialogImpl::FileExportDialogImpl(Gtk::Window &parentWindow, const Glib
// if (extension == NULL)
// checkbox.set_sensitive(FALSE);
- add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
- set_default(*add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK));
+ add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL);
+ set_default(*add_button(_("_Save"), Gtk::RESPONSE_OK));
show_all_children();
}
diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp
index f657e1b76..80dc08ccf 100644
--- a/src/ui/dialog/filter-effects-dialog.cpp
+++ b/src/ui/dialog/filter-effects-dialog.cpp
@@ -64,7 +64,6 @@
#include "selection-chemistry.h"
#include <gtkmm/colorbutton.h>
-#include <gtkmm/stock.h>
#include <gdkmm/general.h>
#include <gtkmm/checkbutton.h>
@@ -1305,7 +1304,7 @@ static Glib::RefPtr<Gtk::Menu> create_popup_menu(Gtk::Widget& parent, sigc::slot
mi->show();
menu->append(*mi);
- mi = Gtk::manage(new Gtk::ImageMenuItem(Gtk::Stock::REMOVE));
+ mi = Gtk::manage(new Gtk::MenuItem(_("_Remove"), true));
menu->append(*mi);
mi->signal_activate().connect(rem);
mi->show();
@@ -1319,7 +1318,7 @@ FilterEffectsDialog::FilterModifier::FilterModifier(FilterEffectsDialog& d)
: _desktop(NULL),
_deskTrack(),
_dialog(d),
- _add(Gtk::Stock::NEW),
+ _add(_("_New"), true),
_observer(new Inkscape::XML::SignalObserver)
{
Gtk::ScrolledWindow* sw = Gtk::manage(new Gtk::ScrolledWindow);
diff --git a/src/ui/dialog/floating-behavior.cpp b/src/ui/dialog/floating-behavior.cpp
index fa8e11dfd..9abad3e7b 100644
--- a/src/ui/dialog/floating-behavior.cpp
+++ b/src/ui/dialog/floating-behavior.cpp
@@ -15,7 +15,6 @@
#endif
#include <gtkmm/dialog.h>
-#include <gtkmm/stock.h>
#include <glibmm/main.h>
#include "floating-behavior.h"
diff --git a/src/ui/dialog/grid-arrange-tab.cpp b/src/ui/dialog/grid-arrange-tab.cpp
index 5872393ae..9ec8d3148 100644
--- a/src/ui/dialog/grid-arrange-tab.cpp
+++ b/src/ui/dialog/grid-arrange-tab.cpp
@@ -1,25 +1,24 @@
-/*
- * A simple dialog for creating grid type arrangements of selected objects
- *
- * Authors:
- * Bob Jamison ( based off trace dialog)
- * John Cliff
- * Other dudes from The Inkscape Organization
- * Abhishek Sharma
- * Declara Denis
- *
- * Copyright (C) 2004 Bob Jamison
- * Copyright (C) 2004 John Cliff
- *
- * Released under GNU GPL, read the file 'COPYING' for more information
- */
-//#define DEBUG_GRID_ARRANGE 1
+ /*
+ * A simple dialog for creating grid type arrangements of selected objects
+ *
+ * Authors:
+ * Bob Jamison ( based off trace dialog)
+ * John Cliff
+ * Other dudes from The Inkscape Organization
+ * Abhishek Sharma
+ * Declara Denis
+ *
+ * Copyright (C) 2004 Bob Jamison
+ * Copyright (C) 2004 John Cliff
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+ //#define DEBUG_GRID_ARRANGE 1
#include "ui/dialog/grid-arrange-tab.h"
#include <glibmm/i18n.h>
#include <gtkmm/grid.h>
-#include <gtkmm/stock.h>
#include <2geom/transforms.h>
@@ -31,193 +30,193 @@
#include "document-undo.h"
#include "widgets/icon.h"
#include "desktop.h"
-//#include "sp-item-transform.h" FIXME
+ //#include "sp-item-transform.h" FIXME
#include "ui/dialog/tile.h" // for Inkscape::UI::Dialog::ArrangeDialog
-/*
- * Sort items by their x co-ordinates, taking account of y (keeps rows intact)
- *
- * <0 *elem1 goes before *elem2
- * 0 *elem1 == *elem2
- * >0 *elem1 goes after *elem2
- */
-static bool sp_compare_x_position(SPItem *first, SPItem *second)
-{
- using Geom::X;
- using Geom::Y;
+ /*
+ * Sort items by their x co-ordinates, taking account of y (keeps rows intact)
+ *
+ * <0 *elem1 goes before *elem2
+ * 0 *elem1 == *elem2
+ * >0 *elem1 goes after *elem2
+ */
+ static bool sp_compare_x_position(SPItem *first, SPItem *second)
+ {
+ using Geom::X;
+ using Geom::Y;
- Geom::OptRect a = first->documentVisualBounds();
- Geom::OptRect b = second->documentVisualBounds();
+ Geom::OptRect a = first->documentVisualBounds();
+ Geom::OptRect b = second->documentVisualBounds();
- if ( !a || !b ) {
- // FIXME?
- return false;
- }
+ if ( !a || !b ) {
+ // FIXME?
+ return false;
+ }
- double const a_height = a->dimensions()[Y];
- double const b_height = b->dimensions()[Y];
+ double const a_height = a->dimensions()[Y];
+ double const b_height = b->dimensions()[Y];
- bool a_in_b_vert = false;
- if ((a->min()[Y] < b->min()[Y] + 0.1) && (a->min()[Y] > b->min()[Y] - b_height)) {
- a_in_b_vert = true;
- } else if ((b->min()[Y] < a->min()[Y] + 0.1) && (b->min()[Y] > a->min()[Y] - a_height)) {
- a_in_b_vert = true;
- } else if (b->min()[Y] == a->min()[Y]) {
- a_in_b_vert = true;
- } else {
- a_in_b_vert = false;
- }
+ bool a_in_b_vert = false;
+ if ((a->min()[Y] < b->min()[Y] + 0.1) && (a->min()[Y] > b->min()[Y] - b_height)) {
+ a_in_b_vert = true;
+ } else if ((b->min()[Y] < a->min()[Y] + 0.1) && (b->min()[Y] > a->min()[Y] - a_height)) {
+ a_in_b_vert = true;
+ } else if (b->min()[Y] == a->min()[Y]) {
+ a_in_b_vert = true;
+ } else {
+ a_in_b_vert = false;
+ }
- if (!a_in_b_vert) { // a and b are not in the same row
- return (a->min()[Y] < b->min()[Y]);
+ if (!a_in_b_vert) { // a and b are not in the same row
+ return (a->min()[Y] < b->min()[Y]);
+ }
+ return (a->min()[X] < b->min()[X]);
}
- return (a->min()[X] < b->min()[X]);
-}
-/*
- * Sort items by their y co-ordinates.
- */
-static bool sp_compare_y_position(SPItem *first, SPItem *second)
-{
- Geom::OptRect a = first->documentVisualBounds();
- Geom::OptRect b = second->documentVisualBounds();
+ /*
+ * Sort items by their y co-ordinates.
+ */
+ static bool sp_compare_y_position(SPItem *first, SPItem *second)
+ {
+ Geom::OptRect a = first->documentVisualBounds();
+ Geom::OptRect b = second->documentVisualBounds();
- if ( !a || !b ) {
- // FIXME?
- return false;
- }
+ if ( !a || !b ) {
+ // FIXME?
+ return false;
+ }
+
+ if (a->min()[Geom::Y] > b->min()[Geom::Y]) {
+ return false;
+ }
+ if (a->min()[Geom::Y] < b->min()[Geom::Y]) {
+ return true;
+ }
- if (a->min()[Geom::Y] > b->min()[Geom::Y]) {
return false;
}
- if (a->min()[Geom::Y] < b->min()[Geom::Y]) {
- return true;
- }
-
- return false;
-}
-namespace Inkscape {
-namespace UI {
-namespace Dialog {
+ namespace Inkscape {
+ namespace UI {
+ namespace Dialog {
-//#########################################################################
-//## E V E N T S
-//#########################################################################
-
-/*
- *
- * This arranges the selection in a grid pattern.
- *
- */
+ //#########################################################################
+ //## E V E N T S
+ //#########################################################################
-void GridArrangeTab::arrange()
-{
+ /*
+ *
+ * This arranges the selection in a grid pattern.
+ *
+ */
- int cnt,row_cnt,col_cnt,a,row,col;
- double grid_left,grid_top,col_width,row_height,paddingx,paddingy,width, height, new_x, new_y;
- double total_col_width,total_row_height;
- col_width = 0;
- row_height = 0;
- total_col_width=0;
- total_row_height=0;
+ void GridArrangeTab::arrange()
+ {
- // check for correct numbers in the row- and col-spinners
- on_col_spinbutton_changed();
- on_row_spinbutton_changed();
+ int cnt,row_cnt,col_cnt,a,row,col;
+ double grid_left,grid_top,col_width,row_height,paddingx,paddingy,width, height, new_x, new_y;
+ double total_col_width,total_row_height;
+ col_width = 0;
+ row_height = 0;
+ total_col_width=0;
+ total_row_height=0;
- // set padding to manual values
- paddingx = XPadding.getValue("px");
- paddingy = YPadding.getValue("px");
+ // check for correct numbers in the row- and col-spinners
+ on_col_spinbutton_changed();
+ on_row_spinbutton_changed();
- std::vector<double> row_heights;
- std::vector<double> col_widths;
- std::vector<double> row_ys;
- std::vector<double> col_xs;
+ // set padding to manual values
+ paddingx = XPadding.getValue("px");
+ paddingy = YPadding.getValue("px");
- int NoOfCols = NoOfColsSpinner.get_value_as_int();
- int NoOfRows = NoOfRowsSpinner.get_value_as_int();
+ std::vector<double> row_heights;
+ std::vector<double> col_widths;
+ std::vector<double> row_ys;
+ std::vector<double> col_xs;
- width = 0;
- for (a=0;a<NoOfCols; a++){
- col_widths.push_back(width);
- }
+ int NoOfCols = NoOfColsSpinner.get_value_as_int();
+ int NoOfRows = NoOfRowsSpinner.get_value_as_int();
- height = 0;
- for (a=0;a<NoOfRows; a++){
- row_heights.push_back(height);
- }
- grid_left = 99999;
- grid_top = 99999;
+ width = 0;
+ for (a=0;a<NoOfCols; a++){
+ col_widths.push_back(width);
+ }
- SPDesktop *desktop = Parent->getDesktop();
- desktop->getDocument()->ensureUpToDate();
+ height = 0;
+ for (a=0;a<NoOfRows; a++){
+ row_heights.push_back(height);
+ }
+ grid_left = 99999;
+ grid_top = 99999;
- Inkscape::Selection *selection = desktop->getSelection();
- std::vector<SPItem*> items;
- if (selection) {
- items.insert(items.end(), selection->items().begin(), selection->items().end());
- }
+ SPDesktop *desktop = Parent->getDesktop();
+ desktop->getDocument()->ensureUpToDate();
- for(std::vector<SPItem*>::const_iterator i = items.begin();i!=items.end(); ++i){
- SPItem *item = *i;
- Geom::OptRect b = item->documentVisualBounds();
- if (!b) {
- continue;
+ Inkscape::Selection *selection = desktop->getSelection();
+ std::vector<SPItem*> items;
+ if (selection) {
+ items.insert(items.end(), selection->items().begin(), selection->items().end());
}
- width = b->dimensions()[Geom::X];
- height = b->dimensions()[Geom::Y];
+ for(std::vector<SPItem*>::const_iterator i = items.begin();i!=items.end(); ++i){
+ SPItem *item = *i;
+ Geom::OptRect b = item->documentVisualBounds();
+ if (!b) {
+ continue;
+ }
+
+ width = b->dimensions()[Geom::X];
+ height = b->dimensions()[Geom::Y];
- if (b->min()[Geom::X] < grid_left) {
- grid_left = b->min()[Geom::X];
- }
- if (b->min()[Geom::Y] < grid_top) {
- grid_top = b->min()[Geom::Y];
- }
- if (width > col_width) {
- col_width = width;
- }
- if (height > row_height) {
- row_height = height;
+ if (b->min()[Geom::X] < grid_left) {
+ grid_left = b->min()[Geom::X];
+ }
+ if (b->min()[Geom::Y] < grid_top) {
+ grid_top = b->min()[Geom::Y];
+ }
+ if (width > col_width) {
+ col_width = width;
+ }
+ if (height > row_height) {
+ row_height = height;
+ }
}
- }
- // require the sorting done before we can calculate row heights etc.
+ // require the sorting done before we can calculate row heights etc.
- g_return_if_fail(selection);
- std::vector<SPItem*> sorted(selection->items().begin(), selection->items().end());
- sort(sorted.begin(),sorted.end(),sp_compare_y_position);
- sort(sorted.begin(),sorted.end(),sp_compare_x_position);
+ g_return_if_fail(selection);
+ std::vector<SPItem*> sorted(selection->items().begin(), selection->items().end());
+ sort(sorted.begin(),sorted.end(),sp_compare_y_position);
+ sort(sorted.begin(),sorted.end(),sp_compare_x_position);
- // Calculate individual Row and Column sizes if necessary
+ // Calculate individual Row and Column sizes if necessary
- cnt=0;
- const std::vector<SPItem*> sizes(sorted);
- for (std::vector<SPItem*>::const_iterator i = sizes.begin();i!=sizes.end(); ++i) {
- SPItem *item = *i;
- Geom::OptRect b = item->documentVisualBounds();
- if (b) {
- width = b->dimensions()[Geom::X];
- height = b->dimensions()[Geom::Y];
- if (width > col_widths[(cnt % NoOfCols)]) {
- col_widths[(cnt % NoOfCols)] = width;
+ cnt=0;
+ const std::vector<SPItem*> sizes(sorted);
+ for (std::vector<SPItem*>::const_iterator i = sizes.begin();i!=sizes.end(); ++i) {
+ SPItem *item = *i;
+ Geom::OptRect b = item->documentVisualBounds();
+ if (b) {
+ width = b->dimensions()[Geom::X];
+ height = b->dimensions()[Geom::Y];
+ if (width > col_widths[(cnt % NoOfCols)]) {
+ col_widths[(cnt % NoOfCols)] = width;
+ }
+ if (height > row_heights[(cnt / NoOfCols)]) {
+ row_heights[(cnt / NoOfCols)] = height;
+ }
}
- if (height > row_heights[(cnt / NoOfCols)]) {
- row_heights[(cnt / NoOfCols)] = height;
- }
- }
- cnt++;
- }
+ cnt++;
+ }
- /// Make sure the top and left of the grid dont move by compensating for align values.
+ /// Make sure the top and left of the grid dont move by compensating for align values.
if (RowHeightButton.get_active()){
grid_top = grid_top - (((row_height - row_heights[0]) / 2)*(VertAlign));
}
diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp
index 8d6ca4143..9c8b14953 100644
--- a/src/ui/dialog/guides.cpp
+++ b/src/ui/dialog/guides.cpp
@@ -32,8 +32,6 @@
#include "message-context.h"
#include "verbs.h"
-#include <gtkmm/stock.h>
-
namespace Inkscape {
namespace UI {
namespace Dialogs {
@@ -158,9 +156,9 @@ void GuidelinePropertiesDialog::_response(gint response)
void GuidelinePropertiesDialog::_setup() {
set_title(_("Guideline"));
- add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
- add_button(Gtk::Stock::DELETE, -12);
- add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
+ add_button(_("_OK"), Gtk::RESPONSE_OK);
+ add_button(_("_Delete"), -12);
+ add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL);
auto mainVBox = get_content_area();
_layout_table.set_row_spacing(4);
diff --git a/src/ui/dialog/icon-preview.cpp b/src/ui/dialog/icon-preview.cpp
index a4fcc9947..19050fb1d 100644
--- a/src/ui/dialog/icon-preview.cpp
+++ b/src/ui/dialog/icon-preview.cpp
@@ -27,7 +27,6 @@
#include <gtkmm/alignment.h>
#include <gtkmm/checkbutton.h>
#include <gtkmm/frame.h>
-#include <gtkmm/stock.h>
#include "ui/widget/frame.h"
#include "desktop.h"
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp
index f9540c989..c5e8a6de6 100644
--- a/src/ui/dialog/inkscape-preferences.cpp
+++ b/src/ui/dialog/inkscape-preferences.cpp
@@ -534,7 +534,7 @@ void InkscapePreferences::initPageUI()
_("Hebrew (he)"), _("Hindi (hi)"), _("Hungarian (hu)"),
_("Icelandic (is)"), _("Indonesian (id)"), _("Irish (ga)"), _("Italian (it)"),
_("Japanese (ja)"),
- _("Kannada (kn)"), _("Kashmiri in Peso-Arabic script (ks@aran)"), _("Kashmiri in Devanagari script (ks@deva)"), _("Khmer (km)"), _("Kinyarwanda (rw)"), _("Konkani (kok)"), _("Konkani in Latin script (kok@latin)"), _("Korean (ko)"),
+ _("Kannada (kn)"), _("Kashmiri in Perso-Arabic script (ks@aran)"), _("Kashmiri in Devanagari script (ks@deva)"), _("Khmer (km)"), _("Kinyarwanda (rw)"), _("Konkani (kok)"), _("Konkani in Latin script (kok@latin)"), _("Korean (ko)"),
_("Latvian (lv)"), _("Lithuanian (lt)"),
_("Macedonian (mk)"), _("Maithili (mai)"), _("Malayalam (ml)"), _("Manipuri (mni)"), _("Manipuri in Bengali script (mni@beng)"), _("Marathi (mr)"), _("Mongolian (mn)"),
_("Nepali (ne)"), _("Norwegian Bokmål (nb)"), _("Norwegian Nynorsk (nn)"),
diff --git a/src/ui/dialog/knot-properties.cpp b/src/ui/dialog/knot-properties.cpp
index 133ed6f4c..954fe2a66 100644
--- a/src/ui/dialog/knot-properties.cpp
+++ b/src/ui/dialog/knot-properties.cpp
@@ -14,11 +14,14 @@
*/
#ifdef HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
+
#include "ui/dialog/knot-properties.h"
+
#include <boost/lexical_cast.hpp>
#include <glibmm/i18n.h>
+#include <glibmm/main.h>
#include "inkscape.h"
#include "util/units.h"
#include "desktop.h"
@@ -35,7 +38,10 @@ namespace UI {
namespace Dialogs {
KnotPropertiesDialog::KnotPropertiesDialog()
-: _desktop(NULL), _knotpoint(NULL), _position_visible(false)
+ : _desktop(NULL),
+ _knotpoint(NULL),
+ _position_visible(false),
+ _close_button(_("_Close"), true)
{
Gtk::Box *mainVBox = get_vbox();
@@ -68,8 +74,6 @@ KnotPropertiesDialog::KnotPropertiesDialog()
mainVBox->pack_start(_layout_table, true, true, 4);
// Buttons
- _close_button.set_use_stock(true);
- _close_button.set_label(Gtk::Stock::CANCEL.id);
_close_button.set_can_default();
_apply_button.set_use_underline(true);
diff --git a/src/ui/dialog/knot-properties.h b/src/ui/dialog/knot-properties.h
index fd87df03d..f6157168f 100644
--- a/src/ui/dialog/knot-properties.h
+++ b/src/ui/dialog/knot-properties.h
@@ -12,11 +12,10 @@
#ifndef INKSCAPE_DIALOG_KNOT_PROPERTIES_H
#define INKSCAPE_DIALOG_KNOT_PROPERTIES_H
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <gtkmm.h>
+#include <gtkmm/dialog.h>
+#include <gtkmm/label.h>
+#include <gtkmm/spinbutton.h>
+#include <gtkmm/table.h>
#include <2geom/point.h>
#include "knot.h"
#include "ui/tools/measure-tool.h"
@@ -40,7 +39,7 @@ class KnotPropertiesDialog : public Gtk::Dialog {
protected:
SPDesktop *_desktop;
- SPKnot *_knotpoint;
+ SPKnot *_knotpoint;
Gtk::Label _knot_x_label;
Gtk::SpinButton _knot_x_entry;
diff --git a/src/ui/dialog/layer-properties.cpp b/src/ui/dialog/layer-properties.cpp
index f28f8336a..c8c42ef90 100644
--- a/src/ui/dialog/layer-properties.cpp
+++ b/src/ui/dialog/layer-properties.cpp
@@ -14,7 +14,6 @@
*/
#include "layer-properties.h"
-#include <gtkmm/stock.h>
#include <glibmm/i18n.h>
#include <glibmm/main.h>
@@ -36,7 +35,11 @@ namespace UI {
namespace Dialogs {
LayerPropertiesDialog::LayerPropertiesDialog()
-: _strategy(NULL), _desktop(NULL), _layer(NULL), _position_visible(false)
+ : _strategy(NULL),
+ _desktop(NULL),
+ _layer(NULL),
+ _position_visible(false),
+ _close_button(_("_Cancel"), true)
{
auto mainVBox = get_content_area();
_layout_table.set_row_spacing(4);
@@ -59,8 +62,6 @@ LayerPropertiesDialog::LayerPropertiesDialog()
mainVBox->pack_start(_layout_table, true, true, 4);
// Buttons
- _close_button.set_use_stock(true);
- _close_button.set_label(Gtk::Stock::CANCEL.id);
_close_button.set_can_default();
_apply_button.set_use_underline(true);
diff --git a/src/ui/dialog/livepatheffect-add.cpp b/src/ui/dialog/livepatheffect-add.cpp
index 917e48ac6..cada915c9 100644
--- a/src/ui/dialog/livepatheffect-add.cpp
+++ b/src/ui/dialog/livepatheffect-add.cpp
@@ -14,7 +14,6 @@
#include "livepatheffect-add.h"
#include <glibmm/i18n.h>
-#include <gtkmm/stock.h>
#include "desktop.h"
@@ -23,8 +22,8 @@ namespace UI {
namespace Dialog {
LivePathEffectAdd::LivePathEffectAdd() :
- add_button(Gtk::Stock::ADD),
- close_button(Gtk::Stock::CANCEL),
+ add_button(_("_Add"), true),
+ close_button(_("_Cancel"), true),
converter(Inkscape::LivePathEffect::LPETypeConverter),
applied(false)
{
@@ -68,7 +67,6 @@ LivePathEffectAdd::LivePathEffectAdd() :
/**
* Buttons
*/
- close_button.set_use_stock(true);
//close_button.set_can_default();
add_button.set_use_underline(true);
add_button.set_can_default();
diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp
index 9bd4c093e..e5becdb5c 100644
--- a/src/ui/dialog/livepatheffect-editor.cpp
+++ b/src/ui/dialog/livepatheffect-editor.cpp
@@ -17,7 +17,6 @@
#endif
#include "livepatheffect-editor.h"
-#include <gtkmm/stock.h>
#include "desktop.h"
@@ -539,9 +538,11 @@ void LivePathEffectEditor::onDown()
void LivePathEffectEditor::on_effect_selection_changed()
{
Glib::RefPtr<Gtk::TreeSelection> sel = effectlist_view.get_selection();
- if (sel->count_selected_rows () == 0)
+ if (sel->count_selected_rows () == 0) {
+ button_remove.set_sensitive(false);
return;
-
+ }
+ button_remove.set_sensitive(true);
Gtk::TreeModel::iterator it = sel->get_selected();
LivePathEffect::LPEObjectReference * lperef = (*it)[columns.lperef];
diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp
index d33ee758d..d6ecae5a9 100644
--- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp
+++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp
@@ -27,7 +27,10 @@ namespace UI {
namespace Dialogs {
FilletChamferPropertiesDialog::FilletChamferPropertiesDialog()
- : _desktop(NULL), _knotpoint(NULL), _position_visible(false)
+ : _desktop(NULL),
+ _knotpoint(NULL),
+ _position_visible(false),
+ _close_button(_("_Cancel"), true)
{
Gtk::Box *mainVBox = get_vbox();
mainVBox->set_homogeneous(false);
@@ -76,8 +79,6 @@ FilletChamferPropertiesDialog::FilletChamferPropertiesDialog()
mainVBox->pack_start(_fillet_chamfer_type_inverse_chamfer, true, true, 4);
// Buttons
- _close_button.set_use_stock(true);
- _close_button.set_label(Gtk::Stock::CANCEL.id);
_close_button.set_can_default();
_apply_button.set_use_underline(true);
@@ -264,6 +265,4 @@ void FilletChamferPropertiesDialog::_set_desktop(SPDesktop *desktop)
fill-column:99
End:
*/
-// vim:
-// filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99
-// :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99
diff --git a/src/ui/dialog/lpe-powerstroke-properties.cpp b/src/ui/dialog/lpe-powerstroke-properties.cpp
index d5b3bb30d..ca10721db 100644
--- a/src/ui/dialog/lpe-powerstroke-properties.cpp
+++ b/src/ui/dialog/lpe-powerstroke-properties.cpp
@@ -33,7 +33,10 @@ namespace UI {
namespace Dialogs {
PowerstrokePropertiesDialog::PowerstrokePropertiesDialog()
-: _desktop(NULL), _knotpoint(NULL), _position_visible(false)
+ : _desktop(NULL),
+ _knotpoint(NULL),
+ _position_visible(false),
+ _close_button(_("_Cancel"), true)
{
Gtk::Box *mainVBox = get_vbox();
@@ -66,8 +69,6 @@ PowerstrokePropertiesDialog::PowerstrokePropertiesDialog()
mainVBox->pack_start(_layout_table, true, true, 4);
// Buttons
- _close_button.set_use_stock(true);
- _close_button.set_label(Gtk::Stock::CANCEL.id);
_close_button.set_can_default();
_apply_button.set_use_underline(true);
diff --git a/src/ui/dialog/objects.cpp b/src/ui/dialog/objects.cpp
index 446af4ccb..c7c696cdc 100644
--- a/src/ui/dialog/objects.cpp
+++ b/src/ui/dialog/objects.cpp
@@ -15,7 +15,6 @@
#include "objects.h"
#include <gtkmm/icontheme.h>
-#include <gtkmm/stock.h>
#include <gtkmm/imagemenuitem.h>
#include <gtkmm/separatormenuitem.h>
#include <glibmm/main.h>
diff --git a/src/ui/dialog/ocaldialogs.cpp b/src/ui/dialog/ocaldialogs.cpp
index 878b68d55..72a2814ed 100644
--- a/src/ui/dialog/ocaldialogs.cpp
+++ b/src/ui/dialog/ocaldialogs.cpp
@@ -27,7 +27,6 @@
#include <gtkmm/notebook.h>
#include <gtkmm/spinner.h>
-#include <gtkmm/stock.h>
#include <gdkmm/general.h>
#include <libxml/tree.h>
@@ -463,7 +462,8 @@ bool PreviewWidget::_on_draw(const Cairo::RefPtr<Cairo::Context>& cr)
StatusWidget::StatusWidget() : Gtk::HBox(false, 6)
{
- image = new Gtk::Image(Gtk::Stock::DIALOG_ERROR, Gtk::ICON_SIZE_MENU);
+ image = new Gtk::Image();
+ image->set_from_icon_name("dialog-error", Gtk::ICON_SIZE_MENU);
spinner = new Gtk::Spinner();
label = new Gtk::Label();
@@ -488,7 +488,7 @@ void StatusWidget::set_info(Glib::ustring text)
spinner->hide();
image->show();
label->show();
- image->set(Gtk::Stock::DIALOG_INFO, Gtk::ICON_SIZE_MENU);
+ image->set_from_icon_name("dialog-information", Gtk::ICON_SIZE_MENU);
label->set_text(text);
}
@@ -497,7 +497,7 @@ void StatusWidget::set_error(Glib::ustring text)
spinner->hide();
image->show();
label->show();
- image->set(Gtk::Stock::DIALOG_ERROR, Gtk::ICON_SIZE_MENU);
+ image->set_from_icon_name("dialog-error", Gtk::ICON_SIZE_MENU);
label->set_text(text);
}
@@ -1086,7 +1086,7 @@ ImportDialog::ImportDialog(Gtk::Window& parent_window, FileDialogType file_types
Gtk::ScrolledWindow* scrolledwindow_preview = new Gtk::ScrolledWindow();
preview_files = new PreviewWidget();
/// Add the buttons in the bottom of the dialog
- button_cancel = new Gtk::Button(Gtk::Stock::CANCEL);
+ button_cancel = new Gtk::Button(_("_Cancel"), true);
button_close = new Gtk::Button(_("Close"));
button_import = new Gtk::Button(_("Import"));
list_results = new SearchResultList(RESULTS_COLUMN_LENGTH);
diff --git a/src/ui/dialog/panel-dialog.h b/src/ui/dialog/panel-dialog.h
index 39110f47a..5919fcaeb 100644
--- a/src/ui/dialog/panel-dialog.h
+++ b/src/ui/dialog/panel-dialog.h
@@ -15,8 +15,8 @@
# include <config.h>
#endif
+#include <glibmm/i18n.h>
#include <gtkmm/dialog.h>
-#include <gtkmm/stock.h>
#include "verbs.h"
#include "dialog.h"
@@ -165,7 +165,7 @@ PanelDialog<B>::PanelDialog(Widget::Panel &panel, char const *prefs_path, int co
panel.addResponseButton(apply_label, Gtk::RESPONSE_APPLY);
panel.setDefaultResponse(Gtk::RESPONSE_APPLY);
}
- panel.addResponseButton(Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE);
+ panel.addResponseButton(_("_Close"), Gtk::RESPONSE_CLOSE);
}
show_all_children();
@@ -214,7 +214,7 @@ PanelDialog<Behavior::FloatingBehavior>::PanelDialog(UI::Widget::Panel &panel, c
panel.addResponseButton(apply_label, Gtk::RESPONSE_APPLY);
panel.setDefaultResponse(Gtk::RESPONSE_APPLY);
}
- panel.addResponseButton(Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE);
+ panel.addResponseButton(_("_Close"), Gtk::RESPONSE_CLOSE);
}
show_all_children();
diff --git a/src/ui/dialog/pixelartdialog.cpp b/src/ui/dialog/pixelartdialog.cpp
index b838b0842..3e6617cfe 100644
--- a/src/ui/dialog/pixelartdialog.cpp
+++ b/src/ui/dialog/pixelartdialog.cpp
@@ -28,7 +28,6 @@
#include "pixelartdialog.h"
#include <gtkmm/radiobutton.h>
-#include <gtkmm/stock.h>
#include <gtkmm/messagedialog.h>
#include <glibmm/i18n.h>
@@ -291,12 +290,12 @@ PixelArtDialogImpl::PixelArtDialogImpl() :
mainResetButton ->set_tooltip_text(_("Reset all settings to defaults"));
//## The OK button
- mainCancelButton = addResponseButton(Gtk::Stock::STOP, GTK_RESPONSE_CANCEL);
+ mainCancelButton = addResponseButton(_("_Stop"), GTK_RESPONSE_CANCEL);
if (mainCancelButton) {
mainCancelButton->set_tooltip_text(_("Abort a trace in progress"));
mainCancelButton->set_sensitive(false);
}
- mainOkButton = addResponseButton(Gtk::Stock::OK, GTK_RESPONSE_OK);
+ mainOkButton = addResponseButton(_("_OK"), GTK_RESPONSE_OK);
mainOkButton->set_tooltip_text(_("Execute the trace"));
contents->pack_start(buttonsHBox);
diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp
index e55a32bd5..791677807 100644
--- a/src/ui/dialog/svg-fonts-dialog.cpp
+++ b/src/ui/dialog/svg-fonts-dialog.cpp
@@ -20,7 +20,6 @@
#include "document-undo.h"
#include <gtkmm/notebook.h>
#include <gtkmm/scale.h>
-#include <gtkmm/stock.h>
#include <gtkmm/imagemenuitem.h>
#include <message-stack.h>
#include "selection.h"
@@ -299,7 +298,7 @@ void SvgFontsDialog::fonts_list_button_release(GdkEventButton* event)
void SvgFontsDialog::create_glyphs_popup_menu(Gtk::Widget& parent, sigc::slot<void> rem)
{
- Gtk::MenuItem* mi = Gtk::manage(new Gtk::ImageMenuItem(Gtk::Stock::REMOVE));
+ auto mi = Gtk::manage(new Gtk::MenuItem(_("_Remove"), true));
_GlyphsContextMenu.append(*mi);
mi->signal_activate().connect(rem);
mi->show();
@@ -308,7 +307,7 @@ void SvgFontsDialog::create_glyphs_popup_menu(Gtk::Widget& parent, sigc::slot<vo
void SvgFontsDialog::create_kerning_pairs_popup_menu(Gtk::Widget& parent, sigc::slot<void> rem)
{
- Gtk::MenuItem* mi = Gtk::manage(new Gtk::ImageMenuItem(Gtk::Stock::REMOVE));
+ auto mi = Gtk::manage(new Gtk::MenuItem(_("_Remove"), true));
_KerningPairsContextMenu.append(*mi);
mi->signal_activate().connect(rem);
mi->show();
@@ -317,7 +316,7 @@ void SvgFontsDialog::create_kerning_pairs_popup_menu(Gtk::Widget& parent, sigc::
void SvgFontsDialog::create_fonts_popup_menu(Gtk::Widget& parent, sigc::slot<void> rem)
{
- Gtk::MenuItem* mi = Gtk::manage(new Gtk::ImageMenuItem(Gtk::Stock::REMOVE));
+ auto mi = Gtk::manage(new Gtk::MenuItem(_("_Remove"), true));
_FontsContextMenu.append(*mi);
mi->signal_activate().connect(rem);
mi->show();
@@ -986,7 +985,8 @@ void SvgFontsDialog::add_font(){
}
SvgFontsDialog::SvgFontsDialog()
- : UI::Widget::Panel("", "/dialogs/svgfonts", SP_VERB_DIALOG_SVG_FONTS), _add(Gtk::Stock::NEW)
+ : UI::Widget::Panel("", "/dialogs/svgfonts", SP_VERB_DIALOG_SVG_FONTS),
+ _add(_("_New"), true)
{
kerning_slider = Gtk::manage(new Gtk::Scale(Gtk::ORIENTATION_HORIZONTAL));
_add.signal_clicked().connect(sigc::mem_fun(*this, &SvgFontsDialog::add_font));
diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp
index a38085c85..94f307828 100644
--- a/src/ui/dialog/text-edit.cpp
+++ b/src/ui/dialog/text-edit.cpp
@@ -29,7 +29,6 @@ extern "C" {
}
#endif
-#include <gtkmm/stock.h>
#include <libnrtype/font-lister.h>
#include "helper/window.h"
@@ -64,8 +63,8 @@ TextEdit::TextEdit()
text_label(_("_Text"), true),
vari_label(_("_Variants"), true),
setasdefault_button(_("Set as _default")),
- close_button(Gtk::Stock::CLOSE),
- apply_button(Gtk::Stock::APPLY),
+ close_button(_("_Close"), true),
+ apply_button(_("_Apply"), true),
desktop(NULL),
deskTrack(),
selectChangedConn(),
diff --git a/src/ui/dialog/text-edit.h b/src/ui/dialog/text-edit.h
index e974874d2..1fc0099fb 100644
--- a/src/ui/dialog/text-edit.h
+++ b/src/ui/dialog/text-edit.h
@@ -22,6 +22,7 @@
# include <config.h>
#endif
+#include <gtkmm/alignment.h>
#include <gtkmm/box.h>
#include <gtkmm/notebook.h>
#include <gtkmm/button.h>
diff --git a/src/ui/dialog/tracedialog.cpp b/src/ui/dialog/tracedialog.cpp
index 1c0cb5708..a1d4d88b8 100644
--- a/src/ui/dialog/tracedialog.cpp
+++ b/src/ui/dialog/tracedialog.cpp
@@ -21,7 +21,6 @@
#include <gtkmm/radiobutton.h>
#include "ui/widget/spinbutton.h"
#include "ui/widget/frame.h"
-#include <gtkmm/stock.h>
#include <glibmm/i18n.h>
@@ -813,12 +812,12 @@ TraceDialogImpl::TraceDialogImpl() :
mainResetButton ->set_tooltip_text(_("Reset all settings to defaults"));
//## The OK button
- mainCancelButton = addResponseButton(Gtk::Stock::STOP, GTK_RESPONSE_CANCEL);
+ mainCancelButton = addResponseButton(_("_Stop"), GTK_RESPONSE_CANCEL);
if (mainCancelButton) {
mainCancelButton->set_tooltip_text(_("Abort a trace in progress"));
mainCancelButton->set_sensitive(false);
}
- mainOkButton = addResponseButton(Gtk::Stock::OK, GTK_RESPONSE_OK);
+ mainOkButton = addResponseButton(_("_OK"), GTK_RESPONSE_OK);
mainOkButton->set_tooltip_text(_("Execute the trace"));
show_all_children();
diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp
index 5ec47b0dc..d209a450c 100644
--- a/src/ui/dialog/transformation.cpp
+++ b/src/ui/dialog/transformation.cpp
@@ -16,7 +16,6 @@
#endif
#include <gtkmm/dialog.h>
-#include <gtkmm/stock.h>
#include <2geom/transforms.h>
#include "document.h"
@@ -134,14 +133,14 @@ Transformation::Transformation()
updateSelection(PAGE_MOVE, _getSelection());
- resetButton = addResponseButton(Gtk::Stock::CLEAR, 0);
+ resetButton = addResponseButton(_("_Clear"), 0);
if (resetButton) {
resetButton->set_tooltip_text(_("Reset the values on the current tab to defaults"));
resetButton->set_sensitive(true);
resetButton->signal_clicked().connect(sigc::mem_fun(*this, &Transformation::onClear));
}
- applyButton = addResponseButton(Gtk::Stock::APPLY, Gtk::RESPONSE_APPLY);
+ applyButton = addResponseButton(_("_Apply"), Gtk::RESPONSE_APPLY);
if (applyButton) {
applyButton->set_tooltip_text(_("Apply transformation to selection"));
applyButton->set_sensitive(false);
diff --git a/src/ui/dialog/undo-history.cpp b/src/ui/dialog/undo-history.cpp
index 53aa7e6ff..bf5bdc76d 100644
--- a/src/ui/dialog/undo-history.cpp
+++ b/src/ui/dialog/undo-history.cpp
@@ -24,7 +24,7 @@
#include "util/signal-blocker.h"
#include "desktop.h"
-#include <gtkmm/invisible.h>
+#include <gtkmm/icontheme.h>
namespace Inkscape {
namespace UI {
@@ -43,8 +43,8 @@ void CellRendererSPIcon::render_vfunc(const Cairo::RefPtr<Cairo::Context>& cr,
// if the icon isn't cached, render it to a pixbuf
if ( !_icon_cache[_property_event_type] ) {
- Glib::ustring image = Inkscape::Verb::get(_property_event_type)->get_image();
- Gtk::Widget* icon = sp_icon_get_icon(image, Inkscape::ICON_SIZE_MENU);
+ Glib::ustring image_name = Inkscape::Verb::get(_property_event_type)->get_image();
+ Gtk::Widget* icon = sp_icon_get_icon(image_name, Inkscape::ICON_SIZE_MENU);
if (icon) {
@@ -54,8 +54,8 @@ void CellRendererSPIcon::render_vfunc(const Cairo::RefPtr<Cairo::Context>& cr,
sp_icon_fetch_pixbuf(sp_icon);
_property_icon = Glib::wrap(sp_icon->pb, true);
} else if ( GTK_IS_IMAGE(icon->gobj()) ) {
- _property_icon = Gtk::Invisible().render_icon_pixbuf(Gtk::StockID(image),
- Gtk::ICON_SIZE_MENU);
+ auto icon_theme = Gtk::IconTheme::get_default();
+ _property_icon = icon_theme->load_icon(image_name, 16);
} else {
delete icon;
return;
diff --git a/src/ui/dialog/xml-tree.cpp b/src/ui/dialog/xml-tree.cpp
index d05c52531..fa35b092a 100644
--- a/src/ui/dialog/xml-tree.cpp
+++ b/src/ui/dialog/xml-tree.cpp
@@ -19,7 +19,6 @@
#include "xml-tree.h"
#include "widgets/icon.h"
#include <glibmm/i18n.h>
-#include <gtkmm/stock.h>
#include "desktop.h"
diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp
index e0c767509..d50c56b76 100644
--- a/src/ui/interface.cpp
+++ b/src/ui/interface.cpp
@@ -73,8 +73,6 @@
#include "message-stack.h"
#include "ui/dialog/layer-properties.h"
-#include "widgets/image-menu-item.h"
-
using Inkscape::DocumentUndo;
/* Drag and Drop */
@@ -405,7 +403,7 @@ sp_ui_menuitem_add_icon( GtkWidget *item, gchar *icon_name )
icon = sp_icon_new( Inkscape::ICON_SIZE_MENU, icon_name );
gtk_widget_show(icon);
- image_menu_item_set_image((ImageMenuItem *) item, icon);
+ gtk_image_menu_item_set_image((GtkImageMenuItem *) item, icon);
} // end of sp_ui_menu_add_icon
void
@@ -459,7 +457,7 @@ static GtkWidget *sp_ui_menu_append_item_from_verb(GtkMenu *menu, Inkscape::Verb
if (radio) {
item = gtk_radio_menu_item_new_with_mnemonic(group, action->name);
} else {
- item = image_menu_item_new_with_mnemonic(action->name);
+ item = gtk_image_menu_item_new_with_mnemonic(action->name);
}
gtk_label_set_markup_with_mnemonic( GTK_LABEL(gtk_bin_get_child(GTK_BIN (item))), action->name);
diff --git a/src/ui/object-edit.cpp b/src/ui/object-edit.cpp
index 2763e6c4b..cf2c03396 100644
--- a/src/ui/object-edit.cpp
+++ b/src/ui/object-edit.cpp
@@ -43,7 +43,7 @@ static KnotHolder *sp_lpe_knot_holder(SPLPEItem *item, SPDesktop *desktop)
KnotHolder *knot_holder = new KnotHolder(desktop, item, NULL);
Inkscape::LivePathEffect::Effect *effect = item->getCurrentLPE();
- effect->addHandles(knot_holder, desktop, item);
+ effect->addHandles(knot_holder, item);
return knot_holder;
}
diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp
index 0e5a9279d..d6e491ac3 100644
--- a/src/ui/tool/node.cpp
+++ b/src/ui/tool/node.cpp
@@ -326,10 +326,7 @@ bool Handle::grabbed(GdkEventMotion *)
void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event)
{
- if (tools_isactive(_desktop, TOOLS_NODES)) {
- Inkscape::UI::Tools::NodeTool *nt = static_cast<Inkscape::UI::Tools::NodeTool*>(_desktop->event_context);
- nt->update_helperpath();
- }
+ Inkscape::UI::Tools::sp_update_helperpath();
Geom::Point parent_pos = _parent->position();
Geom::Point origin = _last_drag_origin();
SnapManager &sm = _desktop->namedview->snap_manager;
@@ -1199,10 +1196,7 @@ bool Node::grabbed(GdkEventMotion *event)
void Node::dragged(Geom::Point &new_pos, GdkEventMotion *event)
{
- if (tools_isactive(_desktop, TOOLS_NODES)) {
- Inkscape::UI::Tools::NodeTool *nt = static_cast<Inkscape::UI::Tools::NodeTool*>(_desktop->event_context);
- nt->update_helperpath();
- }
+ Inkscape::UI::Tools::sp_update_helperpath();
// For a note on how snapping is implemented in Inkscape, see snap.h.
SnapManager &sm = _desktop->namedview->snap_manager;
// even if we won't really snap, we might still call the one of the
diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp
index f316bea38..5746a8f86 100644
--- a/src/ui/tool/path-manipulator.cpp
+++ b/src/ui/tool/path-manipulator.cpp
@@ -1492,11 +1492,14 @@ void PathManipulator::_setGeometry()
}
} else {
if (empty()) return;
- //XML Tree being used here directly while it shouldn't be.
- if (_path->getRepr()->attribute("inkscape:original-d"))
- _path->set_original_curve(_spcurve, false, false);
- else
+ if (SPCurve * original = _path->get_original_curve()){
+ if(!_spcurve->is_equal(original)) {
+ _path->set_original_curve(_spcurve, false, false);
+ delete original;
+ }
+ } else if(!_spcurve->is_equal(_path->get_curve())) {
_path->setCurve(_spcurve, false);
+ }
}
}
diff --git a/src/ui/tool/transform-handle-set.cpp b/src/ui/tool/transform-handle-set.cpp
index 33015fe11..083a7d0ba 100644
--- a/src/ui/tool/transform-handle-set.cpp
+++ b/src/ui/tool/transform-handle-set.cpp
@@ -183,6 +183,11 @@ void TransformHandle::ungrabbed(GdkEventButton *)
_setState(_state);
endTransform();
_th.signal_commit.emit(getCommitEvent());
+
+ //updates the positions of the nodes
+ Inkscape::UI::Tools::NodeTool *nt = INK_NODE_TOOL(_th._desktop->event_context);
+ ControlPointSelection* selection = nt->_selected_nodes;
+ selection->setOriginalPoints();
}
diff --git a/src/ui/tools/calligraphic-tool.cpp b/src/ui/tools/calligraphic-tool.cpp
index 9b4dbb1a2..c2b86b538 100644
--- a/src/ui/tools/calligraphic-tool.cpp
+++ b/src/ui/tools/calligraphic-tool.cpp
@@ -921,10 +921,10 @@ void CalligraphicTool::set_to_accumulated(bool unionize, bool subtract) {
if (unionize) {
desktop->getSelection()->add(this->repr);
- sp_selected_path_union_skip_undo(desktop->getSelection());
+ desktop->getSelection()->pathUnion(true);
} else if (subtract) {
desktop->getSelection()->add(this->repr);
- sp_selected_path_diff_skip_undo(desktop->getSelection());
+ desktop->getSelection()->pathDiff(true);
} else {
if (this->keep_selected) {
desktop->getSelection()->set(this->repr);
diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp
index 4f941e534..ae312e054 100644
--- a/src/ui/tools/eraser-tool.cpp
+++ b/src/ui/tools/eraser-tool.cpp
@@ -714,7 +714,7 @@ void EraserTool::set_to_accumulated() {
Inkscape::GC::release(dup); // parent takes over
selection->set(dup);
if (!this->nowidth) {
- sp_selected_path_union_skip_undo(selection);
+ selection->pathUnion(true);
}
selection->add(item);
if(item->style->fill_rule.value == SP_WIND_RULE_EVENODD){
@@ -725,9 +725,9 @@ void EraserTool::set_to_accumulated() {
css = 0;
}
if (this->nowidth) {
- sp_selected_path_cut_skip_undo(selection);
+ selection->pathCut(true);
} else {
- sp_selected_path_diff_skip_undo(selection);
+ selection->pathDiff(true);
}
workDone = true; // TODO set this only if something was cut.
bool break_apart = prefs->getBool("/tools/eraser/break_apart", false);
@@ -762,7 +762,7 @@ void EraserTool::set_to_accumulated() {
this->repr->parent()->appendChild(dup);
Inkscape::GC::release(dup); // parent takes over
selection->set(dup);
- sp_selected_path_union_skip_undo(selection);
+ selection->pathUnion(true);
if (bbox && bbox->intersects(*eraserBbox)) {
SPClipPath *clip_path = item->clip_ref->getObject();
if (clip_path) {
@@ -786,7 +786,7 @@ void EraserTool::set_to_accumulated() {
sp_object_unref(clip_path);
selection->raiseToTop(true);
selection->add(dup_clip);
- sp_selected_path_diff_skip_undo(selection);
+ selection->pathDiff(true);
SPItem * clip = SP_ITEM(*(selection->items().begin()));
}
}
@@ -802,7 +802,7 @@ void EraserTool::set_to_accumulated() {
rect->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
selection->raiseToTop(true);
selection->add(rect);
- sp_selected_path_diff_skip_undo(selection);
+ selection->pathDiff(true);
}
selection->raiseToTop(true);
selection->add(item);
diff --git a/src/ui/tools/flood-tool.cpp b/src/ui/tools/flood-tool.cpp
index 0b893a7ba..1801a0ea0 100644
--- a/src/ui/tools/flood-tool.cpp
+++ b/src/ui/tools/flood-tool.cpp
@@ -89,10 +89,10 @@ Glib::ustring ch_init[8] = {
const std::vector<Glib::ustring> FloodTool::channel_list( ch_init, ch_init+8 );
Glib::ustring gap_init[4] = {
- C_("Flood autogap", "None"),
- C_("Flood autogap", "Small"),
- C_("Flood autogap", "Medium"),
- C_("Flood autogap", "Large")
+ NC_("Flood autogap", "None"),
+ NC_("Flood autogap", "Small"),
+ NC_("Flood autogap", "Medium"),
+ NC_("Flood autogap", "Large")
};
const std::vector<Glib::ustring> FloodTool::gap_list( gap_init, gap_init+4 );
@@ -446,7 +446,7 @@ static void do_trace(bitmap_coords_info bci, guchar *trace_px, SPDesktop *deskto
ngettext("Area filled, path with <b>%d</b> node created and unioned with selection.","Area filled, path with <b>%d</b> nodes created and unioned with selection.",
SP_PATH(reprobj)->nodesInPath()), SP_PATH(reprobj)->nodesInPath() );
selection->add(reprobj);
- sp_selected_path_union_skip_undo(desktop->getSelection());
+ selection->pathUnion(true);
} else {
desktop->messageStack()->flashF( Inkscape::WARNING_MESSAGE,
ngettext("Area filled, path with <b>%d</b> node created.","Area filled, path with <b>%d</b> nodes created.",
diff --git a/src/ui/tools/gradient-tool.cpp b/src/ui/tools/gradient-tool.cpp
index 16df225e0..750596808 100644
--- a/src/ui/tools/gradient-tool.cpp
+++ b/src/ui/tools/gradient-tool.cpp
@@ -79,6 +79,9 @@ GradientTool::~GradientTool() {
delete this->subselcon;
}
+// This must match GrPointType enum sp-gradient.h
+// We should move this to a shared header (can't simply move to gradient.h since that would require
+// including <glibmm/i18n.h> which messes up "N_" in extensions... argh!).
const gchar *gr_handle_descr [] = {
N_("Linear gradient <b>start</b>"), //POINT_LG_BEGIN
N_("Linear gradient <b>end</b>"),
@@ -88,7 +91,10 @@ const gchar *gr_handle_descr [] = {
N_("Radial gradient <b>radius</b>"),
N_("Radial gradient <b>focus</b>"), // POINT_RG_FOCUS
N_("Radial gradient <b>mid stop</b>"),
- N_("Radial gradient <b>mid stop</b>")
+ N_("Radial gradient <b>mid stop</b>"),
+ N_("Mesh gradient <b>corner</b>"),
+ N_("Mesh gradient <b>handle</b>"),
+ N_("Mesh gradient <b>tensor</b>")
};
void GradientTool::selection_changed(Inkscape::Selection*) {
@@ -831,6 +837,16 @@ bool GradientTool::root_handler(GdkEvent* event) {
ret = TRUE;
break;
+ case GDK_KEY_i:
+ case GDK_KEY_I:
+ if (MOD__SHIFT_ONLY(event)) {
+ // Shift+I - insert stops (alternate keybinding for keyboards
+ // that don't have the Insert key)
+ sp_gradient_context_add_stops_between_selected_stops (this);
+ ret = TRUE;
+ }
+ break;
+
case GDK_KEY_Delete:
case GDK_KEY_KP_Delete:
case GDK_KEY_BackSpace:
diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp
index c6983b94a..e628094d9 100644
--- a/src/ui/tools/mesh-tool.cpp
+++ b/src/ui/tools/mesh-tool.cpp
@@ -41,6 +41,7 @@
#include "sp-text.h"
#include "sp-defs.h"
#include "style.h"
+#include "ui/control-manager.h"
// Gradient specific
#include "gradient-drag.h"
@@ -74,6 +75,9 @@ MeshTool::MeshTool()
: ToolBase(cursor_gradient_xpm, 4, 4)
, cursor_addnode(false)
, node_added(false)
+ , show_handles(true)
+ , edit_fill(true)
+ , edit_stroke(true)
// TODO: Why are these connections stored as pointers?
, selcon(NULL)
, subselcon(NULL)
@@ -92,7 +96,19 @@ MeshTool::~MeshTool() {
delete this->subselcon;
}
+// This must match GrPointType enum sp-gradient.h
+// We should move this to a shared header (can't simply move to gradient.h since that would require
+// including <glibmm/i18n.h> which messes up "N_" in extensions... argh!).
const gchar *ms_handle_descr [] = {
+ N_("Linear gradient <b>start</b>"), //POINT_LG_BEGIN
+ N_("Linear gradient <b>end</b>"),
+ N_("Linear gradient <b>mid stop</b>"),
+ N_("Radial gradient <b>center</b>"),
+ N_("Radial gradient <b>radius</b>"),
+ N_("Radial gradient <b>radius</b>"),
+ N_("Radial gradient <b>focus</b>"), // POINT_RG_FOCUS
+ N_("Radial gradient <b>mid stop</b>"),
+ N_("Radial gradient <b>mid stop</b>"),
N_("Mesh gradient <b>corner</b>"),
N_("Mesh gradient <b>handle</b>"),
N_("Mesh gradient <b>tensor</b>")
@@ -240,7 +256,25 @@ void MeshTool::setup() {
)
));
+ sp_event_context_read(this, "show_handles");
+ sp_event_context_read(this, "edit_fill");
+ sp_event_context_read(this, "edit_stroke");
+
this->selection_changed(selection);
+
+}
+
+void MeshTool::set(const Inkscape::Preferences::Entry& value) {
+ Glib::ustring entry_name = value.getEntryName();
+ if (entry_name == "show_handles") {
+ this->show_handles = value.getBool(true);
+ } else if (entry_name == "edit_fill") {
+ this->edit_fill = value.getBool(true);
+ } else if (entry_name == "edit_stroke") {
+ this->edit_stroke = value.getBool(true);
+ } else {
+ ToolBase::set(value);
+ }
}
void
@@ -266,32 +300,39 @@ sp_mesh_context_select_prev (ToolBase *event_context)
}
/**
-Returns true if mouse cursor over mesh edge.
+Returns vector of control lines mouse is over. Returns only first if 'first' is true.
*/
-static bool
-sp_mesh_context_is_over_line (MeshTool *rc, SPCtrlLine *line, Geom::Point event_p)
+static std::vector<SPCtrlCurve *>
+sp_mesh_context_over_line (MeshTool *rc, Geom::Point event_p, bool first = true)
{
- if (!SP_IS_CTRLCURVE(line) ) {
- return false;
- }
-
SPDesktop *desktop = SP_EVENT_CONTEXT (rc)->desktop;
//Translate mouse point into proper coord system
rc->mousepoint_doc = desktop->w2d(event_p);
- SPCtrlCurve *curve = SP_CTRLCURVE(line);
- Geom::BezierCurveN<3> b( curve->p0, curve->p1, curve->p2, curve->p3 );
- Geom::Coord coord = b.nearestTime( rc->mousepoint_doc ); // Coord == double
- Geom::Point nearest = b( coord );
+ double tolerance = (double) SP_EVENT_CONTEXT(rc)->tolerance;
+
+ GrDrag *drag = rc->_grdrag;
- double dist_screen = Geom::L2 (rc->mousepoint_doc - nearest) * desktop->current_zoom();
+ std::vector<SPCtrlCurve *> selected;
- double tolerance = (double) SP_EVENT_CONTEXT(rc)->tolerance;
+ for (std::vector<SPCtrlLine *>::const_iterator l = drag->lines.begin(); l != drag->lines.end(); ++l) {
+ if (!SP_IS_CTRLCURVE(*l)) continue;
- bool close = (dist_screen < tolerance);
+ SPCtrlCurve *curve = SP_CTRLCURVE(*l);
+ Geom::BezierCurveN<3> b( curve->p0, curve->p1, curve->p2, curve->p3 );
+ Geom::Coord coord = b.nearestTime( rc->mousepoint_doc ); // Coord == double
+ Geom::Point nearest = b( coord );
- return close;
+ double dist_screen = Geom::L2 (rc->mousepoint_doc - nearest) * desktop->current_zoom();
+ if (dist_screen < tolerance) {
+ selected.push_back(curve);
+ if (first) {
+ break;
+ }
+ }
+ }
+ return selected;
}
@@ -336,12 +377,13 @@ sp_mesh_context_corner_operation (MeshTool *rc, MeshCornerOperation operation )
std::map<SPMeshGradient*, std::vector<guint> > points;
std::map<SPMeshGradient*, SPItem*> items;
-
+ std::map<SPMeshGradient*, Inkscape::PaintTarget> fill_or_stroke;
+
// Get list of selected draggers for each mesh.
- // For all selected draggers
+ // For all selected draggers (a dragger may include draggerables from different meshes).
for (std::set<GrDragger *>::const_iterator i = drag->selected.begin(); i != drag->selected.end(); ++i) {
GrDragger *dragger = *i;
- // For all draggables of dragger
+ // For all draggables of dragger (a draggable corresponds to a unique mesh).
for (std::vector<GrDraggable *>::const_iterator j = dragger->draggables.begin(); j != dragger->draggables.end() ; ++j) {
GrDraggable *d = *j;
@@ -354,6 +396,7 @@ sp_mesh_context_corner_operation (MeshTool *rc, MeshCornerOperation operation )
// Collect points together for same gradient
points[gradient].push_back( d->point_i );
items[gradient] = d->item;
+ fill_or_stroke[gradient] = d->fill_or_stroke ? Inkscape::FOR_FILL: Inkscape::FOR_STROKE;
}
}
@@ -389,6 +432,11 @@ sp_mesh_context_corner_operation (MeshTool *rc, MeshCornerOperation operation )
noperation += mg->array.color_pick( iter->second, items[iter->first] );
break;
+ case MG_CORNER_INSERT:
+ // std::cout << "INSERT" << std::endl;
+ noperation += mg->array.insert( iter->second );
+ break;
+
default:
std::cout << "sp_mesh_corner_operation: unknown operation" << std::endl;
}
@@ -402,22 +450,31 @@ sp_mesh_context_corner_operation (MeshTool *rc, MeshCornerOperation operation )
case MG_CORNER_SIDE_TOGGLE:
DocumentUndo::done(doc, SP_VERB_CONTEXT_MESH, _("Toggled mesh path type."));
+ drag->local_change = true; // Don't create new draggers.
break;
case MG_CORNER_SIDE_ARC:
DocumentUndo::done(doc, SP_VERB_CONTEXT_MESH, _("Approximated arc for mesh side."));
+ drag->local_change = true; // Don't create new draggers.
break;
case MG_CORNER_TENSOR_TOGGLE:
DocumentUndo::done(doc, SP_VERB_CONTEXT_MESH, _("Toggled mesh tensors."));
+ drag->local_change = true; // Don't create new draggers.
break;
case MG_CORNER_COLOR_SMOOTH:
DocumentUndo::done(doc, SP_VERB_CONTEXT_MESH, _("Smoothed mesh corner color."));
+ drag->local_change = true; // Don't create new draggers.
break;
case MG_CORNER_COLOR_PICK:
DocumentUndo::done(doc, SP_VERB_CONTEXT_MESH, _("Picked mesh corner color."));
+ drag->local_change = true; // Don't create new draggers.
+ break;
+
+ case MG_CORNER_INSERT:
+ DocumentUndo::done(doc, SP_VERB_CONTEXT_MESH, _("Inserted new row or column."));
break;
default:
@@ -426,7 +483,9 @@ sp_mesh_context_corner_operation (MeshTool *rc, MeshCornerOperation operation )
}
}
}
- drag->updateDraggers();
+
+ // Not needed. Update is done via gr_drag_sel_modified().
+ // drag->updateDraggers();
}
@@ -456,38 +515,33 @@ sp_mesh_context_fit_mesh_in_bbox (MeshTool *rc)
SPItem *item = *i;
SPStyle *style = item->style;
- if (style && (style->fill.isPaintserver())) {
- SPPaintServer *server = item->style->getFillPaintServer();
- if ( SP_IS_MESHGRADIENT(server) ) {
-
- SPMeshGradient *gradient = SP_MESHGRADIENT(server);
- SPCurve * outline = gradient->array.outline_path();
- Geom::OptRect mesh_bbox = outline->get_pathvector().boundsExact();
- outline->unref();
- Geom::OptRect item_bbox = item->geometricBounds();
-
- if ((*mesh_bbox).width() == 0) {
- continue;
- }
- if ((*mesh_bbox).height() == 0) {
- continue;
+ if (style) {
+
+ if (style->fill.isPaintserver()) {
+ SPPaintServer *server = item->style->getFillPaintServer();
+ if ( SP_IS_MESHGRADIENT(server) ) {
+
+ Geom::OptRect item_bbox = item->geometricBounds();
+ SPMeshGradient *gradient = SP_MESHGRADIENT(server);
+ if (gradient->array.fill_box( item_bbox )) {
+ changed = true;
+ }
}
- double scale_x = (*item_bbox).width() /(*mesh_bbox).width() ;
- double scale_y = (*item_bbox).height()/(*mesh_bbox).height();
-
- Geom::Translate t1(-(*mesh_bbox).min());
- Geom::Scale scale(scale_x,scale_y);
- Geom::Translate t2((*item_bbox).min());
- Geom::Affine transform = t1 * scale * t2;
- if (!transform.isIdentity() ) {
- gradient->array.transform(transform);
- gradient->array.write( gradient );
- gradient->requestModified(SP_OBJECT_MODIFIED_FLAG);
- changed = true;
+ }
+
+ if (style->stroke.isPaintserver()) {
+ SPPaintServer *server = item->style->getStrokePaintServer();
+ if ( SP_IS_MESHGRADIENT(server) ) {
+
+ Geom::OptRect item_bbox = item->visualBounds();
+ SPMeshGradient *gradient = SP_MESHGRADIENT(server);
+ if (gradient->array.fill_box( item_bbox )) {
+ changed = true;
+ }
}
}
+
}
-
}
if (changed) {
DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_MESH,
@@ -523,42 +577,42 @@ bool MeshTool::root_handler(GdkEvent* event) {
// Double click:
// If over a mesh line, divide mesh row/column
- // If not over a line, create new gradients for selected objects.
+ // If not over a line and no mesh, create new mesh for top selected object.
if ( event->button.button == 1 ) {
- // Are we over a mesh line?
- bool over_line = false;
- if (! drag->lines.empty()) {
- for (std::vector<SPCtrlLine *>::const_iterator l = drag->lines.begin(); l != drag->lines.end() && (!over_line); ++l) {
- over_line |= sp_mesh_context_is_over_line (this, *l, Geom::Point(event->motion.x, event->motion.y));
- }
- }
+ // Are we over a mesh line?
+ std::vector<SPCtrlCurve *> over_line =
+ sp_mesh_context_over_line(this, Geom::Point(event->motion.x, event->motion.y));
- if (over_line) {
+ if (!over_line.empty()) {
// We take the first item in selection, because with doubleclick, the first click
// always resets selection to the single object under cursor
sp_mesh_context_split_near_point(this, selection->items().front(), this->mousepoint_doc, event->button.time);
} else {
- sp_mesh_new_default(*this);
// Create a new gradient with default coordinates.
-// auto items= selection->items();
-// for(auto i=items.begin();i!=items.end();++i){
-// SPItem *item = *i;
-// SPGradientType new_type = SP_GRADIENT_TYPE_MESH;
-// Inkscape::PaintTarget fsmode = (prefs->getInt("/tools/gradient/newfillorstroke", 1) != 0) ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE;
-
-// #ifdef DEBUG_MESH
-// std::cout << "sp_mesh_context_root_handler: creating new mesh on: " << (fsmode == Inkscape::FOR_FILL ? "Fill" : "Stroke") << std::endl;
-// #endif
-// SPGradient *vector = sp_gradient_vector_for_object(desktop->getDocument(), desktop, item, fsmode);
-
-// SPGradient *priv = sp_item_set_gradient(item, vector, new_type, fsmode);
-// sp_gradient_reset_to_userspace(priv, item);
-// }
-
-// DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_MESH,
-// _("Create default mesh"));
+
+ // Check if object already has mesh... if it does,
+ // don't create new mesh with click-drag.
+ bool has_mesh = false;
+ if (!selection->isEmpty()) {
+ SPStyle *style = selection->items().front()->style;
+ if (style) {
+ Inkscape::PaintTarget fill_or_stroke =
+ (prefs->getInt("/tools/gradient/newfillorstroke", 1) != 0) ?
+ Inkscape::FOR_FILL : Inkscape::FOR_STROKE;
+ SPPaintServer *server =
+ (fill_or_stroke == Inkscape::FOR_FILL) ?
+ style->getFillPaintServer():
+ style->getStrokePaintServer();
+ if (server && SP_IS_MESHGRADIENT(server))
+ has_mesh = true;
+ }
+ }
+
+ if (!has_mesh) {
+ sp_mesh_new_default(*this);
+ }
}
ret = TRUE;
@@ -570,10 +624,36 @@ bool MeshTool::root_handler(GdkEvent* event) {
#ifdef DEBUG_MESH
std::cout << "sp_mesh_context_root_handler: GDK_BUTTON_PRESS" << std::endl;
#endif
+
// Button down
- // If Shift key down: do rubber band selection
- // Else set origin for drag. A drag creates a new gradient if one does not exist
+ // If mesh already exists, do rubber band selection.
+ // Else set origin for drag which will create a new gradient.
if ( event->button.button == 1 && !this->space_panning ) {
+
+ // Are we over a mesh line?
+ std::vector<SPCtrlCurve *> over_line =
+ sp_mesh_context_over_line(this, Geom::Point(event->motion.x, event->motion.y), false);
+
+ if (!over_line.empty()) {
+ for (std::vector<SPCtrlCurve *>::const_iterator it = over_line.begin();
+ it != over_line.end(); ++it ) {
+ SPItem *item = (*it)->item;
+ Inkscape::PaintTarget fill_or_stroke =
+ (*it)->is_fill ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE;
+ GrDragger* dragger0 = drag->getDraggerFor(item, POINT_MG_CORNER, (*it)->corner0, fill_or_stroke);
+ GrDragger* dragger1 = drag->getDraggerFor(item, POINT_MG_CORNER, (*it)->corner1, fill_or_stroke);
+ bool add = (event->button.state & GDK_SHIFT_MASK);
+ bool toggle = (event->button.state & GDK_CONTROL_MASK);
+ if ( !add && !toggle ) {
+ drag->deselectAll();
+ }
+ drag->setSelected( dragger0, true, !toggle );
+ drag->setSelected( dragger1, true, !toggle );
+ }
+ ret = true;
+ break; // To avoid putting the following code in an else block.
+ }
+
Geom::Point button_w(event->button.x, event->button.y);
// save drag origin
@@ -584,25 +664,43 @@ bool MeshTool::root_handler(GdkEvent* event) {
dragging = true;
Geom::Point button_dt = desktop->w2d(button_w);
- if (event->button.state & GDK_SHIFT_MASK) {
- Inkscape::Rubberband::get(desktop)->start(desktop, button_dt);
- } else {
- // remember clicked item, disregarding groups, honoring Alt; do nothing with Crtl to
- // enable Ctrl+doubleclick of exactly the selected item(s)
- if (!(event->button.state & GDK_CONTROL_MASK)) {
- this->item_to_select = sp_event_context_find_item (desktop, button_w, event->button.state & GDK_MOD1_MASK, TRUE);
+ // Check if object already has mesh... if it does,
+ // don't create new mesh with click-drag.
+ bool has_mesh = false;
+ if (!selection->isEmpty()) {
+ SPStyle *style = selection->items().front()->style;
+ if (style) {
+ Inkscape::PaintTarget fill_or_stroke =
+ (prefs->getInt("/tools/gradient/newfillorstroke", 1) != 0) ?
+ Inkscape::FOR_FILL : Inkscape::FOR_STROKE;
+ SPPaintServer *server =
+ (fill_or_stroke == Inkscape::FOR_FILL) ?
+ style->getFillPaintServer():
+ style->getStrokePaintServer();
+ if (server && SP_IS_MESHGRADIENT(server))
+ has_mesh = true;
}
+ }
- if (!selection->isEmpty()) {
- SnapManager &m = desktop->namedview->snap_manager;
- m.setup(desktop);
- m.freeSnapReturnByRef(button_dt, Inkscape::SNAPSOURCE_NODE_HANDLE);
- m.unSetup();
- }
+ if (has_mesh) {
+ Inkscape::Rubberband::get(desktop)->start(desktop, button_dt);
+ }
- this->origin = button_dt;
+ // remember clicked item, disregarding groups, honoring Alt; do nothing with Crtl to
+ // enable Ctrl+doubleclick of exactly the selected item(s)
+ if (!(event->button.state & GDK_CONTROL_MASK)) {
+ this->item_to_select = sp_event_context_find_item (desktop, button_w, event->button.state & GDK_MOD1_MASK, TRUE);
}
+ if (!selection->isEmpty()) {
+ SnapManager &m = desktop->namedview->snap_manager;
+ m.setup(desktop);
+ m.freeSnapReturnByRef(button_dt, Inkscape::SNAPSOURCE_NODE_HANDLE);
+ m.unSetup();
+ }
+
+ this->origin = button_dt;
+
ret = TRUE;
}
break;
@@ -663,19 +761,14 @@ bool MeshTool::root_handler(GdkEvent* event) {
}
// Change cursor shape if over line
- bool over_line = false;
+ std::vector<SPCtrlCurve *> over_line =
+ sp_mesh_context_over_line(this, Geom::Point(event->motion.x, event->motion.y));
- if (!drag->lines.empty()) {
- for (std::vector<SPCtrlLine *>::const_iterator l = drag->lines.begin(); l != drag->lines.end() ; ++l) {
- over_line |= sp_mesh_context_is_over_line (this, *l, Geom::Point(event->motion.x, event->motion.y));
- }
- }
-
- if (this->cursor_addnode && !over_line) {
+ if (this->cursor_addnode && over_line.empty()) {
this->cursor_shape = cursor_gradient_xpm;
this->sp_event_context_update_cursor();
this->cursor_addnode = false;
- } else if (!this->cursor_addnode && over_line) {
+ } else if (!this->cursor_addnode && !over_line.empty()) {
this->cursor_shape = cursor_gradient_add_xpm;
this->sp_event_context_update_cursor();
this->cursor_addnode = true;
@@ -692,23 +785,15 @@ bool MeshTool::root_handler(GdkEvent* event) {
this->xp = this->yp = 0;
if ( event->button.button == 1 && !this->space_panning ) {
- // Check if over line
- bool over_line = false;
- SPCtrlLine *line = NULL;
-
- if (!drag->lines.empty()) {
- for (std::vector<SPCtrlLine *>::const_iterator l = drag->lines.begin(); l != drag->lines.end() && (!over_line); ++l) {
- over_line = sp_mesh_context_is_over_line (this, *l, Geom::Point(event->motion.x, event->motion.y));
- if (over_line) {
- break;
- }
- }
- }
+ // Check if over line
+ std::vector<SPCtrlCurve *> over_line =
+ sp_mesh_context_over_line(this, Geom::Point(event->motion.x, event->motion.y));
if ( (event->button.state & GDK_CONTROL_MASK) && (event->button.state & GDK_MOD1_MASK ) ) {
- if (over_line && line) {
- sp_mesh_context_split_near_point(this, line->item, this->mousepoint_doc, 0);
+ if (!over_line.empty()) {
+ sp_mesh_context_split_near_point(this, over_line[0]->item,
+ this->mousepoint_doc, 0);
ret = TRUE;
}
} else {
@@ -721,22 +806,47 @@ bool MeshTool::root_handler(GdkEvent* event) {
}
if (!this->within_tolerance) {
- // we've been dragging, either create a new gradient
- // or rubberband-select if we have rubberband
- Inkscape::Rubberband *r = Inkscape::Rubberband::get(desktop);
-
- if (r->is_started() && !this->within_tolerance) {
- // this was a rubberband drag
- if (r->getMode() == RUBBERBAND_MODE_RECT) {
- Geom::OptRect const b = r->getRectangle();
- drag->selectRect(*b);
+
+ // Check if object already has mesh... if it does,
+ // don't create new mesh with click-drag.
+ bool has_mesh = false;
+ if (!selection->isEmpty()) {
+ SPStyle *style = selection->items().front()->style;
+ if (style) {
+ Inkscape::PaintTarget fill_or_stroke =
+ (prefs->getInt("/tools/gradient/newfillorstroke", 1) != 0) ?
+ Inkscape::FOR_FILL : Inkscape::FOR_STROKE;
+ SPPaintServer *server =
+ (fill_or_stroke == Inkscape::FOR_FILL) ?
+ style->getFillPaintServer():
+ style->getStrokePaintServer();
+ if (server && SP_IS_MESHGRADIENT(server))
+ has_mesh = true;
}
- } else {
- // Create a new mesh gradient
+ }
+
+ if (!has_mesh) {
sp_mesh_new_default(*this);
+ } else {
+
+ // we've been dragging, either create a new gradient
+ // or rubberband-select if we have rubberband
+ Inkscape::Rubberband *r = Inkscape::Rubberband::get(desktop);
+
+ if (r->is_started() && !this->within_tolerance) {
+ // this was a rubberband drag
+ if (r->getMode() == RUBBERBAND_MODE_RECT) {
+ Geom::OptRect const b = r->getRectangle();
+ if (!(event->button.state & GDK_SHIFT_MASK)) {
+ drag->deselectAll();
+ }
+ drag->selectRect(*b);
+ }
+ }
}
+
} else if (this->item_to_select) {
- if (over_line && line) {
+ if (!over_line.empty()) {
// Clicked on an existing mesh line, don't change selection. This stops
// possible change in selection during a double click with overlapping objects
} else {
@@ -744,15 +854,21 @@ bool MeshTool::root_handler(GdkEvent* event) {
if (event->button.state & GDK_SHIFT_MASK) {
selection->toggle(this->item_to_select);
} else {
+ drag->deselectAll();
selection->set(this->item_to_select);
}
}
} else {
- // click in an empty space; do the same as Esc
- if (!drag->selected.empty()) {
- drag->deselectAll();
+ if (!over_line.empty()) {
+ // Clicked on an existing mesh line, don't change selection. This stops
+ // possible change in selection during a double click with overlapping objects
} else {
- selection->clear();
+ // click in an empty space; do the same as Esc
+ if (!drag->selected.empty()) {
+ drag->deselectAll();
+ } else {
+ selection->clear();
+ }
}
}
@@ -780,10 +896,11 @@ bool MeshTool::root_handler(GdkEvent* event) {
case GDK_KEY_Shift_R:
case GDK_KEY_Meta_L: // Meta is when you press Shift+Alt (at least on my machine)
case GDK_KEY_Meta_R:
- sp_event_show_modifier_tip (this->defaultMessageContext(), event,
- _("FIXME<b>Ctrl</b>: snap mesh angle"),
- _("FIXME<b>Shift</b>: draw mesh around the starting point"),
- NULL);
+
+ // sp_event_show_modifier_tip (this->defaultMessageContext(), event,
+ // _("FIXME<b>Ctrl</b>: snap mesh angle"),
+ // _("FIXME<b>Shift</b>: draw mesh around the starting point"),
+ // NULL);
break;
case GDK_KEY_A:
@@ -901,25 +1018,33 @@ bool MeshTool::root_handler(GdkEvent* event) {
}
break;
+ // Mesh Operations --------------------------------------------
+
case GDK_KEY_Insert:
case GDK_KEY_KP_Insert:
// with any modifiers:
- //sp_gradient_context_add_stops_between_selected_stops (rc);
- std::cout << "Inserting stops between selected stops not implemented yet" << std::endl;
+ sp_mesh_context_corner_operation ( this, MG_CORNER_INSERT );
ret = TRUE;
break;
+ case GDK_KEY_i:
+ case GDK_KEY_I:
+ if (MOD__SHIFT_ONLY(event)) {
+ // Shift+I - insert corners (alternate keybinding for keyboards
+ // that don't have the Insert key)
+ sp_mesh_context_corner_operation ( this, MG_CORNER_INSERT );
+ ret = TRUE;
+ }
+ break;
+
case GDK_KEY_Delete:
case GDK_KEY_KP_Delete:
case GDK_KEY_BackSpace:
if ( !drag->selected.empty() ) {
- std::cout << "Deleting mesh stops not implemented yet" << std::endl;
ret = TRUE;
}
break;
- // Mesh Operations --------------------------------------------
-
case GDK_KEY_b: // Toggle mesh side between lineto and curveto.
case GDK_KEY_B:
if (MOD__ALT(event) && drag->isNonEmpty() && drag->hasSelection()) {
@@ -1011,6 +1136,16 @@ static void sp_mesh_new_default(MeshTool &rc) {
(prefs->getInt("/tools/gradient/newfillorstroke", 1) != 0) ?
Inkscape::FOR_FILL : Inkscape::FOR_STROKE;
+ // Ensure mesh is immediately editable.
+ // Editting both fill and stroke at same time doesn't work well so avoid.
+ if (fill_or_stroke == Inkscape::FOR_FILL) {
+ prefs->setBool("/tools/mesh/edit_fill", true );
+ prefs->setBool("/tools/mesh/edit_stroke", false);
+ } else {
+ prefs->setBool("/tools/mesh/edit_fill", false);
+ prefs->setBool("/tools/mesh/edit_stroke", true );
+ }
+
// HACK: reset fill-opacity - that 0.75 is annoying; BUT remove this when we have an opacity slider for all tabs
SPCSSAttr *css = sp_repr_css_attr_new();
sp_repr_css_set_property(css, "fill-opacity", "1.0");
@@ -1065,7 +1200,6 @@ static void sp_mesh_new_default(MeshTool &rc) {
}
}
-
}
}
}
diff --git a/src/ui/tools/mesh-tool.h b/src/ui/tools/mesh-tool.h
index f142bfd9c..1f012dc53 100644
--- a/src/ui/tools/mesh-tool.h
+++ b/src/ui/tools/mesh-tool.h
@@ -31,29 +31,34 @@ namespace Tools {
class MeshTool : public ToolBase {
public:
- MeshTool();
- virtual ~MeshTool();
+ MeshTool();
+ virtual ~MeshTool();
Geom::Point origin;
- bool cursor_addnode;
-
- bool node_added;
-
Geom::Point mousepoint_doc; // stores mousepoint when over_line in doc coords
sigc::connection *selcon;
sigc::connection *subselcon;
- static const std::string prefsPath;
+ static const std::string prefsPath;
- virtual void setup();
- virtual bool root_handler(GdkEvent* event);
+ virtual void setup();
+ virtual void set(const Inkscape::Preferences::Entry& val);
+ virtual bool root_handler(GdkEvent* event);
- virtual const std::string& getPrefsPath();
+ virtual const std::string& getPrefsPath();
private:
- void selection_changed(Inkscape::Selection* sel);
+ void selection_changed(Inkscape::Selection* sel);
+
+ bool cursor_addnode;
+ bool node_added;
+ bool show_handles;
+ bool edit_fill;
+ bool edit_stroke;
+
+
};
void sp_mesh_context_select_next(ToolBase *event_context);
diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp
index f3679b40f..0c948c91c 100644
--- a/src/ui/tools/node-tool.cpp
+++ b/src/ui/tools/node-tool.cpp
@@ -32,6 +32,8 @@
#include "sp-text.h"
#include "ui/control-manager.h"
#include "ui/tools/node-tool.h"
+#include "ui/tools-switch.h"
+#include "ui/tools/tool-base.h"
#include "ui/tool/control-point-selection.h"
#include "ui/tool/event-utils.h"
#include "ui/tool/multi-path-manipulator.h"
@@ -209,7 +211,7 @@ void NodeTool::setup() {
this->_sizeUpdatedConn = ControlManager::getManager().connectCtrlSizeChanged(
sigc::mem_fun(this, &NodeTool::handleControlUiStyleChange)
);
-
+ this->helperpath_tmpitem = NULL;
this->_selected_nodes = new Inkscape::UI::ControlPointSelection(this->desktop, this->_transform_handle_group);
data.node_data.selection = this->_selected_nodes;
@@ -237,7 +239,6 @@ void NodeTool::setup() {
)))
);
- this->helperpath_tmpitem = NULL;
this->cursor_drag = false;
this->show_transform_handles = true;
this->single_node_transform_handles = false;
@@ -270,29 +271,34 @@ void NodeTool::setup() {
}
this->desktop->emitToolSubselectionChanged(NULL); // sets the coord entry fields to inactive
- this->update_helperpath();
+ sp_update_helperpath();
}
// show helper paths of the applied LPE, if any
-void NodeTool::update_helperpath () {
- Inkscape::Selection *selection = this->desktop->getSelection();
-
- if (this->helperpath_tmpitem) {
- this->desktop->remove_temporary_canvasitem(this->helperpath_tmpitem);
- this->helperpath_tmpitem = NULL;
+void sp_update_helperpath() {
+ SPDesktop * desktop = SP_ACTIVE_DESKTOP;
+ if (!desktop || !tools_isactive(desktop, TOOLS_NODES)) {
+ return;
+ }
+ Inkscape::UI::Tools::NodeTool *nt = static_cast<Inkscape::UI::Tools::NodeTool*>(desktop->event_context);
+ Inkscape::Selection *selection = desktop->getSelection();
+ if (nt->helperpath_tmpitem) {
+ desktop->remove_temporary_canvasitem(nt->helperpath_tmpitem);
+ nt->helperpath_tmpitem = NULL;
}
if (SP_IS_LPE_ITEM(selection->singleItem())) {
Inkscape::LivePathEffect::Effect *lpe = SP_LPE_ITEM(selection->singleItem())->getCurrentLPE();
if (lpe && lpe->isVisible()/* && lpe->showOrigPath()*/) {
- Inkscape::UI::ControlPointSelection *selectionNodes = _selected_nodes;
+
+ Inkscape::UI::ControlPointSelection *selectionNodes = nt->_selected_nodes;
std::vector<Geom::Point> selectedNodesPositions;
for (Inkscape::UI::ControlPointSelection::iterator i = selectionNodes->begin(); i != selectionNodes->end(); ++i) {
Inkscape::UI::Node *n = dynamic_cast<Inkscape::UI::Node *>(*i);
selectedNodesPositions.push_back(n->position());
}
lpe->setSelectedNodePoints(selectedNodesPositions);
- lpe->setCurrentZoom(this->desktop->current_zoom());
+ lpe->setCurrentZoom(desktop->current_zoom());
SPCurve *c = new SPCurve();
SPCurve *cc = new SPCurve();
std::vector<Geom::PathVector> cs = lpe->getCanvasIndicators(SP_LPE_ITEM(selection->singleItem()));
@@ -302,11 +308,11 @@ void NodeTool::update_helperpath () {
cc->reset();
}
if (!c->is_empty()) {
- SPCanvasItem *helperpath = sp_canvas_bpath_new(this->desktop->getTempGroup(), c, true);
+ SPCanvasItem *helperpath = sp_canvas_bpath_new(desktop->getTempGroup(), c, true);
sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(helperpath), 0x0000ff9A, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(helperpath), 0, SP_WIND_RULE_NONZERO);
sp_canvas_item_affine_absolute(helperpath, selection->singleItem()->i2dt_affine());
- this->helperpath_tmpitem = this->desktop->add_temporary_canvasitem(helperpath, 0);
+ nt->helperpath_tmpitem = desktop->add_temporary_canvasitem(helperpath, 0);
}
c->unref();
cc->unref();
@@ -468,7 +474,7 @@ bool NodeTool::root_handler(GdkEvent* event) {
switch (event->type)
{
case GDK_MOTION_NOTIFY: {
- update_helperpath();
+ sp_update_helperpath();
combine_motion_events(desktop->canvas, event->motion, 0);
SPItem *over_item = sp_event_context_find_item (desktop, event_point(event->button),
FALSE, TRUE);
diff --git a/src/ui/tools/node-tool.h b/src/ui/tools/node-tool.h
index 8342d66a6..983ba6cee 100644
--- a/src/ui/tools/node-tool.h
+++ b/src/ui/tools/node-tool.h
@@ -49,14 +49,14 @@ public:
Inkscape::UI::ControlPointSelection* _selected_nodes;
Inkscape::UI::MultiPathManipulator* _multipath;
-
+ Inkscape::Display::TemporaryItem *helperpath_tmpitem;
+
bool edit_clipping_paths;
bool edit_masks;
static const std::string prefsPath;
virtual void setup();
- virtual void update_helperpath();
virtual void set(const Inkscape::Preferences::Entry& val);
virtual bool root_handler(GdkEvent* event);
@@ -68,7 +68,7 @@ private:
sigc::connection _sizeUpdatedConn;
SPItem *flashed_item;
- Inkscape::Display::TemporaryItem *helperpath_tmpitem;
+
Inkscape::Display::TemporaryItem *flash_tempitem;
Inkscape::UI::Selector* _selector;
Inkscape::UI::PathSharedData* _path_data;
@@ -96,8 +96,9 @@ private:
void update_tip(GdkEvent *event);
void handleControlUiStyleChange();
};
-
+ void sp_update_helperpath();
}
+
}
}
diff --git a/src/ui/tools/spray-tool.cpp b/src/ui/tools/spray-tool.cpp
index 3649008ff..ad006627c 100644
--- a/src/ui/tools/spray-tool.cpp
+++ b/src/ui/tools/spray-tool.cpp
@@ -1026,7 +1026,7 @@ static bool sp_spray_recursive(SPDesktop *desktop,
if (unionResult) { // No need to add the very first item (initialized with NULL).
set->add(unionResult);
}
- sp_selected_path_union_skip_undo(set);
+ set->pathUnion(true);
set->add(parent_item);
Inkscape::GC::release(copy);
did = true;
@@ -1364,7 +1364,7 @@ bool SprayTool::root_handler(GdkEvent* event) {
SP_VERB_CONTEXT_SPRAY, _("Spray with clones"));
break;
case SPRAY_MODE_SINGLE_PATH:
- sp_selected_path_union_skip_undo(objectSet());
+ objectSet()->pathUnion(true);
desktop->getSelection()->add(object_set.objects().begin(), object_set.objects().end());
DocumentUndo::done(this->desktop->getDocument(),
SP_VERB_CONTEXT_SPRAY, _("Spray in single path"));
diff --git a/src/ui/tools/tweak-tool.cpp b/src/ui/tools/tweak-tool.cpp
index a0394ecd4..ff5d623c2 100644
--- a/src/ui/tools/tweak-tool.cpp
+++ b/src/ui/tools/tweak-tool.cpp
@@ -56,6 +56,8 @@
#include "sp-gradient-reference.h"
#include "sp-linear-gradient.h"
#include "sp-radial-gradient.h"
+#include "sp-mesh-gradient.h"
+#include "sp-mesh-array.h"
#include "gradient-chemistry.h"
#include "sp-text.h"
#include "sp-flowtext.h"
@@ -761,112 +763,132 @@ static void tweak_colors_in_gradient(SPItem *item, Inkscape::PaintTarget fill_or
p *= (gradient->gradientTransform).inverse();
// now p is in gradient's original coordinates
- double pos = 0;
- double r = 0;
-
SPLinearGradient *lg = dynamic_cast<SPLinearGradient *>(gradient);
- if (lg) {
- Geom::Point p1(lg->x1.computed, lg->y1.computed);
- Geom::Point p2(lg->x2.computed, lg->y2.computed);
- Geom::Point pdiff(p2 - p1);
- double vl = Geom::L2(pdiff);
+ SPRadialGradient *rg = dynamic_cast<SPRadialGradient *>(gradient);
+ if (lg || rg) {
- // This is the matrix which moves and rotates the gradient line
- // so it's oriented along the X axis:
- Geom::Affine norm = Geom::Affine(Geom::Translate(-p1)) * Geom::Affine(Geom::Rotate(-atan2(pdiff[Geom::Y], pdiff[Geom::X])));
+ double pos = 0;
+ double r = 0;
- // Transform the mouse point by it to find out its projection onto the gradient line:
- Geom::Point pnorm = p * norm;
+ if (lg) {
+ Geom::Point p1(lg->x1.computed, lg->y1.computed);
+ Geom::Point p2(lg->x2.computed, lg->y2.computed);
+ Geom::Point pdiff(p2 - p1);
+ double vl = Geom::L2(pdiff);
- // Scale its X coordinate to match the length of the gradient line:
- pos = pnorm[Geom::X] / vl;
- // Calculate radius in lenfth-of-gradient-line units
- r = radius / vl;
+ // This is the matrix which moves and rotates the gradient line
+ // so it's oriented along the X axis:
+ Geom::Affine norm = Geom::Affine(Geom::Translate(-p1)) *
+ Geom::Affine(Geom::Rotate(-atan2(pdiff[Geom::Y], pdiff[Geom::X])));
- } else {
- SPRadialGradient *rg = dynamic_cast<SPRadialGradient *>(gradient);
+ // Transform the mouse point by it to find out its projection onto the gradient line:
+ Geom::Point pnorm = p * norm;
+
+ // Scale its X coordinate to match the length of the gradient line:
+ pos = pnorm[Geom::X] / vl;
+ // Calculate radius in lenfth-of-gradient-line units
+ r = radius / vl;
+
+ }
if (rg) {
Geom::Point c (rg->cx.computed, rg->cy.computed);
pos = Geom::L2(p - c) / rg->r.computed;
r = radius / rg->r.computed;
}
- }
- // Normalize pos to 0..1, taking into accound gradient spread:
- double pos_e = pos;
- if (gradient->getSpread() == SP_GRADIENT_SPREAD_PAD) {
- if (pos > 1) {
- pos_e = 1;
- }
- if (pos < 0) {
- pos_e = 0;
- }
- } else if (gradient->getSpread() == SP_GRADIENT_SPREAD_REPEAT) {
- if (pos > 1 || pos < 0) {
- pos_e = pos - floor(pos);
- }
- } else if (gradient->getSpread() == SP_GRADIENT_SPREAD_REFLECT) {
- if (pos > 1 || pos < 0) {
- bool odd = ((int)(floor(pos)) % 2 == 1);
- pos_e = pos - floor(pos);
- if (odd) {
- pos_e = 1 - pos_e;
+ // Normalize pos to 0..1, taking into accound gradient spread:
+ double pos_e = pos;
+ if (gradient->getSpread() == SP_GRADIENT_SPREAD_PAD) {
+ if (pos > 1) {
+ pos_e = 1;
+ }
+ if (pos < 0) {
+ pos_e = 0;
+ }
+ } else if (gradient->getSpread() == SP_GRADIENT_SPREAD_REPEAT) {
+ if (pos > 1 || pos < 0) {
+ pos_e = pos - floor(pos);
+ }
+ } else if (gradient->getSpread() == SP_GRADIENT_SPREAD_REFLECT) {
+ if (pos > 1 || pos < 0) {
+ bool odd = ((int)(floor(pos)) % 2 == 1);
+ pos_e = pos - floor(pos);
+ if (odd) {
+ pos_e = 1 - pos_e;
+ }
}
}
- }
- SPGradient *vector = sp_gradient_get_forked_vector_if_necessary(gradient, false);
+ SPGradient *vector = sp_gradient_get_forked_vector_if_necessary(gradient, false);
- double offset_l = 0;
- double offset_h = 0;
- SPObject *child_prev = NULL;
- for (auto& child: vector->children) {
- SPStop *stop = dynamic_cast<SPStop *>(&child);
- if (!stop) {
- continue;
- }
+ double offset_l = 0;
+ double offset_h = 0;
+ SPObject *child_prev = NULL;
+ for (auto& child: vector->children) {
+ SPStop *stop = dynamic_cast<SPStop *>(&child);
+ if (!stop) {
+ continue;
+ }
- offset_h = stop->offset;
-
- if (child_prev) {
- SPStop *prevStop = dynamic_cast<SPStop *>(child_prev);
- g_assert(prevStop != NULL);
-
- if (offset_h - offset_l > r && pos_e >= offset_l && pos_e <= offset_h) {
- // the summit falls in this interstop, and the radius is small,
- // so it only affects the ends of this interstop;
- // distribute the force between the two endstops so that they
- // get all the painting even if they are not touched by the brush
- tweak_color (mode, stop->specified_color.v.c, rgb_goal,
- force * (pos_e - offset_l) / (offset_h - offset_l),
- do_h, do_s, do_l);
- tweak_color(mode, prevStop->specified_color.v.c, rgb_goal,
- force * (offset_h - pos_e) / (offset_h - offset_l),
- do_h, do_s, do_l);
- stop->updateRepr();
- child_prev->updateRepr();
- break;
- } else {
- // wide brush, may affect more than 2 stops,
- // paint each stop by the force from the profile curve
- if (offset_l <= pos_e && offset_l > pos_e - r) {
+ offset_h = stop->offset;
+
+ if (child_prev) {
+ SPStop *prevStop = dynamic_cast<SPStop *>(child_prev);
+ g_assert(prevStop != NULL);
+
+ if (offset_h - offset_l > r && pos_e >= offset_l && pos_e <= offset_h) {
+ // the summit falls in this interstop, and the radius is small,
+ // so it only affects the ends of this interstop;
+ // distribute the force between the two endstops so that they
+ // get all the painting even if they are not touched by the brush
+ tweak_color (mode, stop->specified_color.v.c, rgb_goal,
+ force * (pos_e - offset_l) / (offset_h - offset_l),
+ do_h, do_s, do_l);
tweak_color(mode, prevStop->specified_color.v.c, rgb_goal,
- force * tweak_profile (fabs (pos_e - offset_l), r),
+ force * (offset_h - pos_e) / (offset_h - offset_l),
do_h, do_s, do_l);
+ stop->updateRepr();
child_prev->updateRepr();
+ break;
+ } else {
+ // wide brush, may affect more than 2 stops,
+ // paint each stop by the force from the profile curve
+ if (offset_l <= pos_e && offset_l > pos_e - r) {
+ tweak_color(mode, prevStop->specified_color.v.c, rgb_goal,
+ force * tweak_profile (fabs (pos_e - offset_l), r),
+ do_h, do_s, do_l);
+ child_prev->updateRepr();
+ }
+
+ if (offset_h >= pos_e && offset_h < pos_e + r) {
+ tweak_color (mode, stop->specified_color.v.c, rgb_goal,
+ force * tweak_profile (fabs (pos_e - offset_h), r),
+ do_h, do_s, do_l);
+ stop->updateRepr();
+ }
}
+ }
- if (offset_h >= pos_e && offset_h < pos_e + r) {
+ offset_l = offset_h;
+ child_prev = &child;
+ }
+ } else {
+ // Mesh
+ SPMeshGradient *mg = dynamic_cast<SPMeshGradient *>(gradient);
+ if (mg) {
+ SPMeshGradient *mg_array = dynamic_cast<SPMeshGradient *>(mg->getArray());
+ SPMeshNodeArray *array = &(mg_array->array);
+ // Every third node is a corner node
+ for( unsigned i=0; i < array->nodes.size(); i+=3 ) {
+ for( unsigned j=0; j < array->nodes[i].size(); j+=3 ) {
+ SPStop *stop = array->nodes[i][j]->stop;
+ double distance = Geom::L2(Geom::Point(p - array->nodes[i][j]->p));
tweak_color (mode, stop->specified_color.v.c, rgb_goal,
- force * tweak_profile (fabs (pos_e - offset_h), r),
- do_h, do_s, do_l);
+ force * tweak_profile (distance, radius), do_h, do_s, do_l);
stop->updateRepr();
}
}
}
-
- offset_l = offset_h;
- child_prev = &child;
}
}
@@ -1062,7 +1084,8 @@ sp_tweak_dilate (TweakTool *tc, Geom::Point event_p, Geom::Point p, Geom::Point
double move_force = get_move_force(tc);
double color_force = MIN(sqrt(path_force)/20.0, 1);
- auto items= selection->items();
+// auto items= selection->items();
+ std::vector<SPItem*> items(selection->items().begin(), selection->items().end());
for(auto i=items.begin();i!=items.end(); ++i){
SPItem *item = *i;
diff --git a/src/ui/widget/dock-item.cpp b/src/ui/widget/dock-item.cpp
index 979c09d2f..d124854ae 100644
--- a/src/ui/widget/dock-item.cpp
+++ b/src/ui/widget/dock-item.cpp
@@ -15,7 +15,6 @@
#include "widgets/icon.h"
#include <gtkmm/icontheme.h>
-#include <gtkmm/stockitem.h>
#include <glibmm/exceptionhandler.h>
namespace Inkscape {
@@ -47,18 +46,11 @@ DockItem::DockItem(Dock& dock, const Glib::ustring& name, const Glib::ustring& l
if (!iconTheme->has_icon(icon_name)) {
Inkscape::queueIconPrerender( INKSCAPE_ICON(icon_name.data()), Inkscape::ICON_SIZE_MENU );
}
- // Icon might be in the icon theme, or might be a stock item. Check the proper source:
if ( iconTheme->has_icon(icon_name) ) {
int width = 0;
int height = 0;
Gtk::IconSize::lookup(Gtk::ICON_SIZE_MENU, width, height);
_icon_pixbuf = iconTheme->load_icon(icon_name, width);
- } else {
- Gtk::StockItem item;
- Gtk::StockID stockId(icon_name);
- if ( Gtk::StockItem::lookup(stockId, item) ) {
- _icon_pixbuf = _dock.getWidget().render_icon_pixbuf( stockId, Gtk::ICON_SIZE_MENU );
- }
}
}
@@ -423,6 +415,8 @@ void
DockItem::_onStateChanged(State /*prev_state*/, State new_state)
{
_window = getWindow();
+ if(_window)
+ _window->set_type_hint(Gdk::WINDOW_TYPE_HINT_NORMAL);
if (new_state == FLOATING_STATE && _window) {
_window->signal_hide().connect(sigc::mem_fun(*this, &Inkscape::UI::Widget::DockItem::_onHideWindow));
diff --git a/src/ui/widget/dock.cpp b/src/ui/widget/dock.cpp
index 7744cb695..b2dec401f 100644
--- a/src/ui/widget/dock.cpp
+++ b/src/ui/widget/dock.cpp
@@ -256,7 +256,7 @@ void Dock::_onLayoutChanged()
_paned->get_child1()->set_size_request(-1, -1);
_scrolled_window->set_size_request(_default_empty_width);
}
- getParentPaned()->set_position(INT_MAX);
+ getParentPaned()->set_position(10000);
} else {
// unset any forced size requests
diff --git a/src/ui/widget/font-button.cpp b/src/ui/widget/font-button.cpp
index a472ac6a4..ed57c803a 100644
--- a/src/ui/widget/font-button.cpp
+++ b/src/ui/widget/font-button.cpp
@@ -8,8 +8,11 @@
#endif
#include "font-button.h"
+
#include <glibmm/i18n.h>
+#include <gtkmm/fontbutton.h>
+
namespace Inkscape {
namespace UI {
namespace Widget {
diff --git a/src/ui/widget/font-button.h b/src/ui/widget/font-button.h
index 1f1ad2d01..98c3db440 100644
--- a/src/ui/widget/font-button.h
+++ b/src/ui/widget/font-button.h
@@ -8,7 +8,6 @@
#ifndef INKSCAPE_UI_WIDGET_FONT_BUTTON_H
#define INKSCAPE_UI_WIDGET_FONT_BUTTON_H
-#include <gtkmm.h>
#include "labelled.h"
namespace Inkscape {
diff --git a/src/ui/widget/frame.cpp b/src/ui/widget/frame.cpp
index 65d10dcc4..6593d9c7c 100644
--- a/src/ui/widget/frame.cpp
+++ b/src/ui/widget/frame.cpp
@@ -21,26 +21,20 @@ namespace UI {
namespace Widget {
Frame::Frame(Glib::ustring const &label_text /*= ""*/, gboolean label_bold /*= TRUE*/ )
- : _label(label_text, 1.0, 0.5, TRUE),
- _alignment()
+ : _label(label_text, 1.0, 0.5, TRUE)
{
set_shadow_type(Gtk::SHADOW_NONE);
- //Put an indented GtkAlignment inside the frame.
- //Further children should be children of this GtkAlignment:
- Gtk::Frame::add(_alignment);
- set_padding(4, 0, 8, 0);
-
set_label_widget(_label);
set_label(label_text, label_bold);
-
- show_all_children();
}
void
Frame::add(Widget& widget)
{
- _alignment.add(widget);
+ Gtk::Frame::add(widget);
+ set_padding(4, 0, 8, 0);
+ show_all_children();
}
void
@@ -56,7 +50,21 @@ Frame::set_label(const Glib::ustring &label_text, gboolean label_bold /*= TRUE*/
void
Frame::set_padding (guint padding_top, guint padding_bottom, guint padding_left, guint padding_right)
{
- _alignment.set_padding(padding_top, padding_bottom, padding_left, padding_right);
+ auto child = get_child();
+
+ if(child)
+ {
+ child->set_margin_top(padding_top);
+ child->set_margin_bottom(padding_bottom);
+
+#if GTK_CHECK_VERSION(3,12,0)
+ child->set_margin_start(padding_left);
+ child->set_margin_end(padding_right);
+#else
+ child->set_margin_left(padding_left);
+ child->set_margin_right(padding_right);
+#endif
+ }
}
Gtk::Label const *
diff --git a/src/ui/widget/frame.h b/src/ui/widget/frame.h
index a04666651..24dd716e6 100644
--- a/src/ui/widget/frame.h
+++ b/src/ui/widget/frame.h
@@ -10,7 +10,6 @@
#ifndef INKSCAPE_UI_WIDGET_FRAME_H
#define INKSCAPE_UI_WIDGET_FRAME_H
-#include <gtkmm/alignment.h>
#include <gtkmm/frame.h>
#include <gtkmm/label.h>
@@ -55,8 +54,6 @@ public:
protected:
Gtk::Label _label;
- Gtk::Alignment _alignment;
-
};
} // namespace Widget
diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp
index 6e6e6c527..dff92594b 100644
--- a/src/ui/widget/panel.cpp
+++ b/src/ui/widget/panel.cpp
@@ -17,7 +17,6 @@
#include <gtkmm/dialog.h> // for Gtk::RESPONSE_*
#include <gtkmm/menu.h>
-#include <gtkmm/stock.h>
#include <gtkmm/checkmenuitem.h>
#include <gtkmm/radiomenuitem.h>
#include <gtkmm/separatormenuitem.h>
@@ -66,7 +65,7 @@ Panel::Panel(Glib::ustring const &label, gchar const *prefs_path,
_label(label),
_apply_label(apply_label),
_verb_num(verb_num),
- _temp_arrow(Gtk::ARROW_LEFT, Gtk::SHADOW_ETCHED_OUT),
+ _temp_arrow(),
_menu(0),
_action_area(0),
_fillable(0)
@@ -269,11 +268,9 @@ void Panel::_init()
_top_bar.pack_end(_menu_popper, false, false);
gint width = 0;
gint height = 0;
-
- if ( gtk_icon_size_lookup( Inkscape::getRegisteredIconSize(Inkscape::ICON_SIZE_DECORATION), &width, &height ) ) {
- _temp_arrow.set_size_request(width, height);
- }
-
+ gtk_image_set_from_icon_name(_temp_arrow.gobj(),
+ "pan-start-symbolic",
+ Inkscape::getRegisteredIconSize(Inkscape::ICON_SIZE_SMALL_TOOLBAR));
_menu_popper.add(_temp_arrow);
_menu_popper.signal_button_press_event().connect_notify(sigc::mem_fun(*this, &Panel::_popper));
}
@@ -578,14 +575,7 @@ void Panel::_apply()
Gtk::Button *Panel::addResponseButton(const Glib::ustring &button_text, int response_id, bool pack_start)
{
- Gtk::Button *button = new Gtk::Button(button_text);
- _addResponseButton(button, response_id, pack_start);
- return button;
-}
-
-Gtk::Button *Panel::addResponseButton(const Gtk::StockID &stock_id, int response_id, bool pack_start)
-{
- Gtk::Button *button = new Gtk::Button(stock_id);
+ Gtk::Button *button = new Gtk::Button(button_text, true);
_addResponseButton(button, response_id, pack_start);
return button;
}
diff --git a/src/ui/widget/panel.h b/src/ui/widget/panel.h
index 370779586..9cbf39de9 100644
--- a/src/ui/widget/panel.h
+++ b/src/ui/widget/panel.h
@@ -18,9 +18,9 @@
#endif
#include <gtkmm/box.h>
-#include <gtkmm/arrow.h>
#include <gtkmm/button.h>
#include <gtkmm/eventbox.h>
+#include <gtkmm/image.h>
#include <gtkmm/label.h>
#include "enums.h"
#include <vector>
@@ -101,7 +101,6 @@ public:
/* Methods providing a Gtk::Dialog like interface for adding buttons that emit Gtk::RESPONSE
* signals on click. */
Gtk::Button* addResponseButton (const Glib::ustring &button_text, int response_id, bool pack_start=false);
- Gtk::Button* addResponseButton (const Gtk::StockID &stock_id, int response_id, bool pack_start=false);
void setDefaultResponse(int response_id);
void setResponseSensitive(int response_id, bool setting);
@@ -157,7 +156,7 @@ private:
Gtk::VBox _right_bar;
Gtk::VBox _contents;
Gtk::Label _tab_title;
- Gtk::Arrow _temp_arrow;
+ Gtk::Image _temp_arrow;
Gtk::EventBox _menu_popper;
Gtk::Button _close_button;
Gtk::Menu *_menu;
diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp
index 1205cd012..b2cebcaa6 100644
--- a/src/ui/widget/preferences-widget.cpp
+++ b/src/ui/widget/preferences-widget.cpp
@@ -18,7 +18,6 @@
#include <gtkmm/frame.h>
#include <gtkmm/alignment.h>
#include <gtkmm/scale.h>
-#include <gtkmm/stock.h>
#include <gtkmm/table.h>
#include "preferences.h"
@@ -708,8 +707,9 @@ void PrefEntryFileButtonHBox::init(Glib::ustring const &prefs_path,
relatedButton = new Gtk::Button();
Gtk::HBox* pixlabel = new Gtk::HBox(false, 3);
- Gtk::Image *im = new Gtk::Image(Gtk::StockID(Gtk::Stock::INDEX),
- Gtk::ICON_SIZE_BUTTON);
+ Gtk::Image *im = new Gtk::Image();
+ im->set_from_icon_name("applications-graphics",
+ Gtk::ICON_SIZE_BUTTON);
pixlabel->pack_start(*im);
Gtk::Label *l = new Gtk::Label();
l->set_markup_with_mnemonic(_("_Browse..."));
diff --git a/src/ui/widget/registered-widget.h b/src/ui/widget/registered-widget.h
index d410dbfe6..f66d5cbf2 100644
--- a/src/ui/widget/registered-widget.h
+++ b/src/ui/widget/registered-widget.h
@@ -135,7 +135,7 @@ private:
repr = NULL;
doc = NULL;
write_undo = false;
- event_type = -1;
+ event_type = 0; //SP_VERB_INVALID
}
};
diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp
index ebc6fe919..0370d55db 100644
--- a/src/ui/widget/selected-style.cpp
+++ b/src/ui/widget/selected-style.cpp
@@ -781,56 +781,7 @@ void SelectedStyle::on_stroke_paste() {
}
void SelectedStyle::on_fillstroke_swap() {
- SPCSSAttr *css = sp_repr_css_attr_new ();
-
- switch (_mode[SS_FILL]) {
- case SS_NA:
- case SS_MANY:
- break;
- case SS_NONE:
- sp_repr_css_set_property (css, "stroke", "none");
- break;
- case SS_UNSET:
- sp_repr_css_unset_property (css, "stroke");
- break;
- case SS_COLOR:
- gchar c[64];
- sp_svg_write_color (c, sizeof(c), _thisselected[SS_FILL]);
- sp_repr_css_set_property (css, "stroke", c);
- break;
- case SS_LGRADIENT:
- case SS_RGRADIENT:
- case SS_PATTERN:
- sp_repr_css_set_property (css, "stroke", _paintserver_id[SS_FILL].c_str());
- break;
- }
-
- switch (_mode[SS_STROKE]) {
- case SS_NA:
- case SS_MANY:
- break;
- case SS_NONE:
- sp_repr_css_set_property (css, "fill", "none");
- break;
- case SS_UNSET:
- sp_repr_css_unset_property (css, "fill");
- break;
- case SS_COLOR:
- gchar c[64];
- sp_svg_write_color (c, sizeof(c), _thisselected[SS_STROKE]);
- sp_repr_css_set_property (css, "fill", c);
- break;
- case SS_LGRADIENT:
- case SS_RGRADIENT:
- case SS_PATTERN:
- sp_repr_css_set_property (css, "fill", _paintserver_id[SS_STROKE].c_str());
- break;
- }
-
- sp_desktop_set_style (_desktop, css);
- sp_repr_css_attr_unref (css);
- DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE,
- _("Swap fill and stroke"));
+ _desktop->getSelection()->swapFillStroke();
}
void SelectedStyle::on_fill_edit() {