Commit Graph

72662 Commits

Author SHA1 Message Date
Vadim Zeitlin
eb361a182a Use a single wxBitmapBundle in wxDataViewBitmapRenderer
Instead of using either a wxBitmap or a wxIcon, always use the same
wxBitmapBundle object to store whatever we are rendering.

This slightly simplifies the code and prepares for further changes, but
nothing real changes yet.
2022-05-08 15:55:34 +01:00
Vadim Zeitlin
dc90e92110 Add wxBitmapBundle::Clear()
This is just a convenient helper for resetting the bundle contents which
seems more readable than assigning an empty bundle to it.
2022-05-08 15:54:51 +01: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
Lauri Nurmi
cb527f5b1f Do not assemble OSX menu item translations from pieces
Just spell out "Quit Application" and "Hide Application" as is,
without string concatenation.

Translating individual words can be complicated with some languages.

This change affects the case when wxTheApp is NULL, which presumably
is quite rare.

Closes #22384.
2022-05-03 18:10:16 +02:00
wangpengli.qwerty
f93b4f9c90 Fix assert checking size in wxBitmapBundleImplRC::AddBitmap()
Add the missing "name" argument to wxString::Format().

Closes #22387.
2022-05-03 18:04:26 +02:00
Vadim Zeitlin
10b49c9084 Avoid using invalid column/row indices when repainting empty grid
Even the normally safe internalYToRow() and internalXToCol() functions
can still return an invalid index when the grid is empty, i.e. when
there are no valid indices at all, so check for their return value
before using it as an argument to Get{Row,Col}Pos() that would
(correctly) assert when passed an invalid value.

This fixes a regression inadvertently introduced by 3719ab3725 (Add
support for rearranging wxGrid rows order interactively, 2022-04-02)
which added non-trivial GetRowPos().
2022-05-02 21:56:49 +01:00
Vadim Zeitlin
b585ef67af Consistently write loops over wxRegionIterator in the same way
Standardize on a single loop for all versions of it and prefer to use
"for" loops with the iterator increment directly in the loop statement
instead of using "while" loops with the increment somewhere inside the
loop, where it could be possibly skipped by a "continue" statement.

No real changes.
2022-05-02 21:52:25 +01:00
Vadim Zeitlin
bdfa9359ae Move wxGrid::Get{Row,Col}Pos() out of line
Don't define these functions in the header file, this is unnecessary.

No real changes.
2022-05-02 21:43:42 +01:00
Vadim Zeitlin
3cc55d5b66 Add a workaround for failing test under Wine
Debugging confirms that DPtoLP() simply returns wrong (i.e. different
from that returned under actual MSW) result when using Wine, so just
account for it in the test as it seems to be better than just skipping
the test entirely under Wine and there doesn't seem to be anything else
to do.
2022-05-02 22:42:42 +02:00
Vadim Zeitlin
c0b7240dfb Fix wxDC::DeviceToLogical() in presence of transform matrix
It's not enough to just shift the result by the origin shift if there is
a transform matrix, we need to apply the reverse shift transformed by
this matrix in general.

This is not very efficient as we redo the same matrix operations on
every call, but using both device origin shift and transform matrix
together should be quite rare, so it's not clear if it's worth
optimizing this.
2022-05-02 20:02:04 +01:00
Vadim Zeitlin
7eb5e99cac Don't use array of a single POINT in wxMSW wxDC code
No real changes, just use a simple POINT rather than POINT[1].
2022-05-02 19:52:27 +01:00
utelle
0e435c1c45 Simplify check for translated labels in wxMSW message boxes
Only translate the labels in the native message box if there is a valid
current wxTranslations instance: this is simpler and more robust than
checking if the current language is different from the system language.

Closes #22383.
2022-05-02 03:57:49 +02:00
Vadim Zeitlin
4f9186f1a1 Increase usable scrolling range in wxMSW by a factor of 10,000
Using GDI functions for the device origin translation limits the
scrolling range to 2^27 size of the device space in the controls using
PrepareDC(), as it works by adjusting the device origin, and this may be
too small when having many (millions) of rows, which is perfectly
possible with wxDataViewCtrl or wxGrid, for example.

So handle DC device origin translations ourselves in wxMSW, i.e. offset
the coordinates by device origin before passing them to the native
functions as this allows to use the full 32-bit range.

Closes #17550.
2022-05-02 02:51:42 +01:00
Vadim Zeitlin
c6e45280d7 Increase maximum allowed size of test virtual grid in the sample
This allows to see that the grid is currently not redrawn correctly
under MSW when it has more than ~6,000,000 rows due to overflowing the
device space span of 2^27.
2022-05-01 02:12:50 +01:00
Vadim Zeitlin
d64ba81378 Merge branch 'dc-cleanup'
Some cleanup in wxDC code: remove unnecessary casts, use RAII helpers
instead of manual memory and other resources management.

No real changes.

See #22378.
2022-05-01 03:11:06 +02:00
Vadim Zeitlin
4fcf3ba465 Merge branch 'fix-build-without-base64' of https://github.com/PBfordev/wxWidgets
Fix build when wxUSE_BASE64==0.

See #22377.
2022-05-01 03:07:35 +02:00
PB
ed3b1c6ca3 Simplify MSVC pragma for embedding application manifest
Instead of defining a manifest for each individual CPU architecture, use
a single manifest with an asterisk for the architecture.

Should have been part of 77d8926126 (Simplify Windows application
manifests, 2021-12-17).

Closes #22376.
2022-05-01 03:03:20 +02:00
utelle
1c65e88221 Replace references to wxLocale by wxUILocale
Use newer wxUILocale class directly instead of using wxLocale functions
that forward to it anyhow.

No real changes.

Closes #22375.
2022-05-01 03:02:26 +02:00
Vadim Zeitlin
a7791781d9 Merge branch 'listbook-images'
Show images added to its wxImageList later in wxListbook again and also
improve determining the size of the list control under MSW.

See #22372.
2022-05-01 02:57:24 +02:00
Vadim Zeitlin
eb5ad7255c Merge branch 'shared-client-data'
Allow sharing client data in wxGrid-related classes.

See #22369.
2022-05-01 02:55:36 +02:00
Vadim Zeitlin
9a36e26d4a Merge remote-tracking branch 'MaartenBent/wxdc-dpi'
Make wxDC and wxGraphicsContext DPI aware, i.e. add {From,To}DIP() to
them too and make the values returned from Get{DPI,PPI}() consistent
with wxWindow.

Also improve CMake build: add support for finding Cairo when not using
GTK, fix a warning when creating the inplace-config, and mark some
variables as advanced.

See #22346.
2022-05-01 02:53:12 +02:00
Vadim Zeitlin
e09a01068d Remove more unnecessary casts to int in wxMSW wxDC code
There is no need to cast wxCoord to int, they're one and the same.
2022-04-30 21:31:34 +01:00
Vadim Zeitlin
4a56747e8d Use helper PolyFillModeSetter in wxMSW wxDC code
No real changes, just use RAII helper instead of manually setting and
restoring the polygon fill mode.
2022-04-30 21:15:09 +01:00
Vadim Zeitlin
5157a8a62c Hide private StretchBltModeChanger class in unnamed namespace
No real changes, just put this non-wx-prefixed class in an unnamed
namespace to avoid any clashes with user-defined classes (which would be
possible when using wx as a static library).
2022-04-30 21:15:09 +01:00
Vadim Zeitlin
481b73d14c Use wxScopedArray<> instead of manual memory management in wxDC
Update similar code in all ports to use wxScopedArray for arrays of
points, dashes etc in various wxDC implementations instead of using
new[] and delete[] manually.

No real changes, just make the code safer and shorter.
2022-04-30 21:14:58 +01:00
Vadim Zeitlin
6383bc39ff Add convenient wxDCImpl::CalcBoundingBox() overloads and use them
No real changes, just make the code updating the bounding box slightly
shorter by providing convenient and slightly higher-level overloads.

For now these functions are only in wxDCImpl, it's not clear if we
really need them in wxDC, so don't add them to the public API.
2022-04-30 20:51:53 +01:00