r19754 by jghali - #12890: Distribute tools crash
scribus-commit
scribus-commit at lists.scribus.net
Thu Jan 15 19:38:42 UTC 2015
Author: jghali
Date: Thu Jan 15 19:38:42 2015
New Revision: 19754
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19754
Log:
#12890: Distribute tools crash
Modified:
trunk/Scribus/scribus/scribusdoc.cpp
trunk/Scribus/scribus/scribusdoc.h
Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19754&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Thu Jan 15 19:38:42 2015
@@ -12239,11 +12239,11 @@
}
-bool ScribusDoc::startAlign()
+bool ScribusDoc::startAlign(uint minObjects)
{
buildAlignItemList();
- uint alignObjectsCount=AObjects.count();
- if (alignObjectsCount==0)
+ uint alignObjectsCount = AObjects.count();
+ if (alignObjectsCount < minObjects)
return false;
bool oneLocked=false;
@@ -12292,7 +12292,6 @@
return true;
}
-
void ScribusDoc::endAlign()
{
changed();
@@ -12380,8 +12379,8 @@
{
if (!startAlign())
return;
- uint alignObjectsCount=AObjects.count();
- int loopStart=0, loopEnd=alignObjectsCount-1;
+ uint alignObjectsCount = AObjects.count();
+ int loopStart = 0, loopEnd = alignObjectsCount - 1;
double newX = std::numeric_limits<double>::max();
switch ( currAlignTo )
{
@@ -12418,8 +12417,8 @@
{
if (!startAlign())
return;
- uint alignObjectsCount=AObjects.count();
- int loopStart=0, loopEnd=alignObjectsCount-1;
+ uint alignObjectsCount = AObjects.count();
+ int loopStart = 0, loopEnd = alignObjectsCount - 1;
double newX = std::numeric_limits<double>::max();
switch ( currAlignTo )
{
@@ -12456,8 +12455,8 @@
{
if (!startAlign())
return;
- uint alignObjectsCount=AObjects.count();
- int loopStart=0, loopEnd=alignObjectsCount-1;
+ uint alignObjectsCount = AObjects.count();
+ int loopStart = 0, loopEnd = alignObjectsCount - 1;
double newX = 0.0;
switch ( currAlignTo )
{
@@ -12510,8 +12509,8 @@
{
if (!startAlign())
return;
- uint alignObjectsCount=AObjects.count();
- int loopStart=0, loopEnd=alignObjectsCount-1;
+ uint alignObjectsCount = AObjects.count();
+ int loopStart = 0, loopEnd = alignObjectsCount - 1;
double newX = -std::numeric_limits<double>::max();
switch ( currAlignTo )
{
@@ -12550,8 +12549,8 @@
{
if (!startAlign())
return;
- uint alignObjectsCount=AObjects.count();
- int loopStart=0, loopEnd=alignObjectsCount-1;
+ uint alignObjectsCount = AObjects.count();
+ int loopStart = 0, loopEnd = alignObjectsCount - 1;
double newX = -std::numeric_limits<double>::max();
switch ( currAlignTo )
{
@@ -12590,8 +12589,8 @@
{
if (!startAlign())
return;
- uint alignObjectsCount=AObjects.count();
- int loopStart=0, loopEnd=alignObjectsCount-1;
+ uint alignObjectsCount = AObjects.count();
+ int loopStart = 0, loopEnd = alignObjectsCount - 1;
double newY = std::numeric_limits<double>::max();
switch ( currAlignTo )
{
@@ -12628,8 +12627,8 @@
{
if (!startAlign())
return;
- uint alignObjectsCount=AObjects.count();
- int loopStart=0, loopEnd=alignObjectsCount-1;
+ uint alignObjectsCount = AObjects.count();
+ int loopStart = 0, loopEnd = alignObjectsCount - 1;
double newY = std::numeric_limits<double>::max();
switch ( currAlignTo )
{
@@ -12666,8 +12665,8 @@
{
if (!startAlign())
return;
- uint alignObjectsCount=AObjects.count();
- int loopStart=0, loopEnd=alignObjectsCount-1;
+ uint alignObjectsCount = AObjects.count();
+ int loopStart = 0, loopEnd = alignObjectsCount - 1;
double newY = 0.0;
switch ( currAlignTo )
{
@@ -12720,8 +12719,8 @@
{
if (!startAlign())
return;
- uint alignObjectsCount=AObjects.count();
- int loopStart=0, loopEnd=alignObjectsCount-1;
+ uint alignObjectsCount = AObjects.count();
+ int loopStart = 0, loopEnd = alignObjectsCount - 1;
double newY = -std::numeric_limits<double>::max();
switch ( currAlignTo )
{
@@ -12760,8 +12759,8 @@
{
if (!startAlign())
return;
- uint alignObjectsCount=AObjects.count();
- int loopStart=0, loopEnd=alignObjectsCount-1;
+ uint alignObjectsCount = AObjects.count();
+ int loopStart = 0, loopEnd = alignObjectsCount - 1;
double newY = -std::numeric_limits<double>::max();
switch ( currAlignTo )
{
@@ -12798,11 +12797,9 @@
void ScribusDoc::itemSelection_DistributeLeft()
{
- if (!startAlign())
+ if (!startAlign(2))
return;
- uint alignObjectsCount=AObjects.count();
- if (alignObjectsCount<=1)
- return;
+ uint alignObjectsCount = AObjects.count();
QMap<double,uint> Xsorted;
for (uint a = 0; a < alignObjectsCount; ++a)
{
@@ -12838,11 +12835,9 @@
void ScribusDoc::itemSelection_DistributeCenterH()
{
- if (!startAlign())
+ if (!startAlign(2))
return;
- uint alignObjectsCount=AObjects.count();
- if (alignObjectsCount<=1)
- return;
+ uint alignObjectsCount = AObjects.count();
QMap<double,uint> Xsorted;
for (uint a = 0; a < alignObjectsCount; ++a)
{
@@ -12878,11 +12873,9 @@
void ScribusDoc::itemSelection_DistributeRight()
{
- if (!startAlign())
+ if (!startAlign(2))
return;
- uint alignObjectsCount=AObjects.count();
- if (alignObjectsCount<=1)
- return;
+ uint alignObjectsCount = AObjects.count();
QMap<double,uint> Xsorted;
for (uint a = 0; a < alignObjectsCount; ++a)
{
@@ -12918,11 +12911,9 @@
void ScribusDoc::itemSelection_DistributeDistH(bool usingDistance, double distance, bool reverseDistribute)
{
- if (!startAlign())
+ if (!startAlign(2))
return;
- uint alignObjectsCount=AObjects.count();
- if (alignObjectsCount<=1)
- return;
+ uint alignObjectsCount = AObjects.count();
QMap<double,uint> X1sorted, X2sorted;
for (uint a = 0; a < alignObjectsCount; ++a)
{
@@ -13003,11 +12994,9 @@
void ScribusDoc::itemSelection_DistributeBottom()
{
- if (!startAlign())
+ if (!startAlign(2))
return;
- uint alignObjectsCount=AObjects.count();
- if (alignObjectsCount<=1)
- return;
+ uint alignObjectsCount = AObjects.count();
QMap<double,uint> Ysorted;
for (uint a = 0; a < alignObjectsCount; ++a)
{
@@ -13043,11 +13032,9 @@
void ScribusDoc::itemSelection_DistributeCenterV()
{
- if (!startAlign())
+ if (!startAlign(2))
return;
- uint alignObjectsCount=AObjects.count();
- if (alignObjectsCount<=1)
- return;
+ uint alignObjectsCount = AObjects.count();
QMap<double,uint> Ysorted;
for (uint a = 0; a < alignObjectsCount; ++a)
{
@@ -13083,11 +13070,9 @@
void ScribusDoc::itemSelection_DistributeTop()
{
- if (!startAlign())
+ if (!startAlign(2))
return;
- uint alignObjectsCount=AObjects.count();
- if (alignObjectsCount<=1)
- return;
+ uint alignObjectsCount = AObjects.count();
QMap<double,uint> Ysorted;
for (uint a = 0; a < alignObjectsCount; ++a)
{
@@ -13123,11 +13108,9 @@
void ScribusDoc::itemSelection_DistributeDistV(bool usingDistance, double distance, bool reverseDistribute)
{
- if (!startAlign())
+ if (!startAlign(2))
return;
- uint alignObjectsCount=AObjects.count();
- if (alignObjectsCount<=1)
- return;
+ uint alignObjectsCount = AObjects.count();
QMap<double,uint> Y1sorted, Y2sorted;
for (uint a = 0; a < alignObjectsCount; ++a)
{
@@ -13208,11 +13191,9 @@
void ScribusDoc::itemSelection_DistributeAcrossPage(bool useMargins)
{
- if (!startAlign())
+ if (!startAlign(2))
return;
- uint alignObjectsCount=AObjects.count();
- if (alignObjectsCount<=1)
- return;
+ uint alignObjectsCount = AObjects.count();
QMap<double,uint> X1sorted, X2sorted;
for (uint a = 0; a < alignObjectsCount; ++a)
{
@@ -13260,11 +13241,9 @@
void ScribusDoc::itemSelection_DistributeDownPage(bool useMargins)
{
- if (!startAlign())
+ if (!startAlign(2))
return;
- uint alignObjectsCount=AObjects.count();
- if (alignObjectsCount<=1)
- return;
+ uint alignObjectsCount = AObjects.count();
QMap<double,uint> Y1sorted, Y2sorted;
for (uint a = 0; a < alignObjectsCount; ++a)
{
@@ -13323,11 +13302,9 @@
void ScribusDoc::itemSelection_SwapLeft()
{
- if (!startAlign())
+ if (!startAlign(2))
return;
- uint alignObjectsCount=AObjects.count();
- if (alignObjectsCount<=1)
- return;
+ uint alignObjectsCount = AObjects.count();
QList<int> circleList;
int circleListCounter=0;
//X
@@ -13437,12 +13414,10 @@
void ScribusDoc::itemSelection_SwapRight()
{
- if (!startAlign())
+ if (!startAlign(2))
return;
- uint alignObjectsCount=AObjects.count();
- if (alignObjectsCount<=1)
- return;
- QList<int> circleList;
+ uint alignObjectsCount = AObjects.count();
+ QList<int> circleList;
int circleListCounter=0;
//X
QMap<double,uint> Xsorted;
Modified: trunk/Scribus/scribus/scribusdoc.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19754&path=/trunk/Scribus/scribus/scribusdoc.h
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.h (original)
+++ trunk/Scribus/scribus/scribusdoc.h Thu Jan 15 19:38:42 2015
@@ -1012,7 +1012,7 @@
typedef enum {alignFirst, alignLast, alignPage, alignMargins, alignGuide, alignSelection } AlignTo;
typedef enum {alignByMoving, alignByResizing } AlignMethod;
void buildAlignItemList(Selection* customSelection=0);
- bool startAlign();
+ bool startAlign(uint minObjects = 1);
void endAlign();
/**
* \brief Insert a color into the documents color list
More information about the scribus-commit
mailing list