setting to change timeline zoom

This commit is contained in:
Carlo 'zED' Caputo 2016-08-04 03:02:44 -03:00 committed by Carlo "zED" Caputo
parent 1d51ceec20
commit 30feffab8d
6 changed files with 22 additions and 2 deletions

View File

@ -257,6 +257,7 @@
<option id="color2" type="app::Color" default="app::Color::fromRgb(192, 192, 192)" migrate="Option.CheckedBgColor2" />
</section>
<section id="thumbnails">
<option id="zoom" type="double" default="1" />
<option id="enabled" type="bool" default="false" />
<option id="overlay_enabled" type="bool" default="false" />
<option id="overlay_size" type="int" default="5" />

View File

@ -4,6 +4,9 @@
<vbox id="timeline_conf">
<separator cell_hspan="2" text="Thumbnails:" left="true" horizontal="true" />
<grid columns="3">
<label text="Zoom:" />
<slider min="10" max="100" id="zoom" cell_align="horizontal" width="128" cell_hspan="2" />
<check id="thumb_enabled" text="Enabled" />
<label text="Opacity:" />
<slider min="0" max="255" id="thumb_opacity" cell_align="horizontal" width="128" />

View File

@ -62,6 +62,7 @@ ConfigureTimelinePopup::ConfigureTimelinePopup()
m_box->behind()->Click.connect(base::Bind<void>(&ConfigureTimelinePopup::onPositionChange, this));
m_box->infront()->Click.connect(base::Bind<void>(&ConfigureTimelinePopup::onPositionChange, this));
m_box->zoom()->Change.connect(base::Bind<void>(&ConfigureTimelinePopup::onZoomChange, this));
m_box->thumbOpacity()->Change.connect(base::Bind<void>(&ConfigureTimelinePopup::onThumbOpacityChange, this));
m_box->thumbBackground()->Change.connect(&ConfigureTimelinePopup::onThumbBackgroundChange, this);
m_box->thumbEnabled()->Click.connect(base::Bind<void>(&ConfigureTimelinePopup::onThumbEnabledChange, this));
@ -133,6 +134,7 @@ void ConfigureTimelinePopup::updateWidgetsFromCurrentSettings()
break;
}
m_box->zoom()->setValue(docPref.thumbnails.zoom() * 10.0);
m_box->thumbOpacity()->setValue(docPref.thumbnails.opacity());
m_box->thumbBackground()->setColor(docPref.thumbnails.background());
m_box->thumbEnabled()->setSelected(docPref.thumbnails.enabled());
@ -209,6 +211,11 @@ void ConfigureTimelinePopup::onPositionChange()
render::OnionskinPosition::INFRONT);
}
void ConfigureTimelinePopup::onZoomChange()
{
docPref().thumbnails.zoom(m_box->zoom()->getValue()/10.0);
}
void ConfigureTimelinePopup::onThumbOpacityChange()
{
docPref().thumbnails.opacity(m_box->thumbOpacity()->getValue());

View File

@ -41,6 +41,7 @@ namespace app {
void onCurrentLayerChange();
void onPositionChange();
void onZoomChange();
void onThumbOpacityChange();
void onThumbQualityChange();
void onThumbBackgroundChange(const app::Color& color);

View File

@ -150,8 +150,14 @@ Timeline::~Timeline()
delete m_confPopup;
}
void Timeline::setZoom(double zoom)
{
m_zoom = MID(1.0, zoom, 10.0);
}
void Timeline::onThumbnailsPrefChange()
{
setZoom(docPref().thumbnails.zoom());
invalidate();
}
@ -187,6 +193,8 @@ void Timeline::updateUsingEditor(Editor* editor)
m_thumbnailsPrefConn = docPref.thumbnails.AfterChange.connect(
base::Bind<void>(&Timeline::onThumbnailsPrefChange, this));
setZoom(docPref.thumbnails.zoom());
// If we are already in the same position as the "editor", we don't
// need to update the at all timeline.
if (m_document == site.document() &&
@ -893,8 +901,7 @@ bool Timeline::onProcessMessage(Message* msg)
break;
case kTouchMagnifyMessage:
m_zoom = m_zoom + m_zoom * static_cast<ui::TouchMessage*>(msg)->magnification();
m_zoom = MID(1.0, m_zoom, 10.0);
setZoom(m_zoom + m_zoom * static_cast<ui::TouchMessage*>(msg)->magnification());
invalidate();
break;
}

View File

@ -265,6 +265,7 @@ namespace app {
void updateCelOverlayBounds(const Hit& hit);
void drawCelOverlay(ui::Graphics* g);
void onThumbnailsPrefChange();
void setZoom(double zoom);
ui::ScrollBar m_hbar;
ui::ScrollBar m_vbar;