2001-08-19 13:25:15 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file QDocument.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.
|
2002-10-15 18:29:01 +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
|
|
|
|
*/
|
2001-03-23 06:31:30 +00:00
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2002-04-23 08:16:27 +00:00
|
|
|
|
#ifdef __GNUG__
|
2001-03-23 06:31:30 +00:00
|
|
|
|
#pragma implementation
|
|
|
|
|
#endif
|
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
#include "gettext.h"
|
|
|
|
|
|
|
|
|
|
#include "ControlDocument.h"
|
2001-08-19 13:25:15 +00:00
|
|
|
|
#include "QDocument.h"
|
|
|
|
|
#include "QDocumentDialog.h"
|
2002-10-09 08:59:02 +00:00
|
|
|
|
#include "Qt2BC.h"
|
2001-03-23 06:31:30 +00:00
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
#include "language.h"
|
|
|
|
|
#include "helper_funcs.h" // getSecond()
|
2001-03-23 06:31:30 +00:00
|
|
|
|
#include "insets/insetquotes.h"
|
2002-10-09 08:59:02 +00:00
|
|
|
|
#include "frnt_lang.h"
|
|
|
|
|
#include "tex-strings.h" // tex_graphics
|
|
|
|
|
#include "support/lstrings.h" // tostr()
|
|
|
|
|
#include "support/filetools.h" // LibFileSearch()
|
|
|
|
|
#include "lyxtextclasslist.h"
|
2001-03-23 06:31:30 +00:00
|
|
|
|
#include "vspace.h"
|
2002-10-09 08:59:02 +00:00
|
|
|
|
#include "bufferparams.h"
|
2001-03-23 06:31:30 +00:00
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
#include <qpushbutton.h>
|
|
|
|
|
#include <qmultilineedit.h>
|
2001-03-23 06:31:30 +00:00
|
|
|
|
#include <qradiobutton.h>
|
2002-10-09 08:59:02 +00:00
|
|
|
|
#include <qcombobox.h>
|
|
|
|
|
#include <qcheckbox.h>
|
2001-03-23 06:31:30 +00:00
|
|
|
|
#include <qspinbox.h>
|
2002-10-09 08:59:02 +00:00
|
|
|
|
#include <qlineedit.h>
|
|
|
|
|
#include <qstringlist.h>
|
|
|
|
|
#include "lengthcombo.h"
|
2001-03-23 06:31:30 +00:00
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
#include <vector>
|
2001-03-29 15:02:19 +00:00
|
|
|
|
|
2002-10-15 17:45:12 +00:00
|
|
|
|
using std::vector;
|
|
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
|
typedef Qt2CB<ControlDocument, Qt2DB<QDocumentDialog> > base_class;
|
2001-03-23 06:31:30 +00:00
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
QDocument::QDocument()
|
|
|
|
|
: base_class(_("Document Settings"))
|
2001-03-23 06:31:30 +00:00
|
|
|
|
{
|
2002-10-09 08:59:02 +00:00
|
|
|
|
vector<frnt::LanguagePair> const langs = frnt::getLanguageData(false);
|
|
|
|
|
lang_ = getSecond(langs);
|
2001-03-23 06:31:30 +00:00
|
|
|
|
}
|
2001-08-29 15:37:39 +00:00
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
void QDocument::build_dialog()
|
2001-08-29 15:37:39 +00:00
|
|
|
|
{
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_.reset(new QDocumentDialog(this));
|
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
// biblio
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->biblioModule->citeStyleCO->insertItem(_("Author-year"));
|
|
|
|
|
dialog_->biblioModule->citeStyleCO->insertItem(_("Numerical"));
|
|
|
|
|
dialog_->biblioModule->citeStyleCO->setCurrentItem(0);
|
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
// language & quotes
|
2002-10-09 08:59:02 +00:00
|
|
|
|
vector<frnt::LanguagePair> const langs = frnt::getLanguageData(false);
|
|
|
|
|
vector<frnt::LanguagePair>::const_iterator lit = langs.begin();
|
|
|
|
|
vector<frnt::LanguagePair>::const_iterator lend = langs.end();
|
|
|
|
|
for (; lit != lend; ++lit) {
|
|
|
|
|
dialog_->langModule->languageCO->insertItem(
|
|
|
|
|
lit->first.c_str());
|
|
|
|
|
}
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->langModule->quoteStyleCO->insertItem(_("``text''"));
|
|
|
|
|
dialog_->langModule->quoteStyleCO->insertItem(_("''text''"));
|
|
|
|
|
dialog_->langModule->quoteStyleCO->insertItem(_(",,text``"));
|
|
|
|
|
dialog_->langModule->quoteStyleCO->insertItem(_(",,text''"));
|
|
|
|
|
dialog_->langModule->quoteStyleCO->insertItem(_("<EFBFBD>text<EFBFBD>"));
|
|
|
|
|
dialog_->langModule->quoteStyleCO->insertItem(_("<EFBFBD>text<EFBFBD>"));
|
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
// packages
|
2002-10-09 08:59:02 +00:00
|
|
|
|
char const * items[] = {"default","auto","latin1","latin2",
|
|
|
|
|
"latin3","latin4","latin5","latin9",
|
|
|
|
|
"koi8-r","koi8-u","cp866","cp1251",
|
|
|
|
|
"iso88595","pt154",0};
|
|
|
|
|
dialog_->packagesModule->encodingCO->insertStrList(items);
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->packagesModule->lspacingCO->insertItem(
|
2002-10-20 01:48:28 +00:00
|
|
|
|
_("Single"), Spacing::Single);
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->packagesModule->lspacingCO->insertItem(
|
2002-10-20 01:48:28 +00:00
|
|
|
|
_("OneHalf"), Spacing::Onehalf);
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->packagesModule->lspacingCO->insertItem(
|
2002-10-20 01:48:28 +00:00
|
|
|
|
_("Double"), Spacing::Double);
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->packagesModule->lspacingCO->insertItem(
|
2002-10-20 01:48:28 +00:00
|
|
|
|
_("Custom"), Spacing::Other);
|
2002-10-09 08:59:02 +00:00
|
|
|
|
|
2002-10-19 10:32:57 +00:00
|
|
|
|
for (int n = 0; tex_graphics[n][0]; ++n) {
|
2002-10-09 08:59:02 +00:00
|
|
|
|
QString enc = tex_graphics[n];
|
|
|
|
|
dialog_->packagesModule->psdriverCO->insertItem(enc);
|
|
|
|
|
}
|
2001-03-23 06:31:30 +00:00
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
// paper
|
2002-10-09 08:59:02 +00:00
|
|
|
|
QStringList papersize_;
|
|
|
|
|
papersize_ << _("Default") << _("Custom") << _("US letter") << _("US legal")
|
|
|
|
|
<< _("US executive") << _("A3") << _("A4") << _("A5")
|
|
|
|
|
<< _("B3") << _("B4") << _("B5");
|
|
|
|
|
dialog_->paperModule->papersizeCO->insertStringList(papersize_);
|
2001-03-23 06:31:30 +00:00
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
// layout
|
2002-10-09 08:59:02 +00:00
|
|
|
|
for (LyXTextClassList::const_iterator cit = textclasslist.begin();
|
|
|
|
|
cit != textclasslist.end(); ++cit) {
|
|
|
|
|
dialog_->layoutModule->classCO->insertItem(cit->description().c_str());
|
|
|
|
|
}
|
2001-06-05 17:05:51 +00:00
|
|
|
|
|
2002-10-19 10:32:57 +00:00
|
|
|
|
for (int n = 0; tex_fonts[n][0]; ++n) {
|
2002-10-09 08:59:02 +00:00
|
|
|
|
QString font = tex_fonts[n];
|
|
|
|
|
dialog_->layoutModule->fontsCO->insertItem(font);
|
|
|
|
|
}
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->layoutModule->fontsizeCO->insertItem(_("default"));
|
|
|
|
|
dialog_->layoutModule->fontsizeCO->insertItem(_("10"));
|
|
|
|
|
dialog_->layoutModule->fontsizeCO->insertItem(_("11"));
|
|
|
|
|
dialog_->layoutModule->fontsizeCO->insertItem(_("12"));
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->layoutModule->skipCO->insertItem(_("Smallskip"));
|
|
|
|
|
dialog_->layoutModule->skipCO->insertItem(_("Medskip"));
|
|
|
|
|
dialog_->layoutModule->skipCO->insertItem(_("Bigskip"));
|
|
|
|
|
dialog_->layoutModule->skipCO->insertItem(_("Length"));
|
|
|
|
|
|
|
|
|
|
dialog_->layoutModule->pagestyleCO->insertItem(_("default"));
|
|
|
|
|
dialog_->layoutModule->pagestyleCO->insertItem(_("empty"));
|
|
|
|
|
dialog_->layoutModule->pagestyleCO->insertItem(_("plain"));
|
|
|
|
|
dialog_->layoutModule->pagestyleCO->insertItem(_("headings"));
|
|
|
|
|
dialog_->layoutModule->pagestyleCO->insertItem(_("fancy"));
|
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
// margins
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->setMargins(0);
|
|
|
|
|
|
|
|
|
|
string const bmtablefile = LibFileSearch("images", "standard", "xpm");
|
|
|
|
|
QString s = bmtablefile.c_str();
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
// Manage the restore, ok, apply, restore and cancel/close buttons
|
|
|
|
|
bc().setOK(dialog_->okPB);
|
|
|
|
|
bc().setApply(dialog_->applyPB);
|
|
|
|
|
bc().setCancel(dialog_->cancelPB);
|
|
|
|
|
bc().setRestore(dialog_->restorePB);
|
2001-03-23 06:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
|
void QDocument::apply()
|
2001-03-23 06:31:30 +00:00
|
|
|
|
{
|
2002-10-20 01:48:28 +00:00
|
|
|
|
BufferParams & params = controller().params();
|
|
|
|
|
|
|
|
|
|
// preamble
|
|
|
|
|
params.preamble =
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->preambleModule->preambleMLE->text().latin1();
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
// biblio
|
|
|
|
|
params.use_natbib =
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->biblioModule->natbibCB->isChecked();
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.use_numerical_citations =
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->biblioModule->citeStyleCO->currentItem();
|
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
// language & quotes
|
2002-10-09 08:59:02 +00:00
|
|
|
|
if (dialog_->langModule->singleQuoteRB->isChecked())
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.quotes_times = InsetQuotes::SingleQ;
|
2002-10-09 08:59:02 +00:00
|
|
|
|
else
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.quotes_times = InsetQuotes::DoubleQ;
|
2001-06-05 17:05:51 +00:00
|
|
|
|
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
InsetQuotes::quote_language lga = InsetQuotes::EnglishQ;
|
|
|
|
|
switch (dialog_->langModule->quoteStyleCO->currentItem()) {
|
|
|
|
|
case 0:
|
|
|
|
|
lga = InsetQuotes::EnglishQ;
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
lga = InsetQuotes::SwedishQ;
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
lga = InsetQuotes::GermanQ;
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
lga = InsetQuotes::PolishQ;
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
lga = InsetQuotes::FrenchQ;
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
lga = InsetQuotes::DanishQ;
|
|
|
|
|
break;
|
2001-06-05 17:05:51 +00:00
|
|
|
|
}
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.quotes_language = lga;
|
2001-06-05 17:05:51 +00:00
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
int const pos = dialog_->langModule->languageCO->currentItem();
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.language = languages.getLanguage(lang_[pos]);
|
2001-03-29 15:02:19 +00:00
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
// numbering
|
|
|
|
|
params.secnumdepth =
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->numberingModule->tocDepthSB->value();
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.tocdepth =
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->numberingModule->sectionnrDepthSB->value();
|
2001-03-29 15:02:19 +00:00
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
// packages
|
2002-10-09 08:59:02 +00:00
|
|
|
|
switch (dialog_->packagesModule->lspacingCO->currentItem()) {
|
|
|
|
|
case 0:
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.spacing.set(Spacing::Single);
|
2002-10-09 08:59:02 +00:00
|
|
|
|
break;
|
|
|
|
|
case 1:
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.spacing.set(Spacing::Onehalf);
|
2002-10-09 08:59:02 +00:00
|
|
|
|
break;
|
|
|
|
|
case 2:
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.spacing.set(Spacing::Double);
|
2002-10-09 08:59:02 +00:00
|
|
|
|
break;
|
|
|
|
|
case 3:
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.spacing.set(Spacing::Other,
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->packagesModule->
|
|
|
|
|
lspacingLE->text().toFloat()
|
|
|
|
|
);
|
|
|
|
|
break;
|
2001-03-23 06:31:30 +00:00
|
|
|
|
}
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.graphicsDriver =
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->packagesModule->psdriverCO->currentText().latin1();
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.use_amsmath =
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->packagesModule->amsCB->isChecked();
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.inputenc =
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->packagesModule->encodingCO->currentText().latin1();
|
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
// layout
|
|
|
|
|
params.textclass =
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->layoutModule->classCO->currentItem();
|
|
|
|
|
|
|
|
|
|
//bool succes = controller().classApply();
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.fonts =
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->layoutModule->fontsCO->currentText().latin1();
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.fontsize =
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->layoutModule->fontsizeCO->currentText().latin1();
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.pagestyle =
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->layoutModule->pagestyleCO->currentText().latin1();
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
if (dialog_->layoutModule->indentRB->isChecked())
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.paragraph_separation = BufferParams::PARSEP_INDENT;
|
2001-06-05 17:05:51 +00:00
|
|
|
|
else
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.paragraph_separation = BufferParams::PARSEP_SKIP;
|
2002-10-09 08:59:02 +00:00
|
|
|
|
|
|
|
|
|
switch (dialog_->layoutModule->skipCO->currentItem()) {
|
|
|
|
|
case 0:
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.setDefSkip(VSpace(VSpace::SMALLSKIP));
|
2002-10-09 08:59:02 +00:00
|
|
|
|
break;
|
|
|
|
|
case 1:
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.setDefSkip(VSpace(VSpace::MEDSKIP));
|
2002-10-09 08:59:02 +00:00
|
|
|
|
break;
|
|
|
|
|
case 2:
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.setDefSkip(VSpace(VSpace::BIGSKIP));
|
2002-10-09 08:59:02 +00:00
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
{
|
|
|
|
|
LyXLength::UNIT unit =
|
|
|
|
|
dialog_->layoutModule->skipLengthCO->
|
|
|
|
|
currentLengthItem();
|
|
|
|
|
double length =
|
|
|
|
|
dialog_->layoutModule->skipLE->text().toDouble();
|
|
|
|
|
VSpace vs = VSpace(LyXGlueLength(LyXLength(length,unit)));
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.setDefSkip(vs);
|
2002-10-09 08:59:02 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default:
|
2001-06-05 17:05:51 +00:00
|
|
|
|
// DocumentDefskipCB assures that this never happens
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.setDefSkip(VSpace(VSpace::MEDSKIP));
|
2001-06-05 17:05:51 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.options =
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->layoutModule->optionsLE->text().latin1();
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.float_placement =
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->layoutModule->floatPlacementLE->text().latin1();
|
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
// paper
|
|
|
|
|
params.papersize2 =
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->paperModule->papersizeCO->currentItem();
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.paperwidth =
|
2002-10-09 08:59:02 +00:00
|
|
|
|
LyXLength(dialog_->paperModule->paperwidthLE->text().toDouble(),
|
|
|
|
|
dialog_->paperModule->paperwidthUnitCO->currentLengthItem()
|
|
|
|
|
).asString();
|
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.paperheight =
|
2002-10-09 08:59:02 +00:00
|
|
|
|
LyXLength(dialog_->paperModule->paperheightLE->text().toDouble(),
|
|
|
|
|
dialog_->paperModule->paperheightUnitCO->currentLengthItem()
|
|
|
|
|
).asString();
|
|
|
|
|
|
|
|
|
|
if (dialog_->paperModule->twoColumnCB->isChecked())
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.columns = 2;
|
2001-06-05 17:05:51 +00:00
|
|
|
|
else
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.columns = 1;
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
if (dialog_->paperModule->facingPagesCB->isChecked())
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.sides = LyXTextClass::TwoSides;
|
2001-06-05 17:05:51 +00:00
|
|
|
|
else
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.sides = LyXTextClass::OneSide;
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
if (dialog_->paperModule->landscapeRB->isChecked())
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.orientation = BufferParams::ORIENTATION_LANDSCAPE;
|
2001-06-05 17:05:51 +00:00
|
|
|
|
else
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.orientation = BufferParams::ORIENTATION_PORTRAIT;
|
2001-03-23 06:31:30 +00:00
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
// margins
|
|
|
|
|
params.use_geometry =
|
|
|
|
|
(dialog_->marginsModule->marginCO->currentItem() == 1);
|
2001-03-23 06:31:30 +00:00
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
int margin = dialog_->marginsModule->marginCO->currentItem();
|
2002-10-20 01:48:28 +00:00
|
|
|
|
if (margin > 0) {
|
2002-10-09 08:59:02 +00:00
|
|
|
|
margin = margin - 1;
|
2001-06-05 17:05:51 +00:00
|
|
|
|
}
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.paperpackage = char(margin);
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.leftmargin =
|
2002-10-09 08:59:02 +00:00
|
|
|
|
LyXLength(dialog_->marginsModule->innerLE->text().toDouble(),
|
|
|
|
|
dialog_->marginsModule->innerUnit->currentLengthItem()
|
|
|
|
|
).asString();
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.topmargin =
|
2002-10-09 08:59:02 +00:00
|
|
|
|
LyXLength(dialog_->marginsModule->topLE->text().toDouble(),
|
|
|
|
|
dialog_->marginsModule->topUnit->currentLengthItem()
|
|
|
|
|
).asString();
|
2001-06-05 17:05:51 +00:00
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.rightmargin =
|
2002-10-09 08:59:02 +00:00
|
|
|
|
LyXLength(dialog_->marginsModule->outerLE->text().toDouble(),
|
|
|
|
|
dialog_->marginsModule->outerUnit->currentLengthItem()
|
|
|
|
|
).asString();
|
2001-06-05 17:05:51 +00:00
|
|
|
|
|
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.bottommargin =
|
2002-10-09 08:59:02 +00:00
|
|
|
|
LyXLength(dialog_->marginsModule->bottomLE->text().toDouble(),
|
|
|
|
|
dialog_->marginsModule->bottomUnit->currentLengthItem()
|
|
|
|
|
).asString();
|
2001-03-23 06:31:30 +00:00
|
|
|
|
|
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.headheight =
|
2002-10-09 08:59:02 +00:00
|
|
|
|
LyXLength(dialog_->marginsModule->headheightLE->text().toDouble(),
|
|
|
|
|
dialog_->marginsModule->headheightUnit->currentLengthItem()
|
|
|
|
|
).asString();
|
2001-03-23 06:31:30 +00:00
|
|
|
|
|
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.headsep =
|
2002-10-09 08:59:02 +00:00
|
|
|
|
LyXLength(dialog_->marginsModule->headsepLE->text().toDouble(),
|
|
|
|
|
dialog_->marginsModule->headsepUnit->currentLengthItem()
|
|
|
|
|
).asString();
|
2001-03-29 15:02:19 +00:00
|
|
|
|
|
2001-03-23 06:31:30 +00:00
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.footskip =
|
2002-10-09 08:59:02 +00:00
|
|
|
|
LyXLength(dialog_->marginsModule->footskipLE->text().toDouble(),
|
|
|
|
|
dialog_->marginsModule->footskipUnit->currentLengthItem()
|
|
|
|
|
).asString();
|
2001-03-23 06:31:30 +00:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
namespace {
|
2001-03-23 06:31:30 +00:00
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
/** Return the position of val in the vector if found.
|
|
|
|
|
If not found, return 0.
|
|
|
|
|
*/
|
|
|
|
|
template<class A>
|
|
|
|
|
typename std::vector<A>::size_type
|
|
|
|
|
findPos(std::vector<A> const & vec, A const & val)
|
2001-03-23 06:31:30 +00:00
|
|
|
|
{
|
2002-10-09 08:59:02 +00:00
|
|
|
|
typename std::vector<A>::const_iterator it =
|
|
|
|
|
std::find(vec.begin(), vec.end(), val);
|
|
|
|
|
if (it == vec.end())
|
|
|
|
|
return 0;
|
|
|
|
|
return std::distance(vec.begin(), it);
|
2001-03-23 06:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
} // namespace anom
|
2001-03-23 06:31:30 +00:00
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
void QDocument::update_contents()
|
2001-03-23 06:31:30 +00:00
|
|
|
|
{
|
2002-10-09 08:59:02 +00:00
|
|
|
|
if (!dialog_.get())
|
2001-06-05 17:05:51 +00:00
|
|
|
|
return;
|
2001-03-23 06:31:30 +00:00
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
BufferParams const & params = controller().params();
|
|
|
|
|
|
|
|
|
|
// preamble
|
|
|
|
|
QString preamble = params.preamble.c_str();
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->preambleModule->preambleMLE->setText(preamble);
|
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
// biblio
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->biblioModule->natbibCB->setChecked(
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.use_natbib);
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->biblioModule->citeStyleCO->setCurrentItem(
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.use_numerical_citations ? 1 : 0);
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
// language & quotes
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->langModule->singleQuoteRB->setChecked(
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.quotes_times == InsetQuotes::SingleQ);
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->langModule->doubleQuoteRB->setChecked(
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.quotes_times == InsetQuotes::DoubleQ);
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
int const pos = int(findPos(lang_,
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.language->lang()));
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->langModule->languageCO->setCurrentItem(pos);
|
|
|
|
|
|
|
|
|
|
dialog_->langModule->quoteStyleCO->setCurrentItem(
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.quotes_language);
|
2002-10-09 08:59:02 +00:00
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
// numbering
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->numberingModule->tocDepthSB->setValue(
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.secnumdepth);
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->numberingModule->sectionnrDepthSB->setValue(
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.tocdepth);
|
2002-10-09 08:59:02 +00:00
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
// packages
|
2002-10-09 08:59:02 +00:00
|
|
|
|
QStringList enc;
|
|
|
|
|
enc << "default" << "auto" << "latin1" << "latin2" << "latin3" <<
|
|
|
|
|
"latin4" << "latin5" << "latin9" << "koi8-r" << "koi8-u" <<
|
|
|
|
|
"cp866" << "cp1251" << "iso88595" << "pt154";
|
|
|
|
|
int pos2 = 0;
|
|
|
|
|
for (QStringList::Iterator it = enc.begin();
|
|
|
|
|
it!=enc.end(); ++it) {
|
2002-10-20 01:48:28 +00:00
|
|
|
|
if (*it == params.inputenc.c_str()) {
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->packagesModule->encodingCO->setCurrentItem(pos2);
|
|
|
|
|
}
|
|
|
|
|
++pos2;
|
2001-06-05 17:05:51 +00:00
|
|
|
|
}
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
QString text = params.graphicsDriver.c_str();
|
2002-10-09 08:59:02 +00:00
|
|
|
|
int nitem = dialog_->packagesModule->psdriverCO->count();
|
2002-10-19 10:32:57 +00:00
|
|
|
|
for (int n = 0; n < nitem ; ++n) {
|
2002-10-09 08:59:02 +00:00
|
|
|
|
QString enc = tex_graphics[n];
|
2002-10-19 10:32:57 +00:00
|
|
|
|
if (enc == text) {
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->packagesModule->psdriverCO->setCurrentItem(n);
|
2001-06-05 17:05:51 +00:00
|
|
|
|
}
|
2001-03-29 15:02:19 +00:00
|
|
|
|
}
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->packagesModule->amsCB->setChecked(
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.use_amsmath);
|
2002-10-09 08:59:02 +00:00
|
|
|
|
|
|
|
|
|
dialog_->packagesModule->lspacingCO->
|
2002-10-20 01:48:28 +00:00
|
|
|
|
setCurrentItem(params.spacing.getSpace());
|
|
|
|
|
if (params.spacing.getSpace() == Spacing::Other) {
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->packagesModule->lspacingLE->setText(
|
2002-10-20 01:48:28 +00:00
|
|
|
|
tostr(params.spacing.getValue()).c_str());
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->setLSpacing(3);
|
2001-06-05 17:05:51 +00:00
|
|
|
|
}
|
2001-03-23 06:31:30 +00:00
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
// layout
|
2002-10-09 08:59:02 +00:00
|
|
|
|
for (int n = 0; n<dialog_->layoutModule->classCO->count(); ++n) {
|
2002-10-20 01:48:28 +00:00
|
|
|
|
if (dialog_->layoutModule->classCO->text(n) ==
|
2002-10-09 08:59:02 +00:00
|
|
|
|
controller().textClass().description().c_str()) {
|
|
|
|
|
dialog_->layoutModule->classCO->setCurrentItem(n);
|
|
|
|
|
break;
|
2001-06-05 17:05:51 +00:00
|
|
|
|
}
|
2001-03-23 06:31:30 +00:00
|
|
|
|
}
|
2002-10-09 08:59:02 +00:00
|
|
|
|
|
|
|
|
|
dialog_->updateFontsize(controller().textClass().opt_fontsize(),
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.fontsize);
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->updatePagestyle(controller().textClass().opt_pagestyle(),
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.pagestyle);
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-19 10:32:57 +00:00
|
|
|
|
for (int n = 0; tex_fonts[n][0]; ++n) {
|
2002-10-20 01:48:28 +00:00
|
|
|
|
if (tex_fonts[n] == params.fonts) {
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->layoutModule->fontsCO->setCurrentItem(n);
|
|
|
|
|
break;
|
2001-06-05 17:05:51 +00:00
|
|
|
|
}
|
2001-03-23 06:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
if (params.paragraph_separation
|
2002-10-09 08:59:02 +00:00
|
|
|
|
== BufferParams::PARSEP_INDENT) {
|
|
|
|
|
dialog_->layoutModule->indentRB->setChecked(true);
|
|
|
|
|
} else {
|
|
|
|
|
dialog_->layoutModule->skipRB->setChecked(true);
|
2001-06-05 17:05:51 +00:00
|
|
|
|
}
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
int skip = 0;
|
2002-10-20 01:48:28 +00:00
|
|
|
|
switch (params.getDefSkip().kind()) {
|
2002-10-09 08:59:02 +00:00
|
|
|
|
case VSpace::SMALLSKIP:
|
|
|
|
|
skip = 0;
|
|
|
|
|
break;
|
|
|
|
|
case VSpace::MEDSKIP:
|
|
|
|
|
skip = 1;
|
|
|
|
|
break;
|
|
|
|
|
case VSpace::BIGSKIP:
|
|
|
|
|
skip = 2;
|
|
|
|
|
break;
|
|
|
|
|
case VSpace::LENGTH:
|
|
|
|
|
{
|
|
|
|
|
skip = 3;
|
2002-10-20 01:48:28 +00:00
|
|
|
|
string const length = params.getDefSkip().asLyXCommand();
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->layoutModule->skipLengthCO->setCurrentItem(LyXLength(length).unit());
|
|
|
|
|
dialog_->layoutModule->skipLE->setText(tostr(LyXLength(length).value()).c_str());
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
skip = 0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
dialog_->layoutModule->skipCO->setCurrentItem(skip);
|
|
|
|
|
dialog_->setSkip(skip);
|
2001-03-23 06:31:30 +00:00
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
if (!params.options.empty()) {
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->layoutModule->optionsLE->setText(
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.options.c_str());
|
2002-10-09 08:59:02 +00:00
|
|
|
|
} else {
|
|
|
|
|
dialog_->layoutModule->optionsLE->setText("");
|
2001-03-29 15:02:19 +00:00
|
|
|
|
}
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
// paper
|
|
|
|
|
int const psize = params.papersize2;
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->paperModule->papersizeCO->setCurrentItem(psize);
|
|
|
|
|
dialog_->setMargins(psize);
|
|
|
|
|
dialog_->setCustomPapersize(psize);
|
|
|
|
|
|
|
|
|
|
bool const landscape =
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.orientation == BufferParams::ORIENTATION_LANDSCAPE;
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->paperModule->landscapeRB->setChecked(landscape);
|
|
|
|
|
dialog_->paperModule->portraitRB->setChecked(!landscape);
|
|
|
|
|
|
|
|
|
|
dialog_->paperModule->facingPagesCB->setChecked(
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.sides == LyXTextClass::TwoSides);
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->paperModule->twoColumnCB->setChecked(
|
2002-10-20 01:48:28 +00:00
|
|
|
|
params.columns == 2);
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->paperModule->paperwidthUnitCO->setCurrentItem(
|
2002-10-20 01:48:28 +00:00
|
|
|
|
LyXLength(params.paperwidth).unit());
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->paperModule->paperwidthLE->setText(
|
2002-10-20 01:48:28 +00:00
|
|
|
|
tostr(LyXLength(params.paperwidth).value()).c_str());
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->paperModule->paperheightUnitCO->setCurrentItem(
|
2002-10-20 01:48:28 +00:00
|
|
|
|
LyXLength(params.paperheight).unit());
|
2002-10-09 08:59:02 +00:00
|
|
|
|
|
|
|
|
|
dialog_->paperModule->paperheightLE->setText(
|
2002-10-20 01:48:28 +00:00
|
|
|
|
tostr(LyXLength(params.paperheight).value()).c_str());
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
// margins
|
|
|
|
|
int item = params.paperpackage;
|
|
|
|
|
if (params.use_geometry) {
|
2002-10-09 08:59:02 +00:00
|
|
|
|
item = 1;
|
2002-10-19 10:32:57 +00:00
|
|
|
|
} else if (item > 0) {
|
2002-10-09 08:59:02 +00:00
|
|
|
|
item = item + 1;
|
|
|
|
|
}
|
|
|
|
|
dialog_->marginsModule->marginCO->setCurrentItem(item);
|
|
|
|
|
dialog_->setCustomMargins(item);
|
|
|
|
|
|
|
|
|
|
dialog_->marginsModule->topUnit->setCurrentItem(
|
2002-10-20 01:48:28 +00:00
|
|
|
|
LyXLength(params.topmargin).unit());
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->marginsModule->topLE->setText(
|
2002-10-20 01:48:28 +00:00
|
|
|
|
tostr(LyXLength(params.topmargin).value()).c_str());
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->marginsModule->bottomUnit->setCurrentItem(
|
2002-10-20 01:48:28 +00:00
|
|
|
|
LyXLength(params.bottommargin).unit());
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->marginsModule->bottomLE->setText(
|
2002-10-20 01:48:28 +00:00
|
|
|
|
tostr(LyXLength(params.bottommargin).value()).c_str());
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->marginsModule->innerUnit->setCurrentItem(
|
2002-10-20 01:48:28 +00:00
|
|
|
|
LyXLength(params.leftmargin).unit());
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->marginsModule->innerLE->setText(
|
2002-10-20 01:48:28 +00:00
|
|
|
|
tostr(LyXLength(params.leftmargin).value()).c_str());
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->marginsModule->outerUnit->setCurrentItem(
|
2002-10-20 01:48:28 +00:00
|
|
|
|
LyXLength(params.rightmargin).unit());
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->marginsModule->outerLE->setText(
|
2002-10-20 01:48:28 +00:00
|
|
|
|
tostr(LyXLength(params.rightmargin).value()).c_str());
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->marginsModule->headheightUnit->setCurrentItem(
|
2002-10-20 01:48:28 +00:00
|
|
|
|
LyXLength(params.headheight).unit());
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->marginsModule->headheightLE->setText(
|
2002-10-20 01:48:28 +00:00
|
|
|
|
tostr(LyXLength(params.headheight).value()).c_str());
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->marginsModule->headsepUnit->setCurrentItem(
|
2002-10-20 01:48:28 +00:00
|
|
|
|
LyXLength(params.headsep).unit());
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->marginsModule->headsepLE->setText(
|
2002-10-20 01:48:28 +00:00
|
|
|
|
tostr(LyXLength(params.headsep).value()).c_str());
|
2002-10-15 18:29:01 +00:00
|
|
|
|
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->marginsModule->footskipUnit->setCurrentItem(
|
2002-10-20 01:48:28 +00:00
|
|
|
|
LyXLength(params.footskip).unit());
|
2002-10-09 08:59:02 +00:00
|
|
|
|
dialog_->marginsModule->footskipLE->setText(
|
2002-10-20 01:48:28 +00:00
|
|
|
|
tostr(LyXLength(params.footskip).value()).c_str());
|
2002-10-15 18:29:01 +00:00
|
|
|
|
}
|