You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor UI control drawing to add styles and reduce the number of parameters (#227)
This is my proposal for improving the too-many-parameters problem
brought up in
#220 (comment). It
combines parameters that routinely appear together, provides easy access
to common combinations, and eliminates most situations where a caller
can't pass all the appropriate options.
The intentional user-visible changes are:
- Refuse to accept negative numbers for things like fixed and built
building count.
- Reduce the leading padding from 0.8 to 0.5 in all text input boxes
that didn't already use 0.5. (Except the 'create directory' text box in
the filesystem window, which still uses 0.2 x 0.2.)
- Change the `MilestoneDisplay.Normal` icons in the NEIE to `Contained`
instead. (see
[ImmediateWidget.cs:12-24](https://github.com/shpaass/yafc-ce/blob/412f62c9aad6d87a0047def1037e77aa03d43ea5/Yafc/Widgets/ImmediateWidgets.cs#L12-L24))
publicstaticvoidShowTooltip(thisImGuigui,Rectrect,stringtext,floatwidth=20f)=>gui.window?.ShowTooltip(gui,rect, x =>x.BuildText(text,wrap:true),width);
266
+
publicstaticvoidShowTooltip(thisImGuigui,Rectrect,stringtext,floatwidth=20f)=>gui.window?.ShowTooltip(gui,rect, x =>x.BuildText(text,TextBlockDisplayStyle.WrappedText),width);
/// Contains the display parameters for editable text (<c>TextBox</c> in both WPF and WinForms)
41
+
/// </summary>
42
+
/// <param name="Icon">The <see cref="Icon"/> to display to the left of the text, or <see cref="Icon.None"/> to display no icon.</param>
43
+
/// <param name="Padding">The <see cref="UI.Padding"/> to place between the text and the edges of the editable area. (The box area not used by <paramref name="Icon"/>.)</param>
44
+
/// <param name="Alignment">The <see cref="RectAlignment"/> to apply when drawing the text within the edit box.</param>
45
+
/// <param name="ColorGroup">The <see cref="SchemeColorGroup"/> to use when drawing the edit box.</param>
/// Gets the default display style, used for the Preferences screen and calls to <see cref="ImGui.BuildTextInput(string?, out string, string?, Icon, bool, bool)"/>.
/// Gets the display style for amounts associated with Factorio objects. (<c><see langword="with"/> { ColorGroup = <see cref="SchemeColorGroup.Grey"/> }</c> for built building counts.)
0 commit comments