Commit Graph

41641 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
Vadim Zeitlin
2fbb40ab61 Remove RealizeScaleAndOrigin() call from wxMSWDCImpl::Clear()
It seems unnecessary here as this function doesn't change neither scale
nor the origin, so there should be no need to realize them neither.
2022-04-30 20:51:53 +01:00
Vadim Zeitlin
03b9be08de Remove useless casts to int from wxMSW wxDC::SetDeviceOrigin()
The variables are already of type int (== wxCoord).

No real changes.
2022-04-30 20:51:53 +01:00
Stefan Csomor
dc2ff0d6b4 wxOSX: Rewiring GetBestSize for single line text control again
see #22374
2022-04-30 20:34:28 +02:00
PB
97e126624e Show error message wxSVGBitmapEmbedHandler::ProcessBitmap()
Do not just silently fail in wxSVGBitmapEmbedHandler::ProcessBitmap()
when wxUSE_BASE64=0, use wxFAIL_MEG() to show why it failed.
2022-04-30 17:46:25 +02:00
PB
3f32bac284 Fix building wxSVGBitmapEmbedHandler when wxUSE_BASE64=0
Use guards for wxUSE_BASE64 in wxSVGBitmapEmbedHandler::ProcessBitmap()
and just return false there when wxUSE_BASE64=0.
2022-04-30 16:33:28 +02:00
PB
4ddaa9c0ce Fix building wxIniConfig when wxUSE_BASE64=0
Use guards for wxUSE_BASE64 just as wxConfigBase does.
2022-04-30 16:29:13 +02:00
Vadim Zeitlin
e0f7dca2b8 Improve best height of horizontally laid out wxListCtrl in wxMSW
It seems that ListView_ApproximateViewRect() always reserves space for
the horizontal scrollbar vertically, even when it isn't needed,
resulting in a lot of blank space remaining in horizontal wxListbook
(e.g. using "top" orientation) in the notebook sample.

So instead of adding extra space when the scrollbar is shown, remove it
when it is not shown.
2022-04-28 23:47:51 +01:00
Maarten Bent
dc5fe63cb2 Don't implement FromDIP and ToDIP in headers 2022-04-29 00:38:46 +02:00
Vadim Zeitlin
25e46d0a4d Improve wxListCtrl::MSWGetBestViewRect() fit
It looks like ListView_ApproximateViewRect() doesn't actually take the
borders into account and doesn't even take margins into account
correctly.

With this change, vertical wxListbook in the notebook sample doesn't
show any horizontal scrollbar and has symmetric margins around its
contents (whether it shows a vertical scrollbar or not) under both
Windows 7 and 10.
2022-04-28 23:38:40 +01:00
Stefan Csomor
74c0fe6dcc Serialize font style correctly in Mac wxNativeFontInfo
The style needs to be explicitly included in the serialized
representation as it's not necessarily part of the native font
description itself, but can be emulated using a transform matrix.

Also fix the font family handling by recreating the native font info
from the newly generated font.

Closes #22373.
2022-04-28 23:37:43 +02:00
Stefan Csomor
5f7d4a70c2 Use "Courier New" and "Times New Roman" in wxOSX
macOS 12 doesn't provide "Courier" and "Times" fonts any longer, so use
their closest replacements "Courier New" and "Times New Roman" instead.

In addition to using them for our own default fonts, also map
user-provided fonts with the old names to the new ones, as in practice
quite a few applications specify these face names rather than relying on
wxFontFamily and it seems better to allow them to keep working correctly
under macOS 12+ rather than using a completely different default system
font when e.g. "Courier" is specified.

Co-Authored-By: Vadim Zeitlin <vadim@wxwidgets.org>

Closes #22355.
2022-04-28 00:53:05 +02:00
Vadim Zeitlin
35a3bac439 Use wxObjectDataPtr in wxSharedClientDataContainer
This is slightly more economical, both at run-time and, maybe more
importantly, at compile-time than using wxSharedPtr that we don't really
need here, simple intrusive ref counting smart pointer is enough.
2022-04-28 00:47:19 +02:00
Vadim Zeitlin
e2a5c1ffc8 Don't provide wxSharedClientDataContainer::m_data accessors
This is not really necessary and breaks encapsulation of this private
method. It is enough to provide just a way to copy the data from another
object as this is all that the derived classes really need.
2022-04-28 00:36:40 +02:00
Frode Roxrud Gill
f646e8b11c Allow cloning client data stored in wxGrid attributes etc
Add wxSharedClientDataContainer class storing ref-counted client data
and use it instead of plain wxClientDataContainer in wxGridCellAttr,
wxGridCellEditor and wxGridCellRenderer classes.

This allows to keep the same client data associated with many grid cells
without having to make many copies of it.
2022-04-28 00:28:58 +02:00
Vadim Zeitlin
6935b831bd Merge branch 'messages-with-context' of https://github.com/lanurmi/wxWidgets
Add wxTRANSLATE_IN_CONTEXT() and use it in a few places, notably for the
key names.

See #22354.
2022-04-27 19:17:12 +02:00
DietmarSchwertberger
1b158caa83 Improve usability of wxGrid actions using mouse dragging
Implement auto scrolling and handle ESCAPE to cancel the actions done by
dragging the mouse, such as resizing or selecting an area.

Closes #22292.
2022-04-27 19:09:40 +02:00
Maarten Bent
d2366b2eb0 Fix printing at high DPI on GTK3 and when saving as postscript 2022-04-26 21:25:55 +02:00
Maarten Bent
2bab3e8d1c Remove wxWindow DPI from wxMemoryDC
wxMemoryDC is normally not associated with a wxWindow.
2022-04-26 21:25:55 +02:00
Maarten Bent
bb91534cb3 Use different method to get CGContextRef on Cairo renderer 2022-04-26 21:25:50 +02:00
Maarten Bent
77a61569a8 Restructure Cairo font initialization
Add some comments explaining why things are done.
2022-04-26 21:25:50 +02:00