Commit graph

122 commits

Author SHA1 Message Date
Kp 07c52f14f9 Save parent canvas in listbox_layout 2021-09-12 16:20:52 +00:00
Kp 8d67bcddb0 Record parent canvas in newmenu
Use it to avoid resetting to the screen canvas when preparing the
layout.
2021-09-12 16:20:52 +00:00
Kp e7aa9855e0 Compute menu border widths from screen canvas instead of screen
In practice, this should be the same result.  However, this allows the
flexibility to use a canvas other than the screen.
2021-09-12 16:20:52 +00:00
Kp 13e29c64f3 In debug builds, initialize newmenu_item type,text to poison values
This improves the chance that an unset value will abort rather than
displaying strange results.  Release builds are unchanged.
2021-06-28 03:37:51 +00:00
Kp 212400d140 Convert nm_messagebox_str to use messagebox_newmenu 2021-06-28 03:37:50 +00:00
Kp 9044a19d78 Fold passive_messagebox_item into passive_messagebox 2021-06-28 03:37:50 +00:00
Kp 4c34875c84 Remove unused subfunction_handler
Previous commits eliminated all uses of it.  Remove the unused stubs.
2021-06-28 03:37:50 +00:00
Kp 63ac8a1f5d Move saved_text out of imenu_specific_type
This significantly shrinks newmenu_item, by not embedding a saved_text
in the union that is present in every newmenu_item.
2021-06-28 03:37:49 +00:00
Kp 93a7e34caf Move newmenu_item slider storage of saved_text out of line
When other newmenu_item private members also move, this will make
newmenu_item smaller.
2021-06-28 03:37:49 +00:00
Kp 1936b771e1 Construct nm_item_input in place 2021-06-28 03:37:49 +00:00
Kp ef6e36f7ee Move newmenu_item union members into named union 2021-06-28 03:37:49 +00:00
Kp 821e68527d Remove nm_set_item_input overload for char[]
Require use of std::array.  There is no need to support both overloads.
2021-06-28 03:37:49 +00:00
Kp 2a504ee03e Construct nm_item_menu in place 2021-06-28 03:37:49 +00:00
Kp b5460a0a48 Construct nm_item_text in place 2021-06-28 03:37:49 +00:00
Kp 00f6436959 Zero out newmenu_item::nm_private_imenu
Clear the largest union member to avoid issues with uninitialized
members.  A future change will refine this to construct members to
specific values.
2021-02-08 01:56:15 +00:00
Kp 6e52dc8db2 Shrink newmenu_item::right_offset
Its value never exceeds UINT8_MAX.
2021-02-06 17:53:53 +00:00
Kp a4bc997be3 Pack newmenu_item more tightly
Move value down to eliminate one area of padding on 64-bit systems.
2021-02-06 17:53:53 +00:00
Kp e4f8d02380 Make screen_resolution_menu inherit from newmenu 2020-12-27 22:03:09 +00:00
Kp ed2bc8e213 Use enum class for nm_type 2020-12-27 22:03:09 +00:00
Kp e7629f35ee Move newmenu_item::saved_text into the two sub-types that need it 2020-12-27 22:03:09 +00:00
Kp e6875641c9 Move Newmenu_allowed_chars into individual newmenu_item
Allowed characters are more properly scoped to a specific text entry
field.  Move them there to eliminate a global.
2020-12-27 22:03:09 +00:00
Kp 1f8c8e355b Allow newmenu callers to choose whether to use a background box
Previously, callers chose whether to use a fullscreen background image,
and the newmenu code inferred that callers without a background image
wanted a background box, while those with a background image wanted no
box.  Change newmenu_layout to take a parameter specifying the caller's
intent, so that a caller can choose to have any combination of a
background image and a background box.
2020-12-27 22:03:09 +00:00
Kp 2b9c146ff2 Convert glitz menu to inherit from newmenu
Add a static method to block until the menu closes, so that the glitz
menu can continue to block its caller.
2020-12-27 22:03:09 +00:00
Kp effa7435c2 Remove newmenu_listbox1
It is no longer used.
2020-12-27 22:03:09 +00:00
Kp 095d660c55 Inline listbox_get_window
It is only used once.
2020-12-26 21:17:29 +00:00
Kp def7e03260 Move listbox callback handling to a derived class 2020-12-26 21:17:29 +00:00
Kp f43e98764a Move listbox to newmenu.h 2020-12-26 21:17:29 +00:00
Kp f01c29c779 Flatten newmenu_do* hierarchy
There is now a single caller for newmenu_do3.  Inline do3 into do2, so
that do2 calls do4.  Mark do4 as static.
2020-12-26 21:17:29 +00:00
Kp d1ff6becb4 Move listbox_layout to newmenu.h
Rename listbox_create_structure to listbox_layout::create_structure.
2020-12-26 21:17:29 +00:00
Kp b9a27094eb Pass menu_title through listbox functions 2020-12-26 21:17:29 +00:00
Kp b63ccc63ca Make passive_messagebox inherit from newmenu
passive_messagebox is only suitable when the user's selection does not
matter, so restrict to be used for cases where only one "choice" is
offered.
2020-12-26 21:17:29 +00:00
Kp df1ee5e671 Make weapon reorder menu inherit from newmenu 2020-12-20 20:39:07 +00:00
Kp 303815f80c Make netgame_list_game_menu inherit from newmenu 2020-12-20 20:39:07 +00:00
Kp e57c9efa7e Change main F1 help menu to inherit from newmenu 2020-12-19 16:13:26 +00:00
Kp 76acfdd38f Convert main menu to inherit from newmenu 2020-12-19 16:13:26 +00:00
Kp 8e65573c56 Eliminate move construction of newmenu_layout
Construct one in place, update it, and then use it to initialize the
rest of the newmenu.
2020-12-19 16:13:26 +00:00
Kp 56122687d1 Delegate newmenu subfunction handling into virtual function 2020-12-19 16:13:26 +00:00
Kp d4cf9943c5 Make newmenu subfunction const 2020-12-19 16:13:26 +00:00
Kp 1032462988 Make newmenu max_displayable const 2020-12-19 16:13:26 +00:00
Kp de5c300724 Make newmenu_layout::all_text const 2020-12-19 16:13:26 +00:00
Kp 530f396b2e Make newmenu::tiny_mode_flag, tabs_flag, max_on_menu const 2020-12-19 16:13:26 +00:00
Kp 200952c3d9 Add type-specific tag wrappers for newmenu calls
Make the compiler check that title, subtitle, and filename are passed in
the right places.
2020-12-19 16:13:26 +00:00
Kp 53566b7673 Move struct newmenu to newmenu.h 2020-12-19 16:13:26 +00:00
Kp 52e4d6f103 Remove printf checking on vnm_messagebox_aN
It is always invoked with format arguments.
2020-10-22 02:26:17 +00:00
Kp d2c5b4d64a Make listbox inherit from window 2020-10-22 02:26:16 +00:00
Kp 09531047b9 Use uint8_t for allow_abort_flag
It is only ever 0 or 1.
2020-10-22 02:26:16 +00:00
Kp 7e73ee2c78 Pass newmenu& to newmenu_create_structure 2020-10-12 03:28:26 +00:00
Kp 2ccfcb64d8 Use named enum for newmenu TinyMode 2020-10-12 03:28:26 +00:00
Kp 96f5428378 Use named enum for newmenu TabsFlag 2020-10-12 03:28:26 +00:00
Kp 39cb42b878 Push partial_range construction to newmenu callers
In some cases, callers know the length of the range and can apply better
checks than the called code.
2020-09-11 03:08:02 +00:00