WinForms: Enable maximize/minimize buttons on resizable Eto dialogs#810
Open
navara wants to merge 1 commit into
Open
WinForms: Enable maximize/minimize buttons on resizable Eto dialogs#810navara wants to merge 1 commit into
navara wants to merge 1 commit into
Conversation
Eto.Forms' WinForms DialogHandler hardcodes MaximizeBox=false and MinimizeBox=false. Setting Resizable=true only changes FormBorderStyle, so all ~30 NAPS2 dialogs derived from EtoDialogBase (Preview, Crop, Settings, EditProfile, etc.) had a greyed-out maximize button despite being resizable by drag. Add SetFormMaximizable(Window, bool) to EtoPlatform (no-op default; WinForms override sets MaximizeBox/MinimizeBox on the underlying WF.Form), and call it from FormStateController.OnShownInternal right after _window.Resizable is applied. Mac/GTK behavior is unchanged since their handlers already wire Resizable to native maximize behavior. Fixes cyanfish#755
Owner
|
I'd rather just set |
Author
|
I guess it cannot hurt, as long as it doesn't interfere with Restore part of maximization (though that might not be needed as long as Close button is visible). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #755 — the title-bar maximize button is greyed out on ~30 NAPS2 dialogs on Windows (Preview, Crop, Settings, EditProfile, etc.) even though the windows are user-resizable by drag.
Root cause
Eto.Forms 2.8.3's
Eto.WinForms.Forms.DialogHandlerconstructor hardcodesMaximizeBox = falseandMinimizeBox = falseon the underlyingWF.Form. NAPS2'sEtoDialogBasesetsResizable = true, but Eto'sResizablesetter only changesFormBorderStyle(e.g. toSizable); it does not touchMaximizeBox/MinimizeBox. Net effect: the form is resizable by drag-handles but the title-bar maximize button stays disabled.The main window (
DesktopFormviaEtoFormBase→ EtoForm) is unaffected because Eto'sFormHandlerleavesMaximizeBox = true.Change
Centralized fix in the platform abstraction — no per-dialog edits.
EtoPlatform.cs— new no-op virtualSetFormMaximizable(Window, bool).WinFormsEtoPlatform.cs— override setsMaximizeBoxandMinimizeBoxonWF.Form.FormStateController.cs— call fromOnShownInternal, immediately after_window.Resizable = Resizable;.MinimizeBoxis coupled toMaximizeBox(both follow the single bool): Eto'sDialogHandlerdisabled both, an asymmetric title bar would look odd, and the mainDesktopFormalready shows both.Mac/GTK keep the no-op base implementation — those platforms already wire
Window.Resizableto native maximize behavior via Eto's own handlers.Affected windows
Now correctly maximizable (~30): Preview, Crop, BlackWhite, BrightCont, HueSat, Sharpen, Rotate, Split, Combine, AdvancedProfile, EditProfile, Settings, Image/Pdf/Email Settings, KeyboardShortcuts, Profiles, Placeholders, ChooseDevice, BatchScan, ScannerSharing, SharedDevice, Resolution, PageSize, AutoSaveSettings, OcrDownload, OcrMultiLang, DownloadProgress, PdfPassword, ManualIp, Error, Progress, EditWith, EmailProvider.
Intentionally unchanged (
FormStateController.Resizable = false): About, Authorize, BatchPrompt, OcrSetup, Recover. TheirFormBorderStyle = FixedDialogstill hides the maximize button.DesktopForm: unchanged.
Bonus
Per-form
Maximizedstate is already saved inFormState(FormStateController.cs:166) and restored on load. With this fix, dialogs can actually become maximized, so that pre-existing facility starts producing user-visible value.