logic: Undoing file minimize, snippets and maximize actions

* MessageChangeFileView as single message for changing file state in the code view
* Show code view after updates at once
This commit is contained in:
Eberhard Graether
2016-01-28 12:40:29 +01:00
parent 297d5490c0
commit 38f943e8a0
20 changed files with 443 additions and 271 deletions
@@ -0,0 +1,64 @@
#ifndef MESSAGE_CHANGE_FILE_VIEW_H
#define MESSAGE_CHANGE_FILE_VIEW_H
#include "utility/messaging/Message.h"
#include "utility/types.h"
#include "data/location/TokenLocationFile.h"
class MessageChangeFileView
: public Message<MessageChangeFileView>
{
public:
enum FileState
{
FILE_MINIMIZED,
FILE_SNIPPETS,
FILE_MAXIMIZED
};
MessageChangeFileView(
const FilePath filePath,
FileState state,
bool needsData,
bool showErrors,
std::shared_ptr<TokenLocationFile> locationFile
)
: filePath(filePath)
, state(state)
, needsData(needsData)
, showErrors(showErrors)
, locationFile(locationFile)
{
}
static const std::string getStaticType()
{
return "MessageChangeFileView";
}
virtual void print(std::ostream& os) const
{
switch (state)
{
case FILE_MINIMIZED: os << "minimize"; break;
case FILE_SNIPPETS: os << "snippets"; break;
case FILE_MAXIMIZED: os << "maximize"; break;
}
if (needsData)
{
os << ", needs data";
}
}
FilePath filePath;
FileState state;
bool needsData;
bool showErrors;
std::shared_ptr<TokenLocationFile> locationFile;
};
#endif // MESSAGE_CHANGE_FILE_VIEW_H
@@ -1,32 +0,0 @@
#ifndef MESSAGE_SHOW_FILE_H
#define MESSAGE_SHOW_FILE_H
#include "utility/file/FilePath.h"
#include "utility/messaging/Message.h"
#include "utility/types.h"
class MessageShowFile
: public Message<MessageShowFile>
{
public:
MessageShowFile(const FilePath& filePath, bool showErrors)
: filePath(filePath)
, showErrors(showErrors)
{
}
static const std::string getStaticType()
{
return "MessageShowFile";
}
virtual void print(std::ostream& os) const
{
os << filePath.str();
}
const FilePath filePath;
const bool showErrors;
};
#endif // MESSAGE_SHOW_FILE_H
@@ -1,31 +0,0 @@
#ifndef MESSAGE_SHOW_SNIPPETS_H
#define MESSAGE_SHOW_SNIPPETS_H
#include "utility/messaging/Message.h"
#include "utility/types.h"
#include "data/location/TokenLocationFile.h"
class MessageShowSnippets
: public Message<MessageShowSnippets>
{
public:
MessageShowSnippets(std::shared_ptr<TokenLocationFile> locationFile)
: locationFile(locationFile)
{
}
static const std::string getStaticType()
{
return "MessageShowSnippets";
}
virtual void print(std::ostream& os) const
{
os << locationFile->getFilePath().str();
}
std::shared_ptr<TokenLocationFile> locationFile;
};
#endif // MESSAGE_SHOW_SNIPPETS_H