32#ifndef UNDOSTUDIO_UNDOAPP_OPENDOCUMENTS_HPP
33#define UNDOSTUDIO_UNDOAPP_OPENDOCUMENTS_HPP
101 if (doc.path == path) {
134 bool pin(
const std::string& path)
137 if (doc.path == path) {
152 if (doc.path != path) {
208 bool rename(
const std::string& oldPath,
const std::string& newPath)
210 if (newPath.empty() || oldPath == newPath ||
isOpen(newPath)) {
214 if (doc.path != oldPath) {
230 if (doc.path == path) {
265 bool isOpen(
const std::string& path)
const
268 if (doc.path == path) {
297 const std::string*
cycle(
int direction)
305 index =
static_cast<int>(i);
309 const int count =
static_cast<int>(
m_documents.size());
312 int next = (index < 0) ? (direction >= 0 ? 0 : count - 1) : (index + direction + count) % count;
The set of open files, at most one of them a preview.
Definition undoAppOpenDocuments.hpp:87
DirtySummary closeAll()
Definition undoAppOpenDocuments.hpp:246
const std::string * cycle(int direction)
Move to the next or previous document, wrapping round.
Definition undoAppOpenDocuments.hpp:297
void setClean(const std::string &path)
Record that a document's changes have been written.
Definition undoAppOpenDocuments.hpp:164
CloseOutcome close(const std::string &path)
Definition undoAppOpenDocuments.hpp:175
std::vector< OpenDocument > m_documents
Definition undoAppOpenDocuments.hpp:318
void setDirty(const std::string &path, bool dirty)
Record whether a document has changes not written to disk.
Definition undoAppOpenDocuments.hpp:149
OpenOutcome open(const std::string &path, DocKind kind)
Open a file, taking the preview slot.
Definition undoAppOpenDocuments.hpp:94
bool rename(const std::string &oldPath, const std::string &newPath)
Follow a file that was renamed or moved on disk.
Definition undoAppOpenDocuments.hpp:208
const std::string & active() const
Definition undoAppOpenDocuments.hpp:261
size_t size() const
Definition undoAppOpenDocuments.hpp:262
bool activate(const std::string &path)
Bring a document to the front without reopening it.
Definition undoAppOpenDocuments.hpp:227
bool isOpen(const std::string &path) const
Whether a document is open.
Definition undoAppOpenDocuments.hpp:265
size_t pinnedCount() const
How many documents are pinned.
Definition undoAppOpenDocuments.hpp:276
bool pin(const std::string &path)
Make a document permanent.
Definition undoAppOpenDocuments.hpp:134
std::string m_active
Definition undoAppOpenDocuments.hpp:319
const std::vector< OpenDocument > & documents() const
Definition undoAppOpenDocuments.hpp:260
Definition undoAppCpp.hpp:26
DocKind
Which backend a document belongs to.
Definition undoAppOpenDocuments.hpp:49
One file that is open.
Definition undoAppOpenDocuments.hpp:61
DocKind kind
Definition undoAppOpenDocuments.hpp:63
bool dirty
Has changes not written to disk.
Definition undoAppOpenDocuments.hpp:65
std::string path
Absolute path.
Definition undoAppOpenDocuments.hpp:62
bool pinned
Permanent: a preview is not replaced.
Definition undoAppOpenDocuments.hpp:64
Close a document.
Definition undoAppOpenDocuments.hpp:169
std::string nextActive
Definition undoAppOpenDocuments.hpp:171
bool closed
Definition undoAppOpenDocuments.hpp:170
bool activeWasClosed
Definition undoAppOpenDocuments.hpp:172
Close every document that has changes.
Definition undoAppOpenDocuments.hpp:241
size_t dirty
Definition undoAppOpenDocuments.hpp:243
size_t closed
Definition undoAppOpenDocuments.hpp:242
What opening a file did, so the caller knows what to put back.
Definition undoAppOpenDocuments.hpp:77
bool alreadyOpen
The file was already open and was focused.
Definition undoAppOpenDocuments.hpp:78
bool droppedPreview
The preview slot's previous occupant went away.
Definition undoAppOpenDocuments.hpp:79
std::string droppedPath
The file that went away, empty if none did.
Definition undoAppOpenDocuments.hpp:80