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
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2001-08-19 13:25:15 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
2003-06-20 23:03:43 +00:00
|
|
|
|
2003-12-14 16:33:56 +00:00
|
|
|
#include "bufferparams.h"
|
2003-09-29 10:50:51 +00:00
|
|
|
#include "debug.h"
|
2004-03-30 19:18:14 +00:00
|
|
|
#include "gettext.h"
|
2003-12-14 16:33:56 +00:00
|
|
|
#include "lyxrc.h"
|
|
|
|
|
|
|
|
#include "controllers/ControlDocument.h"
|
|
|
|
|
|
|
|
#include "support/lstrings.h"
|
2002-10-09 08:59:02 +00:00
|
|
|
|
|
|
|
#include "QDocument.h"
|
2001-08-19 13:25:15 +00:00
|
|
|
#include "QDocumentDialog.h"
|
|
|
|
|
2003-03-28 17:19:49 +00:00
|
|
|
#include "floatplacement.h"
|
2003-12-14 16:33:56 +00:00
|
|
|
#include "lengthcombo.h"
|
|
|
|
#include "panelstack.h"
|
|
|
|
#include "qt_helpers.h"
|
2003-06-20 23:03:43 +00:00
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
#include <qlabel.h>
|
|
|
|
#include <qmultilineedit.h>
|
2001-08-19 13:25:15 +00:00
|
|
|
#include <qlineedit.h>
|
2002-12-16 22:24:33 +00:00
|
|
|
#include <qlistview.h>
|
2002-10-09 08:59:02 +00:00
|
|
|
#include <qpushbutton.h>
|
|
|
|
#include <qradiobutton.h>
|
|
|
|
#include <qcheckbox.h>
|
2003-03-29 03:46:27 +00:00
|
|
|
#include <qslider.h>
|
2003-10-23 11:58:01 +00:00
|
|
|
#include <qpixmap.h>
|
|
|
|
#include <qcolor.h>
|
|
|
|
#include <qcolordialog.h>
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2003-09-09 22:13:45 +00:00
|
|
|
using lyx::support::token;
|
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
using std::string;
|
|
|
|
|
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
|
|
|
|
2003-03-28 17:19:49 +00:00
|
|
|
textLayoutModule = new TextLayoutModuleBase(this);
|
|
|
|
pageLayoutModule = new PageLayoutModuleBase(this);
|
2002-10-09 08:59:02 +00:00
|
|
|
marginsModule = new MarginsModuleBase(this);
|
|
|
|
langModule = new LanguageModuleBase(this);
|
|
|
|
bulletsModule = new BulletsModule(this);
|
|
|
|
numberingModule = new NumberingModuleBase(this);
|
|
|
|
biblioModule = new BiblioModuleBase(this);
|
2003-03-28 17:19:49 +00:00
|
|
|
mathsModule = new MathsModuleBase(this);
|
|
|
|
floatModule = new FloatPlacement(this, "floatplacement");
|
|
|
|
latexModule = new LaTeXModuleBase(this);
|
2003-10-23 11:58:01 +00:00
|
|
|
branchesModule = new BranchesModuleBase(this);
|
2002-10-09 08:59:02 +00:00
|
|
|
preambleModule = new PreambleModuleBase(this);
|
|
|
|
|
2003-03-28 17:19:49 +00:00
|
|
|
docPS->addPanel(latexModule, _("Document Class"));
|
|
|
|
docPS->addPanel(textLayoutModule, _("Text Layout"));
|
|
|
|
docPS->addPanel(pageLayoutModule, _("Page Layout"));
|
|
|
|
docPS->addPanel(marginsModule, _("Page Margins"));
|
2003-03-28 02:10:23 +00:00
|
|
|
docPS->addPanel(langModule, _("Language"));
|
2003-03-29 03:46:27 +00:00
|
|
|
docPS->addPanel(numberingModule, _("Numbering & TOC"));
|
2003-03-28 02:10:23 +00:00
|
|
|
docPS->addPanel(biblioModule, _("Bibliography"));
|
2003-03-28 17:19:49 +00:00
|
|
|
docPS->addPanel(mathsModule, _("Math options"));
|
|
|
|
docPS->addPanel(floatModule, _("Float Placement"));
|
2003-03-28 02:10:23 +00:00
|
|
|
docPS->addPanel(bulletsModule, _("Bullets"));
|
2003-10-23 11:58:01 +00:00
|
|
|
docPS->addPanel(branchesModule, _("Branches"));
|
2003-03-28 02:10:23 +00:00
|
|
|
docPS->addPanel(preambleModule, _("LaTeX Preamble"));
|
2003-03-28 17:19:49 +00:00
|
|
|
docPS->setCurrentPanel(_("Document Class"));
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2002-12-01 22:59:25 +00:00
|
|
|
// preamble
|
2003-03-28 02:10:23 +00:00
|
|
|
connect(preambleModule->preambleMLE, SIGNAL(textChanged()), this, SLOT(change_adaptor()));
|
2002-12-01 22:59:25 +00:00
|
|
|
// biblio
|
2004-03-07 14:33:17 +00:00
|
|
|
connect(biblioModule->citeDefaultRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
|
|
|
|
connect(biblioModule->citeNatbibRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
|
2003-03-28 02:10:23 +00:00
|
|
|
connect(biblioModule->citeStyleCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
|
2004-03-07 14:33:17 +00:00
|
|
|
connect(biblioModule->citeJurabibRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
|
2004-03-29 13:17:25 +00:00
|
|
|
connect(biblioModule->bibtopicCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
|
2002-12-01 22:59:25 +00:00
|
|
|
// language & quote
|
2003-03-28 02:10:23 +00:00
|
|
|
connect(langModule->languageCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
|
|
|
|
connect(langModule->defaultencodingCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
|
|
|
|
connect(langModule->encodingCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
|
|
|
|
connect(langModule->quoteStyleCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
|
2002-12-01 22:59:25 +00:00
|
|
|
// numbering
|
2003-03-29 03:46:27 +00:00
|
|
|
connect(numberingModule->depthSL, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor()));
|
|
|
|
connect(numberingModule->tocSL, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor()));
|
|
|
|
connect(numberingModule->depthSL, SIGNAL(valueChanged(int)), this, SLOT(updateNumbering()));
|
|
|
|
connect(numberingModule->tocSL, SIGNAL(valueChanged(int)), this, SLOT(updateNumbering()));
|
|
|
|
numberingModule->tocLV->setSorting(-1);
|
2003-03-28 17:19:49 +00:00
|
|
|
// maths
|
|
|
|
connect(mathsModule->amsCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
|
|
|
|
connect(mathsModule->amsautoCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
|
|
|
|
// float
|
|
|
|
connect(floatModule, SIGNAL(changed()), this, SLOT(change_adaptor()));
|
|
|
|
// latex class
|
|
|
|
connect(latexModule->classCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
|
|
|
|
connect(latexModule->optionsLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(latexModule->psdriverCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
|
|
|
|
connect(latexModule->classCO, SIGNAL(activated(int)), this, SLOT(classChanged()));
|
|
|
|
// text layout
|
|
|
|
connect(textLayoutModule->fontsCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
|
|
|
|
connect(textLayoutModule->fontsizeCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
|
|
|
|
connect(textLayoutModule->lspacingCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
|
|
|
|
connect(textLayoutModule->lspacingCO, SIGNAL(activated(int)), this, SLOT(setLSpacing(int)));
|
|
|
|
connect(textLayoutModule->lspacingLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(textLayoutModule->skipRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
|
|
|
|
connect(textLayoutModule->indentRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
|
|
|
|
connect(textLayoutModule->skipCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
|
|
|
|
connect(textLayoutModule->skipLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(textLayoutModule->skipLengthCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
|
|
|
|
connect(textLayoutModule->skipCO, SIGNAL(activated(int)), this, SLOT(setSkip(int)));
|
|
|
|
connect(textLayoutModule->skipRB, SIGNAL(toggled(bool)), this, SLOT(enableSkip(bool)));
|
|
|
|
connect(textLayoutModule->twoColumnCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
|
2002-11-13 00:52:15 +00:00
|
|
|
|
2002-12-01 22:59:25 +00:00
|
|
|
// margins
|
2003-03-28 02:10:23 +00:00
|
|
|
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()));
|
2002-11-13 00:52:15 +00:00
|
|
|
|
2003-03-28 17:19:49 +00:00
|
|
|
// page layout
|
|
|
|
connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)), this, SLOT(setMargins(int)));
|
|
|
|
connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)), this, SLOT(setCustomPapersize(int)));
|
|
|
|
connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)), this, SLOT(setCustomPapersize(int)));
|
|
|
|
connect(pageLayoutModule->portraitRB, SIGNAL(toggled(bool)), this, SLOT(portraitChanged()));
|
|
|
|
connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
|
|
|
|
connect(pageLayoutModule->paperheightLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(pageLayoutModule->paperwidthLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(pageLayoutModule->paperwidthUnitCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
|
|
|
|
connect(pageLayoutModule->paperheightUnitCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
|
|
|
|
connect(pageLayoutModule->portraitRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
|
|
|
|
connect(pageLayoutModule->landscapeRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
|
|
|
|
connect(pageLayoutModule->facingPagesCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
|
|
|
|
connect(pageLayoutModule->pagestyleCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
|
2002-11-13 00:52:15 +00:00
|
|
|
|
2003-02-25 13:35:26 +00:00
|
|
|
// bullets
|
2003-03-29 01:29:20 +00:00
|
|
|
connect(bulletsModule, SIGNAL(changed()), this, SLOT(change_adaptor()));
|
2003-10-23 11:58:01 +00:00
|
|
|
|
|
|
|
// branches
|
|
|
|
connect(branchesModule->addBranchPB, SIGNAL(pressed()), this, SLOT(addBranchPressed()));
|
|
|
|
connect(branchesModule->removePB, SIGNAL(pressed()), this, SLOT(deleteBranchPressed()));
|
|
|
|
connect(branchesModule->activatePB, SIGNAL(pressed()), this, SLOT(toggleBranchPressed()));
|
2003-12-01 07:54:02 +00:00
|
|
|
connect(branchesModule->branchesLV, SIGNAL(doubleClicked(QListViewItem *)), this,
|
|
|
|
SLOT(branchDoubleClicked(QListViewItem *)));
|
2003-11-29 17:25:31 +00:00
|
|
|
connect(branchesModule->colorPB, SIGNAL(clicked()), this, SLOT(toggleBranchColor()));
|
2003-10-23 11:58:01 +00:00
|
|
|
branchesModule->branchesLV->setSorting(0);
|
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
|
|
|
|
2003-03-28 02:10:23 +00:00
|
|
|
void QDocumentDialog::showPreamble()
|
2002-10-09 08:59:02 +00:00
|
|
|
{
|
2003-03-28 02:10:23 +00:00
|
|
|
docPS->setCurrentPanel(_("LaTeX Preamble"));
|
2002-10-09 08:59:02 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2003-03-28 17:19:49 +00:00
|
|
|
textLayoutModule->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);
|
2003-03-28 17:19:49 +00:00
|
|
|
textLayoutModule->skipLE->setEnabled(enable);
|
|
|
|
textLayoutModule->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
|
|
|
{
|
2003-03-28 17:19:49 +00:00
|
|
|
textLayoutModule->skipCO->setEnabled(skip);
|
|
|
|
textLayoutModule->skipLE->setEnabled(skip);
|
|
|
|
textLayoutModule->skipLengthCO->setEnabled(skip);
|
2002-10-09 08:59:02 +00:00
|
|
|
if (skip)
|
2003-03-28 17:19:49 +00:00
|
|
|
setSkip(textLayoutModule->skipCO->currentItem());
|
2001-08-19 13:25:15 +00:00
|
|
|
}
|
|
|
|
|
2003-02-12 17:05:56 +00:00
|
|
|
void QDocumentDialog::portraitChanged()
|
|
|
|
{
|
2003-03-28 17:19:49 +00:00
|
|
|
setMargins(pageLayoutModule->papersizeCO->currentItem());
|
2003-02-12 17:05:56 +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-10-09 08:59:02 +00:00
|
|
|
int olditem = marginsModule->marginCO->currentItem();
|
|
|
|
marginsModule->marginCO->clear();
|
2002-12-17 20:37:13 +00:00
|
|
|
marginsModule->marginCO->insertItem(qt_("Default"));
|
|
|
|
marginsModule->marginCO->insertItem(qt_("Custom"));
|
2003-02-12 17:05:56 +00:00
|
|
|
bool a4size = (papersize == 6 || papersize == 0
|
2003-07-26 23:04:39 +00:00
|
|
|
&& lyxrc.default_papersize == PAPER_A4PAPER);
|
2003-03-28 17:19:49 +00:00
|
|
|
if (a4size && pageLayoutModule->portraitRB->isChecked()) {
|
2002-12-17 20:37:13 +00:00
|
|
|
marginsModule->marginCO->insertItem(qt_("Small margins"));
|
|
|
|
marginsModule->marginCO->insertItem(qt_("Very small margins"));
|
|
|
|
marginsModule->marginCO->insertItem(qt_("Very wide margins"));
|
|
|
|
} else if (olditem > 1) {
|
|
|
|
olditem = 0;
|
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);
|
|
|
|
|
2003-03-28 17:19:49 +00:00
|
|
|
pageLayoutModule->paperwidthL->setEnabled(custom);
|
|
|
|
pageLayoutModule->paperwidthLE->setEnabled(custom);
|
|
|
|
pageLayoutModule->paperwidthUnitCO->setEnabled(custom);
|
|
|
|
pageLayoutModule->paperheightL->setEnabled(custom);
|
|
|
|
pageLayoutModule->paperheightLE->setEnabled(custom);
|
|
|
|
pageLayoutModule->paperheightLE->setFocus();
|
|
|
|
pageLayoutModule->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
|
|
|
{
|
2003-03-28 17:19:49 +00:00
|
|
|
textLayoutModule->fontsizeCO->clear();
|
|
|
|
textLayoutModule->fontsizeCO->insertItem("default");
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2003-06-30 23:56:22 +00:00
|
|
|
for (int n = 0; !token(items,'|',n).empty(); ++n)
|
2003-03-28 17:19:49 +00:00
|
|
|
textLayoutModule->fontsizeCO->
|
2002-12-17 20:37:13 +00:00
|
|
|
insertItem(toqstr(token(items,'|',n)));
|
2001-08-19 13:25:15 +00:00
|
|
|
|
2003-03-28 17:19:49 +00:00
|
|
|
for (int n = 0; n<textLayoutModule->fontsizeCO->count(); ++n) {
|
|
|
|
if (fromqstr(textLayoutModule->fontsizeCO->text(n)) == sel) {
|
|
|
|
textLayoutModule->fontsizeCO->setCurrentItem(n);
|
2002-10-09 08:59:02 +00:00
|
|
|
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
|
|
|
{
|
2003-03-28 17:19:49 +00:00
|
|
|
pageLayoutModule->pagestyleCO->clear();
|
|
|
|
pageLayoutModule->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)
|
2003-03-28 17:19:49 +00:00
|
|
|
pageLayoutModule->pagestyleCO->
|
2002-12-17 20:37:13 +00:00
|
|
|
insertItem(toqstr(token(items,'|',n)));
|
2001-08-19 13:25:15 +00:00
|
|
|
|
2003-03-28 17:19:49 +00:00
|
|
|
for (int n = 0; n<pageLayoutModule->pagestyleCO->count(); ++n) {
|
|
|
|
if (fromqstr(pageLayoutModule->pagestyleCO->text(n))==sel) {
|
|
|
|
pageLayoutModule->pagestyleCO->setCurrentItem(n);
|
2002-10-09 08:59:02 +00:00
|
|
|
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-22 10:47:56 +00:00
|
|
|
ControlDocument & cntrl = form_->controller();
|
|
|
|
BufferParams & params = cntrl.params();
|
2002-11-07 15:48:38 +00:00
|
|
|
|
2003-03-28 17:19:49 +00:00
|
|
|
lyx::textclass_type const tc = latexModule->classCO->currentItem();
|
2002-11-07 15:48:38 +00:00
|
|
|
|
2002-11-24 14:54:50 +00:00
|
|
|
if (form_->controller().loadTextclass(tc)) {
|
2002-11-07 15:48:38 +00:00
|
|
|
params.textclass = tc;
|
|
|
|
|
2002-11-22 10:47:56 +00:00
|
|
|
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 {
|
2003-05-03 19:24:36 +00:00
|
|
|
latexModule->classCO->setCurrentItem(params.textclass);
|
2002-11-07 15:48:38 +00:00
|
|
|
}
|
2002-10-20 01:48:28 +00:00
|
|
|
}
|
2003-03-29 03:46:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
void QDocumentDialog::updateNumbering()
|
|
|
|
{
|
|
|
|
int const depth = numberingModule->depthSL->value();
|
|
|
|
int const toc = numberingModule->tocSL->value();
|
|
|
|
QListViewItem * partitem = numberingModule->tocLV->firstChild();
|
|
|
|
QListViewItem * chapteritem = partitem->nextSibling();
|
|
|
|
QListViewItem * sectionitem = chapteritem->nextSibling();
|
|
|
|
QListViewItem * subsectionitem = sectionitem->nextSibling();
|
|
|
|
QListViewItem * subsubsectionitem = subsectionitem->nextSibling();
|
|
|
|
QListViewItem * paragraphitem = subsubsectionitem->nextSibling();
|
|
|
|
QListViewItem * subparagraphitem = paragraphitem->nextSibling();
|
|
|
|
|
|
|
|
QString const no = qt_("No");
|
|
|
|
QString const yes = qt_("Yes");
|
|
|
|
|
|
|
|
//numberingModule->tocLV->setUpdatesEnabled(false);
|
|
|
|
|
|
|
|
partitem->setText(1, yes);
|
|
|
|
chapteritem->setText(1, yes);
|
|
|
|
sectionitem->setText(1, yes);
|
|
|
|
subsectionitem->setText(1, yes);
|
|
|
|
subsubsectionitem->setText(1, yes);
|
|
|
|
paragraphitem->setText(1, yes);
|
|
|
|
subparagraphitem->setText(1, yes);
|
|
|
|
partitem->setText(2, yes);
|
|
|
|
chapteritem->setText(2, yes);
|
|
|
|
sectionitem->setText(2, yes);
|
|
|
|
subsectionitem->setText(2, yes);
|
|
|
|
subsubsectionitem->setText(2, yes);
|
|
|
|
paragraphitem->setText(2, yes);
|
|
|
|
subparagraphitem->setText(2, yes);
|
|
|
|
|
|
|
|
// numbering
|
|
|
|
if (depth < -1) partitem->setText(1, no);
|
|
|
|
if (depth < 0) chapteritem->setText(1, no);
|
|
|
|
if (depth < 1) sectionitem->setText(1, no);
|
|
|
|
if (depth < 2) subsectionitem->setText(1, no);
|
|
|
|
if (depth < 3) subsubsectionitem->setText(1, no);
|
|
|
|
if (depth < 4) paragraphitem->setText(1, no);
|
|
|
|
if (depth < 5) subparagraphitem->setText(1, no);
|
|
|
|
|
|
|
|
// in toc
|
|
|
|
if (toc < 0) chapteritem->setText(2, no);
|
|
|
|
if (toc < 1) sectionitem->setText(2, no);
|
|
|
|
if (toc < 2) subsectionitem->setText(2, no);
|
|
|
|
if (toc < 3) subsubsectionitem->setText(2, no);
|
|
|
|
if (toc < 4) paragraphitem->setText(2, no);
|
|
|
|
if (toc < 5) subparagraphitem->setText(2, no);
|
|
|
|
|
|
|
|
//numberingModule->tocLV->setUpdatesEnabled(true);
|
|
|
|
//numberingModule->tocLV->update();
|
|
|
|
}
|
2003-10-23 11:58:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
void QDocumentDialog::updateBranchView()
|
|
|
|
{
|
2004-03-05 13:08:08 +00:00
|
|
|
// store the selected branch
|
|
|
|
QListViewItem * selItem =
|
|
|
|
branchesModule->branchesLV->selectedItem();
|
|
|
|
QString sel_branch;
|
|
|
|
if (selItem != 0)
|
|
|
|
sel_branch = selItem->text(0);
|
|
|
|
|
2003-10-23 11:58:01 +00:00
|
|
|
branchesModule->branchesLV->clear();
|
2003-12-14 16:33:56 +00:00
|
|
|
|
|
|
|
BranchList::const_iterator it = form_->branchlist_.begin();
|
|
|
|
BranchList::const_iterator const end = form_->branchlist_.end();
|
|
|
|
for (; it != end; ++it) {
|
|
|
|
QString const bname = toqstr(it->getBranch());
|
|
|
|
QString const sel = it->getSelected() ? qt_("Yes") : qt_("No");
|
|
|
|
QListViewItem * newItem =
|
|
|
|
new QListViewItem(branchesModule->branchesLV, bname, sel);
|
|
|
|
string const x11hexname = it->getColor();
|
|
|
|
QColor itemcolor;
|
|
|
|
if (x11hexname[0] == '#')
|
|
|
|
itemcolor.setNamedColor(toqstr(x11hexname));
|
|
|
|
if (itemcolor.isValid()) {
|
|
|
|
QPixmap coloritem(30, 10);
|
|
|
|
coloritem.fill(itemcolor);
|
|
|
|
newItem->setPixmap(2, coloritem);
|
2003-10-23 11:58:01 +00:00
|
|
|
}
|
2004-03-05 13:08:08 +00:00
|
|
|
// restore selected branch
|
|
|
|
if (bname == sel_branch)
|
|
|
|
branchesModule->branchesLV->setSelected(newItem, true);
|
2003-10-23 11:58:01 +00:00
|
|
|
}
|
|
|
|
form_->changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QDocumentDialog::addBranchPressed()
|
|
|
|
{
|
|
|
|
QString const new_branch = branchesModule->newBranchLE->text();
|
|
|
|
if (!new_branch.isEmpty()) {
|
2003-12-14 16:33:56 +00:00
|
|
|
form_->branchlist_.add(fromqstr(new_branch));
|
2003-10-23 11:58:01 +00:00
|
|
|
branchesModule->newBranchLE->clear();
|
|
|
|
updateBranchView();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QDocumentDialog::deleteBranchPressed()
|
|
|
|
{
|
|
|
|
QListViewItem * selItem =
|
|
|
|
branchesModule->branchesLV->selectedItem();
|
|
|
|
QString sel_branch;
|
|
|
|
if (selItem != 0)
|
|
|
|
sel_branch = selItem->text(0);
|
|
|
|
if (sel_branch) {
|
2003-12-14 16:33:56 +00:00
|
|
|
form_->branchlist_.remove(fromqstr(sel_branch));
|
2003-10-23 11:58:01 +00:00
|
|
|
branchesModule->newBranchLE->clear();
|
|
|
|
updateBranchView();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QDocumentDialog::toggleBranchPressed()
|
2003-12-01 07:54:02 +00:00
|
|
|
{
|
|
|
|
QListViewItem * selItem =
|
|
|
|
branchesModule->branchesLV->selectedItem();
|
|
|
|
toggleBranch(selItem);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QDocumentDialog::branchDoubleClicked(QListViewItem * selItem)
|
|
|
|
{
|
|
|
|
toggleBranch(selItem);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QDocumentDialog::toggleBranch(QListViewItem * selItem)
|
2003-10-23 11:58:01 +00:00
|
|
|
{
|
2003-12-14 16:33:56 +00:00
|
|
|
if (selItem == 0)
|
|
|
|
return;
|
2003-10-23 11:58:01 +00:00
|
|
|
|
2003-12-14 16:33:56 +00:00
|
|
|
QString sel_branch = selItem->text(0);
|
2003-10-23 11:58:01 +00:00
|
|
|
if (sel_branch) {
|
2003-12-14 16:33:56 +00:00
|
|
|
bool const selected = selItem->text(1) == qt_("Yes");
|
|
|
|
Branch * branch = form_->branchlist_.find(fromqstr(sel_branch));
|
|
|
|
if (branch && branch->setSelected(!selected)) {
|
|
|
|
branchesModule->newBranchLE->clear();
|
|
|
|
updateBranchView();
|
|
|
|
}
|
2003-10-23 11:58:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QDocumentDialog::toggleBranchColor()
|
|
|
|
{
|
|
|
|
QListViewItem * selItem =
|
|
|
|
branchesModule->branchesLV->selectedItem();
|
|
|
|
QString sel_branch;
|
|
|
|
if (selItem != 0)
|
|
|
|
sel_branch = selItem->text(0);
|
|
|
|
if (sel_branch) {
|
|
|
|
QColor initial;
|
2003-10-27 07:05:07 +00:00
|
|
|
string current_branch = fromqstr(sel_branch);
|
2003-12-14 16:33:56 +00:00
|
|
|
Branch * branch =
|
|
|
|
form_->branchlist_.find(current_branch);
|
|
|
|
if (!branch)
|
|
|
|
return;
|
|
|
|
|
|
|
|
string x11hexname = branch->getColor();
|
2003-10-23 11:58:01 +00:00
|
|
|
if (x11hexname[0] == '#')
|
|
|
|
initial.setNamedColor(toqstr(x11hexname));
|
|
|
|
QColor ncol(QColorDialog::getColor(initial));
|
|
|
|
if (ncol.isValid()){
|
2003-10-27 07:05:07 +00:00
|
|
|
// add the color to the branchlist
|
2003-12-14 16:33:56 +00:00
|
|
|
branch->setColor(fromqstr(ncol.name()));
|
2003-10-23 11:58:01 +00:00
|
|
|
branchesModule->newBranchLE->clear();
|
|
|
|
updateBranchView();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|