Compare commits

..

38 Commits

Author SHA1 Message Date
David Capello 5e12a5d3d8 Restore the "Position" section in Timeline configuration
We're going to keep this section for a couple of versions as old users
get used to the new Workspace Layout customization.

The "Position" section will contain the layout icon so we can switch
the Workspace Layout combobox from there too,
2025-08-04 19:41:59 -03:00
David Capello 60112cd929 Close layout combobox after clicking the reset/delete layout button
Without this, the combobox is still visible and clicking the button
again will crash the program.
2025-08-04 19:41:59 -03:00
David Capello a1fb751323 Remove base field from "New Layout" dialog 2025-08-04 19:41:59 -03:00
David Capello 24046600ec Fix loading modified default layouts at the very beginning 2025-08-04 19:41:59 -03:00
David Capello 34aae80eab Fix some strings
From https://github.com/aseprite/aseprite/pull/3485#pullrequestreview-2824195211
2025-08-04 19:41:59 -03:00
David Capello c8ae1017b3 Fix crashes resetting the default layout + remove some hacks
With this patch we've also simplified some hacks handling the
populateComboBox() call, deferring the deletion of widgets/items when
we are inside an event generated by those items.
2025-08-04 19:41:59 -03:00
David Capello 9c5d1feaf5 Fix several layout saving/loading issues
* Better support to load legacy timeline information: we have to
  estimate workspace bounds)
* Auto-save layouts after resizing a splitter/dock
* Fix resetting expansive widgets inside docks after switching tabs
* Load mirrored layout correctly if it was the last selected layout
2025-08-04 19:41:59 -03:00
David Capello aa66d260ad Fix switch/break style 2025-08-04 19:41:59 -03:00
David Capello 86c7fae42c Move LayoutSelector::setActiveLayoutId() impl to .cpp file 2025-08-04 19:41:59 -03:00
David Capello 778e62a411 Minor changes (format, remove unused/unnecessary vars/keywords) 2025-08-04 19:41:59 -03:00
David Capello b08662eeca Change notification flag location inside the layout selector widget
This improves the look of the flag as another icon above the tabs
bottom and at the right of the layout selector icon.
2025-08-04 19:41:59 -03:00
David Capello d6c5ac6786 [theme] New layout selector icon + bg color fixes 2025-08-04 19:41:59 -03:00
David Capello e0226d95d9 Improve layout selector widget location when menu bar is visible/hidden 2025-08-04 19:41:59 -03:00
David Capello 7eb2df6965 Remove unused member variable from ui::Dock 2025-08-04 19:41:59 -03:00
Christian Kaiser c445075a79 Polish layout handling
@dacap's notes: A description of the included changes:

* Improve UX auto-saving layouts when docks are modified, and new 'X'
  icon to delete layouts (or reset the 'Default' layout).
* Remove old timeline position controls (Left/Right/Bottom buttons)
  from the Timeline configuration and from the layout selector
* Add support to drag and drop docks to other sides with real-time
  feedback using a semi-transparent UILayer
* Add a context menu w/right-click to dock the widget at the supported
  sides without drag-and-drop

Some review comments in https://github.com/dacap/aseprite/pull/2
2025-08-04 19:41:59 -03:00
David Capello f556052fc6 Show handles in dockable areas to drag-and-drop them 2025-08-04 19:41:58 -03:00
David Capello c8e9b33ad3 Fix bug where the ToolBar popup wasn't being opened
This was a new issue with combination of
9b90159d1b, probably we should close the
popup when the window is resized (instead of onSizeHint()).
2025-08-04 19:41:58 -03:00
David Capello 37d2be7668 Update saving/loading dock layouts w/tinyxml2 library 2025-08-04 19:41:58 -03:00
David Capello 43140e71ec Save layout changes immediately when docks are resized
This patch includes:

* The layout is updated immediately when docks are resized (before
  this the layout was like a snapshot of the configuration when the
  layout was created or overwritten with the "New Layout" option)
* Saving the active layout used in
  preferences.general.workspace_layout so we can restore it after
  restarting Aseprite
* Change "UI Layout" to "Workspace Layout"
* Some strings moved to en.ini file for i18n
* Fixed a crash on MainWindow::onActiveViewChange() when the
  application was being closed
2025-08-04 19:41:58 -03:00
David Capello eecc14153d Improve borders of context & color bars for both sides (left/right) 2025-08-04 19:41:58 -03:00
David Capello 131aa8b3df Add View > Workspace Layout option to switch the layout w/keys 2025-08-04 19:41:58 -03:00
David Capello ab69421096 Add possibility to overwrite existent layouts 2025-08-04 19:41:58 -03:00
David Capello 0e4e776bc0 Include StatusBar in the set of customizable widgets in the layout 2025-08-04 19:41:58 -03:00
David Capello 78b9f340f7 Save/Load user defined layouts in new user.aseprite-layouts file
And now we store the TiXmlElement for each Layout, instead of
converting from/to text back and forth.
2025-08-04 19:41:58 -03:00
David Capello 92a039a619 Add option to save/restore user-defined layouts on memory
This happens only in memory at the moment (layouts are not saved in
disk yet), and the customization is quite simple (only size of
splitters, timeline position). But in the future we should be able to
dock elements in any place.
2025-08-04 19:41:58 -03:00
David Capello dc040e81e7 Set the initial timeline position in the LayoutSelector correctly 2025-08-04 19:41:58 -03:00
David Capello 465574e2db Show the timeline when we set its position from the LayoutSelector 2025-08-04 19:41:58 -03:00
David Capello 544f711adc Improve the layout selector UI
Changes:
* Now we use the "user data" icon as the button to expand the layouts
  combobox
* Added a tooltip to this icon
* Added buttons to configure the Timeline position in the same
  combobox
* Fixed some bugs in Dock using space for hidden widgets
2025-08-04 19:41:58 -03:00
David Capello ec95323856 Save/restore color bar splitter position correctly 2025-08-04 19:41:58 -03:00
David Capello 9b56d5ba3d Save/restore timeline splitter position correctly 2025-08-04 19:41:58 -03:00
David Capello 2c0920f514 Fix popups & tooltips direction when ToolBar is docked at the left side 2025-08-04 19:41:58 -03:00
David Capello ba39b56096 Fix std::clamp() max bound in TipWindow::pointAt() 2025-08-04 19:41:58 -03:00
David Capello ad4d00ced2 Use std::unique_ptr in ToolBar members 2025-08-04 19:41:58 -03:00
David Capello 6df6037fdc Fix memory leaks in MainWindow
Temporary/created subdocks must be deleted automatically, and children
that are not part of the window hierarchy must be deleted explicitly
now (using some std::unique_ptrs).
2025-08-04 19:41:58 -03:00
David Capello bb65296a1a Add Dock widget, initial & basic version of dockable elements (#518)
Some missing features so far:

1) Restore old layout configuration (color bar split pos, timeline
   pos, etc.) and migrate to new Dock layout
2) Load/saving Dock layout
3) Create & customize current layoout (drag-and-drop widgets, etc.)
2025-08-04 19:41:58 -03:00
Christian Kaiser eaa2bdf0af [lua] Process mnemonics consistently for plugins (fix #5250) 2025-08-04 15:58:29 -03:00
Christian Kaiser 57309e5aa5 Allow gif encoding to be stopped (fix #2619) 2025-08-01 20:46:32 -03:00
Christian Kaiser 4bb9239f50 [lua] Add `resizeable` property to Dialog constructor (fix #5177)
build / build (Debug, macos-latest, lua, cli) (push) Has been cancelled Details
build / build (Debug, macos-latest, noscripts, cli) (push) Has been cancelled Details
build / build (Debug, ubuntu-latest, lua, cli) (push) Has been cancelled Details
build / build (Debug, ubuntu-latest, noscripts, cli) (push) Has been cancelled Details
build / build (Debug, windows-latest, lua, cli) (push) Has been cancelled Details
build / build (Debug, windows-latest, noscripts, cli) (push) Has been cancelled Details
build / build (RelWithDebInfo, macos-latest, lua, gui) (push) Has been cancelled Details
build / build (RelWithDebInfo, ubuntu-latest, lua, gui) (push) Has been cancelled Details
build / build (RelWithDebInfo, windows-latest, lua, gui) (push) Has been cancelled Details
2025-08-01 18:57:50 -03:00
3 changed files with 17 additions and 2 deletions

View File

@ -1095,6 +1095,9 @@ public:
gifframe_t nframes = totalFrames();
for (gifframe_t gifFrame = 0; gifFrame < nframes; ++gifFrame) {
ASSERT(frame_it != frame_end);
if (m_fop->isStop())
break;
frame_t frame = *frame_it;
++frame_it;

View File

@ -127,12 +127,13 @@ struct Dialog {
int showRef = LUA_REFNIL;
lua_State* L = nullptr;
Dialog(const ui::Window::Type windowType, const std::string& title)
Dialog(const ui::Window::Type windowType, const std::string& title, bool sizeable)
: window(windowType, title)
, grid(2, false)
, currentGrid(&grid)
{
window.addChild(&grid);
window.setSizeable(sizeable);
all_dialogs.push_back(this);
}
@ -365,6 +366,7 @@ int Dialog_new(lua_State* L)
// Get the title and the type of window (with or without title bar)
ui::Window::Type windowType = ui::Window::WithTitleBar;
std::string title = "Script";
bool sizeable = true;
if (lua_isstring(L, 1)) {
title = lua_tostring(L, 1);
}
@ -378,9 +380,14 @@ int Dialog_new(lua_State* L)
if (type != LUA_TNIL && lua_toboolean(L, -1))
windowType = ui::Window::WithoutTitleBar;
lua_pop(L, 1);
type = lua_getfield(L, 1, "resizeable");
if (type != LUA_TNIL && !lua_toboolean(L, -1))
sizeable = false;
lua_pop(L, 1);
}
auto dlg = push_new<Dialog>(L, windowType, title);
auto dlg = push_new<Dialog>(L, windowType, title, sizeable);
// The uservalue of the dialog userdata will contain a table that
// stores all the callbacks to handle events. As these callbacks can
@ -1509,6 +1516,10 @@ int Dialog_modify(lua_State* L)
type = lua_getfield(L, 2, "text");
if (const char* s = lua_tostring(L, -1)) {
widget->setText(s);
// Re-process mnemonics for buttons
if (widget->type() == WidgetType::kButtonWidget)
widget->processMnemonicFromText();
relayout = true;
}
lua_pop(L, 1);

View File

@ -172,6 +172,7 @@ int Plugin_newCommand(lua_State* L)
if (!group.empty() && App::instance()->isGui()) { // On CLI menus do not make sense
if (auto appMenus = AppMenus::instance()) {
auto menuItem = std::make_unique<AppMenuItem>(title, id);
menuItem->processMnemonicFromText();
appMenus->addMenuItemIntoGroup(group, std::move(menuItem));
}
}