Commit graph

76160 commits

Author SHA1 Message Date
Václav Slavík
6d48acb5f3 Add unit tests for wxTranslations language lookup 2024-02-13 18:24:43 +01:00
Václav Slavík
1f658ff729 Override GetPreferredUILanguages with WXLANGUAGE
Add support for overriding GetPreferredUILanguages() return value by
setting the WXLANGUAGE environment variable to a colon-separated list
of desired languages (same as GNU's LANGUAGE variable).

Primarily used for unit tests, but may be more generally useful.
2024-02-13 18:23:06 +01:00
Václav Slavík
f248f0593c Clarify GetAvailableTranslations() return value
Add a note explaining that the msgid language is not included.
2024-02-13 16:12:57 +01:00
Václav Slavík
f0ed987010 Warn about a GetBestAvailableTranslation() quirk 2024-02-13 16:12:57 +01:00
Václav Slavík
1030147aff Fix AddAvailableCatalog() API
Knowing msgIdLanguage is necessary for correct evaluation of preferred
languages order; without it, it would be possible to load undesirable
translation file.

See 2af36e9560 for details.
2024-02-13 16:12:56 +01:00
Václav Slavík
2af36e9560 Partially revert "Add AddAvailableCatalog() and use it in AddStdCatalog()"
This commit partially reverts 94b1a17aeb.

The above commit changed translation lookup logic to differentiate
between msgid and "available" translations (the latter being loaded from
a file or resource). It first attempted to use available translations
and only felt back to msgid language as the last resort.

Unfortunately, doing that broke lookup in cases when the user had msgid
language as not-last preference in their UI languages list, or even when
a similar translation was available. For example:

- msgid=en, user preference [cs,en,fr], only fr.po available: fr would
  be used instead of en
- msgid=en_US or en, user preference [en], but en_GB.po available:
  British English would be used even for US users

This commit fixes this by restoring the previous behavior where msgid
language was treated as a first-class citizen in lookup, while
preserving the API that allows distinguishing between the two cases.

It also reimplements AddStdCatalog() in a more straightforward way that
doesn't rely on AddAvailableCatalog().
2024-02-13 16:12:38 +01:00
Václav Slavík
34a90ba3af Fix GetBestAvailableTranslation to return no match
GetBestTranslation() and GetBestAvailableTranslation() are documented to
return an empty string if they find no match, but actually didn't do
that due to the way GetPreferredUILanguage() was implemented to always
fall back to the locale and return it without additional checks.
2024-02-10 12:55:12 +01:00
Paul Cornett
d8c5a87fe3 Partial fix for wxSearchCtrl mouse enter/leave events
The events only occur for part of the widget area,
but it's better than the previous nothing.
See #24245
2024-02-09 12:52:30 -08:00
Vadim Zeitlin
82cb7d1074 Merge branch 'generic-listctrl-center-label'
Fix centering of item label in generic wxListCtrl

See #2340, #24292.
2024-02-09 18:36:53 +01:00
Ian McInerney
9d3b8ba339 Test short labels in the listctrl sample too
This allows to easily verify that they work correctly in the icon view.

See #24292.
2024-02-09 18:35:53 +01:00
taler21
e7dba90bd0 Make auto-grow of in-place editor in generic wxListCtrl work again
Auto-growing of the editor has not worked since the changes of
a8a8915453 (Made code more similar to
wxTreeCtrl' code, 2008-01-10).

Closes #24293.
2024-02-09 17:30:21 +01:00
DietmarSchwertberger
bfc3fcf0f4 Fix grid selection when deleting grid rows or cols
The new selection right/bottom coordinate was off by 1 and could become
invalid.

Closes #24286.
2024-02-09 17:26:17 +01:00
Vadim Zeitlin
308815bafd Merge branch 'msw-button-getdefaultsize'
Fix wxButton::GetDefaultSize() in high DPI under MSW.

See #24285.

Closes #24285.
2024-02-09 17:23:06 +01:00
Vadim Zeitlin
a6cc89777b Allow passing -1 to wxPGProperty::SetChoiceSelection() again
This used to be possible in 3.0 but was disallowed back in 29bf859fae
(Check if new index is in range before selecting new value in
wxPGProperty::SetChoiceSelection., 2014-11-29). However there doesn't
seem to be any real harm in still allowing to do this, so handle -1 as a
special case here.

Closes #24279.

Closes #24281.
2024-02-09 17:21:52 +01:00
Vadim Zeitlin
33ef342dcc Merge branch 'propgrid-xrc'
Add support for loading wxPropertyGrid from XRC.

See #24274.
2024-02-09 17:20:22 +01:00
Vadim Zeitlin
21255ee197 Document wxIPV4address::Hostname(unsigned long) overload
Just mention that it exists too.
2024-02-09 17:19:49 +01:00
SMMB-DEV
388050513d Don't perform DNS lookup when constructing wxIPV4address from IP
Calling Hostname() when constructing wxIPV4address from an already
resolved IP address is unnecessary and can be slow, so don't do it and
just use the string representation of the IP address as "m_origHostname"
instead.

Closes #23109.

Closes #24269.
2024-02-09 17:17:14 +01:00
Vadim Zeitlin
a401106da0 Merge branch 'cmake-misc' of https://github.com/MaartenBent/wxWidgets
Miscellaneous CMake improvements.

Note that the new required CMake version is 3.5 now.

See #24263.
2024-02-09 17:12:18 +01:00
Blake Madden
7555bba1bf Modernize ribbon code
The only real change in this commit is the use of wxRound() instead of
truncating cast to int when rescaling icons.

The rest consists of just some cleanup:

- Initialize (mostly) pointer member variables in their declaration.
- Remove wxT() from strings.
- Replace checks for __WXMAC__ with checks for __WXOSX__.
- Replace macros with lambda functions.
- Add "explicit"
- Replace wxString::IsEmpty() with empty().
- Use wxNOT_FOUND instead of -1.
- Use static_cast<> instead of C-style casts.

Closes #24261.
2024-02-09 17:04:43 +01:00
taler21
82b5f85418 Fix centering of item label in generic wxListCtrl
The item label was not centered if the icon is wider than the label.
2024-02-08 08:44:20 +01:00
Mark Wagner
8eb3729fec Fix reading GIF images without CLEAR code
The encoder may chose not to emit a CLEAR code when the alphabet is full
according to the specification, but wxGIFDecoder assumed it always did,
preventing it from reading some valid GIF files (in practice, most often
animated ones).

This commit is best viewed ignoring whitespace-only changes.

Closes #22799.

Closes #24234.
2024-02-06 19:14:20 +01:00
Maarten Bent
c72f4efc9c Fix crash when closing a wxColourDialog under MSW
Check that ms_pfnSetThreadDpiAwarenessContext function pointer was
initialized before using it.

This fixes a regression introduced in 9befda5c26 (Only use
AutoSystemDpiAware when displays have different DPI, 2023-12-10).

See #24121, #24196.

Closes #24288.
2024-02-06 19:07:46 +01:00
Vadim Zeitlin
be5fa77839 Reuse wxButton::GetDefaultSize() instead of duplicating it
Just reuse the existing function in IncreaseToStdSizeAndCache() helper
instead of using a separate and, until the parent commit, different, way
of computing the default button size here.

This will hopefully avoid introducing any discrepancies between the size
returned by GetDefaultSize() and the size actually used for the buttons
by default in the future.

See #24283.
2024-02-05 19:05:02 +01:00
Vadim Zeitlin
57b408ed88 Fix wxButton::GetDefaultSize() in high DPI under MSW
Using button size in dialog units doesn't work well in high DPI, as it
gives sizes wildly different from those actually used by Windows itself
for the buttons (e.g. for those in Explorer dialogs still using Win32
API), so switch to using DIPs, just as it was done for determining the
initial size of the buttons when actually creating them in c6d2f6d9fe
(Really fix the standard button size in high DPI under MSW, 2019-10-19)

See #18528.

Closes #24283.
2024-02-05 19:04:52 +01:00
Maarten Bent
e41fd2052c
CMake: Mention that CMake 3.5 is the minimum version
Generating project files has been confirmed to work with this version.
2024-02-04 18:11:10 +01:00
Maarten Bent
f0061b3c04
CMake: Only keep unicode definitions on Windows 2024-02-04 18:03:06 +01:00
Maarten Bent
f0d2d0e748
CMake: Prevent possible policy warnings 2024-02-04 18:01:36 +01:00
Vadim Zeitlin
f6a1b1a18a Show loading wxPropertyGrid from XRC in the sample
Demonstrate defining wxPropertyGridManager in XRC.
2024-02-03 22:03:17 +01:00
Vadim Zeitlin
36583f13e1 Merge branch 'fix-vlistbox-out-of-range' of https://github.com/wsu-cb/wxWidgets
Prevent scrolling beyond specified range.

See #24278.
2024-02-03 21:54:40 +01:00
Vadim Zeitlin
42839def49 Merge branch 'fix_webkit_tests'
Fix WebView tests with WebKitGTK 2.43+.

See #24276.
2024-02-03 21:54:05 +01:00
Vadim Zeitlin
e20a994b1f Merge branch 'really-fix-cleanup'
Really fix logging during app cleanup.

See #24272.
2024-02-03 21:53:24 +01:00
Vadim Zeitlin
dba79a2d67 Merge branch 'avoid-impl-string-conv-logstatus'
Avoid implicit string conversions when using wxLog functions.

See #24271.
2024-02-03 21:52:27 +01:00
Vadim Zeitlin
edf94f684c Remove dependency on wxxml and wxxrc from wxpropgrid library
It shouldn't, and now doesn't, use these libraries directly and
shouldn't depend on them to avoid introducing unnecessary requirements
for the applications which use it without XRC.
2024-02-03 21:46:15 +01:00
Vadim Zeitlin
52c60628fa Don't use wxXmlNode directly in wxPropertyGridXmlHandler
Use wxXmlResourceHandler functions such as GetNodeContent(),
GetNodeName() and GetNodeAttribute() instead, which are defined in the
core library and so don't create a dependency on wxxrc.
2024-02-03 21:46:15 +01:00
Vadim Zeitlin
fe599e4757 Add wxXmlResourceHandler::GetNodeAttribute()
Add another helper function that can be used in XRC handlers without
using wxXmlNode directly.
2024-02-03 21:46:15 +01:00
Vadim Zeitlin
921018cfc8 Add wxXmlResourceHandler::GetNodeName()
This allows to get the name of the node which is needed for XRC handlers
using specific elements instead of using the object elements with
specific name attribute.
2024-02-03 21:46:15 +01:00
Vadim Zeitlin
9ab62c02fd Make wxXmlResourceHandlerImpl::GetNodeContent() const
There doesn't seem to be any reason not to and it's more consistent with
the other similar functions.
2024-02-03 21:46:15 +01:00
Vadim Zeitlin
f943635da8 Reuse wxXmlNode::GetNodeContent() in wxXmlResourceHandlerImpl
Don't duplicate wxXmlNode function logic but just call it instead.

This shouldn't result in any changes.
2024-02-03 21:46:15 +01:00
Vadim Zeitlin
9550c37e29 Support inherited attributes in wxPropertyGrid XRC handler
Allow specifying recurse="1" to inherit the attribute, as this is much
nicer than having to specify it for all the children.

Also add support for this to wxPropertyGridPopulator, which is used by
the XRC handler.
2024-02-03 21:46:15 +01:00
Vadim Zeitlin
0ddbf965c9 Get rid of unnecessary "emptyString" when calling GetAttribute()
This is just extra noise, so remove it.

No real changes.
2024-02-03 21:46:15 +01:00
Vadim Zeitlin
f513c08876 Add DLL export declaration to wxPropertyGridXmlHandler 2024-02-03 21:46:15 +01:00
Vadim Zeitlin
65715453e7 Add minimal support for wxPropertyGrid to the XRC schema
This is too lax and might also not cover everything but it better than
nothing.
2024-02-03 21:46:15 +01:00
Vadim Zeitlin
8c586b6ff5 Add minimal documentation of wxPropertyGrid XRC format
Not everything is documented yet, mostly because it's not really easy to
find out what "everything" actually is.
2024-02-03 21:46:15 +01:00
Bill Su
95054f3d4a wxVListBox: fix Page Down being unable to reach last item 2024-02-03 00:21:49 -05:00
Vadim Zeitlin
9c33be4f5e Use a helper lambda for naming history menu items
Shorten the code a bit more.

No real changes.
2024-02-02 18:01:24 +01:00
Vadim Zeitlin
44bc26f087 Use range-for loops for iterating over wxWebViewHistoryItems
No real changes, just simplify the code a bit.
2024-02-02 17:59:01 +01:00
Bill Su
66dfd0ae89 prevent scrolling beyond specified range
Fix #24277
2024-02-02 00:41:10 -05:00
Scott Talbert
3ef1aee986 Fix WebView sample when there are blank title pages in history
Otherwise, the wxMenu code asserts due to an empty item.
2024-02-01 20:56:36 -05:00
Scott Talbert
1622a5c9c2 Fix WebView tests with WebKitGTK 2.43+
It seems that WebKitGTK is now failing to navigate to about: URLs unless
they are about:blank or about:srcdoc, so use about:srcdoc as the
alternate URL to fix the WebView tests.

Ref: 3c3163e71f
2024-02-01 20:56:32 -05:00
Vadim Zeitlin
a01c870dbb Don't let exceptions escape from events handled during idle time
This resulted in immediate program termination, at least with wxGTK, if
an event handler called when dispatching pending events during idle time
threw an exception (which, in particular, covers all the exceptions
inside lambdas passed to CallAfter()).

Just catch and handle them as usual, i.e. as we do with the event
handlers called immediately in response to a user action.
2024-01-31 04:08:26 +01:00