r15851 by jghali - - avoid crash when using calligraphic tool by initializing m_MouseButtonPressed variable properly
scribus-commit
scribus-commit at lists.scribus.net
Sun Nov 14 12:19:07 CET 2010
Author: jghali
Date: Sun Nov 14 11:19:07 2010
New Revision: 15851
URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=15851
Log:
- avoid crash when using calligraphic tool by initializing m_MouseButtonPressed variable properly
- cleanup unused variables in calligraphic and freehand tool
Modified:
trunk/Scribus/scribus/canvasmode_drawcalligraphic.cpp
trunk/Scribus/scribus/canvasmode_drawcalligraphic.h
trunk/Scribus/scribus/canvasmode_drawfreehand.cpp
trunk/Scribus/scribus/canvasmode_drawfreehand.h
Modified: trunk/Scribus/scribus/canvasmode_drawcalligraphic.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15851&path=/trunk/Scribus/scribus/canvasmode_drawcalligraphic.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_drawcalligraphic.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_drawcalligraphic.cpp Sun Nov 14 11:19:07 2010
@@ -60,16 +60,9 @@
CalligraphicMode::CalligraphicMode(ScribusView* view) : CanvasMode(view)
{
- GxM = GyM = -1;
Mxp = Myp = -1;
Dxp = Dyp = -1;
- MoveGX = MoveGY = false;
- oldCp = Cp = -1;
- frameResizeHandle = -1;
- RotMode = 0;
- inItemCreation = false;
- shiftSelItems = false;
- FirstPoly = true;
+ m_MouseButtonPressed = false;
}
@@ -102,16 +95,9 @@
void CalligraphicMode::activate(bool flag)
{
- GxM = GyM = -1;
Mxp = Myp = -1;
Dxp = Dyp = -1;
- MoveGX = MoveGY = false;
- oldCp = Cp = -1;
- frameResizeHandle = -1;
- RotMode = 0;
- inItemCreation = false;
- shiftSelItems = false;
- FirstPoly = true;
+ m_MouseButtonPressed = false;
setModeCursor();
}
@@ -169,7 +155,7 @@
return;
}
- if ((GetItem(&currItem)) && (!shiftSelItems))
+ if (GetItem(&currItem))
{
newX = qRound(mousePointDoc.x()); //m_view->translateToDoc(m->x(), m->y()).x());
newY = qRound(mousePointDoc.y()); //m_view->translateToDoc(m->x(), m->y()).y());
@@ -195,7 +181,7 @@
}
else
{
- if ((m_MouseButtonPressed) && (m->buttons() & Qt::LeftButton) && (GyM == -1) && (GxM == -1))
+ if ((m_MouseButtonPressed) && (m->buttons() & Qt::LeftButton))
{
newX = qRound(mousePointDoc.x()); //m_view->translateToDoc(m->x(), m->y()).x());
newY = qRound(mousePointDoc.y()); //m_view->translateToDoc(m->x(), m->y()).y());
@@ -225,8 +211,6 @@
m_view->HaveSelRect = false;
m_doc->DragP = false;
m_doc->leaveDrag = false;
- MoveGX = MoveGY = false;
- inItemCreation = false;
m->accept();
m_view->registerMousePress(m->globalPos());
Mxp = mousePointDoc.x(); //qRound(m->x()/m_canvas->scale() + 0*m_doc->minCanvasCoordinate.x());
@@ -321,7 +305,6 @@
createTransaction.commit(targetName, currItem->getUPixmap(), Um::Create + " " + currItem->getUName(), "", Um::ICreate);
//FIXME
m_canvas->m_viewMode.operItemResizing = false;
- inItemCreation = false;
m_doc->changed();
}
if (!PrefsManager::instance()->appPrefs.uiPrefs.stickyTools)
@@ -338,8 +321,6 @@
m_doc->DragP = false;
m_doc->leaveDrag = false;
m_view->MidButt = false;
- shiftSelItems = false;
- inItemCreation = false;
if (m_view->groupTransactionStarted())
{
for (int i = 0; i < m_doc->m_Selection->count(); ++i)
Modified: trunk/Scribus/scribus/canvasmode_drawcalligraphic.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15851&path=/trunk/Scribus/scribus/canvasmode_drawcalligraphic.h
==============================================================================
--- trunk/Scribus/scribus/canvasmode_drawcalligraphic.h (original)
+++ trunk/Scribus/scribus/canvasmode_drawcalligraphic.h Sun Nov 14 11:19:07 2010
@@ -49,16 +49,9 @@
inline bool GetItem(PageItem** pi);
void selectPage(QMouseEvent *m);
- int Cp, oldCp;
- bool inItemCreation, shiftSelItems, FirstPoly;
- bool m_MouseButtonPressed;
- int frameResizeHandle;
- int RotMode;
- int dragConstrainInitPtX, dragConstrainInitPtY;
+ bool m_MouseButtonPressed;
double Mxp, Myp, Dxp, Dyp;
- int GxM, GyM;
double SeRx, SeRy;
- bool MoveGX, MoveGY;
FPointArray RecordP;
};
Modified: trunk/Scribus/scribus/canvasmode_drawfreehand.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15851&path=/trunk/Scribus/scribus/canvasmode_drawfreehand.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_drawfreehand.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_drawfreehand.cpp Sun Nov 14 11:19:07 2010
@@ -60,16 +60,10 @@
FreehandMode::FreehandMode(ScribusView* view) : CanvasMode(view)
{
- GxM = GyM = -1;
Mxp = Myp = -1;
Dxp = Dyp = -1;
MoveGX = MoveGY = false;
- oldCp = Cp = -1;
- frameResizeHandle = -1;
- RotMode = 0;
- inItemCreation = false;
- shiftSelItems = false;
- FirstPoly = true;
+ m_MouseButtonPressed = false;
}
@@ -109,16 +103,10 @@
void FreehandMode::activate(bool flag)
{
// qDebug() << "FreehandMode::activate" << flag;
- GxM = GyM = -1;
Mxp = Myp = -1;
Dxp = Dyp = -1;
MoveGX = MoveGY = false;
- oldCp = Cp = -1;
- frameResizeHandle = -1;
- RotMode = 0;
- inItemCreation = false;
- shiftSelItems = false;
- FirstPoly = true;
+ m_MouseButtonPressed = false;
setModeCursor();
}
@@ -199,7 +187,7 @@
return;
}
- if ((GetItem(&currItem)) && (!shiftSelItems))
+ if (GetItem(&currItem))
{
newX = qRound(mousePointDoc.x()); //m_view->translateToDoc(m->x(), m->y()).x());
newY = qRound(mousePointDoc.y()); //m_view->translateToDoc(m->x(), m->y()).y());
@@ -225,7 +213,7 @@
}
else
{
- if ((m_MouseButtonPressed) && (m->buttons() & Qt::LeftButton) && (GyM == -1) && (GxM == -1))
+ if ((m_MouseButtonPressed) && (m->buttons() & Qt::LeftButton))
{
newX = qRound(mousePointDoc.x()); //m_view->translateToDoc(m->x(), m->y()).x());
newY = qRound(mousePointDoc.y()); //m_view->translateToDoc(m->x(), m->y()).y());
@@ -263,7 +251,6 @@
m_doc->DragP = false;
m_doc->leaveDrag = false;
MoveGX = MoveGY = false;
- inItemCreation = false;
// oldClip = 0;
m->accept();
m_view->registerMousePress(m->globalPos());
@@ -366,7 +353,6 @@
Um::Create + " " + currItem->getUName(), "", Um::ICreate);
//FIXME
m_canvas->m_viewMode.operItemResizing = false;
- inItemCreation = false;
m_doc->changed();
// m_view->updateContents(currItem->getRedrawBounding(m_canvas->scale()).adjusted(-10, -10, 20, 20));
}
@@ -381,598 +367,12 @@
return;
}
-#if 0
- assert(false);
- if (m_doc->appMode != modeDrawBezierLine) //FIXME: that should be dead - av
- {
- if (inItemCreation)
- {
- currItem = m_doc->m_Selection->itemAt(0);
- double itemX = 0.0;
- double itemY = 0.0;
- if (m_doc->appMode == modeDrawLine)
- {
- QTransform p = currItem->getTransform();
- FPoint np = m_doc->ApplyGridF(mousePointDoc).transformPoint(p, true);
- itemX = sqrt(pow(np.x(),2.0)+pow(np.y(),2.0));
- itemY = 1.0;
- }
- else if (m_doc->appMode == modeDrawRegularPolygon)
- {
- FPoint np1(mousePointDoc); //m_view->translateToDoc(m->x(), m->y()));
- np1 = m_doc->ApplyGridF(np1);
- itemX = fabs(np1.x() - currItem->xPos());
- itemY = fabs(np1.y() - currItem->yPos());
- }
- else
- {
- itemX = fabs(currItem->width());
- itemY = fabs(currItem->height());
- }
- if ((!m_view->moveTimerElapsed()) || ((itemX < 2.0) && (itemY < 2.0)) || ((m_doc->appMode == modeDrawLine) && (itemX < 2.0)))
- {
- int lmode = 0;
- if (m_doc->appMode == modeDrawLine)
- lmode = 1;
- PrefsContext* sizes = PrefsManager::instance()->prefsFile->getContext("ObjectSize");
- double xSize, ySize;
- int originPoint;
- if (lmode == 0)
- {
- xSize = sizes->getDouble("defWidth", 100.0);
- ySize = sizes->getDouble("defHeight", 100.0);
- originPoint = sizes->getInt("Origin", 0);
- }
- else
- {
- xSize = sizes->getDouble("defLength", 100.0);
- ySize = sizes->getDouble("defAngle", 0.0);
- originPoint = sizes->getInt("OriginL", 0);
- }
- bool doRemember = sizes->getBool("Remember", true);
- bool doCreate = false;
- if (m->modifiers() & (Qt::ShiftModifier | Qt::ControlModifier))
- doCreate = true;
- else
- {
- qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
- OneClick *dia = new OneClick(m_view, ScribusView::tr("Enter Object Size"), m_doc->unitIndex(), xSize, ySize, doRemember, originPoint, lmode);
- if (dia->exec())
- {
- doRemember = dia->checkRemember->isChecked();
- if (lmode == 0)
- {
- xSize = dia->spinWidth->value() / unitGetRatioFromIndex(m_doc->unitIndex());
- ySize = dia->spinHeight->value() / unitGetRatioFromIndex(m_doc->unitIndex());
- originPoint = dia->RotationGroup->checkedId();
- if (doRemember)
- {
- sizes->set("defWidth", xSize);
- sizes->set("defHeight", ySize);
- sizes->set("Origin", originPoint);
- }
- }
- else
- {
- xSize = dia->spinWidth->value() / unitGetRatioFromIndex(m_doc->unitIndex());
- ySize = dia->spinHeight->value();
- originPoint = dia->RotationGroup->checkedId();
- if (doRemember)
- {
- sizes->set("defLength", xSize);
- sizes->set("defAngle", ySize);
- sizes->set("OriginL", originPoint);
- }
- }
- sizes->set("Remember", doRemember);
- doCreate = true;
- }
- else
- {
- m_view->Deselect(false);
- m_doc->Items->removeAt(currItem->ItemNr);
- }
- delete dia;
- }
- if (doCreate)
- {
- bool oldSnap = m_doc->SnapGuides;
- m_doc->SnapGuides = false;
- m_doc->SizeItem(xSize, ySize, currItem->ItemNr, false, false, false);
- currItem->updateClip();
- currItem->ContourLine = currItem->PoLine.copy();
- switch (originPoint)
- {
- case 0:
- break;
- case 1:
- if (lmode == 0)
- m_doc->MoveItem(-currItem->width(), 0.0, currItem, false);
- else
- m_doc->MoveRotated(currItem, FPoint(-currItem->width() / 2.0, 0.0), false);
- break;
- case 2:
- if (lmode == 0)
- m_doc->MoveItem(-currItem->width() / 2.0, -currItem->height() / 2.0, currItem, false);
- else
- m_doc->MoveRotated(currItem, FPoint(-currItem->width(), 0.0), false);
- break;
- case 3:
- m_doc->MoveItem(0.0, -currItem->height(), currItem, false);
- break;
- case 4:
- m_doc->MoveItem(-currItem->width(), -currItem->height(), currItem, false);
- break;
- }
- m_doc->setRedrawBounding(currItem);
- currItem->OwnPage = m_doc->OnPage(currItem);
- currItem->OldB2 = currItem->width();
- currItem->OldH2 = currItem->height();
- currItem->Sizing = false;
- m_doc->SnapGuides = oldSnap;
- if (!PrefsManager::instance()->appPrefs.uiPrefs.stickyTools)
- {
- m_view->requestMode(modeNormal);
-// m_view->requestMode(submodePaintingDone);
- }
- else
- {
- int appMode = m_doc->appMode;
- if ((inItemCreation) && (appMode == modeNormal))
- {
- currItem = m_doc->m_Selection->itemAt(0);
- if (currItem->asTextFrame())
- appMode = modeDrawText;
- else if (currItem->asImageFrame())
- appMode = modeDrawImage;
- else if (m_doc->SubMode != -1)
- appMode = modeDrawShapes;
- }
- m_view->requestMode(appMode);
- }
- currItem->update();
- m_doc->changed();
-// emit DocChanged();
- }
- else
- {
- m_view->requestMode(submodePaintingDone);
-// emit HaveSel(-1);
- }
- inItemCreation = false;
- m_doc->DragP = false;
- m_doc->leaveDrag = false;
-//FIXME m_canvas->m_viewMode.operItemResizing = false;
- m_canvas->setRenderModeUseBuffer(false);
- m_view->MidButt = false;
- shiftSelItems = false;
- m_view->updateCanvas();
- qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
- }
- }
- if (m_view->moveTimerElapsed() && (GetItem(&currItem)))
- {
- m_canvas->setRenderModeUseBuffer(false);
- if (m_doc->m_Selection->isMultipleSelection())
- {
-
- }
- else
- {
- //Where a single frame resize stops when the mouse buttno is released
- //FIXME: reduce code!
- if (currItem->Sizing)
- {
- FPoint npx;
- double nx = mousePointDoc.x(); //m_view->translateToDoc(m->x(), m->y()).x();
- double ny = mousePointDoc.y(); //m_view->translateToDoc(m->x(), m->y()).y();
- if (m_doc->SnapGuides)
- {
- m_doc->ApplyGuides(&nx, &ny);
- npx = FPoint(nx, ny, currItem->xPos(), currItem->yPos(), currItem->rotation(), 1, 1, true);
- }
- else
- {
- npx = m_doc->ApplyGridF(FPoint(nx, ny));
- npx = FPoint(npx.x(), npx.y(), currItem->xPos(), currItem->yPos(), currItem->rotation(), 1, 1, true);
- }
- if ((frameResizeHandle == 1) && !(currItem->asLine()) && (m_doc->SnapGuides))
- m_doc->SizeItem(npx.x(), npx.y(), currItem->ItemNr);
- bool sav = m_doc->SnapGuides;
- m_doc->SnapGuides = false;
- UndoTransaction* activeTransaction = NULL;
- if (UndoManager::undoEnabled())
- {
- activeTransaction = new UndoTransaction(m_view->undoManager->beginTransaction(currItem->getUName(), currItem->getUPixmap(),
- Um::Resize, QString(Um::ResizeFromTo).arg(currItem->width()).arg(currItem->height()).arg(currItem->width() - npx.x()).arg(currItem->height() - npx.y()), Um::IResize));
- }
-// m_canvas->m_viewMode.operItemResizing = false;
- switch (frameResizeHandle)
- {
- case 1:
- if (!currItem->asLine())
- {
- //<<Swap location if width/height is <0
- if (currItem->width()<0)
- {
- currItem->setWidth(-currItem->width());
- currItem->setXPos(currItem->xPos()-currItem->width());
- }
- if (currItem->height()<0)
- {
- currItem->setHeight(-currItem->height());
- currItem->setYPos(currItem->yPos()-currItem->height());
- }
- //>>
- if (currItem->imageFlippedH())
- currItem->moveImageInFrame(-(currItem->width() - currItem->OldB2)/currItem->imageXScale(), 0);
- if (currItem->imageFlippedV())
- currItem->moveImageInFrame(0, -(currItem->height() - currItem->OldH2)/currItem->imageYScale());
- }
- else
- {
- if (sav)
- {
- double nx = mousePointDoc.x(); //m_view->translateToDoc(m->x(), m->y()).x();
- double ny = mousePointDoc.y(); //m_view->translateToDoc(m->x(), m->y()).y();
- if (m_doc->useRaster)
- {
- FPoint ra(m_doc->ApplyGridF(FPoint(nx, ny)));
- nx = ra.x();
- ny = ra.y();
- }
- m_doc->SnapGuides = sav;
- m_doc->ApplyGuides(&nx, &ny);
- m_doc->SnapGuides = false;
- double r = atan2(ny - currItem->yPos(), nx - currItem->xPos())*(180.0/M_PI);
- m_doc->RotateItem(r, currItem->ItemNr);
- double w = sqrt(pow(nx - currItem->xPos(), 2) + pow(ny - currItem->yPos(),2));
- m_doc->SizeItem(w, currItem->height(), currItem->ItemNr, true);
- }
- }
- currItem->Sizing = false;
- break;
- case 2:
- if (!currItem->asLine())
- {
- m_doc->MoveSizeItem(npx, npx, currItem->ItemNr);
-
- //<<Swap location if width/height is <0
- if (currItem->width()<0)
- {
- currItem->setWidth(-currItem->width());
- currItem->setXPos(currItem->xPos()-currItem->width());
- }
- if (currItem->height()<0)
- {
- currItem->setHeight(-currItem->height());
- currItem->setYPos(currItem->yPos()-currItem->height());
- }
- //>>
-
- currItem->Sizing = false;
- if (!currItem->imageFlippedH())
- {
- currItem->moveImageInFrame((currItem->width() - currItem->OldB2)/currItem->imageXScale(), 0);
- currItem->update();
- }
- if (!currItem->imageFlippedV())
- {
- currItem->moveImageInFrame(0, (currItem->height() - currItem->OldH2)/currItem->imageYScale());
- currItem->update();
- }
- }
- else
- {
- if (sav)
- {
- double nx = mousePointDoc.x(); //m_view->translateToDoc(m->x(), m->y()).x();
- double ny = mousePointDoc.y(); //m_view->translateToDoc(m->x(), m->y()).y();
- if (m_doc->useRaster)
- {
- FPoint ra(m_doc->ApplyGridF(FPoint(nx, ny)));
- nx = ra.x();
- ny = ra.y();
- }
- m_doc->SnapGuides = sav;
- m_doc->ApplyGuides(&nx, &ny);
- m_doc->SnapGuides = false;
- QTransform ma;
- ma.translate(currItem->xPos(), currItem->yPos());
- ma.rotate(currItem->rotation());
- double mx = ma.m11() * currItem->width() + ma.m21() * currItem->height() + ma.dx();
- double my = ma.m22() * currItem->height() + ma.m12() * currItem->width() + ma.dy();
- double r = atan2(my-ny,mx-nx)*(180.0/M_PI);
- double w = sqrt(pow(mx-nx,2)+pow(my-ny,2));
- m_doc->MoveItem(nx - currItem->xPos(), ny - currItem->yPos(), currItem, true);
- m_doc->SizeItem(w, currItem->height(), currItem->ItemNr, true);
- m_doc->RotateItem(r, currItem->ItemNr);
- currItem->Sizing = false;
- }
- }
- break;
- case 3:
- m_doc->MoveSizeItem(FPoint(0, npx.y()), FPoint(currItem->width() - npx.x(), npx.y()), currItem->ItemNr);
-
- //<<Swap location if width/height is <0
- if (currItem->width()<0)
- {
- currItem->setWidth(-currItem->width());
- currItem->setXPos(currItem->xPos()-currItem->width());
- }
- if (currItem->height()<0)
- {
- currItem->setHeight(-currItem->height());
- currItem->setYPos(currItem->yPos()-currItem->height());
- }
- //>>
-
- currItem->Sizing = false;
- if (currItem->imageFlippedH())
- currItem->moveImageInFrame(-(currItem->width() - currItem->OldB2)/currItem->imageXScale(), 0);
- if (!currItem->imageFlippedV())
- currItem->moveImageInFrame(0, (currItem->height() - currItem->OldH2)/currItem->imageYScale());
- break;
- case 4:
-
- m_doc->MoveSizeItem(FPoint(npx.x(), 0), FPoint(npx.x(), currItem->height() - npx.y()), currItem->ItemNr);
-
- //<<Swap location if width/height is <0
- if (currItem->width()<0)
- {
- currItem->setWidth(-currItem->width());
- currItem->setXPos(currItem->xPos()-currItem->width());
- }
- if (currItem->height()<0)
- {
- currItem->setHeight(-currItem->height());
- currItem->setYPos(currItem->yPos()-currItem->height());
- }
- //>>
-
- currItem->Sizing = false;
- if (!currItem->imageFlippedH())
- currItem->moveImageInFrame((currItem->width() - currItem->OldB2)/currItem->imageXScale(), 0);
- if (currItem->imageFlippedV())
- currItem->moveImageInFrame(0, -(currItem->height() - currItem->OldH2)/currItem->imageYScale());
- break;
- case 5:
- m_doc->MoveSizeItem(FPoint(0, 0), FPoint(0, currItem->height() - npx.y()), currItem->ItemNr);
- if (currItem->imageFlippedV())
- currItem->moveImageInFrame(0, -(currItem->height() - currItem->OldH2)/currItem->imageYScale());
-
- //<<Swap location if width/height is <0
- if (currItem->width()<0)
- {
- currItem->setWidth(-currItem->width());
- currItem->setXPos(currItem->xPos()-currItem->width());
- }
- if (currItem->height()<0)
- {
- currItem->setHeight(-currItem->height());
- currItem->setYPos(currItem->yPos()-currItem->height());
- }
- //>>
-
- currItem->Sizing = false;
- break;
- case 6:
- m_doc->MoveSizeItem(FPoint(0, 0), FPoint(currItem->width() - npx.x(), 0), currItem->ItemNr);
- if (currItem->imageFlippedH())
- currItem->moveImageInFrame(-(currItem->width() - currItem->OldB2)/currItem->imageXScale(), 0);
-
- //<<Swap location if width/height is <0
- if (currItem->width()<0)
- {
- currItem->setWidth(-currItem->width());
- currItem->setXPos(currItem->xPos()-currItem->width());
- }
- if (currItem->height()<0)
- {
- currItem->setHeight(-currItem->height());
- currItem->setYPos(currItem->yPos()-currItem->height());
- }
- //>>
-
- currItem->Sizing = false;
- break;
- case 7:
- m_doc->MoveSizeItem(FPoint(npx.x(), 0), FPoint(npx.x(), 0), currItem->ItemNr);
-
- //<<Swap location if width/height is <0
- if (currItem->width()<0)
- {
- currItem->setWidth(-currItem->width());
- currItem->setXPos(currItem->xPos()-currItem->width());
- }
- if (currItem->height()<0)
- {
- currItem->setHeight(-currItem->height());
- currItem->setYPos(currItem->yPos()-currItem->height());
- }
- //>>
-
- currItem->Sizing = false;
- if (!currItem->imageFlippedH())
- currItem->moveImageInFrame((currItem->width() - currItem->OldB2)/currItem->imageXScale(), 0);
- if (currItem->imageFlippedV())
- currItem->moveImageInFrame(0, -(currItem->height() - currItem->OldH2)/currItem->imageYScale());
- break;
- case 8:
- m_doc->MoveSizeItem(FPoint(0, npx.y()), FPoint(0, npx.y()), currItem->ItemNr);
-
- //<<Swap location if width/height is <0
- if (currItem->width()<0)
- {
- currItem->setWidth(-currItem->width());
- currItem->setXPos(currItem->xPos()-currItem->width());
- }
- if (currItem->height()<0)
- {
- currItem->setHeight(-currItem->height());
- currItem->setYPos(currItem->yPos()-currItem->height());
- }
- //>>
-
- currItem->Sizing = false;
- if (currItem->imageFlippedH())
- currItem->moveImageInFrame(-(currItem->width() - currItem->OldB2)/currItem->imageXScale(), 0);
- if (!currItem->imageFlippedV())
- currItem->moveImageInFrame(0, (currItem->height() - currItem->OldH2)/currItem->imageYScale());
- break;
- }
-
- currItem->updateClip();
-// emit ItemTextCols(currItem->Cols, currItem->ColGap);
- m_doc->SnapGuides = sav;
-// evSpon = false;
- currItem->update(); // MoveSizeItem *should* call PageItem::update
- m_view->updateCanvas();
-// emit DocChanged();
- currItem->checkChanges();
- if (activeTransaction)
- {
- activeTransaction->commit();
- delete activeTransaction;
- activeTransaction = NULL;
- }
- }
- m_doc->setRedrawBounding(currItem);
- currItem->OwnPage = m_doc->OnPage(currItem);
-// m_canvas->m_viewMode.operItemResizing = false;
- if (currItem->asLine())
- m_view->updateCanvas();
- }
- }
- //CB Drag selection performed here
- if (((m_doc->m_Selection->count() == 0) && (m_view->HaveSelRect) && (!m_view->MidButt)) || ((shiftSelItems) && (m_view->HaveSelRect) && (!m_view->MidButt)))
- {
- QRectF Sele = QRectF(Dxp, Dyp, SeRx-Dxp, SeRy-Dyp).normalized();
- if (!m_doc->masterPageMode())
- {
- uint docPagesCount=m_doc->Pages->count();
- uint docCurrPageNo=m_doc->currentPageNumber();
- for (uint i = 0; i < docPagesCount; ++i)
- {
- if (QRectF(m_doc->Pages->at(i)->xOffset(), m_doc->Pages->at(i)->yOffset(), m_doc->Pages->at(i)->width(), m_doc->Pages->at(i)->height()).intersects(Sele))
- {
- if (docCurrPageNo != i)
- {
- m_doc->setCurrentPage(m_doc->Pages->at(i));
- m_view->setMenTxt(i);
- }
- break;
- }
- }
-//FIXME m_view->setRulerPos(m_view->contentsX(), m_view->contentsY());
- }
-/* FIXME
- int docItemCount=m_doc->Items->count();
- if (docItemCount != 0)
- {
- m_doc->m_Selection->setIsGUISelection(false);
- for (int a = 0; a < docItemCount; ++a)
- {
- PageItem* docItem = m_doc->Items->at(a);
- QTransform p;
- m_canvas->Transform(docItem, p);
- QRegion apr = QRegion(docItem->Clip * p);
- QRect apr2(docItem->getRedrawBounding(1.0));
- if ((m_doc->masterPageMode()) && (docItem->OnMasterPage != m_doc->currentPage()->pageName()))
- continue;
- //CB Finally Items are selected here
- if (((Sele.contains(apr.boundingRect())) || (Sele.contains(apr2))) && (docItem->LayerID == m_doc->activeLayer()) && (!m_doc->layerLocked(docItem->LayerID)))
- {
- //CB set draw to true to (dis)enable some actions via emit to HaveNewSel in scapp.
- //CB FIXME emit from selection when multiple selected instead
- //CB #3523 bool redrawSelection=(a==docItemCount-1);
- bool redrawSelection=false;
- m_view->SelectItemNr(a, redrawSelection);
- }
- }
- m_doc->m_Selection->setIsGUISelection(true);
- m_doc->m_Selection->connectItemToGUI();
- if (m_doc->m_Selection->count() > 1)
- {
- m_doc->m_Selection->setGroupRect();
- double x, y, w, h;
- m_doc->m_Selection->getGroupRect(&x, &y, &w, &h);
-// emit ItemPos(x, y);
-// emit ItemGeom(w, h);
- m_view->getGroupRectScreen(&x, &y, &w, &h);
- }
-// if (m_doc->m_Selection->count() > 0)
-// emit HaveSel(m_doc->m_Selection->itemAt(0)->itemType());
- }*/
-
- m_view->HaveSelRect = false;
- shiftSelItems = false;
- m_view->redrawMarker->hide();
- m_view->updateCanvas();
- }
- if (m_doc->appMode != modeEdit)
- {
- if (!PrefsManager::instance()->appPrefs.uiPrefs.stickyTools)
- {
-// qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
- m_view->requestMode(modeNormal);
-// m_view->requestMode(submodePaintingDone);
- }
- else
- {
- int appMode = m_doc->appMode;
- if ((inItemCreation) && (appMode == modeNormal))
- {
- currItem = m_doc->m_Selection->itemAt(0);
- if (currItem->asTextFrame())
- appMode = modeDrawText;
- else if (currItem->asImageFrame())
- appMode = modeDrawImage;
- else if (m_doc->SubMode != -1)
- appMode = modeDrawShapes;
- }
- m_view->requestMode(appMode);
- }
- }
- if (GetItem(&currItem))
- {
- if (m_doc->m_Selection->count() > 1)
- {
- m_doc->m_Selection->setGroupRect();
- //CB shouldnt need this i think
- //emit HaveSel(currItem->itemType());
- double x, y, w, h;
- m_doc->m_Selection->getGroupRect(&x, &y, &w, &h);
-// emit ItemPos(x, y);
-// emit ItemGeom(w, h);
-// m_view->getGroupRectScreen(&x, &y, &w, &h);
-
-// m_canvas->m_viewMode.operItemResizing = false;
- m_canvas->update(QRect(static_cast<int>(x-5), static_cast<int>(y-5), static_cast<int>(w+10), static_cast<int>(h+10)));
- }
- else
- currItem->emitAllToGUI();
-
- /*else
- {
- //CB Dont think we need this here with the new selection code
- //For a select, deselect operation, this will cause 2x emit
- //emit HaveSel(currItem->itemType());
- //EmitValues(currItem);
- //currItem->emitAllToGUI();
- }*/
- }
- }
-#endif
-
m_canvas->setRenderModeUseBuffer(false);
m_doc->DragP = false;
m_doc->leaveDrag = false;
// m_canvas->m_viewMode.operItemResizing = false;
m_view->MidButt = false;
- shiftSelItems = false;
- inItemCreation = false;
// m_doc->SubMode = -1;
if (m_view->groupTransactionStarted())
{
Modified: trunk/Scribus/scribus/canvasmode_drawfreehand.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15851&path=/trunk/Scribus/scribus/canvasmode_drawfreehand.h
==============================================================================
--- trunk/Scribus/scribus/canvasmode_drawfreehand.h (original)
+++ trunk/Scribus/scribus/canvasmode_drawfreehand.h Sun Nov 14 11:19:07 2010
@@ -49,14 +49,8 @@
inline bool GetItem(PageItem** pi);
void selectPage(QMouseEvent *m);
- int Cp, oldCp;
- bool inItemCreation, shiftSelItems, FirstPoly;
- bool m_MouseButtonPressed;
- int frameResizeHandle;
- int RotMode;
- int dragConstrainInitPtX, dragConstrainInitPtY;
+ bool m_MouseButtonPressed;
double Mxp, Myp, Dxp, Dyp;
- int GxM, GyM;
double SeRx, SeRy;
bool MoveGX, MoveGY;
FPointArray RecordP;
More information about the scribus-commit
mailing list