Commit Graph

73 Commits

Author SHA1 Message Date
David Capello bf0a47545c Remove #if/endif ENABLE_UI conditional directives (fix #4619)
This was originated for #1279 (CLI-only Aseprite) which can be
achieved with LAF_BACKEND=none anyway.

In this way we simplify the development process, and checking for the
availability of the GUI can be done in run-time through App::isGui()
or Context::isUIAvailable().
2024-09-02 23:16:26 -03:00
Martín Capello f7f2c56abf [lua] Fix tabs ID handling (fix #4268) 2024-02-08 10:55:46 -03:00
Martín Capello 0c7759acf1 [lua] Fix how separators are added into dialog's tabs (fix #4288) 2024-02-06 16:27:24 -03:00
Gaspar Capello 8226e5285a Fix Dialog.bounds doesn't work as expected (fix #3898)
Prior to this fix, the 'Dialog:show()' function overrode bounds when
they were defined before the 'show' command.
2023-11-22 18:22:20 -03:00
Martín Capello 26523156da Improve script engine's exception handling
More details about the implications of this change can be found
in https://github.com/aseprite/aseprite/pull/4057
2023-10-26 11:24:51 -03:00
Martín Capello ba99f41d82 [lua] Add "focus", "enabled", and "visible" common properties to tabs 2023-09-19 14:53:47 -03:00
Martín Capello 815366d385 [lua] Add support to modify tabs buttons via Dialog:modify 2023-09-12 17:21:00 -03:00
Martín Capello 6010748f81 [lua] Add tabs onclick and ontabchange events support 2023-09-12 17:21:00 -03:00
Martín Capello d21f47f827 [lua] Add selected tab retrieval/selection through Dialog's data and possibility to set the tabs selector at the bottom 2023-09-12 17:21:00 -03:00
David Capello 702a7d5265 [lua] Rename Dialog:canvas{ autoScaling -> autoscaling } (fix #4011) 2023-08-21 21:10:51 -03:00
Martín Capello 115e20d2a5 Add tab widget to lua api 2023-08-14 18:08:33 -03:00
David Capello 9755efece4 Add note to remove duplicated code incorporated in aebb370906 2023-08-14 18:06:55 -03:00
Martín Capello aebb370906 Add autoscrollbars feature to Lua API Dialog:show function 2023-08-14 18:04:24 -03:00
Martín Capello 0958573cac Add canvas autoScaling feature (fix #3748) 2023-04-27 11:07:26 -03:00
Martín Capello 961dc46066 Avoid dialog's window relayout during an ongoing window's size change 2023-03-28 14:09:03 -03:00
Martín Capello 5fb0b72c73 Fix hexpand and vexpand setting 2023-03-28 13:54:02 -03:00
David Capello af9f7288ee [lua] Add 'ondblclick' event for canvas widget 2023-03-27 14:22:10 -03:00
David Capello b7770f5fac [lua] Add KeyEvent.repeatCount (fix aseprite/api#95)
As "repeat" is a keyword on Lua, it makes things complicated.
2023-03-16 14:55:30 -03:00
David Capello 33c92dd218 Fix some warnings
- Added missing override
- Removed some unused captures for lambdas
- Removed some unused local/member variables
2023-02-28 13:05:02 -03:00
David Capello cef84ad113 [lua] Fix regression, Dialog() must create a window with titlebar
Added a new Dialog{ notitlebar=true } parameter to avoid showing a
title bar explicitly. So we can continue using Dialog() to create
dialogs with the default "Script" title.

Regression introduced in 453d9c2168
2023-02-22 18:17:26 -03:00
David Capello 5953e93402 [lua] Add possibility to display a Dialog as a popup menu
* Added new Dialog:menuItem{} widget
* Added Dialog:showMenu{} function
2023-01-12 11:09:05 -03:00
David Capello 39d1fb56d4 Remove ui::Event& args from ui::Button::Click signal
This is to simplify code and to match ui::MenuItem::Click and
ui::Button::Click signals (so then we can write some generic code
using Button::Click or MenuItem::Click).
2023-01-12 11:00:16 -03:00
David Capello 453d9c2168 [lua] Add possibility to create dialogs without titlebar 2023-01-11 09:46:21 -03:00
David Capello f5a79ce3b8 [lua] Add possibility to specify parent dialog 2023-01-11 09:38:19 -03:00
David Capello 7ede783926 [lua] Add key modifiers to mouse and touch messages on canvas widget 2023-01-05 16:14:00 -03:00
David Capello 17825921e0 [lua] Add onkeydown/onkeyup events to canvas widget 2023-01-04 14:40:10 -03:00
David Capello 1830e5343f [lua] Add onwheel and ontouchmagnify events to Dialog:canvas() 2022-12-29 15:12:15 -03:00
David Capello a6a7519178 [lua] Add possibility to modify the mouseCursor of a canvas 2022-12-26 15:33:14 -03:00
David Capello d4cefb8ba6 Fix crash double clicking a Dialog:canvas()
There were missing some setRecipient() when some messages are
converted to other kind of message (e.g. DoubleClick -> MouseDown)
2022-12-15 19:29:28 -03:00
David Capello 8b390d56fd [lua] Fix mouse position to client coordinates on mouse events 2022-12-15 16:21:24 -03:00
David Capello 0aaa9fdddf [lua] Add onmousemove/down/up events to canvas widget
At the moment very basic properties were added to the received event:
x, y, and button.
2022-12-14 22:13:49 -03:00
David Capello 25682a44d8 [lua] Add Dialog:repaint() function 2022-12-14 21:17:51 -03:00
David Capello 2cb526a19b [lua] Add new GraphicsContext type for Canvas onpaint event
We include a simple initial API for the GraphicsContext (like
stroking/filling rectangles and images).
2022-12-14 18:59:44 -03:00
David Capello 6e13e59aff [lua] Add initial version Dialog:canvas() (aseprite/api#87)
Right now it just creates a plain widget, but now we can specify
hexpand/vexpand arguments too so we can create a canvas with a fixed
size or with dynamic size (e.g. to use the whole dialog client area).

The onpaint event is not functional yet.
2022-12-14 17:33:29 -03:00
David Capello 16ca5a55db Merge branch 'main' into beta 2022-04-05 23:16:55 -03:00
David Capello 2a908f79df lua: Dialog() must return nil if there is no UI available
This avoids some crashes when running in --batch mode and some script
tries to create a Dialog().
2022-04-05 20:45:34 -03:00
David Capello 2b57fcaa6c Merge branch 'main' into beta 2021-12-01 18:14:53 -03:00
Omar Abdul Aziz b30e64648e [lua] Dialog:modify() now supports combobox options
References:
* https://github.com/aseprite/aseprite/issues/2965#issuecomment-939556356
* https://github.com/aseprite/api/issues/61
2021-11-30 18:59:57 -03:00
David Capello 06a387fd45 [lua] Fix using Dialog.bounds property with multiple windows
Fixes for:
https://community.aseprite.org/t/9277
https://steamcommunity.com/app/431730/discussions/0/3091137796288948505/
2021-06-07 17:39:12 -03:00
David Capello 35bb3af6e2 Replace all base::Bind() with lambda functions 2021-03-05 20:09:42 -03:00
David Capello 3623720dd4 Merge branch 'master' into beta 2020-08-18 11:05:37 -03:00
David Capello f44aad06db [lua] Fix Dialog:file{ save=true } so 'save' field must be =true
Before this change if we used Dialog:file{ save=false } it would show
the save version of the dialog, which didn't make sense.
2020-08-18 08:55:04 -03:00
David Capello 20d763ca4b Merge branch 'master' into beta 2020-07-30 16:48:43 -03:00
David Capello c4ed8c1450 [lua] We cannot detect existent keys with nil in a table (they aren't added to the table)
All non-existent keys return nil (and nil keys are not added when the
table is created, so we cannot even iterate the table to search for
keys like "always" or "sRGB"). The only solution is assigning a
non-nil value, e.g. { always=true }, { sRGB=true }, etc.
2020-07-28 17:40:19 -03:00
David Capello 7656627605 [lua] Fix calling onclose Dialog event when we close the app (fix https://github.com/aseprite/api/issues/28) 2020-07-28 10:35:38 -03:00
David Capello 8a3f32b47f Replace all base::Bind() with lambda functions 2020-07-03 21:51:46 -03:00
David Capello a2cdde8ec8 [lua] Add "enabled" and "visible" properties when creating new widgets
Fixed https://github.com/aseprite/api/issues/29
2020-05-15 19:03:46 -03:00
David Capello 68720424c0 [lua] Dialog:modify{} now can modify the text of a separator
Fixes https://github.com/aseprite/api/issues/27
2020-05-11 12:26:43 -03:00
Laurens Holst b3681fdbb0 [lua] Implement Dialog:modify for more properties
Support modifying the following properties:

Dialog:number { decimals }
Dialog:slider { min, max, value }
Dialog:combobox { option }
Dialog:color { color }
Dialog:shades { colors }
Dialog:file { filename }
2020-04-30 22:47:00 +02:00
Laurens Holst 1311173d97 [lua] Add missing Dialog onchange and onrelease events
Adding the following events:

Dialog:entry { onchange }
Dialog:number { onchange }
Dialog:slider { onchange, onrelease }
Dialog:combobox { onchange }
2020-04-29 23:38:15 +02:00