Add aspect ratio on status bar (fix #1769)

This commit is contained in:
Gaspar Capello 2019-01-09 16:34:54 -03:00 committed by David Capello
parent e9e28dce19
commit 3dc76d08c4
5 changed files with 21 additions and 9 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -401,6 +401,7 @@
<part id="aseprite_face" x="0" y="272" w="28" h="30" /> <part id="aseprite_face" x="0" y="272" w="28" h="30" />
<part id="aseprite_face_mouse" x="28" y="272" w="28" h="30" /> <part id="aseprite_face_mouse" x="28" y="272" w="28" h="30" />
<part id="aseprite_face_pushed" x="56" y="272" w="28" h="30" /> <part id="aseprite_face_pushed" x="56" y="272" w="28" h="30" />
<part id="icon_aspect_ratio" x="256" y="264" w="10" h="8" />
</parts> </parts>
<styles> <styles>
<style id="box" /> <style id="box" />

2
laf

@ -1 +1 @@
Subproject commit de720940ce9548780ae083049fa5a2c191299a75 Subproject commit 44881e93cdae685fa630fec1ee2cd5809f69d30e

View File

@ -1,9 +1,11 @@
// Aseprite // Aseprite
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello // Copyright (C) 2001-2018 David Capello
// //
// This program is distributed under the terms of // This program is distributed under the terms of
// the End-User License Agreement for Aseprite. // the End-User License Agreement for Aseprite.
#include "base/gcd.h"
#include "base/pi.h" #include "base/pi.h"
#include <cmath> #include <cmath>
@ -237,10 +239,12 @@ public:
gfx::Point offset = loop->statusBarPositionOffset(); gfx::Point offset = loop->statusBarPositionOffset();
char buf[1024]; char buf[1024];
sprintf(buf, ":start: %3d %3d :end: %3d %3d :size: %3d %3d :distance: %.1f", int gcd = base::gcd(w, h);
sprintf(buf, ":start: %3d %3d :end: %3d %3d :size: %3d %3d :distance: %.1f :aspect_ratio: %2d : %2d",
stroke[0].x+offset.x, stroke[0].y+offset.y, stroke[0].x+offset.x, stroke[0].y+offset.y,
stroke[1].x+offset.x, stroke[1].y+offset.y, stroke[1].x+offset.x, stroke[1].y+offset.y,
w, h, std::sqrt(w*w + h*h)); w, h, std::sqrt(w*w + h*h),
w/gcd, h/gcd);
if (hasAngle() || if (hasAngle() ||
loop->getIntertwine()->snapByAngle()) { loop->getIntertwine()->snapByAngle()) {

View File

@ -1,4 +1,5 @@
// Aseprite // Aseprite
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello // Copyright (C) 2001-2018 David Capello
// //
// This program is distributed under the terms of // This program is distributed under the terms of
@ -34,6 +35,7 @@
#include "app/ui_context.h" #include "app/ui_context.h"
#include "app/util/clipboard.h" #include "app/util/clipboard.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/gcd.h"
#include "base/pi.h" #include "base/pi.h"
#include "doc/algorithm/flip_image.h" #include "doc/algorithm/flip_image.h"
#include "doc/mask.h" #include "doc/mask.h"
@ -457,17 +459,22 @@ bool MovingPixelsState::onUpdateStatusBar(Editor* editor)
const Transformation& transform(getTransformation(editor)); const Transformation& transform(getTransformation(editor));
gfx::Size imageSize = m_pixelsMovement->getInitialImageSize(); gfx::Size imageSize = m_pixelsMovement->getInitialImageSize();
int w = int(transform.bounds().w);
int h = int(transform.bounds().h);
int gcd = base::gcd(w, h);
StatusBar::instance()->setStatusText StatusBar::instance()->setStatusText
(100, ":pos: %d %d :size: %3d %3d :selsize: %d %d [%.02f%% %.02f%%] :angle: %.1f", (100, ":pos: %d %d :size: %3d %3d :selsize: %d %d [%.02f%% %.02f%%] :angle: %.1f :aspect_ratio: %2d : %2d",
int(transform.bounds().x), int(transform.bounds().x),
int(transform.bounds().y), int(transform.bounds().y),
imageSize.w, imageSize.w,
imageSize.h, imageSize.h,
int(transform.bounds().w), w,
int(transform.bounds().h), h,
(double)transform.bounds().w*100.0/imageSize.w, (double)w*100.0/imageSize.w,
(double)transform.bounds().h*100.0/imageSize.h, (double)h*100.0/imageSize.h,
180.0 * transform.angle() / PI); 180.0 * transform.angle() / PI,
w/gcd,
h/gcd);
return true; return true;
} }