logic: Return to last scroll position in code view on undo

* fixed scrolling on undo
* refactored autoscrolling in code view
* save scroll position of user with MessageScrollCode
This commit is contained in:
Eberhard Graether
2016-01-29 13:08:30 +01:00
parent 427c94457b
commit ead0abfba2
20 changed files with 240 additions and 91 deletions
+9 -2
View File
@@ -20,6 +20,7 @@ public:
, m_sendAsTask(true)
, m_keepContent(false)
, m_cancelled(false)
, m_isLast(true)
{
}
@@ -45,9 +46,14 @@ public:
return (undoRedoType == UNDOTYPE_NORMAL);
}
bool isIgnorable() const
bool isLast() const
{
return (undoRedoType == UNDOTYPE_IGNORE);
return m_isLast;
}
void setIsLast(bool isLast)
{
m_isLast = isLast;
}
void setKeepContent(bool keepContent)
@@ -86,6 +92,7 @@ private:
bool m_sendAsTask;
bool m_keepContent;
bool m_cancelled;
bool m_isLast;
};
#endif // MESSAGE_BASE_H
@@ -8,13 +8,16 @@ class MessageActivateTokens
: public Message<MessageActivateTokens>
{
public:
MessageActivateTokens(const std::vector<Id>& tokenIds)
MessageActivateTokens(const MessageBase* other, const std::vector<Id>& tokenIds)
: tokenIds(tokenIds)
, isEdge(false)
, isAggregation(false)
, isFromSystem(false)
, isFromSearch(false)
{
undoRedoType = other->undoRedoType;
setKeepContent(other->keepContent());
setIsLast(other->isLast());
}
static const std::string getStaticType()
@@ -0,0 +1,23 @@
#ifndef MESSAGE_SCROLL_CODE_H
#define MESSAGE_SCROLL_CODE_H
#include "utility/messaging/Message.h"
class MessageScrollCode
: public Message<MessageScrollCode>
{
public:
MessageScrollCode(int value)
: value(value)
{
}
static const std::string getStaticType()
{
return "MessageScrollCode";
}
int value;
};
#endif // MESSAGE_SCROLL_CODE_H