Commit Graph

41580 Commits

Author SHA1 Message Date
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
Vadim Zeitlin
8245ba96ee Don't crash if invalid index is used with wxDataViewListCtrl
Use wxCHECK, not wxASSERT, for checking a critical precondition to
ensure that we don't crash if it's violated.

This fixes crashes in various wxDataViewListCtrl methods if they're
passed an invalid index different from wxNOT_FOUND.

Closes #22358.
2022-04-26 02:02:29 +02:00
Maarten Bent
a98104c1f0 Fix wxRichToolTipPopup size at non-system DPI displays
Move the popup to the display where it will be shown, so the size
calculations are based on the correct DPI.

Also adjust the tip size to the current DPI.

Closes #22361.
2022-04-25 22:16:21 +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
3396a40015 Mark keyboard key names translatable in a specific context
Many key names are short and commonly used words; e.g. "Delete", "Left",
"Right", "Pause", "Menu", "End".

It is not at all unlikely that such words could be used in a completely
different meaning elsewhere in the code. That is why this list of
keys should be assigned a context.

The context fulfills also the same purpose as TRANSLATORS: comments --
removing comments as redundant.
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
Paul Cornett
a261c80298 Avoid Gdk-CRITICAL warnings when using PopupMenu() with Wayland 2022-04-22 09:58:02 -07:00
Stefan Csomor
184a1fa244 reuse already existing method for turning off tabbing by default 2022-04-22 18:04:28 +02:00
Stefan Csomor
86e485c8d8 suppress adding automatic menu items on macOS
see #22210
2022-04-22 17:46:14 +02:00
Vadim Zeitlin
e38c8946d1 Merge branch 'dist-no-symlinks'
Get rid of symlinks in the distribution archives.

See #22342.
2022-04-21 21:25:22 +02:00
Vadim Zeitlin
ac60d78d8d Merge branch 'toolbar-bitmap-size'
Make wxToolBar::SetToolBitmapSize() take size in logical pixels.

See #22338.
2022-04-21 21:24:46 +02:00
Vadim Zeitlin
d10c4997ea Remove a useless symlink from expat submodule
This created problems when unpacking distribution archives without
administrative rights under MSW, so simply remove a symlink that we
don't really need anyhow to avoid them.

Closes #22271.
2022-04-21 01:08:43 +02:00
Vadim Zeitlin
1b3243c012 Merge branch 'zlib-1.2.12-prefix'
Fix bug with unprefixed functions in zlib 1.2.12.

See #22341.
2022-04-21 00:39:55 +02:00
Vadim Zeitlin
dbb9b9a651 Remove assert checking bitmap sizes in MSW wxHeaderCtrl
This assert could trigger when the window DPI was changed (e.g. due to
moving it to another display using different DPI scaling factor) and
doesn't seem very useful.

Just ensure that we always use the same size for all bitmaps in the
image list.

Closes #22267.

Closes #22334.
2022-04-20 23:38:42 +01:00
Vadim Zeitlin
079e608cb5 Remind to update zconf.h when upgrading zlib
And upgrade the submodule after performing the change documented here in
it to avoid link conflicts between the bundled zlib version and another
copy of zlib potentially used in the application due to the name clashes
between crc32_combine_xxx functions new in 1.2.12 that upstream forgot
to add to zconf.h.

Closes #22280.
2022-04-20 19:48:10 +02:00
Vadim Zeitlin
eb6506e677 Make wxToolBar::SetToolBitmapSize() take size in logical pixels
Previously it interpreted its argument as being in DIPs, which was
perhaps more convenient, but inconsistent with most of the other
functions and broke the general rule that FromDIP() should be used with
all hard-coded sizes.

Update the sample to use FromDIP() when calling it now, improve the
documentation and fix a bug in AdjustToolBitmapSize() which resulted in
not increasing the bitmap size when moving toolbar sample using "large"
toolbar size from a standard DPI display to a high DPI one: the old code
considered that the new size was the same as the old one and returned
before comparing it with m_requestedBitmapSize, which resulted in the
bitmaps not changing size at all instead of doubling their size as they
were expected to.
2022-04-19 23:36:02 +01:00
Vadim Zeitlin
a0abd711f7 Remove outdated comment from wxToolBarBase code
This comment was for the line of code removed back in 222ed1d678
(STL-ification patch for wxMSW and wxGTK., 2003-07-10) and should have
itself been removed back then, as it didn't make any sense after it.

No real changes.
2022-04-19 18:51:29 +01:00
Uwe Runtemund
13339425be Fix setting wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_TOP_COLOUR
wxRibbonMSWArtProvider::SetColour() used a wrong variable for this
colour index, assign to the correct one.

Closes #22321.
2022-04-19 00:48:11 +02:00
Uwe Runtemund
94f698cc15 Add functions for getting current ribbon tool rectangle
wxRibbonButtonBar::GetItemRect() and wxRibbonToolBar::GetActiveTool()
are helpful for positioning other windows (e.g. popup ones) that should
be aligned to tools and buttons in the ribbon bar.

Closes #22329.
2022-04-19 00:46:58 +02:00
Vadim Zeitlin
bf3b653492 Merge branch 'auibook-help'
Fix infinite recursion when processing wxEVT_HELP for wxAuiNotebook
pages.

See #22323.

Closes #22309.
2022-04-19 00:38:39 +02:00
Vadim Zeitlin
3439087685 Merge branch 'fontdlg-dpi'
Fix font sizes in MSW font dialog in high DPI.

See #22322.
2022-04-19 00:35:20 +02:00
Vadim Zeitlin
4d163de84e Merge branch 'dc-content-scale-factor'
Add GetDPIScaleFactor() to wxDC and wxGraphicsContext to allow scaling
the coordinates and sizes depending on the DPI.

See #22314.
2022-04-19 00:28:09 +02:00
Artur Wieczorek
b06b950574 Document changes in wxImageFileProperty
Remove references to the non-public member variables
from documentation.
2022-04-18 22:17:31 +02:00
Vadim Zeitlin
87a0472485 Fix size of the font returned from wxFontDialog in wxMSW
Ensure that the font has exactly the point size entered in the dialog,
rather than having a fractional point size close, but not identical, to
it, as happened before due to first rounding the result of converting
the point size to pixels and then _not_ rounding the result of the
reverse conversion.

This resulted in wxFont::GetPointSize() returning the correct value, but
not GetFractionalPointSize(). Now the latter returns the same, correctly
rounded, value too.
2022-04-18 19:03:03 +01:00
Vadim Zeitlin
91f1be23dd Fix initial point size in MSW wxFontDialog in high DPI
The native dialog doesn't take the actual DPI into account, so convert
our font sizes that do use the DPI to the standard one before using it
and convert font height back to the value corresponding to the actual
DPI once a font is selected in it.

Closes #22313.
2022-04-18 19:02:38 +01:00
Vadim Zeitlin
b66d4488e1 Merge branch 'fn-long-path'
Fix wxPATH_NORM_LONG with UNC paths and slightly optimize long path
normalization.

See #22307.
2022-04-17 18:51:09 +02:00
Vadim Zeitlin
6998eaf154 Merge branches 'no-unused-err' and 'dynlib-test-fix'
Fix CI builds under macOS 12 with clang 13.
2022-04-17 18:49:52 +02:00
utelle
8ab635b451 Improve wxLocale backwards compatibility and enhance wxUILocale
Restore the old behaviour of wxLocale, which is supposed to use the
default locale and not the preferred language, which may not be the same
(see #22281).

Also apply the following fixes and improvements to wxUILocale:

- Add new GetSystemLocale() method.
- Change the MSW implementation to use the default locale instead of the
  preferred UI language for Windows versions below Windows 10.
- Change the Unix implementation to respect LANGUAGE environment
  variable and use it for determining the preferred UI languages.
- Use wxUILocale in wxTranslations to determine the preferred UI
  languages.
- Use wxUILocale during initialization of internat sample.

Closes #22281.

Closes #22318.
2022-04-17 18:04:21 +02:00
Maarten Bent
4a3098aebb Optimize MSW wxNotebook background painting
MSWDefWindowProc(WM_PAINT, ...) in OnPaint causes performance issues on
large screens so only use it when an actual custom background colour is
set.

Closes #22308.

Closes #22320.
2022-04-17 17:59:24 +02:00
Vadim Zeitlin
f68993111c Change DPI awareness only for ChooseFont() duration
Extract ChooseFont() in a small helper function to ensure that the DPI
awareness is restored as soon as it returns.

No real changes yet.
2022-04-17 16:55:38 +01:00
Vadim Zeitlin
67da8bc7e0 Fix warning about unused "err" from clang 13 in release build
Don't just wxASSERT(err == 0), as this expands to nothing in the release
builds. Use wxCHECK() instead so that we at least return an error even
in the release builds too.
2022-04-17 16:31:03 +02:00
Vadim Zeitlin
37a9a33150 Use wxScopedArray instead of new[] in wxOSX display code
Avoid manual memory management.

This was already fixed once in 563f41c686 (Fix memory leak on error
return in wxOSX wxDisplay code., 2014-02-21) but incompletely and then
another instance of new/delete[] was reintroduced in d5180d3604 (add a
GetFromWindow implementation to wxDisplayFactory, 2020-08-07). Get rid
of all of them now and use wxScopedArray<> instead (we could also use
wxVector<> or even std::vector<> too).

No real changes.
2022-04-17 16:30:58 +02:00
Vadim Zeitlin
fac4822ab3 Make wxAuiNotebook::FindPage() work correctly
Make this function virtual in the base class so that it could be
overridden to do the right thing in wxAuiNotebook, instead of just
always returning NULL as before and add a unit test checking that it
works.

Explain that wxBookCtrlBase::m_pages may not be used in the derived
classes, but that in this case they must override all the methods using
it.

Finally, "soft-deprecate" wxAuiNotebook::GetPageIndex(), which is
identical to FindPage() now.

This fixes infinite recursion when handling wxEVT_HELP in wxAuiNotebook
in wxUniv too, see #22309.

Closes #15932.
2022-04-16 23:01:57 +01:00
Vadim Zeitlin
8afbf79d02 Take const pointer in wxAuiTabContainer::GetIdxFromWindow()
Allow passing const pointers to this function, as it doesn't need to
modify them at all.
2022-04-16 22:52:30 +01:00
Vadim Zeitlin
59463eced4 Simplify check for wxEVT_HELP origin in wxBookCtrl for main ports
Restrict the extra workaround for wxUniversal wxNotebook added back in
ec09e18d35 (more fixes to OnHelp() to avoid infinite recursion when
handling help events, 2006-06-14) to wxUniversal, to keep the code
simpler and more robust in the main ports.

Notably, this is sufficient to fix infinite recursion when pressing F1
in a wxTextCtrl used as a wxAuiNotebook page in non-wxUniv builds.

See #22309.
2022-04-16 22:36:13 +01:00
Vadim Zeitlin
caac3a4f19 Load SetThreadDpiAwarenessContext() function pointer only once
A small optimization to avoid resolving this function dynamically every
time it is needed and just do it once, on first use.
2022-04-16 17:49:09 +01:00
Maarten Bent
ee2b02614e Add GetDPIScaleFactor to wxDC and wxGraphicsContext
It can be used to scale coordinates and sizes to make them DPI aware.

In the common headers, use wxDisplay::GetStdPPIValue() as default DPI value,
so the correct values are used on Windows (96) and macOS (72).

In wxMemoryDC use m_contentScaleFactor as the DPIScaleFactor, see e4c2298e5e
(Use window scale factor for all MSW wxDCs associated with windows, 2022-04-04).
2022-04-16 01:11:33 +02:00
Artur Wieczorek
d72a3f7cec Create wxBitmap compatible with wxDC for all ports
Ctor creating wxBitmap compatible with wxDC is now implemented in all
ports.
2022-04-15 10:12:41 +02:00
Vadim Zeitlin
d6c3344c6f Don't try finding the long form of non-existent paths
This is at best useless and at worst harmful, as shown by the bug fixed
in the previous commit, so just don't do it if GetLongPathName() has
already determined that the path doesn't exist.
2022-04-15 00:32:35 +01:00
Vadim Zeitlin
35d08e6a87 Don't corrupt UNC paths when normalizing with wxPATH_NORM_LONG
After the fixes to UNC paths handling, Normalize(wxPATH_NORM_LONG)
started adding an extra colon after the UNC paths.

Fix this by using wxGetVolumeString() instead of constructing this thing
manually and add a unit test checking for this.

Closes #22275.
2022-04-15 00:32:35 +01:00
Vadim Zeitlin
105e81a4b0 Merge branch 'cmake-gtk2' of github.com:MaartenBent/wxWidgets
Fix some CMake and build warnings with GTK2.

See #22305.
2022-04-14 23:19:54 +02:00
Vadim Zeitlin
54bdc6bbd2 Merge branch 'configure-snprintf'
Don't use AC_CHECK_FUNCS(snprintf) which doesn't work with the latest
MinGW API headers (see https://sourceforge.net/p/mingw-w64/bugs/935/)
and some other minor cleanup.

See #22302.
2022-04-14 23:18:16 +02:00
Maarten Bent
5bea1dc18a Fix static build using extended RTTI
Fix declaration of 'o' hides previous local declaration warnings.

Change two wxCONSTRUCTOR_5 definitions using wxBitmapBundle instead of
wxBitmap (this does not give build errors).

wxGenericCalendarCtrl is missing all XTI implementations, so just use
RTTI. And fix building the xti sample.

Note the shared build still fails due to WXDLLIMPEXP related issues.

Closes #22300.

Closes #22301.
2022-04-14 23:17:05 +02:00
Maarten Bent
5ebcfd7681 Fix warnings in GTK2 build 2022-04-14 22:58:46 +02:00
Vadim Zeitlin
4b918d16d0 Fix wrong format specifier in wxMarkupParser debug logs
Use "%z" and not "%l" for size_t arguments.
2022-04-14 17:37:32 +01:00
Vadim Zeitlin
0407d74eaa Remove __WXSTUBS__ mention and test
This has never really been a thing and there remained just one (never
used) test for it in the sources, so simply remove it.

No real changes.
2022-04-14 00:40:36 +02:00
Vadim Zeitlin
7b45060d30 Remove remains of Classic Mac support
Don't test for __WXMAC__ after testing for __UNIX__ just above, as the
latter is now always defined when the latter is, we don't support
non-Unix Mac systems since an awfully long time.

No real changes.
2022-04-14 00:39:37 +02:00
Vadim Zeitlin
d31d645777 Drop remains of support for Metrowerks Standard C++ library
This compiler is not supported since a very long time, so get rid of the
tests for __MSL__.
2022-04-14 00:38:03 +02:00