mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 05:25:26 +00:00
Box fixes from Vincent and me.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26711 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c4570a96da
commit
e2fc0d4385
@ -185,6 +185,8 @@ void GuiBox::typeChanged(int index)
|
||||
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);
|
||||
@ -414,8 +416,10 @@ void GuiBox::setSpecial(bool ibox)
|
||||
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)
|
||||
@ -430,6 +434,10 @@ void GuiBox::setSpecial(bool ibox)
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@ -446,8 +454,6 @@ void GuiBox::setInnerType(bool frameless, int i)
|
||||
else
|
||||
innerBoxCO->setCurrentIndex(i);
|
||||
} else {
|
||||
if (innerBoxCO->count() == 2)
|
||||
++i;
|
||||
innerBoxCO->clear();
|
||||
innerBoxCO->addItem(qt_("None"));
|
||||
innerBoxCO->addItem(qt_("Parbox"));
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#include "support/debug.h"
|
||||
#include "support/gettext.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "support/Translator.h"
|
||||
|
||||
#include "frontends/Application.h"
|
||||
@ -35,6 +36,7 @@
|
||||
#include <sstream>
|
||||
|
||||
using namespace std;
|
||||
using namespace lyx::support;
|
||||
|
||||
namespace lyx {
|
||||
|
||||
@ -139,21 +141,34 @@ void InsetBox::read(Lexer & lex)
|
||||
|
||||
void InsetBox::setButtonLabel()
|
||||
{
|
||||
BoxType btype = boxtranslator().find(params_.type);
|
||||
BoxType const btype = boxtranslator().find(params_.type);
|
||||
|
||||
docstring const type = _("Box");
|
||||
|
||||
docstring inner;
|
||||
if (params_.inner_box) {
|
||||
if (params_.use_parbox)
|
||||
inner = _("Parbox");
|
||||
else
|
||||
inner = _("Minipage");
|
||||
}
|
||||
|
||||
docstring frame;
|
||||
if (btype != Frameless)
|
||||
frame = boxtranslator_loc().find(btype);
|
||||
|
||||
docstring label;
|
||||
label += _("Box");
|
||||
label += " (";
|
||||
if (btype == Frameless) {
|
||||
if (params_.use_parbox)
|
||||
label += _("Parbox");
|
||||
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 += _("Minipage");
|
||||
} else {
|
||||
label += boxtranslator_loc().find(btype);
|
||||
}
|
||||
label += ")";
|
||||
|
||||
label = bformat(_("%1$s (%2$s, %3$s)"),
|
||||
type, inner, frame);
|
||||
setLabel(label);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user