#include "Dialog.h"
#include "FileDialog.h"
#include "GuiApplication.h"
+#include "GuiCompleter.h"
#include "GuiWorkArea.h"
#include "GuiKeySymbol.h"
#include "GuiToolbar.h"
#include "ToolbarBackend.h"
#include "version.h"
+#include "support/assert.h"
#include "support/debug.h"
-#include "support/FileFilterList.h"
#include "support/FileName.h"
#include "support/filetools.h"
#include "support/gettext.h"
#include <QUrl>
#include <QScrollBar>
-#include <boost/assert.hpp>
#include <boost/bind.hpp>
#ifdef HAVE_SYS_TIME_H
{
LYXERR(Debug::GUI, "show banner: " << lyxrc.show_banner);
/// The text to be written on top of the pixmap
- QString const text = lyx_version ? lyx_version : qt_("unknown version");
+ QString const text = lyx_version ?
+ qt_("version ") + lyx_version : qt_("unknown version");
splash_ = QPixmap(":/images/banner.png");
QPainter pain(&splash_);
- pain.setPen(QColor(255, 255, 0));
+ pain.setPen(QColor(0, 0, 0));
QFont font;
// The font used to display the version info
font.setStyleHint(QFont::SansSerif);
font.setWeight(QFont::Bold);
font.setPointSize(int(toqstr(lyxrc.font_sizes[FONT_SIZE_LARGE]).toDouble()));
pain.setFont(font);
- pain.drawText(260, 270, text);
+ pain.drawText(190, 225, text);
}
void paintEvent(QPaintEvent *)
// We don't want to keep the window in memory if it is closed.
setAttribute(Qt::WA_DeleteOnClose, true);
-#ifndef Q_WS_MACX
- // assign an icon to main form. We do not do it under Qt/Mac,
+#if (!defined(Q_WS_WIN) && !defined(Q_WS_MACX))
+ // assign an icon to main form. We do not do it under Qt/Win or Qt/Mac,
// since the icon is provided in the application bundle.
setWindowIcon(QPixmap(":/images/lyx.png"));
#endif
break;
}
}
- if (b && !closeBuffer(*b)) {
+ if (b && !closeBuffer(*b, true)) {
close_event->ignore();
return;
}
void GuiView::setCurrentWorkArea(GuiWorkArea * wa)
{
- BOOST_ASSERT(wa);
+ LASSERT(wa, /**/);
// Changing work area can result from opening a file so
// update the toc in any case.
void GuiView::removeWorkArea(GuiWorkArea * wa)
{
- BOOST_ASSERT(wa);
+ LASSERT(wa, /**/);
if (wa == d.current_work_area_) {
disconnectBuffer();
disconnectBufferView();
- hideBufferDependent();
d.current_work_area_ = 0;
}
void GuiView::setBuffer(Buffer * newBuffer)
{
- BOOST_ASSERT(newBuffer);
+ LASSERT(newBuffer, /**/);
setBusy(true);
GuiWorkArea * wa = workArea(*newBuffer);
}
-void GuiView::updateEmbeddedFiles()
-{
- updateDialog("embedding", "");
-}
-
-
void GuiView::autoSave()
{
LYXERR(Debug::INFO, "Running autoSave()");
FuncStatus fs;
if (!inset->getStatus(view()->cursor(), fr, fs)) {
// Every inset is supposed to handle this
- BOOST_ASSERT(false);
+ LASSERT(false, /**/);
}
flag |= fs;
} else {
dlg.setButton1(qt_("Documents|#o#O"), toqstr(lyxrc.document_path));
dlg.setButton1(qt_("Templates|#T#t"), toqstr(lyxrc.template_path));
- FileDialog::Result result =
- dlg.open(toqstr(lyxrc.template_path),
- FileFilterList(_("LyX Documents (*.lyx)")));
+ FileDialog::Result result = dlg.open(toqstr(lyxrc.template_path),
+ QStringList(qt_("LyX Documents (*.lyx)")));
if (result.first == FileDialog::Later)
return FileName();
toqstr(addPath(package().system_support().absFilename(), "examples")));
FileDialog::Result result =
- dlg.open(toqstr(initpath), FileFilterList(_("LyX Documents (*.lyx)")));
+ dlg.open(toqstr(initpath), QStringList(qt_("LyX Documents (*.lyx)")));
if (result.first == FileDialog::Later)
return;
filter += ')';
FileDialog::Result result =
- dlg.open(toqstr(initpath), FileFilterList(filter));
+ dlg.open(toqstr(initpath), fileFilters(toqstr(filter)));
if (result.first == FileDialog::Later)
return;
return;
// get absolute path of file
- FileName const fullname(makeAbsPath(filename));
+ FileName const fullname(support::makeAbsPath(filename));
FileName const lyxfile(support::changeExtension(fullname.absFilename(), ".lyx"));
toqstr(addPath(package().system_support().absFilename(),
"examples")));
- FileDialog::Result result =
- dlg.open(toqstr(initpath),
- FileFilterList(_("LyX Documents (*.lyx)")));
+ FileDialog::Result result = dlg.open(toqstr(initpath),
+ QStringList(qt_("LyX Documents (*.lyx)")));
if (result.first == FileDialog::Later)
return;
LFUN_FILE_INSERT_PLAINTEXT_PARA : LFUN_FILE_INSERT_PLAINTEXT));
FileDialog::Result result = dlg.open(toqstr(bv->buffer().filePath()),
- FileFilterList());
+ QStringList());
if (result.first == FileDialog::Later)
return;
if (!newname.empty()) {
// FIXME UNICODE
- fname = makeAbsPath(to_utf8(newname), oldname.onlyPath().absFilename());
+ fname = support::makeAbsPath(to_utf8(newname), oldname.onlyPath().absFilename());
} else {
// Switch to this Buffer.
setBuffer(&b);
if (!isLyXFilename(fname.absFilename()))
fname.changeExtension(".lyx");
- FileFilterList const filter(_("LyX Documents (*.lyx)"));
-
FileDialog::Result result =
dlg.save(toqstr(fname.onlyPath().absFilename()),
- filter,
+ QStringList(qt_("LyX Documents (*.lyx)")),
toqstr(fname.onlyFileName()));
if (result.first == FileDialog::Later)
}
-bool GuiView::closeBuffer(Buffer & buf)
+bool GuiView::closeBuffer(Buffer & buf, bool tolastopened)
{
// goto bookmark to update bookmark pit.
//FIXME: we should update only the bookmarks related to this buffer!
theLyXFunc().gotoBookmark(i+1, false, false);
if (buf.isClean() || buf.paragraphs().empty()) {
- if (buf.masterBuffer() == &buf)
+ if (buf.masterBuffer() == &buf && tolastopened)
LyX::ref().session().lastOpened().add(buf.fileName());
theBufferList().release(&buf);
return true;
// save file names to .lyx/session
// if master/slave are both open, do not save slave since it
// will be automatically loaded when the master is loaded
- if (buf.masterBuffer() == &buf)
+ if (buf.masterBuffer() == &buf && tolastopened)
LyX::ref().session().lastOpened().add(buf.fileName());
theBufferList().release(&buf);
char const * const dialognames[] = {
"aboutlyx", "bibitem", "bibtex", "box", "branch", "changes", "character",
-"citation", "document", "embedding", "errorlist", "ert", "external", "file",
+"citation", "document", "errorlist", "ert", "external", "file",
"findreplace", "float", "graphics", "include", "index", "nomenclature", "label", "log",
"mathdelimiter", "mathmatrix", "note", "paragraph", "prefs", "print",
"ref", "sendto", "space", "spellchecker", "symbols", "tabular", "tabularcreate",
}
-void GuiView::hideBufferDependent() const
-{
- map<string, DialogPtr>::const_iterator it = d.dialogs_.begin();
- map<string, DialogPtr>::const_iterator end = d.dialogs_.end();
-
- for(; it != end; ++it) {
- Dialog * dialog = it->second.get();
- if (dialog->isBufferDependent())
- dialog->hideView();
- }
-}
-
-
void GuiView::updateBufferDependent(bool switched) const
{
map<string, DialogPtr>::const_iterator it = d.dialogs_.begin();
Dialog * GuiView::build(string const & name)
{
- BOOST_ASSERT(isValidName(name));
+ LASSERT(isValidName(name), /**/);
if (name == "aboutlyx")
return createGuiAbout(*this);