Skip to content

Lay out dialogs the way Factorio's own are - #1669

Merged
RedRafe merged 3 commits into
Refactorio:developfrom
lex:gui-dialogs
Nov 2, 2026
Merged

RedRafe merged 3 commits into
Refactorio:developfrom
lex:gui-dialogs

Conversation

@lex

@lex lex commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Every dialog gets the same layout, like Factorio's own: its content in an inner frame, and one row of buttons along the bottom, all the same height, with space between them to drag the window by. Following the rule from #1668's review, no dialog has a Close or Cancel button: its X closes it.

Change

  • utils/gui.lua:
    • Gui.add_dialog(player, spec): a window (Gui.add_window) with its content in a padded inner frame (inside_shallow_frame_with_padding). Returns the window, the content and the X.
    • Gui.add_dialog_buttons(frame, left, right): the row of buttons under it. left holds the likes of Clear and Reset, right the likes of Delete and then the confirming button. Without a style of their own, the last one on the right is a confirm_button and the rest dialog_buttons, so they all line up. A drag space between the two sides is never narrower than 24, so every dialog has somewhere to drag it by.
    • Docked side panels keep their width when they don't all fit beside each other, instead of being squashed into scroll bars.
  • Dialogs with buttons (screenshots 1 to 6):
    • the poll editor: Clear on the left, Delete (when editing) and Create poll on the right;
    • the task editor: Clear, then Create task;
    • the announcements editor: Clear and Reset, then Confirm;
    • the tag editor: Delete (when editing), then Create;
    • the report form: Submit; Cancel goes;
    • popups: OK, now the confirming button.
  • Dialogs whose only button was Close keep only their X, with their content in the inner frame (screenshots 7 to 12): the reports list, Configure Restart, Radio, Rich Text, the description generator and the paint palette.
  • Rich Text's eleven image types sit in a 4 by 3 grid, with the picker, a slot_button_in_shallow_frame, in the twelfth place, and the text box below as wide as the grid (screenshot 10).
  • Styles go through Gui.set_style in the code this touches.

Tests

Screenshots

1_poll_editor 2_task_editor 3_announcements_editor 4_tag_editor 5_report_form 6_popup 7_reports_list 8_restart 9_radio 10_rich_text 11_description_generator 12_paint_palette

🤖 Generated with Claude Code

Gui.add_dialog puts a window's content in a padded inner frame, and Gui.add_dialog_buttons adds
the row of buttons below it: the likes of Clear on the left, the confirming button on the right,
space to drag the window by between them, and all of them the same height. A dialog has no Close
or Cancel button: its X closes it. The poll, task, announcement and tag editors, the report form,
the jail confirmation and popups use them. A window whose only button was Close now closes with
its X alone. Docked panels keep their size when they don't all fit, and the announcements in Tasks
read as text rather than an input field.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lex
lex marked this pull request as ready for review October 30, 2026 10:35
@RedRafe

RedRafe commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

This probably doesn't matter since it's never used, but for Rich Text I'd put the 11 fields into a 3x4 | 4x3 | 6x2 table with sprite button in the 12th spot so it's more appealing. For the button style, I'd use the lot button in shallow frame one

Other than that, everything looks clean

lex and others added 2 commits November 1, 2026 15:45
…t slot

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lex

lex commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Thanks! Done in 1193f4b: the eleven image types are a 4 by 3 grid with the picker in the twelfth place, as a slot_button_in_shallow_frame, and the text box under them is as wide as the grid (screenshot 10).

And from your review of #1670, ea2d63c takes the announcements back to their own text box, so they stand out; that change was in this PR, not #1670.

@RedRafe
RedRafe merged commit e7e3a6f into Refactorio:develop Nov 2, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants