From d61385bc6a6eaaf2d86b20035788c18c3600c356 Mon Sep 17 00:00:00 2001 From: craig Date: Wed, 21 Mar 2012 20:00:11 +0000 Subject: #8562: Holding Control while creating items now produces squared frames again git-svn-id: svn://scribus.net/branches/Version14x/Scribus@17393 11d20701-8431-0410-a711-e3c959e3b870 --- scribus/canvasmode_create.cpp | 59 ++++++++++++++++++++++++++++++++----------- 1 file changed, 44 insertions(+), 15 deletions(-) (limited to 'scribus/canvasmode_create.cpp') diff --git a/scribus/canvasmode_create.cpp b/scribus/canvasmode_create.cpp index 3c1ddc7..8caf348 100644 --- a/scribus/canvasmode_create.cpp +++ b/scribus/canvasmode_create.cpp @@ -80,7 +80,17 @@ void CreateMode::drawControls(QPainter* p) if (createObjectMode != modeDrawLine) { - QRectF bounds = QRectF(topLeft, btRight).normalized(); + QRectF bounds=QRectF(topLeft, btRight).normalized(); + //Lock Height to Width for Control Modifier for region drawing + if (modifiers==Qt::ControlModifier) + { + bounds.setHeight(bounds.width()); + if (btRight.y()topLeft.y()) + bounds.moveTop(topLeft.y()); + } + QRect localRect = m_canvas->canvasToLocal(bounds); if (localRect.width() <= 0 || localRect.height() <= 0) return; @@ -218,7 +228,7 @@ void CreateMode::mouseMoveEvent(QMouseEvent *m) { const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos()); modifiers = m->modifiers(); - + double newX, newY; PageItem *currItem; QPoint np, np2, mop; @@ -469,19 +479,19 @@ void CreateMode::SetupDrawNoResize(int nr) m_doc->m_Selection->addItem(currItem); // #10618 : Select table items if needed otherwise // a crash will be triggered if user tries to ungroup - if (currItem->Groups.count() > 0) - { - for (int i = 0; i < m_doc->Items->count(); ++i) - { - PageItem* item = m_doc->Items->at(i); - if (item->Groups.count() == 0) - continue; - if (item->Groups.top() != currItem->Groups.top()) - continue; - if (item->ItemNr != currItem->ItemNr) - m_doc->m_Selection->addItem(item, true); - item->isSingleSel = false; - } + if (currItem->Groups.count() > 0) + { + for (int i = 0; i < m_doc->Items->count(); ++i) + { + PageItem* item = m_doc->Items->at(i); + if (item->Groups.count() == 0) + continue; + if (item->Groups.top() != currItem->Groups.top()) + continue; + if (item->ItemNr != currItem->ItemNr) + m_doc->m_Selection->addItem(item, true); + item->isSingleSel = false; + } } m_doc->m_Selection->delaySignalsOff(); // emit DocChanged(); @@ -556,6 +566,7 @@ PageItem* CreateMode::doCreateNewObject(void) double wSize = canvasCurrCoord.x() - createObjectPos.x(); double hSize = canvasCurrCoord.y() - createObjectPos.y(); + bool skipOneClick = (modifiers == Qt::ShiftModifier); if ((createObjectMode == modeDrawLine) || (createObjectMode == modeDrawTable) || (createObjectMode == modeInsertPDFButton) || (createObjectMode == modeInsertPDFTextfield) || @@ -578,11 +589,29 @@ PageItem* CreateMode::doCreateNewObject(void) wSize = canvasCurrCoord.x() - createObjectPos.x(); hSize = canvasCurrCoord.y() - createObjectPos.y(); + //Lock Height to Width for Control Modifier for final item creation + if (modifiers == Qt::ControlModifier) + hSize=wSize; + PageItem *newObject = NULL, *currItem = NULL; // FIXME for modeDrawLine QRectF createObjectRect(createObjectPos.x(), createObjectPos.y(), wSize, hSize); if (createObjectMode != modeDrawLine) + { createObjectRect = createObjectRect.normalized(); + if (modifiers==Qt::ControlModifier) + { + //bottom right and upper left are ok + //upper right + if (canvasCurrCoord.y() < createObjectPos.y() && createObjectPos.x()createObjectPos.y()) + createObjectRect.translate(0.0, createObjectRect.height()); + } + } + + double Rxp = createObjectRect.x(); double Ryp = createObjectRect.y(); double Rxpd = createObjectRect.width(); -- cgit