Skip to content

Commit b0ab079

Browse files
committed
Tag improvements work in progress
1 parent b2f2010 commit b0ab079

File tree

2 files changed

+22
-16
lines changed

2 files changed

+22
-16
lines changed

src/Interface/Application/ModuleProxyWidget.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ ModuleProxyWidget::ModuleProxyWidget(ModuleWidget* module, QGraphicsItem* parent
123123
setWidget(module);
124124
setFlags(ItemIsMovable | ItemIsSelectable | ItemSendsGeometryChanges);
125125
setAcceptDrops(true);
126+
setData(TagDataKey, NoTag);
126127

127128
connect(module, SIGNAL(noteUpdated(const Note&)), this, SLOT(updateNote(const Note&)));
128129
connect(module, SIGNAL(requestModuleVisible()), this, SLOT(ensureThisVisible()));

src/Interface/Application/TagManagerWindow.cc

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -110,24 +110,26 @@ QStringList TagManagerWindow::getTagColors() const
110110

111111
QColor TagManagerWindow::tagColor(int tag) const
112112
{
113-
//rgb(128, 128, 0)
114-
auto colorStr = tagColors_[tag];
115113
int r, g, b;
116-
try
117-
{
118-
static boost::regex reg("rgb\\((.+), (.+), (.+)\\)");
119-
boost::smatch what;
120-
regex_match(colorStr, what, reg);
121-
r = boost::lexical_cast<int>(what[1]);
122-
g = boost::lexical_cast<int>(what[2]);
123-
b = boost::lexical_cast<int>(what[3]);
124-
}
125-
catch (...)
114+
r = g = b = 155;
115+
if (0 <= tag && tag < NumberOfTags)
126116
{
127-
//error results in gray
128-
r = g = b = 155;
117+
auto colorStr = tagColors_[tag];
118+
try
119+
{
120+
static boost::regex reg("rgb\\((.+), (.+), (.+)\\)");
121+
boost::smatch what;
122+
regex_match(colorStr, what, reg);
123+
r = boost::lexical_cast<int>(what[1]);
124+
g = boost::lexical_cast<int>(what[2]);
125+
b = boost::lexical_cast<int>(what[3]);
126+
}
127+
catch (...)
128+
{
129+
//error results in gray
130+
}
129131
}
130-
return QColor(r, g, b);
132+
return QColor(r, g, b);
131133
}
132134

133135
QString TagManagerWindow::tagName(int tag) const
@@ -145,7 +147,10 @@ void TagManagerWindow::showHelp(QWidget* parent)
145147
"Each tag's color can be chosen in the Tag Manager window, as well as a descriptive label. Tag colors are a global setting, while module tags are saved in the network file. \n\n"
146148
"To use, while in the Network Editor, hold down the Alt / Option key. Then press A to see all module tag groups(each module will be colorized "
147149
"according to the chosen colors). Or press 0 - 9 keys to see each tag group individually; other modules will be slightly blurred out. While in "
148-
"the single - tag view, you can click a module to toggle it as tagged. There is also a button in the toolbar to view all tagged modules.");
150+
"the single - tag view, you can click a module to toggle it as tagged. There is also a button in the toolbar to view all tagged modules."
151+
"\n\Once tags are being used, tag groups can be toggled using Alt-G (show) and Alt-Shift-G (hide). Boxes of the tag color, labelled with the tag's text, will be displayed overlaying the network."
152+
"\n\nComing soon: tag names saved in the network file to override application-level names, as well as an option to display tag groups on network load."
153+
);
149154
}
150155

151156
void TagManagerWindow::helpButtonClicked()

0 commit comments

Comments
 (0)