Use generated FrameProperties widget in FramePropertiesCommand

This commit is contained in:
David Capello 2015-02-19 20:29:48 -03:00
parent adf3e6c00d
commit 4376647fcd
2 changed files with 15 additions and 16 deletions

View File

@ -1,7 +1,8 @@
<!-- ASEPRITE -->
<!-- Copyright (C) 2001-2013 by David Capello -->
<?xml version="1.0" encoding="utf-8"?>
<!-- Aseprite -->
<!-- Copyright (C) 2001-2015 by David Capello -->
<gui>
<window text="Frame Duration" id="frame_duration">
<window text="Frame Properties" id="frame_properties">
<grid columns="3">
<label text="Frame number:" />
<label text="" id="frame" />

View File

@ -23,6 +23,8 @@
#include "doc/sprite.h"
#include "ui/ui.h"
#include "generated_frame_properties.h"
namespace app {
using namespace ui;
@ -82,13 +84,9 @@ void FramePropertiesCommand::onExecute(Context* context)
const ContextReader reader(context);
const Sprite* sprite = reader.sprite();
base::UniquePtr<Window> window(app::load_widget<Window>("frame_duration.xml", "frame_duration"));
Widget* frame = app::find_widget<Widget>(window, "frame");
Widget* frlen = app::find_widget<Widget>(window, "frlen");
Widget* ok = app::find_widget<Widget>(window, "ok");
frame_t firstFrame(0);
frame_t lastFrame(0);
app::gen::FrameProperties window;
frame_t firstFrame = 0;
frame_t lastFrame = 0;
switch (m_target) {
@ -115,15 +113,15 @@ void FramePropertiesCommand::onExecute(Context* context)
}
if (firstFrame != lastFrame)
frame->setTextf("[%d...%d]", (int)firstFrame+1, (int)lastFrame+1);
window.frame()->setTextf("[%d...%d]", (int)firstFrame+1, (int)lastFrame+1);
else
frame->setTextf("%d", (int)firstFrame+1);
window.frame()->setTextf("%d", (int)firstFrame+1);
frlen->setTextf("%d", sprite->frameDuration(firstFrame));
window.frlen()->setTextf("%d", sprite->frameDuration(firstFrame));
window->openWindowInForeground();
if (window->getKiller() == ok) {
int num = frlen->getTextInt();
window.openWindowInForeground();
if (window.getKiller() == window.ok()) {
int num = window.frlen()->getTextInt();
ContextWriter writer(reader);
Transaction transaction(writer.context(), "Frame Duration");