Don't ignore "first frame" in tag properties dialog (fix #1350)

This commit is contained in:
David Capello 2016-12-29 09:42:44 -03:00
parent 8a5c3e49a3
commit a56dff5515
3 changed files with 14 additions and 9 deletions

View File

@ -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<app::Document*>(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);
}

View File

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

View File

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