Replace app::skin::get_style() with SkinTheme::Styles

This commit is contained in:
David Capello 2015-02-17 11:43:25 -03:00
parent 1805d56733
commit ebdc2700c1
9 changed files with 113 additions and 171 deletions

View File

@ -307,15 +307,15 @@
<part id="timeline_empty_frame_active" x="252" y="60" w="12" h="12" />
<part id="timeline_keyframe_normal" x="240" y="72" w="12" h="12" />
<part id="timeline_keyframe_active" x="252" y="72" w="12" h="12" />
<part id="timeline_fromleft_normal" x="240" y="84" w="12" h="12" />
<part id="timeline_fromleft_active" x="252" y="84" w="12" h="12" />
<part id="timeline_fromright_normal" x="240" y="96" w="12" h="12" />
<part id="timeline_fromright_active" x="252" y="96" w="12" h="12" />
<part id="timeline_fromboth_normal" x="240" y="108" w="12" h="12" />
<part id="timeline_fromboth_active" x="252" y="108" w="12" h="12" />
<part id="timeline_leftlink_active" x="264" y="84" w="12" h="12" />
<part id="timeline_bothlinks_active" x="264" y="96" w="12" h="12" />
<part id="timeline_rightlink_active" x="264" y="108" w="12" h="12" />
<part id="timeline_from_left_normal" x="240" y="84" w="12" h="12" />
<part id="timeline_from_left_active" x="252" y="84" w="12" h="12" />
<part id="timeline_from_right_normal" x="240" y="96" w="12" h="12" />
<part id="timeline_from_right_active" x="252" y="96" w="12" h="12" />
<part id="timeline_from_both_normal" x="240" y="108" w="12" h="12" />
<part id="timeline_from_both_active" x="252" y="108" w="12" h="12" />
<part id="timeline_left_link_active" x="264" y="84" w="12" h="12" />
<part id="timeline_both_links_active" x="264" y="96" w="12" h="12" />
<part id="timeline_right_link_active" x="264" y="108" w="12" h="12" />
<part id="timeline_gear" x="264" y="12" w="12" h="12" />
<part id="timeline_gear_active" x="264" y="24" w="12" h="12" />
<part id="timeline_onionskin" x="264" y="36" w="12" h="12" />
@ -485,35 +485,35 @@
<icon part="timeline_keyframe_active" />
</style>
<style id="timeline_fromleft">
<icon part="timeline_fromleft_normal" />
<style id="timeline_from_left">
<icon part="timeline_from_left_normal" />
</style>
<style id="timeline_fromleft:active">
<icon part="timeline_fromleft_active" />
<style id="timeline_from_left:active">
<icon part="timeline_from_left_active" />
</style>
<style id="timeline_fromright">
<icon part="timeline_fromright_normal" />
<style id="timeline_from_right">
<icon part="timeline_from_right_normal" />
</style>
<style id="timeline_fromright:active">
<icon part="timeline_fromright_active" />
<style id="timeline_from_right:active">
<icon part="timeline_from_right_active" />
</style>
<style id="timeline_fromboth">
<icon part="timeline_fromboth_normal" />
<style id="timeline_from_both">
<icon part="timeline_from_both_normal" />
</style>
<style id="timeline_fromboth:active">
<icon part="timeline_fromboth_active" />
<style id="timeline_from_both:active">
<icon part="timeline_from_both_active" />
</style>
<style id="timeline_leftlink">
<icon part="timeline_leftlink_active" />
<style id="timeline_left_link">
<icon part="timeline_left_link_active" />
</style>
<style id="timeline_rightlink">
<icon part="timeline_rightlink_active" />
<style id="timeline_right_link">
<icon part="timeline_right_link_active" />
</style>
<style id="timeline_bothlinks">
<icon part="timeline_bothlinks_active" />
<style id="timeline_both_links">
<icon part="timeline_both_links_active" />
</style>
<!-- timeline_gear -->

View File

@ -45,7 +45,8 @@ using namespace doc;
class ColorSelector::WarningIcon : public StyledButton {
public:
WarningIcon() : StyledButton("warning_box") {
WarningIcon()
: StyledButton(skin::SkinTheme::instance()->styles.warningBox()) {
}
};

View File

@ -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)
{
}

View File

@ -134,6 +134,12 @@ static const char* cursor_names[kCursorTypes] = {
"magnifier" // kMagnifierCursor
};
// static
SkinTheme* SkinTheme::instance()
{
return static_cast<SkinTheme*>(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());

View File

@ -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<SkinTheme*>(ui::Manager::getDefault()->getTheme())->getStyle(id);
}
inline SkinPartPtr get_part_by_id(const std::string& id) {
return static_cast<SkinTheme*>(ui::Manager::getDefault()->getTheme())->getPartById(id);
}

View File

@ -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) {

View File

@ -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;

View File

@ -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 <cstdio>
@ -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<SkinTheme*>(getTheme());
}
} // namespace app

View File

@ -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;