if (index != 1)
pagebreakCB->setChecked(false);
int itype = innerBoxCO->currentIndex();
+ if (innerBoxCO->count() == 2)
+ ++itype;
pagebreakCB->setEnabled(index == 1 && itype == 0);
widthED->setEnabled(index != 5);
widthUnitsLC->setEnabled(index != 5);
ids_spec_ = boxGuiSpecialLengthIds();
gui_names_spec_ = boxGuiSpecialLengthNames();
+ QString const current_text = widthUnitsLC->currentText();
+
// check if the widget contains the special units
- int count = widthUnitsLC->count();
+ int const count = widthUnitsLC->count();
bool has_special = false;
for (int i = 0; i != count; ++i)
if (widthUnitsLC->itemText(i).contains(qt_("Total Height")) > 0)
for (int i = 0; i != num_units; ++i)
widthUnitsLC->addItem(qt_(unit_name_gui[i]));
}
+ // restore selected text, if possible
+ int const idx = widthUnitsLC->findText(current_text);
+ if (idx != -1)
+ widthUnitsLC->setCurrentIndex(idx);
}
else
innerBoxCO->setCurrentIndex(i);
} else {
- if (innerBoxCO->count() == 2)
- ++i;
innerBoxCO->clear();
innerBoxCO->addItem(qt_("None"));
innerBoxCO->addItem(qt_("Parbox"));
#include "support/debug.h"
#include "support/gettext.h"
+#include "support/lstrings.h"
#include "support/Translator.h"
#include "frontends/Application.h"
#include <sstream>
using namespace std;
+using namespace lyx::support;
namespace lyx {
void InsetBox::setButtonLabel()
{
- BoxType btype = boxtranslator().find(params_.type);
+ BoxType const btype = boxtranslator().find(params_.type);
- docstring label;
- label += _("Box");
- label += " (";
- if (btype == Frameless) {
+ docstring const type = _("Box");
+
+ docstring inner;
+ if (params_.inner_box) {
if (params_.use_parbox)
- label += _("Parbox");
+ inner = _("Parbox");
else
- label += _("Minipage");
- } else {
- label += boxtranslator_loc().find(btype);
+ inner = _("Minipage");
}
- label += ")";
+ docstring frame;
+ if (btype != Frameless)
+ frame = boxtranslator_loc().find(btype);
+
+ docstring label;
+ if (inner.empty() && frame.empty())
+ label = type;
+ else if (inner.empty())
+ label = bformat(_("%1$s (%2$s)"),
+ type, frame);
+ else if (frame.empty())
+ label = bformat(_("%1$s (%2$s)"),
+ type, inner);
+ else
+ label = bformat(_("%1$s (%2$s, %3$s)"),
+ type, inner, frame);
setLabel(label);
}