From 656df5ad3a7573abce175b22b4849b9316254851 Mon Sep 17 00:00:00 2001
From: ale rimoldi <ale@graphicslab.org>
Date: Sun, 2 Feb 2025 14:38:38 +0100
Subject: align and distribute: use toolbuttons instead of combobox and merge
 the tabs into sections


diff --git a/scribus/CMakeLists_Sources.txt b/scribus/CMakeLists_Sources.txt
index 7b59202c4..4ba985604 100644
--- a/scribus/CMakeLists_Sources.txt
+++ b/scribus/CMakeLists_Sources.txt
@@ -573,6 +573,7 @@ set(SCRIBUS_SOURCES
 	ui/widgets/pagesizepreview.cpp
 	ui/widgets/pagesizeselector.cpp
 	ui/widgets/popup_menu.cpp
+	ui/widgets/pulsing_toolbutton.cpp
 	ui/widgets/section_container.cpp
 	ui/widgets/stacked_container.cpp
 	ui/widgets/switch.cpp
diff --git a/scribus/ui/aligndistribute.cpp b/scribus/ui/aligndistribute.cpp
index b0b057743..8e05385aa 100644
--- a/scribus/ui/aligndistribute.cpp
+++ b/scribus/ui/aligndistribute.cpp
@@ -22,6 +22,7 @@ for which a new license (GPL+exception) is in place.
 #include "aligndistribute.h"
 
 #include <QComboBox>
+#include <QButtonGroup>
 #include <QEvent>
 #include <QImage>
 #include <QLabel>
@@ -78,6 +79,21 @@ AlignDistributePalette::AlignDistributePalette(QWidget* parent) : DockPanelBase(
 	//set up scrspinboxes
 	ad->distributeDistSpinBox->setValues(-10000.0, 10000.0, 2, 0.0);
 
+	groupReference = new QButtonGroup();
+
+	groupReference->addButton(ad->buttonReferenceFirst, 0);
+	groupReference->addButton(ad->buttonReferenceLast, 1);
+	groupReference->addButton(ad->buttonReferencePage, 2);
+	groupReference->addButton(ad->buttonReferenceMargins, 3);
+	groupReference->addButton(ad->buttonReferenceGuide, 4);
+	groupReference->addButton(ad->buttonReferenceSelection, 5);
+	ad->buttonReferenceFirst->setChecked(true);
+
+	groupMode = new QButtonGroup();
+	groupMode->addButton(ad->buttonModeMove, 0);
+	groupMode->addButton(ad->buttonModeResize, 1);
+	ad->buttonModeMove->setChecked(true);
+
 	resize( QSize(100, 100).expandedTo(minimumSizeHint()) );
 	languageChange();
 	init();
@@ -85,6 +101,7 @@ AlignDistributePalette::AlignDistributePalette(QWidget* parent) : DockPanelBase(
 
 	connect(ScQApp, SIGNAL(iconSetChanged()), this, SLOT(iconSetChange()));
 	connect(ScQApp, SIGNAL(localeChanged()), this, SLOT(localeChange()));
+	connect(ScQApp, SIGNAL(labelVisibilityChanged(bool)), this, SLOT(toggleLabelVisibility(bool)));
 }
 
 void AlignDistributePalette::changeEvent(QEvent *e)
@@ -101,26 +118,18 @@ void AlignDistributePalette::languageChange()
 {
 	ad->retranslateUi(this);
 
-	int alignComboValue = ad->alignRelativeToCombo->currentIndex();
-	ad->alignRelativeToCombo->clear();
-	ad->alignRelativeToCombo->addItem( tr( "First Selected" ) );
-	ad->alignRelativeToCombo->addItem( tr( "Last Selected" ) );
-	ad->alignRelativeToCombo->addItem( tr( "Page" ) );
-	ad->alignRelativeToCombo->addItem( tr( "Margins" ) );
-	ad->alignRelativeToCombo->addItem( tr( "Guide" ) );
-	ad->alignRelativeToCombo->addItem( tr( "Selection" ) );
-	ad->alignRelativeToCombo->setCurrentIndex(alignComboValue);
-	ad->alignRelativeToCombo->setToolTip( tr( "<qt>Align relative to the:<ul><li>First selected item</li><li>Second Selected Item</li><li>The current page</li><li>The margins of the current page</li><li>A Guide</li><li>The selection</ul></qt>" ) );
-	alignToChanged(alignComboValue);
-
-	int alignMethodValue = ad->alignMoveOrResizeCombo->currentIndex();
-	ad->alignMoveOrResizeCombo->clear();
-	ad->alignMoveOrResizeCombo->addItem( tr("Move") );
-	ad->alignMoveOrResizeCombo->addItem( tr("Resize") );
-	ad->alignMoveOrResizeCombo->setToolTip( tr( "<qt>When aligning one side of an item do one of the following:<ul><li>Always move the other side too (preserve existing width and height)</li><li>Keep the other side fixed (resize the item instead of moving it) whenever possible</li></ul></qt>" ));
-	alignMethodChanged(alignMethodValue);
-
-	ad->alignGuideLineEdit->setToolTip( tr( "The location of the selected guide to align to" ) );
+	referenceGuideTooltipTemplate = tr("Align relative to a guide%1");
+
+	ad->buttonReferenceFirst->setToolTip(tr("Align relative to the first selected item"));
+	ad->buttonReferenceLast->setToolTip(tr("Align relative to the last selected item"));
+	ad->buttonReferencePage->setToolTip(tr("Align relative to the current page"));
+	ad->buttonReferenceMargins->setToolTip(tr("Align relative to the margins of the current page"));
+	ad->buttonReferenceGuide->setToolTip(referenceGuideTooltipTemplate);
+	ad->buttonReferenceSelection->setToolTip(tr("Align relative the selection"));
+
+	ad->buttonModeMove->setToolTip(tr("When aligning one side of an item, always move the other side too (preserve existing width and height)"));
+	ad->buttonModeResize->setToolTip(tr("When aligning one side of an item,  whenever possible keep the other side fixed (resize the item instead of moving it)"));
+
 	ad->alignLeftOutToolButton->setToolTip( tr( "Align right sides of items to left side of anchor" ) );
 	ad->alignRightOutToolButton->setToolTip( tr( "Align left sides of items to right side of anchor" ) );
 	ad->alignBottomInToolButton->setToolTip( tr( "Align bottoms" ) );
@@ -149,20 +158,33 @@ void AlignDistributePalette::languageChange()
 	ad->distributeDownMarginsToolButton->setToolTip( tr( "Make vertical gaps between items and the top and bottom of page margins equal" ) );
 
 	ad->distributeDistSpinBox->setToolTip( tr( "Distribute the items with the distance specified" ) );
-	ad->reverseDistributionCheckBox->setToolTip( tr("When distributing by a set distance, reverse the direction of the distribution of items") );
-
-	guideInfoTextNone = tr("None Selected");
+	ad->reverseDistributionButton->setToolTip( tr("When distributing by a set distance, reverse the direction of the distribution of items") );
 
 	ad->swapLeftToolButton->setToolTip( tr( "Swap items to the left" ) );
 	ad->swapRightToolButton->setToolTip( tr( "Swap items to the right" ) );
 }
 
+void AlignDistributePalette::toggleLabelVisibility(bool v)
+{
+	ad->alignReferenceLabel->setLabelVisibility(v);
+	ad->alignModeLabel->setLabelVisibility(v);
+	ad->alignHorizontalLabel->setLabelVisibility(v);
+	ad->alignVerticalLabel->setLabelVisibility(v);
+	ad->swapLabel->setLabelVisibility(v);
+	ad->distributeHorizontalLabel->setLabelVisibility(v);
+	ad->distributeVerticalLabel->setLabelVisibility(v);
+	ad->distributeByGapLabel->setLabelVisibility(v);
+	ad->distributeByDistanceLabel->setLabelVisibility(v);
+}
+
 void AlignDistributePalette::init()
 {
 	undoManager = UndoManager::instance();
 
 	iconSetChange();
 
+	connect(groupReference, &QButtonGroup::idClicked, this, &AlignDistributePalette::alignToChanged);
+	connect(groupMode, &QButtonGroup::idClicked, this, &AlignDistributePalette::alignMethodChanged);
 	connect(ad->alignLeftOutToolButton, SIGNAL(clicked()), this, SLOT(alignLeftOut()));
 	connect(ad->alignRightOutToolButton, SIGNAL(clicked()), this, SLOT(alignRightOut()));
 	connect(ad->alignBottomInToolButton, SIGNAL(clicked()), this, SLOT(alignBottomIn()));
@@ -190,17 +212,11 @@ void AlignDistributePalette::init()
 	connect(ad->swapLeftToolButton, SIGNAL(clicked()), this, SLOT(swapLeft()));
 	connect(ad->swapRightToolButton, SIGNAL(clicked()), this, SLOT(swapRight()));
 
-	ad->alignRelativeToCombo->setCurrentIndex(0);
 	alignToChanged(0);
 	alignMethodChanged(0);
-	connect(ad->alignRelativeToCombo, SIGNAL(activated(int)), this, SLOT(alignToChanged(int)));
-	connect(ad->alignMoveOrResizeCombo, SIGNAL(activated(int)), this, SLOT(alignMethodChanged(int)));
 
 	unitRatio = 1.0;
 	guideDirection = -1;
-
-	guideInfoText = guideInfoTextNone;
-	ad->alignGuideLineEdit->setText(guideInfoTextNone);
 }
 
 void AlignDistributePalette::iconSetChange()
@@ -342,7 +358,7 @@ void AlignDistributePalette::distributeRight()
 void AlignDistributePalette::distributeDistH(bool usingDistance)
 {
 	if (currDoc != nullptr)
-		currDoc->itemSelection_DistributeDistH(usingDistance, ad->distributeDistSpinBox->value(), ad->reverseDistributionCheckBox->isChecked());
+		currDoc->itemSelection_DistributeDistH(usingDistance, ad->distributeDistSpinBox->value(), ad->reverseDistributionButton->isChecked());
 }
 
 void AlignDistributePalette::distributeDistValH()
@@ -397,7 +413,7 @@ void AlignDistributePalette::distributeTop()
 void AlignDistributePalette::distributeDistV(bool usingDistance)
 {
 	if (currDoc != nullptr)
-		currDoc->itemSelection_DistributeDistV(usingDistance, ad->distributeDistSpinBox->value(), ad->reverseDistributionCheckBox->isChecked());
+		currDoc->itemSelection_DistributeDistV(usingDistance, ad->distributeDistSpinBox->value(), ad->reverseDistributionButton->isChecked());
 }
 
 void AlignDistributePalette::distributeDistValV()
@@ -432,10 +448,9 @@ void AlignDistributePalette::alignMethodChanged(int newAlignMethod)
 
 void AlignDistributePalette::setGuide(int direction, qreal position)
 {
-	//direction 0 = H, 1 = V
-// 	qDebug() << "AlignDistributePalette::setGuide(" << direction << "" << position << ")";
 	guideDirection = direction;
 	guidePosition = position;
+	ad->buttonReferenceGuide->animatePulsing();
 	enableGuideButtons();
 }
 
@@ -449,6 +464,7 @@ void AlignDistributePalette::localeChange()
 void AlignDistributePalette::enableGuideButtons()
 {
 	QString suffix;
+	QString guidePositionText;
 	double unitRatio = 1.0;
 	int precision = 1;
 	if (currDoc != nullptr)
@@ -462,17 +478,16 @@ void AlignDistributePalette::enableGuideButtons()
 	switch (guideDirection)
 	{
 		case -1:
-			guideInfoText = guideInfoTextNone;
 			if (currAlignTo == ScribusDoc::alignGuide)
 				setterH = setterV = false;
 			break;
 		case 0:
-			guideInfoText = tr("Y: %1%2").arg(guidePosition * unitRatio, 0, 'f', precision).arg(suffix);
+			guidePositionText = tr(": Y: %1%2").arg(guidePosition * unitRatio, 0, 'f', precision).arg(suffix);
 			if (currAlignTo == ScribusDoc::alignGuide)
 				setterV = false;
 			break;
 		case 1:
-			guideInfoText = tr("X: %1%2").arg(guidePosition * unitRatio, 0, 'f', precision).arg(suffix);
+			guidePositionText = tr(": X: %1%2").arg(guidePosition * unitRatio, 0, 'f', precision).arg(suffix);
 			if (currAlignTo == ScribusDoc::alignGuide)
 				setterH = false;
 			break;
@@ -493,6 +508,6 @@ void AlignDistributePalette::enableGuideButtons()
 	ad->alignBottomOutToolButton->setEnabled(setterO);
 	ad->alignCenterVerToolButton->setEnabled(setterH);
 
-	ad->alignGuideLineEdit->setText(guideInfoText);
+	ad->buttonReferenceGuide->setToolTip(referenceGuideTooltipTemplate.arg(guidePositionText == "" ? "" : guidePositionText));
 }
 
diff --git a/scribus/ui/aligndistribute.h b/scribus/ui/aligndistribute.h
index 0b7934f2c..96f6ace9e 100644
--- a/scribus/ui/aligndistribute.h
+++ b/scribus/ui/aligndistribute.h
@@ -76,10 +76,13 @@ public:
 public slots:
 	void setGuide(int, qreal);
 	void localeChange();
+	void toggleLabelVisibility(bool v);
 
 protected:
 	ScribusView *currView { nullptr };
 	AlignDistribute * ad {nullptr};
+	QButtonGroup* groupReference;
+	QButtonGroup* groupMode;
 
 	// UserActionSniffer *userActionSniffer;
 	// void installSniffer(ScrSpinBox *spinBox);
@@ -133,8 +136,7 @@ private:
 	qreal unitRatio { 1.0 };
 	int guideDirection { -1 };
 	qreal guidePosition { 0.0 };
-	QString guideInfoText;
-	QString guideInfoTextNone;
+	QString referenceGuideTooltipTemplate;
 	
 signals:
 	void documentChanged();
diff --git a/scribus/ui/aligndistribute.ui b/scribus/ui/aligndistribute.ui
index dcb3273a5..31eb4b9da 100644
--- a/scribus/ui/aligndistribute.ui
+++ b/scribus/ui/aligndistribute.ui
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>247</width>
-    <height>456</height>
+    <width>308</width>
+    <height>567</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -27,19 +27,11 @@
     <number>3</number>
    </property>
    <item>
-    <widget class="SectionContainer" name="sectionAlign" native="true">
+    <widget class="SectionContainer" name="sectionAlign">
      <property name="title" stdset="0">
       <string>Align</string>
      </property>
      <widget class="QWidget" name="page">
-      <property name="geometry">
-       <rect>
-        <x>0</x>
-        <y>0</y>
-        <width>282</width>
-        <height>107</height>
-       </rect>
-      </property>
       <layout class="QVBoxLayout" name="verticalLayout_4">
        <property name="leftMargin">
         <number>8</number>
@@ -54,243 +46,477 @@
         <number>8</number>
        </property>
        <item>
-        <layout class="QHBoxLayout" name="horizontalLayout_3">
-         <item>
-          <widget class="QLineEdit" name="alignGuideLineEdit"/>
-         </item>
-         <item>
-          <widget class="QComboBox" name="alignRelativeToCombo"/>
-         </item>
-         <item>
-          <widget class="QComboBox" name="alignMoveOrResizeCombo"/>
-         </item>
-        </layout>
-       </item>
-       <item>
-        <layout class="QHBoxLayout" name="horizontalLayout_4">
+        <layout class="QHBoxLayout" name="horizontalLayout_2">
          <item>
-          <widget class="QToolButton" name="alignRightInToolButton">
-           <property name="minimumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="iconSize">
-            <size>
-             <width>22</width>
-             <height>22</height>
-            </size>
-           </property>
+          <widget class="FormWidget" name="alignReferenceLabel">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="label" stdset="0">
+            <string>Reference</string>
+           </property>
+           <layout class="QHBoxLayout" name="horizontalLayout">
+            <property name="leftMargin">
+             <number>0</number>
+            </property>
+            <property name="topMargin">
+             <number>0</number>
+            </property>
+            <property name="rightMargin">
+             <number>0</number>
+            </property>
+            <property name="bottomMargin">
+             <number>0</number>
+            </property>
+            <item>
+             <layout class="QHBoxLayout" name="horizontalLayout_13">
+              <item>
+               <widget class="QToolButton" name="buttonReferenceFirst">
+                <property name="text">
+                 <string/>
+                </property>
+                <property name="checkable">
+                 <bool>true</bool>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QToolButton" name="buttonReferenceLast">
+                <property name="text">
+                 <string/>
+                </property>
+                <property name="checkable">
+                 <bool>true</bool>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QToolButton" name="buttonReferencePage">
+                <property name="text">
+                 <string/>
+                </property>
+                <property name="checkable">
+                 <bool>true</bool>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QToolButton" name="buttonReferenceMargins">
+                <property name="text">
+                 <string/>
+                </property>
+                <property name="checkable">
+                 <bool>true</bool>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="PulsingToolButton" name="buttonReferenceGuide">
+                <property name="text">
+                 <string/>
+                </property>
+                <property name="checkable">
+                 <bool>true</bool>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QToolButton" name="buttonReferenceSelection">
+                <property name="text">
+                 <string/>
+                </property>
+                <property name="checkable">
+                 <bool>true</bool>
+                </property>
+               </widget>
+              </item>
+             </layout>
+            </item>
+           </layout>
           </widget>
          </item>
          <item>
-          <widget class="QToolButton" name="alignCenterHorToolButton">
-           <property name="minimumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="iconSize">
-            <size>
-             <width>22</width>
-             <height>22</height>
-            </size>
-           </property>
+          <widget class="FormWidget" name="alignModeLabel">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="label" stdset="0">
+            <string>Mode</string>
+           </property>
+           <layout class="QHBoxLayout" name="horizontalLayout_12">
+            <property name="leftMargin">
+             <number>0</number>
+            </property>
+            <property name="topMargin">
+             <number>0</number>
+            </property>
+            <property name="rightMargin">
+             <number>0</number>
+            </property>
+            <property name="bottomMargin">
+             <number>0</number>
+            </property>
+            <item>
+             <layout class="QHBoxLayout" name="horizontalLayout_14">
+              <item>
+               <widget class="QToolButton" name="buttonModeMove">
+                <property name="text">
+                 <string/>
+                </property>
+                <property name="checkable">
+                 <bool>true</bool>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QToolButton" name="buttonModeResize">
+                <property name="text">
+                 <string/>
+                </property>
+                <property name="checkable">
+                 <bool>true</bool>
+                </property>
+               </widget>
+              </item>
+             </layout>
+            </item>
+           </layout>
           </widget>
          </item>
          <item>
-          <widget class="QToolButton" name="alignLeftInToolButton">
-           <property name="minimumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
+          <spacer name="horizontalSpacer">
+           <property name="orientation">
+            <enum>Qt::Orientation::Horizontal</enum>
            </property>
-           <property name="maximumSize">
+           <property name="sizeHint" stdset="0">
             <size>
-             <width>24</width>
-             <height>24</height>
+             <width>40</width>
+             <height>20</height>
             </size>
            </property>
-           <property name="iconSize">
-            <size>
-             <width>22</width>
-             <height>22</height>
-            </size>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QToolButton" name="alignLeftOutToolButton">
-           <property name="minimumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="iconSize">
-            <size>
-             <width>22</width>
-             <height>22</height>
-            </size>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QToolButton" name="alignRightOutToolButton">
-           <property name="minimumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="iconSize">
-            <size>
-             <width>22</width>
-             <height>22</height>
-            </size>
-           </property>
-          </widget>
+          </spacer>
          </item>
         </layout>
        </item>
        <item>
-        <layout class="QHBoxLayout" name="horizontalLayout_5">
+        <layout class="QHBoxLayout" name="horizontalLayout_18">
          <item>
-          <widget class="QToolButton" name="alignBottomInToolButton">
-           <property name="minimumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="iconSize">
-            <size>
-             <width>22</width>
-             <height>22</height>
-            </size>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QToolButton" name="alignCenterVerToolButton">
-           <property name="minimumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="iconSize">
-            <size>
-             <width>22</width>
-             <height>22</height>
-            </size>
-           </property>
+          <widget class="FormWidget" name="alignHorizontalLabel">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="label" stdset="0">
+            <string>Horizontal</string>
+           </property>
+           <layout class="QHBoxLayout" name="horizontalLayout_15">
+            <property name="leftMargin">
+             <number>0</number>
+            </property>
+            <property name="topMargin">
+             <number>0</number>
+            </property>
+            <property name="rightMargin">
+             <number>0</number>
+            </property>
+            <property name="bottomMargin">
+             <number>0</number>
+            </property>
+            <item>
+             <layout class="QHBoxLayout" name="horizontalLayout_4">
+              <item>
+               <widget class="QToolButton" name="alignRightInToolButton">
+                <property name="minimumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="maximumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="iconSize">
+                 <size>
+                  <width>22</width>
+                  <height>22</height>
+                 </size>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QToolButton" name="alignCenterHorToolButton">
+                <property name="minimumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="maximumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="iconSize">
+                 <size>
+                  <width>22</width>
+                  <height>22</height>
+                 </size>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QToolButton" name="alignLeftInToolButton">
+                <property name="minimumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="maximumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="iconSize">
+                 <size>
+                  <width>22</width>
+                  <height>22</height>
+                 </size>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QToolButton" name="alignLeftOutToolButton">
+                <property name="minimumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="maximumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="iconSize">
+                 <size>
+                  <width>22</width>
+                  <height>22</height>
+                 </size>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QToolButton" name="alignRightOutToolButton">
+                <property name="minimumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="maximumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="iconSize">
+                 <size>
+                  <width>22</width>
+                  <height>22</height>
+                 </size>
+                </property>
+               </widget>
+              </item>
+             </layout>
+            </item>
+           </layout>
           </widget>
          </item>
          <item>
-          <widget class="QToolButton" name="alignTopInToolButton">
-           <property name="minimumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
+          <spacer name="horizontalSpacer_2">
+           <property name="orientation">
+            <enum>Qt::Orientation::Horizontal</enum>
            </property>
-           <property name="maximumSize">
+           <property name="sizeHint" stdset="0">
             <size>
-             <width>24</width>
-             <height>24</height>
+             <width>40</width>
+             <height>20</height>
             </size>
            </property>
-           <property name="iconSize">
-            <size>
-             <width>22</width>
-             <height>22</height>
-            </size>
-           </property>
-          </widget>
+          </spacer>
          </item>
+        </layout>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_19">
          <item>
-          <widget class="QToolButton" name="alignTopOutToolButton">
-           <property name="minimumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="iconSize">
-            <size>
-             <width>22</width>
-             <height>22</height>
-            </size>
-           </property>
+          <widget class="FormWidget" name="alignVerticalLabel">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="label" stdset="0">
+            <string>Vertical</string>
+           </property>
+           <layout class="QHBoxLayout" name="horizontalLayout_16">
+            <property name="leftMargin">
+             <number>0</number>
+            </property>
+            <property name="topMargin">
+             <number>0</number>
+            </property>
+            <property name="rightMargin">
+             <number>0</number>
+            </property>
+            <property name="bottomMargin">
+             <number>0</number>
+            </property>
+            <item>
+             <layout class="QHBoxLayout" name="horizontalLayout_5">
+              <item>
+               <widget class="QToolButton" name="alignBottomInToolButton">
+                <property name="minimumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="maximumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="iconSize">
+                 <size>
+                  <width>22</width>
+                  <height>22</height>
+                 </size>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QToolButton" name="alignCenterVerToolButton">
+                <property name="minimumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="maximumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="iconSize">
+                 <size>
+                  <width>22</width>
+                  <height>22</height>
+                 </size>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QToolButton" name="alignTopInToolButton">
+                <property name="minimumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="maximumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="iconSize">
+                 <size>
+                  <width>22</width>
+                  <height>22</height>
+                 </size>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QToolButton" name="alignTopOutToolButton">
+                <property name="minimumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="maximumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="iconSize">
+                 <size>
+                  <width>22</width>
+                  <height>22</height>
+                 </size>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QToolButton" name="alignBottomOutToolButton">
+                <property name="minimumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="maximumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="iconSize">
+                 <size>
+                  <width>22</width>
+                  <height>22</height>
+                 </size>
+                </property>
+               </widget>
+              </item>
+             </layout>
+            </item>
+           </layout>
           </widget>
          </item>
          <item>
-          <widget class="QToolButton" name="alignBottomOutToolButton">
-           <property name="minimumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
+          <spacer name="horizontalSpacer_3">
+           <property name="orientation">
+            <enum>Qt::Orientation::Horizontal</enum>
            </property>
-           <property name="maximumSize">
+           <property name="sizeHint" stdset="0">
             <size>
-             <width>24</width>
-             <height>24</height>
+             <width>40</width>
+             <height>20</height>
             </size>
            </property>
-           <property name="iconSize">
-            <size>
-             <width>22</width>
-             <height>22</height>
-            </size>
-           </property>
-          </widget>
+          </spacer>
          </item>
         </layout>
        </item>
@@ -299,19 +525,11 @@
     </widget>
    </item>
    <item>
-    <widget class="SectionContainer" name="sectionDistribute" native="true">
+    <widget class="SectionContainer" name="sectionDistribute">
      <property name="title" stdset="0">
       <string>Distribute</string>
      </property>
      <widget class="QWidget" name="page_2">
-      <property name="geometry">
-       <rect>
-        <x>0</x>
-        <y>0</y>
-        <width>176</width>
-        <height>233</height>
-       </rect>
-      </property>
       <layout class="QVBoxLayout" name="verticalLayout_7">
        <property name="leftMargin">
         <number>8</number>
@@ -326,417 +544,629 @@
         <number>8</number>
        </property>
        <item>
-        <layout class="QHBoxLayout" name="horizontalLayout_9">
+        <layout class="QHBoxLayout" name="horizontalLayout_24">
          <item>
-          <widget class="QToolButton" name="distributeDistValueVToolButton">
-           <property name="minimumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="iconSize">
-            <size>
-             <width>22</width>
-             <height>22</height>
-            </size>
-           </property>
+          <widget class="FormWidget" name="distributeHorizontalLabel">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="label" stdset="0">
+            <string>Horizontal</string>
+           </property>
+           <layout class="QHBoxLayout" name="horizontalLayout_21">
+            <property name="leftMargin">
+             <number>0</number>
+            </property>
+            <property name="topMargin">
+             <number>0</number>
+            </property>
+            <property name="rightMargin">
+             <number>0</number>
+            </property>
+            <property name="bottomMargin">
+             <number>0</number>
+            </property>
+            <item>
+             <layout class="QHBoxLayout" name="horizontalLayout_6">
+              <item>
+               <widget class="QToolButton" name="distributeDistHToolButton">
+                <property name="minimumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="maximumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="iconSize">
+                 <size>
+                  <width>22</width>
+                  <height>22</height>
+                 </size>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QToolButton" name="distributeRightToolButton">
+                <property name="minimumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="maximumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="iconSize">
+                 <size>
+                  <width>22</width>
+                  <height>22</height>
+                 </size>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QToolButton" name="distributeCenterHToolButton">
+                <property name="minimumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="maximumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="iconSize">
+                 <size>
+                  <width>22</width>
+                  <height>22</height>
+                 </size>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QToolButton" name="distributeLeftToolButton">
+                <property name="minimumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="maximumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="iconSize">
+                 <size>
+                  <width>22</width>
+                  <height>22</height>
+                 </size>
+                </property>
+               </widget>
+              </item>
+             </layout>
+            </item>
+           </layout>
           </widget>
          </item>
          <item>
-          <widget class="QToolButton" name="distributeDistValueHToolButton">
-           <property name="minimumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
+          <spacer name="horizontalSpacer_6">
+           <property name="orientation">
+            <enum>Qt::Orientation::Horizontal</enum>
            </property>
-           <property name="iconSize">
+           <property name="sizeHint" stdset="0">
             <size>
-             <width>22</width>
-             <height>22</height>
+             <width>40</width>
+             <height>20</height>
             </size>
            </property>
-          </widget>
+          </spacer>
          </item>
         </layout>
        </item>
        <item>
-        <layout class="QHBoxLayout" name="horizontalLayout_6">
-         <item>
-          <widget class="QToolButton" name="distributeDistHToolButton">
-           <property name="minimumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="iconSize">
-            <size>
-             <width>22</width>
-             <height>22</height>
-            </size>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QToolButton" name="distributeRightToolButton">
-           <property name="minimumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="iconSize">
-            <size>
-             <width>22</width>
-             <height>22</height>
-            </size>
-           </property>
-          </widget>
-         </item>
+        <layout class="QHBoxLayout" name="horizontalLayout_25">
          <item>
-          <widget class="QToolButton" name="distributeCenterHToolButton">
-           <property name="minimumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="iconSize">
-            <size>
-             <width>22</width>
-             <height>22</height>
-            </size>
-           </property>
+          <widget class="FormWidget" name="distributeVerticalLabel">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="label" stdset="0">
+            <string>Vertical</string>
+           </property>
+           <layout class="QHBoxLayout" name="horizontalLayout_22">
+            <property name="leftMargin">
+             <number>0</number>
+            </property>
+            <property name="topMargin">
+             <number>0</number>
+            </property>
+            <property name="rightMargin">
+             <number>0</number>
+            </property>
+            <property name="bottomMargin">
+             <number>0</number>
+            </property>
+            <item>
+             <layout class="QHBoxLayout" name="horizontalLayout_7">
+              <item>
+               <widget class="QToolButton" name="distributeCenterVToolButton">
+                <property name="minimumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="maximumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="iconSize">
+                 <size>
+                  <width>22</width>
+                  <height>22</height>
+                 </size>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QToolButton" name="distributeBottomToolButton">
+                <property name="minimumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="maximumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="iconSize">
+                 <size>
+                  <width>22</width>
+                  <height>22</height>
+                 </size>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QToolButton" name="distributeDistVToolButton">
+                <property name="minimumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="maximumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="iconSize">
+                 <size>
+                  <width>22</width>
+                  <height>22</height>
+                 </size>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QToolButton" name="distributeTopToolButton">
+                <property name="minimumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="maximumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="iconSize">
+                 <size>
+                  <width>22</width>
+                  <height>22</height>
+                 </size>
+                </property>
+               </widget>
+              </item>
+             </layout>
+            </item>
+           </layout>
           </widget>
          </item>
          <item>
-          <widget class="QToolButton" name="distributeLeftToolButton">
-           <property name="minimumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
+          <spacer name="horizontalSpacer_7">
+           <property name="orientation">
+            <enum>Qt::Orientation::Horizontal</enum>
            </property>
-           <property name="iconSize">
+           <property name="sizeHint" stdset="0">
             <size>
-             <width>22</width>
-             <height>22</height>
+             <width>40</width>
+             <height>20</height>
             </size>
            </property>
-          </widget>
+          </spacer>
          </item>
         </layout>
        </item>
        <item>
-        <layout class="QHBoxLayout" name="horizontalLayout_7">
+        <layout class="QHBoxLayout" name="horizontalLayout_26">
          <item>
-          <widget class="QToolButton" name="distributeCenterVToolButton">
-           <property name="minimumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="iconSize">
-            <size>
-             <width>22</width>
-             <height>22</height>
-            </size>
-           </property>
+          <widget class="FormWidget" name="distributeByGapLabel">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="label" stdset="0">
+            <string>By gap</string>
+           </property>
+           <layout class="QHBoxLayout" name="horizontalLayout_23">
+            <property name="leftMargin">
+             <number>0</number>
+            </property>
+            <property name="topMargin">
+             <number>0</number>
+            </property>
+            <property name="rightMargin">
+             <number>0</number>
+            </property>
+            <property name="bottomMargin">
+             <number>0</number>
+            </property>
+            <item>
+             <layout class="QHBoxLayout" name="horizontalLayout_8">
+              <item>
+               <widget class="QToolButton" name="distributeDownPageToolButton">
+                <property name="enabled">
+                 <bool>true</bool>
+                </property>
+                <property name="minimumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="maximumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="iconSize">
+                 <size>
+                  <width>22</width>
+                  <height>22</height>
+                 </size>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QToolButton" name="distributeAcrossPageToolButton">
+                <property name="enabled">
+                 <bool>true</bool>
+                </property>
+                <property name="minimumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="maximumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="iconSize">
+                 <size>
+                  <width>22</width>
+                  <height>22</height>
+                 </size>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QToolButton" name="distributeDownMarginsToolButton">
+                <property name="enabled">
+                 <bool>true</bool>
+                </property>
+                <property name="minimumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="maximumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="iconSize">
+                 <size>
+                  <width>22</width>
+                  <height>22</height>
+                 </size>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QToolButton" name="distributeAcrossMarginsToolButton">
+                <property name="enabled">
+                 <bool>true</bool>
+                </property>
+                <property name="minimumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="maximumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="iconSize">
+                 <size>
+                  <width>22</width>
+                  <height>22</height>
+                 </size>
+                </property>
+               </widget>
+              </item>
+             </layout>
+            </item>
+           </layout>
           </widget>
          </item>
          <item>
-          <widget class="QToolButton" name="distributeBottomToolButton">
-           <property name="minimumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
+          <spacer name="horizontalSpacer_8">
+           <property name="orientation">
+            <enum>Qt::Orientation::Horizontal</enum>
            </property>
-           <property name="iconSize">
+           <property name="sizeHint" stdset="0">
             <size>
-             <width>22</width>
-             <height>22</height>
+             <width>40</width>
+             <height>20</height>
             </size>
            </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QToolButton" name="distributeDistVToolButton">
-           <property name="minimumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="iconSize">
-            <size>
-             <width>22</width>
-             <height>22</height>
-            </size>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QToolButton" name="distributeTopToolButton">
-           <property name="minimumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="iconSize">
-            <size>
-             <width>22</width>
-             <height>22</height>
-            </size>
-           </property>
-          </widget>
+          </spacer>
          </item>
         </layout>
        </item>
        <item>
-        <layout class="QHBoxLayout" name="horizontalLayout_8">
-         <item>
-          <widget class="QToolButton" name="distributeDownPageToolButton">
-           <property name="enabled">
-            <bool>true</bool>
-           </property>
-           <property name="minimumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="iconSize">
-            <size>
-             <width>22</width>
-             <height>22</height>
-            </size>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QToolButton" name="distributeAcrossPageToolButton">
-           <property name="enabled">
-            <bool>true</bool>
-           </property>
-           <property name="minimumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="iconSize">
-            <size>
-             <width>22</width>
-             <height>22</height>
-            </size>
-           </property>
-          </widget>
-         </item>
+        <layout class="QHBoxLayout" name="horizontalLayout_10">
          <item>
-          <widget class="QToolButton" name="distributeDownMarginsToolButton">
-           <property name="enabled">
-            <bool>true</bool>
-           </property>
-           <property name="minimumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="iconSize">
-            <size>
-             <width>22</width>
-             <height>22</height>
-            </size>
-           </property>
+          <widget class="FormWidget" name="distributeByDistanceLabel">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="label" stdset="0">
+            <string>By distance</string>
+           </property>
+           <layout class="QHBoxLayout" name="horizontalLayout_20">
+            <property name="leftMargin">
+             <number>0</number>
+            </property>
+            <property name="topMargin">
+             <number>0</number>
+            </property>
+            <property name="rightMargin">
+             <number>0</number>
+            </property>
+            <property name="bottomMargin">
+             <number>0</number>
+            </property>
+            <item>
+             <layout class="QHBoxLayout" name="horizontalLayout_9">
+              <item>
+               <widget class="QToolButton" name="distributeDistValueVToolButton">
+                <property name="minimumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="maximumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="iconSize">
+                 <size>
+                  <width>22</width>
+                  <height>22</height>
+                 </size>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QToolButton" name="distributeDistValueHToolButton">
+                <property name="minimumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="maximumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="iconSize">
+                 <size>
+                  <width>22</width>
+                  <height>22</height>
+                 </size>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="ScrSpinBox" name="distributeDistSpinBox">
+                <property name="minimumSize">
+                 <size>
+                  <width>50</width>
+                  <height>24</height>
+                 </size>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QToolButton" name="reverseDistributionButton">
+                <property name="text">
+                 <string/>
+                </property>
+                <property name="checkable">
+                 <bool>true</bool>
+                </property>
+               </widget>
+              </item>
+             </layout>
+            </item>
+           </layout>
           </widget>
          </item>
          <item>
-          <widget class="QToolButton" name="distributeAcrossMarginsToolButton">
-           <property name="enabled">
-            <bool>true</bool>
-           </property>
-           <property name="minimumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
+          <spacer name="horizontalSpacer_4">
+           <property name="orientation">
+            <enum>Qt::Orientation::Horizontal</enum>
            </property>
-           <property name="maximumSize">
+           <property name="sizeHint" stdset="0">
             <size>
-             <width>24</width>
-             <height>24</height>
+             <width>40</width>
+             <height>20</height>
             </size>
            </property>
-           <property name="iconSize">
-            <size>
-             <width>22</width>
-             <height>22</height>
-            </size>
-           </property>
-          </widget>
+          </spacer>
          </item>
         </layout>
        </item>
        <item>
-        <layout class="QHBoxLayout" name="horizontalLayout_11">
-         <item>
-          <widget class="QToolButton" name="swapRightToolButton">
-           <property name="minimumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="iconSize">
-            <size>
-             <width>22</width>
-             <height>22</height>
-            </size>
-           </property>
-          </widget>
-         </item>
+        <layout class="QHBoxLayout" name="horizontalLayout_3">
          <item>
-          <widget class="QToolButton" name="swapLeftToolButton">
-           <property name="minimumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>24</width>
-             <height>24</height>
-            </size>
-           </property>
-           <property name="iconSize">
-            <size>
-             <width>22</width>
-             <height>22</height>
-            </size>
-           </property>
+          <widget class="FormWidget" name="swapLabel">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="label" stdset="0">
+            <string>Swap</string>
+           </property>
+           <layout class="QHBoxLayout" name="horizontalLayout_17">
+            <property name="leftMargin">
+             <number>0</number>
+            </property>
+            <property name="topMargin">
+             <number>0</number>
+            </property>
+            <property name="rightMargin">
+             <number>0</number>
+            </property>
+            <property name="bottomMargin">
+             <number>0</number>
+            </property>
+            <item>
+             <layout class="QHBoxLayout" name="horizontalLayout_11">
+              <item>
+               <widget class="QToolButton" name="swapRightToolButton">
+                <property name="minimumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="maximumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="iconSize">
+                 <size>
+                  <width>22</width>
+                  <height>22</height>
+                 </size>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QToolButton" name="swapLeftToolButton">
+                <property name="minimumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="maximumSize">
+                 <size>
+                  <width>24</width>
+                  <height>24</height>
+                 </size>
+                </property>
+                <property name="iconSize">
+                 <size>
+                  <width>22</width>
+                  <height>22</height>
+                 </size>
+                </property>
+               </widget>
+              </item>
+             </layout>
+            </item>
+           </layout>
           </widget>
          </item>
-        </layout>
-       </item>
-       <item>
-        <layout class="QHBoxLayout" name="horizontalLayout_10">
          <item>
-          <widget class="QCheckBox" name="checkBoxAlignSpacing">
-           <property name="text">
-            <string>Use Spacing</string>
+          <spacer name="horizontalSpacer_5">
+           <property name="orientation">
+            <enum>Qt::Orientation::Horizontal</enum>
            </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="ScrSpinBox" name="distributeDistSpinBox">
-           <property name="minimumSize">
+           <property name="sizeHint" stdset="0">
             <size>
-             <width>50</width>
-             <height>24</height>
+             <width>40</width>
+             <height>20</height>
             </size>
            </property>
-          </widget>
+          </spacer>
          </item>
         </layout>
        </item>
-       <item>
-        <widget class="QCheckBox" name="reverseDistributionCheckBox">
-         <property name="text">
-          <string>Reverse Distribution</string>
-         </property>
-        </widget>
-       </item>
       </layout>
      </widget>
     </widget>
@@ -758,16 +1188,28 @@
  </widget>
  <customwidgets>
   <customwidget>
-   <class>ScrSpinBox</class>
-   <extends>QDoubleSpinBox</extends>
-   <header>ui/scrspinbox.h</header>
+   <class>FormWidget</class>
+   <extends>QWidget</extends>
+   <header>ui/widgets/form_widget.h</header>
+   <container>1</container>
   </customwidget>
   <customwidget>
    <class>SectionContainer</class>
    <extends>QWidget</extends>
    <header>ui/widgets/section_container.h</header>
+   <addpagemethod>setWidget</addpagemethod>
    <container>1</container>
   </customwidget>
+  <customwidget>
+   <class>ScrSpinBox</class>
+   <extends>QDoubleSpinBox</extends>
+   <header>ui/scrspinbox.h</header>
+  </customwidget>
+  <customwidget>
+   <class>PulsingToolButton</class>
+   <extends>QToolButton</extends>
+   <header>ui/widgets/pulsing_toolbutton.h</header>
+  </customwidget>
  </customwidgets>
  <includes>
   <include location="local">ui/scrspinbox.h</include>
diff --git a/scribus/ui/widgets/pulsing_toolbutton.cpp b/scribus/ui/widgets/pulsing_toolbutton.cpp
new file mode 100644
index 000000000..106ffc8b0
--- /dev/null
+++ b/scribus/ui/widgets/pulsing_toolbutton.cpp
@@ -0,0 +1,79 @@
+#include "pulsing_toolbutton.h"
+
+#include <QBrush>
+#include <QColor>
+#include <QPaintEvent>
+#include <QPalette>
+#include <QStyle>
+#include <QStyleOptionButton>
+#include <QStylePainter>
+#include <QString>
+#include <QToolButton>
+#include <QVariant>
+#include <QVariantAnimation>
+#include <QWidget>
+
+PulsingToolButton::PulsingToolButton(QWidget *parent):
+	QToolButton(parent),
+	m_transition(nullptr)
+{
+}
+
+void PulsingToolButton::paintEvent(QPaintEvent* event)
+{
+	if (m_transition == nullptr)
+	{
+		QToolButton::paintEvent(event);
+	}
+	else
+	{
+		QStylePainter p(this);
+		QStyleOptionToolButton opt;
+		initStyleOption(&opt);        
+		p.drawComplexControl(QStyle::CC_ToolButton, opt);
+
+		m_currentColor.setAlpha(100);
+		p.setBrush(m_currentColor);
+		p.setPen(Qt::NoPen);
+		p.drawRect(0,0,width(),height());
+	}
+}
+
+// https://stackoverflow.com/questions/53084981/how-to-add-a-hover-transition-to-qpushbutton
+// https://forum.qt.io/post/538500
+void PulsingToolButton::animatePulsing()
+{
+	if (!isChecked())
+	{
+		return;
+	}
+	if (m_transition != nullptr)
+	{
+		// too fast, don't show a second animation
+		return;
+		// m_transition->stop();
+	}
+
+	m_transition = new QVariantAnimation(this);
+	m_transition->setDuration(1000); // TODO: this should be a class const
+
+	QColor startColor = palette().button().color();
+	QColor endColor = palette().shadow().color();
+
+	m_transition->setStartValue(startColor);
+	m_transition->setEndValue(endColor);
+
+	connect(m_transition, &QVariantAnimation::valueChanged,
+			this, [this](const QVariant &value){
+		m_currentColor = value.value<QColor>();
+		repaint();
+	});
+
+	connect(m_transition, &QVariantAnimation::destroyed,
+			this, [this](){
+		m_transition = nullptr;
+		repaint();
+	});
+
+	m_transition->start(QAbstractAnimation::DeleteWhenStopped);
+}
diff --git a/scribus/ui/widgets/pulsing_toolbutton.h b/scribus/ui/widgets/pulsing_toolbutton.h
new file mode 100644
index 000000000..c071fa483
--- /dev/null
+++ b/scribus/ui/widgets/pulsing_toolbutton.h
@@ -0,0 +1,40 @@
+#ifndef PULSING_TOOLBUTTON_H
+#define PULSING_TOOLBUTTON_H
+
+/**
+ * Change the background color of the ToolButton to the opposite among checked and unchecked,
+ * then animate the transition back to the original color.
+ * Currently, done by draing a semitransparent rectangle on top of the button.
+ * 
+ * In the future, the widget can be extend to pulse in a loop until mouseover, or other
+ * fancy gadgets.
+ *
+ * The current minimal implementation is tailored for the buttonReferenceGuide button in
+ * the align and distribute dialog:
+ * - It only pulses once.
+ * - It only pulses when it's checked.
+ * - The animation time is a constant.
+ */
+
+#include <QColor>
+#include <QToolButton>
+
+class QVariantAnimation;
+class QWidget;
+
+class PulsingToolButton : public QToolButton
+{
+	Q_OBJECT
+public:
+	explicit PulsingToolButton(QWidget *parent = nullptr);
+	void animatePulsing();
+
+protected:
+	void paintEvent(QPaintEvent *) override;
+
+private:
+	QVariantAnimation *m_transition;
+	QColor m_currentColor;
+};
+
+#endif
