37 Commits

Author SHA1 Message Date
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
David Capello
48e941cb2f [lua] Add Dialog:newrow{ always } 2020-04-16 11:48:44 -03:00
David Capello
ed5deb9ca3 [lua] Add Dialog:color{ onchange } event 2020-04-07 11:25:58 -03:00
David Capello
4eefb84cf3 [lua] Add possibility to change dialog title with Dialog:modify{ title=... } 2020-04-07 11:14:06 -03:00
David Capello
bb8d0e7a6a [lua] Add possibility to modify a widget label and focus it 2020-04-07 11:13:30 -03:00
David Capello
8fe01b43f6 Fix typo in dialog_class.cpp 2020-04-07 11:01:46 -03:00
David Capello
8d8c116fa8 [lua] Fix some Dialog functions to convert to string implicitly 2020-04-06 14:54:11 -03:00
David Capello
55a1fa8b81 [lua] Add Dialog:modify{} method to change widget properties 2020-04-04 19:42:44 -03:00
David Capello
2c3fd2171b [lua] Fix Dialog.data for checkboxes if the last pressed button was a checkbox 2020-04-04 19:41:30 -03:00
David Capello
150ca293ef [lua] Fix checking for missing fields on tables in Dialog methods
We've to use LUA_TNIL instead of LUA_TNONE.
2020-04-04 19:40:52 -03:00
David Capello
32fd67e187 [lua] Add ev.button property onclick of shades widget 2020-03-27 16:14:00 -03:00
David Capello
c9b330ab65 lua: Added Dialog:shades{} widget
Also ColorShades is a little more generic now (doesn't depends so much
on the ColorBar).
2019-12-16 21:17:12 -03:00
David Capello
2b1903ee02 lua: Add Dialog{ title, onclose } constructor 2019-12-13 10:23:22 -03:00
David Capello
484de6bd3a lua: Fix memory leak of dialogs with callbacks pointing to itself
Now we store the callbacks in a table that depends of the lifetime of
the dialog (instead of the global registry), so when the dialog is not
used anymore/closed, the whole "island" of objects (dialog +
callbacks) is GC'd.
2019-12-12 09:13:21 -03:00
David Capello
ad1a39714e [lua] Add Image:resize() function
Closes: https://community.aseprite.org/t/3633
2019-08-13 18:16:30 -03:00
David Capello
6c7f1ff05b lua: Add "bounds" parameter to Dialog:show() function 2019-07-12 16:44:54 -03:00
David Capello
568aadbfc8 lua: invalidate Dialog() after changing its bounds 2019-07-12 16:42:43 -03:00
David Capello
e0e83f0d40 Add Dialog:file() (#1997, fix aseprite/api#7) 2019-02-13 16:15:04 -03:00
David Capello
74b2423070 lua: Add "focus" property for Dialog widgets (mainly button and entry) 2019-01-10 16:20:11 -03:00
David Capello
4fb260d265 lua: Add Dialog.bounds property 2018-11-29 09:46:37 -03:00
David Capello
f7a07b5a09 lua: Call Dialog button onclick callback with protected lua_pcall() 2018-11-21 17:42:12 -03:00
David Capello
7029e05dc4 lua: Avoid crashes executing transactions without an active sprite
This is true even for background Dialogs with buttons that will
try to create a transaction for a nil app.activeSprite.

With this change we introduced a new way to handle the app::Console window,
it'll be alive almost the entire execution of the program (so if we
close it, it's hidden, but then will appear in the same location if
it's open again, and the text is cleared).
2018-11-20 19:42:53 -03:00
David Capello
254a866b9f Fix compilation when ENABLE_UI is not defined 2018-10-26 08:50:13 -03:00
David Capello
bccd3f1bf8 lua: add Dialog() 2018-10-11 12:01:21 -03:00