Minor changes in CelPropertiesCommand (remove buf[] local variable using Widget::setTextf).

This commit is contained in:
David Capello 2011-01-18 19:20:57 -03:00
parent 9fa71e5299
commit ae918802e3

View File

@ -66,7 +66,6 @@ void CelPropertiesCommand::onExecute(Context* context)
JWidget label_frame, label_pos, label_size; JWidget label_frame, label_pos, label_size;
Widget* button_ok; Widget* button_ok;
Slider* slider_opacity; Slider* slider_opacity;
char buf[1024];
int memsize; int memsize;
const CurrentSpriteReader sprite(context); const CurrentSpriteReader sprite(context);
@ -92,28 +91,24 @@ void CelPropertiesCommand::onExecute(Context* context)
button_ok->setEnabled(false); button_ok->setEnabled(false);
} }
usprintf(buf, "%d/%d", sprite->getCurrentFrame()+1, sprite->getTotalFrames()); label_frame->setTextf("%d/%d", sprite->getCurrentFrame()+1, sprite->getTotalFrames());
label_frame->setText(buf);
if (cel != NULL) { if (cel != NULL) {
/* position */ // Position
usprintf(buf, "%d, %d", cel->x, cel->y); label_pos->setTextf("%d, %d", cel->x, cel->y);
label_pos->setText(buf);
/* dimension (and memory size) */ // Dimension (and memory size)
memsize = memsize =
image_line_size(sprite->getStock()->getImage(cel->image), image_line_size(sprite->getStock()->getImage(cel->image),
sprite->getStock()->getImage(cel->image)->w)* sprite->getStock()->getImage(cel->image)->w)*
sprite->getStock()->getImage(cel->image)->h; sprite->getStock()->getImage(cel->image)->h;
usprintf(buf, "%dx%d (%s)", label_size->setTextf("%dx%d (%s)",
sprite->getStock()->getImage(cel->image)->w, sprite->getStock()->getImage(cel->image)->w,
sprite->getStock()->getImage(cel->image)->h, sprite->getStock()->getImage(cel->image)->h,
get_pretty_memory_size(memsize).c_str()); get_pretty_memory_size(memsize).c_str());
label_size->setText(buf); // Opacity
/* opacity */
slider_opacity->setValue(cel->opacity); slider_opacity->setValue(cel->opacity);
if (layer->is_background()) { if (layer->is_background()) {
slider_opacity->setEnabled(false); slider_opacity->setEnabled(false);