Add a checkbox to expand thumbnails options in Timeline popup

This commit is contained in:
David Capello 2017-02-01 13:47:16 -03:00
parent 2bac4d0313
commit 8abd401a04
6 changed files with 39 additions and 11 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Aseprite -->
<!-- Copyright (C) 2014-2016 by David Capello -->
<!-- Copyright (C) 2014-2017 by David Capello -->
<preferences>
<types>
@ -225,7 +225,7 @@
<option id="enabled" type="bool" default="false" />
</section>
<section id="thumbnails">
<option id="cache_limit" type="int" default="5000" />
<option id="visible_options" type="bool" default="false" />
</section>
<section id="perf">
<option id="show_render_time" type="bool" default="false" />

View File

@ -483,7 +483,7 @@ right = &Right
bottom = &Bottom
frame_header = Frame Header:
first_frame = First Frame:
thumbnails = Thumbnails:
thumbnails = Thumbnails
force = Force
zoom = Zoom:
overlay = Overlay

View File

@ -1,5 +1,5 @@
<!-- Aseprite -->
<!-- Copyright (C) 2014-2016 by David Capello -->
<!-- Copyright (C) 2014-2017 by David Capello -->
<gui>
<vbox id="timeline_conf">
<hbox>
@ -14,14 +14,17 @@
</hbox>
</vbox>
<vbox>
<separator cell_hspan="2" text="@.frame_header" left="true" horizontal="true" />
<separator text="@.frame_header" left="true" horizontal="true" />
<hbox>
<label text="@.first_frame" />
<entry id="first_frame" maxsize="3" />
</hbox>
<separator cell_hspan="2" text="@.thumbnails" left="true" horizontal="true" />
<grid columns="3">
<hbox>
<check id="thumb_check" text="@.thumbnails" horizontal="true" />
<separator id="thumb_h_separator" horizontal="true" expansive="true" />
</hbox>
<grid columns="3" id="thumb_box">
<check id="thumb_enabled" text="@.force" />
<label text="@.zoom" />
<slider min="1" max="10" id="zoom" cell_align="horizontal" width="128" />
@ -33,7 +36,7 @@
</vbox>
</hbox>
<separator cell_hspan="2" text="@.onion_skin" left="true" horizontal="true" />
<separator text="@.onion_skin" left="true" horizontal="true" />
<grid columns="2">
<hbox cell_hspan="2">
<radio group="1" text="@.merge_frames" id="merge" />

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2001-2016 David Capello
// Copyright (C) 2001-2017 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -64,9 +64,14 @@ ConfigureTimelinePopup::ConfigureTimelinePopup()
m_box->infront()->Click.connect(base::Bind<void>(&ConfigureTimelinePopup::onPositionChange, this));
m_box->zoom()->Change.connect(base::Bind<void>(&ConfigureTimelinePopup::onZoomChange, this));
m_box->thumbCheck()->Click.connect(base::Bind<void>(&ConfigureTimelinePopup::onThumbBoxChange, this));
m_box->thumbEnabled()->Click.connect(base::Bind<void>(&ConfigureTimelinePopup::onThumbEnabledChange, this));
m_box->thumbOverlayEnabled()->Click.connect(base::Bind<void>(&ConfigureTimelinePopup::onThumbOverlayEnabledChange, this));
m_box->thumbOverlaySize()->Change.connect(base::Bind<void>(&ConfigureTimelinePopup::onThumbOverlaySizeChange, this));
bool visibleThumbBox = Preferences::instance().thumbnails.visibleOptions();
m_box->thumbHSeparator()->setVisible(visibleThumbBox);
m_box->thumbBox()->setVisible(visibleThumbBox);
}
app::Document* ConfigureTimelinePopup::doc()
@ -127,10 +132,20 @@ void ConfigureTimelinePopup::updateWidgetsFromCurrentSettings()
break;
}
bool visibleThumbBox = Preferences::instance().thumbnails.visibleOptions();
m_box->zoom()->setValue(docPref.thumbnails.zoom());
m_box->thumbCheck()->setSelected(visibleThumbBox);
m_box->thumbHSeparator()->setVisible(visibleThumbBox);
m_box->thumbBox()->setVisible(visibleThumbBox);
m_box->thumbEnabled()->setSelected(docPref.thumbnails.enabled());
m_box->thumbOverlayEnabled()->setSelected(docPref.thumbnails.overlayEnabled());
m_box->thumbOverlaySize()->setValue(docPref.thumbnails.overlaySize());
gfx::Rect prevBounds = bounds();
setBounds(gfx::Rect(gfx::Point(bounds().x, bounds().y), sizeHint()));
manager()->invalidateRect(prevBounds);
invalidate();
}
bool ConfigureTimelinePopup::onProcessMessage(ui::Message* msg)
@ -227,6 +242,14 @@ void ConfigureTimelinePopup::onZoomChange()
docPref().thumbnails.zoom(m_box->zoom()->getValue());
}
void ConfigureTimelinePopup::onThumbBoxChange()
{
auto& option = Preferences::instance().thumbnails.visibleOptions;
option(!option());
updateWidgetsFromCurrentSettings();
}
void ConfigureTimelinePopup::onThumbEnabledChange()
{
docPref().thumbnails.enabled(m_box->thumbEnabled()->isSelected());

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2001-2016 David Capello
// Copyright (C) 2001-2017 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -43,6 +43,7 @@ namespace app {
void onPositionChange();
void onZoomChange();
void onThumbBoxChange();
void onThumbEnabledChange();
void onThumbOverlayEnabledChange();
void onThumbOverlaySizeChange();

View File

@ -1,5 +1,5 @@
// Aseprite Code Generator
// Copyright (c) 2014-2016 David Capello
// Copyright (c) 2014-2017 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
@ -71,6 +71,7 @@ static std::string convert_type(const std::string& name)
if (name == "popupwindow") return "ui::PopupWindow";
if (name == "radio") return "ui::RadioButton";
if (name == "search") return "app::SearchEntry";
if (name == "separator") return "ui::Separator";
if (name == "slider") return "ui::Slider";
if (name == "splitter") return "ui::Splitter";
if (name == "tipwindow") return "ui::TipWindow";