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.
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.
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.
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.
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.
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.
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.
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.
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().
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.
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.
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.
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.
Some cleanup in wxDC code: remove unnecessary casts, use RAII helpers
instead of manual memory and other resources management.
No real changes.
See #22378.
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.
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).
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.
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.
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.
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.
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.
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.
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.
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.
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.