From f27591e7a1b733dd0e480b212fc1536943159a9b Mon Sep 17 00:00:00 2001
Message-Id: <f27591e7a1b733dd0e480b212fc1536943159a9b.1614798210.git.bubu@ujevangelizacio.hu>
From: =?UTF-8?q?Gyuris=20Gell=C3=A9rt?= <bubu@ujevangelizacio.hu>
Date: Wed, 3 Mar 2021 19:52:26 +0100
Subject: [PATCH] Update layout for Style Manager: widow and orphans, character
 layout

---
 scribus/ui/smcstylewidget.ui  | 659 +++++++++++++++++-----------------
 scribus/ui/smpstylewidget.cpp |   2 +
 scribus/ui/smpstylewidget.ui  | 104 ++++--
 3 files changed, 404 insertions(+), 361 deletions(-)

diff --git a/scribus/ui/smcstylewidget.ui b/scribus/ui/smcstylewidget.ui
index 8a81560a1..715ae14a1 100644
--- a/scribus/ui/smcstylewidget.ui
+++ b/scribus/ui/smcstylewidget.ui
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>430</width>
-    <height>601</height>
+    <width>581</width>
+    <height>492</height>
    </rect>
   </property>
   <property name="sizePolicy">
@@ -423,347 +423,360 @@
           </widget>
          </item>
          <item>
-          <widget class="QGroupBox" name="hyphenGroup">
-           <property name="title">
-            <string>Hyphenation</string>
-           </property>
-           <layout class="QVBoxLayout" name="verticalLayout_4">
-            <item>
-             <layout class="QHBoxLayout" name="horizontalLayout_3">
-              <item>
-               <widget class="QLabel" name="label_4">
-                <property name="text">
-                 <string>Hyphenation Character:</string>
-                </property>
-               </widget>
-              </item>
-              <item>
-               <widget class="SMLineEdit" name="hyphenCharLineEdit">
-                <property name="maximumSize">
-                 <size>
-                  <width>60</width>
-                  <height>16777215</height>
-                 </size>
-                </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>
-             <layout class="QHBoxLayout" name="horizontalLayout">
-              <item>
-               <widget class="QLabel" name="smallestWordLabel">
-                <property name="text">
-                 <string>Smallest Word:</string>
-                </property>
-               </widget>
-              </item>
-              <item>
-               <widget class="SMSpinBox" name="smallestWordSpinBox">
-                <property name="minimum">
-                 <number>3</number>
-                </property>
-               </widget>
-              </item>
-              <item>
-               <widget class="QLabel" name="smallestWordLabel2">
-                <property name="text">
-                 <string>Characters</string>
-                </property>
-               </widget>
-              </item>
-              <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>
+          <layout class="QGridLayout" name="gridLayout">
+           <item row="0" column="0">
+            <widget class="QGroupBox" name="smColorGroup">
+             <property name="title">
+              <string>Colors</string>
+             </property>
+             <layout class="QVBoxLayout" name="verticalLayout">
+              <item>
+               <layout class="QHBoxLayout" name="_2">
+                <item>
+                 <widget class="QLabel" name="FillIcon">
+                  <property name="minimumSize">
+                   <size>
+                    <width>20</width>
+                    <height>0</height>
+                   </size>
+                  </property>
+                  <property name="maximumSize">
+                   <size>
+                    <width>22</width>
+                    <height>22</height>
+                   </size>
+                  </property>
+                  <property name="text">
+                   <string/>
+                  </property>
+                  <property name="buddy">
+                   <cstring>fillColor_</cstring>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <widget class="SMColorCombo" name="fillColor_">
+                  <property name="toolTip">
+                   <string>Fill Color</string>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <widget class="QLabel" name="fillShadeLabel">
+                  <property name="minimumSize">
+                   <size>
+                    <width>20</width>
+                    <height>0</height>
+                   </size>
+                  </property>
+                  <property name="maximumSize">
+                   <size>
+                    <width>22</width>
+                    <height>22</height>
+                   </size>
+                  </property>
+                  <property name="text">
+                   <string/>
+                  </property>
+                  <property name="buddy">
+                   <cstring>fillShade_</cstring>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <widget class="SMShadeButton" name="fillShade_">
+                  <property name="toolTip">
+                   <string>Fill Shade</string>
+                  </property>
+                  <property name="text">
+                   <string/>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <spacer>
+                  <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>
+               <layout class="QHBoxLayout" name="_10">
+                <item>
+                 <widget class="QLabel" name="StrokeIcon">
+                  <property name="minimumSize">
+                   <size>
+                    <width>20</width>
+                    <height>0</height>
+                   </size>
+                  </property>
+                  <property name="maximumSize">
+                   <size>
+                    <width>22</width>
+                    <height>22</height>
+                   </size>
+                  </property>
+                  <property name="text">
+                   <string/>
+                  </property>
+                  <property name="buddy">
+                   <cstring>strokeColor_</cstring>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <widget class="SMColorCombo" name="strokeColor_">
+                  <property name="toolTip">
+                   <string>Stroke Color</string>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <widget class="QLabel" name="strokeShadeLabel">
+                  <property name="minimumSize">
+                   <size>
+                    <width>20</width>
+                    <height>0</height>
+                   </size>
+                  </property>
+                  <property name="maximumSize">
+                   <size>
+                    <width>22</width>
+                    <height>22</height>
+                   </size>
+                  </property>
+                  <property name="text">
+                   <string/>
+                  </property>
+                  <property name="buddy">
+                   <cstring>strokeShade_</cstring>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <widget class="SMShadeButton" name="strokeShade_">
+                  <property name="toolTip">
+                   <string>Stroke Shade</string>
+                  </property>
+                  <property name="text">
+                   <string/>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <spacer>
+                  <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>
+               <layout class="QHBoxLayout" name="_11">
+                <item>
+                 <widget class="QLabel" name="backIcon">
+                  <property name="minimumSize">
+                   <size>
+                    <width>20</width>
+                    <height>0</height>
+                   </size>
+                  </property>
+                  <property name="maximumSize">
+                   <size>
+                    <width>22</width>
+                    <height>22</height>
+                   </size>
+                  </property>
+                  <property name="text">
+                   <string/>
+                  </property>
+                  <property name="buddy">
+                   <cstring>fillColor_</cstring>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <widget class="SMColorCombo" name="backColor_">
+                  <property name="toolTip">
+                   <string>Background Color</string>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <widget class="QLabel" name="backShadeLabel">
+                  <property name="minimumSize">
+                   <size>
+                    <width>20</width>
+                    <height>0</height>
+                   </size>
+                  </property>
+                  <property name="maximumSize">
+                   <size>
+                    <width>22</width>
+                    <height>22</height>
+                   </size>
+                  </property>
+                  <property name="text">
+                   <string/>
+                  </property>
+                  <property name="buddy">
+                   <cstring>fillShade_</cstring>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <widget class="SMShadeButton" name="backShade_">
+                  <property name="toolTip">
+                   <string>Background Shade</string>
+                  </property>
+                  <property name="text">
+                   <string/>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <spacer>
+                  <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>
              </layout>
-            </item>
-           </layout>
-          </widget>
-         </item>
-         <item>
-          <widget class="QGroupBox" name="smColorGroup">
-           <property name="title">
-            <string>Colors</string>
-           </property>
-           <layout class="QVBoxLayout" name="verticalLayout">
-            <item>
-             <layout class="QHBoxLayout" name="_2">
-              <item>
-               <widget class="QLabel" name="FillIcon">
-                <property name="minimumSize">
-                 <size>
-                  <width>20</width>
-                  <height>0</height>
-                 </size>
-                </property>
-                <property name="maximumSize">
-                 <size>
-                  <width>22</width>
-                  <height>22</height>
-                 </size>
-                </property>
-                <property name="text">
-                 <string/>
-                </property>
-                <property name="buddy">
-                 <cstring>fillColor_</cstring>
-                </property>
-               </widget>
-              </item>
-              <item>
-               <widget class="SMColorCombo" name="fillColor_">
-                <property name="toolTip">
-                 <string>Fill Color</string>
-                </property>
-               </widget>
-              </item>
-              <item>
-               <widget class="QLabel" name="fillShadeLabel">
-                <property name="minimumSize">
-                 <size>
-                  <width>20</width>
-                  <height>0</height>
-                 </size>
-                </property>
-                <property name="maximumSize">
-                 <size>
-                  <width>22</width>
-                  <height>22</height>
-                 </size>
-                </property>
-                <property name="text">
-                 <string/>
-                </property>
-                <property name="buddy">
-                 <cstring>fillShade_</cstring>
-                </property>
-               </widget>
-              </item>
-              <item>
-               <widget class="SMShadeButton" name="fillShade_">
-                <property name="toolTip">
-                 <string>Fill Shade</string>
-                </property>
-                <property name="text">
-                 <string/>
-                </property>
-               </widget>
+            </widget>
+           </item>
+           <item row="0" column="1">
+            <widget class="QGroupBox" name="hyphenGroup">
+             <property name="title">
+              <string>Hyphenation</string>
+             </property>
+             <layout class="QVBoxLayout" name="verticalLayout_4">
+              <item>
+               <layout class="QHBoxLayout" name="horizontalLayout_3">
+                <item>
+                 <widget class="QLabel" name="label_4">
+                  <property name="text">
+                   <string>Hyphenation Character:</string>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <widget class="SMLineEdit" name="hyphenCharLineEdit">
+                  <property name="maximumSize">
+                   <size>
+                    <width>60</width>
+                    <height>16777215</height>
+                   </size>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <spacer name="horizontalSpacer_2">
+                  <property name="orientation">
+                   <enum>Qt::Horizontal</enum>
+                  </property>
+                  <property name="sizeHint" stdset="0">
+                   <size>
+                    <width>0</width>
+                    <height>20</height>
+                   </size>
+                  </property>
+                 </spacer>
+                </item>
+               </layout>
+              </item>
+              <item>
+               <layout class="QHBoxLayout" name="horizontalLayout">
+                <item>
+                 <widget class="QLabel" name="smallestWordLabel">
+                  <property name="text">
+                   <string>Smallest Word:</string>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <widget class="SMSpinBox" name="smallestWordSpinBox">
+                  <property name="suffix">
+                   <string> characters</string>
+                  </property>
+                  <property name="minimum">
+                   <number>3</number>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <spacer name="horizontalSpacer">
+                  <property name="orientation">
+                   <enum>Qt::Horizontal</enum>
+                  </property>
+                  <property name="sizeHint" stdset="0">
+                   <size>
+                    <width>0</width>
+                    <height>20</height>
+                   </size>
+                  </property>
+                 </spacer>
+                </item>
+               </layout>
               </item>
               <item>
                <spacer>
                 <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>
-             <layout class="QHBoxLayout" name="_10">
-              <item>
-               <widget class="QLabel" name="StrokeIcon">
-                <property name="minimumSize">
-                 <size>
-                  <width>20</width>
-                  <height>0</height>
-                 </size>
-                </property>
-                <property name="maximumSize">
-                 <size>
-                  <width>22</width>
-                  <height>22</height>
-                 </size>
-                </property>
-                <property name="text">
-                 <string/>
-                </property>
-                <property name="buddy">
-                 <cstring>strokeColor_</cstring>
-                </property>
-               </widget>
-              </item>
-              <item>
-               <widget class="SMColorCombo" name="strokeColor_">
-                <property name="toolTip">
-                 <string>Stroke Color</string>
+                 <enum>Qt::Vertical</enum>
                 </property>
-               </widget>
-              </item>
-              <item>
-               <widget class="QLabel" name="strokeShadeLabel">
-                <property name="minimumSize">
-                 <size>
-                  <width>20</width>
-                  <height>0</height>
-                 </size>
-                </property>
-                <property name="maximumSize">
-                 <size>
-                  <width>22</width>
-                  <height>22</height>
-                 </size>
-                </property>
-                <property name="text">
-                 <string/>
-                </property>
-                <property name="buddy">
-                 <cstring>strokeShade_</cstring>
-                </property>
-               </widget>
-              </item>
-              <item>
-               <widget class="SMShadeButton" name="strokeShade_">
-                <property name="toolTip">
-                 <string>Stroke Shade</string>
-                </property>
-                <property name="text">
-                 <string/>
-                </property>
-               </widget>
-              </item>
-              <item>
-               <spacer>
-                <property name="orientation">
-                 <enum>Qt::Horizontal</enum>
+                <property name="sizeType">
+                 <enum>QSizePolicy::MinimumExpanding</enum>
                 </property>
                 <property name="sizeHint" stdset="0">
-                 <size>
-                  <width>40</width>
-                  <height>20</height>
-                 </size>
-                </property>
-               </spacer>
-              </item>
-             </layout>
-            </item>
-            <item>
-             <layout class="QHBoxLayout" name="_11">
-              <item>
-               <widget class="QLabel" name="backIcon">
-                <property name="minimumSize">
                  <size>
                   <width>20</width>
                   <height>0</height>
                  </size>
                 </property>
-                <property name="maximumSize">
-                 <size>
-                  <width>22</width>
-                  <height>22</height>
-                 </size>
-                </property>
-                <property name="text">
-                 <string/>
-                </property>
-                <property name="buddy">
-                 <cstring>fillColor_</cstring>
-                </property>
-               </widget>
-              </item>
-              <item>
-               <widget class="SMColorCombo" name="backColor_">
-                <property name="toolTip">
-                 <string>Background Color</string>
-                </property>
-               </widget>
-              </item>
-              <item>
-               <widget class="QLabel" name="backShadeLabel">
-                <property name="minimumSize">
-                 <size>
-                  <width>20</width>
-                  <height>0</height>
-                 </size>
-                </property>
-                <property name="maximumSize">
-                 <size>
-                  <width>22</width>
-                  <height>22</height>
-                 </size>
-                </property>
-                <property name="text">
-                 <string/>
-                </property>
-                <property name="buddy">
-                 <cstring>fillShade_</cstring>
-                </property>
-               </widget>
-              </item>
-              <item>
-               <widget class="SMShadeButton" name="backShade_">
-                <property name="toolTip">
-                 <string>Background Shade</string>
-                </property>
-                <property name="text">
-                 <string/>
-                </property>
-               </widget>
-              </item>
-              <item>
-               <spacer>
-                <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>
-              <property name="orientation">
-               <enum>Qt::Vertical</enum>
-              </property>
-              <property name="sizeType">
-               <enum>QSizePolicy::MinimumExpanding</enum>
-              </property>
-              <property name="sizeHint" stdset="0">
-               <size>
-                <width>300</width>
-                <height>0</height>
-               </size>
-              </property>
-             </spacer>
-            </item>
-           </layout>
-          </widget>
+            </widget>
+           </item>
+          </layout>
          </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>0</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
       </layout>
      </widget>
      <widget class="QWidget" name="tabFontFeatures">
diff --git a/scribus/ui/smpstylewidget.cpp b/scribus/ui/smpstylewidget.cpp
index 03d158f92..5922dc961 100644
--- a/scribus/ui/smpstylewidget.cpp
+++ b/scribus/ui/smpstylewidget.cpp
@@ -103,6 +103,8 @@ void SMPStyleWidget::iconSetChange()
 	lineSpacingLabel->setPixmap(iconManager.loadPixmap("linespacing2.png"));
 	spaceAboveLabel->setPixmap(iconManager.loadPixmap("above.png") );
 	spaceBelowLabel->setPixmap(iconManager.loadPixmap("below.png") );
+	keepLabelStart->setPixmap(iconManager.loadPixmap("16/orphan.png") );
+	keepLabelEnd->setPixmap(iconManager.loadPixmap("16/widow.png") );
 	backIcon->setPixmap(iconManager.loadPixmap("16/color-fill.png"));
 	backShadeLabel->setPixmap(iconManager.loadPixmap("shade.png"));
 
diff --git a/scribus/ui/smpstylewidget.ui b/scribus/ui/smpstylewidget.ui
index 89047a832..87149de38 100644
--- a/scribus/ui/smpstylewidget.ui
+++ b/scribus/ui/smpstylewidget.ui
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>695</width>
-    <height>596</height>
+    <width>665</width>
+    <height>572</height>
    </rect>
   </property>
   <layout class="QVBoxLayout">
@@ -280,21 +280,42 @@
            </property>
            <layout class="QVBoxLayout" name="verticalLayout_3">
             <item>
-             <layout class="QHBoxLayout" name="horizontalLayout_11">
+             <layout class="QHBoxLayout" name="horizontalLayout_4">
               <item>
-               <widget class="QLabel" name="keepLabelStart">
+               <widget class="QLabel" name="keepLabelEnd">
+                <property name="sizePolicy">
+                 <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+                  <horstretch>0</horstretch>
+                  <verstretch>0</verstretch>
+                 </sizepolicy>
+                </property>
+                <property name="minimumSize">
+                 <size>
+                  <width>22</width>
+                  <height>22</height>
+                 </size>
+                </property>
+                <property name="maximumSize">
+                 <size>
+                  <width>22</width>
+                  <height>22</height>
+                 </size>
+                </property>
                 <property name="toolTip">
-                 <string>Ensure that first lines of a paragraph won't end up separated from the rest (known as widow/orphan control)</string>
+                 <string>Ensure that last lines of a paragraph won't end up separated from the rest (known as widow control)</string>
                 </property>
                 <property name="text">
-                 <string>Don't separate first</string>
+                 <string/>
+                </property>
+                <property name="buddy">
+                 <cstring>keepLinesEnd</cstring>
                 </property>
                </widget>
               </item>
               <item>
-               <widget class="SMSpinBox" name="keepLinesStart">
+               <widget class="SMSpinBox" name="keepLinesEnd">
                 <property name="toolTip">
-                 <string>Ensure that first lines of a paragraph won't end up separated from the rest (known as widow/orphan control)</string>
+                 <string>Ensure that last lines of a paragraph won't end up separated from the rest (known as widow control)</string>
                 </property>
                 <property name="suffix">
                  <string> lines</string>
@@ -305,33 +326,40 @@
                </widget>
               </item>
               <item>
-               <spacer name="horizontalSpacer_5">
-                <property name="orientation">
-                 <enum>Qt::Horizontal</enum>
+               <widget class="QLabel" name="keepLabelStart">
+                <property name="sizePolicy">
+                 <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+                  <horstretch>0</horstretch>
+                  <verstretch>0</verstretch>
+                 </sizepolicy>
                 </property>
-                <property name="sizeHint" stdset="0">
+                <property name="minimumSize">
                  <size>
-                  <width>0</width>
-                  <height>20</height>
+                  <width>22</width>
+                  <height>22</height>
                  </size>
                 </property>
-               </spacer>
-              </item>
-             </layout>
-            </item>
-            <item>
-             <layout class="QHBoxLayout" name="horizontalLayout_14">
-              <item>
-               <widget class="QLabel" name="keepLabelEnd">
+                <property name="maximumSize">
+                 <size>
+                  <width>22</width>
+                  <height>22</height>
+                 </size>
+                </property>
+                <property name="toolTip">
+                 <string>Ensure that first lines of a paragraph won't end up separated from the rest (known as orphan control)</string>
+                </property>
                 <property name="text">
-                 <string>Don't separate last</string>
+                 <string/>
+                </property>
+                <property name="buddy">
+                 <cstring>keepLinesStart</cstring>
                 </property>
                </widget>
               </item>
               <item>
-               <widget class="SMSpinBox" name="keepLinesEnd">
+               <widget class="SMSpinBox" name="keepLinesStart">
                 <property name="toolTip">
-                 <string>Ensure that last lines of a paragraph won't end up separated from the rest (known as widow/orphan control)</string>
+                 <string>Ensure that first lines of a paragraph won't end up separated from the rest (known as orphan control)</string>
                 </property>
                 <property name="suffix">
                  <string> lines</string>
@@ -341,19 +369,6 @@
                 </property>
                </widget>
               </item>
-              <item>
-               <spacer name="horizontalSpacer_6">
-                <property name="orientation">
-                 <enum>Qt::Horizontal</enum>
-                </property>
-                <property name="sizeHint" stdset="0">
-                 <size>
-                  <width>0</width>
-                  <height>20</height>
-                 </size>
-                </property>
-               </spacer>
-              </item>
              </layout>
             </item>
             <item>
@@ -376,6 +391,19 @@
               </property>
              </widget>
             </item>
+            <item>
+             <spacer name="verticalSpacer_4">
+              <property name="orientation">
+               <enum>Qt::Vertical</enum>
+              </property>
+              <property name="sizeHint" stdset="0">
+               <size>
+                <width>20</width>
+                <height>0</height>
+               </size>
+              </property>
+             </spacer>
+            </item>
            </layout>
           </widget>
          </item>
-- 
2.27.0

