diff options
| author | craig <craig@11d20701-8431-0410-a711-e3c959e3b870> | 2012-03-21 20:00:11 +0000 |
|---|---|---|
| committer | craig <craig@11d20701-8431-0410-a711-e3c959e3b870> | 2012-03-21 20:00:11 +0000 |
| commit | d61385bc6a6eaaf2d86b20035788c18c3600c356 (patch) | |
| tree | 2e2eba1ab6c93c5413f3347c4da02fb2ba6b9e7b | |
| parent | 9aaaa94c618ff0533dedd6497f5bd34c49e0019a (diff) | |
| download | scribus-d61385bc6a6eaaf2d86b20035788c18c3600c356.tar.gz scribus-d61385bc6a6eaaf2d86b20035788c18c3600c356.tar.xz scribus-d61385bc6a6eaaf2d86b20035788c18c3600c356.zip | |
#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
| -rw-r--r-- | scribus/canvasmode_create.cpp | 59 |
1 files changed, 44 insertions, 15 deletions
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.moveBottom(topLeft.y());
+ if (btRight.x()<topLeft.x() && 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()<canvasCurrCoord.x())
+ createObjectRect.translate(0.0, -createObjectRect.height());
+ //bottom left
+ if (canvasCurrCoord.x()<createObjectPos.x() && canvasCurrCoord.y()>createObjectPos.y())
+ createObjectRect.translate(0.0, createObjectRect.height());
+ }
+ }
+
+
double Rxp = createObjectRect.x();
double Ryp = createObjectRect.y();
double Rxpd = createObjectRect.width();
|
