Commit Graph

3354 Commits (92cd9ef35083448a15f961320ee2f6bed3f15c0d)

Author SHA1 Message Date
lethosor 62e7303c68
Upgrade pre-commit-hooks to v4.3.0 (+ submodules)
This contains a fix on Windows that checks for the executable bit according to
Git, instead of according to Windows, which reduces false-positive
"check-executables-have-shebangs" failures.
2022-06-08 17:48:14 -04:00
DFHack-Urist via GitHub Actions ec2f2446d2 Auto-update submodules
library/xml: master
scripts: master
2022-06-08 07:18:16 +00:00
DFHack-Urist via GitHub Actions 40a6fcdd99 Auto-update submodules
library/xml: master
scripts: master
2022-06-07 07:18:05 +00:00
DFHack-Urist via GitHub Actions 7b2cb8f9a6 Auto-update submodules
library/xml: master
2022-06-05 07:16:27 +00:00
DFHack-Urist via GitHub Actions f290b1c804 Auto-update submodules
library/xml: master
scripts: master
2022-06-04 07:16:44 +00:00
DFHack-Urist via GitHub Actions f5d3b9f699 Auto-update submodules
library/xml: master
scripts: master
2022-06-02 04:51:00 +00:00
Myk 89d3d45e87
Allow EditField widgets to manage their own activation and keyboard focus (#2147)
* use new focus subsystem in widgets.EditField

* always eat the enter key if we have an on_submit

* add modal attribute

* give EditFields a default height of 1

so they can be autoarranged
2022-06-01 21:48:21 -07:00
Myk ad2d9cad03
[lua] implement keyboard focus subsystem (#2160)
* implement keyboard focus subsystem

* Fix error in focus group combining

* documentation for the inputToSubviews decision

* modify unit tests to catch that last bug
2022-06-01 17:42:13 -07:00
Ryan Williams bc0def4342
MiscUtils word_wrap: Add option to trim only leading whitespace after wrapping (#2169)
* Update changelog.txt
2022-05-30 22:58:46 -04:00
Ryan Williams b1e118384e Update Maps.cpp 2022-05-30 16:26:30 -07:00
myk002 ea7fe2b926
account for scroll bars when sizing message boxes 2022-05-27 15:38:13 -07:00
Timur Kelman 07f54deb0b
fix wrong `Label.frame_body.x2` value (#2134)
* fix wrong `Label.frame_body.x2` value

`update_scroll_inset` might change `frame_inset`, i.e. we need to `computeFrame` with the new values.

* add tests for Label

* add missing `local`, remove code in comments

* move `TestFramedScreen` outside test functions
2022-05-27 15:25:17 -07:00
lethosor ca10cbc9e6
Merge remote-tracking branch 'lethosor/mock-observe-func' into develop 2022-05-27 01:46:24 -04:00
lethosor 888c531774
Add mock.observe_func(), improve mock.lua documentation
observe_func() is similar to func() but passes through all calls to a specified
function.
2022-05-27 00:33:44 -04:00
DFHack-Urist via GitHub Actions 56b301164f Auto-update submodules
library/xml: master
scripts: master
2022-05-25 07:18:15 +00:00
myk002 18628ff5b8 make key_sep more configurable
and add more configuration to HotkeyLabel and EditField to take
advantage of it
2022-05-18 16:46:33 -07:00
myk002 53609db1f9 let CycleHotkeyLabels take numeric initial_options
even if all of the option values are non-numeric
2022-05-18 15:39:52 -07:00
DFHack-Urist via GitHub Actions 47b87a5ac1 Auto-update submodules
library/xml: master
2022-05-17 07:18:04 +00:00
Ryan Williams 785fe9aa3a fix "info" level described as "error" level 2022-05-14 05:56:57 -07:00
Myk 8f6522899b
Upgrade jsoncpp to 1.9.5 (#2144)
* test jsoncpp upgrade

* use new json library target name

* don't remap the output dirs

* undo warnings at the source

* set new defaults for jsoncpp

* fix typo in new options

* fix signed comparison mismatch warning

* address random(?) compile failures

saying our std::atomic is not initialized in Debug.cpp
2022-05-13 13:52:43 -07:00
DFHack-Urist via GitHub Actions bf8eaef6bc Auto-update submodules
library/xml: master
plugins/isoworld: master
depends/libexpat: dfhack
depends/jsoncpp-sub: dfhack
2022-05-12 05:21:01 +00:00
DFHack-Urist via GitHub Actions 15a11d1a39 Auto-update submodules
library/xml: master
scripts: master
2022-05-10 07:22:46 +00:00
Tim Siegel 55e4008925
MiscUtils: teach word_wrap() to optionally preserve whitespace 2022-05-09 13:42:11 -04:00
myk002 585888c2d3
update version, changelog, modules for 0.47.05-r5 2022-05-04 17:21:31 -07:00
DFHack-Urist via GitHub Actions d4ba946d2b Auto-update submodules
library/xml: master
scripts: master
2022-05-03 07:18:10 +00:00
DFHack-Urist via GitHub Actions 5f1d2a08e4 Auto-update submodules
library/xml: master
scripts: master
2022-05-01 13:33:50 +00:00
DFHack-Urist via GitHub Actions 7120988044 Auto-update submodules
library/xml: master
scripts: master
2022-05-01 07:17:58 +00:00
DFHack-Urist via GitHub Actions 9643246b18 Auto-update submodules
library/xml: master
2022-04-30 19:20:07 +00:00
DFHack-Urist via GitHub Actions e9a2de08cd Auto-update submodules
library/xml: master
2022-04-30 07:17:43 +00:00
Myk e2fb15a3a5
add dwarfmode.MenuOverlay:renderMapOverlay() (#2119)
* add dwarfmode.MenuOverlay:renderMapOverlay()

* ensure we move with the viewport when bounds_rect is nil
2022-04-29 20:32:22 -07:00
Myk 24dd4d8ac0
Update init files (#2117)
* update example init files

replace onLoad.init-example with documentation on how to create scripts that run on world/map load
it was confusing to show it being loaded with sc-script since it gets autorun anyway if it is just named properly

* update changelog

* add quickfort keybinding

* move standard tweaks from dreamfort init to main
2022-04-29 20:24:09 -07:00
myk002 e603fee3ce
move sidebar mode management code to init
from onAboutToShow(). this allows the frames to be calculated correctly
during widget instantiation. otherwise widgets can end up with -1 width
2022-04-29 12:10:05 -07:00
myk002 af47434f52
protect against 0 width in string:wrap() 2022-04-29 11:29:19 -07:00
Tachytaenius b9c36c1e63
Added custom-raw-tokens utility (#2038)
* Added (chain) for [CHAIN_METAL_TEXT] armours in gui/materials.lua used by gui/create-item-- again (oops)

* Added customRawData utility

* Oops, whitespace

* Revised rawStringsFieldNames

* Dialed down on lua trickery and fixed wrongly formatted changelog entry

* Fixed changelog in wrong place and made customRawData a proper module

* Fixed not caching not-present tags, revised examples and fixed error

* Fixed whitespace. Changing settings in editor!

* customRawData docs

* Added getCreatureTag for respecting caste tags, "fixed" bizarre caching error (quotes because I don't even know what was causing it) and updated docs

* Added line limiting for docs, I guess

* Added missing string convert argument

* docs indent fix, code block fix, and revision

* Major revision

* gdi, docs error

* Another? But... huh.

* ...

* Made requested changes

* Whoops

* Rearrange docs lines

* Followed example, should fix linter issues

* fix typo. linted offline this time......

* Make it so that last instance of tag is what is read from

* Added requested change

* eventful key change

* i to lenArgs

* change eventful key

* add test for broken caste selection

* Major redesign

* tags --> tokens

* Added plant growth behaviour and did some requested changes

* More error handling

* fix docs

* Added basic error suppression

* Docs clarification.

* Docs registering example and fix error

* Strip errors on frame after onWorldLoad, not on map load

* Revert "Strip errors on frame after onWorldLoad, not on map load"

This reverts commit e20a0ef8d3743f79d961077f46910b77b16f36b9.

* Revert "Docs registering example and fix error"

This reverts commit 9c848c54c3f84e0ecc1dc421137c8a8b4a52280d.

* Revert "Docs clarification."

This reverts commit 6b4b6a1aa40c50398504f37ecf1ff0f93d6459b1.

* Revert "Added basic error suppression"

This reverts commit d11cb1438cf1e56ff700469e944f0b9af64651d7.

* Use more eventful key more consistent with other files

* use onStateChange instead of eventful and remove redundant utils require

* Code review stuff

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update docs/Lua API.rst

committing a suggestion

Co-authored-by: Alan <lethosor@users.noreply.github.com>

* Prepend examples with DFHACK_

* Remove unused parameters

* Use new ensure_key global

* Named a couple of unnamed arguments (untested)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Alan <lethosor@users.noreply.github.com>
2022-04-29 08:39:59 -07:00
Timur Kelman f08a268e8a
add scroll icons to Label widget (#2101)
* WIP: add scroll icons to Label widget

It's an opt-out. The icons are rendered in the right-most column of the 1st and last row. They are only rendered when text can actually be scrolled in the corresponding direction.

WIP: Currently, the icons might overlay text characters, there is no mechanism preventing it

* gui.lua: expose the `parse_inset()` function

* refactor Label's scroll icon code

* since `render_scroll_icons` only works with a label, it's now a class function
* `update_scroll_inset` ensures `frame_inset.r` or `.l` is at least 1, according to `show_scroll_icons`
* `show_scroll_icons` has 4 possible values: `false` for no icons, `left` for icons on the first column on the left (also ensuring `frame_inset.l >= 1`), `right` - last column on the right, `DEFAULT_NIL` - same as `right` if text height greater than `frame_body.height`, else same as `false`.

* make `render_scroll_icons` always draw icons

The check now happens in `onRenderFrame`

* draw frame's background

calling `Label.super.onRenderFrame(self, dc, rect)` makes frame's background invisible for some reason

* remove trailing spaces

* fix scroll icons placed far above/below text

 With `Label.frame_inset = 1` the text could be vertically centered with plenty of space below and above,
but not all rendered. Before this change, the scroll icons would be at the very top and bottom of the frame
instead of near the first and last rendered text line.

* always `update_scroll_inset` to react to resized window

* draw scroll icons next to text

* update `Lua API.rst` with new `Label` parameters

* move comment separator up

This way every scroll related parameter is in one group

* list default values for new parameters in docs

* add missing description of `Label.scroll_keys`
2022-04-29 06:55:08 -07:00
myk002 dcadde38d7 add new global function: ensure_key 2022-04-27 17:35:49 -07:00
myk002 6ad362d698
return a reference to the created dialogs 2022-04-27 11:51:46 -07:00
myk002 ed5523152c
factor text wrapping out of TooltipLabel into WrappedLabel 2022-04-22 09:53:10 -07:00
myk002 809f9316fd
make frame inset configurable for ListBox list 2022-04-22 08:30:53 -07:00
Josh Cooper 9c9a7ef99a Adds consistent interface signatures for Maps module 2022-04-21 19:40:58 -07:00
DFHack-Urist via GitHub Actions 62b02c2367 Auto-update submodules
library/xml: master
2022-04-19 07:17:48 +00:00
Josh Cooper 251f4f92c8 Fixes build errors 2022-04-18 23:53:23 -07:00
Josh Cooper ff2bd8d953 Retypes the EventManager's constructions container 2022-04-18 23:53:23 -07:00
Josh Cooper d6b2629cfc Adds hash functions and operator overloads for event data structures 2022-04-18 23:53:23 -07:00
Josh Cooper 64b7de0339 Revises getVerb signature 2022-04-18 22:46:38 -07:00
Josh Cooper 018d189494 Simplifies report index safety 2022-04-18 22:46:38 -07:00
Josh Cooper 1f972d6c1c Implements clang-tidy suggestions 2022-04-18 22:46:38 -07:00
myk002 07761e1d5d add some more handy widgets to the library
TooltipLabel
HotkeyLabel
CycleHotkeyLabel
ToggleHotkeyLabel
2022-04-18 17:37:11 -07:00
Timur Kelman cb123e5076
default unset `frame_inset` values to 0 (#2100)
* default unset `frame_inset` values to 0

This change allows writing `frame_inset = {r=1}` instead of `frame_inset = {l=0, r=1, t=0, b=0}`
2022-04-16 08:17:35 -07:00
Josh Cooper 9bf9a79a11
EventManager/Eventful - Generate event arrays (#2097)
* Replaces EventManager.cpp's event array with an auto-gen one

* Replaces eventful.cpp's event array with auto-gen one
2022-04-14 21:47:25 -07:00