Skip to content

Commit

Permalink
Timeline: Add button and handles to configure onionskin range
Browse files Browse the repository at this point in the history
  • Loading branch information
dacap committed Dec 18, 2013
1 parent f467628 commit b4d9e3c
Show file tree
Hide file tree
Showing 8 changed files with 172 additions and 51 deletions.
Binary file modified data/skins/default/sheet.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions data/skins/default/skin.xml
Expand Up @@ -294,6 +294,10 @@
<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_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" />
<part id="timeline_onionskin_active" x="264" y="48" w="12" h="12" />
<part id="timeline_onionskin_range" x="240" y="120" w1="3" w2="6" w3="3" h1="3" h2="6" h3="3" />
<part id="timeline_padding" x="276" y="12" w1="1" w2="10" w3="1" h1="1" h2="10" h3="1" />
<part id="timeline_padding_tr" x="288" y="12" w1="1" w2="10" w3="1" h1="1" h2="10" h3="1" />
<part id="timeline_padding_bl" x="276" y="24" w1="1" w2="10" w3="1" h1="1" h2="10" h3="1" />
Expand Down Expand Up @@ -409,6 +413,28 @@
<style id="timeline_gear" base="timeline_box">
<icon part="timeline_gear" />
</style>
<style id="timeline_gear:active">
<icon part="timeline_gear_active" />
</style>
<style id="timeline_gear:clicked">
<icon part="timeline_gear_active" />
</style>

<!-- timeline_onionskin -->
<style id="timeline_onionskin" base="timeline_box">
<icon part="timeline_onionskin" />
</style>
<style id="timeline_onionskin:active">
<icon part="timeline_onionskin_active" />
</style>
<style id="timeline_onionskin:clicked">
<icon part="timeline_onionskin_active" />
</style>

<!-- timeline_onionskin_range -->
<style id="timeline_onionskin_range">
<background part="timeline_onionskin_range" />
</style>

<!-- paddings -->
<style id="timeline_padding">
Expand Down
1 change: 0 additions & 1 deletion data/widgets/tools_configuration.xml
Expand Up @@ -10,7 +10,6 @@
<check text="x" id="tiled_x" />
<check text="y" id="tiled_y" />
</box>
<check text="Onionskin" id="onionskin" />
<separator text="Grid:" horizontal="true" left="true" />
<check text="Snap to Grid" id="snap_to_grid" />
<check text="View Grid" id="view_grid" />
Expand Down
10 changes: 0 additions & 10 deletions src/app/commands/cmd_configure_tools.cpp
Expand Up @@ -71,7 +71,6 @@ class ConfigureTools : public Command {
CheckBox* m_tiledY;
CheckBox* m_pixelGrid;
CheckBox* m_snapToGrid;
CheckBox* m_onionSkin;
CheckBox* m_viewGrid;
ISettings* m_settings;
IDocumentSettings* m_docSettings;
Expand All @@ -83,7 +82,6 @@ class ConfigureTools : public Command {
void onPixelGridClick();
void onSetGridClick();
void onSnapToGridClick();
void onOnionSkinClick();
};

ConfigureTools::ConfigureTools()
Expand Down Expand Up @@ -121,7 +119,6 @@ void ConfigureTools::onExecute(Context* context)
m_viewGrid = app::find_widget<CheckBox>(window, "view_grid");
m_pixelGrid = app::find_widget<CheckBox>(window, "pixel_grid");
set_grid = app::find_widget<Button>(window, "set_grid");
m_onionSkin = app::find_widget<CheckBox>(window, "onionskin");
}
catch (...) {
delete window;
Expand All @@ -142,7 +139,6 @@ void ConfigureTools::onExecute(Context* context)
if (m_docSettings->getSnapToGrid()) m_snapToGrid->setSelected(true);
if (m_docSettings->getGridVisible()) m_viewGrid->setSelected(true);
if (m_docSettings->getPixelGridVisible()) m_pixelGrid->setSelected(true);
if (m_docSettings->getUseOnionskin()) m_onionSkin->setSelected(true);

if (first_time) {
// Slots
Expand All @@ -154,7 +150,6 @@ void ConfigureTools::onExecute(Context* context)
m_pixelGrid->Click.connect(Bind<void>(&ConfigureTools::onPixelGridClick, this));
set_grid->Click.connect(Bind<void>(&ConfigureTools::onSetGridClick, this));
m_snapToGrid->Click.connect(Bind<void>(&ConfigureTools::onSnapToGridClick, this));
m_onionSkin->Click.connect(Bind<void>(&ConfigureTools::onOnionSkinClick, this));

App::instance()->Exit.connect(&on_exit_delete_this_widget);
}
Expand Down Expand Up @@ -238,11 +233,6 @@ void ConfigureTools::onSetGridClick()
}
}

void ConfigureTools::onOnionSkinClick()
{
m_docSettings->setUseOnionskin(m_onionSkin->isSelected());
}

Command* CommandFactory::createConfigureToolsCommand()
{
return new ConfigureTools;
Expand Down
5 changes: 5 additions & 0 deletions src/app/settings/ui_settings_impl.cpp
Expand Up @@ -418,26 +418,31 @@ int UIDocumentSettingsImpl::getOnionskinOpacityStep()
void UIDocumentSettingsImpl::setUseOnionskin(bool state)
{
m_use_onionskin = state;
redrawDocumentViews();
}

void UIDocumentSettingsImpl::setOnionskinPrevFrames(int frames)
{
m_prev_frames_onionskin = frames;
redrawDocumentViews();
}

void UIDocumentSettingsImpl::setOnionskinNextFrames(int frames)
{
m_next_frames_onionskin = frames;
redrawDocumentViews();
}

void UIDocumentSettingsImpl::setOnionskinOpacityBase(int base)
{
m_onionskin_opacity_base = base;
redrawDocumentViews();
}

void UIDocumentSettingsImpl::setOnionskinOpacityStep(int step)
{
m_onionskin_opacity_step = step;
redrawDocumentViews();
}

//////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion src/app/ui/skin/style_sheet.cpp
Expand Up @@ -102,7 +102,7 @@ SkinPartPtr StyleSheet::convertPart(const css::Value& value)
// static
ui::Color StyleSheet::convertColor(const css::Value& value)
{
ui::Color color;
ui::Color color = ui::ColorNone;
if (value.type() == css::Value::String) {
const std::string& color_id = value.string();
color = get_color_by_id(color_id);
Expand Down

0 comments on commit b4d9e3c

Please sign in to comment.