2001-08-19 13:25:15 +00:00
|
|
|
/**
|
|
|
|
* \file QDocumentDialog.C
|
2002-09-24 13:57:09 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2001-08-19 13:25:15 +00:00
|
|
|
*
|
2002-10-09 08:59:02 +00:00
|
|
|
* \author Edwin Leuven
|
2002-09-24 13:57:09 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS
|
2001-08-19 13:25:15 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
2002-10-09 08:59:02 +00:00
|
|
|
#include "gettext.h"
|
|
|
|
|
|
|
|
#include "ControlDocument.h"
|
|
|
|
#include "QDocument.h"
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2002-09-24 13:57:09 +00:00
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
#include "QDocumentDialog.h"
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
#include "ui/ClassModuleBase.h"
|
|
|
|
#include "ui/PackagesModuleBase.h"
|
|
|
|
#include "ui/PaperModuleBase.h"
|
|
|
|
#include "ui/LanguageModuleBase.h"
|
|
|
|
#include "ui/BulletsModuleBase.h"
|
|
|
|
#include "BulletsModule.h"
|
|
|
|
#include "ui/BiblioModuleBase.h"
|
|
|
|
#include "ui/NumberingModuleBase.h"
|
|
|
|
#include "ui/MarginsModuleBase.h"
|
|
|
|
#include "ui/PreambleModuleBase.h"
|
|
|
|
|
|
|
|
#include "Spacing.h"
|
|
|
|
#include "support/lstrings.h"
|
|
|
|
#include "lyxrc.h"
|
|
|
|
#include "buffer.h"
|
|
|
|
|
|
|
|
#include <qwidgetstack.h>
|
|
|
|
#include <qlistbox.h>
|
|
|
|
#include <qlabel.h>
|
|
|
|
#include <qmultilineedit.h>
|
2001-08-19 13:25:15 +00:00
|
|
|
#include <qlineedit.h>
|
2002-10-09 08:59:02 +00:00
|
|
|
#include <qpushbutton.h>
|
2001-08-19 13:25:15 +00:00
|
|
|
#include <qcombobox.h>
|
2002-10-09 08:59:02 +00:00
|
|
|
#include <qradiobutton.h>
|
|
|
|
#include <qcheckbox.h>
|
2001-08-19 13:25:15 +00:00
|
|
|
#include <qspinbox.h>
|
2002-10-09 08:59:02 +00:00
|
|
|
#include "lengthcombo.h"
|
2002-10-20 01:48:28 +00:00
|
|
|
|
|
|
|
|
2002-11-13 00:52:15 +00:00
|
|
|
QDocumentDialog::QDocumentDialog(QDocument * form)
|
|
|
|
: QDocumentDialogBase(0, 0, false, 0), form_(form)
|
2002-10-09 08:59:02 +00:00
|
|
|
{
|
|
|
|
connect(okPB, SIGNAL(clicked()),
|
|
|
|
form, SLOT(slotOK()));
|
|
|
|
connect(applyPB, SIGNAL(clicked()),
|
|
|
|
form, SLOT(slotApply()));
|
2002-11-13 05:36:07 +00:00
|
|
|
connect(closePB, SIGNAL(clicked()),
|
2002-10-09 08:59:02 +00:00
|
|
|
form, SLOT(slotClose()));
|
|
|
|
connect(restorePB, SIGNAL(clicked()),
|
|
|
|
form, SLOT(slotRestore()));
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
moduleLB->clear();
|
2002-11-13 00:52:15 +00:00
|
|
|
moduleLB->insertItem(_("Layout"), LAYOUT);
|
|
|
|
moduleLB->insertItem(_("Packages"), PACKAGES);
|
|
|
|
moduleLB->insertItem(_("Paper"), PAPER);
|
|
|
|
moduleLB->insertItem(_("Margins"), MARGINS);
|
|
|
|
moduleLB->insertItem(_("Language"), LANGUAGE);
|
|
|
|
moduleLB->insertItem(_("Bullets"), BULLETS);
|
|
|
|
moduleLB->insertItem(_("Numbering"), NUMBERING);
|
|
|
|
moduleLB->insertItem(_("Bibliography"), BIBLIOGRAPHY);
|
|
|
|
moduleLB->insertItem(_("Preamble"), PREAMBLE);
|
2002-10-09 08:59:02 +00:00
|
|
|
moduleLB->setCurrentItem(LAYOUT);
|
2002-11-13 00:52:15 +00:00
|
|
|
moduleLB->setMinimumSize(moduleLB->sizeHint());
|
2002-10-09 08:59:02 +00:00
|
|
|
|
|
|
|
layoutModule = new ClassModuleBase(this);
|
|
|
|
paperModule = new PaperModuleBase(this);
|
|
|
|
marginsModule = new MarginsModuleBase(this);
|
|
|
|
packagesModule = new PackagesModuleBase(this);
|
|
|
|
langModule = new LanguageModuleBase(this);
|
|
|
|
bulletsModule = new BulletsModule(this);
|
|
|
|
numberingModule = new NumberingModuleBase(this);
|
|
|
|
biblioModule = new BiblioModuleBase(this);
|
|
|
|
preambleModule = new PreambleModuleBase(this);
|
|
|
|
|
2002-11-13 05:36:07 +00:00
|
|
|
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);
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
moduleStack->raiseWidget(LAYOUT);
|
2002-11-08 00:09:00 +00:00
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
|
|
|
// take care of title
|
|
|
|
QFont f = titleL->font();
|
2002-11-13 00:52:15 +00:00
|
|
|
f.setWeight(QFont::Bold);
|
|
|
|
titleL->setFont(f);
|
2002-10-09 08:59:02 +00:00
|
|
|
setTitle(LAYOUT);
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2002-11-13 00:52:15 +00:00
|
|
|
// preamble
|
|
|
|
connect(preambleModule->preambleMLE, SIGNAL(textChanged()),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
// biblio
|
|
|
|
connect(biblioModule->natbibCB, SIGNAL(toggled(bool)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(biblioModule->citeStyleCO, SIGNAL(activated(int)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
// language & quote
|
|
|
|
connect(langModule->singleQuoteRB, SIGNAL(toggled(bool)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(langModule->doubleQuoteRB, SIGNAL(toggled(bool)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(langModule->languageCO, SIGNAL(activated(int)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(langModule->quoteStyleCO, SIGNAL(activated(int)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
// numbering
|
|
|
|
connect(numberingModule->sectionnrDepthSB,
|
|
|
|
SIGNAL(valueChanged(int)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(numberingModule->tocDepthSB,
|
|
|
|
SIGNAL(valueChanged(int)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
// packages
|
|
|
|
connect(packagesModule->lspacingCO, SIGNAL(activated(int)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(packagesModule->lspacingCO, SIGNAL(activated(int)),
|
|
|
|
this , SLOT(setLSpacing(int)));
|
|
|
|
connect(packagesModule->lspacingLE,
|
|
|
|
SIGNAL(textChanged(const QString&)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(packagesModule->encodingCO, SIGNAL(activated(int)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(packagesModule->amsCB, SIGNAL(toggled(bool)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(packagesModule->psdriverCO, SIGNAL(activated(int)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
// layout
|
|
|
|
connect(layoutModule->classCO, SIGNAL(activated(int)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(layoutModule->optionsLE,
|
|
|
|
SIGNAL(textChanged(const QString&)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(layoutModule->pagestyleCO, SIGNAL(activated(int)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(layoutModule->fontsCO, SIGNAL(activated(int)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(layoutModule->fontsizeCO, SIGNAL(activated(int)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(layoutModule->floatPlacementLE,
|
|
|
|
SIGNAL(textChanged(const QString&)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(layoutModule->skipRB, SIGNAL(toggled(bool)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(layoutModule->indentRB, SIGNAL(toggled(bool)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(layoutModule->skipCO, SIGNAL(activated(int)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(layoutModule->skipLE,
|
|
|
|
SIGNAL(textChanged(const QString&)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(layoutModule->skipLengthCO, SIGNAL(activated(int)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
|
|
|
|
connect(layoutModule->classCO, SIGNAL(activated(int)),
|
|
|
|
this , SLOT(classChanged()));
|
|
|
|
connect(layoutModule->skipCO, SIGNAL(activated(int)),
|
|
|
|
this , SLOT(setSkip(int)));
|
|
|
|
connect(layoutModule->skipRB, SIGNAL(toggled(bool)),
|
|
|
|
this , SLOT(enableSkip(bool)));
|
|
|
|
|
|
|
|
// margins
|
|
|
|
connect(marginsModule->marginCO, SIGNAL(activated(int)),
|
|
|
|
this , SLOT(setCustomMargins(int)));
|
|
|
|
|
|
|
|
connect(marginsModule->marginCO, SIGNAL(activated(int)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(marginsModule->topLE, SIGNAL(textChanged(const QString&)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(marginsModule->topUnit, SIGNAL(activated(int)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(marginsModule->bottomLE, SIGNAL(textChanged(const QString&)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(marginsModule->bottomUnit, SIGNAL(activated(int)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(marginsModule->innerLE, SIGNAL(textChanged(const QString&)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(marginsModule->innerUnit, SIGNAL(activated(int)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(marginsModule->outerLE, SIGNAL(textChanged(const QString&)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(marginsModule->outerUnit, SIGNAL(activated(int)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(marginsModule->headheightLE, SIGNAL(textChanged(const QString&)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(marginsModule->headheightUnit, SIGNAL(activated(int)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(marginsModule->headsepLE, SIGNAL(textChanged(const QString&)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(marginsModule->headsepUnit, SIGNAL(activated(int)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(marginsModule->footskipLE, SIGNAL(textChanged(const QString&)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(marginsModule->footskipUnit, SIGNAL(activated(int)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
|
|
|
|
// paper
|
|
|
|
connect(paperModule->papersizeCO, SIGNAL(activated(int)),
|
|
|
|
this , SLOT(setMargins(int)));
|
|
|
|
connect(paperModule->papersizeCO, SIGNAL(activated(int)),
|
|
|
|
this , SLOT(setCustomPapersize(int)));
|
|
|
|
connect(paperModule->papersizeCO, SIGNAL(activated(int)),
|
|
|
|
this , SLOT(setCustomPapersize(int)));
|
|
|
|
|
|
|
|
connect(paperModule->papersizeCO, SIGNAL(activated(int)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(paperModule->paperheightLE, SIGNAL(textChanged(const QString&)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(paperModule->paperwidthLE, SIGNAL(textChanged(const QString&)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(paperModule->paperwidthUnitCO, SIGNAL(activated(int)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(paperModule->paperheightUnitCO, SIGNAL(activated(int)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(paperModule->portraitRB, SIGNAL(toggled(bool)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(paperModule->landscapeRB, SIGNAL(toggled(bool)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(paperModule->twoColumnCB, SIGNAL(toggled(bool)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(paperModule->facingPagesCB, SIGNAL(toggled(bool)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
|
|
|
|
// bullets
|
|
|
|
connect(bulletsModule->bullet1LE, SIGNAL(textChanged(const QString&)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(bulletsModule->bulletsize1CO, SIGNAL(activated(int)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(bulletsModule->bullet2LE, SIGNAL(textChanged(const QString&)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(bulletsModule->bulletsize2CO, SIGNAL(activated(int)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(bulletsModule->bullet3LE, SIGNAL(textChanged(const QString&)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(bulletsModule->bulletsize3CO, SIGNAL(activated(int)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(bulletsModule->bullet4LE, SIGNAL(textChanged(const QString&)),
|
|
|
|
this , SLOT(change_adaptor()));
|
|
|
|
connect(bulletsModule->bulletsize4CO, SIGNAL(activated(int)),
|
|
|
|
this , SLOT(change_adaptor()));
|
2002-11-12 10:32:20 +00:00
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
}
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
QDocumentDialog::~QDocumentDialog()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
void QDocumentDialog::setTitle(int item)
|
|
|
|
{
|
|
|
|
switch(item) {
|
|
|
|
case LAYOUT:
|
|
|
|
titleL->setText(_("Document Style"));
|
|
|
|
break;
|
|
|
|
case PACKAGES:
|
|
|
|
titleL->setText(_("LaTeX Packages"));
|
|
|
|
break;
|
|
|
|
case PAPER:
|
|
|
|
titleL->setText(_("Papersize and Orientation"));
|
|
|
|
break;
|
|
|
|
case MARGINS:
|
|
|
|
titleL->setText(_("Margins"));
|
|
|
|
break;
|
|
|
|
case LANGUAGE:
|
|
|
|
titleL->setText(_("Language Settings and Quote Style"));
|
|
|
|
break;
|
|
|
|
case BULLETS:
|
|
|
|
titleL->setText(_("Bullet Types"));
|
|
|
|
break;
|
|
|
|
case NUMBERING:
|
|
|
|
titleL->setText(_("Numbering"));
|
|
|
|
break;
|
|
|
|
case BIBLIOGRAPHY:
|
|
|
|
titleL->setText(_("Bibliography Settings"));
|
|
|
|
break;
|
|
|
|
case PREAMBLE:
|
|
|
|
titleL->setText(_("LaTeX Preamble"));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2002-11-07 15:48:38 +00:00
|
|
|
void QDocumentDialog::saveDefaultClicked()
|
|
|
|
{
|
|
|
|
form_->saveDocDefault();
|
|
|
|
}
|
2001-08-19 13:25:15 +00:00
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2002-11-07 15:48:38 +00:00
|
|
|
void QDocumentDialog::useDefaultsClicked()
|
2001-08-19 13:25:15 +00:00
|
|
|
{
|
2002-11-07 15:48:38 +00:00
|
|
|
form_->useClassDefaults();
|
2001-08-19 13:25:15 +00:00
|
|
|
}
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
void QDocumentDialog::change_adaptor()
|
2001-08-19 13:25:15 +00:00
|
|
|
{
|
2002-10-09 08:59:02 +00:00
|
|
|
form_->changed();
|
2001-08-19 13:25:15 +00:00
|
|
|
}
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
void QDocumentDialog::closeEvent(QCloseEvent * e)
|
2001-08-19 13:25:15 +00:00
|
|
|
{
|
2002-10-09 08:59:02 +00:00
|
|
|
form_->slotWMHide();
|
|
|
|
e->accept();
|
2001-08-19 13:25:15 +00:00
|
|
|
}
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
void QDocumentDialog::setLSpacing(int item)
|
2001-08-19 13:25:15 +00:00
|
|
|
{
|
2002-10-20 01:48:28 +00:00
|
|
|
packagesModule->lspacingLE->setEnabled(item == 3);
|
2001-08-19 13:25:15 +00:00
|
|
|
}
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
void QDocumentDialog::setSkip(int item)
|
2001-08-19 13:25:15 +00:00
|
|
|
{
|
2002-11-13 00:52:15 +00:00
|
|
|
bool const enable = (item == 3);
|
2002-10-09 08:59:02 +00:00
|
|
|
layoutModule->skipLE->setEnabled(enable);
|
|
|
|
layoutModule->skipLengthCO->setEnabled(enable);
|
2001-08-19 13:25:15 +00:00
|
|
|
}
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
void QDocumentDialog::enableSkip(bool skip)
|
2001-08-19 13:25:15 +00:00
|
|
|
{
|
2002-10-09 08:59:02 +00:00
|
|
|
layoutModule->skipCO->setEnabled(skip);
|
|
|
|
layoutModule->skipLE->setEnabled(skip);
|
|
|
|
layoutModule->skipLengthCO->setEnabled(skip);
|
|
|
|
if (skip)
|
|
|
|
setSkip(layoutModule->skipCO->currentItem());
|
2001-08-19 13:25:15 +00:00
|
|
|
}
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
void QDocumentDialog::setMargins(int papersize)
|
2001-08-19 13:25:15 +00:00
|
|
|
{
|
2002-11-18 21:19:02 +00:00
|
|
|
const char * a4only[] = {
|
|
|
|
_("Small Margins"), _("Very small Margins"),
|
|
|
|
_("Very wide Margins ") };
|
|
|
|
const char * normal[] = {
|
|
|
|
_("Default"), _("Custom") };
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
int olditem = marginsModule->marginCO->currentItem();
|
|
|
|
marginsModule->marginCO->clear();
|
2002-11-18 21:19:02 +00:00
|
|
|
marginsModule->marginCO->insertStrList(normal);
|
2002-10-09 08:59:02 +00:00
|
|
|
if (papersize==6) {
|
2002-11-18 21:19:02 +00:00
|
|
|
marginsModule->marginCO->insertStrList(a4only);
|
2002-10-09 08:59:02 +00:00
|
|
|
}
|
|
|
|
marginsModule->marginCO->setCurrentItem(olditem);
|
|
|
|
setCustomMargins(olditem);
|
2001-08-19 13:25:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
void QDocumentDialog::setCustomPapersize(int papersize)
|
2001-08-19 13:25:15 +00:00
|
|
|
{
|
2002-10-20 01:48:28 +00:00
|
|
|
bool const custom = (papersize == 1);
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
paperModule->paperwidthL->setEnabled(custom);
|
|
|
|
paperModule->paperwidthLE->setEnabled(custom);
|
|
|
|
paperModule->paperwidthUnitCO->setEnabled(custom);
|
|
|
|
paperModule->paperheightL->setEnabled(custom);
|
|
|
|
paperModule->paperheightLE->setEnabled(custom);
|
|
|
|
paperModule->paperheightLE->setFocus();
|
|
|
|
paperModule->paperheightUnitCO->setEnabled(custom);
|
2001-08-19 13:25:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
void QDocumentDialog::setCustomMargins(int margin)
|
2001-08-19 13:25:15 +00:00
|
|
|
{
|
2002-10-20 01:48:28 +00:00
|
|
|
bool const custom = (margin == 1);
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
marginsModule->topL->setEnabled(custom);
|
|
|
|
marginsModule->topLE->setEnabled(custom);
|
|
|
|
marginsModule->topUnit->setEnabled(custom);
|
2001-08-19 13:25:15 +00:00
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
marginsModule->bottomL->setEnabled(custom);
|
|
|
|
marginsModule->bottomLE->setEnabled(custom);
|
|
|
|
marginsModule->bottomUnit->setEnabled(custom);
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
marginsModule->innerL->setEnabled(custom);
|
|
|
|
marginsModule->innerLE->setEnabled(custom);
|
|
|
|
marginsModule->innerUnit->setEnabled(custom);
|
2001-08-19 13:25:15 +00:00
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
marginsModule->outerL->setEnabled(custom);
|
|
|
|
marginsModule->outerLE->setEnabled(custom);
|
|
|
|
marginsModule->outerUnit->setEnabled(custom);
|
2001-08-19 13:25:15 +00:00
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
marginsModule->headheightL->setEnabled(custom);
|
|
|
|
marginsModule->headheightLE->setEnabled(custom);
|
|
|
|
marginsModule->headheightUnit->setEnabled(custom);
|
2001-08-19 13:25:15 +00:00
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
marginsModule->headsepL->setEnabled(custom);
|
|
|
|
marginsModule->headsepLE->setEnabled(custom);
|
|
|
|
marginsModule->headsepUnit->setEnabled(custom);
|
2001-08-19 13:25:15 +00:00
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
marginsModule->footskipL->setEnabled(custom);
|
|
|
|
marginsModule->footskipLE->setEnabled(custom);
|
|
|
|
marginsModule->footskipUnit->setEnabled(custom);
|
2001-08-19 13:25:15 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
void QDocumentDialog::updateFontsize(string const & items, string const & sel)
|
2001-08-19 13:25:15 +00:00
|
|
|
{
|
2002-10-09 08:59:02 +00:00
|
|
|
layoutModule->fontsizeCO->clear();
|
|
|
|
layoutModule->fontsizeCO->insertItem("default");
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
for (int n=0; !token(items,'|',n).empty(); ++n)
|
|
|
|
layoutModule->fontsizeCO->
|
|
|
|
insertItem(token(items,'|',n).c_str());
|
2001-08-19 13:25:15 +00:00
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
for (int n = 0; n<layoutModule->fontsizeCO->count(); ++n) {
|
|
|
|
if (layoutModule->fontsizeCO->text(n).latin1()==sel) {
|
|
|
|
layoutModule->fontsizeCO->setCurrentItem(n);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2001-08-19 13:25:15 +00:00
|
|
|
}
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
void QDocumentDialog::updatePagestyle(string const & items, string const & sel)
|
2001-08-19 13:25:15 +00:00
|
|
|
{
|
2002-10-09 08:59:02 +00:00
|
|
|
layoutModule->pagestyleCO->clear();
|
|
|
|
layoutModule->pagestyleCO->insertItem("default");
|
2001-08-19 13:25:15 +00:00
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
for (int n=0; !token(items,'|',n).empty(); ++n)
|
|
|
|
layoutModule->pagestyleCO->
|
|
|
|
insertItem(token(items,'|',n).c_str());
|
2001-08-19 13:25:15 +00:00
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
for (int n = 0; n<layoutModule->pagestyleCO->count(); ++n) {
|
|
|
|
if (layoutModule->pagestyleCO->text(n).latin1()==sel) {
|
|
|
|
layoutModule->pagestyleCO->setCurrentItem(n);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2001-08-19 13:25:15 +00:00
|
|
|
}
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
void QDocumentDialog::classChanged()
|
2001-08-19 13:25:15 +00:00
|
|
|
{
|
2002-11-07 15:48:38 +00:00
|
|
|
unsigned int tc = layoutModule->classCO->currentItem();
|
|
|
|
|
|
|
|
BufferParams & params = form_->controller().params();
|
|
|
|
params.textclass = 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)
|
|
|
|
params.textclass = tc;
|
|
|
|
updateFontsize(form_->controller().textClass().opt_fontsize(),
|
|
|
|
params.fontsize);
|
|
|
|
|
|
|
|
updatePagestyle(form_->controller().textClass().opt_pagestyle(),
|
|
|
|
params.pagestyle);
|
|
|
|
}
|
2002-10-20 01:48:28 +00:00
|
|
|
}
|