mirror of
https://github.com/aseprite/aseprite.git
synced 2024-09-02 13:09:27 +00:00
Merge branch 'main' into beta
This commit is contained in:
commit
1912053f33
Binary file not shown.
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
@ -386,6 +386,8 @@
|
|||||||
<part id="icon_save" x="232" y="264" w="8" h="8" />
|
<part id="icon_save" x="232" y="264" w="8" h="8" />
|
||||||
<part id="icon_save_small" x="240" y="264" w="8" h="8" />
|
<part id="icon_save_small" x="240" y="264" w="8" h="8" />
|
||||||
<part id="icon_slice" x="248" y="264" w="8" h="8" />
|
<part id="icon_slice" x="248" y="264" w="8" h="8" />
|
||||||
|
<part id="icon_aspect_ratio" x="256" y="264" w="10" h="8" />
|
||||||
|
<part id="icon_delta" x="266" y="264" w="6" h="8" />
|
||||||
<part id="tool_rectangular_marquee" x="144" y="0" w="16" h="16" />
|
<part id="tool_rectangular_marquee" x="144" y="0" w="16" h="16" />
|
||||||
<part id="tool_elliptical_marquee" x="160" y="0" w="16" h="16" />
|
<part id="tool_elliptical_marquee" x="160" y="0" w="16" h="16" />
|
||||||
<part id="tool_lasso" x="176" y="0" w="16" h="16" />
|
<part id="tool_lasso" x="176" y="0" w="16" h="16" />
|
||||||
@ -418,7 +420,6 @@
|
|||||||
<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" />
|
|
||||||
<part id="linear_gradient" x="176" y="208" w="8" h="8" />
|
<part id="linear_gradient" x="176" y="208" w="8" h="8" />
|
||||||
<part id="radial_gradient" x="184" y="208" w="8" h="8" />
|
<part id="radial_gradient" x="184" y="208" w="8" h="8" />
|
||||||
<part id="folder_icon_small" x="144" y="272" w="10" h="8" />
|
<part id="folder_icon_small" x="144" y="272" w="10" h="8" />
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
@ -382,6 +382,8 @@
|
|||||||
<part id="icon_save" x="232" y="264" w="8" h="8" />
|
<part id="icon_save" x="232" y="264" w="8" h="8" />
|
||||||
<part id="icon_save_small" x="240" y="264" w="8" h="8" />
|
<part id="icon_save_small" x="240" y="264" w="8" h="8" />
|
||||||
<part id="icon_slice" x="248" y="264" w="8" h="8" />
|
<part id="icon_slice" x="248" y="264" w="8" h="8" />
|
||||||
|
<part id="icon_aspect_ratio" x="256" y="264" w="10" h="8" />
|
||||||
|
<part id="icon_delta" x="266" y="264" w="6" h="8" />
|
||||||
<part id="tool_rectangular_marquee" x="144" y="0" w="16" h="16" />
|
<part id="tool_rectangular_marquee" x="144" y="0" w="16" h="16" />
|
||||||
<part id="tool_elliptical_marquee" x="160" y="0" w="16" h="16" />
|
<part id="tool_elliptical_marquee" x="160" y="0" w="16" h="16" />
|
||||||
<part id="tool_lasso" x="176" y="0" w="16" h="16" />
|
<part id="tool_lasso" x="176" y="0" w="16" h="16" />
|
||||||
@ -414,7 +416,6 @@
|
|||||||
<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" />
|
|
||||||
<part id="linear_gradient" x="176" y="208" w="8" h="8" />
|
<part id="linear_gradient" x="176" y="208" w="8" h="8" />
|
||||||
<part id="radial_gradient" x="184" y="208" w="8" h="8" />
|
<part id="radial_gradient" x="184" y="208" w="8" h="8" />
|
||||||
<part id="folder_icon_small" x="144" y="272" w="10" h="8" />
|
<part id="folder_icon_small" x="144" y="272" w="10" h="8" />
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2020-2021 Igara Studio S.A.
|
// Copyright (C) 2020-2022 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2016 David Capello
|
// Copyright (C) 2001-2016 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -437,9 +437,9 @@ void AppBrushes::save(const std::string& filename) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (slot.brush()->type() == kImageBrushType &&
|
if (slot.brush()->type() == kImageBrushType &&
|
||||||
slot.brush()->image()) {
|
slot.brush()->originalImage()) {
|
||||||
TiXmlElement elem("image");
|
TiXmlElement elem("image");
|
||||||
save_xml_image(&elem, slot.brush()->image());
|
save_xml_image(&elem, slot.brush()->originalImage());
|
||||||
brushElem.InsertEndChild(elem);
|
brushElem.InsertEndChild(elem);
|
||||||
|
|
||||||
if (slot.brush()->maskBitmap()) {
|
if (slot.brush()->maskBitmap()) {
|
||||||
|
@ -113,7 +113,7 @@ public:
|
|||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
|
|
||||||
case ui::kMouseMoveMessage:
|
case ui::kMouseMoveMessage:
|
||||||
if (hasCapture()) {
|
if (hasCapture() && m_undoHistory) {
|
||||||
auto mouseMsg = static_cast<ui::MouseMessage*>(msg);
|
auto mouseMsg = static_cast<ui::MouseMessage*>(msg);
|
||||||
const gfx::Rect bounds = this->bounds();
|
const gfx::Rect bounds = this->bounds();
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2019-2020 Igara Studio S.A.
|
// Copyright (C) 2019-2022 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
|
||||||
@ -94,7 +94,7 @@ 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",
|
sprintf(buf, ":start: %d %d :end: %d %d",
|
||||||
stroke.firstPoint().x+offset.x,
|
stroke.firstPoint().x+offset.x,
|
||||||
stroke.firstPoint().y+offset.y,
|
stroke.firstPoint().y+offset.y,
|
||||||
stroke.lastPoint().x+offset.x,
|
stroke.lastPoint().x+offset.x,
|
||||||
@ -259,7 +259,7 @@ public:
|
|||||||
gfx::Point offset = loop->statusBarPositionOffset();
|
gfx::Point offset = loop->statusBarPositionOffset();
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
int gcd = base::gcd(w, h);
|
int gcd = base::gcd(w, h);
|
||||||
sprintf(buf, ":start: %3d %3d :end: %3d %3d :size: %3d %3d :distance: %.1f",
|
sprintf(buf, ":start: %d %d :end: %d %d :size: %d %d :distance: %.1f",
|
||||||
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));
|
||||||
@ -362,7 +362,7 @@ 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",
|
sprintf(buf, ":start: %d %d :end: %d %d",
|
||||||
stroke.firstPoint().x+offset.x,
|
stroke.firstPoint().x+offset.x,
|
||||||
stroke.firstPoint().y+offset.y,
|
stroke.firstPoint().y+offset.y,
|
||||||
stroke.lastPoint().x+offset.x,
|
stroke.lastPoint().x+offset.x,
|
||||||
@ -402,7 +402,7 @@ public:
|
|||||||
|
|
||||||
gfx::Point offset = loop->statusBarPositionOffset();
|
gfx::Point offset = loop->statusBarPositionOffset();
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
sprintf(buf, ":pos: %3d %3d",
|
sprintf(buf, ":pos: %d %d",
|
||||||
stroke[0].x+offset.x,
|
stroke[0].x+offset.x,
|
||||||
stroke[0].y+offset.y);
|
stroke[0].y+offset.y);
|
||||||
text = buf;
|
text = buf;
|
||||||
@ -460,7 +460,7 @@ 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 (%3d %3d - %3d %3d)",
|
sprintf(buf, ":start: %d %d :end: %d %d (%d %d - %d %d)",
|
||||||
stroke[0].x+offset.x, stroke[0].y+offset.y,
|
stroke[0].x+offset.x, stroke[0].y+offset.y,
|
||||||
stroke[3].x+offset.x, stroke[3].y+offset.y,
|
stroke[3].x+offset.x, stroke[3].y+offset.y,
|
||||||
stroke[1].x+offset.x, stroke[1].y+offset.y,
|
stroke[1].x+offset.x, stroke[1].y+offset.y,
|
||||||
|
@ -81,7 +81,9 @@ public:
|
|||||||
, m_slot(slot) {
|
, m_slot(slot) {
|
||||||
if (m_brush.hasBrush()) {
|
if (m_brush.hasBrush()) {
|
||||||
SkinPartPtr icon(new SkinPart);
|
SkinPartPtr icon(new SkinPart);
|
||||||
icon->setBitmap(0, BrushPopup::createSurfaceForBrush(m_brush.brush()));
|
icon->setBitmap(0, BrushPopup::createSurfaceForBrush(
|
||||||
|
m_brush.brush(),
|
||||||
|
m_brush.hasFlag(BrushSlot::Flags::ImageColor)));
|
||||||
setIcon(icon);
|
setIcon(icon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -453,7 +455,8 @@ void BrushPopup::onBrushChanges()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
os::SurfaceRef BrushPopup::createSurfaceForBrush(const BrushRef& origBrush)
|
os::SurfaceRef BrushPopup::createSurfaceForBrush(const BrushRef& origBrush,
|
||||||
|
const bool useOriginalImage)
|
||||||
{
|
{
|
||||||
Image* image = nullptr;
|
Image* image = nullptr;
|
||||||
BrushRef brush = origBrush;
|
BrushRef brush = origBrush;
|
||||||
@ -462,7 +465,12 @@ os::SurfaceRef BrushPopup::createSurfaceForBrush(const BrushRef& origBrush)
|
|||||||
brush.reset(new Brush(*brush));
|
brush.reset(new Brush(*brush));
|
||||||
brush->setSize(10);
|
brush->setSize(10);
|
||||||
}
|
}
|
||||||
image = brush->image();
|
// Show the original image in the popup (without the image colors
|
||||||
|
// modified if there were some modification).
|
||||||
|
if (useOriginalImage)
|
||||||
|
image = brush->originalImage();
|
||||||
|
else
|
||||||
|
image = brush->image();
|
||||||
}
|
}
|
||||||
|
|
||||||
os::SurfaceRef surface = os::instance()->makeRgbaSurface(
|
os::SurfaceRef surface = os::instance()->makeRgbaSurface(
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018-2021 Igara Studio S.A.
|
// Copyright (C) 2018-2022 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2015 David Capello
|
// Copyright (C) 2001-2015 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -24,7 +24,8 @@ namespace app {
|
|||||||
void regenerate(ui::Display* display,
|
void regenerate(ui::Display* display,
|
||||||
const gfx::Point& pos);
|
const gfx::Point& pos);
|
||||||
|
|
||||||
static os::SurfaceRef createSurfaceForBrush(const doc::BrushRef& brush);
|
static os::SurfaceRef createSurfaceForBrush(const doc::BrushRef& brush,
|
||||||
|
const bool useOriginalImage = false);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void onStandardBrush();
|
void onStandardBrush();
|
||||||
|
@ -142,7 +142,7 @@ bool ColorButton::onProcessMessage(Message* msg)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case kMouseEnterMessage:
|
case kMouseEnterMessage:
|
||||||
StatusBar::instance()->showColor(0, "", m_color);
|
StatusBar::instance()->showColor(0, m_color);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kMouseLeaveMessage:
|
case kMouseLeaveMessage:
|
||||||
|
@ -334,7 +334,7 @@ bool ColorSelector::onProcessMessage(ui::Message* msg)
|
|||||||
if (color != app::Color::fromMask()) {
|
if (color != app::Color::fromMask()) {
|
||||||
base::ScopedValue<bool> switcher(m_lockColor, subColorPicked(), false);
|
base::ScopedValue<bool> switcher(m_lockColor, subColorPicked(), false);
|
||||||
|
|
||||||
StatusBar::instance()->showColor(0, "", color);
|
StatusBar::instance()->showColor(0, color);
|
||||||
if (hasCapture())
|
if (hasCapture())
|
||||||
ColorChange(color, mouseMsg->button());
|
ColorChange(color, mouseMsg->button());
|
||||||
}
|
}
|
||||||
|
@ -2220,6 +2220,11 @@ void ContextBar::setActiveBrushBySlot(tools::Tool* tool, int slot)
|
|||||||
|
|
||||||
if (brush.brush()) {
|
if (brush.brush()) {
|
||||||
if (brush.brush()->type() == doc::kImageBrushType) {
|
if (brush.brush()->type() == doc::kImageBrushType) {
|
||||||
|
// Reset the colors of the image when we select the brush from
|
||||||
|
// the slot.
|
||||||
|
if (brush.hasFlag(BrushSlot::Flags::ImageColor))
|
||||||
|
brush.brush()->resetImageColors();
|
||||||
|
|
||||||
setActiveBrush(brush.brush());
|
setActiveBrush(brush.brush());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -2971,6 +2971,7 @@ void Editor::updateAutoCelGuides(ui::Message* msg)
|
|||||||
if (m_showGuidesThisCel != oldShowGuidesThisCel ||
|
if (m_showGuidesThisCel != oldShowGuidesThisCel ||
|
||||||
m_showAutoCelGuides != oldShowAutoCelGuides) {
|
m_showAutoCelGuides != oldShowAutoCelGuides) {
|
||||||
invalidate();
|
invalidate();
|
||||||
|
updateStatusBar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,6 +317,9 @@ namespace app {
|
|||||||
// key is pressed to cancel the active selection.
|
// key is pressed to cancel the active selection.
|
||||||
void cancelSelections();
|
void cancelSelections();
|
||||||
|
|
||||||
|
// Properties to show information in the status bar
|
||||||
|
bool showAutoCelGuides() const { return m_showAutoCelGuides; }
|
||||||
|
|
||||||
static void registerCommands();
|
static void registerCommands();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -389,7 +392,6 @@ namespace app {
|
|||||||
|
|
||||||
void invalidateCanvas();
|
void invalidateCanvas();
|
||||||
void invalidateIfActive();
|
void invalidateIfActive();
|
||||||
bool showAutoCelGuides();
|
|
||||||
void updateAutoCelGuides(ui::Message* msg);
|
void updateAutoCelGuides(ui::Message* msg);
|
||||||
|
|
||||||
// Stack of states. The top element in the stack is the current state (m_state).
|
// Stack of states. The top element in the stack is the current state (m_state).
|
||||||
|
@ -97,8 +97,12 @@ MovingCelState::MovingCelState(Editor* editor,
|
|||||||
ASSERT(!m_celList.empty());
|
ASSERT(!m_celList.empty());
|
||||||
|
|
||||||
m_cel = collect.mainCel();
|
m_cel = collect.mainCel();
|
||||||
if (m_cel)
|
if (m_cel) {
|
||||||
m_celMainSize = m_cel->boundsF().size();
|
if (m_cel->data()->hasBoundsF())
|
||||||
|
m_celMainSize = m_cel->boundsF().size();
|
||||||
|
else
|
||||||
|
m_celMainSize = gfx::SizeF(m_cel->bounds().size());
|
||||||
|
}
|
||||||
|
|
||||||
// Record start positions of all cels in selected range
|
// Record start positions of all cels in selected range
|
||||||
for (Cel* cel : m_celList) {
|
for (Cel* cel : m_celList) {
|
||||||
@ -282,6 +286,11 @@ void MovingCelState::onCommitMouseMove(Editor* editor,
|
|||||||
|
|
||||||
// Redraw the new cel position.
|
// Redraw the new cel position.
|
||||||
editor->invalidate();
|
editor->invalidate();
|
||||||
|
|
||||||
|
// Redraw status bar with the new position of cels (without this the
|
||||||
|
// previous position before this onCommitMouseMove() is still
|
||||||
|
// displayed in the screen).
|
||||||
|
editor->updateStatusBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MovingCelState::onKeyDown(Editor* editor, KeyMessage* msg)
|
bool MovingCelState::onKeyDown(Editor* editor, KeyMessage* msg)
|
||||||
@ -297,37 +306,46 @@ bool MovingCelState::onKeyDown(Editor* editor, KeyMessage* msg)
|
|||||||
|
|
||||||
bool MovingCelState::onUpdateStatusBar(Editor* editor)
|
bool MovingCelState::onUpdateStatusBar(Editor* editor)
|
||||||
{
|
{
|
||||||
gfx::PointF pos = m_cursorStart - gfx::PointF(editor->mainTilePosition());
|
gfx::PointF pos = m_celOffset + m_cursorStart - gfx::PointF(editor->mainTilePosition());
|
||||||
|
gfx::RectF fullBounds = calcFullBounds();
|
||||||
|
std::string buf;
|
||||||
|
|
||||||
if (m_hasReference) {
|
if (m_hasReference) {
|
||||||
|
buf = fmt::format(":pos: {:.2f} {:.2f}", pos.x, pos.y);
|
||||||
if (m_scaled && m_cel) {
|
if (m_scaled && m_cel) {
|
||||||
StatusBar::instance()->setStatusText(
|
buf += fmt::format(
|
||||||
0,
|
" :start: {:.2f} {:.2f}"
|
||||||
fmt::format(
|
" :size: {:.2f} {:.2f} [{:.2f}% {:.2f}%]",
|
||||||
":pos: {:.2f} {:.2f} :offset: {:.2f} {:.2f} :size: {:.2f}% {:.2f}%",
|
m_cel->boundsF().x,
|
||||||
pos.x, pos.y,
|
m_cel->boundsF().y,
|
||||||
m_celOffset.x, m_celOffset.y,
|
m_celScale.w*m_celMainSize.w,
|
||||||
100.0*m_celScale.w*m_celMainSize.w/m_cel->image()->width(),
|
m_celScale.h*m_celMainSize.h,
|
||||||
100.0*m_celScale.h*m_celMainSize.h/m_cel->image()->height()));
|
100.0*m_celScale.w*m_celMainSize.w/m_cel->image()->width(),
|
||||||
|
100.0*m_celScale.h*m_celMainSize.h/m_cel->image()->height());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
StatusBar::instance()->setStatusText(
|
buf += fmt::format(
|
||||||
0,
|
" :start: {:.2f} {:.2f} :size: {:.2f} {:.2f}"
|
||||||
fmt::format(
|
" :delta: {:.2f} {:.2f}",
|
||||||
":pos: {:.2f} {:.2f} :offset: {:.2f} {:.2f}",
|
fullBounds.x, fullBounds.y,
|
||||||
pos.x, pos.y,
|
fullBounds.w, fullBounds.h,
|
||||||
m_celOffset.x, m_celOffset.y));
|
m_celOffset.x, m_celOffset.y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
gfx::Point intOffset = intCelOffset();
|
gfx::Point intOffset = intCelOffset();
|
||||||
StatusBar::instance()->setStatusText(
|
fullBounds.floor();
|
||||||
0,
|
buf = fmt::format(
|
||||||
fmt::format(":pos: {:3d} {:3d} :offset: {:3d} {:3d}",
|
":pos: {} {}"
|
||||||
int(pos.x), int(pos.y),
|
" :start: {} {} :size: {} {}"
|
||||||
intOffset.x, intOffset.y));
|
" :delta: {} {}",
|
||||||
|
int(pos.x), int(pos.y),
|
||||||
|
int(fullBounds.x), int(fullBounds.y),
|
||||||
|
int(fullBounds.w), int(fullBounds.h),
|
||||||
|
intOffset.x, intOffset.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StatusBar::instance()->setStatusText(0, buf);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,6 +355,18 @@ gfx::Point MovingCelState::intCelOffset() const
|
|||||||
int(std::round(m_celOffset.y)));
|
int(std::round(m_celOffset.y)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gfx::RectF MovingCelState::calcFullBounds() const
|
||||||
|
{
|
||||||
|
gfx::RectF bounds;
|
||||||
|
for (Cel* cel : m_celList) {
|
||||||
|
if (cel->data()->hasBoundsF())
|
||||||
|
bounds |= cel->boundsF();
|
||||||
|
else
|
||||||
|
bounds |= gfx::RectF(cel->bounds()).floor();
|
||||||
|
}
|
||||||
|
return bounds;
|
||||||
|
}
|
||||||
|
|
||||||
bool MovingCelState::restoreCelStartPosition() const
|
bool MovingCelState::restoreCelStartPosition() const
|
||||||
{
|
{
|
||||||
bool modified = false;
|
bool modified = false;
|
||||||
|
@ -57,6 +57,7 @@ namespace app {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
gfx::Point intCelOffset() const;
|
gfx::Point intCelOffset() const;
|
||||||
|
gfx::RectF calcFullBounds() const;
|
||||||
bool restoreCelStartPosition() const;
|
bool restoreCelStartPosition() const;
|
||||||
// ContextObserver
|
// ContextObserver
|
||||||
void onBeforeCommandExecution(CommandExecutionEvent& ev);
|
void onBeforeCommandExecution(CommandExecutionEvent& ev);
|
||||||
|
@ -554,7 +554,11 @@ bool MovingPixelsState::onUpdateStatusBar(Editor* editor)
|
|||||||
StatusBar::instance()->setStatusText(
|
StatusBar::instance()->setStatusText(
|
||||||
100,
|
100,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
":pos: {} {} :size: {:3d} {:3d} :selsize: {} {} [{:.02f}% {:.02f}%] :angle: {:.1f} :aspect_ratio: {}:{}",
|
":pos: {} {}"
|
||||||
|
" :size: {} {}"
|
||||||
|
" :selsize: {} {} [{:.02f}% {:.02f}%]"
|
||||||
|
" :angle: {:.1f}"
|
||||||
|
" :aspect_ratio: {}:{}",
|
||||||
int(transform.bounds().x),
|
int(transform.bounds().x),
|
||||||
int(transform.bounds().y),
|
int(transform.bounds().y),
|
||||||
imageSize.w,
|
imageSize.w,
|
||||||
|
@ -157,7 +157,9 @@ bool MovingSelectionState::onUpdateStatusBar(Editor* editor)
|
|||||||
StatusBar::instance()->setStatusText(
|
StatusBar::instance()->setStatusText(
|
||||||
100,
|
100,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
":pos: {} {} :size: {:3d} {:3d} :offset: {} {}",
|
":pos: {} {}"
|
||||||
|
" :size: {} {}"
|
||||||
|
" :delta: {} {}",
|
||||||
bounds.x, bounds.y,
|
bounds.x, bounds.y,
|
||||||
bounds.w, bounds.h,
|
bounds.w, bounds.h,
|
||||||
m_delta.x, m_delta.y));
|
m_delta.x, m_delta.y));
|
||||||
|
@ -532,14 +532,15 @@ bool StandbyState::onUpdateStatusBar(Editor* editor)
|
|||||||
editor->projection(),
|
editor->projection(),
|
||||||
color, tile);
|
color, tile);
|
||||||
|
|
||||||
auto buf = fmt::format(" :pos: {} {}",
|
std::string buf =
|
||||||
int(std::floor(spritePos.x)),
|
fmt::format(" :pos: {} {}",
|
||||||
int(std::floor(spritePos.y)));
|
int(std::floor(spritePos.x)),
|
||||||
|
int(std::floor(spritePos.y)));
|
||||||
|
|
||||||
if (site.tilemapMode() == TilemapMode::Tiles)
|
if (site.tilemapMode() == TilemapMode::Tiles)
|
||||||
StatusBar::instance()->showTile(0, buf.c_str(), tile);
|
StatusBar::instance()->showTile(0, tile, buf);
|
||||||
else
|
else
|
||||||
StatusBar::instance()->showColor(0, buf.c_str(), color);
|
StatusBar::instance()->showColor(0, color, buf);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Site site = editor->getSite();
|
Site site = editor->getSite();
|
||||||
@ -547,22 +548,37 @@ bool StandbyState::onUpdateStatusBar(Editor* editor)
|
|||||||
(editor->document()->isMaskVisible() ?
|
(editor->document()->isMaskVisible() ?
|
||||||
editor->document()->mask(): NULL);
|
editor->document()->mask(): NULL);
|
||||||
|
|
||||||
char buf[1024];
|
std::string buf = fmt::format(
|
||||||
sprintf(
|
":pos: {} {}",
|
||||||
buf, ":pos: %d %d :size: %d %d",
|
int(std::floor(spritePos.x)),
|
||||||
int(std::floor(spritePos.x)),
|
int(std::floor(spritePos.y)));
|
||||||
int(std::floor(spritePos.y)),
|
|
||||||
sprite->width(),
|
Cel* cel = nullptr;
|
||||||
sprite->height());
|
if (editor->showAutoCelGuides()) {
|
||||||
|
cel = editor->getSite().cel();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cel) {
|
||||||
|
buf += fmt::format(
|
||||||
|
" :start: {} {} :size: {} {}",
|
||||||
|
cel->bounds().x, cel->bounds().y,
|
||||||
|
cel->bounds().w, cel->bounds().h);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
buf += fmt::format(
|
||||||
|
" :size: {} {}",
|
||||||
|
sprite->width(),
|
||||||
|
sprite->height());
|
||||||
|
}
|
||||||
|
|
||||||
if (mask)
|
if (mask)
|
||||||
sprintf(buf+std::strlen(buf), " :selsize: %d %d",
|
buf += fmt::format(" :selsize: {} {}",
|
||||||
mask->bounds().w,
|
mask->bounds().w,
|
||||||
mask->bounds().h);
|
mask->bounds().h);
|
||||||
|
|
||||||
if (sprite->totalFrames() > 1) {
|
if (sprite->totalFrames() > 1) {
|
||||||
sprintf(
|
buf += fmt::format(
|
||||||
buf+std::strlen(buf), " :frame: %d :clock: %s/%s",
|
" :frame: {} :clock: {}/{}",
|
||||||
site.frame()+editor->docPref().timeline.firstFrame(),
|
site.frame()+editor->docPref().timeline.firstFrame(),
|
||||||
human_readable_time(sprite->frameDuration(site.frame())).c_str(),
|
human_readable_time(sprite->frameDuration(site.frame())).c_str(),
|
||||||
human_readable_time(sprite->totalAnimationDuration()).c_str());
|
human_readable_time(sprite->totalAnimationDuration()).c_str());
|
||||||
@ -573,15 +589,14 @@ bool StandbyState::onUpdateStatusBar(Editor* editor)
|
|||||||
doc::Grid grid = site.grid();
|
doc::Grid grid = site.grid();
|
||||||
if (!grid.isEmpty()) {
|
if (!grid.isEmpty()) {
|
||||||
gfx::Point pt = grid.canvasToTile(gfx::Point(spritePos));
|
gfx::Point pt = grid.canvasToTile(gfx::Point(spritePos));
|
||||||
sprintf(buf+std::strlen(buf), " :grid: %d %d", pt.x, pt.y);
|
buf += fmt::format(" :grid: {} {}", pt.x, pt.y);
|
||||||
|
|
||||||
// Show the tile index of this specific tile
|
// Show the tile index of this specific tile
|
||||||
if (site.layer() &&
|
if (site.layer() &&
|
||||||
site.layer()->isTilemap() &&
|
site.layer()->isTilemap() &&
|
||||||
site.image()) {
|
site.image()) {
|
||||||
if (site.image()->bounds().contains(pt)) {
|
if (site.image()->bounds().contains(pt)) {
|
||||||
sprintf(buf+std::strlen(buf), " [%d]",
|
buf += fmt::format(" [{}]", site.image()->getPixel(pt.x, pt.y));
|
||||||
site.image()->getPixel(pt.x, pt.y));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -596,14 +611,11 @@ bool StandbyState::onUpdateStatusBar(Editor* editor)
|
|||||||
int(std::floor(spritePos.x)),
|
int(std::floor(spritePos.x)),
|
||||||
int(std::floor(spritePos.y)))) {
|
int(std::floor(spritePos.y)))) {
|
||||||
if (++count == 3) {
|
if (++count == 3) {
|
||||||
sprintf(
|
buf += fmt::format(" :slice: ...");
|
||||||
buf+std::strlen(buf), " :slice: ...");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(
|
buf += fmt::format(" :slice: {}", slice->name());
|
||||||
buf+std::strlen(buf), " :slice: %s",
|
|
||||||
slice->name().c_str());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ public:
|
|||||||
PaletteViewModification::DRAGANDDROP);
|
PaletteViewModification::DRAGANDDROP);
|
||||||
}
|
}
|
||||||
void showEntryInStatusBar(StatusBar* statusBar, int index) override {
|
void showEntryInStatusBar(StatusBar* statusBar, int index) override {
|
||||||
statusBar->showColor(0, "", app::Color::fromIndex(index));
|
statusBar->showColor(0, app::Color::fromIndex(index));
|
||||||
}
|
}
|
||||||
void showDragInfoInStatusBar(StatusBar* statusBar, bool copy, int destIndex, int newSize) override {
|
void showDragInfoInStatusBar(StatusBar* statusBar, bool copy, int destIndex, int newSize) override {
|
||||||
statusBar->setStatusText(
|
statusBar->setStatusText(
|
||||||
@ -281,7 +281,7 @@ public:
|
|||||||
picks = newPicks;
|
picks = newPicks;
|
||||||
}
|
}
|
||||||
void showEntryInStatusBar(StatusBar* statusBar, int index) override {
|
void showEntryInStatusBar(StatusBar* statusBar, int index) override {
|
||||||
statusBar->showTile(0, "", doc::tile(index, 0));
|
statusBar->showTile(0, doc::tile(index, 0));
|
||||||
}
|
}
|
||||||
void showDragInfoInStatusBar(StatusBar* statusBar, bool copy, int destIndex, int newSize) override {
|
void showDragInfoInStatusBar(StatusBar* statusBar, bool copy, int destIndex, int newSize) override {
|
||||||
statusBar->setStatusText(
|
statusBar->setStatusText(
|
||||||
|
@ -833,26 +833,28 @@ void StatusBar::showTip(int msecs, const std::string& msg)
|
|||||||
m_timeout = base::current_tick();
|
m_timeout = base::current_tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatusBar::showColor(int msecs, const char* text, const app::Color& color)
|
void StatusBar::showColor(int msecs, const app::Color& color,
|
||||||
|
const std::string& text)
|
||||||
{
|
{
|
||||||
if ((base::current_tick() > m_timeout) || (msecs > 0)) {
|
if ((base::current_tick() > m_timeout) || (msecs > 0)) {
|
||||||
showIndicators();
|
showIndicators();
|
||||||
IndicatorsGeneration gen(m_indicators);
|
IndicatorsGeneration gen(m_indicators);
|
||||||
gen.add(color);
|
gen.add(color);
|
||||||
if (text)
|
if (!text.empty())
|
||||||
gen.add(text);
|
gen.add(text.c_str());
|
||||||
|
|
||||||
m_timeout = base::current_tick() + msecs;
|
m_timeout = base::current_tick() + msecs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatusBar::showTile(int msecs, const char* text, doc::tile_t tile)
|
void StatusBar::showTile(int msecs, doc::tile_t tile,
|
||||||
|
const std::string& text)
|
||||||
{
|
{
|
||||||
if ((base::current_tick() > m_timeout) || (msecs > 0)) {
|
if ((base::current_tick() > m_timeout) || (msecs > 0)) {
|
||||||
IndicatorsGeneration gen(m_indicators);
|
IndicatorsGeneration gen(m_indicators);
|
||||||
gen.add(tile);
|
gen.add(tile);
|
||||||
if (text)
|
if (!text.empty())
|
||||||
gen.add(text);
|
gen.add(text.c_str());
|
||||||
|
|
||||||
m_timeout = base::current_tick() + msecs;
|
m_timeout = base::current_tick() + msecs;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018-2021 Igara Studio S.A.
|
// Copyright (C) 2018-2022 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
|
||||||
@ -61,8 +61,10 @@ namespace app {
|
|||||||
|
|
||||||
bool setStatusText(int msecs, const std::string& text);
|
bool setStatusText(int msecs, const std::string& text);
|
||||||
void showTip(int msecs, const std::string& msg);
|
void showTip(int msecs, const std::string& msg);
|
||||||
void showColor(int msecs, const char* text, const Color& color);
|
void showColor(int msecs, const Color& color,
|
||||||
void showTile(int msecs, const char* text, doc::tile_t tile);
|
const std::string& text = std::string());
|
||||||
|
void showTile(int msecs, doc::tile_t tile,
|
||||||
|
const std::string& text = std::string());
|
||||||
void showTool(int msecs, tools::Tool* tool);
|
void showTool(int msecs, tools::Tool* tool);
|
||||||
void showSnapToGridWarning(bool state);
|
void showSnapToGridWarning(bool state);
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ bool TileButton::onProcessMessage(Message* msg)
|
|||||||
switch (msg->type()) {
|
switch (msg->type()) {
|
||||||
|
|
||||||
case kMouseEnterMessage:
|
case kMouseEnterMessage:
|
||||||
StatusBar::instance()->showTile(0, "", m_tile);
|
StatusBar::instance()->showTile(0, m_tile);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kMouseLeaveMessage:
|
case kMouseLeaveMessage:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite Document Library
|
// Aseprite Document Library
|
||||||
// Copyright (C) 2019-2021 Igara Studio S.A.
|
// Copyright (C) 2019-2022 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2016 David Capello
|
// Copyright (C) 2001-2016 David Capello
|
||||||
//
|
//
|
||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
@ -281,6 +281,12 @@ void Brush::setImageColor(ImageColor imageColor, color_t color)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Brush::resetImageColors()
|
||||||
|
{
|
||||||
|
if (m_backupImage)
|
||||||
|
m_image.reset(Image::createCopy(m_backupImage.get()));
|
||||||
|
}
|
||||||
|
|
||||||
void Brush::setCenter(const gfx::Point& center)
|
void Brush::setCenter(const gfx::Point& center)
|
||||||
{
|
{
|
||||||
m_center = center;
|
m_center = center;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite Document Library
|
// Aseprite Document Library
|
||||||
// Copyright (C) 2019-2020 Igara Studio S.A.
|
// Copyright (C) 2019-2022 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
@ -52,7 +52,12 @@ namespace doc {
|
|||||||
void setAngle(int angle);
|
void setAngle(int angle);
|
||||||
void setImage(const Image* image,
|
void setImage(const Image* image,
|
||||||
const Image* maskBitmap);
|
const Image* maskBitmap);
|
||||||
|
|
||||||
|
// Special functions to change the colors of the image or restore
|
||||||
|
// the colors to the original image used to create the brush.
|
||||||
void setImageColor(ImageColor imageColor, color_t color);
|
void setImageColor(ImageColor imageColor, color_t color);
|
||||||
|
void resetImageColors();
|
||||||
|
|
||||||
void setPattern(BrushPattern pattern) {
|
void setPattern(BrushPattern pattern) {
|
||||||
m_pattern = pattern;
|
m_pattern = pattern;
|
||||||
}
|
}
|
||||||
@ -64,6 +69,15 @@ namespace doc {
|
|||||||
}
|
}
|
||||||
void setCenter(const gfx::Point& center);
|
void setCenter(const gfx::Point& center);
|
||||||
|
|
||||||
|
// Returns the original image used to create the brush before
|
||||||
|
// calling any setImageColor()
|
||||||
|
Image* originalImage() const {
|
||||||
|
if (m_backupImage)
|
||||||
|
return m_backupImage.get();
|
||||||
|
else
|
||||||
|
return m_image.get();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void clean();
|
void clean();
|
||||||
void regenerate();
|
void regenerate();
|
||||||
|
@ -176,14 +176,14 @@ void IntEntry::openPopup()
|
|||||||
{
|
{
|
||||||
m_slider.setValue(getValue());
|
m_slider.setValue(getValue());
|
||||||
|
|
||||||
m_popupWindow = new TransparentPopupWindow(PopupWindow::ClickBehavior::CloseOnClickInOtherWindow);
|
m_popupWindow = std::make_unique<TransparentPopupWindow>(PopupWindow::ClickBehavior::CloseOnClickInOtherWindow);
|
||||||
m_popupWindow->setAutoRemap(false);
|
m_popupWindow->setAutoRemap(false);
|
||||||
m_popupWindow->addChild(&m_slider);
|
m_popupWindow->addChild(&m_slider);
|
||||||
m_popupWindow->Close.connect(&IntEntry::onPopupClose, this);
|
m_popupWindow->Close.connect(&IntEntry::onPopupClose, this);
|
||||||
|
|
||||||
fit_bounds(
|
fit_bounds(
|
||||||
display(),
|
display(),
|
||||||
m_popupWindow,
|
m_popupWindow.get(),
|
||||||
gfx::Rect(0, 0, 128*guiscale(), m_popupWindow->sizeHint().h),
|
gfx::Rect(0, 0, 128*guiscale(), m_popupWindow->sizeHint().h),
|
||||||
[this](const gfx::Rect& workarea,
|
[this](const gfx::Rect& workarea,
|
||||||
gfx::Rect& rc,
|
gfx::Rect& rc,
|
||||||
@ -214,8 +214,7 @@ void IntEntry::closePopup()
|
|||||||
removeSlider();
|
removeSlider();
|
||||||
|
|
||||||
m_popupWindow->closeWindow(nullptr);
|
m_popupWindow->closeWindow(nullptr);
|
||||||
delete m_popupWindow;
|
m_popupWindow.reset();
|
||||||
m_popupWindow = nullptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,7 +236,7 @@ void IntEntry::onPopupClose(CloseEvent& ev)
|
|||||||
void IntEntry::removeSlider()
|
void IntEntry::removeSlider()
|
||||||
{
|
{
|
||||||
if (m_popupWindow &&
|
if (m_popupWindow &&
|
||||||
m_slider.parent() == m_popupWindow) {
|
m_slider.parent() == m_popupWindow.get()) {
|
||||||
m_popupWindow->removeChild(&m_slider);
|
m_popupWindow->removeChild(&m_slider);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// Aseprite UI Library
|
// Aseprite UI Library
|
||||||
|
// Copyright (C) 2022 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2017 David Capello
|
// Copyright (C) 2001-2017 David Capello
|
||||||
//
|
//
|
||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
@ -11,6 +12,8 @@
|
|||||||
#include "ui/entry.h"
|
#include "ui/entry.h"
|
||||||
#include "ui/slider.h"
|
#include "ui/slider.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
class CloseEvent;
|
class CloseEvent;
|
||||||
@ -43,7 +46,7 @@ namespace ui {
|
|||||||
int m_min;
|
int m_min;
|
||||||
int m_max;
|
int m_max;
|
||||||
Slider m_slider;
|
Slider m_slider;
|
||||||
PopupWindow* m_popupWindow;
|
std::unique_ptr<PopupWindow> m_popupWindow;
|
||||||
bool m_changeFromSlider;
|
bool m_changeFromSlider;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user