#include "GuiDocument.h"
+#include "GuiView.h"
+
#include "BranchList.h"
#include "buffer_funcs.h"
#include "Buffer.h"
#include "BufferParams.h"
#include "BufferView.h"
#include "Color.h"
+#include "EmbeddedFiles.h"
#include "Encoding.h"
#include "FloatPlacement.h"
-#include "frontend_helpers.h"
#include "FuncRequest.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "GuiBranches.h"
#include "Language.h"
#include "LaTeXFeatures.h"
#include "TextClassList.h"
#include "Validator.h"
-
-// FIXME: those two headers are needed because of the
-// WorkArea::redraw() call below.
-#include "frontends/LyXView.h"
-#include "frontends/WorkArea.h"
-
#include "insets/InsetListingsParams.h"
+#include "support/FileName.h"
+#include "support/filetools.h"
#include "support/lstrings.h"
#include <boost/bind.hpp>
-GuiDocument::GuiDocument(LyXView & lv)
- : GuiDialog(lv, "document"), Controller(this)
+GuiDocument::GuiDocument(GuiView & lv)
+ : GuiDialog(lv, "document")
{
setupUi(this);
- setController(this, false);
setViewTitle(_("Document Settings"));
lang_ = getSecond(getLanguageData(false));
connect(bulletsModule, SIGNAL(changed()),
this, SLOT(change_adaptor()));
+ // embedded files
+ embeddedFilesModule = new UiWidget<Ui::EmbeddedFilesUi>;
+ connect(embeddedFilesModule->bundleCB, SIGNAL(toggled(bool)),
+ this, SLOT(change_adaptor()));
+ connect(embeddedFilesModule->addPB, SIGNAL(clicked()),
+ this, SLOT(change_adaptor()));
+ connect(embeddedFilesModule->removePB, SIGNAL(clicked()),
+ this, SLOT(change_adaptor()));
+
// PDF support
pdfSupportModule = new UiWidget<Ui::PDFSupportUi>;
this, SLOT(change_adaptor()));
connect(pdfSupportModule->backrefCB, SIGNAL(toggled(bool)),
this, SLOT(change_adaptor()));
+ connect(pdfSupportModule->pdfusetitleCB, SIGNAL(toggled(bool)),
+ this, SLOT(change_adaptor()));
connect(pdfSupportModule->pagebackrefCB, SIGNAL(toggled(bool)),
this, SLOT(change_adaptor()));
connect(pdfSupportModule->fullscreenCB, SIGNAL(toggled(bool)),
docPS->addPanel(floatModule, _("Float Placement"));
docPS->addPanel(bulletsModule, _("Bullets"));
docPS->addPanel(branchesModule, _("Branches"));
+ docPS->addPanel(embeddedFilesModule, _("Embedded Files"));
docPS->addPanel(preambleModule, _("LaTeX Preamble"));
docPS->setCurrentPanel(_("Document Class"));
// FIXME: hack to work around resizing bug in Qt >= 4.2
}
+void GuiDocument::updateEmbeddedFileList()
+{
+ embeddedFilesModule->filesLW->clear();
+ // add current embedded files
+ EmbeddedFiles & files = buffer().embeddedFiles();
+ files.update();
+ EmbeddedFiles::EmbeddedFileList::iterator fit = files.begin();
+ EmbeddedFiles::EmbeddedFileList::iterator fit_end = files.end();
+ for (; fit != fit_end; ++fit) {
+ QString label = toqstr(fit->relFilename(buffer().filePath()));
+ if (fit->refCount() > 1)
+ label += " (" + QString::number(fit->refCount()) + ")";
+ QListWidgetItem * item = new QListWidgetItem(label);
+ item->setFlags(item->flags() | Qt::ItemIsSelectable
+ | Qt::ItemIsUserCheckable);
+ if(fit->embedded())
+ item->setCheckState(Qt::Checked);
+ else
+ item->setCheckState(Qt::Unchecked);
+ // index of the currently used ParConstIterator
+ embeddedFilesModule->filesLW->addItem(item);
+ }
+}
+
+
void GuiDocument::updateNumbering()
{
TextClass const & tclass = bp_.getTextClass();
pageLayoutModule->paperheightUnitCO);
if (pageLayoutModule->facingPagesCB->isChecked())
- params.sides = TextClass::TwoSides;
+ params.sides = TwoSides;
else
- params.sides = TextClass::OneSide;
+ params.sides = OneSide;
if (pageLayoutModule->landscapeRB->isChecked())
params.orientation = ORIENTATION_LANDSCAPE;
pdf.breaklinks = pdfSupportModule->breaklinksCB->isChecked();
pdf.pdfborder = pdfSupportModule->pdfborderCB->isChecked();
+ pdf.pdfusetitle = pdfSupportModule->pdfusetitleCB->isChecked();
pdf.colorlinks = pdfSupportModule->colorlinksCB->isChecked();
pdf.backref = pdfSupportModule->backrefCB->isChecked();
pdf.pagebackref = pdfSupportModule->pagebackrefCB->isChecked();
else
pdf.pagemode.clear();
pdf.quoted_options = fromqstr(pdfSupportModule->optionsLE->text());
- if (pdf.use_hyperref || !pdf.empty())
- pdf.store_options = true;
+
+ // Embedded files
+ // FIXME
+
+ // GuiDocument is special because some change in there might affect other
+ // dialogs. It is then better to make sure that all dialogs are in sync
+ // with current document settings.
+ lyxview().updateBufferDependent(true);
+ lyxview().updateLayoutList();
+ lyxview().updateToolbars();
}
pageLayoutModule->portraitRB->setChecked(!landscape);
pageLayoutModule->facingPagesCB->setChecked(
- params.sides == TextClass::TwoSides);
+ params.sides == TwoSides);
lengthToWidgets(pageLayoutModule->paperwidthLE,
pdfSupportModule->breaklinksCB->setChecked(pdf.breaklinks);
pdfSupportModule->pdfborderCB->setChecked(pdf.pdfborder);
+ pdfSupportModule->pdfusetitleCB->setChecked(pdf.pdfusetitle);
pdfSupportModule->colorlinksCB->setChecked(pdf.colorlinks);
pdfSupportModule->backrefCB->setChecked(pdf.backref);
pdfSupportModule->pagebackrefCB->setChecked(pdf.pagebackref);
pdfSupportModule->optionsLE->setText(
toqstr(pdf.quoted_options));
+
+ // embedded files
+ updateEmbeddedFileList();
}
}
-static void dispatch_bufferparams(Controller const & controller,
+static void dispatch_bufferparams(Dialog const & dialog,
BufferParams const & bp, kb_action lfun)
{
ostringstream ss;
ss << "\\begin_header\n";
bp.writeFile(ss);
ss << "\\end_header\n";
- controller.dispatch(FuncRequest(lfun, ss.str()));
+ dialog.dispatch(FuncRequest(lfun, ss.str()));
}
for (; it != end; ++it) {
docstring const & current_branch = it->getBranch();
Branch const * branch = branchlist.find(current_branch);
- string const x11hexname =
- lyx::X11hexname(branch->getColor());
+ string const x11hexname = X11hexname(branch->getColor());
// display the new color
docstring const str = current_branch + ' ' + from_ascii(x11hexname);
dispatch(FuncRequest(LFUN_SET_COLOR, str));
"assign branch"));
}
// FIXME: If we used an LFUN, we would not need those two lines:
- bufferview()->update();
- lyxview().currentWorkArea()->redraw();
+ bufferview()->processUpdateFlags(Update::Force | Update::FitCursor);
}
}
-Dialog * createGuiDocument(LyXView & lv) { return new GuiDocument(lv); }
+Dialog * createGuiDocument(GuiView & lv) { return new GuiDocument(lv); }
} // namespace frontend