commit e121bd04bbaed32b4c23700dc492fcd1459ff6a6
Author: Juergen Spitzmueller <[email protected]>
Date:   Sun Jun 28 18:27:59 2020 +0200

    Support halfline and fullline also in vspace.
---
 lib/doc/UserGuide.lyx           |   28 ++++++++++++++++++++--
 lib/doc/de/UserGuide.lyx        |   37 ++++++++++++++++++++++--------
 lib/lyx2lyx/lyx_2_4.py          |   21 ++++++++++++++++-
 lib/ui/stdcontext.inc           |    2 +
 src/frontends/qt/GuiVSpace.cpp  |   48 +++++++++++++++++++++++++++-----------
 src/frontends/qt/ui/VSpaceUi.ui |   15 ++++++++++-
 src/tex2lyx/text.cpp            |    7 +++++
 7 files changed, 128 insertions(+), 30 deletions(-)

diff --git a/lib/doc/UserGuide.lyx b/lib/doc/UserGuide.lyx
index dd32fac..879f305 100644
--- a/lib/doc/UserGuide.lyx
+++ b/lib/doc/UserGuide.lyx
@@ -1,5 +1,5 @@
 #LyX 2.4 created this file. For more info see https://www.lyx.org/
-\lyxformat 595
+\lyxformat 596
 \begin_document
 \begin_header
 \save_transient_properties true
@@ -46,6 +46,9 @@
 % only uncomment this when you are using makindex
 %\let\OrgIndex\index 
 %\renewcommand*{\index}[1]{\OrgIndex{#1}}
+% Added by lyx2lyx
+\setlength{\parskip}{\medskipamount}
+\setlength{\parindent}{0pt}
 \end_preamble
 \options 
refpage,intoc,bibliography=totoc,index=totoc,BCOR7.5mm,captions=tableheading
 \use_default_options false
@@ -137,8 +140,8 @@ logicalmkup
 \end_index
 \secnumdepth 3
 \tocdepth 2
-\paragraph_separation skip
-\defskip medskip
+\paragraph_separation indent
+\paragraph_indentation default
 \is_math_indent 0
 \math_numbering_side default
 \quotes_style english
@@ -12119,6 +12122,25 @@ DefSkip
 MedSkip
 \family default
 .
+\change_inserted -712698321 1593360527
+
+\end_layout
+
+\begin_layout Standard
+
+\change_inserted -712698321 1593360570
+
+\family sans
+Half line height
+\family default
+ and 
+\family sans
+Line height
+\family default
+ equal to the height, or half the height, of a line in the current font
+ size including line spacing.
+\change_unchanged
+
 \end_layout
 
 \begin_layout Standard
diff --git a/lib/doc/de/UserGuide.lyx b/lib/doc/de/UserGuide.lyx
index 98700b5..e95f71c 100644
--- a/lib/doc/de/UserGuide.lyx
+++ b/lib/doc/de/UserGuide.lyx
@@ -1,5 +1,5 @@
 #LyX 2.4 created this file. For more info see https://www.lyx.org/
-\lyxformat 595
+\lyxformat 596
 \begin_document
 \begin_header
 \save_transient_properties true
@@ -53,6 +53,9 @@
 
 % Trennausnahmen
 \hyphenation{Text-ei-gen-schaf-ten}
+% Added by lyx2lyx
+\setlength{\parskip}{\medskipamount}
+\setlength{\parindent}{0pt}
 \end_preamble
 \options 
refpage,intoc,bibliography=totoc,index=totoc,BCOR7.5mm,captions=tableheading
 \use_default_options false
@@ -142,8 +145,8 @@ logicalmkup
 \end_index
 \secnumdepth 3
 \tocdepth 2
-\paragraph_separation skip
-\defskip medskip
+\paragraph_separation indent
+\paragraph_indentation default
 \is_math_indent 0
 \math_numbering_side default
 \quotes_style german
@@ -12157,21 +12160,21 @@ Abstand
 \begin_layout Standard
 
 \family sans
-SmallSkip
+Klein
 \family default
 , 
 \family sans
-MedSkip
+Mittel
 \family default
  und 
 \family sans
-BigSkip
+Groß
 \family default
- sind \SpecialChar LaTeX
+ entsprechen \SpecialChar LaTeX
 -Größen, die von der Schriftgröße des Dokuments abhängen.
  
 \family sans
-DefSkip
+Standard
 \family default
  ist der Abstand, der im Dialog 
 \family sans
@@ -12192,16 +12195,30 @@ Dokument ! Einstellungen
  für die Absatztrennung eingestellt ist.
  Wenn Sie Absätze per Einrückung voneinander trennen, ist 
 \family sans
-DefSkip
+Standard
 \family default
  gleich 
 \family sans
-MedSkip
+Mittel
 \family default
 .
 \end_layout
 
 \begin_layout Standard
+
+\family sans
+Halbe Zeilenhöhe
+\family default
+ und 
+\family sans
+Zeilenhöhe
+\family default
+ entsprechen der Höhe (bzw.
+ der halben Höhe) einer Zeile in der gewählten Schriftgröße inklusive des
+ Zeilenabstands.
+\end_layout
+
+\begin_layout Standard
 Der 
 \family sans
 Abstand
diff --git a/lib/lyx2lyx/lyx_2_4.py b/lib/lyx2lyx/lyx_2_4.py
index 4e2533c..d4e8b0a 100644
--- a/lib/lyx2lyx/lyx_2_4.py
+++ b/lib/lyx2lyx/lyx_2_4.py
@@ -3831,6 +3831,25 @@ def revert_parskip(document):
     document.header[j] = "\\paragraph_indentation default"
 
 
+def revert_line_vspaces(document):
+    " Revert fulline and halfline vspaces to TeX "
+    insets = {
+        "fullline*" : "\\vspace*{\\baselineskip}",
+        "fullline" : "\\vspace{\\baselineskip}",
+        "halfline*" : "\\vspace*{0.5\\baselineskip}",
+        "halfline" : "\\vspace{0.5\\baselineskip}",
+        }
+    for inset in insets.keys():
+        i = 0
+        j = 0
+        i = find_token(document.body, "\\begin_inset VSpace " + inset, i)
+        if i == -1:
+            continue
+        end = find_end_of_inset(document.body, i)
+        subst = put_cmd_in_ert(insets[inset])
+        document.body[i : end + 1] = subst
+
+
 ##
 # Conversion hub
 #
@@ -3891,7 +3910,7 @@ convert = [
            [596, [convert_parskip]]
           ]
 
-revert =  [[595, [revert_parskip]],
+revert =  [[595, [revert_parskip,revert_line_vspaces]],
            [594, [revert_ams_spaces]],
            [593, [revert_counter_inset]],
            [592, [revert_counter_maintenance]],
diff --git a/lib/ui/stdcontext.inc b/lib/ui/stdcontext.inc
index 2c28a85..0a2cbda 100644
--- a/lib/ui/stdcontext.inc
+++ b/lib/ui/stdcontext.inc
@@ -292,6 +292,8 @@ Menuset
                Item "SmallSkip|S" "inset-modify vspace smallskip"
                Item "MedSkip|M" "inset-modify vspace medskip"
                Item "BigSkip|B" "inset-modify vspace bigskip"
+               Item "Half line height|H" "inset-modify vspace halfline"
+               Item "Line height|L" "inset-modify vspace fullline"
                Item "VFill|F" "inset-modify vspace vfill"
                Item "Custom|C" "command-sequence inset-modify vspace custom; 
inset-settings"
                Separator
diff --git a/src/frontends/qt/GuiVSpace.cpp b/src/frontends/qt/GuiVSpace.cpp
index cbd0265..96fa016 100644
--- a/src/frontends/qt/GuiVSpace.cpp
+++ b/src/frontends/qt/GuiVSpace.cpp
@@ -66,7 +66,7 @@ GuiVSpace::GuiVSpace(QWidget * parent) : 
InsetParamsWidget(parent)
 
 void GuiVSpace::enableCustom(int selection)
 {
-       bool const enable = selection == 5;
+       bool const enable = selection == 7;
        valueLE->setEnabled(enable);
        if (enable)
                valueLE->setFocus();
@@ -96,15 +96,17 @@ static void setWidgetsFromVSpace(VSpace const & space,
                case VSpace::BIGSKIP:
                        item = 3;
                        break;
-               case VSpace::VFILL:
+               case VSpace::HALFLINE:
                        item = 4;
                        break;
-               case VSpace::LENGTH:
+               case VSpace::FULLLINE:
                        item = 5;
                        break;
-               case VSpace::HALFLINE:
-               case VSpace::FULLLINE:
-                       // not supported here yet
+               case VSpace::VFILL:
+                       item = 6;
+                       break;
+               case VSpace::LENGTH:
+                       item = 7;
                        break;
        }
        spacing->setCurrentIndex(item);
@@ -131,12 +133,30 @@ static VSpace setVSpaceFromWidgets(int spacing,
        VSpace space;
 
        switch (spacing) {
-               case 0: space = VSpace(VSpace::DEFSKIP); break;
-               case 1: space = VSpace(VSpace::SMALLSKIP); break;
-               case 2: space = VSpace(VSpace::MEDSKIP); break;
-               case 3: space = VSpace(VSpace::BIGSKIP); break;
-               case 4: space = VSpace(VSpace::VFILL); break;
-               case 5: space = VSpace(GlueLength(widgetsToLength(value, 
unit))); break;
+               case 0:
+                       space = VSpace(VSpace::DEFSKIP);
+                       break;
+               case 1:
+                       space = VSpace(VSpace::SMALLSKIP);
+                       break;
+               case 2:
+                       space = VSpace(VSpace::MEDSKIP);
+                       break;
+               case 3:
+                       space = VSpace(VSpace::BIGSKIP);
+                       break;
+               case 4:
+                       space = VSpace(VSpace::HALFLINE);
+                       break;
+               case 5:
+                       space = VSpace(VSpace::FULLLINE);
+                       break;
+               case 6:
+                       space = VSpace(VSpace::VFILL);
+                       break;
+               case 7:
+                       space = VSpace(GlueLength(widgetsToLength(value, 
unit)));
+                       break;
        }
 
        space.setKeep(keep);
@@ -148,7 +168,7 @@ docstring GuiVSpace::dialogToParams() const
 {
        // If a vspace choice is "Length" but there's no text in
        // the input field, do not insert a vspace at all.
-       if (spacingCO->currentIndex() == 5 && valueLE->text().isEmpty())
+       if (spacingCO->currentIndex() == 7 && valueLE->text().isEmpty())
                return docstring();
 
        VSpace const params = setVSpaceFromWidgets(spacingCO->currentIndex(),
@@ -175,7 +195,7 @@ bool GuiVSpace::checkWidgets(bool readonly) const
                spacingCO->setEnabled(false);
                unitCO->setEnabled(false);
        } else {
-               bool const enable = (spacingCO->currentIndex() == 5);
+               bool const enable = (spacingCO->currentIndex() == 7);
                valueLE->setEnabled(enable);
                valueL->setEnabled(enable);
                unitCO->setEnabled(enable);
diff --git a/src/frontends/qt/ui/VSpaceUi.ui b/src/frontends/qt/ui/VSpaceUi.ui
index 0e4a83d..847c0df 100644
--- a/src/frontends/qt/ui/VSpaceUi.ui
+++ b/src/frontends/qt/ui/VSpaceUi.ui
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <ui version="4.0">
  <class>VSpaceUi</class>
  <widget class="QWidget" name="VSpaceUi">
@@ -5,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>215</width>
-    <height>96</height>
+    <width>288</width>
+    <height>118</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -99,6 +100,16 @@
      </item>
      <item>
       <property name="text">
+       <string>Half line height</string>
+      </property>
+     </item>
+     <item>
+      <property name="text">
+       <string>Line height</string>
+      </property>
+     </item>
+     <item>
+      <property name="text">
        <string>VFill</string>
       </property>
      </item>
diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp
index 4053ddb..fdcab63 100644
--- a/src/tex2lyx/text.cpp
+++ b/src/tex2lyx/text.cpp
@@ -5709,12 +5709,19 @@ void parse_text(Parser & p, ostream & os, unsigned 
flags, bool outer,
                                                } else if (unit == 
"\\bigskipamount") {
                                                        unit = "bigskip";
                                                        known_vspace = true;
+                                               } else if (length == 
"\\baselineskip") {
+                                                       unit = "fullline";
+                                                       known_vspace = true;
                                                } else if (unit == "\\fill") {
                                                        unit = "vfill";
                                                        known_vspace = true;
                                                }
                                        }
                                }
+                               if (value == 0.5 && t.cs()[0] != 'h' && unit == 
"\\baselineskip") {
+                                       unit = "halfline";
+                                       known_vspace = true;
+                               }
                                if (!known_hspace && !known_vspace) {
                                        switch (unitFromString(unit)) {
                                        case Length::SP:
-- 
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to