r17393 by craig - #8562: Holding Control while creating items now produces squared frames again
scribus-commit
scribus-commit at lists.scribus.net
Wed Mar 21 20:00:12 UTC 2012
Author: craig
Date: Wed Mar 21 20:00:11 2012
New Revision: 17393
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17393
Log:
#8562: Holding Control while creating items now produces squared frames again
Modified:
branches/Version14x/Scribus/scribus/canvasmode_create.cpp
Modified: branches/Version14x/Scribus/scribus/canvasmode_create.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17393&path=/branches/Version14x/Scribus/scribus/canvasmode_create.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/canvasmode_create.cpp (original)
+++ branches/Version14x/Scribus/scribus/canvasmode_create.cpp Wed Mar 21 20:00:11 2012
@@ -80,7 +80,17 @@
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 @@
{
const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
modifiers = m->modifiers();
-
+
double newX, newY;
PageItem *currItem;
QPoint np, np2, mop;
@@ -469,19 +479,19 @@
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 @@
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 @@
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();
More information about the scribus-commit
mailing list