#include "insets/InsetListingsParams.h"
-//#include "support/debug.h"
#include "support/FileName.h"
#include "support/filetools.h"
#include "support/lstrings.h"
+#include "frontends/alert.h"
+
#include <boost/bind.hpp>
#include <QCloseEvent>
using namespace std;
using namespace lyx::support;
+
///
template<class Pair>
vector<typename Pair::second_type> const
return tmp;
}
+
char const * const tex_graphics[] =
{
"default", "dvips", "dvitops", "emtex",
namespace lyx {
namespace frontend {
+
+///
+QModelIndex getSelectedIndex(QListView * lv)
+{
+ QModelIndex retval = QModelIndex();
+ QModelIndexList selIdx =
+ lv->selectionModel()->selectedIndexes();
+ if (!selIdx.empty())
+ retval = selIdx.first();
+ return retval;
+}
+
+
namespace {
vector<string> getRequiredList(string const & modName)
{
LyXModule const * const mod = moduleList[modName];
if (!mod)
return _("Module not found!");
- return from_ascii(mod->getDescription());
+ return _(mod->getDescription());
}
upPB, downPB, availableModel, selectedModel)
{}
-
-namespace {
-QModelIndex getSelectedIndex(QListView * lv)
-{
- QModelIndex retval = QModelIndex();
- QModelIndexList selIdx =
- lv->selectionModel()->selectedIndexes();
- if (!selIdx.empty())
- retval = selIdx.first();
- return retval;
-}
-}
-
void ModuleSelMan::updateAddPB()
{
GuiDocument::GuiDocument(GuiView & lv)
- : GuiDialog(lv, "document")
+ : GuiDialog(lv, "document", qt_("Document Settings")), current_id_(0)
{
setupUi(this);
- setViewTitle(_("Document Settings"));
-
+
lang_ = getSecond(getLanguageData(false));
connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
this, SLOT(enableSkip(bool)));
connect(textLayoutModule->twoColumnCB, SIGNAL(clicked()),
this, SLOT(change_adaptor()));
+ connect(textLayoutModule->twoColumnCB, SIGNAL(clicked()),
+ this, SLOT(setColSep()));
connect(textLayoutModule->listingsED, SIGNAL(textChanged()),
this, SLOT(change_adaptor()));
connect(textLayoutModule->bypassCB, SIGNAL(clicked()),
this, SLOT(change_adaptor()));
connect(marginsModule->footskipUnit, SIGNAL(activated(int)),
this, SLOT(change_adaptor()));
+ connect(marginsModule->columnsepLE, SIGNAL(textChanged(const QString&)),
+ this, SLOT(change_adaptor()));
+ connect(marginsModule->columnsepUnit, SIGNAL(activated(int)),
+ this, SLOT(change_adaptor()));
marginsModule->topLE->setValidator(unsignedLengthValidator(
marginsModule->topLE));
marginsModule->bottomLE->setValidator(unsignedLengthValidator(
marginsModule->headheightLE));
marginsModule->footskipLE->setValidator(unsignedLengthValidator(
marginsModule->footskipLE));
+ marginsModule->columnsepLE->setValidator(unsignedLengthValidator(
+ marginsModule->columnsepLE));
bc().addCheckedLineEdit(marginsModule->topLE,
marginsModule->topL);
marginsModule->headheightL);
bc().addCheckedLineEdit(marginsModule->footskipLE,
marginsModule->footskipL);
+ bc().addCheckedLineEdit(marginsModule->columnsepLE,
+ marginsModule->columnsepL);
langModule = new UiWidget<Ui::LanguageUi>;
latexModule = new UiWidget<Ui::LaTeXUi>;
// 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()));
+ connect(latexModule->classCO, SIGNAL(activated(int)),
+ this, SLOT(change_adaptor()));
selectionManager =
new ModuleSelMan(latexModule->availableLV, latexModule->selectedLV,
}
-void GuiDocument::closeEvent(QCloseEvent * e)
-{
- slotClose();
- e->accept();
-}
-
-
void GuiDocument::setLSpacing(int item)
{
textLayoutModule->lspacingLE->setEnabled(item == 3);
}
+void GuiDocument::setColSep()
+{
+ setCustomMargins(marginsModule->marginCB->checkState() == Qt::Checked);
+}
+
+
void GuiDocument::setCustomMargins(bool custom)
{
marginsModule->topL->setEnabled(!custom);
marginsModule->footskipL->setEnabled(!custom);
marginsModule->footskipLE->setEnabled(!custom);
marginsModule->footskipUnit->setEnabled(!custom);
+
+ bool const enableColSep = !custom &&
+ textLayoutModule->twoColumnCB->checkState() == Qt::Checked;
+ marginsModule->columnsepL->setEnabled(enableColSep);
+ marginsModule->columnsepLE->setEnabled(enableColSep);
+ marginsModule->columnsepUnit->setEnabled(enableColSep);
}
textclass_type const tc = latexModule->classCO->currentIndex();
bp_.setBaseClass(tc);
if (lyxrc.auto_reset_options) {
+ if (applyPB->isEnabled()) {
+ int const ret = Alert::prompt(_("Unapplied changes"),
+ _("Some changes in the dialog were not yet applied."
+ "If you do not apply now, they will be lost after this action."),
+ 1, 1, _("&Apply"), _("&Dismiss"));
+ if (ret == 0)
+ applyView();
+ }
bp_.useClassDefaults();
- updateContents();
+ forceUpdate();
}
}
params.headheight = widgetsToLength(m->headheightLE, m->headheightUnit);
params.headsep = widgetsToLength(m->headsepLE, m->headsepUnit);
params.footskip = widgetsToLength(m->footskipLE, m->footskipUnit);
+ params.columnsep = widgetsToLength(m->columnsepLE, m->columnsepUnit);
branchesModule->apply(params);
lengthToWidgets(m->footskipLE, m->footskipUnit,
params.footskip, defaultUnit);
+ lengthToWidgets(m->columnsepLE, m->columnsepUnit,
+ params.columnsep, defaultUnit);
+
branchesModule->update(params);
// PDF support
int const mSize = modInfoList.size();
for (int i = 0; i < mSize; ++i) {
modInfoStruct const & modInfo = modInfoList[i];
- available_model_.insertRow(i, modInfo.name, modInfo.id);
+ available_model_.insertRow(i, qt_(modInfo.name), modInfo.id);
}
}
int const sSize = selModList.size();
for (int i = 0; i < sSize; ++i) {
modInfoStruct const & modInfo = selModList[i];
- selected_model_.insertRow(i, modInfo.name, modInfo.id);
+ selected_model_.insertRow(i, qt_(modInfo.name), modInfo.id);
}
}
void GuiDocument::updateContents()
{
+ if (id() == current_id_)
+ return;
+
updateAvailableModules();
updateSelectedModules();
//selected, and that we don't have conflicts. If so, we could
//at least pop up a warning.
updateParams(bp_);
+ current_id_ = id();
}
+
+void GuiDocument::forceUpdate()
+{
+ // reset to force dialog update
+ current_id_ = 0;
+ updateContents();
+}
+
+
void GuiDocument::useClassDefaults()
{
+ if (applyPB->isEnabled()) {
+ int const ret = Alert::prompt(_("Unapplied changes"),
+ _("Some changes in the dialog were not yet applied."
+ "If you do not apply now, they will be lost after this action."),
+ 1, 1, _("&Apply"), _("&Dismiss"));
+ if (ret == 0)
+ applyView();
+ }
+
bp_.setBaseClass(latexModule->classCO->currentIndex());
bp_.useClassDefaults();
- updateContents();
+ forceUpdate();
}
bool GuiDocument::isValid()
{
- return validate_listings_params().empty();
+ return (validate_listings_params().empty() &&
+ (textLayoutModule->skipCO->currentIndex() != 3 ||
+ !textLayoutModule->skipLE->text().isEmpty()));
}