editor: move fileName inside SyncDocument

This commit is contained in:
Erik Faye-Lund 2011-03-28 22:38:17 +02:00
parent 8de60a4095
commit 55cdc24cef
3 changed files with 10 additions and 10 deletions

View File

@ -190,8 +190,6 @@ HMENU findSubMenuContaining(HMENU menu, UINT id)
return (HMENU)0; return (HMENU)0;
} }
std::wstring fileName;
void fileNew() void fileNew()
{ {
// document.purgeUnusedTracks(); // document.purgeUnusedTracks();
@ -204,7 +202,7 @@ void fileNew()
document.exec(multiCmd); document.exec(multiCmd);
setWindowFileName(L"Untitled"); setWindowFileName(L"Untitled");
fileName.clear(); document.fileName.clear();
document.clearUndoStack(); document.clearUndoStack();
document.clearRedoStack(); document.clearRedoStack();
@ -215,7 +213,6 @@ void loadDocument(const std::wstring &_fileName)
{ {
if (document.load(_fileName)) { if (document.load(_fileName)) {
setWindowFileName(_fileName.c_str()); setWindowFileName(_fileName.c_str());
fileName = _fileName;
mruFileList.insert(_fileName); mruFileList.insert(_fileName);
mruFileList.update(); mruFileList.update();
@ -267,7 +264,7 @@ bool fileSaveAs()
if (document.save(temp)) { if (document.save(temp)) {
document.clientSocket.sendSaveCommand(); document.clientSocket.sendSaveCommand();
setWindowFileName(temp); setWindowFileName(temp);
fileName = temp; document.fileName = temp;
mruFileList.insert(temp); mruFileList.insert(temp);
mruFileList.update(); mruFileList.update();
@ -281,10 +278,10 @@ bool fileSaveAs()
bool fileSave() bool fileSave()
{ {
if (fileName.empty()) if (document.fileName.empty())
return fileSaveAs(); return fileSaveAs();
if (!document.save(fileName.c_str())) { if (!document.save(document.fileName)) {
document.clientSocket.sendSaveCommand(); document.clientSocket.sendSaveCommand();
error("Failed to save file"); error("Failed to save file");
return false; return false;

View File

@ -64,6 +64,7 @@ bool SyncDocument::load(const std::wstring &fileName)
this->setRows(atoi(rowsString.c_str())); this->setRows(atoi(rowsString.c_str()));
} }
this->fileName = fileName;
clearUndoStack(); clearUndoStack();
clearRedoStack(); clearRedoStack();

View File

@ -271,6 +271,8 @@ public:
size_t getRows() const { return rows; } size_t getRows() const { return rows; }
void setRows(size_t rows) { this->rows = rows; } void setRows(size_t rows) { this->rows = rows; }
std::wstring fileName;
private: private:
std::vector<size_t> trackOrder; std::vector<size_t> trackOrder;
size_t rows; size_t rows;