From 9684672f5fe9f66e73ba617c77807821fd8dc9cf Mon Sep 17 00:00:00 2001 From: David Capello Date: Sat, 7 Jan 2012 16:35:04 -0300 Subject: [PATCH] Improve status bar text when the user is scaling/rotating the selection. --- src/widgets/editor/moving_pixels_state.cpp | 7 ++++++- src/widgets/editor/pixels_movement.cpp | 5 +++++ src/widgets/editor/pixels_movement.h | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/widgets/editor/moving_pixels_state.cpp b/src/widgets/editor/moving_pixels_state.cpp index ac5f9feef..fcfd6fcc1 100644 --- a/src/widgets/editor/moving_pixels_state.cpp +++ b/src/widgets/editor/moving_pixels_state.cpp @@ -263,11 +263,16 @@ bool MovingPixelsState::onUpdateStatusBar(Editor* editor) ASSERT(m_pixelsMovement != NULL); const gfx::Transformation& transform(getTransformation(editor)); + Document* document = editor->getDocument(); + gfx::Size imageSize = m_pixelsMovement->getInitialImageSize(); app_get_statusbar()->setStatusText - (100, "Pos %d %d, Size %d %d, Angle %.1f", + (100, "Pos %d %d, Size %d %d, Orig: %3d %3d (%.02f%% %.02f%%), Angle %.1f", transform.bounds().x, transform.bounds().y, transform.bounds().w, transform.bounds().h, + imageSize.w, imageSize.h, + (double)transform.bounds().w*100.0/imageSize.w, + (double)transform.bounds().h*100.0/imageSize.h, 180.0 * transform.angle() / PI); return true; diff --git a/src/widgets/editor/pixels_movement.cpp b/src/widgets/editor/pixels_movement.cpp index 427e92822..75b11db16 100644 --- a/src/widgets/editor/pixels_movement.cpp +++ b/src/widgets/editor/pixels_movement.cpp @@ -379,6 +379,11 @@ gfx::Rect PixelsMovement::getImageBounds() return gfx::Rect(cel->getX(), cel->getY(), image->w, image->h); } +gfx::Size PixelsMovement::getInitialImageSize() const +{ + return m_initialData.bounds().getSize(); +} + void PixelsMovement::setMaskColor(uint32_t mask_color) { { diff --git a/src/widgets/editor/pixels_movement.h b/src/widgets/editor/pixels_movement.h index bd9d15c43..ce952fe14 100644 --- a/src/widgets/editor/pixels_movement.h +++ b/src/widgets/editor/pixels_movement.h @@ -22,6 +22,7 @@ #include "document_wrappers.h" #include "undo_transaction.h" #include "widgets/editor/handle_type.h" +#include "gfx/size.h" class Document; class Image; @@ -60,6 +61,7 @@ public: bool isDragging() const; gfx::Rect getImageBounds(); + gfx::Size getInitialImageSize() const; void setMaskColor(uint32_t mask_color);