/**
* \file QDocumentDialog.C
- * Copyright 2001 the LyX Team
- * Read the file COPYING
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
*
- * \author Kalle Dalheimer <kalle@klaralvdalens-datakonsult.se>
+ * \author Edwin Leuven
+ *
+ * Full author contact details are available in file CREDITS
*/
#include <config.h>
-
-#include "QDocumentDialog.h"
-#include "Dialogs.h"
+#include "gettext.h"
+
+#include "ControlDocument.h"
#include "QDocument.h"
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "QDocumentDialog.h"
+
+#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>
#include <qlineedit.h>
-#include <qcheckbox.h>
-#include <qtoolbutton.h>
-#include <qbuttongroup.h>
+#include <qpushbutton.h>
#include <qcombobox.h>
+#include <qradiobutton.h>
+#include <qcheckbox.h>
#include <qspinbox.h>
+#include "lengthcombo.h"
+
+
+QDocumentDialog::QDocumentDialog(QDocument * form)
+ : QDocumentDialogBase(0, 0, false, 0), form_(form)
+{
+ connect(okPB, SIGNAL(clicked()),
+ form, SLOT(slotOK()));
+ connect(applyPB, SIGNAL(clicked()),
+ form, SLOT(slotApply()));
+ connect(closePB, SIGNAL(clicked()),
+ form, SLOT(slotClose()));
+ connect(restorePB, SIGNAL(clicked()),
+ form, SLOT(slotRestore()));
+
+ moduleLB->clear();
+ 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);
+ moduleLB->setCurrentItem(LAYOUT);
+ moduleLB->setMinimumSize(moduleLB->sizeHint());
+
+ 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);
+
+ 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();
+ f.setWeight(QFont::Bold);
+ titleL->setFont(f);
+ setTitle(LAYOUT);
+
+ // 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()));
-QDocumentDialog::QDocumentDialog(QDocument * form, QWidget * parent, const char * name, bool modal, WFlags fl)
- : QDocumentDialogBase(parent, name, modal, fl),
- form_(form)
-{
-#if 0
- // Copy the pointers to the bullet buttons into an array so that
- // they can all be manipulated together.
- bulletbuttons[0] = bullet00PB;
- bulletbuttons[1] = bullet01PB;
- bulletbuttons[2] = bullet02PB;
- bulletbuttons[3] = bullet03PB;
- bulletbuttons[4] = bullet04PB;
- bulletbuttons[5] = bullet05PB;
- bulletbuttons[6] = bullet10PB;
- bulletbuttons[7] = bullet11PB;
- bulletbuttons[8] = bullet12PB;
- bulletbuttons[9] = bullet13PB;
- bulletbuttons[10] = bullet14PB;
- bulletbuttons[11] = bullet15PB;
- bulletbuttons[12] = bullet20PB;
- bulletbuttons[13] = bullet21PB;
- bulletbuttons[14] = bullet22PB;
- bulletbuttons[15] = bullet23PB;
- bulletbuttons[16] = bullet24PB;
- bulletbuttons[17] = bullet25PB;
- bulletbuttons[18] = bullet30PB;
- bulletbuttons[19] = bullet31PB;
- bulletbuttons[20] = bullet32PB;
- bulletbuttons[21] = bullet33PB;
- bulletbuttons[22] = bullet34PB;
- bulletbuttons[23] = bullet35PB;
- bulletbuttons[24] = bullet40PB;
- bulletbuttons[25] = bullet41PB;
- bulletbuttons[26] = bullet42PB;
- bulletbuttons[27] = bullet43PB;
- bulletbuttons[28] = bullet44PB;
- bulletbuttons[29] = bullet45PB;
- bulletbuttons[30] = bullet50PB;
- bulletbuttons[31] = bullet51PB;
- bulletbuttons[32] = bullet52PB;
- bulletbuttons[33] = bullet53PB;
- bulletbuttons[34] = bullet54PB;
- bulletbuttons[35] = bullet55PB;
-#endif
-}
-
-
-QDocumentDialog::~QDocumentDialog()
-{
-}
-
-
-#if 0
-void QDocumentDialog::slotApply()
-{
- form->apply();
- // PENDING(kalle) Check whether we need this
- // form->bc_->apply();
-}
-
-
-void QDocumentDialog::slotAMSMath(bool)
-{
- form->checkDocumentInput( amsMathCB );
-}
-
-
-void QDocumentDialog::slotBulletDepth1()
-{
- form->bulletDepth( 0 );
-}
-
-
-void QDocumentDialog::slotBulletDepth2()
-{
- form->bulletDepth( 1 );
-}
-
-
-void QDocumentDialog::slotBulletDepth3()
-{
- form->bulletDepth( 2 );
-}
-
-
-void QDocumentDialog::slotBulletDepth4()
-{
- form->bulletDepth( 3 );
-}
-
-
-void QDocumentDialog::slotBulletDing1()
-{
- qDebug( "QDocumentDialog::slotBulletDing1()" );
- form->checkDocumentInput( bulletDing1PB );
- form->setBulletPics();
- bulletStandardPB->setOn( false );
- bulletMathsPB->setOn( false );
- bulletDing2PB->setOn( false );
- bulletDing3PB->setOn( false );
- bulletDing4PB->setOn( false );
-}
-
-
-void QDocumentDialog::slotBulletDing2()
-{
- form->checkDocumentInput( bulletDing2PB );
- form->setBulletPics();
- bulletStandardPB->setOn( false );
- bulletMathsPB->setOn( false );
- bulletDing1PB->setOn( false );
- bulletDing3PB->setOn( false );
- bulletDing4PB->setOn( false );
-}
-
-
-void QDocumentDialog::slotBulletDing3()
-{
- form->checkDocumentInput( bulletDing3PB );
- form->setBulletPics();
- bulletStandardPB->setOn( false );
- bulletMathsPB->setOn( false );
- bulletDing2PB->setOn( false );
- bulletDing1PB->setOn( false );
- bulletDing4PB->setOn( false );
-}
-
-
-void QDocumentDialog::slotBulletDing4()
-{
- form->checkDocumentInput( bulletDing4PB );
- form->setBulletPics();
- bulletStandardPB->setOn( false );
- bulletMathsPB->setOn( false );
- bulletDing2PB->setOn( false );
- bulletDing3PB->setOn( false );
- bulletDing1PB->setOn( false );
-}
-
-
-void QDocumentDialog::slotBulletMaths()
-{
- form->checkDocumentInput( bulletMathsPB );
- form->setBulletPics();
- bulletStandardPB->setOn( false );
- bulletDing1PB->setOn( false );
- bulletDing2PB->setOn( false );
- bulletDing3PB->setOn( false );
- bulletDing4PB->setOn( false );
-}
-
-
-void QDocumentDialog::slotBulletSize(int)
-{
- form->choiceBulletSize();
- form->checkDocumentInput( bulletSizeCO );
-}
-
-
-void QDocumentDialog::slotBulletStandard()
-{
- form->checkDocumentInput( bulletStandardPB );
- form->setBulletPics();
- bulletDing1PB->setOn( false );
- bulletMathsPB->setOn( false );
- bulletDing2PB->setOn( false );
- bulletDing3PB->setOn( false );
- bulletDing4PB->setOn( false );
-}
-
-
-void QDocumentDialog::slotBulletSymbol(int n)
-{
- qDebug( "QDocumentDialog::slotBulletSymbol( %d )", n );
- for( int i = 0; i < 36; i++ )
- bulletbuttons[i]->setOn( false );
- bulletbuttons[n]->setOn( true );
- form->bulletBMTable( n );
- form->checkDocumentInput( bulletTypeBG );
-}
-
-
-void QDocumentDialog::slotClass(int)
-{
- form->checkChoiceClass( 0 );
- form->checkDocumentInput( classesCO );
-}
-
-
-void QDocumentDialog::slotClose()
-{
- form->cancel();
- form->hide();
- // PENDING(kalle) do something with this
- // form->bc_->cancel();
-}
-
-
-void QDocumentDialog::slotColumns(int)
-{
- form->checkDocumentInput( columnsBG );
-}
-
-
-void QDocumentDialog::slotDefaultSkip(const QString&)
-{
- form->checkDocumentInput( defaultSkipED );
-}
-
-
-void QDocumentDialog::slotDefaultSkip(int)
-{
- form->checkChoiceClass( defaultSkipCO );
- form->checkDocumentInput( defaultSkipCO );
-}
-
-
-void QDocumentDialog::slotEncoding(int)
-{
- form->checkChoiceClass( encodingCO );
- form->checkDocumentInput( encodingCO );
-}
-
-
-void QDocumentDialog::slotExtraOptions(const QString&)
-{
- form->checkDocumentInput( extraOptionsED );
-}
-
-
-void QDocumentDialog::slotFloatPlacement(const QString&)
-{
- form->checkDocumentInput( floatPlacementED );
-}
-
-
-void QDocumentDialog::slotFont(int)
-{
- form->checkChoiceClass( fontsCO );
- form->checkDocumentInput( fontsCO );
-}
-
-
-void QDocumentDialog::slotFontSize(int)
-{
- form->checkChoiceClass( fontSizeCO );
- form->checkDocumentInput( fontSizeCO );
}
-void QDocumentDialog::slotFootskip(const QString&)
+QDocumentDialog::~QDocumentDialog()
{
- form->checkDocumentInput( footskipED );
}
-void QDocumentDialog::slotHeadheight(const QString&)
+void QDocumentDialog::setTitle(int item)
{
- form->checkDocumentInput( headheightED );
+ 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;
+ }
}
-void QDocumentDialog::slotHeadsep(const QString&)
+void QDocumentDialog::saveDefaultClicked()
{
- form->checkDocumentInput( headsepED );
+ form_->saveDocDefault();
}
-void QDocumentDialog::slotHeight(const QString&)
+void QDocumentDialog::useDefaultsClicked()
{
- form->checkDocumentInput( customHeightED );
+ form_->useClassDefaults();
}
-void QDocumentDialog::slotLanguage(int)
+void QDocumentDialog::change_adaptor()
{
- form->checkChoiceClass( languageCO );
- form->checkDocumentInput( languageCO );
+ form_->changed();
}
-void QDocumentDialog::slotBulletLaTeX(const QString&)
+void QDocumentDialog::closeEvent(QCloseEvent * e)
{
- form->inputBulletLaTeX();
- form->checkDocumentInput( latexED );
+ form_->slotWMHide();
+ e->accept();
}
-void QDocumentDialog::slotMarginBottom(const QString&)
+void QDocumentDialog::setLSpacing(int item)
{
- form->checkDocumentInput( marginBottomED );
+ packagesModule->lspacingLE->setEnabled(item == 3);
}
-void QDocumentDialog::slotMarginLeft(const QString&)
+void QDocumentDialog::setSkip(int item)
{
- form->checkDocumentInput( marginLeftED );
+ bool const enable = (item == 3);
+ layoutModule->skipLE->setEnabled(enable);
+ layoutModule->skipLengthCO->setEnabled(enable);
}
-void QDocumentDialog::slotMarginRight(const QString&)
+void QDocumentDialog::enableSkip(bool skip)
{
- form->checkDocumentInput( marginRightED );
+ layoutModule->skipCO->setEnabled(skip);
+ layoutModule->skipLE->setEnabled(skip);
+ layoutModule->skipLengthCO->setEnabled(skip);
+ if (skip)
+ setSkip(layoutModule->skipCO->currentItem());
}
-void QDocumentDialog::slotMarginTop(const QString&)
+void QDocumentDialog::setMargins(int papersize)
{
- form->checkDocumentInput( marginTopED );
-}
+ char const * a4only[] = {
+ _("Small Margins"), _("Very small Margins"),
+ _("Very wide Margins "), 0 };
+ char const * normal[] = {
+ _("Default"), _("Custom"), 0 };
-
-void QDocumentDialog::slotOK()
-{
- form->apply();
- form->hide();
- // PENDING(kalle) Do something about this.
- // form->bc_->ok();
+ int olditem = marginsModule->marginCO->currentItem();
+ marginsModule->marginCO->clear();
+ marginsModule->marginCO->insertStrList(normal);
+ if (papersize==6) {
+ marginsModule->marginCO->insertStrList(a4only);
+ }
+ marginsModule->marginCO->setCurrentItem(olditem);
+ setCustomMargins(olditem);
}
-void QDocumentDialog::slotOrientation(int)
+void QDocumentDialog::setCustomPapersize(int papersize)
{
- form->checkDocumentInput( orientationBG );
-}
-
+ bool const custom = (papersize == 1);
-void QDocumentDialog::slotPSDriver(int)
-{
- form->checkChoiceClass( psDriverCO );
- form->checkDocumentInput( psDriverCO );
+ 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);
}
-void QDocumentDialog::slotPageStyle(int)
+void QDocumentDialog::setCustomMargins(int margin)
{
- form->checkChoiceClass( pagestyleCO );
- form->checkDocumentInput( pagestyleCO );
-}
+ bool const custom = (margin == 1);
+ marginsModule->topL->setEnabled(custom);
+ marginsModule->topLE->setEnabled(custom);
+ marginsModule->topUnit->setEnabled(custom);
-void QDocumentDialog::slotPapersize(int)
-{
- form->checkChoiceClass( pagestyleCO );
- form->checkDocumentInput( papersizeCO );
-}
+ marginsModule->bottomL->setEnabled(custom);
+ marginsModule->bottomLE->setEnabled(custom);
+ marginsModule->bottomUnit->setEnabled(custom);
+ marginsModule->innerL->setEnabled(custom);
+ marginsModule->innerLE->setEnabled(custom);
+ marginsModule->innerUnit->setEnabled(custom);
-void QDocumentDialog::slotQuoteStyle(int)
-{
- form->checkChoiceClass( quoteStyleTypeCO );
- form->checkDocumentInput( quoteStyleTypeCO );
-}
-
-
-void QDocumentDialog::slotQuoteType(int)
-{
- // Intentionally left blank
-}
+ marginsModule->outerL->setEnabled(custom);
+ marginsModule->outerLE->setEnabled(custom);
+ marginsModule->outerUnit->setEnabled(custom);
+ marginsModule->headheightL->setEnabled(custom);
+ marginsModule->headheightLE->setEnabled(custom);
+ marginsModule->headheightUnit->setEnabled(custom);
-void QDocumentDialog::slotRestore()
-{
- form->update();
- // PENDING(kalle) Do something about this.
- // form->bc_->updateAll();
-}
+ marginsModule->headsepL->setEnabled(custom);
+ marginsModule->headsepLE->setEnabled(custom);
+ marginsModule->headsepUnit->setEnabled(custom);
+ marginsModule->footskipL->setEnabled(custom);
+ marginsModule->footskipLE->setEnabled(custom);
+ marginsModule->footskipUnit->setEnabled(custom);
-void QDocumentDialog::slotSectionNumberDepth(int)
-{
- form->checkDocumentInput( sectionNumberDepthSB );
}
-void QDocumentDialog::slotSeparation(int)
+void QDocumentDialog::updateFontsize(string const & items, string const & sel)
{
- form->checkDocumentInput( separationBG );
-}
+ layoutModule->fontsizeCO->clear();
+ layoutModule->fontsizeCO->insertItem("default");
+ for (int n=0; !token(items,'|',n).empty(); ++n)
+ layoutModule->fontsizeCO->
+ insertItem(token(items,'|',n).c_str());
-void QDocumentDialog::slotSides(int)
-{
- form->checkDocumentInput( sidesBG );
+ for (int n = 0; n<layoutModule->fontsizeCO->count(); ++n) {
+ if (layoutModule->fontsizeCO->text(n).latin1()==sel) {
+ layoutModule->fontsizeCO->setCurrentItem(n);
+ break;
+ }
+ }
}
-void QDocumentDialog::slotSpacing(const QString&)
+void QDocumentDialog::updatePagestyle(string const & items, string const & sel)
{
- form->checkDocumentInput( spacingED );
-}
+ layoutModule->pagestyleCO->clear();
+ layoutModule->pagestyleCO->insertItem("default");
+ for (int n=0; !token(items,'|',n).empty(); ++n)
+ layoutModule->pagestyleCO->
+ insertItem(token(items,'|',n).c_str());
-void QDocumentDialog::slotSpacing(int)
-{
- form->checkDocumentInput( spacingCO );
- form->checkDocumentInput( spacingCO );
+ for (int n = 0; n<layoutModule->pagestyleCO->count(); ++n) {
+ if (layoutModule->pagestyleCO->text(n).latin1()==sel) {
+ layoutModule->pagestyleCO->setCurrentItem(n);
+ break;
+ }
+ }
}
-void QDocumentDialog::slotSpecialPaperPackage(int)
+void QDocumentDialog::classChanged()
{
- form->checkChoiceClass( specialCO );
- form->checkDocumentInput( specialCO );
-}
+ ControlDocument & cntrl = form_->controller();
+ BufferParams & params = cntrl.params();
+ lyx::textclass_type const tc = layoutModule->classCO->currentItem();
-void QDocumentDialog::slotTOCDepth(int)
-{
- form->checkDocumentInput( tocDepthSB );
-}
+ if (form_->controller().loadTextclass(tc)) {
+ params.textclass = tc;
+ if (lyxrc.auto_reset_options) {
+ params.useClassDefaults();
+ form_->update_contents();
+ } else {
+ updateFontsize(cntrl.textClass().opt_fontsize(),
+ params.fontsize);
-void QDocumentDialog::slotUseGeometryPackage(bool)
-{
- form->checkDocumentInput( CheckBox1 );
-}
-
-
-void QDocumentDialog::slotWidth(const QString&)
-{
- form->checkDocumentInput( customWidthED );
-}
-#endif
-
-
-void QDocumentDialog::closeEvent( QCloseEvent* e )
-{
- //form_->hide();
- //PENDING(kalle) Do something about this.
- // form->bc_->hide();
- e->accept();
+ 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;
+ }
+ }
+ }
}