Commit graph

74740 commits

Author SHA1 Message Date
Vadim Zeitlin
a0e3f1e1ab Use grep instead of fgrep and egrep
The latter are deprecated and shouldn't be used any longer.

No real changes.

Closes #23537.
2023-05-10 23:44:17 +02:00
Vadim Zeitlin
54a8a6ac16 Fix wxTreeCtrl::ScrollTo() with hidden root item in wxMSW
Scroll to the topmost item, as the generic version does, instead of
crashing.

Closes #23534.
2023-05-10 19:08:00 +01:00
Vadim Zeitlin
d39aac0fa8 Merge branch 'aui-tbar-items'
Fix regression in code using pointers to wxAuiToolBar elements.

See #23529.
2023-05-08 15:15:02 +01:00
Vadim Zeitlin
4d48e47811 Fix regression in destroying wxArtProvider objects
Don't delete the art provider object in Remove() as this contradicted
its contract and do restore the call to Remove() from wxArtProvider dtor
as it's actually documented to work.

This fixes a regression due to the changes of 4a294caacd (Stop using
macro-based wxList in wxArtProvider code, 2023-04-11).

Closes #23513.

Closes #23529.
2023-05-08 15:13:35 +01:00
Vadim Zeitlin
50dcf06bff Revert to using wxBaseObjectArray for wxAuiToolBarItemArray
This partially undoes the changes of bc23b1f4f0 (Use wxBaseArray instead
of object array for wxAuiToolBarItemArray, 2023-04-11) as they broke the
existing code using wxAuiToolBar because the pointers to the tools were
not stable any more.

At least avoid the use of the ugly -WX_DECLARE_USER_EXPORTED_OBJARRAY()
macro by just using wxBaseObjectArray<> directly, which is simpler now,
after the change in the parent commit.

Add a trivial test checking that pointers to wxAuiToolBar tools remain
stable when more tools are added.

Closes #23514.
2023-05-07 00:52:07 +01:00
Ivan Sorokin
8a01942f1a Add WXK_NUMPAD_CENTER to refer to numpad "5" in portable code
This key produces events with different key codes in wxMSW (WXK_CLEAR)
and the other ports (WXK_NUMPAD_BEGIN), so add a new constant to allow
to refer to it under the same name everywhere.

Also generate a key event for it in wxOSX where it previously wasn't
generated at all.

Closes #23478.

Closes #23491.
2023-05-06 21:57:47 +01:00
Vadim Zeitlin
91ded239e9 Allow using wxBaseObjectArray without defining traits
This makes it possible to use this class with the complete classes
without using any macros.
2023-05-06 19:59:44 +01:00
Vadim Zeitlin
4df2c878f4 Add wxSTC project to the GUI tests MSVS solution
The tests depend on wxSTC library, so add the project to ensure that it
is (re)built when building them.
2023-05-06 19:43:00 +01:00
Vadim Zeitlin
130e6693e1 Merge branch 'xrc-load'
Improve error reporting in wxXmlResource::Load().

See #23524.
2023-05-05 15:22:10 +02:00
Vadim Zeitlin
2358323d37 Merge branch 'ftp-list'
Fix wxFTP::GetFilesList() and other uses of wxProtocol::ReadLine().

See #23521.
2023-05-05 15:21:11 +02:00
Lauri Nurmi
9f94f4069c Support wxDP_DROPDOWN mode for native date pickers on macOS
According to Apple's documentation, the presentsCalendarOverlay property
is supported in macOS 10.15.4 and later.

Closes #23520.
2023-05-05 15:19:49 +02:00
Vadim Zeitlin
b5313bacca Improve check in wxFindNextFile()
Show the expected assert about calling wxFindNextFile() without
(successfully) calling wxFindFirstFile() first instead of not triggering
this assert if the last call to wxFindFirstFile() failed but a preceding
one had succeeded and triggering another, less clear, assert in wxDir
instead, complaining about using a not-opened directory.

Do this by only setting gs_dir to a valid value if wxFindFirstFile()
succeeded and resetting it to empty pointer if it didn't.
2023-05-05 01:12:11 +01:00
Vadim Zeitlin
81d96e875f Don't assert when loading XML resources from inexistent directory
Calling wxXmlResource::Load() with a file using an inexistent path
resulted in an assert in wxFindNextFile() because it was called when the
preceding call to wxFindFirstFile() failed.

Avoid this by simply not calling it in this case.
2023-05-05 01:07:31 +01:00
Vadim Zeitlin
685044b03f Avoid using macros in wxXmlResource::Load()
No real changes, just use lambdas instead of macros.
2023-05-05 00:54:42 +01:00
Vadim Zeitlin
821c2a07fe Fix editing cells without values in wxGTK wxDataViewCtrl
Do not hide cells without values at GTK level, as this makes them not
only appear as blank (which is fine), but also prevents them from being
edited, which is not, as the user should be able to enter values into
the previously empty cells.

This fixes regression introduced back in 74e1c444fa (Don't show bogus
value when there are none in wxGTK wxDVC neither, 2021-12-01).

Note that this also undoes the changes of 8aefedcb45 (Remove duplicated
HasValue() call from wxGTK wxDataViewCtrl code, 2022-05-08) and
HasValue() is called twice again now, but this is less of a problem than
wrong behaviour fixed by this commit and we can address it later, e.g.
by passing the cell value to PrepareForItem() instead of retrieving it
inside it, if it turns out to be really worth it.

Closes #23523.
2023-05-04 22:11:01 +02:00
Vadim Zeitlin
c1a27f3beb Fix wxProtocolError::ReadLine() if the socket was closed
Don't hang forever in this case but just return an error immediately.

This notably fixes hanging in wxFTP::GetFilesList() as the socket it
used for retrieving the list of files was always closed by the server
after sending the full list, but we kept trying reading from it.

Closes #23519.
2023-05-04 17:06:34 +01:00
Vadim Zeitlin
a2e3dd563e Check that we retrieve the same numbers of files in wxFTP test
GetFilesList() and GetDirList() should return the same number of lines,
normally, so check for this.
2023-05-04 17:06:02 +01:00
Vadim Zeitlin
5e3c2fb1c6 Don't use raw pointers in wxFTP unit test
Use std::unique_ptr<> and vector<> instead.
2023-05-04 16:38:29 +01:00
Vadim Zeitlin
649c64bab1 Replace CPPUNIT_ASSERT with CATCH macros in wxFTP unit test
No real changes, just stop using legacy macros.
2023-05-04 16:36:28 +01:00
Vadim Zeitlin
26d342cb05 Merge branch 'msw-dpi-handling-fixes'
Fixes to make processing wxEVT_DPI_CHANGED work better.

See #23510.
2023-05-02 18:01:06 +01:00
Kvaz1r
79fa753641 Fix showing hint in wxUniv wxTextCtrl
Correctly remove the hint when the text control is focused.

Closes #23511.
2023-05-02 18:58:36 +02:00
Vadim Zeitlin
0329dfecd8 Update wxSlider thumb before processing wxEVT_DPI_CHANGED
This changes of 4713301cf5 (Fix font and thumb size of wxSlider after
DPI change, 2019-08-27) fixed updating the slider thumb length on DPI
change, but this happened too late because it was done after executing
the user-defined handler for this event which could have updated the
slider size, which led to a call to its overridden DoMoveWindow() which
would use the old thumb length, resulting in the size remaining too big
when switching from higher to lower DPI and, worse, too small (and not
showing the thumb entirely) when switching in the other direction.

Fix this by updating the thumb length earlier, by using the just added
MSWBeforeDPIChangedEvent() for doing it instead of doing it in the event
handler.
2023-05-01 17:23:09 +01:00
Vadim Zeitlin
0f19c0a074 Pass wxDPIChangedEvent to the just added MSWBeforeDPIChangedEvent()
This is unusual, but this function may need to rescale some coordinates
and it's convenient to just call event.Scale() then.

So pass it the event that we are preparing to process to it instead of
passing it new and old DPI separately and forcing it to deal with them
itself (instead of using Scale()).
2023-05-01 17:21:03 +01:00
Vadim Zeitlin
7cee6d59c3 Fix updating wxFrame client size in wxEVT_DPI_CHANGED handler
This didn't work correctly when switching from higher to lower DPI if
the frame had a status bar because this status bar still had its old,
bigger height, by the time SetClientSize() was called from the event
handler, resulting in the frame size becoming too big.

It notably resulted in having an unwanted gap between the frame contents
and the status bar if the event handler called GetSizer()->Fit().

Fix this by calling PositionStatusBar(), which also updates the status
bar height to correspond to the new DPI as a side effect, from a new
virtual MSWBeforeDPIChangedEvent() function which had to be added to
allow wxFrame to customize DPI handling.

Adding this new virtual function just for this isn't great, but the only
alternatives seem even worse.
2023-05-01 17:21:03 +01:00
Vadim Zeitlin
b2bb68dc36 Add wxDPIChangedEvent::Scale() overloads for wxPoint and wxRect
Allow scaling positions, in addition to the sizes, and, also, entire
rectangles.
2023-05-01 17:21:03 +01:00
Vadim Zeitlin
1093bb492b Merge branch 'msw-statusbar-improv'
Minor MSW wxStatusBar cleanup.

See #23509.
2023-04-30 17:42:45 +02:00
Vadim Zeitlin
d27dff8c3a Merge branch 'msw-bmpbndl-enh'
Some minor QoL improvements to using bitmaps bundles in wxMSW.

See #23503.
2023-04-30 17:42:13 +02:00
Vadim Zeitlin
1b26a85534 Update comment in .git-blame-ignore-revs after renaming it
Just fix a misleading comment using the wrong (old) file name.

This should have been done in cacfcb1e61 (Allow ignoring revisions when
viewing blame on GitHub, 2022-03-24).
2023-04-30 15:35:02 +02:00
Vadim Zeitlin
2acf999f39 Merge branch 'xrc-getposition-win'
Add windowToUse argument to wxXRC GetPosition() too.

See #23507.
2023-04-30 01:18:01 +02:00
PB
c5dc85f398 Remove mentions of no longer supported MSVS versions
The oldest supported MSVS version for wxWidgets 3.3 is 2015,
so remove mentions of limitations of older MSVS versions.

Closes #23508.
2023-04-30 01:17:28 +02:00
Vadim Zeitlin
4b4d40445c Slightly optimize destruction of a frame with a status bar
Avoid posting (and then processing) a resize event during the frame
destruction, as it's just wasteful if the window is going away anyhow.
2023-04-30 01:04:54 +02:00
Vadim Zeitlin
484e7ab0b3 Stop caching a DC in wxStatusBar
This was done back in 0cd159592e (save the current status text for each
pane inside wxStatusBarPane [...], 2009-02-09), but without any real
explanation about why is it needed and doesn't seem useful. Besides,
doing this requires updating this DC in several places, so just don't do
it and create the DC only when we need it.
2023-04-30 01:03:35 +02:00
Vadim Zeitlin
ca7605d9af Merge branch 'png2c-fixes'
Improve png2c script, notably make it work with Python 3.9+.

See #23500.
2023-04-30 00:58:12 +02:00
Vadim Zeitlin
81ac38cf65 Remove manual memory management code for tooltips in wxStatusBar
Use a vector of unique_ptr<> to manage memory automatically instead.

No real changes, this just simplifies the code and makes it more robust
by making it impossible to forget to delete a tooltip.
2023-04-29 23:18:24 +01:00
Vadim Zeitlin
454c7e0fb9 Add "windowToUse" to wxXmlResourceHandler::GetPosition() too
There doesn't seem to be any reason to have it in GetSize() and
GetDimension(), where they were added by 0c00c86faf (fixed dialog units
in toplevel windows (bug #1170234), 2005-03-28), but not in this
function, so add it here as well.
2023-04-28 18:14:40 +01:00
Vadim Zeitlin
83805407bf Use "nullptr" instead of "0" in wxXmlResourceHandler docs
No real changes, just use nullptr for the default pointers values.
2023-04-28 16:56:07 +01:00
Vadim Zeitlin
8d8f94da64 Merge branch 'webkit2_fixes' of https://github.com/swt2c/wxWidgets
Miscellaneous fixes for WebKit2 wxWebView backend.

See #23497.
2023-04-28 16:39:49 +02:00
Kumazuma
3a18b6ba18 Fix discrepancy between using GDI and Direct2D in high DPI
Set DPI to 96 in RenderTargetProperties when creating HwndRenderTarget
to prevent pixel scaling.

If the value is set to zero, Direct2D sets the HwndRenderTarget's DPI to
match the window's DPI.

When the DPI of the ID2D1RenderTarget is not set to 96, Direct2D
performs pixel scaling.

See #23486.

Closes #23496.
2023-04-28 16:36:55 +02:00
Vadim Zeitlin
cd65c312d3 Merge branch 'use-std-in-samples'
Use standard containers in samples.

See #23490.
2023-04-28 15:32:34 +02:00
jolz
160b4dd9c6 Fix build with gcc 7 and clang 6 in C++17 mode
Some compilers, including gcc 7, don't provide <charconv> even though
they do (partially) support C++17, so check for the header existence
explicitly, using __has_include (which is, ironically, another C++17
feature) to avoid compilation errors when using them since the changes
of 65c048568f (Use C++17 <charconv> for wxString to/from number
conversion, 2023-04-05).

Closes #23484.

Closes #23487.
2023-04-28 15:28:04 +02:00
Vadim Zeitlin
5d2639d1cf Merge branch 'std-iostream-fixes'
Restore wxDocument::{Save,Load}Object() compatibility with the old
non-STL build.

See #23481.
2023-04-28 15:26:54 +02:00
Vadim Zeitlin
2bb3525723 Improve wxDocument::{Save,Load}Object() documentation
Clarify when each of the overloads is available and also document that
std::istream must not be in failed state for LoadObject() to be
considered successful.

Closes #23479.
2023-04-28 15:26:46 +02:00
Vadim Zeitlin
20b3c887f5 Improve wxUSE_STD_IOSTREAM documentation
Clarify that it is 1 by default in the documentation, instead of
implying that it's off by default and needs to be enabled.

Improve the description of this option in setup.h files.

And also document this compilation option in the summary page.
2023-04-28 15:26:46 +02:00
Vadim Zeitlin
9257d36af6 Stop using legacy wxSTD macro in the library code
Just use "std::" directly instead.

No real changes.
2023-04-28 15:26:46 +02:00
Vadim Zeitlin
fd0a52250d Remove redundant wxUSE_STD_IOSTREAM test
It's not necessary to check for it as wxHAS_TEXT_WINDOW_STREAM is only
set to 1 if standard streams are used.
2023-04-28 15:26:46 +02:00
Vadim Zeitlin
4d2e8840e5 Remove unnecessary <fstream> include from wxOSX/wxiOS wxTextCtrl
This header doesn't seem to have been ever actually needed here, so
simply remove it.
2023-04-28 15:26:46 +02:00
Vadim Zeitlin
1ce48b0d2a Improve comment for a header included from log.cpp
The old comment was misleading, mention that we need this header not
just for <windows.h> inclusion (which could be achieved by just
including wx/msw/wrapwin.h), but for wxMSWFormatMessage() declaration.

No real changes.
2023-04-28 15:26:46 +02:00
Vadim Zeitlin
bf9f8c70b9 Merge remote-tracking branch 'github/msw-univ-fixes'
Fix wxUniv/MSW build and a CI job for it.

See #23476.

Closes #23471.
2023-04-28 15:23:59 +02:00
Vadim Zeitlin
85e88d6af3 Merge branch 'format-unicode-fix' of https://github.com/lanurmi/wxWidgets
Fix for wxLocale breaking Unicode string formatting under macOS.

See #23454.
2023-04-28 15:06:54 +02:00
Blake-Madden
bbf499959b Fix typo and formatting in wxWebResponse docs
Fix typo, missing semicolon, missing commas, and stray colon; use
consistent formatting.

Closes #23501.
2023-04-28 14:49:47 +02:00