Commit graph

75652 commits

Author SHA1 Message Date
Vadim Zeitlin
d7b9548c19 Create output directory in wxFileConfig if it doesn't exist
This seems like the most sensible thing to do. Alternative would be to
not use XDG directories if ~/.config doesn't exist yet, but this doesn't
seem right, especially if wxCONFIG_USE_XDG is explicitly specified.
2024-01-08 02:02:18 +01:00
Vadim Zeitlin
6586afb0a5 Use XDG-compliant location by default in wxFileConfig
Still use the traditional dot file if it already exists, but prefer
using the new location otherwise, i.e. for the new program installation.

Add wxCONFIG_USE_HOME to allow forcing the use of the old location if
really necessary.

Also use the new style as default "old style" of MigrateLocalFile() so
that calling it even when using XDG layout in wxStandardPaths still
works as expected.
2024-01-08 00:43:26 +01:00
Vadim Zeitlin
e38a61a09b Merge branch 'cmake-cxx-std'
Improve C++ standard handling in CMake.

See #24188.
2024-01-07 16:14:53 +01:00
Vadim Zeitlin
b294a6b2bc Merge branch 'config-xdg'
Make it easier to use wxFileConfig in XDG-compliant way.

See #24180.
2024-01-07 16:13:15 +01:00
Vadim Zeitlin
cc8fbeed56 Merge branch 'xml-conv-simplify'
Simplify and modernize wxXmlDocument code.

See #24179.
2024-01-07 16:12:31 +01:00
Vadim Zeitlin
d36fd5822d Add MSVS 2022 solutions files for building tests
They're almost identical to MSVS 2019 ones but still convenient to have.
2024-01-07 00:43:48 +01:00
Vadim Zeitlin
cfdfd14c59 Improve frame size in the listctrl sample
Make it bigger on high DPI displays and smaller on normal ones.
2024-01-07 00:35:39 +01:00
Artur Wieczorek
dc627da250 Use std::array instead of raw array in wxCursorProperty 2024-01-06 22:43:28 +01:00
Artur Wieczorek
084d70fbe2 Use std::array instead of raw array in wxFontProperty 2024-01-06 22:43:22 +01:00
Artur Wieczorek
8095672309 Use std::array instead of raw array in wxSystemColourProperty 2024-01-06 22:43:16 +01:00
Artur Wieczorek
080b778d17 Use std::array instead of raw array in wxColourProperty 2024-01-06 22:43:11 +01:00
Artur Wieczorek
72a909c971 Use std::array instead of raw array in wxUIntProperty 2024-01-06 22:43:06 +01:00
Artur Wieczorek
e2dcdb275b Use wxString() rather than wxEmptyString in propgrid sample 2024-01-06 22:43:01 +01:00
Artur Wieczorek
efa2870cb4 Rename wxPGKeyboardActions type to wxPGKeyboardAction
For regular enumeration singular name is more appropriate.
2024-01-06 22:42:55 +01:00
Artur Wieczorek
3cb3d62212 Use enum class to represent NumericType
This is for better type safety.
2024-01-06 22:42:49 +01:00
Artur Wieczorek
e7ab6a6d53 Use enum class to represent wxPGNumericValidationConstants
This is for better type safety.
2024-01-06 22:42:43 +01:00
Artur Wieczorek
ca3acd7a03 Use enum class to implement wxPGPropValFormatFlags as bitmask
This is for better type safety of the flags.
2024-01-06 22:42:38 +01:00
Artur Wieczorek
031435bd39 Use dedicated function to obtain decimal separator in propgrid sample 2024-01-06 22:42:30 +01:00
Artur Wieczorek
b681a80b96 Explicitly create all sub-controls in wxPropertyGridManager::Create()
Instead of deferring creation of wxPropertyGrid and other controls
to EVT_SIZE handler we can create them when wxPropertyGridManager
is created and its initial size is known.
This way we can avoid using a trick with magic number used as a flag
to determine when to create all controls in OnResize().

Closes #24171.
2024-01-06 22:42:23 +01:00
Vadim Zeitlin
94252d84b1 Merge branch 'msw-fix-hdr-memleak'
Fix memory leak in wxMSWHeaderCtrl in dark mode and some cleanup.

See #24192.
2024-01-06 17:40:01 +01:00
Vadim Zeitlin
97468661c7 Fix drawing right and bottom wxMSW wxStaticBox edges in high DPI
Passing window size divided by "scale" to CreateWithDIPSize() was wrong
as the resulting bitmap could be too small to cover the entire window
due to rounding errors, e.g. at 200% DPI the right and bottom row/column
was never drawn on if the window size in the corresponding direction was
odd.

This notably fixes their (dis)appearance in dark mode, where we always
draw them ourselves (otherwise we mostly only do it when using
non-default colour).
2024-01-06 17:36:29 +01:00
Vadim Zeitlin
a3fc9283f7 Remove useless wxMSWHeaderCtrl::Init()
This was supposed to be "common part of all ctors" but there is just a
single ctor in this class and even this one doesn't really need to call
Bind(), which was the only thing done in Init() since the last commit,
as it can, and should be, called by Create() after successfully creating
the window instead.

No real changes, just a simplification.
2024-01-06 15:35:50 +01:00
Vadim Zeitlin
735fe67182 Initialize wxMSWHeaderCtrl members in their declarations
No real changes, just prefer initializing members directly when
declaring them instead of doing it in a separate Init() function.
2024-01-06 15:35:50 +01:00
Vadim Zeitlin
c1754d4033 Also use std::unique_ptr<wxImageList> instead of raw pointer
Similar to the previous commit and done for consistency and safety.
2024-01-06 15:35:50 +01:00
Vadim Zeitlin
069ffbeaff Use std::unique_ptr<wxMSWHeaderCtrlCustomDraw> and not raw pointer
Make memory leaks, such as the one fixed by the previous commit,
impossible by making a smart pointer instead of a raw one for this
object.

No real changes.
2024-01-06 15:35:50 +01:00
Vadim Zeitlin
9d21630069 Don't leak wxMSWHeaderCtrlCustomDraw in dark mode
The pointer may have been already allocated when the code initializing
it in Create() when using dark mode is executed, so unconditionally
reassigning to it leaked memory.
2024-01-06 15:35:50 +01:00
Vadim Zeitlin
3b06ab65ff Don't set CMAKE_CXX_STANDARD to 11 by default
Use the compiler default C++ dialect if it is C++11 or higher and only
explicitly request C++11 if the compiler can't compile a small test
using C++11 features by default.

This prevents from unnecessarily adding -std=c++11 to the compiler flags
under Unix, even with compilers using e.g. C++17 by default.
2024-01-06 13:59:09 +01:00
Vadim Zeitlin
e97d27165a Merge branch 'point-cleanup-and-new-operators'
Clean up wxPoint and wxRealPoint arithmetic operators: add missing ones,
fix parameter names,

See #24191.
2024-01-05 19:35:48 +01:00
David Miguel Susano Pinto
68bef2fbf3 Add compound operators * and / to wxPoint and wxRealPoint
Also add unit tests for them as well as for the existing additive
compound operators.
2024-01-05 19:34:43 +01:00
David Miguel Susano Pinto
1300c56f0d Put wxRealPoint operators in the same order as wxPoint ones 2024-01-05 19:31:14 +01:00
David Miguel Susano Pinto
11c3034177 Implement unary minus for wxRealPoint, same as wxPoint. 2024-01-05 12:44:11 +00:00
David Miguel Susano Pinto
b9b0cce41b include/wx/gdicmn.h: reorder to match the order in interface/wx/gdicmn.h. 2024-01-05 12:44:11 +00:00
David Miguel Susano Pinto
8638db50da Document a series of undocumented wxPoint and wxRealPoint operators.
Unary minus of wxPoint and multiplication with double are implemented
but undocumented.  Many of operators that use integers types other
than int remain undocumented though.
2024-01-05 12:44:11 +00:00
David Miguel Susano Pinto
66e7d0bce8 Implement + and - between wxRealPoint and wxSize.
These operators are part of the documented interface for wxRealPoint
but were never implemented.  This commit implements them.
2024-01-05 12:44:11 +00:00
David Miguel Susano Pinto
8ccbd7e95d Implement operator/=(int) and operator*=(int) for wxPoint and wxRealPoint.
These operators are part of the documented interface but were never
implemented.  This commit implements them.
2024-01-05 12:43:57 +00:00
David Miguel Susano Pinto
9a5d2ffade Correct names of variables in wxPoint and wxRealPoint arithmetic operators.
The arithmetic operators for wxPoint and wxRealPoint are quite
repetitive and were made by copy-paste from the wxSize operators.
Because of that, some of the names are a bit misleading which this
commit changes.  The changes are:

1. replace s/sz with p/pt for point variables (likely 's' comes from
   copied code used for wxSize variables)

2. replace 'i' with 'f' for floating point types (likely 'i' comes
   from copied code used for integer types)

3. replace 'factor' with 'divisor' for division operations (factors
   are the multiplication operands, not division)
2024-01-05 11:28:11 +00:00
Vadim Zeitlin
3dde6bdeb0 Disable swap interval in GLX wxGLCanvas implementation too
We need to do it when using XWayland for the same reasons as we had to
do it in the EGL version when using either XWayland or Wayland directly:
without this, we can block for up to 1 second in glXSwapBuffers() if the
window is hidden, see #23512.

Closes #24163.

Closes #24165.
2024-01-05 01:05:30 +01:00
David Miguel Susano Pinto
11ebffe7b0 Add operator/(wxPoint, double) and operator/(wxRealPoint, double)
Do this for consistency with wxSize which already had this operator/()
overload and operator*() in these classes which was already overloaded
for double.

Closes #24185.

Closes #24187.
2024-01-05 00:45:57 +01:00
Paul Cornett
a5e9befd4d Remove unused class
Unused since 025f5d1450 (Don't cache HDC used by wxPaintDCEx in wxMSW., 2013-03-09)
2024-01-04 12:49:37 -08:00
Paul Cornett
071e3187f5 Remove unused variables
These have been unused since e95354ec54 (added UTF-16/32-[LB]E conversions; got
rid of wxCharacterSet and simplified and fixed some bugs in remaining code, 2003-09-22)
2024-01-04 12:34:56 -08:00
Paul Cornett
cd93c73900 Remove another reference to GLU
Should have been part of ce1d317768 (Remove GLU dependency, 2023-12-28)
2024-01-04 12:22:39 -08:00
Paul Cornett
31a672b858 Improve our best size calculation for multi-line wxTextCtrl with GTK
Instead of trying to figure it out ourselves, just ask the control
what its minimum size is.
2024-01-04 12:11:50 -08:00
Vadim Zeitlin
5faa70503a Fix name in the comment for wx_check_c_source_compiles()
No real changes.
2024-01-04 03:25:07 +01:00
Vadim Zeitlin
486865b446 Add wxFileConfig::MigrateLocalFile()
This can be useful for the existing applications switching to using
XDG-compliant config files location as they can just call this function
on startup to keep using the existing file.
2024-01-04 03:23:37 +01:00
Vadim Zeitlin
ebe0847932 Add wxHAS_CONFIG_AS_{REG,FILE}CONFIG symbols
Sometimes it's useful to have some code used only if wxConfig is defined
as wxRegConfig or only if it is defined as wxFileConfig and testing for
these symbols is more clear than testing for the platform (and more
correct, considering that setting wxUSE_CONFIG_NATIVE to 0 may result in
wxFileConfig being used even under Windows).
2024-01-04 02:55:05 +01:00
Vadim Zeitlin
055c4cbed5 Fix crash on shutdown if wxConfig couldn't be saved
If saving wxConfig to the file in wxAppConsoleBase::CleanUp() failed,
wxLog messages were logged into a wxLogGui target which was recreated
because wxTheApp is still non-null when CleanUp() is called. However it
is destroyed soon afterwards and showing messages from wxLogGui without
wxTheApp leads to crashes, at least in wxGTK.

To avoid this, we could set wxTheApp to null before calling CleanUp(),
but it's not clear if there is no cleanup code (or something called from
it) which doesn't rely on wxTheApp existence, so instead just flush, and
reset, the log target after calling CleanUp() but before destroying the
application object.

This fixes the crash which could be easily reproduced simply by making
the file used by wxFileConfig not-writeable under Linux.
2024-01-04 02:46:18 +01:00
Vadim Zeitlin
e21b27019f Merge branch 'mac-build'
Improve Mac build documentation and build itself.

See #24128.
2024-01-03 20:27:00 +01:00
David Miguel Susano Pinto
a8b14edc40 Correct wxRealPoint and wxPoint operator return types in the docs
Use the correct types instead of wxSize which was erroneously used
there ever since a5664fd6ef (Increase interoperability between wxPoint
and wxRealPoint introducing constructors which convert between the two
classes., 2010-06-09).

Closes #23804.
2024-01-03 20:24:17 +01:00
Vadim Zeitlin
261490d5e2 Ignore failures in tests handling mouse clicks under AppVeyor
For some completely mysterious reason we don't get the expected mouse
click events when running under AppVeyor, something might be covering
the window and stealing the clicks for itself there.

As there doesn't seem to be anything to do about it, just skip the test
in this case.

Closes #24082.
2024-01-03 20:21:59 +01:00
Vadim Zeitlin
989829891a Fix memory leak when calling wxInitialize(void)
We still allocated argv arrays when argc was 0, but didn't free them in
this case.

Fix this by just not bothering to allocate them.
2024-01-03 18:36:25 +01:00