Myk Taylor
72d5760ff6
add CycleHotkeyLabel:setOption()
2023-01-07 01:00:40 -08:00
Myk
fe9d1e186e
Merge pull request #2562 from myk002/myk_greenify
...
allow color options for CycleHotkeyLabel
2023-01-06 19:10:39 -08:00
Myk Taylor
093eac3eb2
use a black background for non-top ZScreen titles
2023-01-06 18:58:08 -08:00
Myk Taylor
810430f1a2
make windows lockable (can ignore r-click and esc)
2023-01-06 18:48:53 -08:00
Myk Taylor
f43358002d
Allow dialogs to close on r-click
2023-01-06 15:43:08 -08:00
Myk Taylor
f15e9e3577
don't revert to plain strings for pens
2023-01-06 15:42:30 -08:00
Myk Taylor
e111a73763
allow color options for CycleHotkeyLabel
...
and use the option to render `On` in green for ToggleHotkeyLabel
2023-01-06 15:42:27 -08:00
Myk Taylor
1934014659
framework for passthru, z-order swapping windows
2023-01-05 18:07:38 -08:00
Myk Taylor
c4a2bdd08e
update lua too
2023-01-05 17:35:33 -08:00
Myk Taylor
55cdaea636
refactor EditField text insertion
2023-01-03 12:57:02 -08:00
Myk Taylor
a0343b06a6
adjust text wrap to new scrollbar width
2023-01-03 00:56:07 -08:00
Myk
35ce361b09
Merge pull request #2542 from myk002/myk_dwarfmode_dims
...
clear out obsolete area map and menu logic from the Gui module
2023-01-02 20:42:30 -08:00
Myk Taylor
da63d6294b
ensure the scrollbar midpoint is always rendered
...
this mimics the vanilla scrollbar behavior (and looks better)
2023-01-01 17:55:06 -08:00
Myk Taylor
7d5d2d0a9b
clear out obsolete area map and menu logic
...
in particular, return the correct map dimensions in getDwarfmodeDims()
2022-12-31 22:49:30 -08:00
Myk
bf995a0968
Merge pull request #2533 from myk002/myk_lua_input
...
adjust Lua widgets to new input scheme
2022-12-30 22:37:12 -08:00
Myk
a7dd14d699
Merge pull request #2535 from myk002/myk_smart_refresh
...
only do a full refresh when needed
2022-12-30 22:36:42 -08:00
Myk Taylor
cf65f48aa0
don't use defunct MENU_CONFIRM keybinding
2022-12-30 22:35:08 -08:00
Myk Taylor
21f137644f
remove trailing whitespace
2022-12-30 22:35:08 -08:00
Myk Taylor
3a76fc086f
fix keyboard movement of Panel widgets
2022-12-30 22:35:08 -08:00
Myk Taylor
6871bc20c4
use new KEYBOARD interface keys in move delta
2022-12-30 22:35:08 -08:00
Myk Taylor
04f2d555c6
implement context-aware mouse wheel scrolling
2022-12-30 22:35:08 -08:00
Myk Taylor
38b525bdb5
adapt lua library widgets to new keyboard keybindings
2022-12-30 22:35:08 -08:00
Myk Taylor
dd0cc087d5
Revert "consolidate full refresh logic in widgets.Panel"
...
This reverts commit 33787473f0
.
I've already found another use case where we need a more general
implementation -- modal dialogs that inherit from FramedScreen that
appear and disappear
2022-12-30 22:13:53 -08:00
Myk Taylor
33787473f0
consolidate full refresh logic in widgets.Panel
2022-12-30 20:44:15 -08:00
Myk Taylor
88dcdfd158
move trigger code from Window to Panel
...
where the drag/resize code actually is. Panels can be dragged around the
parent screen without them being a Window
2022-12-30 20:01:09 -08:00
Myk Taylor
70a0f4a718
only do a full refresh when needed
...
this significantly reduces CPU utilization when DFHack-owned screens are
visible.
2022-12-30 17:06:41 -08:00
Myk Taylor
3aac79fe4f
skin our scrollbars to look and hover like DF's
2022-12-30 05:33:17 -08:00
Myk Taylor
cff603e243
allow Labels to write tile textures
2022-12-28 23:16:13 -08:00
lethosor
6a61c750e9
widgets.render_text(): error early if key is invalid
...
This helps identify _which_ key is invalid - otherwise, getKeyDisplay()
complains that it was called with `nil`, which is less helpful.
2022-12-23 13:17:26 -05:00
Myk
42203b13f4
Merge pull request #2500 from myk002/myk_panel_drag
...
Support resizing for DFHack Panel widgets
2022-12-15 14:36:33 -08:00
Myk Taylor
06346c6269
implement double clicking on the title to maximize
...
also double click on a maximized window to jump to the minimum size
the location of the window isn't guaranteed to be the same after
maximizing and un-maximizing, but we could implement that if there is
call for it.
2022-12-14 19:03:38 -08:00
Myk Taylor
434e9322cc
fix error in error message formatting
2022-12-14 17:51:07 -08:00
Myk Taylor
4c6daf30d9
add widgets.Window and fix paint_frame offset
2022-12-14 12:04:29 -08:00
Myk Taylor
12e62c7f9d
highlight anchor point when resizing with keyboard
2022-12-14 10:34:06 -08:00
Myk Taylor
c030704705
implement panel resizing
2022-12-14 10:34:04 -08:00
Myk Taylor
99b599e9ab
add docs for panel dragging
2022-12-13 13:01:49 -08:00
Myk Taylor
3f43f72731
fix the math
2022-12-13 12:39:17 -08:00
Myk Taylor
38a3bec953
dragging logic
2022-12-12 18:07:05 -08:00
myk002
2b87307e11
allow visible and active to be dynamic properties
2022-12-04 15:46:19 -08:00
Myk
aac89d4942
Merge branch 'develop' into myk_default_search_key
2022-11-29 15:07:12 -08:00
myk002
726771c8d3
supply default search key for tokenized text
2022-11-28 16:02:47 -08:00
myk002
adb9c5ea12
fix frame size calculation when frame_inset is set
...
also fix error when clicking on HotkeyLabels where no on_activate
callback has been set
2022-11-28 15:12:22 -08:00
myk002
c9cf5ecca8
we kept editfield as MOUSE_L for click and drag
2022-11-21 17:51:24 -08:00
myk002
24dc879888
adapt library code to newly correct mouse events
2022-11-21 17:36:46 -08:00
myk002
5b1ebdf72a
don't return list idx when mouse is on scrollbar
2022-11-11 10:40:10 -08:00
Myk
ccd43f1710
Merge pull request #2381 from myk002/myk_framed_panel
...
[widgets.Panel] support frames around panel widgets
2022-11-09 10:32:23 -08:00
myk002
32dc80729a
support drawing frames around panels
2022-11-07 16:50:21 -08:00
myk002
83f560a6f4
allow shift-click to trigger submit2 for List
2022-11-07 16:14:16 -08:00
myk002
1b7b75d8ab
factor out detection of the list index under mouse
2022-11-07 16:13:45 -08:00
Myk
a854e379b2
Merge pull request #2354 from myk002/myk_scrollbars_redux
...
make scrollbars more responsive when dragging
2022-10-22 20:28:52 -07:00
myk002
64b923b9eb
make the materials dialog filter lcase only
...
this allows the capital letter hotkeys to be processed by the list
widget without the special-casing of the ignore_keys attribute.
2022-10-21 12:43:53 -07:00
myk002
593b80cfa0
make scrollbars more responsive when dragging
2022-10-21 12:22:57 -07:00
myk002
1e21e6546e
fix materials selection dialog
...
where the filter was swallowing the sublist hotkeys
2022-10-19 17:31:28 -07:00
myk002
142b45ef49
move list item hotkey hint left by one tile
...
so it doesn't get covered by the scrollbar
2022-10-19 17:30:51 -07:00
myk002
d650ba2377
ensure scrollbar can never get ahead of the cursor
2022-10-10 16:42:32 -07:00
myk002
ba36e72b33
support click and drag for scrollbars
2022-10-07 16:27:19 -07:00
myk002
35eb4e08dd
hold down the mouse button to continue scrolling
2022-10-07 15:40:05 -07:00
myk002
2bff70a290
add unit tests for widgets.Scrollbar
2022-10-07 13:14:52 -07:00
myk002
5722d6914b
transition Label to use the new generic Scrollbar
2022-10-07 12:45:43 -07:00
myk002
24232e894a
create Scrollbar widget and integrate with List
2022-10-06 11:13:16 -07:00
Myk Taylor
3b650c8d0b
don't let changes to the lua cursor bleed through
...
before, we could end up changing the state of whoever last called
guidm.setCursorPos()
2022-09-18 08:20:33 -07:00
myk002
6fff83de5a
fix EditField rendering with TWBT
2022-09-16 15:24:33 -07:00
myk002
b88d343ddd
fix off-by-one error on scrollbar click detection
2022-09-14 09:25:43 -07:00
myk002
d4914e7511
implement mouse click reactions for scrollbar
2022-09-11 19:33:01 -07:00
myk002
e2fbade219
fix scrollbar display when all text is visible
...
also align behavior with documentation when 'left' or 'right' is
explicitly specified (i.e. always show the scrollbar)
2022-09-11 18:56:43 -07:00
myk002
f71f034d1d
show full scrollbars instead of just scroll icons
2022-09-11 17:58:10 -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
myk002
27e189fef2
no cursor position reset when updating list filter
2022-08-29 15:17:17 -07:00
myk002
8acda4d6c8
Interpret '4' & '6' as strings, not movement keys
2022-08-19 22:40:53 -07:00
myk002
7f0791f6c3
use setText() accessor method instead of direct access
2022-08-15 16:24:34 -07:00
myk002
22f9f3b042
add unit tests for new widget functionality
2022-08-15 16:24:34 -07:00
myk002
0ae4fed3cf
add mouse support for CycleHotkeyLabel widgets
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
a5af5a1373
don't bork on no frame, set cursor to end of text
2022-08-15 16:24:34 -07:00
myk002
4e382c7b3b
make HotkeyLabels react to clicking
...
also be better about initializing EditField frame height
2022-08-15 16:24:34 -07:00
myk002
8de8b22566
click to correct cursor position on long strings
...
where the left side of the string has been trimmed
2022-08-15 16:24:34 -07:00
myk002
b7f74fe2ce
allow mouse lclick to select a List item
2022-08-15 16:24:34 -07:00
myk002
1dd3d6656b
move the cursor in an EditField on mouse lclick
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
214dd3c579
reset scroll position when the text is changed
2022-08-15 16:24:34 -07:00
myk002
64b793b409
support EditField:setText() so scripts can use it
...
and be compatible with both the develop and docs branch
2022-07-20 15:40:49 -07:00
Timur Kelman
9788a8a22a
Add default selection handler to `materials.ItemTraitsDialog` ( #2211 )
...
* add forward compatibility for future `job_item_flags`
* add default selection handler to `materials.ItemTraitsDialog`
* add a call to `error()` in 'unknown'-branch inside `setTrait`
* add `ItemTraitsDialog` improvement description to changelog.txt
2022-06-28 16:27:18 -07:00
Timur Kelman
1a629a26bf
add `ItemTraitsDialog` to materials.lua ( #2199 )
...
* add `ItemTraitDialog` to materials.lua
* rename `ItemTraitDialog` to `ItemTraitsDialog` (plural)
* Update changelog.txt
2022-06-12 07:03:04 -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
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
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
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
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
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
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
myk002
07761e1d5d
add some more handy widgets to the library
...
TooltipLabel
HotkeyLabel
CycleHotkeyLabel
ToggleHotkeyLabel
2022-04-18 17:37:11 -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
e6299700bf
Handle punctuation in FilteredList filter matching ( #2085 )
...
* allow punctuation to be typed into a filter
and allow the filter to match keys with punctuation
2022-04-11 18:22:31 -07:00