ui: Added history of last active symbols to UI and menu (issue 151)

* holding down back or forward button shows list of current back-forward stack
* added narrow button between back and forward to show the list
* added History menu
* moved back and forward actions to History menu
* show chronological list of recently active symbols in History menu

bug id = 151

fortune cookie message = Dein Geschäft wird gut laufen und expandieren.
This commit is contained in:
Eberhard Graether
2017-05-09 17:14:43 +02:00
parent bb8c2ae5a9
commit f4caacacf2
30 changed files with 668 additions and 65 deletions
@@ -11,7 +11,8 @@ class MessageSearch
{
public:
MessageSearch(const std::vector<SearchMatch>& matches)
: m_matches(matches)
: isFromSearch(true)
, m_matches(matches)
{
}
@@ -70,6 +71,8 @@ public:
os << getMatchesAsString();
}
bool isFromSearch;
private:
const std::vector<SearchMatch> m_matches;
};
@@ -0,0 +1,24 @@
#ifndef MESSAGE_TO_UNDO_REDO_POSITION_H
#define MESSAGE_TO_UNDO_REDO_POSITION_H
#include "utility/messaging/Message.h"
#include "utility/types.h"
class MessageToUndoRedoPosition
: public Message<MessageToUndoRedoPosition>
{
public:
MessageToUndoRedoPosition(size_t index)
: index(index)
{
}
static const std::string getStaticType()
{
return "MessageToUndoRedoPosition";
}
size_t index;
};
#endif // MESSAGE_TO_UNDO_REDO_POSITION_H
+18
View File
@@ -243,6 +243,24 @@ namespace utility
return (wsback <= wsfront ? std::string() : std::string(wsfront, wsback));
}
std::string elide(const std::string& str, ElideMode mode, size_t size)
{
if (str.size() <= size || str.size() <= 3)
{
return str;
}
switch (mode)
{
case ELIDE_LEFT:
return "..." + str.substr(str.size() - size - 3, str.size());
case ELIDE_MIDDLE:
return str.substr(0, size / 2 - 1) + "..." + str.substr(str.size() - (size / 2 - 2), str.size());
case ELIDE_RIGHT:
return str.substr(0, size - 3) + "...";
}
}
std::string substrBetween(const std::string &str, const std::string &delimiter1, const std::string &delimiter2)
{
size_t found_delimiter1 = str.find(delimiter1);
+9
View File
@@ -48,6 +48,15 @@ namespace utility
std::string trim(const std::string &str);
enum ElideMode
{
ELIDE_LEFT,
ELIDE_MIDDLE,
ELIDE_RIGHT
};
std::string elide(const std::string& str, ElideMode mode, size_t size);
template <typename ContainerType>
ContainerType split(const std::string& str, const std::string& delimiter)
{