PixelPaint: Change color of disabled layers in LayerListWidget

This commit is contained in:
Marcus Nilsson 2021-07-01 13:42:42 +02:00 committed by Andreas Kling
parent 36abb38f26
commit 9df3550e58
Notes: sideshowbarker 2024-07-18 10:21:15 +09:00

View file

@ -86,17 +86,22 @@ void LayerListWidget::paint_event(GUI::PaintEvent& event)
painter.fill_rect(adjusted_rect, palette().selection());
}
painter.draw_rect(adjusted_rect, Color::Black);
painter.draw_rect(adjusted_rect, palette().color(ColorRole::BaseText));
Gfx::IntRect thumbnail_rect { adjusted_rect.x(), adjusted_rect.y(), adjusted_rect.height(), adjusted_rect.height() };
thumbnail_rect.shrink(8, 8);
painter.draw_scaled_bitmap(thumbnail_rect, layer.bitmap(), layer.bitmap().rect());
painter.draw_rect(thumbnail_rect, Color::Black);
Gfx::IntRect text_rect { thumbnail_rect.right() + 10, adjusted_rect.y(), adjusted_rect.width(), adjusted_rect.height() };
text_rect.intersect(adjusted_rect);
painter.draw_text(text_rect, layer.name(), Gfx::TextAlignment::CenterLeft, layer.is_selected() ? palette().selection_text() : palette().button_text());
if (layer.is_visible()) {
painter.draw_text(text_rect, layer.name(), Gfx::TextAlignment::CenterLeft, layer.is_selected() ? palette().selection_text() : palette().button_text());
painter.draw_rect(thumbnail_rect, palette().color(ColorRole::BaseText));
} else {
painter.draw_text(text_rect, layer.name(), Gfx::TextAlignment::CenterLeft, palette().color(ColorRole::DisabledText));
painter.draw_rect(thumbnail_rect, palette().color(ColorRole::DisabledText));
}
};
for (auto& gadget : m_gadgets) {