r19946 by craig - Move NodeEditContext to its own file
scribus-commit
scribus-commit at lists.scribus.net
Wed Mar 25 19:45:42 UTC 2015
Author: craig
Date: Wed Mar 25 19:45:42 2015
New Revision: 19946
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19946
Log:
Move NodeEditContext to its own file
Modified:
trunk/Scribus/scribus/CMakeLists.txt
trunk/Scribus/scribus/canvasmode.cpp
trunk/Scribus/scribus/canvasmode_editarc.h
trunk/Scribus/scribus/canvasmode_nodeedit.cpp
trunk/Scribus/scribus/pageitem.cpp
trunk/Scribus/scribus/plugins/tools/subdivide/subdivide.cpp
trunk/Scribus/scribus/scribus.cpp
trunk/Scribus/scribus/scribusdoc.cpp
trunk/Scribus/scribus/scribusdoc.h
trunk/Scribus/scribus/scribusview.cpp
trunk/Scribus/scribus/ui/nodeeditpalette.cpp
Modified: trunk/Scribus/scribus/CMakeLists.txt
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19946&path=/trunk/Scribus/scribus/CMakeLists.txt
==============================================================================
--- trunk/Scribus/scribus/CMakeLists.txt (original)
+++ trunk/Scribus/scribus/CMakeLists.txt Wed Mar 25 19:45:42 2015
@@ -3,15 +3,18 @@
ADD_DEFINITIONS(-DHAVE_SVNVERSION)
MESSAGE(STATUS "SVN Version requested in About dialog")
# a custom target that is always built
- add_custom_target(svnheader ALL DEPENDS svn_header ) # svn_header is nothing more than a unique string
+
+add_custom_target(svnheader ALL COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -P ${CMAKE_MODULE_PATH}/getsvn.cmake BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/svnversion.h)
+
+# add_custom_target(svnheader ALL DEPENDS svn_header ) # svn_header is nothing more than a unique string
# creates svnheader.h using cmake script
- add_custom_command(OUTPUT svn_header ${CMAKE_CURRENT_BINARY_DIR}/svnversion.h
- COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -P ${CMAKE_MODULE_PATH}/getsvn.cmake)
-
- set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/svnversion.h
- PROPERTIES GENERATED TRUE
- HEADER_FILE_ONLY TRUE)
+# add_custom_command(OUTPUT svn_header ${CMAKE_CURRENT_BINARY_DIR}/svnversion.h
+# COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -P ${CMAKE_MODULE_PATH}/getsvn.cmake)
+
+# set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/svnversion.h
+# PROPERTIES GENERATED TRUE
+# HEADER_FILE_ONLY TRUE)
ENDIF (WANT_SVNVERSION)
IF(WIN32)
@@ -617,6 +620,7 @@
nftrcreader.cpp
nftsettings.cpp
nfttemplate.cpp
+ nodeeditcontext.cpp
notesstyles.cpp
pageitem.cpp
pageitem_arc.cpp
Modified: trunk/Scribus/scribus/canvasmode.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19946&path=/trunk/Scribus/scribus/canvasmode.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode.cpp (original)
+++ trunk/Scribus/scribus/canvasmode.cpp Wed Mar 25 19:45:42 2015
@@ -1419,21 +1419,21 @@
{
if ((m_doc->appMode == modeEditClip) && (m_doc->nodeEdit.hasNodeSelected()))
{
- int storedClRe = m_doc->nodeEdit.ClRe;
- if ((m_doc->nodeEdit.SelNode.count() != 0) && (m_doc->nodeEdit.EdPoints))
+ int storedClRe = m_doc->nodeEdit.clre();
+ if ((m_doc->nodeEdit.selNode().count() != 0) && (m_doc->nodeEdit.edPoints()))
{
QPolygonF poly;
- if ((currItem->imageFlippedH() && (!m_doc->nodeEdit.isContourLine)) && (currItem->isSymbol() || currItem->isGroup()))
+ if ((currItem->imageFlippedH() && (!m_doc->nodeEdit.isContourLine())) && (currItem->isSymbol() || currItem->isGroup()))
moveBy *= -1;
- for (int itm = 0; itm < m_doc->nodeEdit.SelNode.count(); ++itm)
+ for (int itm = 0; itm < m_doc->nodeEdit.selNode().count(); ++itm)
{
FPoint np;
- int clRe = m_doc->nodeEdit.SelNode.at(itm);
- if (m_doc->nodeEdit.isContourLine)
+ int clRe = m_doc->nodeEdit.selNode().at(itm);
+ if (m_doc->nodeEdit.isContourLine())
np = currItem->ContourLine.point(clRe);
else
np = currItem->PoLine.point(clRe);
- m_doc->nodeEdit.ClRe = clRe;
+ m_doc->nodeEdit.setClre(clRe);
np = np - FPoint(moveBy, 0);
m_doc->nodeEdit.moveClipPoint(currItem, np);
poly.append(np.toQPointF());
@@ -1444,7 +1444,7 @@
QRectF newR(currItem->getBoundingRect());
m_doc->regionsChanged()->update(newR.united(oldR));
}
- m_doc->nodeEdit.ClRe = storedClRe;
+ m_doc->nodeEdit.setClre(storedClRe);
}
else
{
@@ -1469,7 +1469,7 @@
else
{
//CB If in EditContour mode, allow contour line to be scaled with arrow keys too
- if(m_doc->nodeEdit.isContourLine)
+ if(m_doc->nodeEdit.isContourLine())
m_view->TransformPoly(10, 0, resizeBy/unitGetRatioFromIndex(m_doc->unitIndex()));
else if (!currItem->sizeLocked())
{
@@ -1493,21 +1493,21 @@
{
if ((m_doc->appMode == modeEditClip) && (m_doc->nodeEdit.hasNodeSelected()))
{
- int storedClRe = m_doc->nodeEdit.ClRe;
- if ((m_doc->nodeEdit.SelNode.count() != 0) && (m_doc->nodeEdit.EdPoints))
+ int storedClRe = m_doc->nodeEdit.clre();
+ if ((m_doc->nodeEdit.selNode().count() != 0) && (m_doc->nodeEdit.edPoints()))
{
QPolygonF poly;
- if ((currItem->imageFlippedH() && (!m_doc->nodeEdit.isContourLine)) && (currItem->isSymbol() || currItem->isGroup()))
+ if ((currItem->imageFlippedH() && (!m_doc->nodeEdit.isContourLine())) && (currItem->isSymbol() || currItem->isGroup()))
moveBy *= -1;
- for (int itm = 0; itm < m_doc->nodeEdit.SelNode.count(); ++itm)
+ for (int itm = 0; itm < m_doc->nodeEdit.selNode().count(); ++itm)
{
FPoint np;
- int clRe = m_doc->nodeEdit.SelNode.at(itm);
- if (m_doc->nodeEdit.isContourLine)
+ int clRe = m_doc->nodeEdit.selNode().at(itm);
+ if (m_doc->nodeEdit.isContourLine())
np = currItem->ContourLine.point(clRe);
else
np = currItem->PoLine.point(clRe);
- m_doc->nodeEdit.ClRe = clRe;
+ m_doc->nodeEdit.setClre(clRe);
np = np + FPoint(moveBy, 0);
m_doc->nodeEdit.moveClipPoint(currItem, np);
poly.append(np.toQPointF());
@@ -1518,7 +1518,7 @@
QRectF newR(currItem->getBoundingRect());
m_doc->regionsChanged()->update(newR.united(oldR));
}
- m_doc->nodeEdit.ClRe = storedClRe;
+ m_doc->nodeEdit.setClre(storedClRe);
}
else
{
@@ -1543,7 +1543,7 @@
else
{
//CB If in EditContour mode, allow contour line to be scaled with arrow keys too
- if(m_doc->nodeEdit.isContourLine)
+ if(m_doc->nodeEdit.isContourLine())
m_view->TransformPoly(11, 0, resizeBy/unitGetRatioFromIndex(m_doc->unitIndex()));
else if (!currItem->sizeLocked())
{
@@ -1567,21 +1567,21 @@
{
if ((m_doc->appMode == modeEditClip) && (m_doc->nodeEdit.hasNodeSelected()))
{
- int storedClRe = m_doc->nodeEdit.ClRe;
- if ((m_doc->nodeEdit.SelNode.count() != 0) && (m_doc->nodeEdit.EdPoints))
+ int storedClRe = m_doc->nodeEdit.clre();
+ if ((m_doc->nodeEdit.selNode().count() != 0) && (m_doc->nodeEdit.edPoints()))
{
QPolygonF poly;
- if ((currItem->imageFlippedV() && (!m_doc->nodeEdit.isContourLine)) && (currItem->isSymbol() || currItem->isGroup()))
+ if ((currItem->imageFlippedV() && (!m_doc->nodeEdit.isContourLine())) && (currItem->isSymbol() || currItem->isGroup()))
moveBy *= -1;
- for (int itm = 0; itm < m_doc->nodeEdit.SelNode.count(); ++itm)
+ for (int itm = 0; itm < m_doc->nodeEdit.selNode().count(); ++itm)
{
FPoint np;
- int clRe = m_doc->nodeEdit.SelNode.at(itm);
- if (m_doc->nodeEdit.isContourLine)
+ int clRe = m_doc->nodeEdit.selNode().at(itm);
+ if (m_doc->nodeEdit.isContourLine())
np = currItem->ContourLine.point(clRe);
else
np = currItem->PoLine.point(clRe);
- m_doc->nodeEdit.ClRe = clRe;
+ m_doc->nodeEdit.setClre(clRe);
np = np - FPoint(0, moveBy);
m_doc->nodeEdit.moveClipPoint(currItem, np);
poly.append(np.toQPointF());
@@ -1592,7 +1592,7 @@
QRectF newR(currItem->getBoundingRect());
m_doc->regionsChanged()->update(newR.united(oldR));
}
- m_doc->nodeEdit.ClRe = storedClRe;
+ m_doc->nodeEdit.setClre(storedClRe);
}
else
{
@@ -1617,7 +1617,7 @@
else
{
//CB If in EditContour mode, allow contour line to be scaled with arrow keys too
- if(m_doc->nodeEdit.isContourLine)
+ if(m_doc->nodeEdit.isContourLine())
m_view->TransformPoly(12, 0, resizeBy/unitGetRatioFromIndex(m_doc->unitIndex()));
else
{
@@ -1641,21 +1641,21 @@
{
if ((m_doc->appMode == modeEditClip) && (m_doc->nodeEdit.hasNodeSelected()))
{
- int storedClRe = m_doc->nodeEdit.ClRe;
- if ((m_doc->nodeEdit.SelNode.count() != 0) && (m_doc->nodeEdit.EdPoints))
+ int storedClRe = m_doc->nodeEdit.clre();
+ if ((m_doc->nodeEdit.selNode().count() != 0) && (m_doc->nodeEdit.edPoints()))
{
QPolygonF poly;
- if ((currItem->imageFlippedV() && (!m_doc->nodeEdit.isContourLine)) && (currItem->isSymbol() || currItem->isGroup()))
+ if ((currItem->imageFlippedV() && (!m_doc->nodeEdit.isContourLine())) && (currItem->isSymbol() || currItem->isGroup()))
moveBy *= -1;
- for (int itm = 0; itm < m_doc->nodeEdit.SelNode.count(); ++itm)
+ for (int itm = 0; itm < m_doc->nodeEdit.selNode().count(); ++itm)
{
FPoint np;
- int clRe = m_doc->nodeEdit.SelNode.at(itm);
- if (m_doc->nodeEdit.isContourLine)
+ int clRe = m_doc->nodeEdit.selNode().at(itm);
+ if (m_doc->nodeEdit.isContourLine())
np = currItem->ContourLine.point(clRe);
else
np = currItem->PoLine.point(clRe);
- m_doc->nodeEdit.ClRe = clRe;
+ m_doc->nodeEdit.setClre(clRe);
np = np - FPoint(0, -moveBy);
m_doc->nodeEdit.moveClipPoint(currItem, np);
poly.append(np.toQPointF());
@@ -1666,7 +1666,7 @@
QRectF newR(currItem->getBoundingRect());
m_doc->regionsChanged()->update(newR.united(oldR));
}
- m_doc->nodeEdit.ClRe = storedClRe;
+ m_doc->nodeEdit.setClre(storedClRe);
}
else
{
@@ -1691,7 +1691,7 @@
else
{
//CB If in EditContour mode, allow contour line to be scaled with arrow keys too
- if(m_doc->nodeEdit.isContourLine)
+ if(m_doc->nodeEdit.isContourLine())
m_view->TransformPoly(13, 0, resizeBy/unitGetRatioFromIndex(m_doc->unitIndex()));
else if (!currItem->sizeLocked())
{
@@ -1749,7 +1749,7 @@
double xposOrig = currItem->xPos();
double yposOrig = currItem->yPos();
m_doc->AdjustItemSize(currItem, true, true);
- if (!m_doc->nodeEdit.isContourLine)
+ if (!m_doc->nodeEdit.isContourLine())
currItem->ContourLine.translate(xposOrig - currItem->xPos(),yposOrig - currItem->yPos());
currItem->update();
m_doc->regionsChanged()->update(currItem->getVisualBoundingRect());
Modified: trunk/Scribus/scribus/canvasmode_editarc.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19946&path=/trunk/Scribus/scribus/canvasmode_editarc.h
==============================================================================
--- trunk/Scribus/scribus/canvasmode_editarc.h (original)
+++ trunk/Scribus/scribus/canvasmode_editarc.h Wed Mar 25 19:45:42 2015
@@ -40,6 +40,7 @@
class CanvasMode_EditArc : public CanvasMode
{
Q_OBJECT
+
public:
explicit CanvasMode_EditArc(ScribusView* view);
virtual ~CanvasMode_EditArc() {}
Modified: trunk/Scribus/scribus/canvasmode_nodeedit.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19946&path=/trunk/Scribus/scribus/canvasmode_nodeedit.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_nodeedit.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_nodeedit.cpp Wed Mar 25 19:45:42 2015
@@ -24,6 +24,7 @@
#include "canvasgesture_rectselect.h"
#include "fpoint.h"
#include "pageitem.h"
+#include "nodeeditcontext.h"
#include "scraction.h"
#include "scribus.h"
#include "scribusXml.h"
@@ -64,7 +65,7 @@
p->setPen(QPen(Qt::blue, 1 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin));
p->setBrush(Qt::NoBrush);
- if ((m_doc->nodeEdit.isContourLine) && (currItem->ContourLine.size() != 0))
+ if ((m_doc->nodeEdit.isContourLine()) && (currItem->ContourLine.size() != 0))
cli = currItem->ContourLine;
else
{
@@ -111,15 +112,15 @@
{
if (cli.isMarker(a))
continue;
- if (m_doc->nodeEdit.EdPoints)
- {
- if (m_doc->nodeEdit.ClRe == static_cast<int>(a+1))
+ if (m_doc->nodeEdit.edPoints())
+ {
+ if (m_doc->nodeEdit.clre() == static_cast<int>(a+1))
p->setPen(QPen(Qt::red, 8 / scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
else
p->setPen(QPen(Qt::magenta, 8 / scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
cli.point(a+1, &x, &y);
p->drawPoint(QPointF(x, y));
- if (m_doc->nodeEdit.ClRe == static_cast<int>(a))
+ if (m_doc->nodeEdit.clre() == static_cast<int>(a))
p->setPen(QPen(Qt::red, 8 / scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
else
p->setPen(QPen(Qt::blue, 8 / scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
@@ -128,13 +129,13 @@
}
else
{
- if (m_doc->nodeEdit.ClRe == static_cast<int>(a))
+ if (m_doc->nodeEdit.clre() == static_cast<int>(a))
p->setPen(QPen(Qt::red, 8 / scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
else
p->setPen(QPen(Qt::blue, 8 / scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
cli.point(a, &x, &y);
p->drawPoint(QPointF(x, y));
- if (m_doc->nodeEdit.ClRe == static_cast<int>(a+1))
+ if (m_doc->nodeEdit.clre() == static_cast<int>(a+1))
p->setPen(QPen(Qt::red, 8 / scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
else
p->setPen(QPen(Qt::magenta, 8 / scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
@@ -143,25 +144,25 @@
}
}
- if (m_doc->nodeEdit.ClRe != -1)
+ if (m_doc->nodeEdit.clre() != -1)
{
p->setPen(QPen(Qt::red, 8 / scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
- cli.point(m_doc->nodeEdit.ClRe, &x, &y);
+ cli.point(m_doc->nodeEdit.clre(), &x, &y);
p->drawPoint(QPointF(x, y));
QList<int>::Iterator itm;
- for (itm = m_doc->nodeEdit.SelNode.begin(); itm != m_doc->nodeEdit.SelNode.end(); ++itm)
+ for (itm = m_doc->nodeEdit.selNode().begin(); itm != m_doc->nodeEdit.selNode().end(); ++itm)
{
cli.point((*itm), &x, &y);
p->drawPoint(QPointF(x, y));
}
}
- bool havePoint = (m_doc->nodeEdit.ClRe != -1);
- emit m_view->HavePoint(havePoint, m_doc->nodeEdit.MoveSym);
-
- if (m_doc->nodeEdit.ClRe != -1)
- {
- cli.point(m_doc->nodeEdit.ClRe, &x, &y);
+ bool havePoint = (m_doc->nodeEdit.clre() != -1);
+ emit m_view->HavePoint(havePoint, m_doc->nodeEdit.moveSym());
+
+ if (m_doc->nodeEdit.clre() != -1)
+ {
+ cli.point(m_doc->nodeEdit.clre(), &x, &y);
emit m_view->ClipPo(x, y);
}
@@ -176,12 +177,12 @@
m_canvas->m_viewMode.m_MouseButtonPressed = false;
// handle rectangle select
PageItem* currItem = m_doc->m_Selection->itemAt(0);
- m_doc->nodeEdit.SelNode.clear();
+ m_doc->nodeEdit.selNode().clear();
QRectF Sele = m_rectangleSelect->result();
FPointArray Clip;
bool firstPoint = false;
QTransform pm2 = currItem->getTransform();
- if (m_doc->nodeEdit.isContourLine)
+ if (m_doc->nodeEdit.isContourLine())
Clip = currItem->ContourLine;
else
{
@@ -212,8 +213,8 @@
firstPoint = true;
if ((firstPoint) && (a == Clip.size() - 2) && (!currItem->asPolyLine()))
continue;
- m_doc->nodeEdit.ClRe = a;
- m_doc->nodeEdit.SelNode.append(a);
+ m_doc->nodeEdit.setClre(a);
+ m_doc->nodeEdit.selNode().append(a);
m_doc->nodeEdit.update(Clip.pointQF(a));
}
}
@@ -403,11 +404,11 @@
m->accept();
if (m_view->moveTimerElapsed())
{
- if (m_doc->nodeEdit.SegP1 != -1 && m_doc->nodeEdit.SegP2 != -1)
+ if (m_doc->nodeEdit.segP1() != -1 && m_doc->nodeEdit.segP2() != -1)
{
m_doc->nodeEdit.deselect();
- m_doc->nodeEdit.SegP1 = -1;
- m_doc->nodeEdit.SegP2 = -1;
+ m_doc->nodeEdit.setSegP1(-1);
+ m_doc->nodeEdit.setSegP2(-1);
}
currItem = m_doc->m_Selection->itemAt(0);
m_canvas->m_viewMode.operItemMoving = false;
@@ -416,7 +417,7 @@
ScItemState<QPair<FPointArray, FPointArray> > *state = NULL;
state = m_doc->nodeEdit.finishTransaction1(currItem);
- if (m_doc->nodeEdit.hasNodeSelected() && (m_doc->nodeEdit.SelNode.count() == 1))
+ if (m_doc->nodeEdit.hasNodeSelected() && (m_doc->nodeEdit.selNode().count() == 1))
{
//FIXME:av
FPoint newP = m_canvas->globalToCanvas(m->globalPos());
@@ -432,7 +433,7 @@
npf = FPoint(nx, ny);
QTransform pp = currItem->getTransform();
npf = npf.transformPoint(pp, true);
- if (m_doc->nodeEdit.isContourLine)
+ if (m_doc->nodeEdit.isContourLine())
Clip = currItem->ContourLine;
else
{
@@ -458,7 +459,7 @@
m_doc->nodeEdit.moveClipPoint(currItem, npf);
}
m_doc->AdjustItemSize(currItem, true, true);
- if (!m_doc->nodeEdit.isContourLine)
+ if (!m_doc->nodeEdit.isContourLine())
currItem->ContourLine.translate(xposOrig - currItem->xPos(), yposOrig - currItem->yPos());
m_doc->regionsChanged()->update(QRectF());
if (state)
@@ -515,7 +516,7 @@
bool pfound = false;
QTransform pm2 = currItem->getTransform();
npf2 = m_canvas->globalToCanvas(m->globalPos()).transformPoint(pm2, true);
- if ((currItem->isSymbol() || currItem->isGroup()) && (!m_doc->nodeEdit.isContourLine))
+ if ((currItem->isSymbol() || currItem->isGroup()) && (!m_doc->nodeEdit.isContourLine()))
{
if (currItem->imageFlippedH())
{
@@ -530,17 +531,17 @@
}
for (int a=0; a < signed(Clip.size()); ++a)
{
- if (((m_doc->nodeEdit.EdPoints) && (a % 2 != 0)) || ((!m_doc->nodeEdit.EdPoints) && (a % 2 == 0)))
+ if (((m_doc->nodeEdit.edPoints()) && (a % 2 != 0)) || ((!m_doc->nodeEdit.edPoints()) && (a % 2 == 0)))
continue;
QPointF npf = pm2.map(Clip.pointQF(a));
if (m_canvas->hitsCanvasPoint(m->globalPos(), npf))
{
- m_doc->nodeEdit.ClRe = a;
- if ((m_doc->nodeEdit.EdPoints) && (m_doc->nodeEdit.SelNode.contains(a) == 0))
+ m_doc->nodeEdit.setClre(a);
+ if ((m_doc->nodeEdit.edPoints()) && (m_doc->nodeEdit.selNode().contains(a) == 0))
{
if (m->modifiers() != Qt::ShiftModifier)
- m_doc->nodeEdit.SelNode.clear();
- m_doc->nodeEdit.SelNode.append(a);
+ m_doc->nodeEdit.selNode().clear();
+ m_doc->nodeEdit.selNode().append(a);
}
m_doc->nodeEdit.update(Clip.pointQF(a));
pfound = true;
@@ -548,21 +549,21 @@
break;
}
}
- if ((!pfound) || (!m_doc->nodeEdit.EdPoints))
- m_doc->nodeEdit.SelNode.clear();
-
- if ((m_doc->nodeEdit.submode == NodeEditContext::MOVE_POINT) && (m_doc->nodeEdit.ClRe2 != -1) && !m_doc->nodeEdit.hasNodeSelected())
- {
- m_doc->nodeEdit.SegP1 = m_doc->nodeEdit.ClRe2;
- m_doc->nodeEdit.SegP2 = m_doc->nodeEdit.ClRe2+2;
- m_doc->nodeEdit.ClRe = m_doc->nodeEdit.ClRe2;
+ if ((!pfound) || (!m_doc->nodeEdit.edPoints()))
+ m_doc->nodeEdit.selNode().clear();
+
+ if ((m_doc->nodeEdit.submode() == NodeEditContext::MOVE_POINT) && (m_doc->nodeEdit.clre() != -1) && !m_doc->nodeEdit.hasNodeSelected())
+ {
+ m_doc->nodeEdit.setSegP1(m_doc->nodeEdit.clre2());
+ m_doc->nodeEdit.setSegP2(m_doc->nodeEdit.clre2()+2);
+ m_doc->nodeEdit.setClre(m_doc->nodeEdit.clre2());
}
FPointArray cli;
uint EndInd = Clip.size();
uint StartInd = 0;
- if (m_doc->nodeEdit.ClRe > 0)
- {
- for (int n = m_doc->nodeEdit.ClRe; n < Clip.size(); ++n)
+ if (m_doc->nodeEdit.clre() > 0)
+ {
+ for (int n = m_doc->nodeEdit.clre(); n < Clip.size(); ++n)
{
if (Clip.isMarker(n))
{
@@ -570,7 +571,7 @@
break;
}
}
- for (uint n2 = m_doc->nodeEdit.ClRe; n2 > 0; n2--)
+ for (uint n2 = m_doc->nodeEdit.clre(); n2 > 0; n2--)
{
if (n2 == 0)
break;
@@ -581,11 +582,11 @@
}
}
}
- if (m_doc->nodeEdit.submode == NodeEditContext::SPLIT_PATH)
- {
- if (!m_doc->nodeEdit.EdPoints)
+ if (m_doc->nodeEdit.submode() == NodeEditContext::SPLIT_PATH)
+ {
+ if (!m_doc->nodeEdit.edPoints())
return;
- if ((!m_doc->nodeEdit.hasNodeSelected()) && (m_doc->nodeEdit.ClRe2 != -1)) // We don't have a Point, try to add one onto the current curve segment
+ if ((!m_doc->nodeEdit.hasNodeSelected()) && (m_doc->nodeEdit.clre2() != -1)) // We don't have a Point, try to add one onto the current curve segment
{
bool foundP = false;
uint seg = 0;
@@ -630,19 +631,19 @@
}
}
}
- cli.putPoints(0, m_doc->nodeEdit.ClRe2+2, Clip);
+ cli.putPoints(0, m_doc->nodeEdit.clre2()+2, Clip);
if (foundP)
{
npf2 = nearPoint;
FPoint base = cli.point(cli.size()-2);
FPoint c1 = cli.point(cli.size()-1);
- FPoint base2 = Clip.point(m_doc->nodeEdit.ClRe2+2);
- FPoint c2 = Clip.point(m_doc->nodeEdit.ClRe2+3);
+ FPoint base2 = Clip.point(m_doc->nodeEdit.clre2()+2);
+ FPoint c2 = Clip.point(m_doc->nodeEdit.clre2()+3);
if ((base == c1) && (base2 == c2))
{
cli.resize(cli.size()+4);
cli.putPoints(cli.size()-4, 4, npf2.x(), npf2.y(), npf2.x(), npf2.y(), npf2.x(), npf2.y(), npf2.x(), npf2.y());
- cli.putPoints(cli.size(), Clip.size()-(m_doc->nodeEdit.ClRe2 + 2), Clip, m_doc->nodeEdit.ClRe2+2);
+ cli.putPoints(cli.size(), Clip.size()-(m_doc->nodeEdit.clre2() + 2), Clip, m_doc->nodeEdit.clre2()+2);
}
else
{
@@ -654,16 +655,16 @@
cli.resize(cli.size()+4);
uint basind = cli.size()+1;
cli.putPoints(cli.size()-4, 4, npf2.x(), npf2.y(), cn2.x(), cn2.y(), npf2.x(), npf2.y(), cn3.x(), cn3.y());
- cli.putPoints(cli.size(), Clip.size()-(m_doc->nodeEdit.ClRe2 + 2), Clip, m_doc->nodeEdit.ClRe2+2);
+ cli.putPoints(cli.size(), Clip.size()-(m_doc->nodeEdit.clre2() + 2), Clip, m_doc->nodeEdit.clre2()+2);
cli.setPoint(basind, cn4);
}
Clip = cli.copy();
cli.resize(0);
- m_doc->nodeEdit.ClRe = m_doc->nodeEdit.ClRe2+2;
- m_doc->nodeEdit.ClRe2 = -1;
+ m_doc->nodeEdit.setClre(m_doc->nodeEdit.clre2()+2);
+ m_doc->nodeEdit.setClre2(-1);
EndInd = Clip.size();
StartInd = 0;
- for (int n = m_doc->nodeEdit.ClRe; n < Clip.size(); ++n)
+ for (int n = m_doc->nodeEdit.clre(); n < Clip.size(); ++n)
{
if (Clip.isMarker(n))
{
@@ -671,9 +672,9 @@
break;
}
}
- if (m_doc->nodeEdit.ClRe > 0)
- {
- for (uint n2 = m_doc->nodeEdit.ClRe; n2 > 0; n2--)
+ if (m_doc->nodeEdit.clre() > 0)
+ {
+ for (uint n2 = m_doc->nodeEdit.clre(); n2 > 0; n2--)
{
if (n2 == 0)
break;
@@ -692,25 +693,25 @@
{
if (currItem->asPolygon())
{
- if ((m_doc->nodeEdit.ClRe != 0) && (m_doc->nodeEdit.ClRe != static_cast<int>(EndInd-2)))
+ if ((m_doc->nodeEdit.clre() != 0) && (m_doc->nodeEdit.clre() != static_cast<int>(EndInd-2)))
{
if (currItem->Segments.count() == 0)
{
- cli.putPoints(0, EndInd-(m_doc->nodeEdit.ClRe+2), Clip, m_doc->nodeEdit.ClRe+2);
- cli.putPoints(cli.size(), m_doc->nodeEdit.ClRe+2, Clip);
+ cli.putPoints(0, EndInd-(m_doc->nodeEdit.clre()+2), Clip, m_doc->nodeEdit.clre()+2);
+ cli.putPoints(cli.size(), m_doc->nodeEdit.clre()+2, Clip);
}
else
{
cli.putPoints(0, EndInd-StartInd, Clip, StartInd);
int z = m_doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, currItem->xPos(), currItem->yPos(), currItem->width(), currItem->height(), currItem->lineWidth(), currItem->fillColor(), currItem->lineColor(), true);
PageItem* bb = m_doc->Items->takeAt(z);
- if (m_doc->nodeEdit.isContourLine)
+ if (m_doc->nodeEdit.isContourLine())
bb->ContourLine.resize(0);
else
bb->PoLine.resize(0);
if (StartInd != 0)
{
- if (m_doc->nodeEdit.isContourLine)
+ if (m_doc->nodeEdit.isContourLine())
{
bb->ContourLine.putPoints(0, StartInd - 4, Clip);
bb->ContourLine.putPoints(bb->ContourLine.size(), Clip.size()-EndInd, Clip, EndInd);
@@ -723,7 +724,7 @@
}
else
{
- if (m_doc->nodeEdit.isContourLine)
+ if (m_doc->nodeEdit.isContourLine())
bb->ContourLine.putPoints(0, Clip.size()-EndInd-4, Clip, EndInd+4);
else
bb->PoLine.putPoints(0, Clip.size()-EndInd-4, Clip, EndInd+4);
@@ -738,7 +739,7 @@
m_doc->nodeEdit.deselect();
currItem->ClipEdited = true;
edited = true;
- m_doc->nodeEdit.submode = NodeEditContext::MOVE_POINT;
+ m_doc->nodeEdit.setSubMode(NodeEditContext::MOVE_POINT);
PageItem* newItem=m_doc->convertItemTo(currItem, PageItem::PolyLine);
currItem=newItem;
m_doc->m_Selection->clear();
@@ -749,20 +750,20 @@
{
if ((currItem->asPolyLine()) || (currItem->asPathText()))
{
- if ((m_doc->nodeEdit.ClRe > 1) && (m_doc->nodeEdit.ClRe < static_cast<int>(Clip.size()-2)))
+ if ((m_doc->nodeEdit.clre() > 1) && (m_doc->nodeEdit.clre() < static_cast<int>(Clip.size()-2)))
{
int z = m_doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, currItem->xPos(), currItem->yPos(), currItem->width(), currItem->height(), currItem->lineWidth(), currItem->fillColor(), currItem->lineColor(), true);
PageItem* bb = m_doc->Items->at(z);
- if (m_doc->nodeEdit.isContourLine)
- bb->ContourLine.putPoints(0, Clip.size()-(m_doc->nodeEdit.ClRe+2), Clip, m_doc->nodeEdit.ClRe+2);
+ if (m_doc->nodeEdit.isContourLine())
+ bb->ContourLine.putPoints(0, Clip.size()-(m_doc->nodeEdit.clre()+2), Clip, m_doc->nodeEdit.clre()+2);
else
- bb->PoLine.putPoints(0, Clip.size()-(m_doc->nodeEdit.ClRe+2), Clip, m_doc->nodeEdit.ClRe+2);
+ bb->PoLine.putPoints(0, Clip.size()-(m_doc->nodeEdit.clre()+2), Clip, m_doc->nodeEdit.clre()+2);
bb->setRotation(currItem->rotation());
m_doc->AdjustItemSize(bb, true, true);
bb->ClipEdited = true;
bb->setFrameType(currItem->frameType());
cli.resize(0);
- cli.putPoints(0, m_doc->nodeEdit.ClRe+2, Clip);
+ cli.putPoints(0, m_doc->nodeEdit.clre()+2, Clip);
currItem->PoLine = cli.copy();
m_doc->m_Selection->clear();
m_doc->m_Selection->addItem(currItem);
@@ -770,16 +771,16 @@
m_doc->nodeEdit.deselect();
currItem->ClipEdited = true;
edited = true;
- m_doc->nodeEdit.submode = NodeEditContext::MOVE_POINT;
+ m_doc->nodeEdit.setSubMode(NodeEditContext::MOVE_POINT);
currItem->setPolyClip(qRound(qMax(currItem->lineWidth() / 2.0, 1.0)));
emit m_view->PolyOpen();
}
}
}
}
- if ((m_doc->nodeEdit.submode == NodeEditContext::DEL_POINT) && m_doc->nodeEdit.hasNodeSelected())
- {
- if (!m_doc->nodeEdit.EdPoints)
+ if ((m_doc->nodeEdit.submode() == NodeEditContext::DEL_POINT) && m_doc->nodeEdit.hasNodeSelected())
+ {
+ if (!m_doc->nodeEdit.edPoints())
return;
if (!(currItem->isLine() || currItem->isPathText() || currItem->isPolyLine()))
{
@@ -808,7 +809,7 @@
}
else
{
- if (m_doc->nodeEdit.ClRe == static_cast<int>(StartInd))
+ if (m_doc->nodeEdit.clre() == static_cast<int>(StartInd))
{
if (!(currItem->isLine() || currItem->isPathText() || currItem->isPolyLine()))
{
@@ -826,19 +827,19 @@
cli.putPoints(cli.size(), Clip.size() - EndInd, Clip, EndInd);
}
}
- else if (m_doc->nodeEdit.ClRe == static_cast<int>(EndInd - 2))
- {
- Clip.remove(m_doc->nodeEdit.ClRe - 2, 4);
+ else if (m_doc->nodeEdit.clre() == static_cast<int>(EndInd - 2))
+ {
+ Clip.remove(m_doc->nodeEdit.clre() - 2, 4);
cli = Clip.copy();
}
else
{
- if (m_doc->nodeEdit.ClRe != 0)
- cli.putPoints(0, m_doc->nodeEdit.ClRe, Clip);
- cli.putPoints(cli.size(), Clip.size()-(m_doc->nodeEdit.ClRe + 4), Clip, m_doc->nodeEdit.ClRe+4);
- }
- }
- if (m_doc->nodeEdit.isContourLine)
+ if (m_doc->nodeEdit.clre() != 0)
+ cli.putPoints(0, m_doc->nodeEdit.clre(), Clip);
+ cli.putPoints(cli.size(), Clip.size()-(m_doc->nodeEdit.clre() + 4), Clip, m_doc->nodeEdit.clre()+4);
+ }
+ }
+ if (m_doc->nodeEdit.isContourLine())
currItem->ContourLine = cli.copy();
else
currItem->PoLine = cli.copy();
@@ -846,7 +847,7 @@
currItem->ClipEdited = true;
edited = true;
}
- if ((m_doc->nodeEdit.submode == NodeEditContext::ADD_POINT) && (m_doc->nodeEdit.ClRe2 != -1))
+ if ((m_doc->nodeEdit.submode() == NodeEditContext::ADD_POINT) && (m_doc->nodeEdit.clre2() != -1))
{
bool foundP = false;
uint seg = 0;
@@ -891,19 +892,19 @@
}
}
}
- cli.putPoints(0, m_doc->nodeEdit.ClRe2+2, Clip);
+ cli.putPoints(0, m_doc->nodeEdit.clre2()+2, Clip);
if (foundP)
{
npf2 = nearPoint;
FPoint base = cli.point(cli.size()-2);
FPoint c1 = cli.point(cli.size()-1);
- FPoint base2 = Clip.point(m_doc->nodeEdit.ClRe2+2);
- FPoint c2 = Clip.point(m_doc->nodeEdit.ClRe2+3);
+ FPoint base2 = Clip.point(m_doc->nodeEdit.clre2()+2);
+ FPoint c2 = Clip.point(m_doc->nodeEdit.clre2()+3);
if ((base == c1) && (base2 == c2))
{
cli.resize(cli.size()+4);
cli.putPoints(cli.size()-4, 4, npf2.x(), npf2.y(), npf2.x(), npf2.y(), npf2.x(), npf2.y(), npf2.x(), npf2.y());
- cli.putPoints(cli.size(), Clip.size()-(m_doc->nodeEdit.ClRe2 + 2), Clip, m_doc->nodeEdit.ClRe2+2);
+ cli.putPoints(cli.size(), Clip.size()-(m_doc->nodeEdit.clre2() + 2), Clip, m_doc->nodeEdit.clre2()+2);
}
else
{
@@ -915,7 +916,7 @@
cli.resize(cli.size()+4);
uint basind = cli.size()+1;
cli.putPoints(cli.size()-4, 4, npf2.x(), npf2.y(), cn2.x(), cn2.y(), npf2.x(), npf2.y(), cn3.x(), cn3.y());
- cli.putPoints(cli.size(), Clip.size()-(m_doc->nodeEdit.ClRe2 + 2), Clip, m_doc->nodeEdit.ClRe2+2);
+ cli.putPoints(cli.size(), Clip.size()-(m_doc->nodeEdit.clre2() + 2), Clip, m_doc->nodeEdit.clre2()+2);
cli.setPoint(basind, cn4);
}
}
@@ -923,13 +924,13 @@
{
cli.resize(cli.size()+4);
cli.putPoints(cli.size()-4, 4, npf2.x(), npf2.y(), npf2.x(), npf2.y(), npf2.x(), npf2.y(), npf2.x(), npf2.y());
- cli.putPoints(cli.size(), Clip.size()-(m_doc->nodeEdit.ClRe2 + 2), Clip, m_doc->nodeEdit.ClRe2+2);
- }
- if (m_doc->nodeEdit.isContourLine)
+ cli.putPoints(cli.size(), Clip.size()-(m_doc->nodeEdit.clre2() + 2), Clip, m_doc->nodeEdit.clre2()+2);
+ }
+ if (m_doc->nodeEdit.isContourLine())
currItem->ContourLine = cli.copy();
else
currItem->PoLine = cli.copy();
- m_doc->nodeEdit.ClRe2 = -1;
+ m_doc->nodeEdit.setClre2(-1);
currItem->ClipEdited = true;
edited = true;
}
@@ -956,7 +957,7 @@
currItem->update();
m_view->DrawNew();
}
- if ((m_doc->nodeEdit.SelNode.count() != 0) || ((m_doc->nodeEdit.SegP1 != -1) && (m_doc->nodeEdit.SegP2 != -1)) || (m_doc->nodeEdit.hasNodeSelected() && (!m_doc->nodeEdit.EdPoints)))
+ if ((m_doc->nodeEdit.selNode().count() != 0) || ((m_doc->nodeEdit.segP1() != -1) && (m_doc->nodeEdit.segP2() != -1)) || (m_doc->nodeEdit.hasNodeSelected() && (!m_doc->nodeEdit.edPoints())))
{
Mxp = m->x();
Myp = m->y();
@@ -981,7 +982,7 @@
bool CanvasMode_NodeEdit::handleNodeEditMove(QMouseEvent* m, QRect, PageItem* currItem, QTransform)
{
QTransform itemPos = currItem->getTransform();
- if ((currItem->isSymbol() || currItem->isGroup()) && (!m_doc->nodeEdit.isContourLine))
+ if ((currItem->isSymbol() || currItem->isGroup()) && (!m_doc->nodeEdit.isContourLine()))
{
if (currItem->imageFlippedH())
{
@@ -995,37 +996,37 @@
}
}
FPointArray Clip;
- m_doc->nodeEdit.ClRe2 = -1;
- m_doc->nodeEdit.SegP1 = -1;
- m_doc->nodeEdit.SegP2 = -1;
- if (m_doc->nodeEdit.isContourLine)
+ m_doc->nodeEdit.setClre2(-1);
+ m_doc->nodeEdit.setSegP1(-1);
+ m_doc->nodeEdit.setSegP2(-1);
+ if (m_doc->nodeEdit.isContourLine())
Clip = currItem->ContourLine;
else
Clip = currItem->PoLine;
- if ((m_doc->nodeEdit.submode == NodeEditContext::DEL_POINT) ||
- (m_doc->nodeEdit.submode == NodeEditContext::MOVE_POINT) ||
- (m_doc->nodeEdit.submode == NodeEditContext::SPLIT_PATH))
+ if ((m_doc->nodeEdit.submode() == NodeEditContext::DEL_POINT) ||
+ (m_doc->nodeEdit.submode() == NodeEditContext::MOVE_POINT) ||
+ (m_doc->nodeEdit.submode() == NodeEditContext::SPLIT_PATH))
{
for (int a=0; a < signed(Clip.size()); ++a)
{
- if (((m_doc->nodeEdit.EdPoints) && (a % 2 != 0)) || ((!m_doc->nodeEdit.EdPoints) && (a % 2 == 0)))
+ if (((m_doc->nodeEdit.edPoints()) && (a % 2 != 0)) || ((!m_doc->nodeEdit.edPoints()) && (a % 2 == 0)))
continue;
QPointF point = Clip.pointQF(a);
if (m_canvas->hitsCanvasPoint(m->globalPos(), itemPos.map(point)))
{
- if (m_doc->nodeEdit.submode == NodeEditContext::MOVE_POINT)
+ if (m_doc->nodeEdit.submode() == NodeEditContext::MOVE_POINT)
m_view->setCursor(QCursor(Qt::SizeAllCursor));
- if (m_doc->nodeEdit.submode == NodeEditContext::DEL_POINT)
+ if (m_doc->nodeEdit.submode() == NodeEditContext::DEL_POINT)
m_view->setCursor(QCursor(loadIcon("DelPoint.png"), 1, 1));
- if (m_doc->nodeEdit.submode == NodeEditContext::SPLIT_PATH)
+ if (m_doc->nodeEdit.submode() == NodeEditContext::SPLIT_PATH)
m_view->setCursor(QCursor(loadIcon("Split.png"), 1, 1));
return true;
}
}
}
- if ((m_doc->nodeEdit.submode == NodeEditContext::ADD_POINT) ||
- (m_doc->nodeEdit.submode == NodeEditContext::MOVE_POINT) ||
- (m_doc->nodeEdit.submode == NodeEditContext::SPLIT_PATH && m_doc->nodeEdit.EdPoints))
+ if ((m_doc->nodeEdit.submode() == NodeEditContext::ADD_POINT) ||
+ (m_doc->nodeEdit.submode() == NodeEditContext::MOVE_POINT) ||
+ (m_doc->nodeEdit.submode() == NodeEditContext::SPLIT_PATH && m_doc->nodeEdit.edPoints()))
{
for (int poi = 0; poi < Clip.size()-3; poi += 4)
{
@@ -1046,15 +1047,15 @@
QPointF pl = Bez.pointAtPercent(d);
if (m_canvas->hitsCanvasPoint(m->globalPos(), FPoint(pl.x(), pl.y())))
{
- if (m_doc->nodeEdit.submode == NodeEditContext::MOVE_POINT)
+ if (m_doc->nodeEdit.submode() == NodeEditContext::MOVE_POINT)
m_view->setCursor(QCursor(loadIcon("HandC.xpm")));
- else if (m_doc->nodeEdit.submode == NodeEditContext::ADD_POINT)
+ else if (m_doc->nodeEdit.submode() == NodeEditContext::ADD_POINT)
m_view->setCursor(QCursor(loadIcon("AddPoint.png"), 1, 1));
- else if (m_doc->nodeEdit.submode == NodeEditContext::SPLIT_PATH)
+ else if (m_doc->nodeEdit.submode() == NodeEditContext::SPLIT_PATH)
m_view->setCursor(QCursor(loadIcon("Split.png"), 1, 1));
else
m_view->setCursor(QCursor(Qt::ArrowCursor));
- m_doc->nodeEdit.ClRe2 = poi;
+ m_doc->nodeEdit.setClre2(poi);
return true;
}
}
@@ -1068,7 +1069,7 @@
void CanvasMode_NodeEdit::handleNodeEditDrag(QMouseEvent* m, PageItem* currItem)
{
FPoint npf;
- if ((m_canvas->m_viewMode.m_MouseButtonPressed) && !m_doc->nodeEdit.hasNodeSelected() && (m_doc->nodeEdit.SegP1 == -1) && (m_doc->nodeEdit.SegP2 == -1))
+ if ((m_canvas->m_viewMode.m_MouseButtonPressed) && !m_doc->nodeEdit.hasNodeSelected() && (m_doc->nodeEdit.segP1() == -1) && (m_doc->nodeEdit.segP2() == -1))
{
if (!m_rectangleSelect)
{
@@ -1084,36 +1085,36 @@
np = np * (1.0 / m_canvas->scale());
m_canvas->m_viewMode.operItemMoving = true;
currItem = m_doc->m_Selection->itemAt(0);
- if ((m_doc->nodeEdit.SegP1 != -1) && (m_doc->nodeEdit.SegP2 != -1))
- {
- if ((currItem->isSymbol() || currItem->isGroup()) && (!m_doc->nodeEdit.isContourLine))
+ if ((m_doc->nodeEdit.segP1() != -1) && (m_doc->nodeEdit.segP2() != -1))
+ {
+ if ((currItem->isSymbol() || currItem->isGroup()) && (!m_doc->nodeEdit.isContourLine()))
{
if (currItem->imageFlippedH())
np.setX(np.x() * -1);
if (currItem->imageFlippedV())
np.setY(np.y() * -1);
}
- if (m_doc->nodeEdit.isContourLine)
- npf = currItem->ContourLine.point(m_doc->nodeEdit.SegP2) + np;
+ if (m_doc->nodeEdit.isContourLine())
+ npf = currItem->ContourLine.point(m_doc->nodeEdit.segP2()) + np;
else
- npf = currItem->PoLine.point(m_doc->nodeEdit.SegP2) + np;
- m_doc->nodeEdit.ClRe = m_doc->nodeEdit.SegP2;
+ npf = currItem->PoLine.point(m_doc->nodeEdit.segP2()) + np;
+ m_doc->nodeEdit.setClre(m_doc->nodeEdit.segP2());
m_doc->nodeEdit.moveClipPoint(currItem, npf);
- if (m_doc->nodeEdit.isContourLine)
- npf = currItem->ContourLine.point(m_doc->nodeEdit.SegP1) + np;
+ if (m_doc->nodeEdit.isContourLine())
+ npf = currItem->ContourLine.point(m_doc->nodeEdit.segP1() ) + np;
else
- npf = currItem->PoLine.point(m_doc->nodeEdit.SegP1) + np;
- m_doc->nodeEdit.ClRe = m_doc->nodeEdit.SegP1;
+ npf = currItem->PoLine.point(m_doc->nodeEdit.segP1() ) + np;
+ m_doc->nodeEdit.setClre(m_doc->nodeEdit.segP1());
m_doc->nodeEdit.moveClipPoint(currItem, npf);
Mxp = newX;
Myp = newY;
}
else
{
- if ((m_doc->nodeEdit.SelNode.count() != 0) && (m_doc->nodeEdit.EdPoints))
- {
- int storedClRe = m_doc->nodeEdit.ClRe;
- if (m_doc->nodeEdit.SelNode.count() == 1)
+ if ((m_doc->nodeEdit.selNode().count() != 0) && (m_doc->nodeEdit.edPoints()))
+ {
+ int storedClRe = m_doc->nodeEdit.clre();
+ if (m_doc->nodeEdit.selNode().count() == 1)
{
npf = m_canvas->globalToCanvas(m->globalPos());
double nx = npf.x();
@@ -1124,7 +1125,7 @@
npf = FPoint(nx, ny);
QTransform pp = currItem->getTransform();
npf = npf.transformPoint(pp, true);
- if ((currItem->isSymbol() || currItem->isGroup()) && (!m_doc->nodeEdit.isContourLine))
+ if ((currItem->isSymbol() || currItem->isGroup()) && (!m_doc->nodeEdit.isContourLine()))
{
if (currItem->imageFlippedH())
{
@@ -1145,13 +1146,13 @@
//Control Modifier to have parallele shape
if (m->modifiers() == Qt::ControlModifier){
FPointArray cli;
- if (m_doc->nodeEdit.isContourLine)
+ if (m_doc->nodeEdit.isContourLine())
cli = currItem->ContourLine;
else
cli = currItem->PoLine;
FPoint npf1(npf);
int tmpNode;
- int curr = (m_doc->nodeEdit.ClRe==0)?cli.size()-2:m_doc->nodeEdit.ClRe;
+ int curr = (m_doc->nodeEdit.clre()==0) ? cli.size()-2 : m_doc->nodeEdit.clre();
int prev = (curr+cli.size()-4)%cli.size();
int next = (curr+4)%cli.size();
@@ -1168,24 +1169,24 @@
m_doc->nodeEdit.moveClipPoint(currItem, npf);
- m_doc->nodeEdit.ClRe=tmpNode;
-
- if (m_doc->nodeEdit.isContourLine)
- npf1.setX(currItem->ContourLine.point(m_doc->nodeEdit.ClRe).x());
+ m_doc->nodeEdit.setClre(tmpNode);
+
+ if (m_doc->nodeEdit.isContourLine())
+ npf1.setX(currItem->ContourLine.point(m_doc->nodeEdit.clre()).x());
else
- npf1.setX(currItem->PoLine.point(m_doc->nodeEdit.ClRe).x());
+ npf1.setX(currItem->PoLine.point(m_doc->nodeEdit.clre()).x());
m_doc->nodeEdit.moveClipPoint(currItem, npf1);
- if(m_doc->nodeEdit.ClRe==prev)
- m_doc->nodeEdit.ClRe=next;
+ if(m_doc->nodeEdit.clre()==prev)
+ m_doc->nodeEdit.setClre(next);
else
- m_doc->nodeEdit.ClRe=prev;
-
- if (m_doc->nodeEdit.isContourLine)
- npf.setY(currItem->ContourLine.point(m_doc->nodeEdit.ClRe).y());
+ m_doc->nodeEdit.setClre(prev);
+
+ if (m_doc->nodeEdit.isContourLine())
+ npf.setY(currItem->ContourLine.point(m_doc->nodeEdit.clre()).y());
else
- npf.setY(currItem->PoLine.point(m_doc->nodeEdit.ClRe).y());
+ npf.setY(currItem->PoLine.point(m_doc->nodeEdit.clre()).y());
}
@@ -1195,24 +1196,24 @@
}
else
{
- if ((currItem->isSymbol() || currItem->isGroup()) && (!m_doc->nodeEdit.isContourLine))
+ if ((currItem->isSymbol() || currItem->isGroup()) && (!m_doc->nodeEdit.isContourLine()))
{
if (currItem->imageFlippedH())
np.setX(np.x() * -1);
if (currItem->imageFlippedV())
np.setY(np.y() * -1);
}
- for (int itm = 0; itm < m_doc->nodeEdit.SelNode.count(); ++itm)
- {
- m_doc->nodeEdit.ClRe = m_doc->nodeEdit.SelNode.at(itm);
- if (m_doc->nodeEdit.isContourLine)
- npf = currItem->ContourLine.point(m_doc->nodeEdit.ClRe) + np;
+ for (int itm = 0; itm < m_doc->nodeEdit.selNode().count(); ++itm)
+ {
+ m_doc->nodeEdit.setClre(m_doc->nodeEdit.selNode().at(itm));
+ if (m_doc->nodeEdit.isContourLine())
+ npf = currItem->ContourLine.point(m_doc->nodeEdit.clre()) + np;
else
- npf = currItem->PoLine.point(m_doc->nodeEdit.ClRe) + np;
+ npf = currItem->PoLine.point(m_doc->nodeEdit.clre()) + np;
m_doc->nodeEdit.moveClipPoint(currItem, npf);
}
}
- m_doc->nodeEdit.ClRe = storedClRe;
+ m_doc->nodeEdit.setClre(storedClRe);
}
else
{
@@ -1225,7 +1226,7 @@
npf = FPoint(nx, ny);
QTransform pp = currItem->getTransform();
npf = npf.transformPoint(pp, true);
- if ((currItem->isSymbol() || currItem->isGroup()) && (!m_doc->nodeEdit.isContourLine))
+ if ((currItem->isSymbol() || currItem->isGroup()) && (!m_doc->nodeEdit.isContourLine()))
{
if (currItem->imageFlippedH())
{
Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19946&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Wed Mar 25 19:45:42 2015
@@ -5323,19 +5323,19 @@
restoreSplitItem(ss, isUndo);
else if (ss->contains("MIRROR_PATH_H"))
{
- bool editContour = m_Doc->nodeEdit.isContourLine;
- m_Doc->nodeEdit.isContourLine = ss->getBool("IS_CONTOUR");
+ bool editContour = m_Doc->nodeEdit.isContourLine();
+ m_Doc->nodeEdit.setIsContourLine(ss->getBool("IS_CONTOUR"));
select();
m_Doc->MirrorPolyH(m_Doc->m_Selection->itemAt(0));
- m_Doc->nodeEdit.isContourLine = editContour;
+ m_Doc->nodeEdit.setIsContourLine(editContour);
}
else if (ss->contains("MIRROR_PATH_V"))
{
- bool editContour = m_Doc->nodeEdit.isContourLine;
- m_Doc->nodeEdit.isContourLine = ss->getBool("IS_CONTOUR");
+ bool editContour = m_Doc->nodeEdit.isContourLine();
+ m_Doc->nodeEdit.setIsContourLine(ss->getBool("IS_CONTOUR"));
select();
m_Doc->MirrorPolyV(m_Doc->m_Selection->itemAt(0));
- m_Doc->nodeEdit.isContourLine = editContour;
+ m_Doc->nodeEdit.setIsContourLine(editContour);
}
else if (ss->contains("SEND_TO_LAYER"))
restoreLayer(ss, isUndo);
@@ -7450,8 +7450,8 @@
int rot = state->getInt("ROT");
ScribusView* view = m_Doc->view();
double scaling = state->getDouble("SCALING");
- bool editContour = m_Doc->nodeEdit.isContourLine;
- m_Doc->nodeEdit.isContourLine = isContour;
+ bool editContour = m_Doc->nodeEdit.isContourLine();
+ m_Doc->nodeEdit.setIsContourLine(isContour);
select();
if (isUndo)
{
@@ -7465,7 +7465,7 @@
scaling = ((100.0 / (100.0 - scaling)) - 1.0) * 100.0;
}
view->TransformPoly(mode, rot, scaling);
- m_Doc->nodeEdit.isContourLine = editContour;
+ m_Doc->nodeEdit.setIsContourLine(editContour);
}
void PageItem::restoreUniteItem(SimpleState *state, bool isUndo)
Modified: trunk/Scribus/scribus/plugins/tools/subdivide/subdivide.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19946&path=/trunk/Scribus/scribus/plugins/tools/subdivide/subdivide.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/tools/subdivide/subdivide.cpp (original)
+++ trunk/Scribus/scribus/plugins/tools/subdivide/subdivide.cpp Wed Mar 25 19:45:42 2015
@@ -116,7 +116,7 @@
{
FPointArray points;
PageItem *currItem = currDoc->m_Selection->itemAt(aa);
- if (currDoc->nodeEdit.isContourLine)
+ if (currDoc->nodeEdit.isContourLine())
{
uint psize = currItem->ContourLine.size();
for (uint a = 0; a < psize-3; a += 4)
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19946&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Wed Mar 25 19:45:42 2015
@@ -1877,7 +1877,7 @@
double xposOrig = currItem->xPos();
double yposOrig = currItem->yPos();
doc->AdjustItemSize(currItem);
- if (!doc->nodeEdit.isContourLine)
+ if (!doc->nodeEdit.isContourLine())
currItem->ContourLine.translate(xposOrig - currItem->xPos(),yposOrig - currItem->yPos());
currItem->update();
}
Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19946&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Wed Mar 25 19:45:42 2015
@@ -9868,7 +9868,7 @@
{
currItem->ClipEdited = true;
QTransform ma;
- if (nodeEdit.isContourLine)
+ if (nodeEdit.isContourLine())
{
if (UndoManager::undoEnabled())
{
@@ -9912,7 +9912,7 @@
{
currItem->ClipEdited = true;
QTransform ma;
- if (nodeEdit.isContourLine)
+ if (nodeEdit.isContourLine())
{
if (UndoManager::undoEnabled())
{
@@ -16046,482 +16046,7 @@
changed();
}
-NodeEditContext::NodeEditContext()
-: submode(MOVE_POINT), isContourLine(false), oldClip(NULL), nodeTransaction(NULL),
-ClRe(-1), ClRe2(-1), SegP1(-1), SegP2(-1), EdPoints(true), MoveSym(false), SelNode()
-{
-}
-
-bool NodeEditContext::hasNodeSelected()
-{
- return ClRe != -1;
-}
-
-
-void NodeEditContext::deselect()
-{
- ClRe = -1;
- SelNode.clear();
-}
-
-void NodeEditContext::reset()
-{
- submode = MOVE_POINT;
- isContourLine = false;
- ClRe = -1;
- ClRe2 = -1;
- SegP1 = -1;
- SegP2 = -1;
- delete oldClip;
- oldClip = NULL;
- nodeTransaction.reset();
- MoveSym = false;
- SelNode.clear();
-}
-
-
-
-FPointArray NodeEditContext::beginTransaction(PageItem* currItem)
-{
- ScribusDoc* Doc = currItem->doc();
- UndoManager* undoManager = UndoManager::instance();
-
- FPointArray Clip;
- QString uAction;
- if (Doc->nodeEdit.isContourLine)
- {
- Clip = currItem->ContourLine;
- // isContourLine = true;
- uAction = Um::EditContour;
- }
- else
- {
- Clip = currItem->PoLine;
- // isContourLine = false;
- uAction = Um::EditShape;
- }
- oldClip = new FPointArray(Clip);
- oldItemX = currItem->xPos();
- oldItemY = currItem->yPos();
- if (UndoManager::undoEnabled())
- nodeTransaction = undoManager->beginTransaction(currItem->getUName(), currItem->getUPixmap(), uAction);
- Doc->nodeEdit.deselect();
- return Clip;
-}
-
-
-
-void NodeEditContext::finishTransaction(PageItem* currItem)
-{
- ScribusDoc* Doc = currItem->doc();
- UndoManager* undoManager = UndoManager::instance();
-
- if (nodeTransaction) // is there the old clip stored for the undo action
- {
- FPointArray newClip(Doc->nodeEdit.isContourLine ? currItem->ContourLine : currItem->PoLine);
- if (*oldClip != newClip && UndoManager::undoEnabled())
- {
- QString name = Doc->nodeEdit.isContourLine ? Um::EditContour : Um::EditShape;
- ScItemState<QPair<FPointArray, FPointArray> > *state =
- new ScItemState<QPair<FPointArray, FPointArray> >(name);
- state->set("EDIT_SHAPE_OR_CONTOUR", "edit_shape_or_contour");
- state->set("IS_CONTOUR", Doc->nodeEdit.isContourLine);
- state->setItem(qMakePair(*oldClip, newClip));
- state->set("OLD_X", oldItemX);
- state->set("OLD_Y", oldItemY);
- state->set("NEW_X", currItem->xPos());
- state->set("NEW_Y", currItem->yPos());
- undoManager->action(currItem, state);
- nodeTransaction.commit();
- }
- else
- nodeTransaction.cancel();
-
- nodeTransaction.reset();
- delete oldClip;
- oldClip = 0;
- }
-}
-
-
-/**
- first part: create a new UndoState or cancel the current transaction
- */
-ScItemState<QPair<FPointArray, FPointArray> >* NodeEditContext::finishTransaction1(PageItem* currItem)
-{
- ScribusDoc* Doc = currItem->doc();
- UndoManager* undoManager = UndoManager::instance();
- ScItemState<QPair<FPointArray, FPointArray> >* state = NULL;
-
- if (nodeTransaction) // is there the old clip stored for the undo action
- {
- FPointArray newClip(Doc->nodeEdit.isContourLine ? currItem->ContourLine : currItem->PoLine);
- if (*oldClip != newClip && UndoManager::undoEnabled())
- {
- QString name = Doc->nodeEdit.isContourLine ? Um::EditContour : Um::EditShape;
- state = new ScItemState<QPair<FPointArray, FPointArray> >(name);
- state->set("EDIT_SHAPE_OR_CONTOUR", "edit_shape_or_contour");
- state->set("IS_CONTOUR", Doc->nodeEdit.isContourLine);
- state->setItem(qMakePair(*oldClip, newClip));
- undoManager->setUndoEnabled(false);
- }
- else
- {
- delete oldClip;
- oldClip = 0;
- nodeTransaction.cancel();
- }
- }
- return state;
-}
-
-/**
- second part: take the UndoState returned from finishTransaction1() and commit it
-*/
-void NodeEditContext::finishTransaction2(PageItem* currItem, ScItemState<QPair<FPointArray, FPointArray> >* state)
-{
- UndoManager* undoManager = UndoManager::instance();
-
- state->set("OLD_X", oldItemX);
- state->set("OLD_Y", oldItemY);
- state->set("NEW_X", currItem->xPos());
- state->set("NEW_Y", currItem->yPos());
- undoManager->setUndoEnabled(true);
- undoManager->action(currItem, state);
- nodeTransaction.commit();
- nodeTransaction.reset();
- delete oldClip;
- oldClip = 0;
-}
-
-
-//CB-->Doc
-void NodeEditContext::moveClipPoint(PageItem *currItem, FPoint ip)
-{
- ScribusDoc* Doc = currItem->doc();
- if (((EdPoints) && (ClRe % 2 != 0)) || ((!EdPoints) && (ClRe % 2 == 0)))
- return;
- double xposOrig = currItem->xPos();
- double yposOrig = currItem->yPos();
- currItem->ClipEdited = true;
- FPointArray Clip;
- if (isContourLine)
- Clip = currItem->ContourLine.copy();
- else
- Clip = currItem->PoLine.copy();
- currItem->FrameType = 3;
- uint EndInd = Clip.size();
- uint StartInd = 0;
- for (int n = ClRe; n < Clip.size(); ++n)
- {
- if (Clip.isMarker(n))
- {
- EndInd = n;
- break;
- }
- }
- if (ClRe > 0)
- {
- for (uint n2 = ClRe; n2 > 0; n2--)
- {
- if (n2 == 0)
- break;
- if (Clip.isMarker(n2))
- {
- StartInd = n2 + 1;
- break;
- }
- }
- }
- FPoint np(ip);
- if (hasNodeSelected())
- {
- if ((np.x() < 0) && (!isContourLine) && (!(currItem->isGroup() || currItem->isSymbol())))
- {
- Doc->SizeItem(currItem->width() - np.x(), currItem->height(), currItem, false, false, false);
- if (currItem->rotation() != 0)
- {
- FPoint npv(np.x(), 0);
- Doc->MoveRotated(currItem, npv);
- }
- else
- Doc->MoveItem(np.x(), 0, currItem);
- Clip.translate(-np.x(), 0);
- if (!currItem->imageFlippedH())
- currItem->moveImageInFrame(-np.x()/currItem->imageXScale(), 0);
- np.setX(0);
- }
- if ((np.y() < 0) && (!isContourLine) && (!(currItem->isGroup() || currItem->isSymbol())))
- {
- Doc->SizeItem(currItem->width(), currItem->height() - np.y(), currItem, false, false, false);
- if (currItem->rotation() != 0)
- {
- FPoint npv(0, np.y());
- Doc->MoveRotated(currItem, npv);
- }
- else
- Doc->MoveItem(0, np.y(), currItem);
- Clip.translate(0, -np.y());
- if (!currItem->imageFlippedV())
- currItem->moveImageInFrame(0, -np.y()/currItem->imageYScale());
- np.setY(0);
- }
- update(QPointF(np.x(), np.y()));
- if ((ClRe+1 < static_cast<int>(EndInd)) && (ClRe % 2 == 0))
- {
- FPoint ap(Clip.point(ClRe));
- FPoint ap2(Clip.point(ClRe+1));
- ap2.setX(ap2.x() - (ap.x() - np.x()));
- ap2.setY(ap2.y() - (ap.y() - np.y()));
- Clip.setPoint(ClRe+1, ap2);
- }
- Clip.setPoint(ClRe, np);
- if (((ClRe % 4 != 0) && (ClRe % 2 == 0)) && (ClRe+3 < static_cast<int>(EndInd)) && (ClRe != static_cast<int>(StartInd)))
- {
- FPoint ap(Clip.point(ClRe+2));
- FPoint ap2(Clip.point(ClRe+3));
- ap2.setX(ap2.x() - (ap.x() - np.x()));
- ap2.setY(ap2.y() - (ap.y() - np.y()));
- Clip.setPoint(ClRe+3, ap2);
- Clip.setPoint(ClRe+2, np);
- }
- if ((ClRe % 4 == 0) && (ClRe+3 < static_cast<int>(EndInd)) && (ClRe != static_cast<int>(StartInd)))
- {
- FPoint ap(Clip.point(ClRe-2));
- FPoint ap2(Clip.point(ClRe-1));
- ap2.setX(ap2.x() - (ap.x() - np.x()));
- ap2.setY(ap2.y() - (ap.y() - np.y()));
- Clip.setPoint(ClRe-1, ap2);
- Clip.setPoint(ClRe-2, np);
- }
- if (((ClRe == static_cast<int>(StartInd)) || (ClRe == static_cast<int>(EndInd-2))) &&
- ((currItem->itemType() == PageItem::Polygon)
- || (currItem->itemType() == PageItem::Group)
- || (currItem->itemType() == PageItem::Symbol)
- || (currItem->itemType() == PageItem::TextFrame)
- || (currItem->itemType() == PageItem::ImageFrame)))
- {
- if (ClRe == static_cast<int>(StartInd))
- {
- FPoint ap(Clip.point(EndInd-2));
- FPoint ap2(Clip.point(EndInd-1));
- ap2.setX(ap2.x() - (ap.x() - np.x()));
- ap2.setY(ap2.y() - (ap.y() - np.y()));
- Clip.setPoint(EndInd-2, Clip.point(StartInd));
- Clip.setPoint(EndInd-1, ap2);
- }
- else
- {
- FPoint ap(Clip.point(StartInd));
- FPoint ap2(Clip.point(StartInd + 1));
- ap2.setX(ap2.x() - (ap.x() - np.x()));
- ap2.setY(ap2.y() - (ap.y() - np.y()));
- Clip.setPoint(StartInd, Clip.point(EndInd-2));
- Clip.setPoint(StartInd + 1, ap2);
- }
- }
- if (((ClRe == static_cast<int>(StartInd+1)) || (ClRe == static_cast<int>(EndInd-1))) &&
- ((currItem->itemType() == PageItem::Polygon)
- || (currItem->itemType() == PageItem::Group)
- || (currItem->itemType() == PageItem::Symbol)
- || (currItem->itemType() == PageItem::TextFrame)
- || (currItem->itemType() == PageItem::ImageFrame)) &&
- (MoveSym))
- {
- uint kon = 0;
- if (ClRe == static_cast<int>(StartInd+1))
- kon = EndInd-1;
- else
- kon = StartInd + 1;
- FPoint lxy(Clip.point(ClRe-1));
- FPoint lk(Clip.point(ClRe));
- double dx = lxy.x() - lk.x();
- double dy = lxy.y() - lk.y();
- lk.setX(lk.x() + dx*2);
- lk.setY(lk.y() + dy*2);
- Clip.setPoint(kon, lk);
- }
- if ((ClRe % 2 != 0) && (MoveSym) && (ClRe != static_cast<int>(StartInd + 1)) && (ClRe != static_cast<int>(EndInd-1)))
- {
- uint kon = 0;
- if ((ClRe+1) % 4 == 0)
- kon = ClRe + 2;
- else
- kon = ClRe - 2;
- FPoint lxy(Clip.point(ClRe-1));
- FPoint lk(Clip.point(ClRe));
- double dx = lxy.x() - lk.x();
- double dy = lxy.y() - lk.y();
- lk.setX(lk.x() + dx*2);
- lk.setY(lk.y() + dy*2);
- Clip.setPoint(kon, lk);
- }
- if (Doc->nodeEdit.isContourLine)
- currItem->ContourLine = Clip.copy();
- else
- currItem->PoLine = Clip.copy();
- currItem->Clip = FlattenPath(currItem->PoLine, currItem->Segments);
- }
- if (!isContourLine)
- currItem->ContourLine.translate(xposOrig - currItem->xPos(), yposOrig - currItem->yPos());
-}
-
-
-void NodeEditContext::reset1Control(PageItem* currItem)
-{
- ScribusDoc* Doc = currItem->doc();
- if ((ClRe < 0) || (ClRe % 2 == 0))
- return;
- UndoManager* undoManager = UndoManager::instance();
-
- // do no record anything else but the core reset points action
- undoManager->setUndoEnabled(false);
-
- oldClip = new FPointArray(Doc->nodeEdit.isContourLine ? currItem->ContourLine.copy() : currItem->PoLine.copy());
- oldItemX = currItem->xPos();
- oldItemY = currItem->yPos();
- currItem->ClipEdited = true;
- FPoint np;
- if (Doc->nodeEdit.isContourLine)
- np = currItem->ContourLine.point(Doc->nodeEdit.ClRe-1);
- else
- np = currItem->PoLine.point(Doc->nodeEdit.ClRe-1);
- currItem->OldB2 = currItem->width();
- currItem->OldH2 = currItem->height();
- if (Doc->nodeEdit.isContourLine)
- {
- currItem->ContourLine.setPoint(Doc->nodeEdit.ClRe, np);
- Doc->regionsChanged()->update(QRectF());
- currItem->FrameOnly = true;
- currItem->update();
- }
- else
- {
- currItem->PoLine.setPoint(Doc->nodeEdit.ClRe, np);
- // if (!(currItem->isGroup() || currItem->isSymbol()))
- Doc->AdjustItemSize(currItem, true, true);
- Doc->regionsChanged()->update(QRectF());
- }
- undoManager->setUndoEnabled(true);
- FPointArray newClip(Doc->nodeEdit.isContourLine ? currItem->ContourLine : currItem->PoLine);
- if (*oldClip != newClip && UndoManager::undoEnabled())
- {
- ScItemState<QPair<FPointArray, FPointArray> > *state =
- new ScItemState<QPair<FPointArray, FPointArray> >(Um::ResetControlPoint, "",
- currItem->getUPixmap());
- state->set("EDIT_SHAPE_OR_CONTOUR", "edit_shape_or_contour");
- state->set("IS_CONTOUR", Doc->nodeEdit.isContourLine);
- state->setItem(qMakePair(*oldClip, newClip));
- state->set("OLD_X", oldItemX);
- state->set("OLD_Y", oldItemY);
- state->set("NEW_X", currItem->xPos());
- state->set("NEW_Y", currItem->yPos());
- undoManager->action(currItem, state);
- }
- delete oldClip;
- oldClip = 0;
-}
-
-
-void NodeEditContext::resetControl(PageItem* currItem)
-{
- ScribusDoc* Doc = currItem->doc();
- if (ClRe < 0)
- return;
- UndoManager* undoManager = UndoManager::instance();
-
- // do no record anything else but the core reset points action
- undoManager->setUndoEnabled(false);
-
- oldClip = new FPointArray(Doc->nodeEdit.isContourLine ? currItem->ContourLine.copy() : currItem->PoLine.copy());
- oldItemX = currItem->xPos();
- oldItemY = currItem->yPos();
- currItem->ClipEdited = true;
- FPointArray Clip;
- if (Doc->nodeEdit.isContourLine)
- Clip = currItem->ContourLine.copy();
- else
- Clip = currItem->PoLine.copy();
- int EndInd = Clip.size();
- int StartInd = 0;
- for (int n = ClRe; n < Clip.size(); ++n)
- {
- if (Clip.isMarker(n))
- {
- EndInd = n;
- break;
- }
- }
- if (ClRe > 0)
- {
- for (uint n2 = ClRe; n2 > 0; n2--)
- {
- if (n2 == 0)
- break;
- if (Clip.isMarker(n2))
- {
- StartInd = n2 + 1;
- break;
- }
- }
- }
- FPoint np = Clip.point(Doc->nodeEdit.ClRe);
- currItem->OldB2 = currItem->width();
- currItem->OldH2 = currItem->height();
- if ((Doc->nodeEdit.ClRe == StartInd) || (Doc->nodeEdit.ClRe == EndInd-2))
- {
- if (currItem->asPolyLine())
- {
- if (Doc->nodeEdit.ClRe == StartInd)
- Clip.setPoint(StartInd+1, np);
- else
- Clip.setPoint(EndInd-1, np);
- }
- else
- {
- Clip.setPoint(StartInd+1, np);
- Clip.setPoint(EndInd-1, np);
- }
- }
- else
- {
- Clip.setPoint(Doc->nodeEdit.ClRe+1, np);
- Clip.setPoint((Doc->nodeEdit.ClRe % 4 != 0 ? Doc->nodeEdit.ClRe + 3 : Doc->nodeEdit.ClRe - 1), np);
- }
- if (!Doc->nodeEdit.isContourLine)
- {
- currItem->PoLine = Clip.copy();
- // if (!(currItem->isGroup() || currItem->isSymbol()))
- Doc->AdjustItemSize(currItem, true, true);
- Doc->regionsChanged()->update(QRectF());
- }
- else
- {
- currItem->ContourLine = Clip.copy();
- Doc->regionsChanged()->update(QRectF());
- }
- Doc->update();
-
- undoManager->setUndoEnabled(true);
- FPointArray newClip(Doc->nodeEdit.isContourLine ? currItem->ContourLine : currItem->PoLine);
- if (*oldClip != newClip && UndoManager::undoEnabled())
- {
- ScItemState<QPair<FPointArray, FPointArray> > *state =
- new ScItemState<QPair<FPointArray, FPointArray> >(Um::ResetControlPoints, "",
- currItem->getUPixmap());
- state->set("EDIT_SHAPE_OR_CONTOUR", "edit_shape_or_contour");
- state->set("IS_CONTOUR", Doc->nodeEdit.isContourLine);
- state->setItem(qMakePair(*oldClip, newClip));
- state->set("OLD_X", oldItemX);
- state->set("OLD_Y", oldItemY);
- state->set("NEW_X", currItem->xPos());
- state->set("NEW_Y", currItem->yPos());
- undoManager->action(currItem, state);
- }
- delete oldClip;
- oldClip = 0;
-
-}
+
void ScribusDoc::itemSelection_SetColorProfile(const QString & profileName, Selection * customSelection)
{
Modified: trunk/Scribus/scribus/scribusdoc.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19946&path=/trunk/Scribus/scribus/scribusdoc.h
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.h (original)
+++ trunk/Scribus/scribus/scribusdoc.h Wed Mar 25 19:45:42 2015
@@ -44,6 +44,7 @@
#include "documentinformation.h"
#include "numeration.h"
#include "marks.h"
+#include "nodeeditcontext.h"
#include "notesstyles.h"
#include "observable.h"
#include "pageitem.h"
@@ -82,39 +83,6 @@
class NotesStyle;
class TextNote;
-struct SCRIBUS_API NodeEditContext : public MassObservable<QPointF>
-{
- enum SubMode { MOVE_POINT = 0, ADD_POINT = 1, DEL_POINT = 2, SPLIT_PATH = 3 };
- int submode;
- bool isContourLine;
- FPointArray *oldClip;
- UndoTransaction nodeTransaction;
- double oldItemX;
- double oldItemY;
-
- int ClRe;
- int ClRe2;
- int SegP1;
- int SegP2;
- bool EdPoints;
- bool MoveSym;
- QList<int> SelNode;
-
- NodeEditContext();
-
- bool hasNodeSelected();
- void deselect();
-
- void reset();
-
- void reset1Control(PageItem* currItem);
- void resetControl(PageItem* currItem);
- FPointArray beginTransaction(PageItem* currItem);
- void finishTransaction(PageItem* currItem);
- ScItemState<QPair<FPointArray, FPointArray> >* finishTransaction1(PageItem* currItem);
- void finishTransaction2(PageItem* currItem, ScItemState<QPair<FPointArray, FPointArray> >* state);
- void moveClipPoint(PageItem *currItem, FPoint ip);
-};
/**! \brief the Document Class
@@ -1082,8 +1050,6 @@
void itemSelection_SetAlignment(int w, Selection* customSelection=0);
void itemSelection_SetLineSpacing(double w, Selection* customSelection=0);
void itemSelection_SetLineSpacingMode(int w, Selection* customSelection=0);
- //void ChLocalXY(double x, double y);
- //void ChLocalSc(double x, double y);
void itemSetFont(const QString& newFont);
void itemSelection_SetFont(QString fon, Selection* customSelection=0);
void itemSelection_SetFillColor(QString farbe, Selection* customSelection=0);
@@ -1106,8 +1072,6 @@
void itemSelection_SetCompressionQuality(int cqIndex, Selection* customSelection=0);
void itemSelection_SetTracking(int us, Selection* customSelection=0);
void itemSelection_SetFontSize(int size, Selection* customSelection=0);
- //void FlipImageH();
- //void FlipImageV();
void MirrorPolyH(PageItem *currItem);
void MirrorPolyV(PageItem *currItem);
bool getItem(PageItem **currItem, int nr = -1);
Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19946&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Wed Mar 25 19:45:42 2015
@@ -393,9 +393,9 @@
void ScribusView::startGesture(CanvasGesture* gesture)
{
-// qDebug() << "start gesture" << typeid(*m_canvasMode).name()
-// << "---->"
-// << typeid(*gesture).name();
+ qDebug() << "start gesture" << typeid(*m_canvasMode).name()
+ << "---->"
+ << typeid(*gesture).name();
if (m_canvasMode != gesture)
{
m_canvasMode->deactivate(true);
@@ -409,7 +409,7 @@
void ScribusView::stopGesture()
{
-// qDebug() << "stop gesture" << typeid(*m_canvasMode).name() << (m_canvasMode->delegate() != 0);
+ qDebug() << "stop gesture" << typeid(*m_canvasMode).name() << (m_canvasMode->delegate() != 0);
if (m_canvasMode->delegate())
{
m_canvasMode->deactivate(false);
@@ -1394,7 +1394,7 @@
currItem->ClipEdited = true;
QTransform ma;
undoManager->setUndoEnabled(false);
- if (Doc->nodeEdit.isContourLine)
+ if (Doc->nodeEdit.isContourLine())
{
FPoint tp2(getMinClipF(&currItem->ContourLine));
FPoint tp(getMaxClipF(&currItem->ContourLine));
@@ -2125,12 +2125,12 @@
HaveSelRect = false;
Magnify = false;
FirstPoly = true;
- Doc->nodeEdit.EdPoints = true;
+ Doc->nodeEdit.setEdPoints(true);
//GroupSel = false;
DraggedGroup = false;
//FIXME:av MoveGY = false;
//FIXME:av MoveGX = false;
- Doc->nodeEdit.isContourLine = false;
+ Doc->nodeEdit.setIsContourLine(false);
return fe;
}
Modified: trunk/Scribus/scribus/ui/nodeeditpalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19946&path=/trunk/Scribus/scribus/ui/nodeeditpalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/nodeeditpalette.cpp (original)
+++ trunk/Scribus/scribus/ui/nodeeditpalette.cpp Wed Mar 25 19:45:42 2015
@@ -401,7 +401,7 @@
if (m_doc==0)
return;
MoveN();
- m_doc->nodeEdit.submode = NodeEditContext::SPLIT_PATH;
+ m_doc->nodeEdit.setSubMode(NodeEditContext::SPLIT_PATH);
PolySplit->setChecked(true);
}
@@ -589,7 +589,7 @@
{
if (m_doc==0)
return;
- if (m_doc->nodeEdit.submode == NodeEditContext::MOVE_POINT)
+ if (m_doc->nodeEdit.submode() == NodeEditContext::MOVE_POINT)
{
PageItem *currItem = m_doc->m_Selection->itemAt(0);
FPoint zp;
@@ -614,7 +614,7 @@
void NodePalette::SetSym()
{
if (m_doc != 0)
- m_doc->nodeEdit.MoveSym = true;
+ m_doc->nodeEdit.setMoveSym(true);
SymMove->setChecked(true);
AsymMove->setChecked(false);
PolySplit->setChecked(false);
@@ -623,7 +623,7 @@
void NodePalette::SetAsym()
{
if (m_doc != 0)
- m_doc->nodeEdit.MoveSym = false;
+ m_doc->nodeEdit.setMoveSym(false);
SymMove->setChecked(false);
AsymMove->setChecked(true);
PolySplit->setChecked(false);
@@ -662,8 +662,8 @@
Clip = m_doc->m_Selection->itemAt(0)->ContourLine;
else
Clip = m_doc->m_Selection->itemAt(0)->PoLine;
- if (m_doc->nodeEdit.SelNode.count() != 0)
- np = Clip.point(m_doc->nodeEdit.SelNode.at(0));
+ if (m_doc->nodeEdit.selNode().count() != 0)
+ np = Clip.point(m_doc->nodeEdit.selNode().at(0));
if (AbsMode->isChecked())
{
XSpin->setMinimum(-16777215);
@@ -690,12 +690,12 @@
disconnect(YSpin, SIGNAL(valueChanged(double)), this, SLOT(MovePoint()));
if (m_doc != 0)
{
- m_doc->nodeEdit.isContourLine = EditCont->isChecked();
- m_doc->nodeEdit.submode = NodeEditContext::MOVE_POINT;
- m_doc->nodeEdit.ClRe = -1;
- m_doc->nodeEdit.ClRe2 = -1;
- m_doc->nodeEdit.SegP1 = -1;
- m_doc->nodeEdit.SegP2 = -1;
+ m_doc->nodeEdit.setIsContourLine(EditCont->isChecked());
+ m_doc->nodeEdit.setSubMode(NodeEditContext::MOVE_POINT);
+ m_doc->nodeEdit.setClre(-1);
+ m_doc->nodeEdit.setClre2(-1);
+ m_doc->nodeEdit.setSegP1(-1);
+ m_doc->nodeEdit.setSegP2(-1);
if (EditCont->isChecked())
{
BezierClose->setEnabled(false);
@@ -733,7 +733,7 @@
if (m_doc==0)
return;
bool setter = have ? true : false;
- if (m_doc->nodeEdit.SelNode.count() > 1)
+ if (m_doc->nodeEdit.selNode().count() > 1)
{
XSpin->setEnabled(false);
YSpin->setEnabled(false);
@@ -745,7 +745,7 @@
}
if (setter == true)
{
- if (m_doc->nodeEdit.EdPoints)
+ if (m_doc->nodeEdit.edPoints())
ResNode->setEnabled(setter);
else
Res1Node->setEnabled(setter);
@@ -755,7 +755,7 @@
ResNode->setEnabled(setter);
Res1Node->setEnabled(setter);
}
- if (m_doc->nodeEdit.submode == NodeEditContext::MOVE_POINT)
+ if (m_doc->nodeEdit.submode() == NodeEditContext::MOVE_POINT)
{
disconnect(AsymMove, SIGNAL(clicked()), this, SLOT(SetAsym()));
disconnect(SymMove, SIGNAL(clicked()), this, SLOT(SetSym()));
@@ -772,12 +772,12 @@
connect(AsymMove, SIGNAL(clicked()), this, SLOT(SetAsym()));
connect(SymMove, SIGNAL(clicked()), this, SLOT(SetSym()));
}
- if (m_doc->nodeEdit.submode == NodeEditContext::DEL_POINT)
+ if (m_doc->nodeEdit.submode() == NodeEditContext::DEL_POINT)
{
uint cc;
bool leaveEd = false;
PageItem*currItem=m_doc->m_Selection->itemAt(0);
- if (m_doc->nodeEdit.isContourLine)
+ if (m_doc->nodeEdit.isContourLine())
cc = currItem->ContourLine.size();
else
cc = currItem->PoLine.size();
@@ -803,12 +803,12 @@
{
if (m_doc==0)
return;
- m_doc->nodeEdit.submode = NodeEditContext::MOVE_POINT;
- m_doc->nodeEdit.EdPoints = false;
- m_doc->nodeEdit.ClRe = -1;
- m_doc->nodeEdit.ClRe2 = -1;
- m_doc->nodeEdit.SegP1 = -1;
- m_doc->nodeEdit.SegP2 = -1;
+ m_doc->nodeEdit.setSubMode(NodeEditContext::MOVE_POINT);
+ m_doc->nodeEdit.setEdPoints(false);
+ m_doc->nodeEdit.setClre(-1);
+ m_doc->nodeEdit.setClre2(-1);
+ m_doc->nodeEdit.setSegP1(-1);
+ m_doc->nodeEdit.setSegP2(-1);
if (m_doc->m_Selection->count() > 0)
m_doc->m_Selection->itemAt(0)->update();
SymMove->setEnabled(true);
@@ -828,12 +828,12 @@
{
if (m_doc==0)
return;
- m_doc->nodeEdit.submode = NodeEditContext::MOVE_POINT;
- m_doc->nodeEdit.EdPoints = true;
- m_doc->nodeEdit.ClRe = -1;
- m_doc->nodeEdit.ClRe2 = -1;
- m_doc->nodeEdit.SegP1 = -1;
- m_doc->nodeEdit.SegP2 = -1;
+ m_doc->nodeEdit.setSubMode(NodeEditContext::MOVE_POINT);
+ m_doc->nodeEdit.setEdPoints(true);
+ m_doc->nodeEdit.setClre(-1);
+ m_doc->nodeEdit.setClre2(-1);
+ m_doc->nodeEdit.setSegP1(-1);
+ m_doc->nodeEdit.setSegP2(-1);
if (m_doc->m_Selection->count() > 0)
m_doc->m_Selection->itemAt(0)->update();
ResNode->setEnabled(false);
@@ -853,8 +853,8 @@
{
if (m_doc==0)
return;
- m_doc->nodeEdit.submode = NodeEditContext::ADD_POINT;
- m_doc->nodeEdit.EdPoints = true;
+ m_doc->nodeEdit.setSubMode(NodeEditContext::ADD_POINT);
+ m_doc->nodeEdit.setEdPoints(true);
SymMove->setEnabled(false);
AsymMove->setEnabled(false);
ResNode->setEnabled(false);
@@ -868,8 +868,8 @@
{
if (m_doc==0)
return;
- m_doc->nodeEdit.submode = NodeEditContext::DEL_POINT;
- m_doc->nodeEdit.EdPoints = true;
+ m_doc->nodeEdit.setSubMode(NodeEditContext::DEL_POINT);
+ m_doc->nodeEdit.setEdPoints(true);
SymMove->setEnabled(false);
AsymMove->setEnabled(false);
ResNode->setEnabled(false);
@@ -884,11 +884,11 @@
if (m_doc != 0)
{
MoveN();
- m_doc->nodeEdit.ClRe = -1;
- m_doc->nodeEdit.ClRe2 = -1;
- m_doc->nodeEdit.SegP1 = -1;
- m_doc->nodeEdit.SegP2 = -1;
- m_doc->nodeEdit.SelNode.clear();
+ m_doc->nodeEdit.setClre(-1);
+ m_doc->nodeEdit.setClre2(-1);
+ m_doc->nodeEdit.setSegP1(-1);
+ m_doc->nodeEdit.setSegP2(-1);
+ m_doc->nodeEdit.selNode().clear();
PageItem *currItem = m_doc->m_Selection->itemAt(0);
if (currItem->itemType() == PageItem::PathText)
currItem->updatePolyClip();
@@ -904,11 +904,11 @@
if (m_doc != 0)
{
MoveN();
- m_doc->nodeEdit.ClRe = -1;
- m_doc->nodeEdit.ClRe2 = -1;
- m_doc->nodeEdit.SegP1 = -1;
- m_doc->nodeEdit.SegP2 = -1;
- m_doc->nodeEdit.SelNode.clear();
+ m_doc->nodeEdit.setClre(-1);
+ m_doc->nodeEdit.setClre2(-1);
+ m_doc->nodeEdit.setSegP1(-1);
+ m_doc->nodeEdit.setSegP2(-1);
+ m_doc->nodeEdit.selNode().clear();
EditCont->setChecked(false);
ToggleConMode();
PageItem *currItem = m_doc->m_Selection->itemAt(0);
@@ -926,11 +926,11 @@
if (m_doc != 0)
{
MoveN();
- m_doc->nodeEdit.ClRe = -1;
- m_doc->nodeEdit.ClRe2 = -1;
- m_doc->nodeEdit.SegP1 = -1;
- m_doc->nodeEdit.SegP2 = -1;
- m_doc->nodeEdit.SelNode.clear();
+ m_doc->nodeEdit.setClre(-1);
+ m_doc->nodeEdit.setClre2(-1);
+ m_doc->nodeEdit.setSegP1(-1);
+ m_doc->nodeEdit.setSegP2(-1);
+ m_doc->nodeEdit.selNode().clear();
EditCont->setChecked(false);
ToggleConMode();
PageItem *currItem = m_doc->m_Selection->itemAt(0);
@@ -951,11 +951,11 @@
{
if (m_doc != 0)
{
- m_doc->nodeEdit.ClRe = -1;
- m_doc->nodeEdit.ClRe2 = -1;
- m_doc->nodeEdit.SegP1 = -1;
- m_doc->nodeEdit.SegP2 = -1;
- m_doc->nodeEdit.SelNode.clear();
+ m_doc->nodeEdit.setClre(-1);
+ m_doc->nodeEdit.setClre2(-1);
+ m_doc->nodeEdit.setSegP1(-1);
+ m_doc->nodeEdit.setSegP2(-1);
+ m_doc->nodeEdit.selNode().clear();
PageItem *currItem = m_doc->m_Selection->itemAt(0);
if (EditCont->isChecked())
currItem->ContourLine = itemContourPath.copy();
More information about the scribus-commit
mailing list