Commit Graph

20074 Commits

Author SHA1 Message Date
Vadim Zeitlin
663fa1c77b Still use wxPreviewFrame size if it was explicitly specified
Even though it's better to not specify the preview frame size at all,
the size should still be used if it was explicitly specified, but this
didn't happen any more after the addition of the call to Fit().

Fix this now by only doing the equivalent of Fit() if no size was
explicitly given.

Also add advice about not setting the size explicitly to the
documentation.
2022-05-23 15:07:06 +01: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
2efa26cc1f Merge branch 'gtk-log-suppress'
Allow suppressing GTK log messages.

See #22424.
2022-05-17 16:36:06 +02: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
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
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
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
Maarten Bent
603c13aaba CMake: Add support for external NanoSVG library 2022-05-11 01:54:03 +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
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
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
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
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
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
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
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
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
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
Stefan Csomor
dc2ff0d6b4 wxOSX: Rewiring GetBestSize for single line text control again
see #22374
2022-04-30 20:34: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
Maarten Bent
dc5fe63cb2 Don't implement FromDIP and ToDIP in headers 2022-04-29 00:38:46 +02:00
Vadim Zeitlin
ebf5e8813e Show images added to its wxImageList later in wxListbook again
Fix a regression in 3.1.6 which resulted in not showing any images if
the associated image list was empty when it was associated with the
control, as HasImages() returned false in this case and so wxLC_ICON
style was not set.

The fix is to return true from HasImages() if we have image list even if
it is currently empty, as we can't know when (or if) it will become
non-empty and it's better to assume that it will be used (as nothing
really catastrophic should happen if it is not used, finally) rather
than not taking into account the images added to it later.

Closes #22364.
2022-04-28 17:24:58 +01: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
Vadim Zeitlin
de8877d3ee Make more ctors of wxGrid classes explicit
Don't allow nonsensical implicit conversion from int to
wxGridCellFloatFormat etc.

No real changes.
2022-04-28 00:30:44 +02:00
Vadim Zeitlin
5db2244bc8 Use wxString() rather than wxEmptyString in wxGrid classes
No real changes, just use default ctor for the default value of some
parameters.
2022-04-28 00:30:15 +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
Stefan Csomor
d9ec9ab1f1 Use Cocoa native layout inset method
Don't hardcode inset sizes any longer.

This improves various issues under macOS 12, see #22134 and #22135 (but
doesn't fully fix the former problem yet).

Closes #22351.
2022-04-25 21:51:00 +02:00
Lauri Nurmi
180b8e5183 Mark system cursor names translatable in a context, and do get translation
It looks like wxGetTranslation() was not actually called for these strings
earlier, so do call it.

The context fulfills also the same purpose as TRANSLATORS: comments --
removing comments as redundant.
2022-04-24 11:30:31 +03:00
Lauri Nurmi
e3bf759615 Add wxTRANSLATE_IN_CONTEXT() macro for marking strings for translation
Similarly to wxTRANSLATE(), this macro does not do much itself.
2022-04-24 11:30:31 +03:00
Uwe Runtemund
28f62b2e59 Add support for creating wxBitmapBundle from wxIconBundle
This is useful for converting existing code using wxIconBundle for
similar purposes to switch to using wxBitmapBundle instead.

Closes #22347.
2022-04-23 17:31:46 +02:00
Vadim Zeitlin
c4dc0353cc Fix wxGTK1 build after adding wxBitmap(wxImage, wxDC) ctor
This fixes a compilation problem introduced in 24970061fa (Add
wxBitmap(wxImage, wxDC) ctor to all ports, 2022-04-12).
2022-04-23 15:04:25 +02:00
Maarten Bent
e8cf1f989b Add ToDIP to wxDC and wxGraphicsContext 2022-04-21 22:04:10 +02:00
Maarten Bent
59443803b4 Only scale MSW wxMemoryDC without window with content scale factor 2022-04-21 22:04:09 +02:00
Maarten Bent
1a1d19e93b Improve print preview and printing with high DPI
All print related scaling is based on 96DPI, so always let the printing contexts return this,
and also adjust the font to this DPI.
2022-04-21 22:04:06 +02:00
Maarten Bent
3da3103eb5 Override FromDIP in wxSVGFileDC and wxPostScriptDC
These are DPI independent.
2022-04-21 21:55:53 +02:00