Commit Graph

116 Commits (528d7b1be146f04d6f2c414e6b932967e3a73e76)

Author SHA1 Message Date
Myk Taylor 21d160c478
terminology change: locked -> pinned 2023-01-13 16:07:27 -08:00
Myk Taylor 6c6c4e159f
add reminder why we can't clear mouse_lbut 2023-01-13 12:17:51 -08:00
Myk Taylor 15998f2ebe
add gui.TRANSPARENT_PEN for clearing the UI layer 2023-01-12 12:44:50 -08:00
Myk Taylor 079d5e4178
support foreground and background writing from pens 2023-01-12 12:30:07 -08:00
Myk c26ed36893
Merge pull request #2577 from myk002/myk_get_any
get rudimentary getAny(Unit|Item|Building) working
2023-01-09 23:50:02 -08:00
Myk Taylor fecc733192
detect clicks on part of pin that sticks up 2023-01-09 12:52:26 -08:00
Myk Taylor f39684dbfd
pass getAny calls through ZScreens 2023-01-09 09:35:55 -08:00
Myk Taylor 2234328a91
use an actual pin texture for ZScreen pins 2023-01-09 00:47:13 -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 1f5ae4165f
return self from raise, update docs 2023-01-06 15:43:08 -08:00
Myk Taylor fccefd1155
don't pass through handled r-clicks 2023-01-06 15:43:08 -08:00
Myk Taylor 574be3fe73
provide a useful default impl of isMouseOver 2023-01-06 15:42:40 -08:00
Myk Taylor 1934014659
framework for passthru, z-order swapping windows 2023-01-05 18:07:38 -08:00
Myk Taylor 9fd3ef7b4b
correct mouse down behavior without hosing enabler
before, we inhibited multiple mouse button down events by overwriting
the values in enabler. now we keep state internally and inhibit multiple
events on our own.

also add events and state tracking for middle mouse button
2023-01-03 14:52:49 -08:00
Myk Taylor 1d7a7c8a49
Don't leave artifats behind when dimissing mboxes 2022-12-30 22:20:50 -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 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 d7b67e9528
remove cached USE_GRAPHICS from gui.lua
it's no longer constant
2022-12-28 16:27:44 -08:00
Myk Taylor 99ffe769fa
rendering the parent now involves a full refresh
in order to get the background
2022-12-27 15:23:34 -08:00
Myk Taylor 033eb2aefd
use default background colors
and ensure texpos_lower doesn't peek through
2022-12-27 15:05:13 -08:00
Myk Taylor 75afa88790
use tiles for our default frame 2022-12-27 14:40:35 -08:00
Myk Taylor 663e1dd541
ascii is now in color 2022-12-20 16:33:11 -08:00
Myk Taylor 4c6daf30d9
add widgets.Window and fix paint_frame offset 2022-12-14 12:04:29 -08:00
myk002 2b87307e11
allow visible and active to be dynamic properties 2022-12-04 15:46:19 -08:00
myk002 fb6483fe6c
allow frames to be drawn without DFHack signature 2022-11-28 15:04:28 -08:00
myk002 28aadea6af
allow an alternate ViewRect for getMousePos 2022-11-07 15:54:56 -08:00
myk002 be18f4e900
return self from Screen:show() as a convenience 2022-11-07 15:54:55 -08: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
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
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
lethosor 5e09fd882d
Fix Painter:viewport()
This works because Painter inherits from ViewRect. Unsure how this went unnoticed.
2021-03-27 16:55:48 -04:00
lethosor dfac5bc143
Update gui.Painter docs, add sections to dfhack.screen, add more links, etc 2020-09-23 22:00:39 -04:00
lethosor 5081710900 Merge remote-tracking branch 'ThiagoLira/develop' into develop
Also fixed whitespace from #1251

Closes #1186
2018-04-04 17:13:07 -04:00
ThiagoLira b7bd88352e fixed bug causing gui scripts to fail when sidebar is closed 2018-04-04 17:42:46 -03:00
Warmist 25d2938477
Fix parse_inset in gui.lua
It was used in different order than the return happened.
2018-03-11 12:40:30 +02:00
lethosor ae1aa49089 Add map parameter to Lua paintTile() and use in Painter
Also updated gui/siege-engine.lua
2017-06-02 12:42:51 -04:00
lethosor c21b7bf941 Add a Painter:key_string() method 2017-03-01 15:56:50 -05:00
Alexander Gavrilov 9703d3fd8f Detect mouse press events for lua. 2012-12-02 14:43:23 +04:00
Alexander Gavrilov 0bfe006016 Try to reimplement the inventory monitor by falconne in lua.
For no other reason than to provide a complete example of lua
interface for a native plugin :)

TODO: paint the graph in the right pane.
2012-11-30 19:10:17 +04:00
Alexander Gavrilov 94e6690586 Don't complain about fake input tokens in simulateInput. 2012-11-29 13:37:16 +04:00
Alexander Gavrilov 9598316855 Add a native pen object for lua with a more checked behavior. 2012-11-03 20:06:33 +04:00
Alexander Gavrilov a1dd31aab3 Tweak the mechanics for showing and rendering lua screens.
- Place new screens below any dismissed ones on top.
- When asked to render a dismissed lua screen, call render() on its
  parent to avoid producing a black screen frame when unlucky.
2012-10-25 12:09:39 +04:00
Alexander Gavrilov 0046b093f7 Link visibility and event handling order.
- Hidden widgets don't receive events.
- Children handle events in top to bottom order.
2012-10-17 11:49:11 +04:00
Alexander Gavrilov 023dc82564 Implement a material selection dialog. 2012-10-16 18:33:00 +04:00
Alexander Gavrilov d336abfd97 Add label and list widgets, and switch stock dialogs to them. 2012-10-16 14:18:35 +04:00
Alexander Gavrilov abfe2754fb Start implementing common widgets for lua screens. 2012-10-15 20:03:18 +04:00
Alexander Gavrilov 33bd8103de Extract an abstract View superclass from Screen to handle widget trees. 2012-10-15 15:30:00 +04:00
Alexander Gavrilov abf503fcdc Fix the ListBox dialog to behave in a more consistent way. 2012-10-02 16:45:17 +04:00
Alexander Gavrilov 9d5adf1b2f Update the lua screens to use the new key display string API function. 2012-10-02 15:25:59 +04:00
Alexander Gavrilov 57b72831ca Overhaul the concept of lua 'class' initialization yet again. 2012-09-18 20:30:25 +04:00
Alexander Gavrilov d5ea05ebb8 Implement a pressure plate sensitive to machine power.
When built next to a gearbox, it will monitor its powered state.
2012-09-06 12:37:29 +04:00
Alexander Gavrilov 57086ac56e Add stock MessageBox and InputBox dialog screens for lua scripts. 2012-09-05 19:45:45 +04:00
Alexander Gavrilov 41ad42d0fd Expose the liquids plugin engine to lua, and make a wrapper gui script. 2012-08-25 10:37:03 +04:00
Alexander Gavrilov 296f82b02f Try using the Objective-C 'alloc + init' idiom for lua screen objects. 2012-08-24 13:28:34 +04:00
Alexander Gavrilov e825dc5ddb Tweak the API for current viewscreen, and dispatch show/dismiss from C++. 2012-08-24 13:20:08 +04:00
Alexander Gavrilov cf4b8a0196 Improve viewport manipulation utilities and support scroll in mechanisms.
I.e. allow the user to scroll around with cursor keys,
provided that keeps the cursor still visible.
2012-08-22 22:29:01 +04:00
Alexander Gavrilov 7987ea9a98 Put some compatibility features into the base dfhack viewscreen. 2012-08-22 18:18:19 +04:00
Alexander Gavrilov 6e8b68fb29 Add yet one more frame style. 2012-08-22 13:06:06 +04:00
Alexander Gavrilov 2b79582e99 Implement a policy of marking DFHack-owned screens with a signature. 2012-08-22 12:28:01 +04:00
Alexander Gavrilov 15235cc938 More work on utilities for making lua viewscreens. 2012-08-21 19:40:37 +04:00
Alexander Gavrilov 451e965936 Add a Painter class for lua viewscreens, and extract other utilities.
Painter clips to an arbitrary rectangle window, and
tracks current cursor and color state.
2012-08-21 11:35:39 +04:00
Alexander Gavrilov 601a3a7927 Add a script that implements a linked mechanism browser. 2012-08-20 23:04:01 +04:00
Alexander Gavrilov cacb082416 Add a stupid example of a lua-controlled viewscreen. 2012-08-19 17:53:25 +04:00