]> git.lyx.org Git - features.git/commitdiff
support for sidewaysfloats and fix for bug 1016 (float placement allows impossible...
authorJürgen Spitzmüller <spitz@lyx.org>
Mon, 29 Mar 2004 11:38:39 +0000 (11:38 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Mon, 29 Mar 2004 11:38:39 +0000 (11:38 +0000)
BTW: floats are still broken (dialogs do not get updated). No idea where this bug sits.

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

19 files changed:
development/FORMAT
lib/lyx2lyx/ChangeLog
lib/lyx2lyx/lyx2lyx
lib/lyx2lyx/lyxconvert_230.py [new file with mode: 0644]
lib/lyx2lyx/lyxrevert_231.py [new file with mode: 0644]
po/POTFILES.in
src/ChangeLog
src/buffer.C
src/frontends/qt2/ChangeLog
src/frontends/qt2/QFloat.C
src/frontends/qt2/QFloatDialog.C
src/frontends/qt2/floatplacement.C
src/frontends/qt2/floatplacement.h
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormFloat.C
src/frontends/xforms/forms/form_float.fd
src/insets/ChangeLog
src/insets/insetfloat.C
src/insets/insetfloat.h

index 6918c28d875fd55a84888ba41239448ae70b7cab..c8c5e76508dca9c93804cbb4de61be6f64e2738d 100644 (file)
@@ -1,6 +1,19 @@
 LyX file-format changes
 -----------------------
 
+2004-03-29  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * format incremented to 231.
+       
+       * Support for sidewaysfigure/sidewaystable (rotating package).
+       insetfloat has now a param \sideways [true|false] (default is false).
+       The param should be erased on downwards conversion, if it was true, 
+       the inset should be replaced by 
+       \begin{sidewaysfigure} <content> \end{sidewaysfigure}
+       resp.
+       \begin{sidewaystable} <content> \end{sidewaystable}
+       i.e. ERT.
+
 2004-02-23  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
 
        * format incremented to 230.
index 405112a8561e8bc831973572ab7d40f064178110..e084d31cb6b7f3aa630c837efd05a9a0e74ee116 100644 (file)
@@ -1,3 +1,7 @@
+2004-03-29  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * lyx2lyx: up the format to 231.
+
 2004-03-26  Georg Baum  <Georg.Baum@post.rwth-aachen.de>
 
        * lyxrevert_225.py (convert_frameless_box): fix minipage ERT output
index a7d86d6e13188be04ef61aa6f390bdc18e185f23..b973a626bf2d55502915f8643fd5e351426225f0 100755 (executable)
@@ -40,7 +40,8 @@ opt.quiet = 0
 
 format = re.compile(r"(\d)[\.,]?(\d\d)")
 fileformat = re.compile(r"\\lyxformat\s*(\S*)")
-lst_ft = [210, 215, 216, 217, 218, 220, 221, 223, 224, 225, 226, 227, 228, 229, 230]
+lst_ft = [210, 215, 216, 217, 218, 220, 221, 223, 224, 225, 226, 227, 228, 229, 
+          230, 231]
 
 def usage():
     print """Usage: lyx2lyx [options] [file]
diff --git a/lib/lyx2lyx/lyxconvert_230.py b/lib/lyx2lyx/lyxconvert_230.py
new file mode 100644 (file)
index 0000000..22c7fc6
--- /dev/null
@@ -0,0 +1,29 @@
+# This file is part of lyx2lyx
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2003 José Matos <jamatos@fep.up.pt>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+
+import sys
+from parser_tools import find_token
+
+
+def convert(header, body):
+    pass
+
+if __name__ == "__main__":
+    pass
diff --git a/lib/lyx2lyx/lyxrevert_231.py b/lib/lyx2lyx/lyxrevert_231.py
new file mode 100644 (file)
index 0000000..22c7fc6
--- /dev/null
@@ -0,0 +1,29 @@
+# This file is part of lyx2lyx
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2003 José Matos <jamatos@fep.up.pt>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+
+import sys
+from parser_tools import find_token
+
+
+def convert(header, body):
+    pass
+
+if __name__ == "__main__":
+    pass
index af87e6f0fd968dbfc12606c895418ebe2ec3e8b4..46197d4722bac5171184c80bafd3eda97f3ea43f 100644 (file)
@@ -190,6 +190,8 @@ src/output_plaintext.C
 src/paragraph.C
 src/rowpainter.C
 src/support/globbing.C
+src/support/path_defines.C
+src/tex2lyx/lengthcommon.C
 src/text.C
 src/text2.C
 src/text3.C
index 6a6e39b49d9d908c74d205a4f8fa7322542f7b1e..29affcef39e16e3dc5519ca5bd2fa2940517170e 100644 (file)
@@ -1,3 +1,6 @@
+2004-03-29  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * buffer.C: increment file format to 231.
 
 2004-03-28  Alfredo Braunstein  <abraunst@lyx.org>
 
        * lyxrc.C (setDefaults, getDescription, output, read):
        * lyxrc.h: remove ps_command
 
+>>>>>>> 1.1856
 2004-03-22  Angus Leeming  <leeming@lyx.org>
 
        * lyx_main.C (error_handler, init): remove handler for SIGPIPE.
index e0010c2247637eb5dec6c72b5ce056d34122fe2b..f4318371a4ae0437f542ec5ac79e028ee4c3ad46 100644 (file)
@@ -130,7 +130,7 @@ extern BufferList bufferlist;
 
 namespace {
 
-const int LYX_FORMAT = 230;
+const int LYX_FORMAT = 231;
 
 } // namespace anon
 
index a1eb4b0082765279c2a22ef201b95be3d56cfc6f..0d6ce8b28065eac108e9ae00e25f58445df7132b 100644 (file)
@@ -1,3 +1,10 @@
+2004-03-29  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * QFloat.C:
+       * QFloatDialog.C:
+       * floatplacement.[Ch]: add support for sidewaysfloats
+       fix enabling of placement values (bug 1016)
+
 2004-03-28  Angus Leeming  <leeming@lyx.org>
 
        * Dialogs.C (build): added print dialog.
index df292388ea3b8cf150eb0d37bb3136574ee27395..30e46211d4da5d2b16f33b5626a7efee19bbc2ed 100644 (file)
@@ -53,5 +53,5 @@ void QFloat::apply()
 {
        InsetFloatParams & params = controller().params();
 
-       params.placement = dialog_->floatFP->get(params.wide);
+       params.placement = dialog_->floatFP->get(params.wide, params.sideways);
 }
index ebb70581b65a68d0c13b26ecb2d8f786e3789faf..cfb1b272980466c5be79adf6a2253c00b485150d 100644 (file)
@@ -36,6 +36,9 @@ QFloatDialog::QFloatDialog(QFloat * form)
 
        // enable span columns checkbox
        floatFP->useWide();
+       
+       // enable sideways checkbox
+       floatFP->useSideways();
 
        connect(floatFP, SIGNAL(changed()),
                this, SLOT(change_adaptor()));
index cf0150bab49caf069171a6cb95622f3426cd7479..0ae8258f278ae0ad6551dcd148efa19c5360ceae 100644 (file)
@@ -27,6 +27,7 @@ using std::string;
 
 
 // FIXME: set disabled doesn't work properly
+// should be fixed now (jspitzm)
 FloatPlacement::FloatPlacement(QWidget * parent, char * name)
        : QWidget(parent, name)
 {
@@ -42,6 +43,7 @@ FloatPlacement::FloatPlacement(QWidget * parent, char * name)
        heredefinitelyCB = new QCheckBox(qt_("Here definitely"), options);
        ignoreCB = new QCheckBox(qt_("&Ignore LaTeX rules"), options);
        spanCB = 0;
+       sidewaysCB = 0;
 
        layout->addWidget(defaultsCB);
 
@@ -93,6 +95,16 @@ void FloatPlacement::useWide()
 }
 
 
+void FloatPlacement::useSideways()
+{
+       sidewaysCB = new QCheckBox(qt_("&Rotate sideways"), this);
+       layout->addWidget(sidewaysCB);
+       setTabOrder(spanCB, sidewaysCB);
+       connect(sidewaysCB, SIGNAL(clicked()), this, SLOT(sidewaysClicked()));
+       connect(sidewaysCB, SIGNAL(toggled(bool)), this, SLOT(changedSlot()));
+}
+
+
 void FloatPlacement::changedSlot()
 {
        emit changed();
@@ -148,16 +160,21 @@ void FloatPlacement::set(InsetFloatParams const & params)
 
        if (params.wide) {
                herepossiblyCB->setChecked(false);
+               heredefinitelyCB->setChecked(false);
                bottomCB->setChecked(false);
        }
 
        spanCB->setChecked(params.wide);
+       sidewaysCB->setChecked(params.sideways);
+       sidewaysCB->setEnabled(params.type == "figure" 
+               || params.type == "table");
 }
 
 
-string const FloatPlacement::get(bool & wide) const
+string const FloatPlacement::get(bool & wide, bool & sideways) const
 {
        wide = spanCB->isChecked();
+       sideways = sidewaysCB->isChecked();
 
        return get();
 }
@@ -224,6 +241,7 @@ void FloatPlacement::spanClicked()
        if (!defaultsCB->isChecked()) {
                herepossiblyCB->setEnabled(!span);
                heredefinitelyCB->setEnabled(!span);
+               bottomCB->setEnabled(!span);
        }
 
        if (!span)
@@ -231,4 +249,30 @@ void FloatPlacement::spanClicked()
 
        herepossiblyCB->setChecked(false);
        heredefinitelyCB->setChecked(false);
+       bottomCB->setChecked(false);
+}
+
+
+void FloatPlacement::sidewaysClicked()
+{
+       bool const sideways(sidewaysCB->isChecked());
+       bool const span(spanCB->isChecked());
+       bool const defaults(defaultsCB->isChecked());
+       bool ignore(topCB->isChecked());
+       ignore |= bottomCB->isChecked();
+       ignore |= pageCB->isChecked();
+       ignore |= herepossiblyCB->isChecked();
+
+       defaultsCB->setEnabled(!sideways);
+       topCB->setEnabled(!sideways && !defaults);
+       bottomCB->setEnabled(!sideways && !defaults);
+       pageCB->setEnabled(!sideways && !defaults);
+       spanCB->setEnabled(!sideways);
+       ignoreCB->setEnabled(!sideways && !defaults && ignore);
+       herepossiblyCB->setEnabled(!sideways && !defaults);
+       heredefinitelyCB->setEnabled(!sideways && !defaults);
+       if (!sideways && !defaults) {
+               herepossiblyCB->setEnabled(!span);
+               heredefinitelyCB->setEnabled(!span);
+       }
 }
index 445ecd55a809fb769a3b9a1416158c79d91d8aa8..ae56933fe077c0830ffb3925fce03158c9ed5bca 100644 (file)
@@ -24,17 +24,19 @@ public:
        FloatPlacement(QWidget * parent, char * name);
 
        void useWide();
+       void useSideways();
 
        void set(InsetFloatParams const & params);
        void set(std::string const & placement);
 
-       std::string const get(bool & wide) const;
+       std::string const get(bool & wide, bool & sideways) const;
        std::string const get() const;
 
 public slots:
        void tbhpClicked();
        void heredefinitelyClicked();
        void spanClicked();
+       void sidewaysClicked();
        void changedSlot();
 
 signals:
@@ -45,6 +47,7 @@ private:
 
        QCheckBox * defaultsCB;
        QCheckBox * spanCB;
+       QCheckBox * sidewaysCB;
        QCheckBox * ignoreCB;
        QCheckBox * pageCB;
        QCheckBox * heredefinitelyCB;
index ba8588be3407405ac00b5395cd29285eab24a01d..57cc59170d6c02d1d5e9c0efac2c9bddc564e3f8 100644 (file)
@@ -1,3 +1,10 @@
+2004-03-29  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * FormFloat.C:
+       * forms/form_float.fd:
+       add support for sidewaysfloats
+       fix enabling of placement values (bug 1016)
+
 2004-03-28  Angus Leeming  <leeming@lyx.org>
 
        * Dialogs.C (build): added print dialog.
index c683fbcfbade875b25067ebba6b4cc76e1c65b48..85c8e48cc467fde315c74700aa3ae4889a44b968 100644 (file)
@@ -69,6 +69,7 @@ void FormFloat::build()
        bcview().addReadOnly(dialog_->check_here);
        bcview().addReadOnly(dialog_->check_force);
        bcview().addReadOnly(dialog_->check_wide);
+       bcview().addReadOnly(dialog_->check_sideways);
 
        placement_.init(dialog_->radio_default,         DOCUMENT_DEFAULTS);
        placement_.init(dialog_->radio_here_definitely, HERE_DEFINITELY);
@@ -93,12 +94,15 @@ void FormFloat::build()
        tooltips().init(dialog_->check_force, str);
        str = _("Span float over the columns.");
        tooltips().init(dialog_->check_wide, str);
+       str = _("Rotate the float sideways by 90 degs.");
+       tooltips().init(dialog_->check_sideways, str);
 }
 
 
 void FormFloat::apply()
 {
        bool const wide = fl_get_button(dialog_->check_wide);
+       bool const sideways = fl_get_button(dialog_->check_sideways);
 
        string placement;
        switch (placement_.get()) {
@@ -152,6 +156,7 @@ void FormFloat::apply()
 
        controller().params().placement = placement;
        controller().params().wide = wide;
+       controller().params().sideways = sideways;
 }
 
 
@@ -159,6 +164,9 @@ void FormFloat::update()
 {
        string placement(controller().params().placement);
        bool const wide = controller().params().wide;
+       bool const sideways = controller().params().sideways;
+       bool const sideways_possible = (controller().params().type == "figure"
+               || controller().params().type == "table");
 
        bool const here_definitely = contains(placement, 'H');
 
@@ -182,13 +190,18 @@ void FormFloat::update()
        fl_set_button(dialog_->check_page, page);
        fl_set_button(dialog_->check_here, here);
        fl_set_button(dialog_->check_wide, wide);
-
-       setEnabled(dialog_->radio_here_definitely, !wide);
-       setEnabled(dialog_->check_force,  alternatives);
-       setEnabled(dialog_->check_top,    alternatives);
-       setEnabled(dialog_->check_bottom, alternatives);
-       setEnabled(dialog_->check_page,   alternatives);
-       setEnabled(dialog_->check_here,   alternatives && !wide);
+       fl_set_button(dialog_->check_sideways, sideways);
+
+       setEnabled(dialog_->radio_here_definitely, !wide && !sideways);
+       setEnabled(dialog_->check_force,  alternatives && !sideways);
+       setEnabled(dialog_->check_top,    alternatives && !sideways);
+       setEnabled(dialog_->check_bottom, alternatives && !sideways);
+       setEnabled(dialog_->check_page,   alternatives && !sideways);
+       setEnabled(dialog_->check_here,   alternatives && !wide && !sideways);
+       setEnabled(dialog_->check_wide,   !sideways);
+       setEnabled(dialog_->radio_default,   !sideways);
+       setEnabled(dialog_->radio_alternatives,   !sideways);
+       setEnabled(dialog_->check_sideways, sideways_possible);
 }
 
 
@@ -196,16 +209,17 @@ ButtonPolicy::SMInput FormFloat::input(FL_OBJECT * ob, long)
 {
        bool const alternatives = placement_.get() == ALTERNATIVES;
        bool const wide = fl_get_button(dialog_->check_wide);
+       bool const sideways = fl_get_button(dialog_->check_sideways);
 
        if (ob == dialog_->radio_default ||
            ob == dialog_->radio_here_definitely ||
            ob == dialog_->radio_alternatives) {
                // enable check buttons only for Alternatives
                setEnabled(dialog_->check_top, alternatives);
-               setEnabled(dialog_->check_bottom, alternatives);
                setEnabled(dialog_->check_page, alternatives);
-               // wide float doesn't allow 'here' placement
+               // wide float doesn't allow 'here' or 'bottom' placement
                setEnabled(dialog_->check_here, alternatives && !wide);
+               setEnabled(dialog_->check_bottom, alternatives && !wide);
 
        } else if (ob == dialog_->check_wide) {
                if (wide && placement_.get() == HERE_DEFINITELY) {
@@ -215,11 +229,23 @@ ButtonPolicy::SMInput FormFloat::input(FL_OBJECT * ob, long)
                }
                setEnabled(dialog_->check_here, alternatives && !wide);
                setEnabled(dialog_->radio_here_definitely, !wide);
+               setEnabled(dialog_->check_bottom, alternatives && !wide);
+       
+       } else if (ob == dialog_->check_sideways) {
+               setEnabled(dialog_->radio_default,   !sideways);
+               setEnabled(dialog_->radio_alternatives,   !sideways);
+               setEnabled(dialog_->radio_here_definitely, !wide && !sideways);
+               setEnabled(dialog_->check_top, alternatives && !sideways);
+               setEnabled(dialog_->check_bottom, 
+                       alternatives && !wide && !sideways);
+               setEnabled(dialog_->check_page, alternatives && !sideways);
+               setEnabled(dialog_->check_here, alternatives && !wide && !sideways);
+               setEnabled(dialog_->check_wide,   !sideways);
        }
 
        // enable force button, if Alternatives is selected and at least
        // one of its check buttons
-       bool const enable_force = alternatives &&
+       bool const enable_force = alternatives && !sideways &&
                (fl_get_button(dialog_->check_top) ||
                 fl_get_button(dialog_->check_bottom) ||
                 fl_get_button(dialog_->check_page) ||
index 798e210faa28e09cb9a4a2fe9bf2eae031b4d25e..73b18ce4167e4476657234c8f4097e169b57c6b0 100644 (file)
@@ -10,13 +10,13 @@ SnapGrid: 5
 =============== FORM ===============
 Name: form_float
 Width: 395
-Height: 260
-Number of Objects: 17
+Height: 290
+Number of Objects: 18
 
 --------------------
 class: FL_BOX
 type: FLAT_BOX
-box: 0 0 395 260
+box: 0 0 395 290
 boxtype: FL_FLAT_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -124,7 +124,7 @@ argument: 0
 --------------------
 class: FL_BUTTON
 type: NORMAL_BUTTON
-box: 5 230 90 25
+box: 5 260 90 25
 boxtype: FL_UP_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -142,7 +142,7 @@ argument: 0
 --------------------
 class: FL_BUTTON
 type: RETURN_BUTTON
-box: 110 230 90 25
+box: 110 260 90 25
 boxtype: FL_UP_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -160,7 +160,7 @@ argument: 0
 --------------------
 class: FL_BUTTON
 type: NORMAL_BUTTON
-box: 205 230 90 25
+box: 205 260 90 25
 boxtype: FL_UP_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -178,7 +178,7 @@ argument: 0
 --------------------
 class: FL_BUTTON
 type: NORMAL_BUTTON
-box: 300 230 90 25
+box: 300 260 90 25
 boxtype: FL_UP_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -232,7 +232,7 @@ argument: 0
 --------------------
 class: FL_BEGIN_GROUP
 type: 0
-box: 0 10 10 0
+box: 0 0 0
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_CENTER
@@ -320,5 +320,23 @@ name:
 callback: 
 argument: 
 
+--------------------
+class: FL_CHECKBUTTON
+type: PUSH_BUTTON
+box: 5 225 385 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: Rotate sideways|#o
+shortcut: 
+resize: FL_RESIZE_NONE
+gravity: FL_SouthWest FL_SouthWest
+name: check_sideways
+callback: C_FormDialogView_InputCB
+argument: 0
+
 ==============================
 create_the_forms
index fc31ccc48354c15e024e5e2fb3643dea99d3874c..a5bbf7d34c4b03d9d63a4827d900c2d32b684c4e 100644 (file)
@@ -1,3 +1,7 @@
+2004-03-29  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * insetfloat.[Ch]: add param \sideways {true|false}
+       (support for sideways floats from rotating.sty).
 
 2004-03-28  Alfredo Braunstein  <abraunst@lyx.org>
 
index 2a1a485ff71261b064270b2745d25f7d7fe390bf..4f59cbc4c650287e3599d5e86453d0e63a203137 100644 (file)
@@ -162,7 +162,9 @@ void InsetFloat::priv_dispatch(LCursor & cur, FuncRequest & cmd)
                InsetFloatMailer::string2params(cmd.argument, params);
                params_.placement = params.placement;
                params_.wide      = params.wide;
+               params_.sideways  = params.sideways;
                wide(params_.wide, cur.bv().buffer()->params());
+               sideways(params_.sideways, cur.bv().buffer()->params());
                cur.bv().update();
                break;
        }
@@ -191,6 +193,11 @@ void InsetFloatParams::write(ostream & os) const
                os << "wide true\n";
        else
                os << "wide false\n";
+               
+       if (sideways)
+               os << "sideways true\n";
+       else
+               os << "sideways false\n";
 }
 
 
@@ -218,6 +225,18 @@ void InsetFloatParams::read(LyXLex & lex)
                        // take countermeasures
                        lex.pushToken(token);
                }
+               lex.next();
+               token = lex.getString();
+               if (token == "sideways") {
+                       lex.next();
+                       string const tmptoken = lex.getString();
+                       sideways = (tmptoken == "true");
+               } else {
+                       lyxerr << "InsetFloat::Read:: Missing sideways!"
+                              << endl;
+                       // take countermeasures
+                       lex.pushToken(token);
+               }
        }
 }
 
@@ -233,6 +252,7 @@ void InsetFloat::read(Buffer const & buf, LyXLex & lex)
 {
        params_.read(lex);
        wide(params_.wide, buf.params());
+       sideways(params_.sideways, buf.params());
        InsetCollapsable::read(buf, lex);
 }
 
@@ -242,6 +262,9 @@ void InsetFloat::validate(LaTeXFeatures & features) const
        if (contains(params_.placement, 'H')) {
                features.require("float");
        }
+       
+       if (params_.sideways)
+               features.require("rotating");
 
        features.useFloat(params_.type);
        InsetCollapsable::validate(features);
@@ -264,7 +287,13 @@ int InsetFloat::latex(Buffer const & buf, ostream & os,
                      OutputParams const & runparams) const
 {
        FloatList const & floats = buf.params().getLyXTextClass().floats();
-       string const tmptype = (params_.wide ? params_.type + "*" : params_.type);
+       string tmptype = (params_.wide ? params_.type + "*" : params_.type);
+       if (params_.sideways) {
+               if (params_.type == "table")
+                       tmptype = "sidewaystable";
+               else if (params_.type == "figure")
+                       tmptype = "sidewaysfigure";
+       }
        // Figure out the float placement to use.
        // From lowest to highest:
        // - float default placement
@@ -287,7 +316,8 @@ int InsetFloat::latex(Buffer const & buf, ostream & os,
        // when the current output line is empty.
        os << "%\n\\begin{" << tmptype << '}';
        // We only output placement if different from the def_placement.
-       if (!placement.empty()) {
+       // sidewaysfloats always use their own page
+       if (!placement.empty() && !params_.sideways) {
                os << '[' << placement << ']';
        }
        os << '\n';
@@ -377,6 +407,16 @@ void InsetFloat::wide(bool w, BufferParams const & bp)
 }
 
 
+void InsetFloat::sideways(bool s, BufferParams const & bp)
+{
+       params_.sideways = s;
+       string lab = _("float: ") + floatname(params_.type, bp);
+       if (params_.sideways)
+               lab += _(" (sideways)");
+       setLabel(lab);
+}
+
+
 void InsetFloat::addToToc(lyx::toc::TocList & toclist, Buffer const & buf) const
 {
        ParConstIterator pit(*this, 0);
index 53f6e742beffb043e40c009f1dead14affe8e650..633d0a75330087d20e321948541b1ef4a254adc6 100644 (file)
@@ -19,7 +19,7 @@
 
 struct InsetFloatParams {
        ///
-       InsetFloatParams() : wide(false) {}
+       InsetFloatParams() : wide(false), sideways(false) {}
        ///
        void write(std::ostream & os) const;
        ///
@@ -30,6 +30,8 @@ struct InsetFloatParams {
        std::string placement;
        ///
        bool wide;
+       ///
+       bool sideways;
 };
 
 
@@ -72,6 +74,8 @@ public:
        ///
        void wide(bool w, BufferParams const &);
        ///
+       void sideways(bool s, BufferParams const &);
+       ///
        void addToToc(lyx::toc::TocList &, Buffer const &) const;
        ///
        bool  showInsetDialog(BufferView *) const;