Commit 4759859a authored by Jan Hambrecht's avatar Jan Hambrecht

rename align to alignment

parent 94b77d04
......@@ -21,22 +21,22 @@
#include "KoConnectionPoint.h"
KoConnectionPoint::KoConnectionPoint()
: position(0, 0), escapeDirection(AllDirections), align(AlignNone)
: position(0, 0), escapeDirection(AllDirections), alignment(AlignNone)
{
}
KoConnectionPoint::KoConnectionPoint(const QPointF& pos)
: position(pos), escapeDirection(AllDirections), align(AlignNone)
: position(pos), escapeDirection(AllDirections), alignment(AlignNone)
{
}
KoConnectionPoint::KoConnectionPoint(const QPointF& pos, EscapeDirection direction)
: position(pos), escapeDirection(direction), align(AlignNone)
: position(pos), escapeDirection(direction), alignment(AlignNone)
{
}
KoConnectionPoint::KoConnectionPoint(const QPointF &pos, EscapeDirection direction, Align alignment)
: position(pos), escapeDirection(direction), align(alignment)
KoConnectionPoint::KoConnectionPoint(const QPointF &pos, EscapeDirection direction, Alignment alignment)
: position(pos), escapeDirection(direction), alignment(alignment)
{
}
......
......@@ -49,7 +49,7 @@ struct FLAKE_EXPORT KoConnectionPoint
};
/// Alignments for connection points for shape resizing
enum Align {
enum Alignment {
AlignNone, ///< align to nothing
AlignTopLeft, ///< align to top and left edge
AlignTop, ///< align to top edge
......@@ -72,14 +72,14 @@ struct FLAKE_EXPORT KoConnectionPoint
KoConnectionPoint(const QPointF &position, EscapeDirection escapeDirection);
/// Creates connection point with specified position, escape direction and alignment
KoConnectionPoint(const QPointF &position, EscapeDirection escapeDirection, Align alignment);
KoConnectionPoint(const QPointF &position, EscapeDirection escapeDirection, Alignment alignment);
/// Returns default connection point with specified id
static KoConnectionPoint defaultConnectionPoint(KoConnectionPoint::PointId connectionPointId);
QPointF position; ///< the position of the connection point in shape coordinates
EscapeDirection escapeDirection; ///< the escape direction for connection attached to that connection point
Align align; ///< specifies to which edge the connection point is aligned to
Alignment alignment; ///< specifies to which edge the connection point is aligned to
};
/// Connection point container storing connection point data along their id
......
......@@ -205,7 +205,7 @@ void KoShapePrivate::removeShapeCache()
void KoShapePrivate::convertFromShapeCoordinates(KoConnectionPoint &point, const QSizeF &shapeSize) const
{
switch(point.align) {
switch(point.alignment) {
case KoConnectionPoint::AlignNone:
point.position = KoFlake::toRelative(point.position, shapeSize);
point.position.rx() = qBound<qreal>(0.0, point.position.x(), 1.0);
......@@ -243,7 +243,7 @@ void KoShapePrivate::convertFromShapeCoordinates(KoConnectionPoint &point, const
void KoShapePrivate::convertToShapeCoordinates(KoConnectionPoint &point, const QSizeF &shapeSize) const
{
switch(point.align) {
switch(point.alignment) {
case KoConnectionPoint::AlignNone:
point.position = KoFlake::toAbsolute(point.position, shapeSize);
break;
......@@ -1578,23 +1578,23 @@ void KoShape::loadOdfGluePoints(const KoXmlElement &element, KoShapeLoadingConte
connector.position.setX(KoUnit::parseValue(xStr));
connector.position.setY(KoUnit::parseValue(yStr));
if (align == "top-left") {
connector.align = KoConnectionPoint::AlignTopLeft;
connector.alignment = KoConnectionPoint::AlignTopLeft;
} else if (align == "top") {
connector.align = KoConnectionPoint::AlignTop;
connector.alignment = KoConnectionPoint::AlignTop;
} else if (align == "top-right") {
connector.align = KoConnectionPoint::AlignTopRight;
connector.alignment = KoConnectionPoint::AlignTopRight;
} else if (align == "left") {
connector.align = KoConnectionPoint::AlignLeft;
connector.alignment = KoConnectionPoint::AlignLeft;
} else if (align == "center") {
connector.align = KoConnectionPoint::AlignCenter;
connector.alignment = KoConnectionPoint::AlignCenter;
} else if (align == "right") {
connector.align = KoConnectionPoint::AlignRight;
connector.alignment = KoConnectionPoint::AlignRight;
} else if (align == "bottom-left") {
connector.align = KoConnectionPoint::AlignBottomLeft;
connector.alignment = KoConnectionPoint::AlignBottomLeft;
} else if (align == "bottom") {
connector.align = KoConnectionPoint::AlignBottom;
connector.alignment = KoConnectionPoint::AlignBottom;
} else if (align == "bottom-right") {
connector.align = KoConnectionPoint::AlignBottomRight;
connector.alignment = KoConnectionPoint::AlignBottomRight;
}
kDebug(30006) << "using alignment" << align;
d->convertFromShapeCoordinates(connector, size());
......@@ -1883,7 +1883,7 @@ void KoShape::saveOdfCommonChildElements(KoShapeSavingContext &context) const
context.xmlWriter().addAttribute("draw:escape-direction", escapeDirection);
}
QString alignment;
switch(cp.value().align) {
switch(cp.value().alignment) {
case KoConnectionPoint::AlignTopLeft:
alignment = "top-left";
break;
......
......@@ -27,6 +27,7 @@
#include "MoveConnectionPointStrategy.h"
#include "ConnectionPointWidget.h"
#include <KoConnectionShape.h>
#include <KoCanvasBase.h>
#include <KoPointerEvent.h>
#include <KoShapeManager.h>
......@@ -529,7 +530,7 @@ void ConnectionTool::updateActions()
action->setChecked(false);
foreach(QAction *action, m_alignVertical->actions())
action->setChecked(false);
switch(cp.align) {
switch(cp.alignment) {
case KoConnectionPoint::AlignNone:
m_alignPercent->setChecked(true);
break;
......@@ -699,25 +700,25 @@ void ConnectionTool::updateConnectionPoint()
KoConnectionPoint oldPoint = m_currentShape->connectionPoint(m_activeHandle);
KoConnectionPoint newPoint = oldPoint;
if (m_alignPercent->isChecked()) {
newPoint.align = KoConnectionPoint::AlignNone;
newPoint.alignment = KoConnectionPoint::AlignNone;
} else if (m_alignLeft->isChecked() && m_alignTop->isChecked()) {
newPoint.align = KoConnectionPoint::AlignTopLeft;
newPoint.alignment = KoConnectionPoint::AlignTopLeft;
} else if(m_alignCenterH->isChecked() && m_alignTop->isChecked()) {
newPoint.align = KoConnectionPoint::AlignTop;
newPoint.alignment = KoConnectionPoint::AlignTop;
} else if (m_alignRight->isChecked() && m_alignTop->isChecked()) {
newPoint.align = KoConnectionPoint::AlignTopRight;
newPoint.alignment = KoConnectionPoint::AlignTopRight;
} else if (m_alignLeft->isChecked() && m_alignCenterV->isChecked()) {
newPoint.align = KoConnectionPoint::AlignLeft;
newPoint.alignment = KoConnectionPoint::AlignLeft;
} else if (m_alignCenterH->isChecked() && m_alignCenterV->isChecked()) {
newPoint.align = KoConnectionPoint::AlignCenter;
newPoint.alignment = KoConnectionPoint::AlignCenter;
} else if (m_alignRight->isChecked() && m_alignCenterV->isChecked()) {
newPoint.align = KoConnectionPoint::AlignRight;
newPoint.alignment = KoConnectionPoint::AlignRight;
} else if (m_alignLeft->isChecked() && m_alignBottom->isChecked()) {
newPoint.align = KoConnectionPoint::AlignBottomLeft;
newPoint.alignment = KoConnectionPoint::AlignBottomLeft;
} else if (m_alignCenterH->isChecked() && m_alignBottom->isChecked()) {
newPoint.align = KoConnectionPoint::AlignBottom;
newPoint.alignment = KoConnectionPoint::AlignBottom;
} else if (m_alignRight->isChecked() && m_alignBottom->isChecked()) {
newPoint.align = KoConnectionPoint::AlignBottomRight;
newPoint.alignment = KoConnectionPoint::AlignBottomRight;
}
canvas()->addCommand(new ChangeConnectionPointCommand(m_currentShape, m_activeHandle, oldPoint, newPoint));
......
......@@ -26,10 +26,10 @@
#include "KoPathTool.h"
#include <KoConnectionShape.h>
#include <KoCanvasBase.h>
#include <KoSnapGuide.h>
class KoConnectionShape;
class KAction;
class QActionGroup;
class KoShapeConfigWidgetBase;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment