summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2015-03-18 18:17:44 +0000
committerJabiertxof <jtx@jtx.marker.es>2015-03-18 18:17:44 +0000
commit71508f76c3ddc33c41664599f9c10bf84d994d62 (patch)
tree68f69fd8c5b36c4f5a288bb8b2521405724cf9ce /src/ui
parentupdate to trunk (diff)
parentLatvian translation update (diff)
downloadinkscape-71508f76c3ddc33c41664599f9c10bf84d994d62.tar.gz
inkscape-71508f76c3ddc33c41664599f9c10bf84d994d62.zip
update to trunk
(bzr r13879.1.11)
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/CMakeLists.txt1
-rw-r--r--src/ui/Makefile_insert1
-rw-r--r--src/ui/clipboard.cpp12
-rw-r--r--src/ui/dialog/clonetiler.cpp11
-rw-r--r--src/ui/dialog/document-properties.cpp60
-rw-r--r--src/ui/dialog/filedialog.cpp2
-rw-r--r--src/ui/dialog/filedialogimpl-win32.cpp10
-rw-r--r--src/ui/dialog/filedialogimpl-win32.h2
-rw-r--r--src/ui/dialog/find.cpp6
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp4
-rw-r--r--src/ui/dialog/livepatheffect-editor.cpp42
-rw-r--r--src/ui/dialog/lpe-fillet-chamfer-properties.cpp8
-rw-r--r--src/ui/dialog/lpe-fillet-chamfer-properties.h6
-rw-r--r--src/ui/dialog/memory.cpp2
-rw-r--r--src/ui/dialog/objects.cpp68
-rw-r--r--src/ui/dialog/ocaldialogs.cpp2
-rw-r--r--src/ui/dialog/print.cpp21
-rw-r--r--src/ui/dialog/tags.cpp33
-rw-r--r--src/ui/dialog/tags.h2
-rw-r--r--src/ui/dialog/xml-tree.cpp16
-rw-r--r--src/ui/interface.cpp2
-rw-r--r--src/ui/object-edit.cpp120
-rw-r--r--src/ui/tool-factory.cpp102
-rw-r--r--src/ui/tool-factory.h10
-rw-r--r--src/ui/tools/arc-tool.cpp10
-rw-r--r--src/ui/tools/box3d-tool.cpp10
-rw-r--r--src/ui/tools/calligraphic-tool.cpp10
-rw-r--r--src/ui/tools/connector-tool.cpp10
-rw-r--r--src/ui/tools/dropper-tool.cpp10
-rw-r--r--src/ui/tools/eraser-tool.cpp10
-rw-r--r--src/ui/tools/flood-tool.cpp14
-rw-r--r--src/ui/tools/gradient-tool.cpp10
-rw-r--r--src/ui/tools/lpe-tool.cpp11
-rw-r--r--src/ui/tools/measure-tool.cpp10
-rw-r--r--src/ui/tools/mesh-tool.cpp26
-rw-r--r--src/ui/tools/node-tool.cpp10
-rw-r--r--src/ui/tools/pen-tool.cpp9
-rw-r--r--src/ui/tools/pencil-tool.cpp9
-rw-r--r--src/ui/tools/rect-tool.cpp10
-rw-r--r--src/ui/tools/select-tool.cpp9
-rw-r--r--src/ui/tools/spiral-tool.cpp10
-rw-r--r--src/ui/tools/spray-tool.cpp76
-rw-r--r--src/ui/tools/star-tool.cpp10
-rw-r--r--src/ui/tools/text-tool.cpp9
-rw-r--r--src/ui/tools/tweak-tool.cpp10
-rw-r--r--src/ui/tools/zoom-tool.cpp9
-rw-r--r--src/ui/view/view.h2
-rw-r--r--src/ui/widget/addtoicon.cpp17
-rw-r--r--src/ui/widget/addtoicon.h2
-rw-r--r--src/ui/widget/licensor.cpp2
-rw-r--r--src/ui/widget/page-sizer.cpp117
-rw-r--r--src/ui/widget/page-sizer.h19
-rw-r--r--src/ui/widget/selected-style.cpp4
53 files changed, 471 insertions, 537 deletions
diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt
index 98a5a224c..674254686 100644
--- a/src/ui/CMakeLists.txt
+++ b/src/ui/CMakeLists.txt
@@ -8,6 +8,7 @@ set(ui_SRC
object-edit.cpp
previewholder.cpp
shape-editor.cpp
+ tool-factory.cpp
tools-switch.cpp
uxmanager.cpp
diff --git a/src/ui/Makefile_insert b/src/ui/Makefile_insert
index 7aeb4a83d..f94cba4e9 100644
--- a/src/ui/Makefile_insert
+++ b/src/ui/Makefile_insert
@@ -21,6 +21,7 @@ ink_common_sources += \
ui/previewholder.h \
ui/shape-editor.cpp \
ui/shape-editor.h \
+ ui/tool-factory.cpp \
ui/tool-factory.h \
ui/tools-switch.cpp \
ui/tools-switch.h \
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp
index 94a1eb2dc..f1d0ff576 100644
--- a/src/ui/clipboard.cpp
+++ b/src/ui/clipboard.cpp
@@ -32,7 +32,7 @@
#include <glibmm/ustring.h>
#include <glibmm/i18n.h>
#include <glib/gstdio.h> // for g_file_set_contents etc., used in _onGet and paste
-#include "gc-core.h"
+#include "inkgc/gc-core.h"
#include "xml/repr.h"
#include "inkscape.h"
#include "io/stringstream.h"
@@ -685,10 +685,18 @@ void ClipboardManagerImpl::_copySelection(Inkscape::Selection *selection)
sp_repr_css_set(obj_copy, css, "style");
sp_repr_css_attr_unref(css);
+ Geom::Affine transform=item->i2doc_affine();
+
// write the complete accumulated transform passed to us
// (we're dealing with unattached representations, so we write to their attributes
// instead of using sp_item_set_transform)
- gchar *transform_str = sp_svg_transform_write(item->i2doc_affine());
+ SPUse *use=dynamic_cast<SPUse *>(item);
+ if( use && selection->includes(use->get_original()) ){//we are copying something whose parent is also copied (!)
+ transform = ((SPItem*)(use->get_original()->parent))->i2doc_affine().inverse() * transform;
+ }
+ gchar *transform_str = sp_svg_transform_write(transform );
+
+
obj_copy->setAttribute("transform", transform_str);
g_free(transform_str);
}
diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp
index fede30b26..bd3ad0254 100644
--- a/src/ui/dialog/clonetiler.cpp
+++ b/src/ui/dialog/clonetiler.cpp
@@ -2409,7 +2409,7 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg)
// Note: We create a clone at 0,0 too, right over the original, in case our clones are colored
// Get transform from symmetry, shift, scale, rotation
- Geom::Affine t = clonetiler_get_transform (type, i, j, center[Geom::X], center[Geom::Y], w, h,
+ Geom::Affine orig_t = clonetiler_get_transform (type, i, j, center[Geom::X], center[Geom::Y], w, h,
shiftx_per_i, shifty_per_i,
shiftx_per_j, shifty_per_j,
shiftx_rand, shifty_rand,
@@ -2428,7 +2428,8 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg)
rotate_rand,
rotate_alternatei, rotate_alternatej,
rotate_cumulatei, rotate_cumulatej );
-
+ Geom::Affine parent_transform = (((SPItem*)item->parent)->i2doc_affine())*(item->document->getRoot()->c2p.inverse());
+ Geom::Affine t = parent_transform*orig_t*parent_transform.inverse();
cur = center * t - center;
if (fillrect) {
if ((cur[Geom::X] > fillwidth) || (cur[Geom::Y] > fillheight)) { // off limits
@@ -2562,7 +2563,9 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg)
}
}
if (pick_to_size) {
- t = Geom::Translate(-center[Geom::X], -center[Geom::Y]) * Geom::Scale (val, val) * Geom::Translate(center[Geom::X], center[Geom::Y]) * t;
+ t = parent_transform * Geom::Translate(-center[Geom::X], -center[Geom::Y])
+ * Geom::Scale (val, val) * Geom::Translate(center[Geom::X], center[Geom::Y])
+ * parent_transform.inverse() * t;
}
if (pick_to_opacity) {
opacity *= val;
@@ -2590,7 +2593,7 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg)
Geom::Point new_center;
bool center_set = false;
if (obj_repr->attribute("inkscape:transform-center-x") || obj_repr->attribute("inkscape:transform-center-y")) {
- new_center = scale_units*desktop->dt2doc(item->getCenter()) * t;
+ new_center = scale_units*desktop->dt2doc(item->getCenter()) * orig_t;
center_set = true;
}
diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp
index af7ca678a..c381ed755 100644
--- a/src/ui/dialog/document-properties.cpp
+++ b/src/ui/dialog/document-properties.cpp
@@ -87,6 +87,13 @@ static Inkscape::XML::NodeEventVector const _repr_events = {
NULL // order_changed
};
+static void docprops_style_button(Gtk::Button& btn, char const* iconName)
+{
+ GtkWidget *child = sp_icon_new(Inkscape::ICON_SIZE_SMALL_TOOLBAR, iconName);
+ gtk_widget_show( child );
+ btn.add(*Gtk::manage(Glib::wrap(child)));
+ btn.set_relief(Gtk::RELIEF_NONE);
+}
DocumentProperties& DocumentProperties::getInstance()
{
@@ -615,22 +622,10 @@ void DocumentProperties::build_cms()
label_avail->set_markup (_("<b>Available Color Profiles:</b>"));
_link_btn.set_tooltip_text(_("Link Profile"));
-#if WITH_GTKMM_3_10
- _link_btn.set_image_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR);
-#else
- Gtk::Image *image_link = Gtk::manage(new Gtk::Image());
- image_link->set_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR);
- _link_btn.set_image(*image_link);
-#endif
+ docprops_style_button(_link_btn, INKSCAPE_ICON("list-add"));
_unlink_btn.set_tooltip_text(_("Unlink Profile"));
-#if WITH_GTKMM_3_10
- _unlink_btn.set_image_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR);
-#else
- Gtk::Image *image_unlink = Gtk::manage(new Gtk::Image());
- image_unlink->set_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR);
- _unlink_btn.set_image(*image_unlink);
-#endif
+ docprops_style_button(_unlink_btn, INKSCAPE_ICON("list-remove"));
_page_cms->set_spacing(4);
gint row = 0;
@@ -752,22 +747,10 @@ void DocumentProperties::build_scripting()
label_external->set_markup (_("<b>External script files:</b>"));
_external_add_btn.set_tooltip_text(_("Add the current file name or browse for a file"));
-#if WITH_GTKMM_3_10
- _external_add_btn.set_image_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR);
-#else
- Gtk::Image *image_ext_add = Gtk::manage(new Gtk::Image());
- image_ext_add->set_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR);
- _external_add_btn.set_image(*image_ext_add);
-#endif
+ docprops_style_button(_external_add_btn, INKSCAPE_ICON("list-add"));
_external_remove_btn.set_tooltip_text(_("Remove"));
-#if WITH_GTKMM_3_10
- _external_remove_btn.set_image_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR);
-#else
- Gtk::Image *image_ext_rm = Gtk::manage(new Gtk::Image());
- image_ext_rm->set_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR);
- _external_remove_btn.set_image(*image_ext_rm);
-#endif
+ docprops_style_button(_external_remove_btn, INKSCAPE_ICON("list-remove"));
_page_external_scripts->set_spacing(4);
gint row = 0;
@@ -841,22 +824,10 @@ void DocumentProperties::build_scripting()
label_embedded->set_markup (_("<b>Embedded script files:</b>"));
_embed_new_btn.set_tooltip_text(_("New"));
-#if WITH_GTKMM_3_10
- _embed_new_btn.set_image_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR);
-#else
- Gtk::Image *image_embed_new = Gtk::manage(new Gtk::Image());
- image_embed_new->set_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR);
- _embed_new_btn.set_image(*image_embed_new);
-#endif
+ docprops_style_button(_embed_new_btn, INKSCAPE_ICON("list-add"));
_embed_remove_btn.set_tooltip_text(_("Remove"));
-#if WITH_GTKMM_3_10
- _embed_remove_btn.set_image_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR);
-#else
- Gtk::Image *image_embed_rm = Gtk::manage(new Gtk::Image());
- image_embed_rm->set_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR);
- _embed_remove_btn.set_image(*image_embed_rm);
-#endif
+ docprops_style_button(_embed_remove_btn, INKSCAPE_ICON("list-remove"));
#if !WITH_GTKMM_3_0
// TODO: This has been removed from Gtkmm 3.0. Check that
@@ -1502,6 +1473,7 @@ void DocumentProperties::update()
}
_page_sizer.setDim(Inkscape::Util::Quantity(doc_w, doc_w_unit), Inkscape::Util::Quantity(doc_h, doc_h_unit));
_page_sizer.updateFitMarginsUI(nv->getRepr());
+ _page_sizer.updateScaleUI();
//-----------------------------------------------------------guide page
@@ -1684,6 +1656,8 @@ void DocumentProperties::onRemoveGrid()
}
/** Callback for document unit change. */
+/* This should not effect anything in the SVG tree (other than "inkscape:document-units").
+ This should only effect values displayed in the GUI. */
void DocumentProperties::onDocUnitChange()
{
SPDocument *doc = SP_ACTIVE_DOCUMENT;
@@ -1709,6 +1683,8 @@ void DocumentProperties::onDocUnitChange()
os << doc_unit->abbr;
repr->setAttribute("inkscape:document-units", os.str().c_str());
+ _page_sizer.updateScaleUI();
+
// Disable changing of SVG Units. The intent here is to change the units in the UI, not the units in SVG.
// This code should be moved (and fixed) once we have an "SVG Units" setting that sets what units are used in SVG data.
#if 0
diff --git a/src/ui/dialog/filedialog.cpp b/src/ui/dialog/filedialog.cpp
index 00ed09551..4e4b0278a 100644
--- a/src/ui/dialog/filedialog.cpp
+++ b/src/ui/dialog/filedialog.cpp
@@ -19,7 +19,7 @@
#include "filedialogimpl-gtkmm.h"
#include "filedialog.h"
-#include "gc-core.h"
+#include "inkgc/gc-core.h"
#include "ui/dialog-events.h"
#include "extension/output.h"
#include "preferences.h"
diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp
index ee6a0ef3a..cafc3be4f 100644
--- a/src/ui/dialog/filedialogimpl-win32.cpp
+++ b/src/ui/dialog/filedialogimpl-win32.cpp
@@ -44,6 +44,7 @@
#include "filedialog.h"
#include "sp-root.h"
+#include "preferences.h"
#include <zlib.h>
#include <cairomm/win32_surface.h>
@@ -272,6 +273,9 @@ void FileOpenDialogImplWin32::createFilterMenu()
}
if (dialogType != EXE_TYPES) {
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ _show_preview = prefs->getBool("/dialogs/open/enable_preview", true);
+
// Compose the filter string
Inkscape::Extension::DB::InputList extension_list;
Inkscape::Extension::db.get_input_list(extension_list);
@@ -842,6 +846,10 @@ LRESULT CALLBACK FileOpenDialogImplWin32::preview_wnd_proc(HWND hwnd, UINT uMsg,
void FileOpenDialogImplWin32::enable_preview(bool enable)
{
+ if (_show_preview != enable) {
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ prefs->setBool("/dialogs/open/enable_preview", enable);
+ }
_show_preview = enable;
// Relayout the dialog
@@ -1949,7 +1957,7 @@ UINT_PTR CALLBACK FileSaveDialogImplWin32::GetSaveFileName_hookproc(
pImpl = reinterpret_cast<FileSaveDialogImplWin32*>(ofn->lCustData);
// Create the Title label and edit control
- pImpl->_title_label = CreateWindowEx(0, "STATIC", "Title:",
+ pImpl->_title_label = CreateWindowEx(0, "STATIC", _("Title:"),
WS_VISIBLE|WS_CHILD,
CW_USEDEFAULT, CW_USEDEFAULT, rCB1.left-rST.left, rST.bottom-rST.top,
hParentWnd, NULL, hInstance, NULL);
diff --git a/src/ui/dialog/filedialogimpl-win32.h b/src/ui/dialog/filedialogimpl-win32.h
index f77249abd..8c3b6bad6 100644
--- a/src/ui/dialog/filedialogimpl-win32.h
+++ b/src/ui/dialog/filedialogimpl-win32.h
@@ -24,7 +24,7 @@
#include "filedialogimpl-gtkmm.h"
-#include "gc-core.h"
+#include "inkgc/gc-core.h"
// define WINVER high enough so we get the correct OPENFILENAMEW size
#ifndef WINVER
#define WINVER 0x0500
diff --git a/src/ui/dialog/find.cpp b/src/ui/dialog/find.cpp
index 6d8d64607..951cb01ea 100644
--- a/src/ui/dialog/find.cpp
+++ b/src/ui/dialog/find.cpp
@@ -37,6 +37,7 @@
#include "preferences.h"
#include "sp-text.h"
#include "sp-flowtext.h"
+#include "sp-flowdiv.h"
#include "text-editing.h"
#include "sp-tspan.h"
#include "sp-tref.h"
@@ -693,7 +694,10 @@ bool Find::item_type_match (SPItem *item)
} else if (dynamic_cast<SPPath *>(item) || dynamic_cast<SPLine *>(item) || dynamic_cast<SPPolyLine *>(item)) {
return (all || check_paths.get_active());
- } else if (dynamic_cast<SPText *>(item) || dynamic_cast<SPTSpan *>(item) || dynamic_cast<SPTRef *>(item) || dynamic_cast<SPString *>(item)) {
+ } else if (dynamic_cast<SPText *>(item) || dynamic_cast<SPTSpan *>(item) ||
+ dynamic_cast<SPTRef *>(item) || dynamic_cast<SPString *>(item) ||
+ dynamic_cast<SPFlowtext *>(item) || dynamic_cast<SPFlowdiv *>(item) ||
+ dynamic_cast<SPFlowtspan *>(item) || dynamic_cast<SPFlowpara *>(item)) {
return (all || check_texts.get_active());
} else if (dynamic_cast<SPGroup *>(item) && !desktop->isLayer(item) ) { // never select layers!
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp
index 9f86158aa..3b0731953 100644
--- a/src/ui/dialog/inkscape-preferences.cpp
+++ b/src/ui/dialog/inkscape-preferences.cpp
@@ -529,14 +529,14 @@ void InkscapePreferences::initPageUI()
_("English/Canada (en_CA)"), _("English/Great Britain (en_GB)"), _("Pig Latin (en_US@piglatin)"),
_("Esperanto (eo)"), _("Estonian (et)"), _("Farsi (fa)"), _("Finnish (fi)"),
_("French (fr)"), _("Irish (ga)"), _("Galician (gl)"), _("Hebrew (he)"), _("Hungarian (hu)"),
- _("Indonesian (id)"), _("Italian (it)"), _("Japanese (ja)"), _("Khmer (km)"), _("Kinyarwanda (rw)"), _("Korean (ko)"), _("Lithuanian (lt)"), _("Latvian (lv)"), _("Macedonian (mk)"),
+ _("Indonesian (id)"), _("Icelandic (is)"), _("Italian (it)"), _("Japanese (ja)"), _("Khmer (km)"), _("Kinyarwanda (rw)"), _("Korean (ko)"), _("Lithuanian (lt)"), _("Latvian (lv)"), _("Macedonian (mk)"),
_("Mongolian (mn)"), _("Nepali (ne)"), _("Norwegian Bokmål (nb)"), _("Norwegian Nynorsk (nn)"), _("Panjabi (pa)"),
_("Polish (pl)"), _("Portuguese (pt)"), _("Portuguese/Brazil (pt_BR)"), _("Romanian (ro)"), _("Russian (ru)"),
_("Serbian (sr)"), _("Serbian in Latin script (sr@latin)"), _("Slovak (sk)"), _("Slovenian (sl)"), _("Spanish (es)"), _("Spanish/Mexico (es_MX)"),
_("Swedish (sv)"),_("Telugu (te)"), _("Thai (th)"), _("Turkish (tr)"), _("Ukrainian (uk)"), _("Vietnamese (vi)")};
Glib::ustring langValues[] = {"", "sq", "am", "ar", "hy", "az", "eu", "be", "bg", "bn", "bn_BD", "br", "ca", "ca@valencia", "zh_CN", "zh_TW", "hr", "cs", "da", "nl",
"dz", "de", "el", "en", "en_AU", "en_CA", "en_GB", "en_US@piglatin", "eo", "et", "fa", "fi", "fr", "ga",
- "gl", "he", "hu", "id", "it", "ja", "km", "rw", "ko", "lt", "lv", "mk", "mn", "ne", "nb", "nn", "pa",
+ "gl", "he", "hu", "id", "is", "it", "ja", "km", "rw", "ko", "lt", "lv", "mk", "mn", "ne", "nb", "nn", "pa",
"pl", "pt", "pt_BR", "ro", "ru", "sr", "sr@latin", "sk", "sl", "es", "es_MX", "sv", "te", "th", "tr", "uk", "vi" };
{
diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp
index 3b87597c8..422ec10ae 100644
--- a/src/ui/dialog/livepatheffect-editor.cpp
+++ b/src/ui/dialog/livepatheffect-editor.cpp
@@ -27,6 +27,7 @@
#include "document.h"
#include "document-undo.h"
#include "gtkmm/widget.h"
+#include "helper/action.h"
#include "inkscape.h"
#include "live_effects/effect.h"
#include "live_effects/lpeobject.h"
@@ -44,6 +45,7 @@
#include "ui/icon-names.h"
#include "ui/widget/imagetoggler.h"
#include "verbs.h"
+#include "widgets/icon.h"
#include "xml/node.h"
#include "livepatheffect-add.h"
@@ -68,6 +70,14 @@ static void lpeeditor_selection_modified (Inkscape::Selection * selection, guint
lpeeditor->onSelectionChanged(selection);
}
+static void lpe_style_button(Gtk::Button& btn, char const* iconName)
+{
+ GtkWidget *child = sp_icon_new(Inkscape::ICON_SIZE_SMALL_TOOLBAR, iconName);
+ gtk_widget_show( child );
+ btn.add(*Gtk::manage(Glib::wrap(child)));
+ btn.set_relief(Gtk::RELIEF_NONE);
+}
+
/*
* LivePathEffectEditor
@@ -107,43 +117,19 @@ LivePathEffectEditor::LivePathEffectEditor()
effectcontrol_frame.add(effectcontrol_vbox);
button_add.set_tooltip_text(_("Add path effect"));
-#if WITH_GTKMM_3_10
- button_add.set_image_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR);
-#else
- Gtk::Image *image_add = Gtk::manage(new Gtk::Image());
- image_add->set_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR);
- button_add.set_image(*image_add);
-#endif
+ lpe_style_button(button_add, INKSCAPE_ICON("list-add"));
button_add.set_relief(Gtk::RELIEF_NONE);
button_remove.set_tooltip_text(_("Delete current path effect"));
-#if WITH_GTKMM_3_10
- button_remove.set_image_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR);
-#else
- Gtk::Image *image_remove = Gtk::manage(new Gtk::Image());
- image_remove->set_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR);
- button_remove.set_image(*image_remove);
-#endif
+ lpe_style_button(button_remove, INKSCAPE_ICON("list-remove"));
button_remove.set_relief(Gtk::RELIEF_NONE);
button_up.set_tooltip_text(_("Raise the current path effect"));
-#if WITH_GTKMM_3_10
- button_up.set_image_from_icon_name(INKSCAPE_ICON("go-up"), Gtk::ICON_SIZE_SMALL_TOOLBAR);
-#else
- Gtk::Image *image_up = Gtk::manage(new Gtk::Image());
- image_up->set_from_icon_name(INKSCAPE_ICON("go-up"), Gtk::ICON_SIZE_SMALL_TOOLBAR);
- button_up.set_image(*image_up);
-#endif
+ lpe_style_button(button_up, INKSCAPE_ICON("go-up"));
button_up.set_relief(Gtk::RELIEF_NONE);
button_down.set_tooltip_text(_("Lower the current path effect"));
-#if WITH_GTKMM_3_10
- button_down.set_image_from_icon_name(INKSCAPE_ICON("go-down"), Gtk::ICON_SIZE_SMALL_TOOLBAR);
-#else
- Gtk::Image *image_down = Gtk::manage(new Gtk::Image());
- image_down->set_from_icon_name(INKSCAPE_ICON("go-down"), Gtk::ICON_SIZE_SMALL_TOOLBAR);
- button_down.set_image(*image_down);
-#endif
+ lpe_style_button(button_down, INKSCAPE_ICON("go-down"));
button_down.set_relief(Gtk::RELIEF_NONE);
// Add toolbar items to toolbar
diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp
index b318933a7..7e5c17133 100644
--- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp
+++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp
@@ -129,7 +129,7 @@ void FilletChamferPropertiesDialog::showDialog(
const gchar *unit,
bool use_distance,
bool aprox_radius,
- Glib::ustring const * documentUnit)
+ Glib::ustring documentUnit)
{
FilletChamferPropertiesDialog *dialog = new FilletChamferPropertiesDialog();
@@ -172,7 +172,7 @@ void FilletChamferPropertiesDialog::_apply()
}
d_pos = _index + (d_pos / 100);
} else {
- d_pos = Inkscape::Util::Quantity::convert(d_pos, unit, *document_unit);
+ d_pos = Inkscape::Util::Quantity::convert(d_pos, unit, document_unit);
d_pos = d_pos * -1;
}
_knotpoint->knot_set_offset(Geom::Point(d_pos, d_width));
@@ -226,7 +226,7 @@ void FilletChamferPropertiesDialog::_set_knot_point(Geom::Point knotpoint)
_fillet_chamfer_position_label.set_label(_(posConcat.c_str()));
position = knotpoint[Geom::X] * -1;
- position = Inkscape::Util::Quantity::convert(position, *document_unit, unit);
+ position = Inkscape::Util::Quantity::convert(position, document_unit, unit);
}
_fillet_chamfer_position_numeric.set_value(position);
if (knotpoint.y() == 1) {
@@ -256,7 +256,7 @@ void FilletChamferPropertiesDialog::_set_unit(const gchar *abbr)
unit = abbr;
}
-void FilletChamferPropertiesDialog::_set_document_unit(Glib::ustring const *abbr)
+void FilletChamferPropertiesDialog::_set_document_unit(Glib::ustring abbr)
{
document_unit = abbr;
}
diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.h b/src/ui/dialog/lpe-fillet-chamfer-properties.h
index 3807e98c8..870a1734f 100644
--- a/src/ui/dialog/lpe-fillet-chamfer-properties.h
+++ b/src/ui/dialog/lpe-fillet-chamfer-properties.h
@@ -33,7 +33,7 @@ public:
const gchar *unit,
bool use_distance,
bool aprox_radius,
- Glib::ustring const * documentUnit);
+ Glib::ustring documentUnit);
protected:
@@ -69,14 +69,14 @@ protected:
void _set_pt(const Inkscape::LivePathEffect::
FilletChamferPointArrayParamKnotHolderEntity *pt);
void _set_unit(const gchar *abbr);
- void _set_document_unit(Glib::ustring const * abbr);
+ void _set_document_unit(Glib::ustring abbr);
void _set_use_distance(bool use_knot_distance);
void _set_aprox(bool aprox_radius);
void _apply();
void _close();
bool _flexible;
const gchar *unit;
- Glib::ustring const * document_unit;
+ Glib::ustring document_unit;
bool use_distance;
bool aprox;
void _set_knot_point(Geom::Point knotpoint);
diff --git a/src/ui/dialog/memory.cpp b/src/ui/dialog/memory.cpp
index 0008eb284..c0bc884fa 100644
--- a/src/ui/dialog/memory.cpp
+++ b/src/ui/dialog/memory.cpp
@@ -20,7 +20,7 @@
#include <gtkmm/liststore.h>
#include <gtkmm/treeview.h>
-#include "gc-core.h"
+#include "inkgc/gc-core.h"
#include "debug/heap.h"
#include "verbs.h"
diff --git a/src/ui/dialog/objects.cpp b/src/ui/dialog/objects.cpp
index c95529a56..9db0285d7 100644
--- a/src/ui/dialog/objects.cpp
+++ b/src/ui/dialog/objects.cpp
@@ -231,15 +231,13 @@ public:
/**
* Stylizes a button using the given icon name and tooltip
*/
-void ObjectsPanel::_styleButton( Gtk::Button& btn, char const* iconName, char const* tooltip )
+void ObjectsPanel::_styleButton(Gtk::Button& btn, char const* iconName, char const* tooltip)
{
GtkWidget *child = sp_icon_new( Inkscape::ICON_SIZE_SMALL_TOOLBAR, iconName );
gtk_widget_show( child );
btn.add( *Gtk::manage(Glib::wrap(child)) );
btn.set_relief(Gtk::RELIEF_NONE);
-
btn.set_tooltip_text (tooltip);
-
}
/**
@@ -1799,29 +1797,14 @@ ObjectsPanel::ObjectsPanel() :
//Add object/layer
Gtk::Button* btn = Gtk::manage( new Gtk::Button() );
- btn->set_tooltip_text(_("Add layer..."));
-#if GTK_CHECK_VERSION(3,10,0)
- btn->set_image_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR);
-#else
- Gtk::Image *image_add = Gtk::manage(new Gtk::Image());
- image_add->set_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR);
- btn->set_image(*image_add);
-#endif
+ _styleButton(*btn, INKSCAPE_ICON("list-add"), _("Add layer..."));
btn->set_relief(Gtk::RELIEF_NONE);
btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &ObjectsPanel::_takeAction), (int)BUTTON_NEW) );
_buttonsSecondary.pack_start(*btn, Gtk::PACK_SHRINK);
-
//Remove object
btn = Gtk::manage( new Gtk::Button() );
- btn->set_tooltip_text(_("Remove object"));
-#if GTK_CHECK_VERSION(3,10,0)
- btn->set_image_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR);
-#else
- Gtk::Image *image_remove = Gtk::manage(new Gtk::Image());
- image_remove->set_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR);
- btn->set_image(*image_remove);
-#endif
+ _styleButton(*btn, INKSCAPE_ICON("list-remove"), _("Remove object"));
btn->set_relief(Gtk::RELIEF_NONE);
btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &ObjectsPanel::_takeAction), (int)BUTTON_DELETE) );
_watching.push_back( btn );
@@ -1829,14 +1812,7 @@ ObjectsPanel::ObjectsPanel() :
//Move to bottom
btn = Gtk::manage( new Gtk::Button() );
- btn->set_tooltip_text(_("Move To Bottom"));
-#if GTK_CHECK_VERSION(3,10,0)
- btn->set_image_from_icon_name(INKSCAPE_ICON("go-bottom"), Gtk::ICON_SIZE_SMALL_TOOLBAR);
-#else
- image_remove = Gtk::manage(new Gtk::Image());
- image_remove->set_from_icon_name(INKSCAPE_ICON("go-bottom"), Gtk::ICON_SIZE_SMALL_TOOLBAR);
- btn->set_image(*image_remove);
-#endif
+ _styleButton(*btn, INKSCAPE_ICON("go-bottom"), _("Move To Bottom"));
btn->set_relief(Gtk::RELIEF_NONE);
btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &ObjectsPanel::_takeAction), (int)BUTTON_BOTTOM) );
_watchingNonBottom.push_back( btn );
@@ -1844,14 +1820,7 @@ ObjectsPanel::ObjectsPanel() :
//Move down
btn = Gtk::manage( new Gtk::Button() );
- btn->set_tooltip_text(_("Move Down"));
-#if GTK_CHECK_VERSION(3,10,0)
- btn->set_image_from_icon_name(INKSCAPE_ICON("go-down"), Gtk::ICON_SIZE_SMALL_TOOLBAR);
-#else
- image_remove = Gtk::manage(new Gtk::Image());
- image_remove->set_from_icon_name(INKSCAPE_ICON("go-down"), Gtk::ICON_SIZE_SMALL_TOOLBAR);
- btn->set_image(*image_remove);
-#endif
+ _styleButton(*btn, INKSCAPE_ICON("go-down"), _("Move Down"));
btn->set_relief(Gtk::RELIEF_NONE);
btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &ObjectsPanel::_takeAction), (int)BUTTON_DOWN) );
_watchingNonBottom.push_back( btn );
@@ -1859,14 +1828,7 @@ ObjectsPanel::ObjectsPanel() :
//Move up
btn = Gtk::manage( new Gtk::Button() );
- btn->set_tooltip_text(_("Move Up"));
-#if GTK_CHECK_VERSION(3,10,0)
- btn->set_image_from_icon_name(INKSCAPE_ICON("go-up"), Gtk::ICON_SIZE_SMALL_TOOLBAR);
-#else
- image_remove = Gtk::manage(new Gtk::Image());
- image_remove->set_from_icon_name(INKSCAPE_ICON("go-up"), Gtk::ICON_SIZE_SMALL_TOOLBAR);
- btn->set_image(*image_remove);
-#endif
+ _styleButton(*btn, INKSCAPE_ICON("go-up"), _("Move Up"));
btn->set_relief(Gtk::RELIEF_NONE);
btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &ObjectsPanel::_takeAction), (int)BUTTON_UP) );
_watchingNonTop.push_back( btn );
@@ -1874,14 +1836,7 @@ ObjectsPanel::ObjectsPanel() :
//Move to top
btn = Gtk::manage( new Gtk::Button() );
- btn->set_tooltip_text(_("Move To Top"));
-#if GTK_CHECK_VERSION(3,10,0)
- btn->set_image_from_icon_name(INKSCAPE_ICON("go-top"), Gtk::ICON_SIZE_SMALL_TOOLBAR);
-#else
- image_remove = Gtk::manage(new Gtk::Image());
- image_remove->set_from_icon_name(INKSCAPE_ICON("go-top"), Gtk::ICON_SIZE_SMALL_TOOLBAR);
- btn->set_image(*image_remove);
-#endif
+ _styleButton(*btn, INKSCAPE_ICON("go-top"), _("Move To Top"));
btn->set_relief(Gtk::RELIEF_NONE);
btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &ObjectsPanel::_takeAction), (int)BUTTON_TOP) );
_watchingNonTop.push_back( btn );
@@ -1889,14 +1844,7 @@ ObjectsPanel::ObjectsPanel() :
//Collapse all
btn = Gtk::manage( new Gtk::Button() );
- btn->set_tooltip_text(_("Collapse All"));
-#if GTK_CHECK_VERSION(3,10,0)
- btn->set_image_from_icon_name(INKSCAPE_ICON("gtk-unindent-ltr"), Gtk::ICON_SIZE_SMALL_TOOLBAR);
-#else
- image_remove = Gtk::manage(new Gtk::Image());
- image_remove->set_from_icon_name(INKSCAPE_ICON("gtk-unindent-ltr"), Gtk::ICON_SIZE_SMALL_TOOLBAR);
- btn->set_image(*image_remove);
-#endif
+ _styleButton(*btn, INKSCAPE_ICON("format-indent-less"), _("Collapse All"));
btn->set_relief(Gtk::RELIEF_NONE);
btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &ObjectsPanel::_takeAction), (int)BUTTON_COLLAPSE_ALL) );
_watchingNonBottom.push_back( btn );
diff --git a/src/ui/dialog/ocaldialogs.cpp b/src/ui/dialog/ocaldialogs.cpp
index c4dd9df98..a1c7d41bd 100644
--- a/src/ui/dialog/ocaldialogs.cpp
+++ b/src/ui/dialog/ocaldialogs.cpp
@@ -26,7 +26,7 @@
#include "path-prefix.h"
#include "filedialogimpl-gtkmm.h"
#include "ui/interface.h"
-#include "gc-core.h"
+#include "inkgc/gc-core.h"
#include "ui/dialog-events.h"
#include "io/sys.h"
#include "preferences.h"
diff --git a/src/ui/dialog/print.cpp b/src/ui/dialog/print.cpp
index a015d28f9..ad979b570 100644
--- a/src/ui/dialog/print.cpp
+++ b/src/ui/dialog/print.cpp
@@ -126,30 +126,13 @@ static void draw_page(
cairo_surface_t *surface = cairo_get_target(cr);
cairo_matrix_t ctm;
cairo_get_matrix(cr, &ctm);
-#ifdef WIN32
- //Gtk+ does not take the non printable area into account
- //http://bugzilla.gnome.org/show_bug.cgi?id=381371
- //
- // This workaround translates the origin from the top left of the
- // printable area to the top left of the page.
- GtkPrintSettings *settings = gtk_print_operation_get_print_settings(operation);
- const gchar *printerName = gtk_print_settings_get_printer(settings);
- HDC hdc = CreateDC("WINSPOOL", printerName, NULL, NULL);
- if (hdc) {
- cairo_matrix_t mat;
- int x_off = GetDeviceCaps (hdc, PHYSICALOFFSETX);
- int y_off = GetDeviceCaps (hdc, PHYSICALOFFSETY);
- cairo_matrix_init_translate(&mat, -x_off, -y_off);
- cairo_matrix_multiply (&ctm, &ctm, &mat);
- DeleteDC(hdc);
- }
-#endif
+
bool ret = ctx->setSurfaceTarget (surface, true, &ctm);
if (ret) {
ret = renderer.setupDocument (ctx, junk->_doc, TRUE, 0., NULL);
if (ret) {
renderer.renderItem(ctx, junk->_base);
- ret = ctx->finish();
+ ctx->finish();
}
else {
g_warning("%s", _("Could not set up Document"));
diff --git a/src/ui/dialog/tags.cpp b/src/ui/dialog/tags.cpp
index 8a104d137..7d3edaffb 100644
--- a/src/ui/dialog/tags.cpp
+++ b/src/ui/dialog/tags.cpp
@@ -145,31 +145,12 @@ public:
int _actionCode;
};
-void TagsPanel::_styleButton( Gtk::Button& btn, SPDesktop *desktop, unsigned int code, char const* iconName, char const* tooltip )
+void TagsPanel::_styleButton(Gtk::Button& btn, char const* iconName, char const* tooltip)
{
- bool set = false;
-
- if ( iconName ) {
- GtkWidget *child = sp_icon_new( Inkscape::ICON_SIZE_SMALL_TOOLBAR, iconName );
- gtk_widget_show( child );
- btn.add( *manage(Glib::wrap(child)) );
- btn.set_relief(Gtk::RELIEF_NONE);
- set = true;
- }
-
- if ( desktop ) {
- Verb *verb = Verb::get( code );
- if ( verb ) {
- SPAction *action = verb->get_action(desktop);
- if ( !set && action && action->image ) {
- GtkWidget *child = sp_icon_new( Inkscape::ICON_SIZE_SMALL_TOOLBAR, action->image );
- gtk_widget_show( child );
- btn.add( *manage(Glib::wrap(child)) );
- set = true;
- }
- }
- }
-
+ GtkWidget *child = sp_icon_new(Inkscape::ICON_SIZE_SMALL_TOOLBAR, iconName);
+ gtk_widget_show(child);
+ btn.add(*manage(Glib::wrap(child)));
+ btn.set_relief(Gtk::RELIEF_NONE);
btn.set_tooltip_text (tooltip);
}
@@ -1013,7 +994,7 @@ TagsPanel::TagsPanel() :
SPDesktop* targetDesktop = getDesktop();
Gtk::Button* btn = manage( new Gtk::Button() );
- _styleButton( *btn, targetDesktop, SP_VERB_TAG_NEW, GTK_STOCK_ADD, _("Add a new selection set") );
+ _styleButton(*btn, "list-add", _("Add a new selection set") );
btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &TagsPanel::_takeAction), (int)BUTTON_NEW) );
_buttonsSecondary.pack_start(*btn, Gtk::PACK_SHRINK);
@@ -1022,7 +1003,7 @@ TagsPanel::TagsPanel() :
// _buttonsRow.add( *btn );
btn = manage( new Gtk::Button() );
- _styleButton( *btn, targetDesktop, SP_VERB_LAYER_DELETE, GTK_STOCK_REMOVE, _("Remove Item/Set") );
+ _styleButton( *btn, "list-remove", _("Remove Item/Set") );
btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &TagsPanel::_takeAction), (int)BUTTON_DELETE) );
_watching.push_back( btn );
_buttonsSecondary.pack_start(*btn, Gtk::PACK_SHRINK);
diff --git a/src/ui/dialog/tags.h b/src/ui/dialog/tags.h
index d35dfba01..3576bd111 100644
--- a/src/ui/dialog/tags.h
+++ b/src/ui/dialog/tags.h
@@ -62,7 +62,7 @@ private:
TagsPanel(TagsPanel const &); // no copy
TagsPanel &operator=(TagsPanel const &); // no assign
- void _styleButton( Gtk::Button& btn, SPDesktop *desktop, unsigned int code, char const* iconName, char const* tooltip );
+ void _styleButton( Gtk::Button& btn, char const* iconName, char const* tooltip );
void _fireAction( unsigned int code );
Gtk::MenuItem& _addPopupItem( SPDesktop *desktop, unsigned int code, char const* iconName, char const* fallback, int id );
diff --git a/src/ui/dialog/xml-tree.cpp b/src/ui/dialog/xml-tree.cpp
index c02520218..99a4acc69 100644
--- a/src/ui/dialog/xml-tree.cpp
+++ b/src/ui/dialog/xml-tree.cpp
@@ -71,10 +71,10 @@ XmlTree::XmlTree (void) :
xml_text_new_button ( _("New text node")),
xml_node_delete_button ( Q_("nodeAsInXMLdialogTooltip|Delete node")),
xml_node_duplicate_button ( _("Duplicate node")),
- unindent_node_button (Gtk::Stock::UNINDENT),
- indent_node_button (Gtk::Stock::INDENT),
- raise_node_button (Gtk::Stock::GO_UP),
- lower_node_button (Gtk::Stock::GO_DOWN),
+ unindent_node_button(),
+ indent_node_button(),
+ raise_node_button(),
+ lower_node_button(),
attr_toolbar(),
xml_attribute_delete_button (_("Delete attribute")),
text_container (),
@@ -149,21 +149,29 @@ XmlTree::XmlTree (void) :
tree_toolbar.add(separator2);
+ unindent_node_button.set_icon_widget(*Gtk::manage(Glib::wrap(
+ sp_icon_new (Inkscape::ICON_SIZE_LARGE_TOOLBAR, INKSCAPE_ICON("format-indent-less")))));
unindent_node_button.set_label(_("Unindent node"));
unindent_node_button.set_tooltip_text(_("Unindent node"));
unindent_node_button.set_sensitive(false);
tree_toolbar.add(unindent_node_button);
+ indent_node_button.set_icon_widget(*Gtk::manage(Glib::wrap(
+ sp_icon_new (Inkscape::ICON_SIZE_LARGE_TOOLBAR, INKSCAPE_ICON("format-indent-more")))));
indent_node_button.set_label(_("Indent node"));
indent_node_button.set_tooltip_text(_("Indent node"));
indent_node_button.set_sensitive(false);
tree_toolbar.add(indent_node_button);
+ raise_node_button.set_icon_widget(*Gtk::manage(Glib::wrap(
+ sp_icon_new (Inkscape::ICON_SIZE_LARGE_TOOLBAR, INKSCAPE_ICON("go-up")))));
raise_node_button.set_label(_("Raise node"));
raise_node_button.set_tooltip_text(_("Raise node"));
raise_node_button.set_sensitive(false);
tree_toolbar.add(raise_node_button);
+ lower_node_button.set_icon_widget(*Gtk::manage(Glib::wrap(
+ sp_icon_new (Inkscape::ICON_SIZE_LARGE_TOOLBAR, INKSCAPE_ICON("go-down")))));
lower_node_button.set_label(_("Lower node"));
lower_node_button.set_tooltip_text(_("Lower node"));
lower_node_button.set_sensitive(false);
diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp
index 28a65e0b4..87438ac01 100644
--- a/src/ui/interface.cpp
+++ b/src/ui/interface.cpp
@@ -1815,7 +1815,7 @@ void ContextMenu::SelectSameStrokeColor(void)
void ContextMenu::SelectSameStrokeStyle(void)
{
- sp_select_same_stroke_style(_desktop);
+ sp_select_same_fill_stroke_style(_desktop, false, false, true);
}
void ContextMenu::SelectSameObjectType(void)
diff --git a/src/ui/object-edit.cpp b/src/ui/object-edit.cpp
index fb99dfd59..0a6c792dc 100644
--- a/src/ui/object-edit.cpp
+++ b/src/ui/object-edit.cpp
@@ -154,12 +154,9 @@ RectKnotHolderEntityRX::knot_set(Geom::Point const &p, Geom::Point const &/*orig
if (state & GDK_CONTROL_MASK) {
gdouble temp = MIN(rect->height.computed, rect->width.computed) / 2.0;
- rect->rx.computed = rect->ry.computed = CLAMP(rect->x.computed + rect->width.computed - s[Geom::X], 0.0, temp);
- rect->rx._set = rect->ry._set = true;
-
+ rect->rx = rect->ry = CLAMP(rect->x.computed + rect->width.computed - s[Geom::X], 0.0, temp);
} else {
- rect->rx.computed = CLAMP(rect->x.computed + rect->width.computed - s[Geom::X], 0.0, rect->width.computed / 2.0);
- rect->rx._set = true;
+ rect->rx = CLAMP(rect->x.computed + rect->width.computed - s[Geom::X], 0.0, rect->width.computed / 2.0);
}
update_knot();
@@ -207,20 +204,17 @@ RectKnotHolderEntityRY::knot_set(Geom::Point const &p, Geom::Point const &/*orig
if (state & GDK_CONTROL_MASK) { // When holding control then rx will be kept equal to ry,
// resulting in a perfect circle (and not an ellipse)
gdouble temp = MIN(rect->height.computed, rect->width.computed) / 2.0;
- rect->rx.computed = rect->ry.computed = CLAMP(s[Geom::Y] - rect->y.computed, 0.0, temp);
- rect->ry._set = rect->rx._set = true;
+ rect->rx = rect->ry = CLAMP(s[Geom::Y] - rect->y.computed, 0.0, temp);
} else {
if (!rect->rx._set || rect->rx.computed == 0) {
- rect->ry.computed = CLAMP(s[Geom::Y] - rect->y.computed,
- 0.0,
- MIN(rect->height.computed / 2.0, rect->width.computed / 2.0));
+ rect->ry = CLAMP(s[Geom::Y] - rect->y.computed,
+ 0.0,
+ MIN(rect->height.computed / 2.0, rect->width.computed / 2.0));
} else {
- rect->ry.computed = CLAMP(s[Geom::Y] - rect->y.computed,
- 0.0,
- rect->height.computed / 2.0);
+ rect->ry = CLAMP(s[Geom::Y] - rect->y.computed,
+ 0.0,
+ rect->height.computed / 2.0);
}
-
- rect->ry._set = true;
}
update_knot();
@@ -250,12 +244,10 @@ static void sp_rect_clamp_radii(SPRect *rect)
{
// clamp rounding radii so that they do not exceed width/height
if (2 * rect->rx.computed > rect->width.computed) {
- rect->rx.computed = 0.5 * rect->width.computed;
- rect->rx._set = true;
+ rect->rx = 0.5 * rect->width.computed;
}
if (2 * rect->ry.computed > rect->height.computed) {
- rect->ry.computed = 0.5 * rect->height.computed;
- rect->ry._set = true;
+ rect->ry = 0.5 * rect->height.computed;
}
}
@@ -296,44 +288,45 @@ RectKnotHolderEntityWH::set_internal(Geom::Point const &p, Geom::Point const &or
// closer to the diagonal and in same-sign quarters, change both using ratio
s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(-ratio, -1)), state);
minx = s[Geom::X] - origin[Geom::X];
- miny = s[Geom::Y] - origin[Geom::Y];
- rect->height.computed = MAX(h_orig + minx / ratio, 0);
+ // Dead assignment: Value stored to 'miny' is never read
+ //miny = s[Geom::Y] - origin[Geom::Y];
+ rect->height = MAX(h_orig + minx / ratio, 0);
} else {
// closer to the horizontal, change only width, height is h_orig
s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(-1, 0)), state);
minx = s[Geom::X] - origin[Geom::X];
- miny = s[Geom::Y] - origin[Geom::Y];
- rect->height.computed = MAX(h_orig, 0);
+ // Dead assignment: Value stored to 'miny' is never read
+ //miny = s[Geom::Y] - origin[Geom::Y];
+ rect->height = MAX(h_orig, 0);
}
- rect->width.computed = MAX(w_orig + minx, 0);
+ rect->width = MAX(w_orig + minx, 0);
} else {
// snap to vertical or diagonal
if (miny != 0 && fabs(minx/miny) > 0.5 * ratio && (SGN(minx) == SGN(miny))) {
// closer to the diagonal and in same-sign quarters, change both using ratio
s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(-ratio, -1)), state);
- minx = s[Geom::X] - origin[Geom::X];
+ // Dead assignment: Value stored to 'minx' is never read
+ //minx = s[Geom::X] - origin[Geom::X];
miny = s[Geom::Y] - origin[Geom::Y];
- rect->width.computed = MAX(w_orig + miny * ratio, 0);
+ rect->width = MAX(w_orig + miny * ratio, 0);
} else {
// closer to the vertical, change only height, width is w_orig
s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(0, -1)), state);
- minx = s[Geom::X] - origin[Geom::X];
+ // Dead assignment: Value stored to 'minx' is never read
+ //minx = s[Geom::X] - origin[Geom::X];
miny = s[Geom::Y] - origin[Geom::Y];
- rect->width.computed = MAX(w_orig, 0);
+ rect->width = MAX(w_orig, 0);
}
- rect->height.computed = MAX(h_orig + miny, 0);
+ rect->height = MAX(h_orig + miny, 0);
}
- rect->width._set = rect->height._set = true;
-
} else {
// move freely
s = snap_knot_position(p, state);
- rect->width.computed = MAX(s[Geom::X] - rect->x.computed, 0);
- rect->height.computed = MAX(s[Geom::Y] - rect->y.computed, 0);
- rect->width._set = rect->height._set = true;
+ rect->width = MAX(s[Geom::X] - rect->x.computed, 0);
+ rect->height = MAX(s[Geom::Y] - rect->y.computed, 0);
}
sp_rect_clamp_radii(rect);
@@ -388,53 +381,54 @@ RectKnotHolderEntityXY::knot_set(Geom::Point const &p, Geom::Point const &origin
// closer to the diagonal and in same-sign quarters, change both using ratio
s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(-ratio, -1)), state);
minx = s[Geom::X] - origin[Geom::X];
- miny = s[Geom::Y] - origin[Geom::Y];
- rect->y.computed = MIN(origin[Geom::Y] + minx / ratio, opposite_y);
- rect->height.computed = MAX(h_orig - minx / ratio, 0);
+ // Dead assignment: Value stored to 'miny' is never read
+ //miny = s[Geom::Y] - origin[Geom::Y];
+ rect->y = MIN(origin[Geom::Y] + minx / ratio, opposite_y);
+ rect->height = MAX(h_orig - minx / ratio, 0);
} else {
// closer to the horizontal, change only width, height is h_orig
s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(-1, 0)), state);
minx = s[Geom::X] - origin[Geom::X];
- miny = s[Geom::Y] - origin[Geom::Y];
- rect->y.computed = MIN(origin[Geom::Y], opposite_y);
- rect->height.computed = MAX(h_orig, 0);
+ // Dead assignment: Value stored to 'miny' is never read
+ //miny = s[Geom::Y] - origin[Geom::Y];
+ rect->y = MIN(origin[Geom::Y], opposite_y);
+ rect->height = MAX(h_orig, 0);
}
- rect->x.computed = MIN(s[Geom::X], opposite_x);
- rect->width.computed = MAX(w_orig - minx, 0);
+ rect->x = MIN(s[Geom::X], opposite_x);
+ rect->width = MAX(w_orig - minx, 0);
} else {
// snap to vertical or diagonal
if (miny != 0 && fabs(minx/miny) > 0.5 *ratio && (SGN(minx) == SGN(miny))) {
// closer to the diagonal and in same-sign quarters, change both using ratio
s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(-ratio, -1)), state);
- minx = s[Geom::X] - origin[Geom::X];
+ // Dead assignment: Value stored to 'minx' is never read
+ //minx = s[Geom::X] - origin[Geom::X];
miny = s[Geom::Y] - origin[Geom::Y];
- rect->x.computed = MIN(origin[Geom::X] + miny * ratio, opposite_x);
- rect->width.computed = MAX(w_orig - miny * ratio, 0);
+ rect->x = MIN(origin[Geom::X] + miny * ratio, opposite_x);
+ rect->width = MAX(w_orig - miny * ratio, 0);
} else {
// closer to the vertical, change only height, width is w_orig
s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(0, -1)), state);
- minx = s[Geom::X] - origin[Geom::X];
+ // Dead assignment: Value stored to 'minx' is never read
+ //minx = s[Geom::X] - origin[Geom::X];
miny = s[Geom::Y] - origin[Geom::Y];
- rect->x.computed = MIN(origin[Geom::X], opposite_x);
- rect->width.computed = MAX(w_orig, 0);
+ rect->x = MIN(origin[Geom::X], opposite_x);
+ rect->width = MAX(w_orig, 0);
}
- rect->y.computed = MIN(s[Geom::Y], opposite_y);
- rect->height.computed = MAX(h_orig - miny, 0);
+ rect->y = MIN(s[Geom::Y], opposite_y);
+ rect->height = MAX(h_orig - miny, 0);
}
- rect->width._set = rect->height._set = rect->x._set = rect->y._set = true;
-
} else {
// move freely
s = snap_knot_position(p, state);
minx = s[Geom::X] - origin[Geom::X];
miny = s[Geom::Y] - origin[Geom::Y];
- rect->x.computed = MIN(s[Geom::X], opposite_x);
- rect->width.computed = MAX(w_orig - minx, 0);
- rect->y.computed = MIN(s[Geom::Y], opposite_y);
- rect->height.computed = MAX(h_orig - miny, 0);
- rect->width._set = rect->height._set = rect->x._set = rect->y._set = true;
+ rect->x = MIN(s[Geom::X], opposite_x);
+ rect->y = MIN(s[Geom::Y], opposite_y);
+ rect->width = MAX(w_orig - minx, 0);
+ rect->height = MAX(h_orig - miny, 0);
}
sp_rect_clamp_radii(rect);
@@ -909,10 +903,10 @@ ArcKnotHolderEntityRX::knot_set(Geom::Point const &p, Geom::Point const &/*origi
Geom::Point const s = snap_knot_position(p, state);
- ge->rx.computed = fabs( ge->cx.computed - s[Geom::X] );
+ ge->rx = fabs( ge->cx.computed - s[Geom::X] );
if ( state & GDK_CONTROL_MASK ) {
- ge->ry.computed = ge->rx.computed;
+ ge->ry = ge->rx.computed;
}
item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
@@ -934,7 +928,7 @@ ArcKnotHolderEntityRX::knot_click(unsigned int state)
g_assert(ge != NULL);
if (state & GDK_CONTROL_MASK) {
- ge->ry.computed = ge->rx.computed;
+ ge->ry = ge->rx.computed;
ge->updateRepr();
}
}
@@ -947,10 +941,10 @@ ArcKnotHolderEntityRY::knot_set(Geom::Point const &p, Geom::Point const &/*origi
Geom::Point const s = snap_knot_position(p, state);
- ge->ry.computed = fabs( ge->cy.computed - s[Geom::Y] );
+ ge->ry = fabs( ge->cy.computed - s[Geom::Y] );
if ( state & GDK_CONTROL_MASK ) {
- ge->rx.computed = ge->ry.computed;
+ ge->rx = ge->ry.computed;
}
item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
@@ -972,7 +966,7 @@ ArcKnotHolderEntityRY::knot_click(unsigned int state)
g_assert(ge != NULL);
if (state & GDK_CONTROL_MASK) {
- ge->rx.computed = ge->ry.computed;
+ ge->rx = ge->ry.computed;
ge->updateRepr();
}
}
diff --git a/src/ui/tool-factory.cpp b/src/ui/tool-factory.cpp
new file mode 100644
index 000000000..700bd40ce
--- /dev/null
+++ b/src/ui/tool-factory.cpp
@@ -0,0 +1,102 @@
+/*
+ * Factory for ToolBase tree
+ *
+ * Authors:
+ * Markus Engel
+ *
+ * Copyright (C) 2013 Authors
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "tool-factory.h"
+
+#include "ui/tools/arc-tool.h"
+#include "ui/tools/box3d-tool.h"
+#include "ui/tools/calligraphic-tool.h"
+#include "ui/tools/connector-tool.h"
+#include "ui/tools/dropper-tool.h"
+#include "ui/tools/eraser-tool.h"
+#include "ui/tools/flood-tool.h"
+#include "ui/tools/gradient-tool.h"
+#include "ui/tools/lpe-tool.h"
+#include "ui/tools/measure-tool.h"
+#include "ui/tools/mesh-tool.h"
+#include "ui/tools/node-tool.h"
+#include "ui/tools/pencil-tool.h"
+#include "ui/tools/pen-tool.h"
+#include "ui/tools/rect-tool.h"
+#include "ui/tools/select-tool.h"
+#include "ui/tools/spiral-tool.h"
+#include "ui/tools/spray-tool.h"
+#include "ui/tools/star-tool.h"
+#include "ui/tools/text-tool.h"
+#include "ui/tools/tool-base.h"
+#include "ui/tools/tweak-tool.h"
+#include "ui/tools/zoom-tool.h"
+
+using namespace Inkscape::UI::Tools;
+
+ToolBase *ToolFactory::createObject(std::string const& id)
+{
+ ToolBase *tool = NULL;
+
+ if (id == "/tools/shapes/arc")
+ tool = new ArcTool;
+ else if (id == "/tools/shapes/3dbox")
+ tool = new Box3dTool;
+ else if (id == "/tools/calligraphic")
+ tool = new CalligraphicTool;
+ else if (id == "/tools/connector")
+ tool = new ConnectorTool;
+ else if (id == "/tools/dropper")
+ tool = new DropperTool;
+ else if (id == "/tools/eraser")
+ tool = new EraserTool;
+ else if (id == "/tools/paintbucket")
+ tool = new FloodTool;
+ else if (id == "/tools/gradient")
+ tool = new GradientTool;
+ else if (id == "/tools/lpetool")
+ tool = new LpeTool;
+ else if (id == "/tools/measure")
+ tool = new MeasureTool;
+ else if (id == "/tools/mesh")
+ tool = new MeshTool;
+ else if (id == "/tools/nodes")
+ tool = new NodeTool;
+ else if (id == "/tools/freehand/pencil")
+ tool = new PencilTool;
+ else if (id == "/tools/freehand/pen")
+ tool = new PenTool;
+ else if (id == "/tools/shapes/rect")
+ tool = new RectTool;
+ else if (id == "/tools/select")
+ tool = new SelectTool;
+ else if (id == "/tools/shapes/spiral")
+ tool = new SpiralTool;
+ else if (id == "/tools/spray")
+ tool = new SprayTool;
+ else if (id == "/tools/shapes/star")
+ tool = new StarTool;
+ else if (id == "/tools/text")
+ tool = new TextTool;
+ else if (id == "/tools/tweak")
+ tool = new TweakTool;
+ else if (id == "/tools/zoom")
+ tool = new ZoomTool;
+ else
+ fprintf(stderr, "WARNING: unknown tool: %s", id.c_str());
+
+ return tool;
+}
+
+/*
+ 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/tool-factory.h b/src/ui/tool-factory.h
index 726706732..3b041fec5 100644
--- a/src/ui/tool-factory.h
+++ b/src/ui/tool-factory.h
@@ -1,6 +1,6 @@
-/** @file
+/*
* Factory for ToolBase tree
- *//*
+ *
* Authors:
* Markus Engel
*
@@ -11,7 +11,7 @@
#ifndef TOOL_FACTORY_SEEN
#define TOOL_FACTORY_SEEN
-#include "factory.h"
+#include <string>
namespace Inkscape {
namespace UI {
@@ -23,7 +23,9 @@ class ToolBase;
}
}
-typedef Singleton< Factory<Inkscape::UI::Tools::ToolBase> > ToolFactory;
+struct ToolFactory {
+ static Inkscape::UI::Tools::ToolBase *createObject(std::string const& id);
+};
#endif
diff --git a/src/ui/tools/arc-tool.cpp b/src/ui/tools/arc-tool.cpp
index b9206407a..c6a9bb23a 100644
--- a/src/ui/tools/arc-tool.cpp
+++ b/src/ui/tools/arc-tool.cpp
@@ -48,20 +48,10 @@
using Inkscape::DocumentUndo;
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
-namespace {
- ToolBase* createArcContext() {
- return new ArcTool();
- }
-
- bool arcContextRegistered = ToolFactory::instance().registerObject("/tools/shapes/arc", createArcContext);
-}
-
const std::string& ArcTool::getPrefsPath() {
return ArcTool::prefsPath;
}
diff --git a/src/ui/tools/box3d-tool.cpp b/src/ui/tools/box3d-tool.cpp
index f8ae685c4..538e0c7e2 100644
--- a/src/ui/tools/box3d-tool.cpp
+++ b/src/ui/tools/box3d-tool.cpp
@@ -52,20 +52,10 @@
using Inkscape::DocumentUndo;
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
-namespace {
- ToolBase* createBox3dTool() {
- return new Box3dTool();
- }
-
- bool Box3dToolRegistered = ToolFactory::instance().registerObject("/tools/shapes/3dbox", createBox3dTool);
-}
-
const std::string& Box3dTool::getPrefsPath() {
return Box3dTool::prefsPath;
}
diff --git a/src/ui/tools/calligraphic-tool.cpp b/src/ui/tools/calligraphic-tool.cpp
index 151ab5f89..15e6527a3 100644
--- a/src/ui/tools/calligraphic-tool.cpp
+++ b/src/ui/tools/calligraphic-tool.cpp
@@ -82,22 +82,12 @@ using Inkscape::DocumentUndo;
#define DYNA_MIN_WIDTH 1.0e-6
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
static void add_cap(SPCurve *curve, Geom::Point const &from, Geom::Point const &to, double rounding);
-namespace {
- ToolBase* createCalligraphicContext() {
- return new CalligraphicTool();
- }
-
- bool calligraphicContextRegistered = ToolFactory::instance().registerObject("/tools/calligraphic", createCalligraphicContext);
-}
-
const std::string& CalligraphicTool::getPrefsPath() {
return CalligraphicTool::prefsPath;
}
diff --git a/src/ui/tools/connector-tool.cpp b/src/ui/tools/connector-tool.cpp
index 26a4eadd5..d76b0d142 100644
--- a/src/ui/tools/connector-tool.cpp
+++ b/src/ui/tools/connector-tool.cpp
@@ -109,8 +109,6 @@
using Inkscape::DocumentUndo;
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
@@ -147,14 +145,6 @@ static Inkscape::XML::NodeEventVector layer_repr_events = {
NULL /* order_changed */
};
-namespace {
- ToolBase* createConnectorContext() {
- return new ConnectorTool();
- }
-
- bool connectorContextRegistered = ToolFactory::instance().registerObject("/tools/connector", createConnectorContext);
-}
-
const std::string& ConnectorTool::getPrefsPath() {
return ConnectorTool::prefsPath;
}
diff --git a/src/ui/tools/dropper-tool.cpp b/src/ui/tools/dropper-tool.cpp
index 9038628ee..bda9d8e8a 100644
--- a/src/ui/tools/dropper-tool.cpp
+++ b/src/ui/tools/dropper-tool.cpp
@@ -52,20 +52,10 @@ using Inkscape::DocumentUndo;
static GdkCursor *cursor_dropper_fill = NULL;
static GdkCursor *cursor_dropper_stroke = NULL;
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
-namespace {
- ToolBase* createDropperContext() {
- return new DropperTool();
- }
-
- bool dropperContextRegistered = ToolFactory::instance().registerObject("/tools/dropper", createDropperContext);
-}
-
const std::string& DropperTool::getPrefsPath() {
return DropperTool::prefsPath;
}
diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp
index 1b4dcfe25..af0cbcb78 100644
--- a/src/ui/tools/eraser-tool.cpp
+++ b/src/ui/tools/eraser-tool.cpp
@@ -84,20 +84,10 @@ using Inkscape::DocumentUndo;
#define DRAG_DEFAULT 1.0
#define DRAG_MAX 1.0
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
-namespace {
- ToolBase* createEraserContext() {
- return new EraserTool();
- }
-
- bool eraserContextRegistered = ToolFactory::instance().registerObject("/tools/eraser", createEraserContext);
-}
-
const std::string& EraserTool::getPrefsPath() {
return EraserTool::prefsPath;
}
diff --git a/src/ui/tools/flood-tool.cpp b/src/ui/tools/flood-tool.cpp
index e4c4e855d..bb8782dfa 100644
--- a/src/ui/tools/flood-tool.cpp
+++ b/src/ui/tools/flood-tool.cpp
@@ -74,20 +74,10 @@ using Inkscape::Display::ExtractARGB32;
using Inkscape::Display::ExtractRGB32;
using Inkscape::Display::AssembleARGB32;
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
-namespace {
- ToolBase* createPaintbucketContext() {
- return new FloodTool();
- }
-
- bool paintbucketContextRegistered = ToolFactory::instance().registerObject("/tools/paintbucket", createPaintbucketContext);
-}
-
const std::string& FloodTool::getPrefsPath() {
return FloodTool::prefsPath;
}
@@ -1097,8 +1087,8 @@ bool FloodTool::item_handler(SPItem* item, GdkEvent* event) {
desktop->applyCurrentOrToolStyle(item, "/tools/paintbucket", false);
DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_PAINTBUCKET, _("Set style on object"));
-
- ret = TRUE;
+ // Dead assignment: Value stored to 'ret' is never read
+ //ret = TRUE;
}
break;
diff --git a/src/ui/tools/gradient-tool.cpp b/src/ui/tools/gradient-tool.cpp
index 5da30da7b..5be84eb76 100644
--- a/src/ui/tools/gradient-tool.cpp
+++ b/src/ui/tools/gradient-tool.cpp
@@ -51,22 +51,12 @@
using Inkscape::DocumentUndo;
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
static void sp_gradient_drag(GradientTool &rc, Geom::Point const pt, guint state, guint32 etime);
-namespace {
- ToolBase* createGradientContext() {
- return new GradientTool();
- }
-
- bool gradientContextRegistered = ToolFactory::instance().registerObject("/tools/gradient", createGradientContext);
-}
-
const std::string& GradientTool::getPrefsPath() {
return GradientTool::prefsPath;
}
diff --git a/src/ui/tools/lpe-tool.cpp b/src/ui/tools/lpe-tool.cpp
index c9b656397..c0517578d 100644
--- a/src/ui/tools/lpe-tool.cpp
+++ b/src/ui/tools/lpe-tool.cpp
@@ -58,23 +58,12 @@ SubtoolEntry lpesubtools[] = {
{Inkscape::LivePathEffect::MIRROR_SYMMETRY, "draw-geometry-mirror"}
};
-
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
void sp_lpetool_context_selection_changed(Inkscape::Selection *selection, gpointer data);
-namespace {
- ToolBase* createLPEToolContext() {
- return new LpeTool();
- }
-
- bool lpetoolContextRegistered = ToolFactory::instance().registerObject("/tools/lpetool", createLPEToolContext);
-}
-
const std::string& LpeTool::getPrefsPath() {
return LpeTool::prefsPath;
}
diff --git a/src/ui/tools/measure-tool.cpp b/src/ui/tools/measure-tool.cpp
index b7e54b9c8..0875c29e0 100644
--- a/src/ui/tools/measure-tool.cpp
+++ b/src/ui/tools/measure-tool.cpp
@@ -49,22 +49,12 @@ using Inkscape::ControlManager;
using Inkscape::CTLINE_SECONDARY;
using Inkscape::Util::unit_table;
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
std::vector<Inkscape::Display::TemporaryItem*> measure_tmp_items;
-namespace {
- ToolBase* createMeasureContext() {
- return new MeasureTool();
- }
-
- bool measureContextRegistered = ToolFactory::instance().registerObject("/tools/measure", createMeasureContext);
-}
-
const std::string& MeasureTool::getPrefsPath() {
return MeasureTool::prefsPath;
}
diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp
index d333b932e..67ed7aef1 100644
--- a/src/ui/tools/mesh-tool.cpp
+++ b/src/ui/tools/mesh-tool.cpp
@@ -48,27 +48,17 @@
// Mesh specific
#include "ui/tools/mesh-tool.h"
-#include "sp-mesh-gradient.h"
+#include "sp-mesh.h"
#include "display/sp-ctrlcurve.h"
using Inkscape::DocumentUndo;
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
static void sp_mesh_drag(MeshTool &rc, Geom::Point const pt, guint state, guint32 etime);
-namespace {
- ToolBase* createMeshContext() {
- return new MeshTool();
- }
-
- bool meshContextRegistered = ToolFactory::instance().registerObject("/tools/mesh", createMeshContext);
-}
-
const std::string& MeshTool::getPrefsPath() {
return MeshTool::prefsPath;
}
@@ -172,9 +162,9 @@ void MeshTool::selection_changed(Inkscape::Selection* /*sel*/) {
// if (style && (style->fill.isPaintserver())) {
// SPPaintServer *server = item->style->getFillPaintServer();
- // if ( SP_IS_MESHGRADIENT(server) ) {
+ // if ( SP_IS_MESH(server) ) {
- // SPMeshGradient *mg = SP_MESHGRADIENT(server);
+ // SPMesh *mg = SP_MESH(server);
// guint rows = 0;//mg->array.patches.size();
// for ( guint i = 0; i < rows; ++i ) {
@@ -337,8 +327,8 @@ sp_mesh_context_corner_operation (MeshTool *rc, MeshCornerOperation operation )
SPDocument *doc = NULL;
GrDrag *drag = rc->_grdrag;
- std::map<SPMeshGradient*, std::vector<guint> > points;
- std::map<SPMeshGradient*, SPItem*> items;
+ std::map<SPMesh*, std::vector<guint> > points;
+ std::map<SPMesh*, SPItem*> items;
// Get list of selected draggers for each mesh.
// For all selected draggers
@@ -352,7 +342,7 @@ sp_mesh_context_corner_operation (MeshTool *rc, MeshCornerOperation operation )
if( d->point_type != POINT_MG_CORNER ) continue;
// Find the gradient
- SPMeshGradient *gradient = SP_MESHGRADIENT( getGradient (d->item, d->fill_or_stroke) );
+ SPMesh *gradient = SP_MESH( getGradient (d->item, d->fill_or_stroke) );
// Collect points together for same gradient
points[gradient].push_back( d->point_i );
@@ -361,8 +351,8 @@ sp_mesh_context_corner_operation (MeshTool *rc, MeshCornerOperation operation )
}
// Loop over meshes.
- for( std::map<SPMeshGradient*, std::vector<guint> >::const_iterator iter = points.begin(); iter != points.end(); ++iter) {
- SPMeshGradient *mg = SP_MESHGRADIENT( iter->first );
+ for( std::map<SPMesh*, std::vector<guint> >::const_iterator iter = points.begin(); iter != points.end(); ++iter) {
+ SPMesh *mg = SP_MESH( iter->first );
if( iter->second.size() > 0 ) {
guint noperation = 0;
switch (operation) {
diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp
index caec901a6..f8045a029 100644
--- a/src/ui/tools/node-tool.cpp
+++ b/src/ui/tools/node-tool.cpp
@@ -107,20 +107,10 @@
using Inkscape::ControlManager;
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
-namespace {
- ToolBase* createNodesContext() {
- return new NodeTool();
- }
-
- bool nodesContextRegistered = ToolFactory::instance().registerObject("/tools/nodes", createNodesContext);
-}
-
const std::string& NodeTool::getPrefsPath() {
return NodeTool::prefsPath;
}
diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp
index 5174775c9..d28b7c27a 100644
--- a/src/ui/tools/pen-tool.cpp
+++ b/src/ui/tools/pen-tool.cpp
@@ -73,8 +73,6 @@
#include "live_effects/lpe-bspline.h"
#include <2geom/nearest-point.h>
-#include "ui/tool-factory.h"
-
#include "live_effects/effect.h"
@@ -88,13 +86,6 @@ static Geom::Point pen_drag_origin_w(0, 0);
static bool pen_within_tolerance = false;
static int pen_last_paraxial_dir = 0; // last used direction in horizontal/vertical mode; 0 = horizontal, 1 = vertical
const double handleCubicGap = 0.01;
-namespace {
- ToolBase* createPenContext() {
- return new PenTool();
- }
-
- bool penContextRegistered = ToolFactory::instance().registerObject("/tools/freehand/pen", createPenContext);
-}
const std::string& PenTool::getPrefsPath() {
return PenTool::prefsPath;
diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp
index 28fed3a8f..db24c7432 100644
--- a/src/ui/tools/pencil-tool.cpp
+++ b/src/ui/tools/pencil-tool.cpp
@@ -43,7 +43,6 @@
#include "display/sp-canvas.h"
#include "display/curve.h"
#include "livarot/Path.h"
-#include "ui/tool-factory.h"
#include "ui/tool/event-utils.h"
namespace Inkscape {
@@ -55,14 +54,6 @@ static bool pencil_within_tolerance = false;
static bool in_svg_plane(Geom::Point const &p) { return Geom::LInfty(p) < 1e18; }
-namespace {
- ToolBase* createPencilContext() {
- return new PencilTool();
- }
-
- bool pencilContextRegistered = ToolFactory::instance().registerObject("/tools/freehand/pencil", createPencilContext);
-}
-
const std::string& PencilTool::getPrefsPath() {
return PencilTool::prefsPath;
}
diff --git a/src/ui/tools/rect-tool.cpp b/src/ui/tools/rect-tool.cpp
index 9476ff624..62a9006ea 100644
--- a/src/ui/tools/rect-tool.cpp
+++ b/src/ui/tools/rect-tool.cpp
@@ -46,20 +46,10 @@
using Inkscape::DocumentUndo;
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
-namespace {
- ToolBase* createRectContext() {
- return new RectTool();
- }
-
- bool rectContextRegistered = ToolFactory::instance().registerObject("/tools/shapes/rect", createRectContext);
-}
-
const std::string& RectTool::getPrefsPath() {
return RectTool::prefsPath;
}
diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp
index 939b1a0b3..40b994968 100644
--- a/src/ui/tools/select-tool.cpp
+++ b/src/ui/tools/select-tool.cpp
@@ -49,7 +49,6 @@
#include "display/sp-canvas.h"
#include "display/sp-canvas-item.h"
#include "display/drawing-item.h"
-#include "ui/tool-factory.h"
using Inkscape::DocumentUndo;
@@ -65,14 +64,6 @@ static GdkCursor *CursorSelectDragging = NULL;
static gint rb_escaped = 0; // if non-zero, rubberband was canceled by esc, so the next button release should not deselect
static gint drag_escaped = 0; // if non-zero, drag was canceled by esc
-namespace {
- ToolBase* createSelectContext() {
- return new SelectTool();
- }
-
- bool selectContextRegistered = ToolFactory::instance().registerObject("/tools/select", createSelectContext);
-}
-
const std::string& SelectTool::getPrefsPath() {
return SelectTool::prefsPath;
}
diff --git a/src/ui/tools/spiral-tool.cpp b/src/ui/tools/spiral-tool.cpp
index f208e1c43..833fef18d 100644
--- a/src/ui/tools/spiral-tool.cpp
+++ b/src/ui/tools/spiral-tool.cpp
@@ -45,20 +45,10 @@
using Inkscape::DocumentUndo;
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
-namespace {
- ToolBase* createSpiralContext() {
- return new SpiralTool();
- }
-
- bool spiralContextRegistered = ToolFactory::instance().registerObject("/tools/shapes/spiral", createSpiralContext);
-}
-
const std::string& SpiralTool::getPrefsPath() {
return SpiralTool::prefsPath;
}
diff --git a/src/ui/tools/spray-tool.cpp b/src/ui/tools/spray-tool.cpp
index a01c5c55b..ec7d10e13 100644
--- a/src/ui/tools/spray-tool.cpp
+++ b/src/ui/tools/spray-tool.cpp
@@ -84,20 +84,10 @@ using namespace std;
// Please enable again when working on 1.0
#define ENABLE_SPRAY_MODE_SINGLE_PATH
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
-namespace {
- ToolBase* createSprayContext() {
- return new SprayTool();
- }
-
- bool sprayContextRegistered = ToolFactory::instance().registerObject("/tools/spray", createSprayContext);
-}
-
const std::string& SprayTool::getPrefsPath() {
return SprayTool::prefsPath;
}
@@ -449,39 +439,41 @@ static bool sp_spray_recursive(SPDesktop *desktop,
}
i++;
}
- SPDocument *doc = parent_item->document;
- Inkscape::XML::Document* xml_doc = doc->getReprDoc();
- Inkscape::XML::Node *old_repr = parent_item->getRepr();
- Inkscape::XML::Node *parent = old_repr->parent();
-
- Geom::OptRect a = parent_item->documentVisualBounds();
- if (a) {
- if (_fid <= population) { // Rules the population of objects sprayed
- // Duplicates the parent item
- Inkscape::XML::Node *copy = old_repr->duplicate(xml_doc);
- parent->appendChild(copy);
- SPObject *new_obj = doc->getObjectByRepr(copy);
- item_copied = dynamic_cast<SPItem *>(new_obj);
-
- // Move around the cursor
- Geom::Point move = (Geom::Point(cos(tilt)*cos(dp)*dr/(1-ratio)+sin(tilt)*sin(dp)*dr/(1+ratio), -sin(tilt)*cos(dp)*dr/(1-ratio)+cos(tilt)*sin(dp)*dr/(1+ratio)))+(p-a->midpoint());
-
- Geom::Point center = parent_item->getCenter();
- sp_spray_scale_rel(center, desktop, item_copied, Geom::Scale(_scale, _scale));
- sp_spray_scale_rel(center, desktop, item_copied, Geom::Scale(scale, scale));
- sp_spray_rotate_rel(center, desktop, item_copied, Geom::Rotate(angle));
- sp_item_move_rel(item_copied, Geom::Translate(move[Geom::X], -move[Geom::Y]));
-
- // Union and duplication
- selection->clear();
- selection->add(item_copied);
- if (unionResult) { // No need to add the very first item (initialized with NULL).
- selection->add(unionResult);
+ if (parent_item) {
+ SPDocument *doc = parent_item->document;
+ Inkscape::XML::Document* xml_doc = doc->getReprDoc();
+ Inkscape::XML::Node *old_repr = parent_item->getRepr();
+ Inkscape::XML::Node *parent = old_repr->parent();
+
+ Geom::OptRect a = parent_item->documentVisualBounds();
+ if (a) {
+ if (_fid <= population) { // Rules the population of objects sprayed
+ // Duplicates the parent item
+ Inkscape::XML::Node *copy = old_repr->duplicate(xml_doc);
+ parent->appendChild(copy);
+ SPObject *new_obj = doc->getObjectByRepr(copy);
+ item_copied = dynamic_cast<SPItem *>(new_obj);
+
+ // Move around the cursor
+ Geom::Point move = (Geom::Point(cos(tilt)*cos(dp)*dr/(1-ratio)+sin(tilt)*sin(dp)*dr/(1+ratio), -sin(tilt)*cos(dp)*dr/(1-ratio)+cos(tilt)*sin(dp)*dr/(1+ratio)))+(p-a->midpoint());
+
+ Geom::Point center = parent_item->getCenter();
+ sp_spray_scale_rel(center, desktop, item_copied, Geom::Scale(_scale, _scale));
+ sp_spray_scale_rel(center, desktop, item_copied, Geom::Scale(scale, scale));
+ sp_spray_rotate_rel(center, desktop, item_copied, Geom::Rotate(angle));
+ sp_item_move_rel(item_copied, Geom::Translate(move[Geom::X], -move[Geom::Y]));
+
+ // Union and duplication
+ selection->clear();
+ selection->add(item_copied);
+ if (unionResult) { // No need to add the very first item (initialized with NULL).
+ selection->add(unionResult);
+ }
+ sp_selected_path_union_skip_undo(selection, selection->desktop());
+ selection->add(parent_item);
+ Inkscape::GC::release(copy);
+ did = true;
}
- sp_selected_path_union_skip_undo(selection, selection->desktop());
- selection->add(parent_item);
- Inkscape::GC::release(copy);
- did = true;
}
}
#endif
diff --git a/src/ui/tools/star-tool.cpp b/src/ui/tools/star-tool.cpp
index df311f2d8..9190ae57b 100644
--- a/src/ui/tools/star-tool.cpp
+++ b/src/ui/tools/star-tool.cpp
@@ -49,20 +49,10 @@
using Inkscape::DocumentUndo;
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
-namespace {
- ToolBase* createStarContext() {
- return new StarTool();
- }
-
- bool starContextRegistered = ToolFactory::instance().registerObject("/tools/shapes/star", createStarContext);
-}
-
const std::string& StarTool::getPrefsPath() {
return StarTool::prefsPath;
}
diff --git a/src/ui/tools/text-tool.cpp b/src/ui/tools/text-tool.cpp
index df0583d67..a2c0c81ae 100644
--- a/src/ui/tools/text-tool.cpp
+++ b/src/ui/tools/text-tool.cpp
@@ -52,7 +52,6 @@
#include "xml/node-event-vector.h"
#include "xml/repr.h"
#include <gtk/gtk.h>
-#include "ui/tool-factory.h"
using Inkscape::ControlManager;
using Inkscape::DocumentUndo;
@@ -71,14 +70,6 @@ static gint sptc_focus_in(GtkWidget *widget, GdkEventFocus *event, TextTool *tc)
static gint sptc_focus_out(GtkWidget *widget, GdkEventFocus *event, TextTool *tc);
static void sptc_commit(GtkIMContext *imc, gchar *string, TextTool *tc);
-namespace {
- ToolBase* createTextContext() {
- return new TextTool();
- }
-
- bool textContextRegistered = ToolFactory::instance().registerObject("/tools/text", createTextContext);
-}
-
const std::string& TextTool::getPrefsPath() {
return TextTool::prefsPath;
}
diff --git a/src/ui/tools/tweak-tool.cpp b/src/ui/tools/tweak-tool.cpp
index 5e53fdb93..80b52fba6 100644
--- a/src/ui/tools/tweak-tool.cpp
+++ b/src/ui/tools/tweak-tool.cpp
@@ -91,20 +91,10 @@ using Inkscape::DocumentUndo;
#define DYNA_MIN_WIDTH 1.0e-6
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
-namespace {
- ToolBase* createTweakContext() {
- return new TweakTool();
- }
-
- bool tweakContextRegistered = ToolFactory::instance().registerObject("/tools/tweak", createTweakContext);
-}
-
const std::string& TweakTool::getPrefsPath() {
return TweakTool::prefsPath;
}
diff --git a/src/ui/tools/zoom-tool.cpp b/src/ui/tools/zoom-tool.cpp
index b3fb78c8f..6a4d4dbbd 100644
--- a/src/ui/tools/zoom-tool.cpp
+++ b/src/ui/tools/zoom-tool.cpp
@@ -25,20 +25,11 @@
#include "selection-chemistry.h"
#include "ui/tools/zoom-tool.h"
-#include "ui/tool-factory.h"
namespace Inkscape {
namespace UI {
namespace Tools {
-namespace {
- ToolBase* createZoomContext() {
- return new ZoomTool();
- }
-
- bool zoomContextRegistered = ToolFactory::instance().registerObject("/tools/zoom", createZoomContext);
-}
-
const std::string& ZoomTool::getPrefsPath() {
return ZoomTool::prefsPath;
}
diff --git a/src/ui/view/view.h b/src/ui/view/view.h
index 48f4d2549..21a5d0dfc 100644
--- a/src/ui/view/view.h
+++ b/src/ui/view/view.h
@@ -15,7 +15,7 @@
#include <stddef.h>
#include <sigc++/connection.h>
#include "message.h"
-#include "gc-managed.h"
+#include "inkgc/gc-managed.h"
#include "gc-finalized.h"
#include "gc-anchored.h"
#include <2geom/forward.h>
diff --git a/src/ui/widget/addtoicon.cpp b/src/ui/widget/addtoicon.cpp
index 0798d1c98..f15d7abf7 100644
--- a/src/ui/widget/addtoicon.cpp
+++ b/src/ui/widget/addtoicon.cpp
@@ -23,6 +23,7 @@
#include "widgets/icon.h"
#include "widgets/toolbox.h"
#include "ui/icon-names.h"
+#include "preferences.h"
#include "layertypeicon.h"
#include "addtoicon.h"
@@ -39,6 +40,7 @@ AddToIcon::AddToIcon() :
{
property_mode() = Gtk::CELL_RENDERER_MODE_ACTIVATABLE;
phys = sp_icon_get_phys_size((int)Inkscape::ICON_SIZE_BUTTON);
+
// Glib::RefPtr<Gtk::IconTheme> icon_theme = Gtk::IconTheme::get_default();
//
// if (!icon_theme->has_icon(_pixAddName)) {
@@ -50,7 +52,8 @@ AddToIcon::AddToIcon() :
//
// _property_pixbuf_add = Gtk::Widget::
- property_stock_id() = GTK_STOCK_ADD;
+ //property_stock_id() = GTK_STOCK_ADD;
+ set_pixbuf();
}
@@ -118,7 +121,7 @@ void AddToIcon::render_vfunc( const Glib::RefPtr<Gdk::Drawable>& window,
Gtk::CellRendererState flags )
#endif
{
- property_stock_id() = property_active().get_value() ? GTK_STOCK_ADD : GTK_STOCK_DELETE;
+ set_pixbuf();
#if WITH_GTKMM_3_0
Gtk::CellRendererPixbuf::render_vfunc( cr, widget, background_area, cell_area, flags );
@@ -137,6 +140,14 @@ bool AddToIcon::activate_vfunc(GdkEvent* /*event*/,
return false;
}
+void AddToIcon::set_pixbuf()
+{
+ bool active = property_active().get_value();
+
+ GdkPixbuf *pixbuf = sp_pixbuf_new(Inkscape::ICON_SIZE_BUTTON, active ? INKSCAPE_ICON("list-add") : INKSCAPE_ICON("edit-delete"));
+ property_pixbuf() = Glib::wrap(pixbuf);
+}
+
} // namespace Widget
} // namespace UI
@@ -152,5 +163,3 @@ bool AddToIcon::activate_vfunc(GdkEvent* /*event*/,
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
-
-
diff --git a/src/ui/widget/addtoicon.h b/src/ui/widget/addtoicon.h
index 9c134d231..a8d900d1f 100644
--- a/src/ui/widget/addtoicon.h
+++ b/src/ui/widget/addtoicon.h
@@ -74,7 +74,7 @@ private:
Glib::Property<bool> _property_active;
// Glib::Property< Glib::RefPtr<Gdk::Pixbuf> > _property_pixbuf_add;
-
+ void set_pixbuf();
};
diff --git a/src/ui/widget/licensor.cpp b/src/ui/widget/licensor.cpp
index 7429bb07e..d21e848f2 100644
--- a/src/ui/widget/licensor.cpp
+++ b/src/ui/widget/licensor.cpp
@@ -69,7 +69,7 @@ void LicenseItem::on_toggled()
SPDocument *doc = SP_ACTIVE_DOCUMENT;
rdf_set_license (doc, _lic->details ? _lic : 0);
if (doc->priv->sensitive) {
- DocumentUndo::done(doc, SP_VERB_NONE, "Document license updated");
+ DocumentUndo::done(doc, SP_VERB_NONE, _("Document license updated"));
}
_wr.setUpdating (false);
static_cast<Gtk::Entry*>(_eep->_packable)->set_text (_lic->uri);
diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp
index 8c3b44bf5..8e647ebb4 100644
--- a/src/ui/widget/page-sizer.cpp
+++ b/src/ui/widget/page-sizer.cpp
@@ -26,6 +26,7 @@
#include <cmath>
#include <string>
#include <string.h>
+#include <sstream>
#include <vector>
#include <glibmm/i18n.h>
@@ -240,6 +241,8 @@ PageSizer::PageSizer(Registry & _wr)
_marginRight( _("Ri_ght:"), _("Right margin"), "fit-margin-right", _wr),
_marginBottom( _("Botto_m:"), _("Bottom margin"), "fit-margin-bottom", _wr),
_lockMarginUpdate(false),
+ _scaleX(_("Scale _x:"), _("Scale X"), "scale-x", _wr),
+ _lockScaleUpdate(false),
_widgetRegistry(&_wr)
{
// set precision of scalar entry boxes
@@ -250,6 +253,8 @@ PageSizer::PageSizer(Registry & _wr)
_marginLeft.setDigits(5);
_marginRight.setDigits(5);
_marginBottom.setDigits(5);
+ _scaleX.setDigits(5);
+ _scaleX.setRange( 0.00001, 100000 );
_wr.setUpdating (false);
//# Set up the Paper Size combo box
@@ -318,6 +323,7 @@ PageSizer::PageSizer(Registry & _wr)
}
_wr.setUpdating (false);
+
//## Set up custom size frame
_customFrame.set_label(_("Custom size"));
pack_start (_customFrame, false, false, 0);
@@ -419,6 +425,34 @@ PageSizer::PageSizer(Registry & _wr)
_fitPageButton.set_label(_("_Resize page to drawing or selection"));
_fitPageButton.set_tooltip_text(_("Resize the page to fit the current selection, or the entire drawing if there is no selection"));
+ _scaleFrame.set_label(_("Scale"));
+ pack_start (_scaleFrame, false, false, 0);
+ _scaleFrame.add(_scaleTable);
+
+ _scaleTable.set_border_width(4);
+
+#if WITH_GTKMM_3_0
+ _scaleTable.set_row_spacing(4);
+ _scaleTable.set_column_spacing(4);
+
+ _dimensionWidth.set_hexpand();
+ _dimensionWidth.set_vexpand();
+ _scaleTable.attach(_scaleX, 0, 0, 1, 1);
+
+ _dimensionUnits.set_hexpand();
+ _dimensionUnits.set_vexpand();
+ _scaleTable.attach(_scaleLabel, 1, 0, 1, 1);
+#else
+ _scaleTable.resize(2, 1);
+ _scaleTable.set_row_spacings(4);
+ _scaleTable.set_col_spacings(4);
+ _scaleTable.attach(_scaleX, 0,1, 0,1);
+ _scaleTable.attach(_scaleLabel, 1,2, 0,1);
+#endif
+
+ _wr.setUpdating (true);
+ updateScaleUI();
+ _wr.setUpdating (false);
}
@@ -444,7 +478,7 @@ PageSizer::init ()
_changedh_connection = _dimensionHeight.signal_value_changed().connect (sigc::mem_fun (*this, &PageSizer::on_value_changed));
_changedu_connection = _dimensionUnits.getUnitMenu()->signal_changed().connect (sigc::mem_fun (*this, &PageSizer::on_units_changed));
_fitPageButton.signal_clicked().connect(sigc::mem_fun(*this, &PageSizer::fire_fit_canvas_to_selection_or_drawing));
-
+ _changeds_connection = _scaleX.signal_value_changed().connect (sigc::mem_fun (*this, &PageSizer::on_scale_changed));
show_all_children();
}
@@ -512,6 +546,7 @@ PageSizer::setDim (Inkscape::Util::Quantity w, Inkscape::Util::Quantity h, bool
_dimensionHeight.setUnit(h.unit->abbr);
_dimensionHeight.setValue (h.quantity);
+
_paper_size_list_connection.unblock();
_landscape_connection.unblock();
_portrait_connection.unblock();
@@ -701,6 +736,60 @@ PageSizer::on_landscape()
}
}
+
+/**
+ * Update scale widgets
+ */
+void
+PageSizer::updateScaleUI()
+{
+
+ if (_lockScaleUpdate) {
+ return;
+ }
+
+ static bool _called = false;
+ if (_called) {
+ return;
+ }
+
+ _called = true;
+
+ _changeds_connection.block();
+
+ SPDesktop *dt = SP_ACTIVE_DESKTOP;
+ if (dt) {
+ SPDocument *doc = dt->getDocument();
+ Geom::Scale scale = doc->getDocumentScale();
+
+ SPNamedView *nv = dt->getNamedView();
+
+ std::stringstream ss;
+ ss << _("User units per ") << nv->display_units->abbr << "." ;
+ _scaleLabel.set_text( ss.str() );
+
+ double scaleX_inv =
+ Inkscape::Util::Quantity::convert( scale[Geom::X], "px", nv->display_units );
+ if( scaleX_inv > 0 ) {
+ _scaleX.setValue(1.0/scaleX_inv);
+ } else {
+ // Should never happen
+ std::cerr << "PageSizer::updateScaleUI(): Invalid scale value: " << scaleX_inv << std::endl;
+ _scaleX.setValue(1.0);
+ }
+
+ } else {
+ // Should never happen
+ std::cerr << "PageSizer::updateScaleUI(): No active desktop." << std::endl;
+ _scaleLabel.set_text( "Unknown scale" );
+ }
+
+ _changeds_connection.unblock();
+
+ _called = false;
+}
+
+
/**
* Callback for the dimension widgets
*/
@@ -722,6 +811,32 @@ PageSizer::on_units_changed()
true, false);
}
+/**
+ * Callback for scale widgets
+ */
+void
+PageSizer::on_scale_changed()
+{
+ if (_widgetRegistry->isUpdating()) return;
+
+ double value = _scaleX.getValue();
+ if( value > 0 ) {
+
+ SPDesktop *dt = SP_ACTIVE_DESKTOP;
+ if (dt) {
+ SPDocument *doc = dt->getDocument();
+ SPNamedView *nv = dt->getNamedView();
+
+ double scaleX_inv = Inkscape::Util::Quantity(1.0/value, nv->display_units ).value("px");
+
+ _lockScaleUpdate = true;
+ doc->setDocumentScale( 1.0/scaleX_inv );
+ _lockScaleUpdate = false;
+ DocumentUndo::done(doc, SP_VERB_NONE, _("Set page scale"));
+ }
+ }
+}
+
} // namespace Widget
} // namespace UI
} // namespace Inkscape
diff --git a/src/ui/widget/page-sizer.h b/src/ui/widget/page-sizer.h
index bed117e5a..f9a72d9f3 100644
--- a/src/ui/widget/page-sizer.h
+++ b/src/ui/widget/page-sizer.h
@@ -169,6 +169,11 @@ public:
*/
void updateFitMarginsUI(Inkscape::XML::Node *nv_repr);
+ /**
+ * Updates the scale widgets. (Just changes the values of the ui widgets.)
+ */
+ void updateScaleUI();
+
protected:
/**
@@ -250,12 +255,26 @@ protected:
Gtk::Button _fitPageButton;
bool _lockMarginUpdate;
+ // Document scale
+ Gtk::Frame _scaleFrame;
+#if WITH_GTKMM_3_0
+ Gtk::Grid _scaleTable;
+#else
+ Gtk::Table _scaleTable;
+#endif
+
+ Gtk::Label _scaleLabel;
+ RegisteredScalar _scaleX;
+ bool _lockScaleUpdate;
+
//callback
void on_value_changed();
void on_units_changed();
+ void on_scale_changed();
sigc::connection _changedw_connection;
sigc::connection _changedh_connection;
sigc::connection _changedu_connection;
+ sigc::connection _changeds_connection;
Registry *_widgetRegistry;
diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp
index 1fc67dcef..9e283fc64 100644
--- a/src/ui/widget/selected-style.cpp
+++ b/src/ui/widget/selected-style.cpp
@@ -25,8 +25,8 @@
#include "desktop-style.h"
#include "sp-namedview.h"
#include "sp-linear-gradient.h"
-#include "sp-mesh-gradient.h"
#include "sp-radial-gradient.h"
+#include "sp-mesh.h"
#include "sp-pattern.h"
#include "ui/dialog/dialog-manager.h"
#include "ui/dialog/fill-and-stroke.h"
@@ -1045,7 +1045,7 @@ SelectedStyle::update()
place->set_tooltip_text(__rgradient[i]);
_mode[i] = SS_RGRADIENT;
#ifdef WITH_MESH
- } else if (SP_IS_MESHGRADIENT(server)) {
+ } else if (SP_IS_MESH(server)) {
SPGradient *vector = SP_GRADIENT(server)->getVector();
sp_gradient_image_set_gradient(SP_GRADIENT_IMAGE(_gradient_preview_m[i]), vector);
place->add(_gradient_box_m[i]);