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;
|
std::vector<Tag> m_tags;
|
||||||
|
|
||||||
NavigationTags() {}
|
QColor m_lastTagColorUsed;
|
||||||
|
|
||||||
|
NavigationTags();
|
||||||
~NavigationTags() {}
|
~NavigationTags() {}
|
||||||
|
|
||||||
std::vector<Tag> getTags() { return m_tags; }
|
std::vector<Tag> getTags() { return m_tags; }
|
||||||
|
|
|
@ -2,11 +2,21 @@
|
||||||
|
|
||||||
#include "tstream.h"
|
#include "tstream.h"
|
||||||
#include "texception.h"
|
#include "texception.h"
|
||||||
|
#include "tenv.h"
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#endif
|
#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 {
|
int NavigationTags::getCount() const {
|
||||||
|
@ -28,7 +38,7 @@ NavigationTags::Tag NavigationTags::getTag(int frame) {
|
||||||
void NavigationTags::addTag(int frame, QString label) {
|
void NavigationTags::addTag(int frame, QString label) {
|
||||||
if (frame < 0 || isTagged(frame)) return;
|
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());
|
std::sort(m_tags.begin(), m_tags.end());
|
||||||
}
|
}
|
||||||
|
@ -146,7 +156,7 @@ void NavigationTags::setTagLabel(int frame, QString label) {
|
||||||
QColor NavigationTags::getTagColor(int frame) {
|
QColor NavigationTags::getTagColor(int frame) {
|
||||||
Tag tag = getTag(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;
|
m_tags[i].m_color = color;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_lastTagColorUsed = color;
|
||||||
|
NavigationTagLastColorR = color.red();
|
||||||
|
NavigationTagLastColorG = color.green();
|
||||||
|
NavigationTagLastColorB = color.blue();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in a new issue