Commit Graph

72788 Commits

Author SHA1 Message Date
Vadim Zeitlin
35e982a67f Merge branch 'grid-dragmove'
Improve UI of dragging the wxGrid columns/rows to move them.

See #22457.
2022-06-05 13:39:35 +01:00
Vadim Zeitlin
31fee399ce Remove left over "#| msgid" comments
These comments are suggestions for the correct translations and are not
needed any longer after the translations had been updated to take them
into account.
2022-06-05 14:24:01 +02:00
Felipe
043ff97c91 Update Brazilian Portuguese translations for 3.1.7 2022-06-05 14:23:11 +02:00
Vadim Zeitlin
0f77418090 Merge branch 'more-icon-fixes'
More icon fixes in wxMSW: fix transparency in wxImageList and size in
wxArtProvider.

See #22487.
2022-06-05 13:16:19 +01:00
Vadim Zeitlin
56e4bb8bb4 Merge branch 'custom-file-dialog-controls'
Implement support for custom file dialog controls in new style MSW
dialogs.

See #22476.

Closes #14770.
2022-06-05 13:13:28 +01:00
Vadim Zeitlin
b5184ee539 Merge branch 'msw-gcdc'
Fix using wxGCDC with scrolled wxDC in wxMSW.

See #22485.
2022-06-05 13:12:24 +01:00
Vadim Zeitlin
b0ac00f359 Don't let parent frame handle wxLogFrame events
This doesn't make any sense and can prevent wxLogFrame menu items such
as "Save" from working if the parent frame defines an wxEVT_UPDATE_UI
handler for wxID_SAVE disabling it.

Closes #22486.
2022-06-04 23:25:47 +01:00
Vadim Zeitlin
e1b3d93f5a Allow upscaling 16x15 art bitmaps to multiples of 16x16 too
The default art provider has many icons of 16x15 size, suitable for use
in the standard-sized MSW toolbars (which nobody uses any more, but this
is not the point), so handle them specially and not only resize them to
16x16, which was already done as part of the normal logic here (in the
past this used to be handled specially too, but bd0db4a5f9 (Still resize
(16, 15) bitmaps to (16, 16) ones in wxArtProvider, 2022-02-05) changed
this), but also upscale them to 32x32 and other multiple-of-16 sizes by
resizing them to 16x16 first and then upscaling.

This makes the appearance of 16x15 and 16x16 icons consistent with each
other when showing them in bigger sizes in the resource browser dialog
of the artprov sample, which seems to be the right thing to do.

This commit is best viewed with Git --color-moved
--color-moved-ws=ignore-all-space options.
2022-06-04 23:15:01 +01:00
Vadim Zeitlin
054972e56b Fix adding icons with mask to wxMSW wxImageList
The changes of 6feeed9fe9 (Handle transparency to the best of our
ability in wxImageList, 2022-05-05) didn't handle the icons with mask
(and without alpha) correctly, as the native image list doesn't handle
the icon masks without ILC_MASK, so the masks were just ignored.

Fix this by handling icons as bitmaps: for them everything already works
and even it means extra unneeded conversions, it's much simpler than the
alternative of reimplementing GetImageListBitmaps() logic for the icons.

See #22349.
2022-06-04 23:02:49 +01:00
Vadim Zeitlin
34fa234f48 Merge branch 'bmpbndl-scaling'
Improve wxBitmapBundle scaling logic by limiting it to integer scaling
factors and ensure it's consistent for files and MSW resources.

See #22481.
2022-06-04 18:36:50 +01:00
Vadim Zeitlin
a8eaeb0276 Fix using wxGraphicsContext with scrolled wxDC in wxMSW
The changes of 4f9186f1a1 (Increase usable scrolling range in wxMSW by a
factor of 10,000, 2022-04-30) broke using wxGraphicsContext, and wxGCDC,
with scrolled wxDC, as GDI+ wasn't aware about the origin shift in it
any more, now that it's not done at MSW level any longer.

Fix this by shifting the origin before constructing the Graphics object
from HDC to restore the old behaviour.

Note that this means that the origin shift is still limited to 2^27
(instead of the full int range) when using wxGCDC, which is not ideal,
but better than breaking it completely (and when using wxGraphicsContext
directly, world transformation can, and should, be used to avoid this
limit).

Closes #22480.
2022-06-04 18:28:49 +01:00
Vadim Zeitlin
c66cd985dd Simplify wxGraphicsContext code by using wxDC::GetHDC()
No real changes, just use GetHDC() instead of reproducing what it does.
2022-06-04 17:37:45 +01:00
Vadim Zeitlin
b202dec93c Highlight the grid row/column being dragged on all platforms
Remove __WXGTK__ checks and highlight it everywhere, this can be useful
under other platforms too depending on the colour schema and not having
platform-specific checks is better than having them if they're not
absolutely required.

If we really want to avoid highlighting in some cases, we should check
for the contrast between the border and background colours, but it seems
to be much simpler to just always show it.
2022-06-04 16:17:10 +01:00
Vadim Zeitlin
583a9aa557 Use ternary operator instead of an "if"
No real changes, but calling wxRect::Deflate() once here with the value
depending on whether wxBORDER_NONE is used seems more clear in this
particular context.
2022-06-04 17:09:26 +02:00
Vadim Zeitlin
38dfcf05ab Handle non-default scale factor in wxBitmapBundleImplArt
The existing code only worked correctly if overridden
wxArtProvider::CreateBitmap() returned bitmaps with scale factor of 1,
but not for anything else.

Account for the bitmap scale factor when determining the default size
and available scales correctly to fix this.

Co-authored-by: Václav Slavík <vaclav@slavik.io>
2022-06-04 15:39:47 +01:00
Lauri Nurmi
83c6edcc32 Always call wxSecureZeroMemory() to wipe memory in wxSecretValue
Replaces a call to MSW native ::SecureZeroMemory(), and calls to plain
memset().
2022-06-04 15:14:09 +03:00
Vadim Zeitlin
c18486e81f Add support for custom comboboxes in wxFileDialogCustomize
Allow using simple (i.e. not editable) comboboxes, known as wxChoice in
wx API, in the dialog too.

Demonstrate their use in the dialogs sample.
2022-06-04 00:50:54 +01:00
Vadim Zeitlin
5e7b104248 Change the meaning of the radio buttons in the file dialog
No real changes, just rename the buttons to use paper size for
demonstrating something else.
2022-06-03 23:07:47 +01:00
Vadim Zeitlin
76ff441bf2 Demonstrate disabling radio buttons in the sample
Radio buttons are different from the other controls internally in
IFileDialogCustomize-based implementation, so check that disabling them
also works correctly.
2022-06-03 23:00:23 +01:00
Vadim Zeitlin
153a024492 Document the new wxFileDialog customization API
Explain its relationship to the old API and document the new classes.
2022-06-03 03:18:05 +01:00
Vadim Zeitlin
06232cd275 Make filters discussion a section in wxFileDialog documentation
Using a section looks better and prepares for adding another one in the
upcoming commit.

Also remove a note about Motif file dialog limitation, nobody cares
about it any more anyhow.
2022-06-03 01:41:30 +01:00
Vadim Zeitlin
23e9ac9d93 Fix spurious gcc warning about wxFileDialogMSWData dtor
Add unnecessary virtual dtor to this class just to avoid
-Wdelete-non-virtual-dtor from gcc (which is wrong here as this class is
never used polymorphically, i.e. never deleted via a pointer to its base
class).
2022-06-03 01:35:31 +01:00
Vadim Zeitlin
07d7dd19f8 Add support for custom radio button controls in wxFileDialog
Update the dialogs sample to show using them too.
2022-06-03 01:35:31 +01:00
Vadim Zeitlin
bf5ddc200b Improve extra controls support in wxGenericFileDialog
Update the extra controls whenever anything changes in the dialog to
make the example in the dialogs sample actually work with the generic
dialog (previously nothing was updated at all).

Also delete the extra controls earlier to make the behaviour more
consistent with the native dialogs.

Use the new customization API for the generic dialogs in the sample too.
2022-06-03 01:35:31 +01:00
Vadim Zeitlin
44b6ce4826 Implement sending events for generic custom wxFileDialog controls
Forward the events from the actual wxControls used in the generic
implementation of wxFileDialogCustomize to wxFileDialogCustomControl so
that they could be handled by the application code binding to them.
2022-06-03 01:35:31 +01:00
Vadim Zeitlin
64fb2b1202 Adjust size of custom wxStaticText in wxFileDialog to contents
This is more useful than just truncating the contents if the label is
set to a value longer than its initial one.
2022-06-03 01:35:31 +01:00
Vadim Zeitlin
8c87d90844 Fix using wxFileDialog geometry in custom controls event handlers
Keep wxFileDialog HWND valid until it's dismissed in order to allow any
operations involving the dialog geometry to work correctly while it's
shown, so that e.g. resizing windows from the custom controls event
handlers works.
2022-06-03 01:35:31 +01:00
Vadim Zeitlin
96bcd545a9 Support wxFileDialogCustomize when not using IFileDialog in wxMSW
This should be rarely needed, but it doesn't cost anything to support
the new customization API if IFileDialog is not available at either
compile- or run-time, as this just reuses the existing generic
implementation.
2022-06-03 01:35:31 +01:00
Vadim Zeitlin
ae16657426 Add generic implementation of wxFileDialogCustomize API
Add implementation of the new file dialog customization API in terms of
the old one for the non-MSW ports (or even wxMSW if IFileDialog can't be
used for whatever reasons).

Just map wxFileDialogFoo to the corresponding wxFoo.
2022-06-03 01:35:31 +01:00
Vadim Zeitlin
fdcaeb050f Move GetExtraControlSize() hack from wxFileDialogBase to MSW code
The hack with creating a dummy dialog just to get the size of the extra
controls is only used in wxMSW, so move it to MSW-specific file from the
common code.

To allow doing this there, add CreateExtraControlWithParent() helper,
which is still not really used anywhere else than in wxMSW, but at least
doesn't do anything particularly ugly and doesn't really penalize the
common code for wxMSW sins.

No real changes.
2022-06-03 01:35:31 +01:00
Vadim Zeitlin
f6a261468e Slightly change the logic of CreateExtraControl()
This will make it simpler to extend in the upcoming commits.

No real changes yet.
2022-06-03 01:35:31 +01:00
Vadim Zeitlin
096c4bf195 Remove unnecessary HasExtraControlCreator() check from wxOSX
There is no need to call this function, just call CreateExtraControl()
directly -- it will do nothing if there are no extra controls to create.

No real changes.
2022-06-03 01:35:31 +01:00
Vadim Zeitlin
751a73a2ca Add optional label to wxFileDialogCustomize::AddTextCtrl()
Creating a text with a label is a common operation and can be
implemented to look slightly better than AddStaticText() followed by
AddTextCtrl() without a label when using IFileDialog.
2022-06-03 01:35:30 +01:00
Vadim Zeitlin
095c4dfc94 Add event generation to MSW IFileDialog-based implementation
Inherit wxFileDialogCustomControl from wxEvtHandler to allow Bind()ing
to events on it and use this to handle wxEVT_BUTTON and wxEVT_CHECKBOX
in the sample.

And inherit from IFileDialogControlEvents in wxMSW code to actually
generate these events when they happen.
2022-06-03 01:35:30 +01:00
Vadim Zeitlin
359ab98cb2 Start adding new API for wxFileDialog customization
wxFileDialog::SetCustomizeHook() can be implemented in terms of
IFileDialogCustomize in wxMSW, which means that it can be used with the
new style dialogs shown by IFileDialog, unlike SetExtraControlCreator(),
which could only be supported when using older style common dialogs.

Add support for a few different controls and wxMSW implementation, more
controls, generic implementation and the documentation will be updated
later.

Also update the sample to show the new API in action and allow toggling
between using it and the old API for testing.
2022-06-03 01:35:30 +01:00
Vadim Zeitlin
f8976c3247 Implement IUnknown methods manually in wxFileDialogMSWData
Using the helper macros won't work with multiple inheritance that is
going to be used in the upcoming commits.

We also don't need real reference counting here, so simplify the code by
not using it.
2022-06-03 01:35:30 +01:00
Vadim Zeitlin
0caddb4472 Document important COM implementation macro limitation
These macros can't be used with multiple inheritance, as they don't do
anything to cast the pointer to the correct type in this case.
2022-06-03 01:35:30 +01:00
Vadim Zeitlin
c93f5350a3 Fix wxFileDialog repositioning
The calls to SetSize() were doing nothing because our own overridden
DoGet{Position,Size}() fooled it into thinking that the window already
had the correct geometry.

Return the actual position and size during MSWOnInitDone(), i.e. when we
have a correct HWND, to prevent this from happening.
2022-06-03 01:35:30 +01:00
Vadim Zeitlin
63f44b5bfa Call MSWOnInitDone() when using IFileDialog too
This allows to use the new style dialog for the file dialogs for which
Centre() or SetSize() had been called, as we can now position the window
even when not using a hook function.

As there is no IFileDialogEvents function corresponding to CDN_INITDONE
notification, use the first call to OnTypeChange() instead.
2022-06-03 01:35:30 +01:00
Vadim Zeitlin
1de1c62872 Pass the correct HWND to MSWOnInitDone()
Instead of requiring the function itself to use GetParent(), call it in
the hook function and pass the actual dialog HWND to MSWOnInitDone().

No real changes, just refactoring to prepare for further changes.
2022-06-03 01:35:30 +01:00
Vadim Zeitlin
56bb9c2420 Don't call MSWOnSelChange() from MSWOnInitDone() itself
Call it from the hook function when it gets CDN_INITDONE notification
instead.

This doesn't change anything yet, but will when MSWOnInitDone() is
called from elsewhere.
2022-06-03 01:35:30 +01:00
Vadim Zeitlin
92534cf270 Check if we need to do something in wxFileDialog::MSWOnInitDone()
And don't do anything at all if we don't.

No real changes.
2022-06-03 01:35:30 +01:00
Vadim Zeitlin
a137145a44 Update the currently selected file when using IFileDialog too
Implement IFileDialogEvents::OnSelectionChange() to react to the changes
in the dialog selection.
2022-06-03 01:35:30 +01:00
Vadim Zeitlin
5bd765355b Make ConvertIShellItemToPath() public and rename
Extract a private function from src/msw/dirdlg.cpp, change its return
type to avoid losing information about the error and rename it to a more
clear name now that it's used outside of this file.

No real changes.
2022-06-03 01:35:30 +01:00
Vadim Zeitlin
0a1714b709 Start using IFileDialogEvents to get notifications about changes
For now only update the currently selected file type using this
interface, but it will be used for more notifications later.
2022-06-03 01:35:30 +01:00
Vadim Zeitlin
a341efec34 Add helper FileDialogGetFileTypeIndex()
This is just a refactoring to allow reusing this function later.

No real changes.
2022-06-03 01:35:30 +01:00
Vadim Zeitlin
db7cf34e30 Remove unused HWND parameter of MSWOnTypeChange()
Also simplify the hook function code a little by using OPENFILENAME
local variable directly instead of using OFNOTIFY only to always use its
OPENFILENAME member and nothing else.

No real changes.
2022-06-03 01:35:30 +01:00
Vadim Zeitlin
05fdf15c54 Use NMHDR to refer to the notification code everywhere
It was confusing to take the notification code from NMHDR itself in one
place and then from OFNOTIFY just below -- use NMHDR in both places, as
OFNOTIFY field refers to the same thing.

No real changes.
2022-06-03 01:35:30 +01:00
Vadim Zeitlin
895b4a0710 Make wxFileDialog::MSWOnXXX() private
These functions were always marked as being implementation-only, but we
can actually do better and make them private, by making the dialog hook
function a (static) member of wxFileDialogMSWData and making this class
(which is now a class and not a struct any more, as it's not just a
collection of fields any longer) a friend of wxFileDialog.

No real changes.
2022-06-03 01:35:30 +01:00
Vadim Zeitlin
cf81527cfc Move private wxFileDialog members to wxFileDialogMSWData
No real changes, just make it possibly to add more fields to the private
struct in the future without affecting the ABI.

This commit is best viewed with git --color-moved
--color-moved-ws=ignore-all-space options.
2022-06-03 01:35:29 +01:00