From 4072a82b6ea1d9d52457ffcf3dd108f8deaf3db0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Mon, 29 Mar 2004 11:38:39 +0000 Subject: [PATCH] support for sidewaysfloats and fix for bug 1016 (float placement allows impossible settings). 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 --- development/FORMAT | 13 +++++++ lib/lyx2lyx/ChangeLog | 4 +++ lib/lyx2lyx/lyx2lyx | 3 +- lib/lyx2lyx/lyxconvert_230.py | 29 +++++++++++++++ lib/lyx2lyx/lyxrevert_231.py | 29 +++++++++++++++ po/POTFILES.in | 2 ++ src/ChangeLog | 4 +++ src/buffer.C | 2 +- src/frontends/qt2/ChangeLog | 7 ++++ src/frontends/qt2/QFloat.C | 2 +- src/frontends/qt2/QFloatDialog.C | 3 ++ src/frontends/qt2/floatplacement.C | 46 +++++++++++++++++++++++- src/frontends/qt2/floatplacement.h | 5 ++- src/frontends/xforms/ChangeLog | 7 ++++ src/frontends/xforms/FormFloat.C | 44 ++++++++++++++++++----- src/frontends/xforms/forms/form_float.fd | 34 +++++++++++++----- src/insets/ChangeLog | 4 +++ src/insets/insetfloat.C | 44 +++++++++++++++++++++-- src/insets/insetfloat.h | 6 +++- 19 files changed, 263 insertions(+), 25 deletions(-) create mode 100644 lib/lyx2lyx/lyxconvert_230.py create mode 100644 lib/lyx2lyx/lyxrevert_231.py diff --git a/development/FORMAT b/development/FORMAT index 6918c28d87..c8c5e76508 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -1,6 +1,19 @@ LyX file-format changes ----------------------- +2004-03-29 Jürgen Spitzmüller + + * 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} \end{sidewaysfigure} + resp. + \begin{sidewaystable} \end{sidewaystable} + i.e. ERT. + 2004-02-23 Jürgen Spitzmüller * format incremented to 230. diff --git a/lib/lyx2lyx/ChangeLog b/lib/lyx2lyx/ChangeLog index 405112a856..e084d31cb6 100644 --- a/lib/lyx2lyx/ChangeLog +++ b/lib/lyx2lyx/ChangeLog @@ -1,3 +1,7 @@ +2004-03-29 Jürgen Spitzmüller + + * lyx2lyx: up the format to 231. + 2004-03-26 Georg Baum * lyxrevert_225.py (convert_frameless_box): fix minipage ERT output diff --git a/lib/lyx2lyx/lyx2lyx b/lib/lyx2lyx/lyx2lyx index a7d86d6e13..b973a626bf 100755 --- a/lib/lyx2lyx/lyx2lyx +++ b/lib/lyx2lyx/lyx2lyx @@ -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 index 0000000000..22c7fc658b --- /dev/null +++ b/lib/lyx2lyx/lyxconvert_230.py @@ -0,0 +1,29 @@ +# This file is part of lyx2lyx +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2003 José Matos +# +# 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 index 0000000000..22c7fc658b --- /dev/null +++ b/lib/lyx2lyx/lyxrevert_231.py @@ -0,0 +1,29 @@ +# This file is part of lyx2lyx +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2003 José Matos +# +# 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/po/POTFILES.in b/po/POTFILES.in index af87e6f0fd..46197d4722 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -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 diff --git a/src/ChangeLog b/src/ChangeLog index 6a6e39b49d..29affcef39 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,6 @@ +2004-03-29 Jürgen Spitzmüller + + * buffer.C: increment file format to 231. 2004-03-28 Alfredo Braunstein @@ -221,6 +224,7 @@ * lyxrc.C (setDefaults, getDescription, output, read): * lyxrc.h: remove ps_command +>>>>>>> 1.1856 2004-03-22 Angus Leeming * lyx_main.C (error_handler, init): remove handler for SIGPIPE. diff --git a/src/buffer.C b/src/buffer.C index e0010c2247..f4318371a4 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -130,7 +130,7 @@ extern BufferList bufferlist; namespace { -const int LYX_FORMAT = 230; +const int LYX_FORMAT = 231; } // namespace anon diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index a1eb4b0082..0d6ce8b280 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,10 @@ +2004-03-29 Jürgen Spitzmüller + + * QFloat.C: + * QFloatDialog.C: + * floatplacement.[Ch]: add support for sidewaysfloats + fix enabling of placement values (bug 1016) + 2004-03-28 Angus Leeming * Dialogs.C (build): added print dialog. diff --git a/src/frontends/qt2/QFloat.C b/src/frontends/qt2/QFloat.C index df292388ea..30e46211d4 100644 --- a/src/frontends/qt2/QFloat.C +++ b/src/frontends/qt2/QFloat.C @@ -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); } diff --git a/src/frontends/qt2/QFloatDialog.C b/src/frontends/qt2/QFloatDialog.C index ebb70581b6..cfb1b27298 100644 --- a/src/frontends/qt2/QFloatDialog.C +++ b/src/frontends/qt2/QFloatDialog.C @@ -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())); diff --git a/src/frontends/qt2/floatplacement.C b/src/frontends/qt2/floatplacement.C index cf0150bab4..0ae8258f27 100644 --- a/src/frontends/qt2/floatplacement.C +++ b/src/frontends/qt2/floatplacement.C @@ -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); + } } diff --git a/src/frontends/qt2/floatplacement.h b/src/frontends/qt2/floatplacement.h index 445ecd55a8..ae56933fe0 100644 --- a/src/frontends/qt2/floatplacement.h +++ b/src/frontends/qt2/floatplacement.h @@ -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; diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index ba8588be34..57cc59170d 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,10 @@ +2004-03-29 Jürgen Spitzmüller + + * FormFloat.C: + * forms/form_float.fd: + add support for sidewaysfloats + fix enabling of placement values (bug 1016) + 2004-03-28 Angus Leeming * Dialogs.C (build): added print dialog. diff --git a/src/frontends/xforms/FormFloat.C b/src/frontends/xforms/FormFloat.C index c683fbcfba..85c8e48cc4 100644 --- a/src/frontends/xforms/FormFloat.C +++ b/src/frontends/xforms/FormFloat.C @@ -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); + fl_set_button(dialog_->check_sideways, sideways); - 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); + 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) || diff --git a/src/frontends/xforms/forms/form_float.fd b/src/frontends/xforms/forms/form_float.fd index 798e210faa..73b18ce416 100644 --- a/src/frontends/xforms/forms/form_float.fd +++ b/src/frontends/xforms/forms/form_float.fd @@ -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 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 diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index fc31ccc483..a5bbf7d34c 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,7 @@ +2004-03-29 Jürgen Spitzmüller + + * insetfloat.[Ch]: add param \sideways {true|false} + (support for sideways floats from rotating.sty). 2004-03-28 Alfredo Braunstein diff --git a/src/insets/insetfloat.C b/src/insets/insetfloat.C index 2a1a485ff7..4f59cbc4c6 100644 --- a/src/insets/insetfloat.C +++ b/src/insets/insetfloat.C @@ -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); diff --git a/src/insets/insetfloat.h b/src/insets/insetfloat.h index 53f6e742be..633d0a7533 100644 --- a/src/insets/insetfloat.h +++ b/src/insets/insetfloat.h @@ -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;