Commit Graph

72585 Commits

Author SHA1 Message Date
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
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
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
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
Vadim Zeitlin
937fa42d10 Document that wxGetTimeZone() doesn't account for DST
This is intentional and won't be changed, although we could, perhaps,
add a wxGetDST() function or similar to make it easier to take DST into
account as well.

Closes #22399.
2022-05-08 16:18:29 +02:00
Vadim Zeitlin
610eeb476b Inline wxGtkTreeSetVisibleProp() function
No real changes, just get rid of a trivial helper function which is only
used once since the changes of the previous commit and copy its code
directly into the caller.
2022-05-08 00:32:06 +02:00
Vadim Zeitlin
1c9c48c346 Don't show value-less wxDataViewVirtualListModel cells in wxGTK
For some reason, calls to wxGtkTreeSetVisibleProp() were skipped when
using virtual list model in wxGTK implementation, resulting in showing
the value of the previous (i.e. upper) cell for the rows of this model
for which no value was available.

Simply remove IsVirtualListModel() checks and always set the cell
visibility to fix this.

This commit is best viewed ignoring whitespace-only changes.
2022-05-08 00:27:45 +02:00
DietmarSchwertberger
b6fb5109c0 Fix drawing of row/col drag markers in wxGrid
Don't offset the DC in the unwanted direction as this resulted in not
drawing anything at all when the grid was scrolled.

Also fix off by one error in the marker line length.

Closes #22403.
2022-05-07 18:58:07 +02:00
DietmarSchwertberger
84729af324 Fix handling of standard accelerators in wxSpinCtrl in wxMSW
Keys such as Ctrl-C etc could be unexpectedly intercepted by
accelerators defined for the menu items when wxSpinCtrl had focus.

Fix this by always preprocessing such keys in wxSpinCtrl itself, just as
it was already done for wxTextCtrl and even reuse the same function for
doing it (which had to be factored out in order to allow it).

Closes #22404.
2022-05-07 17:12:08 +02:00
taler21
d9c53a650d Fix translations of accelerator prefixes after context change
Ensure that the accelerators using non-English strings are recognized
properly again, provided the translations for these prefixes are
available, just as it was the case before the changes of e6abc4ca12
(Update message catalogs after adding keyboard key context, 2022-04-27)

See #22354.

Closes #22388.
2022-05-07 17:03:12 +02:00
Vadim Zeitlin
0e544960b0 Fix example of creating wxUILocale in its documentation
There are several ways to do it, and it's not clear which one of them
should be illustrated here, but it should definitely be one that works.

Closes #22389.
2022-05-07 16:34:45 +02:00
Vadim Zeitlin
6feeed9fe9 Handle transparency to the best of our ability in wxImageList
Don't take the value of "mask" parameter of wxImageList constructor too
prescriptively, it predates support for alpha in wxWidgets by many years
and was never meant to actually suppress using it.

Instead, do the best thing we can in all cases, i.e. use alpha if it's
specified and supported and use mask otherwise. But only create the mask
from light grey colour if we have nothing else if "mask" is true in
wxImageList constructor, as this is a potentially destructive action
that must not be performed if the user has explicitly decided to set
this parameter to false.

Incidentally fix handling of alpha with comctl32.dll v5 (which is used
in the absence of any manifest) by converting it to a mask in this case:
this is not ideal, but better than just using black background as it
happened before, and restores pre-3.1.5 behaviour.

Also simplify the generic version which just has to create the default
mask if necessary and doesn't have to do anything at all in all the
other cases.

Note that these changes required relaxing some of the existing unit
tests as wxMSW implementation now can add alpha channel to the bitmaps
that didn't have it -- but this is a more useful behaviour, and so it
makes more sense to adapt the tests to it rather than doing a less
useful thing just to conform to the tests.

This commit is best viewed with git --color-moved
--color-moved-ws=ignore-all-spac options.

Closes #22349.
2022-05-06 02:12:54 +01:00
Vadim Zeitlin
0e21b52d57 Extract mask creation from wxImage in a separate function
Allow reusing the code for creating a mask from wxImage mask from
elsewhere.

No real changes yet, this is a just a refactoring.

This commit is best viewed with git --color-moved
--color-moved-ws=ignore-all-space options.
2022-05-06 02:12:54 +01:00
Vadim Zeitlin
416ebf79e0 Use wxScopedArray<> in wxBitmap::CreateFromImage()
Don't manage memory manually.

No real changes.
2022-05-06 02:12:54 +01:00
Vadim Zeitlin
e75f100841 Make GetImageListBitmap() member of wxGenericImageList too
Just simplify the code a little by avoiding having to pass m_useMask and
m_size to all calls of this function.

No real changes.
2022-05-06 02:12:54 +01:00
Maarten Bent
931370f0ad Add NanoSVG setup options
An option to enable or disable using NanoSVG for rasterizing SVG files.
And an option to indicate an external NanoSVG library is used.
2022-05-05 22:15:49 +02:00
Maarten Bent
c8bfd53d13 CMake: Fix using Windows path separator in wxINSTALL_PREFIX 2022-05-05 22:07:52 +02:00
Maarten Bent
fb8e860c05 CMake: Include third-party library directories when they are defined
Recent versions of CMake's FindJPEG also has the _DIRS variant.
2022-05-05 22:07:52 +02:00
Vadim Zeitlin
dcc39d942f Make GetImageListBitmaps() member function of wxImageList
No real changes, just simplify the code a bit by using a member function
as this avoids having to pass m_useMask to it separately.
2022-05-05 19:06:18 +01:00
PB
68dee47694 Explain how to best use wxFrame as input form
Add information about the recommended way of using wxFrame
as a form, i.e., to not create the input controls as its
direct children but use wxPanel for this instead.

Closes #22395.
2022-05-05 17:32:43 +02:00
Vadim Zeitlin
84e15a8fd2 Merge branch 'wxsvg-mac' of https://github.com/MaartenBent/wxWidgets
Improve wxSVGFileDC on macOS: use correct scaling.

See #22390.
2022-05-05 17:29:20 +02:00
Vadim Zeitlin
bf0f9cf55b Merge branch 'msw-scroll-beyond-2_27'
Increase usable scrolling range in wxMSW by a factor of 10,000 by
switching to handling the device origin in wxWidgets itself instead of
letting GDI handle it.

See #22382.
2022-05-05 17:24:58 +02:00
DietmarSchwertberger
ec737396d8 Unify wxGrid code for processing row and column mouse events
Reuse the same code for handling mouse events for both rows and columns
instead of duplicating almost (but not quite) the same code for both of
them.

As part of resolving the inconsistencies between the two versions, add
wxEVT_GRID_ROW_AUTO_SIZE corresponding to the existing event with the
same name for the columns.

Closes #22380.
2022-05-05 17:23:45 +02:00
Joonas Kuusela
1660584a45 Fix using wx/tipwin.h as the first include wx header
Include wx/defs.h from wx/tipwin.h to ensure wxUSE_TIPWINDOW is defined
before testing its value.

Closes #22392.
2022-05-05 16:10:46 +02:00
Vadim Zeitlin
84eb6bfa41 Consistently use 1992 as the start of the copyright period
Use 1992 as the initial date for all non-Mac files, instead of using
slightly later years for some of them without any good reason (or at
least without any good reason still remembered by anybody).

This also allows to simplify the script for updating the year.
2022-05-04 17:24:53 +02:00
Jouk
9ad589ce1d Corrections for different syntax of uname command on OpenVMS 2022-05-04 15:58:13 +02:00
Maarten Bent
17e6fe5b4f Improve wxSVGFileDC on macOS
On macOS everything is based on 72DPI, while the SVG is based on 96DPI.
As a result, fonts in point-size are too big and squeezed together (due too
textLength).

Fix this by taking the standard screen DPI into account in FromDIP and ToDIP,
so all coordinates and sizes will be in SVG DPI.

wxSVGFileDC should be created with a DIP size, so use FromDIP to get the
correct viewBox size and clear-rectangle size.
2022-05-03 22:56:55 +02:00
Maarten Bent
1d6c366f14 Make all pages in the drawing sample DPI aware 2022-05-03 22:56:07 +02:00
Vadim Zeitlin
e503cbe212 Merge branch 'fix-empty-grid'
Fix asserts when redrawing empty wxGrid.

See #22385.
2022-05-03 18:11:09 +02:00