Commit Graph

41496 Commits

Author SHA1 Message Date
utelle
b507c97b92 Handle Windows CRT locale names in wxLocaleIdent::FromTag() too
Recognize strings returned by setlocale() when using MSVC under MSW too,
if only because it was possible to construct wxLocale using them in the
previous versions and so doing this avoids breaking the existing code.

Also don't assert in FromTag(), even if the input is incorrect, as it is
potentially user-defined (e.g. can come from environment variables under
Unix).

Closes #22247, #22252.
2022-04-02 16:45:20 +02:00
utelle
280cb68887 Add wxLanguageInfo::GetCanonicalWithRegion() helper
This simple function allows to simplify the code by avoid to test for
CanonicalRef before using either it or CanonicalName in multiple places.

No real changes.

See #22252.
2022-04-02 16:45:20 +02:00
Vadim Zeitlin
fdfb9cda1b Update zlib submodule to v1.2.12.1
This fixes a security problem (CVE-2018-25032) in it.
2022-04-01 17:56:23 +02:00
Vadim Zeitlin
d311c705d7 Make native dialogs application-modal in wxMSW
Being able to use other application windows while a modal dialog was
shown was unexpected and could easily result in nasty reentrancies, and
was also inconsistent with the behaviour of ShowModal() for the dialogs
defined in wx, so disable all the windows, not just the parent one,
while showing the native modal dialogs too.

Closes #11887.
2022-04-01 02:50:38 +02:00
Vadim Zeitlin
b2b58ee6cf Upgrade bundled Expat to the latest version
This fixes several security vulnerabilities when parsing untrusted XML
input.

Closes #22218.
2022-04-01 01:37:40 +02:00
Paul Cornett
0ac60175b0 Use wxINVERT for drawing generic wxCaret when possible
This now works after recent fixes, although wxINVERT does not
work with wxGraphicsContext-based wxDC. So this is mainly for GTK2,
only about 20 years late.
2022-03-31 08:11:27 -07:00
Paul Cornett
d51f274e1c Avoid drawing generic wxCaret outside of its bounds
Outline caret rectangle needs to be inset so that its outer
edge is the same as the solid caret when window is scaled.
2022-03-31 07:46:28 -07:00
Paul Cornett
228bbbf93a Create generic wxCaret backing bitmap with correct scale
Fixes degraded appearance of scaled window contents under caret
2022-03-30 09:04:19 -07:00
Tobias Fleischer
e8872b335c Allow using multiple lines in single line wxTextCtrl under Mac
Add new OSX specific OSXEnableNewLineReplacement(bool enable) function
to control if new lines should be replaced with spaces (which is still
done by default) in a single-line wxTextCtrl.

Closes #22245.
2022-03-30 17:59:49 +02:00
utelle
9bb2a02232 Simplify accessing localized names
Add a helper function allowing to make the code shorter and hopefully
more clear.

Closes #22246.
2022-03-30 14:32:07 +02:00
Daniel Kulp
842314af4e Fix generating right click menu events for wxComboBox in wxOSX
These events were never generated for the comboboxes, so forward them to
the window from the text editor used for the comboboxes, just as we
already do for the key events.

Do it for the mouse up events too for consistency.

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

Closes #22179.
2022-03-30 01:13:32 +02:00
Vadim Zeitlin
7084f7c51a Merge branch 'memdc-setfont-null'
Fix recently broken wxMemoryDC::SetFont(wxNullFont) in wxMSW.

See #22241.
2022-03-29 22:59:14 +01:00
Paul Cornett
c1259ad3c7 Fix rendering HiDPI bitmaps with wxDataViewIconTextRenderer on GTK3
Update code to use wxBitmapBundle
2022-03-29 08:45:30 -07:00
Vadim Zeitlin
b390c487f7 Fix wxMemoryDC::SetFont(wxNullFont) broken by recent changes
Fix crash in this function introduced by 9e5c8a8027 (Respect bitmap
content scale factor in wxMSW wxMemoryDC, 2022-03-26).

Also add a unit test ensuring that this doesn't get broken again under
MSW, which seems to be the only place where it works.

Closes #22240.
2022-03-29 14:10:34 +01:00
Paul Cornett
ffdaec88ee Fix wxDataViewIconTextRenderer background on GTK
Background attribute needs to be set on the icon renderer as well.
See #19301
2022-03-28 21:28:10 -07:00
Vadim Zeitlin
9bb3945778 Fix spurious assert in GetLocalizedName() under Unix
Add a missing "break" forgotten in 6d6e5cde21 (Enhance wxUILocale and
wxLocaleIdent, 2022-03-28).

See #2615.
2022-03-28 18:10:55 +02:00
utelle
6d6e5cde21 Enhance wxUILocale and wxLocaleIdent
Many improvements and fixes to wxUILocale:

- Add wxUILocale method for retrieving wxLocaleIdent identifier,
  localized names, layout direction.
- Add wxLocaleIdent attributes, getter, and setter for
  platform-dependent tags under Windows: extension, sort order.
- Modify method wxLocaleIdent::FromTag to support not only BCP 47-like
  tags, but also platform-dependent syntax.
- Modify method wxLocaleIdent::GetTag to allow specifying the tag type.
- Update internat sample to better show using wxUILocale.
- Update German and French message catalogs for internat sample (German
  fully translated, French msgIds only).
- Introduced wxUILocaleImplStdC under Windows, because locale "en-US" is
  not equivalent to the C locale.
- Adjust wxLocale class to restore previous wxUILocale in the
  destructor.
- Implement wxLocale::GetInfo method through wxUILocale methods.
- Removed LCID dependency in wxLocale.
- Move the implementation of some static wxUILocale methods from
  intl.cpp to uilocale.cpp.

Co-authored-by: Vadim Zeitlin <vadim@wxwidgets.org>

Closes #2615.
2022-03-28 01:11:40 +02:00
Vadim Zeitlin
9e5c8a8027 Respect bitmap content scale factor in wxMSW wxMemoryDC
Apply it manually because MSW doesn't do it automatically for us and
also adjust the font size in wxMemoryDC as the base class version only
does it for the device contexts associated with a window, but we also
need to do it when using a wxMemoryDC for a bitmap using scale factor
different from that of the main display.

As the result of these changes, contents drawn on wxMemoryDC, both
directly via its own methods, or via wxGraphicsContext (using either
GDI+ or Direct2D) created from it, it appears the same as in wxWindowDC
(e.g. wxPaintDC) created for a window using the same scale.

Closes #22130.

Closes #22234.
2022-03-28 01:03:07 +02:00
Vadim Zeitlin
74fa410b81 Merge branch 'generic-dialogs-cleanup'
Simplify generic dialogs code and make them more consistent with each
other.
2022-03-28 00:58:44 +02:00
Vadim Zeitlin
d47119680f Create bigger windows on high DPI screens in wxMSW by default
When using 200% DPI scaling, 400*250 windows are too small as almost
nothing fits into them, so use 800*500 size for them instead.

This is still completely arbitrary, but clearly better.

Closes #22235.
2022-03-28 00:55:54 +02:00
Paul Cornett
9af728caea Minor simplification in generic wxCaret
Only create wxMemoryDC if it's actually needed.
2022-03-27 13:54:46 -07:00
Paul Cornett
03bf61be3c Fix drawing caret on GTK3 with GDK_SCALE=2
Don't use pen when drawing solid rectangle, avoids partial outline left on window.
2022-03-27 13:49:00 -07:00
Gerhard Gruber
9dc7248b1d Add conversion to signed/unsigned int to wxString
Add wxString::ToInt() and ToUInt() for convenience and consistency with
the existing ToLong() and ToULong().

Closes #22068.
2022-03-26 00:46:58 +01:00
Paul Cornett
c10a70be67 Fix GTK version check 2022-03-25 12:01:12 -07:00
Paul Cornett
b3b43ad15b Fix drawing of TLW with wxBG_STYLE_TRANSPARENT on GTK
Default drawing of the background has to be disabled.
See #18592
2022-03-25 12:00:07 -07:00
Vadim Zeitlin
16d8e61d28 Render "Close" bitmap button correctly in high DPI
Define a custom wxBitmapBundle to represent this bitmap in order to be
able to draw it at any required size instead of scaling up the bitmap in
high DPI.

See #18822.
2022-03-24 21:40:44 +01:00
Vadim Zeitlin
debd3f338b Use high DPI icons in wxInfoBarGeneric if appropriate
Just switch to using wxArtProvider::GetBitmapBundle() instead of
GetBitmap() which returned standard-sized bitmap that was upscaled
later.

See #18822.
2022-03-24 21:40:44 +01:00
Vadim Zeitlin
a48859e20c Merge branch 'uilocale-fixes'
wxUILocale-related fixes.

See #22222.
2022-03-24 21:39:34 +01:00
Vadim Zeitlin
387981e373 Merge branch 'generic-dvc-fixes'
Fixes to generic wxDataViewCtrl under GTK.

See #22220.
2022-03-24 21:39:09 +01:00
Vadim Zeitlin
66c52326d5 Merge branch 'dvc-add-item-error' of https://github.com/thesiv/wxWidgets
Fix adding items to collapsed nodes of wxDataViewCtrl in wxGTK too.

See #22228.
2022-03-24 21:37:15 +01:00
Vadim Zeitlin
886f8e58f0 Merge branch 'artprov-sizehint-dips'
wxArtProvider::GetSizeHints() improvements: use DIPs and get rid of
"bool platform_dependent = false".

Closes #22224.
2022-03-24 21:36:20 +01:00
Vadim Zeitlin
108108e54e Add wxArtProvider::Get[Native]DIPSizeHint()
Also add "wxWindow* win = NULL" argument to the existing functions to
convert from DIPs using the given window instead of the default DPI
scaling factor.

Closes #22022.
2022-03-24 21:35:26 +01:00
Ilya Sinitsyn
946ad457e9 Fix items adding to a collapsed node of DVC under GTK
Note that `wxDataViewCtrlInternal_FindNode()` was removed to access
protected `wxDataViewCtrlInternal::BuildBranch()`.
2022-03-25 02:43:45 +07:00
Paul Cornett
a1a883b8e8 Fix SetTransparent() with GTK3
An RGBA visual is required for it to work, which may not be the default.
See #18592
2022-03-24 12:09:00 -07:00
Ilya Sinitsyn
7966eaf268 Fix nodes duplication in the generic DVC implementation
Don't create a subtree in `FindNode()` and just return as the subtree
will be realized when a parent node will be expanded.
2022-03-25 01:05:09 +07:00
Vadim Zeitlin
506f292be2 Deprecate wxArtProvider::GetSizeHint(bool) overload
This was confusing and completely unnecessary as the version with the
non-default value of the bool argument was just equivalent to calling
GetNativeSizeHint() directly, so why even bother having it.
2022-03-24 00:10:08 +01:00
Vadim Zeitlin
4e4b80760b Move wxArtProvider::DoGetSizeHint() out of line and simplify it
This function has no need to be inline and it can be written in a more
clear way by just calling GetNativeSizeHint() directly instead of
passing by GetSizeHint(true).
2022-03-24 00:05:01 +01:00
Vadim Zeitlin
8bc606ba73 Don't cache locale-specific data in wxNumberFormatter
This cache was never updated and so could be wrong and not using it at
all is the simplest (although also the slowest) fix for this.

Notably, it could result in failures in ValNum::Interactive unit test
because the thousands separator was set to nothing during a previous
test execution, instead of the expected comma.

This commit is best viewed ignoring whitespace-only changes.
2022-03-23 18:46:55 +01:00
Vadim Zeitlin
4a9da949ce Set C locale for wxLANGUAGE_DEFAULT under Unix too
This had been done before all the recent wxUILocale-related changed and
was still done for non-Unix systems, but not there because we explicitly
skipped calling setlocale() in this case with a comment saying that the
default locale was already in use -- however this comment was wrong and
we do need to call setlocale(LC_ALL, "") in this case for compatibility
and consistency.

Closes #22212.
2022-03-23 16:10:40 +01:00
taler21
af9e7fd460 Fix truncation of translated "Finish" button label in wxWizard
Ensure that the button is wide enough to show both "Next" and "Finish"
and also make all the buttons of the same size, as they look better like
this.

Co-authored-by: Vadim Zeitlin <vadim@wxwidgets.org>

Closes #22200.

Closes #22221.
2022-03-23 15:56:03 +01:00
Vadim Zeitlin
5f011b84c1 Merge branch 'tz-parse' of https://github.com/lanurmi/wxWidgets
Parse more time sonzes in wxDateTime::ParseDataTime().

See #22217.
2022-03-23 14:38:58 +01:00
Vadim Zeitlin
d77fd33e66 Merge branch 'imagelist-scale-factor'
Scale factor-related fixes to wxImageList and Mac wxDataViewCtrl.

See #22211.
2022-03-23 13:59:46 +01:00
Vadim Zeitlin
09a472e3ef Hide wxGenericDataViewCtrl helpers in anonymous namespace
This is a good idea anyhow, as these classes don't need to have extern
linkage and so shouldn't have it, and it also fixes some gcc 11
-Wsubobject-linkage warnings.
2022-03-23 13:35:41 +01:00
Vadim Zeitlin
1a8906206e Use appropriately sized bitmaps in wxOSX wxDataViewCtrl
Select the bitmap of the required size from wxBitmapBundle instead of
selecting the bitmap with the default size and then possibly rescaling
it to get the bitmap of the needed size, resulting in fuzzy-looking
bitmaps.

Closes #22189.
2022-03-22 23:02:25 +01:00
Vadim Zeitlin
cc02b3cece Revert "Assure that all images in the generic wxImageList have the same scale factor"
This reverts commit b6d305e4f2 because
silently discarding images using a different scale factor is simply too
user-unfriendly: this can silently break the existing code, i.e. it can
still compile perfectly and not give any errors during run-time but not
show any images neither.

Also revert most of dc43d15cf7 (Add tests of storing HiDPI images in
generic wxImageList (wxOSX, wxGTK3), 2021-04-05) as these tests don't
pass any longer because the behaviour was intentionally changed.

See #22189.
2022-03-22 23:01:40 +01:00
Vadim Zeitlin
d9a48edc81 Restore the old default size of Tango art provider bitmaps
The default size of the bitmaps created from bitmap bundles returned by
the Tango art provider for the client strings different from wxART_MENU
and wxART_BUTTON was changed from 24x24 to 16x16 in 766fefeb34 (Use SVG
instead of PNGs in tango art provider, 2022-01-27), see #22067, without
any real need and perhaps even non intentionally at all.

Restore the old default size to restore the old behaviour.

See #22189.
2022-03-22 23:01:40 +01:00
Lauri Nurmi
fdd05c8b8b Parse also time zone in ParseDateTime(), if found
Accept the same kind of time zone specifiers that RFC822 timestamps
accept; most importantly the "+0200" style.

Added more tests, and changed the way tests compare dates:
Since some timestamps now specify a time zone, those need to be compared
as UTC to avoid the system's time zone affecting the tests. Others can
still be compared as local time, as before.
2022-03-22 19:12:48 +02:00
Lauri Nurmi
136b1713e1 Refactor time zone parsing into a separate function from ParseRfc822Date()
For now, the new function is private and undocumented.
2022-03-22 19:12:45 +02:00
Lauri Nurmi
770cf26afe Fix out-of-bounds with military and truncated time zones; add more tests
Out-of-bounds was already covered by the fact that the date is appended 32
zero-bytes in ParseRFC822Date() as a safety measure. But now the time zone
parsing section of the function no longer relies on those extra zeros
being present.

Added tests for RFC822 timestamps with military time zones, and more types
of truncated, invalid time zone specifiers.
2022-03-22 19:11:22 +02:00
Paul Cornett
6a3ccabf11 Fix unused parameter warning with GTK2 2022-03-21 12:22:26 -07:00