Commit Graph

72662 Commits

Author SHA1 Message Date
Vadim Zeitlin
f0de5a93f8 Use reasonable size for wxPreviewFrame by default
Give a reasonable default size to wxPreviewCanvas and fit wxPreviewFrame
to its contents.

Remove the useless call to Fit() from SizerWithButtons: the size set
inside it was just ignored anyhow.

This also allows to stop hardcoding the size in the sample, so don't do
this any more.

See #22439.
2022-05-19 17:04:32 +01:00
Vadim Zeitlin
93a6784c5f Remove unnecessary wxPreviewFrame::Layout() call
No real changes, just remove the useless call which was left over the
very first version of this code added in 7bcb11d307 (Many changes to the
printing classes., 1999-03-25).
2022-05-19 17:21:49 +02:00
taler21
91a0dc3197 Fix insufficient width of zoom combobox in print preview
Don't hardcode 70px size for the combobox, but let it determine its own
size instead, as 70 may well not be enough, depending on the theme and
the font size.

Closes #22439.
2022-05-19 16:42:31 +02:00
Vadim Zeitlin
dd80f16fc2 Fix wxGTK build with glib < 2.50
This was recently broken by bffcb88266 (Optionally detect not filtered
GTK log messages, 2022-05-12), see #22424.

Fix it by providing a trivial "do nothing" version of LogFilterByMessage
even if we can't implement it -- this seems to be preferable to using
preprocessor checks in the code using it.

Closes #22434.
2022-05-18 18:47:37 +02:00
Vadim Zeitlin
754aed4d7b Fix wxBitmapBundle support in wxTreeList
Don't use wxWithImages::GetImage(), which is limited to only a single
bitmap resolution, but use GetBitmapBundle() instead to ensure that we
show the representation of the bitmap appropriate for the current
resolution.
2022-05-18 17:45:44 +02:00
Vadim Zeitlin
1ed13da86e Factor out common initialization code in wxImageList tests
No changes, just stop duplicating exactly the same initialization code
for the tests with and without masks.
2022-05-18 15:43:31 +01:00
Vadim Zeitlin
ed264087ec Use flags for drawing arrow in wxGTK DrawComboBoxDropButton()
This would seem to be required for drawing it correctly in the disabled
state, for example, but is still insufficient to fix its appearance, at
least with GTK 3.

See #22431.
2022-05-17 16:45:37 +02:00
Vadim Zeitlin
2efa26cc1f Merge branch 'gtk-log-suppress'
Allow suppressing GTK log messages.

See #22424.
2022-05-17 16:36:06 +02:00
Patriccollu
43a8cb2db7 Update Corsican translation for 3.1.7 2022-05-17 16:21:06 +02:00
Robin Dunn
e6f2325f63 Add some missing wxBitmap --> wxBitmapBundle changes 2022-05-16 15:33:41 -07:00
Vadim Zeitlin
6268b5c619 Fix building font sample in STL mode after recent breakage
The changes of adb8bbab4d (Sort font names in the dialog showing them in
the font sample, 2022-05-12) didn't compile with wxUSE_STL==1 because
wxSortedArrayString doesn't inherit from wxArrayString in this case.

Fix this by using wxArrayString and its Sort() method instead.
2022-05-12 21:00:01 +02:00
Vadim Zeitlin
9fe3d3c0c9 Merge branch 'cplusplus-tests'
Add wxCHECK_CXX_STD() to accommodate MSVC and, in particular, fix
warnings when using this compiler in C++20 mode.

See #22422.
2022-05-12 18:57:18 +01:00
Vadim Zeitlin
a058951259 Skip disabling the correct window when showing MSW modal dialogs
The fix of a5a5b1bb15 (Fix restoring focus after showing native modal
dialogs in wxMSW, 2022-04-07) wasn't quite correct as it used the parent
window specified when showing the dialog, but it should have been using
the effective dialog parent, i.e. owner window in MSW terms.

Fix this by passing GetParentForModalDialog() to wxWindowDisabler, which
ensures that the preserve the same behaviour as before, including
refreshing the owner window after the dialog as dismissed -- which turns
out to be important because some existing code relies on this happening,
see #22362.

This commit should hopefully fix the last regression after d311c705d7
(Make native dialogs application-modal in wxMSW, 2022-04-01) and still
solve the original problem (see #11887), while preserving the original
behaviour when there is just one top-level window.
2022-05-12 18:52:02 +01:00
Vadim Zeitlin
adb8bbab4d Sort font names in the dialog showing them in the font sample
This makes the list of the fonts much more readable, compared to listing
them in essentially random order.

Incidentally stop using manual memory allocation to avoid giving a bad
example.
2022-05-12 16:31:40 +01:00
Vadim Zeitlin
bffcb88266 Optionally detect not filtered GTK log messages
In the future it might be useful to run the code with WXTRACE=gtklog to
see if any GTK log messages we're filtering don't need to be filtered
any longer.
2022-05-12 16:13:19 +02:00
Vadim Zeitlin
8f49ecc3d0 Suppress bogus GTK messages when removing wxNotebook pages
These messages are due to an assertion failure deep inside ATK which
doesn't indicate any real problem (as failure to get the label of an
already destroyed tab is normal and is already handled correctly in the
GTK code) and can't be avoided, so suppress them to avoid showing them
to the users who can't do anything at all about them anyhow, but can be
scared by the "CRITICAL" GTK messages.

Closes #22176.
2022-05-12 16:13:19 +02:00
Vadim Zeitlin
4602caf49d Add LogFilterByMessage GTK log filter
This will allow suppressing GTK log messages with the specified
fixed contents.
2022-05-12 00:34:14 +02:00
Vadim Zeitlin
f137f19bb7 Factor out wxGTKImpl::LogFilter from GTKSuppressDiagnostics()
Refactor the code to separate setting of the log callback from the
filtering decision.

Right now the only existing filter is the one just checking the log
level, which is used by GTKSuppressDiagnostics(), but this will allow
adding other filters in the upcoming commits.
2022-05-12 00:25:08 +02:00
DietmarSchwertberger
2698dde445 Fix regression in wxGrid::DeleteRows()
Compare the row position with the number of rows, not columns, fixing a
regression introduced in 3719ab3725 (Add support for rearranging wxGrid
rows order interactively, 2022-04-02) (see #22260).

Closes #22420.

Closes #22423.
2022-05-11 23:33:44 +02:00
Vadim Zeitlin
2ba9007d0e Add wxCHECK_CXX_STD() and use it to test for C++17 and C++20
Unlike direct tests of __cplusplus, using this macro also works with
(recent enough, i.e. MSVS 2015.3 or later) MSVC versions, even if
/Zc:__cplusplus is not used.

This simplifies some checks and makes some other ones (notably the check
for C++20 used before wxALLOW_COMBINING_ENUMS macro definition) work
with MSVC versions with C++20 support as intended.
2022-05-11 16:57:18 +01:00
Vadim Zeitlin
d311a07b7a Remove unnecessary test which was needed for macOS < 10.7 only
There is no need to check for the weird case of using a C++11 compiler
with C++98 standard library any longer, this is not supposed to happen
and we don't support macOS < 10.7 since a very long time anyhow.
2022-05-11 16:49:43 +01:00
Vadim Zeitlin
140b88af4a Improve wxDataViewRenderer variant type documentation
Explain what it is in the ctor documentation and link to the new
IsCompatibleVariantType() in GetVariantType() docs.
2022-05-11 17:23:56 +02:00
Vadim Zeitlin
df51ec8c40 Merge branch 'dvc-null-values'
Fix (not) showing values for empty cells in wxDVC using
wxDataViewVirtualListModel in wxGTK.

See #22409.
2022-05-11 16:42:43 +02:00
Vadim Zeitlin
d456f87321 Use appropriate initial size for the wrapsizer sample frame
Ensure the frame is big enough to show its contents, otherwise some
controls were truncated and not visible at all initially, at least under
MSW.
2022-05-11 15:24:34 +01:00
Antti Nietosvaara
7f32d9b752 Fix layout of wxFlexGridSizer containing wxWrapSizer
Fix a layout issue when wxFlexGridSizer contains items that return true
from InformFirstDirection(), such as wxWrapSizer.

If didAdjustMinSize == true, the minimum width has probably changed, and
we should recalculate it. Otherwise we end up using incorrect delta in
DoAdjustForGrowables, which might push items too far to the right.

Closes #22421.
2022-05-11 15:21:16 +01:00
Vadim Zeitlin
a7eee933c6 Merge branch 'tsan-warnings'
Fix a harmless warning from thread sanitizer and make wxAtomicInc() more
useful.

See #22417.
2022-05-11 02:37:26 +02:00
Vadim Zeitlin
bb52a5c5b5 Merge branch 'imaglist-mask'
Make handling of masks in wxImageList simpler and more useful.

See #22400.
2022-05-11 02:35:59 +02:00
Vadim Zeitlin
5a6adf4f58 Merge branch 'nanosvg-lib'
CMake: Support external NanoSVG library.

See #22407.
2022-05-11 02:33:38 +02:00
Vadim Zeitlin
f81e73b9b1 Document that wxUSE_NANOSVG is available starting in 3.1.7 only
Don't bother repeating it for wxUSE_NANOSVG_EXTERNAL as it should be
clear enough that this option doesn't make sense without wxUSE_NANOSVG
anyhow.
2022-05-11 02:32:22 +02:00
Vadim Zeitlin
cf841aa286 Fix build with WXWIN_COMPATIBILITY_2_8==1
This was broken by the changes of 6383bc39ff (Add convenient
wxDCImpl::CalcBoundingBox() overloads and use them, 2022-04-30), fix it
by calling the overloaded wxDCImpl::CalcBoundingBox() instead of the
wxDC version for which the overloads were not added.

Closes #22418.
2022-05-11 02:29:02 +02:00
Maarten Bent
ce32faa563 Document the NanoSVG options 2022-05-11 01:55:20 +02:00
Maarten Bent
760bfaa34e Add --with-nanosvg option to configure
So wxUSE_NANOSVG is enabled by default.
2022-05-11 01:55:19 +02:00
Maarten Bent
86b33600bc CMake: Check all known NanoSVG target names 2022-05-11 01:55:19 +02:00
Maarten Bent
138d1ab021 CMake: Support header-only NanoSVG library
Check if the NanoSVG target defines any library locations.
Add a private compile definition to wxcore, instead of adding another setup.h option.
2022-05-11 01:55:19 +02:00
Maarten Bent
603c13aaba CMake: Add support for external NanoSVG library 2022-05-11 01:54:03 +02:00
Vadim Zeitlin
fbeccb3954 Use wxAtomicInt for the global initialization counter
This is slightly more efficient and simpler than using a separate
critical section and can easily be done now that wxAtomicInc() returns
the new value.

No real changes.
2022-05-11 00:18:02 +02:00
Vadim Zeitlin
c036bdf3e5 Recommend using std::atomic instead of our functions
The standard class is much more flexible and type-safe.
2022-05-11 00:18:02 +02:00
Vadim Zeitlin
cf66ce5f94 Return the new value from wxAtomicInc() too
This is easy to do and can be useful when using an atomic initialization
counter.

The only platform where not returning the new value might be more
efficient than returning it is Solaris which is not really relevant any
more and on all the other platforms the functions we were already using
provided this value already (or almost, in case of using gcc builtins,
when we just have to use a different one).
2022-05-11 00:16:47 +02:00
Vadim Zeitlin
e82290f0da Use wxVector instead of array macro in atomic unit test
No real changes.
2022-05-11 00:08:52 +02:00
Vadim Zeitlin
50bc3ceb04 Get rid of CppUnit boilerplate in atomic unit test
Also use a single test function with different sections instead of using
a helper function with 4 wrappers calling it for simplicity.
2022-05-11 00:08:03 +02:00
Vadim Zeitlin
a2e68f43ea Avoid direct access to an atomic variable in the test
This (correctly) results in a warning about data race from TSAN, so
don't do it and use the return value of wxAtomicDec() instead.
2022-05-10 23:55:25 +02:00
Vadim Zeitlin
44131b044d Use the same number of iterations in atomic unit test
Use reasonably, but not too, big number, so that the test doesn't run
too long, even when TSAN is used.

This also simplifies the code.
2022-05-10 23:54:21 +02:00
Vadim Zeitlin
f4fb91b56e Don't keep critical section locked during wxEntryStart() call
Use gs_initData.csInit only to ensure that we call wxEntryStart() once
even if there are multiple calls to wxInitialize() from multiple
threads, but don't keep it locked for the duration of that function as
this is unnecessary and results in -- probably benign in practice, but
still annoying -- warnings from the thread sanitizer about lock order
inversions due to locking csInit first before locking gs_mutexGui in
wxThreadModule::OnInit() and then acquiring csInit again while
gs_mutexGui is still locked in wxUninitialize().

This shouldn't result in any observable changes in behaviour.
2022-05-10 23:26:45 +02:00
Miguel Gimenez
25e5181386 Update Spanish translations for 3.1.7 2022-05-10 19:22:55 +02:00
Vadim Zeitlin
1b82a9fe04 Use wxBitmapBundle as default type in wxDataViewBitmapRenderer
The default type doesn't really matter after the previous commits, as
the renderer accepts both wxBitmap and wxBitmapBundle (and also wxIcon)
in any case anyhow, but it seems better to use the preferred type as the
default one.

Also make the documentation more useful, although an example is still
lacking.
2022-05-09 14:36:41 +02:00
Vadim Zeitlin
8d3e7fd346 Accept wxBitmapBundle in wxDataViewBitmapRenderer too
This allows returning the entire bundle from the model GetValue()
function to let the renderer itself to select the best matching bitmap
to use.
2022-05-09 14:36:41 +02:00
Vadim Zeitlin
5556ea8429 Add support for storing wxBitmapBundle in a wxVariant
Define wxBitmapBundleVariantData without using the standard macros that
only work for wxObject-derived classes, but using more or less what they
expand into.

This will allow using wxBitmapBundle with wxDataViewCustomRenderer
subclasses in the upcoming commit.
2022-05-08 21:26:04 +02:00
Vadim Zeitlin
d8abdfbdee Accept either bitmaps or icons in wxDataViewBitmapRenderer
Allow using either wxBitmap or wxIcon in wxDataViewBitmapRenderer
independently of the type the renderer was created with because this is
convenient and there is no real danger in allowing to mix and match
bitmaps and icons together.

Override the just added IsCompatibleVariantType() to implement this.
2022-05-08 21:26:04 +02:00
Vadim Zeitlin
23e815bcf6 Allow relaxing the check for variant type in wxDataViewRenderer
Instead of checking for the exact variant type match, call the new
IsCompatibleVariantType() virtual function, which still does the same
check by default, but can be overridden to allow other types as well if
they're accepted by the renderer.

This will be soon used to allow accepting both wxBitmap (which must
still be accepted for compatibility) and wxBitmapBundle (which is the
simplest way to support high DPI) in wxDataViewBitmapRenderer at once.
2022-05-08 18:39:15 +01:00
Vadim Zeitlin
8aefedcb45 Remove duplicated HasValue() call from wxGTK wxDataViewCtrl code
HasValue() is already called by PrepareForItem(), so there is no need to
call it explicitly from wxGTK code, just rely on PrepareForItem()
returning false if there is no value to show -- we can skip the call to
GtkSetCurrentItem() in this case, this function is cheap, and we lose
more by calling HasValue() twice in the common case than we save on not
calling it.

No real changes.
2022-05-08 18:24:01 +02:00