From ebdc2700c1349f7640bc9ca7f08128ce5f7d7599 Mon Sep 17 00:00:00 2001 From: David Capello Date: Tue, 17 Feb 2015 11:43:25 -0300 Subject: [PATCH] Replace app::skin::get_style() with SkinTheme::Styles --- data/skins/default/skin.xml | 54 ++++++------ src/app/ui/color_selector.cpp | 3 +- src/app/ui/notifications.cpp | 4 +- src/app/ui/skin/skin_theme.cpp | 25 ++++-- src/app/ui/skin/skin_theme.h | 6 +- src/app/ui/styled_button.cpp | 6 +- src/app/ui/styled_button.h | 2 +- src/app/ui/timeline.cpp | 147 ++++++++++++--------------------- src/app/ui/timeline.h | 37 ++------- 9 files changed, 113 insertions(+), 171 deletions(-) diff --git a/data/skins/default/skin.xml b/data/skins/default/skin.xml index 5965d3886..18c533597 100644 --- a/data/skins/default/skin.xml +++ b/data/skins/default/skin.xml @@ -307,15 +307,15 @@ - - - - - - - - - + + + + + + + + + @@ -485,35 +485,35 @@ - - - - - - - - - diff --git a/src/app/ui/color_selector.cpp b/src/app/ui/color_selector.cpp index 1088b45bb..3e1191c02 100644 --- a/src/app/ui/color_selector.cpp +++ b/src/app/ui/color_selector.cpp @@ -45,7 +45,8 @@ using namespace doc; class ColorSelector::WarningIcon : public StyledButton { public: - WarningIcon() : StyledButton("warning_box") { + WarningIcon() + : StyledButton(skin::SkinTheme::instance()->styles.warningBox()) { } }; diff --git a/src/app/ui/notifications.cpp b/src/app/ui/notifications.cpp index 95ec9ccd8..1f5186db9 100644 --- a/src/app/ui/notifications.cpp +++ b/src/app/ui/notifications.cpp @@ -23,8 +23,6 @@ namespace app { using namespace ui; -static const char* kFlag = "flag"; - class NotificationItem : public MenuItem { public: NotificationItem(INotificationDelegate* del) @@ -44,7 +42,7 @@ private: Notifications::Notifications() : Button("") - , m_flagStyle(skin::get_style(kFlag)) + , m_flagStyle(skin::SkinTheme::instance()->styles.flag()) , m_withNotifications(false) { } diff --git a/src/app/ui/skin/skin_theme.cpp b/src/app/ui/skin/skin_theme.cpp index ae15d3bf5..7a4785a05 100644 --- a/src/app/ui/skin/skin_theme.cpp +++ b/src/app/ui/skin/skin_theme.cpp @@ -134,6 +134,12 @@ static const char* cursor_names[kCursorTypes] = { "magnifier" // kMagnifierCursor }; +// static +SkinTheme* SkinTheme::instance() +{ + return static_cast(ui::Manager::getDefault()->getTheme()); +} + SkinTheme::SkinTheme() : m_cursors(ui::kCursorTypes, NULL) { @@ -1615,8 +1621,13 @@ void SkinTheme::paintViewScrollbar(PaintEvent& ev) if (skinPropery != NULL) isMiniLook = (skinPropery->getLook() == MiniLook); - skin::Style* bgStyle = get_style(isMiniLook ? "mini_scrollbar": "scrollbar"); - skin::Style* thumbStyle = get_style(isMiniLook ? "mini_scrollbar_thumb": "scrollbar_thumb"); + skin::Style* bgStyle = (isMiniLook ? + styles.miniScrollbar(): + styles.scrollbar()); + + skin::Style* thumbStyle = (isMiniLook ? + styles.miniScrollbarThumb(): + styles.scrollbarThumb()); widget->getScrollBarThemeInfo(&pos, &len); @@ -1658,20 +1669,20 @@ void SkinTheme::paintWindow(PaintEvent& ev) if (!window->isDesktop()) { // window frame if (window->hasText()) { - get_style("window")->paint(g, pos, NULL, Style::State()); - get_style("window_title")->paint(g, + styles.window()->paint(g, pos, NULL, Style::State()); + styles.windowTitle()->paint(g, gfx::Rect(cpos.x, pos.y+5*guiscale(), cpos.w, // TODO this hard-coded 5 should be configurable in skin.xml window->getTextHeight()), window->getText().c_str(), Style::State()); } // menubox else { - get_style("menubox")->paint(g, pos, NULL, Style::State()); + styles.menubox()->paint(g, pos, NULL, Style::State()); } } // desktop else { - get_style("desktop")->paint(g, pos, NULL, Style::State()); + styles.desktop()->paint(g, pos, NULL, Style::State()); } } @@ -1683,7 +1694,7 @@ void SkinTheme::paintPopupWindow(PaintEvent& ev) gfx::Rect pos = window->getClientBounds(); if (!is_transparent(BGCOLOR)) - get_style("menubox")->paint(g, pos, NULL, Style::State()); + styles.menubox()->paint(g, pos, NULL, Style::State()); pos.shrink(window->getBorder()); diff --git a/src/app/ui/skin/skin_theme.h b/src/app/ui/skin/skin_theme.h index cdf827540..f65ac31fe 100644 --- a/src/app/ui/skin/skin_theme.h +++ b/src/app/ui/skin/skin_theme.h @@ -42,6 +42,8 @@ namespace app { public: static const char* kThemeCloseButtonId; + static SkinTheme* instance(); + SkinTheme(); ~SkinTheme(); @@ -144,10 +146,6 @@ namespace app { she::Font* m_minifont; }; - inline Style* get_style(const std::string& id) { - return static_cast(ui::Manager::getDefault()->getTheme())->getStyle(id); - } - inline SkinPartPtr get_part_by_id(const std::string& id) { return static_cast(ui::Manager::getDefault()->getTheme())->getPartById(id); } diff --git a/src/app/ui/styled_button.cpp b/src/app/ui/styled_button.cpp index c28e9a491..171281c8a 100644 --- a/src/app/ui/styled_button.cpp +++ b/src/app/ui/styled_button.cpp @@ -22,8 +22,10 @@ namespace app { using namespace ui; -StyledButton::StyledButton(const std::string& styleName) : Button("") { - m_style = skin::get_style(styleName); +StyledButton::StyledButton(skin::Style* style) + : Button("") + , m_style(style) +{ } bool StyledButton::onProcessMessage(Message* msg) { diff --git a/src/app/ui/styled_button.h b/src/app/ui/styled_button.h index 347d0ee1f..3dcf3b094 100644 --- a/src/app/ui/styled_button.h +++ b/src/app/ui/styled_button.h @@ -19,7 +19,7 @@ namespace app { class StyledButton : public ui::Button { public: - StyledButton(const std::string& styleName); + StyledButton(skin::Style* style); protected: bool onProcessMessage(ui::Message* msg) override; diff --git a/src/app/ui/timeline.cpp b/src/app/ui/timeline.cpp index b7c514a0c..4b08727bd 100644 --- a/src/app/ui/timeline.cpp +++ b/src/app/ui/timeline.cpp @@ -25,19 +25,20 @@ #include "app/modules/editors.h" #include "app/modules/gfx.h" #include "app/modules/gui.h" +#include "app/transaction.h" #include "app/ui/configure_timeline_popup.h" #include "app/ui/document_view.h" #include "app/ui/editor/editor.h" #include "app/ui/skin/skin_theme.h" +#include "app/ui/skin/style.h" #include "app/ui/status_bar.h" #include "app/ui_context.h" -#include "app/transaction.h" #include "app/util/clipboard.h" #include "base/memory.h" +#include "doc/doc.h" #include "doc/document_event.h" #include "gfx/point.h" #include "gfx/rect.h" -#include "doc/doc.h" #include "ui/ui.h" #include @@ -72,38 +73,6 @@ using namespace gfx; using namespace doc; using namespace ui; -static const char* kTimeline = "timeline"; -static const char* kTimelineBox = "timeline_box"; -static const char* kTimelineOpenEye = "timeline_open_eye"; -static const char* kTimelineClosedEye = "timeline_closed_eye"; -static const char* kTimelineOpenPadlock = "timeline_open_padlock"; -static const char* kTimelineClosedPadlock = "timeline_closed_padlock"; -static const char* kTimelineContinuous = "timeline_continuous"; -static const char* kTimelineDiscontinuous = "timeline_discontinuous"; -static const char* kTimelineLayer = "timeline_layer"; -static const char* kTimelineEmptyFrame = "timeline_empty_frame"; -static const char* kTimelineKeyframe = "timeline_keyframe"; -static const char* kTimelineFromLeft = "timeline_fromleft"; -static const char* kTimelineFromRight = "timeline_fromright"; -static const char* kTimelineFromBoth = "timeline_fromboth"; -static const char* kTimelineLeftLink = "timeline_leftlink"; -static const char* kTimelineRightLink = "timeline_rightlink"; -static const char* kTimelineBothLinks = "timeline_bothlinks"; -static const char* kTimelineGear = "timeline_gear"; -static const char* kTimelineOnionskin = "timeline_onionskin"; -static const char* kTimelineOnionskinRange = "timeline_onionskin_range"; -static const char* kTimelinePadding = "timeline_padding"; -static const char* kTimelinePaddingTr = "timeline_padding_tr"; -static const char* kTimelinePaddingBl = "timeline_padding_bl"; -static const char* kTimelinePaddingBr = "timeline_padding_br"; -static const char* kTimelineSelectedCelStyle = "timeline_selected_cel"; -static const char* kTimelineRangeOutlineStyle = "timeline_range_outline"; -static const char* kTimelineDropLayerDecoStyle = "timeline_drop_layer_deco"; -static const char* kTimelineDropFrameDecoStyle = "timeline_drop_frame_deco"; -static const char* kTimelineLoopRangeStyle = "timeline_loop_range"; - -static const char* kTimelineActiveColor = "timeline_active"; - enum { A_PART_NOTHING, A_PART_SEPARATOR, @@ -127,35 +96,6 @@ enum { Timeline::Timeline() : Widget(kGenericWidget) - , m_timelineStyle(get_style(kTimeline)) - , m_timelineBoxStyle(get_style(kTimelineBox)) - , m_timelineOpenEyeStyle(get_style(kTimelineOpenEye)) - , m_timelineClosedEyeStyle(get_style(kTimelineClosedEye)) - , m_timelineOpenPadlockStyle(get_style(kTimelineOpenPadlock)) - , m_timelineClosedPadlockStyle(get_style(kTimelineClosedPadlock)) - , m_timelineContinuousStyle(get_style(kTimelineContinuous)) - , m_timelineDiscontinuousStyle(get_style(kTimelineDiscontinuous)) - , m_timelineLayerStyle(get_style(kTimelineLayer)) - , m_timelineEmptyFrameStyle(get_style(kTimelineEmptyFrame)) - , m_timelineKeyframeStyle(get_style(kTimelineKeyframe)) - , m_timelineFromLeftStyle(get_style(kTimelineFromLeft)) - , m_timelineFromRightStyle(get_style(kTimelineFromRight)) - , m_timelineFromBothStyle(get_style(kTimelineFromBoth)) - , m_timelineLeftLinkStyle(get_style(kTimelineLeftLink)) - , m_timelineRightLinkStyle(get_style(kTimelineRightLink)) - , m_timelineBothLinksStyle(get_style(kTimelineBothLinks)) - , m_timelineGearStyle(get_style(kTimelineGear)) - , m_timelineOnionskinStyle(get_style(kTimelineOnionskin)) - , m_timelineOnionskinRangeStyle(get_style(kTimelineOnionskinRange)) - , m_timelinePaddingStyle(get_style(kTimelinePadding)) - , m_timelinePaddingTrStyle(get_style(kTimelinePaddingTr)) - , m_timelinePaddingBlStyle(get_style(kTimelinePaddingBl)) - , m_timelinePaddingBrStyle(get_style(kTimelinePaddingBr)) - , m_timelineSelectedCelStyle(get_style(kTimelineSelectedCelStyle)) - , m_timelineRangeOutlineStyle(get_style(kTimelineRangeOutlineStyle)) - , m_timelineDropLayerDecoStyle(get_style(kTimelineDropLayerDecoStyle)) - , m_timelineDropFrameDecoStyle(get_style(kTimelineDropFrameDecoStyle)) - , m_timelineLoopRangeStyle(get_style(kTimelineLoopRangeStyle)) , m_context(UIContext::instance()) , m_editor(NULL) , m_document(NULL) @@ -831,7 +771,7 @@ void Timeline::onPaint(ui::PaintEvent& ev) gfx::Rect bounds = getOnionskinFramesBounds(); if (!bounds.isEmpty()) { drawPart(g, bounds, - NULL, m_timelineOnionskinRangeStyle, + NULL, skinTheme()->styles.timelineOnionskinRange(), false, false, false); } } @@ -887,7 +827,8 @@ void Timeline::onPaint(ui::PaintEvent& ev) paintNoDoc:; if (noDoc) - drawPart(g, getClientBounds(), NULL, m_timelinePaddingStyle); + drawPart(g, getClientBounds(), NULL, + skinTheme()->styles.timelinePadding()); } void Timeline::onAfterCommandExecution(Command* command) @@ -1096,46 +1037,47 @@ void Timeline::drawClipboardRange(ui::Graphics* g) void Timeline::drawHeader(ui::Graphics* g) { + SkinTheme::Styles& styles = skinTheme()->styles; bool allInvisible = allLayersInvisible(); bool allLocked = allLayersLocked(); bool allContinuous = allLayersContinuous(); drawPart(g, getPartBounds(A_PART_HEADER_EYE), NULL, - allInvisible ? m_timelineClosedEyeStyle: m_timelineOpenEyeStyle, + allInvisible ? styles.timelineClosedEye(): styles.timelineOpenEye(), m_clk_part == A_PART_HEADER_EYE, m_hot_part == A_PART_HEADER_EYE, m_clk_part == A_PART_HEADER_EYE); drawPart(g, getPartBounds(A_PART_HEADER_PADLOCK), NULL, - allLocked ? m_timelineClosedPadlockStyle: m_timelineOpenPadlockStyle, + allLocked ? styles.timelineClosedPadlock(): styles.timelineOpenPadlock(), m_clk_part == A_PART_HEADER_PADLOCK, m_hot_part == A_PART_HEADER_PADLOCK, m_clk_part == A_PART_HEADER_PADLOCK); drawPart(g, getPartBounds(A_PART_HEADER_CONTINUOUS), NULL, - allContinuous ? m_timelineContinuousStyle: m_timelineDiscontinuousStyle, + allContinuous ? styles.timelineContinuous(): styles.timelineDiscontinuous(), m_clk_part == A_PART_HEADER_CONTINUOUS, m_hot_part == A_PART_HEADER_CONTINUOUS, m_clk_part == A_PART_HEADER_CONTINUOUS); drawPart(g, getPartBounds(A_PART_HEADER_GEAR), - NULL, m_timelineGearStyle, + NULL, styles.timelineGear(), false, m_hot_part == A_PART_HEADER_GEAR, m_clk_part == A_PART_HEADER_GEAR); drawPart(g, getPartBounds(A_PART_HEADER_ONIONSKIN), - NULL, m_timelineOnionskinStyle, + NULL, styles.timelineOnionskin(), docPref().onionskin.active(), m_hot_part == A_PART_HEADER_ONIONSKIN, m_clk_part == A_PART_HEADER_ONIONSKIN); // Empty header space. drawPart(g, getPartBounds(A_PART_HEADER_LAYER), - NULL, m_timelineBoxStyle, false, false, false); + NULL, styles.timelineBox(), false, false, false); } void Timeline::drawHeaderFrame(ui::Graphics* g, frame_t frame) @@ -1153,13 +1095,14 @@ void Timeline::drawHeaderFrame(ui::Graphics* g, frame_t frame) std::sprintf(buf, "%d", (frame+1)%100); // Draw only the first two digits. she::Font* oldFont = g->getFont(); - g->setFont(((SkinTheme*)getTheme())->getMiniFont()); - drawPart(g, bounds, buf, m_timelineBoxStyle, is_active, is_hover, is_clicked); + g->setFont(skinTheme()->getMiniFont()); + drawPart(g, bounds, buf, skinTheme()->styles.timelineBox(), is_active, is_hover, is_clicked); g->setFont(oldFont); } void Timeline::drawLayer(ui::Graphics* g, LayerIndex layerIdx) { + SkinTheme::Styles& styles = skinTheme()->styles; Layer* layer = m_layers[layerIdx]; bool is_active = isLayerActive(layerIdx); bool hotlayer = (m_hot_layer == layerIdx); @@ -1172,7 +1115,7 @@ void Timeline::drawLayer(ui::Graphics* g, LayerIndex layerIdx) // Draw the eye (visible flag). bounds = getPartBounds(A_PART_LAYER_EYE_ICON, layerIdx); drawPart(g, bounds, NULL, - layer->isVisible() ? m_timelineOpenEyeStyle: m_timelineClosedEyeStyle, + layer->isVisible() ? styles.timelineOpenEye(): styles.timelineClosedEye(), is_active, (hotlayer && m_hot_part == A_PART_LAYER_EYE_ICON), (clklayer && m_clk_part == A_PART_LAYER_EYE_ICON)); @@ -1180,7 +1123,7 @@ void Timeline::drawLayer(ui::Graphics* g, LayerIndex layerIdx) // Draw the padlock (editable flag). bounds = getPartBounds(A_PART_LAYER_PADLOCK_ICON, layerIdx); drawPart(g, bounds, NULL, - layer->isEditable() ? m_timelineOpenPadlockStyle: m_timelineClosedPadlockStyle, + layer->isEditable() ? styles.timelineOpenPadlock(): styles.timelineClosedPadlock(), is_active, (hotlayer && m_hot_part == A_PART_LAYER_PADLOCK_ICON), (clklayer && m_clk_part == A_PART_LAYER_PADLOCK_ICON)); @@ -1188,14 +1131,14 @@ void Timeline::drawLayer(ui::Graphics* g, LayerIndex layerIdx) // Draw the continuous flag. bounds = getPartBounds(A_PART_LAYER_CONTINUOUS_ICON, layerIdx); drawPart(g, bounds, NULL, - layer->isContinuous() ? m_timelineContinuousStyle: m_timelineDiscontinuousStyle, + layer->isContinuous() ? styles.timelineContinuous(): styles.timelineDiscontinuous(), is_active, (hotlayer && m_hot_part == A_PART_LAYER_CONTINUOUS_ICON), (clklayer && m_clk_part == A_PART_LAYER_CONTINUOUS_ICON)); // Draw the layer's name. bounds = getPartBounds(A_PART_LAYER_TEXT, layerIdx); - drawPart(g, bounds, layer->name().c_str(), m_timelineLayerStyle, + drawPart(g, bounds, layer->name().c_str(), styles.timelineLayer(), is_active, (hotlayer && m_hot_part == A_PART_LAYER_TEXT), (clklayer && m_clk_part == A_PART_LAYER_TEXT)); @@ -1206,13 +1149,14 @@ void Timeline::drawLayer(ui::Graphics* g, LayerIndex layerIdx) if (hotlayer && !is_active && m_clk_part == A_PART_LAYER_TEXT) { // TODO this should be skinneable g->fillRect( - ((SkinTheme*)getTheme())->colors.timelineActive(), + skinTheme()->colors.timelineActive(), gfx::Rect(bounds.x, bounds.y, bounds.w, 2)); } } void Timeline::drawCel(ui::Graphics* g, LayerIndex layerIndex, frame_t frame, Cel* cel) { + SkinTheme::Styles& styles = skinTheme()->styles; Layer* layer = m_layers[layerIndex]; Image* image = (cel ? cel->image(): NULL); bool is_hover = (m_hot_part == A_PART_CEL && @@ -1226,15 +1170,15 @@ void Timeline::drawCel(ui::Graphics* g, LayerIndex layerIndex, frame_t frame, Ce return; if (layer == m_layer && frame == m_frame) - drawPart(g, bounds, NULL, m_timelineSelectedCelStyle, false, false, true); + drawPart(g, bounds, NULL, styles.timelineSelectedCel(), false, false, true); else - drawPart(g, bounds, NULL, m_timelineBoxStyle, is_active, is_hover); + drawPart(g, bounds, NULL, styles.timelineBox(), is_active, is_hover); skin::Style* style; bool fromLeft = false; bool fromRight = false; if (is_empty) { - style = m_timelineEmptyFrameStyle; + style = styles.timelineEmptyFrame(); } else { Cel* left = (layer->isImage() ? layer->cel(frame-1): NULL); @@ -1245,13 +1189,13 @@ void Timeline::drawCel(ui::Graphics* g, LayerIndex layerIndex, frame_t frame, Ce fromRight = (rightImg == cel->image()->id()); if (fromLeft && fromRight) - style = m_timelineFromBothStyle; + style = styles.timelineFromBoth(); else if (fromLeft) - style = m_timelineFromLeftStyle; + style = styles.timelineFromLeft(); else if (fromRight) - style = m_timelineFromRightStyle; + style = styles.timelineFromRight(); else - style = m_timelineKeyframeStyle; + style = styles.timelineKeyframe(); } drawPart(g, bounds, NULL, style, is_active, is_hover); @@ -1266,6 +1210,7 @@ void Timeline::drawCel(ui::Graphics* g, LayerIndex layerIndex, frame_t frame, Ce void Timeline::drawCelLinkDecorators(ui::Graphics* g, const gfx::Rect& bounds, Cel* cel, Cel* activeCel, frame_t frame, bool is_active, bool is_hover) { + SkinTheme::Styles& styles = skinTheme()->styles; ObjectId imageId = activeCel->image()->id(); // Link in some cel at the left side @@ -1290,18 +1235,18 @@ void Timeline::drawCelLinkDecorators(ui::Graphics* g, const gfx::Rect& bounds, if (!cel || cel->image()->id() != imageId) { if (left && right) - drawPart(g, bounds, NULL, m_timelineBothLinksStyle, is_active, is_hover); + drawPart(g, bounds, NULL, styles.timelineBothLinks(), is_active, is_hover); } else { if (left) { Cel* prevCel = m_layer->cel(cel->frame()-1); if (!prevCel || prevCel->image()->id() != imageId) - drawPart(g, bounds, NULL, m_timelineLeftLinkStyle, is_active, is_hover); + drawPart(g, bounds, NULL, styles.timelineLeftLink(), is_active, is_hover); } if (right) { Cel* nextCel = m_layer->cel(cel->frame()+1); if (!nextCel || nextCel->image()->id() != imageId) - drawPart(g, bounds, NULL, m_timelineRightLinkStyle, is_active, is_hover); + drawPart(g, bounds, NULL, styles.timelineRightLink(), is_active, is_hover); } } } @@ -1325,11 +1270,14 @@ void Timeline::drawLoopRange(ui::Graphics* g) if (!clip) return; - drawPart(g, bounds, NULL, m_timelineLoopRangeStyle); + drawPart(g, bounds, NULL, + skinTheme()->styles.timelineLoopRange()); } void Timeline::drawRangeOutline(ui::Graphics* g) { + SkinTheme::Styles& styles = skinTheme()->styles; + gfx::Rect clipBounds; switch (m_range.type()) { case Range::kCels: clipBounds = getCelsBounds(); break; @@ -1345,7 +1293,7 @@ void Timeline::drawRangeOutline(ui::Graphics* g) if (m_hot_part == A_PART_RANGE_OUTLINE) state += Style::hover(); gfx::Rect bounds = getPartBounds(A_PART_RANGE_OUTLINE); - m_timelineRangeOutlineStyle->paint(g, bounds, NULL, state); + styles.timelineRangeOutline()->paint(g, bounds, NULL, state); Range drop = m_dropRange; gfx::Rect dropBounds = getRangeBounds(drop); @@ -1354,7 +1302,7 @@ void Timeline::drawRangeOutline(ui::Graphics* g) case Range::kCels: { dropBounds = dropBounds.enlarge(OUTLINE_WIDTH); - m_timelineRangeOutlineStyle->paint(g, dropBounds, NULL, Style::active()); + styles.timelineRangeOutline()->paint(g, dropBounds, NULL, Style::active()); break; } @@ -1370,7 +1318,7 @@ void Timeline::drawRangeOutline(ui::Graphics* g) dropBounds.w = w; - m_timelineDropFrameDecoStyle->paint(g, dropBounds, NULL, Style::State()); + styles.timelineDropFrameDeco()->paint(g, dropBounds, NULL, Style::State()); break; } @@ -1386,7 +1334,7 @@ void Timeline::drawRangeOutline(ui::Graphics* g) dropBounds.h = h; - m_timelineDropLayerDecoStyle->paint(g, dropBounds, NULL, Style::State()); + styles.timelineDropLayerDeco()->paint(g, dropBounds, NULL, Style::State()); break; } } @@ -1394,6 +1342,8 @@ void Timeline::drawRangeOutline(ui::Graphics* g) void Timeline::drawPaddings(ui::Graphics* g) { + SkinTheme::Styles& styles = skinTheme()->styles; + gfx::Rect client = getClientBounds(); gfx::Rect bottomLayer; gfx::Rect lastFrame; @@ -1411,18 +1361,18 @@ void Timeline::drawPaddings(ui::Graphics* g) gfx::Rect(lastFrame.x+lastFrame.w, client.y, client.w - (lastFrame.x+lastFrame.w), bottomLayer.y+bottomLayer.h), - NULL, m_timelinePaddingTrStyle); + NULL, styles.timelinePaddingTr()); drawPart(g, gfx::Rect(client.x, bottomLayer.y+bottomLayer.h, lastFrame.x+lastFrame.w - client.x, client.h - (bottomLayer.y+bottomLayer.h)), - NULL, m_timelinePaddingBlStyle); + NULL, styles.timelinePaddingBl()); drawPart(g, gfx::Rect(lastFrame.x+lastFrame.w, bottomLayer.y+bottomLayer.h, client.w - (lastFrame.x+lastFrame.w), client.h - (bottomLayer.y+bottomLayer.h)), - NULL, m_timelinePaddingBrStyle); + NULL, styles.timelinePaddingBr()); } gfx::Rect Timeline::getLayerHeadersBounds() const @@ -2195,4 +2145,9 @@ DocumentPreferences& Timeline::docPref() const return App::instance()->preferences().document(m_document); } +skin::SkinTheme* Timeline::skinTheme() const +{ + return static_cast(getTheme()); +} + } // namespace app diff --git a/src/app/ui/timeline.h b/src/app/ui/timeline.h index fe4e9cbe9..6108813f5 100644 --- a/src/app/ui/timeline.h +++ b/src/app/ui/timeline.h @@ -12,7 +12,6 @@ #include "app/document_range.h" #include "app/pref/preferences.h" #include "app/ui/editor/editor_observer.h" -#include "app/ui/skin/style.h" #include "base/connection.h" #include "doc/document_observer.h" #include "doc/documents_observer.h" @@ -36,6 +35,12 @@ namespace ui { } namespace app { + + namespace skin { + class Style; + class SkinTheme; + } + using namespace doc; class Command; @@ -190,36 +195,8 @@ namespace app { bool validFrame(frame_t frame) const { return frame >= firstFrame() && frame <= lastFrame(); } DocumentPreferences& docPref() const; + skin::SkinTheme* skinTheme() const; - skin::Style* m_timelineStyle; - skin::Style* m_timelineBoxStyle; - skin::Style* m_timelineOpenEyeStyle; - skin::Style* m_timelineClosedEyeStyle; - skin::Style* m_timelineOpenPadlockStyle; - skin::Style* m_timelineClosedPadlockStyle; - skin::Style* m_timelineContinuousStyle; - skin::Style* m_timelineDiscontinuousStyle; - skin::Style* m_timelineLayerStyle; - skin::Style* m_timelineEmptyFrameStyle; - skin::Style* m_timelineKeyframeStyle; - skin::Style* m_timelineFromLeftStyle; - skin::Style* m_timelineFromRightStyle; - skin::Style* m_timelineFromBothStyle; - skin::Style* m_timelineLeftLinkStyle; - skin::Style* m_timelineRightLinkStyle; - skin::Style* m_timelineBothLinksStyle; - skin::Style* m_timelineGearStyle; - skin::Style* m_timelineOnionskinStyle; - skin::Style* m_timelineOnionskinRangeStyle; - skin::Style* m_timelinePaddingStyle; - skin::Style* m_timelinePaddingTrStyle; - skin::Style* m_timelinePaddingBlStyle; - skin::Style* m_timelinePaddingBrStyle; - skin::Style* m_timelineSelectedCelStyle; - skin::Style* m_timelineRangeOutlineStyle; - skin::Style* m_timelineDropLayerDecoStyle; - skin::Style* m_timelineDropFrameDecoStyle; - skin::Style* m_timelineLoopRangeStyle; Context* m_context; Editor* m_editor; Document* m_document;