summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a72861c)
raw | patch | inline | side by side (parent: a72861c)
author | rwst <rwst@users.sourceforge.net> | |
Thu, 22 Jun 2006 08:43:28 +0000 (08:43 +0000) | ||
committer | rwst <rwst@users.sourceforge.net> | |
Thu, 22 Jun 2006 08:43:28 +0000 (08:43 +0000) |
src/ui/widget/page-sizer.cpp | patch | blob | history |
index 6ccd10f87f7299c8ffc5ca5e94c8f293656aba0d..b6b8503c48a99b81b915780e3cb4d7955795c034 100644 (file)
sp_convert_distance (&w, &src_unit, &_px_unit);
sp_convert_distance (&h, &src_unit, &_px_unit);
if (_parent->_landscape)
- _parent->setDim (h, w, true);
+ _parent->setDim (h, w);
else
- _parent->setDim (w, h, true);
+ _parent->setDim (w, h);
}
//---------------------------------------------------
show_all_children();
}
+
/**
+ * Set document dimensions (if not called by Doc prop's update()) and
+ * set the PageSizer's widgets and text entries accordingly. This is
+ * somewhat slow, is there something done too often invisibly?
+ *
* \param w, h given in px
*/
-void
-PageSizer::setDim (double w, double h, bool update)
+void
+PageSizer::setDim (double w, double h)
{
+ static bool _called = false;
+ if (_called) return;
+
+ _called = true;
+
+ _landscape_connection.block();
+ _portrait_connection.block();
+ _changedw_connection.block();
+ _changedh_connection.block();
+
+ if (SP_ACTIVE_DESKTOP && !_wr->isUpdating()) {
+ SPDocument *doc = sp_desktop_document(SP_ACTIVE_DESKTOP);
+ sp_document_set_width (doc, w, &_px_unit);
+ sp_document_set_height (doc, h, &_px_unit);
+ sp_document_done (doc);
+ }
+
_landscape = w>h;
_rb_land->set_active (_landscape ? true : false);
_rb_port->set_active (_landscape ? false : true);
+
_omenu_size->set_history (1 + find_paper_size (w, h));
Unit const& unit = _rum._sel->getUnit();
- if (!update) _changedw_connection.block();
_rusw.setValue (w / unit.factor);
- if (!update) _changedw_connection.unblock();
- if (!update) _changedh_connection.block();
_rush.setValue (h / unit.factor);
- if (!update) _changedh_connection.unblock();
-}
-void
-PageSizer::setDoc (double w, double h)
-{
- if (SP_ACTIVE_DESKTOP && !_wr->isUpdating()) {
- SPDocument *doc = sp_desktop_document(SP_ACTIVE_DESKTOP);
- sp_document_set_width (doc, w, &_px_unit);
- sp_document_set_height (doc, h, &_px_unit);
- sp_document_done (doc);
- } else {
- setDim (w, h);
- }
+ _landscape_connection.unblock();
+ _portrait_connection.unblock();
+ _changedw_connection.unblock();
+ _changedh_connection.unblock();
+
+ _called = false;
}
/**
return;
double w = _rusw.getSU()->getValue ("px");
double h = _rush.getSU()->getValue ("px");
- if (h<w) setDoc (h, w);
+ if (h<w) setDim (h, w);
}
void
return;
double w = _rusw.getSU()->getValue ("px");
double h = _rush.getSU()->getValue ("px");
- if (w<h) setDoc (h, w);
+ if (w<h) setDim (h, w);
}
void
{
if (_wr->isUpdating()) return;
- setDoc (_rusw.getSU()->getValue("px"), _rush.getSU()->getValue("px"));
+ setDim (_rusw.getSU()->getValue("px"), _rush.getSU()->getValue("px"));
}
} // namespace Widget