mirror of https://github.com/aseprite/aseprite.git
Compare commits
5 Commits
43e1f0ad9d
...
aecb5539a8
| Author | SHA1 | Date |
|---|---|---|
|
|
aecb5539a8 | |
|
|
b3814ec912 | |
|
|
e88f3bb413 | |
|
|
eaa2bdf0af | |
|
|
57309e5aa5 |
8
build.sh
8
build.sh
|
|
@ -428,9 +428,17 @@ if [ ! -d "$skia_library_dir" ] ; then
|
||||||
skia_url=$(bash laf/misc/skia-url.sh $skia_build)
|
skia_url=$(bash laf/misc/skia-url.sh $skia_build)
|
||||||
skia_file=$(basename $skia_url)
|
skia_file=$(basename $skia_url)
|
||||||
if [ ! -f "$skia_dir/$skia_file" ] ; then
|
if [ ! -f "$skia_dir/$skia_file" ] ; then
|
||||||
|
if ! command -v curl >/dev/null 2>&1 ; then
|
||||||
|
echo "Error: 'curl' command line tool is not available in PATH"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
curl --ssl-revoke-best-effort -L -o "$skia_dir/$skia_file" "$skia_url"
|
curl --ssl-revoke-best-effort -L -o "$skia_dir/$skia_file" "$skia_url"
|
||||||
fi
|
fi
|
||||||
if [ ! -d "$skia_library_dir" ] ; then
|
if [ ! -d "$skia_library_dir" ] ; then
|
||||||
|
if ! command -v unzip >/dev/null 2>&1 ; then
|
||||||
|
echo "Error: 'unzip' command line tool is not available in PATH"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
unzip -n -d "$skia_dir" "$skia_dir/$skia_file"
|
unzip -n -d "$skia_dir" "$skia_dir/$skia_file"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -621,6 +621,14 @@ current_layer = Current Layer
|
||||||
first_ref_layer = First Reference Layer
|
first_ref_layer = First Reference Layer
|
||||||
pick = Pick:
|
pick = Pick:
|
||||||
sample = Sample:
|
sample = Sample:
|
||||||
|
position_label = P:
|
||||||
|
rotation_label = R:
|
||||||
|
position_x = X Position
|
||||||
|
position_y = Y Position
|
||||||
|
size_width = Width
|
||||||
|
size_height = Height
|
||||||
|
rotation_angle = Angle
|
||||||
|
rotation_skew = Skew
|
||||||
|
|
||||||
[convolution_matrix]
|
[convolution_matrix]
|
||||||
reload_stock = &Reload Stock
|
reload_stock = &Reload Stock
|
||||||
|
|
|
||||||
|
|
@ -1095,6 +1095,9 @@ public:
|
||||||
gifframe_t nframes = totalFrames();
|
gifframe_t nframes = totalFrames();
|
||||||
for (gifframe_t gifFrame = 0; gifFrame < nframes; ++gifFrame) {
|
for (gifframe_t gifFrame = 0; gifFrame < nframes; ++gifFrame) {
|
||||||
ASSERT(frame_it != frame_end);
|
ASSERT(frame_it != frame_end);
|
||||||
|
if (m_fop->isStop())
|
||||||
|
break;
|
||||||
|
|
||||||
frame_t frame = *frame_it;
|
frame_t frame = *frame_it;
|
||||||
++frame_it;
|
++frame_it;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,7 @@ struct Dialog {
|
||||||
std::map<std::string, ui::Widget*> dataWidgets;
|
std::map<std::string, ui::Widget*> dataWidgets;
|
||||||
std::map<std::string, ui::Widget*> labelWidgets;
|
std::map<std::string, ui::Widget*> labelWidgets;
|
||||||
int currentRadioGroup = 0;
|
int currentRadioGroup = 0;
|
||||||
|
int autofit = ui::LEFT | ui::TOP;
|
||||||
|
|
||||||
// Member used to hold current state about the creation of a tabs
|
// Member used to hold current state about the creation of a tabs
|
||||||
// widget. After creation it is reset to null to be ready for the
|
// widget. After creation it is reset to null to be ready for the
|
||||||
|
|
@ -193,6 +194,13 @@ struct Dialog {
|
||||||
it->second->setText(text);
|
it->second->setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setAutofit(int align)
|
||||||
|
{
|
||||||
|
// Accept both 0 or a valid subset of align parameters.
|
||||||
|
if (align == 0 || (align & (ui::LEFT | ui::RIGHT | ui::TOP | ui::BOTTOM)))
|
||||||
|
autofit = align;
|
||||||
|
}
|
||||||
|
|
||||||
Display* parentDisplay() const
|
Display* parentDisplay() const
|
||||||
{
|
{
|
||||||
Display* parentDisplay = window.parentDisplay();
|
Display* parentDisplay = window.parentDisplay();
|
||||||
|
|
@ -231,8 +239,10 @@ struct Dialog {
|
||||||
window.display()->nativeWindow()->setFrame(frame);
|
window.display()->nativeWindow()->setFrame(frame);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
gfx::Rect oldBounds(window.bounds());
|
||||||
window.setBounds(rc);
|
window.setBounds(rc);
|
||||||
window.invalidate();
|
window.invalidate();
|
||||||
|
parentDisplay()->invalidateRect(oldBounds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -367,6 +377,7 @@ int Dialog_new(lua_State* L)
|
||||||
ui::Window::Type windowType = ui::Window::WithTitleBar;
|
ui::Window::Type windowType = ui::Window::WithTitleBar;
|
||||||
std::string title = "Script";
|
std::string title = "Script";
|
||||||
bool sizeable = true;
|
bool sizeable = true;
|
||||||
|
int autofit = -1;
|
||||||
if (lua_isstring(L, 1)) {
|
if (lua_isstring(L, 1)) {
|
||||||
title = lua_tostring(L, 1);
|
title = lua_tostring(L, 1);
|
||||||
}
|
}
|
||||||
|
|
@ -385,9 +396,16 @@ int Dialog_new(lua_State* L)
|
||||||
if (type != LUA_TNIL && !lua_toboolean(L, -1))
|
if (type != LUA_TNIL && !lua_toboolean(L, -1))
|
||||||
sizeable = false;
|
sizeable = false;
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
|
|
||||||
|
type = lua_getfield(L, 1, "autofit");
|
||||||
|
if (type != LUA_TNIL) {
|
||||||
|
autofit = lua_tointeger(L, -1);
|
||||||
|
}
|
||||||
|
lua_pop(L, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto dlg = push_new<Dialog>(L, windowType, title, sizeable);
|
auto dlg = push_new<Dialog>(L, windowType, title, sizeable);
|
||||||
|
dlg->setAutofit(autofit);
|
||||||
|
|
||||||
// The uservalue of the dialog userdata will contain a table that
|
// The uservalue of the dialog userdata will contain a table that
|
||||||
// stores all the callbacks to handle events. As these callbacks can
|
// stores all the callbacks to handle events. As these callbacks can
|
||||||
|
|
@ -1516,6 +1534,10 @@ int Dialog_modify(lua_State* L)
|
||||||
type = lua_getfield(L, 2, "text");
|
type = lua_getfield(L, 2, "text");
|
||||||
if (const char* s = lua_tostring(L, -1)) {
|
if (const char* s = lua_tostring(L, -1)) {
|
||||||
widget->setText(s);
|
widget->setText(s);
|
||||||
|
|
||||||
|
// Re-process mnemonics for buttons
|
||||||
|
if (widget->type() == WidgetType::kButtonWidget)
|
||||||
|
widget->processMnemonicFromText();
|
||||||
relayout = true;
|
relayout = true;
|
||||||
}
|
}
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
|
|
@ -1650,8 +1672,26 @@ int Dialog_modify(lua_State* L)
|
||||||
if (relayout && !dlg->window.isResizing()) {
|
if (relayout && !dlg->window.isResizing()) {
|
||||||
dlg->window.layout();
|
dlg->window.layout();
|
||||||
|
|
||||||
gfx::Rect bounds(dlg->window.bounds().w, dlg->window.sizeHint().h);
|
if (dlg->autofit > 0) {
|
||||||
dlg->window.expandWindow(bounds.size());
|
gfx::Rect oldBounds = dlg->window.bounds();
|
||||||
|
gfx::Size resize(oldBounds.size());
|
||||||
|
|
||||||
|
if (dlg->autofit & ui::TOP || dlg->autofit & ui::BOTTOM)
|
||||||
|
resize.h = dlg->window.sizeHint().h;
|
||||||
|
if (dlg->autofit & ui::LEFT || dlg->autofit & ui::RIGHT)
|
||||||
|
resize.w = dlg->window.sizeHint().w;
|
||||||
|
|
||||||
|
gfx::Size difference = resize - oldBounds.size();
|
||||||
|
const auto& bounds = dlg->getWindowBounds();
|
||||||
|
gfx::Rect newBounds(bounds.x, bounds.y, resize.w, resize.h);
|
||||||
|
|
||||||
|
if (dlg->autofit & ui::BOTTOM)
|
||||||
|
newBounds.y = bounds.y - difference.h;
|
||||||
|
if (dlg->autofit & ui::RIGHT)
|
||||||
|
newBounds.x = bounds.x - difference.w;
|
||||||
|
|
||||||
|
dlg->setWindowBounds(newBounds);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lua_pushvalue(L, 1);
|
lua_pushvalue(L, 1);
|
||||||
|
|
@ -1873,6 +1913,27 @@ int Dialog_get_bounds(lua_State* L)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Dialog_get_sizeHint(lua_State* L)
|
||||||
|
{
|
||||||
|
auto dlg = get_obj<Dialog>(L, 1);
|
||||||
|
push_new<gfx::Size>(L, dlg->window.sizeHint());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Dialog_get_autofit(lua_State* L)
|
||||||
|
{
|
||||||
|
auto dlg = get_obj<Dialog>(L, 1);
|
||||||
|
lua_pushinteger(L, dlg->autofit);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Dialog_set_autofit(lua_State* L)
|
||||||
|
{
|
||||||
|
auto dlg = get_obj<Dialog>(L, 1);
|
||||||
|
dlg->setAutofit(lua_tointeger(L, 2));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int Dialog_set_bounds(lua_State* L)
|
int Dialog_set_bounds(lua_State* L)
|
||||||
{
|
{
|
||||||
auto dlg = get_obj<Dialog>(L, 1);
|
auto dlg = get_obj<Dialog>(L, 1);
|
||||||
|
|
@ -1916,6 +1977,8 @@ const luaL_Reg Dialog_methods[] = {
|
||||||
const Property Dialog_properties[] = {
|
const Property Dialog_properties[] = {
|
||||||
{ "data", Dialog_get_data, Dialog_set_data },
|
{ "data", Dialog_get_data, Dialog_set_data },
|
||||||
{ "bounds", Dialog_get_bounds, Dialog_set_bounds },
|
{ "bounds", Dialog_get_bounds, Dialog_set_bounds },
|
||||||
|
{ "autofit", Dialog_get_autofit, Dialog_set_autofit },
|
||||||
|
{ "sizeHint", Dialog_get_sizeHint, nullptr },
|
||||||
{ nullptr, nullptr, nullptr }
|
{ nullptr, nullptr, nullptr }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -172,6 +172,7 @@ int Plugin_newCommand(lua_State* L)
|
||||||
if (!group.empty() && App::instance()->isGui()) { // On CLI menus do not make sense
|
if (!group.empty() && App::instance()->isGui()) { // On CLI menus do not make sense
|
||||||
if (auto appMenus = AppMenus::instance()) {
|
if (auto appMenus = AppMenus::instance()) {
|
||||||
auto menuItem = std::make_unique<AppMenuItem>(title, id);
|
auto menuItem = std::make_unique<AppMenuItem>(title, id);
|
||||||
|
menuItem->processMnemonicFromText();
|
||||||
appMenus->addMenuItemIntoGroup(group, std::move(menuItem));
|
appMenus->addMenuItemIntoGroup(group, std::move(menuItem));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1001,12 +1001,12 @@ public:
|
||||||
m_angle.setSuffix("°");
|
m_angle.setSuffix("°");
|
||||||
m_skew.setSuffix("°");
|
m_skew.setSuffix("°");
|
||||||
|
|
||||||
addChild(new Label("P:"));
|
addChild(new Label(Strings::context_bar_position_label()));
|
||||||
addChild(&m_x);
|
addChild(&m_x);
|
||||||
addChild(&m_y);
|
addChild(&m_y);
|
||||||
addChild(&m_w);
|
addChild(&m_w);
|
||||||
addChild(&m_h);
|
addChild(&m_h);
|
||||||
addChild(new Label("R:"));
|
addChild(new Label(Strings::context_bar_rotation_label()));
|
||||||
addChild(&m_angle);
|
addChild(&m_angle);
|
||||||
addChild(&m_skew);
|
addChild(&m_skew);
|
||||||
|
|
||||||
|
|
@ -1047,6 +1047,16 @@ public:
|
||||||
m_skew.Change.connect([this] { onChangeSkew(); });
|
m_skew.Change.connect([this] { onChangeSkew(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setupTooltips(TooltipManager* tooltipManager)
|
||||||
|
{
|
||||||
|
tooltipManager->addTooltipFor(&m_x, Strings::context_bar_position_x(), BOTTOM);
|
||||||
|
tooltipManager->addTooltipFor(&m_y, Strings::context_bar_position_y(), BOTTOM);
|
||||||
|
tooltipManager->addTooltipFor(&m_w, Strings::context_bar_size_width(), BOTTOM);
|
||||||
|
tooltipManager->addTooltipFor(&m_h, Strings::context_bar_size_height(), BOTTOM);
|
||||||
|
tooltipManager->addTooltipFor(&m_angle, Strings::context_bar_rotation_angle(), BOTTOM);
|
||||||
|
tooltipManager->addTooltipFor(&m_skew, Strings::context_bar_rotation_skew(), BOTTOM);
|
||||||
|
}
|
||||||
|
|
||||||
void update(const Transformation& t)
|
void update(const Transformation& t)
|
||||||
{
|
{
|
||||||
auto rc = t.bounds();
|
auto rc = t.bounds();
|
||||||
|
|
@ -2626,6 +2636,7 @@ void ContextBar::setupTooltips(TooltipManager* tooltipManager)
|
||||||
m_dropPixels->setupTooltips(tooltipManager);
|
m_dropPixels->setupTooltips(tooltipManager);
|
||||||
m_symmetry->setupTooltips(tooltipManager);
|
m_symmetry->setupTooltips(tooltipManager);
|
||||||
m_sliceFields->setupTooltips(tooltipManager);
|
m_sliceFields->setupTooltips(tooltipManager);
|
||||||
|
m_transformation->setupTooltips(tooltipManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContextBar::registerCommands()
|
void ContextBar::registerCommands()
|
||||||
|
|
|
||||||
|
|
@ -286,9 +286,6 @@ bool MovingPixelsState::onMouseDown(Editor* editor, MouseMessage* msg)
|
||||||
UIContext* ctx = UIContext::instance();
|
UIContext* ctx = UIContext::instance();
|
||||||
ctx->setActiveView(editor->getDocView());
|
ctx->setActiveView(editor->getDocView());
|
||||||
|
|
||||||
ContextBar* contextBar = App::instance()->contextBar();
|
|
||||||
contextBar->updateForMovingPixels(getTransformation(editor));
|
|
||||||
|
|
||||||
// Start scroll loop
|
// Start scroll loop
|
||||||
if (editor->checkForScroll(msg) || editor->checkForZoom(msg))
|
if (editor->checkForScroll(msg) || editor->checkForZoom(msg))
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -442,10 +439,6 @@ void MovingPixelsState::onCommitMouseMove(Editor* editor, const gfx::PointF& spr
|
||||||
// Drag the image to that position
|
// Drag the image to that position
|
||||||
m_pixelsMovement->moveImage(spritePos, moveModifier);
|
m_pixelsMovement->moveImage(spritePos, moveModifier);
|
||||||
|
|
||||||
// Update context bar and status bar
|
|
||||||
ContextBar* contextBar = App::instance()->contextBar();
|
|
||||||
contextBar->updateForMovingPixels(transformation);
|
|
||||||
|
|
||||||
m_editor->updateStatusBar();
|
m_editor->updateStatusBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -529,6 +522,10 @@ 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();
|
||||||
|
|
||||||
|
// Update the context bar along with the status bar
|
||||||
|
ContextBar* contextBar = App::instance()->contextBar();
|
||||||
|
contextBar->updateForMovingPixels(transform);
|
||||||
|
|
||||||
int w = int(transform.bounds().w);
|
int w = int(transform.bounds().w);
|
||||||
int h = int(transform.bounds().h);
|
int h = int(transform.bounds().h);
|
||||||
int gcd = base::gcd(w, h);
|
int gcd = base::gcd(w, h);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue