Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/widgets #4955

Merged
merged 9 commits into from
Sep 28, 2024
Merged

Refactor/widgets #4955

merged 9 commits into from
Sep 28, 2024

Conversation

wiktor-obrebski
Copy link
Contributor

@wiktor-obrebski wiktor-obrebski commented Sep 22, 2024

Refactor massive widgets.lua into module per component style.

No API or logic has been changed (at least intentionally).

This is a preparation to add TextArea (gui/journal style input widget) and migrate TextField widget to journal style features.

wiktor-obrebski and others added 7 commits September 22, 2024 10:45
ResizingPanel, Pages, EditField, HotkeyLabel, Label and Scrollbar
WrappedLabel, TooltipLabel, HelpButton, ConfigureButton, BannerPanel
TextButton, CycleHotkeyLabel, ButtonGroup, ToggleHotkeyLabel, List
FilteredList, TabBar, Tab, RangeSlider, DimensionsTooltip
Comment on lines +36 to +39
DOUBLE_CLICK_MS = Panel.DOUBLE_CLICK_MS
STANDARDSCROLL = Scrollbar.STANDARDSCROLL
SCROLL_INITIAL_DELAY_MS = Scrollbar.SCROLL_INITIAL_DELAY_MS
SCROLL_DELAY_MS = Scrollbar.SCROLL_DELAY_MS
Copy link
Member

@myk002 myk002 Sep 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we'll probably need a function-based API for these config elements. As written, if you change these values via the control panel, the relevant widgets won't actually see the changed value and will not change their behavior. See scripts/internal/control-panel/registry.lua for how these values are interacted with.

We could change them to a function interface, like we did for HIDE_ARMOK_TOOLS in dfhack.lua. It is now wrapped with getMortalMode() and setMortalMode() functions. The code in the control panel registry would then have switch to call the new API instead of setting the values directly (this is not hard -- see how the mortal mode functions are called).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure TabBar should be classified as a container. It's meant to be used alongside a container, like a Pages widget, but it doesn't contain other widgets itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved to root widgets dir

Comment on lines 32 to 34
parse_label_text = Label.parse_label_text
render_text = Label.render_text
check_text_keys = Label.check_text_keys
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are there any existing usages of these three functions (parse_label_text, render_text, and check_text_keys)? they aren't really intended for public use. they could probably stay as an internal API and not be exposed in widgets

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right.
removed from the public API.

@myk002 myk002 merged commit 7c417a4 into DFHack:develop Sep 28, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants