r13772 by cbradney - #480: Enable swapping (with left or right rotation) of items

scribus-commit scribus-commit at lists.scribus.net
Wed Jul 15 00:10:48 CEST 2009


Revision: 13772
Author: cbradney
Date: 2009-07-14T22:10:57.444802Z
Commit message: #480: Enable swapping (with left or right rotation) of items

Changeset: 
M  /trunk/Scribus/scribus/ui/aligndistribute.h
M  /trunk/Scribus/scribus/scribusdoc.cpp
M  /trunk/Scribus/scribus/ui/aligndistribute.ui
M  /trunk/Scribus/scribus/scribusdoc.h
M  /trunk/Scribus/scribus/ui/aligndistribute.cpp

Diffs:
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp	(revision 13771)
+++ scribus/scribusdoc.cpp	(revision 13772)
@@ -8794,7 +8794,234 @@
 	endAlign();
 }
 
+void ScribusDoc::itemSelection_SwapLeft()
+{
+	if (!startAlign())
+		return;
+	uint alignObjectsCount=AObjects.count();
+	if (alignObjectsCount<=1)
+		return;
+	 QList<int> circleList;
+	int circleListCounter=0;
+	//X
+	QMap<double,uint> Xsorted;
+	for (uint a = 0; a < alignObjectsCount; ++a)
+	{
+		if (!Xsorted.contains(AObjects[a].x1))
+			Xsorted.insert(AObjects[a].x1, a);
+	}
+	QMap<double,uint>::Iterator itX = Xsorted.begin();
+	QMap<double,uint>::Iterator itXend = Xsorted.end();
+	double minX=itX.key();
+	double maxX=itX.key();
+	while ( itX != itXend)
+	{
+		if (minX>itX.key())
+			minX=itX.key();
+		if (maxX<itX.key())
+			maxX=itX.key();
+		++itX;
+	}
+	//Y
+	QMap<double,uint> Ysorted;
+	for (uint a = 0; a < alignObjectsCount; ++a)
+	{
+		if (!Ysorted.contains(AObjects[a].y1))
+			Ysorted.insert(AObjects[a].y1, a);
+	}
+	QMap<double,uint>::Iterator itY = Ysorted.begin();
+	QMap<double,uint>::Iterator itYend = Ysorted.end();
+	double minY=itY.key();
+	double maxY=itY.key();
+	while ( itY != itYend)
+	{
+		if (minY>itY.key())
+			minY=itY.key();
+		if (maxY<itY.key())
+			maxY=itY.key();
+		++itY;
+	}
 
+	itX = Xsorted.begin(); //first item is left most
+	int itemIndex=itX.value(); //get our first item's index in the AObjects array
+	bool found=false;
+	double itXX=itX.key();
+	minY=999999.9;
+	maxY=-999999.9;
+	int nextItemIndex=itemIndex;
+	circleList.append(nextItemIndex);
+	++circleListCounter;
+	// find the next X item with the minimum Y
+
+	QMap<double,uint>::Iterator itX2_1 = Xsorted.begin();
+	QMap<double,uint>::Iterator itLast = Xsorted.begin();
+	double xBeginYValue=AObjects[itX2_1.value()].y1;
+	while (itX2_1!=Xsorted.end())
+	{
+		if (AObjects[itX2_1.value()].y1<xBeginYValue)
+		{
+			circleList.append(itX2_1.value());
+			++circleListCounter;
+		}
+		itLast=itX2_1;
+		itX2_1++;
+	}
+
+
+	if (circleListCounter!=alignObjectsCount) //need to reverse back now
+	{
+		QMap<double,uint>::Iterator itX2_2 = itLast;
+		while (itX2_2!=Xsorted.begin())
+		{
+			if (AObjects[itX2_2.value()].y1>=xBeginYValue)
+			{
+				circleList.append(itX2_2.value());
+				++circleListCounter;
+			}
+			itX2_2--;
+		}
+	}
+
+	int i=0;
+	double swapX=AObjects[i].x1;
+	double swapY=AObjects[i].y1;
+	for (int j = 0; j < AObjects[i].Objects.count(); ++j)
+		if (!AObjects[i].Objects.at(j)->locked())
+			AObjects[i].Objects.at(j)->moveBy(AObjects[circleListCounter-1].x1-AObjects[i].x1, AObjects[circleListCounter-1].y1-AObjects[i].y1);
+	++i;
+	while(i<circleListCounter-1)
+	{
+		double diffX=swapX-AObjects[i].x1;
+		double diffY=swapY-AObjects[i].y1;
+		swapX=AObjects[i].x1;
+		swapY=AObjects[i].y1;
+		for (int j = 0; j < AObjects[i].Objects.count(); ++j)
+			if (!AObjects[i].Objects.at(j)->locked())
+				AObjects[i].Objects.at(j)->moveBy(diffX, diffY);
+		++i;
+	}
+	double diffX3=swapX-AObjects[circleListCounter-1].x1;
+	double diffY3=swapY-AObjects[circleListCounter-1].y1;
+	for (int j = 0; j < AObjects[circleListCounter-1].Objects.count(); ++j)
+		if (!AObjects[circleListCounter-1].Objects.at(j)->locked())
+			AObjects[circleListCounter-1].Objects.at(j)->moveBy(diffX3, diffY3);
+	endAlign();
+}
+
+void ScribusDoc::itemSelection_SwapRight()
+{
+	if (!startAlign())
+		return;
+	uint alignObjectsCount=AObjects.count();
+	if (alignObjectsCount<=1)
+		return;
+	 QList<int> circleList;
+	int circleListCounter=0;
+	//X
+	QMap<double,uint> Xsorted;
+	for (uint a = 0; a < alignObjectsCount; ++a)
+	{
+		if (!Xsorted.contains(AObjects[a].x1))
+			Xsorted.insert(AObjects[a].x1, a);
+	}
+	QMap<double,uint>::Iterator itX = Xsorted.begin();
+	QMap<double,uint>::Iterator itXend = Xsorted.end();
+	double minX=itX.key();
+	double maxX=itX.key();
+	while ( itX != itXend)
+	{
+		if (minX>itX.key())
+			minX=itX.key();
+		if (maxX<itX.key())
+			maxX=itX.key();
+		++itX;
+	}
+	//Y
+	QMap<double,uint> Ysorted;
+	for (uint a = 0; a < alignObjectsCount; ++a)
+	{
+		if (!Ysorted.contains(AObjects[a].y1))
+			Ysorted.insert(AObjects[a].y1, a);
+	}
+	QMap<double,uint>::Iterator itY = Ysorted.begin();
+	QMap<double,uint>::Iterator itYend = Ysorted.end();
+	double minY=itY.key();
+	double maxY=itY.key();
+	while ( itY != itYend)
+	{
+		if (minY>itY.key())
+			minY=itY.key();
+		if (maxY<itY.key())
+			maxY=itY.key();
+		++itY;
+	}
+
+	itX = Xsorted.begin(); //first item is left most
+	int itemIndex=itX.value(); //get our first item's index in the AObjects array
+	bool found=false;
+	double itXX=itX.key();
+	minY=999999.9;
+	maxY=-999999.9;
+	int nextItemIndex=itemIndex;
+	circleList.append(nextItemIndex);
+	++circleListCounter;
+	// find the next X item with the minimum Y
+
+	QMap<double,uint>::Iterator itX2_1 = Xsorted.begin();
+	QMap<double,uint>::Iterator itLast = Xsorted.begin();
+	double xBeginYValue=AObjects[itX2_1.value()].y1;
+	while (itX2_1!=Xsorted.end())
+	{
+		if (AObjects[itX2_1.value()].y1<xBeginYValue)
+		{
+			circleList.append(itX2_1.value());
+			++circleListCounter;
+		}
+		itLast=itX2_1;
+		itX2_1++;
+	}
+
+
+	if (circleListCounter!=alignObjectsCount) //need to reverse back now
+	{
+		QMap<double,uint>::Iterator itX2_2 = itLast;
+		while (itX2_2!=Xsorted.begin())
+		{
+			if (AObjects[itX2_2.value()].y1>=xBeginYValue)
+			{
+				circleList.append(itX2_2.value());
+				++circleListCounter;
+			}
+			itX2_2--;
+		}
+	}
+
+	int i=circleListCounter-1;
+	double swapX=AObjects[i].x1;
+	double swapY=AObjects[i].y1;
+	for (int j = 0; j < AObjects[i].Objects.count(); ++j)
+		if (!AObjects[i].Objects.at(j)->locked())
+			AObjects[i].Objects.at(j)->moveBy(AObjects[0].x1-AObjects[i].x1, AObjects[0].y1-AObjects[i].y1);
+	--i;
+	while(i>0)
+	{
+		double diffX=swapX-AObjects[i].x1;
+		double diffY=swapY-AObjects[i].y1;
+		swapX=AObjects[i].x1;
+		swapY=AObjects[i].y1;
+		for (int j = 0; j < AObjects[i].Objects.count(); ++j)
+			if (!AObjects[i].Objects.at(j)->locked())
+				AObjects[i].Objects.at(j)->moveBy(diffX, diffY);
+		--i;
+	}
+	double diffX3=swapX-AObjects[0].x1;
+	double diffY3=swapY-AObjects[0].y1;
+	for (int j = 0; j < AObjects[0].Objects.count(); ++j)
+		if (!AObjects[0].Objects.at(j)->locked())
+			AObjects[0].Objects.at(j)->moveBy(diffX3, diffY3);
+	endAlign();
+}
+
 void ScribusDoc::changed()
 {
 	setModified(true);
Index: scribus/scribusdoc.h
===================================================================
--- scribus/scribusdoc.h	(revision 13771)
+++ scribus/scribusdoc.h	(revision 13772)
@@ -1182,6 +1182,8 @@
 	void itemSelection_DistributeLeft();
 	void itemSelection_DistributeCenterV();
 	void itemSelection_DistributeTop();
+	void itemSelection_SwapLeft();
+	void itemSelection_SwapRight();
 	void itemSelection_MultipleDuplicate(ItemMultipleDuplicateData&);
 	void itemSelection_UniteItems(Selection* customSelection=0);
 	void itemSelection_SplitItems(Selection* customSelection=0);
Index: scribus/ui/aligndistribute.h
===================================================================
--- scribus/ui/aligndistribute.h	(revision 13771)
+++ scribus/ui/aligndistribute.h	(revision 13772)
@@ -97,6 +97,8 @@
 	void distributeLeft();
 	void distributeCenterV();
 	void distributeTop();
+	void swapLeft();
+	void swapRight();
 	
 	void alignToChanged(int);
 
Index: scribus/ui/aligndistribute.ui
===================================================================
--- scribus/ui/aligndistribute.ui	(revision 13771)
+++ scribus/ui/aligndistribute.ui	(revision 13772)
@@ -1,63 +1,55 @@
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
  <class>AlignDistribute</class>
- <widget class="ScrPaletteBase" native="1" name="AlignDistribute" >
-  <property name="enabled" >
+ <widget class="ScrPaletteBase" name="AlignDistribute">
+  <property name="enabled">
    <bool>true</bool>
   </property>
-  <property name="geometry" >
+  <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>251</width>
+    <width>260</width>
     <height>218</height>
    </rect>
   </property>
-  <property name="minimumSize" >
+  <property name="minimumSize">
    <size>
     <width>0</width>
     <height>0</height>
    </size>
   </property>
-  <layout class="QVBoxLayout" >
-   <property name="margin" >
+  <layout class="QVBoxLayout">
+   <property name="spacing">
+    <number>5</number>
+   </property>
+   <property name="margin">
     <number>6</number>
    </property>
-   <property name="spacing" >
-    <number>5</number>
-   </property>
    <item>
-    <widget class="QTabWidget" name="tabWidget" >
-     <property name="currentIndex" >
-      <number>0</number>
+    <widget class="QTabWidget" name="tabWidget">
+     <property name="currentIndex">
+      <number>2</number>
      </property>
-     <widget class="QWidget" name="tabAlign" >
-      <attribute name="title" >
+     <widget class="QWidget" name="tabAlign">
+      <attribute name="title">
        <string>Align</string>
       </attribute>
-      <layout class="QVBoxLayout" >
-       <property name="margin" >
+      <layout class="QVBoxLayout">
+       <property name="margin">
         <number>0</number>
        </property>
-       <property name="spacing" >
-        <number>6</number>
-       </property>
        <item>
-        <layout class="QHBoxLayout" >
-         <property name="margin" >
-          <number>0</number>
-         </property>
-         <property name="spacing" >
-          <number>6</number>
-         </property>
+        <layout class="QHBoxLayout">
          <item>
           <spacer>
-           <property name="orientation" >
+           <property name="orientation">
             <enum>Qt::Horizontal</enum>
            </property>
-           <property name="sizeType" >
+           <property name="sizeType">
             <enum>QSizePolicy::Expanding</enum>
            </property>
-           <property name="sizeHint" >
+           <property name="sizeHint" stdset="0">
             <size>
              <width>40</width>
              <height>20</height>
@@ -66,56 +58,50 @@
           </spacer>
          </item>
          <item>
-          <layout class="QGridLayout" >
-           <property name="margin" >
-            <number>0</number>
-           </property>
-           <property name="spacing" >
-            <number>6</number>
-           </property>
-           <item row="1" column="0" >
-            <widget class="QLabel" name="alignGuideLabel" >
-             <property name="text" >
+          <layout class="QGridLayout">
+           <item row="1" column="0">
+            <widget class="QLabel" name="alignGuideLabel">
+             <property name="text">
               <string>&amp;Selected Guide:</string>
              </property>
-             <property name="wordWrap" >
+             <property name="wordWrap">
               <bool>false</bool>
              </property>
-             <property name="buddy" >
+             <property name="buddy">
               <cstring>alignGuideLineEdit</cstring>
              </property>
             </widget>
            </item>
-           <item row="0" column="0" >
-            <widget class="QLabel" name="alignRelativeToLabel" >
-             <property name="text" >
+           <item row="0" column="0">
+            <widget class="QLabel" name="alignRelativeToLabel">
+             <property name="text">
               <string>&amp;Relative To:</string>
              </property>
-             <property name="wordWrap" >
+             <property name="wordWrap">
               <bool>false</bool>
              </property>
-             <property name="buddy" >
+             <property name="buddy">
               <cstring>alignRelativeToCombo</cstring>
              </property>
             </widget>
            </item>
-           <item row="1" column="1" >
-            <widget class="QLineEdit" name="alignGuideLineEdit" />
+           <item row="1" column="1">
+            <widget class="QLineEdit" name="alignGuideLineEdit"/>
            </item>
-           <item row="0" column="1" >
-            <widget class="QComboBox" name="alignRelativeToCombo" />
+           <item row="0" column="1">
+            <widget class="QComboBox" name="alignRelativeToCombo"/>
            </item>
           </layout>
          </item>
          <item>
           <spacer>
-           <property name="orientation" >
+           <property name="orientation">
             <enum>Qt::Horizontal</enum>
            </property>
-           <property name="sizeType" >
+           <property name="sizeType">
             <enum>QSizePolicy::Expanding</enum>
            </property>
-           <property name="sizeHint" >
+           <property name="sizeHint" stdset="0">
             <size>
              <width>40</width>
              <height>20</height>
@@ -126,22 +112,16 @@
         </layout>
        </item>
        <item>
-        <layout class="QHBoxLayout" >
-         <property name="margin" >
-          <number>0</number>
-         </property>
-         <property name="spacing" >
-          <number>6</number>
-         </property>
+        <layout class="QHBoxLayout">
          <item>
           <spacer>
-           <property name="orientation" >
+           <property name="orientation">
             <enum>Qt::Horizontal</enum>
            </property>
-           <property name="sizeType" >
+           <property name="sizeType">
             <enum>QSizePolicy::Expanding</enum>
            </property>
-           <property name="sizeHint" >
+           <property name="sizeHint" stdset="0">
             <size>
              <width>40</width>
              <height>20</height>
@@ -150,79 +130,73 @@
           </spacer>
          </item>
          <item>
-          <layout class="QGridLayout" >
-           <property name="margin" >
-            <number>0</number>
-           </property>
-           <property name="spacing" >
-            <number>6</number>
-           </property>
-           <item row="1" column="3" >
-            <widget class="QToolButton" name="alignBottomInToolButton" >
-             <property name="text" >
+          <layout class="QGridLayout">
+           <item row="1" column="3">
+            <widget class="QToolButton" name="alignBottomInToolButton">
+             <property name="text">
               <string>...</string>
              </property>
             </widget>
            </item>
-           <item row="1" column="1" >
-            <widget class="QToolButton" name="alignTopInToolButton" >
-             <property name="text" >
+           <item row="1" column="1">
+            <widget class="QToolButton" name="alignTopInToolButton">
+             <property name="text">
               <string>...</string>
              </property>
             </widget>
            </item>
-           <item row="0" column="1" >
-            <widget class="QToolButton" name="alignLeftInToolButton" >
-             <property name="text" >
+           <item row="0" column="1">
+            <widget class="QToolButton" name="alignLeftInToolButton">
+             <property name="text">
               <string>...</string>
              </property>
             </widget>
            </item>
-           <item row="0" column="3" >
-            <widget class="QToolButton" name="alignRightInToolButton" >
-             <property name="text" >
+           <item row="0" column="3">
+            <widget class="QToolButton" name="alignRightInToolButton">
+             <property name="text">
               <string>...</string>
              </property>
             </widget>
            </item>
-           <item row="1" column="4" >
-            <widget class="QToolButton" name="alignBottomOutToolButton" >
-             <property name="text" >
+           <item row="1" column="4">
+            <widget class="QToolButton" name="alignBottomOutToolButton">
+             <property name="text">
               <string>...</string>
              </property>
             </widget>
            </item>
-           <item row="1" column="0" >
-            <widget class="QToolButton" name="alignTopOutToolButton" >
-             <property name="text" >
+           <item row="1" column="0">
+            <widget class="QToolButton" name="alignTopOutToolButton">
+             <property name="text">
               <string>...</string>
              </property>
             </widget>
            </item>
-           <item row="1" column="2" >
-            <widget class="QToolButton" name="alignCenterVerToolButton" >
-             <property name="text" >
+           <item row="1" column="2">
+            <widget class="QToolButton" name="alignCenterVerToolButton">
+             <property name="text">
               <string>...</string>
              </property>
             </widget>
            </item>
-           <item row="0" column="0" >
-            <widget class="QToolButton" name="alignLeftOutToolButton" >
-             <property name="text" >
+           <item row="0" column="0">
+            <widget class="QToolButton" name="alignLeftOutToolButton">
+             <property name="text">
               <string>...</string>
              </property>
             </widget>
            </item>
-           <item row="0" column="4" >
-            <widget class="QToolButton" name="alignRightOutToolButton" >
-             <property name="text" >
+           <item row="0" column="4">
+            <widget class="QToolButton" name="alignRightOutToolButton">
+             <property name="text">
               <string>...</string>
              </property>
             </widget>
            </item>
-           <item row="0" column="2" >
-            <widget class="QToolButton" name="alignCenterHorToolButton" >
-             <property name="text" >
+           <item row="0" column="2">
+            <widget class="QToolButton" name="alignCenterHorToolButton">
+             <property name="text">
               <string>...</string>
              </property>
             </widget>
@@ -231,13 +205,13 @@
          </item>
          <item>
           <spacer>
-           <property name="orientation" >
+           <property name="orientation">
             <enum>Qt::Horizontal</enum>
            </property>
-           <property name="sizeType" >
+           <property name="sizeType">
             <enum>QSizePolicy::Expanding</enum>
            </property>
-           <property name="sizeHint" >
+           <property name="sizeHint" stdset="0">
             <size>
              <width>40</width>
              <height>20</height>
@@ -249,13 +223,13 @@
        </item>
        <item>
         <spacer>
-         <property name="orientation" >
+         <property name="orientation">
           <enum>Qt::Vertical</enum>
          </property>
-         <property name="sizeType" >
+         <property name="sizeType">
           <enum>QSizePolicy::Expanding</enum>
          </property>
-         <property name="sizeHint" >
+         <property name="sizeHint" stdset="0">
           <size>
            <width>20</width>
            <height>40</height>
@@ -265,34 +239,25 @@
        </item>
       </layout>
      </widget>
-     <widget class="QWidget" name="tabDistribute" >
-      <attribute name="title" >
+     <widget class="QWidget" name="tabDistribute">
+      <attribute name="title">
        <string>Distribute</string>
       </attribute>
-      <layout class="QVBoxLayout" >
-       <property name="margin" >
+      <layout class="QVBoxLayout">
+       <property name="margin">
         <number>0</number>
        </property>
-       <property name="spacing" >
-        <number>6</number>
-       </property>
        <item>
-        <layout class="QHBoxLayout" >
-         <property name="margin" >
-          <number>0</number>
-         </property>
-         <property name="spacing" >
-          <number>6</number>
-         </property>
+        <layout class="QHBoxLayout">
          <item>
           <spacer>
-           <property name="orientation" >
+           <property name="orientation">
             <enum>Qt::Horizontal</enum>
            </property>
-           <property name="sizeType" >
+           <property name="sizeType">
             <enum>QSizePolicy::Expanding</enum>
            </property>
-           <property name="sizeHint" >
+           <property name="sizeHint" stdset="0">
             <size>
              <width>63</width>
              <height>20</height>
@@ -301,133 +266,127 @@
           </spacer>
          </item>
          <item>
-          <layout class="QGridLayout" >
-           <property name="margin" >
-            <number>0</number>
-           </property>
-           <property name="spacing" >
-            <number>6</number>
-           </property>
-           <item row="0" column="3" >
-            <widget class="QToolButton" name="distributeDistHToolButton" >
-             <property name="text" >
+          <layout class="QGridLayout">
+           <item row="0" column="3">
+            <widget class="QToolButton" name="distributeDistHToolButton">
+             <property name="text">
               <string>...</string>
              </property>
             </widget>
            </item>
-           <item row="1" column="2" >
-            <widget class="QToolButton" name="distributeTopToolButton" >
-             <property name="text" >
+           <item row="1" column="2">
+            <widget class="QToolButton" name="distributeTopToolButton">
+             <property name="text">
               <string>...</string>
              </property>
             </widget>
            </item>
-           <item row="1" column="1" >
-            <widget class="QToolButton" name="distributeCenterVToolButton" >
-             <property name="text" >
+           <item row="1" column="1">
+            <widget class="QToolButton" name="distributeCenterVToolButton">
+             <property name="text">
               <string>...</string>
              </property>
             </widget>
            </item>
-           <item row="0" column="2" >
-            <widget class="QToolButton" name="distributeRightToolButton" >
-             <property name="text" >
+           <item row="0" column="2">
+            <widget class="QToolButton" name="distributeRightToolButton">
+             <property name="text">
               <string>...</string>
              </property>
             </widget>
            </item>
-           <item row="3" column="0" >
-            <widget class="QToolButton" name="toolButtonDummy1" >
-             <property name="text" >
+           <item row="3" column="0">
+            <widget class="QToolButton" name="toolButtonDummy1">
+             <property name="text">
               <string>...</string>
              </property>
             </widget>
            </item>
-           <item row="2" column="2" >
-            <widget class="QToolButton" name="distributeAcrossMarginsToolButton" >
-             <property name="enabled" >
+           <item row="2" column="2">
+            <widget class="QToolButton" name="distributeAcrossMarginsToolButton">
+             <property name="enabled">
               <bool>true</bool>
              </property>
-             <property name="text" >
+             <property name="text">
               <string>...</string>
              </property>
             </widget>
            </item>
-           <item row="0" column="0" >
-            <widget class="QToolButton" name="distributeLeftToolButton" >
-             <property name="text" >
+           <item row="0" column="0">
+            <widget class="QToolButton" name="distributeLeftToolButton">
+             <property name="text">
               <string>...</string>
              </property>
             </widget>
            </item>
-           <item row="2" column="0" >
-            <widget class="QToolButton" name="distributeAcrossPageToolButton" >
-             <property name="enabled" >
+           <item row="2" column="0">
+            <widget class="QToolButton" name="distributeAcrossPageToolButton">
+             <property name="enabled">
               <bool>true</bool>
              </property>
-             <property name="text" >
+             <property name="text">
               <string>...</string>
              </property>
             </widget>
            </item>
-           <item row="3" column="1" >
-            <widget class="QToolButton" name="distributeDistValueHToolButton" >
-             <property name="text" >
+           <item row="3" column="1">
+            <widget class="QToolButton" name="distributeDistValueHToolButton">
+             <property name="text">
               <string>...</string>
              </property>
             </widget>
            </item>
-           <item row="2" column="3" >
-            <widget class="QToolButton" name="distributeDownMarginsToolButton" >
-             <property name="enabled" >
+           <item row="2" column="3">
+            <widget class="QToolButton" name="distributeDownMarginsToolButton">
+             <property name="enabled">
               <bool>true</bool>
              </property>
-             <property name="text" >
+             <property name="text">
               <string>...</string>
              </property>
             </widget>
            </item>
-           <item row="0" column="1" >
-            <widget class="QToolButton" name="distributeCenterHToolButton" >
-             <property name="text" >
+           <item row="0" column="1">
+            <widget class="QToolButton" name="distributeCenterHToolButton">
+             <property name="text">
               <string>...</string>
              </property>
             </widget>
            </item>
-           <item row="3" column="3" >
-            <widget class="QToolButton" name="toolButtonDummy2" >
-             <property name="text" >
+           <item row="3" column="3">
+            <widget class="QToolButton" name="toolButtonDummy2">
+             <property name="text">
               <string>...</string>
              </property>
             </widget>
            </item>
-           <item row="2" column="1" >
-            <widget class="QToolButton" name="distributeDownPageToolButton" >
-             <property name="enabled" >
+           <item row="2" column="1">
+            <widget class="QToolButton" name="distributeDownPageToolButton">
+             <property name="enabled">
               <bool>true</bool>
              </property>
-             <property name="text" >
+             <property name="text">
               <string>...</string>
              </property>
             </widget>
            </item>
-           <item row="3" column="2" >
-            <widget class="QToolButton" name="distributeDistValueVToolButton" >
-             <property name="text" >
+           <item row="3" column="2">
+            <widget class="QToolButton" name="distributeDistValueVToolButton">
+             <property name="text">
               <string>...</string>
              </property>
             </widget>
            </item>
-           <item row="1" column="3" >
-            <widget class="QToolButton" name="distributeDistVToolButton" >
-             <property name="text" >
+           <item row="1" column="3">
+            <widget class="QToolButton" name="distributeDistVToolButton">
+             <property name="text">
               <string>...</string>
              </property>
             </widget>
            </item>
-           <item row="1" column="0" >
-            <widget class="QToolButton" name="distributeBottomToolButton" >
-             <property name="text" >
+           <item row="1" column="0">
+            <widget class="QToolButton" name="distributeBottomToolButton">
+             <property name="text">
               <string>...</string>
              </property>
             </widget>
@@ -436,13 +395,13 @@
          </item>
          <item>
           <spacer>
-           <property name="orientation" >
+           <property name="orientation">
             <enum>Qt::Horizontal</enum>
            </property>
-           <property name="sizeType" >
+           <property name="sizeType">
             <enum>QSizePolicy::Expanding</enum>
            </property>
-           <property name="sizeHint" >
+           <property name="sizeHint" stdset="0">
             <size>
              <width>62</width>
              <height>20</height>
@@ -453,22 +412,16 @@
         </layout>
        </item>
        <item>
-        <layout class="QHBoxLayout" >
-         <property name="margin" >
-          <number>0</number>
-         </property>
-         <property name="spacing" >
-          <number>6</number>
-         </property>
+        <layout class="QHBoxLayout">
          <item>
           <spacer>
-           <property name="orientation" >
+           <property name="orientation">
             <enum>Qt::Horizontal</enum>
            </property>
-           <property name="sizeType" >
+           <property name="sizeType">
             <enum>QSizePolicy::Expanding</enum>
            </property>
-           <property name="sizeHint" >
+           <property name="sizeHint" stdset="0">
             <size>
              <width>40</width>
              <height>20</height>
@@ -477,32 +430,26 @@
           </spacer>
          </item>
          <item>
-          <layout class="QHBoxLayout" >
-           <property name="margin" >
-            <number>0</number>
-           </property>
-           <property name="spacing" >
-            <number>6</number>
-           </property>
+          <layout class="QHBoxLayout">
            <item>
-            <widget class="QLabel" name="distributeDistLabel" >
-             <property name="text" >
+            <widget class="QLabel" name="distributeDistLabel">
+             <property name="text">
               <string>&amp;Distance:</string>
              </property>
-             <property name="wordWrap" >
+             <property name="wordWrap">
               <bool>false</bool>
              </property>
-             <property name="indent" >
+             <property name="indent">
               <number>-1</number>
              </property>
-             <property name="buddy" >
+             <property name="buddy">
               <cstring>distributeDistSpinBox</cstring>
              </property>
             </widget>
            </item>
            <item>
-            <widget class="ScrSpinBox" name="distributeDistSpinBox" >
-             <property name="minimumSize" >
+            <widget class="ScrSpinBox" name="distributeDistSpinBox">
+             <property name="minimumSize">
               <size>
                <width>50</width>
                <height>24</height>
@@ -514,13 +461,13 @@
          </item>
          <item>
           <spacer>
-           <property name="orientation" >
+           <property name="orientation">
             <enum>Qt::Horizontal</enum>
            </property>
-           <property name="sizeType" >
+           <property name="sizeType">
             <enum>QSizePolicy::Expanding</enum>
            </property>
-           <property name="sizeHint" >
+           <property name="sizeHint" stdset="0">
             <size>
              <width>40</width>
              <height>20</height>
@@ -532,13 +479,13 @@
        </item>
        <item>
         <spacer>
-         <property name="orientation" >
+         <property name="orientation">
           <enum>Qt::Vertical</enum>
          </property>
-         <property name="sizeType" >
+         <property name="sizeType">
           <enum>QSizePolicy::Expanding</enum>
          </property>
-         <property name="sizeHint" >
+         <property name="sizeHint" stdset="0">
           <size>
            <width>20</width>
            <height>16</height>
@@ -548,11 +495,75 @@
        </item>
       </layout>
      </widget>
+     <widget class="QWidget" name="tabSwap">
+      <attribute name="title">
+       <string>Swap</string>
+      </attribute>
+      <layout class="QVBoxLayout" name="verticalLayout">
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout">
+         <item>
+          <spacer name="horizontalSpacer">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <widget class="QToolButton" name="swapLeftToolButton">
+           <property name="text">
+            <string>...</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QToolButton" name="swapRightToolButton">
+           <property name="text">
+            <string>...</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer name="horizontalSpacer_2">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+        </layout>
+       </item>
+       <item>
+        <spacer name="verticalSpacer">
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>20</width>
+           <height>40</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
+     </widget>
     </widget>
    </item>
   </layout>
  </widget>
- <layoutdefault spacing="6" margin="11" />
+ <layoutdefault spacing="6" margin="11"/>
  <customwidgets>
   <customwidget>
    <class>ScrSpinBox</class>
@@ -567,9 +578,9 @@
   </customwidget>
  </customwidgets>
  <includes>
-  <include location="local" >ui/scrpalettebase.h</include>
-  <include location="local" >ui/scrpalettebase.h</include>
-  <include location="local" >ui/scrspinbox.h</include>
+  <include location="local">ui/scrpalettebase.h</include>
+  <include location="local">ui/scrpalettebase.h</include>
+  <include location="local">ui/scrspinbox.h</include>
  </includes>
  <resources/>
  <connections/>
Index: scribus/ui/aligndistribute.cpp
===================================================================
--- scribus/ui/aligndistribute.cpp	(revision 13771)
+++ scribus/ui/aligndistribute.cpp	(revision 13772)
@@ -172,24 +172,23 @@
 	alignCenterHorToolButton->setIcon(QIcon(loadIcon("22/align-horizontal-center.png")));
 	alignRightInToolButton->setIcon(QIcon(loadIcon("22/align-horizontal-right.png")));
 	alignRightOutToolButton->setIcon(QIcon(loadIcon("22/align-horizontal-right-out.png")));
- 	
+
 	alignTopOutToolButton->setIcon(QIcon(loadIcon("22/align-vertical-top-out.png")));
 	alignTopInToolButton->setIcon(QIcon(loadIcon("22/align-vertical-top.png")));
 	alignCenterVerToolButton->setIcon(QIcon(loadIcon("22/align-vertical-center.png")));
 	alignBottomInToolButton->setIcon(QIcon(loadIcon("22/align-vertical-bottom.png")));
 	alignBottomOutToolButton->setIcon(QIcon(loadIcon("22/align-vertical-bottom-out.png")));
- 	
+
 	distributeLeftToolButton->setIcon(QIcon(loadIcon("22/distribute-horizontal-left.png")));
 	distributeCenterHToolButton->setIcon(QIcon(loadIcon("22/distribute-horizontal-center.png")));
 	distributeRightToolButton->setIcon(QIcon(loadIcon("22/distribute-horizontal-right.png")));
 	distributeDistHToolButton->setIcon(QIcon(loadIcon("22/distribute-horizontal-equal.png")));
- 	
+
 	distributeBottomToolButton->setIcon(QIcon(loadIcon("22/distribute-vertical-bottom.png")));
 	distributeCenterVToolButton->setIcon(QIcon(loadIcon("22/distribute-vertical-center.png")));
 	distributeTopToolButton->setIcon(QIcon(loadIcon("22/distribute-vertical-top.png")));
 	distributeDistVToolButton->setIcon(QIcon(loadIcon("22/distribute-vertical-equal.png")));
- 	
-	
+
 	distributeAcrossPageToolButton->setIcon(QIcon(loadIcon("22/distribute-horizontal-page.png")));
 	distributeDownPageToolButton->setIcon(QIcon(loadIcon("22/distribute-vertical-page.png")));
 	distributeAcrossMarginsToolButton->setIcon(QIcon(loadIcon("22/distribute-horizontal-margin.png")));
@@ -197,6 +196,9 @@
 	distributeDistValueHToolButton->setIcon(QIcon(loadIcon("22/distribute-horizontal-x.png")));
 	distributeDistValueVToolButton->setIcon(QIcon(loadIcon("22/distribute-vertical-y.png")));
 
+	swapLeftToolButton->setIcon(QIcon(loadIcon("22/swap-left.png")));
+	swapRightToolButton->setIcon(QIcon(loadIcon("22/swap-right.png")));
+
 	connect(alignLeftOutToolButton, SIGNAL(clicked()), this, SLOT(alignLeftOut()));
 	connect(alignRightOutToolButton, SIGNAL(clicked()), this, SLOT(alignRightOut()));
 	connect(alignBottomInToolButton, SIGNAL(clicked()), this, SLOT(alignBottomIn()));
@@ -221,6 +223,8 @@
 	connect(distributeDownPageToolButton, SIGNAL(clicked()), this, SLOT(distributeDistDownPage()));
 	connect(distributeAcrossMarginsToolButton, SIGNAL(clicked()), this, SLOT(distributeDistAcrossMargins()));
 	connect(distributeDownMarginsToolButton, SIGNAL(clicked()), this, SLOT(distributeDistDownMargins()));
+	connect(swapLeftToolButton, SIGNAL(clicked()), this, SLOT(swapLeft()));
+	connect(swapRightToolButton, SIGNAL(clicked()), this, SLOT(swapRight()));
 	
 	alignRelativeToCombo->setCurrentIndex(0);
 	alignToChanged(0);
@@ -402,6 +406,18 @@
 		distributeDistV(true);
 }
 
+void AlignDistributePalette::swapLeft()
+{
+	if (currDoc!=NULL)
+		currDoc->itemSelection_SwapLeft();
+}
+
+void AlignDistributePalette::swapRight()
+{
+	if (currDoc!=NULL)
+		currDoc->itemSelection_SwapRight();
+}
+
 void AlignDistributePalette::alignToChanged(int newAlignTo)
 {
 	currAlignTo = ScribusDoc::AlignTo(newAlignTo);




More information about the scribus-commit mailing list