summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/display/canvas-axonomgrid.cpp3
-rw-r--r--src/extension/implementation/xslt.cpp40
-rw-r--r--src/file.cpp6
-rw-r--r--src/inkscape-x64.rc8
-rw-r--r--src/inkscape.rc8
-rw-r--r--src/inkview-x64.rc8
-rw-r--r--src/inkview.rc8
-rw-r--r--src/live_effects/parameter/parameter.cpp8
-rw-r--r--src/live_effects/parameter/parameter.h2
-rw-r--r--src/selection-chemistry.cpp17
-rw-r--r--src/selection-chemistry.h2
-rw-r--r--src/sp-item-group.cpp8
-rw-r--r--src/sp-item.cpp26
-rw-r--r--src/sp-solid-color.cpp2
-rw-r--r--src/ui/dialog/document-properties.cpp7
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp8
-rw-r--r--src/ui/dialog/inkscape-preferences.h1
-rw-r--r--src/ui/dialog/print.cpp21
-rw-r--r--src/ui/widget/rendering-options.cpp18
-rw-r--r--src/util/units.cpp6
-rw-r--r--src/widgets/font-selector.cpp7
21 files changed, 134 insertions, 80 deletions
diff --git a/src/display/canvas-axonomgrid.cpp b/src/display/canvas-axonomgrid.cpp
index 312a8d655..592c962a6 100644
--- a/src/display/canvas-axonomgrid.cpp
+++ b/src/display/canvas-axonomgrid.cpp
@@ -387,6 +387,9 @@ _wr.setUpdating (false);
_rcp_gmcol->setRgba32 (empcolor);
_rsi->setValue (empspacing);
+ _rsu_ox->setProgrammatically = false;
+ _rsu_oy->setProgrammatically = false;
+
return table;
}
diff --git a/src/extension/implementation/xslt.cpp b/src/extension/implementation/xslt.cpp
index bcea06cb5..85ae9efde 100644
--- a/src/extension/implementation/xslt.cpp
+++ b/src/extension/implementation/xslt.cpp
@@ -20,6 +20,7 @@
#include "xslt.h"
#include "../extension.h"
#include "../output.h"
+#include "extension/input.h"
#include "xml/repr.h"
#include "io/sys.h"
@@ -53,8 +54,7 @@ XSLT::XSLT(void) :
{
}
-Glib::ustring
-XSLT::solve_reldir(Inkscape::XML::Node *reprin) {
+Glib::ustring XSLT::solve_reldir(Inkscape::XML::Node *reprin) {
gchar const *s = reprin->attribute("reldir");
@@ -90,8 +90,7 @@ XSLT::solve_reldir(Inkscape::XML::Node *reprin) {
return "";
}
-bool
-XSLT::check(Inkscape::Extension::Extension *module)
+bool XSLT::check(Inkscape::Extension::Extension *module)
{
if (load(module)) {
unload(module);
@@ -101,8 +100,7 @@ XSLT::check(Inkscape::Extension::Extension *module)
}
}
-bool
-XSLT::load(Inkscape::Extension::Extension *module)
+bool XSLT::load(Inkscape::Extension::Extension *module)
{
if (module->loaded()) { return true; }
@@ -130,8 +128,7 @@ XSLT::load(Inkscape::Extension::Extension *module)
return true;
}
-void
-XSLT::unload(Inkscape::Extension::Extension *module)
+void XSLT::unload(Inkscape::Extension::Extension *module)
{
if (!module->loaded()) { return; }
xsltFreeStylesheet(_stylesheet);
@@ -139,8 +136,8 @@ XSLT::unload(Inkscape::Extension::Extension *module)
return;
}
-SPDocument *
-XSLT::open(Inkscape::Extension::Input */*module*/, gchar const *filename)
+SPDocument * XSLT::open(Inkscape::Extension::Input */*module*/,
+ gchar const *filename)
{
xmlDocPtr filein = xmlParseFile(filename);
if (filein == NULL) { return NULL; }
@@ -184,8 +181,7 @@ XSLT::open(Inkscape::Extension::Input */*module*/, gchar const *filename)
return doc;
}
-void
-XSLT::save(Inkscape::Extension::Output */*module*/, SPDocument *doc, gchar const *filename)
+void XSLT::save(Inkscape::Extension::Output *module, SPDocument *doc, gchar const *filename)
{
/* TODO: Should we assume filename to be in utf8 or to be a raw filename?
* See JavaFXOutput::save for discussion. */
@@ -214,10 +210,24 @@ XSLT::save(Inkscape::Extension::Output */*module*/, SPDocument *doc, gchar const
return;
}
- const char * params[1];
- params[0] = NULL;
+ std::list<std::string> params;
+ module->paramListString(params);
+ const int max_parameters = params.size() * 2;
+ const char * xslt_params[max_parameters+1] ;
+
+ int count = 0;
+ for(std::list<std::string>::iterator t=params.begin(); t != params.end(); ++t) {
+ std::size_t pos = t->find("=");
+ std::ostringstream parameter;
+ std::ostringstream value;
+ parameter << t->substr(2,pos-2);
+ value << t->substr(pos+1);
+ xslt_params[count++] = g_strdup_printf("%s", parameter.str().c_str());
+ xslt_params[count++] = g_strdup_printf("'%s'", value.str().c_str());
+ }
+ xslt_params[count] = NULL;
- xmlDocPtr newdoc = xsltApplyStylesheet(_stylesheet, svgdoc, params);
+ xmlDocPtr newdoc = xsltApplyStylesheet(_stylesheet, svgdoc, xslt_params);
//xmlSaveFile(filename, newdoc);
int success = xsltSaveResultToFilename(filename, newdoc, _stylesheet, 0);
diff --git a/src/file.cpp b/src/file.cpp
index d8671c5d5..2f13ae3b0 100644
--- a/src/file.cpp
+++ b/src/file.cpp
@@ -1087,9 +1087,9 @@ void sp_import_document(SPDesktop *desktop, SPDocument *clipdoc, bool in_place)
Inkscape::Selection *selection = sp_desktop_selection(desktop);
selection->setReprList(pasted_objects);
- // invers apply parent transform
+ // Apply inverse of parent transform
Geom::Affine doc2parent = SP_ITEM(desktop->currentLayer())->i2doc_affine().inverse();
- sp_selection_apply_affine(selection, desktop->dt2doc() * doc2parent * desktop->doc2dt(), true, false);
+ sp_selection_apply_affine(selection, desktop->dt2doc() * doc2parent * desktop->doc2dt(), true, false, false);
// Update (among other things) all curves in paths, for bounds() to work
target_document->ensureUpToDate();
@@ -1226,7 +1226,7 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri,
// c2p is identity matrix at this point unless ensureUpToDate is called
doc->ensureUpToDate();
Geom::Affine affine = doc->getRoot()->c2p * SP_ITEM(place_to_insert)->i2doc_affine().inverse();
- sp_selection_apply_affine(selection, desktop->dt2doc() * affine * desktop->doc2dt(), true, false);
+ sp_selection_apply_affine(selection, desktop->dt2doc() * affine * desktop->doc2dt(), true, false, false);
// move to mouse pointer
{
diff --git a/src/inkscape-x64.rc b/src/inkscape-x64.rc
index ce286c2ca..47dbcb2bc 100644
--- a/src/inkscape-x64.rc
+++ b/src/inkscape-x64.rc
@@ -3,8 +3,8 @@ APPLICATION_ICON ICON DISCARDABLE "../inkscape.ico"
1 24 DISCARDABLE "./inkscape-manifest-x64.xml"
1 VERSIONINFO
- FILEVERSION 0,48,0,9
- PRODUCTVERSION 0,48,0,9
+ FILEVERSION 0,91pre2,0,0
+ PRODUCTVERSION 0,91pre2,0,0
BEGIN
BLOCK "StringFileInfo"
BEGIN
@@ -13,11 +13,11 @@ BEGIN
VALUE "Comments", "Published under the GNU GPL"
VALUE "CompanyName", "inkscape.org"
VALUE "FileDescription", "Inkscape"
- VALUE "FileVersion", "0.48+devel"
+ VALUE "FileVersion", "0.91pre2"
VALUE "InternalName", "Inkscape"
VALUE "LegalCopyright", "© 2014 Inkscape"
VALUE "ProductName", "Inkscape"
- VALUE "ProductVersion", "0.48+devel"
+ VALUE "ProductVersion", "0.91pre2"
END
END
BLOCK "VarFileInfo"
diff --git a/src/inkscape.rc b/src/inkscape.rc
index 395ef39e1..2c2c0112b 100644
--- a/src/inkscape.rc
+++ b/src/inkscape.rc
@@ -3,8 +3,8 @@ APPLICATION_ICON ICON DISCARDABLE "../inkscape.ico"
1 24 DISCARDABLE "./inkscape-manifest.xml"
1 VERSIONINFO
- FILEVERSION 0,48,0,9
- PRODUCTVERSION 0,48,0,9
+ FILEVERSION 0,91pre2,0,0
+ PRODUCTVERSION 0,91pre2,0,0
BEGIN
BLOCK "StringFileInfo"
BEGIN
@@ -13,11 +13,11 @@ BEGIN
VALUE "Comments", "Published under the GNU GPL"
VALUE "CompanyName", "inkscape.org"
VALUE "FileDescription", "Inkscape"
- VALUE "FileVersion", "0.48+devel"
+ VALUE "FileVersion", "0.91pre2"
VALUE "InternalName", "Inkscape"
VALUE "LegalCopyright", "© 2014 Inkscape"
VALUE "ProductName", "Inkscape"
- VALUE "ProductVersion", "0.48+devel"
+ VALUE "ProductVersion", "0.91pre2"
END
END
BLOCK "VarFileInfo"
diff --git a/src/inkview-x64.rc b/src/inkview-x64.rc
index 2de16060b..f23fe84c9 100644
--- a/src/inkview-x64.rc
+++ b/src/inkview-x64.rc
@@ -3,8 +3,8 @@ APPLICATION_ICON ICON DISCARDABLE "../inkscape.ico"
1 24 DISCARDABLE "./inkview-manifest-x64.xml"
1 VERSIONINFO
- FILEVERSION 0,48,0,9
- PRODUCTVERSION 0,48,0,9
+ FILEVERSION 0,91,0,0
+ PRODUCTVERSION 0,91,0,0
BEGIN
BLOCK "StringFileInfo"
BEGIN
@@ -13,11 +13,11 @@ BEGIN
VALUE "Comments", "Published under the GNU GPL"
VALUE "CompanyName", "inkscape.org"
VALUE "FileDescription", "Inkview"
- VALUE "FileVersion", "0.48+devel"
+ VALUE "FileVersion", "0.91pre2"
VALUE "InternalName", "Inkview"
VALUE "LegalCopyright", "© 2014 Inkscape"
VALUE "ProductName", "Inkview"
- VALUE "ProductVersion", "0.48+devel"
+ VALUE "ProductVersion", "0.91pre2"
END
END
BLOCK "VarFileInfo"
diff --git a/src/inkview.rc b/src/inkview.rc
index fd7eb50a1..efbe2568b 100644
--- a/src/inkview.rc
+++ b/src/inkview.rc
@@ -3,8 +3,8 @@ APPLICATION_ICON ICON DISCARDABLE "../inkscape.ico"
1 24 DISCARDABLE "./inkview-manifest.xml"
1 VERSIONINFO
- FILEVERSION 0,48,0,9
- PRODUCTVERSION 0,48,0,9
+ FILEVERSION 0,91pre2,0,0
+ PRODUCTVERSION 0,91pre2,0,0
BEGIN
BLOCK "StringFileInfo"
BEGIN
@@ -13,11 +13,11 @@ BEGIN
VALUE "Comments", "Published under the GNU GPL"
VALUE "CompanyName", "inkscape.org"
VALUE "FileDescription", "Inkview"
- VALUE "FileVersion", "0.48+devel"
+ VALUE "FileVersion", "0.91pre2"
VALUE "InternalName", "Inkview"
VALUE "LegalCopyright", "© 2014 Inkscape"
VALUE "ProductName", "Inkview"
- VALUE "ProductVersion", "0.48+devel"
+ VALUE "ProductVersion", "0.91pre2"
END
END
BLOCK "VarFileInfo"
diff --git a/src/live_effects/parameter/parameter.cpp b/src/live_effects/parameter/parameter.cpp
index 7732eee76..7a2fd9769 100644
--- a/src/live_effects/parameter/parameter.cpp
+++ b/src/live_effects/parameter/parameter.cpp
@@ -36,14 +36,12 @@ Parameter::Parameter( const Glib::ustring& label, const Glib::ustring& tip,
{
}
-
void
Parameter::param_write_to_repr(const char * svgd)
{
param_effect->getRepr()->setAttribute(param_key.c_str(), svgd);
}
-
// In gtk2, this wasn't an issue; we could toss around
// G_MAXDOUBLE and not worry about size allocations. But
// in gtk3, it is an issue: it allocates widget size for the maxmium
@@ -51,6 +49,12 @@ Parameter::param_write_to_repr(const char * svgd)
// If you need this to be more, please be conservative about it.
const double SCALARPARAM_G_MAXDOUBLE = 10000000000;
+void Parameter::write_to_SVG(void)
+{
+ gchar * str = param_getSVGValue();
+ param_write_to_repr(str);
+ g_free(str);
+}
/*###########################################
* REAL PARAM
diff --git a/src/live_effects/parameter/parameter.h b/src/live_effects/parameter/parameter.h
index 785ada92e..2e6cae49f 100644
--- a/src/live_effects/parameter/parameter.h
+++ b/src/live_effects/parameter/parameter.h
@@ -49,7 +49,7 @@ public:
virtual bool param_readSVGValue(const gchar * strvalue) = 0; // returns true if new value is valid / accepted.
virtual gchar * param_getSVGValue() const = 0;
- void write_to_SVG() { param_write_to_repr(param_getSVGValue()); }
+ void write_to_SVG();
virtual void param_set_default() = 0;
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index f058189d3..01ce20509 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -1466,7 +1466,7 @@ value of set_i2d==false is only used by seltrans when it's dragging objects live
that case, items are already in the new position, but the repr is in the old, and this function
then simply updates the repr from item->transform.
*/
-void sp_selection_apply_affine(Inkscape::Selection *selection, Geom::Affine const &affine, bool set_i2d, bool compensate)
+void sp_selection_apply_affine(Inkscape::Selection *selection, Geom::Affine const &affine, bool set_i2d, bool compensate, bool adjust_transf_center)
{
if (selection->isEmpty())
return;
@@ -1621,14 +1621,13 @@ void sp_selection_apply_affine(Inkscape::Selection *selection, Geom::Affine cons
item->doWriteTransform(item->getRepr(), item->transform, NULL, compensate);
}
- // if we're transforming the actual object, not just updating the repr, we can transform the
- // center by the same matrix (only necessary for non-translations)
- if (set_i2d && item->isCenterSet() && !(affine.isTranslation() || affine.isIdentity())) {
- // If there's a viewbox, we might have an affine with a translation component;
- // we will only apply the scaling/skewing components, not the translations
- // because otherwise the center will move relative to the item
- item->setCenter(old_center * affine.withoutTranslation());
- item->updateRepr();
+ if (adjust_transf_center) { // The transformation center should not be touched in case of pasting or importing, which is allowed by this if clause
+ // if we're moving the actual object, not just updating the repr, we can transform the
+ // center by the same matrix (only necessary for non-translations)
+ if (set_i2d && item->isCenterSet() && !(affine.isTranslation() || affine.isIdentity())) {
+ item->setCenter(old_center * affine);
+ item->updateRepr();
+ }
}
}
}
diff --git a/src/selection-chemistry.h b/src/selection-chemistry.h
index d76a67a9d..01c35d65a 100644
--- a/src/selection-chemistry.h
+++ b/src/selection-chemistry.h
@@ -104,7 +104,7 @@ void sp_selection_to_next_layer( SPDesktop *desktop, bool suppressDone = false )
void sp_selection_to_prev_layer( SPDesktop *desktop, bool suppressDone = false );
void sp_selection_to_layer( SPDesktop *desktop, SPObject *layer, bool suppressDone = false );
-void sp_selection_apply_affine(Inkscape::Selection *selection, Geom::Affine const &affine, bool set_i2d = true, bool compensate = true);
+void sp_selection_apply_affine(Inkscape::Selection *selection, Geom::Affine const &affine, bool set_i2d = true, bool compensate = true, bool adjust_transf_center = true);
void sp_selection_remove_transform (SPDesktop *desktop);
void sp_selection_scale_absolute (Inkscape::Selection *selection, double x0, double x1, double y0, double y1);
void sp_selection_scale_relative(Inkscape::Selection *selection, Geom::Point const &align, Geom::Scale const &scale);
diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp
index 657aca692..bb52b0c55 100644
--- a/src/sp-item-group.cpp
+++ b/src/sp-item-group.cpp
@@ -660,12 +660,6 @@ void SPGroup::scaleChildItemsRec(Geom::Scale const &sc, Geom::Point const &p)
Geom::Translate const s(p);
Geom::Affine final = s.inverse() * sc * s;
- Geom::Point old_center(0,0);
- if (item->isCenterSet()) {
- item->scaleCenter(sc.inverse()); // Convert the old relative center position to the new coordinates already now
- old_center = item->getCenter(); // because getCenter() will use the bbox midpoint, which is also already in the new coordinates
- }
-
gchar const *conn_type = NULL;
if (SP_IS_TEXT_TEXTPATH(item)) {
SP_TEXT(item)->optimizeTextpathText();
@@ -710,7 +704,7 @@ void SPGroup::scaleChildItemsRec(Geom::Scale const &sc, Geom::Point const &p)
}
if (item->isCenterSet() && !(final.isTranslation() || final.isIdentity())) {
- item->setCenter(old_center * final);
+ item->scaleCenter(sc); // All coordinates have been scaled, so also the center must be scaled
item->updateRepr();
}
}
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index 0cacc86b1..428f9555e 100644
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
@@ -228,18 +228,25 @@ void SPItem::setExplicitlyHidden(bool val) {
}
/**
- * Sets the transform_center_x and transform_center_y properties to retain the rotation centre
- */
+ * Sets the transform_center_x and transform_center_y properties to retain the rotation center
+*/
void SPItem::setCenter(Geom::Point const &object_centre) {
document->ensureUpToDate();
+ // Copied from DocumentProperties::onDocUnitChange()
+ gdouble viewscale_w = this->document->getWidth().value("px") / this->document->getRoot()->viewBox.width();
+ gdouble viewscale_h = this->document->getHeight().value("px")/ this->document->getRoot()->viewBox.height();
+ gdouble viewscale = std::min(viewscale_h, viewscale_w);
+
// FIXME this is seriously wrong
Geom::OptRect bbox = desktopGeometricBounds();
if (bbox) {
- transform_center_x = object_centre[Geom::X] - bbox->midpoint()[Geom::X];
+ // object centre is document coordinates (i.e. in pixels), so we need to consider the viewbox
+ // to translate to user units; transform_center_x/y is in user units
+ transform_center_x = (object_centre[Geom::X] - bbox->midpoint()[Geom::X])/viewscale;
if (Geom::are_near(transform_center_x, 0)) // rounding error
transform_center_x = 0;
- transform_center_y = object_centre[Geom::Y] - bbox->midpoint()[Geom::Y];
+ transform_center_y = (object_centre[Geom::Y] - bbox->midpoint()[Geom::Y])/viewscale;
if (Geom::are_near(transform_center_y, 0)) // rounding error
transform_center_y = 0;
}
@@ -255,16 +262,25 @@ bool SPItem::isCenterSet() const {
return (transform_center_x != 0 || transform_center_y != 0);
}
+// Get the item's transformation center in document coordinates (i.e. in pixels)
Geom::Point SPItem::getCenter() const {
document->ensureUpToDate();
+ // Copied from DocumentProperties::onDocUnitChange()
+ gdouble viewscale_w = this->document->getWidth().value("px") / this->document->getRoot()->viewBox.width();
+ gdouble viewscale_h = this->document->getHeight().value("px")/ this->document->getRoot()->viewBox.height();
+ gdouble viewscale = std::min(viewscale_h, viewscale_w);
+
// FIXME this is seriously wrong
Geom::OptRect bbox = desktopGeometricBounds();
if (bbox) {
- return bbox->midpoint() + Geom::Point (transform_center_x, transform_center_y);
+ // transform_center_x/y are stored in user units, so we have to take the viewbox into account to translate to document coordinates
+ return bbox->midpoint() + Geom::Point (transform_center_x*viewscale, transform_center_y*viewscale);
+
} else {
return Geom::Point(0, 0); // something's wrong!
}
+
}
void
diff --git a/src/sp-solid-color.cpp b/src/sp-solid-color.cpp
index 1f606d176..9f6692f98 100644
--- a/src/sp-solid-color.cpp
+++ b/src/sp-solid-color.cpp
@@ -72,7 +72,7 @@ Inkscape::XML::Node* SPSolidColor::write(Inkscape::XML::Document* xml_doc, Inksc
return repr;
}
-cairo_pattern_t* SPSolidColor::pattern_new(cairo_t * /*ct*/, Geom::OptRect const &bbox, double opacity) {
+cairo_pattern_t* SPSolidColor::pattern_new(cairo_t * /*ct*/, Geom::OptRect const & /*bbox*/, double opacity) {
SPIColor *c = &(this->style->solid_color);
cairo_pattern_t *cp = cairo_pattern_create_rgba ( c->value.color.v.c[0], c->value.color.v.c[1], c->value.color.v.c[2], SP_SCALE24_TO_FLOAT(this->style->solid_opacity.value) * opacity );
diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp
index 9141b2268..4e4616724 100644
--- a/src/ui/dialog/document-properties.cpp
+++ b/src/ui/dialog/document-properties.cpp
@@ -45,6 +45,7 @@
#include "widgets/icon.h"
#include "xml/node-event-vector.h"
#include "xml/repr.h"
+#include <algorithm> // std::min
#include "rdf.h"
#include "ui/widget/entity-entry.h"
@@ -1735,9 +1736,9 @@ void DocumentProperties::onDocUnitChange()
prefs->setBool("/options/transform/gradient", true);
{
ShapeEditor::blockSetItem(true);
- gdouble viewscale = doc->getWidth().value("px")/doc->getRoot()->viewBox.width();
- if (doc->getHeight().value("px")/doc->getRoot()->viewBox.height() < viewscale)
- viewscale = doc->getHeight().value("px")/doc->getRoot()->viewBox.height();
+ gdouble viewscale_w = doc->getWidth().value("px")/doc->getRoot()->viewBox.width();
+ gdouble viewscale_h = doc->getHeight().value("px")/doc->getRoot()->viewBox.height();
+ gdouble viewscale = std::min(viewscale_h, viewscale_w);
gdouble scale = Inkscape::Util::Quantity::convert(1, old_doc_unit, doc_unit);
doc->getRoot()->scaleChildItemsRec(Geom::Scale(scale), Geom::Point(-viewscale*doc->getRoot()->viewBox.min()[Geom::X] +
(doc->getWidth().value("px") - viewscale*doc->getRoot()->viewBox.width())/2,
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp
index f1a29e971..5d065dc60 100644
--- a/src/ui/dialog/inkscape-preferences.cpp
+++ b/src/ui/dialog/inkscape-preferences.cpp
@@ -76,7 +76,8 @@ InkscapePreferences::InkscapePreferences()
: UI::Widget::Panel ("", "/dialogs/preferences", SP_VERB_DIALOG_DISPLAY),
_max_dialog_width(0),
_max_dialog_height(0),
- _current_page(0)
+ _current_page(0),
+ _init(true)
{
//get the width of a spinbutton
Inkscape::UI::Widget::SpinButton* sb = new Inkscape::UI::Widget::SpinButton;
@@ -2000,6 +2001,7 @@ bool InkscapePreferences::PresentPage(const Gtk::TreeModel::iterator& iter)
Gtk::TreeModel::Row row = *iter;
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
int desired_page = prefs->getInt("/dialogs/preferences/page", 0);
+ _init = false;
if (desired_page == row[_page_list_columns._col_id])
{
if (desired_page >= PREFS_PAGE_TOOLS && desired_page <= PREFS_PAGE_TOOLS_CONNECTOR)
@@ -2049,7 +2051,9 @@ void InkscapePreferences::on_pagelist_selection_changed()
Gtk::TreeModel::Row row = *iter;
_current_page = row[_page_list_columns._col_page];
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- prefs->setInt("/dialogs/preferences/page", row[_page_list_columns._col_id]);
+ if (!_init) {
+ prefs->setInt("/dialogs/preferences/page", row[_page_list_columns._col_id]);
+ }
_page_title.set_markup("<span size='large'><b>" + row[_page_list_columns._col_name] + "</b></span>");
_page_frame.add(*_current_page);
_current_page->show();
diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h
index 1c2151605..9f37626ed 100644
--- a/src/ui/dialog/inkscape-preferences.h
+++ b/src/ui/dialog/inkscape-preferences.h
@@ -532,6 +532,7 @@ private:
InkscapePreferences();
InkscapePreferences(InkscapePreferences const &d);
InkscapePreferences operator=(InkscapePreferences const &d);
+ bool _init;
};
} // namespace Dialog
diff --git a/src/ui/dialog/print.cpp b/src/ui/dialog/print.cpp
index 459e64041..ed39ebb32 100644
--- a/src/ui/dialog/print.cpp
+++ b/src/ui/dialog/print.cpp
@@ -14,8 +14,15 @@
# include <config.h>
#endif
+#ifdef WIN32
+#include <io.h>
+#include <windows.h>
+#endif
+
+#include <gtkmm.h>
+
+#include "preferences.h"
#include "print.h"
-#include <gtkmm/stock.h>
#include "extension/internal/cairo-render-context.h"
#include "extension/internal/cairo-renderer.h"
@@ -29,11 +36,6 @@
#include <glibmm/i18n.h>
-#ifdef WIN32
-#include <io.h>
-#include <windows.h>
-#endif
-
static void draw_page(
#ifdef WIN32
@@ -45,14 +47,18 @@ static void draw_page(
gint /*page_nr*/,
gpointer user_data)
{
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
struct workaround_gtkmm *junk = (struct workaround_gtkmm*)user_data;
//printf("%s %d\n",__FUNCTION__, page_nr);
if (junk->_tab->as_bitmap()) {
// Render as exported PNG
+ prefs->setBool("/dialogs/printing/asbitmap", true);
gdouble width = (junk->_doc)->getWidth().value("px");
gdouble height = (junk->_doc)->getHeight().value("px");
gdouble dpi = junk->_tab->bitmap_dpi();
+ prefs->setDouble("/dialogs/printing/dpi", dpi);
+
std::string tmp_png;
std::string tmp_base = "inkscape-print-png-XXXXXX";
@@ -93,7 +99,7 @@ static void draw_page(
cairo_get_matrix(cr, &m);
cairo_scale(cr, Inkscape::Util::Quantity::convert(1, "in", "pt") / dpi, Inkscape::Util::Quantity::convert(1, "in", "pt") / dpi);
// FIXME: why is the origin offset??
- cairo_set_source_surface(cr, png->cobj(), -16.0, -16.0);
+ cairo_set_source_surface(cr, png->cobj(), 0, 0);
cairo_paint(cr);
cairo_set_matrix(cr, &m);
}
@@ -107,6 +113,7 @@ static void draw_page(
}
else {
// Render as vectors
+ prefs->setBool("/dialogs/printing/asbitmap", false);
Inkscape::Extension::Internal::CairoRenderer renderer;
Inkscape::Extension::Internal::CairoRenderContext *ctx = renderer.createContext();
diff --git a/src/ui/widget/rendering-options.cpp b/src/ui/widget/rendering-options.cpp
index d6248df69..837387f7b 100644
--- a/src/ui/widget/rendering-options.cpp
+++ b/src/ui/widget/rendering-options.cpp
@@ -12,6 +12,9 @@
# include <config.h>
#endif
+#include <gtkmm.h>
+
+#include "preferences.h"
#include "rendering-options.h"
#include "util/units.h"
#include <glibmm/i18n.h>
@@ -38,6 +41,7 @@ RenderingOptions::RenderingOptions () :
Glib::ustring(""), Glib::ustring(""),
false)
{
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
// set up tooltips
_radio_vector.set_tooltip_text(
_("Render using Cairo vector operations. "
@@ -52,15 +56,21 @@ RenderingOptions::RenderingOptions () :
set_border_width(2);
- // default to vector operations
- _radio_vector.set_active (true);
Gtk::RadioButtonGroup group = _radio_vector.get_group ();
_radio_bitmap.set_group (group);
_radio_bitmap.signal_toggled().connect(sigc::mem_fun(*this, &RenderingOptions::_toggled));
-
+
+ // default to vector operations
+ if (prefs->getBool("/dialogs/printing/asbitmap", false)) {
+ _radio_bitmap.set_active();
+ } else {
+ _radio_vector.set_active();
+ }
+
// configure default DPI
_dpi.setRange(Inkscape::Util::Quantity::convert(1, "in", "pt"),2400.0);
- _dpi.setValue(Inkscape::Util::Quantity::convert(1, "in", "pt"));
+ _dpi.setValue(prefs->getDouble("/dialogs/printing/dpi",
+ Inkscape::Util::Quantity::convert(1, "in", "pt")));
_dpi.setIncrements(1.0,10.0);
_dpi.setDigits(0);
_dpi.update();
diff --git a/src/util/units.cpp b/src/util/units.cpp
index d2053f60b..eb4a313e0 100644
--- a/src/util/units.cpp
+++ b/src/util/units.cpp
@@ -291,11 +291,15 @@ Quantity UnitTable::parseQuantity(Glib::ustring const &q) const
std::istringstream tmp_v(match_info.fetch(0));
tmp_v >> value;
}
+ int start_pos, end_pos;
+ match_info.fetch_pos(0, end_pos, start_pos);
+ end_pos = q.size() - start_pos;
+ Glib::ustring u = q.substr(start_pos, end_pos);
// Extract unit abbreviation
Glib::ustring abbr;
Glib::RefPtr<Glib::Regex> unit_regex = Glib::Regex::create("[A-z%]+");
- if (unit_regex->match(q, match_info)) {
+ if (unit_regex->match(u, match_info)) {
abbr = match_info.fetch(0);
}
diff --git a/src/widgets/font-selector.cpp b/src/widgets/font-selector.cpp
index c9a52ef11..327349844 100644
--- a/src/widgets/font-selector.cpp
+++ b/src/widgets/font-selector.cpp
@@ -157,6 +157,10 @@ static void sp_font_selector_init(SPFontSelector *fsel)
gtk_container_add(GTK_CONTAINER(f), sw);
fsel->family_treeview = gtk_tree_view_new ();
+ gtk_tree_view_set_row_separator_func( GTK_TREE_VIEW(fsel->family_treeview),
+ GtkTreeViewRowSeparatorFunc ((gpointer)font_lister_separator_func),
+ NULL, NULL );
+ gtk_widget_show_all(GTK_WIDGET (fsel->family_treeview));
GtkTreeViewColumn *column = gtk_tree_view_column_new ();
GtkCellRenderer *cell = gtk_cell_renderer_text_new ();
gtk_tree_view_column_pack_start (column, cell, FALSE);
@@ -166,9 +170,6 @@ static void sp_font_selector_init(SPFontSelector *fsel)
NULL, NULL );
gtk_tree_view_append_column (GTK_TREE_VIEW(fsel->family_treeview), column);
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(fsel->family_treeview), FALSE);
- gtk_tree_view_set_row_separator_func( GTK_TREE_VIEW(fsel->family_treeview),
- GtkTreeViewRowSeparatorFunc ((gpointer)font_lister_separator_func),
- NULL, NULL );
/* Muck with style, see text-toolbar.cpp */
gtk_widget_set_name( GTK_WIDGET(fsel->family_treeview), "font_selector_family" );