-
Notifications
You must be signed in to change notification settings - Fork 7.5k
[ZoomIt] Modernise save dialogs and consolidate save behaviour #43350
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
base: main
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
@check-spelling-bot Report🔴 Please reviewSee the 📂 files view, the 📜action log, or 📝 job summary for details.
See ❌ Event descriptions for more information. These words are not needed and should be removedcabstr CIBUILD djwsxzxb HIDEREADONLY icf installscopeperuser ksa Olllama rap registryroot regroot rtm suntimes TARGETDIR utmPattern suggestions ✂️ (1)You could add these patterns to Alternatively, if a pattern suggestion doesn't make sense for this project, add a If the flagged items are 🤯 false positivesIf items relate to a ...
|
|
/azp run |
|
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command. |
|
Hi @daverayment Could you resolve the conflicts when you get a chance so we can include it in the 96 release. |
|
Hi @lei9444. Yes, I can have a look. It's quite a complex set of conflicts because there are at least 3 PRs on top of each other here, but I'll try my best to resolve everything. I love ZoomIt being basically one massive file 😄 |
Summary of the Pull Request
This PR replaces the legacy Win32
GetSaveFilename()usage with a modern COM-basedIFileSaveDialogimplementation and consolidates screenshot and screencast recording save behaviour behind a single, consistent path.It updates several strings related to the save dialogs which were not compliant with Windows style guidelines.
It also introduces a safer mapping between the save dialog's filters and the underlying screenshot save options.
Edit 2025-11-07: Also fixes file overwrite bug
During testing another fix, I found a file overwrite bug in the old dialog code because of the manual application of the ".png" extension (see #43376). Setting the dialog's
lpstrDefExtproperty correctly in this PR fixes that issue.PR Checklist
Detailed Description of the Pull Request / Additional comments
Code updates
Added
SaveDialogResultEncapsulates the selected file path and the (1-based) filter index returned by the dialog.
Added
ShowSaveDialog()IFileSaveDialogvia WILstd::optionalofSaveDialogResultnullopt)winrt::hresult_errorUnified dialog filters
Added a single source of truth for screenshot save filter definitions with the new
ScreenshotSaveOptionenum,ScreenshotFilterSpecstruct andg_ScreenshotFilterslist.Logic now derives the dialog settings and interprets the results from the same place, replacing the reliance on hard-coded filter indices.
Added
GetScreenshotFilterSpecs()Provides a cached
std::vector<COMDLG_FILTERSPEC>for use by the screenshot save routine. Uses a lazy-initialised static for efficiency.Updated save handlers
The
IDC_SAVE/IDC_SAVE_CROPpath in the main WndProc now usesShowSaveDialoginstead of the legacy Win32OPENFILENAME-based method which was previously inline.The filter index is now mapped safely to
ScreenshotSaveOption, which allows for a more readableswitchbetweenScreenshotSaveOption::ZoomedandScreenshotSaveOption::ActualSizeinstead of a brittle comparison with1.This allows us to more easily add more options, reorder the entries, and/or to localise the strings.
Updated recording save workflow
Now uses the same
ShowSaveDialgohelper, simplifying the flow.Miscellaneous
SavePnghas been updated to accept astd::filesystem::path&instead of aPTCHAR. This better indicates the intent of the routine and reflects the change to use the new consistent save path.Some
constpedantry to more clearly indicate intention, e.g. path and filter index returns from the show dialog routine.Minor reorg in
StartRecordingAsyncso the full-screen initialisation work isn't done if a window is being captured.Strings
Several dialog strings have been updated to align with Windows style guidelines and provide clearer, more descriptive wording:
Screenshot Save Dialog
Save zoomed screen...Save Zoomed ScreenZoomed PNGZoomed image (*.png)Actual size PNGActual size image (*.png)Recording Save Dialog
Save AsSave RecordingMP4 VideoZoomIt recording (*.mp4)Error Strings
Recording cancelled before startedRecording cancelled before it could start.Error starting recordingAn error occurred during recording or saving.Validation Steps Performed
(Manual testing on Windows 11. Standalone ZoomIt.)