form, SLOT(slotOK()));
connect(applyPB, SIGNAL(clicked()),
form, SLOT(slotApply()));
- connect(cancelPB, SIGNAL(clicked()),
+ connect(closePB, SIGNAL(clicked()),
form, SLOT(slotClose()));
connect(restorePB, SIGNAL(clicked()),
form, SLOT(slotRestore()));
moduleLB->insertItem(_("Bibliography"), BIBLIOGRAPHY);
moduleLB->insertItem(_("Preamble"), PREAMBLE);
moduleLB->setCurrentItem(LAYOUT);
- moduleLB->setMinimumSize(moduleLB->sizeHint());
+ moduleLB->setMinimumSize(moduleLB->sizeHint());
layoutModule = new ClassModuleBase(this);
paperModule = new PaperModuleBase(this);
biblioModule = new BiblioModuleBase(this);
preambleModule = new PreambleModuleBase(this);
- moduleStack->addWidget(layoutModule,LAYOUT);
- moduleStack->addWidget(paperModule,PAPER);
- moduleStack->addWidget(marginsModule,MARGINS);
- moduleStack->addWidget(packagesModule,PACKAGES);
- moduleStack->addWidget(langModule,LANGUAGE);
- moduleStack->addWidget(bulletsModule,BULLETS);
- moduleStack->addWidget(numberingModule,NUMBERING);
- moduleStack->addWidget(biblioModule,BIBLIOGRAPHY);
- moduleStack->addWidget(preambleModule,PREAMBLE);
+ moduleStack->addWidget(layoutModule, LAYOUT);
+ moduleStack->addWidget(paperModule, PAPER);
+ moduleStack->addWidget(marginsModule, MARGINS);
+ moduleStack->addWidget(packagesModule, PACKAGES);
+ moduleStack->addWidget(langModule, LANGUAGE);
+ moduleStack->addWidget(bulletsModule, BULLETS);
+ moduleStack->addWidget(numberingModule, NUMBERING);
+ moduleStack->addWidget(biblioModule, BIBLIOGRAPHY);
+ moduleStack->addWidget(preambleModule, PREAMBLE);
moduleStack->raiseWidget(LAYOUT);
-
+
// take care of title
QFont f = titleL->font();
titleL->setFont(f);
setTitle(LAYOUT);
- // FIXME: Edwin, please change this by making each module have
- // a change_adaptor(), and connecting inside designer; then
- // connect each module's change_adaptor to the main form's
- // one here.
-
- // preamble
+ // preamble
connect(preambleModule->preambleMLE, SIGNAL(textChanged()),
this , SLOT(change_adaptor()));
- // biblio
+ // biblio
connect(biblioModule->natbibCB, SIGNAL(toggled(bool)),
this , SLOT(change_adaptor()));
connect(biblioModule->citeStyleCO, SIGNAL(activated(int)),
this , SLOT(change_adaptor()));
- // language & quote
+ // language & quote
connect(langModule->singleQuoteRB, SIGNAL(toggled(bool)),
this , SLOT(change_adaptor()));
connect(langModule->doubleQuoteRB, SIGNAL(toggled(bool)),
this , SLOT(change_adaptor()));
connect(langModule->quoteStyleCO, SIGNAL(activated(int)),
this , SLOT(change_adaptor()));
- // numbering
+ // numbering
connect(numberingModule->sectionnrDepthSB,
SIGNAL(valueChanged(int)),
this , SLOT(change_adaptor()));
connect(numberingModule->tocDepthSB,
SIGNAL(valueChanged(int)),
this , SLOT(change_adaptor()));
- // packages
+ // packages
connect(packagesModule->lspacingCO, SIGNAL(activated(int)),
this , SLOT(change_adaptor()));
connect(packagesModule->lspacingCO, SIGNAL(activated(int)),
this , SLOT(change_adaptor()));
connect(packagesModule->psdriverCO, SIGNAL(activated(int)),
this , SLOT(change_adaptor()));
- // layout
+ // layout
connect(layoutModule->classCO, SIGNAL(activated(int)),
this , SLOT(change_adaptor()));
connect(layoutModule->optionsLE,
connect(layoutModule->skipRB, SIGNAL(toggled(bool)),
this , SLOT(enableSkip(bool)));
- // margins
+ // margins
connect(marginsModule->marginCO, SIGNAL(activated(int)),
this , SLOT(setCustomMargins(int)));
connect(marginsModule->footskipUnit, SIGNAL(activated(int)),
this , SLOT(change_adaptor()));
- // paper
+ // paper
connect(paperModule->papersizeCO, SIGNAL(activated(int)),
this , SLOT(setMargins(int)));
connect(paperModule->papersizeCO, SIGNAL(activated(int)),
connect(paperModule->facingPagesCB, SIGNAL(toggled(bool)),
this , SLOT(change_adaptor()));
- // bullets
+ // bullets
connect(bulletsModule->bullet1LE, SIGNAL(textChanged(const QString&)),
this , SLOT(change_adaptor()));
connect(bulletsModule->bulletsize1CO, SIGNAL(activated(int)),
void QDocumentDialog::setMargins(int papersize)
{
- QStringList a4only;
- QStringList normal;
- a4only << _("Small Margins") << _("Very small Margins")
- << _("Very wide Margins ");
- normal << _("Default") << _("Custom");
+ char const * a4only[] = {
+ _("Small Margins"), _("Very small Margins"),
+ _("Very wide Margins "), 0 };
+ char const * normal[] = {
+ _("Default"), _("Custom"), 0 };
int olditem = marginsModule->marginCO->currentItem();
marginsModule->marginCO->clear();
- marginsModule->marginCO->insertStringList(normal);
+ marginsModule->marginCO->insertStrList(normal);
if (papersize==6) {
- marginsModule->marginCO->insertStringList(a4only);
+ marginsModule->marginCO->insertStrList(a4only);
}
marginsModule->marginCO->setCurrentItem(olditem);
setCustomMargins(olditem);
void QDocumentDialog::classChanged()
{
- unsigned int tc = layoutModule->classCO->currentItem();
+ ControlDocument & cntrl = form_->controller();
+ BufferParams & params = cntrl.params();
- BufferParams & params = form_->controller().params();
- params.textclass = layoutModule->classCO->currentItem();
+ lyx::textclass_type const tc = layoutModule->classCO->currentItem();
- if (lyxrc.auto_reset_options) {
- params.textclass = tc;
- params.useClassDefaults();
- form_->update_contents();
- } else {
- // update the params which are needed in any case
- // (fontsizes, pagestyle)
+ if (form_->controller().loadTextclass(tc)) {
params.textclass = tc;
- updateFontsize(form_->controller().textClass().opt_fontsize(),
- params.fontsize);
- updatePagestyle(form_->controller().textClass().opt_pagestyle(),
- params.pagestyle);
+ if (lyxrc.auto_reset_options) {
+ params.useClassDefaults();
+ form_->update_contents();
+ } else {
+ updateFontsize(cntrl.textClass().opt_fontsize(),
+ params.fontsize);
+
+ updatePagestyle(cntrl.textClass().opt_pagestyle(),
+ params.pagestyle);
+ }
+ } else {
+ for (int n = 0; n<layoutModule->classCO->count(); ++n) {
+ if (layoutModule->classCO->text(n) ==
+ cntrl.textClass().description().c_str()) {
+ layoutModule->classCO->setCurrentItem(n);
+ break;
+ }
+ }
}
}