Commit Graph

169 Commits (ee51e830ad01f428c757e3738d8434e9d65c9b2f)

Author SHA1 Message Date
Myk Taylor 8e718d9851
add docs for dfhack.gui.getMousePos() 2022-09-18 13:31:20 -07:00
Myk d5cfbf5e77
Merge branch 'develop' into modding-guide 2022-09-14 10:57:58 -07:00
Myk 51f5349baf
labels must go above a section header 2022-09-14 10:43:51 -07:00
myk002 0e30160c3c update documentation documentation 2022-09-12 14:50:48 -07:00
Myk 04754b0a81
Merge branch 'develop' into modding-guide 2022-09-11 23:00:33 -07:00
myk002 d4914e7511
implement mouse click reactions for scrollbar 2022-09-11 19:33:01 -07:00
myk002 f71f034d1d
show full scrollbars instead of just scroll icons 2022-09-11 17:58:10 -07:00
Myk 09372680a2
Merge pull request #2281 from myk002/myk_helpdb_wrap
[helpdb] dynamically wrap long help text, preserving block indents
2022-09-11 14:40:43 -07:00
myk002 2311158792
fix reference to old ls param in Lua API docs
also add another example to the ls example commands
2022-09-11 14:06:21 -07:00
myk002 23994d4f4c
dynamically wrap helpdb long help text (default 80) 2022-09-11 13:41:20 -07:00
myk002 cae2bca0a7
add dfhack.screen.hideGuard 2022-09-10 09:49:43 -07:00
myk002 b1a8662c4a
Merge branch 'develop' into docs 2022-08-31 23:00:39 -07:00
myk002 074a6ec5cd allow EditFields to ignore specified keys
like "+" and "-", so you can use them as hotkeys in the parent view
2022-08-31 10:22:41 -07:00
Myk 29d4d530b5
Merge branch 'develop' into modding-guide 2022-08-27 09:00:53 -07:00
Tachytaenius 0b6178f5d2
Apply suggestions from code review
Co-authored-by: Myk <myk.taylor@gmail.com>
2022-08-27 15:24:22 +01:00
Tachytaenius 155525b853 Update Lua API.rst 2022-08-26 20:33:23 -07:00
myk002 df9c37a8b7
Merge branch 'develop' into docs 2022-08-15 17:09:36 -07:00
myk002 8672282fd8
add helpdb, unit test, and document API
note that we have to dynamically sort some of the expected lists for
locale agnosticism
2022-08-15 16:31:52 -07:00
myk002 6fd0f4505f add dfhack history repository and expose to lua 2022-08-15 16:27:43 -07:00
myk002 7dddb5e2ed document widget mouse integration 2022-08-15 16:24:34 -07:00
myk002 79b6cd13e9 support scrolling by half pages in Label 2022-08-15 16:24:34 -07:00
myk002 0aa9a187cf support cursor movement in EditFields 2022-08-15 16:24:34 -07:00
myk002 43b1abcdcf support submit2 for EditFields 2022-08-15 16:24:34 -07:00
myk002 a4c8535977 add argparse int checking methods, more docs 2022-08-15 16:15:41 -07:00
myk002 a8d0cc7980
support scrolling by half pages in Label 2022-08-06 23:48:25 -07:00
myk002 e677e8098d
add docs for plugins that only provide Lua apis 2022-07-27 15:48:11 -07:00
myk002 6b1c0b5308
rename building-hacks section 2022-07-25 06:53:08 -07:00
myk002 629c22b148
update docs for building-hacks 2022-07-18 16:38:28 -07:00
myk002 f354200728
update widget docs 2022-07-16 22:23:22 -07:00
myk002 27425e47f6
support cursor movement in EditFields 2022-07-15 22:22:51 -07:00
myk002 9b340a7630
support submit2 for EditFields 2022-07-15 13:46:01 -07:00
Tachytaenius 0e704f39f7 Got the really big part of the guide done 2022-07-15 19:28:59 +01:00
myk002 c9a87511bd
add dfhack history repository and expose to lua 2022-07-15 09:18:27 -07:00
Tachytaenius 063e4897a8 Forgot to stage a change 2022-06-20 20:31:19 +01:00
Warmist fc384fd1a2
Update eventful.lua (#2203)
* Update eventful.lua

Had wrong function. Fixes https://github.com/DFHack/dfhack/issues/2202

* Update Lua API.rst

Update docs to add onReactionCompleting and remove outdated info

* Update Lua API.rst

Some more minor doc fixes

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

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

* add changelog entry

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-06-12 07:12:49 -07: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
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
Josh Cooper fe29bff845
Adds cxxrandom unit test and fixes interface problems (#2099)
* Adds cxxrandom unit test and fixes interface problems

* Tightens braces

* Adds detection code for Shuffle's seqID/engID

* Adds usage examples for cxxrandom

* Gives cxxrandom objects id ranges, sort of

* Updates changelog

* Updates changelog.txt

* Increases id space for cxxrandom

* Fixes bool distribution error message and improves check

* Adds comment explaining the seeded RNG tests for cxxrandom

* Fixes type problem for 32bit builds

* Reduces loop count a few magnitudes

* Fixes a mistake in test.cxxrandom_seed
2022-04-30 21:46:47 -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 ed5523152c
factor text wrapping out of TooltipLabel into WrappedLabel 2022-04-22 09:53:10 -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
Myk fd1ee233a2
automatically manage sidebar modes in MenuOverlay (#2083) 2022-04-11 20:58:54 -07:00
Myk 10f22ecc27
add ResizingPanel class and autolayout for Panels (#2086)
* add autolayout for Panels and new ResizingPanel
2022-04-11 18:25:00 -07:00
Myk 4f9608da13
Document and update argparse module (#2089)
also add unit tests and use new string fns in processArgs and allow it to recognize parameters with two dashes instead of just one
2022-04-11 16:16:55 -07:00
Myk 96b5b4420b
Add string:escape_pattern() utility function (#2082)
* add string:escape_pattern() to dfhack.lua

stolen from devel/query.lua. will migrate scripts to use the common implementation later
2022-04-10 21:18:01 -07:00
Myk c603d6a9f3 Move docs for include_prefix param to correct function
It was listed under listdir, but it only appears in listdir_recursive
2022-04-08 23:13:10 -07:00