Remember last color tag used
This commit is contained in:
parent
6f87b4bc68
commit
3d7eee9ed2
2 changed files with 20 additions and 3 deletions
|
@ -41,7 +41,9 @@ public:
|
|||
};
|
||||
std::vector<Tag> m_tags;
|
||||
|
||||
NavigationTags() {}
|
||||
QColor m_lastTagColorUsed;
|
||||
|
||||
NavigationTags();
|
||||
~NavigationTags() {}
|
||||
|
||||
std::vector<Tag> getTags() { return m_tags; }
|
||||
|
|
|
@ -2,11 +2,21 @@
|
|||
|
||||
#include "tstream.h"
|
||||
#include "texception.h"
|
||||
#include "tenv.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
TEnv::IntVar NavigationTagLastColorR("NavigationTagLastColorR", 255);
|
||||
TEnv::IntVar NavigationTagLastColorG("NavigationTagLastColorG", 0);
|
||||
TEnv::IntVar NavigationTagLastColorB("NavigationTagLastColorB", 255);
|
||||
|
||||
NavigationTags::NavigationTags() {
|
||||
m_lastTagColorUsed = QColor(NavigationTagLastColorR, NavigationTagLastColorG,
|
||||
NavigationTagLastColorB);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
int NavigationTags::getCount() const {
|
||||
|
@ -28,7 +38,7 @@ NavigationTags::Tag NavigationTags::getTag(int frame) {
|
|||
void NavigationTags::addTag(int frame, QString label) {
|
||||
if (frame < 0 || isTagged(frame)) return;
|
||||
|
||||
m_tags.push_back(Tag(frame, label));
|
||||
m_tags.push_back(Tag(frame, label, m_lastTagColorUsed));
|
||||
|
||||
std::sort(m_tags.begin(), m_tags.end());
|
||||
}
|
||||
|
@ -146,7 +156,7 @@ void NavigationTags::setTagLabel(int frame, QString label) {
|
|||
QColor NavigationTags::getTagColor(int frame) {
|
||||
Tag tag = getTag(frame);
|
||||
|
||||
return tag.m_color;
|
||||
return (tag.m_frame == -1) ? m_lastTagColorUsed : tag.m_color;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -159,6 +169,11 @@ void NavigationTags::setTagColor(int frame, QColor color) {
|
|||
m_tags[i].m_color = color;
|
||||
break;
|
||||
}
|
||||
|
||||
m_lastTagColorUsed = color;
|
||||
NavigationTagLastColorR = color.red();
|
||||
NavigationTagLastColorG = color.green();
|
||||
NavigationTagLastColorB = color.blue();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue