Commit cf58d185 authored by Dmitry Kazakov's avatar Dmitry Kazakov

Display isolated nodes in the timeline differently

parent 190be338
......@@ -41,6 +41,8 @@
#include "kis_animation_utils.h"
#include "timeline_color_scheme.h"
#include "kis_node_model.h"
#include "kis_projection_leaf.h"
struct TimelineFramesModel::Private
......@@ -468,6 +470,25 @@ QVariant TimelineFramesModel::headerData(int section, Qt::Orientation orientatio
return name;
}
case Qt::TextColorRole: {
// WARNING: this role doesn't work for header views! Use
// bold font to show isolated mode instead!
return QVariant();
}
case Qt::FontRole: {
KisNodeDummy *dummy = m_d->converter->dummyFromRow(section);
if (!dummy) return QVariant();
KisNodeSP node = dummy->node();
QFont baseFont;
if (node->projectionLeaf()->isDroppedMask()) {
baseFont.setStrikeOut(true);
} else if (m_d->image->isolatedModeRoot() &&
KisNodeModel::belongsToIsolatedGroup(m_d->image, node, m_d->dummiesFacade)) {
baseFont.setBold(true);
}
return baseFont;
}
case Qt::ToolTipRole: {
return m_d->layerName(section);
}
......
......@@ -101,15 +101,15 @@ QModelIndex KisNodeModel::indexFromNode(KisNodeSP node) const
return QModelIndex();
}
bool KisNodeModel::belongsToIsolatedGroup(KisNodeSP node) const
bool KisNodeModel::belongsToIsolatedGroup(KisImageSP image, KisNodeSP node, KisDummiesFacadeBase *dummiesFacade)
{
KisNodeSP isolatedRoot = m_d->image->isolatedModeRoot();
KisNodeSP isolatedRoot = image->isolatedModeRoot();
if (!isolatedRoot) return true;
KisNodeDummy *isolatedRootDummy =
m_d->dummiesFacade->dummyForNode(isolatedRoot);
dummiesFacade->dummyForNode(isolatedRoot);
KisNodeDummy *dummy =
m_d->dummiesFacade->dummyForNode(node);
dummiesFacade->dummyForNode(node);
while (dummy) {
if (dummy == isolatedRootDummy) {
......@@ -121,6 +121,11 @@ bool KisNodeModel::belongsToIsolatedGroup(KisNodeSP node) const
return false;
}
bool KisNodeModel::belongsToIsolatedGroup(KisNodeSP node) const
{
return belongsToIsolatedGroup(m_d->image, node, m_d->dummiesFacade);
}
void KisNodeModel::resetIndexConverter()
{
delete m_d->indexConverter;
......
......@@ -83,6 +83,8 @@ public:
Qt::DropActions supportedDropActions() const;
bool hasDummiesFacade();
static bool belongsToIsolatedGroup(KisImageSP image, KisNodeSP node, KisDummiesFacadeBase *dummiesFacade);
Q_SIGNALS:
void nodeActivated(KisNodeSP);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment