#include "GuiBox.h"
#include "FuncRequest.h"
-#include "gettext.h"
+#include "support/gettext.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 <QPushButton>
#include <QLineEdit>
-#include <QCloseEvent>
-
-using std::string;
-using std::vector;
+using namespace std;
namespace lyx {
namespace frontend {
{
char const * const ids_[] = {
"Frameless", "Boxed", "ovalbox",
- "Ovalbox", "Shadowbox", "Doublebox"};
+ "Ovalbox", "Shadowbox", "Shaded", "Doublebox"};
size_t const ids_size = sizeof(ids_) / sizeof(char *);
ids = vector<string>(ids_, ids_ + ids_size);
gui_names.clear();
- gui_names.push_back(_("No frame drawn"));
- gui_names.push_back(_("Rectangular box"));
- gui_names.push_back(_("Oval box, thin"));
- gui_names.push_back(_("Oval box, thick"));
- gui_names.push_back(_("Shadow box"));
- gui_names.push_back(_("Double box"));
+ gui_names.push_back(_("No frame"));
+ gui_names.push_back(_("Simple rectangular frame"));
+ gui_names.push_back(_("Oval frame, thin"));
+ gui_names.push_back(_("Oval frame, thick"));
+ gui_names.push_back(_("Drop shadow"));
+ gui_names.push_back(_("Shaded background"));
+ gui_names.push_back(_("Double rectangular frame"));
}
}
-GuiBox::GuiBox(LyXView & lv)
- : GuiDialog(lv, "box"), Controller(this), params_("")
+GuiBox::GuiBox(GuiView & lv)
+ : GuiDialog(lv, "box", qt_("Box Settings")), params_("")
{
setupUi(this);
- setViewTitle(_("Box Settings"));
- setController(this, false);
// fill the box type choice
box_gui_tokens(ids_, gui_names_);
connect(innerBoxCO, SIGNAL(activated(const QString&)),
this, SLOT(innerBoxChanged(const QString &)));
connect(innerBoxCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
+ connect(pagebreakCB, SIGNAL(stateChanged(int)),
+ this, SLOT(pagebreakClicked()));
heightED->setValidator(unsignedLengthValidator(heightED));
widthED->setValidator(unsignedLengthValidator(widthED));
bc().addReadOnly(heightCB);
bc().addReadOnly(heightED);
bc().addReadOnly(heightUnitsLC);
+ bc().addReadOnly(pagebreakCB);
bc().setRestore(restorePB);
bc().setOK(okPB);
}
-void GuiBox::closeEvent(QCloseEvent * e)
-{
- slotClose();
- e->accept();
-}
-
-
void GuiBox::change_adaptor()
{
changed();
heightUnitsLC->setEnabled(true);
setSpecial(true);
}
+ if (index != 1)
+ pagebreakCB->setChecked(false);
+ pagebreakCB->setEnabled(index == 1);
int itype = innerBoxCO->currentIndex();
setInnerType(frameless, itype);
}
}
+void GuiBox::pagebreakClicked()
+{
+ bool pbreak = (pagebreakCB->checkState() == Qt::Checked);
+ innerBoxCO->setEnabled(!pbreak);
+ if (pbreak) {
+ valignCO->setEnabled(false);
+ ialignCO->setEnabled(false);
+ halignCO->setEnabled(false);
+ heightCB->setEnabled(false);
+ heightED->setEnabled(false);
+ heightUnitsLC->setEnabled(false);
+ setSpecial(false);
+ } else
+ typeChanged(typeCO->currentIndex());
+ change_adaptor();
+}
+
void GuiBox::updateContents()
{
string type = params_.type;
+ if (type == "Framed") {
+ pagebreakCB->setChecked(true);
+ type = "Boxed";
+ } else
+ pagebreakCB->setChecked(false);
+
+ pagebreakCB->setEnabled(type == "Boxed");
+
for (unsigned int i = 0; i < gui_names_.size(); ++i) {
if (type == ids_[i])
typeCO->setCurrentIndex(i);
void GuiBox::applyView()
{
- params_.type = ids_[typeCO->currentIndex()];
+ bool pagebreak = pagebreakCB->isChecked();
+ if (pagebreak)
+ params_.type = "Framed";
+ else
+ params_.type = ids_[typeCO->currentIndex()];
- params_.inner_box = innerBoxCO->currentText() != qt_("None");
- params_.use_parbox = innerBoxCO->currentText() == qt_("Parbox");
+ params_.inner_box = (!pagebreak && innerBoxCO->currentText() != qt_("None"));
+ params_.use_parbox = (!pagebreak && innerBoxCO->currentText() == qt_("Parbox"));
params_.pos = "tcb"[valignCO->currentIndex()];
params_.inner_pos = "tcbs"[ialignCO->currentIndex()];
}
-Dialog * createGuiBox(LyXView & lv) { return new GuiBox(lv); }
+Dialog * createGuiBox(GuiView & lv) { return new GuiBox(lv); }
} // namespace frontend