summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2015-04-09 18:54:52 +0000
committerJabiertxof <jtx@jtx.marker.es>2015-04-09 18:54:52 +0000
commit42569eeea6a78406c723a0c2139a6adbb5f9c9cc (patch)
tree480aff49241ce0c5b30837bf8bd6137e0a9f2789 /src/ui
parentupdate to trunk (diff)
parentCleaned up cmake files to build successfully on Linux. (diff)
downloadinkscape-42569eeea6a78406c723a0c2139a6adbb5f9c9cc.tar.gz
inkscape-42569eeea6a78406c723a0c2139a6adbb5f9c9cc.zip
update to trunk
(bzr r12588.1.40)
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/CMakeLists.txt29
-rw-r--r--src/ui/dialog/filter-effects-dialog.cpp2
-rw-r--r--src/ui/tool/curve-drag-point.cpp4
-rw-r--r--src/ui/tool/multi-path-manipulator.h2
-rw-r--r--src/ui/tool/node.cpp15
-rw-r--r--src/ui/tool/path-manipulator.cpp44
-rw-r--r--src/ui/tool/path-manipulator.h2
-rw-r--r--src/ui/tools/box3d-tool.h2
-rw-r--r--src/ui/tools/connector-tool.cpp2
-rw-r--r--src/ui/tools/dynamic-base.h2
-rw-r--r--src/ui/tools/gradient-tool.cpp2
-rw-r--r--src/ui/tools/node-tool.cpp2
-rw-r--r--src/ui/tools/pen-tool.cpp4
-rw-r--r--src/ui/tools/spray-tool.cpp2
-rw-r--r--src/ui/widget/page-sizer.cpp169
-rw-r--r--src/ui/widget/page-sizer.h21
16 files changed, 234 insertions, 70 deletions
diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt
index 674254686..991d11feb 100644
--- a/src/ui/CMakeLists.txt
+++ b/src/ui/CMakeLists.txt
@@ -1,11 +1,10 @@
-
set(ui_SRC
clipboard.cpp
control-manager.cpp
dialog-events.cpp
draw-anchor.cpp
- interface.cpp
- object-edit.cpp
+ interface.cpp
+ object-edit.cpp
previewholder.cpp
shape-editor.cpp
tool-factory.cpp
@@ -56,8 +55,8 @@ set(ui_SRC
dialog/aboutbox.cpp
dialog/align-and-distribute.cpp
dialog/calligraphic-profile-rename.cpp
- dialog/color-item.cpp
dialog/clonetiler.cpp
+ dialog/color-item.cpp
dialog/debug.cpp
dialog/desktop-tracker.cpp
dialog/dialog-manager.cpp
@@ -86,31 +85,36 @@ set(ui_SRC
dialog/livepatheffect-add.cpp
dialog/livepatheffect-editor.cpp
dialog/lpe-fillet-chamfer-properties.cpp
+ dialog/lpe-powerstroke-properties.cpp
dialog/memory.cpp
dialog/messages.cpp
dialog/new-from-template.cpp
dialog/object-attributes.cpp
dialog/object-properties.cpp
+ dialog/objects.cpp
dialog/ocaldialogs.cpp
+ dialog/pixelartdialog.cpp
dialog/polar-arrange-tab.cpp
dialog/print-colors-preview-dialog.cpp
dialog/print.cpp
- dialog/symbols.cpp
- dialog/xml-tree.cpp
dialog/spellcheck.cpp
dialog/svg-fonts-dialog.cpp
dialog/swatches.cpp
+ dialog/symbols.cpp
+ dialog/tags.cpp
dialog/template-load-tab.cpp
dialog/template-widget.cpp
dialog/text-edit.cpp
dialog/tile.cpp
dialog/tracedialog.cpp
- dialog/pixelartdialog.cpp
dialog/transformation.cpp
dialog/undo-history.cpp
+ dialog/xml-tree.cpp
+ widget/addtoicon.cpp
widget/anchor-selector.cpp
widget/button.cpp
+ widget/clipmaskicon.cpp
widget/color-picker.cpp
widget/color-preview.cpp
widget/dock-item.cpp
@@ -121,10 +125,13 @@ set(ui_SRC
widget/frame.cpp
widget/gimpcolorwheel.c
widget/gimpspinscale.c
+ widget/highlight-picker.cpp
widget/imageicon.cpp
widget/imagetoggler.cpp
+ widget/insertordericon.cpp
widget/labelled.cpp
widget/layer-selector.cpp
+ widget/layertypeicon.cpp
widget/licensor.cpp
widget/notebook-page.cpp
widget/object-composite-settings.cpp
@@ -179,8 +186,8 @@ set(ui_SRC
dialog/arrange-tab.h
dialog/behavior.h
dialog/calligraphic-profile-rename.h
- dialog/color-item.h
dialog/clonetiler.h
+ dialog/color-item.h
dialog/debug.h
dialog/desktop-tracker.h
dialog/dialog-manager.h
@@ -200,8 +207,8 @@ set(ui_SRC
dialog/floating-behavior.h
dialog/font-substitution.h
dialog/glyphs.h
- dialog/guides.h
dialog/grid-arrange-tab.h
+ dialog/guides.h
dialog/icon-preview.h
dialog/inkscape-preferences.h
dialog/input.h
@@ -215,13 +222,13 @@ set(ui_SRC
dialog/new-from-template.h
dialog/object-attributes.h
dialog/object-properties.h
+ dialog/objects.h
dialog/ocaldialogs.h
dialog/panel-dialog.h
- dialog/polar-arrange-tab.h
dialog/pixelartdialog.h
+ dialog/polar-arrange-tab.h
dialog/print-colors-preview-dialog.h
dialog/print.h
-
dialog/spellcheck.h
dialog/svg-fonts-dialog.h
dialog/swatches.h
diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp
index 3da0e0043..077c6f5ca 100644
--- a/src/ui/dialog/filter-effects-dialog.cpp
+++ b/src/ui/dialog/filter-effects-dialog.cpp
@@ -211,7 +211,7 @@ private:
ComboBoxEnum<T>* combo;
};
-// Contains an arbitrary number of spin buttons that use seperate attributes
+// Contains an arbitrary number of spin buttons that use separate attributes
class MultiSpinButton : public Gtk::HBox
{
public:
diff --git a/src/ui/tool/curve-drag-point.cpp b/src/ui/tool/curve-drag-point.cpp
index 49c949107..a90dfb155 100644
--- a/src/ui/tool/curve-drag-point.cpp
+++ b/src/ui/tool/curve-drag-point.cpp
@@ -54,7 +54,7 @@ bool CurveDragPoint::grabbed(GdkEventMotion */*event*/)
// delta is a vector equal 1/3 of distance from first to second
Geom::Point delta = (second->position() - first->position()) / 3.0;
// only update the nodes if the mode is bspline
- if(!_pm.isBSpline(false)){
+ if(!_pm.isBSpline()){
first->front()->move(first->front()->position() + delta);
second->back()->move(second->back()->position() - delta);
}
@@ -91,7 +91,7 @@ void CurveDragPoint::dragged(Geom::Point &new_pos, GdkEventMotion *event)
Geom::Point offset1 = (weight/(3*t*t*(1-t))) * delta;
//modified so that, if the trace is bspline, it only acts if the SHIFT key is pressed
- if(!_pm.isBSpline(false)){
+ if(!_pm.isBSpline()){
first->front()->move(first->front()->position() + offset0);
second->back()->move(second->back()->position() + offset1);
}else if(weight>=0.8){
diff --git a/src/ui/tool/multi-path-manipulator.h b/src/ui/tool/multi-path-manipulator.h
index cdbf34e9d..1bbcdd7ec 100644
--- a/src/ui/tool/multi-path-manipulator.h
+++ b/src/ui/tool/multi-path-manipulator.h
@@ -39,7 +39,7 @@ public:
virtual bool event(Inkscape::UI::Tools::ToolBase *, GdkEvent *event);
bool empty() { return _mmap.empty(); }
- unsigned size() { return _mmap.empty(); }
+ unsigned size() { return _mmap.size(); }
void setItems(std::set<ShapeRecord> const &);
void clear() { _mmap.clear(); }
void cleanup();
diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp
index eeea47e4d..08cc6708d 100644
--- a/src/ui/tool/node.cpp
+++ b/src/ui/tool/node.cpp
@@ -192,7 +192,7 @@ void Handle::move(Geom::Point const &new_pos)
setRelativePos(new_delta);
//move the handler and its oposite the same proportion
- if(_pm().isBSpline()){
+ if(_pm().isBSpline()){
setPosition(_pm().BSplineHandleReposition(this,this));
this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),this));
}
@@ -222,7 +222,6 @@ void Handle::move(Geom::Point const &new_pos)
setPosition(_pm().BSplineHandleReposition(this,this));
this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),this));
}
-
}
void Handle::setPosition(Geom::Point const &p)
@@ -382,7 +381,7 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event)
std::vector<Inkscape::SnapCandidatePoint> unselected;
//if the snap adjustment is activated and it is not bspline
- if (snap && !_pm().isBSpline(false)) {
+ if (snap && !_pm().isBSpline()) {
ControlPointSelection::Set &nodes = _parent->_selection.allPoints();
for (ControlPointSelection::Set::iterator i = nodes.begin(); i != nodes.end(); ++i) {
Node *n = static_cast<Node*>(*i);
@@ -486,7 +485,7 @@ Glib::ustring Handle::_getTip(unsigned state) const
char const *more;
// a trick to mark as bspline if the node has no strength, we are going to use it later
// to show the appropiate messages. We cannot do it in any different way becasue the function is constant
-
+ Handle *h = const_cast<Handle *>(this);
bool isBSpline = _pm().isBSpline();
bool can_shift_rotate = _parent->type() == NODE_CUSP && !other()->isDegenerate();
if (can_shift_rotate && !isBSpline) {
@@ -550,7 +549,7 @@ Glib::ustring Handle::_getTip(unsigned state) const
"<b>Auto node handle</b>: drag to convert to smooth node (%s)"), more);
}else{
return format_tip(C_("Path handle tip",
- "<b>BSpline node handle</b>: Shift to drag, double click to reset (%s)"), more);
+ "<b>BSpline node handle</b>: Shift to drag, double click to reset (%s). %g power"),more,_pm().BSplineHandlePosition(h,NULL));
}
}
}
@@ -1435,6 +1434,8 @@ Node *Node::nodeAwayFrom(Handle *h)
Glib::ustring Node::_getTip(unsigned state) const
{
bool isBSpline = _pm().isBSpline();
+ Handle *h = const_cast<Handle *>(&_front);
+ Handle *h2 = const_cast<Handle *>(&_back);
if (state_held_shift(state)) {
bool can_drag_out = (_next() && _front.isDegenerate()) || (_prev() && _back.isDegenerate());
if (can_drag_out) {
@@ -1469,7 +1470,7 @@ Glib::ustring Node::_getTip(unsigned state) const
"<b>%s</b>: drag to shape the path (more: Shift, Ctrl, Alt)"), nodetype);
}else if(_selection.size() == 1){
return format_tip(C_("Path node tip",
- "<b>BSpline node</b>: %g weight, drag to shape the path (more: Shift, Ctrl, Alt)"),noPower/*this->bsplineWeight*/);
+ "<b>BSpline node</b>: drag to shape the path (more: Shift, Ctrl, Alt). %g power"),_pm().BSplineHandlePosition(h,h2));
}
return format_tip(C_("Path node tip",
"<b>%s</b>: drag to shape the path, click to toggle scale/rotation handles (more: Shift, Ctrl, Alt)"), nodetype);
@@ -1479,7 +1480,7 @@ Glib::ustring Node::_getTip(unsigned state) const
"<b>%s</b>: drag to shape the path, click to select only this node (more: Shift, Ctrl, Alt)"), nodetype);
}else{
return format_tip(C_("Path node tip",
- "<b>BSpline node</b>: drag to shape the path, click to select only this node (more: Shift, Ctrl, Alt)"));
+ "<b>BSpline node</b>: drag to shape the path, click to select only this node (more: Shift, Ctrl, Alt). %g power"),_pm().BSplineHandlePosition(h,h2));
}
}
diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp
index c8b986824..dbae69f2c 100644
--- a/src/ui/tool/path-manipulator.cpp
+++ b/src/ui/tool/path-manipulator.cpp
@@ -11,6 +11,7 @@
*/
#include "live_effects/lpe-powerstroke.h"
+#include "live_effects/lpe-bspline.h"
#include "live_effects/lpe-fillet-chamfer.h"
#include <string>
#include <sstream>
@@ -43,7 +44,6 @@
#include "ui/tool/multi-path-manipulator.h"
#include "xml/node.h"
#include "xml/node-observer.h"
-#include "live_effects/lpe-bspline.h"
namespace Inkscape {
namespace UI {
@@ -124,6 +124,7 @@ PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path,
, _show_path_direction(false)
, _live_outline(true)
, _live_objects(true)
+ , _is_bspline(false)
, _lpe_key(lpe_key)
{
if (_lpe_key.empty()) {
@@ -151,7 +152,7 @@ PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path,
_createControlPointsFromGeometry();
//Define if the path is BSpline on construction
- isBSpline(true);
+ recalculateIsBSpline();
}
PathManipulator::~PathManipulator()
@@ -1221,10 +1222,13 @@ int PathManipulator::BSplineGetSteps() const {
LivePathEffect::LPEBSpline const *lpe_bsp = NULL;
- if (SP_IS_LPE_ITEM(_path) && _path->hasPathEffect()){
- Inkscape::LivePathEffect::Effect const *thisEffect = SP_LPE_ITEM(_path)->getPathEffectOfType(Inkscape::LivePathEffect::BSPLINE);
- if(thisEffect){
- lpe_bsp = dynamic_cast<LivePathEffect::LPEBSpline const*>(thisEffect->getLPEObj()->get_lpe());
+ SPLPEItem * path = dynamic_cast<SPLPEItem *>(_path);
+ if (path){
+ if(path->hasPathEffect()){
+ Inkscape::LivePathEffect::Effect const *thisEffect = path->getPathEffectOfType(Inkscape::LivePathEffect::BSPLINE);
+ if(thisEffect){
+ lpe_bsp = dynamic_cast<LivePathEffect::LPEBSpline const*>(thisEffect->getLPEObj()->get_lpe());
+ }
}
}
int steps = 0;
@@ -1235,19 +1239,24 @@ int PathManipulator::BSplineGetSteps() const {
}
// determines if the trace has bspline effect
-bool PathManipulator::isBSpline(bool recalculate){
- if(recalculate){
- _is_bspline = this->BSplineGetSteps() > 0;
+void PathManipulator::recalculateIsBSpline(){
+ if (SP_IS_LPE_ITEM(_path) && _path->hasPathEffect()) {
+ Inkscape::LivePathEffect::Effect const *thisEffect = _path->getPathEffectOfType(Inkscape::LivePathEffect::BSPLINE);
+ if(thisEffect){
+ _is_bspline = true;
+ return;
+ }
}
- return _is_bspline;
+ _is_bspline = false;
}
bool PathManipulator::isBSpline() const {
- return BSplineGetSteps() > 0;
+ return _is_bspline;
}
// returns the corresponding strength to the position of the handlers
-double PathManipulator::BSplineHandlePosition(Handle *h, Handle *h2){
+double PathManipulator::BSplineHandlePosition(Handle *h, Handle *h2)
+{
using Geom::X;
using Geom::Y;
if(h2){
@@ -1272,7 +1281,8 @@ double PathManipulator::BSplineHandlePosition(Handle *h, Handle *h2){
}
// give the location for the handler in the corresponding position
-Geom::Point PathManipulator::BSplineHandleReposition(Handle *h, Handle *h2){
+Geom::Point PathManipulator::BSplineHandleReposition(Handle *h, Handle *h2)
+{
double pos = this->BSplineHandlePosition(h, h2);
return BSplineHandleReposition(h,pos);
}
@@ -1309,7 +1319,7 @@ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE)
{
Geom::PathBuilder builder;
//Refresh if is bspline some times -think on path change selection, this value get lost
- isBSpline(true);
+ recalculateIsBSpline();
for (std::list<SubpathPtr>::iterator spi = _subpaths.begin(); spi != _subpaths.end(); ) {
SubpathPtr subpath = *spi;
if (subpath->empty()) {
@@ -1338,15 +1348,15 @@ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE)
_spcurve->set_pathvector(pathv);
if (alert_LPE) {
/// \todo note that _path can be an Inkscape::LivePathEffect::Effect* too, kind of confusing, rework member naming?
- if (SP_IS_LPE_ITEM(_path) && _path->hasPathEffect()){
- Inkscape::LivePathEffect::Effect* thisEffect = SP_LPE_ITEM(_path)->getPathEffectOfType(Inkscape::LivePathEffect::POWERSTROKE);
+ if (SP_IS_LPE_ITEM(_path) && _path->hasPathEffect()) {
+ Inkscape::LivePathEffect::Effect* thisEffect = _path->getPathEffectOfType(Inkscape::LivePathEffect::POWERSTROKE);
if(thisEffect){
LivePathEffect::LPEPowerStroke *lpe_pwr = dynamic_cast<LivePathEffect::LPEPowerStroke*>(thisEffect->getLPEObj()->get_lpe());
if (lpe_pwr) {
lpe_pwr->adjustForNewPath(pathv);
}
}
- thisEffect = SP_LPE_ITEM(_path)->getPathEffectOfType(Inkscape::LivePathEffect::FILLET_CHAMFER);
+ thisEffect = _path->getPathEffectOfType(Inkscape::LivePathEffect::FILLET_CHAMFER);
if(thisEffect){
LivePathEffect::LPEFilletChamfer *lpe_fll = dynamic_cast<LivePathEffect::LPEFilletChamfer*>(thisEffect->getLPEObj()->get_lpe());
if (lpe_fll) {
diff --git a/src/ui/tool/path-manipulator.h b/src/ui/tool/path-manipulator.h
index 4d2bf4300..6dc1c9d09 100644
--- a/src/ui/tool/path-manipulator.h
+++ b/src/ui/tool/path-manipulator.h
@@ -107,7 +107,7 @@ private:
void _createControlPointsFromGeometry();
- bool isBSpline(bool recalculate = false);
+ void recalculateIsBSpline();
bool isBSpline() const;
double BSplineHandlePosition(Handle *h, Handle *h2 = NULL);
Geom::Point BSplineHandleReposition(Handle *h, Handle *h2 = NULL);
diff --git a/src/ui/tools/box3d-tool.h b/src/ui/tools/box3d-tool.h
index 1dd6bb5f8..33ae6d8e7 100644
--- a/src/ui/tools/box3d-tool.h
+++ b/src/ui/tools/box3d-tool.h
@@ -80,7 +80,7 @@ private:
Proj::Pt3 drag_ptC_proj;
bool ctrl_dragged; /* whether we are ctrl-dragging */
- bool extruded; /* whether shift-dragging already occured (i.e. the box is already extruded) */
+ bool extruded; /* whether shift-dragging already occurred (i.e. the box is already extruded) */
sigc::connection sel_changed_connection;
diff --git a/src/ui/tools/connector-tool.cpp b/src/ui/tools/connector-tool.cpp
index d76b0d142..c3ef19507 100644
--- a/src/ui/tools/connector-tool.cpp
+++ b/src/ui/tools/connector-tool.cpp
@@ -49,7 +49,7 @@
* Much of the way connectors work for user-defined points has been
* changed so that it no longer defines special attributes to record
* the points. Instead it uses single node paths to define points
- * who are then seperate objects that can be fixed on the canvas,
+ * who are then separate objects that can be fixed on the canvas,
* grouped into objects and take full advantage of all transform, snap
* and align functionality of all other objects.
*
diff --git a/src/ui/tools/dynamic-base.h b/src/ui/tools/dynamic-base.h
index c948fa286..095af8f88 100644
--- a/src/ui/tools/dynamic-base.h
+++ b/src/ui/tools/dynamic-base.h
@@ -47,7 +47,7 @@ protected:
/** accumulated shape which ultimately goes in svg:path */
SPCurve *accumulated;
- /** canvas items for "comitted" segments */
+ /** canvas items for "committed" segments */
GSList *segments;
/** canvas item for red "leading" segment */
diff --git a/src/ui/tools/gradient-tool.cpp b/src/ui/tools/gradient-tool.cpp
index 5be84eb76..b27859ebb 100644
--- a/src/ui/tools/gradient-tool.cpp
+++ b/src/ui/tools/gradient-tool.cpp
@@ -321,7 +321,7 @@ sp_gradient_context_add_stops_between_selected_stops (GradientTool *rc)
if (d->point_type == POINT_RG_FOCUS) {
/*
* There are 2 draggables at the center (start) of a radial gradient
- * To avoid creating 2 seperate stops, ignore this draggable point type
+ * To avoid creating 2 separate stops, ignore this draggable point type
*/
continue;
}
diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp
index f8045a029..a4b903960 100644
--- a/src/ui/tools/node-tool.cpp
+++ b/src/ui/tools/node-tool.cpp
@@ -75,7 +75,7 @@
* - ControlPointSelection: keeps track of node selection and a set of nodes that can potentially
* be selected. There can be more than one selection. Performs actions that require no
* knowledge about the path, only about the nodes, like dragging and transforms. It is not
- * specific to nodes and can accomodate any control point derived from SelectableControlPoint.
+ * specific to nodes and can accommodate any control point derived from SelectableControlPoint.
* Transforms nodes in response to transform handle events.
* - TransformHandleSet: displays nodeset transform handles and emits transform events. The aim
* is to eventually use a common class for object and control point transforms.
diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp
index d28b7c27a..d5f501163 100644
--- a/src/ui/tools/pen-tool.cpp
+++ b/src/ui/tools/pen-tool.cpp
@@ -2143,7 +2143,7 @@ bool PenTool::_undoLastPoint() {
this->p[1] = this->p[0];
}
- // asign the value in a third of the distance of the last segment.
+ // assign the value in a third of the distance of the last segment.
if (this->bspline){
this->p[1] = this->p[0] + (1./3)*(this->p[3] - this->p[0]);
}
@@ -2165,7 +2165,7 @@ bool PenTool::_undoLastPoint() {
this->green_curve->backspace();
}
- // assign the value of this->p[1] to the oposite of the green line last segment
+ // assign the value of this->p[1] to the opposite of the green line last segment
if (this->spiro){
Geom::CubicBezier const *cubic = dynamic_cast<Geom::CubicBezier const *>(this->green_curve->last_segment());
if ( cubic ) {
diff --git a/src/ui/tools/spray-tool.cpp b/src/ui/tools/spray-tool.cpp
index ec7d10e13..0399b1e55 100644
--- a/src/ui/tools/spray-tool.cpp
+++ b/src/ui/tools/spray-tool.cpp
@@ -406,7 +406,7 @@ static bool sp_spray_recursive(SPDesktop *desktop,
parent->appendChild(copy);
SPObject *new_obj = doc->getObjectByRepr(copy);
- item_copied = dynamic_cast<SPItem *>(new_obj); // Convertion object->item
+ item_copied = dynamic_cast<SPItem *>(new_obj); // Conversion object->item
Geom::Point center=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));
diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp
index 8e647ebb4..0a5697661 100644
--- a/src/ui/widget/page-sizer.cpp
+++ b/src/ui/widget/page-sizer.cpp
@@ -242,7 +242,13 @@ PageSizer::PageSizer(Registry & _wr)
_marginBottom( _("Botto_m:"), _("Bottom margin"), "fit-margin-bottom", _wr),
_lockMarginUpdate(false),
_scaleX(_("Scale _x:"), _("Scale X"), "scale-x", _wr),
+ _scaleY(_("Scale _y:"), _("Scale Y"), "scale-y", _wr),
_lockScaleUpdate(false),
+ _viewboxX(_("X:"), _("X"), "viewbox-x", _wr),
+ _viewboxY(_("Y:"), _("Y"), "viewbox-y", _wr),
+ _viewboxW(_("Width:"), _("Width"), "viewbox-width", _wr),
+ _viewboxH(_("Height:"), _("Height"), "viewbox-height", _wr),
+ _lockViewboxUpdate(false),
_widgetRegistry(&_wr)
{
// set precision of scalar entry boxes
@@ -254,7 +260,21 @@ PageSizer::PageSizer(Registry & _wr)
_marginRight.setDigits(5);
_marginBottom.setDigits(5);
_scaleX.setDigits(5);
+ _scaleY.setDigits(5);
+ _viewboxX.setDigits(2);
+ _viewboxY.setDigits(2);
+ _viewboxW.setDigits(2);
+ _viewboxH.setDigits(2);
+
_scaleX.setRange( 0.00001, 100000 );
+ _scaleY.setRange( 0.00001, 100000 );
+ _viewboxX.setRange( -100000, 100000 );
+ _viewboxY.setRange( -100000, 100000 );
+ _viewboxW.setRange( 0, 200000 );
+ _viewboxH.setRange( 0, 200000 );
+
+ _scaleY.set_sensitive (false); // We only want to display Y scale.
+
_wr.setUpdating (false);
//# Set up the Paper Size combo box
@@ -435,21 +455,62 @@ PageSizer::PageSizer(Registry & _wr)
_scaleTable.set_row_spacing(4);
_scaleTable.set_column_spacing(4);
- _dimensionWidth.set_hexpand();
- _dimensionWidth.set_vexpand();
_scaleTable.attach(_scaleX, 0, 0, 1, 1);
+ _scaleTable.attach(_scaleY, 1, 0, 1, 1);
- _dimensionUnits.set_hexpand();
- _dimensionUnits.set_vexpand();
- _scaleTable.attach(_scaleLabel, 1, 0, 1, 1);
+ _scaleTable.attach(_scaleLabel, 2, 0, 1, 1);
+ _scaleTable.attach(_scaleWarning, 0, 1, 2, 1);
+ _viewboxExpander.set_hexpand();
+ _viewboxExpander.set_vexpand();
+ _scaleTable.attach(_viewboxExpander, 0, 2, 2, 1);
#else
- _scaleTable.resize(2, 1);
+ _scaleTable.resize(3, 2);
_scaleTable.set_row_spacings(4);
_scaleTable.set_col_spacings(4);
_scaleTable.attach(_scaleX, 0,1, 0,1);
- _scaleTable.attach(_scaleLabel, 1,2, 0,1);
+ _scaleTable.attach(_scaleY, 1,2, 0,1);
+ _scaleTable.attach(_scaleLabel, 2,3, 0,1);
+ _scaleTable.attach(_scaleWarning, 0,3, 1,2, Gtk::FILL);
+ _scaleTable.attach(_viewboxExpander, 0,3, 2,3);
#endif
+ _scaleWarning.set_label(_("While SVG allows non-uniform scaling it is recommended to use only uniform scaling in Inkscape. To set a non-uniform scaling, set the 'viewBox' directly."));
+ _scaleWarning.set_line_wrap( true );
+
+ _viewboxExpander.set_use_underline();
+ _viewboxExpander.set_label(_("_Viewbox..."));
+ _viewboxExpander.add(_viewboxTable);
+
+#if WITH_GTKMM_3_0
+ _viewboxTable.set_row_spacing(2);
+ _viewboxTable.set_column_spacing(2);
+
+ _viewboxX.set_hexpand();
+ _viewboxX.set_vexpand();
+ _viewboxTable.attach(_viewboxX, 0, 0, 1, 1);
+
+ _viewboxY.set_hexpand();
+ _viewboxY.set_vexpand();
+ _viewboxTable.attach(_viewboxY, 1, 0, 1, 1);
+
+ _viewboxW.set_hexpand();
+ _viewboxW.set_vexpand();
+ _viewboxTable.attach(_viewboxW, 0, 1, 1, 1);
+
+ _viewboxH.set_hexpand();
+ _viewboxH.set_vexpand();
+ _viewboxTable.attach(_viewboxH, 1, 1, 1, 1);
+
+#else
+ _viewboxTable.set_border_width(4);
+ _viewboxTable.set_row_spacings(2);
+ _viewboxTable.set_col_spacings(2);
+ _viewboxTable.attach(_viewboxX, 0,1, 0,1);
+ _viewboxTable.attach(_viewboxY, 1,2, 0,1);
+ _viewboxTable.attach(_viewboxW, 0,1, 1,2);
+ _viewboxTable.attach(_viewboxH, 1,2, 1,2);
+#endif
+
_wr.setUpdating (true);
updateScaleUI();
_wr.setUpdating (false);
@@ -478,7 +539,11 @@ 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));
+ _changeds_connection = _scaleX.signal_value_changed().connect (sigc::mem_fun (*this, &PageSizer::on_scale_changed));
+ _changedvx_connection = _viewboxX.signal_value_changed().connect (sigc::mem_fun (*this, &PageSizer::on_viewbox_changed));
+ _changedvy_connection = _viewboxY.signal_value_changed().connect (sigc::mem_fun (*this, &PageSizer::on_viewbox_changed));
+ _changedvw_connection = _viewboxW.signal_value_changed().connect (sigc::mem_fun (*this, &PageSizer::on_viewbox_changed));
+ _changedvh_connection = _viewboxH.signal_value_changed().connect (sigc::mem_fun (*this, &PageSizer::on_viewbox_changed));
show_all_children();
}
@@ -744,10 +809,6 @@ void
PageSizer::updateScaleUI()
{
- if (_lockScaleUpdate) {
- return;
- }
-
static bool _called = false;
if (_called) {
return;
@@ -756,28 +817,56 @@ PageSizer::updateScaleUI()
_called = true;
_changeds_connection.block();
+ _changedvx_connection.block();
+ _changedvy_connection.block();
+ _changedvw_connection.block();
+ _changedvh_connection.block();
SPDesktop *dt = SP_ACTIVE_DESKTOP;
if (dt) {
SPDocument *doc = dt->getDocument();
+
+ // Update scale
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);
+ if( !_lockScaleUpdate ) {
+
+ 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);
+ }
+ }
+
+ { // Don't need to lock as scaleY widget not linked to callback.
+ double scaleY_inv =
+ Inkscape::Util::Quantity::convert( scale[Geom::Y], "px", nv->display_units );
+ if( scaleY_inv > 0 ) {
+ _scaleY.setValue(1.0/scaleY_inv);
+ } else {
+ // Should never happen
+ std::cerr << "PageSizer::updateScaleUI(): Invalid scale value: " << scaleY_inv << std::endl;
+ _scaleY.setValue(1.0);
+ }
}
+ if( !_lockViewboxUpdate ) {
+ Geom::Rect viewBox = doc->getViewBox();
+ _viewboxX.setValue( viewBox.min()[Geom::X] );
+ _viewboxY.setValue( viewBox.min()[Geom::Y] );
+ _viewboxW.setValue( viewBox.width() );
+ _viewboxH.setValue( viewBox.height() );
+ }
+
} else {
// Should never happen
std::cerr << "PageSizer::updateScaleUI(): No active desktop." << std::endl;
@@ -785,6 +874,10 @@ PageSizer::updateScaleUI()
}
_changeds_connection.unblock();
+ _changedvx_connection.unblock();
+ _changedvy_connection.unblock();
+ _changedvw_connection.unblock();
+ _changedvh_connection.unblock();
_called = false;
}
@@ -801,6 +894,7 @@ PageSizer::on_value_changed()
setDim (Inkscape::Util::Quantity(_dimensionWidth.getValue(""), _dimensionUnits.getUnit()),
Inkscape::Util::Quantity(_dimensionHeight.getValue(""), _dimensionUnits.getUnit()));
}
+
void
PageSizer::on_units_changed()
{
@@ -830,13 +924,44 @@ PageSizer::on_scale_changed()
double scaleX_inv = Inkscape::Util::Quantity(1.0/value, nv->display_units ).value("px");
_lockScaleUpdate = true;
- doc->setDocumentScale( 1.0/scaleX_inv );
+ doc->setDocumentScale( 1.0/scaleX_inv );
+ updateScaleUI();
_lockScaleUpdate = false;
DocumentUndo::done(doc, SP_VERB_NONE, _("Set page scale"));
}
}
}
+/**
+ * Callback for viewbox widgets
+ */
+void
+PageSizer::on_viewbox_changed()
+{
+ if (_widgetRegistry->isUpdating()) return;
+
+ double viewboxX = _viewboxX.getValue();
+ double viewboxY = _viewboxY.getValue();
+ double viewboxW = _viewboxW.getValue();
+ double viewboxH = _viewboxH.getValue();
+
+ if( viewboxW > 0 && viewboxH > 0) {
+ SPDesktop *dt = SP_ACTIVE_DESKTOP;
+ if (dt) {
+ SPDocument *doc = dt->getDocument();
+ _lockViewboxUpdate = true;
+ doc->setViewBox( Geom::Rect::from_xywh( viewboxX, viewboxY, viewboxW, viewboxH ) );
+ updateScaleUI();
+ _lockViewboxUpdate = false;
+ DocumentUndo::done(doc, SP_VERB_NONE, _("Set 'viewBox'"));
+ }
+ } else {
+ std::cerr
+ << "PageSizer::on_viewbox_changed(): width and height must both be greater than zero."
+ << std::endl;
+ }
+}
+
} // namespace Widget
} // namespace UI
} // namespace Inkscape
diff --git a/src/ui/widget/page-sizer.h b/src/ui/widget/page-sizer.h
index f9a72d9f3..0eea28e61 100644
--- a/src/ui/widget/page-sizer.h
+++ b/src/ui/widget/page-sizer.h
@@ -264,17 +264,38 @@ protected:
#endif
Gtk::Label _scaleLabel;
+ Gtk::Label _scaleWarning;
RegisteredScalar _scaleX;
+ RegisteredScalar _scaleY;
bool _lockScaleUpdate;
+ // Viewbox
+ Gtk::Expander _viewboxExpander;
+#if WITH_GTKMM_3_0
+ Gtk::Grid _viewboxTable;
+#else
+ Gtk::Table _viewboxTable;
+#endif
+
+ RegisteredScalar _viewboxX;
+ RegisteredScalar _viewboxY;
+ RegisteredScalar _viewboxW;
+ RegisteredScalar _viewboxH;
+ bool _lockViewboxUpdate;
+
//callback
void on_value_changed();
void on_units_changed();
void on_scale_changed();
+ void on_viewbox_changed();
sigc::connection _changedw_connection;
sigc::connection _changedh_connection;
sigc::connection _changedu_connection;
sigc::connection _changeds_connection;
+ sigc::connection _changedvx_connection;
+ sigc::connection _changedvy_connection;
+ sigc::connection _changedvw_connection;
+ sigc::connection _changedvh_connection;
Registry *_widgetRegistry;