#include "GuiApplication.h"
#include "GuiCommandBuffer.h"
#include "GuiCompleter.h"
-#include "GuiWorkArea.h"
#include "GuiKeySymbol.h"
#include "GuiToc.h"
#include "GuiToolbar.h"
+#include "GuiWorkArea.h"
#include "LayoutBox.h"
#include "Menus.h"
#include "TocModel.h"
void GuiView::updateWindowTitle(GuiWorkArea * wa)
{
- if (wa != d.current_work_area_)
+ if (wa != d.current_work_area_
+ || wa->bufferView().buffer().isInternal())
return;
setWindowTitle(qt_("LyX: ") + wa->windowTitle());
setWindowIconText(wa->windowIconText());
}
+#if (QT_VERSION >= 0x040400)
static docstring saveAndDestroyBuffer(Buffer * buffer, FileName const & fname)
{
bool failed = true;
? _("Automatic save failed!")
: _("Automatic save done.");
}
+#endif
void GuiView::autoSave()
bool GuiView::closeBuffer()
{
GuiWorkArea * wa = currentMainWorkArea();
+ setCurrentWorkArea(wa);
Buffer & buf = wa->bufferView().buffer();
return wa && closeWorkArea(wa, !buf.parent());
}
buf.removeAutosaveFile();
if (hiding)
// revert all changes
- buf.loadLyXFile(buf.fileName());
+ buf.reload();
buf.markClean();
break;
case 2:
void GuiView::reloadBuffer()
{
Buffer * buf = &documentBufferView()->buffer();
- reloadBuffer(buf);
-}
-
-
-void GuiView::reloadBuffer(Buffer * buf)
-{
- FileName filename = buf->fileName();
- // e.g., read-only status could have changed due to version control
- filename.refresh();
- Buffer const * parent = buf->parent();
- bool const is_child = parent != buf;
- // The user has already confirmed that the changes, if any, should
- // be discarded. So we just release the Buffer and don't call closeBuffer();
- theBufferList().release(buf);
- buf = loadDocument(filename);
- docstring const disp_fn = makeDisplayPath(filename.absFilename());
- docstring str;
- if (buf) {
- // re-allocate master if necessary
- if (is_child && theBufferList().isLoaded(parent)
- && buf->parent() != parent)
- buf->setParent(parent);
- buf->updateLabels();
- setBuffer(buf);
- buf->errors("Parse");
- str = bformat(_("Document %1$s reloaded."), disp_fn);
- } else {
- str = bformat(_("Could not reload document %1$s"), disp_fn);
- }
- message(str);
+ buf->reload();
}
int const ret = Alert::prompt(_("Reload externally changed document?"),
text, 0, 1, _("&Reload"), _("&Cancel"));
if (!ret)
- reloadBuffer(*bit);
+ (*bit)->reload();
}
}
}
break;
if (buffer->lyxvc().inUse() && !buffer->isReadonly()) {
msg = buffer->lyxvc().checkIn();
- reloadBuffer();
+ if (!msg.empty())
+ reloadBuffer();
}
break;
}
+#if (QT_VERSION >= 0x040400)
static docstring exportAndDestroy(Buffer * buffer, string const & format)
{
bool const success = buffer->doExport(format, true);
? bformat(_("Successful preview of format: %1$s"), from_utf8(format))
: bformat(_("Error previewing format: %1$s"), from_utf8(format));
}
+#endif
bool GuiView::dispatch(FuncRequest const & cmd)