Commit graph

74828 commits

Author SHA1 Message Date
Brian Nixon
d78e9fb1cb Correct loading of BI_BITFIELDS bitmaps
This fixes several minor bugs in the loading of `BI_BITFIELDS` bitmaps,
related to handling different header sizes and the colour and alpha
masks.

Closes #23601.
2023-06-03 21:07:40 +02:00
Vadim Zeitlin
6bba7055aa Exclude descrip.mms files everywhere from the whitespace check
Previously only the top-level one was excluded, but others use TABs too.
2023-06-03 21:07:40 +02:00
Vadim Zeitlin
e95073c24b Merge branch 'init-keyevent-repeat'
Ensure that wxKeyEvent::m_isRepeat is initialized.

See #23596.
2023-06-03 21:07:40 +02:00
Vadim Zeitlin
1a1790350f Merge branch 'htmllbox-fix-ub'
Fix undefined behaviour in wxHtmlListBox::OnDrawItem().

See #23595.
2023-06-03 21:07:40 +02:00
Vadim Zeitlin
a3e925df0a Merge branch 'mac-uilocale-script-fix'
Locale-related fixes for macOS and new calendar names localization
functions.

Closes #23209.

See #23556.
2023-06-03 21:07:40 +02:00
Vadim Zeitlin
946aa6bbc4 Remove redundant "const" from wxItemId conversion operator
This "const" is ignored and just results in a warning from MSVS 17.6.

Closes #23590.
2023-06-03 21:07:40 +02:00
Ian McInerney
5d0c4066d8 Add operators for boolean conversions to wxPGGlobalVars
The old API allowed for users to directly test the variable and find if
it was null, so recreate that API with the new system to preserve
compatibility.

Closes #23445.
2023-06-03 21:07:40 +02:00
Artur Wieczorek
57a9247889 Fix wxPG_PROP_ACTIVE_BTN flag definition
wxPG_PROP_ACTIVE_BTN and wxPG_PROP_SHOW_FULL_FILENAME can be used together
(like e.g. in wxFileProperty) so they can't share the same value
(wxPG_PROP_CLASS_SPECIFIC_1).

Closes #23565.
2023-06-03 00:07:45 +02:00
Vadim Zeitlin
865def904b Merge branch 'html-dark-mode'
Fixes for wxHtmlWindow in dark mode.

See #23588.
2023-06-02 19:15:45 +02:00
Vadim Zeitlin
30de30eec1 Merge branch 'rle-bitmaps'
Fix loading RLE bitmaps in wxMSW.

See #23573, #23584.
2023-06-02 19:14:36 +02:00
Vadim Zeitlin
3080b6b04a Merge branch 'com-init-filedlg'
Fix hang in wxMSW wxFileDialog when using multi-thread COM.

See #23583.
2023-06-02 19:13:01 +02:00
PB
885c87d865 Fix storing DXF entities in penguin sample
The code in b76ebc6 switched from wxList to std::vector but the changes
did not account that we must store the pointers to derived classes in
the entity list, not just the struct they derive from.

Closes #23582.
2023-06-02 19:11:11 +02:00
Reza Karimi
f967118f16 Create IE emulation key in the registry if it does not exist
The related folder of the registry key (FEATURE_BROWSER_EMULATION)
should be created if it does not exist. Otherwise some of IE features
may not work depending on the level set.

Closes #23580.
2023-06-02 19:09:38 +02:00
Vadim Zeitlin
3d13e77b01 Merge branch 'env-wxlog-time-format'
Add support for WXLOG_TIME_FORMAT and docs improvements.

See #23576.
2023-06-02 19:07:55 +02:00
Vadim Zeitlin
fb30d563a5 Turn wxCAPTION on automatically if it's required by other styles
The documentation used to warn that wxXXX_BOX styles were ignored unless
wxCAPTION was also specified, but this was actually wrong, at least for
wxOSX, which instead enabled wxCAPTION too if any of the BOX flags was
given.

And this behaviour seems more useful, as it's not really obvious why the
boxes are not shown otherwise, so make wxMSW behave like this too and
update the documentation.
2023-06-02 19:05:53 +02:00
Vadim Zeitlin
5988812efa Initialize some wxKeyEvent members in their declarations
Initialize at least boolean members when they are declared to ensure
that we don't forget to do it later (see #23593).

The other ones are already initialized later, normally, so don't touch
them for now.

No real changes.
2023-06-02 16:20:04 +02:00
Vadim Zeitlin
bf249973e4 Initialize wxKeyEvent::m_isRepeat in wxGTK
This field was never initialized, so it could have completely invalid
values and resulted in UBSAN errors.

Closes #23593.
2023-06-02 16:13:18 +02:00
Vadim Zeitlin
c0f226e674 Initialize wxHtmlSelection members in their declaration
No real changes, just prefer initializing members when declaring them
instead of doing it in the ctor.
2023-06-02 16:09:27 +02:00
jolz
2c3c37a0b6 Fix UB due to invalid stack access in wxHtmlListBox code
Ensure that the local variable referenced via a pointer stored in
htmlRendInfo has a life-time long enough to still be valid by then.

Previously, accessing it after it went out of scope was undefined
behaviour and resulted in ASAN stack-use-after-scope error.

Closes #23592.
2023-06-02 16:05:42 +02:00
Vadim Zeitlin
be4ec7b93d Fix default colours used by wxHtmlWindow in dark mode
Don't hardcode white background in wxHtmlWindow, but use
wxSYS_COLOUR_WINDOW, as was already done in wxHtmlWinParser in case when
wxHtmlWindow was not used at all.

Also use wxSYS_COLOUR_WINDOWTEXT for the default foreground and
light/dark-mode dependent link colour instead of hardcoded blue. As a
side effect, this uses a more appropriate colour for the links in the
light mode as well.

Add a link to the lists test page in the HTML test sample to allow
testing the links appearance easily (links present in the other pages of
this sample use fixed colours specified in HTML itself).
2023-06-01 17:00:14 +01:00
Vadim Zeitlin
94e80dc21a Move wxGenericHyperlinkCtrl GetLinkColour() to a private header
No changes yet, but this will allow reusing the same function from
wxHTML in the upcoming commit.
2023-06-01 17:00:13 +01:00
Vadim Zeitlin
08d4577495 Fix regression in iterators comparison in wxHtmlWindow
This got broken in f3848673ab (Stop using wxList-based container in
wxHtmlWindow code, 2023-04-11): default-constructed std::list::iterator
is invalid, unlike the default-constructed compatibility_iterator used
before.
2023-06-01 17:00:13 +01:00
Vadim Zeitlin
b9e93e7e6b Generalize IFileDialog::Show() workaround to wxDirDialog too
Move the check for multi-threaded COM apartment into a new helper
function and use it from both wxFileDialog and wxDirDialog, which should
be subject to the same problem.
2023-06-01 14:25:58 +01:00
Brian Nixon
28d6234bfe Add image test to compare BMP creation methods
Check that loading BMP files directly using wxDIB and via wxImage
built-in support for them produces the same result (which wasn't the
case for the RLE-compressed bitmaps until the last commit).
2023-05-31 21:19:14 +01:00
Vadim Zeitlin
a2f6e01bea Delete wxDIB copy ctor and assignment operator
No real changes, just use C++11 feature instead of declaring these
special member functions as private without defining them.
2023-05-31 21:16:35 +01:00
Vadim Zeitlin
07408ed1df Initialize wxDIB members in their declarations and drop Init()
Remove the Init() helper initializing all members as we can now do it in
their declarations instead which is even better.

Also drop Free() which existed mostly for symmetry with Init().

As a side effect, this change allows to include this header from outside
the library (e.g. from the tests code), while previously it would result
in the following warning from gcc:

‘void wxDIB::Init()’ redeclared without dllimport attribute after being
referenced with dll linkage
2023-05-31 21:16:35 +01:00
Brian Nixon
d2ee111eb9 Fix handling of RLE-compressed bitmaps in wxMSW
Correct color table size calculation for the bitmaps using RLE
compression: the same calculation as for BI_RGB should be used for them.
2023-05-31 20:58:47 +01:00
Vadim Zeitlin
ade7e88672 Update wxOleInitialize() comment
No real changes, just don't say that this function calls CoInitialize()
because this is not the case any longer, and do advise using the RAII
wrapper instead of calling it directly.
2023-05-31 19:40:00 +01:00
Vadim Zeitlin
6c4bee846c Fix hang in wxMSW wxFileDialog when using multi-thread COM
Fall back to old style file dialogs in this case, as IFileDialog just
doesn't seem to support this COM threading model, as hinted at in
SHBrowseForFolder() documentation.

Also document this limitation.

Closes #23578.
2023-05-31 19:39:53 +01:00
utelle
36f06bf882 Use correct calendar names form in wxGenericCalendarCtrl
Use month and weekday names in standalone context form, which can be
different in the one used for formatting dates in some languages, and
which needs to be used when the month or weekday names used are used on
their own, as here.

See #23191.
2023-05-31 18:53:45 +02:00
utelle
9deb7ea746 Match the chosen script when creating wxUILocale under macOS
Take the script name into account if it's specified to avoid selecting a
locale with a different script.
2023-05-31 18:53:45 +02:00
utelle
5b424ea181 Add wxUILocale methods for getting month and day names
Implement wxUILocale::GetMonthName() and wxUILocale::GetWeekDayName() in
wxMSW, wxGTK, and wxOSX.

Also extend the existing wxDateTime methods to support a 3rd month and
weekday name representation (Name_Shortest) and a usage context
(Context_Formatting and Context_Standalone).

These changes make wxDateTime methods for getting the localized date and
month names use the current UI locale, as set by wxUILocale, instead of
the current C locale set by the standard C library function, which is a
change in behaviour but a desired one and notably fixes the display of
the months in generic calendar control in wxOSX where the current C
locale is not changed when the UI locale is set.

Replaces #23551.

Closes #23191.
2023-05-31 18:53:45 +02:00
utelle
9ada6cd2db Fix parsing Windows sort order in wxLocaleIdent::FromTag()
Adjust the code to check for Windows sort order only after the last
underscore (instead of the first one).

This avoids misinterpreting locale tags like "zh_Hans_CN".
2023-05-28 22:56:10 +02:00
utelle
5a80bfb1e9 Improve handling of standard C locale
For wxOSX return "C" from GetName() for "en_US_POSIX" which is now
used as the standard "C" locale.

Also handle special locales "C" and "POSIX" properly in
wxLocaleIdent::FromTag().
2023-05-28 22:56:10 +02:00
utelle
0c4e97b881 Use better suited locale for standard C locale under macOS
Replace systemLocale by locale identified by en_US_POSIX because
systemLocale doesn't provide any reasonable month and weekday names
unlike the latter and this will be important for the upcoming commit.
2023-05-28 22:44:31 +02:00
Vadim Zeitlin
674592719f Allow customizing wxLog timestamp format via environment variable
Call wxLog::SetTimestamp() with WXLOG_TIME_FORMAT value if it's defined.
2023-05-28 22:35:34 +02:00
Vadim Zeitlin
03c09d703f Document default timestamp in wxLog::GetTimestamp() documentation
It seems like this would be useful to know.
2023-05-28 22:22:38 +02:00
Vadim Zeitlin
21daae3435 Improve WXTRACE documentation
Link to wxLogTrace() documentation and don't speak about "debug build"
any more.
2023-05-28 22:18:28 +02:00
Vadim Zeitlin
726aedd5a4 Improve wxLogDebug() and wxLogTrace() documentation
Refer to the debugging overview instead of outdated documentation
speaking about debug and release build modes.
2023-05-28 22:17:50 +02:00
Vadim Zeitlin
f2f2868de5 Add support for dark mode colours to XRC
Allow specifying a different colour to use in the dark mode in XRC
colour properties.

Closes #23571.
2023-05-27 21:51:51 +02:00
Vadim Zeitlin
e1f9f8f988 Remove outdated comment mentioning Windows CE limitation
This is irrelevant since a very long time, so just remove it.

No real changes.
2023-05-27 21:51:36 +02:00
Vadim Zeitlin
fff31e01b7 Merge branch 'dark-mode-fixes'
Various cosmetic -- but rather important -- fixes for MSW dark mode.

See #23570.
2023-05-27 21:46:34 +02:00
Christian Beier
1a64e17ccc Add EVT_FULLSCREEN event macro
This macro was mentioned in the docs added by 0ff1bdec09 (Add
wxFullScreenEvent for macOS, 2021-03-18), but its implementation was not
added by said commit.

Closes #23566.
2023-05-27 21:44:55 +02:00
Vadim Zeitlin
e51d74f158 Make wxDV_ROW_LINES much more subtle in dark mode
The colour used for odd rows was much too light in the dark mode and was
actually much lighter than the colour used for the selection, which is
much more important than cosmetic zebra striping.

Fix this by strongly decreasing the lightness change in dark mode, from
50% to 10%, which results in using #363636 on #202020 which is the
default dark mode background in wxMSW, instead of #8f8f8f used before
(by comparison, light mode uses #f7f7f7 on #ffffff background).

See #12834.
2023-05-26 01:02:19 +01:00
Vadim Zeitlin
0ca1c14df0 Improve wxListCtrl appearance in dark mode
Switch to using "DarkMode_Explorer" theme for it in dark mode, bringing
the following improvements:

1. Scrollbars are dark now, as they should be.
2. There are no vertical separator lines in the control any more, which
   is unexpected and especially jarring because they misalign (by 1px)
   with the header separators.

To make "DarkMode_Explorer" work we have to take care of drawing the
selected items ourselves, as they appear completely wrongly in this
theme by default, so do take care of this by changing the custom drawing
code to use the colours appropriate for both light and dark mode and
also fix yet another misalignment problem in it by changing the offset
used for the item rectangle: it's not clear why the offset, added back
in c9a695b777 (wxMSW: Fix incorrect subitem rect calculation in
wxListCtrl., 2012-09-07) differed for the first and non-first columns,
but the first column offset is off by 2px under both Windows 10 and
Windows 7 now, which resulted in a noticeable shift of custom-drawn
items compared to the normal ones.
2023-05-26 01:01:38 +01:00
Vadim Zeitlin
308e9b3f14 Fix custom-drawn wxListCtrl items appearance when focused
The focus rectangle wasn't drawn correctly due to the of ClientHDC in
the painting code, which didn't work when using compositing.

Use the provided HDC, as in the rest of the drawing code, as it seems to
work fine now and the comment saying that it didn't, written back in
2006 was either erroneous or, more likely, out of date by now.
2023-05-25 00:18:17 +01:00
Vadim Zeitlin
693de13ce1 Use anonymous namespace for private wxListCtrl drawing functions
No real changes, just use an anonymous namespace instead of making all
the private functions static.
2023-05-25 00:10:31 +01:00
Vadim Zeitlin
6d849f8211 Fix creating Chinese locales under macOS
Creating Chinese locales such as zh_TW didn't work because this string
didn't appear in [NSLocale availableLocaleIdentifiers] return value,
as only the variants explicitly specifying the script were included.

Fix this by ignoring the script part when checking if the locale is
available. This should work well for zh_TW or zh_SG, which exist only in
a single script (traditional and simplified, respectively), but it's not
really clear whether it works, or what should we do if it doesn't work,
for zh_CN or zh_HK both of which exist in both scripts.

See #23209.
2023-05-19 01:39:02 +02:00
Vadim Zeitlin
d2101ca3be Show result of parsing wxLocaleIdent in wxUILocale pseudo test
In addition to showing whether the locale is supported or not, show all
of its components to allow interactively verifying if an identifier is
being parsed correctly.
2023-05-19 01:33:13 +02:00
Vadim Zeitlin
bc72a5d003 Fix drawing of disabled wxStaticText in dark mode
Disabled static controls looked ugly as greying out the label doesn't
work at all when the background is dark, so override their drawing in
this case and just draw them using the same grey-ish colour that is
already used for the disabled menu items.

This is somewhat of a hack, but doesn't seem to have any bad effects and
is much simpler than using owner-drawn controls.
2023-05-18 01:31:25 +01:00