summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/CMakeLists.txt3
-rw-r--r--src/ui/cache/makefile.in17
-rw-r--r--src/ui/clipboard.cpp49
-rw-r--r--src/ui/clipboard.h1
-rw-r--r--src/ui/contextmenu.cpp2
-rw-r--r--src/ui/control-manager.cpp4
-rw-r--r--src/ui/control-manager.h4
-rw-r--r--src/ui/dialog-events.cpp2
-rw-r--r--src/ui/dialog/clonetiler.cpp15
-rw-r--r--src/ui/dialog/dialog.cpp2
-rw-r--r--src/ui/dialog/export.cpp10
-rw-r--r--src/ui/dialog/filedialogimpl-gtkmm.cpp50
-rw-r--r--src/ui/dialog/filedialogimpl-win32.cpp1
-rw-r--r--src/ui/dialog/grid-arrange-tab.cpp12
-rw-r--r--src/ui/dialog/icon-preview.cpp1
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp143
-rw-r--r--src/ui/dialog/inkscape-preferences.h3
-rw-r--r--src/ui/dialog/knot-properties.cpp2
-rw-r--r--src/ui/dialog/layer-properties.cpp2
-rw-r--r--src/ui/dialog/layers.cpp6
-rw-r--r--src/ui/dialog/livepatheffect-editor.cpp10
-rw-r--r--src/ui/dialog/lpe-powerstroke-properties.cpp2
-rw-r--r--src/ui/dialog/makefile.in17
-rw-r--r--src/ui/dialog/objects.cpp6
-rw-r--r--src/ui/dialog/objects.h3
-rw-r--r--src/ui/dialog/polar-arrange-tab.cpp2
-rw-r--r--src/ui/dialog/print.cpp3
-rw-r--r--src/ui/dialog/prototype.cpp2
-rw-r--r--src/ui/dialog/spellcheck.cpp87
-rw-r--r--src/ui/dialog/spellcheck.h11
-rw-r--r--src/ui/dialog/styledialog.cpp12
-rw-r--r--src/ui/dialog/symbols.cpp46
-rw-r--r--src/ui/dialog/symbols.h12
-rw-r--r--src/ui/dialog/tags.cpp14
-rw-r--r--src/ui/dialog/transformation.cpp2
-rw-r--r--src/ui/dialog/xml-tree.cpp2
-rw-r--r--src/ui/interface.cpp118
-rw-r--r--src/ui/makefile.in17
-rw-r--r--src/ui/object-edit.h84
-rw-r--r--src/ui/shape-editor-knotholders.cpp (renamed from src/ui/object-edit.cpp)50
-rw-r--r--src/ui/shape-editor.cpp23
-rw-r--r--src/ui/shape-editor.h4
-rw-r--r--src/ui/tool/control-point-selection.h1
-rw-r--r--src/ui/tool/control-point.cpp2
-rw-r--r--src/ui/tool/control-point.h12
-rw-r--r--src/ui/tool/manipulator.h16
-rw-r--r--src/ui/tool/multi-path-manipulator.cpp5
-rw-r--r--src/ui/tool/multi-path-manipulator.h8
-rw-r--r--src/ui/tool/node.cpp19
-rw-r--r--src/ui/tool/node.h8
-rw-r--r--src/ui/tool/path-manipulator.cpp2
-rw-r--r--src/ui/tool/path-manipulator.h4
-rw-r--r--src/ui/tools/arc-tool.cpp15
-rw-r--r--src/ui/tools/box3d-tool.cpp8
-rw-r--r--src/ui/tools/calligraphic-tool.cpp26
-rw-r--r--src/ui/tools/connector-tool.cpp4
-rw-r--r--src/ui/tools/dropper-tool.cpp2
-rw-r--r--src/ui/tools/dynamic-base.cpp7
-rw-r--r--src/ui/tools/dynamic-base.h3
-rw-r--r--src/ui/tools/eraser-tool.cpp24
-rw-r--r--src/ui/tools/flood-tool.cpp4
-rw-r--r--src/ui/tools/freehand-base.cpp76
-rw-r--r--src/ui/tools/freehand-base.h6
-rw-r--r--src/ui/tools/gradient-tool.cpp97
-rw-r--r--src/ui/tools/lpe-tool.cpp4
-rw-r--r--src/ui/tools/measure-tool.cpp4
-rw-r--r--src/ui/tools/mesh-tool.cpp74
-rw-r--r--src/ui/tools/node-tool.cpp5
-rw-r--r--src/ui/tools/pen-tool.cpp61
-rw-r--r--src/ui/tools/pencil-tool.cpp12
-rw-r--r--src/ui/tools/rect-tool.cpp29
-rw-r--r--src/ui/tools/select-tool.cpp24
-rw-r--r--src/ui/tools/spiral-tool.cpp11
-rw-r--r--src/ui/tools/spray-tool.cpp8
-rw-r--r--src/ui/tools/star-tool.cpp12
-rw-r--r--src/ui/tools/text-tool.cpp22
-rw-r--r--src/ui/tools/tool-base.cpp55
-rw-r--r--src/ui/tools/tool-base.h3
-rw-r--r--src/ui/tools/tweak-tool.cpp17
-rw-r--r--src/ui/tools/zoom-tool.cpp4
-rw-r--r--src/ui/view/makefile.in17
-rw-r--r--src/ui/widget/color-notebook.cpp5
-rw-r--r--src/ui/widget/color-preview.cpp45
-rw-r--r--src/ui/widget/makefile.in17
-rw-r--r--src/ui/widget/page-sizer.cpp14
-rw-r--r--src/ui/widget/page-sizer.h2
-rw-r--r--src/ui/widget/panel.cpp1
-rw-r--r--src/ui/widget/preferences-widget.cpp31
-rw-r--r--src/ui/widget/preferences-widget.h12
-rw-r--r--src/ui/widget/registered-widget.cpp7
-rw-r--r--src/ui/widget/selected-style.cpp11
-rw-r--r--src/ui/widget/selected-style.h2
-rw-r--r--src/ui/widget/spinbutton.cpp2
-rw-r--r--src/ui/widget/unit-tracker.cpp51
-rw-r--r--src/ui/widget/unit-tracker.h6
95 files changed, 778 insertions, 995 deletions
diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt
index efdb279b4..be13d9b1b 100644
--- a/src/ui/CMakeLists.txt
+++ b/src/ui/CMakeLists.txt
@@ -5,10 +5,10 @@ set(ui_SRC
dialog-events.cpp
draw-anchor.cpp
interface.cpp
- object-edit.cpp
previewholder.cpp
selected-color.cpp
shape-editor.cpp
+ shape-editor-knotholders.cpp
tool-factory.cpp
tools-switch.cpp
uxmanager.cpp
@@ -185,7 +185,6 @@ set(ui_SRC
event-debug.h
icon-names.h
interface.h
- object-edit.h
previewable.h
previewfillable.h
previewholder.h
diff --git a/src/ui/cache/makefile.in b/src/ui/cache/makefile.in
deleted file mode 100644
index af45adb0f..000000000
--- a/src/ui/cache/makefile.in
+++ /dev/null
@@ -1,17 +0,0 @@
-# Convenience stub makefile to call the real Makefile.
-
-@SET_MAKE@
-
-OBJEXT = @OBJEXT@
-
-# Explicit so that it's the default rule.
-all:
- cd ../.. && $(MAKE) ui/cache/all
-
-clean %.a %.$(OBJEXT):
- cd ../.. && $(MAKE) ui/cache/$@
-
-.PHONY: all clean
-
-.SUFFIXES:
-.SUFFIXES: .a .$(OBJEXT)
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp
index 3cc8ac098..33ad4401c 100644
--- a/src/ui/clipboard.cpp
+++ b/src/ui/clipboard.cpp
@@ -105,6 +105,7 @@ public:
virtual bool pastePathEffect(ObjectSet *set);
virtual Glib::ustring getPathParameter(SPDesktop* desktop);
virtual Glib::ustring getShapeOrTextObjectId(SPDesktop *desktop);
+ virtual std::vector<Glib::ustring> getElementsOfType(SPDesktop *desktop, gchar const *type);
virtual const gchar *getFirstObjectID();
ClipboardManagerImpl();
@@ -653,6 +654,54 @@ Glib::ustring ClipboardManagerImpl::getShapeOrTextObjectId(SPDesktop *desktop)
}
/**
+ * Get all objects id from the clipboard.
+ * @return A vector containing all IDs or empty if no shape or text item was found.
+ * type. Set to "*" to retrive all elements of the types vector inside, feel free to populate more
+ */
+std::vector<Glib::ustring> ClipboardManagerImpl::getElementsOfType(SPDesktop *desktop, gchar const* type)
+{
+ std::vector<Glib::ustring> result;
+ SPDocument *tempdoc = _retrieveClipboard(); // any target will do here
+ if ( tempdoc == NULL ) {
+ _userWarn(desktop, _("Nothing on the clipboard."));
+ return result;
+ }
+ Inkscape::XML::Node *root = tempdoc->getReprRoot();
+
+ // 1293979: strip out the defs of the document
+ root->removeChild(tempdoc->getDefs()->getRepr());
+ std::vector<Inkscape::XML::Node const *> reprs;
+ if (strcmp(type, "*") == 0){
+ //TODO:Fill vector with all posible elements
+ std::vector<Glib::ustring> types;
+ types.push_back((Glib::ustring)"svg:path");
+ types.push_back((Glib::ustring)"svg:circle");
+ types.push_back((Glib::ustring)"svg:rect");
+ types.push_back((Glib::ustring)"svg:ellipse");
+ types.push_back((Glib::ustring)"svg:text");
+ types.push_back((Glib::ustring)"svg:g");
+ types.push_back((Glib::ustring)"svg:image");
+ for (auto i=types.begin();i!=types.end();++i) {
+ Glib::ustring type_elem = *i;
+ std::vector<Inkscape::XML::Node const *> reprs_found = sp_repr_lookup_name_many(root, type_elem.c_str(), -1); // unlimited search depth
+ reprs.insert(reprs.end(), reprs_found.begin(), reprs_found.end());
+ }
+ } else {
+ reprs = sp_repr_lookup_name_many(root, type, -1); // unlimited search depth
+ }
+ for (auto i=reprs.begin();i!=reprs.end();++i) {
+ Inkscape::XML::Node const * node = *i;
+ result.push_back(node->attribute("id"));
+ }
+ if ( result.empty() ) {
+ _userWarn(desktop, ((Glib::ustring)_("Clipboard does not contain any.") + (Glib::ustring)type).c_str());
+ tempdoc->doUnref();
+ return result;
+ }
+ return result;
+}
+
+/**
* Iterate over a list of items and copy them to the clipboard.
*/
void ClipboardManagerImpl::_copySelection(ObjectSet *selection)
diff --git a/src/ui/clipboard.h b/src/ui/clipboard.h
index 32a49867c..390830bba 100644
--- a/src/ui/clipboard.h
+++ b/src/ui/clipboard.h
@@ -51,6 +51,7 @@ public:
virtual bool pastePathEffect(ObjectSet *set) = 0;
virtual Glib::ustring getPathParameter(SPDesktop* desktop) = 0;
virtual Glib::ustring getShapeOrTextObjectId(SPDesktop *desktop) = 0;
+ virtual std::vector<Glib::ustring> getElementsOfType(SPDesktop *desktop, gchar const* type = "*") = 0;
virtual const gchar *getFirstObjectID() = 0;
static ClipboardManager *get();
diff --git a/src/ui/contextmenu.cpp b/src/ui/contextmenu.cpp
index 1bc87574e..3ca752c82 100644
--- a/src/ui/contextmenu.cpp
+++ b/src/ui/contextmenu.cpp
@@ -253,7 +253,7 @@ context_menu_item_on_my_deselect(void */*object*/, SPAction *action)
// TODO: Update this to allow radio items to be used
-void ContextMenu::AppendItemFromVerb(Inkscape::Verb *verb)//, SPDesktop *view)//, bool radio, GSList *group)
+void ContextMenu::AppendItemFromVerb(Inkscape::Verb *verb)
{
SPAction *action;
SPDesktop *view = _desktop;
diff --git a/src/ui/control-manager.cpp b/src/ui/control-manager.cpp
index d0285e467..d0106bfcd 100644
--- a/src/ui/control-manager.cpp
+++ b/src/ui/control-manager.cpp
@@ -330,10 +330,12 @@ void ControlManagerImpl::setSelected(SPCanvasItem *item, bool selected)
if (selected && _resizeOnSelect.count(item->ctrlType)) {
item->ctrlResize = 2;
+ } else {
+ item->ctrlResize = 0;
}
// TODO refresh colors
- double targetSize = _sizeTable[item->ctrlType][_size - 1] + _resize;
+ double targetSize = _sizeTable[item->ctrlType][_size - 1] + item->ctrlResize;
g_object_set(item, "size", targetSize, NULL);
}
}
diff --git a/src/ui/control-manager.h b/src/ui/control-manager.h
index 3f090d0bd..418591991 100644
--- a/src/ui/control-manager.h
+++ b/src/ui/control-manager.h
@@ -76,11 +76,7 @@ public:
private:
ControlManager();
-#if __cplusplus <= 199711L
- std::auto_ptr<ControlManagerImpl> _impl;
-#else
std::unique_ptr<ControlManagerImpl> _impl;
-#endif
friend class ControlManagerImpl;
};
diff --git a/src/ui/dialog-events.cpp b/src/ui/dialog-events.cpp
index d7d56fa50..cf11490f3 100644
--- a/src/ui/dialog-events.cpp
+++ b/src/ui/dialog-events.cpp
@@ -100,7 +100,7 @@ sp_dialog_event_handler (GtkWindow *win, GdkEvent *event, gpointer data)
case GDK_KEY_PRESS:
- switch (Inkscape::UI::Tools::get_group0_keyval (&event->key)) {
+ switch (Inkscape::UI::Tools::get_latin_keyval (&event->key)) {
case GDK_KEY_Escape:
sp_dialog_defocus (win);
ret = TRUE;
diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp
index ad13ed8c4..71edcf259 100644
--- a/src/ui/dialog/clonetiler.cpp
+++ b/src/ui/dialog/clonetiler.cpp
@@ -1993,18 +1993,16 @@ void CloneTiler::remove(bool do_undo/* = true*/)
SPObject *parent = obj->parent;
// remove old tiling
- GSList *to_delete = NULL;
+ std::vector<SPObject *> to_delete;
for (auto& child: parent->children) {
if (is_a_clone_of (&child, obj)) {
- to_delete = g_slist_prepend (to_delete, &child);
+ to_delete.push_back(&child);
}
}
- for (GSList *i = to_delete; i; i = i->next) {
- SPObject *obj = reinterpret_cast<SPObject *>(i->data);
+ for (auto obj:to_delete) {
g_assert(obj != NULL);
obj->deleteObject();
}
- g_slist_free (to_delete);
change_selection (selection);
@@ -2639,11 +2637,10 @@ void CloneTiler::reset_recursive(GtkWidget *w)
}
if (GTK_IS_CONTAINER(w)) {
- GList *ch = gtk_container_get_children (GTK_CONTAINER(w));
- for (GList *i = ch; i != NULL; i = i->next) {
- reset_recursive (GTK_WIDGET(i->data));
+ std::vector<Gtk::Widget*> c = Glib::wrap(GTK_CONTAINER(w))->get_children();
+ for ( auto i : c ) {
+ reset_recursive(i->gobj());
}
- g_list_free (ch);
}
}
diff --git a/src/ui/dialog/dialog.cpp b/src/ui/dialog/dialog.cpp
index 9037e8377..e50824c7b 100644
--- a/src/ui/dialog/dialog.cpp
+++ b/src/ui/dialog/dialog.cpp
@@ -257,7 +257,7 @@ bool Dialog::_onEvent(GdkEvent *event)
switch (event->type) {
case GDK_KEY_PRESS: {
- switch (Inkscape::UI::Tools::get_group0_keyval (&event->key)) {
+ switch (Inkscape::UI::Tools::get_latin_keyval (&event->key)) {
case GDK_KEY_Escape: {
_defocus();
ret = true;
diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp
index 56f3a29c0..d878b50a4 100644
--- a/src/ui/dialog/export.cpp
+++ b/src/ui/dialog/export.cpp
@@ -27,10 +27,6 @@
#include <gtkmm/grid.h>
#include <gtkmm/spinbutton.h>
-#ifdef WITH_GNOME_VFS
-# include <libgnomevfs/gnome-vfs-init.h> // gnome_vfs_initialized
-#endif
-
#include <glibmm/i18n.h>
#include <glibmm/miscutils.h>
@@ -1300,11 +1296,7 @@ void Export::onBrowse ()
_("_Save"), GTK_RESPONSE_ACCEPT,
NULL );
-#ifdef WITH_GNOME_VFS
- if (gnome_vfs_initialized()) {
- gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(fs), false);
- }
-#endif
+ gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(fs), false);
sp_transientize (fs);
diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp
index b69e9ce97..64f6c98c6 100644
--- a/src/ui/dialog/filedialogimpl-gtkmm.cpp
+++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp
@@ -31,10 +31,6 @@
#include "path-prefix.h"
#include "preferences.h"
-#ifdef WITH_GNOME_VFS
-#include <libgnomevfs/gnome-vfs.h>
-#endif
-
#include <gtkmm/expander.h>
#include <glibmm/convert.h>
@@ -663,11 +659,9 @@ void FileDialogBaseGtk::_updatePreviewCallback()
Glib::ustring fileName = get_preview_filename();
bool enabled = previewCheckbox.get_active();
-#ifdef WITH_GNOME_VFS
- if (fileName.empty() && gnome_vfs_initialized()) {
+ if (fileName.empty()) {
fileName = get_preview_uri();
}
-#endif
if (enabled && !fileName.empty()) {
svgPreview.set(fileName, _dialogType);
@@ -698,11 +692,7 @@ FileOpenDialogImplGtk::FileOpenDialogImplGtk(Gtk::Window &parentWindow, const Gl
set_select_multiple(true);
}
-#ifdef WITH_GNOME_VFS
- if (gnome_vfs_initialized()) {
- set_local_only(false);
- }
-#endif
+ set_local_only(false);
/* Initalize to Autodetect */
extension = NULL;
@@ -883,10 +873,11 @@ bool FileOpenDialogImplGtk::show()
extension = extensionMap[gtk_file_filter_get_name(filter)];
}
myFilename = get_filename();
-#ifdef WITH_GNOME_VFS
- if (myFilename.empty() && gnome_vfs_initialized())
+
+ if (myFilename.empty()) {
myFilename = get_uri();
-#endif
+ }
+
cleanup(true);
return true;
} else {
@@ -928,10 +919,10 @@ std::vector<Glib::ustring> FileOpenDialogImplGtk::getFilenames()
for (auto it : result_tmp)
result.push_back(it);
-#ifdef WITH_GNOME_VFS
- if (result.empty() && gnome_vfs_initialized())
+ if (result.empty()) {
result = get_uris();
-#endif
+ }
+
return result;
}
@@ -963,11 +954,7 @@ FileSaveDialogImplGtk::FileSaveDialogImplGtk(Gtk::Window &parentWindow, const Gl
/* One file at a time */
set_select_multiple(false);
-#ifdef WITH_GNOME_VFS
- if (gnome_vfs_initialized()) {
- set_local_only(false);
- }
-#endif
+ set_local_only(false);
/* Initalize to Autodetect */
extension = NULL;
@@ -1310,11 +1297,11 @@ void FileSaveDialogImplGtk::updateNameAndExtension()
{
// Pick up any changes the user has typed in.
Glib::ustring tmp = get_filename();
-#ifdef WITH_GNOME_VFS
- if (tmp.empty() && gnome_vfs_initialized()) {
+
+ if (tmp.empty()) {
tmp = get_uri();
}
-#endif
+
if (!tmp.empty()) {
myFilename = tmp;
}
@@ -1449,11 +1436,7 @@ FileExportDialogImpl::FileExportDialogImpl(Gtk::Window &parentWindow, const Glib
/* One file at a time */
set_select_multiple(false);
-#ifdef WITH_GNOME_VFS
- if (gnome_vfs_initialized()) {
- set_local_only(false);
- }
-#endif
+ set_local_only(false);
/* Initalize to Autodetect */
extension = NULL;
@@ -1634,11 +1617,10 @@ bool FileExportDialogImpl::show()
extension = type.extension;
}
myFilename = get_filename();
-#ifdef WITH_GNOME_VFS
- if (myFilename.empty() && gnome_vfs_initialized()) {
+
+ if (myFilename.empty()) {
myFilename = get_uri();
}
-#endif
/*
diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp
index 4fb8089ee..7f0bf58c5 100644
--- a/src/ui/dialog/filedialogimpl-win32.cpp
+++ b/src/ui/dialog/filedialogimpl-win32.cpp
@@ -1781,6 +1781,7 @@ void FileSaveDialogImplWin32::GetSaveFileName_thread()
ofn.lpstrFilter = _filter;
ofn.nFilterIndex = _filter_index;
ofn.lpfnHook = GetSaveFileName_hookproc;
+ ofn.lpstrDefExt = L"svg\0";
ofn.lCustData = (LPARAM)this;
_result = GetSaveFileNameW(&ofn) != 0;
diff --git a/src/ui/dialog/grid-arrange-tab.cpp b/src/ui/dialog/grid-arrange-tab.cpp
index 3cbc1b6e9..c16e60c5f 100644
--- a/src/ui/dialog/grid-arrange-tab.cpp
+++ b/src/ui/dialog/grid-arrange-tab.cpp
@@ -298,15 +298,14 @@ g_print("\n row = %f col = %f selection x= %f selection y = %f", total_row_h
std::vector<SPItem*>::iterator it = sorted.begin();
for (row_cnt=0; ((it != sorted.end()) && (row_cnt<NoOfRows)); ++row_cnt) {
- GSList *current_row = NULL;
+ std::vector<SPItem *> current_row;
col_cnt = 0;
for(;it!=sorted.end()&&col_cnt<NoOfCols;++it) {
- current_row = g_slist_append (current_row, *it);
+ current_row.push_back(*it);
col_cnt++;
}
- for (; current_row != NULL; current_row = current_row->next) {
- SPItem *item=SP_ITEM(current_row->data);
+ for (auto item:current_row) {
Inkscape::XML::Node *repr = item->getRepr();
Geom::OptRect b = item->documentVisualBounds();
Geom::Point min;
@@ -329,11 +328,10 @@ g_print("\n row = %f col = %f selection x= %f selection y = %f", total_row_h
Geom::Point move = Geom::Point(new_x - min[Geom::X], min[Geom::Y] - new_y);
Geom::Affine const affine = Geom::Affine(Geom::Translate(move));
item->set_i2d_affine(item->i2dt_affine() * affine);
- item->doWriteTransform(repr, item->transform, NULL);
- SP_OBJECT (current_row->data)->updateRepr();
+ item->doWriteTransform(item->transform);
+ item->updateRepr();
cnt +=1;
}
- g_slist_free (current_row);
}
DocumentUndo::done(desktop->getDocument(), SP_VERB_SELECTION_ARRANGE,
diff --git a/src/ui/dialog/icon-preview.cpp b/src/ui/dialog/icon-preview.cpp
index 991139aa8..f9cd8929a 100644
--- a/src/ui/dialog/icon-preview.cpp
+++ b/src/ui/dialog/icon-preview.cpp
@@ -18,7 +18,6 @@
#endif
#include <gtkmm/buttonbox.h>
-#include <boost/scoped_ptr.hpp>
#include <glibmm/i18n.h>
#include <glibmm/timer.h>
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp
index 2ccffd7bc..4aaa0cbe4 100644
--- a/src/ui/dialog/inkscape-preferences.cpp
+++ b/src/ui/dialog/inkscape-preferences.cpp
@@ -22,6 +22,8 @@
#include <glibmm/miscutils.h>
#include <glibmm/markup.h>
#include <gtkmm/main.h>
+#include <gtkmm/recentmanager.h>
+#include <gtkmm/recentinfo.h>
#include "preferences.h"
#include "verbs.h"
@@ -498,11 +500,20 @@ void InkscapePreferences::initPageTools()
_page_text.add_group_header( _("Text units"));
_font_unit_type.init( "/options/font/unitType", sizeLabels, sizeValues, G_N_ELEMENTS(sizeLabels), SP_CSS_UNIT_PT );
- _page_text.add_line( false, _("Text size unit type:"), _font_unit_type, "",
+ _page_text.add_line( true, _("Text size unit type:"), _font_unit_type, "",
_("Set the type of unit used in the text toolbar and text dialogs"), false);
_font_output_px.init ( _("Always output text size in pixels (px)"), "/options/font/textOutputPx", true);
// _page_text.add_line( false, "", _font_output_px, "", _("Always convert the text size units above into pixels (px) before saving to file"));
+ _page_text.add_group_header( _("Font directories"));
+ _font_fontsdir_system.init( _("Use Inkscape's fonts directory"), "/options/font/use_fontsdir_system", true);
+ _page_text.add_line( true, "", _font_fontsdir_system, "", _("Load additional fonts from \"fonts\" directory located in Inkscape's global \"share\" directory"));
+ _font_fontsdir_user.init( _("Use user's fonts directory"), "/options/font/use_fontsdir_user", true);
+ _page_text.add_line( true, "", _font_fontsdir_user, "", _("Load additional fonts from \"fonts\" directory located in Inkscape's user configuration directory"));
+ _font_fontdirs_custom.init("/options/font/custom_fontdirs", 50);
+ _page_text.add_line(true, _("Additional font directories"), _font_fontdirs_custom, "", _("Load additional fonts from custom locations (one path per line)"), true);
+
+
this->AddNewObjectsStyle(_page_text, "/tools/text");
//Spray
@@ -1959,12 +1970,7 @@ void InkscapePreferences::initPageSpellcheck()
static void appendList( Glib::ustring& tmp, const gchar* const*listing )
{
- bool first = true;
for (const gchar* const* ptr = listing; *ptr; ptr++) {
- if (!first) {
- tmp += " ";
- }
- first = false;
tmp += *ptr;
tmp += "\n";
}
@@ -1980,77 +1986,64 @@ void InkscapePreferences::initPageSystem()
_page_system.add_line( false, "", _misc_namedicon_delay, "",
_("When on, named icons will be rendered before displaying the ui. This is for working around bugs in GTK+ named icon notification"), true);
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- {
- // TRANSLATORS: following strings are paths in Inkscape preferences - Misc - System info
-
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
-
- _page_system.add_group_header( _("System info"));
-
- _sys_user_config.set_text((char const *)Inkscape::IO::Resource::profile_path(""));
- _sys_user_config.set_editable(false);
- _page_system.add_line(true, _("User config: "), _sys_user_config, "", _("Location of users configuration"), true);
-
- _sys_user_prefs.set_text(prefs->getPrefsFilename());
- _sys_user_prefs.set_editable(false);
- _page_system.add_line(true, _("User preferences: "), _sys_user_prefs, "", _("Location of the users preferences file"), true);
+ _page_system.add_group_header( _("System info"));
- _sys_user_extension_dir.set_text((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::EXTENSIONS, ""));
- _sys_user_extension_dir.set_editable(false);
- _page_system.add_line(true, _("User extensions: "), _sys_user_extension_dir, "", _("Location of the users extensions"), true);
+ _sys_user_config.set_text((char const *)Inkscape::IO::Resource::profile_path(""));
+ _sys_user_config.set_editable(false);
+ _page_system.add_line(true, _("User config: "), _sys_user_config, "", _("Location of users configuration"), true);
- _sys_user_cache.set_text(g_get_user_cache_dir());
- _sys_user_cache.set_editable(false);
- _page_system.add_line(true, _("User cache: "), _sys_user_cache, "", _("Location of users cache"), true);
+ _sys_user_prefs.set_text(prefs->getPrefsFilename());
+ _sys_user_prefs.set_editable(false);
+ _page_system.add_line(true, _("User preferences: "), _sys_user_prefs, "", _("Location of the users preferences file"), true);
- Glib::ustring tmp_dir = prefs->getString("/options/autosave/path");
- if (tmp_dir.empty()) {
- tmp_dir = Glib::get_tmp_dir();
- }
- _sys_tmp_files.set_text(tmp_dir);
- _sys_tmp_files.set_editable(false);
- _page_system.add_line(true, _("Temporary files: "), _sys_tmp_files, "", _("Location of the temporary files used for autosave"), true);
-
- _sys_data.set_text( INKSCAPE_DATADIR );
- _sys_data.set_editable(false);
- _page_system.add_line(true, _("Inkscape data: "), _sys_data, "", _("Location of Inkscape data"), true);
-
- _sys_extension_dir.set_text(INKSCAPE_EXTENSIONDIR);
- _sys_extension_dir.set_editable(false);
- _page_system.add_line(true, _("Inkscape extensions: "), _sys_extension_dir, "", _("Location of the Inkscape extensions"), true);
-
- Glib::ustring tmp;
- appendList( tmp, g_get_system_data_dirs() );
- _sys_systemdata.get_buffer()->insert(_sys_systemdata.get_buffer()->end(), tmp);
- _sys_systemdata.set_editable(false);
- _sys_systemdata_scroll.add(_sys_systemdata);
- _sys_systemdata_scroll.set_size_request(0, 80);
- _sys_systemdata_scroll.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
- _page_system.add_line(true, _("System data: "), _sys_systemdata_scroll, "", _("Locations of system data"), true);
+ _sys_user_extension_dir.set_text((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::EXTENSIONS, ""));
+ _sys_user_extension_dir.set_editable(false);
+ _page_system.add_line(true, _("User extensions: "), _sys_user_extension_dir, "", _("Location of the users extensions"), true);
- {
- tmp = "";
- gchar** paths = 0;
- gint count = 0;
- gtk_icon_theme_get_search_path(gtk_icon_theme_get_default(), &paths, &count);
- if (count > 0) {
- tmp += paths[0];
- tmp += "\n";
- for (int i = 1; i < count; i++) {
- tmp += " ";
- tmp += paths[i];
- tmp += "\n";
- }
- }
- }
+ _sys_user_cache.set_text(g_get_user_cache_dir());
+ _sys_user_cache.set_editable(false);
+ _page_system.add_line(true, _("User cache: "), _sys_user_cache, "", _("Location of users cache"), true);
- _sys_icon.get_buffer()->insert(_sys_icon.get_buffer()->end(), tmp);
+ Glib::ustring tmp_dir = prefs->getString("/options/autosave/path");
+ if (tmp_dir.empty()) {
+ tmp_dir = Glib::get_tmp_dir();
}
+ _sys_tmp_files.set_text(tmp_dir);
+ _sys_tmp_files.set_editable(false);
+ _page_system.add_line(true, _("Temporary files: "), _sys_tmp_files, "", _("Location of the temporary files used for autosave"), true);
+
+ _sys_data.set_text( INKSCAPE_DATADIR );
+ _sys_data.set_editable(false);
+ _page_system.add_line(true, _("Inkscape data: "), _sys_data, "", _("Location of Inkscape data"), true);
+
+ _sys_extension_dir.set_text(INKSCAPE_EXTENSIONDIR);
+ _sys_extension_dir.set_editable(false);
+ _page_system.add_line(true, _("Inkscape extensions: "), _sys_extension_dir, "", _("Location of the Inkscape extensions"), true);
+
+ Glib::ustring tmp;
+ appendList( tmp, g_get_system_data_dirs() );
+ _sys_systemdata.get_buffer()->insert(_sys_systemdata.get_buffer()->end(), tmp);
+ _sys_systemdata.set_editable(false);
+ _sys_systemdata_scroll.add(_sys_systemdata);
+ _sys_systemdata_scroll.set_size_request(100, 80);
+ _sys_systemdata_scroll.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
+ _sys_systemdata_scroll.set_shadow_type(Gtk::SHADOW_IN);
+ _page_system.add_line(true, _("System data: "), _sys_systemdata_scroll, "", _("Locations of system data"), true);
+
+ tmp = "";
+ gchar** paths = 0;
+ gint count = 0;
+ gtk_icon_theme_get_search_path(gtk_icon_theme_get_default(), &paths, &count);
+ appendList( tmp, paths );
+ g_strfreev(paths);
+ _sys_icon.get_buffer()->insert(_sys_icon.get_buffer()->end(), tmp);
_sys_icon.set_editable(false);
_sys_icon_scroll.add(_sys_icon);
- _sys_icon_scroll.set_size_request(0, 80);
+ _sys_icon_scroll.set_size_request(100, 80);
_sys_icon_scroll.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
+ _sys_icon_scroll.set_shadow_type(Gtk::SHADOW_IN);
_page_system.add_line(true, _("Icon theme: "), _sys_icon_scroll, "", _("Locations of icon themes"), true);
this->AddPage(_page_system, _("System"), PREFS_PAGE_SYSTEM);
@@ -2097,21 +2090,15 @@ bool InkscapePreferences::PresentPage(const Gtk::TreeModel::iterator& iter)
void InkscapePreferences::on_reset_open_recent_clicked()
{
- GtkRecentManager* manager = gtk_recent_manager_get_default();
- GList* recent_list = gtk_recent_manager_get_items(manager);
- GList* element;
- GError* error;
+ Glib::RefPtr<Gtk::RecentManager> manager = Gtk::RecentManager::get_default();
+ std::vector< Glib::RefPtr< Gtk::RecentInfo > > recent_list = manager->get_items();
//Remove only elements that were added by Inkscape
- for (element = g_list_first(recent_list); element; element = g_list_next(element)){
- error = NULL;
- GtkRecentInfo* info = (GtkRecentInfo*) element->data;
- if (gtk_recent_info_has_application(info, g_get_prgname())){
- gtk_recent_manager_remove_item(manager, gtk_recent_info_get_uri(info), &error);
+ for (auto e : recent_list) {
+ if (e->has_application(g_get_prgname())) {
+ manager->remove_item(e->get_uri());
}
- gtk_recent_info_unref (info);
}
- g_list_free(recent_list);
}
void InkscapePreferences::on_pagelist_selection_changed()
diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h
index 50465a9ec..a197a8e65 100644
--- a/src/ui/dialog/inkscape-preferences.h
+++ b/src/ui/dialog/inkscape-preferences.h
@@ -328,6 +328,9 @@ protected:
UI::Widget::PrefCheckButton _font_dialog;
UI::Widget::PrefCombo _font_unit_type;
UI::Widget::PrefCheckButton _font_output_px;
+ UI::Widget::PrefCheckButton _font_fontsdir_system;
+ UI::Widget::PrefCheckButton _font_fontsdir_user;
+ UI::Widget::PrefMultiEntry _font_fontdirs_custom;
UI::Widget::PrefCheckButton _misc_comment;
UI::Widget::PrefCheckButton _misc_default_metadata;
diff --git a/src/ui/dialog/knot-properties.cpp b/src/ui/dialog/knot-properties.cpp
index b094dc0e7..29e1cb2bb 100644
--- a/src/ui/dialog/knot-properties.cpp
+++ b/src/ui/dialog/knot-properties.cpp
@@ -151,7 +151,7 @@ KnotPropertiesDialog::_close()
bool KnotPropertiesDialog::_handleKeyEvent(GdkEventKey * /*event*/)
{
- /*switch (get_group0_keyval(event)) {
+ /*switch (get_latin_keyval(event)) {
case GDK_KEY_Return:
case GDK_KEY_KP_Enter: {
_apply();
diff --git a/src/ui/dialog/layer-properties.cpp b/src/ui/dialog/layer-properties.cpp
index 562484022..4ab6e130e 100644
--- a/src/ui/dialog/layer-properties.cpp
+++ b/src/ui/dialog/layer-properties.cpp
@@ -290,7 +290,7 @@ SPObject* LayerPropertiesDialog::_selectedLayer()
bool LayerPropertiesDialog::_handleKeyEvent(GdkEventKey *event)
{
- switch (Inkscape::UI::Tools::get_group0_keyval(event)) {
+ switch (Inkscape::UI::Tools::get_latin_keyval(event)) {
case GDK_KEY_Return:
case GDK_KEY_KP_Enter: {
_strategy->perform(*this);
diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp
index 3c99d1461..6223bd627 100644
--- a/src/ui/dialog/layers.cpp
+++ b/src/ui/dialog/layers.cpp
@@ -542,7 +542,7 @@ void LayersPanel::_toggled( Glib::ustring const& str, int targetCol )
bool LayersPanel::_handleKeyEvent(GdkEventKey *event)
{
- switch (Inkscape::UI::Tools::get_group0_keyval(event)) {
+ switch (Inkscape::UI::Tools::get_latin_keyval(event)) {
case GDK_KEY_Return:
case GDK_KEY_KP_Enter:
case GDK_KEY_F2: {
@@ -713,12 +713,12 @@ void LayersPanel::_doTreeMove( )
{
if (_dnd_source && _dnd_source->getRepr() ) {
if(!_dnd_target){
- _dnd_source->doWriteTransform(_dnd_source->getRepr(), _dnd_source->i2doc_affine() * _dnd_source->document->getRoot()->i2doc_affine().inverse());
+ _dnd_source->doWriteTransform(_dnd_source->i2doc_affine() * _dnd_source->document->getRoot()->i2doc_affine().inverse());
}else{
SPItem* parent = _dnd_into ? _dnd_target : dynamic_cast<SPItem*>(_dnd_target->parent);
if(parent){
Geom::Affine move = _dnd_source->i2doc_affine() * parent->i2doc_affine().inverse();
- _dnd_source->doWriteTransform(_dnd_source->getRepr(), move);
+ _dnd_source->doWriteTransform(move);
}
}
_dnd_source->moveTo(_dnd_target, _dnd_into);
diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp
index 98789f7b2..28a42929b 100644
--- a/src/ui/dialog/livepatheffect-editor.cpp
+++ b/src/ui/dialog/livepatheffect-editor.cpp
@@ -206,9 +206,11 @@ LivePathEffectEditor::showParams(LivePathEffect::Effect& effect)
if (defaultswidget) {
Gtk::Expander * expander = NULL;
std::vector<Gtk::Widget *> childs = dynamic_cast<Gtk::Box *> (effectwidget)->get_children();
- std::vector<Gtk::Widget *> childs_default = dynamic_cast<Gtk::Box *> (childs[childs.size()-1])->get_children();
- if ((expander = dynamic_cast<Gtk::Expander *>(childs_default[childs_default.size()-1]))){
- expanderopen = expander->get_expanded();
+ if (childs.size()) {
+ std::vector<Gtk::Widget *> childs_default = dynamic_cast<Gtk::Box *> (childs[childs.size()-1])->get_children();
+ if ((expander = dynamic_cast<Gtk::Expander *>(childs_default[childs_default.size()-1]))){
+ expanderopen = expander->get_expanded();
+ }
}
}
effectcontrol_vbox.remove(*effectwidget);
@@ -473,7 +475,7 @@ LivePathEffectEditor::onAdd()
item = NULL;
// run sp_selection_clone_original_path_lpe
- sel->cloneOriginalPathLPE();
+ sel->cloneOriginalPathLPE(true);
SPItem *new_item = sel->singleItem();
// Check that the cloning was successful. We don't want to change the ID of the original referenced path!
diff --git a/src/ui/dialog/lpe-powerstroke-properties.cpp b/src/ui/dialog/lpe-powerstroke-properties.cpp
index 9bd98c7c0..e66229dcd 100644
--- a/src/ui/dialog/lpe-powerstroke-properties.cpp
+++ b/src/ui/dialog/lpe-powerstroke-properties.cpp
@@ -146,7 +146,7 @@ PowerstrokePropertiesDialog::_close()
bool PowerstrokePropertiesDialog::_handleKeyEvent(GdkEventKey * /*event*/)
{
- /*switch (get_group0_keyval(event)) {
+ /*switch (get_latin_keyval(event)) {
case GDK_KEY_Return:
case GDK_KEY_KP_Enter: {
_apply();
diff --git a/src/ui/dialog/makefile.in b/src/ui/dialog/makefile.in
deleted file mode 100644
index 805c48aef..000000000
--- a/src/ui/dialog/makefile.in
+++ /dev/null
@@ -1,17 +0,0 @@
-# Convenience stub makefile to call the real Makefile.
-
-@SET_MAKE@
-
-OBJEXT = @OBJEXT@
-
-# Explicit so that it's the default rule.
-all:
- cd ../.. && $(MAKE) ui/dialog/all
-
-clean %.a %.$(OBJEXT):
- cd ../.. && $(MAKE) ui/dialog/$@
-
-.PHONY: all clean
-
-.SUFFIXES:
-.SUFFIXES: .a .$(OBJEXT)
diff --git a/src/ui/dialog/objects.cpp b/src/ui/dialog/objects.cpp
index 1e0ab9604..b50d68239 100644
--- a/src/ui/dialog/objects.cpp
+++ b/src/ui/dialog/objects.cpp
@@ -148,8 +148,8 @@ public:
_pnl->_objectsChanged( _obj );
}
}
- virtual void notifyContentChanged( Node &/*node*/, Util::ptr_shared<char> /*old_content*/, Util::ptr_shared<char> /*new_content*/ ) {}
- virtual void notifyAttributeChanged( Node &/*node*/, GQuark name, Util::ptr_shared<char> /*old_value*/, Util::ptr_shared<char> /*new_value*/ ) {
+ virtual void notifyContentChanged( Node &/*node*/, Util::ptr_shared /*old_content*/, Util::ptr_shared /*new_content*/ ) {}
+ virtual void notifyAttributeChanged( Node &/*node*/, GQuark name, Util::ptr_shared /*old_value*/, Util::ptr_shared /*new_value*/ ) {
if ( _pnl && _obj ) {
if ( name == _lockedAttr || name == _labelAttr || name == _highlightAttr || name == _groupAttr || name == _styleAttr || name == _clipAttr || name == _maskAttr ) {
_pnl->_updateObject(_obj, name == _highlightAttr);
@@ -735,7 +735,7 @@ bool ObjectsPanel::_handleKeyEvent(GdkEventKey *event)
// handle events for the treeview
bool empty = _desktop->selection->isEmpty();
- switch (Inkscape::UI::Tools::get_group0_keyval(event)) {
+ switch (Inkscape::UI::Tools::get_latin_keyval(event)) {
case GDK_KEY_Return:
case GDK_KEY_KP_Enter:
{
diff --git a/src/ui/dialog/objects.h b/src/ui/dialog/objects.h
index b7fd1b4f8..8ad1b15ef 100644
--- a/src/ui/dialog/objects.h
+++ b/src/ui/dialog/objects.h
@@ -16,7 +16,6 @@
# include <config.h>
#endif
-#include <boost/scoped_ptr.hpp>
#include <gtkmm/box.h>
#include <gtkmm/treeview.h>
#include <gtkmm/treestore.h>
@@ -168,7 +167,7 @@ private:
Gtk::Box _blur_vbox;
Gtk::Dialog _colorSelectorDialog;
- boost::scoped_ptr<Inkscape::UI::SelectedColor> _selectedColor;
+ std::unique_ptr<Inkscape::UI::SelectedColor> _selectedColor;
//Methods:
diff --git a/src/ui/dialog/polar-arrange-tab.cpp b/src/ui/dialog/polar-arrange-tab.cpp
index 2b4550d20..75e1a56b8 100644
--- a/src/ui/dialog/polar-arrange-tab.cpp
+++ b/src/ui/dialog/polar-arrange-tab.cpp
@@ -140,7 +140,7 @@ static void rotateAround(SPItem *item, Geom::Point center, Geom::Rotate const &r
center = item->getCenter();
item->set_i2d_affine(item->i2dt_affine() * affine);
- item->doWriteTransform(item->getRepr(), item->transform);
+ item->doWriteTransform(item->transform);
if(item->isCenterSet())
{
diff --git a/src/ui/dialog/print.cpp b/src/ui/dialog/print.cpp
index 4d248fd09..532a8c364 100644
--- a/src/ui/dialog/print.cpp
+++ b/src/ui/dialog/print.cpp
@@ -26,7 +26,6 @@
#include "util/units.h"
#include "helper/png-write.h"
#include "svg/svg-color.h"
-#include "io/sys.h"
#include <glibmm/i18n.h>
@@ -52,7 +51,7 @@ static void draw_page(GtkPrintOperation *,
std::string tmp_base = "inkscape-print-png-XXXXXX";
int tmp_fd;
- if ( (tmp_fd = Inkscape::IO::file_open_tmp (tmp_png, tmp_base)) >= 0) {
+ if ( (tmp_fd = Glib::file_open_tmp(tmp_png, tmp_base)) >= 0) {
close(tmp_fd);
guint32 bgcolor = 0x00000000;
diff --git a/src/ui/dialog/prototype.cpp b/src/ui/dialog/prototype.cpp
index b3bf60aab..b7c9f7abf 100644
--- a/src/ui/dialog/prototype.cpp
+++ b/src/ui/dialog/prototype.cpp
@@ -22,6 +22,8 @@ namespace Inkscape {
namespace UI {
namespace Dialog {
+// Note that in order for a dialog to be restored, it must be listed in SPDesktop::show_dialogs().
+
Prototype::Prototype() :
// UI::Widget::Panel("Prototype Label", "/dialogs/prototype", SP_VERB_DIALOG_PROTOTYPE,
// "Prototype Apply Label", true),
diff --git a/src/ui/dialog/spellcheck.cpp b/src/ui/dialog/spellcheck.cpp
index 4f7657f4f..3318b5e6b 100644
--- a/src/ui/dialog/spellcheck.cpp
+++ b/src/ui/dialog/spellcheck.cpp
@@ -50,8 +50,6 @@ namespace Dialog {
SpellCheck::SpellCheck (void) :
UI::Widget::Panel ("", "/dialogs/spellcheck/", SP_VERB_DIALOG_SPELLCHECK),
- _rects(NULL),
- _seen_objects(NULL),
_text(NULL),
_layout(NULL),
_stops(0),
@@ -196,12 +194,11 @@ void SpellCheck::setTargetDesktop(SPDesktop *desktop)
void SpellCheck::clearRects()
{
- for (GSList *it = _rects; it; it = it->next) {
- sp_canvas_item_hide(SP_CANVAS_ITEM(it->data));
- sp_canvas_item_destroy(SP_CANVAS_ITEM(it->data));
+ for(auto t : _rects) {
+ sp_canvas_item_hide(t);
+ sp_canvas_item_destroy(t);
}
- g_slist_free(_rects);
- _rects = NULL;
+ _rects.clear();
}
void SpellCheck::disconnect()
@@ -214,47 +211,39 @@ void SpellCheck::disconnect()
}
}
-GSList *SpellCheck::allTextItems (SPObject *r, GSList *l, bool hidden, bool locked)
+void SpellCheck::allTextItems (SPObject *r, std::vector<SPItem *> &l, bool hidden, bool locked)
{
if (!desktop)
- return l; // no desktop to check
+ return; // no desktop to check
if (SP_IS_DEFS(r))
- return l; // we're not interested in items in defs
+ return; // we're not interested in items in defs
if (!strcmp(r->getRepr()->name(), "svg:metadata")) {
- return l; // we're not interested in metadata
+ return; // we're not interested in metadata
}
for (auto& child: r->children) {
if (SP_IS_ITEM (&child) && !child.cloned && !desktop->isLayer(SP_ITEM(&child))) {
if ((hidden || !desktop->itemIsHidden(SP_ITEM(&child))) && (locked || !SP_ITEM(&child)->isLocked())) {
if (SP_IS_TEXT(&child) || SP_IS_FLOWTEXT(&child))
- l = g_slist_prepend (l, &child);
+ l.push_back(static_cast<SPItem*>(&child));
}
}
- l = allTextItems (&child, l, hidden, locked);
+ allTextItems (&child, l, hidden, locked);
}
- return l;
+ return;
}
bool
SpellCheck::textIsValid (SPObject *root, SPItem *text)
{
- GSList *l = NULL;
- l = allTextItems (root, l, false, true);
- for (GSList *i = l; i; i = i->next) {
- SPItem *item = static_cast<SPItem *>(i->data);
- if (item == text) {
- g_slist_free (l);
- return true;
- }
- }
- g_slist_free (l);
- return false;
+ std::vector<SPItem*> l;
+ allTextItems (root, l, false, true);
+ return (std::find(l.begin(), l.end(), text) != l.end());
}
-gint SpellCheck::compareTextBboxes (gconstpointer a, gconstpointer b)
+bool SpellCheck::compareTextBboxes (gconstpointer a, gconstpointer b)//returns a<b
{
SPItem *i1 = SP_ITEM(a);
SPItem *i2 = SP_ITEM(b);
@@ -262,41 +251,28 @@ gint SpellCheck::compareTextBboxes (gconstpointer a, gconstpointer b)
Geom::OptRect bbox1 = i1->desktopVisualBounds();
Geom::OptRect bbox2 = i2->desktopVisualBounds();
if (!bbox1 || !bbox2) {
- return 0;
+ return false;
}
// vector between top left corners
Geom::Point diff = Geom::Point(bbox2->min()[Geom::X], bbox2->max()[Geom::Y]) -
Geom::Point(bbox1->min()[Geom::X], bbox1->max()[Geom::Y]);
- // sort top to bottom, left to right, but:
- // if i2 is higher only 0.2 or less times it is righter than i1, put i1 first
- if (diff[Geom::Y] > 0.2 * diff[Geom::X])
- return 1;
- else
- return -1;
-
- return 0;
+ return diff[Geom::Y] == 0 ? (diff[Geom::X] < 0) : (diff[Geom::Y] < 0);
}
// We regenerate and resort the list every time, because user could have changed it while the
// dialog was waiting
SPItem *SpellCheck::getText (SPObject *root)
{
- GSList *l = NULL;
- l = allTextItems (root, l, false, true);
- l = g_slist_sort(l, (GCompareFunc)SpellCheck::compareTextBboxes);
-
- for (GSList *i = l; i; i = i->next) {
- SPItem *item = static_cast<SPItem *>(i->data);
- if (!g_slist_find (_seen_objects, item)) {
- _seen_objects = g_slist_prepend(_seen_objects, item);
- g_slist_free(l);
+ std::vector<SPItem*> l;
+ allTextItems (root, l, false, true);
+ std::sort(l.begin(),l.end(),SpellCheck::compareTextBboxes);
+
+ for (auto item:l) {
+ if(_seen_objects.insert(item).second)
return item;
- }
}
-
- g_slist_free(l);
return NULL;
}
@@ -402,8 +378,7 @@ SpellCheck::init(SPDesktop *d)
_root = desktop->getDocument()->getRoot();
// empty the list of objects we've checked
- g_slist_free (_seen_objects);
- _seen_objects = NULL;
+ _seen_objects.clear();
// grab first text
nextText();
@@ -456,8 +431,7 @@ SpellCheck::finished ()
g_free(label);
}
- g_slist_free(_seen_objects);
- _seen_objects = NULL;
+ _seen_objects.clear();
desktop = NULL;
_root = NULL;
@@ -615,7 +589,7 @@ SpellCheck::nextWord()
curve->lineto(area.corner(0));
sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(rect), curve);
sp_canvas_item_show(rect);
- _rects = g_slist_prepend(_rects, rect);
+ _rects.push_back(rect);
// scroll to make it all visible
Geom::Point const center = desktop->get_display_area().midpoint();
@@ -707,10 +681,10 @@ SpellCheck::nextWord()
void
SpellCheck::deleteLastRect ()
{
- if (_rects) {
- sp_canvas_item_hide(SP_CANVAS_ITEM(_rects->data));
- sp_canvas_item_destroy(SP_CANVAS_ITEM(_rects->data));
- _rects = _rects->next; // pop latest-prepended rect
+ if (!_rects.empty()) {
+ sp_canvas_item_hide(_rects.back());
+ sp_canvas_item_destroy(_rects.back());
+ _rects.pop_back(); // pop latest-prepended rect
}
}
@@ -861,7 +835,6 @@ SpellCheck::onStart ()
}
}
-
/*
Local Variables:
mode:c++
diff --git a/src/ui/dialog/spellcheck.h b/src/ui/dialog/spellcheck.h
index 834f23c24..e7563ad1e 100644
--- a/src/ui/dialog/spellcheck.h
+++ b/src/ui/dialog/spellcheck.h
@@ -16,6 +16,9 @@
# include <config.h>
#endif
+#include <vector>
+#include <set>
+
#include <gtkmm/box.h>
#include <gtkmm/button.h>
#include <gtkmm/buttonbox.h>
@@ -68,7 +71,7 @@ private:
/**
* Returns a list of all the text items in the SPObject
*/
- GSList *allTextItems (SPObject *r, GSList *l, bool hidden, bool locked);
+ void allTextItems (SPObject *r, std::vector<SPItem *> &l, bool hidden, bool locked);
/**
* Is text inside the SPOject's tree
@@ -78,7 +81,7 @@ private:
/**
* Compare the visual bounds of 2 SPItems referred to by a and b
*/
- static gint compareTextBboxes (gconstpointer a, gconstpointer b);
+ static bool compareTextBboxes (gconstpointer a, gconstpointer b);
SPItem *getText (SPObject *root);
void nextText ();
@@ -165,12 +168,12 @@ private:
/**
* list of canvasitems (currently just rects) that mark misspelled things on canvas
*/
- GSList *_rects;
+ std::vector<SPCanvasItem *> _rects;
/**
* list of text objects we have already checked in this session
*/
- GSList *_seen_objects;
+ std::set<SPItem *> _seen_objects;
/**
* the object currently being checked
diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp
index aa453e8e8..60138fa89 100644
--- a/src/ui/dialog/styledialog.cpp
+++ b/src/ui/dialog/styledialog.cpp
@@ -56,8 +56,8 @@ public:
};
virtual void notifyContentChanged(Inkscape::XML::Node &node,
- Inkscape::Util::ptr_shared<char> old_content,
- Inkscape::Util::ptr_shared<char> new_content);
+ Inkscape::Util::ptr_shared old_content,
+ Inkscape::Util::ptr_shared new_content);
StyleDialog * _styleDialog;
};
@@ -66,8 +66,8 @@ public:
void
StyleDialog::NodeObserver::notifyContentChanged(
Inkscape::XML::Node &/*node*/,
- Inkscape::Util::ptr_shared<char> /*old_content*/,
- Inkscape::Util::ptr_shared<char> /*new_content*/ ) {
+ Inkscape::Util::ptr_shared /*old_content*/,
+ Inkscape::Util::ptr_shared /*new_content*/ ) {
#ifdef DEBUG_STYLEDIALOG
std::cout << "StyleDialog::NodeObserver::notifyContentChanged" << std::endl;
@@ -111,8 +111,8 @@ public:
virtual void notifyAttributeChanged( Inkscape::XML::Node &node,
GQuark qname,
- Util::ptr_shared<char> /*old_value*/,
- Util::ptr_shared<char> /*new_value*/ ) {
+ Util::ptr_shared /*old_value*/,
+ Util::ptr_shared /*new_value*/ ) {
if ( _styleDialog && _repr ) {
// For the moment only care about attributes that are directly used in selectors.
diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp
index b876fa98c..558b0b19e 100644
--- a/src/ui/dialog/symbols.cpp
+++ b/src/ui/dialog/symbols.cpp
@@ -617,52 +617,48 @@ void SymbolsDialog::get_symbols() {
}
}
-GSList* SymbolsDialog::symbols_in_doc_recursive (SPObject *r, GSList *l)
+void SymbolsDialog::symbols_in_doc_recursive (SPObject *r, std::vector<SPSymbol*> &l)
{
- g_return_val_if_fail(r != NULL, l);
+ if(!r) return;
// Stop multiple counting of same symbol
if ( dynamic_cast<SPUse *>(r) ) {
- return l;
+ return;
}
if ( dynamic_cast<SPSymbol *>(r) ) {
- l = g_slist_prepend (l, r);
+ l.push_back(dynamic_cast<SPSymbol *>(r));
}
for (auto& child: r->children) {
- l = symbols_in_doc_recursive( &child, l );
+ symbols_in_doc_recursive( &child, l );
}
-
- return l;
}
-GSList* SymbolsDialog::symbols_in_doc( SPDocument* symbolDocument ) {
+std::vector<SPSymbol*> SymbolsDialog::symbols_in_doc( SPDocument* symbolDocument )
+{
- GSList *l = NULL;
- l = symbols_in_doc_recursive (symbolDocument->getRoot(), l );
- l = g_slist_reverse( l );
+ std::vector<SPSymbol*> l;
+ symbols_in_doc_recursive (symbolDocument->getRoot(), l );
return l;
}
-GSList* SymbolsDialog::use_in_doc_recursive (SPObject *r, GSList *l)
+void SymbolsDialog::use_in_doc_recursive (SPObject *r, std::vector<SPUse*> &l)
{
if ( dynamic_cast<SPUse *>(r) ) {
- l = g_slist_prepend (l, r);
+ l.push_back(dynamic_cast<SPUse *>(r));
}
for (auto& child: r->children) {
- l = use_in_doc_recursive( &child, l );
+ use_in_doc_recursive( &child, l );
}
-
- return l;
}
-GSList* SymbolsDialog::use_in_doc( SPDocument* useDocument ) {
+std::vector<SPUse*> SymbolsDialog::use_in_doc( SPDocument* useDocument ) {
- GSList *l = NULL;
- l = use_in_doc_recursive (useDocument->getRoot(), l );
+ std::vector<SPUse*> l;
+ use_in_doc_recursive (useDocument->getRoot(), l);
return l;
}
@@ -671,10 +667,8 @@ GSList* SymbolsDialog::use_in_doc( SPDocument* useDocument ) {
gchar const* SymbolsDialog::style_from_use( gchar const* id, SPDocument* document) {
gchar const* style = 0;
- GSList* l = use_in_doc( document );
- for( ; l != NULL; l = l->next ) {
- SPObject *obj = reinterpret_cast<SPObject *>(l->data);
- SPUse *use = dynamic_cast<SPUse *>(obj);
+ std::vector<SPUse*> l = use_in_doc( document );
+ for( auto use:l ) {
if ( use ) {
gchar const *href = use->getRepr()->attribute("xlink:href");
if( href ) {
@@ -693,10 +687,8 @@ gchar const* SymbolsDialog::style_from_use( gchar const* id, SPDocument* documen
void SymbolsDialog::add_symbols( SPDocument* symbolDocument ) {
- GSList* l = symbols_in_doc( symbolDocument );
- for( ; l != NULL; l = l->next ) {
- SPObject *obj = reinterpret_cast<SPObject *>(l->data);
- SPSymbol *symbol = dynamic_cast<SPSymbol *>(obj);
+ std::vector<SPSymbol*> l = symbols_in_doc( symbolDocument );
+ for(auto symbol:l) {
if (symbol) {
add_symbol( symbol );
}
diff --git a/src/ui/dialog/symbols.h b/src/ui/dialog/symbols.h
index 5dc1e3cad..747e5c6c9 100644
--- a/src/ui/dialog/symbols.h
+++ b/src/ui/dialog/symbols.h
@@ -14,10 +14,10 @@
#define INKSCAPE_UI_DIALOG_SYMBOLS_H
#include "display/drawing.h"
-
#include "ui/dialog/desktop-tracker.h"
-
#include "ui/widget/panel.h"
+#include "sp-symbol.h"
+#include "sp-use.h"
#include <vector>
@@ -85,10 +85,10 @@ private:
void add_symbol( SPObject* symbol_document );
SPDocument* symbols_preview_doc();
- GSList* symbols_in_doc_recursive(SPObject *r, GSList *l);
- GSList* symbols_in_doc( SPDocument* document );
- GSList* use_in_doc_recursive(SPObject *r, GSList *l);
- GSList* use_in_doc( SPDocument* document );
+ void symbols_in_doc_recursive(SPObject *r, std::vector<SPSymbol*> &l);
+ std::vector<SPSymbol*> symbols_in_doc( SPDocument* document );
+ void use_in_doc_recursive(SPObject *r, std::vector<SPUse*> &l);
+ std::vector<SPUse*> use_in_doc( SPDocument* document );
gchar const* style_from_use( gchar const* id, SPDocument* document);
Glib::RefPtr<Gdk::Pixbuf> draw_symbol(SPObject *symbol);
diff --git a/src/ui/dialog/tags.cpp b/src/ui/dialog/tags.cpp
index 176719995..ae45654a7 100644
--- a/src/ui/dialog/tags.cpp
+++ b/src/ui/dialog/tags.cpp
@@ -106,8 +106,8 @@ public:
_pnl->_objectsChanged( _obj );
}
}
- virtual void notifyContentChanged( Node &/*node*/, Util::ptr_shared<char> /*old_content*/, Util::ptr_shared<char> /*new_content*/ ) {}
- virtual void notifyAttributeChanged( Node &/*node*/, GQuark name, Util::ptr_shared<char> /*old_value*/, Util::ptr_shared<char> /*new_value*/ ) {
+ virtual void notifyContentChanged( Node &/*node*/, Util::ptr_shared /*old_content*/, Util::ptr_shared /*new_content*/ ) {}
+ virtual void notifyAttributeChanged( Node &/*node*/, GQuark name, Util::ptr_shared /*old_value*/, Util::ptr_shared /*new_value*/ ) {
if ( _pnl && _obj ) {
if ( name == _labelAttr ) {
_pnl->_updateObject( _obj);
@@ -522,7 +522,7 @@ void TagsPanel::_checkTreeSelection()
bool TagsPanel::_handleKeyEvent(GdkEventKey *event)
{
- switch (Inkscape::UI::Tools::get_group0_keyval(event)) {
+ switch (Inkscape::UI::Tools::get_latin_keyval(event)) {
case GDK_KEY_Return:
case GDK_KEY_KP_Enter:
case GDK_KEY_F2: {
@@ -1103,14 +1103,6 @@ void TagsPanel::setDesktop( SPDesktop* desktop )
setDocument(_desktop, _desktop->doc());
}
}
-/*
- GSList const *layers = _desktop->doc()->getResourceList( "layer" );
- g_message( "layers list starts at %p", layers );
- for ( GSList const *iter=layers ; iter ; iter = iter->next ) {
- SPObject *layer=static_cast<SPObject *>(iter->data);
- g_message(" {%s} [%s]", layer->id, layer->label() );
- }
-*/
deskTrack.setBase(desktop);
}
diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp
index 5ad1b9ec5..8713e6ddc 100644
--- a/src/ui/dialog/transformation.cpp
+++ b/src/ui/dialog/transformation.cpp
@@ -727,7 +727,7 @@ void Transformation::applyPageScale(Inkscape::Selection *selection)
Geom::Affine scaler = get_scale_transform_for_variable_stroke (*bbox_pref, *bbox_geom, transform_stroke, preserve, x0, y0, x1, y1);
item->set_i2d_affine(item->i2dt_affine() * scaler);
- item->doWriteTransform(item->getRepr(), item->transform);
+ item->doWriteTransform(item->transform);
}
}
} else {
diff --git a/src/ui/dialog/xml-tree.cpp b/src/ui/dialog/xml-tree.cpp
index 83c0de45b..c245890bc 100644
--- a/src/ui/dialog/xml-tree.cpp
+++ b/src/ui/dialog/xml-tree.cpp
@@ -856,7 +856,7 @@ void XmlTree::on_document_uri_set(gchar const * /*uri*/, SPDocument * /*document
gboolean XmlTree::quit_on_esc (GtkWidget *w, GdkEventKey *event, GObject */*tbl*/)
{
- switch (Inkscape::UI::Tools::get_group0_keyval (event)) {
+ switch (Inkscape::UI::Tools::get_latin_keyval (event)) {
case GDK_KEY_Escape: // defocus
gtk_widget_destroy(w);
return TRUE;
diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp
index 0223b2b3b..4f1e5cd6f 100644
--- a/src/ui/interface.cpp
+++ b/src/ui/interface.cpp
@@ -25,6 +25,8 @@
#include "ui/dialog/dialog-manager.h"
#include <gtkmm/icontheme.h>
+#include <gtkmm/radiomenuitem.h>
+#include <gtkmm/separatormenuitem.h>
#include "file.h"
#include <glibmm/miscutils.h>
@@ -51,7 +53,6 @@
#include "sp-namedview.h"
#include "sp-root.h"
#include "helper/action.h"
-#include "helper/gnome-utils.h"
#include "helper/window.h"
#include "io/sys.h"
#include "ui/dialog-events.h"
@@ -109,8 +110,7 @@ static GtkTargetEntry *completeDropTargets = 0;
static int completeDropTargetsCount = 0;
static bool temporarily_block_actions = false;
-#define ENTRIES_SIZE(n) sizeof(n)/sizeof(n[0])
-static guint nui_drop_target_entries = ENTRIES_SIZE(ui_drop_target_entries);
+static guint nui_drop_target_entries = G_N_ELEMENTS(ui_drop_target_entries);
static void sp_ui_import_files(gchar *buffer);
static void sp_ui_import_one_file(char const *filename);
static void sp_ui_import_one_file_with_check(gpointer filename, gpointer unused);
@@ -221,19 +221,14 @@ sp_create_window(SPViewWidget *vw, bool editable)
if ( completeDropTargets == 0 || completeDropTargetsCount == 0 )
{
- std::vector<gchar*> types;
-
- GSList *list = gdk_pixbuf_get_formats();
- while ( list ) {
- int i = 0;
- GdkPixbufFormat *one = (GdkPixbufFormat*)list->data;
- gchar** typesXX = gdk_pixbuf_format_get_mime_types(one);
- for ( i = 0; typesXX[i]; i++ ) {
- types.push_back(g_strdup(typesXX[i]));
- }
- g_strfreev(typesXX);
+ std::vector<Glib::ustring> types;
- list = g_slist_next(list);
+ std::vector<Gdk::PixbufFormat> list = Gdk::Pixbuf::get_formats();
+ for (auto one:list) {
+ std::vector<Glib::ustring> typesXX = one.get_mime_types();
+ for (auto i:typesXX) {
+ types.push_back(i);
+ }
}
completeDropTargetsCount = nui_drop_target_entries + types.size();
completeDropTargets = new GtkTargetEntry[completeDropTargetsCount];
@@ -242,8 +237,8 @@ sp_create_window(SPViewWidget *vw, bool editable)
}
int pos = nui_drop_target_entries;
- for (std::vector<gchar*>::iterator it = types.begin() ; it != types.end() ; ++it) {
- completeDropTargets[pos].target = *it;
+ for (std::vector<Glib::ustring>::iterator it = types.begin() ; it != types.end() ; ++it) {
+ completeDropTargets[pos].target = g_strdup((*it).c_str());
completeDropTargets[pos].flags = 0;
completeDropTargets[pos].info = IMAGE_DATA;
pos++;
@@ -452,14 +447,14 @@ static GtkWidget *sp_ui_menu_append_item_from_verb(GtkMenu *men
Inkscape::UI::View::View *view,
bool show_icon = false,
bool radio = false,
- GSList *group = NULL)
+ Gtk::RadioMenuItem::Group *group = NULL)
{
- GtkWidget *item;
+ Gtk::Widget *item;
// Just create a menu separator if this isn't a real action.
// Otherwise, create a real menu item
if (verb->get_code() == SP_VERB_NONE) {
- item = gtk_separator_menu_item_new();
+ item = new Gtk::SeparatorMenuItem();
} else {
SPAction *action = verb->get_action(Inkscape::ActionContext(view));
@@ -468,9 +463,9 @@ static GtkWidget *sp_ui_menu_append_item_from_verb(GtkMenu *men
// Create the menu item itself, either as a radio menu item, or just
// a regular menu item depending on whether the "radio" flag is set
if (radio) {
- item = gtk_radio_menu_item_new(group);
+ item = new Gtk::RadioMenuItem(*group);
} else {
- item = gtk_menu_item_new();
+ item = new Gtk::MenuItem();
}
// Create a box to contain all the widgets (icon, label, accelerator)
@@ -491,8 +486,8 @@ static GtkWidget *sp_ui_menu_append_item_from_verb(GtkMenu *men
GtkAccelGroup *accel_group = sp_shortcut_get_accel_group();
gtk_menu_set_accel_group(menu, accel_group);
- sp_shortcut_add_accelerator(item, sp_shortcut_get_primary(verb));
- gtk_accel_label_set_accel_widget(GTK_ACCEL_LABEL(label), item);
+ sp_shortcut_add_accelerator(item->gobj(), sp_shortcut_get_primary(verb));
+ gtk_accel_label_set_accel_widget(GTK_ACCEL_LABEL(label), item->gobj());
GtkWidget *icon;
@@ -509,33 +504,34 @@ static GtkWidget *sp_ui_menu_append_item_from_verb(GtkMenu *men
gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 0);
// Finally, pack all the widgets into the menu item
- gtk_container_add(GTK_CONTAINER(item), box);
+ gtk_container_add(GTK_CONTAINER(item->gobj()), box);
action->signal_set_sensitive.connect(
sigc::bind<0>(
sigc::ptr_fun(&gtk_widget_set_sensitive),
- item));
+ item->gobj()));
action->signal_set_name.connect(
sigc::bind<0>(
sigc::ptr_fun(&sp_ui_menu_item_set_name),
- item));
+ item->gobj()));
if (!action->sensitive) {
- gtk_widget_set_sensitive(item, FALSE);
+ item->set_sensitive(false);
}
- gtk_widget_set_events(item, GDK_KEY_PRESS_MASK);
- g_object_set_data(G_OBJECT(item), "view", (gpointer) view);
- g_signal_connect( G_OBJECT(item), "activate", G_CALLBACK(sp_ui_menu_activate), action );
- g_signal_connect( G_OBJECT(item), "select", G_CALLBACK(sp_ui_menu_select_action), action );
- g_signal_connect( G_OBJECT(item), "deselect", G_CALLBACK(sp_ui_menu_deselect_action), action );
+ gtk_widget_set_events(item->gobj(), GDK_KEY_PRESS_MASK);
+
+ g_object_set_data(G_OBJECT(item->gobj()), "view", (gpointer) view);
+ g_signal_connect( G_OBJECT(item->gobj()), "activate", G_CALLBACK(sp_ui_menu_activate), action );
+ g_signal_connect( G_OBJECT(item->gobj()), "select", G_CALLBACK(sp_ui_menu_select_action), action );
+ g_signal_connect( G_OBJECT(item->gobj()), "deselect", G_CALLBACK(sp_ui_menu_deselect_action), action );
}
- gtk_widget_show_all(item);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
+ item->show_all();
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), item->gobj());
- return item;
+ return item->gobj();
} // end of sp_ui_menu_append_item_from_verb
@@ -770,25 +766,24 @@ static void addTaskMenuItems(GtkMenu *menu, Inkscape::UI::View::View *view)
0, 0
};
- GSList *group = 0;
+ Gtk::RadioMenuItem::Group group;
int count = 0;
gint active = Inkscape::UI::UXManager::getInstance()->getDefaultTask( dynamic_cast<SPDesktop*>(view) );
for (gchar const **strs = data; strs[0]; strs += 2, count++)
{
- GtkWidget *item = gtk_radio_menu_item_new_with_label( group, strs[0] );
- group = gtk_radio_menu_item_get_group( GTK_RADIO_MENU_ITEM(item) );
+ Gtk::RadioMenuItem *item = new Gtk::RadioMenuItem(group,Glib::ustring(strs[0]));
if ( count == active )
{
- gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM(item), TRUE );
+ item->set_active();
}
- g_object_set_data( G_OBJECT(item), "view", view );
- g_signal_connect( G_OBJECT(item), "toggled", reinterpret_cast<GCallback>(taskToggled), GINT_TO_POINTER(count) );
- g_signal_connect( G_OBJECT(item), "select", G_CALLBACK(sp_ui_menu_select), const_cast<gchar*>(strs[1]) );
- g_signal_connect( G_OBJECT(item), "deselect", G_CALLBACK(sp_ui_menu_deselect), 0 );
+ g_object_set_data( G_OBJECT(item->gobj()), "view", view );
+ g_signal_connect( G_OBJECT(item->gobj()), "toggled", reinterpret_cast<GCallback>(taskToggled), GINT_TO_POINTER(count) );
+ g_signal_connect( G_OBJECT(item->gobj()), "select", G_CALLBACK(sp_ui_menu_select), const_cast<gchar*>(strs[1]) );
+ g_signal_connect( G_OBJECT(item->gobj()), "deselect", G_CALLBACK(sp_ui_menu_deselect), 0 );
- gtk_widget_show( item );
- gtk_menu_shell_append( GTK_MENU_SHELL(menu), item );
+ item->show();
+ gtk_menu_shell_append( GTK_MENU_SHELL(menu), GTK_WIDGET(item->gobj()) );
}
}
@@ -832,7 +827,7 @@ static void sp_ui_build_dyn_menus(Inkscape::XML::Node *menus, GtkWidget *menu, I
{
if (menus == NULL) return;
if (menu == NULL) return;
- GSList *group = NULL;
+ Gtk::RadioMenuItem::Group group;
for (Inkscape::XML::Node *menu_pntr = menus;
menu_pntr != NULL;
@@ -864,8 +859,7 @@ static void sp_ui_build_dyn_menus(Inkscape::XML::Node *menus, GtkWidget *menu, I
if (verb != NULL) {
if (menu_pntr->attribute("radio") != NULL) {
- GtkWidget *item = sp_ui_menu_append_item_from_verb (GTK_MENU(menu), verb, view, show_icon, true, group);
- group = gtk_radio_menu_item_get_group( GTK_RADIO_MENU_ITEM(item));
+ GtkWidget *item = sp_ui_menu_append_item_from_verb (GTK_MENU(menu), verb, view, show_icon, true, &group);
if (menu_pntr->attribute("default") != NULL) {
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), TRUE);
}
@@ -881,7 +875,8 @@ static void sp_ui_build_dyn_menus(Inkscape::XML::Node *menus, GtkWidget *menu, I
}
} else {
sp_ui_menu_append_item_from_verb(GTK_MENU(menu), verb, view, show_icon);
- group = NULL;
+ Gtk::RadioMenuItem::Group group2;
+ group = group2;
}
} else {
gchar string[120];
@@ -1339,12 +1334,13 @@ static void sp_ui_drag_leave( GtkWidget */*widget*/,
static void
sp_ui_import_files(gchar *buffer)
{
- GList *list = gnome_uri_list_extract_filenames(buffer);
- if (!list)
- return;
- g_list_foreach(list, sp_ui_import_one_file_with_check, NULL);
- g_list_foreach(list, (GFunc) g_free, NULL);
- g_list_free(list);
+ gchar** l = g_uri_list_extract_uris(buffer);
+ for (int i = 0; i< g_strv_length (l); i++) {
+ gchar *f = g_filename_from_uri (l[i], NULL, NULL);
+ sp_ui_import_one_file_with_check(f, NULL);
+ g_free(f);
+ }
+ g_strfreev(l);
}
static void
@@ -1436,14 +1432,12 @@ sp_ui_menu_item_set_name(GtkWidget *data, Glib::ustring const &name)
if (GTK_IS_LABEL(child)) {
gtk_label_set_markup_with_mnemonic(GTK_LABEL (child), name.c_str());
} else if (GTK_IS_BOX(child)) {
- GList *children = gtk_container_get_children(GTK_CONTAINER(child));
+ std::vector<Gtk::Widget*> children = Glib::wrap(GTK_CONTAINER(child))->get_children();
// Label is second child in list
- GtkWidget *label = GTK_WIDGET(children->next->data);
-
- gtk_label_set_markup_with_mnemonic(
- GTK_LABEL (label),
- name.c_str());
+ Gtk::Label *label = dynamic_cast<Gtk::Label*>(children[1]);
+ if(!label) return;
+ label->set_markup_with_mnemonic(name);
}//else sp_ui_menu_append_item_from_verb has been modified and can set
//a menu item in yet another way...
}
diff --git a/src/ui/makefile.in b/src/ui/makefile.in
deleted file mode 100644
index f8a407592..000000000
--- a/src/ui/makefile.in
+++ /dev/null
@@ -1,17 +0,0 @@
-# Convenience stub makefile to call the real Makefile.
-
-@SET_MAKE@
-
-OBJEXT = @OBJEXT@
-
-# Explicit so that it's the default rule.
-all:
- cd .. && $(MAKE) ui/all
-
-clean %.a %.$(OBJEXT):
- cd .. && $(MAKE) ui/$@
-
-.PHONY: all clean
-
-.SUFFIXES:
-.SUFFIXES: .a .$(OBJEXT)
diff --git a/src/ui/object-edit.h b/src/ui/object-edit.h
deleted file mode 100644
index 75f3ce12b..000000000
--- a/src/ui/object-edit.h
+++ /dev/null
@@ -1,84 +0,0 @@
-#ifndef OBJECT_EDIT_H_SEEN
-#define OBJECT_EDIT_H_SEEN
-
-/*
- * Node editing extension to objects
- *
- * Authors:
- * Lauris Kaplinski <lauris@kaplinski.com>
- * Mitsuru Oka
- * Jon A. Cruz <jon@joncruz.org>
- *
- * Licensed under GNU GPL
- */
-
-#include "knotholder.h"
-
-namespace Inkscape {
-namespace UI {
-
-KnotHolder *createKnotHolder(SPItem *item, SPDesktop *desktop);
-
-}
-}
-
-class RectKnotHolder : public KnotHolder {
-public:
- RectKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderReleasedFunc relhandler);
- virtual ~RectKnotHolder() {};
-};
-
-class Box3DKnotHolder : public KnotHolder {
-public:
- Box3DKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderReleasedFunc relhandler);
- virtual ~Box3DKnotHolder() {};
-};
-
-class ArcKnotHolder : public KnotHolder {
-public:
- ArcKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderReleasedFunc relhandler);
- virtual ~ArcKnotHolder() {};
-};
-
-class StarKnotHolder : public KnotHolder {
-public:
- StarKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderReleasedFunc relhandler);
- virtual ~StarKnotHolder() {};
-};
-
-class SpiralKnotHolder : public KnotHolder {
-public:
- SpiralKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderReleasedFunc relhandler);
- virtual ~SpiralKnotHolder() {};
-};
-
-class OffsetKnotHolder : public KnotHolder {
-public:
- OffsetKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderReleasedFunc relhandler);
- virtual ~OffsetKnotHolder() {};
-};
-
-class FlowtextKnotHolder : public KnotHolder {
-public:
- FlowtextKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderReleasedFunc relhandler);
- virtual ~FlowtextKnotHolder() {};
-};
-
-class MiscKnotHolder : public KnotHolder {
-public:
- MiscKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderReleasedFunc relhandler);
- virtual ~MiscKnotHolder() {};
-};
-
-#endif // OBJECT_EDIT_H_SEEN
-
-/*
- Local Variables:
- mode:c++
- c-file-style:"stroustrup"
- c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
- indent-tabs-mode:nil
- fill-column:99
- End:
-*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --git a/src/ui/object-edit.cpp b/src/ui/shape-editor-knotholders.cpp
index a2b6a2de0..b2e41bac4 100644
--- a/src/ui/object-edit.cpp
+++ b/src/ui/shape-editor-knotholders.cpp
@@ -31,11 +31,59 @@
#include "live_effects/effect.h"
#include "sp-pattern.h"
#include <glibmm/i18n.h>
-#include "ui/object-edit.h"
+#include "knotholder.h"
#include "knot-holder-entity.h"
#define sp_round(v,m) (((v) < 0.0) ? ((ceil((v) / (m) - 0.5)) * (m)) : ((floor((v) / (m) + 0.5)) * (m)))
+class RectKnotHolder : public KnotHolder {
+public:
+ RectKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderReleasedFunc relhandler);
+ virtual ~RectKnotHolder() {};
+};
+
+class Box3DKnotHolder : public KnotHolder {
+public:
+ Box3DKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderReleasedFunc relhandler);
+ virtual ~Box3DKnotHolder() {};
+};
+
+class ArcKnotHolder : public KnotHolder {
+public:
+ ArcKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderReleasedFunc relhandler);
+ virtual ~ArcKnotHolder() {};
+};
+
+class StarKnotHolder : public KnotHolder {
+public:
+ StarKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderReleasedFunc relhandler);
+ virtual ~StarKnotHolder() {};
+};
+
+class SpiralKnotHolder : public KnotHolder {
+public:
+ SpiralKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderReleasedFunc relhandler);
+ virtual ~SpiralKnotHolder() {};
+};
+
+class OffsetKnotHolder : public KnotHolder {
+public:
+ OffsetKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderReleasedFunc relhandler);
+ virtual ~OffsetKnotHolder() {};
+};
+
+class FlowtextKnotHolder : public KnotHolder {
+public:
+ FlowtextKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderReleasedFunc relhandler);
+ virtual ~FlowtextKnotHolder() {};
+};
+
+class MiscKnotHolder : public KnotHolder {
+public:
+ MiscKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderReleasedFunc relhandler);
+ virtual ~MiscKnotHolder() {};
+};
+
namespace {
static KnotHolder *sp_lpe_knot_holder(SPLPEItem *item, SPDesktop *desktop)
diff --git a/src/ui/shape-editor.cpp b/src/ui/shape-editor.cpp
index 6a8f5e931..4851c413f 100644
--- a/src/ui/shape-editor.cpp
+++ b/src/ui/shape-editor.cpp
@@ -20,21 +20,23 @@
#include "sp-shape.h"
#include "sp-path.h"
#include "inkscape.h"
-#include "ui/object-edit.h"
#include "ui/shape-editor.h"
#include "xml/node-event-vector.h"
-//using Inkscape::createKnotHolder;
namespace Inkscape {
namespace UI {
+KnotHolder *createKnotHolder(SPItem *item, SPDesktop *desktop);
+
bool ShapeEditor::_blockSetItem = false;
-ShapeEditor::ShapeEditor(SPDesktop *dt) {
- this->desktop = dt;
- this->knotholder = NULL;
- this->knotholder_listener_attached_for = NULL;
+ShapeEditor::ShapeEditor(SPDesktop *dt, Geom::Affine edit_transform) :
+ desktop(dt),
+ knotholder(nullptr),
+ knotholder_listener_attached_for(nullptr),
+ _edit_transform(edit_transform)
+{
}
ShapeEditor::~ShapeEditor() {
@@ -76,14 +78,6 @@ void ShapeEditor::decrement_local_change() {
}
}
-const SPItem *ShapeEditor::get_item() {
- const SPItem *item = NULL;
- if (this->has_knotholder()) {
- item = this->knotholder->getItem();
- }
- return item;
-}
-
void ShapeEditor::event_attr_changed(Inkscape::XML::Node * node, gchar const *name, gchar const *, gchar const *, bool, void *data)
{
g_assert(data);
@@ -129,6 +123,7 @@ void ShapeEditor::set_item(SPItem *item, bool keep_knotholder) {
this->knotholder = createKnotHolder(item, desktop);
}
if (this->knotholder) {
+ this->knotholder->setEditTransform(_edit_transform);
this->knotholder->update_knots();
// setting new listener
repr = this->knotholder->repr;
diff --git a/src/ui/shape-editor.h b/src/ui/shape-editor.h
index 7f435efca..e30b2d60b 100644
--- a/src/ui/shape-editor.h
+++ b/src/ui/shape-editor.h
@@ -23,7 +23,7 @@ namespace UI {
class ShapeEditor {
public:
- ShapeEditor(SPDesktop *desktop);
+ ShapeEditor(SPDesktop *desktop, Geom::Affine edit_transform = Geom::identity());
~ShapeEditor();
void set_item(SPItem *item, bool keep_knotholder = false);
@@ -42,11 +42,11 @@ public:
char const * /*new_value*/, bool /*is_interactive*/, void *data);
private:
void reset_item (bool keep_knotholder = true);
- const SPItem *get_item();
static bool _blockSetItem;
SPDesktop *desktop;
Inkscape::XML::Node *knotholder_listener_attached_for;
+ Geom::Affine _edit_transform;
};
} // namespace UI
diff --git a/src/ui/tool/control-point-selection.h b/src/ui/tool/control-point-selection.h
index f122a468d..ec845b1b3 100644
--- a/src/ui/tool/control-point-selection.h
+++ b/src/ui/tool/control-point-selection.h
@@ -20,7 +20,6 @@
#include <2geom/forward.h>
#include <2geom/point.h>
#include <2geom/rect.h>
-#include "util/accumulators.h"
#include "util/unordered-containers.h"
#include "ui/tool/commit-events.h"
#include "ui/tool/manipulator.h"
diff --git a/src/ui/tool/control-point.cpp b/src/ui/tool/control-point.cpp
index d9374c790..8ab9fcbd7 100644
--- a/src/ui/tool/control-point.cpp
+++ b/src/ui/tool/control-point.cpp
@@ -380,7 +380,7 @@ bool ControlPoint::_eventHandler(Inkscape::UI::Tools::ToolBase *event_context, G
// update tips on modifier state change
// TODO add ESC keybinding as drag cancel
case GDK_KEY_PRESS:
- switch (Inkscape::UI::Tools::get_group0_keyval(&event->key))
+ switch (Inkscape::UI::Tools::get_latin_keyval(&event->key))
{
case GDK_KEY_Escape: {
// ignore Escape if this is not a drag
diff --git a/src/ui/tool/control-point.h b/src/ui/tool/control-point.h
index 4a01b9f21..bc1f060cd 100644
--- a/src/ui/tool/control-point.h
+++ b/src/ui/tool/control-point.h
@@ -18,7 +18,6 @@
#include <2geom/point.h>
#include "ui/control-types.h"
-#include "util/accumulators.h"
#include "display/sodipodi-ctrl.h"
#include "enums.h"
@@ -76,8 +75,6 @@ namespace UI {
*/
class ControlPoint : boost::noncopyable, public sigc::trackable {
public:
- typedef Inkscape::Util::ReverseInterruptible RInt;
- typedef Inkscape::Util::Interruptible Int;
/**
* Enumeration representing the possible states of the control point, used to determine
@@ -162,15 +159,6 @@ public:
void transferGrab(ControlPoint *from, GdkEventMotion *event);
/// @}
- /// @name Receive notifications about control point events
- /// @{
- /*sigc::signal<void, Geom::Point const &, Geom::Point &, GdkEventMotion*> signal_dragged;
- sigc::signal<bool, GdkEventButton*>::accumulated<RInt> signal_clicked;
- sigc::signal<bool, GdkEventButton*>::accumulated<RInt> signal_doubleclicked;
- sigc::signal<bool, GdkEventMotion*>::accumulated<Int> signal_grabbed;
- sigc::signal<void, GdkEventButton*> signal_ungrabbed;*/
- /// @}
-
/// @name Inspect the state of the control point
/// @{
State state() const { return _state; }
diff --git a/src/ui/tool/manipulator.h b/src/ui/tool/manipulator.h
index 07e01a656..66b47ce98 100644
--- a/src/ui/tool/manipulator.h
+++ b/src/ui/tool/manipulator.h
@@ -17,7 +17,6 @@
#include <sigc++/sigc++.h>
#include <glib.h>
#include <gdk/gdk.h>
-#include <boost/shared_ptr.hpp>
#include "ui/tools/tool-base.h"
class SPDesktop;
@@ -76,14 +75,14 @@ template <typename T>
class MultiManipulator : public PointManipulator {
public:
//typedef typename T::ItemType ItemType;
- typedef typename std::pair<void*, boost::shared_ptr<T> > MapPair;
- typedef typename std::map<void*, boost::shared_ptr<T> > MapType;
+ typedef typename std::pair<void*, std::shared_ptr<T> > MapPair;
+ typedef typename std::map<void*, std::shared_ptr<T> > MapType;
MultiManipulator(SPDesktop *d, ControlPointSelection &sel)
: PointManipulator(d, sel)
{}
void addItem(void *item) {
- boost::shared_ptr<T> m(_createManipulator(item));
+ std::shared_ptr<T> m(_createManipulator(item));
_mmap.insert(MapPair(item, m));
}
void removeItem(void *item) {
@@ -98,16 +97,17 @@ public:
bool empty() {
return _mmap.empty();
}
- void setItems(GSList const *list) {
+
+ void setItems(std::vector<gpointer> list) { // this function is not called anywhere ... delete ?
std::set<void*> to_remove;
for (typename MapType::iterator mi = _mmap.begin(); mi != _mmap.end(); ++mi) {
to_remove.insert(mi->first);
}
- for (GSList *i = const_cast<GSList*>(list); i; i = i->next) {
- if (_isItemType(i->data)) {
+ for (auto i:list) {
+ if (_isItemType(i)) {
// erase returns the number of items removed
// if nothing was removed, it means this item did not have a manipulator - add it
- if (!to_remove.erase(i->data)) addItem(i->data);
+ if (!to_remove.erase(i)) addItem(i);
}
}
typedef typename std::set<void*>::iterator RmIter;
diff --git a/src/ui/tool/multi-path-manipulator.cpp b/src/ui/tool/multi-path-manipulator.cpp
index f30c7e349..9cfa4ed31 100644
--- a/src/ui/tool/multi-path-manipulator.cpp
+++ b/src/ui/tool/multi-path-manipulator.cpp
@@ -10,7 +10,6 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#include <boost/shared_ptr.hpp>
#include "node.h"
#include <glibmm/i18n.h>
#include "desktop.h"
@@ -161,7 +160,7 @@ void MultiPathManipulator::setItems(std::set<ShapeRecord> const &s)
if (sr.edit_transform != sr_new.edit_transform ||
sr.role != sr_new.role)
{
- boost::shared_ptr<PathManipulator> hold(i->second);
+ std::shared_ptr<PathManipulator> hold(i->second);
if (sr.edit_transform != sr_new.edit_transform)
hold->setControlsTransform(sr_new.edit_transform);
if (sr.role != sr_new.role) {
@@ -179,7 +178,7 @@ void MultiPathManipulator::setItems(std::set<ShapeRecord> const &s)
for (std::set<ShapeRecord>::iterator i = shapes.begin(); i != shapes.end(); ++i) {
ShapeRecord const &r = *i;
if (!SP_IS_PATH(r.item) && !IS_LIVEPATHEFFECT(r.item)) continue;
- boost::shared_ptr<PathManipulator> newpm(new PathManipulator(*this, (SPPath*) r.item,
+ std::shared_ptr<PathManipulator> newpm(new PathManipulator(*this, (SPPath*) r.item,
r.edit_transform, _getOutlineColor(r.role, r.item), r.lpe_key));
newpm->showHandles(_show_handles);
// always show outlines for clips and masks
diff --git a/src/ui/tool/multi-path-manipulator.h b/src/ui/tool/multi-path-manipulator.h
index 4f152e0a2..742c6d421 100644
--- a/src/ui/tool/multi-path-manipulator.h
+++ b/src/ui/tool/multi-path-manipulator.h
@@ -77,8 +77,8 @@ public:
sigc::signal<void> signal_coords_changed; /// Emitted whenever the coordinates
/// shown in the status bar need updating
private:
- typedef std::pair<ShapeRecord, boost::shared_ptr<PathManipulator> > MapPair;
- typedef std::map<ShapeRecord, boost::shared_ptr<PathManipulator> > MapType;
+ typedef std::pair<ShapeRecord, std::shared_ptr<PathManipulator> > MapPair;
+ typedef std::map<ShapeRecord, std::shared_ptr<PathManipulator> > MapType;
template <typename R>
void invokeForAll(R (PathManipulator::*method)()) {
@@ -88,11 +88,11 @@ private:
// be a valid iterator and then assign i to it.
MapType::iterator next_i = i;
++next_i;
- // i->second is a boost::shared_ptr so try to hold on to it so
+ // i->second is a std::shared_ptr so try to hold on to it so
// it won't get freed prematurely by the WriteXML() method or
// whatever. See https://bugs.launchpad.net/inkscape/+bug/1617615
// Applicable to empty paths.
- boost::shared_ptr<PathManipulator> hold(i->second);
+ std::shared_ptr<PathManipulator> hold(i->second);
((hold.get())->*method)();
i = next_i;
}
diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp
index d6e491ac3..4f42400d4 100644
--- a/src/ui/tool/node.cpp
+++ b/src/ui/tool/node.cpp
@@ -559,14 +559,11 @@ Glib::ustring Handle::_getDragTip(GdkEventMotion */*event*/) const
Inkscape::Util::Quantity x_q = Inkscape::Util::Quantity(dist[Geom::X], "px");
Inkscape::Util::Quantity y_q = Inkscape::Util::Quantity(dist[Geom::Y], "px");
Inkscape::Util::Quantity len_q = Inkscape::Util::Quantity(length(), "px");
- GString *x = g_string_new(x_q.string(_desktop->namedview->display_units).c_str());
- GString *y = g_string_new(y_q.string(_desktop->namedview->display_units).c_str());
- GString *len = g_string_new(len_q.string(_desktop->namedview->display_units).c_str());
+ Glib::ustring x = x_q.string(_desktop->namedview->display_units);
+ Glib::ustring y = y_q.string(_desktop->namedview->display_units);
+ Glib::ustring len = len_q.string(_desktop->namedview->display_units);
Glib::ustring ret = format_tip(C_("Path handle tip",
- "Move handle by %s, %s; angle %.2f°, length %s"), x->str, y->str, angle, len->str);
- g_string_free(x, TRUE);
- g_string_free(y, TRUE);
- g_string_free(len, TRUE);
+ "Move handle by %s, %s; angle %.2f°, length %s"), x.c_str(), y.c_str(), angle, len.c_str());
return ret;
}
@@ -1458,11 +1455,9 @@ Glib::ustring Node::_getDragTip(GdkEventMotion */*event*/) const
Inkscape::Util::Quantity x_q = Inkscape::Util::Quantity(dist[Geom::X], "px");
Inkscape::Util::Quantity y_q = Inkscape::Util::Quantity(dist[Geom::Y], "px");
- GString *x = g_string_new(x_q.string(_desktop->namedview->display_units).c_str());
- GString *y = g_string_new(y_q.string(_desktop->namedview->display_units).c_str());
- Glib::ustring ret = format_tip(C_("Path node tip", "Move node by %s, %s"), x->str, y->str);
- g_string_free(x, TRUE);
- g_string_free(y, TRUE);
+ Glib::ustring x = x_q.string(_desktop->namedview->display_units);
+ Glib::ustring y = y_q.string(_desktop->namedview->display_units);
+ Glib::ustring ret = format_tip(C_("Path node tip", "Move node by %s, %s"), x.c_str(), y.c_str());
return ret;
}
diff --git a/src/ui/tool/node.h b/src/ui/tool/node.h
index a05f0e3b9..2964b66ca 100644
--- a/src/ui/tool/node.h
+++ b/src/ui/tool/node.h
@@ -22,8 +22,6 @@
#include <cstddef>
#include <functional>
-#include <boost/enable_shared_from_this.hpp>
-#include <boost/shared_ptr.hpp>
#include "ui/tool/selectable-control-point.h"
#include "snapped-point.h"
#include "ui/tool/node-types.h"
@@ -357,7 +355,7 @@ private:
friend class NodeList;
};
-class NodeList : ListNode, boost::noncopyable, public boost::enable_shared_from_this<NodeList> {
+class NodeList : ListNode, boost::noncopyable {
public:
typedef std::size_t size_type;
typedef Node &reference;
@@ -465,9 +463,9 @@ private:
* List of node lists. Represents an editable path.
* Editable path composed of one or more subpaths.
*/
-class SubpathList : public std::list< boost::shared_ptr<NodeList> > {
+class SubpathList : public std::list< std::shared_ptr<NodeList> > {
public:
- typedef std::list< boost::shared_ptr<NodeList> > list_type;
+ typedef std::list< std::shared_ptr<NodeList> > list_type;
SubpathList(PathManipulator &pm) : _path_manipulator(pm) {}
PathManipulator &pm() { return _path_manipulator; }
diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp
index f2899dd01..2c99e7fc8 100644
--- a/src/ui/tool/path-manipulator.cpp
+++ b/src/ui/tool/path-manipulator.cpp
@@ -68,7 +68,7 @@ public:
}
virtual void notifyAttributeChanged(Inkscape::XML::Node &/*node*/, GQuark attr,
- Util::ptr_shared<char>, Util::ptr_shared<char>)
+ Util::ptr_shared, Util::ptr_shared)
{
// do nothing if blocked
if (_blocked) return;
diff --git a/src/ui/tool/path-manipulator.h b/src/ui/tool/path-manipulator.h
index 283cb610a..5fa24c23b 100644
--- a/src/ui/tool/path-manipulator.h
+++ b/src/ui/tool/path-manipulator.h
@@ -15,8 +15,6 @@
#include <memory>
#include <2geom/pathvector.h>
#include <2geom/affine.h>
-#include <boost/shared_ptr.hpp>
-#include <boost/weak_ptr.hpp>
#include "ui/tool/node.h"
#include "ui/tool/manipulator.h"
#include "live_effects/lpe-bspline.h"
@@ -105,7 +103,7 @@ public:
static bool is_item_type(void *item);
private:
typedef NodeList Subpath;
- typedef boost::shared_ptr<NodeList> SubpathPtr;
+ typedef std::shared_ptr<NodeList> SubpathPtr;
void _createControlPointsFromGeometry();
diff --git a/src/ui/tools/arc-tool.cpp b/src/ui/tools/arc-tool.cpp
index b501962fb..33f323eb3 100644
--- a/src/ui/tools/arc-tool.cpp
+++ b/src/ui/tools/arc-tool.cpp
@@ -227,7 +227,7 @@ bool ArcTool::root_handler(GdkEvent* event) {
break;
case GDK_KEY_PRESS:
- switch (get_group0_keyval (&event->key)) {
+ switch (get_latin_keyval (&event->key)) {
case GDK_KEY_Alt_L:
case GDK_KEY_Alt_R:
case GDK_KEY_Control_L:
@@ -385,8 +385,8 @@ void ArcTool::drag(Geom::Point pt, guint state) {
Inkscape::Util::Quantity rdimx_q = Inkscape::Util::Quantity(rdimx, "px");
Inkscape::Util::Quantity rdimy_q = Inkscape::Util::Quantity(rdimy, "px");
- GString *xs = g_string_new(rdimx_q.string(desktop->namedview->display_units).c_str());
- GString *ys = g_string_new(rdimy_q.string(desktop->namedview->display_units).c_str());
+ Glib::ustring xs = rdimx_q.string(desktop->namedview->display_units);
+ Glib::ustring ys = rdimy_q.string(desktop->namedview->display_units);
if (state & GDK_CONTROL_MASK) {
int ratio_x, ratio_y;
@@ -399,13 +399,10 @@ void ArcTool::drag(Geom::Point pt, guint state) {
ratio_y = (int) rint (rdimy / rdimx);
}
- this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Ellipse</b>: %s &#215; %s (constrained to ratio %d:%d); with <b>Shift</b> to draw around the starting point"), xs->str, ys->str, ratio_x, ratio_y);
+ this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Ellipse</b>: %s &#215; %s (constrained to ratio %d:%d); with <b>Shift</b> to draw around the starting point"), xs.c_str(), ys.c_str(), ratio_x, ratio_y);
} else {
- this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Ellipse</b>: %s &#215; %s; with <b>Ctrl</b> to make square or integer-ratio ellipse; with <b>Shift</b> to draw around the starting point"), xs->str, ys->str);
+ this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Ellipse</b>: %s &#215; %s; with <b>Ctrl</b> to make square or integer-ratio ellipse; with <b>Shift</b> to draw around the starting point"), xs.c_str(), ys.c_str());
}
-
- g_string_free(xs, FALSE);
- g_string_free(ys, FALSE);
}
void ArcTool::finishItem() {
@@ -418,7 +415,7 @@ void ArcTool::finishItem() {
}
this->arc->updateRepr();
- this->arc->doWriteTransform(this->arc->getRepr(), this->arc->transform, NULL, true);
+ this->arc->doWriteTransform(this->arc->transform, NULL, true);
desktop->canvas->endForcedFullRedraws();
diff --git a/src/ui/tools/box3d-tool.cpp b/src/ui/tools/box3d-tool.cpp
index 276385335..09ee2cda9 100644
--- a/src/ui/tools/box3d-tool.cpp
+++ b/src/ui/tools/box3d-tool.cpp
@@ -335,7 +335,7 @@ bool Box3dTool::root_handler(GdkEvent* event) {
break;
case GDK_KEY_PRESS:
- switch (get_group0_keyval (&event->key)) {
+ switch (get_latin_keyval (&event->key)) {
case GDK_KEY_Up:
case GDK_KEY_Down:
case GDK_KEY_KP_Up:
@@ -529,9 +529,9 @@ void Box3dTool::drag(guint /*state*/) {
side->setAttribute("style", cur_style.data());
} else {
// use default style
- GString *pstring = g_string_new("");
- g_string_printf (pstring, "/tools/shapes/3dbox/%s", box3d_side_axes_string(side));
- desktop->applyCurrentOrToolStyle (side, pstring->str, false);
+ Glib::ustring tool_path = Glib::ustring::compose("/tools/shapes/3dbox/%1",
+ box3d_side_axes_string(side));
+ desktop->applyCurrentOrToolStyle (side, tool_path, false);
}
side->updateRepr(); // calls box3d_side_write() and updates, e.g., the axes string description
diff --git a/src/ui/tools/calligraphic-tool.cpp b/src/ui/tools/calligraphic-tool.cpp
index 266375caa..2a29b25b0 100644
--- a/src/ui/tools/calligraphic-tool.cpp
+++ b/src/ui/tools/calligraphic-tool.cpp
@@ -421,10 +421,9 @@ void CalligraphicTool::cancel() {
sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), 0);
/* Remove all temporary line segments */
- while (this->segments) {
- sp_canvas_item_destroy(SP_CANVAS_ITEM(this->segments->data));
- this->segments = g_slist_remove(this->segments, this->segments->data);
- }
+ for (auto i:this->segments)
+ sp_canvas_item_destroy(SP_CANVAS_ITEM(i));
+ this->segments.clear();
/* reset accumulated curve */
this->accumulated->reset();
@@ -731,10 +730,9 @@ bool CalligraphicTool::root_handler(GdkEvent* event) {
this->apply(motion_dt);
/* Remove all temporary line segments */
- while (this->segments) {
- sp_canvas_item_destroy(SP_CANVAS_ITEM(this->segments->data));
- this->segments = g_slist_remove(this->segments, this->segments->data);
- }
+ for (auto i:this->segments)
+ sp_canvas_item_destroy(SP_CANVAS_ITEM(i));
+ this->segments.clear();
/* Create object */
this->fit_and_split(true);
@@ -779,7 +777,7 @@ bool CalligraphicTool::root_handler(GdkEvent* event) {
}
case GDK_KEY_PRESS:
- switch (get_group0_keyval (&event->key)) {
+ switch (get_latin_keyval (&event->key)) {
case GDK_KEY_Up:
case GDK_KEY_KP_Up:
if (!MOD__CTRL_ONLY(event)) {
@@ -860,7 +858,7 @@ bool CalligraphicTool::root_handler(GdkEvent* event) {
break;
case GDK_KEY_RELEASE:
- switch (get_group0_keyval(&event->key)) {
+ switch (get_latin_keyval(&event->key)) {
case GDK_KEY_Control_L:
case GDK_KEY_Control_R:
this->message_context->clear();
@@ -947,7 +945,7 @@ void CalligraphicTool::set_to_accumulated(bool unionize, bool subtract) {
result = desktop->getSelection()->singleItem();
}
- result->doWriteTransform(result->getRepr(), result->transform, NULL, true);
+ result->doWriteTransform(result->transform, NULL, true);
} else {
if (this->repr) {
sp_repr_unparent(this->repr);
@@ -1089,7 +1087,7 @@ void CalligraphicTool::fit_and_split(bool release) {
this->currentcurve->curveto(bp2[2], bp2[1], bp2[0]);
}
// FIXME: dc->segments is always NULL at this point??
- if (!this->segments) { // first segment
+ if (this->segments.empty()) { // first segment
add_cap(this->currentcurve, b2[0], b1[0], this->cap_rounding);
}
this->currentcurve->closepath();
@@ -1143,8 +1141,8 @@ void CalligraphicTool::fit_and_split(bool release) {
sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(cbp), 0x00000000, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
/* fixme: Cannot we cascade it to root more clearly? */
g_signal_connect(G_OBJECT(cbp), "event", G_CALLBACK(sp_desktop_root_handler), desktop);
-
- this->segments = g_slist_prepend(this->segments, cbp);
+
+ this->segments.push_back(cbp);
}
this->point1[0] = this->point1[this->npoints - 1];
diff --git a/src/ui/tools/connector-tool.cpp b/src/ui/tools/connector-tool.cpp
index 6d2682089..b9d36706f 100644
--- a/src/ui/tools/connector-tool.cpp
+++ b/src/ui/tools/connector-tool.cpp
@@ -434,7 +434,7 @@ bool ConnectorTool::root_handler(GdkEvent* event) {
break;
case GDK_KEY_PRESS:
- ret = this->_handleKeyPress(get_group0_keyval (&event->key));
+ ret = this->_handleKeyPress(get_latin_keyval (&event->key));
break;
default:
@@ -904,7 +904,7 @@ void ConnectorTool::_flushWhite(SPCurve *gc) {
this->newconn->updateRepr();
}
- this->newconn->doWriteTransform(this->newconn->getRepr(), this->newconn->transform, NULL, true);
+ this->newconn->doWriteTransform(this->newconn->transform, NULL, true);
// Only set the selection after we are finished with creating the attributes of
// the connector. Otherwise, the selection change may alter the defaults for
diff --git a/src/ui/tools/dropper-tool.cpp b/src/ui/tools/dropper-tool.cpp
index 53a99e481..7bde1b698 100644
--- a/src/ui/tools/dropper-tool.cpp
+++ b/src/ui/tools/dropper-tool.cpp
@@ -345,7 +345,7 @@ bool DropperTool::root_handler(GdkEvent* event) {
break;
case GDK_KEY_PRESS:
- switch (get_group0_keyval(&event->key)) {
+ switch (get_latin_keyval(&event->key)) {
case GDK_KEY_Up:
case GDK_KEY_Down:
case GDK_KEY_KP_Up:
diff --git a/src/ui/tools/dynamic-base.cpp b/src/ui/tools/dynamic-base.cpp
index bb4989333..1026c26c6 100644
--- a/src/ui/tools/dynamic-base.cpp
+++ b/src/ui/tools/dynamic-base.cpp
@@ -21,7 +21,6 @@ namespace Tools {
DynamicBase::DynamicBase(gchar const *const *cursor_shape)
: ToolBase(cursor_shape)
, accumulated(NULL)
- , segments(NULL)
, currentshape(NULL)
, currentcurve(NULL)
, cal1(NULL)
@@ -62,10 +61,10 @@ DynamicBase::~DynamicBase() {
this->accumulated = 0;
}
- while (this->segments) {
- sp_canvas_item_destroy(SP_CANVAS_ITEM(this->segments->data));
- this->segments = g_slist_remove(this->segments, this->segments->data);
+ for (auto i:segments) {
+ sp_canvas_item_destroy(SP_CANVAS_ITEM(i));
}
+ segments.clear();
if (this->currentcurve) {
this->currentcurve = this->currentcurve->unref();
diff --git a/src/ui/tools/dynamic-base.h b/src/ui/tools/dynamic-base.h
index e270052f3..b9ffd71ce 100644
--- a/src/ui/tools/dynamic-base.h
+++ b/src/ui/tools/dynamic-base.h
@@ -20,6 +20,7 @@
*/
#include "ui/tools/tool-base.h"
+#include "display/sp-canvas-item.h"
struct SPCanvasItem;
class SPCurve;
@@ -48,7 +49,7 @@ protected:
SPCurve *accumulated;
/** canvas items for "committed" segments */
- GSList *segments;
+ std::vector<SPCanvasItem*> segments;
/** canvas item for red "leading" segment */
SPCanvasItem *currentshape;
diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp
index b4246b9cc..7892e865b 100644
--- a/src/ui/tools/eraser-tool.cpp
+++ b/src/ui/tools/eraser-tool.cpp
@@ -360,10 +360,9 @@ void EraserTool::cancel() {
this->is_drawing = false;
sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), 0);
/* Remove all temporary line segments */
- while (this->segments) {
- sp_canvas_item_destroy(SP_CANVAS_ITEM(this->segments->data));
- this->segments = g_slist_remove(this->segments, this->segments->data);
- }
+ for (auto i : this->segments)
+ sp_canvas_item_destroy(SP_CANVAS_ITEM(i));
+ this->segments.clear();
/* reset accumulated curve */
this->accumulated->reset();
this->clear_current();
@@ -464,10 +463,9 @@ bool EraserTool::root_handler(GdkEvent* event) {
this->apply(motion_dt);
/* Remove all temporary line segments */
- while (this->segments) {
- sp_canvas_item_destroy(SP_CANVAS_ITEM(this->segments->data));
- this->segments = g_slist_remove(this->segments, this->segments->data);
- }
+ for (auto i : this->segments)
+ sp_canvas_item_destroy(SP_CANVAS_ITEM(i));
+ this->segments.clear();
/* Create object */
this->fit_and_split(true);
@@ -494,7 +492,7 @@ bool EraserTool::root_handler(GdkEvent* event) {
}
case GDK_KEY_PRESS:
- switch (get_group0_keyval (&event->key)) {
+ switch (get_latin_keyval (&event->key)) {
// case GDK_KEY_Up:
// case GDK_KEY_KP_Up:
// if (!MOD__CTRL_ONLY(event)) {
@@ -598,7 +596,7 @@ bool EraserTool::root_handler(GdkEvent* event) {
break;
case GDK_KEY_RELEASE:
- switch (get_group0_keyval(&event->key)) {
+ switch (get_latin_keyval(&event->key)) {
case GDK_KEY_Control_L:
case GDK_KEY_Control_R:
this->message_context->clear();
@@ -780,7 +778,7 @@ void EraserTool::set_to_accumulated() {
if (dup_clip) {
SPItem * dup_clip_obj = SP_ITEM(item_repr->parent->appendChildRepr(dup_clip));
if (dup_clip_obj) {
- dup_clip_obj->doWriteTransform(dup_clip, item->transform);
+ dup_clip_obj->doWriteTransform(item->transform);
sp_object_ref(clip_path, 0);
clip_path->deleteObject(true);
sp_object_unref(clip_path);
@@ -1015,7 +1013,7 @@ void EraserTool::fit_and_split(bool release) {
}
// FIXME: this->segments is always NULL at this point??
- if (!this->segments) { // first segment
+ if (this->segments.empty()) { // first segment
add_cap(this->currentcurve, b2[1], b2[0], b1[0], b1[1], this->cap_rounding);
}
@@ -1072,7 +1070,7 @@ void EraserTool::fit_and_split(bool release) {
/* fixme: Cannot we cascade it to root more clearly? */
g_signal_connect(G_OBJECT(cbp), "event", G_CALLBACK(sp_desktop_root_handler), desktop);
- this->segments = g_slist_prepend(this->segments, cbp);
+ this->segments.push_back(cbp);
if (eraser_mode == ERASER_MODE_DELETE) {
sp_canvas_item_hide(cbp);
diff --git a/src/ui/tools/flood-tool.cpp b/src/ui/tools/flood-tool.cpp
index f6f9b4355..401b50c1c 100644
--- a/src/ui/tools/flood-tool.cpp
+++ b/src/ui/tools/flood-tool.cpp
@@ -444,7 +444,7 @@ static void do_trace(bitmap_coords_info bci, guchar *trace_px, SPDesktop *deskto
SPObject *reprobj = document->getObjectByRepr(pathRepr);
if (reprobj) {
- SP_ITEM(reprobj)->doWriteTransform(pathRepr, transform, NULL);
+ SP_ITEM(reprobj)->doWriteTransform(transform);
// premultiply the item transform by the accumulated parent transform in the paste layer
Geom::Affine local (SP_GROUP(desktop->currentLayer())->i2doc_affine());
@@ -1189,7 +1189,7 @@ bool FloodTool::root_handler(GdkEvent* event) {
}
break;
case GDK_KEY_PRESS:
- switch (get_group0_keyval (&event->key)) {
+ switch (get_latin_keyval (&event->key)) {
case GDK_KEY_Up:
case GDK_KEY_Down:
case GDK_KEY_KP_Up:
diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp
index 32f2bdde1..064a83a5a 100644
--- a/src/ui/tools/freehand-base.cpp
+++ b/src/ui/tools/freehand-base.cpp
@@ -81,13 +81,10 @@ FreehandBase::FreehandBase(gchar const *const *cursor_shape)
, red_curve(NULL)
, blue_bpath(NULL)
, blue_curve(NULL)
- , green_bpaths(NULL)
, green_curve(NULL)
, green_anchor(NULL)
, green_closed(false)
, white_item(NULL)
- , white_curves(NULL)
- , white_anchors(NULL)
, overwrite_curve(NULL)
, sa(NULL)
, ea(NULL)
@@ -178,7 +175,7 @@ bool FreehandBase::root_handler(GdkEvent* event) {
switch (event->type) {
case GDK_KEY_PRESS:
- switch (get_group0_keyval (&event->key)) {
+ switch (get_latin_keyval (&event->key)) {
case GDK_KEY_Up:
case GDK_KEY_Down:
case GDK_KEY_KP_Up:
@@ -619,22 +616,20 @@ static void spdc_attach_selection(FreehandBase *dc, Inkscape::Selection */*sel*/
SPCurve *norm = SP_PATH(item)->get_curve_for_edit();
norm->transform((dc->white_item)->i2dt_affine());
g_return_if_fail( norm != NULL );
- dc->white_curves = g_slist_reverse(norm->split());
+ dc->white_curves = norm->split();
norm->unref();
// Anchor list
- for (GSList *l = dc->white_curves; l != NULL; l = l->next) {
- SPCurve *c;
- c = static_cast<SPCurve*>(l->data);
+ for (auto c:dc->white_curves) {
g_return_if_fail( c->get_segment_count() > 0 );
if ( !c->is_closed() ) {
SPDrawAnchor *a;
a = sp_draw_anchor_new(dc, c, TRUE, *(c->first_point()));
if (a)
- dc->white_anchors = g_slist_prepend(dc->white_anchors, a);
+ dc->white_anchors.push_back(a);
a = sp_draw_anchor_new(dc, c, FALSE, *(c->last_point()));
if (a)
- dc->white_anchors = g_slist_prepend(dc->white_anchors, a);
+ dc->white_anchors.push_back(a);
}
}
// fixme: recalculate active anchor?
@@ -706,10 +701,9 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed)
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
// Green
dc->green_curve = new SPCurve();
- while (dc->green_bpaths) {
- sp_canvas_item_destroy(SP_CANVAS_ITEM(dc->green_bpaths->data));
- dc->green_bpaths = g_slist_remove(dc->green_bpaths, dc->green_bpaths->data);
- }
+ for (auto i : dc->green_bpaths)
+ sp_canvas_item_destroy(i);
+ dc->green_bpaths.clear();
// Blue
c->append_continuous(dc->blue_curve, 0.0625);
@@ -759,8 +753,8 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed)
c->unref();
dc->overwrite_curve->closepath_current();
if(dc->sa){
- dc->white_curves = g_slist_remove(dc->white_curves, dc->sa->curve);
- dc->white_curves = g_slist_append(dc->white_curves, dc->overwrite_curve);
+ dc->white_curves.erase(std::find(dc->white_curves.begin(),dc->white_curves.end(), dc->sa->curve));
+ dc->white_curves.push_back(dc->overwrite_curve);
}
}else{
dc->sa->curve->append_continuous(c, 0.0625);
@@ -774,7 +768,7 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed)
// Step C - test start
if (dc->sa) {
SPCurve *s = dc->sa->curve;
- dc->white_curves = g_slist_remove(dc->white_curves, s);
+ dc->white_curves.erase(std::find(dc->white_curves.begin(),dc->white_curves.end(), s));
if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 ||
prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2){
s = dc->overwrite_curve;
@@ -787,7 +781,7 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed)
c = s;
} else /* Step D - test end */ if (dc->ea) {
SPCurve *e = dc->ea->curve;
- dc->white_curves = g_slist_remove(dc->white_curves, e);
+ dc->white_curves.erase(std::find(dc->white_curves.begin(),dc->white_curves.end(), e));
if (!dc->ea->start) {
e = reverse_then_unref(e);
}
@@ -827,11 +821,10 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed)
static void spdc_flush_white(FreehandBase *dc, SPCurve *gc)
{
SPCurve *c;
- if (dc->white_curves) {
+ if (! dc->white_curves.empty()) {
g_assert(dc->white_item);
c = SPCurve::concat(dc->white_curves);
- g_slist_free(dc->white_curves);
- dc->white_curves = NULL;
+ dc->white_curves.clear();
if (gc) {
c->append(gc, FALSE);
}
@@ -883,7 +876,7 @@ static void spdc_flush_white(FreehandBase *dc, SPCurve *gc)
Inkscape::GC::release(repr);
item->transform = SP_ITEM(desktop->currentLayer())->i2doc_affine().inverse();
item->updateRepr();
- item->doWriteTransform(item->getRepr(), item->transform, NULL, true);
+ item->doWriteTransform(item->transform, NULL, true);
spdc_check_for_and_apply_waiting_LPE(dc, item, c, false);
dc->selection->set(repr);
if(previous_shape_type == BEND_CLIPBOARD){
@@ -917,8 +910,8 @@ SPDrawAnchor *spdc_test_inside(FreehandBase *dc, Geom::Point p)
active = sp_draw_anchor_test(dc->green_anchor, p, TRUE);
}
- for (GSList *l = dc->white_anchors; l != NULL; l = l->next) {
- SPDrawAnchor *na = sp_draw_anchor_test(static_cast<SPDrawAnchor*>(l->data), p, !active);
+ for (auto i:dc->white_anchors) {
+ SPDrawAnchor *na = sp_draw_anchor_test(i, p, !active);
if ( !active && na ) {
active = na;
}
@@ -932,14 +925,12 @@ static void spdc_reset_white(FreehandBase *dc)
// We do not hold refcount
dc->white_item = NULL;
}
- while (dc->white_curves) {
- reinterpret_cast<SPCurve *>(dc->white_curves->data)->unref();
- dc->white_curves = g_slist_remove(dc->white_curves, dc->white_curves->data);
- }
- while (dc->white_anchors) {
- sp_draw_anchor_destroy(static_cast<SPDrawAnchor*>(dc->white_anchors->data));
- dc->white_anchors = g_slist_remove(dc->white_anchors, dc->white_anchors->data);
- }
+ for (auto i: dc->white_curves)
+ i->unref();
+ dc->white_curves.clear();
+ for (auto i:dc->white_anchors)
+ sp_draw_anchor_destroy(i);
+ dc->white_anchors.clear();
}
static void spdc_free_colors(FreehandBase *dc)
@@ -963,10 +954,9 @@ static void spdc_free_colors(FreehandBase *dc)
}
// Green
- while (dc->green_bpaths) {
- sp_canvas_item_destroy(SP_CANVAS_ITEM(dc->green_bpaths->data));
- dc->green_bpaths = g_slist_remove(dc->green_bpaths, dc->green_bpaths->data);
- }
+ for (auto i : dc->green_bpaths)
+ sp_canvas_item_destroy(i);
+ dc->green_bpaths.clear();
if (dc->green_curve) {
dc->green_curve = dc->green_curve->unref();
}
@@ -979,14 +969,12 @@ static void spdc_free_colors(FreehandBase *dc)
// We do not hold refcount
dc->white_item = NULL;
}
- while (dc->white_curves) {
- reinterpret_cast<SPCurve *>(dc->white_curves->data)->unref();
- dc->white_curves = g_slist_remove(dc->white_curves, dc->white_curves->data);
- }
- while (dc->white_anchors) {
- sp_draw_anchor_destroy(static_cast<SPDrawAnchor *>(dc->white_anchors->data));
- dc->white_anchors = g_slist_remove(dc->white_anchors, dc->white_anchors->data);
- }
+ for (auto i: dc->white_curves)
+ i->unref();
+ dc->white_curves.clear();
+ for (auto i:dc->white_anchors)
+ sp_draw_anchor_destroy(i);
+ dc->white_anchors.clear();
}
void spdc_create_single_dot(ToolBase *ec, Geom::Point const &pt, char const *tool, guint event_state) {
diff --git a/src/ui/tools/freehand-base.h b/src/ui/tools/freehand-base.h
index 8759e6647..02d0a9982 100644
--- a/src/ui/tools/freehand-base.h
+++ b/src/ui/tools/freehand-base.h
@@ -66,15 +66,15 @@ public:
SPCurve *blue_curve;
// Green
- GSList *green_bpaths;
+ std::vector<SPCanvasItem*> green_bpaths;
SPCurve *green_curve;
SPDrawAnchor *green_anchor;
gboolean green_closed; // a flag meaning we hit the green anchor, so close the path on itself
// White
SPItem *white_item;
- GSList *white_curves;
- GSList *white_anchors;
+ std::list<SPCurve *> white_curves;
+ std::vector<SPDrawAnchor*> white_anchors;
// Alternative curve to use on continuing the exisiting curve in case of
// bspline or spirolive, because using anchor curves gives random memory
diff --git a/src/ui/tools/gradient-tool.cpp b/src/ui/tools/gradient-tool.cpp
index 95d940bd6..1735a78df 100644
--- a/src/ui/tools/gradient-tool.cpp
+++ b/src/ui/tools/gradient-tool.cpp
@@ -219,7 +219,7 @@ sp_gradient_context_is_over_line (GradientTool *rc, SPItem *item, Geom::Point ev
}
static std::vector<Geom::Point>
-sp_gradient_context_get_stop_intervals (GrDrag *drag, GSList **these_stops, GSList **next_stops)
+sp_gradient_context_get_stop_intervals (GrDrag *drag, std::vector<SPStop *> &these_stops, std::vector<SPStop *> &next_stops)
{
std::vector<Geom::Point> coords;
@@ -285,15 +285,15 @@ sp_gradient_context_get_stop_intervals (GrDrag *drag, GSList **these_stops, GSLi
}
// if both adjacent draggers selected,
- if (!g_slist_find(*these_stops, this_stop) && dnext && dnext->isSelected()) {
+ if ((std::find(these_stops.begin(),these_stops.end(),this_stop)==these_stops.end()) && dnext && dnext->isSelected()) {
// remember the coords of the future dragger to select it
coords.push_back(0.5*(dragger->point + dnext->point));
// do not insert a stop now, it will confuse the loop;
// just remember the stops
- *these_stops = g_slist_prepend (*these_stops, this_stop);
- *next_stops = g_slist_prepend (*next_stops, next_stop);
+ these_stops.push_back(this_stop);
+ next_stops.push_back(next_stop);
}
}
}
@@ -307,12 +307,12 @@ sp_gradient_context_add_stops_between_selected_stops (GradientTool *rc)
SPDocument *doc = NULL;
GrDrag *drag = rc->_grdrag;
- GSList *these_stops = NULL;
- GSList *next_stops = NULL;
+ std::vector<SPStop *> these_stops;
+ std::vector<SPStop *> next_stops;
- std::vector<Geom::Point> coords = sp_gradient_context_get_stop_intervals (drag, &these_stops, &next_stops);
+ std::vector<Geom::Point> coords = sp_gradient_context_get_stop_intervals (drag, these_stops, next_stops);
- if (g_slist_length(these_stops) == 0 && drag->numSelected() == 1) {
+ if (these_stops.empty() && drag->numSelected() == 1) {
// if a single stop is selected, add between that stop and the next one
GrDragger *dragger = *(drag->selected.begin());
for (std::vector<GrDraggable *>::const_iterator j = dragger->draggables.begin(); j != dragger->draggables.end(); ++j) {
@@ -330,47 +330,42 @@ sp_gradient_context_add_stops_between_selected_stops (GradientTool *rc)
if (this_stop) {
SPStop *next_stop = this_stop->getNextStop();
if (next_stop) {
- these_stops = g_slist_prepend (these_stops, this_stop);
- next_stops = g_slist_prepend (next_stops, next_stop);
+ these_stops.push_back(this_stop);
+ next_stops.push_back(next_stop);
}
}
}
}
// now actually create the new stops
- GSList *i = these_stops;
- GSList *j = next_stops;
- GSList *new_stops = NULL;
+ auto i = these_stops.rbegin();
+ auto j = next_stops.rbegin();
+ std::vector<SPStop *> new_stops;
- for (; i != NULL && j != NULL; i = i->next, j = j->next) {
- SPStop *this_stop = (SPStop *) i->data;
- SPStop *next_stop = (SPStop *) j->data;
+ for (;i != these_stops.rend() && j != next_stops.rend(); ++i, ++j ) {
+ SPStop *this_stop = *i;
+ SPStop *next_stop = *j;
gfloat offset = 0.5*(this_stop->offset + next_stop->offset);
SPObject *parent = this_stop->parent;
if (SP_IS_GRADIENT (parent)) {
doc = parent->document;
SPStop *new_stop = sp_vector_add_stop (SP_GRADIENT (parent), this_stop, next_stop, offset);
- new_stops = g_slist_prepend (new_stops, new_stop);
+ new_stops.push_back(new_stop);
SP_GRADIENT(parent)->ensureVector();
}
}
- if (g_slist_length(these_stops) > 0 && doc) {
+ if (!these_stops.empty() && doc) {
DocumentUndo::done(doc, SP_VERB_CONTEXT_GRADIENT, _("Add gradient stop"));
drag->updateDraggers();
// so that it does not automatically update draggers in idle loop, as this would deselect
drag->local_change = true;
// select the newly created stops
- for (GSList *s = new_stops; s != NULL; s = s->next) {
- drag->selectByStop((SPStop *)s->data);
+ for (auto i:new_stops) {
+ drag->selectByStop(i);
}
-
}
-
- g_slist_free (these_stops);
- g_slist_free (next_stops);
- g_slist_free (new_stops);
}
static double sqr(double x) {return x*x;}
@@ -381,26 +376,25 @@ sp_gradient_simplify(GradientTool *rc, double tolerance)
SPDocument *doc = NULL;
GrDrag *drag = rc->_grdrag;
- GSList *these_stops = NULL;
- GSList *next_stops = NULL;
+ std::vector<SPStop *> these_stops;
+ std::vector<SPStop *> next_stops;
- std::vector<Geom::Point> coords = sp_gradient_context_get_stop_intervals (drag, &these_stops, &next_stops);
+ std::vector<Geom::Point> coords = sp_gradient_context_get_stop_intervals (drag, these_stops, next_stops);
- GSList *todel = NULL;
+ std::set<SPStop *> todel;
- GSList *i = these_stops;
- GSList *j = next_stops;
- for (; i != NULL && j != NULL; i = i->next, j = j->next) {
- SPStop *stop0 = (SPStop *) i->data;
- SPStop *stop1 = (SPStop *) j->data;
+ auto i = these_stops.begin();
+ auto j = next_stops.end();
+ for (; i != these_stops.end() && j != next_stops.end(); ++i, ++j) {
+ SPStop *stop0 = *i;
+ SPStop *stop1 = *j;
- gint i1 = g_slist_index(these_stops, stop1);
- if (i1 != -1) {
- GSList *next_next = g_slist_nth (next_stops, i1);
- if (next_next) {
- SPStop *stop2 = (SPStop *) next_next->data;
+ auto i1 = std::find(these_stops.begin(), these_stops.end(), stop1);
+ if (i1 != these_stops.end()) {
+ if (next_stops.size()>(i1-these_stops.begin())) {
+ SPStop *stop2 = *(next_stops.begin() + (i1-these_stops.begin()));
- if (g_slist_find(todel, stop0) || g_slist_find(todel, stop2))
+ if (todel.find(stop0)!=todel.end() || todel.find(stop2) != todel.end())
continue;
guint32 const c0 = stop0->get_rgba32();
@@ -416,28 +410,23 @@ sp_gradient_simplify(GradientTool *rc, double tolerance)
sqr(SP_RGBA32_A_F(c1) - SP_RGBA32_A_F(c1r));
if (diff < tolerance)
- todel = g_slist_prepend (todel, stop1);
+ todel.insert(stop1);
}
}
}
- for (i = todel; i != NULL; i = i->next) {
- SPStop *stop = (SPStop*) i->data;
+ for (auto stop : todel) {
doc = stop->document;
Inkscape::XML::Node * parent = stop->getRepr()->parent();
parent->removeChild( stop->getRepr() );
}
- if (g_slist_length(todel) > 0) {
+ if (!todel.empty()) {
DocumentUndo::done(doc, SP_VERB_CONTEXT_GRADIENT, _("Simplify gradient"));
drag->local_change = true;
drag->updateDraggers();
drag->selectByCoords(coords);
}
-
- g_slist_free (todel);
- g_slist_free (these_stops);
- g_slist_free (next_stops);
}
@@ -676,7 +665,7 @@ bool GradientTool::root_handler(GdkEvent* event) {
break;
case GDK_KEY_PRESS:
- switch (get_group0_keyval (&event->key)) {
+ switch (get_latin_keyval (&event->key)) {
case GDK_KEY_Alt_L:
case GDK_KEY_Alt_R:
case GDK_KEY_Control_L:
@@ -730,7 +719,7 @@ bool GradientTool::root_handler(GdkEvent* event) {
case GDK_KEY_KP_4:
if (!MOD__CTRL(event)) { // not ctrl
gint mul = 1 + gobble_key_events(
- get_group0_keyval(&event->key), 0); // with any mask
+ get_latin_keyval(&event->key), 0); // with any mask
if (MOD__ALT(event)) { // alt
if (MOD__SHIFT(event)) {
drag->selected_move_screen(mul*-10, 0); // shift
@@ -753,7 +742,7 @@ bool GradientTool::root_handler(GdkEvent* event) {
case GDK_KEY_KP_8:
if (!MOD__CTRL(event)) { // not ctrl
gint mul = 1 + gobble_key_events(
- get_group0_keyval(&event->key), 0); // with any mask
+ get_latin_keyval(&event->key), 0); // with any mask
if (MOD__ALT(event)) { // alt
if (MOD__SHIFT(event)) {
drag->selected_move_screen(0, mul*10); // shift
@@ -777,7 +766,7 @@ bool GradientTool::root_handler(GdkEvent* event) {
case GDK_KEY_KP_6:
if (!MOD__CTRL(event)) { // not ctrl
gint mul = 1 + gobble_key_events(
- get_group0_keyval(&event->key), 0); // with any mask
+ get_latin_keyval(&event->key), 0); // with any mask
if (MOD__ALT(event)) { // alt
if (MOD__SHIFT(event)) {
@@ -802,7 +791,7 @@ bool GradientTool::root_handler(GdkEvent* event) {
case GDK_KEY_KP_2:
if (!MOD__CTRL(event)) { // not ctrl
gint mul = 1 + gobble_key_events(
- get_group0_keyval(&event->key), 0); // with any mask
+ get_latin_keyval(&event->key), 0); // with any mask
if (MOD__ALT(event)) { // alt
if (MOD__SHIFT(event)) {
@@ -859,7 +848,7 @@ bool GradientTool::root_handler(GdkEvent* event) {
break;
case GDK_KEY_RELEASE:
- switch (get_group0_keyval (&event->key)) {
+ switch (get_latin_keyval (&event->key)) {
case GDK_KEY_Alt_L:
case GDK_KEY_Alt_R:
case GDK_KEY_Control_L:
diff --git a/src/ui/tools/lpe-tool.cpp b/src/ui/tools/lpe-tool.cpp
index 35e6d14a0..ad3964f4a 100644
--- a/src/ui/tools/lpe-tool.cpp
+++ b/src/ui/tools/lpe-tool.cpp
@@ -225,14 +225,14 @@ bool LpeTool::root_handler(GdkEvent* event) {
case GDK_KEY_PRESS:
/**
- switch (get_group0_keyval (&event->key)) {
+ switch (get_latin_keyval (&event->key)) {
}
break;
**/
case GDK_KEY_RELEASE:
/**
- switch (get_group0_keyval(&event->key)) {
+ switch (get_latin_keyval(&event->key)) {
case GDK_Control_L:
case GDK_Control_R:
dc->_message_context->clear();
diff --git a/src/ui/tools/measure-tool.cpp b/src/ui/tools/measure-tool.cpp
index 0da883891..24295e7cf 100644
--- a/src/ui/tools/measure-tool.cpp
+++ b/src/ui/tools/measure-tool.cpp
@@ -1005,7 +1005,7 @@ void MeasureTool::setLabelText(const char *value, Geom::Point pos, double fontsi
text_item_box->transform *= Geom::Translate(pos);
text_item_box->transform *= SP_ITEM(desktop->currentLayer())->i2doc_affine().inverse();
text_item_box->updateRepr();
- text_item_box->doWriteTransform(text_item_box->getRepr(), text_item_box->transform, NULL, true);
+ text_item_box->doWriteTransform(text_item_box->transform, NULL, true);
Inkscape::XML::Node *rlabel = text_item_box->getRepr();
text_item_box->deleteObject();
measure_repr->addChild(rlabel, NULL);
@@ -1014,7 +1014,7 @@ void MeasureTool::setLabelText(const char *value, Geom::Point pos, double fontsi
text_item->transform *= Geom::Rotate(angle);
text_item->transform *= Geom::Translate(pos);
text_item->transform *= SP_ITEM(desktop->currentLayer())->i2doc_affine().inverse();
- text_item->doWriteTransform(text_item->getRepr(), text_item->transform, NULL, true);
+ text_item->doWriteTransform(text_item->transform, NULL, true);
}
}
diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp
index d79741270..fdfae84df 100644
--- a/src/ui/tools/mesh-tool.cpp
+++ b/src/ui/tools/mesh-tool.cpp
@@ -170,68 +170,6 @@ void MeshTool::selection_changed(Inkscape::Selection* /*sel*/) {
// FIXME
// We need to update mesh gradient handles.
// Get gradient this drag belongs too..
- // std::cout << "mesh_selection_changed: selection: objects: " << n_obj << std::endl;
- // GSList *itemList = (GSList *) selection->itemList();
- // while( itemList ) {
-
- // SPItem *item = SP_ITEM( itemList->data );
- // // std::cout << " item: " << SP_OBJECT(item)->getId() << std::endl;
-
- // SPStyle *style = item->style;
- // if (style && (style->fill.isPaintserver())) {
-
- // SPPaintServer *server = item->style->getFillPaintServer();
- // if ( SP_IS_MESHGRADIENT(server) ) {
-
- // SPMeshGradient *mg = SP_MESHGRADIENT(server);
-
- // guint rows = 0;//mg->array.patches.size();
- // for ( guint i = 0; i < rows; ++i ) {
- // guint columns = 0;//mg->array.patches[0].size();
- // for ( guint j = 0; j < columns; ++j ) {
- // }
- // }
- // }
- // }
- // itemList = itemList->next;
- // }
-
- // GList* dragger_ptr = drag->draggers; // Points to GrDragger class (group of GrDraggable)
- // guint count = 0;
- // while( dragger_ptr ) {
-
- // std::cout << "mesh_selection_changed: dragger: " << ++count << std::endl;
- // GSList* draggable_ptr = ((GrDragger *) dragger_ptr->data)->draggables;
-
- // while( draggable_ptr ) {
-
- // std::cout << "mesh_selection_changed: draggable: " << draggable_ptr << std::endl;
- // GrDraggable *draggable = (GrDraggable *) draggable_ptr->data;
-
- // gint point_type = draggable->point_type;
- // gint point_i = draggable->point_i;
- // bool fill_or_stroke = draggable->fill_or_stroke;
-
- // if( point_type == POINT_MG_CORNER ) {
-
- // //std::cout << "mesh_selection_changed: POINT_MG_CORNER: " << point_i << std::endl;
- // // Now we must create or destroy corresponding handles.
-
- // if( g_list_find( drag->selected, dragger_ptr->data ) ) {
- // //std::cout << "gradient_selection_changed: Selected: " << point_i << std::endl;
- // // Which meshes does this point belong to?
-
- // } else {
- // //std::cout << "mesh_selection_changed: Not Selected: " << point_i << std::endl;
- // }
- // }
-
- // draggable_ptr = draggable_ptr->next;
-
- // }
-
- // dragger_ptr = dragger_ptr->next;
- // }
}
void MeshTool::setup() {
@@ -887,7 +825,7 @@ bool MeshTool::root_handler(GdkEvent* event) {
#endif
// FIXME: tip
- switch (get_group0_keyval (&event->key)) {
+ switch (get_latin_keyval (&event->key)) {
case GDK_KEY_Alt_L:
case GDK_KEY_Alt_R:
case GDK_KEY_Control_L:
@@ -926,7 +864,7 @@ bool MeshTool::root_handler(GdkEvent* event) {
case GDK_KEY_KP_Left:
case GDK_KEY_KP_4:
if (!MOD__CTRL(event)) { // not ctrl
- gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask
+ gint mul = 1 + gobble_key_events(get_latin_keyval(&event->key), 0); // with any mask
if (MOD__ALT(event)) { // alt
if (MOD__SHIFT(event)) {
@@ -950,7 +888,7 @@ bool MeshTool::root_handler(GdkEvent* event) {
case GDK_KEY_KP_Up:
case GDK_KEY_KP_8:
if (!MOD__CTRL(event)) { // not ctrl
- gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask
+ gint mul = 1 + gobble_key_events(get_latin_keyval(&event->key), 0); // with any mask
if (MOD__ALT(event)) { // alt
if (MOD__SHIFT(event)) {
@@ -974,7 +912,7 @@ bool MeshTool::root_handler(GdkEvent* event) {
case GDK_KEY_KP_Right:
case GDK_KEY_KP_6:
if (!MOD__CTRL(event)) { // not ctrl
- gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask
+ gint mul = 1 + gobble_key_events(get_latin_keyval(&event->key), 0); // with any mask
if (MOD__ALT(event)) { // alt
if (MOD__SHIFT(event)) {
@@ -998,7 +936,7 @@ bool MeshTool::root_handler(GdkEvent* event) {
case GDK_KEY_KP_Down:
case GDK_KEY_KP_2:
if (!MOD__CTRL(event)) { // not ctrl
- gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask
+ gint mul = 1 + gobble_key_events(get_latin_keyval(&event->key), 0); // with any mask
if (MOD__ALT(event)) { // alt
if (MOD__SHIFT(event)) {
@@ -1096,7 +1034,7 @@ bool MeshTool::root_handler(GdkEvent* event) {
#ifdef DEBUG_MESH
std::cout << "sp_mesh_context_root_handler: GDK_KEY_RELEASE" << std::endl;
#endif
- switch (get_group0_keyval (&event->key)) {
+ switch (get_latin_keyval (&event->key)) {
case GDK_KEY_Alt_L:
case GDK_KEY_Alt_R:
case GDK_KEY_Control_L:
diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp
index d508a16f2..2b3de5203 100644
--- a/src/ui/tools/node-tool.cpp
+++ b/src/ui/tools/node-tool.cpp
@@ -358,6 +358,7 @@ void NodeTool::set(const Inkscape::Preferences::Entry& value) {
}
/** Recursively collect ShapeRecords */
+static
void gather_items(NodeTool *nt, SPItem *base, SPObject *obj, Inkscape::UI::ShapeRole role,
std::set<Inkscape::UI::ShapeRecord> &s)
{
@@ -437,7 +438,7 @@ void NodeTool::selection_changed(Inkscape::Selection *sel) {
if ((SP_IS_SHAPE(r.item) || SP_IS_TEXT(r.item) || SP_IS_GROUP(r.item) || SP_IS_OBJECTGROUP(r.item)) &&
this->_shape_editors.find(r.item) == this->_shape_editors.end())
{
- ShapeEditor *si = new ShapeEditor(this->desktop);
+ ShapeEditor *si = new ShapeEditor(this->desktop, r.edit_transform);
si->set_item(r.item);
this->_shape_editors.insert(const_cast<SPItem*&>(r.item), si);
}
@@ -549,7 +550,7 @@ bool NodeTool::root_handler(GdkEvent* event) {
// otherwise some features cease to work
case GDK_KEY_PRESS:
- switch (get_group0_keyval(&event->key))
+ switch (get_latin_keyval(&event->key))
{
case GDK_KEY_Escape: // deselect everything
if (this->_selected_nodes->empty()) {
diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp
index dcdbe1220..16cdf63b5 100644
--- a/src/ui/tools/pen-tool.cpp
+++ b/src/ui/tools/pen-tool.cpp
@@ -861,18 +861,18 @@ bool PenTool::_handle2ButtonPress(GdkEventButton const &bevent) {
void PenTool::_redrawAll() {
// green
- if (this->green_bpaths) {
+ if (! this->green_bpaths.empty()) {
// remove old piecewise green canvasitems
- while (this->green_bpaths) {
- sp_canvas_item_destroy(SP_CANVAS_ITEM(this->green_bpaths->data));
- this->green_bpaths = g_slist_remove(this->green_bpaths, this->green_bpaths->data);
+ for (auto i : this->green_bpaths){
+ sp_canvas_item_destroy(i);
}
+ this->green_bpaths.clear();
// one canvas bpath for all of green_curve
SPCanvasItem *canvas_shape = sp_canvas_bpath_new(this->desktop->getSketch(), this->green_curve, true);
sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(canvas_shape), this->green_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(canvas_shape), 0, SP_WIND_RULE_NONZERO);
- this->green_bpaths = g_slist_prepend(this->green_bpaths, canvas_shape);
+ this->green_bpaths.push_back(canvas_shape);
}
if (this->green_anchor) {
SP_CTRL(this->green_anchor->ctrl)->moveto(this->green_anchor->dp);
@@ -1063,7 +1063,7 @@ bool PenTool::_handleKeyPress(GdkEvent *event) {
}
}
- switch (get_group0_keyval (&event->key)) {
+ switch (get_latin_keyval (&event->key)) {
case GDK_KEY_Left: // move last point left
case GDK_KEY_KP_Left:
if (!MOD__CTRL(event)) { // not ctrl
@@ -1254,10 +1254,10 @@ void PenTool::_resetColors() {
this->blue_curve->reset();
sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->blue_bpath), NULL, true);
// Green
- while (this->green_bpaths) {
- sp_canvas_item_destroy(SP_CANVAS_ITEM(this->green_bpaths->data));
- this->green_bpaths = g_slist_remove(this->green_bpaths, this->green_bpaths->data);
+ for (auto i:this->green_bpaths) {
+ sp_canvas_item_destroy(i);
}
+ this->green_bpaths.clear();
this->green_curve->reset();
if (this->green_anchor) {
this->green_anchor = sp_draw_anchor_destroy(this->green_anchor);
@@ -1292,7 +1292,7 @@ void PenTool::_setAngleDistanceStatusMessage(Geom::Point const p, int pc_point_t
Geom::Point rel = p - this->p[pc_point_to_compare];
Inkscape::Util::Quantity q = Inkscape::Util::Quantity(Geom::L2(rel), "px");
- GString *dist = g_string_new(q.string(desktop->namedview->display_units).c_str());
+ Glib::ustring dist = q.string(desktop->namedview->display_units);
double angle = atan2(rel[Geom::Y], rel[Geom::X]) * 180 / M_PI;
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
if (prefs->getBool("/options/compassangledisplay/value", 0) != 0) {
@@ -1302,8 +1302,7 @@ void PenTool::_setAngleDistanceStatusMessage(Geom::Point const p, int pc_point_t
}
}
- this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, message, angle, dist->str);
- g_string_free(dist, false);
+ this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, message, angle, dist.c_str());
}
// this function changes the colors red, green and blue making them transparent or not, depending on if spiro is being used.
@@ -1334,17 +1333,17 @@ void PenTool::_bsplineSpiroColor()
}
//We erase all the "green_bpaths" to recreate them after with the colour
//transparency recently modified
- if (this->green_bpaths) {
+ if (!this->green_bpaths.empty()) {
// remove old piecewise green canvasitems
- while (this->green_bpaths) {
- sp_canvas_item_destroy(SP_CANVAS_ITEM(this->green_bpaths->data));
- this->green_bpaths = g_slist_remove(this->green_bpaths, this->green_bpaths->data);
+ for (auto i:this->green_bpaths) {
+ sp_canvas_item_destroy(i);
}
+ this->green_bpaths.clear();
// one canvas bpath for all of green_curve
SPCanvasItem *canvas_shape = sp_canvas_bpath_new(this->desktop->getSketch(), this->green_curve, true);
sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(canvas_shape), this->green_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(canvas_shape), 0, SP_WIND_RULE_NONZERO);
- this->green_bpaths = g_slist_prepend(this->green_bpaths, canvas_shape);
+ this->green_bpaths.push_back(canvas_shape);
}
sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(this->red_bpath), this->red_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
}
@@ -1557,18 +1556,18 @@ void PenTool::_bsplineSpiroMotion(guint const state){
this->overwrite_curve = tmp_curve->copy();
}
}
- if (this->green_bpaths) {
+ if (!this->green_bpaths.empty()) {
this->green_curve = tmp_curve->copy();
// remove old piecewise green canvasitems
- while (this->green_bpaths) {
- sp_canvas_item_destroy(SP_CANVAS_ITEM(this->green_bpaths->data));
- this->green_bpaths = g_slist_remove(this->green_bpaths, this->green_bpaths->data);
+ for (auto i: this->green_bpaths) {
+ sp_canvas_item_destroy(i);
}
+ this->green_bpaths.clear();
// one canvas bpath for all of green_curve
SPCanvasItem *canvas_shape = sp_canvas_bpath_new(this->desktop->getSketch(), this->green_curve, true);
sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(canvas_shape), this->green_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(canvas_shape), 0, SP_WIND_RULE_NONZERO);
- this->green_bpaths = g_slist_prepend(this->green_bpaths, canvas_shape);
+ this->green_bpaths.push_back(canvas_shape);
}
}
if (cubic) {
@@ -1929,7 +1928,7 @@ void PenTool::_finishSegment(Geom::Point const p, guint const state) {
curve->unref();
sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(canvas_shape), this->green_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
- this->green_bpaths = g_slist_prepend(this->green_bpaths, canvas_shape);
+ this->green_bpaths.push_back(canvas_shape);
this->p[0] = this->p[3];
this->p[1] = this->p[4];
@@ -1955,11 +1954,9 @@ bool PenTool::_undoLastPoint() {
// Reset red curve
this->red_curve->reset();
// Destroy topmost green bpath
- if (this->green_bpaths) {
- if (this->green_bpaths->data) {
- sp_canvas_item_destroy(SP_CANVAS_ITEM(this->green_bpaths->data));
- }
- this->green_bpaths = g_slist_remove(this->green_bpaths, this->green_bpaths->data);
+ if (!this->green_bpaths.empty()) {
+ sp_canvas_item_destroy(this->green_bpaths.back());
+ this->green_bpaths.pop_back();
}
// Get last segment
if ( this->green_curve->is_unset() ) {
@@ -1987,11 +1984,9 @@ bool PenTool::_undoLastPoint() {
// delete the last segment of the green curve
if (this->green_curve->get_segment_count() == 1) {
this->npoints = 5;
- if (this->green_bpaths) {
- if (this->green_bpaths->data) {
- sp_canvas_item_destroy(SP_CANVAS_ITEM(this->green_bpaths->data));
- }
- this->green_bpaths = g_slist_remove(this->green_bpaths, this->green_bpaths->data);
+ if (!this->green_bpaths.empty()) {
+ sp_canvas_item_destroy(this->green_bpaths.back());
+ this->green_bpaths.pop_back();
}
this->green_curve->reset();
} else {
diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp
index 3705d0f43..6f64e8e26 100644
--- a/src/ui/tools/pencil-tool.cpp
+++ b/src/ui/tools/pencil-tool.cpp
@@ -475,10 +475,10 @@ void PencilTool::_cancel() {
this->red_curve->reset();
sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), NULL);
- while (this->green_bpaths) {
- sp_canvas_item_destroy(SP_CANVAS_ITEM(this->green_bpaths->data));
- this->green_bpaths = g_slist_remove(this->green_bpaths, this->green_bpaths->data);
+ for (auto i:this->green_bpaths) {
+ sp_canvas_item_destroy(i);
}
+ this->green_bpaths.clear();
this->green_curve->reset();
if (this->green_anchor) {
this->green_anchor = sp_draw_anchor_destroy(this->green_anchor);
@@ -493,7 +493,7 @@ void PencilTool::_cancel() {
bool PencilTool::_handleKeyPress(GdkEventKey const &event) {
bool ret = false;
- switch (get_group0_keyval(&event)) {
+ switch (get_latin_keyval(&event)) {
case GDK_KEY_Up:
case GDK_KEY_Down:
case GDK_KEY_KP_Up:
@@ -546,7 +546,7 @@ bool PencilTool::_handleKeyPress(GdkEventKey const &event) {
bool PencilTool::_handleKeyRelease(GdkEventKey const &event) {
bool ret = false;
- switch (get_group0_keyval(&event)) {
+ switch (get_latin_keyval(&event)) {
case GDK_KEY_Alt_L:
case GDK_KEY_Alt_R:
case GDK_KEY_Meta_L:
@@ -1067,7 +1067,7 @@ void PencilTool::_fitAndSplit() {
}
sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(cshape), this->green_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
- this->green_bpaths = g_slist_prepend(this->green_bpaths, cshape);
+ this->green_bpaths.push_back(cshape);
this->red_curve_is_valid = false;
}
diff --git a/src/ui/tools/rect-tool.cpp b/src/ui/tools/rect-tool.cpp
index 9ebf51e76..655650ef4 100644
--- a/src/ui/tools/rect-tool.cpp
+++ b/src/ui/tools/rect-tool.cpp
@@ -258,7 +258,7 @@ bool RectTool::root_handler(GdkEvent* event) {
}
break;
case GDK_KEY_PRESS:
- switch (get_group0_keyval (&event->key)) {
+ switch (get_latin_keyval (&event->key)) {
case GDK_KEY_Alt_L:
case GDK_KEY_Alt_R:
case GDK_KEY_Control_L:
@@ -326,7 +326,7 @@ bool RectTool::root_handler(GdkEvent* event) {
}
break;
case GDK_KEY_RELEASE:
- switch (get_group0_keyval (&event->key)) {
+ switch (get_latin_keyval (&event->key)) {
case GDK_KEY_Alt_L:
case GDK_KEY_Alt_R:
case GDK_KEY_Control_L:
@@ -397,8 +397,8 @@ void RectTool::drag(Geom::Point const pt, guint state) {
Inkscape::Util::Quantity rdimx_q = Inkscape::Util::Quantity(rdimx, "px");
Inkscape::Util::Quantity rdimy_q = Inkscape::Util::Quantity(rdimy, "px");
- GString *xs = g_string_new(rdimx_q.string(desktop->namedview->display_units).c_str());
- GString *ys = g_string_new(rdimy_q.string(desktop->namedview->display_units).c_str());
+ Glib::ustring xs = rdimx_q.string(desktop->namedview->display_units);
+ Glib::ustring ys = rdimy_q.string(desktop->namedview->display_units);
if (state & GDK_CONTROL_MASK) {
int ratio_x, ratio_y;
@@ -421,20 +421,25 @@ void RectTool::drag(Geom::Point const pt, guint state) {
}
if (!is_golden_ratio) {
- this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Rectangle</b>: %s &#215; %s (constrained to ratio %d:%d); with <b>Shift</b> to draw around the starting point"), xs->str, ys->str, ratio_x, ratio_y);
+ this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE,
+ _("<b>Rectangle</b>: %s &#215; %s (constrained to ratio %d:%d); with <b>Shift</b> to draw around the starting point"),
+ xs.c_str(), ys.c_str(), ratio_x, ratio_y);
} else {
if (ratio_y == 1) {
- this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Rectangle</b>: %s &#215; %s (constrained to golden ratio 1.618 : 1); with <b>Shift</b> to draw around the starting point"), xs->str, ys->str);
+ this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE,
+ _("<b>Rectangle</b>: %s &#215; %s (constrained to golden ratio 1.618 : 1); with <b>Shift</b> to draw around the starting point"),
+ xs.c_str(), ys.c_str());
} else {
- this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Rectangle</b>: %s &#215; %s (constrained to golden ratio 1 : 1.618); with <b>Shift</b> to draw around the starting point"), xs->str, ys->str);
+ this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE,
+ _("<b>Rectangle</b>: %s &#215; %s (constrained to golden ratio 1 : 1.618); with <b>Shift</b> to draw around the starting point"),
+ xs.c_str(), ys.c_str());
}
}
} else {
- this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Rectangle</b>: %s &#215; %s; with <b>Ctrl</b> to make square or integer-ratio rectangle; with <b>Shift</b> to draw around the starting point"), xs->str, ys->str);
+ this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE,
+ _("<b>Rectangle</b>: %s &#215; %s; with <b>Ctrl</b> to make square or integer-ratio rectangle; with <b>Shift</b> to draw around the starting point"),
+ xs.c_str(), ys.c_str());
}
-
- g_string_free(xs, FALSE);
- g_string_free(ys, FALSE);
}
void RectTool::finishItem() {
@@ -447,7 +452,7 @@ void RectTool::finishItem() {
}
this->rect->updateRepr();
- this->rect->doWriteTransform(this->rect->getRepr(), this->rect->transform, NULL, true);
+ this->rect->doWriteTransform(this->rect->transform, NULL, true);
this->desktop->canvas->endForcedFullRedraws();
diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp
index fca2173ca..3dfb764bb 100644
--- a/src/ui/tools/select-tool.cpp
+++ b/src/ui/tools/select-tool.cpp
@@ -344,18 +344,18 @@ bool SelectTool::item_handler(SPItem* item, GdkEvent* event) {
break;
case GDK_KEY_PRESS:
- if (get_group0_keyval (&event->key) == GDK_KEY_space) {
+ if (get_latin_keyval (&event->key) == GDK_KEY_space) {
if (this->dragging && this->grabbed) {
/* stamping mode: show content mode moving */
_seltrans->stamp();
ret = TRUE;
}
- } else if (get_group0_keyval (&event->key) == GDK_KEY_Tab) {
+ } else if (get_latin_keyval (&event->key) == GDK_KEY_Tab) {
if (this->dragging && this->grabbed) {
_seltrans->getNextClosestPoint(false);
ret = TRUE;
}
- } else if (get_group0_keyval (&event->key) == GDK_KEY_ISO_Left_Tab) {
+ } else if (get_latin_keyval (&event->key) == GDK_KEY_ISO_Left_Tab) {
if (this->dragging && this->grabbed) {
_seltrans->getNextClosestPoint(true);
ret = TRUE;
@@ -854,7 +854,7 @@ bool SelectTool::root_handler(GdkEvent* event) {
case GDK_KEY_PRESS: // keybindings for select context
{
{
- guint keyval = get_group0_keyval(&event->key);
+ guint keyval = get_latin_keyval(&event->key);
bool alt = ( MOD__ALT(event)
|| (keyval == GDK_KEY_Alt_L)
@@ -896,11 +896,11 @@ bool SelectTool::root_handler(GdkEvent* event) {
gdouble const offset = prefs->getDoubleLimited("/options/defaultscale/value", 2, 0, 1000, "px");
int const snaps = prefs->getInt("/options/rotationsnapsperpi/value", 12);
- switch (get_group0_keyval (&event->key)) {
+ switch (get_latin_keyval (&event->key)) {
case GDK_KEY_Left: // move selection left
case GDK_KEY_KP_Left:
if (!MOD__CTRL(event)) { // not ctrl
- gint mul = 1 + gobble_key_events( get_group0_keyval(&event->key), 0); // with any mask
+ gint mul = 1 + gobble_key_events( get_latin_keyval(&event->key), 0); // with any mask
if (MOD__ALT(event)) { // alt
if (MOD__SHIFT(event)) {
@@ -923,7 +923,7 @@ bool SelectTool::root_handler(GdkEvent* event) {
case GDK_KEY_Up: // move selection up
case GDK_KEY_KP_Up:
if (!MOD__CTRL(event)) { // not ctrl
- gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask
+ gint mul = 1 + gobble_key_events(get_latin_keyval(&event->key), 0); // with any mask
if (MOD__ALT(event)) { // alt
if (MOD__SHIFT(event)) {
@@ -946,7 +946,7 @@ bool SelectTool::root_handler(GdkEvent* event) {
case GDK_KEY_Right: // move selection right
case GDK_KEY_KP_Right:
if (!MOD__CTRL(event)) { // not ctrl
- gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask
+ gint mul = 1 + gobble_key_events(get_latin_keyval(&event->key), 0); // with any mask
if (MOD__ALT(event)) { // alt
if (MOD__SHIFT(event)) {
@@ -969,7 +969,7 @@ bool SelectTool::root_handler(GdkEvent* event) {
case GDK_KEY_Down: // move selection down
case GDK_KEY_KP_Down:
if (!MOD__CTRL(event)) { // not ctrl
- gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask
+ gint mul = 1 + gobble_key_events(get_latin_keyval(&event->key), 0); // with any mask
if (MOD__ALT(event)) { // alt
if (MOD__SHIFT(event)) {
@@ -1024,7 +1024,7 @@ bool SelectTool::root_handler(GdkEvent* event) {
case GDK_KEY_bracketleft:
if (MOD__ALT(event)) {
- gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask
+ gint mul = 1 + gobble_key_events(get_latin_keyval(&event->key), 0); // with any mask
selection->rotateScreen(mul*1);
} else if (MOD__CTRL(event)) {
selection->rotate(90);
@@ -1037,7 +1037,7 @@ bool SelectTool::root_handler(GdkEvent* event) {
case GDK_KEY_bracketright:
if (MOD__ALT(event)) {
- gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask
+ gint mul = 1 + gobble_key_events(get_latin_keyval(&event->key), 0); // with any mask
selection->rotateScreen(-1*mul);
} else if (MOD__CTRL(event)) {
selection->rotate(-90);
@@ -1097,7 +1097,7 @@ bool SelectTool::root_handler(GdkEvent* event) {
break;
}
case GDK_KEY_RELEASE: {
- guint keyval = get_group0_keyval(&event->key);
+ guint keyval = get_latin_keyval(&event->key);
if (key_is_a_modifier (keyval)) {
this->defaultMessageContext()->clear();
}
diff --git a/src/ui/tools/spiral-tool.cpp b/src/ui/tools/spiral-tool.cpp
index b681aec38..bb8ce6356 100644
--- a/src/ui/tools/spiral-tool.cpp
+++ b/src/ui/tools/spiral-tool.cpp
@@ -232,7 +232,7 @@ bool SpiralTool::root_handler(GdkEvent* event) {
break;
case GDK_KEY_PRESS:
- switch (get_group0_keyval(&event->key)) {
+ switch (get_latin_keyval(&event->key)) {
case GDK_KEY_Alt_R:
case GDK_KEY_Control_L:
case GDK_KEY_Control_R:
@@ -291,7 +291,7 @@ bool SpiralTool::root_handler(GdkEvent* event) {
break;
case GDK_KEY_RELEASE:
- switch (get_group0_keyval(&event->key)) {
+ switch (get_latin_keyval(&event->key)) {
case GDK_KEY_Alt_L:
case GDK_KEY_Alt_R:
case GDK_KEY_Control_L:
@@ -372,11 +372,10 @@ void SpiralTool::drag(Geom::Point const &p, guint state) {
/* status text */
Inkscape::Util::Quantity q = Inkscape::Util::Quantity(rad, "px");
- GString *rads = g_string_new(q.string(desktop->namedview->display_units).c_str());
+ Glib::ustring rads = q.string(desktop->namedview->display_units);
this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE,
_("<b>Spiral</b>: radius %s, angle %5g&#176;; with <b>Ctrl</b> to snap angle"),
- rads->str, sp_round((arg + 2.0*M_PI*this->spiral->revo)*180/M_PI, 0.0001));
- g_string_free(rads, FALSE);
+ rads.c_str(), sp_round((arg + 2.0*M_PI*this->spiral->revo)*180/M_PI, 0.0001));
}
void SpiralTool::finishItem() {
@@ -390,7 +389,7 @@ void SpiralTool::finishItem() {
spiral->set_shape();
spiral->updateRepr(SP_OBJECT_WRITE_EXT);
- spiral->doWriteTransform(spiral->getRepr(), spiral->transform, NULL, true);
+ spiral->doWriteTransform(spiral->transform, NULL, true);
this->desktop->canvas->endForcedFullRedraws();
diff --git a/src/ui/tools/spray-tool.cpp b/src/ui/tools/spray-tool.cpp
index f3e7e6d3c..5593ceb34 100644
--- a/src/ui/tools/spray-tool.cpp
+++ b/src/ui/tools/spray-tool.cpp
@@ -120,7 +120,7 @@ static void sp_spray_rotate_rel(Geom::Point c, SPDesktop */*desktop*/, SPItem *i
// Rotate item.
item->set_i2d_affine(item->i2dt_affine() * affine);
// Use each item's own transform writer, consistent with sp_selection_apply_affine()
- item->doWriteTransform(item->getRepr(), item->transform);
+ item->doWriteTransform(item->transform);
// Restore the center position (it's changed because the bbox center changed)
if (item->isCenterSet()) {
item->setCenter(c);
@@ -133,7 +133,7 @@ static void sp_spray_scale_rel(Geom::Point c, SPDesktop */*desktop*/, SPItem *it
{
Geom::Translate const s(c);
item->set_i2d_affine(item->i2dt_affine() * s.inverse() * scale * s);
- item->doWriteTransform(item->getRepr(), item->transform);
+ item->doWriteTransform(item->transform);
}
SprayTool::SprayTool()
@@ -1375,7 +1375,7 @@ bool SprayTool::root_handler(GdkEvent* event) {
}
case GDK_KEY_PRESS:
- switch (get_group0_keyval (&event->key)) {
+ switch (get_latin_keyval (&event->key)) {
case GDK_KEY_j:
case GDK_KEY_J:
if (MOD__SHIFT_ONLY(event)) {
@@ -1487,7 +1487,7 @@ bool SprayTool::root_handler(GdkEvent* event) {
case GDK_KEY_RELEASE: {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- switch (get_group0_keyval(&event->key)) {
+ switch (get_latin_keyval(&event->key)) {
case GDK_KEY_Shift_L:
case GDK_KEY_Shift_R:
this->update_cursor(false);
diff --git a/src/ui/tools/star-tool.cpp b/src/ui/tools/star-tool.cpp
index 32f0e6d92..ed25503c4 100644
--- a/src/ui/tools/star-tool.cpp
+++ b/src/ui/tools/star-tool.cpp
@@ -246,7 +246,7 @@ bool StarTool::root_handler(GdkEvent* event) {
break;
case GDK_KEY_PRESS:
- switch (get_group0_keyval(&event->key)) {
+ switch (get_latin_keyval(&event->key)) {
case GDK_KEY_Alt_R:
case GDK_KEY_Control_L:
case GDK_KEY_Control_R:
@@ -306,7 +306,7 @@ bool StarTool::root_handler(GdkEvent* event) {
break;
case GDK_KEY_RELEASE:
- switch (get_group0_keyval (&event->key)) {
+ switch (get_latin_keyval (&event->key)) {
case GDK_KEY_Alt_L:
case GDK_KEY_Alt_R:
case GDK_KEY_Control_L:
@@ -389,14 +389,12 @@ void StarTool::drag(Geom::Point p, guint state)
/* status text */
Inkscape::Util::Quantity q = Inkscape::Util::Quantity(r1, "px");
- GString *rads = g_string_new(q.string(desktop->namedview->display_units).c_str());
+ Glib::ustring rads = q.string(desktop->namedview->display_units);
this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE,
( this->isflatsided?
_("<b>Polygon</b>: radius %s, angle %5g&#176;; with <b>Ctrl</b> to snap angle")
: _("<b>Star</b>: radius %s, angle %5g&#176;; with <b>Ctrl</b> to snap angle") ),
- rads->str, sp_round((arg1) * 180 / M_PI, 0.0001));
-
- g_string_free(rads, FALSE);
+ rads.c_str(), sp_round((arg1) * 180 / M_PI, 0.0001));
}
void StarTool::finishItem() {
@@ -415,7 +413,7 @@ void StarTool::finishItem() {
this->star->setCenter(this->center);
this->star->set_shape();
this->star->updateRepr(SP_OBJECT_WRITE_EXT);
- this->star->doWriteTransform(this->star->getRepr(), this->star->transform, NULL, true);
+ this->star->doWriteTransform(this->star->transform, NULL, true);
desktop->canvas->endForcedFullRedraws();
diff --git a/src/ui/tools/text-tool.cpp b/src/ui/tools/text-tool.cpp
index 9091b455e..692b65c44 100644
--- a/src/ui/tools/text-tool.cpp
+++ b/src/ui/tools/text-tool.cpp
@@ -417,7 +417,7 @@ static void sp_text_context_setup_text(TextTool *tc)
text_item->transform = SP_ITEM(ec->desktop->currentLayer())->i2doc_affine().inverse();
text_item->updateRepr();
- text_item->doWriteTransform(text_item->getRepr(), text_item->transform, NULL, true);
+ text_item->doWriteTransform(text_item->transform, NULL, true);
DocumentUndo::done(ec->desktop->getDocument(), SP_VERB_CONTEXT_TEXT,
_("Create text"));
}
@@ -575,13 +575,9 @@ bool TextTool::root_handler(GdkEvent* event) {
// status text
Inkscape::Util::Quantity x_q = Inkscape::Util::Quantity(fabs((p - this->p0)[Geom::X]), "px");
Inkscape::Util::Quantity y_q = Inkscape::Util::Quantity(fabs((p - this->p0)[Geom::Y]), "px");
- GString *xs = g_string_new(x_q.string(desktop->namedview->display_units).c_str());
- GString *ys = g_string_new(y_q.string(desktop->namedview->display_units).c_str());
- this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Flowed text frame</b>: %s &#215; %s"), xs->str, ys->str);
-
- g_string_free(xs, FALSE);
- g_string_free(ys, FALSE);
-
+ Glib::ustring xs = x_q.string(desktop->namedview->display_units);
+ Glib::ustring ys = y_q.string(desktop->namedview->display_units);
+ this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Flowed text frame</b>: %s &#215; %s"), xs.c_str(), ys.c_str());
} else if (!this->sp_event_context_knot_mouseover()) {
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop);
@@ -657,7 +653,7 @@ bool TextTool::root_handler(GdkEvent* event) {
}
break;
case GDK_KEY_PRESS: {
- guint const group0_keyval = get_group0_keyval(&event->key);
+ guint const group0_keyval = get_latin_keyval(&event->key);
if (group0_keyval == GDK_KEY_KP_Add ||
group0_keyval == GDK_KEY_KP_Subtract) {
@@ -965,7 +961,7 @@ bool TextTool::root_handler(GdkEvent* event) {
if (this->text) {
if (MOD__ALT(event)) {
gint mul = 1 + gobble_key_events(
- get_group0_keyval(&event->key), 0); // with any mask
+ get_latin_keyval(&event->key), 0); // with any mask
if (MOD__SHIFT(event))
sp_te_adjust_kerning_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, Geom::Point(mul*-10, 0));
else
@@ -989,7 +985,7 @@ bool TextTool::root_handler(GdkEvent* event) {
if (this->text) {
if (MOD__ALT(event)) {
gint mul = 1 + gobble_key_events(
- get_group0_keyval(&event->key), 0); // with any mask
+ get_latin_keyval(&event->key), 0); // with any mask
if (MOD__SHIFT(event))
sp_te_adjust_kerning_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, Geom::Point(mul*10, 0));
else
@@ -1013,7 +1009,7 @@ bool TextTool::root_handler(GdkEvent* event) {
if (this->text) {
if (MOD__ALT(event)) {
gint mul = 1 + gobble_key_events(
- get_group0_keyval(&event->key), 0); // with any mask
+ get_latin_keyval(&event->key), 0); // with any mask
if (MOD__SHIFT(event))
sp_te_adjust_kerning_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, Geom::Point(0, mul*-10));
else
@@ -1037,7 +1033,7 @@ bool TextTool::root_handler(GdkEvent* event) {
if (this->text) {
if (MOD__ALT(event)) {
gint mul = 1 + gobble_key_events(
- get_group0_keyval(&event->key), 0); // with any mask
+ get_latin_keyval(&event->key), 0); // with any mask
if (MOD__SHIFT(event))
sp_te_adjust_kerning_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, Geom::Point(0, mul*10));
else
diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp
index 12c3a3675..7b4f67da9 100644
--- a/src/ui/tools/tool-base.cpp
+++ b/src/ui/tools/tool-base.cpp
@@ -71,6 +71,10 @@ static guint32 scroll_event_time = 0;
static gdouble scroll_multiply = 1;
static guint scroll_keyval = 0;
+// globals for key processing
+static bool latin_keys_group_valid = FALSE;
+static gint latin_keys_group;
+
namespace Inkscape {
namespace UI {
@@ -598,7 +602,7 @@ bool ToolBase::root_handler(GdkEvent* event) {
int const key_scroll = prefs->getIntLimited("/options/keyscroll/value",
10, 0, 1000);
- switch (get_group0_keyval(&event->key)) {
+ switch (get_latin_keyval(&event->key)) {
// GDK insists on stealing these keys (F1 for no idea what, tab for cycling widgets
// in the editing window). So we resteal them back and run our regular shortcut
// invoker on them.
@@ -638,7 +642,7 @@ bool ToolBase::root_handler(GdkEvent* event) {
int i = (int) floor(key_scroll * accelerate_scroll(event,
acceleration, desktop->getCanvas()));
- gobble_key_events(get_group0_keyval(&event->key), GDK_CONTROL_MASK);
+ gobble_key_events(get_latin_keyval(&event->key), GDK_CONTROL_MASK);
this->desktop->scroll_relative(Geom::Point(i, 0));
ret = TRUE;
} else {
@@ -653,7 +657,7 @@ bool ToolBase::root_handler(GdkEvent* event) {
int i = (int) floor(key_scroll * accelerate_scroll(event,
acceleration, desktop->getCanvas()));
- gobble_key_events(get_group0_keyval(&event->key), GDK_CONTROL_MASK);
+ gobble_key_events(get_latin_keyval(&event->key), GDK_CONTROL_MASK);
this->desktop->scroll_relative(Geom::Point(0, i));
ret = TRUE;
} else {
@@ -668,7 +672,7 @@ bool ToolBase::root_handler(GdkEvent* event) {
int i = (int) floor(key_scroll * accelerate_scroll(event,
acceleration, desktop->getCanvas()));
- gobble_key_events(get_group0_keyval(&event->key), GDK_CONTROL_MASK);
+ gobble_key_events(get_latin_keyval(&event->key), GDK_CONTROL_MASK);
this->desktop->scroll_relative(Geom::Point(-i, 0));
ret = TRUE;
} else {
@@ -683,7 +687,7 @@ bool ToolBase::root_handler(GdkEvent* event) {
int i = (int) floor(key_scroll * accelerate_scroll(event,
acceleration, desktop->getCanvas()));
- gobble_key_events(get_group0_keyval(&event->key), GDK_CONTROL_MASK);
+ gobble_key_events(get_latin_keyval(&event->key), GDK_CONTROL_MASK);
this->desktop->scroll_relative(Geom::Point(0, -i));
ret = TRUE;
} else {
@@ -752,7 +756,7 @@ bool ToolBase::root_handler(GdkEvent* event) {
gdk_window_set_cursor(gtk_widget_get_window (w), this->cursor);
}
- switch (get_group0_keyval(&event->key)) {
+ switch (get_latin_keyval(&event->key)) {
case GDK_KEY_space:
if (within_tolerance) {
// Space was pressed, but not panned
@@ -1138,7 +1142,7 @@ void sp_event_root_menu_popup(SPDesktop *desktop, SPItem *item, GdkEvent *event)
void sp_event_show_modifier_tip(Inkscape::MessageContext *message_context,
GdkEvent *event, gchar const *ctrl_tip, gchar const *shift_tip,
gchar const *alt_tip) {
- guint keyval = get_group0_keyval(&event->key);
+ guint keyval = get_latin_keyval(&event->key);
bool ctrl = ctrl_tip && (MOD__CTRL(event) || (keyval == GDK_KEY_Control_L) || (keyval
== GDK_KEY_Control_R));
@@ -1159,19 +1163,48 @@ void sp_event_show_modifier_tip(Inkscape::MessageContext *message_context,
}
/**
- * Return the keyval corresponding to the key event in group 0, i.e.,
- * in the main (English) layout.
+ * Try to determine the keys group of Latin layout.
+ * Check available keymap entries for Latin 'a' key and find the minimal integer value.
+ */
+static void update_latin_keys_group() {
+ GdkKeymapKey* keys;
+ gint n_keys;
+
+ latin_keys_group_valid = FALSE;
+ if (gdk_keymap_get_entries_for_keyval(gdk_keymap_get_default(), GDK_KEY_a, &keys, &n_keys)) {
+ for (gint i = 0; i < n_keys; i++) {
+ if (!latin_keys_group_valid || keys[i].group < latin_keys_group) {
+ latin_keys_group = keys[i].group;
+ latin_keys_group_valid = TRUE;
+ }
+ }
+ g_free(keys);
+ }
+}
+
+/**
+ * Initialize Latin keys group handling.
+ */
+void init_latin_keys_group() {
+ g_signal_connect(G_OBJECT(gdk_keymap_get_default()),
+ "keys-changed", G_CALLBACK(update_latin_keys_group), NULL);
+ update_latin_keys_group();
+}
+
+/**
+ * Return the keyval corresponding to the key event in Latin group.
*
* Use this instead of simply event->keyval, so that your keyboard shortcuts
* work regardless of layouts (e.g., in Cyrillic).
*/
-guint get_group0_keyval(GdkEventKey const *event, guint *consumed_modifiers /*= NULL*/) {
+guint get_latin_keyval(GdkEventKey const *event, guint *consumed_modifiers /*= NULL*/) {
guint keyval = 0;
GdkModifierType modifiers;
+ gint group = latin_keys_group_valid ? latin_keys_group : event->group;
gdk_keymap_translate_keyboard_state(
gdk_keymap_get_for_display(gdk_display_get_default()),
- event->hardware_keycode, (GdkModifierType) event->state, 0 /*event->group*/,
+ event->hardware_keycode, (GdkModifierType) event->state, group,
&keyval, NULL, NULL, &modifiers);
if (consumed_modifiers) {
diff --git a/src/ui/tools/tool-base.h b/src/ui/tools/tool-base.h
index 09a9db660..7185b787e 100644
--- a/src/ui/tools/tool-base.h
+++ b/src/ui/tools/tool-base.h
@@ -251,7 +251,8 @@ gint gobble_motion_events(gint mask);
void sp_event_show_modifier_tip(Inkscape::MessageContext *message_context, GdkEvent *event,
gchar const *ctrl_tip, gchar const *shift_tip, gchar const *alt_tip);
-guint get_group0_keyval(GdkEventKey const *event, guint *consumed_modifiers = NULL);
+void init_latin_keys_group();
+guint get_latin_keyval(GdkEventKey const *event, guint *consumed_modifiers = NULL);
SPItem *sp_event_context_find_item (SPDesktop *desktop, Geom::Point const &p, bool select_under, bool into_groups);
SPItem *sp_event_context_over_item (SPDesktop *desktop, SPItem *item, Geom::Point const &p);
diff --git a/src/ui/tools/tweak-tool.cpp b/src/ui/tools/tweak-tool.cpp
index dcd9413fb..9348ef842 100644
--- a/src/ui/tools/tweak-tool.cpp
+++ b/src/ui/tools/tweak-tool.cpp
@@ -374,23 +374,20 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P
}
if (dynamic_cast<SPGroup *>(item) && !dynamic_cast<SPBox3D *>(item)) {
- GSList *children = NULL;
+ std::vector<SPItem *> children;
for (auto& child: item->children) {
- if (dynamic_cast<SPItem *>(static_cast<SPObject *>(&child))) {
- children = g_slist_prepend(children, &child);
+ if (dynamic_cast<SPItem *>(&child)) {
+ children.push_back(dynamic_cast<SPItem *>(&child));
}
}
- for (GSList *i = children; i; i = i->next) {
- SPItem *child = dynamic_cast<SPItem *>(static_cast<SPObject *>(i->data));
+ for (auto i = children.rbegin(); i!= children.rend(); ++i) {
+ SPItem *child = *i;
g_assert(child != NULL);
if (sp_tweak_dilate_recursive (selection, child, p, vector, mode, radius, force, fidelity, reverse)) {
did = true;
}
}
-
- g_slist_free(children);
-
} else {
if (mode == TWEAK_MODE_MOVE) {
@@ -1287,7 +1284,7 @@ bool TweakTool::root_handler(GdkEvent* event) {
}
case GDK_KEY_PRESS:
{
- switch (get_group0_keyval (&event->key)) {
+ switch (get_latin_keyval (&event->key)) {
case GDK_KEY_m:
case GDK_KEY_M:
case GDK_KEY_0:
@@ -1482,7 +1479,7 @@ bool TweakTool::root_handler(GdkEvent* event) {
}
case GDK_KEY_RELEASE: {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- switch (get_group0_keyval(&event->key)) {
+ switch (get_latin_keyval(&event->key)) {
case GDK_KEY_Shift_L:
case GDK_KEY_Shift_R:
this->update_cursor(false);
diff --git a/src/ui/tools/zoom-tool.cpp b/src/ui/tools/zoom-tool.cpp
index 8ba0c17b3..6f7fca242 100644
--- a/src/ui/tools/zoom-tool.cpp
+++ b/src/ui/tools/zoom-tool.cpp
@@ -168,7 +168,7 @@ bool ZoomTool::root_handler(GdkEvent* event) {
break;
}
case GDK_KEY_PRESS:
- switch (get_group0_keyval (&event->key)) {
+ switch (get_latin_keyval (&event->key)) {
case GDK_KEY_Escape:
if (!Inkscape::Rubberband::get(desktop)->is_started()) {
Inkscape::SelectionHelper::selectNone(desktop);
@@ -206,7 +206,7 @@ bool ZoomTool::root_handler(GdkEvent* event) {
}
break;
case GDK_KEY_RELEASE:
- switch (get_group0_keyval (&event->key)) {
+ switch (get_latin_keyval (&event->key)) {
case GDK_KEY_Shift_L:
case GDK_KEY_Shift_R:
this->cursor_shape = cursor_zoom_xpm;
diff --git a/src/ui/view/makefile.in b/src/ui/view/makefile.in
deleted file mode 100644
index 0fe15637a..000000000
--- a/src/ui/view/makefile.in
+++ /dev/null
@@ -1,17 +0,0 @@
-# Convenience stub makefile to call the real Makefile.
-
-@SET_MAKE@
-
-OBJEXT = @OBJEXT@
-
-# Explicit so that it's the default rule.
-all:
- cd ../.. && $(MAKE) ui/view/all
-
-clean %.a %.$(OBJEXT):
- cd ../.. && $(MAKE) ui/view/$@
-
-.PHONY: all clean
-
-.SUFFIXES:
-.SUFFIXES: .a .$(OBJEXT)
diff --git a/src/ui/widget/color-notebook.cpp b/src/ui/widget/color-notebook.cpp
index a4df8187f..ba333d0ed 100644
--- a/src/ui/widget/color-notebook.cpp
+++ b/src/ui/widget/color-notebook.cpp
@@ -22,6 +22,7 @@
#include <glibmm/i18n.h>
#include <gtkmm/label.h>
#include <gtkmm/notebook.h>
+#include <gtkmm/radiobutton.h>
#include "preferences.h"
#include "widgets/spw-utilities.h"
@@ -325,8 +326,8 @@ void ColorNotebook::_addPage(Page &page)
_buttons[page_num] = gtk_radio_button_new_with_label(NULL, mode_name.c_str());
gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(_buttons[page_num]), FALSE);
if (page_num > 0) {
- GSList *group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(_buttons[0]));
- gtk_radio_button_set_group(GTK_RADIO_BUTTON(_buttons[page_num]), group);
+ auto g = Glib::wrap(GTK_RADIO_BUTTON(_buttons[0]))->get_group();
+ Glib::wrap(GTK_RADIO_BUTTON(_buttons[page_num]))->set_group(g);
}
gtk_widget_show(_buttons[page_num]);
gtk_box_pack_start(GTK_BOX(_buttonbox), _buttons[page_num], TRUE, TRUE, 0);
diff --git a/src/ui/widget/color-preview.cpp b/src/ui/widget/color-preview.cpp
index c9b6e56d2..54b2991f0 100644
--- a/src/ui/widget/color-preview.cpp
+++ b/src/ui/widget/color-preview.cpp
@@ -11,6 +11,7 @@
#include "ui/widget/color-preview.h"
#include "display/cairo-utils.h"
+#include <cairo.h>
#define SPCP_DEFAULT_WIDTH 32
#define SPCP_DEFAULT_HEIGHT 12
@@ -70,45 +71,45 @@ ColorPreview::setRgba32 (guint32 rgba)
bool
ColorPreview::on_draw(const Cairo::RefPtr<Cairo::Context>& cr)
{
- GdkRectangle warea, carea;
- gint w2;
-
+ double x, y, width, height;
const Gtk::Allocation& allocation = get_allocation();
- warea.x = allocation.get_x();
- warea.y = allocation.get_y();
- warea.width = allocation.get_width();
- warea.height = allocation.get_height();
+ x = 0;
+ y = 0;
+ width = allocation.get_width()/2.0;
+ height = allocation.get_height();
+
+ double radius = height / 7.5;
+ double degrees = M_PI / 180.0;
+ cairo_new_sub_path (cr->cobj());
+ cairo_line_to(cr->cobj(), width, 0);
+ cairo_line_to(cr->cobj(), width, height);
+ cairo_arc (cr->cobj(), x + radius, y + height - radius, radius, 90 * degrees, 180 * degrees);
+ cairo_arc (cr->cobj(), x + radius, y + radius, radius, 180 * degrees, 270 * degrees);
+ cairo_close_path (cr->cobj());
/* Transparent area */
- w2 = warea.width / 2;
-
- carea.x = warea.x;
- carea.y = warea.y;
- carea.width = w2;
- carea.height = warea.height;
-
cairo_pattern_t *checkers = ink_cairo_pattern_create_checkerboard();
- cr->rectangle(carea.x, carea.y, carea.width, carea.height);
cairo_set_source(cr->cobj(), checkers);
cr->fill_preserve();
ink_cairo_set_source_rgba32(cr->cobj(), _rgba);
cr->fill();
-
cairo_pattern_destroy(checkers);
/* Solid area */
- carea.x = warea.x + w2;
- carea.y = warea.y;
- carea.width = warea.width - w2;
- carea.height = warea.height;
+ x = width;
- cr->rectangle(carea.x, carea.y, carea.width, carea.height);
+ cairo_new_sub_path (cr->cobj());
+ cairo_arc (cr->cobj(), x + width - radius, y + radius, radius, -90 * degrees, 0 * degrees);
+ cairo_arc (cr->cobj(), x + width - radius, y + height - radius, radius, 0 * degrees, 90 * degrees);
+ cairo_line_to(cr->cobj(), x, height);
+ cairo_line_to(cr->cobj(), x, y);
+ cairo_close_path (cr->cobj());
ink_cairo_set_source_rgba32(cr->cobj(), _rgba | 0xff);
cr->fill();
-
+
return true;
}
diff --git a/src/ui/widget/makefile.in b/src/ui/widget/makefile.in
deleted file mode 100644
index e479d7031..000000000
--- a/src/ui/widget/makefile.in
+++ /dev/null
@@ -1,17 +0,0 @@
-# Convenience stub makefile to call the real Makefile.
-
-@SET_MAKE@
-
-OBJEXT = @OBJEXT@
-
-# Explicit so that it's the default rule.
-all:
- cd ../.. && $(MAKE) ui/widget/all
-
-clean %.a %.$(OBJEXT):
- cd ../.. && $(MAKE) ui/widget/$@
-
-.PHONY: all clean
-
-.SUFFIXES:
-.SUFFIXES: .a .$(OBJEXT)
diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp
index eb0e45f14..7427ad4e2 100644
--- a/src/ui/widget/page-sizer.cpp
+++ b/src/ui/widget/page-sizer.cpp
@@ -355,13 +355,12 @@ PageSizer::PageSizer(Registry & _wr)
_fitPageMarginExpander.set_vexpand();
_customDimTable.attach(_fitPageMarginExpander, 0, 2, 2, 1);
- _dimTabOrderGList = NULL;
- _dimTabOrderGList = g_list_append(_dimTabOrderGList, _dimensionWidth.gobj());
- _dimTabOrderGList = g_list_append(_dimTabOrderGList, _dimensionHeight.gobj());
- _dimTabOrderGList = g_list_append(_dimTabOrderGList, _dimensionUnits.gobj());
- _dimTabOrderGList = g_list_append(_dimTabOrderGList, _fitPageMarginExpander.gobj());
- Glib::ListHandle<Widget *> dimFocusChain(_dimTabOrderGList, Glib::OWNERSHIP_NONE);
- _customDimTable.set_focus_chain(dimFocusChain);
+ _dimTabOrderList.clear();
+ _dimTabOrderList.push_back(&_dimensionWidth);
+ _dimTabOrderList.push_back(&_dimensionHeight);
+ _dimTabOrderList.push_back(&_dimensionUnits);
+ _dimTabOrderList.push_back(&_fitPageMarginExpander);
+ _customDimTable.set_focus_chain(_dimTabOrderList);
//## Set up fit page expander
_fitPageMarginExpander.set_use_underline();
@@ -454,7 +453,6 @@ PageSizer::PageSizer(Registry & _wr)
*/
PageSizer::~PageSizer()
{
- g_list_free(_dimTabOrderGList);
}
diff --git a/src/ui/widget/page-sizer.h b/src/ui/widget/page-sizer.h
index f84f96782..329ecfc6d 100644
--- a/src/ui/widget/page-sizer.h
+++ b/src/ui/widget/page-sizer.h
@@ -220,7 +220,7 @@ protected:
RegisteredUnitMenu _dimensionUnits;
RegisteredScalarUnit _dimensionWidth;
RegisteredScalarUnit _dimensionHeight;
- GList * _dimTabOrderGList;
+ std::vector<Widget*> _dimTabOrderList;
//### Fit Page options
Gtk::Expander _fitPageMarginExpander;
diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp
index 9332fe0f9..aea9b7e8e 100644
--- a/src/ui/widget/panel.cpp
+++ b/src/ui/widget/panel.cpp
@@ -24,7 +24,6 @@
#include <glibmm/i18n.h>
#include "panel.h"
-#include "icon-size.h"
#include "preferences.h"
#include "desktop.h"
diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp
index 2981316c0..8b8e663a5 100644
--- a/src/ui/widget/preferences-widget.cpp
+++ b/src/ui/widget/preferences-widget.cpp
@@ -34,6 +34,7 @@
#include <glibmm/i18n.h>
#include <glibmm/convert.h>
+#include <glibmm/regex.h>
#ifdef WIN32
#include <windows.h>
@@ -78,6 +79,7 @@ void DialogPage::add_line(bool indent,
auto hb = Gtk::manage(new Gtk::Box());
hb->set_spacing(12);
+ hb->set_hexpand(true);
hb->pack_start(widget, expand_widget, expand_widget);
// Pack an additional widget into a box with the widget if desired
@@ -859,6 +861,35 @@ void PrefEntry::on_changed()
}
}
+void PrefMultiEntry::init(Glib::ustring const &prefs_path, int height)
+{
+ // TODO: Figure out if there's a way to specify height in lines instead of px
+ // and how to obtain a reasonable default width if 'expand_widget' is not used
+ set_size_request(100, height);
+ set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
+ set_shadow_type(Gtk::SHADOW_IN);
+
+ add(_text);
+
+ _prefs_path = prefs_path;
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ Glib::ustring value = prefs->getString(_prefs_path);
+ value = Glib::Regex::create("\\|")->replace_literal(value, 0, "\n", (Glib::RegexMatchFlags)0);
+ _text.get_buffer()->set_text(value);
+ _text.get_buffer()->signal_changed().connect(sigc::mem_fun(*this, &PrefMultiEntry::on_changed));
+}
+
+void PrefMultiEntry::on_changed()
+{
+ if (get_visible()) //only take action if user changed value
+ {
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ Glib::ustring value = _text.get_buffer()->get_text();
+ value = Glib::Regex::create("\\n")->replace_literal(value, 0, "|", (Glib::RegexMatchFlags)0);
+ prefs->setString(_prefs_path, value);
+ }
+}
+
void PrefColorPicker::init(Glib::ustring const &label, Glib::ustring const &prefs_path,
guint32 default_rgba)
{
diff --git a/src/ui/widget/preferences-widget.h b/src/ui/widget/preferences-widget.h
index 142793509..2578be533 100644
--- a/src/ui/widget/preferences-widget.h
+++ b/src/ui/widget/preferences-widget.h
@@ -28,6 +28,8 @@
#include <sigc++/sigc++.h>
#include <gtkmm/checkbutton.h>
#include <gtkmm/radiobutton.h>
+#include <gtkmm/scrolledwindow.h>
+#include <gtkmm/textview.h>
#include <gtkmm/comboboxtext.h>
#include <gtkmm/drawingarea.h>
#include <gtkmm/grid.h>
@@ -195,6 +197,16 @@ protected:
void on_changed();
};
+class PrefMultiEntry : public Gtk::ScrolledWindow
+{
+public:
+ void init(Glib::ustring const &prefs_path, int height);
+protected:
+ Glib::ustring _prefs_path;
+ Gtk::TextView _text;
+ void on_changed();
+};
+
class PrefEntryButtonHBox : public Gtk::HBox
{
public:
diff --git a/src/ui/widget/registered-widget.cpp b/src/ui/widget/registered-widget.cpp
index 639bd4161..a88413347 100644
--- a/src/ui/widget/registered-widget.cpp
+++ b/src/ui/widget/registered-widget.cpp
@@ -412,9 +412,12 @@ RegisteredColorPicker::on_changed (guint32 rgba)
local_repr = dt->getNamedView()->getRepr();
local_doc = dt->getDocument();
}
-
gchar c[32];
- sp_svg_write_color(c, sizeof(c), rgba);
+ if (_akey == _ckey + "_opacity_LPE") { //For LPE parameter we want stored with alpha
+ sprintf(c, "#%08x", rgba);
+ } else {
+ sp_svg_write_color(c, sizeof(c), rgba);
+ }
bool saved = DocumentUndo::getUndoSensitive(local_doc);
DocumentUndo::setUndoSensitive(local_doc, false);
local_repr->setAttribute(_ckey.c_str(), c);
diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp
index 68acddfcc..d9b93f6db 100644
--- a/src/ui/widget/selected-style.cpp
+++ b/src/ui/widget/selected-style.cpp
@@ -107,8 +107,7 @@ static const GtkTargetEntry ui_drop_target_entries [] = {
{"application/x-color", 0, APP_X_COLOR}
};
-#define ENTRIES_SIZE(n) sizeof(n)/sizeof(n[0])
-static guint nui_drop_target_entries = ENTRIES_SIZE(ui_drop_target_entries);
+static guint nui_drop_target_entries = G_N_ELEMENTS(ui_drop_target_entries);
/* convenience function */
static Dialog::FillAndStroke *get_fill_and_stroke_panel(SPDesktop *desktop);
@@ -139,7 +138,6 @@ SelectedStyle::SelectedStyle(bool /*layout*/)
_opacity_blocked (false),
- _unit_mis(NULL),
_sw_unit(NULL)
{
set_name("SelectedStyle");
@@ -336,7 +334,7 @@ SelectedStyle::SelectedStyle(bool /*layout*/)
while(iter != m.end()) {
Gtk::RadioMenuItem *mi = Gtk::manage(new Gtk::RadioMenuItem(_sw_group));
mi->add(*(new Gtk::Label(iter->first, Gtk::ALIGN_START)));
- _unit_mis = g_slist_append(_unit_mis, mi);
+ _unit_mis.push_back(mi);
Inkscape::Util::Unit const *u = unit_table.getUnit(iter->first);
mi->signal_activate().connect(sigc::bind<Inkscape::Util::Unit const *>(sigc::mem_fun(*this, &SelectedStyle::on_popup_units), u));
_popup_sw.attach(*mi, 0,1, row, row+1);
@@ -449,6 +447,7 @@ SelectedStyle::~SelectedStyle()
delete selection_modified_connection;
subselection_changed_connection->disconnect();
delete subselection_changed_connection;
+ _unit_mis.clear();
for (int i = SS_FILL; i <= SS_STROKE; i++) {
delete _color_preview[i];
@@ -488,9 +487,7 @@ SelectedStyle::setDesktop(SPDesktop *desktop)
_sw_unit = desktop->getNamedView()->display_units;
// Set the doc default unit active in the units list
- gint length = g_slist_length(_unit_mis);
- for (int i = 0; i < length; i++) {
- Gtk::RadioMenuItem *mi = (Gtk::RadioMenuItem *) g_slist_nth_data(_unit_mis, i);
+ for ( auto mi:_unit_mis ) {
if (mi && mi->get_label() == _sw_unit->abbr) {
mi->set_active();
break;
diff --git a/src/ui/widget/selected-style.h b/src/ui/widget/selected-style.h
index 065d745f0..b7f3d5dda 100644
--- a/src/ui/widget/selected-style.h
+++ b/src/ui/widget/selected-style.h
@@ -267,7 +267,7 @@ protected:
Gtk::Menu _popup_sw;
Gtk::RadioButtonGroup _sw_group;
- GSList *_unit_mis;
+ std::vector<Gtk::RadioMenuItem*> _unit_mis;
void on_popup_units(Inkscape::Util::Unit const *u);
void on_popup_preset(int i);
Gtk::MenuItem _popup_sw_remove;
diff --git a/src/ui/widget/spinbutton.cpp b/src/ui/widget/spinbutton.cpp
index d1776e630..0c082d3ce 100644
--- a/src/ui/widget/spinbutton.cpp
+++ b/src/ui/widget/spinbutton.cpp
@@ -71,7 +71,7 @@ bool SpinButton::on_my_focus_in_event(GdkEventFocus* /*event*/)
bool SpinButton::on_my_key_press_event(GdkEventKey* event)
{
- switch (Inkscape::UI::Tools::get_group0_keyval (event)) {
+ switch (Inkscape::UI::Tools::get_latin_keyval (event)) {
case GDK_KEY_Escape:
undo();
return true; // I consumed the event
diff --git a/src/ui/widget/unit-tracker.cpp b/src/ui/widget/unit-tracker.cpp
index a1501c229..d36220b74 100644
--- a/src/ui/widget/unit-tracker.cpp
+++ b/src/ui/widget/unit-tracker.cpp
@@ -14,7 +14,7 @@
#include "style-internal.h"
#include "unit-tracker.h"
-#include "widgets/ege-select-one-action.h"
+//#include "widgets/ege-select-one-action.h"
#define COLUMN_STRING 0
@@ -31,9 +31,6 @@ UnitTracker::UnitTracker(UnitType unit_type) :
_activeUnit(NULL),
_activeUnitInitialized(false),
_store(0),
- _unitList(0),
- _actionList(0),
- _adjList(0),
_priorValues()
{
_store = gtk_list_store_new(1, G_TYPE_STRING);
@@ -58,17 +55,17 @@ UnitTracker::UnitTracker(UnitType unit_type) :
UnitTracker::~UnitTracker()
{
// Unhook weak references to GtkActions
- while (_actionList) {
- g_signal_handlers_disconnect_by_func(G_OBJECT(_actionList->data), (gpointer) _unitChangedCB, this);
- g_object_weak_unref(G_OBJECT(_actionList->data), _actionFinalizedCB, this);
- _actionList = g_slist_delete_link(_actionList, _actionList);
+ for (auto i : _actionList) {
+ g_signal_handlers_disconnect_by_func(G_OBJECT(i), (gpointer) _unitChangedCB, this);
+ g_object_weak_unref(G_OBJECT(i), _actionFinalizedCB, this);
}
+ _actionList.clear();
// Unhook weak references to GtkAdjustments
- while (_adjList) {
- g_object_weak_unref(G_OBJECT(_adjList->data), _adjustmentFinalizedCB, this);
- _adjList = g_slist_delete_link(_adjList, _adjList);
+ for (auto i : _adjList) {
+ g_object_weak_unref(G_OBJECT(i), _adjustmentFinalizedCB, this);
}
+ _adjList.clear();
}
bool UnitTracker::isUpdating() const
@@ -109,9 +106,9 @@ void UnitTracker::setActiveUnitByAbbr(gchar const *abbr)
void UnitTracker::addAdjustment(GtkAdjustment *adj)
{
- if (!g_slist_find(_adjList, adj)) {
+ if (std::find(_adjList.begin(),_adjList.end(),adj)!=_adjList.end()) {
g_object_weak_ref(G_OBJECT(adj), _adjustmentFinalizedCB, this);
- _adjList = g_slist_append(_adjList, adj);
+ _adjList.push_back(adj);
}
}
@@ -147,7 +144,7 @@ GtkAction *UnitTracker::createAction(gchar const *name, gchar const *label, gcha
ege_select_one_action_set_appearance(act1, "minimal");
g_object_weak_ref(G_OBJECT(act1), _actionFinalizedCB, this);
g_signal_connect(G_OBJECT(act1), "changed", G_CALLBACK(_unitChangedCB), this);
- _actionList = g_slist_append(_actionList, act1);
+ _actionList.push_back(act1);
return GTK_ACTION(act1);
}
@@ -180,9 +177,10 @@ void UnitTracker::_adjustmentFinalizedCB(gpointer data, GObject *where_the_objec
void UnitTracker::_actionFinalized(GObject *where_the_object_was)
{
- GSList *target = g_slist_find(_actionList, where_the_object_was);
- if (target) {
- _actionList = g_slist_remove(_actionList, where_the_object_was);
+ EgeSelectOneAction* act = (EgeSelectOneAction*)(where_the_object_was);
+ auto it = std::find(_actionList.begin(),_actionList.end(), act);
+ if (it != _actionList.end()) {
+ _actionList.erase(it);
} else {
g_warning("Received a finalization callback for unknown object %p", where_the_object_was);
}
@@ -190,9 +188,10 @@ void UnitTracker::_actionFinalized(GObject *where_the_object_was)
void UnitTracker::_adjustmentFinalized(GObject *where_the_object_was)
{
- GSList *target = g_slist_find(_adjList, where_the_object_was);
- if (target) {
- _adjList = g_slist_remove(_adjList, where_the_object_was);
+ GtkAdjustment* adj = (GtkAdjustment*)(where_the_object_was);
+ auto it = std::find(_adjList.begin(),_adjList.end(), adj);
+ if (it != _adjList.end()) {
+ _adjList.erase(it);
} else {
g_warning("Received a finalization callback for unknown object %p", where_the_object_was);
}
@@ -217,7 +216,7 @@ void UnitTracker::_setActive(gint active)
Inkscape::Util::Unit const *newUnit = unit_table.getUnit(newAbbr);
_activeUnit = newUnit;
- if (_adjList) {
+ if (!_adjList.empty()) {
_fixupAdjustments(unit, newUnit);
}
@@ -230,11 +229,8 @@ void UnitTracker::_setActive(gint active)
_active = active;
- for ( GSList *cur = _actionList ; cur ; cur = g_slist_next(cur) ) {
- if (IS_EGE_SELECT_ONE_ACTION(cur->data)) {
- EgeSelectOneAction *act = EGE_SELECT_ONE_ACTION(cur->data);
- ege_select_one_action_set_active(act, active);
- }
+ for (auto act:_actionList) {
+ ege_select_one_action_set_active(act, active);
}
_activeUnitInitialized = true;
@@ -244,8 +240,7 @@ void UnitTracker::_setActive(gint active)
void UnitTracker::_fixupAdjustments(Inkscape::Util::Unit const *oldUnit, Inkscape::Util::Unit const *newUnit)
{
_isUpdating = true;
- for ( GSList *cur = _adjList ; cur ; cur = g_slist_next(cur) ) {
- GtkAdjustment *adj = GTK_ADJUSTMENT(cur->data);
+ for ( auto adj : _adjList ) {
gdouble oldVal = gtk_adjustment_get_value(adj);
gdouble val = oldVal;
diff --git a/src/ui/widget/unit-tracker.h b/src/ui/widget/unit-tracker.h
index 8fa9ff304..643ac4e51 100644
--- a/src/ui/widget/unit-tracker.h
+++ b/src/ui/widget/unit-tracker.h
@@ -17,6 +17,7 @@
#include <map>
#include "util/units.h"
+#include "widgets/ege-select-one-action.h"
using Inkscape::Util::Unit;
using Inkscape::Util::UnitType;
@@ -65,9 +66,8 @@ private:
Inkscape::Util::Unit const *_activeUnit;
bool _activeUnitInitialized;
GtkListStore *_store;
- GSList *_unitList;
- GSList *_actionList;
- GSList *_adjList;
+ std::vector<EgeSelectOneAction*> _actionList;
+ std::vector<GtkAdjustment*> _adjList;
std::map <GtkAdjustment *, gdouble> _priorValues;
};