r17744 by craig - #10978: Chelen: Apply initial patch, more to come to fix all issues
scribus-commit
scribus-commit at lists.scribus.net
Tue Jul 31 19:57:06 UTC 2012
Author: craig
Date: Tue Jul 31 19:57:06 2012
New Revision: 17744
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17744
Log:
#10978: Chelen: Apply initial patch, more to come to fix all issues
Modified:
trunk/Scribus/scribus/actionmanager.cpp
trunk/Scribus/scribus/canvas.cpp
trunk/Scribus/scribus/canvasgesture_linemove.cpp
trunk/Scribus/scribus/canvasgesture_resize.cpp
trunk/Scribus/scribus/canvasgesture_table.cpp
trunk/Scribus/scribus/canvasmode.cpp
trunk/Scribus/scribus/canvasmode.h
trunk/Scribus/scribus/canvasmode_create.cpp
trunk/Scribus/scribus/canvasmode_drawbezier.cpp
trunk/Scribus/scribus/canvasmode_edit.cpp
trunk/Scribus/scribus/canvasmode_editmeshgradient.cpp
trunk/Scribus/scribus/canvasmode_editmeshpatch.cpp
trunk/Scribus/scribus/canvasmode_editweldpoint.cpp
trunk/Scribus/scribus/canvasmode_imageimport.cpp
trunk/Scribus/scribus/canvasmode_nodeedit.cpp
trunk/Scribus/scribus/canvasmode_normal.cpp
trunk/Scribus/scribus/guidesmodel.cpp
trunk/Scribus/scribus/guidesmodel.h
trunk/Scribus/scribus/pageitem.cpp
trunk/Scribus/scribus/pageitem.h
trunk/Scribus/scribus/pageitem_textframe.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
trunk/Scribus/scribus/prefsmanager.cpp
trunk/Scribus/scribus/scribus.cpp
trunk/Scribus/scribus/scribus.h
trunk/Scribus/scribus/scribusdoc.cpp
trunk/Scribus/scribus/scribusdoc.h
trunk/Scribus/scribus/scribusview.cpp
trunk/Scribus/scribus/ui/contextmenu.cpp
trunk/Scribus/scribus/ui/cpalette.cpp
trunk/Scribus/scribus/ui/guidemanager.cpp
trunk/Scribus/scribus/ui/paintmanager.cpp
trunk/Scribus/scribus/ui/prefs_guidesbase.ui
trunk/Scribus/scribus/ui/propertiespalette_imagebase.ui
trunk/Scribus/scribus/ui/rulermover.cpp
trunk/Scribus/scribus/undomanager.cpp
trunk/Scribus/scribus/undomanager.h
Modified: trunk/Scribus/scribus/actionmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/actionmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/actionmanager.cpp (original)
+++ trunk/Scribus/scribus/actionmanager.cpp Tue Jul 31 19:57:06 2012
@@ -631,6 +631,8 @@
scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
name="viewSnapToGuides";
scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
+ name="viewSnapToElements";
+ scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
name="viewShowContextMenu";
scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
name="showMouseCoordinates";
@@ -653,6 +655,7 @@
(*scrActions)["viewRulerMode"]->setToggleAction(true);
(*scrActions)["viewSnapToGrid"]->setToggleAction(true);
(*scrActions)["viewSnapToGuides"]->setToggleAction(true);
+ (*scrActions)["viewSnapToElements"]->setToggleAction(true);
(*scrActions)["showMouseCoordinates"]->setToggleAction(true);
(*scrActions)["viewPreviewMode"]->setChecked(false);
@@ -689,6 +692,7 @@
connect( (*scrActions)["viewRulerMode"], SIGNAL(triggered()), mainWindow, SLOT(ToggleRulerMode()) );
connect( (*scrActions)["viewSnapToGrid"], SIGNAL(triggered()), mainWindow, SLOT(ToggleURaster()) );
connect( (*scrActions)["viewSnapToGuides"], SIGNAL(triggered()), mainWindow, SLOT(ToggleUGuides()) );
+ connect( (*scrActions)["viewSnapToElements"], SIGNAL(triggered()), mainWindow, SLOT(ToggleUElements()) );
connect( (*scrActions)["showMouseCoordinates"], SIGNAL(triggered()), mainWindow, SLOT(ToggleMouseTips()) );
// connect( (*scrActions)["viewNewView"], SIGNAL(triggered()), mainWindow, SLOT(newView()) );
@@ -1540,6 +1544,7 @@
(*scrActions)["viewRulerMode"]->setTexts( tr("Rulers Relative to Page"));
(*scrActions)["viewSnapToGrid"]->setTexts( tr("Sn&ap to Grid"));
(*scrActions)["viewSnapToGuides"]->setTexts( tr("Sna&p to Guides"));
+ (*scrActions)["viewSnapToElements"]->setTexts( tr("Snap to Items"));
(*scrActions)["viewShowContextMenu"]->setTexts( tr("Show Context Menu"));
// (*scrActions)["viewNewView"]->setTexts( tr("New View"));
@@ -2087,7 +2092,8 @@
<< "pageManageGuides"
<< "pageManageMargins"
<< "viewSnapToGrid"
- << "viewSnapToGuides";
+ << "viewSnapToGuides"
+ << "viewSnapToElements";
//View
++itmenu;
itmenu->second
Modified: trunk/Scribus/scribus/canvas.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/canvas.cpp
==============================================================================
--- trunk/Scribus/scribus/canvas.cpp (original)
+++ trunk/Scribus/scribus/canvas.cpp Tue Jul 31 19:57:06 2012
@@ -943,6 +943,7 @@
#endif
// does mode specific rendering, currently selection in legacymode and nodes in nodeedit
m_view->m_canvasMode->drawControls(&qp);
+ m_view->m_canvasMode->drawSnapLine(&qp);
QPainter tp(this);
tp.drawPixmap(p->rect(), tmpImg, tmpImg.rect());
#ifdef SHOW_ME_WHAT_YOU_GET_IN_D_CANVA
Modified: trunk/Scribus/scribus/canvasgesture_linemove.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/canvasgesture_linemove.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasgesture_linemove.cpp (original)
+++ trunk/Scribus/scribus/canvasgesture_linemove.cpp Tue Jul 31 19:57:06 2012
@@ -218,6 +218,7 @@
double nx = np2.x();
double ny = np2.y();
m_doc->ApplyGuides(&nx, &ny);
+ m_doc->ApplyGuides(&nx, &ny,true);
newX = nx;
newY = ny;
//>>#8099
Modified: trunk/Scribus/scribus/canvasgesture_resize.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/canvasgesture_resize.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasgesture_resize.cpp (original)
+++ trunk/Scribus/scribus/canvasgesture_resize.cpp Tue Jul 31 19:57:06 2012
@@ -420,13 +420,21 @@
}
// snap to grid + snap to guides
+ xSnap = 0;
+ ySnap = 0;
bool isCorner = m_handle == Canvas::NORTHWEST || m_handle == Canvas::NORTHEAST
|| m_handle == Canvas::SOUTHWEST || m_handle == Canvas::SOUTHEAST;
if (m_rotation == 0 || isCorner)
{
FPoint snappedPoint = m_doc->ApplyGridF(docPoint);
double x = snappedPoint.x(), y = snappedPoint.y();
+
m_doc->ApplyGuides(&x, &y);
+ m_doc->ApplyGuides(&x, &y,true);
+ if(x != snappedPoint.x() && m_handle != Canvas::NORTH && m_handle != Canvas::SOUTH)
+ xSnap = x * m_canvas->scale();
+ if(y != snappedPoint.y() && m_handle != Canvas::EAST && m_handle != Canvas::WEST)
+ ySnap = y * m_canvas->scale();
// if (m_doc->ApplyGuides(&x, &y))
// qDebug() << "guides applied:" << snappedPoint.x() << snappedPoint.y() << "to" << x << y;
if (m_handle == Canvas::NORTH || m_handle == Canvas::SOUTH)
Modified: trunk/Scribus/scribus/canvasgesture_table.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/canvasgesture_table.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasgesture_table.cpp (original)
+++ trunk/Scribus/scribus/canvasgesture_table.cpp Tue Jul 31 19:57:06 2012
@@ -32,6 +32,7 @@
// Snap to grid and guides.
canvasPoint = m_doc->ApplyGridF(canvasPoint);
m_doc->ApplyGuides(&canvasPoint);
+ m_doc->ApplyGuides(&canvasPoint,true);
}
// Return point mapped to table grid.
Modified: trunk/Scribus/scribus/canvasmode.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/canvasmode.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode.cpp (original)
+++ trunk/Scribus/scribus/canvasmode.cpp Tue Jul 31 19:57:06 2012
@@ -766,7 +766,28 @@
}
#endif // GESTURE_FRAME_PREVIEW
-
+void CanvasMode::drawSnapLine(QPainter* p)
+{
+ if(m_doc->SnapElement)
+ {
+ if(ySnap)
+ {
+ p->setPen(Qt::green);
+ double x = (m_doc->currentPage()->xOffset() - m_doc->bleedsVal().Left)* m_canvas->scale();
+ double w = (m_doc->currentPage()->width() + m_doc->bleedsVal().Left + m_doc->bleedsVal().Right) * m_canvas->scale();
+ p->drawLine(x, ySnap, x+w,ySnap);
+ ySnap = 0;
+ }
+ if(xSnap)
+ {
+ p->setPen(Qt::green);
+ double y = (m_doc->currentPage()->yOffset() - m_doc->bleedsVal().Top) * m_canvas->scale();
+ double h = (m_doc->currentPage()->height() + m_doc->bleedsVal().Bottom + m_doc->bleedsVal().Top) * m_canvas->scale();
+ p->drawLine(xSnap, y, xSnap,y+h);
+ xSnap = 0;
+ }
+ }
+}
void CanvasMode::setResizeCursor(int how, double rot)
{
@@ -1265,14 +1286,17 @@
/* Don't use Grid or Guide Snapping when dragging Items or Groups with the keyboard */
/* as the user might be trying to fine tune a position */
bool sav1 = m_doc->SnapGuides;
+ bool sav3 = m_doc->SnapElement;
bool sav2 = m_doc->useRaster;
m_doc->SnapGuides = false;
m_doc->useRaster = false;
+ m_doc->SnapElement = false;
if (m_doc->m_Selection->count() > 1)
m_view->startGroupTransaction(Um::Move, "", Um::IMove);
m_doc->moveGroup(-moveBy, 0);
if (m_doc->m_Selection->count() > 1)
m_view->endGroupTransaction();
+ m_doc->SnapElement = sav3;
m_doc->SnapGuides = sav1;
m_doc->useRaster = sav2;
}
@@ -1337,8 +1361,10 @@
/* as the user might be trying to fine tune a position */
bool sav1 = m_doc->SnapGuides;
bool sav2 = m_doc->useRaster;
+ bool sav3 = m_doc->SnapElement;
m_doc->SnapGuides = false;
m_doc->useRaster = false;
+ m_doc->SnapElement = false;
if (m_doc->m_Selection->count() > 1)
m_view->startGroupTransaction(Um::Move, "", Um::IMove);
m_doc->moveGroup(moveBy, 0);
@@ -1346,6 +1372,7 @@
m_view->endGroupTransaction();
m_doc->SnapGuides = sav1;
m_doc->useRaster = sav2;
+ m_doc->SnapElement = sav3;
}
}
else
@@ -1408,8 +1435,10 @@
/* as the user might be trying to fine tune a position */
bool sav1 = m_doc->SnapGuides;
bool sav2 = m_doc->useRaster;
+ bool sav3 = m_doc->SnapElement;
m_doc->SnapGuides = false;
m_doc->useRaster = false;
+ m_doc->SnapElement = false;
if (m_doc->m_Selection->count() > 1)
m_view->startGroupTransaction(Um::Move, "", Um::IMove);
m_doc->moveGroup(0, -moveBy);
@@ -1417,6 +1446,7 @@
m_view->endGroupTransaction();
m_doc->SnapGuides = sav1;
m_doc->useRaster = sav2;
+ m_doc->SnapElement = sav3;
}
}
else
@@ -1479,8 +1509,10 @@
/* as the user might be trying to fine tune a position */
bool sav1 = m_doc->SnapGuides;
bool sav2 = m_doc->useRaster;
+ bool sav3 = m_doc->SnapElement;
m_doc->SnapGuides = false;
m_doc->useRaster = false;
+ m_doc->SnapElement = false;
if (m_doc->m_Selection->count() > 1)
m_view->startGroupTransaction(Um::Move, "", Um::IMove);
m_doc->moveGroup(0, moveBy);
@@ -1488,6 +1520,7 @@
m_view->endGroupTransaction();
m_doc->SnapGuides = sav1;
m_doc->useRaster = sav2;
+ m_doc->SnapElement = sav3;
}
}
else
Modified: trunk/Scribus/scribus/canvasmode.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/canvasmode.h
==============================================================================
--- trunk/Scribus/scribus/canvasmode.h (original)
+++ trunk/Scribus/scribus/canvasmode.h Tue Jul 31 19:57:06 2012
@@ -123,6 +123,8 @@
/** Draws the regular selection marker */
void drawSelection(QPainter* psx, bool drawHandles);
/** Draws an outline of selected items */
+ void drawSnapLine(QPainter* psx);
+ /** Draws an outline of selected items */
void drawOutline(QPainter* p, double scalex=1.0, double scaley=1.0, double deltax=0.0, double deltay=0.0);
#ifdef GESTURE_FRAME_PREVIEW
// I donât know why the methods above have been implemented here and left non-virtual.
@@ -146,6 +148,7 @@
Canvas * const m_canvas;
ScribusDoc * const m_doc;
PanGesture * m_panGesture;
+ double xSnap,ySnap;
void setResizeCursor(int how, double rot = 0.0);
bool commonMouseMove(QMouseEvent *m);
Modified: trunk/Scribus/scribus/canvasmode_create.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/canvasmode_create.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_create.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_create.cpp Tue Jul 31 19:57:06 2012
@@ -299,6 +299,7 @@
double nx = np2.x();
double ny = np2.y();
m_doc->ApplyGuides(&nx, &ny);
+ m_doc->ApplyGuides(&nx, &ny,true);
// #8959 : suppress qRound here as this prevent drawing line with angle constrain
// precisely and does not allow to stick precisely to grid or guides
newX = /*qRound(*/nx/*)*/;
@@ -359,6 +360,7 @@
canvasCurrCoord = canvasPressCoord;
m_doc->ApplyGuides(&Rxp, &Ryp);
+ m_doc->ApplyGuides(&Rxp, &Ryp,true);
createObjectPos.setXY(Rxp, Ryp);
if (m->button() == Qt::MidButton)
@@ -667,6 +669,7 @@
Rxp = createObjectPos.x();
Ryp = createObjectPos.y();
m_doc->ApplyGuides(&Rxp, &Ryp);
+ m_doc->ApplyGuides(&Rxp, &Ryp,true);
rot = xy2Deg(Rxpd, Rypd);
if (rot < 0.0)
rot += 360;
@@ -934,14 +937,16 @@
FPoint first = m_doc->ApplyGridF(firstPoint);
FPoint second = m_doc->ApplyGridF(secondPoint);
- // Lock to guides.
+ // Lock to guides and items.
double firstX = first.x();
double firstY = first.y();
m_doc->ApplyGuides(&firstX, &firstY);
+ m_doc->ApplyGuides(&firstX, &firstY,true);
double secondX = second.x();
double secondY = second.y();
m_doc->ApplyGuides(&secondX, &secondY);
+ m_doc->ApplyGuides(&secondX, &secondY,true);
// Return normalized rectangle.
FRect rect(firstX, firstY, secondX - firstX, secondY - firstY);
Modified: trunk/Scribus/scribus/canvasmode_drawbezier.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/canvasmode_drawbezier.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_drawbezier.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_drawbezier.cpp Tue Jul 31 19:57:06 2012
@@ -138,7 +138,7 @@
// m_view->stopDragTimer();
PageItem* currItem = m_doc->m_Selection->itemAt(0);
undoManager->setUndoEnabled(true);
- if (UndoManager::undoEnabled())
+ if (currItem && UndoManager::undoEnabled())
{
ScItemState<PageItem*> *is = new ScItemState<PageItem*>("Create PageItem");
is->set("CREATE_ITEM", "create_item");
Modified: trunk/Scribus/scribus/canvasmode_edit.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/canvasmode_edit.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_edit.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_edit.cpp Tue Jul 31 19:57:06 2012
@@ -728,7 +728,7 @@
m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
double nx = gx;
double ny = gy;
- if (!m_doc->ApplyGuides(&nx, &ny))
+ if (!m_doc->ApplyGuides(&nx, &ny) && !m_doc->ApplyGuides(&nx, &ny,true))
{
FPoint npx = m_doc->ApplyGridF(FPoint(gx, gy));
FPoint npw = m_doc->ApplyGridF(FPoint(gx+gw, gy+gh));
@@ -746,7 +746,7 @@
m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
nx = gx+gw;
ny = gy+gh;
- if (m_doc->ApplyGuides(&nx, &ny))
+ if (m_doc->ApplyGuides(&nx, &ny) || m_doc->ApplyGuides(&nx,&ny,true))
m_doc->moveGroup(nx-(gx+gw), ny-(gy+gh), false);
m_doc->m_Selection->setGroupRect();
}
@@ -757,7 +757,7 @@
{
double nx = currItem->xPos();
double ny = currItem->yPos();
- if (!m_doc->ApplyGuides(&nx, &ny))
+ if (!m_doc->ApplyGuides(&nx, &ny) && !m_doc->ApplyGuides(&nx, &ny,true))
{
m_doc->m_Selection->setGroupRect();
double gx, gy, gh, gw;
Modified: trunk/Scribus/scribus/canvasmode_editmeshgradient.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/canvasmode_editmeshgradient.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_editmeshgradient.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_editmeshgradient.cpp Tue Jul 31 19:57:06 2012
@@ -576,7 +576,7 @@
FPoint npfN;
double nx = mousePointDoc.x();
double ny = mousePointDoc.y();
- if (!m_doc->ApplyGuides(&nx, &ny))
+ if (!m_doc->ApplyGuides(&nx, &ny) && !m_doc->ApplyGuides(&nx, &ny,true))
npfN = m_doc->ApplyGridF(FPoint(nx, ny));
else
npfN = FPoint(nx, ny);
Modified: trunk/Scribus/scribus/canvasmode_editmeshpatch.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/canvasmode_editmeshpatch.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_editmeshpatch.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_editmeshpatch.cpp Tue Jul 31 19:57:06 2012
@@ -570,7 +570,7 @@
FPoint npfN;
double nx = mousePointDoc.x();
double ny = mousePointDoc.y();
- if (!m_doc->ApplyGuides(&nx, &ny))
+ if (!m_doc->ApplyGuides(&nx, &ny) && !m_doc->ApplyGuides(&nx, &ny,true))
npfN = m_doc->ApplyGridF(FPoint(nx, ny));
else
npfN = FPoint(nx, ny);
Modified: trunk/Scribus/scribus/canvasmode_editweldpoint.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/canvasmode_editweldpoint.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_editweldpoint.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_editweldpoint.cpp Tue Jul 31 19:57:06 2012
@@ -349,7 +349,7 @@
FPoint npfN;
double nx = mousePointDoc.x();
double ny = mousePointDoc.y();
- if (!m_doc->ApplyGuides(&nx, &ny))
+ if (!m_doc->ApplyGuides(&nx, &ny) && !m_doc->ApplyGuides(&nx, &ny,true))
npfN = m_doc->ApplyGridF(FPoint(nx, ny));
else
npfN = FPoint(nx, ny);
Modified: trunk/Scribus/scribus/canvasmode_imageimport.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/canvasmode_imageimport.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_imageimport.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_imageimport.cpp Tue Jul 31 19:57:06 2012
@@ -52,8 +52,12 @@
while(!(m_doc->m_Selection->itemAt(0)->isImageFrame()))
m_doc->m_Selection->removeFirst();
if(!m_doc->m_Selection->isEmpty())
+ {
setImage(m_doc->m_Selection->itemAt(0));
- m_view->requestMode(submodePaintingDone);
+ m_view->requestMode(submodePaintingDone);
+ }
+ else
+ newToolTip(l.first());
}
else
newToolTip(l.first());
@@ -71,7 +75,6 @@
{
thumb = thumb.scaled(80,80,Qt::KeepAspectRatio);
p.drawImage((80 - thumb.width()) / 2, (80 - thumb.height()) / 2, thumb);
- p.end();
QBuffer buffer;
buffer.open(QIODevice::WriteOnly);
pm.save(&buffer, "PNG");
@@ -112,6 +115,9 @@
break;
case Qt::Key_Backtab:
imageList.append(imageList.takeFirst());
+ break;
+ case Qt::Key_Backspace:
+ imageList.removeFirst();
break;
case Qt::Key_Escape:
imageList.clear();
@@ -162,6 +168,17 @@
QToolTip::showText(m->globalPos(), tipText, qApp->activeWindow());
QToolTip::showText(m->globalPos(), tipText + "<b></b>", qApp->activeWindow());
m->accept();
+ PageItem *item;
+ if((item = m_canvas->itemUnderCursor(m->globalPos())) != NULL)
+ {
+ PageItem_ImageFrame *currItem;
+ if((currItem = item->asImageFrame()) != NULL)
+ qApp->changeOverrideCursor(QCursor(loadIcon("DrawImageFrame.xpm")));
+ else
+ qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
+ }
+ else
+ qApp->changeOverrideCursor(QCursor(loadIcon("DrawImageFrame.xpm")));
if (commonMouseMove(m))
return;
}
Modified: trunk/Scribus/scribus/canvasmode_nodeedit.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/canvasmode_nodeedit.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_nodeedit.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_nodeedit.cpp Tue Jul 31 19:57:06 2012
@@ -428,7 +428,7 @@
FPoint npf;
double nx = newP.x();
double ny = newP.y();
- if (!m_doc->ApplyGuides(&nx, &ny))
+ if (!m_doc->ApplyGuides(&nx, &ny) && !m_doc->ApplyGuides(&nx, &ny,true))
npf = m_doc->ApplyGridF(FPoint(nx, ny));
else
npf = FPoint(nx, ny);
@@ -1118,7 +1118,7 @@
npf = m_canvas->globalToCanvas(m->globalPos());
double nx = npf.x();
double ny = npf.y();
- if (!m_doc->ApplyGuides(&nx, &ny))
+ if (!m_doc->ApplyGuides(&nx, &ny) && !m_doc->ApplyGuides(&nx, &ny,true))
npf = m_doc->ApplyGridF(FPoint(nx, ny));
else
npf = FPoint(nx, ny);
@@ -1219,7 +1219,7 @@
npf = m_canvas->globalToCanvas(m->globalPos());
double nx = npf.x();
double ny = npf.y();
- if (!m_doc->ApplyGuides(&nx, &ny))
+ if (!m_doc->ApplyGuides(&nx, &ny) && !m_doc->ApplyGuides(&nx, &ny,true))
npf = m_doc->ApplyGridF(FPoint(nx, ny));
else
npf = FPoint(nx, ny);
Modified: trunk/Scribus/scribus/canvasmode_normal.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/canvasmode_normal.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_normal.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_normal.cpp Tue Jul 31 19:57:06 2012
@@ -83,6 +83,8 @@
m_mouseCurrentPoint.setXY(0, 0);
m_mouseSavedPoint.setXY(0, 0);
m_objectDeltaPos.setXY(0,0 );
+ ySnap = 0;
+ xSnap = 0;
}
inline bool CanvasMode_Normal::GetItem(PageItem** pi)
@@ -95,13 +97,9 @@
{
// qDebug() << "CanvasMode_Normal::drawControls";
if (m_canvas->m_viewMode.operItemMoving)
- {
drawOutline(p, 1.0, 1.0, m_objectDeltaPos.x(), m_objectDeltaPos.y());
- }
else
- {
drawSelection(p, true);
- }
}
void CanvasMode_Normal::enterEvent(QEvent *)
@@ -433,7 +431,6 @@
if (!m_canvas->m_viewMode.operItemResizing)
{
//Dragging an item (plus more?)
- QRectF newPlace;
newX = mousePointDoc.x(); //static_cast<int>(m->x()/sc);
newY = mousePointDoc.y(); //static_cast<int>(m->y()/sc);
m_canvas->m_viewMode.operItemMoving = true;
@@ -466,7 +463,6 @@
}
double gx, gy, gh, gw;
m_objectDeltaPos.setXY(dX, dY);
- m_doc->m_Selection->setGroupRect();
m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
// #10677 : temporary hack : we need to introduce the
// concept of item snapping points to handle better
@@ -491,6 +487,37 @@
ny = nyo = gy + gh + m_objectDeltaPos.y();
m_doc->ApplyGuides(&nx, &ny);
m_objectDeltaPos += FPoint(nx-nxo, ny-nyo);
+ if(false)
+ {
+ nx = nxo = gx + gw/2 + m_objectDeltaPos.x();
+ ny = nyo = gy + gh/2 + m_objectDeltaPos.y();
+ m_doc->ApplyGuides(&nx, &ny);
+ m_objectDeltaPos += FPoint(nx-nxo, ny-nyo);
+ }
+ }
+ if (m_doc->SnapElement)
+ {
+ xSnap = 0;
+ ySnap = 0;
+ double snapWidth[] = {0,gw,gw/2};
+ double snapHeight[] = {0,gh,gh/2};
+ if(m_objectDeltaPos.x()<0)
+ std::swap(snapWidth[0],snapWidth[2]);
+ if(m_objectDeltaPos.y()<0)
+ std::swap(snapHeight[0],snapHeight[2]);
+ double nx,ny,nyo,nxo;
+ for(int i = 0;i<3;i++)
+ {
+ nx = gx + snapWidth[i] + m_objectDeltaPos.x();
+ ny = gy + snapHeight[i] + m_objectDeltaPos.y();
+ nxo = nx, nyo = ny;
+ m_doc->ApplyGuides(&nx, &ny,true);
+ m_objectDeltaPos += FPoint(nx - nxo, ny - nyo);
+ if(ny != nyo)
+ ySnap = ny * m_canvas->scale();
+ if(nx != nxo)
+ xSnap = nx * m_canvas->scale();
+ }
}
if (m_doc->useRaster)
{
@@ -537,16 +564,46 @@
m_objectDeltaPos.setXY(dX, dY);
if (m_doc->SnapGuides)
{
- m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
double nx = gx + m_objectDeltaPos.x();
double ny = gy + m_objectDeltaPos.y();
double nxo = nx, nyo = ny;
m_doc->ApplyGuides(&nx, &ny);
- m_objectDeltaPos += FPoint(nx-nxo, ny-nyo);
+ m_objectDeltaPos += FPoint(nx - nxo, ny - nyo);
nx = nxo = gx + gw + m_objectDeltaPos.x();
ny = nyo = gy + gh + m_objectDeltaPos.y();
m_doc->ApplyGuides(&nx, &ny);
m_objectDeltaPos += FPoint(nx-nxo, ny-nyo);
+ if(false)
+ {
+ nx = nxo = gx + gw/2 + m_objectDeltaPos.x();
+ ny = nyo = gy + gh/2 + m_objectDeltaPos.y();
+ m_doc->ApplyGuides(&nx, &ny);
+ m_objectDeltaPos += FPoint(nx-nxo, ny-nyo);
+ }
+ }
+ if (m_doc->SnapElement)
+ {
+ xSnap = 0;
+ ySnap = 0;
+ double snapWidth[] = {0,gw,gw/2};
+ double snapHeight[] = {0,gh,gh/2};
+ if(m_objectDeltaPos.x()<0)
+ std::swap(snapWidth[0],snapWidth[2]);
+ if(m_objectDeltaPos.y()<0)
+ std::swap(snapHeight[0],snapHeight[2]);
+ double nx,ny,nyo,nxo;
+ for(int i = 0;i<3;i++)
+ {
+ nx = gx + snapWidth[i] + m_objectDeltaPos.x();
+ ny = gy + snapHeight[i] + m_objectDeltaPos.y();
+ nxo = nx, nyo = ny;
+ m_doc->ApplyGuides(&nx, &ny,true);
+ m_objectDeltaPos += FPoint(nx - nxo, ny - nyo);
+ if(ny != nyo)
+ ySnap = ny * m_canvas->scale();
+ if(nx != nxo)
+ xSnap = nx * m_canvas->scale();
+ }
}
if (m_doc->useRaster)
{
@@ -920,7 +977,7 @@
m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
double nx = gx;
double ny = gy;
- if (!m_doc->ApplyGuides(&nx, &ny))
+ if (!m_doc->ApplyGuides(&nx, &ny) && !m_doc->ApplyGuides(&nx, &ny,true))
{
FPoint npx = m_doc->ApplyGridF(FPoint(gx, gy));
FPoint npw = m_doc->ApplyGridF(FPoint(gx+gw, gy+gh));
@@ -938,7 +995,7 @@
m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
nx = gx+gw;
ny = gy+gh;
- if (m_doc->ApplyGuides(&nx, &ny))
+ if (m_doc->ApplyGuides(&nx, &ny) && !m_doc->ApplyGuides(&nx, &ny,true))
m_doc->moveGroup(nx-(gx+gw), ny-(gy+gh), false);
m_doc->m_Selection->setGroupRect();
}
@@ -950,7 +1007,7 @@
{
double nx = currItem->xPos();
double ny = currItem->yPos();
- if (!m_doc->ApplyGuides(&nx, &ny))
+ if (!m_doc->ApplyGuides(&nx, &ny) && !m_doc->ApplyGuides(&nx, &ny,true))
{
m_doc->m_Selection->setGroupRect();
double gx, gy, gh, gw, gxo, gyo;
@@ -1090,6 +1147,7 @@
}
else
m_view->Deselect(true);
+ xSnap = ySnap = 0;
m_canvas->setRenderModeUseBuffer(false);
m_doc->DragP = false;
m_doc->leaveDrag = false;
@@ -1381,6 +1439,8 @@
QFileInfo fi(fileName);
bool savedAlignGrid = m_doc->useRaster;
bool savedAlignGuides = m_doc->SnapGuides;
+ bool savedAlignElement = m_doc->SnapElement;
+ m_doc->SnapElement = false;
m_doc->useRaster = false;
m_doc->SnapGuides = false;
if (fi.suffix().toLower() == "sce")
@@ -1415,6 +1475,7 @@
}
m_doc->useRaster = savedAlignGrid;
m_doc->SnapGuides = savedAlignGuides;
+ m_doc->SnapElement = savedAlignElement;
m_doc->setLoading(false);
m_doc->view()->DrawNew();
if (m_doc->m_Selection->count() > 0)
Modified: trunk/Scribus/scribus/guidesmodel.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/guidesmodel.cpp
==============================================================================
--- trunk/Scribus/scribus/guidesmodel.cpp (original)
+++ trunk/Scribus/scribus/guidesmodel.cpp Tue Jul 31 19:57:06 2012
@@ -49,7 +49,7 @@
{
QLocale l;
return QVariant(l.toString(pts2value(m_values.at(index.row()),
- m_docUnitIndex), 'f',
+ m_docUnitIndex) - rule, 'f',
m_docUnitDecimals)
);
}
@@ -69,7 +69,7 @@
double newVal = value.toDouble(&ok);
if (!ok)
return false;
- m_values[index.row()] = value2pts(newVal, m_docUnitIndex);
+ m_values[index.row()] = value2pts(newVal, m_docUnitIndex) + rule;
qSort(m_values);
emit dataChanged(index, index);
emit valueChanged();
@@ -138,8 +138,9 @@
return m_values;
}
-void GuidesModel::unitChange(int docUnitIndex, int docUnitDecimals)
+void GuidesModel::unitChange(int docUnitIndex, int docUnitDecimals,double offset)
{
+ rule = offset;
m_docUnitIndex = docUnitIndex;
m_docUnitDecimals = docUnitDecimals;
reset();
Modified: trunk/Scribus/scribus/guidesmodel.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/guidesmodel.h
==============================================================================
--- trunk/Scribus/scribus/guidesmodel.h (original)
+++ trunk/Scribus/scribus/guidesmodel.h Tue Jul 31 19:57:06 2012
@@ -49,7 +49,7 @@
//! \brief Get values back to the app.
Guides values();
- void unitChange(int docUnitIndex, int docUnitDecimals);
+ void unitChange(int docUnitIndex, int docUnitDecimals, double offset);
#if 0
//! debug only
void printValues();
@@ -64,6 +64,7 @@
Guides m_values;
int m_docUnitIndex;
int m_docUnitDecimals;
+ double rule;
};
#endif
Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Tue Jul 31 19:57:06 2012
@@ -1033,11 +1033,14 @@
{
if(LocalRot == newRotation)
return;
- SimpleState *ss = new SimpleState(Um::Rotate,"",Um::IRotate);
- ss->set("IMAGE_ROTATION","image_rotation");
- ss->set("OLD_ROT",LocalRot);
- ss->set("NEW_ROT",newRotation);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::Rotate,"",Um::IRotate);
+ ss->set("IMAGE_ROTATION","image_rotation");
+ ss->set("OLD_ROT",LocalRot);
+ ss->set("NEW_ROT",newRotation);
+ undoManager->action(this,ss);
+ }
LocalRot = newRotation;
if (m_Doc->isLoading())
return;
@@ -1233,12 +1236,12 @@
}
if (UndoManager::undoEnabled() && createUndo) //addPARESEP is false only if linking is invoked from undo action for unlinkWithText
{
- ScItemState<std::pair<PageItem*, PageItem*> > *is = new ScItemState<std::pair<PageItem*, PageItem*> >(UndoManager::LinkTextFrame);
+ ScItemState<QPair<PageItem*, PageItem*> > *is = new ScItemState<QPair<PageItem*, PageItem*> >(Um::LinkTextFrame);
is->set("LINK_TEXT_FRAME", "linkTextFrame");
is->set("FIRST", first);
is->set("JOIN_POS", textLen);
is->set("ADDPARSEP", addPARSEP);
- is->setItem(std::pair<PageItem*, PageItem*>(this, NextBox));
+ is->setItem(qMakePair(this, NextBox));
undoManager->action(this, is);
}
}
@@ -1287,9 +1290,9 @@
NextBox = NULL;
if (UndoManager::undoEnabled() && createUndo)
{
- ScItemState<std::pair<PageItem*, PageItem*> > *is = new ScItemState<std::pair<PageItem*, PageItem*> >(UndoManager::UnlinkTextFrame);
+ ScItemState<QPair<PageItem*, PageItem*> > *is = new ScItemState<QPair<PageItem*, PageItem*> >(Um::UnlinkTextFrame);
is->set("UNLINK_TEXT_FRAME", "unlinkTextFrame");
- is->setItem(std::pair<PageItem*, PageItem*>(this, undoNextBox));
+ is->setItem(qMakePair(this, undoNextBox));
undoManager->action(this, is);
}
}
@@ -1376,10 +1379,10 @@
}
if (UndoManager::undoEnabled())
{
- ScItemState<std::pair<PageItem*, PageItem*> > *is = new ScItemState<std::pair<PageItem*, PageItem*> >(UndoManager::UnlinkTextFrame);
+ ScItemState<QPair<PageItem*, PageItem*> > *is = new ScItemState<QPair<PageItem*, PageItem*> >(Um::UnlinkTextFrame);
is->set("UNLINK_TEXT_FRAME", "unlinkTextFrame");
is->set("CUT_TEXT", cutText);
- is->setItem(std::pair<PageItem*, PageItem*>(Prev, Next));
+ is->setItem(qMakePair(Prev, Next));
undoManager->action(this, is);
}
}
@@ -1526,7 +1529,8 @@
{
if(Cols==n)
return;
- if(UndoManager::undoEnabled()){
+ if(UndoManager::undoEnabled())
+ {
SimpleState *ss = new SimpleState(Um::Columns, "", Um::IBorder);
ss->set("COLUMNS", "columns");
ss->set("OLD_COLUMNS", Cols);
@@ -1553,20 +1557,17 @@
{
if(RadRect==newRadius)
return;
- SimpleState *state = new SimpleState(Um::RoundCorner,"",Um::IBorder);
- state->set("CORNER_RADIUS","corner_radius");
- state->set("OLD_RADIUS",RadRect);
- state->set("NEW_RADIUS",newRadius);
- undoManager->action(this,state);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *state = new SimpleState(Um::RoundCorner,"",Um::IBorder);
+ state->set("CORNER_RADIUS","corner_radius");
+ state->set("OLD_RADIUS",RadRect);
+ state->set("NEW_RADIUS",newRadius);
+ undoManager->action(this,state);
+ }
RadRect=newRadius;
//emit cornerRadius(RadRect);
}
-
-
-
-
-
-
@@ -2718,30 +2719,39 @@
void PageItem::setMaskGradient(VGradient grad){
if(mask_gradient==grad)
return;
- ScItemState<QPair<VGradient,VGradient> > *is = new ScItemState<QPair<VGradient,VGradient> >(Um::GradVal);
- is->set("MASK_GRAD","mask_grad");
- is->setItem(qMakePair(mask_gradient,grad));
- undoManager->action(this,is);
+ if(UndoManager::undoEnabled())
+ {
+ ScItemState<QPair<VGradient,VGradient> > *is = new ScItemState<QPair<VGradient,VGradient> >(Um::GradVal);
+ is->set("MASK_GRAD","mask_grad");
+ is->setItem(qMakePair(mask_gradient,grad));
+ undoManager->action(this,is);
+ }
mask_gradient=grad;
}
void PageItem::setFillGradient(VGradient grad){
if(fill_gradient==grad)
return;
- ScItemState<QPair<VGradient,VGradient> > *is = new ScItemState<QPair<VGradient,VGradient> >(Um::GradVal);
- is->set("FILL_GRAD","fill_grad");
- is->setItem(qMakePair(fill_gradient,grad));
- undoManager->action(this,is);
+ if(UndoManager::undoEnabled())
+ {
+ ScItemState<QPair<VGradient,VGradient> > *is = new ScItemState<QPair<VGradient,VGradient> >(Um::GradVal);
+ is->set("FILL_GRAD","fill_grad");
+ is->setItem(qMakePair(fill_gradient,grad));
+ undoManager->action(this,is);
+ }
fill_gradient=grad;
}
void PageItem::setStrokeGradient(VGradient grad){
if(stroke_gradient==grad)
return;
- ScItemState<QPair<VGradient,VGradient> > *is = new ScItemState<QPair<VGradient,VGradient> >(Um::GradVal);
- is->set("STROKE_GRAD","STROKE_grad");
- is->setItem(qMakePair(stroke_gradient,grad));
- undoManager->action(this,is);
+ if(UndoManager::undoEnabled())
+ {
+ ScItemState<QPair<VGradient,VGradient> > *is = new ScItemState<QPair<VGradient,VGradient> >(Um::GradVal);
+ is->set("STROKE_GRAD","STROKE_grad");
+ is->setItem(qMakePair(stroke_gradient,grad));
+ undoManager->action(this,is);
+ }
stroke_gradient=grad;
}
@@ -2770,28 +2780,44 @@
void PageItem::set4ColorTransparency(double t1, double t2, double t3, double t4)
{
- UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradVal,"",Um::IFill));
+ UndoTransaction *trans = NULL;
+ if(UndoManager::undoEnabled())
+ trans = new UndoTransaction(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradVal,"",Um::IFill));
setGradientTransp1(t1);
setGradientTransp2(t2);
setGradientTransp3(t3);
setGradientTransp4(t4);
- trans.commit();
+ if(trans)
+ {
+ trans->commit();
+ delete trans;
+ trans = NULL;
+ }
}
void PageItem::set4ColorShade(int t1, int t2, int t3, int t4)
{
- UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradVal,"",Um::IFill));
+ UndoTransaction *trans = NULL;
+ if(UndoManager::undoEnabled())
+ trans = new UndoTransaction(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradVal,"",Um::IFill));
setGradientShade1(t1);
setGradientShade2(t2);
setGradientShade3(t3);
setGradientShade4(t4);
- trans.commit();
+ if(trans)
+ {
+ trans->commit();
+ delete trans;
+ trans = NULL;
+ }
}
void PageItem::set4ColorColors(QString col1, QString col2, QString col3, QString col4)
{
QColor tmp;
- UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradVal,"",Um::IFill));
+ UndoTransaction *trans = NULL;
+ if(UndoManager::undoEnabled())
+ trans = new UndoTransaction(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradVal,"",Um::IFill));
setGradientCol1(col1);
if (GrColorP1 != CommonStrings::None)
{
@@ -2948,7 +2974,12 @@
VisionDefectColor defect;
setGradientColor4(defect.convertDefect(GrColorP4QColor, m_Doc->previewVisual));
}
- trans.commit();
+ if(trans)
+ {
+ trans->commit();
+ delete trans;
+ trans = NULL;
+ }
}
void PageItem::get4ColorGeometry(FPoint &c1, FPoint &c2, FPoint &c3, FPoint &c4)
@@ -3019,12 +3050,6 @@
meshPoint *mp;
if (forPatch)
{
- UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradVal,"",Um::IFill));
- ScItemState<QPair<QColor,QColor> > *ss = new ScItemState<QPair<QColor,QColor> >(Um::GradVal);
- ss->set("GRAD_MESH_COLOR","grad_mesh_color");
- ss->set("X",x);
- ss->set("Y",y);
- ss->set("PATCH",true);
meshGradientPatch *patch = &meshGradientPatches[x];
switch (y)
{
@@ -3041,121 +3066,16 @@
mp = &(patch->BL);
break;
}
- ss->set("OLD_COLOR_NAME",mp->colorName);
- ss->set("NEW_COLOR_NAME",MColor);
- ss->setItem(qMakePair(mp->color,MQColor));
- ss->set("OLD_SHADE",mp->shade);
- ss->set("NEW_SHADE",shade);
- ss->set("OLD_TRANSP",mp->transparency);
- ss->set("NEW_TRANSP",transparency);
- mp->colorName = MColor;
- mp->color = MQColor;
- mp->shade = shade;
- mp->transparency = transparency;
- undoManager->action(this,ss);
- FPoint xx = mp->gridPoint;
- for (int col = 0; col < meshGradientPatches.count(); col++)
- {
- if (col != x)
- {
- if (meshGradientPatches[col].TL.gridPoint == xx)
- {
- ScItemState<QPair<QColor,QColor> > *ss = new ScItemState<QPair<QColor,QColor> >(Um::GradVal);
- ss->set("GRAD_MESH_COLOR","grad_mesh_color");
- ss->set("X",col);
- ss->set("Y",1);
- ss->set("PATCH",true);
- mp = &(meshGradientPatches[col].TL);
- ss->set("OLD_COLOR_NAME",mp->colorName);
- ss->set("NEW_COLOR_NAME",MColor);
- ss->setItem(qMakePair(mp->color,MQColor));
- ss->set("OLD_SHADE",mp->shade);
- ss->set("NEW_SHADE",shade);
- ss->set("OLD_TRANSP",mp->transparency);
- ss->set("NEW_TRANSP",transparency);
- mp->colorName = MColor;
- mp->color = MQColor;
- mp->shade = shade;
- mp->transparency = transparency;
- undoManager->action(this,ss);
- }
- if (meshGradientPatches[col].TR.gridPoint == xx)
- {
- ScItemState<QPair<QColor,QColor> > *ss = new ScItemState<QPair<QColor,QColor> >(Um::GradVal);
- ss->set("GRAD_MESH_COLOR","grad_mesh_color");
- ss->set("X",col);
- ss->set("Y",2);
- ss->set("PATCH",true);
- mp = &(meshGradientPatches[col].TR);
- ss->set("OLD_COLOR_NAME",mp->colorName);
- ss->set("NEW_COLOR_NAME",MColor);
- ss->setItem(qMakePair(mp->color,MQColor));
- ss->set("OLD_SHADE",mp->shade);
- ss->set("NEW_SHADE",shade);
- ss->set("OLD_TRANSP",mp->transparency);
- ss->set("NEW_TRANSP",transparency);
- mp->colorName = MColor;
- mp->color = MQColor;
- mp->shade = shade;
- mp->transparency = transparency;
- undoManager->action(this,ss);
- }
- if (meshGradientPatches[col].BR.gridPoint == xx)
- {
- ScItemState<QPair<QColor,QColor> > *ss = new ScItemState<QPair<QColor,QColor> >(Um::GradVal);
- ss->set("GRAD_MESH_COLOR","grad_mesh_color");
- ss->set("X",col);
- ss->set("Y",3);
- ss->set("PATCH",true);
- mp = &(meshGradientPatches[col].BR);
- ss->set("OLD_COLOR_NAME",mp->colorName);
- ss->set("NEW_COLOR_NAME",MColor);
- ss->setItem(qMakePair(mp->color,MQColor));
- ss->set("OLD_SHADE",mp->shade);
- ss->set("NEW_SHADE",shade);
- ss->set("OLD_TRANSP",mp->transparency);
- ss->set("NEW_TRANSP",transparency);
- mp->colorName = MColor;
- mp->color = MQColor;
- mp->shade = shade;
- mp->transparency = transparency;
- undoManager->action(this,ss);
- }
- if (meshGradientPatches[col].BL.gridPoint == xx)
- {
- ScItemState<QPair<QColor,QColor> > *ss = new ScItemState<QPair<QColor,QColor> >(Um::GradVal);
- ss->set("GRAD_MESH_COLOR","grad_mesh_color");
- ss->set("X",col);
- ss->set("Y",4);
- ss->set("PATCH",true);
- mp = &(meshGradientPatches[col].BL);
- ss->set("OLD_COLOR_NAME",mp->colorName);
- ss->set("NEW_COLOR_NAME",MColor);
- ss->setItem(qMakePair(mp->color,MQColor));
- ss->set("OLD_SHADE",mp->shade);
- ss->set("NEW_SHADE",shade);
- ss->set("OLD_TRANSP",mp->transparency);
- ss->set("NEW_TRANSP",transparency);
- mp->colorName = MColor;
- mp->color = MQColor;
- mp->shade = shade;
- mp->transparency = transparency;
- undoManager->action(this,ss);
- }
- }
- }
- trans.commit();
- }
- else
- {
- if ((x > -1) && (y > -1))
- {
+
+ UndoTransaction *trans = NULL;
+ if(UndoManager::undoEnabled())
+ {
+ trans = new UndoTransaction(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradVal,"",Um::IFill));
ScItemState<QPair<QColor,QColor> > *ss = new ScItemState<QPair<QColor,QColor> >(Um::GradVal);
ss->set("GRAD_MESH_COLOR","grad_mesh_color");
ss->set("X",x);
ss->set("Y",y);
- ss->set("PATCH",false);
- mp = &(meshGradientArray[x][y]);
+ ss->set("PATCH",true);
ss->set("OLD_COLOR_NAME",mp->colorName);
ss->set("NEW_COLOR_NAME",MColor);
ss->setItem(qMakePair(mp->color,MQColor));
@@ -3163,11 +3083,147 @@
ss->set("NEW_SHADE",shade);
ss->set("OLD_TRANSP",mp->transparency);
ss->set("NEW_TRANSP",transparency);
+ undoManager->action(this,ss);
+ }
+ mp->colorName = MColor;
+ mp->color = MQColor;
+ mp->shade = shade;
+ mp->transparency = transparency;
+ FPoint xx = mp->gridPoint;
+ for (int col = 0; col < meshGradientPatches.count(); col++)
+ {
+ if (col != x)
+ {
+ if (meshGradientPatches[col].TL.gridPoint == xx)
+ {
+ mp = &(meshGradientPatches[col].TL);
+ if(UndoManager::undoEnabled())
+ {
+ ScItemState<QPair<QColor,QColor> > *ss = new ScItemState<QPair<QColor,QColor> >(Um::GradVal);
+ ss->set("GRAD_MESH_COLOR","grad_mesh_color");
+ ss->set("X",col);
+ ss->set("Y",1);
+ ss->set("PATCH",true);
+ ss->set("OLD_COLOR_NAME",mp->colorName);
+ ss->set("NEW_COLOR_NAME",MColor);
+ ss->setItem(qMakePair(mp->color,MQColor));
+ ss->set("OLD_SHADE",mp->shade);
+ ss->set("NEW_SHADE",shade);
+ ss->set("OLD_TRANSP",mp->transparency);
+ ss->set("NEW_TRANSP",transparency);
+ undoManager->action(this,ss);
+ }
+ mp->colorName = MColor;
+ mp->color = MQColor;
+ mp->shade = shade;
+ mp->transparency = transparency;
+ }
+ if (meshGradientPatches[col].TR.gridPoint == xx)
+ {
+ mp = &(meshGradientPatches[col].TR);
+ if(UndoManager::undoEnabled())
+ {
+ ScItemState<QPair<QColor,QColor> > *ss = new ScItemState<QPair<QColor,QColor> >(Um::GradVal);
+ ss->set("GRAD_MESH_COLOR","grad_mesh_color");
+ ss->set("X",col);
+ ss->set("Y",2);
+ ss->set("PATCH",true);
+ ss->set("OLD_COLOR_NAME",mp->colorName);
+ ss->set("NEW_COLOR_NAME",MColor);
+ ss->setItem(qMakePair(mp->color,MQColor));
+ ss->set("OLD_SHADE",mp->shade);
+ ss->set("NEW_SHADE",shade);
+ ss->set("OLD_TRANSP",mp->transparency);
+ ss->set("NEW_TRANSP",transparency);
+ undoManager->action(this,ss);
+ }
+ mp->colorName = MColor;
+ mp->color = MQColor;
+ mp->shade = shade;
+ mp->transparency = transparency;
+ }
+ if (meshGradientPatches[col].BR.gridPoint == xx)
+ {
+ mp = &(meshGradientPatches[col].BR);
+ if(UndoManager::undoEnabled())
+ {
+ ScItemState<QPair<QColor,QColor> > *ss = new ScItemState<QPair<QColor,QColor> >(Um::GradVal);
+ ss->set("GRAD_MESH_COLOR","grad_mesh_color");
+ ss->set("X",col);
+ ss->set("Y",3);
+ ss->set("PATCH",true);
+ ss->set("OLD_COLOR_NAME",mp->colorName);
+ ss->set("NEW_COLOR_NAME",MColor);
+ ss->setItem(qMakePair(mp->color,MQColor));
+ ss->set("OLD_SHADE",mp->shade);
+ ss->set("NEW_SHADE",shade);
+ ss->set("OLD_TRANSP",mp->transparency);
+ ss->set("NEW_TRANSP",transparency);
+ undoManager->action(this,ss);
+ }
+ mp->colorName = MColor;
+ mp->color = MQColor;
+ mp->shade = shade;
+ mp->transparency = transparency;
+ }
+ if (meshGradientPatches[col].BL.gridPoint == xx)
+ {
+ mp = &(meshGradientPatches[col].BL);
+ if(UndoManager::undoEnabled())
+ {
+ ScItemState<QPair<QColor,QColor> > *ss = new ScItemState<QPair<QColor,QColor> >(Um::GradVal);
+ ss->set("GRAD_MESH_COLOR","grad_mesh_color");
+ ss->set("X",col);
+ ss->set("Y",4);
+ ss->set("PATCH",true);
+ ss->set("OLD_COLOR_NAME",mp->colorName);
+ ss->set("NEW_COLOR_NAME",MColor);
+ ss->setItem(qMakePair(mp->color,MQColor));
+ ss->set("OLD_SHADE",mp->shade);
+ ss->set("NEW_SHADE",shade);
+ ss->set("OLD_TRANSP",mp->transparency);
+ ss->set("NEW_TRANSP",transparency);
+ undoManager->action(this,ss);
+ }
+ mp->colorName = MColor;
+ mp->color = MQColor;
+ mp->shade = shade;
+ mp->transparency = transparency;
+ }
+ }
+ }
+ if(trans)
+ {
+ trans->commit();
+ delete trans;
+ trans = NULL;
+ }
+ }
+ else
+ {
+ if ((x > -1) && (y > -1))
+ {
+ mp = &(meshGradientArray[x][y]);
+ if(UndoManager::undoEnabled())
+ {
+ ScItemState<QPair<QColor,QColor> > *ss = new ScItemState<QPair<QColor,QColor> >(Um::GradVal);
+ ss->set("GRAD_MESH_COLOR","grad_mesh_color");
+ ss->set("X",x);
+ ss->set("Y",y);
+ ss->set("PATCH",false);
+ ss->set("OLD_COLOR_NAME",mp->colorName);
+ ss->set("NEW_COLOR_NAME",MColor);
+ ss->setItem(qMakePair(mp->color,MQColor));
+ ss->set("OLD_SHADE",mp->shade);
+ ss->set("NEW_SHADE",shade);
+ ss->set("OLD_TRANSP",mp->transparency);
+ ss->set("NEW_TRANSP",transparency);
+ undoManager->action(this,ss);
+ }
mp->colorName = MColor;
mp->color = MQColor;
mp->shade = shade;
mp->transparency = transparency;
- undoManager->action(this,ss);
}
}
}
@@ -3213,12 +3269,15 @@
VisionDefectColor defect;
MQColor = defect.convertDefect(MQColor, m_Doc->previewVisual);
}
- ScItemState<QList<QList<meshPoint> > > *is = new ScItemState<QList<QList<meshPoint> > >(Um::MeshGradient);
- is->set("CREATE_MESH_GRAD","create_mesh_grad");
- is->set("ROW",rows);
- is->set("COL",cols);
- is->setItem(meshGradientArray);
- undoManager->action(this,is);
+ if(UndoManager::undoEnabled())
+ {
+ ScItemState<QList<QList<meshPoint> > > *is = new ScItemState<QList<QList<meshPoint> > >(Um::MeshGradient);
+ is->set("CREATE_MESH_GRAD","create_mesh_grad");
+ is->set("ROW",rows);
+ is->set("COL",cols);
+ is->setItem(meshGradientArray);
+ undoManager->action(this,is);
+ }
meshGradientArray.clear();
double xoffs = Width / static_cast<double>(cols);
double yoffs = Height / static_cast<double>(rows);
@@ -3243,10 +3302,13 @@
{
int rows = meshGradientArray.count();
int cols = meshGradientArray[0].count();
- ScItemState<QList<QList<meshPoint> > > *is = new ScItemState<QList<QList<meshPoint> > >(Um::ResetControlPoints);
- is->set("RESET_MESH_GRAD","reset_mesh_grad");
- is->setItem(meshGradientArray);
- undoManager->action(this,is);
+ if(UndoManager::undoEnabled())
+ {
+ ScItemState<QList<QList<meshPoint> > > *is = new ScItemState<QList<QList<meshPoint> > >(Um::ResetControlPoints);
+ is->set("RESET_MESH_GRAD","reset_mesh_grad");
+ is->setItem(meshGradientArray);
+ undoManager->action(this,is);
+ }
double xoffs = Width / static_cast<double>(cols-1);
double yoffs = Height / static_cast<double>(rows-1);
for (int x = 0; x < rows; x++)
@@ -3290,15 +3352,18 @@
meshGradientArray[m-1][0].gridPoint.x(), meshGradientArray[m-1][0].gridPoint.y());
}
- UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::ChangeMeshGradient,"",Um::IFill));
- ScItemState<QPair<QList<QList<meshPoint> >,FPointArray> > *ism = new ScItemState<QPair<QList<QList<meshPoint> >,FPointArray> >(Um::ChangeMeshGradient, "",Um::IFill);
- ism->set("MOVE_MESH_GRAD", "move_mesh_grad");
- ism->setItem(qMakePair(meshGradientArray,PoLine));
- ism->set("OLDB",OldB2);
- ism->set("OLDH",OldH2);
- ism->set("FRAME_TYPE",FrameType);
- undoManager->action(this, ism);
-
+ UndoTransaction *trans = NULL;
+ if(UndoManager::undoEnabled())
+ {
+ trans = new UndoTransaction(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::ChangeMeshGradient,"",Um::IFill));
+ ScItemState<QPair<QList<QList<meshPoint> >,FPointArray> > *ism = new ScItemState<QPair<QList<QList<meshPoint> >,FPointArray> >(Um::ChangeMeshGradient, "",Um::IFill);
+ ism->set("MOVE_MESH_GRAD", "move_mesh_grad");
+ ism->setItem(qMakePair(meshGradientArray,PoLine));
+ ism->set("OLDB",OldB2);
+ ism->set("OLDH",OldH2);
+ ism->set("FRAME_TYPE",FrameType);
+ undoManager->action(this, ism);
+ }
QList<QList<meshPoint> > meshGradientArrayOld = meshGradientArray;
PoLine = Coords.copy();
double oldX = Xpos;
@@ -3317,12 +3382,20 @@
for (int x = 0; x < rows+1; x++)
for (int y = 0; y < cols+1; y++)
meshGradientArray[x][y].moveRel(dx, dy);
- ScItemState<FPointArray> *is = new ScItemState<FPointArray>(Um::ResetContourLine, "",Um::IBorder);
- is->set("RESET_CONTOUR", "reset_contour");
- is->setItem(ContourLine);
- undoManager->action(this, is);
+ if(UndoManager::undoEnabled())
+ {
+ ScItemState<FPointArray> *is = new ScItemState<FPointArray>(Um::ResetContourLine, "",Um::IBorder);
+ is->set("RESET_CONTOUR", "reset_contour");
+ is->setItem(ContourLine);
+ undoManager->action(this, is);
+ }
ContourLine = PoLine.copy();
- trans.commit();
+ if(trans)
+ {
+ trans->commit();
+ delete trans;
+ trans = NULL;
+ }
}
void PageItem::createConicalMesh()
@@ -3606,11 +3679,14 @@
{
if(GrMask==val)
return;
- SimpleState *ss = new SimpleState(Um::GradTypeMask,"",Um::IFill);
- ss->set("MASKTYPE","masktype");
- ss->set("NEW",val);
- ss->set("OLD",GrMask);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradTypeMask,"",Um::IFill);
+ ss->set("MASKTYPE","masktype");
+ ss->set("NEW",val);
+ ss->set("OLD",GrMask);
+ undoManager->action(this,ss);
+ }
GrMask = val;
}
@@ -4133,11 +4209,14 @@
{
if (m_startArrowScale == newScale)
return; // nothing to do -> return
- SimpleState *ss = new SimpleState(Um::StartArrowScale,"",Um::IArrow);
- ss->set("START_ARROWSCALE","start_arrowscale");
- ss->set("OLD_SCALE",m_startArrowScale);
- ss->set("NEW_SCALE",newScale);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::StartArrowScale,"",Um::IArrow);
+ ss->set("START_ARROWSCALE","start_arrowscale");
+ ss->set("OLD_SCALE",m_startArrowScale);
+ ss->set("NEW_SCALE",newScale);
+ undoManager->action(this,ss);
+ }
m_startArrowScale = newScale;
}
@@ -4145,11 +4224,14 @@
{
if (m_endArrowScale == newScale)
return; // nothing to do -> return
- SimpleState *ss = new SimpleState(Um::EndArrowScale,"",Um::IArrow);
- ss->set("END_ARROWSCALE","end_arrowscale");
- ss->set("OLD_SCALE",m_endArrowScale);
- ss->set("NEW_SCALE",newScale);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::EndArrowScale,"",Um::IArrow);
+ ss->set("END_ARROWSCALE","end_arrowscale");
+ ss->set("OLD_SCALE",m_endArrowScale);
+ ss->set("NEW_SCALE",newScale);
+ undoManager->action(this,ss);
+ }
m_endArrowScale = newScale;
}
@@ -4639,6 +4721,8 @@
{
bool useRasterBackup = m_Doc->useRaster;
bool SnapGuidesBackup = m_Doc->SnapGuides;
+ bool SnapElementBackup = m_Doc->SnapElement;
+ m_Doc->SnapElement = false;
m_Doc->useRaster = false;
m_Doc->SnapGuides = false;
SimpleState *ss = dynamic_cast<SimpleState*>(state);
@@ -4797,8 +4881,6 @@
restoreArrow(ss, isUndo, true);
else if (ss->contains("END_ARROW"))
restoreArrow(ss, isUndo, false);
- else if (ss->contains("PSTYLE"))
- restorePStyle(ss, isUndo);
else if (ss->contains("CONVERT"))
restoreType(ss, isUndo);
else if (ss->contains("TEXTFLOW_OLDMODE"))
@@ -4871,6 +4953,7 @@
if (!OnMasterPage.isEmpty())
m_Doc->setCurrentPage(oldCurrentPage);
m_Doc->setMasterPageMode(oldMPMode);
+ m_Doc->SnapElement = SnapElementBackup;
m_Doc->useRaster = useRasterBackup;
m_Doc->SnapGuides = SnapGuidesBackup;
}
@@ -6452,17 +6535,6 @@
setEndArrowIndex(i);
}
-
-void PageItem::restorePStyle(SimpleState *state, bool isUndo)
-{
- int styleid = state->getInt("OLD_STYLE");
- if (!isUndo)
- styleid = state->getInt("NEW_STYLE");
- //will be done later with other text-undo:
- // m_Doc->chAbStyle(this, styleid);
-}
-
-
// FIXME: This must go into class ScribusDoc!
// For now we'll just make it independent of 'this' -- AV
void PageItem::restoreType(SimpleState *state, bool isUndo)
@@ -6615,7 +6687,7 @@
{
unlink(false);
//restore properly text if frame was linked at beginning of chain
- ScItemState<std::pair<PageItem*, PageItem*> > *is = dynamic_cast<ScItemState<std::pair<PageItem*, PageItem*> >*>(state);
+ ScItemState<QPair<PageItem*, PageItem*> > *is = dynamic_cast<ScItemState<QPair<PageItem*, PageItem*> >*>(state);
int joinPos = is->getInt("JOIN_POS");
int ParSep = is->getBool("ADDPARSEP")?1:0;
if (is->getBool("FIRST"))
@@ -6650,7 +6722,7 @@
}
else
{
- ScItemState<std::pair<PageItem*, PageItem*> > *is = dynamic_cast<ScItemState<std::pair<PageItem*, PageItem*> >*>(state);
+ ScItemState<QPair<PageItem*, PageItem*> > *is = dynamic_cast<ScItemState<QPair<PageItem*, PageItem*> >*>(state);
asTextFrame()->link(is->getItem().second->asTextFrame());
}
}
@@ -6659,7 +6731,7 @@
{
if (!isTextFrame())
return;
- ScItemState<std::pair<PageItem*, PageItem*> > *is = dynamic_cast<ScItemState<std::pair<PageItem*, PageItem*> >*>(state);
+ ScItemState<QPair<PageItem*, PageItem*> > *is = dynamic_cast<ScItemState<QPair<PageItem*, PageItem*> >*>(state);
if (is->contains("CUT_TEXT"))
{
bool cutText = is->getBool("CUT_TEXT");
@@ -7289,11 +7361,14 @@
{
if(GrType==val)
return;
- SimpleState *ss = new SimpleState(Um::GradType,"",Um::IFill);
- ss->set("GRAD_TYPE","grad_type");
- ss->set("OLD",GrType);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradType,"",Um::IFill);
+ ss->set("GRAD_TYPE","grad_type");
+ ss->set("OLD",GrType);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrType = val;
}
@@ -7301,11 +7376,14 @@
{
if(GrTypeStroke==val)
return;
- SimpleState *ss = new SimpleState(Um::GradTypeStroke,"",Um::ILineStyle);
- ss->set("GRAD_TYPESTROKE","grad_typestroke");
- ss->set("OLD",GrTypeStroke);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradTypeStroke,"",Um::ILineStyle);
+ ss->set("GRAD_TYPESTROKE","grad_typestroke");
+ ss->set("OLD",GrTypeStroke);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrTypeStroke = val;
}
@@ -7313,11 +7391,14 @@
{
if(GrColorP1==val)
return;
- SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
- ss->set("GRAD_COL1","grad_col1");
- ss->set("OLD",GrColorP1);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
+ ss->set("GRAD_COL1","grad_col1");
+ ss->set("OLD",GrColorP1);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrColorP1 = val;
}
@@ -7325,11 +7406,14 @@
{
if(GrColorP2==val)
return;
- SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
- ss->set("GRAD_COL2","grad_col2");
- ss->set("OLD",GrColorP2);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
+ ss->set("GRAD_COL2","grad_col2");
+ ss->set("OLD",GrColorP2);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrColorP2 = val;
}
@@ -7337,11 +7421,14 @@
{
if(GrColorP3==val)
return;
- SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
- ss->set("GRAD_COL3","grad_col3");
- ss->set("OLD",GrColorP3);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
+ ss->set("GRAD_COL3","grad_col3");
+ ss->set("OLD",GrColorP3);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrColorP3 = val;
}
@@ -7349,11 +7436,14 @@
{
if(GrColorP4==val)
return;
- SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
- ss->set("GRAD_COL4","grad_col4");
- ss->set("OLD",GrColorP4);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
+ ss->set("GRAD_COL4","grad_col4");
+ ss->set("OLD",GrColorP4);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrColorP4 = val;
}
@@ -7361,11 +7451,14 @@
{
if(GrCol1Shade==val)
return;
- SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
- ss->set("GRAD_SHADE1","grad_shade1");
- ss->set("OLD",GrCol1Shade);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
+ ss->set("GRAD_SHADE1","grad_shade1");
+ ss->set("OLD",GrCol1Shade);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrCol1Shade = val;
}
@@ -7373,11 +7466,14 @@
{
if(GrCol1Shade==val)
return;
- SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
- ss->set("GRAD_SHADE2","grad_shade2");
- ss->set("OLD",GrCol2Shade);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
+ ss->set("GRAD_SHADE2","grad_shade2");
+ ss->set("OLD",GrCol2Shade);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrCol2Shade = val;
}
@@ -7385,11 +7481,14 @@
{
if(GrCol1Shade==val)
return;
- SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
- ss->set("GRAD_SHADE3","grad_shade3");
- ss->set("OLD",GrCol3Shade);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
+ ss->set("GRAD_SHADE3","grad_shade3");
+ ss->set("OLD",GrCol3Shade);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrCol3Shade = val;
}
@@ -7397,11 +7496,14 @@
{
if(GrCol1Shade==val)
return;
- SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
- ss->set("GRAD_SHADE4","grad_shade4");
- ss->set("OLD",GrCol4Shade);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
+ ss->set("GRAD_SHADE4","grad_shade4");
+ ss->set("OLD",GrCol4Shade);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrCol4Shade = val;
}
@@ -7409,11 +7511,14 @@
{
if(GrCol1transp==val)
return;
- SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
- ss->set("GRAD_TRANSP1","grad_transp1");
- ss->set("OLD",GrCol1transp);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
+ ss->set("GRAD_TRANSP1","grad_transp1");
+ ss->set("OLD",GrCol1transp);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrCol1transp = val;
}
@@ -7421,11 +7526,14 @@
{
if(GrCol2transp==val)
return;
- SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
- ss->set("GRAD_TRANSP2","grad_transp2");
- ss->set("OLD",GrCol2transp);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
+ ss->set("GRAD_TRANSP2","grad_transp2");
+ ss->set("OLD",GrCol2transp);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrCol2transp = val;
}
@@ -7433,11 +7541,14 @@
{
if(GrCol3transp==val)
return;
- SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
- ss->set("GRAD_TRANSP3","grad_transp3");
- ss->set("OLD",GrCol3transp);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
+ ss->set("GRAD_TRANSP3","grad_transp3");
+ ss->set("OLD",GrCol3transp);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrCol3transp = val;
}
@@ -7445,11 +7556,14 @@
{
if(GrCol4transp==val)
return;
- SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
- ss->set("GRAD_TRANSP4","grad_transp4");
- ss->set("OLD",GrCol4transp);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
+ ss->set("GRAD_TRANSP4","grad_transp4");
+ ss->set("OLD",GrCol4transp);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrCol4transp = val;
}
@@ -7457,10 +7571,13 @@
{
if(GrColorP1QColor ==val)
return;
- ScItemState<QPair<QColor,QColor> > *ss = new ScItemState<QPair<QColor,QColor> >(Um::GradCol,"",Um::IFill);
- ss->set("GRAD_QCOLOR1","grad_qcolor1");
- ss->setItem(qMakePair(GrColorP1QColor,val));
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ ScItemState<QPair<QColor,QColor> > *ss = new ScItemState<QPair<QColor,QColor> >(Um::GradCol,"",Um::IFill);
+ ss->set("GRAD_QCOLOR1","grad_qcolor1");
+ ss->setItem(qMakePair(GrColorP1QColor,val));
+ undoManager->action(this,ss);
+ }
GrColorP1QColor = val;
}
@@ -7468,10 +7585,13 @@
{
if(GrColorP2QColor ==val)
return;
- ScItemState<QPair<QColor,QColor> > *ss = new ScItemState<QPair<QColor,QColor> >(Um::GradCol,"",Um::IFill);
- ss->set("GRAD_QCOLOR2","grad_qcolor2");
- ss->setItem(qMakePair(GrColorP2QColor,val));
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ ScItemState<QPair<QColor,QColor> > *ss = new ScItemState<QPair<QColor,QColor> >(Um::GradCol,"",Um::IFill);
+ ss->set("GRAD_QCOLOR2","grad_qcolor2");
+ ss->setItem(qMakePair(GrColorP2QColor,val));
+ undoManager->action(this,ss);
+ }
GrColorP2QColor = val;
}
@@ -7479,10 +7599,13 @@
{
if(GrColorP3QColor ==val)
return;
- ScItemState<QPair<QColor,QColor> > *ss = new ScItemState<QPair<QColor,QColor> >(Um::GradCol,"",Um::IFill);
- ss->set("GRAD_QCOLOR3","grad_qcolor3");
- ss->setItem(qMakePair(GrColorP3QColor,val));
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ ScItemState<QPair<QColor,QColor> > *ss = new ScItemState<QPair<QColor,QColor> >(Um::GradCol,"",Um::IFill);
+ ss->set("GRAD_QCOLOR3","grad_qcolor3");
+ ss->setItem(qMakePair(GrColorP3QColor,val));
+ undoManager->action(this,ss);
+ }
GrColorP3QColor = val;
}
@@ -7490,10 +7613,13 @@
{
if(GrColorP4QColor ==val)
return;
- ScItemState<QPair<QColor,QColor> > *ss = new ScItemState<QPair<QColor,QColor> >(Um::GradCol,"",Um::IFill);
- ss->set("GRAD_QCOLOR4","grad_qcolor4");
- ss->setItem(qMakePair(GrColorP4QColor,val));
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ ScItemState<QPair<QColor,QColor> > *ss = new ScItemState<QPair<QColor,QColor> >(Um::GradCol,"",Um::IFill);
+ ss->set("GRAD_QCOLOR4","grad_qcolor4");
+ ss->setItem(qMakePair(GrColorP4QColor,val));
+ undoManager->action(this,ss);
+ }
GrColorP4QColor = val;
}
@@ -7501,324 +7627,414 @@
{
if(snapToPatchGrid ==val)
return;
- SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
- ss->set("SNAP_TO_PATCH","snap_to_patch");
- ss->set("OLD",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
+ ss->set("SNAP_TO_PATCH","snap_to_patch");
+ ss->set("OLD",val);
+ undoManager->action(this,ss);
+ }
snapToPatchGrid = val;
}
void PageItem::setGradientStartX(double val){
if(GrStartX==val)
return;
- SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
- ss->set("GRAD_STARTX","grad_startx");
- ss->set("OLD",GrStartX);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
+ ss->set("GRAD_STARTX","grad_startx");
+ ss->set("OLD",GrStartX);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrStartX = val;
}
void PageItem::setGradientStartY(double val){
if(GrStartY==val)
return;
- SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
- ss->set("GRAD_STARTY","grad_starty");
- ss->set("OLD",GrStartY);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
+ ss->set("GRAD_STARTY","grad_starty");
+ ss->set("OLD",GrStartY);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrStartY = val;
}
void PageItem::setGradientEndX(double val){
if(GrEndX==val)
return;
- SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
- ss->set("GRAD_ENDX","grad_endx");
- ss->set("OLD",GrEndX);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
+ ss->set("GRAD_ENDX","grad_endx");
+ ss->set("OLD",GrEndX);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrEndX = val;
}
void PageItem::setGradientEndY(double val){
if(GrEndY==val)
return;
- SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
- ss->set("GRAD_ENDY","grad_endy");
- ss->set("OLD",GrEndY);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
+ ss->set("GRAD_ENDY","grad_endy");
+ ss->set("OLD",GrEndY);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrEndY = val;
}
void PageItem::setGradientFocalX(double val){
if(GrFocalX==val)
return;
- SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
- ss->set("GRAD_FOCALX","grad_focalx");
- ss->set("OLD",GrFocalX);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
+ ss->set("GRAD_FOCALX","grad_focalx");
+ ss->set("OLD",GrFocalX);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrFocalX = val;
}
void PageItem::setGradientFocalY(double val){
if(GrFocalY==val)
return;
- SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
- ss->set("GRAD_FOCALY","grad_focaly");
- ss->set("OLD",GrFocalY);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
+ ss->set("GRAD_FOCALY","grad_focaly");
+ ss->set("OLD",GrFocalY);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrFocalY = val;
}
void PageItem::setGradientScale(double val){
if(GrScale==val)
return;
- SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
- ss->set("GRAD_SCALE","grad_scale");
- ss->set("OLD",GrScale);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
+ ss->set("GRAD_SCALE","grad_scale");
+ ss->set("OLD",GrScale);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrScale = val;
}
void PageItem::setGradientSkew(double val){
if(GrSkew==val)
return;
- SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
- ss->set("GRAD_SKEW","grad_skew");
- ss->set("OLD",GrSkew);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
+ ss->set("GRAD_SKEW","grad_skew");
+ ss->set("OLD",GrSkew);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrSkew = val;
}
void PageItem::setGradientMaskStartX(double val){
if(GrMaskStartX==val)
return;
- SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
- ss->set("GRAD_MASKSTARTX","grad_maskstartx");
- ss->set("OLD",GrMaskStartX);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
+ ss->set("GRAD_MASKSTARTX","grad_maskstartx");
+ ss->set("OLD",GrMaskStartX);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrMaskStartX = val;
}
void PageItem::setGradientMaskStartY(double val){
if(GrMaskStartY==val)
return;
- SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
- ss->set("GRAD_MASKSTARTY","grad_maskstarty");
- ss->set("OLD",GrMaskStartY);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
+ ss->set("GRAD_MASKSTARTY","grad_maskstarty");
+ ss->set("OLD",GrMaskStartY);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrMaskStartY = val;
}
void PageItem::setGradientMaskEndX(double val){
if(GrMaskEndX==val)
return;
- SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
- ss->set("GRAD_MASKENDX","grad_maskendx");
- ss->set("OLD",GrMaskEndX);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
+ ss->set("GRAD_MASKENDX","grad_maskendx");
+ ss->set("OLD",GrMaskEndX);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrMaskEndX = val;
}
void PageItem::setGradientMaskEndY(double val){
if(GrMaskEndY==val)
return;
- SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
- ss->set("GRAD_MASKENDY","grad_maskendy");
- ss->set("OLD",GrMaskEndY);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
+ ss->set("GRAD_MASKENDY","grad_maskendy");
+ ss->set("OLD",GrMaskEndY);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrMaskEndY = val;
}
void PageItem::setGradientMaskFocalX(double val){
if(GrMaskFocalX==val)
return;
- SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
- ss->set("GRAD_MASKFOCALX","grad_maskfocalx");
- ss->set("OLD",GrMaskFocalX);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
+ ss->set("GRAD_MASKFOCALX","grad_maskfocalx");
+ ss->set("OLD",GrMaskFocalX);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrMaskFocalX = val;
}
void PageItem::setGradientMaskFocalY(double val){
if(GrMaskFocalY==val)
return;
- SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
- ss->set("GRAD_MASKFOCALY","grad_maskfocaly");
- ss->set("OLD",GrMaskFocalY);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
+ ss->set("GRAD_MASKFOCALY","grad_maskfocaly");
+ ss->set("OLD",GrMaskFocalY);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrMaskFocalY = val;
}
void PageItem::setGradientMaskScale(double val){
if(GrMaskScale==val)
return;
- SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
- ss->set("GRAD_MASKSCALE","grad_maskscale");
- ss->set("OLD",GrMaskScale);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
+ ss->set("GRAD_MASKSCALE","grad_maskscale");
+ ss->set("OLD",GrMaskScale);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrMaskScale = val;
}
void PageItem::setGradientMaskSkew(double val){
if(GrMaskSkew==val)
return;
- SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
- ss->set("GRAD_MASKSKEW","grad_maskskew");
- ss->set("OLD",GrMaskSkew);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
+ ss->set("GRAD_MASKSKEW","grad_maskskew");
+ ss->set("OLD",GrMaskSkew);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrMaskSkew = val;
}
void PageItem::setGradientControl1(FPoint val){
if(GrControl1==val)
return;
- ScItemState<QPair<FPoint,FPoint> > *ss = new ScItemState<QPair<FPoint,FPoint> >(Um::GradPos,"",Um::IFill);
- ss->set("GRAD_CONTROL1","grad_control1");
- ss->setItem(qMakePair(GrControl1,val));
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ ScItemState<QPair<FPoint,FPoint> > *ss = new ScItemState<QPair<FPoint,FPoint> >(Um::GradPos,"",Um::IFill);
+ ss->set("GRAD_CONTROL1","grad_control1");
+ ss->setItem(qMakePair(GrControl1,val));
+ undoManager->action(this,ss);
+ }
GrControl1 = val;
}
void PageItem::setGradientControl2(FPoint val){
if(GrControl2==val)
return;
- ScItemState<QPair<FPoint,FPoint> > *ss = new ScItemState<QPair<FPoint,FPoint> >(Um::GradPos,"",Um::IFill);
- ss->set("GRAD_CONTROL2","grad_control2");
- ss->setItem(qMakePair(GrControl2,val));
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ ScItemState<QPair<FPoint,FPoint> > *ss = new ScItemState<QPair<FPoint,FPoint> >(Um::GradPos,"",Um::IFill);
+ ss->set("GRAD_CONTROL2","grad_control2");
+ ss->setItem(qMakePair(GrControl2,val));
+ undoManager->action(this,ss);
+ }
GrControl2 = val;
}
void PageItem::setGradientControl3(FPoint val){
if(GrControl3==val)
return;
- ScItemState<QPair<FPoint,FPoint> > *ss = new ScItemState<QPair<FPoint,FPoint> >(Um::GradPos,"",Um::IFill);
- ss->set("GRAD_CONTROL3","grad_control3");
- ss->setItem(qMakePair(GrControl3,val));
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ ScItemState<QPair<FPoint,FPoint> > *ss = new ScItemState<QPair<FPoint,FPoint> >(Um::GradPos,"",Um::IFill);
+ ss->set("GRAD_CONTROL3","grad_control3");
+ ss->setItem(qMakePair(GrControl3,val));
+ undoManager->action(this,ss);
+ }
GrControl3 = val;
}
void PageItem::setGradientControl4(FPoint val){
if(GrControl4==val)
return;
- ScItemState<QPair<FPoint,FPoint> > *ss = new ScItemState<QPair<FPoint,FPoint> >(Um::GradPos,"",Um::IFill);
- ss->set("GRAD_CONTROL4","grad_control4");
- ss->setItem(qMakePair(GrControl4,val));
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ ScItemState<QPair<FPoint,FPoint> > *ss = new ScItemState<QPair<FPoint,FPoint> >(Um::GradPos,"",Um::IFill);
+ ss->set("GRAD_CONTROL4","grad_control4");
+ ss->setItem(qMakePair(GrControl4,val));
+ undoManager->action(this,ss);
+ }
GrControl4 = val;
}
void PageItem::setGradientControl5(FPoint val){
if(GrControl5==val)
return;
- ScItemState<QPair<FPoint,FPoint> > *ss = new ScItemState<QPair<FPoint,FPoint> >(Um::GradPos,"",Um::IFill);
- ss->set("GRAD_CONTROL5","grad_control5");
- ss->setItem(qMakePair(GrControl5,val));
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ ScItemState<QPair<FPoint,FPoint> > *ss = new ScItemState<QPair<FPoint,FPoint> >(Um::GradPos,"",Um::IFill);
+ ss->set("GRAD_CONTROL5","grad_control5");
+ ss->setItem(qMakePair(GrControl5,val));
+ undoManager->action(this,ss);
+ }
GrControl5 = val;
}
void PageItem::setGradientStrokeScale(double val){
if(GrStrokeScale==val)
return;
- SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine);
- ss->set("GRADSTROKE_SCALE","gradstroke_scale");
- ss->set("OLD",GrStrokeScale);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine);
+ ss->set("GRADSTROKE_SCALE","gradstroke_scale");
+ ss->set("OLD",GrStrokeScale);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrStrokeScale = val;
}
void PageItem::setGradientStrokeSkew(double val){
if(GrStrokeSkew==val)
return;
- SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine);
- ss->set("GRADSTROKE_SKEW","gradstroke_skew");
- ss->set("OLD",GrStrokeSkew);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine);
+ ss->set("GRADSTROKE_SKEW","gradstroke_skew");
+ ss->set("OLD",GrStrokeSkew);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrStrokeSkew = val;
}
void PageItem::setGradientStrokeFocalX(double val){
if(GrStrokeFocalX==val)
return;
- SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine);
- ss->set("GRADSTROKE_FOCALX","gradstroke_focalx");
- ss->set("OLD",GrStrokeFocalX);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine);
+ ss->set("GRADSTROKE_FOCALX","gradstroke_focalx");
+ ss->set("OLD",GrStrokeFocalX);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrStrokeFocalX = val;
}
void PageItem::setGradientStrokeFocalY(double val){
if(GrStrokeFocalY==val)
return;
- SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine);
- ss->set("GRADSTROKE_FOCALY","gradstroke_focaly");
- ss->set("OLD",GrStrokeFocalY);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine);
+ ss->set("GRADSTROKE_FOCALY","gradstroke_focaly");
+ ss->set("OLD",GrStrokeFocalY);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrStrokeFocalY = val;
}
void PageItem::setGradientStrokeStartX(double val){
if(GrStrokeStartX==val)
return;
- SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine);
- ss->set("GRADSTROKE_STARTX","gradstroke_startx");
- ss->set("OLD",GrStrokeStartX);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine);
+ ss->set("GRADSTROKE_STARTX","gradstroke_startx");
+ ss->set("OLD",GrStrokeStartX);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrStrokeStartX = val;
}
void PageItem::setGradientStrokeStartY(double val){
if(GrStrokeStartY==val)
return;
- SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine);
- ss->set("GRADSTROKE_STARTY","gradstroke_starty");
- ss->set("OLD",GrStrokeStartY);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine);
+ ss->set("GRADSTROKE_STARTY","gradstroke_starty");
+ ss->set("OLD",GrStrokeStartY);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrStrokeStartY = val;
}
void PageItem::setGradientStrokeEndX(double val){
if(GrStrokeEndX==val)
return;
- SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine);
- ss->set("GRADSTROKE_ENDX","gradstroke_endx");
- ss->set("OLD",GrStrokeEndX);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine);
+ ss->set("GRADSTROKE_ENDX","gradstroke_endx");
+ ss->set("OLD",GrStrokeEndX);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrStrokeEndX = val;
}
void PageItem::setGradientStrokeEndY(double val){
if(GrStrokeEndY==val)
return;
- SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine);
- ss->set("GRADSTROKE_ENDY","gradstroke_endy");
- ss->set("OLD",GrStrokeEndY);
- ss->set("NEW",val);
- undoManager->action(this,ss);
+ if(UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine);
+ ss->set("GRADSTROKE_ENDY","gradstroke_endy");
+ ss->set("OLD",GrStrokeEndY);
+ ss->set("NEW",val);
+ undoManager->action(this,ss);
+ }
GrStrokeEndY = val;
}
@@ -9768,7 +9984,7 @@
{
ScItemState<QPair<FirstLineOffsetPolicy,FirstLineOffsetPolicy> > *is = new ScItemState<QPair <FirstLineOffsetPolicy,FirstLineOffsetPolicy> >(Um::FirstLineOffset);
is->set("FIRSTLINEOFFSET", "fisrtlineoffset");
- is->setItem(QPair<FirstLineOffsetPolicy,FirstLineOffsetPolicy>(firstLineOffsetP, flop));
+ is->setItem(qMakePair(firstLineOffsetP, flop));
undoManager->action(this, is);
}
firstLineOffsetP = flop;
Modified: trunk/Scribus/scribus/pageitem.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/pageitem.h
==============================================================================
--- trunk/Scribus/scribus/pageitem.h (original)
+++ trunk/Scribus/scribus/pageitem.h Tue Jul 31 19:57:06 2012
@@ -1416,8 +1416,6 @@
void restoreCustomLineStyle(SimpleState *state, bool isUndo);
void restoreArrow(SimpleState *state, bool isUndo, bool isStart);
- void restorePStyle(SimpleState *state, bool isUndo);
-
void restoreType(SimpleState *state, bool isUndo);
void restoreTextFlowing(SimpleState *state, bool isUndo);
void restoreImageScaleMode(SimpleState *state, bool isUndo);
Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp (original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp Tue Jul 31 19:57:06 2012
@@ -3409,7 +3409,7 @@
return;
}
//>>
-
+
ScribusView* view = m_Doc->view();
switch (kk)
{
@@ -3461,14 +3461,31 @@
unicodeInputString = "";
if (ok)
{
+ UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::ITextFrame,Um::InsertText,"",Um::IDelete));
if (itemText.lengthOfSelection() > 0)
deleteSelectedTextFromFrame();
if (conv < 31)
conv = 32;
+ if (UndoManager::undoEnabled())
+ {
+ SimpleState *ss = dynamic_cast<SimpleState*>(undoManager->getLastUndo());
+ if(ss && ss->get("ETEA") == "insert_frametext")
+ ss->set("TEXT_STR",ss->get("TEXT_STR") + QString(QChar(conv)));
+ else {
+ ss = new SimpleState(Um::InsertText,"",Um::ICreate);
+ ss->set("INSERT_FRAMETEXT", "insert_frametext");
+ ss->set("ETEA", QString("insert_frametext"));
+ ss->set("TEXT_STR", QString(QChar(conv)));
+ ss->set("START", itemText.cursorPosition());
+ undoManager->action(this, ss);
+ }
+ }
itemText.insertChars(QString(QChar(conv)), true);
+ trans.commit();
// Tinput = true;
m_Doc->scMW()->setTBvals(this);
update();
+ doc()->changed();
keyRepeat = false;
return;
}
@@ -3772,14 +3789,18 @@
if (itemText.lengthOfSelection() == 0)
itemText.select(itemText.cursorPosition(), 1, true);
deleteSelectedTextFromFrame();
+ updateLayout();
+ if (oldLast != lastInFrame() && NextBox != 0 && NextBox->invalid)
+ NextBox->updateLayout();
update();
// Tinput = false;
- if ((cr == QChar(13)) && (itemText.length() != 0))
- {
+// if ((cr == QChar(13)) && (itemText.length() != 0))
+// {
// m_Doc->chAbStyle(this, findParagraphStyle(m_Doc, itemText.paragraphStyle(qMax(itemText.cursorPosition()-1,0))));
// Tinput = false;
- }
+// }
m_Doc->scMW()->setTBvals(this);
+ doc()->changed();
// view->RefreshItem(this);
break;
case Qt::Key_Backspace:
@@ -3826,6 +3847,7 @@
}
m_Doc->scMW()->setTBvals(this);
update();
+ doc()->changed();
// view->RefreshItem(this);
break;
default:
@@ -3938,11 +3960,11 @@
updateLayout();
if (oldLast != lastInFrame() && NextBox != 0 && NextBox->invalid)
NextBox->updateLayout();
+ doc()->changed();
}
//check if cursor need to jump to next linked frame
if ((itemText.cursorPosition() > lastInFrame() + 1) && (lastInFrame() < (itemText.length() - 2)) && NextBox != 0)
{
- view->Deselect(true);
view->Deselect(true);
NextBox->update();
m_Doc->scMW()->selectItemsFromOutlines(NextBox);
@@ -3952,10 +3974,7 @@
// update();
// view->slotDoCurs(true);
if ((kk == Qt::Key_Left) || (kk == Qt::Key_Right) || (kk == Qt::Key_Up) || (kk == Qt::Key_Down))
- {
keyRepeat = false;
- return;
- }
}
void PageItem_TextFrame::deleteSelectedTextFromFrame()
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp Tue Jul 31 19:57:06 2012
@@ -1018,13 +1018,13 @@
doc->itemToolPrefs().shapeFillColorShade = attrs.valueAsInt("BRUSHSHADE", 100);
doc->opToolPrefs().magMin = attrs.valueAsInt("MAGMIN", 1);
doc->opToolPrefs().magMax = attrs.valueAsInt("MAGMAX", 3200);
- doc->opToolPrefs().magStep = attrs.valueAsInt("MAGSTEP", 200);
+ doc->opToolPrefs().magStep = attrs.valueAsInt("MAGSTEP", 125);
doc->opToolPrefs().dispX = attrs.valueAsDouble("dispX", 10.0);
doc->opToolPrefs().dispY = attrs.valueAsDouble("dispY", 10.0);
doc->opToolPrefs().constrain = attrs.valueAsDouble("constrain", 15.0);
//CB Reset doc zoom step value to 200% instead of old values.
if (doc->opToolPrefs().magStep <= 100)
- doc->opToolPrefs().magStep = 200;
+ doc->opToolPrefs().magStep = 125;
doc->itemToolPrefs().textTabFillChar = attrs.valueAsString("TabFill","");
doc->itemToolPrefs().textTabWidth = attrs.valueAsDouble("TabWidth", 36.0);
if (attrs.hasAttribute("CPICT"))
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp Tue Jul 31 19:57:06 2012
@@ -402,10 +402,10 @@
m_Doc->itemToolPrefs().shapeFillColorShade = dc.attribute("BRUSHSHADE", "100").toInt();
m_Doc->opToolPrefs().magMin = dc.attribute("MAGMIN", "1").toInt();
m_Doc->opToolPrefs().magMax = dc.attribute("MAGMAX", "3200").toInt();
- m_Doc->opToolPrefs().magStep = dc.attribute("MAGSTEP", "200").toInt();
+ m_Doc->opToolPrefs().magStep = dc.attribute("MAGSTEP", "125").toInt();
//CB Reset doc zoom step value to 200% instead of old values.
if (m_Doc->opToolPrefs().magStep <= 100)
- m_Doc->opToolPrefs().magStep = 200;
+ m_Doc->opToolPrefs().magStep = 125;
m_Doc->itemToolPrefs().textTabFillChar = dc.attribute("TabFill","");
m_Doc->itemToolPrefs().textTabWidth = ScCLocale::toDoubleC(dc.attribute("TabWidth"), 36.0);
if (dc.hasAttribute("CPICT"))
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp Tue Jul 31 19:57:06 2012
@@ -1938,6 +1938,7 @@
m_Doc->rulerXoffset = attrs.valueAsDouble("rulerXoffset", 0.0);
m_Doc->rulerYoffset = attrs.valueAsDouble("rulerYoffset", 0.0);
m_Doc->SnapGuides = attrs.valueAsBool("SnapToGuides", false);
+ m_Doc->SnapElement = attrs.valueAsBool("SnapToElement", false);
m_Doc->useRaster = attrs.valueAsBool("SnapToGrid", false);
m_Doc->setAutoSave(attrs.valueAsBool("AutoSave", false));
@@ -2127,13 +2128,13 @@
doc->itemToolPrefs().calligrapicPenStyle = static_cast<Qt::PenStyle>(attrs.valueAsInt("calligrapicPenStyle"));
doc->opToolPrefs().magMin = attrs.valueAsInt("MAGMIN", 1);
doc->opToolPrefs().magMax = attrs.valueAsInt("MAGMAX", 3200);
- doc->opToolPrefs().magStep = attrs.valueAsInt("MAGSTEP", 200);
+ doc->opToolPrefs().magStep = attrs.valueAsInt("MAGSTEP", 125);
doc->opToolPrefs().dispX = attrs.valueAsDouble("dispX", 10.0);
doc->opToolPrefs().dispY = attrs.valueAsDouble("dispY", 10.0);
doc->opToolPrefs().constrain = attrs.valueAsDouble("constrain", 15.0);
//CB Reset doc zoom step value to 200% instead of old values.
if (doc->opToolPrefs().magStep <= 100)
- doc->opToolPrefs().magStep = 200;
+ doc->opToolPrefs().magStep = 125;
doc->itemToolPrefs().textTabFillChar = attrs.valueAsString("TabFill","");
doc->itemToolPrefs().textTabWidth = attrs.valueAsDouble("TabWidth", 36.0);
if (attrs.hasAttribute("CPICT"))
@@ -3643,8 +3644,10 @@
uint itemCount1 = m_Doc->Items->count();
bool savedAlignGrid = m_Doc->useRaster;
bool savedAlignGuides = m_Doc->SnapGuides;
+ bool savedAlignElement = m_Doc->SnapElement;
m_Doc->useRaster = false;
m_Doc->SnapGuides = false;
+ m_Doc->SnapElement = false;
QStringRef tagName = reader.name();
while(!reader.atEnd() && !reader.hasError())
@@ -3709,6 +3712,7 @@
doc->useRaster = savedAlignGrid;
doc->SnapGuides = savedAlignGuides;
+ doc->SnapElement = savedAlignElement;
if (!success)
{
return false;
Modified: trunk/Scribus/scribus/prefsmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/prefsmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/prefsmanager.cpp (original)
+++ trunk/Scribus/scribus/prefsmanager.cpp Tue Jul 31 19:57:06 2012
@@ -258,7 +258,7 @@
appPrefs.itemToolPrefs.lineEndArrow = 0;
appPrefs.opToolPrefs.magMin = 1;
appPrefs.opToolPrefs.magMax = 3200;
- appPrefs.opToolPrefs.magStep = 200;
+ appPrefs.opToolPrefs.magStep = 125;
appPrefs.docSetupPrefs.docUnitIndex = 0;
appPrefs.itemToolPrefs.polyCorners = 4;
appPrefs.itemToolPrefs.polyFactor = 0.5;
@@ -2104,8 +2104,8 @@
appPrefs.itemToolPrefs.imageStrokeColorShade = dc.attribute("ImageStrokeColorShade", "100").toInt();
appPrefs.itemToolPrefs.imageScaleX = ScCLocale::toDoubleC(dc.attribute("ImageScaleX"), 1.0);
appPrefs.itemToolPrefs.imageScaleY = ScCLocale::toDoubleC(dc.attribute("ImageScaleY"), 1.0);
- appPrefs.itemToolPrefs.imageScaleType = static_cast<bool>(dc.attribute("PSCALE", "1").toInt());
- appPrefs.itemToolPrefs.imageAspectRatio = static_cast<bool>(dc.attribute("PASPECT", "0").toInt());
+ appPrefs.itemToolPrefs.imageScaleType = static_cast<bool>(dc.attribute("PSCALE", "0").toInt());
+ appPrefs.itemToolPrefs.imageAspectRatio = static_cast<bool>(dc.attribute("PASPECT", "1").toInt());
appPrefs.itemToolPrefs.imageUseEmbeddedPath = static_cast<bool>(dc.attribute("EmbeddedPath", "0").toInt());
appPrefs.itemToolPrefs.imageLowResType = dc.attribute("ImageLowResType", "1").toInt();
appPrefs.itemToolPrefs.polyCorners = dc.attribute("PolygonCorners", "4").toInt();
@@ -2146,10 +2146,10 @@
{
appPrefs.opToolPrefs.magMin = dc.attribute("MinimumMagnification", "1").toInt();
appPrefs.opToolPrefs.magMax = dc.attribute("MaximumMagnification", "3200").toInt();
- appPrefs.opToolPrefs.magStep = dc.attribute("MagnificationStep", "200").toInt();
+ appPrefs.opToolPrefs.magStep = dc.attribute("MagnificationStep", "125").toInt();
//CB Reset prefs zoom step value to 200% instead of old values.
if (appPrefs.opToolPrefs.magStep <= 100)
- appPrefs.opToolPrefs.magStep = 200;
+ appPrefs.opToolPrefs.magStep = 125;
appPrefs.opToolPrefs.dispX = ScCLocale::toDoubleC(dc.attribute("DisplayOffsetX"), 10.0);
appPrefs.opToolPrefs.dispY = ScCLocale::toDoubleC(dc.attribute("DisplayOffsetY"), 10.0);
appPrefs.opToolPrefs.constrain = ScCLocale::toDoubleC(dc.attribute("RotationConstrainAngle"), 15.0);
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Tue Jul 31 19:57:06 2012
@@ -952,6 +952,7 @@
scrMenuMgr->addMenuSeparator("Page");
scrMenuMgr->addMenuItem(scrActions["viewSnapToGrid"], "Page", true);
scrMenuMgr->addMenuItem(scrActions["viewSnapToGuides"], "Page", true);
+ scrMenuMgr->addMenuItem(scrActions["viewSnapToElements"], "Page", true);
//View menu
scrMenuMgr->createMenu("View", ActionManager::defaultMenuNameEntryTranslated("View"));
@@ -1346,8 +1347,6 @@
QList<QMdiSubWindow *> windows;
QMdiSubWindow* w = NULL;
int kk = k->key();
- QString uc = k->text();
-// QString cr, Tcha, Twort;
if (HaveDoc)
{
if ((doc->appMode == modeMagnifier) && (kk == Qt::Key_Shift))
@@ -1598,16 +1597,16 @@
if (currItem->asImageFrame() && !currItem->locked())
{
currItem->handleModeEditKey(k, keyrep);
+ slotDocCh(false);
}
//FIXME:av view->oldCp = currItem->CPos;
- if (currItem->itemType() == PageItem::TextFrame)
+ else if (currItem->itemType() == PageItem::TextFrame)
{
bool kr=keyrep;
view->canvasMode()->keyPressEvent(k); //Hack for 1.4.x for stopping the cursor blinking while moving about
currItem->handleModeEditKey(k, keyrep);
keyrep=kr;
}
- slotDocCh(false);
}
}
}
@@ -2451,6 +2450,7 @@
scrActions["viewSnapToGrid"]->setChecked(doc->useRaster);
scrActions["viewSnapToGuides"]->setChecked(doc->SnapGuides);
+ scrActions["viewSnapToElements"]->setChecked(doc->SnapElement);
scrActions["viewShowRulers"]->setEnabled(true);
scrMenuMgr->setMenuEnabled("Insert", true);
@@ -3449,14 +3449,17 @@
uint ac = doc->Items->count();
bool savedAlignGrid = doc->useRaster;
bool savedAlignGuides = doc->SnapGuides;
+ bool savedAlignElement = doc->SnapElement;
doc->useRaster = false;
doc->SnapGuides = false;
+ doc->SnapElement = false;
if ((view->dragX == 0) && (view->dragY == 0))
slotElemRead(data, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), true, false, doc, view);
else
slotElemRead(data, view->dragX, view->dragY, true, false, doc, view);
doc->useRaster = savedAlignGrid;
doc->SnapGuides = savedAlignGuides;
+ doc->SnapElement = savedAlignElement;
Selection tmpSelection(this, false);
tmpSelection.copy(*doc->m_Selection, true);
for (int as = ac; as < doc->Items->count(); ++as)
@@ -4417,6 +4420,7 @@
slotFileClose();
qApp->processEvents();
loadDoc(fn);
+ undoManager->clearStack();
}
}
@@ -4678,6 +4682,7 @@
scrActions["viewFit400"]->setEnabled(false);
//scrMenuMgr->setMenuEnabled("Windows", false);
scrActions["viewSnapToGuides"]->setChecked(false);
+ scrActions["viewSnapToElements"]->setChecked(false);
scrActions["viewSnapToGrid"]->setChecked(false);
scrActions["viewShowRulers"]->setEnabled(false);
@@ -5161,6 +5166,7 @@
{
bool savedAlignGrid = doc->useRaster;
bool savedAlignGuides = doc->SnapGuides;
+ bool savedAlignElement = doc->SnapElement;
int ac = doc->Items->count();
bool isGroup = false;
double gx, gy, gh, gw;
@@ -5168,6 +5174,7 @@
FPoint maxSize = doc->maxCanvasCoordinate;
doc->useRaster = false;
doc->SnapGuides = false;
+ doc->SnapElement = false;
// HACK #6541 : undo does not handle text modification => do not record embedded item creation
// if embedded item is deleted, undo system will not be aware of its deletion => crash - JG
undoManager->setUndoEnabled(false);
@@ -5182,6 +5189,7 @@
doc->useRaster = savedAlignGrid;
doc->SnapGuides = savedAlignGuides;
+ doc->SnapElement = savedAlignElement;
//int tempList=doc->m_Selection->backupToTempList(0);
Selection tempSelection(*doc->m_Selection);
doc->m_Selection->clear();
@@ -5255,8 +5263,10 @@
uint ac = doc->Items->count();
bool savedAlignGrid = doc->useRaster;
bool savedAlignGuides = doc->SnapGuides;
+ bool savedAlignElement = doc->SnapElement;
doc->useRaster = false;
doc->SnapGuides = false;
+ doc->SnapElement = false;
if (internalCopy)
slotElemRead(internalCopyBuffer, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), false, true, doc, view);
else
@@ -5275,6 +5285,7 @@
doc->useRaster = savedAlignGrid;
doc->SnapGuides = savedAlignGuides;
+ doc->SnapElement = savedAlignElement;
doc->m_Selection->delaySignalsOn();
for (int as = ac; as < doc->Items->count(); ++as)
{
@@ -6187,6 +6198,15 @@
if (doc)
{
doc->SnapGuides = !doc->SnapGuides;
+ slotDocCh();
+ }
+}
+
+void ScribusMainWindow::ToggleUElements()
+{
+ if (doc)
+ {
+ doc->SnapElement = !doc->SnapElement;
slotDocCh();
}
}
@@ -7480,9 +7500,11 @@
slotSelect();
bool savedAlignGrid = doc->useRaster;
bool savedAlignGuides = doc->SnapGuides;
+ bool savedAlignElement = doc->SnapElement;
internalCopy = true;
doc->useRaster = false;
doc->SnapGuides = false;
+ doc->SnapElement = false;
slotEditCopy();
view->Deselect(true);
UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::IPolygon,Um::Duplicate,"",Um::IMultipleDuplicate));
@@ -7495,6 +7517,7 @@
trans.commit();
doc->useRaster = savedAlignGrid;
doc->SnapGuides = savedAlignGuides;
+ doc->SnapElement = savedAlignElement;
internalCopy = false;
internalCopyBuffer = "";
view->DrawNew();
@@ -8851,7 +8874,7 @@
QMessageBox msgBox;
QPushButton *abortButton = msgBox.addButton(QMessageBox::Cancel);
QPushButton *lockButton = msgBox.addButton(tr("&Lock All"), QMessageBox::AcceptRole);
- QPushButton *unlockButton = msgBox.addButton(tr("&Unlock All"), QMessageBox::AcceptRole);
+ msgBox.addButton(tr("&Unlock All"), QMessageBox::AcceptRole);
msgBox.setIcon(QMessageBox::Warning);
msgBox.setWindowTitle(CommonStrings::trWarning);
msgBox.setText( tr("Some objects are locked."));
@@ -8861,7 +8884,6 @@
else if (msgBox.clickedButton() == lockButton)
lockObject = true;
modifyLock = true;
- unlockButton = NULL; // just to silence the compiler
}
}
doc->itemSelection_GroupObjects(modifyLock, lockObject);
Modified: trunk/Scribus/scribus/scribus.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/scribus.h
==============================================================================
--- trunk/Scribus/scribus/scribus.h (original)
+++ trunk/Scribus/scribus/scribus.h Tue Jul 31 19:57:06 2012
@@ -478,6 +478,7 @@
void ToggleGuides();
void ToggleBase();
void ToggleUGuides();
+ void ToggleUElements();
void EditTabs();
void SearchText();
void imageEditorExited(int, QProcess::ExitStatus);
Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Tue Jul 31 19:57:06 2012
@@ -207,7 +207,8 @@
NrItems(0),
First(1), Last(0),
viewCount(0), viewID(0),
- SnapGuides(false), GuideLock(false),
+ SnapGuides(false),
+ SnapElement(false), GuideLock(false),
minCanvasCoordinate(FPoint(0, 0)),
rulerXoffset(0.0), rulerYoffset(0.0),
Pages(0), MasterPages(), DocPages(),
@@ -301,6 +302,7 @@
NrItems(0),
First(1), Last(0),
viewCount(0), viewID(0),
+ SnapElement(false),
SnapGuides(false), GuideLock(false),
minCanvasCoordinate(FPoint(0, 0)),
rulerXoffset(0.0), rulerYoffset(0.0),
@@ -2472,7 +2474,7 @@
QString name = lToRemove->Name;
UndoTransaction* activeTransaction = NULL;
if (UndoManager::undoEnabled())
- activeTransaction = new UndoTransaction(undoManager->beginTransaction("Layer", Um::IDocument, Um::DeleteLayer, "", Um::IDelete));
+ activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::Layer, Um::IDocument, Um::DeleteLayer, "", Um::IDelete));
rebuildItemLists();
if (ScCore->usingGUI())
@@ -4965,7 +4967,9 @@
iafData.linkToExistingFramePtr->itemType()==PageItem::TextFrame &&
DocItems.contains(iafData.linkToExistingFramePtr))
prevItem=iafData.linkToExistingFramePtr;
- UndoTransaction transaction(undoManager->beginTransaction(iafData.frameType==PageItem::TextFrame ? Um::TextFrame : Um::ImageFrame,
+ UndoTransaction *transaction = NULL;
+ if(UndoManager::undoEnabled())
+ transaction = new UndoTransaction(undoManager->beginTransaction(iafData.frameType==PageItem::TextFrame ? Um::TextFrame : Um::ImageFrame,
iafData.frameType==PageItem::TextFrame ? Um::ITextFrame : Um::IImageFrame,
Um::InsertFrame, "", Um::ICreate));
for (uint i=0;i<pageNs.size();++i)
@@ -5075,7 +5079,12 @@
}
}
- transaction.commit();
+ if(transaction)
+ {
+ transaction->commit();
+ delete transaction;
+ transaction = NULL;
+ }
setCurrentPage(oldCurrentPage);
changed();
regionsChanged()->update(QRectF());
@@ -5811,9 +5820,7 @@
case PageItem::TextFrame:
newItem = new PageItem_TextFrame(*oldItem);
if (UndoManager::undoEnabled() && oldItem->itemType()==PageItem::PathText)
- {
transactionConversion = new UndoTransaction(undoManager->beginTransaction(currentPage()->getUName(), 0, Um::TextFrame, "", Um::ITextFrame));
- }
break;
//We dont allow this
/* case PageItem::Line:
@@ -5829,9 +5836,7 @@
if (secondaryItem==NULL)
return NULL;
if (UndoManager::undoEnabled())
- {
transactionConversion = new UndoTransaction(undoManager->beginTransaction(currentPage()->getUName(), 0, Um::PathText, "", Um::ITextFrame));
- }
newItem = new PageItem_PathText(*oldItem);
break;
default:
@@ -5847,6 +5852,7 @@
{
transactionConversion->cancel();
delete transactionConversion;
+ transactionConversion = NULL;
}
return NULL;
}
@@ -5975,9 +5981,9 @@
//Create the undo action for the new item
if (UndoManager::undoEnabled())
{
- ScItemState<std::pair<PageItem*, PageItem*> > *is = new ScItemState<std::pair<PageItem*, PageItem*> >("Convert Item");
+ ScItemState<QPair<PageItem*, PageItem*> > *is = new ScItemState<QPair<PageItem*, PageItem*> >("Convert Item");
is->set("CONVERT_ITEM", "convert_item");
- is->setItem(std::pair<PageItem*, PageItem*>(oldItem, newItem));
+ is->setItem(qMakePair(oldItem, newItem));
//Undo target rests with the Page for object specific undo
UndoObject *target = Pages->at(0);
if (newItem->OwnPage > -1)
@@ -6374,11 +6380,9 @@
return false;
QMap<uint, DocumentSection>::Iterator itprev=docPrefsData.docSectionMap.begin();
QMap<uint, DocumentSection>::Iterator it=itprev;
- uint currMinIndex = itprev.value().fromindex;
uint currMaxIndex = itprev.value().toindex;
for ( ; it != docPrefsData.docSectionMap.end(); ++it )
{
- currMinIndex=it.value().fromindex;
currMaxIndex=it.value().toindex;
if (it.key()!=number)
@@ -6648,8 +6652,10 @@
int currActiveLayer = activeLayer();
bool savedAlignGrid = this->useRaster;
bool savedAlignGuides = this->SnapGuides;
+ bool savedAlignElement = this->SnapElement;
this->useRaster = false;
this->SnapGuides = false;
+ this->SnapElement = false;
for (it = Layers.begin(); it != Layers.end(); ++it)
{
if ((lcount < itemBuffer.count()) && !itemBuffer[lcount].isEmpty())
@@ -6663,6 +6669,7 @@
}
this->useRaster = savedAlignGrid;
this->SnapGuides = savedAlignGuides;
+ this->SnapElement = savedAlignElement;
setActiveLayer(currActiveLayer);
}
}
@@ -7186,7 +7193,7 @@
{
UndoTransaction* activeTransaction = NULL;
m_updateManager.setUpdatesDisabled();
- if (selectedItemCount > 1)
+ if (UndoManager::undoEnabled() && selectedItemCount > 1)
activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup,
Um::IGroup, Um::LineWidth, "", Um::ILineStyle));
for (uint a = 0; a < selectedItemCount; ++a)
@@ -7230,7 +7237,7 @@
{
UndoTransaction* activeTransaction = NULL;
m_updateManager.setUpdatesDisabled();
- if (selectedItemCount > 1)
+ if (UndoManager::undoEnabled() && selectedItemCount > 1)
activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup,
Um::IGroup, Um::LineStyle, "", Um::ILineStyle));
for (uint a = 0; a < selectedItemCount; ++a)
@@ -7258,7 +7265,7 @@
{
UndoTransaction* activeTransaction = NULL;
m_updateManager.setUpdatesDisabled();
- if (selectedItemCount > 1)
+ if (UndoManager::undoEnabled() && selectedItemCount > 1)
activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup,
Um::IGroup, Um::LineJoin, "", Um::ILineStyle));
for (uint a = 0; a < selectedItemCount; ++a)
@@ -7286,7 +7293,7 @@
{
UndoTransaction* activeTransaction = NULL;
m_updateManager.setUpdatesDisabled();
- if (selectedItemCount > 1)
+ if (UndoManager::undoEnabled() && selectedItemCount > 1)
activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup,
Um::IGroup, Um::LineEnd, "", Um::ILineStyle));
for (uint a = 0; a < selectedItemCount; ++a)
@@ -7348,7 +7355,7 @@
{
UndoTransaction* activeTransaction = NULL;
m_updateManager.setUpdatesDisabled();
- if (docSelectionCount > 1)
+ if (UndoManager::undoEnabled() && docSelectionCount > 1)
activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::LineStyle, name, Um::ILineStyle));
for (uint aa = 0; aa < docSelectionCount; ++aa)
{
@@ -7377,7 +7384,7 @@
m_updateManager.setUpdatesDisabled();
if (farbe == CommonStrings::tr_NoneColor)
farbe = CommonStrings::None;
- if (selectedItemCount > 1)
+ if (selectedItemCount > 1 && UndoManager::undoEnabled())
activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup,
Um::IGroup, Um::SetLineColor, farbe, Um::IFill));
PageItem *i;
@@ -7494,7 +7501,7 @@
{
UndoTransaction* activeTransaction = NULL;
m_updateManager.setUpdatesDisabled();
- if (selectedItemCount > 1)
+ if (selectedItemCount > 1 && UndoManager::undoEnabled())
activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup,
Um::IGroup, Um::SetFill, farbe, Um::IFill));
PageItem *currItem;
@@ -7522,7 +7529,7 @@
{
UndoTransaction* activeTransaction = NULL;
m_updateManager.setUpdatesDisabled();
- if (selectedItemCount > 1)
+ if (selectedItemCount > 1 && UndoManager::undoEnabled())
activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup,
Um::IGroup, Um::SetShade, QString("%1").arg(sha),
Um::IShade));
@@ -7551,7 +7558,7 @@
{
UndoTransaction* activeTransaction = NULL;
m_updateManager.setUpdatesDisabled();
- if (selectedItemCount > 1)
+ if (selectedItemCount > 1 && UndoManager::undoEnabled())
activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup,
Um::IGroup, Um::SetLineShade, QString("%1").arg(sha), Um::IShade));
PageItem *currItem;
@@ -7577,9 +7584,11 @@
uint selectedItemCount=m_Selection->count();
if (selectedItemCount != 0)
{
+ UndoTransaction* activeTransaction = NULL;
m_updateManager.setUpdatesDisabled();
PageItem *currItem;
- UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradTypeMask,"",Um::IFill));
+ if (selectedItemCount > 1 && UndoManager::undoEnabled())
+ activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradTypeMask,"",Um::IFill));
for (uint a = 0; a < selectedItemCount; ++a)
{
currItem = m_Selection->itemAt(a);
@@ -7588,7 +7597,12 @@
currItem->updateGradientVectors();
currItem->update();
}
- trans.commit();
+ if (activeTransaction)
+ {
+ activeTransaction->commit();
+ delete activeTransaction;
+ activeTransaction = NULL;
+ }
m_updateManager.setUpdatesEnabled();
changed();
}
@@ -7599,9 +7613,11 @@
uint selectedItemCount=m_Selection->count();
if (selectedItemCount != 0)
{
+ UndoTransaction *activeTransaction = NULL;
m_updateManager.setUpdatesDisabled();
PageItem *currItem;
- UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradTypeMask,"",Um::IFill));
+ if (UndoManager::undoEnabled())
+ activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradTypeMask,"",Um::IFill));
for (uint a = 0; a < selectedItemCount; ++a)
{
currItem = m_Selection->itemAt(a);
@@ -7636,7 +7652,12 @@
currItem->updateGradientVectors();
currItem->update();
}
- trans.commit();
+ if (activeTransaction)
+ {
+ activeTransaction->commit();
+ delete activeTransaction;
+ activeTransaction = NULL;
+ }
m_updateManager.setUpdatesEnabled();
changed();
}
@@ -7647,9 +7668,11 @@
uint selectedItemCount=m_Selection->count();
if (selectedItemCount != 0)
{
+ UndoTransaction* trans = NULL;
m_updateManager.setUpdatesDisabled();
PageItem *currItem;
- UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::IPolygon,Um::SetFill,"",Um::IFill));
+ if(UndoManager::undoEnabled())
+ trans = new UndoTransaction(undoManager->beginTransaction(Um::Selection,Um::IPolygon,Um::SetFill,"",Um::IFill));
for (uint a = 0; a < selectedItemCount; ++a)
{
currItem = m_Selection->itemAt(a);
@@ -7729,7 +7752,12 @@
currItem->createConicalMesh();
currItem->update();
}
- trans.commit();
+ if(trans)
+ {
+ trans->commit();
+ delete trans;
+ trans = NULL;
+ }
m_updateManager.setUpdatesEnabled();
changed();
}
@@ -8481,7 +8509,7 @@
ScItemState<QPair<ParagraphStyle,ParagraphStyle> > *is = new ScItemState<QPair <ParagraphStyle,ParagraphStyle> >(Um::SetStyle);
is->set("SET_PARASTYLE", "set_parastyle");
is->set("POS",pos);
- is->setItem(QPair<ParagraphStyle,ParagraphStyle>(newStyle, currItem->itemText.paragraphStyle(pos)));
+ is->setItem(qMakePair(newStyle, currItem->itemText.paragraphStyle(pos)));
undoManager->action(currItem, is);
}
currItem->itemText.setStyle(pos, newStyle);
@@ -8494,7 +8522,7 @@
ScItemState<QPair<ParagraphStyle,ParagraphStyle> > *is = new ScItemState<QPair <ParagraphStyle,ParagraphStyle> >(Um::SetStyle);
is->set("SET_PARASTYLE", "set_parastyle");
is->set("POS",stop);
- is->setItem(QPair<ParagraphStyle,ParagraphStyle>(newStyle2, currItem->itemText.paragraphStyle(stop)));
+ is->setItem(qMakePair(newStyle2, currItem->itemText.paragraphStyle(stop)));
undoManager->action(currItem, is);
}
currItem->itemText.setStyle(stop, newStyle2);
@@ -8507,7 +8535,7 @@
{
ScItemState<QPair<ParagraphStyle,ParagraphStyle> > *is = new ScItemState<QPair <ParagraphStyle,ParagraphStyle> >(Um::SetStyle);
is->set("APPLY_DEFAULTPARASTYLE", "apply_defaultparastyle");
- is->setItem(QPair<ParagraphStyle,ParagraphStyle>(newStyle, currItem->itemText.defaultStyle()));
+ is->setItem(qMakePair(newStyle, currItem->itemText.defaultStyle()));
undoManager->action(currItem, is);
}
currItem->itemText.setDefaultStyle(newStyle);
@@ -8534,7 +8562,7 @@
if (selectedItemCount == 0)
return;
UndoTransaction* activeTransaction = NULL;
- if (selectedItemCount > 1)
+ if (UndoManager::undoEnabled() && selectedItemCount > 1)
activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::ApplyTextStyle, newStyle.displayName(), Um::IFont));
for (uint aa = 0; aa < selectedItemCount; ++aa)
{
@@ -8548,7 +8576,7 @@
{
ScItemState<QPair<ParagraphStyle,ParagraphStyle> > *is = new ScItemState<QPair <ParagraphStyle,ParagraphStyle> >(Um::SetStyle);
is->set("APPLY_DEFAULTPARASTYLE", "apply_defaultparastyle");
- is->setItem(QPair<ParagraphStyle,ParagraphStyle>(dstyle, currItem->itemText.defaultStyle()));
+ is->setItem(qMakePair(dstyle, currItem->itemText.defaultStyle()));
undoManager->action(currItem, is);
}
currItem->itemText.setDefaultStyle(dstyle);
@@ -8573,7 +8601,7 @@
ScItemState<QPair<ParagraphStyle,ParagraphStyle> > *is = new ScItemState<QPair <ParagraphStyle,ParagraphStyle> >(Um::SetStyle);
is->set("APPLY_PARASTYLE", "apply_parastyle");
is->set("POS",pos);
- is->setItem(QPair<ParagraphStyle,ParagraphStyle>(newStyle, currItem->itemText.paragraphStyle(pos)));
+ is->setItem(qMakePair(newStyle, currItem->itemText.paragraphStyle(pos)));
undoManager->action(currItem, is);
}
currItem->itemText.applyStyle(pos, newStyle, rmDirectFormatting);
@@ -8584,7 +8612,7 @@
ScItemState<QPair<ParagraphStyle,ParagraphStyle> > *is = new ScItemState<QPair <ParagraphStyle,ParagraphStyle> >(Um::SetStyle);
is->set("APPLY_PARASTYLE", "apply_parastyle");
is->set("POS",stop);
- is->setItem(QPair<ParagraphStyle,ParagraphStyle>(newStyle, currItem->itemText.paragraphStyle(stop)));
+ is->setItem(qMakePair(newStyle, currItem->itemText.paragraphStyle(stop)));
undoManager->action(currItem, is);
}
currItem->itemText.applyStyle(stop, newStyle, rmDirectFormatting);
@@ -8656,9 +8684,9 @@
ss = dynamic_cast<SimpleState*>(ts->at(0));
if(ss && ss->get("ETEA") == ETEA)
{
- for(int i=0;i<ts->sizet();i++){
+ for(uint i=0;i<ts->sizet();i++){
is = dynamic_cast<ScItemState<QPair<CharStyle,CharStyle> > *>(ts->at(i));
- is->setItem(QPair<CharStyle,CharStyle>(newStyle, is->getItem().second));
+ is->setItem(qMakePair(newStyle, is->getItem().second));
}
}
else
@@ -8668,7 +8696,7 @@
is->set("START",lastPos);
is->set("LENGTH",i-lastPos);
is->set("ETEA", ETEA);
- is->setItem(QPair<CharStyle,CharStyle>(newStyle, currItem->itemText.charStyle(lastPos)));
+ is->setItem(qMakePair(newStyle, currItem->itemText.charStyle(lastPos)));
undoManager->action(currItem, is);
}
}
@@ -8687,7 +8715,7 @@
{
ScItemState<QPair<ParagraphStyle,ParagraphStyle> > *is = new ScItemState<QPair <ParagraphStyle,ParagraphStyle> >(Um::SetStyle);
is->set("APPLY_DEFAULTPARASTYLE", "apply_defaultparastyle");
- is->setItem(QPair<ParagraphStyle,ParagraphStyle>(dstyle, currItem->itemText.defaultStyle()));
+ is->setItem(qMakePair(dstyle, currItem->itemText.defaultStyle()));
undoManager->action(currItem, is);
}
CharStyle lastParent = currItem->itemText.charStyle(0);
@@ -8704,7 +8732,7 @@
ist->set("APPLY_CHARSTYLE", "apply_charstyle");
ist->set("START",lastPos);
ist->set("LENGTH",i-lastPos);
- ist->setItem(QPair<CharStyle,CharStyle>(newStyle, currItem->itemText.charStyle(lastPos)));
+ ist->setItem(qMakePair(newStyle, currItem->itemText.charStyle(lastPos)));
undoManager->action(currItem, ist);
}
lastPos = i;
@@ -8770,7 +8798,7 @@
is->set("SET_CHARSTYLE", "set_charstyle");
is->set("START",start);
is->set("LENGTH",length);
- is->setItem(QPair<CharStyle,CharStyle>(newStyle, currItem->itemText.charStyle(start)));
+ is->setItem(qMakePair(newStyle, currItem->itemText.charStyle(start)));
undoManager->action(currItem, is);
}
currItem->itemText.setCharStyle(start, length, newStyle);
@@ -8784,14 +8812,14 @@
{
ScItemState<QPair<ParagraphStyle,ParagraphStyle> > *is = new ScItemState<QPair <ParagraphStyle,ParagraphStyle> >(Um::SetStyle);
is->set("APPLY_DEFAULTPARASTYLE", "apply_defaultparastyle");
- is->setItem(QPair<ParagraphStyle,ParagraphStyle>(dstyle, currItem->itemText.defaultStyle()));
+ is->setItem(qMakePair(dstyle, currItem->itemText.defaultStyle()));
undoManager->action(currItem, is);
ScItemState<QPair<CharStyle,CharStyle> > *ist = new ScItemState<QPair <CharStyle,CharStyle> >(Um::ApplyTextStyle);
ist->set("SET_CHARSTYLE", "set_charstyle");
ist->set("START",0);
ist->set("LENGTH",currItem->itemText.length());
- ist->setItem(QPair<CharStyle,CharStyle>(newStyle, currItem->itemText.charStyle(0)));
+ ist->setItem(qMakePair(newStyle, currItem->itemText.charStyle(0)));
undoManager->action(currItem, ist);
}
currItem->itemText.setDefaultStyle(dstyle);
@@ -8864,7 +8892,7 @@
is->set("SET_CHARSTYLE", "set_charstyle");
is->set("START",lastPos);
is->set("LENGTH",i-lastPos);
- is->setItem(QPair<CharStyle,CharStyle>(newStyle, currItem->itemText.charStyle(lastPos)));
+ is->setItem(qMakePair(newStyle, currItem->itemText.charStyle(lastPos)));
undoManager->action(currItem, is);
}
currItem->itemText.setCharStyle(lastPos, i-lastPos, newStyle);
@@ -8883,7 +8911,7 @@
is->set("SET_CHARSTYLE", "set_charstyle");
is->set("START",lastPos);
is->set("LENGTH",stop-lastPos);
- is->setItem(QPair<CharStyle,CharStyle>(newStyle2, currItem->itemText.charStyle(lastPos)));
+ is->setItem(qMakePair(newStyle2, currItem->itemText.charStyle(lastPos)));
undoManager->action(currItem, is);
}
currItem->itemText.setCharStyle(lastPos, stop-lastPos, newStyle2);
@@ -8899,7 +8927,7 @@
{
ScItemState<QPair<ParagraphStyle,ParagraphStyle> > *is = new ScItemState<QPair <ParagraphStyle,ParagraphStyle> >(Um::SetStyle);
is->set("APPLY_DEFAULTPARASTYLE", "apply_defaultparastyle");
- is->setItem(QPair<ParagraphStyle,ParagraphStyle>(defStyle, currItem->itemText.defaultStyle()));
+ is->setItem(qMakePair(defStyle, currItem->itemText.defaultStyle()));
undoManager->action(currItem, is);
}
currItem->itemText.setDefaultStyle(defStyle);
@@ -9889,7 +9917,7 @@
{
UndoTransaction* activeTransaction = NULL;
m_updateManager.setUpdatesDisabled();
- if (docSelectionCount > 1)
+ if (UndoManager::undoEnabled() && docSelectionCount > 1)
{
if (m_Selection->itemAt(0)->locked())
activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::UnLock, 0, Um::IUnLock));
@@ -9921,7 +9949,7 @@
{
UndoTransaction* activeTransaction = NULL;
m_updateManager.setUpdatesDisabled();
- if (selectedItemCount > 1)
+ if (UndoManager::undoEnabled() && selectedItemCount > 1)
{
if (m_Selection->itemAt(0)->sizeLocked())
activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::SizeUnLock, 0, Um::IUnLock));
@@ -9976,7 +10004,7 @@
return;
UndoTransaction* activeTransaction = NULL;
m_updateManager.setUpdatesDisabled();
- if (docSelectionCount > 1)
+ if (docSelectionCount > 1 && UndoManager::undoEnabled())
{
if (m_Selection->itemAt(0)->printEnabled())
activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::DisablePrint, 0, Um::IDisablePrint));
@@ -10044,18 +10072,21 @@
matrixAft.translate(gw, 0);
break;
}
- ScItemState<QList<QTransform> > *state = new ScItemState<QList<QTransform> >(Um::Transform);
- state->set("TRANSFORM", "TRANSFORM");
- state->set("DX",deltaX);
- state->set("DY",deltaY);
- state->set("POSX",currItem->xPos());
- state->set("POSY",currItem->yPos());
- QList<QTransform> l;
- l.append(matrixPre);
- l.append(matrix);
- l.append(matrixAft);
- state->setItem(l);
- undoManager->action(currItem, state);
+ if(UndoManager::undoEnabled())
+ {
+ ScItemState<QList<QTransform> > *state = new ScItemState<QList<QTransform> >(Um::Transform);
+ state->set("TRANSFORM", "TRANSFORM");
+ state->set("DX",deltaX);
+ state->set("DY",deltaY);
+ state->set("POSX",currItem->xPos());
+ state->set("POSY",currItem->yPos());
+ QList<QTransform> l;
+ l.append(matrixPre);
+ l.append(matrix);
+ l.append(matrixAft);
+ state->setItem(l);
+ undoManager->action(currItem, state);
+ }
currItem->PoLine.translate(deltaX, deltaY);
currItem->PoLine.map(matrixPre);
@@ -10070,9 +10101,7 @@
// currItem->Frame = false;
currItem->ClipEdited = true;
// currItem->FrameType = 3;
- undoManager->setUndoEnabled(false);
AdjustItemSize(currItem);
- undoManager->setUndoEnabled(true);
}
}
else
@@ -10080,8 +10109,10 @@
QList<PageItem*> Elements;
bool savedAlignGrid = useRaster;
bool savedAlignGuides = SnapGuides;
+ bool savedAlignElement = SnapElement;
useRaster = false;
SnapGuides = false;
+ SnapElement = false;
DoDrawing = false;
view()->updatesOn(false);
m_Selection->delaySignalsOn();
@@ -10134,18 +10165,21 @@
break;
}
- ScItemState<QList<QTransform> > *state = new ScItemState<QList<QTransform> >(Um::Transform);
- state->set("TRANSFORM", "TRANSFORM");
- state->set("DX",deltaX);
- state->set("DY",deltaY);
- state->set("POSX",currItem->xPos());
- state->set("POSY",currItem->yPos());
- QList<QTransform> l;
- l.append(matrixPre);
- l.append(matrix);
- l.append(matrixAft);
- state->setItem(l);
- undoManager->action(currItem, state);
+ if(UndoManager::undoEnabled())
+ {
+ ScItemState<QList<QTransform> > *state = new ScItemState<QList<QTransform> >(Um::Transform);
+ state->set("TRANSFORM", "TRANSFORM");
+ state->set("DX",deltaX);
+ state->set("DY",deltaY);
+ state->set("POSX",currItem->xPos());
+ state->set("POSY",currItem->yPos());
+ QList<QTransform> l;
+ l.append(matrixPre);
+ l.append(matrix);
+ l.append(matrixAft);
+ state->setItem(l);
+ undoManager->action(currItem, state);
+ }
currItem->PoLine.translate(deltaX, deltaY);
currItem->PoLine.map(matrixPre);
@@ -10160,9 +10194,7 @@
// currItem->Frame = false;
currItem->ClipEdited = true;
// currItem->FrameType = 3;
- undoManager->setUndoEnabled(false);
AdjustItemSize(currItem);
- undoManager->setUndoEnabled(true);
Elements.append(currItem);
}
comulatedMatrix *= matrix;
@@ -10175,6 +10207,7 @@
RotMode (rotBack);
useRaster = savedAlignGrid;
SnapGuides = savedAlignGuides;
+ SnapGuides = savedAlignElement;
DoDrawing = true;
m_Selection->delaySignalsOff();
view()->updatesOn(true);
@@ -10193,7 +10226,9 @@
uint docSelectionCount=m_Selection->count();
if (docSelectionCount == 0)
return;
- UndoTransaction trans(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::FlipH, 0, Um::IFlipH));
+ UndoTransaction* trans = NULL;
+ if(UndoManager::undoEnabled())
+ trans = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::FlipH, 0, Um::IFlipH));
if (docSelectionCount > 1)
{
double gx, gy, gh, gw, ix, iy, iw, ih;
@@ -10290,7 +10325,12 @@
else if (currItem->isSpiral())
emit updateEditItem();
}
- trans.commit();
+ if(trans)
+ {
+ trans->commit();
+ delete trans;
+ trans = NULL;
+ }
regionsChanged()->update(QRectF());
changed();
emit firstSelectedItemType(m_Selection->itemAt(0)->itemType());
@@ -10302,7 +10342,9 @@
uint docSelectionCount=m_Selection->count();
if (docSelectionCount == 0)
return;
- UndoTransaction trans(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::FlipV, 0, Um::IFlipV));
+ UndoTransaction *trans = NULL;
+ if(UndoManager::undoEnabled())
+ trans = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::FlipV, 0, Um::IFlipV));
if (docSelectionCount > 1)
{
double gx, gy, gh, gw, ix, iy, iw, ih;
@@ -10405,7 +10447,12 @@
emit updateEditItem();
regionsChanged()->update(QRectF());
}
- trans.commit();
+ if(trans)
+ {
+ trans->commit();
+ delete trans;
+ trans = NULL;
+ }
changed();
emit firstSelectedItemType(m_Selection->itemAt(0)->itemType());
}
@@ -11217,17 +11264,14 @@
return;
m_updateManager.setUpdatesDisabled();
UndoTransaction* outerTransaction = NULL;
- if (UndoManager::undoEnabled() && selectedItemCount > 1)
+ if (UndoManager::undoEnabled())
outerTransaction = new UndoTransaction(undoManager->beginTransaction());
QString tooltip = Um::ItemsInvolved + "\n";
if (selectedItemCount > Um::ItemsInvolvedLimit)
tooltip = Um::ItemsInvolved2 + "\n";
for (uint a = 0; a < selectedItemCount; ++a)
{
- UndoTransaction* activeTransaction = NULL;
PageItem *currItem = itemSelection->itemAt(a);
- if (UndoManager::undoEnabled())
- activeTransaction = new UndoTransaction(undoManager->beginTransaction());
currItem->setImageXYScale(sx, sy);
currItem->setImageXYOffset(ox/sx, oy/sy);
if (currItem->imageClip.size() != 0)
@@ -11241,16 +11285,6 @@
}
if (selectedItemCount <= Um::ItemsInvolvedLimit)
tooltip += "\t" + currItem->getUName() + "\n";
- if (activeTransaction)
- {
- activeTransaction->commit(Um::Selection,
- Um::IImageFrame,
- Um::ImageScale,
- tooltip,
- Um::IImageScaling);
- delete activeTransaction;
- activeTransaction = NULL;
- }
currItem->update();
}
if (outerTransaction)
@@ -11274,7 +11308,8 @@
uint selectedItemCount=itemSelection->count();
if (selectedItemCount != 0)
{
- UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::IImageFrame,Um::Rotate,"",Um::IRotate));
+ UndoTransaction * trans = NULL;
+ trans = new UndoTransaction(undoManager->beginTransaction(Um::Selection,Um::IImageFrame,Um::Rotate,"",Um::IRotate));
for (uint a = 0; a < selectedItemCount; ++a)
{
PageItem *currItem = itemSelection->itemAt(a);
@@ -11290,7 +11325,12 @@
}
currItem->update();
}
- trans.commit();
+ if(trans)
+ {
+ trans->commit();
+ delete trans;
+ trans = NULL;
+ }
changed();
}
}
@@ -12944,13 +12984,15 @@
currItem->effectsInUse = newEffectList;
updatePic();
- // this messy part is for the undo action
- ScItemState<QPair<ScImageEffectList, ScImageEffectList> > *state =
- new ScItemState<QPair<ScImageEffectList, ScImageEffectList> >(
- Um::ImageEffects, "", currItem->getUPixmap());
- state->set("APPLY_IMAGE_EFFECTS", "apply_image_effects");
- state->setItem(QPair<ScImageEffectList, ScImageEffectList>(oldEffects, currItem->effectsInUse));
- undoManager->action(currItem, state);
+ if(UndoManager::undoEnabled())
+ {
+ ScItemState<QPair<ScImageEffectList, ScImageEffectList> > *state =
+ new ScItemState<QPair<ScImageEffectList, ScImageEffectList> >(
+ Um::ImageEffects, "", currItem->getUPixmap());
+ state->set("APPLY_IMAGE_EFFECTS", "apply_image_effects");
+ state->setItem(qMakePair(oldEffects, currItem->effectsInUse));
+ undoManager->action(currItem, state);
+ }
changed();
}
}
@@ -13113,12 +13155,12 @@
QMap<double, uint> tmpGuidesSel;
Guides tmpGuides = page->guides.horizontals(GuideManagerCore::Standard);
Guides::iterator it;
+ double viewScale=m_View->scale();
uint yg = 0;
uint xg = 0;
- double viewScale=m_View->scale();
for (it = tmpGuides.begin(); it != tmpGuides.end(); ++it, ++yg)
{
- if (fabs((*it) + page->yOffset() - yin) < (docPrefsData.guidesPrefs.guideRad / viewScale))
+ if (fabs((*it) + page->yOffset() - yin) < (prefsData().guidesPrefs.guideRad / viewScale))
tmpGuidesSel.insert(fabs((*it) + page->yOffset() - yin), yg);
}
if (tmpGuidesSel.count() != 0)
@@ -13130,7 +13172,7 @@
tmpGuides = page->guides.verticals(GuideManagerCore::Standard);
for (it = tmpGuides.begin(); it != tmpGuides.end(); ++it, ++xg)
{
- if (fabs((*it) + page->xOffset() - xin) < (docPrefsData.guidesPrefs.guideRad / viewScale))
+ if (fabs((*it) + page->xOffset() - xin) < (prefsData().guidesPrefs.guideRad / viewScale))
tmpGuidesSel.insert(fabs((*it) + page->xOffset() - xin), xg);
}
if (tmpGuidesSel.count() != 0)
@@ -13144,7 +13186,7 @@
tmpGuides = page->guides.horizontals(GuideManagerCore::Auto);
for (it = tmpGuides.begin(); it != tmpGuides.end(); ++it, ++yg)
{
- if (fabs((*it) + page->yOffset() - yin) < (docPrefsData.guidesPrefs.guideRad / viewScale))
+ if (fabs((*it) + page->yOffset() - yin) < (prefsData().guidesPrefs.guideRad / viewScale))
tmpGuidesSel.insert(fabs((*it) + page->yOffset() - yin), yg);
}
if (tmpGuidesSel.count() != 0)
@@ -13156,13 +13198,66 @@
tmpGuides = page->guides.verticals(GuideManagerCore::Auto);
for (it = tmpGuides.begin(); it != tmpGuides.end(); ++it, ++xg)
{
- if (fabs((*it) + page->xOffset() - xin) < (docPrefsData.guidesPrefs.guideRad / viewScale))
+ if (fabs((*it) + page->xOffset() - xin) < (prefsData().guidesPrefs.guideRad / viewScale))
tmpGuidesSel.insert(fabs((*it) + page->xOffset() - xin), xg);
}
if (tmpGuidesSel.count() != 0)
{
*GxM = tmpGuidesSel.begin().value();
*xout = tmpGuides[*GxM];
+ }
+}
+
+void ScribusDoc::getClosestElementBorder(double xin, double yin, double *xout, double *yout, int *GxM, int *GyM, ScPage* refPage)
+{
+ *GxM = -1;
+ *GyM = -1;
+ ScPage* page = (refPage == NULL) ? currentPage() : refPage;
+ QMap<double, uint> tmpGuidesSel;
+ double viewScale=m_View->scale();
+ QList<PageItem*> item = getAllItems(*Items);
+ for(int i=0;i<item.size();i++)
+ {
+ if(m_Selection->containsItem(item.at(i)) || item.at(i)->OwnPage != OnPage(xin,yin))
+ continue;
+ else if (fabs(item.at(i)->yPos() - yin) < (prefsData().guidesPrefs.guideRad / viewScale))
+ tmpGuidesSel.insert(fabs(item.at(i)->yPos() - yin), i*3);
+ else if (fabs(item.at(i)->yPos() + item.at(i)->height() - yin) < (prefsData().guidesPrefs.guideRad / viewScale))
+ tmpGuidesSel.insert(fabs(item.at(i)->yPos() + item.at(i)->height() - yin), i*3+1);
+ else if (fabs(item.at(i)->yPos() + item.at(i)->height()/2 - yin) < (prefsData().guidesPrefs.guideRad / viewScale))
+ tmpGuidesSel.insert(fabs(item.at(i)->yPos() + item.at(i)->height()/2 - yin), i*3+2);
+ }
+ if (tmpGuidesSel.count() != 0)
+ {
+ *GyM = tmpGuidesSel.begin().value();
+ if(*GyM%3==0)
+ *yout = item.at(*GyM/3)->yPos() - page->yOffset();
+ else if(*GyM%3==1)
+ *yout = item.at(*GyM/3)->yPos() + item.at(*GyM/3)->height() -page->yOffset();
+ else if(*GyM%3==2)
+ *yout = item.at(*GyM/3)->yPos() + item.at(*GyM/3)->height()/2 -page->yOffset();
+ }
+ tmpGuidesSel.clear();
+ for(int i=0;i<item.size();i++)
+ {
+ if(m_Selection->containsItem(item.at(i)) || item.at(i)->OwnPage != OnPage(xin,yin))
+ continue;
+ else if (fabs(item.at(i)->xPos() - xin) < (prefsData().guidesPrefs.guideRad / viewScale))
+ tmpGuidesSel.insert(fabs(item.at(i)->xPos() - xin), i*3);
+ else if (fabs(item.at(i)->xPos() + item.at(i)->width() - xin) < (prefsData().guidesPrefs.guideRad / viewScale))
+ tmpGuidesSel.insert(fabs(item.at(i)->xPos() + item.at(i)->width() - xin), i*3+1);
+ else if (fabs(item.at(i)->xPos() + item.at(i)->width()/2 - xin) < (prefsData().guidesPrefs.guideRad / viewScale))
+ tmpGuidesSel.insert(fabs(item.at(i)->xPos() + item.at(i)->width()/2 - xin), i*3+2);
+ }
+ if (tmpGuidesSel.count() != 0)
+ {
+ *GxM = tmpGuidesSel.begin().value();
+ if(*GxM%3==0)
+ *xout = item.at(*GxM/3)->xPos() -page->xOffset();
+ else if(*GxM%3==1)
+ *xout = item.at(*GxM/3)->xPos() + item.at(*GxM/3)->width() -page->xOffset();
+ else if(*GxM%3==2)
+ *xout = item.at(*GxM/3)->xPos() + item.at(*GxM/3)->width()/2 -page->xOffset();
}
}
@@ -13175,8 +13270,7 @@
return;
ScPage* page = Pages->at(pg);
int GxM, GyM;
-
- //FIXME: stop using m_View
+
getClosestGuides(0, currItem->yPos(), &xout, &yout, &GxM, &GyM);
if (GyM != -1)
currItem->setYPos(yout+page->yOffset());
@@ -13220,7 +13314,7 @@
}
-bool ScribusDoc::ApplyGuides(double *x, double *y)
+bool ScribusDoc::ApplyGuides(double *x, double *y, bool elementSnap)
{
// m_SnapCounter++;
bool ret = false;
@@ -13232,10 +13326,13 @@
int GxM, GyM;
// if ((SnapGuides) && (m_SnapCounter > 1))
- if (SnapGuides)
+ if ((SnapGuides && !elementSnap) || (SnapElement && elementSnap))
{
// m_SnapCounter = 0;
- getClosestGuides(*x, *y, &xout, &yout, &GxM, &GyM, page);
+ if(!elementSnap)
+ getClosestGuides(*x, *y, &xout, &yout, &GxM, &GyM, page);
+ else
+ getClosestElementBorder(*x, *y, &xout, &yout, &GxM, &GyM, page);
if (GxM != -1)
{
*x = xout+page->xOffset();
@@ -13273,11 +13370,11 @@
return ret;
}
-bool ScribusDoc::ApplyGuides(FPoint* point)
+bool ScribusDoc::ApplyGuides(FPoint* point,bool elementSnap)
{
double newX = point->x();
double newY = point->y();
- bool ret = ApplyGuides(&newX, &newY);
+ bool ret = ApplyGuides(&newX, &newY, elementSnap);
point->setX(newX);
point->setY(newY);
@@ -13401,7 +13498,6 @@
PageItem *currItem = pi;
if (currItem->locked())
return false;
- QPainter p;
QRectF oldR(currItem->getBoundingRect());
//Uncomment for stopping resize in any direction
//and remove the height/width <0 tests in item sizing switch
@@ -13412,11 +13508,11 @@
newY = qMax(newY, 1);
}
*/
- std::auto_ptr<UndoTransaction> activeTransaction;
+ UndoTransaction *activeTransaction = NULL;
if (UndoManager::undoEnabled())
{
QString transacDesc = QString(Um::ResizeFromTo).arg(currItem->oldWidth).arg(currItem->oldHeight).arg(newX).arg(newY);
- activeTransaction.reset( new UndoTransaction(undoManager->beginTransaction(currItem->getUName(), currItem->getUPixmap(), Um::Resize, transacDesc, Um::IResize)) );
+ activeTransaction = new UndoTransaction(undoManager->beginTransaction(currItem->getUName(), currItem->getUPixmap(), Um::Resize, transacDesc, Um::IResize));
}
int ph = static_cast<int>(qMax(1.0, currItem->lineWidth() / 2.0));
QTransform ma;
@@ -13465,23 +13561,17 @@
{
currItem->FrameOnly = true;
- if (currItem->FrameType == 0 || currItem->asLine())
- {
- if (activeTransaction.get())
- {
- currItem->checkChanges();
- activeTransaction->commit();
- }
- return true;
- }
-
- currItem->updateClip();
-// currItem->updateGradientVectors();
-
- if (activeTransaction.get())
+ if (currItem->FrameType != 0 && !currItem->asLine())
+ {
+ currItem->updateClip();
+// currItem->updateGradientVectors();
+ }
+ if (activeTransaction)
{
currItem->checkChanges();
activeTransaction->commit();
+ delete activeTransaction;
+ activeTransaction = NULL;
}
return true;
}
@@ -13530,10 +13620,12 @@
}
}
currItem->setCornerRadius(qMin(currItem->cornerRadius(), qMin(currItem->width(),currItem->height())/2));
- if (activeTransaction.get())
+ if (activeTransaction)
{
currItem->checkChanges();
activeTransaction->commit();
+ delete activeTransaction;
+ activeTransaction = NULL;
}
return true;
}
@@ -14146,7 +14238,9 @@
return NULL;
PageItem *currItem;
double x, y, w, h;
- UndoTransaction activeTransaction(undoManager->beginTransaction(Um::Selection,Um::IGroup,Um::Group,"",Um::IGroup));
+ UndoTransaction *activeTransaction = NULL;
+ if(UndoManager::undoEnabled())
+ activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::Selection,Um::IGroup,Um::Group,"",Um::IGroup));
uint selectedItemCount = itemSelection->count();
QString tooltip = Um::ItemsInvolved + "\n";
if (selectedItemCount > Um::ItemsInvolvedLimit)
@@ -14211,13 +14305,20 @@
}
groupItem->asGroupFrame()->adjustXYPosition();
- ScItemState<QList<QPointer<PageItem> > > *is = new ScItemState<QList<QPointer<PageItem> > >(UndoManager::Group);
- is->set("GROUP", "group");
- itemSelection->addItem(groupItem,true);
- is->setItem(itemSelection->selectionList());
- undoManager->action(this, is);
- activeTransaction.commit();
-
+ if(UndoManager::undoEnabled())
+ {
+ ScItemState<QList<QPointer<PageItem> > > *is = new ScItemState<QList<QPointer<PageItem> > >(UndoManager::Group);
+ is->set("GROUP", "group");
+ itemSelection->addItem(groupItem,true);
+ is->setItem(itemSelection->selectionList());
+ undoManager->action(this, is);
+ }
+ if(activeTransaction)
+ {
+ activeTransaction->commit();
+ delete activeTransaction;
+ activeTransaction = NULL;
+ }
itemSelection->clear();
itemSelection->addItem(groupItem);
@@ -14240,7 +14341,9 @@
{
uint docSelectionCount = itemSelection->count();
PageItem *currItem;
- UndoTransaction activeTransaction(undoManager->beginTransaction(Um::Selection,Um::IGroup,Um::Ungroup,"",Um::IGroup));
+ UndoTransaction *activeTransaction= NULL;
+ if(UndoManager::undoEnabled())
+ activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::Selection,Um::IGroup,Um::Ungroup,"",Um::IGroup));
QList<PageItem*> toDelete;
for (uint a=0; a < docSelectionCount; ++a)
{
@@ -14313,11 +14416,14 @@
rItem->OwnPage = OnPage(rItem);
}
- ScItemState<QList<QPointer<PageItem> > > *is = new ScItemState<QList<QPointer<PageItem> > >(UndoManager::Ungroup);
- is->set("UNGROUP", "ungroup");
- tempSelection.addItem(currItem,true);
- is->setItem(tempSelection.selectionList());
- undoManager->action(this, is);
+ if(UndoManager::undoEnabled())
+ {
+ ScItemState<QList<QPointer<PageItem> > > *is = new ScItemState<QList<QPointer<PageItem> > >(UndoManager::Ungroup);
+ is->set("UNGROUP", "ungroup");
+ tempSelection.addItem(currItem,true);
+ is->setItem(tempSelection.selectionList());
+ undoManager->action(this, is);
+ }
tempSelection.clear();
tempSelection.delaySignalsOff();
@@ -14351,7 +14457,12 @@
currItem = toDelete.at(0);
delete currItem;
}
- activeTransaction.commit();
+ if(activeTransaction)
+ {
+ activeTransaction->commit();
+ delete activeTransaction;
+ activeTransaction = NULL;
+ }
/* QMap<int, QList<PageItem*> >::iterator groupIt;
for (it = toDelete.begin(); it != toDelete.end(); ++it)
@@ -14540,7 +14651,7 @@
if (UndoManager::undoEnabled())
{
ScItemState< QPair<QList<PageItem*> , QList<QTransform> > > *is = new ScItemState< QPair<QList<PageItem*> , QList<QTransform> > >(Um::UniteItem, "", Um::IGroup);
- is->setItem(QPair<QList<PageItem*>,QList<QTransform> >(toDel,transform));
+ is->setItem(qMakePair(toDel,transform));
is->set("UNITEITEM", "uniteitem");
is->set("FRAME",currFrame);
is->set("FRAMETYPE",currFrameType);
@@ -14622,8 +14733,7 @@
}
undoManager->setUndoEnabled(true);
m_Selection->delaySignalsOff();
- //FIXME: stop using m_View
- m_View->Deselect(true);
+ view()->Deselect(true);
regionsChanged()->update(QRectF());
if(transaction)
{
@@ -14670,7 +14780,11 @@
}
}
if (convertTransaction)
+ {
convertTransaction->commit();
+ delete convertTransaction;
+ convertTransaction = NULL;
+ }
tmpSel.delaySignalsOff();
m_updateManager.setUpdatesEnabled();
changed();
@@ -14690,6 +14804,10 @@
if (selectedItemCount > 0)
{
UndoTransaction* activeTransaction = NULL;
+ if (UndoManager::undoEnabled())
+ activeTransaction = new UndoTransaction(undoManager->beginTransaction( Um::SelectionGroup,
+ Um::IGroup,
+ Um::AdjustFrameToImage,"",Um::IResize));
for (uint i = 0; i < selectedItemCount; ++i)
{
PageItem *currItem = itemSelection->itemAt(i);
@@ -14697,12 +14815,6 @@
{
if (currItem->asImageFrame() && currItem->PictureIsAvailable)
{
- if (!activeTransaction)
- activeTransaction = new UndoTransaction(undoManager->beginTransaction(selectedItemCount == 1 ?
- currItem->getUName() : Um::SelectionGroup,
- selectedItemCount == 1 ?
- currItem->getUPixmap() : Um::IGroup,
- Um::AdjustFrameToImage,"",Um::IResize));
double w, h, x, y;
w = currItem->OrigW * currItem->imageXScale();
h = currItem->OrigH * currItem->imageYScale();
@@ -14724,10 +14836,10 @@
activeTransaction->commit();
delete activeTransaction;
activeTransaction = NULL;
- regionsChanged()->update(QRectF());
- changed();
- itemSelection->itemAt(0)->emitAllToGUI();
- }
+ }
+ regionsChanged()->update(QRectF());
+ changed();
+ itemSelection->itemAt(0)->emitAllToGUI();
}
}
void ScribusDoc::itemSelection_AdjustImagetoFrameSize( Selection *customSelection)
@@ -14765,7 +14877,9 @@
if (selectedItemCount > 0)
{
- UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::ITextFrame,Um::Resize,"",Um::IResize));
+ UndoTransaction *trans = NULL;
+ if(UndoManager::undoEnabled())
+ trans = new UndoTransaction(undoManager->beginTransaction(Um::Selection,Um::ITextFrame,Um::Resize,"",Um::IResize));
for (uint i = 0; i < selectedItemCount; ++i)
{
PageItem *currItem = itemSelection->itemAt(i);
@@ -14775,7 +14889,12 @@
currItem ->asTextFrame()->setTextFrameHeight();
}
}
- trans.commit();
+ if(trans)
+ {
+ trans->commit();
+ delete trans;
+ trans = NULL;
+ }
regionsChanged()->update(QRectF());
changed();
itemSelection->itemAt(0)->emitAllToGUI();
@@ -14886,7 +15005,8 @@
oldClip = new FPointArray(Clip);
oldItemX = currItem->xPos();
oldItemY = currItem->yPos();
- nodeTransaction = new UndoTransaction(undoManager->beginTransaction(currItem->getUName(), currItem->getUPixmap(), uAction));
+ if(UndoManager::undoEnabled())
+ nodeTransaction = new UndoTransaction(undoManager->beginTransaction(currItem->getUName(), currItem->getUPixmap(), uAction));
Doc->nodeEdit.deselect();
return Clip;
}
@@ -14908,7 +15028,7 @@
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(QPair<FPointArray, FPointArray>(*oldClip, newClip));
+ state->setItem(qMakePair(*oldClip, newClip));
state->set("OLD_X", oldItemX);
state->set("OLD_Y", oldItemY);
state->set("NEW_X", currItem->xPos());
@@ -14945,7 +15065,7 @@
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(QPair<FPointArray, FPointArray>(*oldClip, newClip));
+ state->setItem(qMakePair(*oldClip, newClip));
undoManager->setUndoEnabled(false);
}
else
@@ -15190,14 +15310,14 @@
}
undoManager->setUndoEnabled(true);
FPointArray newClip(Doc->nodeEdit.isContourLine ? currItem->ContourLine : currItem->PoLine);
- if (*oldClip != newClip)
+ 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(QPair<FPointArray, FPointArray>(*oldClip, newClip));
+ state->setItem(qMakePair(*oldClip, newClip));
state->set("OLD_X", oldItemX);
state->set("OLD_Y", oldItemY);
state->set("NEW_X", currItem->xPos());
@@ -15288,14 +15408,14 @@
undoManager->setUndoEnabled(true);
FPointArray newClip(Doc->nodeEdit.isContourLine ? currItem->ContourLine : currItem->PoLine);
- if (*oldClip != newClip)
+ 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(QPair<FPointArray, FPointArray>(*oldClip, newClip));
+ state->setItem(qMakePair(*oldClip, newClip));
state->set("OLD_X", oldItemX);
state->set("OLD_Y", oldItemY);
state->set("NEW_X", currItem->xPos());
Modified: trunk/Scribus/scribus/scribusdoc.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/scribusdoc.h
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.h (original)
+++ trunk/Scribus/scribus/scribusdoc.h Tue Jul 31 19:57:06 2012
@@ -1130,10 +1130,12 @@
bool hasTOCSetup() { return !docPrefsData.tocPrefs.defaultToCSetups.empty(); }
//! \brief Get the closest guide to the given point
void getClosestGuides(double xin, double yin, double *xout, double *yout, int *GxM, int *GyM, ScPage* refPage = NULL);
+ //! \brief Get the closest border of another element to the given point
+ void getClosestElementBorder(double xin, double yin, double *xout, double *yout, int *GxM, int *GyM, ScPage* refPage = NULL);
//! \brief Snap an item to the guides
void SnapToGuides(PageItem *currItem);
- bool ApplyGuides(double *x, double *y);
- bool ApplyGuides(FPoint* point);
+ bool ApplyGuides(double *x, double *y, bool elementSnap = false);
+ bool ApplyGuides(FPoint* point, bool elementSnap = false);
bool MoveItem(double newX, double newY, PageItem* ite, bool fromMP = false);
void RotateItem(double win, PageItem *currItem);
void MoveRotated(PageItem *currItem, FPoint npv, bool fromMP = false);
@@ -1198,6 +1200,7 @@
int viewCount;
int viewID;
bool SnapGuides;
+ bool SnapElement;
bool GuideLock;
bool dontResize;
/** \brief Minimum and Maximum Points of Document */
Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Tue Jul 31 19:57:06 2012
@@ -423,6 +423,7 @@
void ScribusView::togglePreview()
{
+ undoManager->setUndoEnabled(false);
m_canvas->m_viewMode.viewAsPreview = !m_canvas->m_viewMode.viewAsPreview;
Doc->drawAsPreview = m_canvas->m_viewMode.viewAsPreview;
if (m_canvas->m_viewMode.viewAsPreview)
@@ -470,6 +471,7 @@
{
DrawNew();
}
+ undoManager->setUndoEnabled(true);
}
void ScribusView::changed(QRectF re, bool)
@@ -1181,7 +1183,7 @@
Doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
double nx = gx;
double ny = gy;
- if (!Doc->ApplyGuides(&nx, &ny))
+ if (!Doc->ApplyGuides(&nx, &ny) && !Doc->ApplyGuides(&nx, &ny,true))
{
FPoint npx;
npx = Doc->ApplyGridF(FPoint(nx, ny));
@@ -1195,6 +1197,7 @@
nx = gx+gw;
ny = gy+gh;
Doc->ApplyGuides(&nx, &ny);
+ Doc->ApplyGuides(&nx, &ny,true);
Doc->moveGroup(nx-(gx+gw), ny-(gy+gh), false);
Doc->m_Selection->setGroupRect();
Doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
@@ -1221,7 +1224,7 @@
{
double nx = currItem->xPos();
double ny = currItem->yPos();
- if (!Doc->ApplyGuides(&nx, &ny))
+ if (!Doc->ApplyGuides(&nx, &ny) && !Doc->ApplyGuides(&nx, &ny,true))
{
FPoint npx;
npx = Doc->ApplyGridF(FPoint(nx, ny));
@@ -1962,7 +1965,7 @@
newObjects.getGroupRect(&gx, &gy, &gw, &gh);
double nx = gx;
double ny = gy;
- if (!Doc->ApplyGuides(&nx, &ny))
+ if (!Doc->ApplyGuides(&nx, &ny) && !Doc->ApplyGuides(&nx, &ny,true))
{
FPoint npx;
npx = Doc->ApplyGridF(FPoint(nx, ny));
@@ -1975,6 +1978,7 @@
nx = gx+gw;
ny = gy+gh;
Doc->ApplyGuides(&nx, &ny);
+ Doc->ApplyGuides(&nx, &ny,true);
Doc->moveGroup(nx-(gx+gw), ny-(gy+gh), false, &newObjects);
newObjects.setGroupRect();
newObjects.getGroupRect(&gx, &gy, &gw, &gh);
@@ -1988,7 +1992,7 @@
{
double nx = currItem->xPos();
double ny = currItem->yPos();
- if (!Doc->ApplyGuides(&nx, &ny))
+ if (!Doc->ApplyGuides(&nx, &ny) && !Doc->ApplyGuides(&nx, &ny,true))
{
FPoint npx;
npx = Doc->ApplyGridF(FPoint(nx, ny));
@@ -4255,9 +4259,9 @@
{
//user creates new frame using linking tool
PageItem * frame = Doc->m_Selection->itemAt(0);
+ requestMode(modeImportImage);
if (frame)
{
- requestMode(modeImportImage);
dynamic_cast<CanvasMode_ImageImport*>(canvasMode())->setImage(frame);
dynamic_cast<CanvasMode_ImageImport*>(canvasMode())->updateList();
}
Modified: trunk/Scribus/scribus/ui/contextmenu.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/ui/contextmenu.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/contextmenu.cpp (original)
+++ trunk/Scribus/scribus/ui/contextmenu.cpp Tue Jul 31 19:57:06 2012
@@ -507,6 +507,7 @@
addSeparator();
addAction(m_AP->scrActions["viewSnapToGrid"]);
addAction(m_AP->scrActions["viewSnapToGuides"]);
+ addAction(m_AP->scrActions["viewSnapToElements"]);
onAPage = (m_doc->OnPage(mx, my) != -1);
if (onAPage)
Modified: trunk/Scribus/scribus/ui/cpalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/ui/cpalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/cpalette.cpp (original)
+++ trunk/Scribus/scribus/ui/cpalette.cpp Tue Jul 31 19:57:06 2012
@@ -320,11 +320,12 @@
else
setMeshPoint();
if(CGradDia && gradEditButton->isChecked())
+ {
if(tabFillStroke->currentIndex() == 0)
CGradDia->setValues(currentItem->gradientStartX(), currentItem->gradientStartY(), currentItem->gradientEndX(), currentItem->gradientEndY(), currentItem->GrFocalX, currentItem->GrFocalY, currentItem->GrScale, currentItem->GrSkew, 0, 0);
else
CGradDia->setValues(currentItem->GrStrokeStartX, currentItem->GrStrokeStartY, currentItem->GrStrokeEndX, currentItem->GrStrokeEndY, currentItem->GrStrokeFocalX, currentItem->GrStrokeFocalY, currentItem->GrStrokeScale, currentItem->GrStrokeSkew, 0, 0);
-
+ }
editMeshColors->setEnabled(!CGradDia->isVisible());
gradEditButton->setEnabled(true);
@@ -667,11 +668,18 @@
double t2 = color2Alpha->value() / 100.0;
double t3 = color3Alpha->value() / 100.0;
double t4 = color4Alpha->value() / 100.0;
- UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradVal,"",Um::IFill));
+ UndoTransaction *trans = NULL;
+ if(UndoManager::undoEnabled())
+ trans = new UndoTransaction(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradVal,"",Um::IFill));
currentItem->set4ColorShade(static_cast<int>(color1Shade->value()), static_cast<int>(color2Shade->value()), static_cast<int>(color3Shade->value()), static_cast<int>(color4Shade->value()));
currentItem->set4ColorTransparency(t1, t2, t3, t4);
currentItem->set4ColorColors(color1, color2, color3, color4);
- trans.commit();
+ if(trans)
+ {
+ trans->commit();
+ delete trans;
+ trans = NULL;
+ }
currentItem->update();
}
@@ -1227,11 +1235,15 @@
{
if ((grow == -1) || (gcol == 0))
return;
- ScItemState<QPair<meshPoint,meshPoint> > *ss = new ScItemState<QPair<meshPoint,meshPoint> >(Um::GradPos);
- ss->set("MOVE_MESH_PATCH","move_mesh_patch");
- ss->set("ARRAY",false);
- ss->set("X",grow);
- ss->set("Y",gcol);
+ ScItemState<QPair<meshPoint,meshPoint> > *ss = NULL;
+ if(UndoManager::undoEnabled())
+ {
+ ss = new ScItemState<QPair<meshPoint,meshPoint> >(Um::GradPos);
+ ss->set("MOVE_MESH_PATCH","move_mesh_patch");
+ ss->set("ARRAY",false);
+ ss->set("X",grow);
+ ss->set("Y",gcol);
+ }
switch (gcol)
{
case 1:
@@ -1240,7 +1252,8 @@
tmp.controlBottom = tmp.gridPoint;
if (cont == 4)
tmp.controlRight = tmp.gridPoint;
- ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].TL,tmp));
+ if(UndoManager::undoEnabled())
+ ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].TL,tmp));
currentItem->meshGradientPatches[grow].TL = tmp;
break;
case 2:
@@ -1249,7 +1262,8 @@
tmp.controlBottom = tmp.gridPoint;
if (cont == 3)
tmp.controlLeft = tmp.gridPoint;
- ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].TR,tmp));
+ if(UndoManager::undoEnabled())
+ ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].TR,tmp));
currentItem->meshGradientPatches[grow].TR = tmp;
break;
case 3:
@@ -1258,7 +1272,8 @@
tmp.controlTop = tmp.gridPoint;
if (cont == 3)
tmp.controlLeft = tmp.gridPoint;
- ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].BR,tmp));
+ if(UndoManager::undoEnabled())
+ ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].BR,tmp));
currentItem->meshGradientPatches[grow].BR = tmp;
break;
case 4:
@@ -1267,21 +1282,19 @@
tmp.controlTop = tmp.gridPoint;
if (cont == 4)
tmp.controlRight = tmp.gridPoint;
- ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].BL,tmp));
+ if(UndoManager::undoEnabled())
+ ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].BL,tmp));
currentItem->meshGradientPatches[grow].BL = tmp;
break;
}
- undoManager->action(currentItem,ss);
+ if(UndoManager::undoEnabled())
+ undoManager->action(currentItem,ss);
}
else
{
if ((grow == -1) || (gcol == -1))
return;
- ScItemState<QPair<meshPoint,meshPoint> > *ss = new ScItemState<QPair<meshPoint,meshPoint> >(Um::GradPos);
- ss->set("MOVE_MESH_PATCH","move_mesh_patch");
- ss->set("ARRAY",true);
- ss->set("X",grow);
- ss->set("Y",gcol);
+
tmp = currentItem->meshGradientArray[grow][gcol];
if (cont == 1)
tmp.controlTop = tmp.gridPoint;
@@ -1291,9 +1304,18 @@
tmp.controlLeft = tmp.gridPoint;
else if (cont == 4)
tmp.controlRight = tmp.gridPoint;
- ss->setItem(qMakePair(currentItem->meshGradientArray[grow][gcol],tmp));
+
+ if(UndoManager::undoEnabled())
+ {
+ ScItemState<QPair<meshPoint,meshPoint> > *ss = new ScItemState<QPair<meshPoint,meshPoint> >(Um::GradPos);
+ ss->set("MOVE_MESH_PATCH","move_mesh_patch");
+ ss->set("ARRAY",true);
+ ss->set("X",grow);
+ ss->set("Y",gcol);
+ ss->setItem(qMakePair(currentItem->meshGradientArray[grow][gcol],tmp));
+ undoManager->action(currentItem,ss);
+ }
currentItem->meshGradientArray[grow][gcol] = tmp;
- undoManager->action(currentItem,ss);
}
currentItem->update();
currentDoc->regionsChanged()->update(QRect());
@@ -1308,11 +1330,15 @@
{
if ((grow == -1) || (gcol == 0))
return;
- ScItemState<QPair<meshPoint,meshPoint> > *ss = new ScItemState<QPair<meshPoint,meshPoint> >(Um::GradPos);
- ss->set("MOVE_MESH_PATCH","move_mesh_patch");
- ss->set("ARRAY",false);
- ss->set("X",grow);
- ss->set("Y",gcol);
+ ScItemState<QPair<meshPoint,meshPoint> > *ss = NULL;
+ if(UndoManager::undoEnabled())
+ {
+ ss = new ScItemState<QPair<meshPoint,meshPoint> >(Um::GradPos);
+ ss->set("MOVE_MESH_PATCH","move_mesh_patch");
+ ss->set("ARRAY",false);
+ ss->set("X",grow);
+ ss->set("Y",gcol);
+ }
switch (gcol)
{
case 1:
@@ -1321,7 +1347,8 @@
tmp.controlLeft = tmp.gridPoint;
tmp.controlRight = tmp.gridPoint;
tmp.controlBottom = tmp.gridPoint;
- ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].TL,tmp));
+ if(UndoManager::undoEnabled())
+ ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].TL,tmp));
currentItem->meshGradientPatches[grow].TL = tmp;
break;
case 2:
@@ -1330,7 +1357,8 @@
tmp.controlLeft = tmp.gridPoint;
tmp.controlRight = tmp.gridPoint;
tmp.controlBottom = tmp.gridPoint;
- ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].TR,tmp));
+ if(UndoManager::undoEnabled())
+ ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].TR,tmp));
currentItem->meshGradientPatches[grow].TR = tmp;
break;
case 3:
@@ -1339,7 +1367,8 @@
tmp.controlLeft = tmp.gridPoint;
tmp.controlRight = tmp.gridPoint;
tmp.controlBottom = tmp.gridPoint;
- ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].BR,tmp));
+ if(UndoManager::undoEnabled())
+ ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].BR,tmp));
currentItem->meshGradientPatches[grow].BR = tmp;
break;
case 4:
@@ -1348,29 +1377,34 @@
tmp.controlLeft = tmp.gridPoint;
tmp.controlRight = tmp.gridPoint;
tmp.controlBottom = tmp.gridPoint;
- ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].BL,tmp));
+ if(UndoManager::undoEnabled())
+ ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].BL,tmp));
currentItem->meshGradientPatches[grow].BL = tmp;
break;
}
- undoManager->action(currentItem,ss);
+ if(UndoManager::undoEnabled())
+ undoManager->action(currentItem,ss);
}
else
{
if ((grow == -1) || (gcol == -1))
return;
- ScItemState<QPair<meshPoint,meshPoint> > *ss = new ScItemState<QPair<meshPoint,meshPoint> >(Um::GradPos);
- ss->set("MOVE_MESH_PATCH","move_mesh_patch");
- ss->set("ARRAY",true);
- ss->set("X",grow);
- ss->set("Y",gcol);
tmp = currentItem->meshGradientArray[grow][gcol];
tmp.controlTop = tmp.gridPoint;
tmp.controlLeft = tmp.gridPoint;
tmp.controlRight = tmp.gridPoint;
tmp.controlBottom = tmp.gridPoint;
- ss->setItem(qMakePair(currentItem->meshGradientArray[grow][gcol],tmp));
+ if(UndoManager::undoEnabled())
+ {
+ ScItemState<QPair<meshPoint,meshPoint> > *ss = new ScItemState<QPair<meshPoint,meshPoint> >(Um::GradPos);
+ ss->set("MOVE_MESH_PATCH","move_mesh_patch");
+ ss->set("ARRAY",true);
+ ss->set("X",grow);
+ ss->set("Y",gcol);
+ ss->setItem(qMakePair(currentItem->meshGradientArray[grow][gcol],tmp));
+ undoManager->action(currentItem,ss);
+ }
currentItem->meshGradientArray[grow][gcol] = tmp;
- undoManager->action(currentItem,ss);
}
currentItem->update();
currentDoc->regionsChanged()->update(QRect());
@@ -1501,11 +1535,14 @@
{
if ((currentItem->selectedMeshPointX > -1) && (currentItem->meshGradientPatches.count() > 1))
{
- ScItemState<meshGradientPatch> *ss = new ScItemState<meshGradientPatch>(Um::RemoveMeshPatch,"",Um::ILine);
- ss->set("REMOVE_MESH_PATCH","remove_mesh_patch");
- ss->setItem(currentItem->meshGradientPatches.takeAt(currentItem->selectedMeshPointX));
- ss->set("POS",currentItem->selectedMeshPointX);
- undoManager->action(currentItem,ss);
+ if(UndoManager::undoEnabled())
+ {
+ ScItemState<meshGradientPatch> *ss = new ScItemState<meshGradientPatch>(Um::RemoveMeshPatch,"",Um::ILine);
+ ss->set("REMOVE_MESH_PATCH","remove_mesh_patch");
+ ss->setItem(currentItem->meshGradientPatches.takeAt(currentItem->selectedMeshPointX));
+ ss->set("POS",currentItem->selectedMeshPointX);
+ undoManager->action(currentItem,ss);
+ }
currentItem->selectedMeshPointX = -1;
CGradDia->changebuttonRemovePatch((currentItem->selectedMeshPointX > -1) && (currentItem->meshGradientPatches.count() > 1));
currentItem->update();
Modified: trunk/Scribus/scribus/ui/guidemanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/ui/guidemanager.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/guidemanager.cpp (original)
+++ trunk/Scribus/scribus/ui/guidemanager.cpp Tue Jul 31 19:57:06 2012
@@ -293,8 +293,8 @@
horizontalGroupBox->setTitle(horizontalGroupBox->title() + " ("+suffix.trimmed()+")");
verticalGroupBox->setTitle(verticalGroupBox->title() + " ("+suffix.trimmed()+")");
// models display
- horizontalModel->unitChange(docUnitIndex, docUnitDecimals);
- verticalModel->unitChange(docUnitIndex, docUnitDecimals);
+ horizontalModel->unitChange(docUnitIndex, docUnitDecimals, m_Doc->rulerYoffset);
+ verticalModel->unitChange(docUnitIndex, docUnitDecimals, m_Doc->rulerXoffset);
qobject_cast<GuidesHDelegate*>(horizontalView->itemDelegateForColumn(0))->setDoc(m_Doc);
qobject_cast<GuidesVDelegate*>(verticalView->itemDelegateForColumn(0))->setDoc(m_Doc);
}
Modified: trunk/Scribus/scribus/ui/paintmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/ui/paintmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/paintmanager.cpp (original)
+++ trunk/Scribus/scribus/ui/paintmanager.cpp Tue Jul 31 19:57:06 2012
@@ -1292,8 +1292,10 @@
uint ap = m_doc->docPatterns.count();
bool savedAlignGrid = m_doc->useRaster;
bool savedAlignGuides = m_doc->SnapGuides;
+ bool savedAlignElement = m_doc->SnapElement;
m_doc->useRaster = false;
m_doc->SnapGuides = false;
+ m_doc->SnapElement = false;
if (fi.suffix().toLower() == "sce")
{
ScriXmlDoc ss;
@@ -1316,6 +1318,7 @@
}
m_doc->useRaster = savedAlignGrid;
m_doc->SnapGuides = savedAlignGuides;
+ m_doc->SnapElement = savedAlignElement;
uint ae = m_doc->Items->count();
if (ac != ae)
{
Modified: trunk/Scribus/scribus/ui/prefs_guidesbase.ui
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/ui/prefs_guidesbase.ui
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_guidesbase.ui (original)
+++ trunk/Scribus/scribus/ui/prefs_guidesbase.ui Tue Jul 31 19:57:06 2012
@@ -79,13 +79,6 @@
<item>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
- <widget class="QLabel" name="label_5">
- <property name="text">
- <string>Foreground</string>
- </property>
- </widget>
- </item>
- <item>
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -149,13 +142,6 @@
</size>
</property>
</spacer>
- </item>
- <item>
- <widget class="QLabel" name="label_6">
- <property name="text">
- <string>Background</string>
- </property>
- </widget>
</item>
</layout>
</item>
Modified: trunk/Scribus/scribus/ui/propertiespalette_imagebase.ui
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/ui/propertiespalette_imagebase.ui
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_imagebase.ui (original)
+++ trunk/Scribus/scribus/ui/propertiespalette_imagebase.ui Tue Jul 31 19:57:06 2012
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>280</width>
- <height>502</height>
+ <width>286</width>
+ <height>617</height>
</rect>
</property>
<property name="windowTitle">
@@ -143,6 +143,9 @@
<property name="checkable">
<bool>true</bool>
</property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
<property name="autoRaise">
<bool>true</bool>
</property>
@@ -182,6 +185,9 @@
<property name="checkable">
<bool>true</bool>
</property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
<property name="autoRaise">
<bool>true</bool>
</property>
@@ -338,8 +344,8 @@
<customwidgets>
<customwidget>
<class>ScrSpinBox</class>
- <extends>QDoubleSpinBox</extends>
- <header>ui/scrspinbox.h</header>
+ <extends>QSpinBox</extends>
+ <header location="global">ui/scrspinbox.h</header>
</customwidget>
<customwidget>
<class>LinkButton</class>
Modified: trunk/Scribus/scribus/ui/rulermover.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/ui/rulermover.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/rulermover.cpp (original)
+++ trunk/Scribus/scribus/ui/rulermover.cpp Tue Jul 31 19:57:06 2012
@@ -31,6 +31,7 @@
#include "canvas.h"
#include "canvasgesture_rulermove.h"
+#include "ui/guidemanager.h"
#include "scribusview.h"
#include "scribusdoc.h"
#include "scraction.h"
@@ -104,6 +105,8 @@
if (pmen2)
delete pmen2;
}
+ if (currView->Doc->guidesPrefs().guidesShown)
+ currView->Doc->scMW()->guidePalette->setupPage();
QWidget::mouseReleaseEvent(m);
}
Modified: trunk/Scribus/scribus/undomanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/undomanager.cpp
==============================================================================
--- trunk/Scribus/scribus/undomanager.cpp (original)
+++ trunk/Scribus/scribus/undomanager.cpp Tue Jul 31 19:57:06 2012
@@ -422,7 +422,7 @@
if (!stacks_.contains(currentDoc_))
stacks_[currentDoc_] = UndoStack();
- stacks_[currentDoc_].setMaxSize(prefs_->getInt("historylength", 20));
+ stacks_[currentDoc_].setMaxSize(prefs_->getInt("historylength", 100));
for (uint i = 0; i < undoGuis_.size(); ++i)
setState(undoGuis_[i]);
@@ -937,6 +937,7 @@
UndoManager::SetFontEffect = tr("Set font effect");
UndoManager::ImageFrame = tr("Image frame");
UndoManager::TextFrame = tr("Text frame");
+ UndoManager::Layer = tr("Layer");
UndoManager::LatexFrame = tr("Render frame");
UndoManager::Polygon = tr("Polygon");
UndoManager::EditPolygon = tr("Edit polygon");
@@ -1205,6 +1206,7 @@
QString UndoManager::SetFontEffect = "";
QString UndoManager::ImageFrame = "";
QString UndoManager::TextFrame = "";
+QString UndoManager::Layer = "";
QString UndoManager::LatexFrame = "";
QString UndoManager::Polygon = "";
QString UndoManager::EditPolygon = "";
Modified: trunk/Scribus/scribus/undomanager.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17744&path=/trunk/Scribus/scribus/undomanager.h
==============================================================================
--- trunk/Scribus/scribus/undomanager.h (original)
+++ trunk/Scribus/scribus/undomanager.h Tue Jul 31 19:57:06 2012
@@ -536,6 +536,7 @@
static QString SetFontEffect;
static QString ImageFrame;
static QString TextFrame;
+ static QString Layer;
static QString LatexFrame;
static QString ResTyp;
static QString Polygon;
More information about the scribus-commit
mailing list