Commit Graph

71062 Commits

Author SHA1 Message Date
Vadim Zeitlin
d08fc7575e Use wxUILocale for formatting dates in wxGrid
This is similar to the previous commit and ensures that the correct date
format is used even if setlocale() is not called.
2021-08-20 23:37:28 +02:00
Vadim Zeitlin
8fa853a3e2 Add wxGetUIDateFormat() helper function
Retrieve thr date format to use, even when wxUSE_INTL==0.
2021-08-20 23:37:28 +02:00
Vadim Zeitlin
e438f9a496 Use wxNumberFormatter in wxGrid number renderer and editor
This ensures that the correct, i.e. matching the users default, decimal
point separator is used even if setlocale() is not called.

Also simplify the code a bit by removing checks for wxUSE_INTL already
present in wxNumberFormatter itself.
2021-08-20 23:37:28 +02:00
Vadim Zeitlin
3fc031e75b Add wxNumberFormatter::Format() for floating point numbers
The existing ToString() is not flexible enough to be used in wxGrid,
which supports specifying the width (and not just the precision) as well
as using formats other than "%g" and "%f" which are the only ones
supported by the existing function.

Note that currently the implementation simply calls wxString::Format()
and then adjusts the decimal separator, but it could, in principle, use
wxUILocale methods for formatting the floating point numbers using
native platform functions for doing this, e.g. CFNumberFormatter under
macOS.
2021-08-20 23:37:28 +02:00
Vadim Zeitlin
85d379913d Use wxUILocale in wxSpinCtrlDouble
This ensures that we use the decimal separator corresponding to the UI
locale of the application, rather than C locale, so that e.g. comma is
used under macOS even if setlocale() is not used.
2021-08-20 23:37:28 +02:00
Vadim Zeitlin
b3cab73680 Use wxUILocale in wxNumberFormatter
Always use the UI locale conventions for floating point numbers in
wxNumberFormatter, making it different from wxString::{To,From}Double()
functions that use C locale, which may, or not, correspond to the UI
locale.
2021-08-20 23:37:28 +02:00
Vadim Zeitlin
37a23e1ab1 Move platform-specific parts of wxLocale::Init() to wxUILocale
This is tidier than using #ifdefs in the same common file and also
ensures that initializing wxLocale affects wxUILocale too, which will be
important for compatibility when the code elsewhere is modified to use
wxUILocale::GetInfo() instead of wxLocale::GetInfo() in the upcoming
commits.

This commit is best viewed with --color-moved git option.
2021-08-20 23:37:28 +02:00
Vadim Zeitlin
d3a1abaab2 Untangle Mac and POSIX code in wxLocale::GetSystemLanguage()
Most of the code in this function was Unix-specific and didn't make
sense for Mac, where we never have to apply the workarounds in it nor
deal with languages specified without the territory etc, so separate Mac
branch using CoreFouundation API from the rest of the Unix code to make
things more understandable.

No real changes.
2021-08-20 23:37:28 +02:00
Vadim Zeitlin
405bb3ecf7 Move wxLanguageInfo declaration to wx/localedefs.h too
No real changes, just allow wxUILocale code to use this struct without
including the full wx/intl.h.

This commit is best viewed with --color-moved git option.
2021-08-20 22:02:46 +02:00
Vadim Zeitlin
59a4505a5f Use Core Foundation for testing locale availability under Mac
Using setlocale() is not the right way to do it there, try checking if
the locale is supported by Core Foundation instead of whether it's
supported by the Unix layer which is neglected and not used under Mac.
2021-08-20 22:02:46 +02:00
Vadim Zeitlin
8f20dd3490 Remove obsolete AIX workaround from wxLocale code
This code, added back in 420de418ea (workaround for buggy setlocale()
under AIX (without this wxLocale didn't work at all), 2005-09-18), is
probably irrelevant anyhow because AIX 5.2 must not be used any more,
but also seems to have lost its purpose at some time during the
intervening years, as we don't use "retloc" as argument to setlocale()
anyhow, so it is doubly safe to simply remove it.
2021-08-20 22:02:46 +02:00
Vadim Zeitlin
b9cbe6770f Add wxUILocale with minimal functionality
Use it in the sample to show what (little) it can do right now.
2021-08-20 22:02:46 +02:00
Vadim Zeitlin
b12961f992 Display locale information directly in the main sample frame
This is more convenient than having to open the "About" dialog to see
the details of the locale being used.

It also makes it unnecessary to store wxLocale reference in the frame
class, simplifying the sample code.
2021-08-14 19:22:29 +02:00
Vadim Zeitlin
b6d4eda4ad Extract wxLOCALE_XXX constants into their own header
No real changes, just make it possible to use these constants without
including the entire wx/intl.h.

Note that the existing headers including wx/intl.h need to keep
including it, unfortunately, as not doing it any longer would break
compilation of any code including them which relies on _() or
wxGetTranslation() being defined after including e.g. wx/dc.h. This was,
of course, never guaranteed, but in practice it worked for a very long
time, so don't break it now.

This commit is best viewed with --color-moved git option.
2021-08-14 19:21:55 +02:00
Vadim Zeitlin
afe04f7c4a Add internat sample command line option to skip the locale dialog
Getting this dialog all the time is annoying when testing, so add
another command line option to set the locale unconditionally.

This commit is best viewed ignoring whitespace-only changes.
2021-08-14 18:55:43 +02:00
Vadim Zeitlin
31677e597d Don't load translations when setting the locale is disabled too
It makes more sense to skip loading the translations too, if the user
decided not to use the current locale.

This commit is best viewed ignoring whitespace-only changes.
2021-08-14 18:55:43 +02:00
Vadim Zeitlin
eb5bffd3ca Stop allowing to select the language in the internat sample
Restrict the choice to using the current system locale or not using it,
as setting any other language doesn't, and can't, work under macOS.
2021-08-14 18:55:43 +02:00
Vadim Zeitlin
4adb58b7ea Add an option to skip changing locale in the internat sample
Show that we can use the translations to the user language even without
changing the locale.
2021-08-14 18:55:43 +02:00
Vadim Zeitlin
e0cd2c637d Use a panel in internat sample to make it look better under MSW
Creating the controls directly on wxFrame is not recommended and looks
ugly under MSW due to the wrong background being used, so add an
intermediate panel.
2021-08-14 18:55:43 +02:00
Vadim Zeitlin
4db5de9cdb Use wxTranslations directly instead of passing by wxLocale
This is slightly more verbose, but more clear and allows to separate the
translations-related part from locale-changing one.
2021-08-14 18:55:43 +02:00
Vadim Zeitlin
7dc6462561 Show using wxNumberFormatter in the internat sample too
This shows that C and UI (or OS) locales can be different.
2021-08-14 18:55:43 +02:00
Vadim Zeitlin
1f74e7cd1b Show more locale-dependent controls in the internat sample
Show that file dialogs, spin and calendar controls also respect the
selected locale conventions.
2021-08-07 18:04:22 +02:00
Vadim Zeitlin
93190d6263 Interpret empty language as "default" in the internat sample
This provides a more convenient way of testing wxLANGUAGE_DEFAULT than
selecting it from the dialog shown on startup.

This commit is best viewed ignoring whitespace-only changes.
2021-08-07 18:04:22 +02:00
Vadim Zeitlin
33ae58e457 Allow using wxLOCALE_CAT_DEFAULT for numeric or money locale info
Make GetInfo() return information for numbers by default in the Unix
version too instead of asserting, as this is more consistent with the
MSW and Mac versions and also seems more useful.
2021-08-07 18:04:22 +02:00
Vadim Zeitlin
a4940bf696 Extract wxLocaleSetter from the tests into a private header
This will allow using this class in the library code too.

No real changes yet, this is a pure refactoring.

This commit is best viewed using git --color-moved option.
2021-08-07 18:04:22 +02:00
Vadim Zeitlin
ebec1ff9f6 Rebake after removing shaped-ld-sh from bakefile
Simply remove the not existent any longer shared-ld-sh from clean
targets in all makefile.

This should have been done in e663d9af2b (Stop using shared-ld wrapper
script under Mac, 2021-07-06).
2021-08-06 21:51:40 +02:00
Arrigo Marchiori
30915c6163 Make wxrc independent from GUI support
The wxrc program does not depend on the GUI libraries, but only on
the base and XML libraries, so make it possible to build it in non-GUI
builds too.

Closes https://github.com/wxWidgets/wxWidgets/pull/2419
2021-08-06 21:51:11 +02:00
frederick-vs-ja
aaa2dabf5d Remove usage of __w64 for recent MSVC versions
__w64 just increases warnings and errors since VS 2013 (according to
https://docs.microsoft.com/en-us/cpp/cpp/w64?view=msvc-160), so don't
use it any longer.

Closes https://github.com/wxWidgets/wxWidgets/pull/2455
2021-08-06 20:30:43 +01:00
Vadim Zeitlin
b9261597bf Merge branch 'msw-combo-keys'
Fix behaviour of comboboxes in presence of accelerators in wxMSW.

See https://github.com/wxWidgets/wxWidgets/pull/2443
2021-08-06 20:29:20 +01:00
Vadim Zeitlin
1e37f6e5ff Provide information in wxListEvent for generic virtual wxListCtrl
This wasn't done since the changes of c1c4c5516c (fixed unwanted owner
data accesses in virtual list ctrl, 2001-08-07), but there doesn't seem
to be any reason to avoid accessing the item in SendNotify() (any more?)
and if we ever did generate events for all the items in a virtual list
control, this would be already a problem, even if we didn't access the
line info from here.

So just revert the check for !IsVirtual() and always fill the item in
the generated event to make the behaviour of the generic version
consistent with the MSW one and slightly more useful.

See https://github.com/wxWidgets/wxWidgets/pull/2456

Closes #19235.
2021-08-06 21:28:24 +02:00
Vadim Zeitlin
c7ed88af7c Move comment in wxOSX wxToolBar code to a more logical place
No real changes, just move the comment in front of the line it
documents.
2021-08-06 21:22:08 +02:00
Vadim Zeitlin
ce48d01e8a Fix missing item labels in wxToolBar overflow menu under macOS
Always set the label, even when not using wxTB_TEXT style, as otherwise
the items shown in the native "overflow" menu use empty strings as
labels and so can't be distinguished at all.

This undoes part of the changes of 1f7cd4807f (Don't show labels for
toolbars showing icons only in wxOSX, 2016-02-23), but they don't seem
necessary any longer, i.e. calling SetToolShortHelp() doesn't show the
toolbar label when using non-native toolbars, so #16669 remains fixed.

Closes #19226.
2021-08-06 21:17:51 +02:00
Vadim Zeitlin
d8fe06891e Avoid bool argument in wxListMainWindow::RecalculatePositions()
Use 2 separate functions instead to make the code more clear, as passing
false for indicate the refresh shouldn't be done was quite confusing.

Also get rid of a separate RefreshAll() which was called only from
RecalculatePositions().

No real changes.
2021-08-06 21:09:29 +02:00
Vadim Zeitlin
36e9576d42 Fix not refreshing wxListCtrl properly under macOS
Refresh() called from inside wxEVT_PAINT handler doesn't seem to have
any effect, so use CallAfter() to call it slightly later instead.

Closes #19139.
2021-08-06 21:05:49 +02:00
David Connet
233c487dfd Fix direction of mouse wheel zoom in print preview
Make zooming work the same as in all the other programs rather than
zooming in/out in the reverse direction.

Closes #19215.
2021-08-06 19:34:19 +02:00
Vadim Zeitlin
de2b81b06f Ignore error in another wxWebRequest test under AppVeyor
This is similar to b03eaceea6 (Disable WebRequest::SSL::Ignore unit test
under AppVeyor, 2021-08-04) and just warns about the wxWebRequest
cancelling test failure when running it under AppVeyor instead of
failing the entire test suite, as this does happen sporadically (but
regularly) there for as yet unknown reason.
2021-08-05 23:42:53 +01:00
Vadim Zeitlin
56eeb694e7 Fix tests compilation with glibc >= 2.34
Update CATCH submodule to include the workaround for SIGSTKSZ not being
a constant any longer in the latest GNU libc versions.

Closes #19158.
2021-08-05 23:03:20 +02:00
Vadim Zeitlin
dc9dc39970 Fix typos and formatting in wxRegEx incompatibilities section
Double the backslashes to prevent Doxygen from interpreting them as
commands and remove a redundant word.
2021-08-04 21:19:14 +01:00
Vadim Zeitlin
09cbec0373 Allow calling wxListCtrl::SetImageList() before Create() in wxMSW
This already worked with the generic version, but silently failed with
wxMSW, so make it work with wxMSW too as it doesn't cost much and makes
wxListCtrl behave in the same way under all platforms.

Also document that SetImageList() can be used before the window is
created.
2021-08-04 21:09:04 +01:00
Vadim Zeitlin
b03eaceea6 Disable WebRequest::SSL::Ignore unit test under AppVeyor
This test sporadically fails in builds with different compilers (both
MSVC and gcc) there for unknown reasons. Until we can find, and fix, the
underlying problem, disable this test to avoid spurious CI failures.
2021-08-04 18:24:28 +02:00
Vadim Zeitlin
ef21046c2c Document more incompatibilities between PCRE and old wxRegEx
Also try to make the reference to this documentation in the change log
more clear.
2021-08-04 01:36:46 +02:00
Vadim Zeitlin
232a3ab577 Allocate more space for the wxRegEx error message buffer
We need to account for the trailing NUL explicitly here, so add 1 to the
length returned by the first call to wx_regerror() to avoid chopping off
the last character of the error message.
2021-08-04 01:29:44 +02:00
Vadim Zeitlin
bdee83d5ff Fix checks for submodules when using configure --srcdir option
In this case ac_confdir variable is not set, but srcdir still is, so
just use the standard (and also more clear) variable instead.

See https://github.com/wxWidgets/wxWidgets/pull/1954

Closes #19236.
2021-08-02 19:23:40 +02:00
Vadim Zeitlin
a4a65f16f6 Fix linking with builtin regex library
Use the value of wxUSE_REGEX in configure, not its name.
2021-08-02 18:10:20 +02:00
Vadim Zeitlin
a4d06b6c88 Explicitly include wx/scopedptr.h when using wxScopedPtr
Don't rely on it being implicitly included from other headers.
2021-08-01 00:43:31 +01:00
Vadim Zeitlin
55d57c0f68 Remove another obsolete Borland hdrstop pragma
See f57f214122 (Remove BCC-specific hdrstop pragma from everywhere,
2020-10-12).
2021-08-01 00:43:31 +01:00
Vadim Zeitlin
6e40b2525e Stop updating non-existent MSVC 7 project files
MSVC 7 project files don't exist any longer, so don't try updating them
in upmake.

This should have been done in 8b854d2f92 (Remove MSVC 7 project files
and support for generating them, 2021-04-26).
2021-07-31 19:12:41 +01:00
Vadim Zeitlin
c533dab96a Merge branch 'drop-pid_t-checks'
Stop defining pid_t in wx setup.h to avoid conflicts with the other
libraries (such as Boost.Process) also defining it under MSW and also
just because this was completely unnecessary.

See https://github.com/wxWidgets/wxWidgets/pull/2452
2021-07-30 00:55:00 +02:00
Dimitri Schoolwerth
a4cdbdb779 Fix disappearing wxDVC cell items if cell background is set
With both GTK 2 and 3 if a wxDVC cell has a background colour attribute
set then wxDataViewCustomRenderer::RenderText() sets the cell's
background property. With wxDataViewCheckIconText this results in items
drawn prior to the text to be painted over.

Reproducible using the dataview sample which on the MyListModel page
uses a background cell colour for the first column of odd-indexed rows.

Fix by drawing the text first, followed by the checkbox and possible
icon as before. There appear to be no other custom renderers in wx which
draw multiple items and may have needed fixing as well.

This commit is best viewed with git --color-moved option.

Closes https://github.com/wxWidgets/wxWidgets/pull/2449
2021-07-30 00:50:55 +02:00
Vadim Zeitlin
32d9b0413d Don't bother checking for size_t, mode_t and off_t neither
The latter two are always defined in sys/types.h on all Unix systems and
we already define them for MSVC (which doesn't use configure anyhow).

The former type is always defined everywhere.
2021-07-28 21:09:32 +02:00