void refreshFileMonitor();
/// Notify or clear of external modification
- void fileExternallyModified(bool exists) const;
+ void fileExternallyModified(bool exists);
/// has been externally modified? Can be reset by the user.
mutable bool externally_modified_;
}
-void Buffer::Impl::fileExternallyModified(bool const exists) const
+void Buffer::Impl::fileExternallyModified(bool const exists)
{
// ignore notifications after our own saving operations
if (checksum_ == filename.checksum()) {
// location, then the externally modified warning will appear then.
if (exists)
externally_modified_ = true;
- if (wa_)
+ // Update external modification notification.
+ // Dirty buffers must be visible at all times.
+ if (wa_ && wa_->unhide(owner_))
wa_->updateTitles();
+ else
+ // Unable to unhide the buffer (e.g. no GUI or not current View)
+ lyx_clean = true;
}
/// A started long operation is still in progress ?
virtual bool longOperationStarted() = 0;
+ // Add a buffer to the current view, do not switch to it.
+ virtual bool unhide(Buffer * buf) = 0;
};
/// Return the list of loadable formats.
#include "WorkAreaManager.h"
+#include "Application.h"
#include "WorkArea.h"
}
+bool WorkAreaManager::unhide(Buffer * buf)
+{
+ if (!work_areas_.empty())
+ return true;
+ return theApp()->unhide(buf);
+}
+
+
void WorkAreaManager::updateTitles()
{
for (WorkArea * wa : work_areas_)
#include <list>
namespace lyx {
+
+class Buffer;
+
namespace frontend {
class WorkArea;
/// Update window titles of all users and the external modifications
/// warning.
void updateTitles();
+ /// If there is no work area, create a new one in the current view using the
+ /// buffer buf. Returns false if not possible.
+ bool unhide(Buffer * buf);
private:
typedef std::list<WorkArea *>::iterator iterator;
}
+bool GuiApplication::unhide(Buffer * buf)
+{
+ if (!currentView())
+ return false;
+ currentView()->setBuffer(buf, false);
+ return true;
+}
+
+
Clipboard & GuiApplication::clipboard()
{
return d->clipboard_;
void unregisterSocketCallback(int fd);
bool searchMenu(FuncRequest const & func, docstring_list & names) const;
void handleKeyFunc(FuncCode action);
+ bool unhide(Buffer * buf); //override
//@}
///
}
-void GuiView::setBuffer(Buffer * newBuffer)
+void GuiView::setBuffer(Buffer * newBuffer, bool switch_to)
{
LYXERR(Debug::DEBUG, "Setting buffer: " << newBuffer << endl);
LASSERT(newBuffer, return);
}
connectBuffer(*newBuffer);
connectBufferView(wa->bufferView());
- setCurrentWorkArea(wa);
+ if (switch_to)
+ setCurrentWorkArea(wa);
}
///
void focusInEvent(QFocusEvent * e);
- /// set a buffer to the current workarea.
- void setBuffer(Buffer * b); ///< \c Buffer to set.
+ /// Add a Buffer to the View
+ /// \param b Buffer to set.
+ /// \param switch_to Whether to set it to the current workarea.
+ void setBuffer(Buffer * b, bool switch_to = true);
/// load a document into the current workarea.
Buffer * loadDocument(