Commit Graph

71930 Commits

Author SHA1 Message Date
Vadim Zeitlin
d4c83e1cbc Ensure that a copy of a DIB wxBitmap remains a DIB in wxMSW
Creating a DDB from DIB with alpha doesn't work correctly due to using
premultiplied alpha for the latter, but not for the former, and while we
could convert it, it seems to be even better to just preserve the type
of the original bitmap, as this would seem to be expected when making a
copy, after all.

This commit is best viewed ignoring whitespace-only changes.
2022-02-02 22:36:00 +00:00
Vadim Zeitlin
2ae80673ff Avoid unnecessarily unsharing bitmaps in wxMSW
Only call AllocExclusive() if really need to modify the bitmap and avoid
doing it if the scale factor doesn't actually change, as this saves on
unnecessary expensive bitmap copy.

This also avoids the problem of getting wrong background for SVG images
since this call to AllocExclusive() was added in d943d6f6cf (Ensure
wxBitmap::SetScaleFactor() doesn't change bitmap copies, 2022-01-22)
when not using high DPI, although the problem still remains in the high
DPI case as bitmap alpha channel is still copied incorrectly when we do
have to copy it.
2022-02-02 20:54:06 +00:00
Tobias Taschner
03efe56cf9 Allow WebView2 Edge updates without restart
The previous implementation initialized the version number only once.
This caused subsequent calls to wxWebView::GetBackendVersionInfo() to
return the same version number even if the runtime has been updated or
a fixed version runtime had been activated via
wxWebViewEdge::MSWSetBrowserExecutableDir().

This change allows to require a minimum runtime version and allow
a runtime update without requiring a restart of the application.

Closes #22076.
2022-02-01 23:15:18 +01:00
Kvaz1r
03b2ebcffb Fix setting focus on mouse button press in wxUniv
Call base version of HandleMouse to allow the base theme handle to set
the focus to the widget.

Closes #22074.
2022-02-01 23:13:47 +01:00
Vadim Zeitlin
2bbe0d7769 Merge branch 'tango_svg' of https://github.com/TcT2k/wxWidgets
Replace PNG images with SVG in Tango art provider and add a couple of
new art IDs for the use in the webview sample.

See #22067.
2022-02-01 23:12:43 +01:00
Tobias Taschner
73d37d460d Add tango art for refresh and stop
Use the added art IDs in webview sample
2022-02-01 09:50:32 +01:00
Tobias Taschner
766fefeb34 Use SVG instead of PNGs in tango art provider
Replace embedded tango PNG data with SVG data of the same icons.
2022-02-01 09:46:55 +01:00
Tobias Taschner
f256e5ae59 Add additional wxBitmapBundle::FromSVG() overload
This overload can work on non 0 terminated unsigned char arrays.
Especially useful for headers created by bin2c.py
2022-02-01 09:46:48 +01:00
Vadim Zeitlin
ae7fa19ae3 Improve fallback logic in wxArtProvider::GetBitmap{,Bundle}()
This improves the changes of f78db92462 (Avoid bitmap scaling in
wxArtProvider::GetBitmapBundle(), 2021-12-17) and still uses a custom
bundle to avoid scaling the bitmap if possible, but does it in
GetBitmapBundle() itself rather than CreateBitmapBundle().

This allows to also use CreateBitmapBundle() from GetBitmap(), as there
is no possibility of infinite recursion due to calling each of these
functions from the other one any more, and so allows defining art
providers overriding only CreateBitmapBundle() instead of having to
always override both it and CreateBitmap().

Also add a unit test, even if just a trivial one, for these functions,
to at least check that they don't crash.
2022-01-31 22:53:13 +00:00
Lauri Nurmi
1a10199575 Document installing vcpkg packages for x64, too
Vcpkg defaults to installing packages for x86-windows, and from the
perspective of x64 builds, the packages installed just cannot be
found -- and the reason is not very obvious.

Having an example with commands that will install both x86 and x64 is
probably the right thing to do in this day and age -- and if somebody
only wants one and not the other, seeing a package name with architecture
specified helps with guessing how to achieve that.

Closes #22075.
2022-01-30 23:03:17 +01:00
Blake-Madden
49c508c7a9 Fix typo in "By default" in the documentation
It was misspelt as "Bu default" in a couple of places.

Closes #22072.
2022-01-30 22:59:26 +01:00
PB
754f75c1cd Fix memory leaks in artprov sample
The list control used in the Resources Browser dialog had
dynamically allocated wxStrings assigned as item data that
were never freed.

Closes #22070.
2022-01-30 22:58:07 +01:00
Scott Talbert
085d15015a Don't install old or non-existent packages during Linux CI
libwebkitgtk-3.0-dev is long deprecated and isn't used anyway.
gstreamer-0.10* no longer exists even on Ubuntu 18.04.
gstreamermm* is not used by wxWidgets.

Closes #22069.
2022-01-30 22:56:25 +01:00
Artur Wieczorek
2ee8751c46 Use size_t type for index value 2022-01-30 19:27:38 +01:00
Artur Wieczorek
0906e820d9 Use size_t type for index value 2022-01-30 17:29:25 +01:00
Artur Wieczorek
93365e02de Use more relevant macros in wxPropertyGrid 2022-01-30 12:06:27 +01:00
Artur Wieczorek
7e4cd9f1c1 Get rid of unnecessary friend classes 2022-01-30 10:33:17 +01:00
Artur Wieczorek
a86950de7f Get rid of unused variable 2022-01-29 23:36:47 +01:00
Artur Wieczorek
bd784b3186 Refactor functions converting wxArrayString to string in wxArrayStringProperty::GenerateValueAsString()
Because ConvertArrayToString() and ArrayStringToString() produce string
values it would more intuitive to just to return this string as a function
value instead of passing it through the parameter.
2022-01-29 20:32:09 +01:00
Artur Wieczorek
6d318ad0e2 Refactor wxMultiChoiceProperty::GenerateValueAsString()
Because this function produces a string value it would more intuitive to
just to return this string as a function value instead of passing it
through the parameter.
2022-01-29 00:12:27 +01:00
Artur Wieczorek
3c87cc1e49 Get rid of unused member variable 2022-01-28 23:55:12 +01:00
Kvaz1r
b8c457e356 Fix scrolling when m_win != m_targetWindow in wxUniv/MSW
This reverts 3b3169fa15 (Fix refresh problems when scrolling with
mousewheel in wxUniv/MSW, 2021-09-23) (see #2525) and replaces it with a
wxUniv-specific workaround in wxScrollHelperBase::HandleOnScroll().

Closes #2640.
2022-01-27 23:45:52 +01:00
Vadim Zeitlin
4cff1fce29 Merge branch 'unsigned-arith-conv'
Avoid arithmetic conversion warnings from gcc 12.

See #22063, #22057.
2022-01-27 23:40:03 +01:00
Jeinzi
d94dc0cab5 Add missing parenthesis to an example in wxTextCtrl docs
Closes #22062.
2022-01-27 17:07:15 +01:00
Vadim Zeitlin
e0323663b9 Handle font variants added in Pango 1.50
This avoids -Wswitch gcc warning and could be actually useful too if we
ever use a font in one of these variants.

Closes #22064.
2022-01-27 17:05:41 +01:00
Vadim Zeitlin
37a4bf8693 Add wxColour::Get{Red,Green,Blue,Alpha}() to avoid gcc 12 warnings
These functions return the colour components as unsigned int and so
promote to this type in arithmetic expressions, unlike unsigned char
returned by the existing accessors without the "Get" prefix, which
promotes to (signed) int and results in gcc 12 -Warith-conversion
warnings when the result is then converted to unsigned, as it happened
in our own wxColour::GetRGB() and GetRGBA() functions and would probably
happen in a lot of code outside wx, which could also be updated to use
the new functions instead of inserting casts.
2022-01-27 15:46:42 +01:00
Vadim Zeitlin
28b84a1e96 Avoid gcc 12 -Warith-conversion in wxImageHistogram::MakeKey()
Explicitly convert the operands to unsigned because we do actually want
the result to be unsigned here.

Co-Authored-By: Scott Talbert <swt@techie.net>
2022-01-27 15:30:22 +01:00
PB
5ba37d867c Support creating wxBitmapBundle from SVG in application resource
Allow creating wxBitmapBitmap from SVG image stored in an application
resource on the platforms where wxHAS_IMAGE_RESOURCES is defined.

On Windows, load the bundle from a resource with RT_RCDATA type and on
MacOS from a file with an extension "svg" placed in the "Resources"
subdirectory of the application bundle.

Closes #22061.
2022-01-27 14:39:35 +01:00
Alexander Koshelev
3f3561e2c6 Change inactive bitmap to in wxBitmapBundle wxAnimationCtrl 2022-01-27 14:29:25 +01:00
Alexander Koshelev
2b94729a33 Change wxBitmap to wxBitmapBundle in wxBannerWindow 2022-01-27 14:29:25 +01:00
Alexander Koshelev
85becc9362 Change wxBitmap to wxBitmapBundle in wxBitmapToggleButton 2022-01-27 14:29:25 +01:00
Alexander Koshelev
b2629a97e5 Add wxBitmapBundle::GetPreferredLogicalSizeFor()
We often need the logical bitmap size when using it in size computations
involving window size, so add a function returning it directly to
wxBitmapBundle, similarly to wxBitmap::GetLogicalSize(), to avoid using
FromPhys() everywhere.

Also rename the existing wxBitmapBundle::GetPreferredSizeFor() to
GetPreferredBitmapSizeFor() to make it more clear that this is similar
to wxBitmap::GetSize() and so returns the size in physical units.

Closes #22056.
2022-01-27 14:29:25 +01:00
Tobias Taschner
dd185a0b27 Fix timing issue with wxWebViewEdge::SetPage()
When SetPage() was called during the webview was still initializing
it would silently fail. This will now load the contents when the
webview is ready. Additionally error handling for the underlying
NavigateToString() has been added so it wont fail silently.

Closes #22052.
2022-01-27 14:11:19 +01:00
Vadim Zeitlin
311aa370de Merge branch 'dvc-bmpbundle'
Use wxBitmapBundle in wxDVC-related classes.

See #22051.
2022-01-27 14:10:29 +01:00
Ger Hobbelt
4902b8137b Improve startup time of the display sample under MSW
Performance tweak for samples/display, resulting in a much faster
application start, particularly when built in debug mode, when Windows
messages are dumped to the system debug channel for
inspection/diagnosis.

Speed up the Append() loop below by foregoing the repeated resizing of
the choice drop-down via repeated calls to GetBestSize() which happens
deep inside the Append() call chain and executes another inner loop
calling SendMessage() to get the control contents. (This exhibits
1/2*O(N^2) behaviour thanks to the linear growth of the length of the
inner loop to the length of the outer loop (= number of items to add),
while it is re-executed for every new added item.)

With the 'display' sample, that's about 500+ rounds and about 500*500/2
SendMessage() calls less now on my dev/test rig, taking noticeable time
to start the display application.

---

Issue was found due to the barrage of '(winmsg)' Windows Message debug
log lines zipping by in the monitor app when the sample was build in
Debug Mode. Only significant difference with the Release Build is those
debug lines being output, hence the performance gain is less, but still
measurable, in a Release build. When the machine is otherwise severely
loaded (UI render core maxing out), "measurable" becomes "obnoxiously
noticeable" again on Win10/64.

Closes #22049.
2022-01-27 14:08:33 +01:00
Vadim Zeitlin
224d8ffdaf Merge branch 'ak_high_dpi' of https://github.com/kosh543/wxWidgets
Add support for wxBitmapBundle to XRC.

See #22040.
2022-01-27 14:04:01 +01:00
Gerhard Gruber
1533026945 Allow better control over splitter position on resize
Add an event which can be handled by the application to determine the
splitter position when the splitter window itself is resized.

This can be used to e.g. preserve the splitter at the given proportion
of the window (and not just in the middle, as it would be already
possible by using gravity 0.5).

Closes #22035.
2022-01-27 14:00:51 +01:00
Vadim Zeitlin
8f58562fea Fix typo in bin2c.py comment
Correct the name of the other script.
2022-01-27 13:55:46 +01:00
Alexander Koshelev
7f5910ad07 XRC: ability to create wxCommandLinkButton with wxBitmapBundle 2022-01-24 17:26:52 +03:00
Alexander Koshelev
4ec849a28c XRC: ability to create wxButton with wxBitmapBundle 2022-01-24 17:26:52 +03:00
Alexander Koshelev
49fd3a227c XRC: ability to create wxStaticBitmap with wxBitmapBundle 2022-01-24 17:26:52 +03:00
Alexander Koshelev
df1504dd8f XRC: add GetBitmapBundle function
The function creates wxBitmapBundle from <bitmaps> xrc tag.

Co-authored-by: VZ <vz-github@zeitlins.org>
2022-01-24 17:26:42 +03:00
Vadim Zeitlin
4073f3b9bf Use wxBitmapBundle in wxDataViewCtrl-related classes
Extend the existing use of wxIcon in wxDataViewIconText,
wxDataViewCheckIconText, the corresponding renderers and
wxDataViewTreeCtrl to wxBitmapBundle.

As with the other classes, the existing setters have been preserved as
they remain almost entirely compatible with the existing code and the
return type of the existing getters was preserved, with new getters
being introduced for returning wxBitmapBundle only where they're really
required.

Update the sample to use wxBitmapBundle with its wxDataViewTreeCtrl.
2022-01-23 21:55:30 +01:00
Vadim Zeitlin
90bbde8777 Fix "tall row" height in the dataview sample in high DPI
Add missing FromDIP() to ensure that the rows are really tall.
2022-01-23 17:29:43 +01:00
Vadim Zeitlin
e6addf1128 Take DPI scaling into account for wxDataViewCtrl scroll rate
Use FromDIP() to make scrolling work visually the same in high DPI as in
normal one.
2022-01-23 17:29:43 +01:00
Vadim Zeitlin
906808b8e5 Fix wxDataViewCtrl default row height in high DPI
Use FromDIP() to ensure that it is not too small when using DPI scaling.

Also make the code slightly more clear by using a meaningful variable
name instead of a (duplicated) comment.
2022-01-23 17:29:43 +01:00
Vadim Zeitlin
1a1c02804b Add more FromDIP() calls to generic wxDataViewCtrl renderers
Some of them had been already updated to return the values scaled
appropriately for the current DPI in 56fab0aabb (Improve wxDataView on
DPI change, 2019-01-10), but not all, so add the missing calls to
wxDataView{Progress,IconText}Renderer too.
2022-01-23 17:29:43 +01:00
Vadim Zeitlin
2c18e772c2 Fix wxDataViewCheckIconTextRenderer icon size under Mac too
The change of dcdcbbe078 (Fix wxDataViewCheckIconTextRenderer icon size
with GTK3, 2020-09-17) should really apply to all platforms, especially
those with DPI-independent pixels (a.k.a. really logical pixels), such
as Mac, to have the correct icon sizes in high DPI.
2022-01-23 17:29:43 +01:00
Vadim Zeitlin
e6bf7f5ec5 Remove unnecessary HasImageList() checks in wxDataViewTreeCtrl
These checks don't seem to make any sense at all, even though they were
there ever since this classes was added in a75124d0da (Added
wxDataViewTreeCtrl, 2007-12-01), and, in fact, were clearly harmful
until they were fixed in e6a2aa5ae3 (Show correct icon for branch nodes
in wxDataViewTreeCtrl, 2018-09-12).

But it seems that even this wasn't the right thing to do, as there
doesn't seem to be any reason to not call ItemChanged() even for the
controls not using images, so just remove them completely.
2022-01-23 17:29:43 +01:00
Vadim Zeitlin
3cc4ef5f77 Merge branch 'art-wx-logo'
Add wx logo art ID and use SVG to provide it in any size.

See #22046.
2022-01-23 17:29:22 +01:00