r14372 by jghali - #7411: remove frame handles when selection switchs to Editing tool - do not display frame resize handles in canvas modes which do not allow resizing objects - no resize in object edit mode
scribus-commit
scribus-commit at lists.scribus.net
Wed Dec 2 23:35:55 CET 2009
Revision: 14372
Author: jghali
Date: 2009-12-02T12:32:09.624129Z
Commit message: #7411: remove frame handles when selection switchs to Editing tool
- do not display frame resize handles in canvas modes which do not allow resizing objects
- no resize in object edit mode
Changeset:
M /branches/Version135/Scribus/scribus/canvasmode_normal.cpp
M /branches/Version135/Scribus/scribus/canvasmode_edit.h
M /branches/Version135/Scribus/scribus/canvasmode_panning.cpp
M /branches/Version135/Scribus/scribus/canvasmode_framelinks.cpp
M /branches/Version135/Scribus/scribus/canvasmode_rotate.cpp
M /branches/Version135/Scribus/scribus/canvasmode_magnifier.cpp
M /branches/Version135/Scribus/scribus/canvasmode_editgradient.cpp
M /branches/Version135/Scribus/scribus/canvasmode_legacy.cpp
M /branches/Version135/Scribus/scribus/scribusview.cpp
M /branches/Version135/Scribus/scribus/canvasmode_objimport.cpp
M /branches/Version135/Scribus/scribus/canvas.cpp
M /branches/Version135/Scribus/scribus/canvasmode_eyedropper.cpp
M /branches/Version135/Scribus/scribus/canvas.h
M /branches/Version135/Scribus/scribus/canvasmode.cpp
M /branches/Version135/Scribus/scribus/canvasmode.h
M /branches/Version135/Scribus/scribus/canvasmode_edit.cpp
M /branches/Version135/Scribus/scribus/canvasmode_copyproperties.cpp
Diffs:
Index: scribus/canvasmode_editgradient.cpp
===================================================================
--- scribus/canvasmode_editgradient.cpp (revision 14371)
+++ scribus/canvasmode_editgradient.cpp (revision 14372)
@@ -78,7 +78,7 @@
}
else
{
- drawSelection(p);
+ drawSelection(p, false);
}
}
@@ -111,7 +111,6 @@
setModeCursor();
if (fromGesture)
{
- m_canvas->m_viewMode.operItemResizeInEditMode = false;
m_view->update();
}
}
Index: scribus/canvasmode_magnifier.cpp
===================================================================
--- scribus/canvasmode_magnifier.cpp (revision 14371)
+++ scribus/canvasmode_magnifier.cpp (revision 14372)
@@ -59,7 +59,7 @@
void CanvasMode_Magnifier::drawControls(QPainter* p)
{
- commonDrawControls(p);
+ commonDrawControls(p, false);
}
void CanvasMode_Magnifier::enterEvent(QEvent *)
@@ -93,7 +93,6 @@
setModeCursor();
if (fromGesture)
{
- m_canvas->m_viewMode.operItemResizeInEditMode = false;
m_view->update();
}
}
Index: scribus/canvasmode_legacy.cpp
===================================================================
--- scribus/canvasmode_legacy.cpp (revision 14371)
+++ scribus/canvasmode_legacy.cpp (revision 14372)
@@ -106,7 +106,7 @@
void LegacyMode::drawControls(QPainter* p)
{
- commonDrawControls(p);
+ commonDrawControls(p, true);
PageItem* currItem;
if (m_doc->appMode == modeEdit && GetItem(&currItem))
{
@@ -229,7 +229,6 @@
}
if (fromGesture)
{
- m_canvas->m_viewMode.operItemResizeInEditMode = false;
m_view->update();
}
}
@@ -691,7 +690,7 @@
Mxp = newX;
Myp = newY;
}
- if (m_canvas->m_viewMode.m_MouseButtonPressed && (m_doc->appMode == modeEdit) && (!m_canvas->m_viewMode.operItemResizeInEditMode))
+ if (m_canvas->m_viewMode.m_MouseButtonPressed && (m_doc->appMode == modeEdit))
{
if (currItem->asImageFrame())
{
@@ -734,7 +733,7 @@
//Operations run here:
//Item resize, esp after creating a new one
if (m_view->moveTimerElapsed() && m_canvas->m_viewMode.m_MouseButtonPressed && (m->buttons() & Qt::LeftButton) &&
- ((m_doc->appMode == modeNormal) || ((m_doc->appMode == modeEdit) && m_canvas->m_viewMode.operItemResizeInEditMode)) && (!currItem->locked()))
+ (m_doc->appMode == modeNormal) && (!currItem->locked()))
{
// m_view->stopDragTimer();
if (m_canvas->m_viewMode.operItemResizing)
@@ -1704,7 +1703,6 @@
case modeEdit:
{
frameResizeHandle = 0;
- m_canvas->m_viewMode.operItemResizeInEditMode = false;
int oldP=0;
if (GetItem(&currItem))
{
@@ -1715,14 +1713,8 @@
resizeGesture = new ResizeGesture(this);
resizeGesture->mousePressEvent(m);
- if (resizeGesture->frameHandle() > 0)
+ if (resizeGesture->frameHandle() < 0)
{
- m_canvas->m_viewMode.operItemResizeInEditMode = true;
- m_view->startGesture(resizeGesture);
- return;
- }
- else if (resizeGesture->frameHandle() < 0)
- {
m_view->Deselect(true);
if (SeleItem(m))
{
@@ -4019,7 +4011,7 @@
}
}
- if ((m_doc->appMode == modeEdit) && !m_canvas->m_viewMode.operItemResizeInEditMode)
+ if (m_doc->appMode == modeEdit)
{
currItem = m_doc->m_Selection->itemAt(0);
if (currItem->asTextFrame())
Index: scribus/canvasmode_copyproperties.cpp
===================================================================
--- scribus/canvasmode_copyproperties.cpp (revision 14371)
+++ scribus/canvasmode_copyproperties.cpp (revision 14372)
@@ -51,7 +51,7 @@
void CanvasMode_CopyProperties::drawControls(QPainter* p)
{
- commonDrawControls(p);
+ commonDrawControls(p, false);
}
void CanvasMode_CopyProperties::enterEvent(QEvent *)
@@ -85,7 +85,6 @@
setModeCursor();
if (fromGesture)
{
- m_canvas->m_viewMode.operItemResizeInEditMode = false;
m_view->update();
}
}
Index: scribus/canvas.h
===================================================================
--- scribus/canvas.h (revision 14371)
+++ scribus/canvas.h (revision 14372)
@@ -57,7 +57,6 @@
bool m_MouseButtonPressed;
bool operItemMoving;
bool operItemResizing;
- bool operItemResizeInEditMode;
bool operItemSelecting;
bool operTextSelecting;
QPolygon redrawPolygon;
Index: scribus/canvasmode_framelinks.cpp
===================================================================
--- scribus/canvasmode_framelinks.cpp (revision 14371)
+++ scribus/canvasmode_framelinks.cpp (revision 14372)
@@ -66,7 +66,7 @@
void CanvasMode_FrameLinks::drawControls(QPainter* p)
{
- commonDrawControls(p);
+ commonDrawControls(p, false);
}
void CanvasMode_FrameLinks::enterEvent(QEvent *)
@@ -100,7 +100,6 @@
setModeCursor();
if (fromGesture)
{
- m_canvas->m_viewMode.operItemResizeInEditMode = false;
m_view->update();
}
}
Index: scribus/scribusview.cpp
===================================================================
--- scribus/scribusview.cpp (revision 14371)
+++ scribus/scribusview.cpp (revision 14372)
@@ -143,30 +143,15 @@
OldScale(0),
dragX(0), dragY(0), dragW(0), dragH(0),
oldW(-1), // oldCp(-1),
-// Mxp(-1), Myp(-1), Dxp(-1), Dyp(-1),
-// frameResizeHandle(-1),
-// SeRx(-1), SeRy(-1), GyM(-1), GxM(-1),
-// ClRe(-1), ClRe2(-1),
-// SegP1(-1), SegP2(-1),
RotMode(0),
DrHY(-1), DrVX(-1),
-// EdPoints(true),
-// m_MouseButtonPressed(false),
-// operItemMoving(false),
-// MoveGY(false), MoveGX(false),
HaveSelRect(false),
-// operItemResizing(false),
-// EditContour(false),
- //GroupSel(false),
DraggedGroup(false),
DraggedGroupFirst(false),
-// operItemResizeInEditMode(false),
MidButt(false),
updateOn(true),
FirstPoly(true),
Magnify(false),
-// MoveSym(false),
-// previewMode(false),
RCenter(-1,-1),
// RecordP(),
Ready(false),
@@ -174,10 +159,6 @@
m_groupTransactions(0),
m_groupTransaction(NULL),
_isGlobalMode(true),
-// evSpon(false),
-// forceRedraw(false),
-// Scale(Prefs->DisScale),
-// oldClip(0),
m_vhRulerHW(17)
{
setObjectName("s");
Index: scribus/canvasmode_rotate.cpp
===================================================================
--- scribus/canvasmode_rotate.cpp (revision 14371)
+++ scribus/canvasmode_rotate.cpp (revision 14372)
@@ -52,7 +52,7 @@
void CanvasMode_Rotate::drawControls(QPainter* p)
{
- drawSelection(p);
+ drawSelection(p, true);
if (m_inItemRotation)
{
drawItemOutlines(p);
@@ -165,7 +165,6 @@
setModeCursor();
if (fromGesture)
{
- m_canvas->m_viewMode.operItemResizeInEditMode = false;
m_view->update();
}
}
Index: scribus/canvasmode_eyedropper.cpp
===================================================================
--- scribus/canvasmode_eyedropper.cpp (revision 14371)
+++ scribus/canvasmode_eyedropper.cpp (revision 14372)
@@ -64,7 +64,7 @@
void CanvasMode_EyeDropper::drawControls(QPainter* p)
{
- commonDrawControls(p);
+ commonDrawControls(p, false);
}
void CanvasMode_EyeDropper::enterEvent(QEvent *)
@@ -92,7 +92,6 @@
setModeCursor();
if (fromGesture)
{
- m_canvas->m_viewMode.operItemResizeInEditMode = false;
m_view->update();
}
grabMouse();
Index: scribus/canvasmode_objimport.cpp
===================================================================
--- scribus/canvasmode_objimport.cpp (revision 14371)
+++ scribus/canvasmode_objimport.cpp (revision 14372)
@@ -72,7 +72,7 @@
void CanvasMode_ObjImport::drawControls(QPainter* p)
{
// qDebug() << "CanvasMode_ObjImport::drawControls";
- drawSelection(p);
+ drawSelection(p, false);
}
void CanvasMode_ObjImport::enterEvent(QEvent *)
@@ -105,7 +105,6 @@
setModeCursor();
if (fromGesture)
{
- m_canvas->m_viewMode.operItemResizeInEditMode = false;
m_view->update();
}
}
Index: scribus/canvasmode.cpp
===================================================================
--- scribus/canvasmode.cpp (revision 14371)
+++ scribus/canvasmode.cpp (revision 14372)
@@ -160,7 +160,7 @@
}
-void CanvasMode::drawSelection(QPainter* psx)
+void CanvasMode::drawSelection(QPainter* psx, bool drawHandles)
{
QTime t;
t.start();
@@ -173,9 +173,9 @@
psx->setClipping(true);
psx->setClipRegion(QRegion ( m_canvas->exposedRect() ) );
+
if (m_doc->m_Selection->isMultipleSelection())
{
- bool drawHandles(true);
PageItem *curItem(0);
for(int a=0; a<m_doc->m_Selection->count(); ++a)
{
@@ -220,12 +220,12 @@
// items inside a a multi
if (m_doc->m_Selection->count() > 1)
{
- uint docSelectionCount = m_doc->m_Selection->count();
- PageItem *currItem;
- for (uint a=0; a<docSelectionCount; ++a)
- {
- currItem = m_doc->m_Selection->itemAt(a);
- if( currItem->Groups.count() > 0)
+ uint docSelectionCount = m_doc->m_Selection->count();
+ PageItem *currItem;
+ for (uint a=0; a<docSelectionCount; ++a)
+ {
+ currItem = m_doc->m_Selection->itemAt(a);
+ if( currItem->Groups.count() > 0)
{
if(! currItem->controlsGroup() )
continue;
@@ -235,32 +235,32 @@
continue;
}
}
- psx->save();
- psx->setPen(m_pen["selection-group-inside"]);
- psx->setBrush(m_brush["selection-group-inside"]);
- double lineAdjust(psx->pen().width()/m_canvas->scale());
- double x, y, w, h;
- if (currItem->rotation() != 0)
- {
- psx->setRenderHint(QPainter::Antialiasing);
- psx->translate(currItem->xPos(), currItem->yPos());
- psx->rotate(currItem->rotation());
- x = currItem->lineWidth()/-2.0;
- y = currItem->lineWidth()/-2.0;
- }
- else
- {
- psx->translate(currItem->visualXPos(), currItem->visualYPos());
- x = -lineAdjust;
- y = -lineAdjust;
- }
- w = currItem->visualWidth() ;
- h = (currItem->asLine()) ? currItem->visualHeight() - 1.0 : currItem->visualHeight() ;
+ psx->save();
+ psx->setPen(m_pen["selection-group-inside"]);
+ psx->setBrush(m_brush["selection-group-inside"]);
+ double lineAdjust(psx->pen().width()/m_canvas->scale());
+ double x, y, w, h;
+ if (currItem->rotation() != 0)
+ {
+ psx->setRenderHint(QPainter::Antialiasing);
+ psx->translate(currItem->xPos(), currItem->yPos());
+ psx->rotate(currItem->rotation());
+ x = currItem->lineWidth()/-2.0;
+ y = currItem->lineWidth()/-2.0;
+ }
+ else
+ {
+ psx->translate(currItem->visualXPos(), currItem->visualYPos());
+ x = -lineAdjust;
+ y = -lineAdjust;
+ }
+ w = currItem->visualWidth() ;
+ h = (currItem->asLine()) ? currItem->visualHeight() - 1.0 : currItem->visualHeight() ;
- psx->drawRect(QRectF(x, y, w, h));
+ psx->drawRect(QRectF(x, y, w, h));
- psx->restore();
- }
+ psx->restore();
+ }
}
}
else if (m_doc->m_Selection->count() != 0)
@@ -304,7 +304,7 @@
tt.start();
psx->drawRect(QRectF(x, y, w, h));
tu << QString::number(tt.elapsed());
- if(!currItem->locked())
+ if(drawHandles && !currItem->locked())
{
psx->setBrush(m_brush["handle"]);
psx->setPen(m_pen["handle"]);
@@ -650,10 +650,10 @@
return false;
}
-void CanvasMode::commonDrawControls(QPainter* p)
+void CanvasMode::commonDrawControls(QPainter* p, bool drawHandles)
{
if (m_canvas->m_viewMode.operItemMoving)
drawOutline(p);
else
- drawSelection(p);
+ drawSelection(p, drawHandles);
}
Index: scribus/canvasmode_edit.h
===================================================================
--- scribus/canvasmode_edit.h (revision 14371)
+++ scribus/canvasmode_edit.h (revision 14372)
@@ -27,7 +27,6 @@
class PageItem;
class PageItem_TextFrame;
class QTimer;
-class ResizeGesture;
class ScribusMainWindow;
class ScribusView;
@@ -66,7 +65,6 @@
double Mxp, Myp, Dxp, Dyp;
double SeRx, SeRy;
ScribusMainWindow* m_ScMW;
- ResizeGesture* resizeGesture;
bool m_cursorVisible;
QTime m_blinkTime;
QTimer* m_blinker;
Index: scribus/canvasmode.h
===================================================================
--- scribus/canvasmode.h (revision 14371)
+++ scribus/canvasmode.h (revision 14372)
@@ -113,7 +113,7 @@
/** Draws the regular selection marker */
- void drawSelection(QPainter* psx);
+ void drawSelection(QPainter* psx, bool drawHandles);
/** 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
@@ -140,7 +140,7 @@
void setResizeCursor(int how, double rot = 0.0);
bool commonMouseMove(QMouseEvent *m);
- void commonDrawControls(QPainter* p);
+ void commonDrawControls(QPainter* p, bool drawHandles);
private:
QMap<QString,QPen> m_pen;
Index: scribus/canvasmode_edit.cpp
===================================================================
--- scribus/canvasmode_edit.cpp (revision 14371)
+++ scribus/canvasmode_edit.cpp (revision 14372)
@@ -65,7 +65,6 @@
Dxp = Dyp = -1;
oldCp = Cp = -1;
frameResizeHandle = -1;
- resizeGesture = NULL;
m_blinker = new QTimer(view);
connect(m_blinker, SIGNAL(timeout()), this, SLOT(blinkTextCursor()));
}
@@ -90,7 +89,7 @@
void CanvasMode_Edit::drawControls(QPainter* p)
{
- commonDrawControls(p);
+ commonDrawControls(p, false);
PageItem* currItem;
if (GetItem(&currItem))
{
@@ -305,7 +304,6 @@
}
if (fromGesture)
{
- m_canvas->m_viewMode.operItemResizeInEditMode = false;
m_view->update();
}
PageItem * it(0);
@@ -360,11 +358,7 @@
m_lastPosWasOverGuide = false;
double newX, newY;
- double nx, ny;
PageItem *currItem;
- QPoint np, np2, mop;
- FPoint npf, npf2;
- QRect tx;
bool erf = false;
m->accept();
if (commonMouseMove(m))
@@ -375,7 +369,7 @@
newY = qRound(mousePointDoc.y()); //m_view->translateToDoc(m->x(), m->y()).y());
if (m_doc->DragP)
return;
- if (m_canvas->m_viewMode.m_MouseButtonPressed && (m_doc->appMode == modeEdit) && (!m_canvas->m_viewMode.operItemResizeInEditMode))
+ if (m_canvas->m_viewMode.m_MouseButtonPressed && (m_doc->appMode == modeEdit))
{
if (currItem->asImageFrame())
{
@@ -427,430 +421,6 @@
}
}
- //Operations run here:
- //Item resize, esp after creating a new one
- if (m_view->moveTimerElapsed() && m_canvas->m_viewMode.m_MouseButtonPressed && (m->buttons() & Qt::LeftButton) &&
- ((m_doc->appMode == modeEdit) && m_canvas->m_viewMode.operItemResizeInEditMode) && (!currItem->locked()))
- {
-// m_view->stopDragTimer();
- if (m_canvas->m_viewMode.operItemResizing)
- {
-// newX = static_cast<int>(m->x()/sc);
-// newY = static_cast<int>(m->y()/sc);
- m_canvas->m_viewMode.operItemMoving = false;
- if (m_doc->m_Selection->isMultipleSelection())
- {
-// qDebug()<<"Resizing multiple selection"<<frameResizeHandle;
-// newX = qRound(mousePointDoc.x()); //m_view->translateToDoc(m->x(), m->y()).x());
-// newY = qRound(mousePointDoc.y()); //m_view->translateToDoc(m->x(), m->y()).y());
- double gx, gy, gh, gw;
- m_doc->m_Selection->getVisualGroupRect(&gx, &gy, &gw, &gh);
- const double sc=1;
- int ox1 = qRound(gx*sc);
- int oy1 = qRound(gy*sc);
- int ox2 = qRound((gx+gw)*sc);
- int oy2 = qRound((gy+gh)*sc);
- FPoint np2 = FPoint(newX, newY);
- np2 = m_doc->ApplyGridF(mousePointDoc);
- double nx = np2.x();
- double ny = np2.y();
- m_doc->ApplyGuides(&nx, &ny);
- np2 = FPoint(qRound(nx*sc), qRound(ny*sc));
- QMatrix pm;
- switch (frameResizeHandle)
- {
- case 1:
- if (m->modifiers() & Qt::ControlModifier)
- np2 = FPoint(qRound(newX), qRound(gy+(gh * ((newX-gx) / gw))));
- else
- np2 = FPoint(qRound(newX), qRound(newY));
- np2 = m_doc->ApplyGridF(np2);
- nx = np2.x();
- ny = np2.y();
- m_doc->ApplyGuides(&nx, &ny);
- np2 = FPoint(qRound(nx*sc), qRound(ny*sc));
- m_canvas->PaintSizeRect(pm.mapToPolygon(QRect(QPoint(qRound(gx*sc), qRound(gy*sc)), QPoint(qRound(np2.x()), qRound(np2.y())))));
- break;
- case 2:
- m_canvas->PaintSizeRect(pm.mapToPolygon(QRect(QPoint(qRound(np2.x()), qRound(np2.y())), QPoint(ox2,oy2))));
- break;
- case 3:
- m_canvas->PaintSizeRect(pm.mapToPolygon(QRect(QPoint(qRound(np2.x()), qRound(np2.y())), QPoint(ox1, oy2))));
- break;
- case 4:
- m_canvas->PaintSizeRect(pm.mapToPolygon(QRect(QPoint(qRound(np2.x()), qRound(np2.y())), QPoint(ox2, oy1))));
- break;
- case 5:
- m_canvas->PaintSizeRect(pm.mapToPolygon(QRect(QPoint(ox1, oy1), QPoint(ox2, qRound(np2.y())))));
- break;
- case 6:
- m_canvas->PaintSizeRect(pm.mapToPolygon(QRect(QPoint(qRound(np2.x()), oy2), QPoint(ox1,oy1))));
- break;
- case 7:
- m_canvas->PaintSizeRect(pm.mapToPolygon(QRect(QPoint(qRound(np2.x()), oy1), QPoint(ox2, oy2))));
- break;
- case 8:
- m_canvas->PaintSizeRect(pm.mapToPolygon(QRect(QPoint(ox1, qRound(qRound(np2.y()))), QPoint(ox2, oy2))));
- break;
- }
- Mxp = qRound(np2.x());
- Myp = qRound(np2.y());
- }
- else
- {
-// qDebug()<<"frameResizeHandle"<<frameResizeHandle;
- for (int a = 0; a < m_doc->m_Selection->count(); ++a)
- {
- currItem = m_doc->m_Selection->itemAt(0);
- double nh = currItem->height();
- if ((frameResizeHandle == 1) || (frameResizeHandle == 2))
- {
- QMatrix mp;
- switch (frameResizeHandle)
- {
- case 1:
-// mp.translate(-m_doc->minCanvasCoordinate.x() * m_canvas->scale(),-m_doc->minCanvasCoordinate.y() * m_canvas->scale());
- m_canvas->Transform(currItem, mp);
- //Shift proportional square resize
- if ((m->modifiers() & Qt::ShiftModifier) && (!(m->modifiers() & Qt::ControlModifier)))
- {
- QMatrix ma;
- ma.translate(currItem->xPos(), currItem->yPos());
- ma.rotate(currItem->rotation());
- ma = ma.inverted();
- nh = ma.m11() * newX + ma.m21() * newY + ma.dx();
- mop = QPoint(m->x(), m->y());
- }
- else
- {
- //Control proportional resize
- if ((m->modifiers() & Qt::ControlModifier) && (!(m->modifiers() & Qt::ShiftModifier)))
- {
- QMatrix ma;
- ma.translate(currItem->xPos(), currItem->yPos());
- ma.rotate(currItem->rotation());
- ma = ma.inverted();
- double nX = ma.m11() * newX + ma.m21() * newY + ma.dx();
- nh = nX / currItem->OldB2 * currItem->OldH2;
- mop = QPoint(m->x(), m->y());
- }
- else
- mop = QPoint(m->x(), m->y());
- }
- np = mop * mp.inverted();
- nx = np.x();
- ny = np.y();
- if (!currItem->asLine())
- {
- if ((m_doc->useRaster) && (m_doc->OnPage(currItem) != -1))
- {
- nx += currItem->xPos();
- ny += currItem->yPos();
- npf = m_doc->ApplyGridF(FPoint(nx, ny));
- nx = npf.x() - currItem->xPos();
- ny = npf.y() - currItem->yPos();
- }
- if (m_doc->SnapGuides)
- {
- nx += currItem->xPos();
- ny += currItem->yPos();
- m_doc->ApplyGuides(&nx, &ny);
- nx -= currItem->xPos();
- ny -= currItem->yPos();
- }
- if ((m->modifiers() & Qt::ControlModifier) || ((m->modifiers() & Qt::ShiftModifier)))
- erf = m_doc->SizeItem(nx, nh, currItem->ItemNr);
- else
- erf = m_doc->SizeItem(nx, ny, currItem->ItemNr);
- QMatrix mp;
- mp.translate(currItem->xPos(),// - m_doc->minCanvasCoordinate.x(),
- currItem->yPos());// - m_doc->minCanvasCoordinate.y());
- mp.rotate(currItem->rotation());
- np2 = QPoint(qRound(nx), qRound(ny));
- QMatrix pm;
- m_canvas->Transform(currItem, pm);
- m_canvas->PaintSizeRect(pm.mapToPolygon(QRect(QPoint(0, 0), np2)));
- }
- else
- {
- double rba = currItem->rotation();
- currItem->setRotation(0.0);
- QMatrix mp;
- m_canvas->Transform(currItem, mp);
-// mp.translate(-m_doc->minCanvasCoordinate.x(), -m_doc->minCanvasCoordinate.y());
- np = QPoint(m->x(), m->y()) * mp.inverted();
- double sizeItemX=np.x(), sizeItemY=np.y();
- //Constrain rotation angle, when the mouse is moving the non-origin point of a line
- if (m->modifiers() & Qt::ControlModifier)
- {
- double newRot=xy2Deg(np.x(), np.y());
- rba=constrainAngle(newRot, m_doc->toolSettings.constrain);
- double hlen=sqrt(pow(newX - currItem->xPos(),2)+pow(newY - currItem->yPos(),2));
- sizeItemX = hlen * cos(rba/(180.0/M_PI));
- sizeItemY = hlen * sin(rba/(180.0/M_PI));
- }
- currItem->setRotation(rba);
- np = m_doc->ApplyGrid(np);
- erf = m_doc->SizeItem(sizeItemX, sizeItemY, currItem->ItemNr);
- QMatrix pm;
-// pm.translate(-m_doc->minCanvasCoordinate.x() * m_canvas->scale(),-m_doc->minCanvasCoordinate.y() * m_canvas->scale());
- m_canvas->Transform(currItem, pm);
- m_canvas->newRedrawPolygon() << pm.map(QPoint(0, 0)) << pm.map(QPoint(qRound(currItem->width()), qRound(currItem->height())));
- m_view->updateContents(QRect(pm.map(QPoint(0, 0)), pm.map(QPoint(qRound(currItem->width()), qRound(currItem->height())))).normalized().adjusted(-10, -10, 20, 20));
- }
- break;
- case 2:
- if (currItem->asLine())
- {
- double sav = m_doc->SnapGuides;
- npf2 = FPoint(newX-Mxp, newY-Myp);
- //Constrain rotation on left point move, disabled for now in movesizeitem
- erf = m_doc->MoveSizeItem(npf2, FPoint(0, 0), currItem->ItemNr, false, (m->modifiers() & Qt::ControlModifier));
- m_doc->SnapGuides = sav;
- if (sav)
- currItem->Sizing = true;
- QMatrix pm;
-// pm.translate(-m_doc->minCanvasCoordinate.x() * m_canvas->scale(),-m_doc->minCanvasCoordinate.y() * m_canvas->scale());
- m_canvas->Transform(currItem, pm);
- m_canvas->newRedrawPolygon() << pm.map(QPoint(0, 0)) << pm.map(QPoint(qRound(currItem->width()), qRound(currItem->height())));
- m_view->updateContents(QRect(pm.map(QPoint(0, 0)), pm.map(QPoint(qRound(currItem->width()), qRound(currItem->height())))).normalized().adjusted(-10, -10, 20, 20));
- }
- else
- {
- newX = qRound(mousePointDoc.x()); //m_view->translateToDoc(m->x(), m->y()).x());
- newY = qRound(mousePointDoc.y()); //m_view->translateToDoc(m->x(), m->y()).y());
-// np2 = QPoint(newX, newY);
- FPoint newP = m_doc->ApplyGridF(FPoint(newX, newY));
- double nx = newP.x();
- double ny = newP.y();
- m_doc->ApplyGuides(&nx, &ny);
- QMatrix mp;
-// mp.translate(currItem->xPos() - m_doc->minCanvasCoordinate.x(), currItem->yPos() - m_doc->minCanvasCoordinate.y());
- mp.rotate(currItem->rotation());
- np2 = QPoint(qRound(nx), qRound(ny)) * mp.inverted();
- QMatrix pm;
- m_canvas->Transform(currItem, pm);
- m_canvas->PaintSizeRect(pm.mapToPolygon(QRect(np2, QPoint(qRound(currItem->width()), qRound(currItem->height())))));
- }
- break;
- }
- }
- else
- {
-// np2 = QPoint(newX, newY);
- FPoint newP = m_doc->ApplyGridF(FPoint(newX, newY));
- double nx = newP.x();
- double ny = newP.y();
- m_doc->ApplyGuides(&nx, &ny);
- QMatrix mp;
-// mp.translate(currItem->xPos() - m_doc->minCanvasCoordinate.x(), currItem->yPos() - m_doc->minCanvasCoordinate.y());
- mp.rotate(currItem->rotation());
- np2 = QPoint(qRound(nx), qRound(ny)) * mp.inverted();
- QMatrix pm;
- m_canvas->Transform(currItem, pm);
- switch (frameResizeHandle)
- {
- case 0:
- break;
- case 3:
- m_canvas->PaintSizeRect(pm.mapToPolygon(QRect(np2, QPoint(0, qRound(currItem->height())))));
- break;
- case 4:
- m_canvas->PaintSizeRect(pm.mapToPolygon(QRect(np2, QPoint(qRound(currItem->width()), 0))));
- break;
- case 5:
- m_canvas->PaintSizeRect(pm.mapToPolygon(QRect(QPoint(0, 0), QPoint(qRound(currItem->width()), np2.y()))));
- break;
- case 6:
- m_canvas->PaintSizeRect(pm.mapToPolygon(QRect(QPoint(0, 0), QPoint(np2.x(), qRound(currItem->height())))));
- break;
- case 7:
- m_canvas->PaintSizeRect(pm.mapToPolygon(QRect(QPoint(np2.x(), 0), QPoint(qRound(currItem->width()), qRound(currItem->height())))));
- break;
- case 8:
- m_canvas->PaintSizeRect(pm.mapToPolygon(QRect(QPoint(0, np2.y()), QPoint(qRound(currItem->width()), qRound(currItem->height())))));
- break;
- }
- }
- }
- }
- if ((erf) || (frameResizeHandle > 1))
- {
- Mxp = newX;
- Myp = newY;
- }
- }
- else
- {
- //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;
- erf = false;
- int dX=qRound(newX-Mxp), dY=qRound(newY-Myp);
- if (!m_doc->m_Selection->isMultipleSelection())
- {
- erf=true;
- currItem = m_doc->m_Selection->itemAt(0);
- //Control Alt drag image in frame without being in edit mode
- if ((currItem->asImageFrame()) && (m->modifiers() & Qt::ControlModifier) && (m->modifiers() & Qt::AltModifier))
- {
- currItem->moveImageInFrame(dX/currItem->imageXScale(),dY/currItem->imageYScale());
- m_view->updateContents(currItem->getRedrawBounding(m_canvas->scale()));
-
- }
- else
- {
- //Dragging orthogonally - Ctrl Drag
- if ((m->modifiers() & Qt::ControlModifier) && !(m->modifiers() & Qt::ShiftModifier) && !(m->modifiers() & Qt::AltModifier))
- {
- if (abs(dX) > abs(dY))
- dY=0;
- else
- if (abs(dY) > abs(dX))
- dX=0;
- erf=false;
- dX+=qRound(dragConstrainInitPtX-currItem->xPos());
- dY+=qRound(dragConstrainInitPtY-currItem->yPos());
- }
- if (!(currItem->isTableItem && currItem->isSingleSel))
- {
- if (!m_view->groupTransactionStarted())
- {
- m_view->startGroupTransaction(Um::Move, "", Um::IMove);
- }
- double gx, gy, gh, gw;
- m_doc->moveGroup(dX, dY, false);
- m_doc->m_Selection->setGroupRect();
- m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
- if (m_doc->SnapGuides)
- {
- double nx = gx;
- double ny = gy;
- m_doc->ApplyGuides(&nx, &ny);
- m_doc->moveGroup(nx-gx, ny-gy, false);
- m_doc->m_Selection->setGroupRect();
- m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
- nx = gx+gw;
- ny = gy+gh;
- m_doc->ApplyGuides(&nx, &ny);
- m_doc->moveGroup(nx-(gx+gw), ny-(gy+gh), false);
- }
- if (m_doc->useRaster)
- {
- m_doc->m_Selection->setGroupRect();
- double gx, gy, gh, gw, gxo, gyo;
- m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
- gxo = gx;
- gyo = gy;
- FPoint npx = m_doc->ApplyGridF(FPoint(gx, gy));
- FPoint npw = m_doc->ApplyGridF(FPoint(gx+gw, gy+gh));
- if ((fabs(gx-npx.x())) > (fabs((gx+gw)-npw.x())))
- gx = npw.x() - gw;
- else
- gx = npx.x();
- if ((fabs(gy-npx.y())) > (fabs((gy+gh)-npw.y())))
- gy = npw.y() - gh;
- else
- gy = npx.y();
- if ((fabs(gx - gxo) < (m_doc->guidesSettings.guideRad / 2.0) / m_canvas->scale()) && (fabs(gy - gyo) < (m_doc->guidesSettings.guideRad / 2.0) / m_canvas->scale()))
- m_doc->moveGroup(gx-gxo, gy-gyo, false);
- }
- }
- }
- }
- else
- {
- if (!m_view->groupTransactionStarted())
- {
- m_view->startGroupTransaction(Um::Move, "", Um::IMove);
- }
- double gx, gy, gh, gw;
- m_doc->m_Selection->setGroupRect();
- m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
- int dX=qRound(newX-Mxp), dY=qRound(newY-Myp);
- erf = true;
- if (m->modifiers() & Qt::ControlModifier)
- {
- if (abs(dX)>abs(dY))
- dY=0;
- else
- if (abs(dY)>abs(dX))
- dX=0;
- erf=false;
- dX+=dragConstrainInitPtX-qRound(gx);
- dY+=dragConstrainInitPtY-qRound(gy);
- }
- m_doc->moveGroup(dX, dY, false);
- m_doc->m_Selection->setGroupRect();
- m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
- if (m_doc->SnapGuides)
- {
- double nx = gx;
- double ny = gy;
- m_doc->ApplyGuides(&nx, &ny);
- m_doc->moveGroup(nx-gx, ny-gy, false);
- m_doc->m_Selection->setGroupRect();
- m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
- nx = gx+gw;
- ny = gy+gh;
- m_doc->ApplyGuides(&nx, &ny);
- m_doc->moveGroup(nx-(gx+gw), ny-(gy+gh), false);
- }
- m_doc->m_Selection->setGroupRect();
- if (m_doc->useRaster)
- {
- m_doc->m_Selection->setGroupRect();
- double gx, gy, gh, gw, gxo, gyo;
- m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
- gxo = gx;
- gyo = gy;
- FPoint npx = m_doc->ApplyGridF(FPoint(gx, gy));
- FPoint npw = m_doc->ApplyGridF(FPoint(gx+gw, gy+gh));
- if ((fabs(gx-npx.x())) > (fabs((gx+gw)-npw.x())))
- gx = npw.x() - gw;
- else
- gx = npx.x();
- if ((fabs(gy-npx.y())) > (fabs((gy+gh)-npw.y())))
- gy = npw.y() - gh;
- else
- gy = npx.y();
- if ((fabs(gx - gxo) < (m_doc->guidesSettings.guideRad / 2.0) / m_canvas->scale()) && (fabs(gy - gyo) < (m_doc->guidesSettings.guideRad / 2.0) / m_canvas->scale()))
- m_doc->moveGroup(gx-gxo, gy-gyo, false);
- m_doc->m_Selection->setGroupRect();
- }
- }
- if (erf)
- {
- Mxp = newX;
- Myp = newY;
- }
-
- {
- double gx, gy, gh, gw;
- m_doc->m_Selection->getVisualGroupRect(&gx, &gy, &gw, &gh);
- m_doc->adjustCanvas(FPoint(gx,gy), FPoint(gx+gw, gy+gh));
- QPoint selectionCenter = m_canvas->canvasToLocal(QPointF(gx+gw/2, gy+gh/2));
- QPoint localMousePos = m_canvas->canvasToLocal(mousePointDoc);
- int localwidth = static_cast<int>(gw * m_canvas->scale());
- int localheight = static_cast<int>(gh * m_canvas->scale());
- if (localwidth > 200)
- {
- localwidth = 0;
- selectionCenter.setX(localMousePos.x());
- }
- if (localheight > 200)
- {
- localheight = 0;
- selectionCenter.setY(localMousePos.y());
- }
- m_view->ensureVisible(selectionCenter.x(), selectionCenter.y(), localwidth/2 + 20, localheight/2 + 20);
- m_canvas->repaint();
- m_canvas->displayXYHUD(m->globalPos());
- }
- }
- }
if (!m_canvas->m_viewMode.m_MouseButtonPressed)
{
if (m_doc->m_Selection->isMultipleSelection())
@@ -873,10 +443,6 @@
if (currItem->asImageFrame())
qApp->changeOverrideCursor(QCursor(loadIcon("HandC.xpm")));
}
- else if (!currItem->sizeLocked())
- {
- setResizeCursor(hitTest, currItem->rotation());
- }
}
else
{
@@ -922,7 +488,6 @@
PageItem *currItem;
m_canvas->PaintSizeRect(QRect());
FPoint npf, npf2;
- QRect tx;
QMatrix pm;
m_canvas->m_viewMode.m_MouseButtonPressed = true;
m_canvas->m_viewMode.operItemMoving = false;
@@ -949,25 +514,15 @@
}
frameResizeHandle = 0;
- m_canvas->m_viewMode.operItemResizeInEditMode = false;
int oldP=0;
if (GetItem(&currItem))
{
// m_view->slotDoCurs(false);
if (!currItem->locked() && !currItem->asLine())
{
- if (!resizeGesture)
- resizeGesture = new ResizeGesture(this);
-
- resizeGesture->mousePressEvent(m);
- if (resizeGesture->frameHandle() > 0)
+ FPoint canvasPoint = m_canvas->globalToCanvas(m->globalPos());
+ if (m_canvas->frameHitTest(QPointF(canvasPoint.x(), canvasPoint.y()), currItem) < 0)
{
- m_canvas->m_viewMode.operItemResizeInEditMode = true;
- m_view->startGesture(resizeGesture);
- return;
- }
- else if (resizeGesture->frameHandle() < 0)
- {
m_view->Deselect(true);
bool wantNormal = true;
if (SeleItem(m))
@@ -1307,7 +862,7 @@
const unsigned SELECT_MULTIPLE = Qt::ShiftModifier;
const unsigned SELECT_BENEATH = Qt::ControlModifier;
QMatrix p;
- QRectF tx, mpo;
+ QRectF mpo;
PageItem *currItem;
m_canvas->m_viewMode.m_MouseButtonPressed = true;
FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
@@ -1501,32 +1056,6 @@
return false;
}
-// void CanvasMode_Edit::setResizeCursor(int how, double rot)
-// {
-// switch (how)
-// {
-// case 1:
-// case 2:
-// qApp->changeOverrideCursor(ScResizeCursor(135 + rot));
-// break;
-// case 3:
-// case 4:
-// qApp->changeOverrideCursor(ScResizeCursor(45 + rot));
-// break;
-// case 5:
-// case 8:
-// qApp->changeOverrideCursor(ScResizeCursor(0 + rot));
-// break;
-// case 6:
-// case 7:
-// qApp->changeOverrideCursor(ScResizeCursor(90 + rot));
-// break;
-// default:
-// qApp->changeOverrideCursor(QCursor(Qt::SizeAllCursor));
-// break;
-// }
-// }
-
void CanvasMode_Edit::createContextMenu(PageItem* currItem, double mx, double my)
{
ContextMenu* cmen=NULL;
Index: scribus/canvas.cpp
===================================================================
--- scribus/canvas.cpp (revision 14371)
+++ scribus/canvas.cpp (revision 14372)
@@ -49,7 +49,6 @@
m_MouseButtonPressed = false;
operItemMoving = false;
operItemResizing = false;
- operItemResizeInEditMode = false;
operItemSelecting = false;
redrawPolygon.resize(0);
linkedFramesToShow.clear();
@@ -69,7 +68,6 @@
<< vm.m_MouseButtonPressed
<< vm.operItemMoving
<< vm.operItemResizing
- << vm.operItemResizeInEditMode
<< vm.operItemSelecting
<< vm.redrawPolygon
<< vm.linkedFramesToShow
@@ -88,7 +86,6 @@
>> vm.m_MouseButtonPressed
>> vm.operItemMoving
>> vm.operItemResizing
- >> vm.operItemResizeInEditMode
>> vm.operItemSelecting
>> vm.redrawPolygon
>> vm.linkedFramesToShow
@@ -1332,14 +1329,14 @@
// currItem->invalid = true;
if (cullingArea.intersects(currItem->getBoundingRect().adjusted(0.0, 0.0, 1.0, 1.0)))
{
- if (!((m_viewMode.operItemMoving || m_viewMode.operItemResizeInEditMode) && (currItem->isSelected())))
+ if (!((m_viewMode.operItemMoving) && (currItem->isSelected())))
{
if (m_viewMode.forceRedraw)
currItem->invalidateLayout();
currItem->DrawObj(painter, cullingArea);
}
// else
-// qDebug() << "skip masterpage item (move/resizeEdit/selected)" << m_viewMode.operItemMoving << m_viewMode.operItemResizeInEditMode << currItem->isSelected();
+// qDebug() << "skip masterpage item (move/resizeEdit/selected)" << m_viewMode.operItemMoving << currItem->isSelected();
}
currItem->OwnPage = currItem->savedOwnPage;
if (!currItem->ChangedMasterItem)
@@ -1518,9 +1515,9 @@
//FIXME if (!evSpon || forceRedraw)
// currItem->invalid = true;
// if ((!m_MouseButtonPressed) || (m_doc->appMode == modeEditClip))
- if (((m_viewMode.operItemMoving || m_viewMode.operItemResizeInEditMode || m_viewMode.drawSelectedItemsWithControls) && currItem->isSelected()))
+ if (((m_viewMode.operItemMoving || m_viewMode.drawSelectedItemsWithControls) && currItem->isSelected()))
{
-// qDebug() << "skipping pageitem (move/resizeEdit/selected)" << m_viewMode.operItemMoving << m_viewMode.operItemResizeInEditMode << currItem->isSelected();
+// qDebug() << "skipping pageitem (move/resizeEdit/selected)" << m_viewMode.operItemMoving << currItem->isSelected();
}
else if(m_viewMode.operItemSelecting)
{
Index: scribus/canvasmode_panning.cpp
===================================================================
--- scribus/canvasmode_panning.cpp (revision 14371)
+++ scribus/canvasmode_panning.cpp (revision 14372)
@@ -38,7 +38,7 @@
void CanvasMode_Panning::drawControls(QPainter* p)
{
- commonDrawControls(p);
+ commonDrawControls(p, false);
}
void CanvasMode_Panning::enterEvent(QEvent *)
@@ -69,7 +69,6 @@
setModeCursor();
if (fromGesture)
{
- m_canvas->m_viewMode.operItemResizeInEditMode = false;
m_view->update();
}
}
Index: scribus/canvasmode_normal.cpp
===================================================================
--- scribus/canvasmode_normal.cpp (revision 14371)
+++ scribus/canvasmode_normal.cpp (revision 14372)
@@ -95,7 +95,7 @@
}
else
{
- drawSelection(p);
+ drawSelection(p, true);
}
}
@@ -137,7 +137,6 @@
setModeCursor();
if (fromGesture)
{
- m_canvas->m_viewMode.operItemResizeInEditMode = false;
m_view->update();
}
}
More information about the scribus-commit
mailing list