]> git.lyx.org Git - features.git/commitdiff
move space above/below from Paragraph into a separate vspace inset.
authorAndré Pönitz <poenitz@gmx.net>
Fri, 28 Nov 2003 15:53:34 +0000 (15:53 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Fri, 28 Nov 2003 15:53:34 +0000 (15:53 +0000)
Gui interaction mailer stuff by Angus...

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8149 a592a061-630c-0410-9148-cb99ea01b6c8

39 files changed:
src/BufferView_pimpl.C
src/ChangeLog
src/ParagraphParameters.C
src/ParagraphParameters.h
src/ParameterStruct.h
src/factory.C
src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlVSpace.C [new file with mode: 0644]
src/frontends/controllers/ControlVSpace.h [new file with mode: 0644]
src/frontends/controllers/Makefile.am
src/frontends/qt2/QParagraph.C
src/frontends/qt2/QParagraphDialog.C
src/frontends/qt2/QParagraphDialog.h
src/frontends/qt2/ui/QParagraphDialogBase.ui
src/frontends/xforms/ChangeLog
src/frontends/xforms/Dialogs.C
src/frontends/xforms/FormParagraph.C
src/frontends/xforms/FormVSpace.C [new file with mode: 0644]
src/frontends/xforms/FormVSpace.h [new file with mode: 0644]
src/frontends/xforms/Makefile.am
src/frontends/xforms/forms/Makefile.am
src/frontends/xforms/forms/form_paragraph.fd
src/frontends/xforms/forms/form_vspace.fd [new file with mode: 0644]
src/insets/ChangeLog
src/insets/Makefile.am
src/insets/inset.h
src/insets/insetvspace.C [new file with mode: 0644]
src/insets/insetvspace.h [new file with mode: 0644]
src/lfuns.h
src/lyxfunc.C
src/lyxtext.h
src/output_latex.C
src/paragraph.C
src/paragraph_funcs.C
src/rowpainter.C
src/rowpainter.h
src/text.C
src/text2.C
src/text3.C

index a73622b7e04a01d2cb1e200e1507efd03cf26abd..c499fbf572b1e21d8a26fb4d4b9820b010ff9133 100644 (file)
@@ -1286,13 +1286,7 @@ bool BufferView::Pimpl::insertInset(InsetOld * inset, string const & lout)
                bool hasLayout = tclass.hasLayout(lres);
 
                bv_->text()->setLayout(hasLayout ? lres : tclass.defaultLayoutName());
-
-               bv_->text()->setParagraph(
-                                  VSpace(VSpace::NONE), VSpace(VSpace::NONE),
-                                  Spacing(),
-                                  LYX_ALIGN_LAYOUT,
-                                  string(),
-                                  0);
+               bv_->text()->setParagraph(Spacing(), LYX_ALIGN_LAYOUT, string(), 0);
        }
        bv_->cursor().innerText()->insertInset(inset);
        unFreezeUndo();
index 08f1da8beca054a9cf02e8e6bc9f85e21e59641e..5729bcd7c6299b1a57801d656cda45f534d5073b 100644 (file)
@@ -1,4 +1,22 @@
 
+2003-11-28  André Pönitz  <poenitz@gmx.net>
+
+       * ParagraphParameters.[Ch]:
+       * ParameterStruct.h: remove space above/below from Paragraph to
+        InsetVSpace
+
+       * BufferView_pimpl.C:
+       * factory.C:
+       * lyxfunc.C:
+       * lyxtext.h:
+       * output_latex.C:
+       * paragraph.C:
+       * paragraph_funcs.C:
+       * rowpainter.[Ch]:
+       * text.C:
+       * text2.C:
+       * text3.C: adjust
+
 2003-11-28  Martin Vermeer  <martin.vermeer@hut.fi>
 
        * factory.C: Syntax change for CharStyles
index bd329198acf6531a6bbf44a30f4ab7b86743efc1..e40c14dad98fb6bed7dc76246631cadc1d77dcd7 100644 (file)
@@ -52,8 +52,6 @@ ParagraphParameters::ParagraphParameters()
 void ParagraphParameters::clear()
 {
        ParameterStruct tmp(*param);
-       tmp.added_space_top = VSpace(VSpace::NONE);
-       tmp.added_space_bottom = VSpace(VSpace::NONE);
        tmp.spacing.set(Spacing::Default);
        tmp.align = LYX_ALIGN_LAYOUT;
        tmp.depth = 0;
@@ -74,8 +72,6 @@ ParagraphParameters::depth_type ParagraphParameters::depth() const
 bool ParagraphParameters::sameLayout(ParagraphParameters const & pp) const
 {
        return param->align == pp.param->align &&
-               param->added_space_bottom == pp.param->added_space_bottom &&
-               param->added_space_top == pp.param->added_space_top &&
                param->spacing == pp.param->spacing &&
                param->noindent == pp.param->noindent &&
                param->depth == pp.param->depth;
@@ -89,34 +85,6 @@ void ParagraphParameters::set_from_struct(ParameterStruct const & ps)
 }
 
 
-VSpace const & ParagraphParameters::spaceTop() const
-{
-       return param->added_space_top;
-}
-
-
-void ParagraphParameters::spaceTop(VSpace const & vs)
-{
-       ParameterStruct tmp(*param);
-       tmp.added_space_top = vs;
-       set_from_struct(tmp);
-}
-
-
-VSpace const & ParagraphParameters::spaceBottom() const
-{
-       return param->added_space_bottom;
-}
-
-
-void ParagraphParameters::spaceBottom(VSpace const & vs)
-{
-       ParameterStruct tmp(*param);
-       tmp.added_space_bottom = vs;
-       set_from_struct(tmp);
-}
-
-
 Spacing const & ParagraphParameters::spacing() const
 {
        return param->spacing;
@@ -257,10 +225,6 @@ void ParagraphParameters::read(LyXLex & lex)
                        lex.nextToken();
                        LyXLength value(lex.getString());
                        leftIndent(value);
-               } else if (token == "\\fill_top") {
-                       spaceTop(VSpace(VSpace::VFILL));
-               } else if (token == "\\fill_bottom") {
-                       spaceBottom(VSpace(VSpace::VFILL));
                } else if (token == "\\start_of_appendix") {
                        startOfAppendix(true);
                } else if (token == "\\paragraph_spacing") {
@@ -284,24 +248,6 @@ void ParagraphParameters::read(LyXLex & lex)
                        if (tmpret == -1)
                                ++tmpret;
                        align(LyXAlignment(1 << tmpret));
-               } else if (token == "\\added_space_top") {
-                       lex.nextToken();
-                       VSpace value = VSpace(lex.getString());
-                       // only add the length when value > 0 or
-                       // with option keep
-                       if ((value.length().len().value() != 0) ||
-                           value.keep() ||
-                           (value.kind() != VSpace::LENGTH))
-                               spaceTop(value);
-               } else if (token == "\\added_space_bottom") {
-                       lex.nextToken();
-                       VSpace value = VSpace(lex.getString());
-                       // only add the length when value > 0 or
-                       // with option keep
-                       if ((value.length().len().value() != 0) ||
-                          value.keep() ||
-                           (value.kind() != VSpace::LENGTH))
-                               spaceBottom(value);
                } else if (token == "\\labelwidthstring") {
                        lex.eatLine();
                        labelWidthString(lex.getString());
@@ -315,14 +261,6 @@ void ParagraphParameters::read(LyXLex & lex)
 
 void ParagraphParameters::write(ostream & os) const
 {
-       // Maybe some vertical spaces.
-       if (spaceTop().kind() != VSpace::NONE)
-               os << "\\added_space_top "
-                  << spaceTop().asLyXCommand() << ' ';
-       if (spaceBottom().kind() != VSpace::NONE)
-               os << "\\added_space_bottom "
-                  << spaceBottom().asLyXCommand() << ' ';
-
        // Maybe the paragraph has special spacing
        spacing().writeFile(os, true);
 
@@ -358,7 +296,6 @@ void ParagraphParameters::write(ostream & os) const
 }
 
 
-
 void setParagraphParams(BufferView & bv, string const & data)
 {
        istringstream is(data);
@@ -370,8 +307,6 @@ void setParagraphParams(BufferView & bv, string const & data)
 
        LyXText * text = bv.getLyXText();
        text->setParagraph(
-                          params.spaceTop(),
-                          params.spaceBottom(),
                           params.spacing(),
                           params.align(),
                           params.labelWidthString(),
index 66d23e6485d5f7d1adb8db22e010a57996c27576..c4910b74e3dea0ccf970a38908b39cb9ccbbf100 100644 (file)
@@ -28,7 +28,6 @@ class LyXLex;
 class Paragraph;
 class ParameterStruct;
 class Spacing;
-class VSpace;
 
 ///
 class ParagraphParameters {
@@ -40,14 +39,6 @@ public:
        ///
        bool sameLayout(ParagraphParameters const &) const;
        ///
-       VSpace const & spaceTop() const;
-       ///
-       void spaceTop(VSpace const &);
-       ///
-       VSpace const & spaceBottom() const;
-       ///
-       void spaceBottom(VSpace const &);
-       ///
        Spacing const & spacing() const;
        ///
        void spacing(Spacing const &);
index 902b2222b3de399fdfc419021ac0e8a39d183bdb..5b0543e44152976974e69db258b879a212f276f1 100644 (file)
@@ -15,7 +15,6 @@
 #include "layout.h"
 #include "lyxlength.h"
 #include "Spacing.h"
-#include "vspace.h"
 
 #include "support/types.h"
 
@@ -27,10 +26,6 @@ struct ParameterStruct {
        ///
        ParameterStruct();
        ///
-       VSpace added_space_top;
-       ///
-       VSpace added_space_bottom;
-       ///
        Spacing spacing;
        ///
        bool noindent;
@@ -63,9 +58,8 @@ inline
 bool operator==(ParameterStruct const & ps1,
                ParameterStruct const & ps2)
 {
-       return ps1.added_space_top == ps2.added_space_top
-               && ps1.added_space_bottom == ps2.added_space_bottom
-               && ps1.spacing == ps2.spacing
+       return
+                  ps1.spacing == ps2.spacing
                && ps1.noindent == ps2.noindent
                && ps1.align == ps2.align
                && ps1.depth == ps2.depth
index d69aad7c2f715c223ef313822998916bf289fbd8..08a831e816b57e9afb7650cd8f7e86461cc0f62d 100644 (file)
@@ -51,6 +51,7 @@
 #include "insets/insettabular.h"
 #include "insets/insettoc.h"
 #include "insets/inseturl.h"
+#include "insets/insetvspace.h"
 #include "insets/insetwrap.h"
 #include "mathed/formulamacro.h"
 #include "mathed/formula.h"
@@ -174,7 +175,7 @@ InsetOld * createInset(FuncRequest const & cmd)
        case LFUN_TABULAR_INSERT:
                if (!cmd.argument.empty()) {
                        std::istringstream ss(cmd.argument);
-                       int r, c;
+                       int r = 0, c = 0;
                        ss >> r >> c;
                        if (r <= 0) r = 2;
                        if (c <= 0) c = 2;
@@ -184,7 +185,7 @@ InsetOld * createInset(FuncRequest const & cmd)
                return 0;
 
        case LFUN_INSET_CAPTION: 
-       if (bv->innerInset()) {
+       if (!bv->innerInset()) {
                auto_ptr<InsetCaption> inset(new InsetCaption(params));
                inset->setOwner(bv->innerInset());
                inset->setAutoBreakRows(true);
@@ -192,6 +193,7 @@ InsetOld * createInset(FuncRequest const & cmd)
                inset->setFrameColor(LColor::captionframe);
                return inset.release();
        }
+       return 0;
 
        case LFUN_INDEX_PRINT:
                return new InsetPrintIndex(InsetCommandParams("printindex"));
@@ -280,6 +282,11 @@ InsetOld * createInset(FuncRequest const & cmd)
                        InsetCommandParams icp;
                        InsetCommandMailer::string2params(cmd.argument, icp);
                        return new InsetUrl(icp);
+
+               } else if (name == "vspace") {
+                       VSpace vspace;
+                       InsetVSpaceMailer::string2params(cmd.argument, vspace);
+                       return new InsetVSpace(vspace);
                }
        }
 
@@ -423,6 +430,8 @@ InsetOld * readInset(LyXLex & lex, Buffer const & buf)
                        inset.reset(new InsetTabular(buf));
                } else if (tmptok == "Text") {
                        inset.reset(new InsetText(buf.params()));
+               } else if (tmptok == "VSpace") {
+                       inset.reset(new InsetVSpace);
                } else if (tmptok == "Foot") {
                        inset.reset(new InsetFoot(buf.params()));
                } else if (tmptok == "Marginal") {
index 13b213ab57387c2677e59e46f5a336ae07efe839..2062907e99be766a44bfe8bbcd5904948bb9b77f 100644 (file)
@@ -1,3 +1,9 @@
+
+2003-11-28  André Pönitz  <poenitz@gmx.net>
+
+       * ControlVSpace.[Ch]: new files
+       * Makefile.am: adjust
+
 2003-11-21  Michael Schmitt  <michael.schmitt@teststep.org>
 
        * ControlDocument.C: Change call to insetsOpenCloseBranch
diff --git a/src/frontends/controllers/ControlVSpace.C b/src/frontends/controllers/ControlVSpace.C
new file mode 100644 (file)
index 0000000..2a7599d
--- /dev/null
@@ -0,0 +1,58 @@
+/**
+ * \file ControlVSpace.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Edwin Leuven
+ * \author Angus Leeming
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "ControlVSpace.h"
+
+#include "funcrequest.h"
+#include "insets/insetvspace.h"
+
+
+using std::istringstream;
+using std::string;
+
+
+ControlVSpace::ControlVSpace(Dialog & parent)
+       : Dialog::Controller(parent)
+{}
+
+
+bool ControlVSpace::initialiseParams(string const & data)
+{
+       InsetVSpaceMailer::string2params(data, params_);
+       return true;
+}
+
+
+void ControlVSpace::clearParams()
+{
+       params_ = VSpace();
+}
+
+
+void ControlVSpace::dispatchParams()
+{
+       string const str = InsetVSpaceMailer::params2string(params_);
+       kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, str));
+}
+
+
+VSpace & ControlVSpace::params()
+{
+       return params_;
+}
+
+
+VSpace const & ControlVSpace::params() const
+{
+       return params_;
+}
diff --git a/src/frontends/controllers/ControlVSpace.h b/src/frontends/controllers/ControlVSpace.h
new file mode 100644 (file)
index 0000000..108afae
--- /dev/null
@@ -0,0 +1,44 @@
+// -*- C++ -*-
+/**
+ * \file ControlVSpace.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Edwin Leuven
+ * \author André Pönitz
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef CONTROLVSPACE_H
+#define CONTROLVSPACE_H
+
+#include "Dialog.h"
+#include "vspace.h"
+
+
+class ControlVSpace : public Dialog::Controller {
+public:
+       ///
+       ControlVSpace(Dialog &);
+       ///
+       virtual bool initialiseParams(std::string const & data);
+       /// clean-up on hide.
+       virtual void clearParams();
+       /// clean-up on hide.
+       virtual void dispatchParams();
+       ///
+       virtual bool isBufferDependent() const { return true; }
+       ///
+       VSpace & params();
+       ///
+       VSpace const & params() const;
+       ///
+       bool inInset() const;
+
+private:
+       ///
+       VSpace params_;
+};
+
+#endif // CONTROLPARAGRAPH_H
index 770c03de90a351b1bffec5994861a5b45f4f25f4..988bc21f7f3fe1cb121fc03f7ddbcb3c5644b1fe 100644 (file)
@@ -104,6 +104,8 @@ libcontrollers_la_SOURCES= \
        ControlToc.h \
        ControlVCLog.C \
        ControlVCLog.h \
+       ControlVSpace.C \
+       ControlVSpace.h \
        ControlWrap.C \
        ControlWrap.h \
        GUI.h \
index da8a7ab64a5c370950fbf2e3d6479d576545c14a..232835fad69c84b27defcd60d643b2853b655a45 100644 (file)
@@ -65,103 +65,18 @@ void QParagraph::build_dialog()
                          bind2nd(contains_functor(), "%"));
        units_.erase(del, units_.end());
 
-       for (vector<string>::const_iterator it = units_.begin();
-               it != units_.end(); ++it) {
-               dialog_->unitAbove->insertItem(toqstr(*it));
-               dialog_->unitBelow->insertItem(toqstr(*it));
-       }
-
        // Manage the ok, apply, restore and cancel/close buttons
        bcview().setOK(dialog_->okPB);
        bcview().setApply(dialog_->applyPB);
        bcview().setCancel(dialog_->closePB);
        bcview().setRestore(dialog_->restorePB);
-       bcview().addReadOnly(dialog_->paragraphTab);
 }
 
 
-namespace {
-
-VSpace setVSpaceFromWidgets(int spacing,
-                           string value,
-                           string unit,
-                           bool keep)
-{
-       VSpace space;
-
-       switch (spacing) {
-       case 0:
-               space = VSpace(VSpace::NONE);
-               break;
-       case 1:
-               space = VSpace(VSpace::DEFSKIP);
-               break;
-       case 2:
-               space = VSpace(VSpace::SMALLSKIP);
-               break;
-       case 3:
-               space = VSpace(VSpace::MEDSKIP);
-               break;
-       case 4:
-               space = VSpace(VSpace::BIGSKIP);
-               break;
-       case 5:
-               space = VSpace(VSpace::VFILL);
-               break;
-       case 6:
-               string s;
-               string const length = trim(value);
-               if (isValidGlueLength(length)) {
-                       s = length;
-               } else if (!length.empty()){
-                       string u = trim(unit);
-                       u = subst(u, "%%", "%");
-                       s = length + u;
-               }
-               space = VSpace(LyXGlueLength(s));
-               break;
-       }
-
-       space.setKeep(keep);
-
-       return space;
-}
-
-} // namespace anon
-
-
 void QParagraph::apply()
 {
        ParagraphParameters & params = controller().params();
 
-       // SPACING ABOVE
-       // If a vspace kind is "Length" but there's no text in
-       // the input field, reset the kind to "None".
-       if (dialog_->spacingAbove->currentItem() == 6
-           && dialog_->valueAbove->text().isEmpty())
-               dialog_->spacingAbove->setCurrentItem(0);
-
-       VSpace const space_top =
-               setVSpaceFromWidgets(dialog_->spacingAbove->currentItem(),
-                                    fromqstr(dialog_->valueAbove->text()),
-                                    fromqstr(dialog_->unitAbove->currentText()),
-                                    dialog_->keepAbove->isChecked());
-
-       params.spaceTop(space_top);
-
-       // SPACING BELOW
-       if (dialog_->spacingBelow->currentItem() == 6
-           && dialog_->valueBelow->text().isEmpty())
-               dialog_->spacingBelow->setCurrentItem(0);
-
-       VSpace const space_bottom =
-       setVSpaceFromWidgets(dialog_->spacingBelow->currentItem(),
-                            fromqstr(dialog_->valueBelow->text()),
-                            fromqstr(dialog_->unitBelow->currentText()),
-                            dialog_->keepBelow->isChecked());
-
-       params.spaceBottom(space_bottom);
-
        // alignment
        LyXAlignment align;
        switch (dialog_->align->currentItem()) {
@@ -211,81 +126,8 @@ void QParagraph::apply()
        params.labelWidthString(fromqstr(dialog_->labelWidth->text()));
        // indendation
        params.noindent(!dialog_->indentCB->isChecked());
-
-}
-
-
-namespace {
-
-void setWidgetsFromVSpace(VSpace const & space,
-                         QComboBox * spacing,
-                         QLineEdit * value,
-                         QComboBox * unit,
-                         QCheckBox * keep, vector<string> units_)
-{
-       value->setText("");
-       value->setEnabled(false);
-       unit->setEnabled(false);
-
-       int item = 0;
-       switch (space.kind()) {
-       case VSpace::NONE:
-               item = 0;
-               break;
-       case VSpace::DEFSKIP:
-               item = 1;
-               break;
-       case VSpace::SMALLSKIP:
-               item = 2;
-               break;
-       case VSpace::MEDSKIP:
-               item = 3;
-               break;
-       case VSpace::BIGSKIP:
-               item = 4;
-               break;
-       case VSpace::VFILL:
-               item = 5;
-               break;
-       case VSpace::LENGTH:
-               item = 6;
-               value->setEnabled(true);
-               unit->setEnabled(true);
-               string length = space.length().asString();
-               string const default_unit =
-                       (lyxrc.default_papersize > 3) ? "cm" : "in";
-               string supplied_unit = default_unit;
-               LyXLength len(length);
-               if ((isValidLength(length)
-                    || isStrDbl(length)) && !len.zero()) {
-                       length = tostr(len.value());
-                       supplied_unit = subst(stringFromUnit(len.unit()),
-                                             "%", "%%");
-               }
-
-               int unit_item = 0;
-               int i = 0;
-               for (vector<string>::const_iterator it = units_.begin();
-                    it != units_.end(); ++it) {
-                       if (*it == default_unit) {
-                               unit_item = i;
-                       }
-                       if (*it == supplied_unit) {
-                               unit_item = i;
-                               break;
-                       }
-                       i += 1;
-               }
-               value->setText(toqstr(length));
-               unit->setCurrentItem(unit_item);
-               break;
-       }
-       spacing->setCurrentItem(item);
-       keep->setChecked(space.keep());
 }
 
-} // namespace anon
-
 
 void QParagraph::update_contents()
 {
@@ -354,18 +196,4 @@ void QParagraph::update_contents()
                dialog_->linespacingValue->setText("");
                dialog_->linespacingValue->setEnabled(false);
        }
-
-       // vspace top
-       setWidgetsFromVSpace(params.spaceTop(),
-                            dialog_->spacingAbove,
-                            dialog_->valueAbove,
-                            dialog_->unitAbove,
-                            dialog_->keepAbove,units_);
-
-       // vspace bottom
-       setWidgetsFromVSpace(params.spaceBottom(),
-                            dialog_->spacingBelow,
-                            dialog_->valueBelow,
-                            dialog_->unitBelow,
-                            dialog_->keepBelow,units_);
 }
index e3a8420d3a50f83e40177a4865fe2e990a4dc3e5..78b6dcfbe2d634168d424cfd54b20334ea4bfb26 100644 (file)
@@ -64,23 +64,6 @@ void QParagraphDialog::change_adaptor()
 }
 
 
-void QParagraphDialog::enableAbove(int)
-{
-       bool const enable = spacingAbove->currentItem()==6;
-       valueAbove->setEnabled(enable);
-       unitAbove->setEnabled(enable);
-
-}
-
-
-void QParagraphDialog::enableBelow(int)
-{
-       bool const enable = spacingBelow->currentItem()==6;
-       valueBelow->setEnabled(enable);
-       unitBelow->setEnabled(enable);
-}
-
-
 void QParagraphDialog::enableLinespacingValue(int)
 {
        bool const enable = linespacing->currentItem()==4;
index e25611848e01c4c974fc94a6ad644634305b331b..b85b1b78929c5b6f953622eb5ea90953e3e5e8e1 100644 (file)
@@ -28,8 +28,6 @@ private:
        QParagraph * form_;
 protected slots:
        void change_adaptor();
-       void enableAbove(int);
-       void enableBelow(int);
        void enableLinespacingValue(int);
 };
 
index 713b8cd5725f38ef583a507a6771279bf8093210..6fa96151a997591ea7de4c4b4243bec67b5e443b 100644 (file)
@@ -13,8 +13,8 @@
         <rect>
             <x>0</x>
             <y>0</y>
-            <width>415</width>
-            <height>261</height>
+            <width>411</width>
+            <height>250</height>
         </rect>
     </property>
     <property stdset="1">
             <name>spacing</name>
             <number>6</number>
         </property>
+        <widget row="1"  column="1" >
+            <class>QComboBox</class>
+            <item>
+                <property>
+                    <name>text</name>
+                    <string>Default</string>
+                </property>
+            </item>
+            <item>
+                <property>
+                    <name>text</name>
+                    <string>Single</string>
+                </property>
+            </item>
+            <item>
+                <property>
+                    <name>text</name>
+                    <string>1.5</string>
+                </property>
+            </item>
+            <item>
+                <property>
+                    <name>text</name>
+                    <string>Double</string>
+                </property>
+            </item>
+            <item>
+                <property>
+                    <name>text</name>
+                    <string>Custom</string>
+                </property>
+            </item>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>linespacing</cstring>
+            </property>
+        </widget>
         <widget row="1"  column="0" >
+            <class>QLabel</class>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>linespacingL</cstring>
+            </property>
+            <property stdset="1">
+                <name>text</name>
+                <string>L&amp;ine spacing:</string>
+            </property>
+            <property>
+                <name>buddy</name>
+                <cstring>linespacing</cstring>
+            </property>
+        </widget>
+        <widget row="0"  column="1" >
+            <class>QComboBox</class>
+            <item>
+                <property>
+                    <name>text</name>
+                    <string>Justified</string>
+                </property>
+            </item>
+            <item>
+                <property>
+                    <name>text</name>
+                    <string>Left</string>
+                </property>
+            </item>
+            <item>
+                <property>
+                    <name>text</name>
+                    <string>Right</string>
+                </property>
+            </item>
+            <item>
+                <property>
+                    <name>text</name>
+                    <string>Center</string>
+                </property>
+            </item>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>align</cstring>
+            </property>
+        </widget>
+        <widget row="0"  column="0" >
+            <class>QLabel</class>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>alignL</cstring>
+            </property>
+            <property stdset="1">
+                <name>text</name>
+                <string>Alig&amp;nment:</string>
+            </property>
+            <property>
+                <name>buddy</name>
+                <cstring>align</cstring>
+            </property>
+        </widget>
+        <widget row="0"  column="2"  rowspan="2"  colspan="1" >
+            <class>QLayoutWidget</class>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>Layout4</cstring>
+            </property>
+            <vbox>
+                <property stdset="1">
+                    <name>margin</name>
+                    <number>0</number>
+                </property>
+                <property stdset="1">
+                    <name>spacing</name>
+                    <number>6</number>
+                </property>
+                <spacer>
+                    <property>
+                        <name>name</name>
+                        <cstring>Spacer3</cstring>
+                    </property>
+                    <property stdset="1">
+                        <name>orientation</name>
+                        <enum>Horizontal</enum>
+                    </property>
+                    <property stdset="1">
+                        <name>sizeType</name>
+                        <enum>Expanding</enum>
+                    </property>
+                    <property>
+                        <name>sizeHint</name>
+                        <size>
+                            <width>20</width>
+                            <height>20</height>
+                        </size>
+                    </property>
+                </spacer>
+                <widget>
+                    <class>QLineEdit</class>
+                    <property stdset="1">
+                        <name>name</name>
+                        <cstring>linespacingValue</cstring>
+                    </property>
+                    <property stdset="1">
+                        <name>enabled</name>
+                        <bool>false</bool>
+                    </property>
+                </widget>
+            </vbox>
+        </widget>
+        <widget row="2"  column="0"  rowspan="1"  colspan="3" >
+            <class>QLayoutWidget</class>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>Layout5</cstring>
+            </property>
+            <hbox>
+                <property stdset="1">
+                    <name>margin</name>
+                    <number>0</number>
+                </property>
+                <property stdset="1">
+                    <name>spacing</name>
+                    <number>6</number>
+                </property>
+                <widget>
+                    <class>QCheckBox</class>
+                    <property stdset="1">
+                        <name>name</name>
+                        <cstring>indentCB</cstring>
+                    </property>
+                    <property stdset="1">
+                        <name>text</name>
+                        <string>In&amp;dent paragraph</string>
+                    </property>
+                </widget>
+                <spacer>
+                    <property>
+                        <name>name</name>
+                        <cstring>Spacer14</cstring>
+                    </property>
+                    <property stdset="1">
+                        <name>orientation</name>
+                        <enum>Horizontal</enum>
+                    </property>
+                    <property stdset="1">
+                        <name>sizeType</name>
+                        <enum>Expanding</enum>
+                    </property>
+                    <property>
+                        <name>sizeHint</name>
+                        <size>
+                            <width>20</width>
+                            <height>20</height>
+                        </size>
+                    </property>
+                </spacer>
+            </hbox>
+        </widget>
+        <widget row="4"  column="0"  rowspan="1"  colspan="3" >
+            <class>QButtonGroup</class>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>labelwidthGB</cstring>
+            </property>
+            <property stdset="1">
+                <name>enabled</name>
+                <bool>false</bool>
+            </property>
+            <property stdset="1">
+                <name>title</name>
+                <string>Label Width</string>
+            </property>
+            <widget>
+                <class>QLabel</class>
+                <property stdset="1">
+                    <name>name</name>
+                    <cstring>TextLabel2</cstring>
+                </property>
+                <property stdset="1">
+                    <name>geometry</name>
+                    <rect>
+                        <x>11</x>
+                        <y>26</y>
+                        <width>84</width>
+                        <height>30</height>
+                    </rect>
+                </property>
+                <property stdset="1">
+                    <name>text</name>
+                    <string>Lo&amp;ngest label</string>
+                </property>
+                <property>
+                    <name>buddy</name>
+                    <cstring>labelWidth</cstring>
+                </property>
+                <property>
+                    <name>toolTip</name>
+                    <string>This text defines the width of the paragraph label</string>
+                </property>
+            </widget>
+            <widget>
+                <class>QLineEdit</class>
+                <property stdset="1">
+                    <name>name</name>
+                    <cstring>labelWidth</cstring>
+                </property>
+                <property stdset="1">
+                    <name>geometry</name>
+                    <rect>
+                        <x>101</x>
+                        <y>26</y>
+                        <width>275</width>
+                        <height>30</height>
+                    </rect>
+                </property>
+                <property>
+                    <name>toolTip</name>
+                    <string>This text defines the width of the paragraph label</string>
+                </property>
+            </widget>
+        </widget>
+        <widget row="6"  column="0"  rowspan="1"  colspan="3" >
             <class>QLayoutWidget</class>
             <property stdset="1">
                 <name>name</name>
                 </widget>
             </hbox>
         </widget>
-        <widget row="0"  column="0" >
-            <class>QTabWidget</class>
-            <property stdset="1">
-                <name>name</name>
-                <cstring>paragraphTab</cstring>
-            </property>
-            <property>
-                <name>toolTip</name>
-                <string></string>
-            </property>
-            <widget>
-                <class>QWidget</class>
-                <property stdset="1">
-                    <name>name</name>
-                    <cstring>tab</cstring>
-                </property>
-                <attribute>
-                    <name>title</name>
-                    <string>&amp;General</string>
-                </attribute>
-                <grid>
-                    <property stdset="1">
-                        <name>margin</name>
-                        <number>11</number>
-                    </property>
-                    <property stdset="1">
-                        <name>spacing</name>
-                        <number>6</number>
-                    </property>
-                    <spacer row="2"  column="2" >
-                        <property>
-                            <name>name</name>
-                            <cstring>Spacer4</cstring>
-                        </property>
-                        <property stdset="1">
-                            <name>orientation</name>
-                            <enum>Horizontal</enum>
-                        </property>
-                        <property stdset="1">
-                            <name>sizeType</name>
-                            <enum>Expanding</enum>
-                        </property>
-                        <property>
-                            <name>sizeHint</name>
-                            <size>
-                                <width>20</width>
-                                <height>20</height>
-                            </size>
-                        </property>
-                    </spacer>
-                    <widget row="2"  column="0"  rowspan="1"  colspan="2" >
-                        <class>QCheckBox</class>
-                        <property stdset="1">
-                            <name>name</name>
-                            <cstring>indentCB</cstring>
-                        </property>
-                        <property stdset="1">
-                            <name>text</name>
-                            <string>In&amp;dent paragraph</string>
-                        </property>
-                    </widget>
-                    <widget row="0"  column="2"  rowspan="2"  colspan="1" >
-                        <class>QLayoutWidget</class>
-                        <property stdset="1">
-                            <name>name</name>
-                            <cstring>Layout4</cstring>
-                        </property>
-                        <vbox>
-                            <property stdset="1">
-                                <name>margin</name>
-                                <number>0</number>
-                            </property>
-                            <property stdset="1">
-                                <name>spacing</name>
-                                <number>6</number>
-                            </property>
-                            <spacer>
-                                <property>
-                                    <name>name</name>
-                                    <cstring>Spacer3</cstring>
-                                </property>
-                                <property stdset="1">
-                                    <name>orientation</name>
-                                    <enum>Horizontal</enum>
-                                </property>
-                                <property stdset="1">
-                                    <name>sizeType</name>
-                                    <enum>Expanding</enum>
-                                </property>
-                                <property>
-                                    <name>sizeHint</name>
-                                    <size>
-                                        <width>20</width>
-                                        <height>20</height>
-                                    </size>
-                                </property>
-                            </spacer>
-                            <widget>
-                                <class>QLineEdit</class>
-                                <property stdset="1">
-                                    <name>name</name>
-                                    <cstring>linespacingValue</cstring>
-                                </property>
-                                <property stdset="1">
-                                    <name>enabled</name>
-                                    <bool>false</bool>
-                                </property>
-                            </widget>
-                        </vbox>
-                    </widget>
-                    <widget row="0"  column="0" >
-                        <class>QLabel</class>
-                        <property stdset="1">
-                            <name>name</name>
-                            <cstring>alignL</cstring>
-                        </property>
-                        <property stdset="1">
-                            <name>text</name>
-                            <string>Alig&amp;nment:</string>
-                        </property>
-                        <property>
-                            <name>buddy</name>
-                            <cstring>align</cstring>
-                        </property>
-                    </widget>
-                    <widget row="1"  column="0" >
-                        <class>QLabel</class>
-                        <property stdset="1">
-                            <name>name</name>
-                            <cstring>linespacingL</cstring>
-                        </property>
-                        <property stdset="1">
-                            <name>text</name>
-                            <string>L&amp;ine spacing:</string>
-                        </property>
-                        <property>
-                            <name>buddy</name>
-                            <cstring>linespacing</cstring>
-                        </property>
-                    </widget>
-                    <widget row="1"  column="1" >
-                        <class>QComboBox</class>
-                        <item>
-                            <property>
-                                <name>text</name>
-                                <string>Default</string>
-                            </property>
-                        </item>
-                        <item>
-                            <property>
-                                <name>text</name>
-                                <string>Single</string>
-                            </property>
-                        </item>
-                        <item>
-                            <property>
-                                <name>text</name>
-                                <string>1.5</string>
-                            </property>
-                        </item>
-                        <item>
-                            <property>
-                                <name>text</name>
-                                <string>Double</string>
-                            </property>
-                        </item>
-                        <item>
-                            <property>
-                                <name>text</name>
-                                <string>Custom</string>
-                            </property>
-                        </item>
-                        <property stdset="1">
-                            <name>name</name>
-                            <cstring>linespacing</cstring>
-                        </property>
-                    </widget>
-                    <widget row="0"  column="1" >
-                        <class>QComboBox</class>
-                        <item>
-                            <property>
-                                <name>text</name>
-                                <string>Justified</string>
-                            </property>
-                        </item>
-                        <item>
-                            <property>
-                                <name>text</name>
-                                <string>Left</string>
-                            </property>
-                        </item>
-                        <item>
-                            <property>
-                                <name>text</name>
-                                <string>Right</string>
-                            </property>
-                        </item>
-                        <item>
-                            <property>
-                                <name>text</name>
-                                <string>Center</string>
-                            </property>
-                        </item>
-                        <property stdset="1">
-                            <name>name</name>
-                            <cstring>align</cstring>
-                        </property>
-                    </widget>
-                    <widget row="4"  column="0"  rowspan="1"  colspan="3" >
-                        <class>QButtonGroup</class>
-                        <property stdset="1">
-                            <name>name</name>
-                            <cstring>labelwidthGB</cstring>
-                        </property>
-                        <property stdset="1">
-                            <name>enabled</name>
-                            <bool>false</bool>
-                        </property>
-                        <property stdset="1">
-                            <name>title</name>
-                            <string>Label Width</string>
-                        </property>
-                        <hbox>
-                            <property stdset="1">
-                                <name>margin</name>
-                                <number>11</number>
-                            </property>
-                            <property stdset="1">
-                                <name>spacing</name>
-                                <number>6</number>
-                            </property>
-                            <widget>
-                                <class>QLabel</class>
-                                <property stdset="1">
-                                    <name>name</name>
-                                    <cstring>TextLabel2</cstring>
-                                </property>
-                                <property stdset="1">
-                                    <name>text</name>
-                                    <string>Lo&amp;ngest label</string>
-                                </property>
-                                <property>
-                                    <name>buddy</name>
-                                    <cstring>labelWidth</cstring>
-                                </property>
-                                <property>
-                                    <name>toolTip</name>
-                                    <string>This text defines the width of the paragraph label</string>
-                                </property>
-                            </widget>
-                            <widget>
-                                <class>QLineEdit</class>
-                                <property stdset="1">
-                                    <name>name</name>
-                                    <cstring>labelWidth</cstring>
-                                </property>
-                                <property>
-                                    <name>toolTip</name>
-                                    <string>This text defines the width of the paragraph label</string>
-                                </property>
-                            </widget>
-                        </hbox>
-                    </widget>
-                    <spacer row="3"  column="1" >
-                        <property>
-                            <name>name</name>
-                            <cstring>Spacer40</cstring>
-                        </property>
-                        <property stdset="1">
-                            <name>orientation</name>
-                            <enum>Vertical</enum>
-                        </property>
-                        <property stdset="1">
-                            <name>sizeType</name>
-                            <enum>Expanding</enum>
-                        </property>
-                        <property>
-                            <name>sizeHint</name>
-                            <size>
-                                <width>20</width>
-                                <height>20</height>
-                            </size>
-                        </property>
-                    </spacer>
-                </grid>
-            </widget>
-            <widget>
-                <class>QWidget</class>
-                <property stdset="1">
-                    <name>name</name>
-                    <cstring>tab</cstring>
-                </property>
-                <attribute>
-                    <name>title</name>
-                    <string>&amp;Spacing</string>
-                </attribute>
-                <grid>
-                    <property stdset="1">
-                        <name>margin</name>
-                        <number>11</number>
-                    </property>
-                    <property stdset="1">
-                        <name>spacing</name>
-                        <number>6</number>
-                    </property>
-                    <widget row="0"  column="1" >
-                        <class>QLabel</class>
-                        <property stdset="1">
-                            <name>name</name>
-                            <cstring>aboveL</cstring>
-                        </property>
-                        <property stdset="1">
-                            <name>text</name>
-                            <string>Above paragraph</string>
-                        </property>
-                        <property stdset="1">
-                            <name>alignment</name>
-                            <set>AlignVCenter|AlignLeft</set>
-                        </property>
-                        <property>
-                            <name>hAlign</name>
-                        </property>
-                    </widget>
-                    <widget row="1"  column="0" >
-                        <class>QLabel</class>
-                        <property stdset="1">
-                            <name>name</name>
-                            <cstring>spacingL</cstring>
-                        </property>
-                        <property stdset="1">
-                            <name>text</name>
-                            <string>S&amp;pacing:</string>
-                        </property>
-                        <property>
-                            <name>buddy</name>
-                            <cstring>spacingAbove</cstring>
-                        </property>
-                    </widget>
-                    <widget row="4"  column="0" >
-                        <class>QLabel</class>
-                        <property stdset="1">
-                            <name>name</name>
-                            <cstring>keepL</cstring>
-                        </property>
-                        <property stdset="1">
-                            <name>text</name>
-                            <string>&amp;Keep space:</string>
-                        </property>
-                        <property>
-                            <name>buddy</name>
-                            <cstring>keepAbove</cstring>
-                        </property>
-                        <property>
-                            <name>toolTip</name>
-                            <string>Include space even at the top/bottom of the page</string>
-                        </property>
-                    </widget>
-                    <widget row="3"  column="0" >
-                        <class>QLabel</class>
-                        <property stdset="1">
-                            <name>name</name>
-                            <cstring>unitL</cstring>
-                        </property>
-                        <property stdset="1">
-                            <name>text</name>
-                            <string>&amp;Unit:</string>
-                        </property>
-                        <property>
-                            <name>buddy</name>
-                            <cstring>unitAbove</cstring>
-                        </property>
-                    </widget>
-                    <widget row="2"  column="0" >
-                        <class>QLabel</class>
-                        <property stdset="1">
-                            <name>name</name>
-                            <cstring>valueL</cstring>
-                        </property>
-                        <property stdset="1">
-                            <name>text</name>
-                            <string>&amp;Value:</string>
-                        </property>
-                        <property>
-                            <name>buddy</name>
-                            <cstring>valueAbove</cstring>
-                        </property>
-                    </widget>
-                    <widget row="1"  column="1" >
-                        <class>QComboBox</class>
-                        <item>
-                            <property>
-                                <name>text</name>
-                                <string>None</string>
-                            </property>
-                        </item>
-                        <item>
-                            <property>
-                                <name>text</name>
-                                <string>DefSkip</string>
-                            </property>
-                        </item>
-                        <item>
-                            <property>
-                                <name>text</name>
-                                <string>SmallSkip</string>
-                            </property>
-                        </item>
-                        <item>
-                            <property>
-                                <name>text</name>
-                                <string>MedSkip</string>
-                            </property>
-                        </item>
-                        <item>
-                            <property>
-                                <name>text</name>
-                                <string>BigSkip</string>
-                            </property>
-                        </item>
-                        <item>
-                            <property>
-                                <name>text</name>
-                                <string>VFill</string>
-                            </property>
-                        </item>
-                        <item>
-                            <property>
-                                <name>text</name>
-                                <string>Custom</string>
-                            </property>
-                        </item>
-                        <property stdset="1">
-                            <name>name</name>
-                            <cstring>spacingAbove</cstring>
-                        </property>
-                    </widget>
-                    <widget row="1"  column="2" >
-                        <class>QComboBox</class>
-                        <item>
-                            <property>
-                                <name>text</name>
-                                <string>None</string>
-                            </property>
-                        </item>
-                        <item>
-                            <property>
-                                <name>text</name>
-                                <string>DefSkip</string>
-                            </property>
-                        </item>
-                        <item>
-                            <property>
-                                <name>text</name>
-                                <string>SmallSkip</string>
-                            </property>
-                        </item>
-                        <item>
-                            <property>
-                                <name>text</name>
-                                <string>MedSkip</string>
-                            </property>
-                        </item>
-                        <item>
-                            <property>
-                                <name>text</name>
-                                <string>BigSkip</string>
-                            </property>
-                        </item>
-                        <item>
-                            <property>
-                                <name>text</name>
-                                <string>VFill</string>
-                            </property>
-                        </item>
-                        <item>
-                            <property>
-                                <name>text</name>
-                                <string>Custom</string>
-                            </property>
-                        </item>
-                        <property stdset="1">
-                            <name>name</name>
-                            <cstring>spacingBelow</cstring>
-                        </property>
-                    </widget>
-                    <widget row="2"  column="1" >
-                        <class>QLineEdit</class>
-                        <property stdset="1">
-                            <name>name</name>
-                            <cstring>valueAbove</cstring>
-                        </property>
-                        <property stdset="1">
-                            <name>enabled</name>
-                            <bool>false</bool>
-                        </property>
-                    </widget>
-                    <widget row="2"  column="2" >
-                        <class>QLineEdit</class>
-                        <property stdset="1">
-                            <name>name</name>
-                            <cstring>valueBelow</cstring>
-                        </property>
-                        <property stdset="1">
-                            <name>enabled</name>
-                            <bool>false</bool>
-                        </property>
-                    </widget>
-                    <widget row="3"  column="1" >
-                        <class>QComboBox</class>
-                        <property stdset="1">
-                            <name>name</name>
-                            <cstring>unitAbove</cstring>
-                        </property>
-                        <property stdset="1">
-                            <name>enabled</name>
-                            <bool>false</bool>
-                        </property>
-                    </widget>
-                    <widget row="3"  column="2" >
-                        <class>QComboBox</class>
-                        <property stdset="1">
-                            <name>name</name>
-                            <cstring>unitBelow</cstring>
-                        </property>
-                        <property stdset="1">
-                            <name>enabled</name>
-                            <bool>false</bool>
-                        </property>
-                    </widget>
-                    <widget row="4"  column="1" >
-                        <class>QCheckBox</class>
-                        <property stdset="1">
-                            <name>name</name>
-                            <cstring>keepAbove</cstring>
-                        </property>
-                        <property stdset="1">
-                            <name>text</name>
-                            <string></string>
-                        </property>
-                        <property>
-                            <name>toolTip</name>
-                            <string>Include this space even at the top of a page</string>
-                        </property>
-                    </widget>
-                    <widget row="0"  column="2" >
-                        <class>QLabel</class>
-                        <property stdset="1">
-                            <name>name</name>
-                            <cstring>belowL</cstring>
-                        </property>
-                        <property stdset="1">
-                            <name>text</name>
-                            <string>Below paragraph</string>
-                        </property>
-                        <property stdset="1">
-                            <name>alignment</name>
-                            <set>AlignVCenter|AlignLeft</set>
-                        </property>
-                        <property>
-                            <name>hAlign</name>
-                        </property>
-                    </widget>
-                    <widget row="4"  column="2" >
-                        <class>QCheckBox</class>
-                        <property stdset="1">
-                            <name>name</name>
-                            <cstring>keepBelow</cstring>
-                        </property>
-                        <property stdset="1">
-                            <name>text</name>
-                            <string></string>
-                        </property>
-                        <property>
-                            <name>toolTip</name>
-                            <string>Include this space even at the bottom of a page</string>
-                        </property>
-                    </widget>
-                    <spacer row="0"  column="0" >
-                        <property>
-                            <name>name</name>
-                            <cstring>Spacer11</cstring>
-                        </property>
-                        <property stdset="1">
-                            <name>orientation</name>
-                            <enum>Horizontal</enum>
-                        </property>
-                        <property stdset="1">
-                            <name>sizeType</name>
-                            <enum>Expanding</enum>
-                        </property>
-                        <property>
-                            <name>sizeHint</name>
-                            <size>
-                                <width>20</width>
-                                <height>20</height>
-                            </size>
-                        </property>
-                    </spacer>
-                    <spacer row="5"  column="0" >
-                        <property>
-                            <name>name</name>
-                            <cstring>Spacer16</cstring>
-                        </property>
-                        <property stdset="1">
-                            <name>orientation</name>
-                            <enum>Vertical</enum>
-                        </property>
-                        <property stdset="1">
-                            <name>sizeType</name>
-                            <enum>Expanding</enum>
-                        </property>
-                        <property>
-                            <name>sizeHint</name>
-                            <size>
-                                <width>20</width>
-                                <height>20</height>
-                            </size>
-                        </property>
-                    </spacer>
-                    <spacer row="5"  column="1" >
-                        <property>
-                            <name>name</name>
-                            <cstring>Spacer17</cstring>
-                        </property>
-                        <property stdset="1">
-                            <name>orientation</name>
-                            <enum>Vertical</enum>
-                        </property>
-                        <property stdset="1">
-                            <name>sizeType</name>
-                            <enum>Expanding</enum>
-                        </property>
-                        <property>
-                            <name>sizeHint</name>
-                            <size>
-                                <width>20</width>
-                                <height>20</height>
-                            </size>
-                        </property>
-                    </spacer>
-                    <spacer row="5"  column="2" >
-                        <property>
-                            <name>name</name>
-                            <cstring>Spacer18</cstring>
-                        </property>
-                        <property stdset="1">
-                            <name>orientation</name>
-                            <enum>Vertical</enum>
-                        </property>
-                        <property stdset="1">
-                            <name>sizeType</name>
-                            <enum>Expanding</enum>
-                        </property>
-                        <property>
-                            <name>sizeHint</name>
-                            <size>
-                                <width>20</width>
-                                <height>20</height>
-                            </size>
-                        </property>
-                    </spacer>
-                </grid>
-            </widget>
-        </widget>
     </grid>
 </widget>
 <connections>
-    <connection>
-        <sender>align</sender>
-        <signal>activated(int)</signal>
-        <receiver>QParagraphDialogBase</receiver>
-        <slot>change_adaptor()</slot>
-    </connection>
-    <connection>
-        <sender>linespacing</sender>
-        <signal>activated(int)</signal>
-        <receiver>QParagraphDialogBase</receiver>
-        <slot>change_adaptor()</slot>
-    </connection>
-    <connection>
-        <sender>linespacing</sender>
-        <signal>activated(int)</signal>
-        <receiver>QParagraphDialogBase</receiver>
-        <slot>enableLinespacingValue(int)</slot>
-    </connection>
-    <connection>
-        <sender>linespacingValue</sender>
-        <signal>textChanged(const QString&amp;)</signal>
-        <receiver>QParagraphDialogBase</receiver>
-        <slot>change_adaptor()</slot>
-    </connection>
-    <connection>
-        <sender>indentCB</sender>
-        <signal>toggled(bool)</signal>
-        <receiver>QParagraphDialogBase</receiver>
-        <slot>change_adaptor()</slot>
-    </connection>
-    <connection>
-        <sender>spacingAbove</sender>
-        <signal>activated(int)</signal>
-        <receiver>QParagraphDialogBase</receiver>
-        <slot>change_adaptor()</slot>
-    </connection>
-    <connection>
-        <sender>spacingAbove</sender>
-        <signal>activated(int)</signal>
-        <receiver>QParagraphDialogBase</receiver>
-        <slot>enableAbove(int)</slot>
-    </connection>
-    <connection>
-        <sender>valueAbove</sender>
-        <signal>textChanged(const QString&amp;)</signal>
-        <receiver>QParagraphDialogBase</receiver>
-        <slot>change_adaptor()</slot>
-    </connection>
-    <connection>
-        <sender>unitAbove</sender>
-        <signal>activated(int)</signal>
-        <receiver>QParagraphDialogBase</receiver>
-        <slot>change_adaptor()</slot>
-    </connection>
-    <connection>
-        <sender>keepAbove</sender>
-        <signal>toggled(bool)</signal>
-        <receiver>QParagraphDialogBase</receiver>
-        <slot>change_adaptor()</slot>
-    </connection>
-    <connection>
-        <sender>spacingBelow</sender>
-        <signal>activated(int)</signal>
-        <receiver>QParagraphDialogBase</receiver>
-        <slot>enableBelow(int)</slot>
-    </connection>
-    <connection>
-        <sender>spacingBelow</sender>
-        <signal>activated(int)</signal>
-        <receiver>QParagraphDialogBase</receiver>
-        <slot>change_adaptor()</slot>
-    </connection>
-    <connection>
-        <sender>valueBelow</sender>
-        <signal>textChanged(const QString&amp;)</signal>
-        <receiver>QParagraphDialogBase</receiver>
-        <slot>change_adaptor()</slot>
-    </connection>
-    <connection>
-        <sender>valueBelow</sender>
-        <signal>textChanged(const QString&amp;)</signal>
-        <receiver>QParagraphDialogBase</receiver>
-        <slot>change_adaptor()</slot>
-    </connection>
-    <connection>
-        <sender>unitBelow</sender>
-        <signal>activated(int)</signal>
-        <receiver>QParagraphDialogBase</receiver>
-        <slot>change_adaptor()</slot>
-    </connection>
-    <connection>
-        <sender>keepBelow</sender>
-        <signal>toggled(bool)</signal>
-        <receiver>QParagraphDialogBase</receiver>
-        <slot>change_adaptor()</slot>
-    </connection>
     <slot access="protected">change_adaptor()</slot>
     <slot access="protected">enableLinespacingValue(int)</slot>
     <slot access="protected">enableAbove(int)</slot>
     <slot access="protected">enableBelow(int)</slot>
 </connections>
 <tabstops>
-    <tabstop>paragraphTab</tabstop>
-    <tabstop>align</tabstop>
-    <tabstop>linespacing</tabstop>
-    <tabstop>linespacingValue</tabstop>
-    <tabstop>indentCB</tabstop>
-    <tabstop>spacingAbove</tabstop>
-    <tabstop>valueAbove</tabstop>
-    <tabstop>unitAbove</tabstop>
-    <tabstop>keepAbove</tabstop>
-    <tabstop>spacingBelow</tabstop>
-    <tabstop>valueBelow</tabstop>
-    <tabstop>unitBelow</tabstop>
-    <tabstop>keepBelow</tabstop>
     <tabstop>restorePB</tabstop>
     <tabstop>okPB</tabstop>
     <tabstop>applyPB</tabstop>
index 184c644d83d50f625f04b2cb709d78097aa1218e..023a0bcd4c20aaa87f6306a7facdf0a7bf9b0603 100644 (file)
@@ -1,3 +1,9 @@
+
+2003-11-28  André Pönitz  <poenitz@gmx.net>
+
+       * FormsVSpace.[Ch]: new file
+       * forms/form_vspace.fd: new file
+
 2003-11-14  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
 
        * forms/form_maths_panel.fd (label): replace label "Greek" by
index 776e6d8ba29b55c2fb52e53c6f1cc29b64cef78d..5cafa29dd2f48554c38f7e95b7f0e1f9ff341ec5 100644 (file)
@@ -37,6 +37,7 @@
 #include "ControlTabularCreate.h"
 #include "ControlToc.h"
 #include "ControlVCLog.h"
+#include "ControlVSpace.h"
 #include "ControlWrap.h"
 
 #include "FormAboutlyx.h"
@@ -72,6 +73,7 @@
 #include "FormToc.h"
 #include "FormUrl.h"
 #include "FormVCLog.h"
+#include "FormVSpace.h"
 #include "FormWrap.h"
 
 #ifdef HAVE_LIBAIKSAURUS
@@ -125,7 +127,7 @@ char const * const dialognames[] = {
 "thesaurus",
 #endif
 
-"toc", "url", "vclog", "wrap" };
+"toc", "url", "vclog", "vspace", "wrap" };
 
 char const * const * const end_dialognames =
        dialognames + (sizeof(dialognames) / sizeof(char *));
@@ -459,6 +461,10 @@ Dialog * Dialogs::build(string const & name)
                dialog->setController(new ControlVCLog(*dialog));
                dialog->setView(new FormVCLog(*dialog));
                dialog->bc().bp(new OkCancelPolicy);
+       } else if (name == "vspace") {
+               dialog->setController(new ControlVSpace(*dialog));
+               dialog->setView(new FormVSpace(*dialog));
+               dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
        } else if (name == "wrap") {
                dialog->setController(new ControlWrap(*dialog));
                dialog->setView(new FormWrap(*dialog));
index 603271d4e63b94607bc753f63db0694e63285b3a..b5bfe655d8b605e51b0ae09ef703a1897f54aa7e 100644 (file)
@@ -26,7 +26,6 @@
 #include "lyxrc.h" // to set the deafult length values
 #include "ParagraphParameters.h"
 #include "Spacing.h"
-#include "vspace.h"
 
 #include "support/lstrings.h"
 #include "support/tostr.h"
@@ -44,24 +43,10 @@ using std::vector;
 using std::string;
 
 
-namespace
-{
+namespace {
 
 string defaultUnit("cm");
 
-void validateVSpaceWidgets(FL_OBJECT * choice_type, FL_OBJECT * input_length);
-
-VSpace const setVSpaceFromWidgets(FL_OBJECT * choice_type,
-                                 FL_OBJECT * input_length,
-                                 FL_OBJECT * choice_length,
-                                 FL_OBJECT * check_keep);
-
-void setWidgetsFromVSpace(VSpace const & space,
-                         FL_OBJECT * choice_type,
-                         FL_OBJECT * input_length,
-                         FL_OBJECT * choice_length,
-                         FL_OBJECT * check_keep);
-
 } // namespace anon
 
 
@@ -84,36 +69,16 @@ void FormParagraph::build()
        bcview().setRestore(dialog_->button_restore);
 
        // disable for read-only documents
-       bcview().addReadOnly(dialog_->choice_space_above);
-       bcview().addReadOnly(dialog_->input_space_above);
-       bcview().addReadOnly(dialog_->check_space_above);
-
        bcview().addReadOnly(dialog_->check_noindent);
        bcview().addReadOnly(dialog_->choice_linespacing);
        bcview().addReadOnly(dialog_->input_linespacing);
 
-       bcview().addReadOnly(dialog_->choice_space_below);
-       bcview().addReadOnly(dialog_->input_space_below);
-       bcview().addReadOnly(dialog_->check_space_below);
-
        bcview().addReadOnly(dialog_->input_labelwidth);
 
-       // check validity of "length + unit" input
-       addCheckedGlueLength(bcview(),
-                            dialog_->input_space_above,
-                            dialog_->choice_space_above);
-       addCheckedGlueLength(bcview(),
-                            dialog_->input_space_below,
-                            dialog_->choice_space_below);
-
        // trigger an input event for cut&paste with middle mouse button.
-       setPrehandler(dialog_->input_space_above);
-       setPrehandler(dialog_->input_space_below);
        setPrehandler(dialog_->input_linespacing);
        setPrehandler(dialog_->input_labelwidth);
 
-       fl_set_input_return(dialog_->input_space_above, FL_RETURN_CHANGED);
-       fl_set_input_return(dialog_->input_space_below, FL_RETURN_CHANGED);
        fl_set_input_return(dialog_->input_labelwidth,  FL_RETURN_CHANGED);
        fl_set_input_return(dialog_->input_linespacing, FL_RETURN_CHANGED);
 
@@ -126,10 +91,6 @@ void FormParagraph::build()
        alignment_.init(dialog_->radio_align_block,  LYX_ALIGN_BLOCK);
        alignment_.init(dialog_->radio_align_center, LYX_ALIGN_CENTER);
 
-       string const parspacing = _("None|DefSkip|SmallSkip|MedSkip|BigSkip|VFill|Length");
-       fl_addto_choice(dialog_->choice_space_above, parspacing.c_str());
-       fl_addto_choice(dialog_->choice_space_below, parspacing.c_str());
-
        string const linespacing = _("Default|Single|OneHalf|Double|Custom");
        fl_addto_choice(dialog_->choice_linespacing, linespacing.c_str());
 
@@ -140,21 +101,6 @@ void FormParagraph::build()
                          bind2nd(contains_functor(), "%"));
        units_vec.erase(del, units_vec.end());
 
-       string const units = getStringFromVector(units_vec, "|");
-       fl_addto_choice(dialog_->choice_unit_space_above, units.c_str());
-       fl_addto_choice(dialog_->choice_unit_space_below, units.c_str());
-
-       // set up the tooltips
-       string str = _("Add additional space above this paragraph.");
-       tooltips().init(dialog_->choice_space_above, str);
-       str = _("Never suppress space (e.g. at top of page or new page).");
-       tooltips().init(dialog_->check_space_above, str);
-
-       str = _("Add additional space below this paragraph.");
-       tooltips().init(dialog_->choice_space_below, str);
-       str = _("Never suppress space (e.g. at bottom of page or new page).");
-       tooltips().init(dialog_->check_space_below, str);
-
        // set default unit for custom length
        switch (lyxrc.default_papersize) {
                case PAPER_DEFAULT:
@@ -175,32 +121,8 @@ void FormParagraph::build()
 
 void FormParagraph::apply()
 {
-       if (!form()) return;
-
-       // spacing
-       // If a vspace choice is "Length" but there's no text in
-       // the input field, reset the choice to "None".
-       validateVSpaceWidgets(dialog_->choice_space_above,
-                             dialog_->input_space_above);
-
-       VSpace const space_above =
-               setVSpaceFromWidgets(dialog_->choice_space_above,
-                                    dialog_->input_space_above,
-                                    dialog_->choice_unit_space_above,
-                                    dialog_->check_space_above);
-
-       controller().params().spaceTop(space_above);
-
-       validateVSpaceWidgets(dialog_->choice_space_below,
-                             dialog_->input_space_below);
-
-       VSpace const space_below =
-               setVSpaceFromWidgets(dialog_->choice_space_below,
-                                    dialog_->input_space_below,
-                                    dialog_->choice_unit_space_below,
-                                    dialog_->check_space_below);
-
-       controller().params().spaceBottom(space_below);
+       if (!form())
+               return;
 
        // alignment
        LyXAlignment const alignment =
@@ -344,20 +266,6 @@ void FormParagraph::update()
                fl_set_input(dialog_->input_linespacing, "");
        }
 
-       // vspace top
-       setWidgetsFromVSpace(controller().params().spaceTop(),
-                            dialog_->choice_space_above,
-                            dialog_->input_space_above,
-                            dialog_->choice_unit_space_above,
-                            dialog_->check_space_above);
-
-       // vspace bottom
-       setWidgetsFromVSpace(controller().params().spaceBottom(),
-                            dialog_->choice_space_below,
-                            dialog_->input_space_below,
-                            dialog_->choice_unit_space_below,
-                            dialog_->check_space_below);
-
        // no indent
        fl_set_button(dialog_->check_noindent,
                      controller().params().noindent());
@@ -368,27 +276,7 @@ ButtonPolicy::SMInput FormParagraph::input(FL_OBJECT * ob, long)
 {
        // Enable input when custum length is choosen,
        // disable 'keep' when no space is choosen
-       if (ob == dialog_->choice_space_above) {
-               bool const custom_length =
-                       fl_get_choice(dialog_->choice_space_above) == 7;
-               setEnabled(dialog_->input_space_above, custom_length);
-               setEnabled(dialog_->choice_unit_space_above, custom_length);
-
-               bool const space =
-                       fl_get_choice(dialog_->choice_space_above) != 1;
-               setEnabled(dialog_->check_space_above, space);
-
-       } else if (ob == dialog_->choice_space_below) {
-               bool const custom_length =
-                       fl_get_choice(dialog_->choice_space_below) == 7;
-               setEnabled(dialog_->input_space_below, custom_length);
-               setEnabled(dialog_->choice_unit_space_below, custom_length);
-
-               bool const space =
-                       fl_get_choice(dialog_->choice_space_below) != 1;
-               setEnabled(dialog_->check_space_below, space);
-
-       } else if (ob == dialog_->choice_linespacing) {
+       if (ob == dialog_->choice_linespacing) {
                bool const custom_spacing =
                        fl_get_choice(dialog_->choice_linespacing) == 5;
                setEnabled(dialog_->input_linespacing, custom_spacing);
@@ -396,127 +284,3 @@ ButtonPolicy::SMInput FormParagraph::input(FL_OBJECT * ob, long)
 
        return ButtonPolicy::SMI_VALID;
 }
-
-
-namespace {
-
-void validateVSpaceWidgets(FL_OBJECT * choice_type, FL_OBJECT * input_length)
-{
-       // Paranoia check!
-       BOOST_ASSERT(choice_type  && choice_type->objclass  == FL_CHOICE &&
-                   input_length && input_length->objclass == FL_INPUT);
-
-       if (fl_get_choice(choice_type) != 7)
-               return;
-
-       // If a vspace kind is "Length" but there's no text in
-       // the input field, reset the kind to "None".
-       string const input = rtrim(getString(input_length));
-       if (input.empty())
-               fl_set_choice(choice_type, 1);
-}
-
-
-VSpace const setVSpaceFromWidgets(FL_OBJECT * choice_type,
-                                 FL_OBJECT * input_length,
-                                 FL_OBJECT * choice_length,
-                                 FL_OBJECT * check_keep)
-{
-       // Paranoia check!
-       BOOST_ASSERT(choice_type   && choice_type->objclass   == FL_CHOICE &&
-                   input_length  && input_length->objclass  == FL_INPUT &&
-                   choice_length && choice_length->objclass == FL_CHOICE &&
-                   check_keep    && check_keep->objclass    == FL_CHECKBUTTON);
-
-       VSpace space;
-       switch (fl_get_choice(choice_type)) {
-       case 1:
-               space = VSpace(VSpace::NONE);
-               break;
-       case 2:
-               space = VSpace(VSpace::DEFSKIP);
-               break;
-       case 3:
-               space = VSpace(VSpace::SMALLSKIP);
-               break;
-       case 4:
-               space = VSpace(VSpace::MEDSKIP);
-               break;
-       case 5:
-               space = VSpace(VSpace::BIGSKIP);
-               break;
-       case 6:
-               space = VSpace(VSpace::VFILL);
-               break;
-       case 7:
-               {
-               string const length =
-                       getLengthFromWidgets(input_length, choice_length);
-               space = VSpace(LyXGlueLength(length));
-               break;
-               }
-       }
-
-       if (fl_get_button(check_keep))
-               space.setKeep(true);
-
-       return space;
-}
-
-
-void setWidgetsFromVSpace(VSpace const & space,
-                         FL_OBJECT * choice_type,
-                         FL_OBJECT * input_length,
-                         FL_OBJECT * choice_length,
-                         FL_OBJECT * check_keep)
-{
-       // Paranoia check!
-       BOOST_ASSERT(choice_type   && choice_type->objclass   == FL_CHOICE &&
-                   input_length  && input_length->objclass  == FL_INPUT &&
-                   choice_length && choice_length->objclass == FL_CHOICE &&
-                   check_keep    && check_keep->objclass    == FL_CHECKBUTTON);
-
-       fl_set_button(check_keep, space.keep());
-
-       int pos = 1;
-       switch (space.kind()) {
-       case VSpace::NONE:
-               pos = 1;
-               break;
-       case VSpace::DEFSKIP:
-               pos = 2;
-               break;
-       case VSpace::SMALLSKIP:
-               pos = 3;
-               break;
-       case VSpace::MEDSKIP:
-               pos = 4;
-               break;
-       case VSpace::BIGSKIP:
-               pos = 5;
-               break;
-       case VSpace::VFILL:
-               pos = 6;
-               break;
-       case VSpace::LENGTH:
-               pos = 7;
-               break;
-       }
-       fl_set_choice(choice_type, pos);
-
-       bool const custom_vspace = space.kind() == VSpace::LENGTH;
-       setEnabled(input_length, custom_vspace);
-       setEnabled(choice_length, custom_vspace);
-       if (custom_vspace) {
-               string const length = space.length().asString();
-               updateWidgetsFromLengthString(input_length, choice_length,
-                                             length, defaultUnit);
-       } else {
-               bool const no_vspace = space.kind() == VSpace::NONE;
-               setEnabled(check_keep, !no_vspace);
-               fl_set_input(input_length, "");
-               fl_set_choice_text(choice_length, defaultUnit.c_str());
-       }
-}
-
-} // namespace anon
diff --git a/src/frontends/xforms/FormVSpace.C b/src/frontends/xforms/FormVSpace.C
new file mode 100644 (file)
index 0000000..59b7e1f
--- /dev/null
@@ -0,0 +1,251 @@
+/**
+ * \file FormVSpace.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author André Pönitz
+ * \author Jürgen Vigna
+ * \author Rob Lahaye
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "FormVSpace.h"
+#include "ControlVSpace.h"
+#include "forms/form_vspace.h"
+
+#include "checkedwidgets.h"
+#include "input_validators.h"
+#include "Tooltips.h"
+#include "xforms_helpers.h"
+#include "xformsBC.h"
+
+#include "controllers/helper_funcs.h"
+
+#include "lyxrc.h" // to set the deafult length values
+#include "Spacing.h"
+#include "vspace.h"
+
+#include "support/lstrings.h"
+#include "support/tostr.h"
+
+#include "lyx_forms.h"
+
+using lyx::support::contains_functor;
+using lyx::support::getStringFromVector;
+using lyx::support::rtrim;
+
+using std::bind2nd;
+using std::remove_if;
+
+using std::vector;
+using std::string;
+
+
+namespace {
+
+string defaultUnit("cm");
+
+void validateVSpaceWidgets(FL_OBJECT * choice_type, FL_OBJECT * input_length)
+{
+       // Paranoia check!
+       BOOST_ASSERT(choice_type  && choice_type->objclass  == FL_CHOICE &&
+                    input_length && input_length->objclass == FL_INPUT);
+
+       if (fl_get_choice(choice_type) != 7)
+               return;
+
+       // If a vspace kind is "Length" but there's no text in
+       // the input field, reset the kind to "None".
+       string const input = rtrim(getString(input_length));
+       if (input.empty())
+               fl_set_choice(choice_type, 1);
+}
+
+
+VSpace const setVSpaceFromWidgets(FL_OBJECT * choice_type,
+                                 FL_OBJECT * input_length,
+                                 FL_OBJECT * choice_length)
+{
+       // Paranoia check!
+       BOOST_ASSERT(choice_type   && choice_type->objclass   == FL_CHOICE &&
+                    input_length  && input_length->objclass  == FL_INPUT &&
+                    choice_length && choice_length->objclass == FL_CHOICE);
+
+       switch (fl_get_choice(choice_type)) {
+       case 1:
+               return VSpace(VSpace::NONE);
+       case 2:
+               return VSpace(VSpace::DEFSKIP);
+       case 3:
+               return VSpace(VSpace::SMALLSKIP);
+       case 4:
+               return VSpace(VSpace::MEDSKIP);
+       case 5:
+               return VSpace(VSpace::BIGSKIP);
+       case 6:
+               return VSpace(VSpace::VFILL);
+       case 7:
+               return VSpace(LyXGlueLength(
+                                     getLengthFromWidgets(input_length, choice_length)));
+       }
+
+       return VSpace(VSpace::NONE);
+}
+
+
+void setWidgetsFromVSpace(VSpace const & space,
+                         FL_OBJECT * choice_type,
+                         FL_OBJECT * input_length,
+                         FL_OBJECT * choice_length)
+{
+       // Paranoia check!
+       BOOST_ASSERT(choice_type   && choice_type->objclass   == FL_CHOICE &&
+                    input_length  && input_length->objclass  == FL_INPUT &&
+                    choice_length && choice_length->objclass == FL_CHOICE);
+
+       int pos = 1;
+       switch (space.kind()) {
+       case VSpace::NONE:
+               pos = 1;
+               break;
+       case VSpace::DEFSKIP:
+               pos = 2;
+               break;
+       case VSpace::SMALLSKIP:
+               pos = 3;
+               break;
+       case VSpace::MEDSKIP:
+               pos = 4;
+               break;
+       case VSpace::BIGSKIP:
+               pos = 5;
+               break;
+       case VSpace::VFILL:
+               pos = 6;
+               break;
+       case VSpace::LENGTH:
+               pos = 7;
+               break;
+       }
+       fl_set_choice(choice_type, pos);
+
+       bool const custom_vspace = space.kind() == VSpace::LENGTH;
+       if (custom_vspace) {
+               string const length = space.length().asString();
+               updateWidgetsFromLengthString(input_length, choice_length,
+                                             length, defaultUnit);
+       } else {
+               fl_set_input(input_length, "");
+               fl_set_choice_text(choice_length, defaultUnit.c_str());
+       }
+}
+
+} // namespace anon
+
+
+typedef FormController<ControlVSpace, FormView<FD_vspace> > base_class;
+
+FormVSpace::FormVSpace(Dialog & parent)
+       : base_class(parent, _("VSpace Settings"))
+{}
+
+
+void FormVSpace::build()
+{
+       // the tabbed folder
+       dialog_.reset(build_vspace(this));
+
+       // Manage the ok, apply, restore and cancel/close buttons
+       bcview().setOK(dialog_->button_ok);
+       bcview().setApply(dialog_->button_apply);
+       bcview().setCancel(dialog_->button_close);
+       bcview().setRestore(dialog_->button_restore);
+
+       // disable for read-only documents
+       bcview().addReadOnly(dialog_->choice_space);
+       bcview().addReadOnly(dialog_->input_space);
+
+       // check validity of "length + unit" input
+       addCheckedGlueLength(bcview(),
+                            dialog_->input_space,
+                            dialog_->choice_space);
+
+       // trigger an input event for cut&paste with middle mouse button.
+       setPrehandler(dialog_->input_space);
+
+       fl_set_input_return(dialog_->input_space, FL_RETURN_CHANGED);
+
+       // Create the contents of the unit choices; don't include the "%" terms.
+       vector<string> units_vec = getLatexUnits();
+       vector<string>::iterator del =
+               remove_if(units_vec.begin(), units_vec.end(),
+                         bind2nd(contains_functor(), "%"));
+       units_vec.erase(del, units_vec.end());
+
+       string const units = getStringFromVector(units_vec, "|");
+       fl_addto_choice(dialog_->choice_unit_space, units.c_str());
+
+       // set up the tooltips
+       string str = _("Additional vertical space.");
+       tooltips().init(dialog_->choice_space, str);
+
+       // set default unit for custom length
+       switch (lyxrc.default_papersize) {
+       case PAPER_DEFAULT:
+       case PAPER_USLETTER:
+       case PAPER_LEGALPAPER:
+       case PAPER_EXECUTIVEPAPER:
+               defaultUnit = "in";
+               break;
+       case PAPER_A3PAPER:
+       case PAPER_A4PAPER:
+       case PAPER_A5PAPER:
+       case PAPER_B5PAPER:
+               defaultUnit = "cm";
+               break;
+       }
+}
+
+
+void FormVSpace::apply()
+{
+       if (!form())
+               return;
+
+       // spacing
+       // If a vspace choice is "Length" but there's no text in
+       // the input field, reset the choice to "None".
+       validateVSpaceWidgets(dialog_->choice_space, dialog_->input_space);
+
+       VSpace const space =
+               setVSpaceFromWidgets(dialog_->choice_space,
+                                    dialog_->input_space,
+                                    dialog_->choice_unit_space);
+
+       controller().params() = space;
+}
+
+
+void FormVSpace::update()
+{
+       setWidgetsFromVSpace(controller().params(),
+                            dialog_->choice_space,
+                            dialog_->input_space,
+                            dialog_->choice_unit_space);
+
+}
+
+
+ButtonPolicy::SMInput FormVSpace::input(FL_OBJECT * ob, long)
+{
+       // Enable input when custum length is choosen,
+       // disable 'keep' when no space is choosen
+       if (ob == dialog_->choice_space) {
+               bool const custom_length =
+                       fl_get_choice(dialog_->choice_space) == 7;
+       }
+       return ButtonPolicy::SMI_VALID;
+}
diff --git a/src/frontends/xforms/FormVSpace.h b/src/frontends/xforms/FormVSpace.h
new file mode 100644 (file)
index 0000000..d286bdb
--- /dev/null
@@ -0,0 +1,41 @@
+// -*- C++ -*-
+/**
+ * \file FormVSpace.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author André Pönitz
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef FORM_VSPACE_H
+#define FORM_VSPACE_H
+
+
+#include "FormDialogView.h"
+#include "RadioButtonGroup.h"
+
+struct FD_vspace;
+class ControlVSpace;
+
+/** This class provides an XForms implementation of the FormVSpace dialog.
+ */
+class FormVSpace
+       : public FormController<ControlVSpace, FormView<FD_vspace> > {
+public:
+       ///
+       FormVSpace(Dialog &);
+private:
+       /// Build the dialog
+       virtual void build();
+       /// Apply from dialog
+       virtual void apply();
+       /// Update the dialog
+       virtual void update();
+
+       /// Filter the inputs on callback from xforms
+       virtual ButtonPolicy::SMInput input(FL_OBJECT *, long);
+};
+
+#endif
index b2cd96fe97bd293273137ee787c1e42035e2a8ce..c7b7e741ef96f0c3b059a950914898a95d859925 100644 (file)
@@ -154,6 +154,8 @@ libxforms_la_SOURCES = \
        FormUrl.h \
        FormVCLog.C \
        FormVCLog.h \
+       FormVSpace.C \
+       FormVSpace.h \
        FormWrap.C \
        FormWrap.h \
        LyXKeySymFactory.C \
index 316f89cd20cef1c61ae3e0364307cae18efa7131..d66e319b7748fc92fb53dc332ca6fd98e11fa2f2 100644 (file)
@@ -50,6 +50,7 @@ SRCS =  form_aboutlyx.fd \
        form_thesaurus.fd \
        form_toc.fd \
        form_url.fd \
+       form_vspace.fd \
        form_wrap.fd
 
 nodist_libfdesign_la_SOURCES = $(SRCS:.fd=.C) $(SRCS:.fd=.h)
index 2a1449ac44a67644834d3a6fc877a323d5615078..2c4fbf1e4283da76523768f2be209c9154e1b9f3 100644 (file)
@@ -10,13 +10,13 @@ SnapGrid: 5
 =============== FORM ===============
 Name: form_paragraph
 Width: 395
-Height: 405
-Number of Objects: 27
+Height: 205
+Number of Objects: 17
 
 --------------------
 class: FL_BOX
 type: FLAT_BOX
-box: 0 0 395 405
+box: 0 0 395 205
 boxtype: FL_FLAT_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -34,7 +34,7 @@ argument:
 --------------------
 class: FL_LABELFRAME
 type: ENGRAVED_FRAME
-box: 205 110 185 115
+box: 205 10 185 115
 boxtype: FL_NO_BOX
 colors: FL_BLACK FL_COL1
 alignment: FL_ALIGN_TOP_LEFT
@@ -52,7 +52,7 @@ argument:
 --------------------
 class: FL_LABELFRAME
 type: ENGRAVED_FRAME
-box: 5 110 200 115
+box: 5 10 200 115
 boxtype: FL_NO_BOX
 colors: FL_BLACK FL_COL1
 alignment: FL_ALIGN_TOP_LEFT
@@ -67,154 +67,10 @@ name:
 callback: 
 argument: 
 
---------------------
-class: FL_LABELFRAME
-type: ENGRAVED_FRAME
-box: 5 235 385 90
-boxtype: FL_NO_BOX
-colors: FL_BLACK FL_COL1
-alignment: FL_ALIGN_TOP_LEFT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Below
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: 
-callback: 
-argument: 
-
---------------------
-class: FL_LABELFRAME
-type: ENGRAVED_FRAME
-box: 5 10 385 90
-boxtype: FL_NO_BOX
-colors: FL_BLACK FL_COL1
-alignment: FL_ALIGN_TOP_LEFT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Above
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: 
-callback: 
-argument: 
-
---------------------
-class: FL_CHOICE
-type: NORMAL_CHOICE
-box: 230 20 120 25
-boxtype: FL_FRAME_BOX
-colors: FL_COL1 FL_BLACK
-alignment: FL_ALIGN_LEFT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Vertical space:|#V
-shortcut: 
-resize: FL_RESIZE_X
-gravity: FL_West FL_East
-name: choice_space_above
-callback: C_FormDialogView_InputCB
-argument: 0
-
---------------------
-class: FL_INPUT
-type: NORMAL_INPUT
-box: 230 45 70 25
-boxtype: FL_DOWN_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: 
-shortcut: 
-resize: FL_RESIZE_NONE
-gravity: FL_West FL_East
-name: input_space_above
-callback: C_FormDialogView_InputCB
-argument: 0
-
---------------------
-class: FL_CHECKBUTTON
-type: PUSH_BUTTON
-box: 230 70 80 25
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Keep|#K
-shortcut: 
-resize: FL_RESIZE_NONE
-gravity: FL_West FL_West
-name: check_space_above
-callback: C_FormDialogView_InputCB
-argument: 0
-
 --------------------
 class: FL_CHOICE
 type: NORMAL_CHOICE
-box: 230 245 120 25
-boxtype: FL_FRAME_BOX
-colors: FL_COL1 FL_BLACK
-alignment: FL_ALIGN_LEFT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Vertical space:|#e
-shortcut: 
-resize: FL_RESIZE_X
-gravity: FL_West FL_East
-name: choice_space_below
-callback: C_FormDialogView_InputCB
-argument: 0
-
---------------------
-class: FL_INPUT
-type: NORMAL_INPUT
-box: 230 270 70 25
-boxtype: FL_DOWN_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: 
-shortcut: 
-resize: FL_RESIZE_X
-gravity: FL_West FL_East
-name: input_space_below
-callback: C_FormDialogView_InputCB
-argument: 0
-
---------------------
-class: FL_CHECKBUTTON
-type: PUSH_BUTTON
-box: 230 295 80 25
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Keep|#p
-shortcut: 
-resize: FL_RESIZE_NONE
-gravity: FL_West FL_West
-name: check_space_below
-callback: C_FormDialogView_InputCB
-argument: 0
-
---------------------
-class: FL_CHOICE
-type: NORMAL_CHOICE
-box: 20 185 90 25
+box: 20 85 90 25
 boxtype: FL_FRAME_BOX
 colors: FL_COL1 FL_BLACK
 alignment: FL_ALIGN_TOP
@@ -232,7 +88,7 @@ argument: 0
 --------------------
 class: FL_INPUT
 type: NORMAL_INPUT
-box: 110 185 60 25
+box: 110 85 60 25
 boxtype: FL_DOWN_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_CENTER
@@ -250,7 +106,7 @@ argument: 0
 --------------------
 class: FL_INPUT
 type: NORMAL_INPUT
-box: 150 340 235 25
+box: 150 140 235 25
 boxtype: FL_DOWN_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_LEFT
@@ -286,7 +142,7 @@ argument: 0
 --------------------
 class: FL_BUTTON
 type: NORMAL_BUTTON
-box: 5 375 90 25
+box: 5 175 90 25
 boxtype: FL_UP_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -304,7 +160,7 @@ argument: 0
 --------------------
 class: FL_BUTTON
 type: RETURN_BUTTON
-box: 110 375 90 25
+box: 110 175 90 25
 boxtype: FL_UP_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -322,7 +178,7 @@ argument: 0
 --------------------
 class: FL_BUTTON
 type: NORMAL_BUTTON
-box: 205 375 90 25
+box: 205 175 90 25
 boxtype: FL_UP_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -340,7 +196,7 @@ argument: 0
 --------------------
 class: FL_BUTTON
 type: NORMAL_BUTTON
-box: 300 375 90 25
+box: 300 175 90 25
 boxtype: FL_UP_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -355,42 +211,6 @@ name: button_close
 callback: C_FormDialogView_CancelCB
 argument: 0
 
---------------------
-class: FL_CHOICE
-type: NORMAL_CHOICE
-box: 300 45 50 25
-boxtype: FL_FRAME_BOX
-colors: FL_COL1 FL_BLACK
-alignment: FL_ALIGN_LEFT
-style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
-lcol: FL_BLACK
-label: 
-shortcut: 
-resize: FL_RESIZE_NONE
-gravity: FL_East FL_East
-name: choice_unit_space_above
-callback: C_FormDialogView_InputCB
-argument: 0
-
---------------------
-class: FL_CHOICE
-type: NORMAL_CHOICE
-box: 300 270 50 25
-boxtype: FL_FRAME_BOX
-colors: FL_COL1 FL_BLACK
-alignment: FL_ALIGN_LEFT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: 
-shortcut: 
-resize: FL_RESIZE_NONE
-gravity: FL_East FL_East
-name: choice_unit_space_below
-callback: C_FormDialogView_InputCB
-argument: 0
-
 --------------------
 class: FL_BEGIN_GROUP
 type: 0
@@ -412,7 +232,7 @@ argument:
 --------------------
 class: FL_ROUND3DBUTTON
 type: RADIO_BUTTON
-box: 215 170 170 25
+box: 215 70 170 25
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_YELLOW
 alignment: FL_ALIGN_CENTER
@@ -430,7 +250,7 @@ argument: 0
 --------------------
 class: FL_ROUND3DBUTTON
 type: RADIO_BUTTON
-box: 215 145 170 25
+box: 215 45 170 25
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_YELLOW
 alignment: FL_ALIGN_CENTER
@@ -448,7 +268,7 @@ argument: 0
 --------------------
 class: FL_ROUND3DBUTTON
 type: RADIO_BUTTON
-box: 215 120 170 25
+box: 215 20 170 25
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_YELLOW
 alignment: FL_ALIGN_CENTER
@@ -466,7 +286,7 @@ argument: 0
 --------------------
 class: FL_ROUND3DBUTTON
 type: RADIO_BUTTON
-box: 215 195 170 25
+box: 215 95 170 25
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_YELLOW
 alignment: FL_ALIGN_CENTER
diff --git a/src/frontends/xforms/forms/form_vspace.fd b/src/frontends/xforms/forms/form_vspace.fd
new file mode 100644 (file)
index 0000000..396f202
--- /dev/null
@@ -0,0 +1,161 @@
+Magic: 13000
+
+Internal Form Definition File
+    (do not change)
+
+Number of forms: 1
+Unit of measure: FL_COORD_PIXEL
+SnapGrid: 5
+
+=============== FORM ===============
+Name: form_vspace
+Width: 395
+Height: 105
+Number of Objects: 8
+
+--------------------
+class: FL_BOX
+type: FLAT_BOX
+box: 0 0 395 105
+boxtype: FL_FLAT_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: 
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: 
+callback: 
+argument: 
+
+--------------------
+class: FL_CHOICE
+type: NORMAL_CHOICE
+box: 230 20 120 25
+boxtype: FL_FRAME_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Vertical space:|#V
+shortcut: 
+resize: FL_RESIZE_X
+gravity: FL_West FL_East
+name: choice_space
+callback: C_FormDialogView_InputCB
+argument: 0
+
+--------------------
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 230 45 70 25
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: 
+shortcut: 
+resize: FL_RESIZE_NONE
+gravity: FL_West FL_East
+name: input_space
+callback: C_FormDialogView_InputCB
+argument: 0
+
+--------------------
+class: FL_BUTTON
+type: NORMAL_BUTTON
+box: 5 75 90 25
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Restore|#R
+shortcut: 
+resize: FL_RESIZE_NONE
+gravity: FL_SouthWest FL_SouthWest
+name: button_restore
+callback: C_FormDialogView_RestoreCB
+argument: 0
+
+--------------------
+class: FL_BUTTON
+type: RETURN_BUTTON
+box: 110 75 90 25
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: OK
+shortcut: ^M
+resize: FL_RESIZE_NONE
+gravity: FL_SouthEast FL_SouthEast
+name: button_ok
+callback: C_FormDialogView_OKCB
+argument: 0
+
+--------------------
+class: FL_BUTTON
+type: NORMAL_BUTTON
+box: 205 75 90 25
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Apply|#A
+shortcut: 
+resize: FL_RESIZE_NONE
+gravity: FL_SouthEast FL_SouthEast
+name: button_apply
+callback: C_FormDialogView_ApplyCB
+argument: 0
+
+--------------------
+class: FL_BUTTON
+type: NORMAL_BUTTON
+box: 300 75 90 25
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Cancel|^[
+shortcut: 
+resize: FL_RESIZE_NONE
+gravity: FL_SouthEast FL_SouthEast
+name: button_close
+callback: C_FormDialogView_CancelCB
+argument: 0
+
+--------------------
+class: FL_CHOICE
+type: NORMAL_CHOICE
+box: 300 45 50 25
+boxtype: FL_FRAME_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label: 
+shortcut: 
+resize: FL_RESIZE_NONE
+gravity: FL_East FL_East
+name: choice_unit_space
+callback: C_FormDialogView_InputCB
+argument: 0
+
+==============================
+create_the_forms
index 32f2f048dab499b657dafb07b16c57e5c3d8cb26..9f21b0700f995b545e45cd2c3a8a91383a497a0e 100644 (file)
@@ -1,4 +1,9 @@
 
+2003-11-28  André Pönitz  <poenitz@gmx.net>
+
+       * Makefile.am:
+       * insetvspace.[Ch]: new insets
+
 2003-11-28  Martin Vermeer  <martin.vermeer@hut.fi>
 
        * insetcharstyle.C: Syntax change for CharStyles
index 911842e9715628d77de426654206f7847de4f86f..b07c8ee86cfaa361f691008a0235987f928aabc9 100644 (file)
@@ -108,6 +108,8 @@ libinsets_la_SOURCES = \
        insettoc.h \
        inseturl.C \
        inseturl.h \
+       insetvspace.C \
+       insetvspace.h \
        insetwrap.h \
        insetwrap.C \
        updatableinset.C \
index 2d6a56a76ea6b96addb15d7a30681a916b95d41d..7ac536035f6a925c6c672ed9072689cde1a8312b 100644 (file)
@@ -136,7 +136,9 @@ public:
                ///
                BOX_CODE,
                ///
-               CHARSTYLE_CODE
+               CHARSTYLE_CODE,
+               ///
+               VSPACE_CODE
        };
 
        ///
diff --git a/src/insets/insetvspace.C b/src/insets/insetvspace.C
new file mode 100644 (file)
index 0000000..91b747c
--- /dev/null
@@ -0,0 +1,233 @@
+/**
+ * \file insetvspace.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author various
+ * \author André Pönitz
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "insetvspace.h"
+
+#include "buffer.h"
+#include "debug.h"
+#include "LColor.h"
+#include "lyxlex.h"
+#include "lyxtext.h"
+#include "metricsinfo.h"
+#include "gettext.h"
+
+#include "frontends/Painter.h"
+#include "frontends/font_metrics.h"
+
+#include "support/std_sstream.h"
+
+using std::endl;
+using std::istringstream;
+using std::ostream;
+using std::ostringstream;
+using std::string;
+using std::max;
+
+
+
+InsetVSpace::InsetVSpace(VSpace const & space)
+       : space_(space)
+{}
+
+
+std::auto_ptr<InsetBase> InsetVSpace::clone() const
+{
+       return std::auto_ptr<InsetBase>(new InsetVSpace(*this));
+}
+
+
+void InsetVSpace::read(Buffer const &, LyXLex & lex)
+{
+       if (lex.isOK()) {
+               lex.next();
+               space_ = VSpace(lex.getString());
+       }
+}
+
+
+void InsetVSpace::write(Buffer const &, ostream & os) const
+{
+       os << "VSpace " << space_.asLyXCommand();
+}
+
+
+void InsetVSpace::metrics(MetricsInfo & mi, Dimension & dim) const
+{
+       int size = 10;
+       if (space_.kind() != VSpace::NONE) {
+               int const arrow_size = 4;
+               int const space_size = space_.inPixels(*mi.base.bv);
+
+               LyXFont font;
+               font.decSize();
+               int const min_size = max(3 * arrow_size, font_metrics::maxHeight(font));
+
+               if (space_.length().len().value() < 0.0)
+                       size = min_size;
+               else
+                       size = max(min_size, space_size);
+       }
+
+       dim.asc = size / 2;
+       dim.des = size / 2;
+       dim.wid = 10;
+
+       dim_ = dim;
+}
+
+
+void InsetVSpace::draw(PainterInfo & pi, int x, int y) const
+{
+       static std::string const label = _("Vertical Space");
+
+       xo_ = x;
+       yo_ = y;
+
+       //if (space_.kind() == VSpace::NONE)
+       //      return 0;
+
+       int const arrow_size = 4;
+       int const start = y - dim_.asc;
+       int const end   = y + dim_.des;
+
+       // the label to display (if any)
+       string str;
+       // y-values for top arrow
+       int ty1, ty2;
+       // y-values for bottom arrow
+       int by1, by2;
+
+       str = label + " (" + space_.asLyXCommand() + ")";
+
+       if (space_.kind() == VSpace::VFILL) {
+               ty1 = ty2 = start;
+               by1 = by2 = end;
+       } else {
+               // adding or removing space
+               bool const added = space_.kind() != VSpace::LENGTH ||
+                                  space_.length().len().value() > 0.0;
+               ty1 = added ? (start + arrow_size) : start;
+               ty2 = added ? start : (start + arrow_size);
+               by1 = added ? (end - arrow_size) : end;
+               by2 = added ? end : (end - arrow_size);
+       }
+
+       int const midx = xo_ + arrow_size;
+       int const rightx = midx + arrow_size;
+
+       // first the string
+       int w = 0;
+       int a = 0;
+       int d = 0;
+
+       LyXFont font;
+       font.setColor(LColor::added_space);
+       font.decSize();
+       font.decSize();
+       font_metrics::rectText(str, font, w, a, d);
+
+       pi.pain.rectText(x + 2 * arrow_size + 5, y + d,
+                      str, font, LColor::none, LColor::none);
+
+       // top arrow
+       pi.pain.line(x, ty1, midx, ty2, LColor::added_space);
+       pi.pain.line(midx, ty2, rightx, ty1, LColor::added_space);
+
+       // bottom arrow
+       pi.pain.line(x, by1, midx, by2, LColor::added_space);
+       pi.pain.line(midx, by2, rightx, by1, LColor::added_space);
+
+       // joining line
+       pi.pain.line(midx, ty2, midx, by2, LColor::added_space);
+}
+
+
+int InsetVSpace::latex(Buffer const & buf, ostream & os,
+                         OutputParams const &) const
+{
+       os << space_.asLatexCommand(buf.params()) << '\n';
+       return 1;
+}
+
+
+int InsetVSpace::plaintext(Buffer const &, ostream & os,
+                          OutputParams const &) const
+{
+       os << "\n\n";
+       return 2;
+}
+
+
+int InsetVSpace::linuxdoc(Buffer const &, std::ostream & os,
+                         OutputParams const &) const
+{
+       os << '\n';
+       return 1;
+}
+
+
+int InsetVSpace::docbook(Buffer const &, std::ostream & os,
+                        OutputParams const &) const
+{
+       os << '\n';
+       return 1;
+}
+
+
+string const InsetVSpaceMailer::name_ = "vspace";
+
+
+InsetVSpaceMailer::InsetVSpaceMailer(InsetVSpace & inset)
+       : inset_(inset)
+{}
+
+
+string const InsetVSpaceMailer::inset2string(Buffer const &) const
+{
+       return params2string(inset_.space_);
+}
+
+
+void InsetVSpaceMailer::string2params(string const & in, VSpace & vspace)
+{
+       //lyxerr << "\nInsetVSpaceMailer::string2params, got: '" << in << "'" << endl;
+
+       vspace = VSpace();
+
+       if (in.empty())
+               return;
+
+       istringstream data(in);
+       LyXLex lex(0,0);
+       lex.setStream(data);
+
+       if (lex.isOK()) {
+               lex.next();
+               string const name = lex.getString();
+       }
+
+       // This is part of the inset proper that is usually swallowed
+       // by Buffer::readInset
+       if (lex.isOK()) {
+               lex.next();
+               vspace = VSpace(lex.getString());
+       }
+}
+
+
+string const InsetVSpaceMailer::params2string(VSpace const & vspace)
+{
+       ostringstream data;
+       data << name_ << ' ' << vspace.asLyXCommand();
+       return data.str();
+}
diff --git a/src/insets/insetvspace.h b/src/insets/insetvspace.h
new file mode 100644 (file)
index 0000000..2c4edf0
--- /dev/null
@@ -0,0 +1,78 @@
+// -*- C++ -*-
+/**
+ * \file insetvspace.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author André Pönitz
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef INSET_VSPACE_H
+#define INSET_VSPACE_H
+
+
+#include "inset.h"
+#include "vspace.h"
+#include "mailinset.h"
+
+class InsetVSpace : public InsetOld {
+public:
+       ///
+       InsetVSpace() {}
+       ///
+       InsetVSpace(VSpace const &);
+       ///
+       std::auto_ptr<InsetBase> clone() const;
+       ///
+       void metrics(MetricsInfo & mi, Dimension & dim) const;
+       ///
+       void draw(PainterInfo & pi, int x, int y) const;
+       ///
+       int latex(Buffer const &, std::ostream &,
+                 OutputParams const &) const;
+       ///
+       int plaintext(Buffer const &, std::ostream &,
+           OutputParams const &) const;
+       ///
+       int linuxdoc(Buffer const &, std::ostream &,
+           OutputParams const &) const;
+       ///
+       int docbook(Buffer const &, std::ostream &,
+           OutputParams const &) const;
+       ///
+       void read(Buffer const &, LyXLex & lex);
+       ///
+       void write(Buffer const & buf, std::ostream & os) const;
+       ///
+       bool display() const { return true; }
+
+public:
+       /// how much
+       VSpace space_;
+};
+
+
+class InsetVSpaceMailer : public MailInset {
+public:
+       ///
+       InsetVSpaceMailer(InsetVSpace & inset);
+       ///
+       virtual InsetBase & inset() const { return inset_; }
+       ///
+       virtual std::string const & name() const { return name_; }
+       ///
+       virtual std::string const inset2string(Buffer const &) const;
+       ///
+       static void string2params(std::string const &, VSpace &);
+       ///
+       static std::string const params2string(VSpace const &);
+private:
+       ///
+       static std::string const name_;
+       ///
+       InsetVSpace & inset_;
+};
+
+#endif
index bb044e78f11abf78e3f5ea6fc9d88b7919cf7910..edbe3b0f1f514d76b1ca7dd139022e200d674cf6 100644 (file)
@@ -332,7 +332,7 @@ enum kb_action {
        LFUN_FINISHED_UP,
        LFUN_FINISHED_DOWN,
        LFUN_INSERT_CHARSTYLE,
-
+       // 255
        LFUN_LASTACTION                  // end of the table
 };
 
index 11d366b0ffa75bdb8bf3fe2f9a5928390c355aff..a36538cb1aa28956a018cbd722f4936b428da81a 100644 (file)
@@ -54,6 +54,7 @@
 #include "insets/insetcommand.h"
 #include "insets/insetexternal.h"
 #include "insets/insettabular.h"
+#include "insets/insetvspace.h"
 
 #include "mathed/math_cursor.h"
 
@@ -590,6 +591,8 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
                        code = InsetOld::TOC_CODE;
                else if (ev.argument == "url")
                        code = InsetOld::URL_CODE;
+               else if (ev.argument == "vspace")
+                       code = InsetOld::VSPACE_CODE;
                else if (ev.argument == "wrap")
                        code = InsetOld::WRAP_CODE;
                break;
@@ -1235,6 +1238,9 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
                        } else if (name == "citation") {
                                InsetCommandParams p("cite");
                                data = InsetCommandMailer::params2string(name, p);
+                       } else if (name == "vspace") {
+                               VSpace space;
+                               data = InsetVSpaceMailer::params2string(space);
                        }
                        owner->getDialogs().show(name, data, 0);
                        break;
index b238817d48745367825bb50cdadca4af5117b30b..a32331a35c836f6f7a197e60ba4d6ae64d1920b4 100644 (file)
@@ -267,8 +267,6 @@ public:
         settings are given to the new one.
         */
        void setParagraph(
-                         VSpace const & space_top,
-                         VSpace const & space_bottom,
                          Spacing const & spacing,
                          LyXAlignment align,
                          std::string const & labelwidthstring,
index 62807cf5aa1d3c55bd32cd8eb1898b39c7b58ad0..a2fe85b5c13707f5ab4f0959febf907f3f414d69 100644 (file)
@@ -244,11 +244,6 @@ TeXOnePar(Buffer const & buf,
                        texrow.newline();
                }
 
-               if (pit->params().spaceTop().kind() != VSpace::NONE) {
-                       os << pit->params().spaceTop().asLatexCommand(bparams);
-                       further_blank_line = true;
-               }
-
                if (further_blank_line) {
                        os << '\n';
                        texrow.newline();
@@ -389,11 +384,6 @@ TeXOnePar(Buffer const & buf,
        if (in == 0 || !in->forceDefaultParagraphs(in)) {
                further_blank_line = false;
 
-               if (pit->params().spaceBottom().kind() != VSpace::NONE) {
-                       os << pit->params().spaceBottom().asLatexCommand(bparams);
-                       further_blank_line = true;
-               }
-
                if (further_blank_line) {
                        os << '\n';
                        texrow.newline();
index 0a5efb303a036315482a638f37230476471c96ff..72638225549b30982714e00d80bc5c7f9b2ce88b 100644 (file)
@@ -45,6 +45,7 @@
 #include "support/tostr.h"
 
 #include <boost/tuple/tuple.hpp>
+#include <boost/bind.hpp>
 
 #include <list>
 #include <stack>
@@ -646,8 +647,6 @@ void Paragraph::applyLayout(LyXLayout_ptr const & new_layout)
        layout(new_layout);
        params().labelWidthString(string());
        params().align(LYX_ALIGN_LAYOUT);
-       params().spaceTop(VSpace(VSpace::NONE));
-       params().spaceBottom(VSpace(VSpace::NONE));
        params().spacing(Spacing(Spacing::Default));
 }
 
@@ -1277,6 +1276,7 @@ void Paragraph::simpleLinuxDocOnePar(Buffer const & buf,
 
                char c = getChar(i);
 
+
                if (c == Paragraph::META_INSET) {
                        InsetOld const * inset = getInset(i);
                        inset->linuxdoc(buf, os, runparams);
index 6f369b341af6c01b750072c32c273ba42e622c1b..d0e144a869a3a52eceac017bb959711c3805f06c 100644 (file)
@@ -132,9 +132,6 @@ void breakParagraph(BufferParams const & bparams,
                tmp->params().align(par->params().align());
                tmp->setLabelWidthString(par->params().labelWidthString());
 
-               tmp->params().spaceBottom(par->params().spaceBottom());
-               par->params().spaceBottom(VSpace(VSpace::NONE));
-
                tmp->params().depth(par->params().depth());
                tmp->params().noindent(par->params().noindent());
 
@@ -167,7 +164,6 @@ void breakParagraph(BufferParams const & bparams,
        if (pos)
                return;
 
-       tmp->params().spaceTop(par->params().spaceTop());
        par->params().clear();
 
        par->layout(bparams.getLyXTextClass().defaultLayout());
@@ -223,9 +219,6 @@ void mergeParagraph(BufferParams const & bparams,
 {
        ParagraphList::iterator the_next = boost::next(par);
 
-       // first the DTP-stuff
-       par->params().spaceBottom(the_next->params().spaceBottom());
-
        pos_type pos_end = the_next->size() - 1;
        pos_type pos_insert = par->size();
 
index 147284d210c76cf97c7c428a1abc6b84f1d7abf3..1df7256337da93e4e6c265ada220efcef9f65044 100644 (file)
@@ -71,7 +71,6 @@ private:
        void paintArabicComposeChar(lyx::pos_type & vpos);
        void paintChars(lyx::pos_type & vpos, bool hebrew, bool arabic);
        int paintAppendixStart(int y);
-       int paintLengthMarker(string const & prefix, VSpace const & vsp, int start);
        void paintText();
        void paintFromPos(lyx::pos_type & vpos);
        void paintInset(lyx::pos_type const pos);
@@ -561,73 +560,6 @@ void RowPainter::paintDepthBar()
 }
 
 
-int RowPainter::paintLengthMarker(string const & prefix, VSpace const & vsp,
-       int start)
-{
-       if (vsp.kind() == VSpace::NONE)
-               return 0;
-
-       int const arrow_size = 4;
-       int const size = getLengthMarkerHeight(bv_, vsp);
-       int const end = start + size;
-
-       // the label to display (if any)
-       string str;
-       // y-values for top arrow
-       int ty1, ty2;
-       // y-values for bottom arrow
-       int by1, by2;
-
-       str = prefix + " (" + vsp.asLyXCommand() + ")";
-
-       if (vsp.kind() == VSpace::VFILL) {
-               ty1 = ty2 = start;
-               by1 = by2 = end;
-       } else {
-               // adding or removing space
-               bool const added = vsp.kind() != VSpace::LENGTH ||
-                                  vsp.length().len().value() > 0.0;
-               ty1 = added ? (start + arrow_size) : start;
-               ty2 = added ? start : (start + arrow_size);
-               by1 = added ? (end - arrow_size) : end;
-               by2 = added ? end : (end - arrow_size);
-       }
-
-       int const leftx = int(xo_) + leftMargin();
-       int const midx = leftx + arrow_size;
-       int const rightx = midx + arrow_size;
-
-       // first the string
-       int w = 0;
-       int a = 0;
-       int d = 0;
-
-       LyXFont font;
-       font.setColor(LColor::added_space);
-       font.decSize();
-       font.decSize();
-       font_metrics::rectText(str, font, w, a, d);
-
-       pain_.rectText(leftx + 2 * arrow_size + 5,
-                      start + (end - start) / 2 + d,
-                      str, font,
-                      LColor::none, LColor::none);
-
-       // top arrow
-       pain_.line(leftx, ty1, midx, ty2, LColor::added_space);
-       pain_.line(midx, ty2, rightx, ty1, LColor::added_space);
-
-       // bottom arrow
-       pain_.line(leftx, by1, midx, by2, LColor::added_space);
-       pain_.line(midx, by2, rightx, by1, LColor::added_space);
-
-       // joining line
-       pain_.line(midx, ty2, midx, by2, LColor::added_space);
-
-       return size;
-}
-
-
 int RowPainter::paintAppendixStart(int y)
 {
        LyXFont pb_font;
@@ -662,10 +594,6 @@ void RowPainter::paintFirst()
        if (parparams.startOfAppendix())
                y_top += paintAppendixStart(yo_ + y_top + 2 * defaultRowHeight());
 
-       // draw the additional space if needed:
-       y_top += paintLengthMarker(_("Space above"), parparams.spaceTop(),
-                       yo_ + y_top);
-
        Buffer const & buffer = *bv_.buffer();
 
        LyXLayout_ptr const & layout = pit_->layout();
@@ -782,15 +710,7 @@ void RowPainter::paintFirst()
 
 void RowPainter::paintLast()
 {
-       ParagraphParameters const & parparams = pit_->params();
-       int y_bottom = row_.height() - 1;
        int const ww = bv_.workWidth();
-
-       // draw the additional space if needed:
-       int const height = getLengthMarkerHeight(bv_, parparams.spaceBottom());
-       y_bottom -= paintLengthMarker(_("Space below"), parparams.spaceBottom(),
-                            yo_ + y_bottom - height);
-
        bool const is_rtl = pit_->isRightToLeftPar(bv_.buffer()->params());
        int const endlabel = getEndLabel(pit_, text_.ownerParagraphs());
 
@@ -972,22 +892,3 @@ void paintTextInset(BufferView const & bv, LyXText const & text, int xo, int yo)
 {
        paintPars(bv, text, text.ownerParagraphs().begin(), xo, yo, 0);
 }
-
-
-int getLengthMarkerHeight(BufferView const & bv, VSpace const & vsp)
-{
-       if (vsp.kind() == VSpace::NONE)
-               return 0;
-
-       int const arrow_size = 4;
-       int const space_size = vsp.inPixels(bv);
-
-       LyXFont font;
-       font.decSize();
-       int const min_size = max(3 * arrow_size, font_metrics::maxHeight(font));
-
-       if (vsp.length().len().value() < 0.0)
-               return min_size;
-       else
-               return max(min_size, space_size);
-}
index 96dcb1b8030a73b745b2cbb30fe478c895671126..496b801f64750d4e5d2d0c7f6df35563e7c18d57 100644 (file)
 
 class LyXText;
 class BufferView;
-class VSpace;
-
-/// return the pixel height of a space marker before/after a par
-int getLengthMarkerHeight(BufferView const & bv, VSpace const & vsp);
 
 /// paint the rows of the main text, return last drawn y value
 int paintText(BufferView const & bv);
index bc02e539ffd29a07b1041c95f1a5022813ce7208..d2ef15453b05ced678ba1fee8b56838b94b57f6d 100644 (file)
@@ -657,9 +657,6 @@ void LyXText::setHeightOfRow(ParagraphList::iterator pit, Row & row)
                                maxasc += bufparams.getDefSkip().inPixels(*bv());
                }
 
-               // add user added vertical space
-               maxasc += getLengthMarkerHeight(*bv(), pit->params().spaceTop());
-
                if (pit->params().startOfAppendix())
                        maxasc += int(3 * dh);
 
@@ -684,7 +681,7 @@ void LyXText::setHeightOfRow(ParagraphList::iterator pit, Row & row)
                                + (layout->topsep + layout->labelbottomsep) * dh);
                }
 
-               // And now the layout spaces, for example before and after
+               // Add the layout spaces, for example before and after
                // a section, or between the items of a itemize or enumerate
                // environment.
 
@@ -715,10 +712,7 @@ void LyXText::setHeightOfRow(ParagraphList::iterator pit, Row & row)
 
        // is it a bottom line?
        if (row.endpos() >= pit->size()) {
-               // add the vertical spaces, that the user added
-               maxdesc += getLengthMarkerHeight(*bv(), pit->params().spaceBottom());
-
-               // and now the layout spaces, for example before and after
+               // add the layout spaces, for example before and after
                // a section, or between the items of a itemize or enumerate
                // environment
                ParagraphList::iterator nextpit = boost::next(pit);
@@ -1319,16 +1313,7 @@ void LyXText::backspace()
                        // handle the actual deletion of the paragraph.
 
                        if (cursor.par()) {
-                               ParagraphList::iterator tmppit = getPar(cursor.par() - 1);
-                               if (cursorPar()->layout() == tmppit->layout()
-                                   && cursorPar()->getAlign() == tmppit->getAlign()) {
-                                       // Inherit bottom DTD from the paragraph below.
-                                       // (the one we are deleting)
-                                       tmppit->params().spaceBottom(cursorPar()->params().spaceBottom());
-                               }
-
                                cursorLeft(bv());
-
                                // the layout things can change the height of a row !
                                redoParagraph();
                                return;
index 3bfed46f8205303011364347a231adb691930984..f85342d4a16fc415e9295a93567a4d578cf0833a 100644 (file)
@@ -310,12 +310,6 @@ LyXText::setLayout(LyXCursor & cur, LyXCursor & sstart_cur,
        do {
                pit->applyLayout(lyxlayout);
                makeFontEntriesLayoutSpecific(bufparams, *pit);
-               pit->params().spaceTop(lyxlayout->fill_top ?
-                                        VSpace(VSpace::VFILL)
-                                        : VSpace(VSpace::NONE));
-               pit->params().spaceBottom(lyxlayout->fill_bottom ?
-                                           VSpace(VSpace::VFILL)
-                                           : VSpace(VSpace::NONE));
                if (lyxlayout->margintype == MARGIN_MANUAL)
                        pit->setLabelWidthString(lyxlayout->labelstring());
                cur.par(std::distance(ownerParagraphs().begin(), pit));
@@ -611,8 +605,7 @@ string LyXText::getStringToIndex()
 // they do not duplicate themself and you cannot play dirty tricks with
 // them!
 
-void LyXText::setParagraph(VSpace const & space_top,
-                          VSpace const & space_bottom,
+void LyXText::setParagraph(
                           Spacing const & spacing,
                           LyXAlignment align,
                           string const & labelwidthstring,
@@ -643,8 +636,6 @@ void LyXText::setParagraph(VSpace const & space_top,
 
                ParagraphList::iterator const pit = cursorPar();
                ParagraphParameters & params = pit->params();
-               params.spaceTop(space_top);
-               params.spaceBottom(space_bottom);
                params.spacing(spacing);
 
                // does the layout allow the new alignment?
index 3629ac427b76c160407abe29245813ac6c0f425a..a4fc9b0b257fb3300d706ccb1bddf8c5799a8663 100644 (file)
@@ -415,7 +415,7 @@ void specialChar(LyXText * lt, BufferView * bv, InsetSpecialChar::Kind kind)
 }
 
 
-void doInsertInset(LyXText * lt, FuncRequest const & cmd,
+void doInsertInset(LyXText const & lt, FuncRequest const & cmd,
                   bool edit, bool pastesel)
 {
        InsetOld * inset = createInset(cmd);
@@ -423,7 +423,7 @@ void doInsertInset(LyXText * lt, FuncRequest const & cmd,
 
        if (inset) {
                bool gotsel = false;
-               if (lt->selection.set()) {
+               if (lt.selection.set()) {
                        bv->owner()->dispatch(FuncRequest(LFUN_CUT));
                        gotsel = true;
                }
@@ -739,21 +739,9 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd)
                if (!selection.set()) {
                        if (cursor.pos() == cursorPar()->size()) {
                                cursorRight(bv);
-                               ParagraphParameters & params = cursorPar()->params();
-                               if (cursor.pos() == 0
-                                   && !(params.spaceTop() == VSpace (VSpace::NONE))) {
-                                       setParagraph(
-                                                VSpace(VSpace::NONE),
-                                                params.spaceBottom(),
-                                                params.spacing(),
-                                                params.align(),
-                                                params.labelWidthString(), 0);
-                                       cursorLeft(bv);
-                               } else {
-                                       cursorLeft(bv);
-                                       Delete();
-                                       selection.cursor = cursor;
-                               }
+                               cursorLeft(bv);
+                               Delete();
+                               selection.cursor = cursor;
                        } else {
                                Delete();
                                selection.cursor = cursor;
@@ -784,19 +772,9 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd)
        case LFUN_BACKSPACE_SKIP:
                // Reverse the effect of LFUN_BREAKPARAGRAPH_SKIP.
                if (!selection.set()) {
-                       ParagraphParameters & params = cursorPar()->params();
-                       if (cursor.pos() == 0 && !(params.spaceTop() == VSpace(VSpace::NONE))) {
-                               setParagraph(
-                                        VSpace(VSpace::NONE),
-                                  params.spaceBottom(),
-                                        params.spacing(),
-                                        params.align(),
-                                        params.labelWidthString(), 0);
-                       } else {
-                               LyXCursor cur = cursor;
-                               backspace();
-                               selection.cursor = cur;
-                       }
+                       LyXCursor cur = cursor;
+                       backspace();
+                       selection.cursor = cur;
                } else {
                        cutSelection(true, false);
                }
@@ -829,15 +807,11 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd)
                replaceSelection(bv->getLyXText());
                if (cur.pos() == 0) {
                        ParagraphParameters & params = getPar(cur)->params();
-                       if (params.spaceTop() == VSpace(VSpace::NONE)) {
-                               setParagraph(
-                                        VSpace(VSpace::DEFSKIP), params.spaceBottom(),
-                                        params.spacing(),
-                                        params.align(),
-                                        params.labelWidthString(), 1);
-                       }
-               }
-               else {
+                       setParagraph(
+                                       params.spacing(),
+                                       params.align(),
+                                       params.labelWidthString(), 1);
+               } else {
                        breakParagraph(bv->buffer()->paragraphs(), 0);
                }
                bv->update();
@@ -924,7 +898,7 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd)
                if (cursorPar()->layout()->free_spacing)
                        insertChar(' ');
                else
-                       doInsertInset(this, cmd, false, false);
+                       doInsertInset(*this, cmd, false, false);
                moveCursor(bv, false);
                break;
 
@@ -1418,12 +1392,12 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd)
        case LFUN_ENVIRONMENT_INSERT:
                // Open the inset, and move the current selection
                // inside it.
-               doInsertInset(this, cmd, true, true);
+               doInsertInset(*this, cmd, true, true);
                break;
 
        case LFUN_INDEX_INSERT:
                // Just open the inset
-               doInsertInset(this, cmd, true, false);
+               doInsertInset(*this, cmd, true, false);
                break;
 
        case LFUN_INDEX_PRINT:
@@ -1432,7 +1406,7 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd)
        case LFUN_INSERT_LINE:
        case LFUN_INSERT_PAGEBREAK:
                // do nothing fancy
-               doInsertInset(this, cmd, false, false);
+               doInsertInset(*this, cmd, false, false);
                break;
 
        case LFUN_DEPTH_MIN: