From a56dff5515ddf34ec644b645e44cac18a0343f33 Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 29 Dec 2016 09:42:44 -0300 Subject: [PATCH] Don't ignore "first frame" in tag properties dialog (fix #1350) --- src/app/ui/frame_tag_window.cpp | 14 +++++++++----- src/app/ui/frame_tag_window.h | 7 ++++--- src/doc/sprite.h | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/app/ui/frame_tag_window.cpp b/src/app/ui/frame_tag_window.cpp index 589634ffb..5b73a69d9 100644 --- a/src/app/ui/frame_tag_window.cpp +++ b/src/app/ui/frame_tag_window.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2001-2015 David Capello +// Copyright (C) 2001-2016 David Capello // // This program is distributed under the terms of // the End-User License Agreement for Aseprite. @@ -10,6 +10,8 @@ #include "app/ui/frame_tag_window.h" +#include "app/document.h" +#include "app/pref/preferences.h" #include "doc/frame_tag.h" #include "doc/sprite.h" @@ -17,10 +19,12 @@ namespace app { FrameTagWindow::FrameTagWindow(const doc::Sprite* sprite, const doc::FrameTag* frameTag) : m_sprite(sprite) + , m_base(Preferences::instance().document( + static_cast(sprite->document())).timeline.firstFrame()) { name()->setText(frameTag->name()); - from()->setTextf("%d", frameTag->fromFrame()+1); - to()->setTextf("%d", frameTag->toFrame()+1); + from()->setTextf("%d", frameTag->fromFrame()+m_base); + to()->setTextf("%d", frameTag->toFrame()+m_base); color()->setColor(app::Color::fromRgb( doc::rgba_getr(frameTag->color()), doc::rgba_getg(frameTag->color()), @@ -52,8 +56,8 @@ void FrameTagWindow::rangeValue(doc::frame_t& from, doc::frame_t& to) doc::frame_t first = 0; doc::frame_t last = m_sprite->lastFrame(); - from = this->from()->textInt()-1; - to = this->to()->textInt()-1; + from = this->from()->textInt()-m_base; + to = this->to()->textInt()-m_base; from = MID(first, from, last); to = MID(from, to, last); } diff --git a/src/app/ui/frame_tag_window.h b/src/app/ui/frame_tag_window.h index 6b5da3386..a66f21d90 100644 --- a/src/app/ui/frame_tag_window.h +++ b/src/app/ui/frame_tag_window.h @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2001-2015 David Capello +// Copyright (C) 2001-2016 David Capello // // This program is distributed under the terms of // the End-User License Agreement for Aseprite. @@ -36,8 +36,9 @@ namespace app { doc::color_t colorValue(); doc::AniDir aniDirValue(); - private: - const doc::Sprite* m_sprite; + private: + const doc::Sprite* m_sprite; + int m_base; }; } diff --git a/src/doc/sprite.h b/src/doc/sprite.h index e54965c60..0acf579ec 100644 --- a/src/doc/sprite.h +++ b/src/doc/sprite.h @@ -58,7 +58,7 @@ namespace doc { //////////////////////////////////////// // Main properties - Document* document() { return m_document; } + Document* document() const { return m_document; } void setDocument(Document* doc) { m_document = doc; } PixelFormat pixelFormat() const { return m_format; }