summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/dialog/document-properties.cpp8
-rw-r--r--src/ui/dialog/filter-effects-dialog.cpp7
-rw-r--r--src/ui/dialog/symbols.cpp4
-rw-r--r--src/ui/tools/dropper-tool.cpp2
-rw-r--r--src/ui/tools/freehand-base.cpp2
-rw-r--r--src/ui/tools/measure-tool.cpp2
-rw-r--r--src/ui/tools/text-tool.cpp2
-rw-r--r--src/ui/tools/zoom-tool.cpp2
-rw-r--r--src/ui/widget/page-sizer.cpp30
9 files changed, 43 insertions, 16 deletions
diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp
index d344fb1d6..0411c789c 100644
--- a/src/ui/dialog/document-properties.cpp
+++ b/src/ui/dialog/document-properties.cpp
@@ -1734,8 +1734,14 @@ 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 scale = Inkscape::Util::Quantity::convert(1, old_doc_unit, doc_unit);
- doc->getRoot()->scaleChildItemsRec(Geom::Scale(scale), Geom::Point(0, doc->getHeight().value("px")));
+ 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,
+ viewscale*doc->getRoot()->viewBox.min()[Geom::Y] +
+ (doc->getHeight().value("px") + viewscale*doc->getRoot()->viewBox.height())/2));
ShapeEditor::blockSetItem(false);
}
prefs->setBool("/options/transform/stroke", transform_stroke);
diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp
index 6a3a4c3f1..e8b09db8b 100644
--- a/src/ui/dialog/filter-effects-dialog.cpp
+++ b/src/ui/dialog/filter-effects-dialog.cpp
@@ -1515,11 +1515,16 @@ void FilterEffectsDialog::FilterModifier::on_name_edited(const Glib::ustring& pa
}
void FilterEffectsDialog::FilterModifier::on_filter_reorder(const Gtk::TreeModel::Path& /*path*/) {
+/* The code below is bugged. Use of "object->getRepr()->setPosition(0)" is dangerous!
+ Writing back the reordered list to XML (reordering XML nodes) should be implemented differently.
+ Note that the dialog does also not update its list of filters when the order is manually changed
+ using the XML dialog
for(Gtk::TreeModel::iterator i = _model->children().begin(); i != _model->children().end(); ++i) {
SPObject* object = (*i)[_columns.filter];
- if(object && object->getRepr())
+ if(object && object->getRepr()) ;
object->getRepr()->setPosition(0);
}
+*/
}
void FilterEffectsDialog::FilterModifier::on_selection_toggled(const Glib::ustring& path)
diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp
index 98754fb4f..62a2f8572 100644
--- a/src/ui/dialog/symbols.cpp
+++ b/src/ui/dialog/symbols.cpp
@@ -381,8 +381,10 @@ void SymbolsDialog::selectionChanged(Inkscape::Selection *selection) {
}
}
-void SymbolsDialog::documentReplaced(SPDesktop */*desktop*/, SPDocument */*document*/)
+void SymbolsDialog::documentReplaced(SPDesktop *desktop, SPDocument *document)
{
+ currentDesktop = desktop;
+ currentDocument = document;
rebuild();
}
diff --git a/src/ui/tools/dropper-tool.cpp b/src/ui/tools/dropper-tool.cpp
index 9c47b50e9..88ed342df 100644
--- a/src/ui/tools/dropper-tool.cpp
+++ b/src/ui/tools/dropper-tool.cpp
@@ -152,6 +152,8 @@ void DropperTool::finish() {
#endif
cursor_dropper_fill = NULL;
}
+
+ ToolBase::finish();
}
/**
diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp
index c3c269743..1e0e6b3b6 100644
--- a/src/ui/tools/freehand-base.cpp
+++ b/src/ui/tools/freehand-base.cpp
@@ -167,6 +167,8 @@ void FreehandBase::finish() {
}
spdc_free_colors(this);
+
+ ToolBase::finish();
}
void FreehandBase::set(const Inkscape::Preferences::Entry& /*value*/) {
diff --git a/src/ui/tools/measure-tool.cpp b/src/ui/tools/measure-tool.cpp
index 0d823dfda..4d7f1e074 100644
--- a/src/ui/tools/measure-tool.cpp
+++ b/src/ui/tools/measure-tool.cpp
@@ -254,6 +254,8 @@ void MeasureTool::finish() {
sp_canvas_item_ungrab(this->grabbed, GDK_CURRENT_TIME);
this->grabbed = NULL;
}
+
+ ToolBase::finish();
}
//void MeasureTool::setup() {
diff --git a/src/ui/tools/text-tool.cpp b/src/ui/tools/text-tool.cpp
index 9b5ab1016..ba68c7829 100644
--- a/src/ui/tools/text-tool.cpp
+++ b/src/ui/tools/text-tool.cpp
@@ -266,6 +266,8 @@ void TextTool::finish() {
}
this->text_selection_quads.clear();
+
+ ToolBase::finish();
}
bool TextTool::item_handler(SPItem* item, GdkEvent* event) {
diff --git a/src/ui/tools/zoom-tool.cpp b/src/ui/tools/zoom-tool.cpp
index d4ede1053..0996e6cf4 100644
--- a/src/ui/tools/zoom-tool.cpp
+++ b/src/ui/tools/zoom-tool.cpp
@@ -63,6 +63,8 @@ void ZoomTool::finish() {
sp_canvas_item_ungrab(this->grabbed, GDK_CURRENT_TIME);
this->grabbed = NULL;
}
+
+ ToolBase::finish();
}
void ZoomTool::setup() {
diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp
index b13567adb..eae0d4a95 100644
--- a/src/ui/widget/page-sizer.cpp
+++ b/src/ui/widget/page-sizer.cpp
@@ -547,36 +547,40 @@ PageSizer::updateFitMarginsUI(Inkscape::XML::Node *nv_repr)
/**
* Returns an iterator pointing to a row in paperSizeListStore which
- * contains a paper of the specified size (specified in px), or
+ * contains a paper of the specified size, or
* paperSizeListStore->children().end() if no such paper exists.
+ *
+ * The code is not tested for the case where w and h have different units.
*/
Gtk::ListStore::iterator
PageSizer::find_paper_size (Inkscape::Util::Quantity w, Inkscape::Util::Quantity h) const
{
- double smaller = w.quantity;
- double larger = h.quantity;
+ using Inkscape::Util::Quantity;
+ using std::swap;
+
+ // The code below assumes that w < h, so make sure that's the case:
if ( h < w ) {
- smaller = h.quantity; larger = w.quantity;
+ swap(h,w);
}
- g_return_val_if_fail(smaller <= larger, _paperSizeListStore->children().end());
+ g_return_val_if_fail(w <= h, _paperSizeListStore->children().end());
std::map<Glib::ustring, PaperSize>::const_iterator iter;
for (iter = _paperSizeTable.begin() ;
iter != _paperSizeTable.end() ; ++iter) {
PaperSize paper = iter->second;
- double smallX = Inkscape::Util::Quantity::convert(paper.smaller, paper.unit, w.unit);
- double largeX = Inkscape::Util::Quantity::convert(paper.larger, paper.unit, w.unit);
+ Quantity smallX (paper.smaller, paper.unit);
+ Quantity largeX (paper.larger, paper.unit);
- g_return_val_if_fail(smallX <= largeX, _paperSizeListStore->children().end());
+ g_return_val_if_fail(smallX.quantity < largeX.quantity + 0.001, _paperSizeListStore->children().end());
- if ((std::abs(smaller - smallX) <= 0.1) &&
- (std::abs(larger - largeX) <= 0.1) ) {
- Gtk::ListStore::iterator p;
+ if ( are_near(w, smallX, 0.1) && are_near(h, largeX, 0.1) ) {
+ Gtk::ListStore::iterator p = _paperSizeListStore->children().begin();
+ Gtk::ListStore::iterator pend = _paperSizeListStore->children().end();
// We need to search paperSizeListStore explicitly for the
// specified paper size because it is sorted in a different
// way than paperSizeTable (which is sorted alphabetically)
- for (p = _paperSizeListStore->children().begin(); p != _paperSizeListStore->children().end(); ++p) {
+ for ( ; p != pend; ++p) {
if ((*p)[_paperSizeListColumns.nameColumn] == paper.name) {
return p;
}
@@ -601,7 +605,7 @@ PageSizer::fire_fit_canvas_to_selection_or_drawing()
SPDocument *doc;
SPNamedView *nv;
Inkscape::XML::Node *nv_repr;
-
+
if ((doc = sp_desktop_document(SP_ACTIVE_DESKTOP))
&& (nv = sp_document_namedview(doc, 0))
&& (nv_repr = nv->getRepr())) {