* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
- * \author Jürgen Vigna (Minipage stuff)
+ * \author Jürgen Vigna (Minipage stuff)
* \author Martin Vermeer
- * \author Jürgen Spitzmüller
+ * \author Jürgen Spitzmüller
*
* Full author contact details are available in file CREDITS.
*/
#include "GuiBox.h"
#include "LengthCombo.h"
+#include "Length.h"
#include "qt_helpers.h"
-#include "lengthcommon.h"
-#include "LyXRC.h" // to set the default length values
#include "Validator.h"
-#include "controllers/ControlBox.h"
-#include "controllers/frontend_helpers.h"
-
#include "insets/InsetBox.h"
+#include "support/gettext.h"
+#include "support/foreach.h"
#include "support/lstrings.h"
#include <QPushButton>
#include <QLineEdit>
-#include <QCloseEvent>
+#ifdef IN
+#undef IN
+#endif
-using lyx::support::getStringFromVector;
-using lyx::support::isStrDbl;
-using lyx::support::subst;
-using std::string;
+using namespace std;
namespace lyx {
namespace frontend {
-//////////////////////////////////////////////////////////////////
-//
-// GuiBoxDialog
-//
-//////////////////////////////////////////////////////////////////
+static QStringList boxGuiIds()
+{
+ return QStringList()
+ << "Frameless" << "Boxed"
+ << "ovalbox" << "Ovalbox"
+ << "Shadowbox" << "Shaded"
+ << "Doublebox";
+}
-GuiBoxDialog::GuiBoxDialog(GuiBox * form)
- : form_(form)
+
+static QStringList boxGuiNames()
{
- setupUi(this);
- connect(restorePB, SIGNAL(clicked()), form, SLOT(slotRestore()));
- connect(okPB, SIGNAL(clicked()), form, SLOT(slotOK()));
- connect(applyPB, SIGNAL(clicked()), form, SLOT(slotApply()));
- connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose()));
+ return QStringList()
+ << qt_("No frame") << qt_("Simple rectangular frame")
+ << qt_("Oval frame, thin") << qt_("Oval frame, thick")
+ << qt_("Drop shadow") << qt_("Shaded background")
+ << qt_("Double rectangular frame");
+}
- connect(widthED, SIGNAL(textChanged(const QString &)),
- this, SLOT(change_adaptor()));
- connect(widthUnitsLC, SIGNAL(selectionChanged(lyx::Length::UNIT)),
- this, SLOT(change_adaptor()));
- connect(valignCO, SIGNAL(highlighted(const QString &)),
- this, SLOT(change_adaptor()));
- connect(heightED, SIGNAL(textChanged(const QString &)),
- this, SLOT(change_adaptor()));
- connect(heightUnitsLC, SIGNAL(selectionChanged(lyx::Length::UNIT) ),
- this, SLOT(change_adaptor()));
- connect(restorePB, SIGNAL(clicked()), this, SLOT(restoreClicked()));
- connect(typeCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
- connect(typeCO, SIGNAL(activated(int)), this, SLOT(typeChanged(int)));
- connect(halignCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
- connect(ialignCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
- connect(innerBoxCO, SIGNAL(activated(const QString&)),
- this, SLOT(innerBoxChanged(const QString &)));
- connect(innerBoxCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
- heightED->setValidator(unsignedLengthValidator(heightED));
- widthED->setValidator(unsignedLengthValidator(widthED));
+static QStringList boxGuiSpecialLengthIds()
+{
+ return QStringList() << "height" << "depth"
+ << "totalheight" << "width";
}
-void GuiBoxDialog::closeEvent(QCloseEvent * e)
+static QStringList boxGuiSpecialLengthNames()
{
- form_->slotWMHide();
- e->accept();
+ return QStringList() << qt_("Height") << qt_("Depth")
+ << qt_("Total Height") << qt_("Width");
}
-void GuiBoxDialog::change_adaptor()
+GuiBox::GuiBox(QWidget * parent) : InsetParamsWidget(parent)
{
- form_->changed();
+ setupUi(this);
+
+ // fill the box type choice
+ ids_ = boxGuiIds();
+ gui_names_ = boxGuiNames();
+ for (int i = 0; i != ids_.size(); ++i)
+ typeCO->addItem(gui_names_[i], ids_[i]);
+
+ // add the special units to the height choice
+ // width needs different handling
+ ids_spec_ = boxGuiSpecialLengthIds();
+ gui_names_spec_ = boxGuiSpecialLengthNames();
+ for (int i = 0; i != ids_spec_.size(); ++i)
+ heightUnitsLC->addItem(gui_names_spec_[i], ids_spec_[i]);
+
+ connect(widthED, SIGNAL(textChanged(QString)), this, SIGNAL(changed()));
+ connect(widthUnitsLC, SIGNAL(selectionChanged(lyx::Length::UNIT)),
+ this, SIGNAL(changed()));
+ connect(valignCO, SIGNAL(highlighted(QString)), this, SIGNAL(changed()));
+ connect(heightED, SIGNAL(textChanged(QString)), this, SIGNAL(changed()));
+ connect(heightUnitsLC, SIGNAL(selectionChanged(lyx::Length::UNIT)),
+ this, SIGNAL(changed()));
+ connect(halignCO, SIGNAL(activated(int)), this, SIGNAL(changed()));
+ connect(ialignCO, SIGNAL(activated(int)), this, SIGNAL(changed()));
+
+ heightED->setValidator(unsignedLengthValidator(heightED));
+ widthED->setValidator(unsignedLengthValidator(widthED));
+
+ // initialize the length validator
+ addCheckedWidget(widthED, widthLA);
+ addCheckedWidget(heightED, heightCB);
+
+ initDialog();
}
-void GuiBoxDialog::innerBoxChanged(const QString & str)
+void GuiBox::on_innerBoxCO_activated(int /* index */)
{
- bool const ibox = (str != qt_("None"));
+ QString itype =
+ innerBoxCO->itemData(innerBoxCO->currentIndex()).toString();
+ // handle parbox and minipage the same way
+ bool const ibox =
+ (itype != "none"
+ && itype != "makebox");
+ QString const outer =
+ typeCO->itemData(typeCO->currentIndex()).toString();
valignCO->setEnabled(ibox);
ialignCO->setEnabled(ibox);
- halignCO->setEnabled(!ibox);
- heightED->setEnabled(ibox);
- heightUnitsLC->setEnabled(ibox);
- form_->setSpecial(ibox);
+ if (heightCB->isChecked() && !ibox)
+ heightCB->setChecked(false);
+ heightCB->setEnabled(ibox);
+ // except for frameless and boxed, the width cannot be specified if
+ // there is no inner box
+ bool const width_enabled =
+ ibox || outer == "Frameless" || outer == "Boxed";
+ widthED->setEnabled(width_enabled);
+ widthUnitsLC->setEnabled(width_enabled);
+ // halign is only allowed for Boxed without inner box or for makebox
+ halignCO->setEnabled((!ibox && outer == "Boxed")
+ || (itype == "makebox"));
+ // pagebreak is only allowed for Boxed without inner box
+ pagebreakCB->setEnabled(!ibox && outer == "Boxed");
+ setSpecial(ibox);
+ changed();
}
-void GuiBoxDialog::typeChanged(int index)
+void GuiBox::on_typeCO_activated(int index)
{
- bool const frameless = (index == 0);
- if (frameless) {
- valignCO->setEnabled(true);
- ialignCO->setEnabled(true);
- halignCO->setEnabled(false);
- heightED->setEnabled(true);
- heightUnitsLC->setEnabled(true);
- form_->setSpecial(true);
+ QString const type =
+ typeCO->itemData(index).toString();
+ bool const frameless = (type == "Frameless");
+ QString itype =
+ innerBoxCO->itemData(innerBoxCO->currentIndex()).toString();
+ setInnerType(frameless, itype);
+ // refresh itype because it might have been changed in setInnerType
+ itype =
+ innerBoxCO->itemData(innerBoxCO->currentIndex()).toString();
+ // handle parbox and minipage the same way
+ bool const ibox =
+ (itype != "none"
+ && itype != "makebox");
+ if (frameless && itype != "makebox") {
+ valignCO->setEnabled(ibox);
+ ialignCO->setEnabled(ibox);
+ if (heightCB->isChecked() && !ibox)
+ heightCB->setChecked(false);
+ heightCB->setEnabled(ibox);
+ setSpecial(ibox);
}
- int itype = innerBoxCO->currentIndex();
- form_->setInnerType(frameless, itype);
+ // except for frameless and boxed, the width cannot be specified if
+ // there is no inner box
+ bool const width_enabled =
+ itype != "none" || frameless || type == "Boxed";
+ widthED->setEnabled(width_enabled);
+ widthUnitsLC->setEnabled(width_enabled);
+ // halign is only allowed for Boxed without inner box or for makebox
+ halignCO->setEnabled((type == "Boxed" && itype == "none") || (itype == "makebox"));
+ // pagebreak is only allowed for Boxed without inner box
+ pagebreakCB->setEnabled(type == "Boxed" && itype == "none");
+ changed();
}
-void GuiBoxDialog::restoreClicked()
+void GuiBox::initDialog()
{
- form_->setInnerType(true, 2);
+ setInnerType(true, toqstr("minipage"));
widthED->setText("100");
widthUnitsLC->setCurrentItem(Length::PCW);
heightED->setText("1");
- for (int j = 0; j < heightUnitsLC->count(); j++) {
- if (heightUnitsLC->itemText(j) == qt_("Total Height"))
- heightUnitsLC->setCurrentItem(j);
- }
+ heightUnitsLC->setCurrentItem("totalheight");
}
-//////////////////////////////////////////////////////////////////
-//
-// GuiBox
-//
-//////////////////////////////////////////////////////////////////
-
-
-GuiBox::GuiBox(GuiDialog & parent)
- : GuiView<GuiBoxDialog>(parent, _("Box Settings"))
-{}
-
-
-void GuiBox::build_dialog()
+void GuiBox::on_heightCB_stateChanged(int state)
{
- dialog_.reset(new GuiBoxDialog(this));
-
- // fill the box type choice
- box_gui_tokens(ids_, gui_names_);
- for (unsigned int i = 0; i < gui_names_.size(); ++i)
- dialog_->typeCO->addItem(toqstr(gui_names_[i]));
+ bool const enable = (innerBoxCO->currentText() != qt_("None"))
+ && (state == Qt::Checked);
+ heightED->setEnabled(enable);
+ heightUnitsLC->setEnabled(enable);
+ changed();
+}
- // add the special units to the height choice
- // width needs different handling
- box_gui_tokens_special_length(ids_spec_, gui_names_spec_);
- for (unsigned int i = 1; i < gui_names_spec_.size(); ++i)
- dialog_->heightUnitsLC->addItem(toqstr(gui_names_spec_[i]));
-
- bc().addReadOnly(dialog_->typeCO);
- bc().addReadOnly(dialog_->innerBoxCO);
- bc().addReadOnly(dialog_->valignCO);
- bc().addReadOnly(dialog_->ialignCO);
- bc().addReadOnly(dialog_->halignCO);
- bc().addReadOnly(dialog_->widthED);
- bc().addReadOnly(dialog_->heightED);
- bc().addReadOnly(dialog_->widthUnitsLC);
- bc().addReadOnly(dialog_->heightUnitsLC);
-
- bc().setRestore(dialog_->restorePB);
- bc().setOK(dialog_->okPB);
- bc().setApply(dialog_->applyPB);
- bc().setCancel(dialog_->closePB);
- // initialize the length validator
- bc().addCheckedLineEdit(dialog_->widthED, dialog_->widthLA);
- bc().addCheckedLineEdit(dialog_->heightED, dialog_->heightLA);
+void GuiBox::on_pagebreakCB_stateChanged()
+{
+ bool pbreak = (pagebreakCB->checkState() == Qt::Checked);
+ innerBoxCO->setEnabled(!pbreak);
+ widthED->setEnabled(!pbreak);
+ widthUnitsLC->setEnabled(!pbreak);
+ if (!pbreak) {
+ on_typeCO_activated(typeCO->currentIndex());
+ return;
+ }
+ valignCO->setEnabled(false);
+ ialignCO->setEnabled(false);
+ halignCO->setEnabled(false);
+ heightCB->setEnabled(false);
+ heightED->setEnabled(false);
+ heightUnitsLC->setEnabled(false);
+ setSpecial(false);
+ changed();
}
-void GuiBox::update_contents()
+void GuiBox::paramsToDialog(Inset const * inset)
{
- string type(controller().params().type);
- for (unsigned int i = 0; i < gui_names_.size(); ++i) {
- if (type == ids_[i])
- dialog_->typeCO->setCurrentIndex(i);
+ InsetBox const * box = static_cast<InsetBox const *>(inset);
+ InsetBoxParams const & params = box->params();
+ QString type = toqstr(params.type);
+ if (type == "Framed") {
+ pagebreakCB->setChecked(true);
+ type = "Boxed";
+ } else {
+ pagebreakCB->setChecked(false);
}
+ typeCO->setCurrentIndex(typeCO->findData(type));
+
// default: minipage
- unsigned int inner_type = 2;
- if (!controller().params().inner_box)
- // none
- inner_type = 0;
- if (controller().params().use_parbox)
- // parbox
- inner_type = 1;
- bool frameless = (controller().params().type == "Frameless");
+ QString inner_type = "minipage";
+ if (!params.inner_box)
+ inner_type = "none";
+ if (params.use_parbox)
+ inner_type = "parbox";
+ if (params.use_makebox)
+ inner_type = "makebox";
+ bool const frameless = (params.type == "Frameless");
setInnerType(frameless, inner_type);
- char c = controller().params().pos;
- dialog_->valignCO->setCurrentIndex(string("tcb").find(c, 0));
- c = controller().params().inner_pos;
- dialog_->ialignCO->setCurrentIndex(string("tcbs").find(c, 0));
- c = controller().params().hor_pos;
- dialog_->halignCO->setCurrentIndex(string("lcrs").find(c, 0));
-
- bool ibox = controller().params().inner_box;
- dialog_->valignCO->setEnabled(ibox);
- dialog_->ialignCO->setEnabled(ibox);
- dialog_->halignCO->setEnabled(!ibox);
- setSpecial(ibox);
-
- Length::UNIT default_unit =
- (lyxrc.default_papersize > 3) ? Length::CM : Length::IN;
+ char c = params.pos;
+ valignCO->setCurrentIndex(string("tcb").find(c, 0));
+ c = params.inner_pos;
+ ialignCO->setCurrentIndex(string("tcbs").find(c, 0));
+ c = params.hor_pos;
+ halignCO->setCurrentIndex(string("lcrs").find(c, 0));
- lengthToWidgets(dialog_->widthED, dialog_->widthUnitsLC,
- (controller().params().width).asString(), default_unit);
-
- string const special(controller().params().special);
- if (!special.empty() && special != "none") {
- QString spc;
- for (unsigned int i = 0; i < gui_names_spec_.size(); i++) {
- if (special == ids_spec_[i])
- spc = toqstr(gui_names_spec_[i].c_str());
- }
- for (int j = 0; j < dialog_->widthUnitsLC->count(); j++) {
- if (dialog_->widthUnitsLC->itemText(j) == spc)
- dialog_->widthUnitsLC->setCurrentIndex(j);
- }
- }
-
- lengthToWidgets(dialog_->heightED, dialog_->heightUnitsLC,
- (controller().params().height).asString(), default_unit);
-
- string const height_special(controller().params().height_special);
- if (!height_special.empty() && height_special != "none") {
- QString hspc;
- for (unsigned int i = 0; i < gui_names_spec_.size(); i++) {
- if (height_special == ids_spec_[i]) {
- hspc = toqstr(gui_names_spec_[i].c_str());
- }
- }
- for (int j = 0; j < dialog_->heightUnitsLC->count(); j++) {
- if (dialog_->heightUnitsLC->itemText(j) == hspc) {
- dialog_->heightUnitsLC->setCurrentIndex(j);
- }
- }
- }
+ bool ibox = (params.inner_box && !params.use_makebox);
+ valignCO->setEnabled(ibox);
+ ialignCO->setEnabled(ibox);
+ setSpecial(ibox);
- dialog_->heightED->setEnabled(ibox);
- dialog_->heightUnitsLC->setEnabled(ibox);
+ // halign and pagebreak are only allowed for Boxed without inner box
+ halignCO->setEnabled((!ibox && type == "Boxed") || (params.use_makebox));
+ // pagebreak is only allowed for Boxed without inner box
+ pagebreakCB->setEnabled(!ibox && type == "Boxed");
+
+ // except for frameless and boxed, the width cannot be specified if
+ // there is no inner box
+ bool const width_enabled = (ibox || frameless || type == "Boxed");
+ widthED->setEnabled(width_enabled);
+ widthUnitsLC->setEnabled(width_enabled);
+
+ Length::UNIT const default_unit = Length::defaultUnit();
+
+ lengthToWidgets(widthED, widthUnitsLC,
+ (params.width).asString(), default_unit);
+
+ QString const special = toqstr(params.special);
+ if (!special.isEmpty() && special != "none")
+ widthUnitsLC->setCurrentItem(special);
+
+ lengthToWidgets(heightED, heightUnitsLC,
+ (params.height).asString(), default_unit);
+
+ QString const height_special = toqstr(params.height_special);
+ if (!height_special.isEmpty() && height_special != "none")
+ heightUnitsLC->setCurrentItem(height_special);
+ // set no optional height if the value is the default "1\height"
+ // (special units like \height are handled as "in",
+ // FIXME: this is a very bad UI, this check box should be disabled in
+ // this case, not forced to 'unchecked' state.
+ if (height_special == "totalheight" && params.height == Length("1in"))
+ heightCB->setCheckState(Qt::Unchecked);
+ else
+ heightCB->setCheckState(Qt::Checked);
+
+ heightCB->setEnabled(ibox);
}
-void GuiBox::applyView()
+docstring GuiBox::dialogToParams() const
{
- controller().params().type =
- ids_[dialog_->typeCO->currentIndex()];
-
- controller().params().inner_box =
- dialog_->innerBoxCO->currentText() != qt_("None");
- controller().params().use_parbox =
- dialog_->innerBoxCO->currentText() == qt_("Parbox");
-
- controller().params().pos =
- "tcb"[dialog_->valignCO->currentIndex()];
- controller().params().inner_pos =
- "tcbs"[dialog_->ialignCO->currentIndex()];
- controller().params().hor_pos =
- "lcrs"[dialog_->halignCO->currentIndex()];
-
- int i = 0;
- bool spec = false;
- QString special = dialog_->widthUnitsLC->currentText();
- QString value = dialog_->widthED->text();
- if (special == qt_("Height")) {
- i = 1;
- spec = true;
- } else if (special == qt_("Depth")) {
- i = 2;
- spec = true;
- } else if (special == qt_("Total Height")) {
- i = 3;
- spec = true;
- } else if (special == qt_("Width")) {
- i = 4;
- spec = true;
- }
- // the user might insert a non-special value in the line edit
- if (isValidLength(fromqstr(value))) {
- i = 0;
- spec = false;
- }
- controller().params().special = ids_spec_[i];
-
- string width;
- if (spec) {
- width = fromqstr(value);
- // beware: bogosity! the unit is simply ignored in this case
- width += "in";
- } else
- width = widgetsToLength(dialog_->widthED, dialog_->widthUnitsLC);
-
- controller().params().width = Length(width);
-
- i = 0;
- spec = false;
- special = dialog_->heightUnitsLC->currentText();
- value = dialog_->heightED->text();
- if (special == qt_("Height")) {
- i = 1;
- spec = true;
- } else if (special == qt_("Depth")) {
- i = 2;
- spec = true;
- } else if (special == qt_("Total Height")) {
- i = 3;
- spec = true;
- } else if (special == qt_("Width")) {
- i = 4;
- spec = true;
- }
- // the user might insert a non-special value in the line edit
- if (isValidLength(fromqstr(value))) {
- i = 0;
- spec = false;
+ bool const pagebreak =
+ pagebreakCB->isEnabled() && pagebreakCB->isChecked();
+ string box_type;
+ if (pagebreak)
+ box_type = "Framed";
+ else
+ box_type = fromqstr(typeCO->itemData(
+ typeCO->currentIndex()).toString());
+
+ InsetBoxParams params(box_type);
+ params.inner_box =
+ (!pagebreak && innerBoxCO->currentText() != qt_("None"));
+ params.use_parbox =
+ (!pagebreak && innerBoxCO->currentText() == qt_("Parbox"));
+ params.use_makebox =
+ (!pagebreak && innerBoxCO->currentText() == qt_("Makebox"));
+
+ params.pos = "tcb"[valignCO->currentIndex()];
+ params.inner_pos = "tcbs"[ialignCO->currentIndex()];
+ params.hor_pos = "lcrs"[halignCO->currentIndex()];
+
+ QString unit =
+ widthUnitsLC->itemData(widthUnitsLC->currentIndex()).toString();
+ QString value = widthED->text();
+ if (ids_spec_.contains(unit) && !isValidLength(fromqstr(value))) {
+ params.special = fromqstr(unit);
+ // Note: the unit is simply ignored in this case
+ params.width = Length(value.toDouble(), Length::IN);
+ } else {
+ params.special = "none";
+ params.width = Length(widgetsToLength(widthED, widthUnitsLC));
}
- controller().params().height_special = ids_spec_[i];
- string height;
- if (spec && !isValidLength(fromqstr(dialog_->heightED->text()))) {
- height = fromqstr(value);
- // beware: bogosity! the unit is simply ignored in this case
- height += "in";
- } else
- height = widgetsToLength(dialog_->heightED, dialog_->heightUnitsLC);
-
- controller().params().height = Length(height);
+ // the height parameter is omitted if the value
+ // is "1in" and "Total Height" is used as unit.
+ // 1in + "Total Height" means "1\height" which is the LaTeX default
+ // if no height is given
+ if (heightCB->checkState() == Qt::Unchecked) {
+ params.height = Length("1in");
+ params.height_special = "totalheight";
+ } else {
+ unit = heightUnitsLC->itemData(heightUnitsLC->currentIndex()).toString();
+ value = heightED->text();
+ if (ids_spec_.contains(unit) && !isValidLength(fromqstr(value))) {
+ params.height_special = fromqstr(unit);
+ // Note: the unit is simply ignored in this case
+ params.height = Length(value.toDouble(), Length::IN);
+ } else {
+ params.height_special = "none";
+ params.height =
+ Length(widgetsToLength(heightED, heightUnitsLC));
+ }
+ }
+ return from_ascii(InsetBox::params2string(params));
}
void GuiBox::setSpecial(bool ibox)
{
- box_gui_tokens_special_length(ids_spec_, gui_names_spec_);
+ QString const last_item =
+ widthUnitsLC->itemData(heightUnitsLC->currentIndex()).toString();
+
// check if the widget contains the special units
- int count = dialog_->widthUnitsLC->count();
- bool has_special = false;
- for (int i = 0; i < count; i++)
- if (dialog_->widthUnitsLC->itemText(i).contains(qt_("Total Height")) > 0)
- has_special = true;
+ bool const has_special = (widthUnitsLC->findData("totalheight") != -1);
// insert 'em if needed...
if (!ibox && !has_special) {
- for (unsigned int i = 1; i < gui_names_spec_.size(); i++)
- dialog_->widthUnitsLC->addItem(toqstr(gui_names_spec_[i]));
+ for (int i = 1; i < ids_spec_.size(); ++i)
+ widthUnitsLC->addItem(gui_names_spec_[i], ids_spec_[i]);
// ... or remove 'em if needed
} else if (ibox && has_special) {
- dialog_->widthUnitsLC->clear();
- for (int i = 0; i < num_units; i++)
- dialog_->widthUnitsLC->addItem(qt_(unit_name_gui[i]));
+ for (int i = 1; i < ids_spec_.size(); ++i) {
+ int n = widthUnitsLC->findData(ids_spec_[i]);
+ if (n != -1)
+ widthUnitsLC->removeItem(n);
+ }
}
+ // restore selected text, if possible
+ widthUnitsLC->setCurrentItem(last_item);
}
-void GuiBox::setInnerType(bool frameless, int i)
+void GuiBox::setInnerType(bool frameless, QString const & type)
{
- // with "frameless" boxes, inner box is mandatory (i.e. is the actual box)
+ // with "frameless" boxes, inner box is mandatory
+ // (i.e. is the actual box)
// we have to remove "none" then and adjust the combo
- if (frameless) {
- dialog_->innerBoxCO->clear();
- dialog_->innerBoxCO->addItem(qt_("Parbox"));
- dialog_->innerBoxCO->addItem(qt_("Minipage"));
- dialog_->innerBoxCO->setCurrentIndex(i - 1);
- } else {
- if (dialog_->innerBoxCO->count() == 2)
- i += 1;
- dialog_->innerBoxCO->clear();
- dialog_->innerBoxCO->addItem(qt_("None"));
- dialog_->innerBoxCO->addItem(qt_("Parbox"));
- dialog_->innerBoxCO->addItem(qt_("Minipage"));
- dialog_->innerBoxCO->setCurrentIndex(i);
- }
+ innerBoxCO->clear();
+ if (!frameless)
+ innerBoxCO->addItem(qt_("None"), toqstr("none"));
+ else
+ innerBoxCO->addItem(qt_("Makebox"), toqstr("makebox"));
+ innerBoxCO->addItem(qt_("Parbox"), toqstr("parbox"));
+ innerBoxCO->addItem(qt_("Minipage"), toqstr("minipage"));
+ int i = (innerBoxCO->findData(type) != -1)
+ ? innerBoxCO->findData(type) : 0;
+ innerBoxCO->setCurrentIndex(i);
}
} // namespace frontend
} // namespace lyx
-#include "GuiBox_moc.cpp"
+#include "moc_GuiBox.cpp"