Commit Graph

41703 Commits

Author SHA1 Message Date
Vadim Zeitlin
212d59cd80 Fix determining the size of wxBitmapComboBox bitmaps
Instead of using the size of the first item bitmap, use the size best
suited for all the bitmaps, which may result in better appearance if the
different bitmaps are not all available in the same sizes.

This also fixes the unit test after 80a736250e (Fix margin between
wxBitmapComboBox images and text in high DPI, 2022-05-25) and should
have been part of it.
2022-05-25 22:18:43 +02:00
Randalphwa
76d1b3c9a9 Extend wxBitmap XRC handler to support all button attributes
Add support for the missing wxBU_NOTEXT style, bitmaps for the other
than default states (pressed, focus, disabled and current) and margins
to wxBitmapXmlHandler.

Note that the images for the other states were previously already
supported by wxBitmapButton XRC handler, but not by the wxBitmap one,
even though both bitmap classes support them.

Closes #22451.
2022-05-25 15:33:31 +02:00
Maarten Bent
4f8b49ca43 Create backing bitmap with correct scale factor in wxSTC
Using GetContentScaleFactor() worked just fine for wxOSX and wxGTK,
where it's the same as GetDPIScaleFactor() anyhow, and, until recently,
didn't matter for wxMSW where the scale factor was just ignored.

However since 9e5c8a8027 (Respect bitmap content scale factor in wxMSW
wxMemoryDC, 2022-03-26) it is important to specify the actually correct
scale factor when creating the backing bitmap in wxSTC code, as
otherwise wxMemoryDC would try to compensate for it by rescaling the
font, which should be unnecessary and resulted in a very noticeable
performance regression.

Simply using GetDPIScaleFactor() fixes the problem for wxMSW without
affecting the other platforms.

Closes #22450.
2022-05-25 15:26:59 +02:00
Maarten Bent
80a736250e Fix margin between wxBitmapComboBox images and text in high DPI
Don't use FromDIP() with m_usedImgSize which is expressed in logical,
and not DPI-independent, pixels already and also update the image size
when the DPI changes.

Closes #22436.
2022-05-25 15:22:15 +02:00
valid-ptr
76797ab9e1 Fix calling wxGTK wxDropTarget::GetMatchingPair() from OnData()
This function didn't work at all in this case because the drag context
wasn't set in target_drag_data_received(), unlike in all the other
callbacks.

Do set it here too to fix it, this notably makes dropping data on
generic wxDataViewCtrl work correctly in wxGTK.

Closes #22453.
2022-05-25 15:11:12 +02:00
DietmarSchwertberger
0dc9b292fe Fix regression in wxGrid row/col dragging to corner label
Recent changes to wxGrid (see #22292) resulted in an assertion being
triggered when dragging row or column to the corner window. Fix this by
adding a check for the new position validity.

Closes #22432.

Closes #22443.
2022-05-23 22:28:10 +01:00
Vadim Zeitlin
411c150bba Merge branch 'print-preview-layout'
Print preview layout and appearance fixes.

See #22441.
2022-05-23 22:25:16 +01:00
Vadim Zeitlin
c5f64e0509 Fix showing fully fully transparent bitmaps in wxMSW wxImageList
This was broken by 6feeed9fe9 (Handle transparency to the best of our
ability in wxImageList, 2022-05-05) as using alpha, rather than mask,
for these images resulted in alpha channel being just ignored.

Work around this by making at least one pixel not quite transparent in
this case.

This also makes things work for images using alpha channel with only 0
values, rather than mask covering the entire bitmap.

See #22400.

Closes #22437.
2022-05-23 22:24:41 +01:00
Vadim Zeitlin
9042b529fa Merge branch 'dvc-bitmap-renderer-bundle'
Allow using wxBitmapBundle with wxDataViewBitmapRenderer.

See #22411.
2022-05-23 22:22:53 +01:00
Vadim Zeitlin
663fa1c77b Still use wxPreviewFrame size if it was explicitly specified
Even though it's better to not specify the preview frame size at all,
the size should still be used if it was explicitly specified, but this
didn't happen any more after the addition of the call to Fit().

Fix this now by only doing the equivalent of Fit() if no size was
explicitly given.

Also add advice about not setting the size explicitly to the
documentation.
2022-05-23 15:07:06 +01:00
Vadim Zeitlin
fc0a4d4e62 Correct client/window confusing in wxPreviewFrame code
Pass the window size to SetSizeHints() to make sure the window minimum
size is set as expected.
2022-05-23 15:07:06 +01:00
Artur Wieczorek
d90cb7511b Change the order of data member initializers
To suppress compiler warning that the order of member initializers
does not match the order in which they are executed.
2022-05-21 22:54:27 +02:00
Artur Wieczorek
a292ebe6ae Change the order of data member initializers
To suppress compiler warning that the order of member initializers
does not match the order in which they are executed.
2022-05-21 22:41:14 +02:00
Artur Wieczorek
e772cb1907 Use NULL literal to represent null pointer 2022-05-21 22:08:35 +02:00
Artur Wieczorek
21fe682187 Don't store wxBitmap objects on the heap in wxPropertyGrid
To simplify managing the life cycle of the objects.
2022-05-21 22:08:02 +02:00
Artur Wieczorek
5e417302c5 Don't store wxCursor object on the heap in wxPropertyGrid
To simplify managing the life cycle of the object.
2022-05-21 22:07:42 +02:00
Artur Wieczorek
d872229be3 Get rid of redundant casts 2022-05-21 22:05:12 +02:00
Artur Wieczorek
6652243b6f Don't override Refresh() in wxPropertyGridManager
It just forwards call to the base class so it's redundant.
2022-05-21 22:04:26 +02:00
Artur Wieczorek
19e0cf0095 Declare variable inside loop 2022-05-21 22:03:52 +02:00
Artur Wieczorek
547afc66c4 Pass large object by a const reference 2022-05-21 22:03:08 +02:00
Artur Wieczorek
598a21da9d Remove useless parentheses 2022-05-21 22:02:38 +02:00
Artur Wieczorek
1c292cfe2c Initialize data members in initialization lists 2022-05-21 22:01:58 +02:00
Artur Wieczorek
950f3ff34f Fix adjusting position of wxPGProperty editor
Position of the editor should be adjusted after setting new virtual size
because this operation can scroll wxPropertyGrid contents and scroll
position needs to be taken into account.

See #22428.
2022-05-21 21:59:51 +02:00
taler21
1e483f9510 Improve the appearance of "Close" button in wxPreviewFrame
Ensure that there is a border at least as wide as between the other
button groups before this button.
2022-05-21 00:11:06 +01:00
Vadim Zeitlin
4d3bb036f9 Use GetDefaultBorderFractional() for borders in wxPreviewFrame
This is slightly more precise when using non-integral scaling factor
than using GetDefaultBorder().
2022-05-21 00:08:11 +01:00
Vadim Zeitlin
5be09037d0 Disallow shrinking wxPreviewFrame too much horizontally
Make it at least as wide as the controls bar to ensure all the buttons
are always shown.
2022-05-21 00:04:03 +01:00
Vadim Zeitlin
f43efa6b46 Fix drawing of corners in wxGraphicsContext::DrawLines()
Close the path corresponding to the polygon to ensure that the starting
and finishing edges are joined correctly, which wasn't the case before
as could be easily seen when using thicker pens.

Closes #22440.
2022-05-20 01:32:07 +02:00
Vadim Zeitlin
dcf24f5311 Remove unnecessary and ugly borders from wxPreviewFrame
Having borders around the controls toolbar and preview canvas not only
wasted space, but also let the frame background show through, which
looked just ugly under MSW, where it is dark grey and so clashes with
the control bar background.

Simply remove them to save space and improve appearance too.
2022-05-19 17:08:17 +01:00
Vadim Zeitlin
f0de5a93f8 Use reasonable size for wxPreviewFrame by default
Give a reasonable default size to wxPreviewCanvas and fit wxPreviewFrame
to its contents.

Remove the useless call to Fit() from SizerWithButtons: the size set
inside it was just ignored anyhow.

This also allows to stop hardcoding the size in the sample, so don't do
this any more.

See #22439.
2022-05-19 17:04:32 +01:00
Vadim Zeitlin
93a6784c5f Remove unnecessary wxPreviewFrame::Layout() call
No real changes, just remove the useless call which was left over the
very first version of this code added in 7bcb11d307 (Many changes to the
printing classes., 1999-03-25).
2022-05-19 17:21:49 +02:00
taler21
91a0dc3197 Fix insufficient width of zoom combobox in print preview
Don't hardcode 70px size for the combobox, but let it determine its own
size instead, as 70 may well not be enough, depending on the theme and
the font size.

Closes #22439.
2022-05-19 16:42:31 +02:00
Vadim Zeitlin
754aed4d7b Fix wxBitmapBundle support in wxTreeList
Don't use wxWithImages::GetImage(), which is limited to only a single
bitmap resolution, but use GetBitmapBundle() instead to ensure that we
show the representation of the bitmap appropriate for the current
resolution.
2022-05-18 17:45:44 +02:00
Vadim Zeitlin
ed264087ec Use flags for drawing arrow in wxGTK DrawComboBoxDropButton()
This would seem to be required for drawing it correctly in the disabled
state, for example, but is still insufficient to fix its appearance, at
least with GTK 3.

See #22431.
2022-05-17 16:45:37 +02:00
Vadim Zeitlin
2efa26cc1f Merge branch 'gtk-log-suppress'
Allow suppressing GTK log messages.

See #22424.
2022-05-17 16:36:06 +02:00
Vadim Zeitlin
a058951259 Skip disabling the correct window when showing MSW modal dialogs
The fix of a5a5b1bb15 (Fix restoring focus after showing native modal
dialogs in wxMSW, 2022-04-07) wasn't quite correct as it used the parent
window specified when showing the dialog, but it should have been using
the effective dialog parent, i.e. owner window in MSW terms.

Fix this by passing GetParentForModalDialog() to wxWindowDisabler, which
ensures that the preserve the same behaviour as before, including
refreshing the owner window after the dialog as dismissed -- which turns
out to be important because some existing code relies on this happening,
see #22362.

This commit should hopefully fix the last regression after d311c705d7
(Make native dialogs application-modal in wxMSW, 2022-04-01) and still
solve the original problem (see #11887), while preserving the original
behaviour when there is just one top-level window.
2022-05-12 18:52:02 +01:00
Vadim Zeitlin
bffcb88266 Optionally detect not filtered GTK log messages
In the future it might be useful to run the code with WXTRACE=gtklog to
see if any GTK log messages we're filtering don't need to be filtered
any longer.
2022-05-12 16:13:19 +02:00
Vadim Zeitlin
8f49ecc3d0 Suppress bogus GTK messages when removing wxNotebook pages
These messages are due to an assertion failure deep inside ATK which
doesn't indicate any real problem (as failure to get the label of an
already destroyed tab is normal and is already handled correctly in the
GTK code) and can't be avoided, so suppress them to avoid showing them
to the users who can't do anything at all about them anyhow, but can be
scared by the "CRITICAL" GTK messages.

Closes #22176.
2022-05-12 16:13:19 +02:00
Vadim Zeitlin
4602caf49d Add LogFilterByMessage GTK log filter
This will allow suppressing GTK log messages with the specified
fixed contents.
2022-05-12 00:34:14 +02:00
Vadim Zeitlin
f137f19bb7 Factor out wxGTKImpl::LogFilter from GTKSuppressDiagnostics()
Refactor the code to separate setting of the log callback from the
filtering decision.

Right now the only existing filter is the one just checking the log
level, which is used by GTKSuppressDiagnostics(), but this will allow
adding other filters in the upcoming commits.
2022-05-12 00:25:08 +02:00
DietmarSchwertberger
2698dde445 Fix regression in wxGrid::DeleteRows()
Compare the row position with the number of rows, not columns, fixing a
regression introduced in 3719ab3725 (Add support for rearranging wxGrid
rows order interactively, 2022-04-02) (see #22260).

Closes #22420.

Closes #22423.
2022-05-11 23:33:44 +02:00
Vadim Zeitlin
df51ec8c40 Merge branch 'dvc-null-values'
Fix (not) showing values for empty cells in wxDVC using
wxDataViewVirtualListModel in wxGTK.

See #22409.
2022-05-11 16:42:43 +02:00
Antti Nietosvaara
7f32d9b752 Fix layout of wxFlexGridSizer containing wxWrapSizer
Fix a layout issue when wxFlexGridSizer contains items that return true
from InformFirstDirection(), such as wxWrapSizer.

If didAdjustMinSize == true, the minimum width has probably changed, and
we should recalculate it. Otherwise we end up using incorrect delta in
DoAdjustForGrowables, which might push items too far to the right.

Closes #22421.
2022-05-11 15:21:16 +01:00
Vadim Zeitlin
a7eee933c6 Merge branch 'tsan-warnings'
Fix a harmless warning from thread sanitizer and make wxAtomicInc() more
useful.

See #22417.
2022-05-11 02:37:26 +02:00
Vadim Zeitlin
bb52a5c5b5 Merge branch 'imaglist-mask'
Make handling of masks in wxImageList simpler and more useful.

See #22400.
2022-05-11 02:35:59 +02:00
Vadim Zeitlin
5a6adf4f58 Merge branch 'nanosvg-lib'
CMake: Support external NanoSVG library.

See #22407.
2022-05-11 02:33:38 +02:00
Vadim Zeitlin
cf841aa286 Fix build with WXWIN_COMPATIBILITY_2_8==1
This was broken by the changes of 6383bc39ff (Add convenient
wxDCImpl::CalcBoundingBox() overloads and use them, 2022-04-30), fix it
by calling the overloaded wxDCImpl::CalcBoundingBox() instead of the
wxDC version for which the overloads were not added.

Closes #22418.
2022-05-11 02:29:02 +02:00
Maarten Bent
138d1ab021 CMake: Support header-only NanoSVG library
Check if the NanoSVG target defines any library locations.
Add a private compile definition to wxcore, instead of adding another setup.h option.
2022-05-11 01:55:19 +02:00
Maarten Bent
603c13aaba CMake: Add support for external NanoSVG library 2022-05-11 01:54:03 +02:00
Vadim Zeitlin
fbeccb3954 Use wxAtomicInt for the global initialization counter
This is slightly more efficient and simpler than using a separate
critical section and can easily be done now that wxAtomicInc() returns
the new value.

No real changes.
2022-05-11 00:18:02 +02:00
Vadim Zeitlin
f4fb91b56e Don't keep critical section locked during wxEntryStart() call
Use gs_initData.csInit only to ensure that we call wxEntryStart() once
even if there are multiple calls to wxInitialize() from multiple
threads, but don't keep it locked for the duration of that function as
this is unnecessary and results in -- probably benign in practice, but
still annoying -- warnings from the thread sanitizer about lock order
inversions due to locking csInit first before locking gs_mutexGui in
wxThreadModule::OnInit() and then acquiring csInit again while
gs_mutexGui is still locked in wxUninitialize().

This shouldn't result in any observable changes in behaviour.
2022-05-10 23:26:45 +02:00