Commit Graph

67914 Commits

Author SHA1 Message Date
Artur Wieczorek
1dc0c777ae Return value of the proper type
Returned value should be the same type like the memeber variable.
2020-04-05 22:06:00 +02:00
Artur Wieczorek
810c1be640 Use GdiPlus::Status enum to represent status of GDI+ operation 2020-04-05 21:55:46 +02:00
Artur Wieczorek
f0e458e25c Get font family of private GDI+ font from the cache
When font family of a private font is retrieved with call to
Gdiplus::Font::GetFamily() then later on there is thrown access violation
exception when array of cached private font families (filled in by
Gdiplus::PrivateFontCollection::GetFamilies()) is deleted in
wxGDIPlusRenderer::Unload(). Call to Font::GetFamily() is done in
wxGDIPlusContext::GetTextExtent() so this issue can be seen once text
extent is retrieved for a private font.
Because it looks that calling to Font::GetFamily() for a private font is
messing up something in the array of cached private font families so
we should avoid calling this method and directly fetch corresponding font
family from the cache instead.
Reference to the cached font family would be stored in
the wxGDIPlusDataFont and it could be fetched from there directly instead
of making a call to Font::GetFamily().

Closes #18704.
2020-04-05 21:14:24 +02:00
Vadim Zeitlin
43b3a3fc5b Merge branch 'grid-hidpi'
wxGrid improvements for high DPI and DPI changes

See https://github.com/wxWidgets/wxWidgets/pull/1776
2020-04-04 18:46:54 +02:00
Vadim Zeitlin
28a9f50bc7 Merge branch 'grid-align-overflow'
Fix overflow in wxGrid cells with non-default alignment.

See https://github.com/wxWidgets/wxWidgets/pull/1775
2020-04-04 18:46:18 +02:00
Artur Wieczorek
372a609e82 Use ellipsis character instead of "..." approximation
This way editor button label will be shorter.
2020-04-04 18:07:46 +02:00
Artur Wieczorek
c7b789d351 Increase wxPropertyGrid line height under wxGTK3
Line height calculation based on the font size is not right for wxGTK3
because native buttons (used as in-line editor buttons) don't scale down
well and they are not displayed properly within the line.
Minimal button size when the label is displayed properly is 35 so this
has to be minimal line height under wxGTK3.

Closes #18715.
2020-04-04 18:02:40 +02:00
Artur Wieczorek
a3cbcc2c6c Fix positioning the buttons in wxPGMultiButton
For the sake of consistency with editor buttons created with
wxPropertyGrid::GenerateEditorButton(), the borders around the buttons
should be taken into account while positioning the buttons
in wxPGMultiButton.
2020-04-04 17:41:46 +02:00
Vadim Zeitlin
c90bb2596a Upgrade libjpeg to the latest 9d version
This library version includes some optimizations as well as security
fixes.
2020-04-04 00:46:40 +02:00
Vadim Zeitlin
0f2fe27e04 Add more top-level references to XRC
Try to make XRC existence more discoverable.
2020-04-03 14:58:51 +02:00
Vadim Zeitlin
7c6da45663 Document change in wxGTK wxTextCtrl creation behaviour
It now doesn't send any events, which is correct, but different from the
behaviour in the previous wx versions.
2020-04-02 09:10:36 -07:00
Vadim Zeitlin
b4eb5438a4 Add a unit test for wxTextCtrl event generation on creation
Check that creating a wxTextCtrl doesn't generate any events to verify
that this problem doesn't exist in other ports, after fixing it in
wxGTK in 3e7e7dd24c (Avoid generating wxEVT_TEXT when wxTextCtrl initial
value is not empty, 2020-04-01).
2020-04-02 09:10:36 -07:00
Paul Cornett
6240ecf153 Fix virtual call of Destroy() in wxDocChildFrameAny
Allow derived class override to be called.
See #18694
2020-04-02 09:03:35 -07:00
Vadim Zeitlin
a40ead0ccf Remove unnecessary Refresh() from wxGrid::OnDPIChanged()
The entire TLW is already refreshed when the DPI changes, so it's
unnecessary to refresh wxGrid window itself.
2020-04-01 23:43:17 +02:00
Vadim Zeitlin
9463415998 Fix check mark size in wxGrid after DPI change
Moving wxGrid window to a monitor with different DPI now correctly
changes the check mark size as expected.
2020-04-01 22:39:45 +02:00
Vadim Zeitlin
d41d159576 Replace wxGridCellBoolRenderer::ms_sizeCheckMark with a local var
This variable is (now) only used in a single function, so there is no
reason to declare it as a class member.

No real changes.
2020-04-01 22:33:02 +02:00
Paul Cornett
3e7e7dd24c Avoid generating wxEVT_TEXT when wxTextCtrl initial value is not empty
See #18714
2020-04-01 10:23:44 -07:00
NancyLi1013
d781764d6d Add vcpkg installation instructions for wxMSW
Closes https://github.com/wxWidgets/wxWidgets/pull/1777
2020-04-01 13:24:24 +02:00
Vadim Zeitlin
f2923d49e1 Update native wxGrid header on DPI change
Simply resize all columns to their effective widths when using native
wxHeaderCtrl for the grid.
2020-04-01 01:08:41 +02:00
Vadim Zeitlin
5525e0ed3f Update grid row/column sizes when switching DPI
Because the size of the text (usually) shown in the grid changes, the
size of its columns/rows should change as well when DPI changes. Scale
them by the DPI ratio if necessary, i.e. if any of them were set to
non-default values to achieve this.

Note that this is not ideal because it can result in rounding errors and
hence in slight change of row/column size when moving the grid window to
another display with a different DPI and then back, but to prevent this
from happening we'd need to store the column/rows sizes in DIPs inside
wxGrid and convert them to actual physical pixels everywhere, which
would require much more changes. Still, if the round trip problems turn
out to be a real problem in practice, we probably will need to do this.

Also note that this doesn't take care of the grid with a native header,
but this will be addressed by upcoming commits.
2020-04-01 00:58:59 +02:00
Vadim Zeitlin
5e761ad99f Add minimal DPI change handler to wxGrid
This handler redoes wxGrid layout and refreshes it to at least avoid
ugly display artifacts when moving wxGrid window between displays with
different DPI.
2020-04-01 00:46:39 +02:00
Vadim Zeitlin
393f5c8e2b Use less arbitrary column/row sizes in the grid sample
Base the sizes on the default column/row size instead of just hardcoding
pixel, or even DIP, values.
2020-03-31 19:38:18 +02:00
Vadim Zeitlin
f48c3f1e83 Sprinkle grid sample with FromDIP() to improve its appearance
Make frame sizes and column/row sizes more appropriate for high DPI
displays.
2020-03-31 19:38:18 +02:00
Vadim Zeitlin
104733550e Use wxGridCellAttrPtr typedef
No real changes, just make the code slightly shorter.
2020-03-31 19:37:39 +02:00
Vadim Zeitlin
ca30169767 Restore overflowing for cells with non-default vertical alignment
Since the changes in a40acbb28e (Add CanOverflow function to
wxGridCellAttr, 2020-02-06), cells with non-default vertical alignment
didn't overflow any more, even if their horizontal alignment was
unchanged and still defaulted to left-aligned.

This was due to assuming that if the alignment of wxGridCellAttr itself
was different from wxALIGN_LEFT, it meant that it wasn't left-aligned,
which seems logical but is in fact false, as the alignment can also be
wxALIGN_INVALID, in which case the real alignment is taken from the
default grid attribute.

Fix this by using GetNonDefaultAlignment() to get the alignment value
effectively used and add a unit test, as well as an example in the
sample, showing that this now works correctly.
2020-03-31 19:32:47 +02:00
Vadim Zeitlin
5834bef2f7 Fix memory leaks in wxGrid unit tests
Use smart pointers to ensure that various objects are released, as they
have to be.
2020-03-31 19:32:47 +02:00
Vadim Zeitlin
59ad458d39 Scale default wxGrid constants by DPI
In particular, this makes default column width better suited for high
DPI displays, as it was too narrow before.

Also mark a couple of obsolete constants as such with a comment.
2020-03-31 14:48:54 +02:00
Vadim Zeitlin
06af121e9c Add wxObjectDataPtr::release()
This makes it possible to use wxObjectDataPtr inside functions returning
raw pointers owned by the caller, such as custom GetAttr() in the grid
sample.
2020-03-31 02:57:01 +02:00
Vadim Zeitlin
15b5a1865c Add a simple wxGrid::AssignTable() wrapper for SetTable()
In many case SetTable() is called with its takeOwnership parameter set
to true, as shown by the grid sample in which all 3 of the calls to
SetTable() set it to true, but calling it in this case is awkward, as
bare "true" in the caller is unreadable and almost invariably requires
an explanatory comment.

Improve the API by adding AssignTable(), which is the same to SetTable()
as the existing AssignImageList() to SetImageLabel(), which always takes
ownership of the table pointer.
2020-03-31 02:43:08 +02:00
Vadim Zeitlin
3674240146 Add missing wx/scopedptr.h in wxMSW wxFileDialog code
This file uses wxScopedPtr<> and so needs to include this header
explicitly instead of relying on it being included indirectly from some
other header, as happens in the default build, but not always.

Closes #18711.
2020-03-30 23:10:13 +02:00
Vadim Zeitlin
6c061b6bf9 Fix compilation of spinctrlcmn.cpp when wxUSE_SPINCTRL==0
Don't include wx/private/spinctrl.h header (nor the other ones) at all
in this case, as it doesn't compile in this build configuration.

This fixes one of build problems under iOS.

See https://github.com/wxWidgets/wxWidgets/pull/1773
2020-03-30 15:26:00 +02:00
Vadim Zeitlin
00f6cfec51 Fix wxUniv build with wxNO_RTTI
ForceUpperFunctor must have a default ctor when wxNO_RTTI is on, i.e.
when wxRTTI is used.

Closes #18707.
2020-03-30 00:57:16 +02:00
Vadim Zeitlin
c6a4cc80fe Merge branch 'pmdpi-build' of git://github.com/MaartenBent/wxWidgets
Improve DPI aware builds with .vc and .vcproj files.

See https://github.com/wxWidgets/wxWidgets/pull/1769
2020-03-28 14:10:17 +01:00
Maarten Bent
343bd89b63 Rebake after changes 2020-03-27 23:15:03 +01:00
Maarten Bent
3978733a37 CMake: Enable DPI awareness options for demos 2020-03-27 23:11:00 +01:00
Maarten Bent
820234340f Remove unnecessary arguments for nmake in AppVeyor script 2020-03-27 23:11:00 +01:00
Maarten Bent
f1a017539a Generate an error when the CPU parameter is not specified and cannot be determined
See #18640
2020-03-27 23:11:00 +01:00
Maarten Bent
284b25ce02 Automatically detect if target architecture is x64 in .vc file
This allows a successful build even if the user omits specifying CPU=X64.

See #18640
2020-03-27 23:11:00 +01:00
Maarten Bent
3c53fbb94b Add DPI manifest only for MSVS 2015 and later in .vc file
Prevent errors and warnings when embedding the manifest.

Check if environment variable VISUALSTUDIOVERSION (set by VS developer command
prompt) is 14.0, 15.0 or 16.0.

See #18665
2020-03-27 23:10:56 +01:00
Vadim Zeitlin
42c9375c14 Merge branch 'drawing-lines'
Fix drawing of dotted/hatched lines in wxMSW and some drawing sample
improvements.

Closes #7097.

See https://github.com/wxWidgets/wxWidgets/pull/1771
2020-03-27 20:22:17 +01:00
Anton Triest
53d51105be Fix drawing of non-solid lines with width 0 using wxDC in wxMSW
::ExtCreatePen() doesn't allow the pen width to be 0, unlike
::CreatePen() and failed to create the brush in this case.

Use width of 1 to draw e.g. hatched lines of width 0 correctly.

See #7097.
2020-03-27 12:02:36 +01:00
Anton Triest
d245dc9e1f Fix drawing of dotted lines with wxDC in wxMSW
Use ::ExtCreatePen() for creating pens for such lines, as it results in
much better appearance for them than ::CreatePen(), which draws dashed,
and not dotted, lines in this case.

See #7097.
2020-03-27 11:59:10 +01:00
Vadim Zeitlin
bb489418b0 Number renderers using consecutive digits in the sample
This has the disadvantage of not using the same accelerators in
different wxWidgets builds, but the advantage of appearing logical to a
casual user when running the sample, while having "0, 1, 3, 4" sequence
was surprising.

Alternatively, we could always add all menu items, but disable the ones
that are not available in the current build. It could be surprising to
see "GDI+" under non-MSW systems too though.
2020-03-27 11:51:56 +01:00
Vadim Zeitlin
e7c8039d13 Simplify renderer selection in the drawing sample
Make "Use default wxGraphicsContext" part of the renderer selection
radio group and put it in correct order, as having "1, 0, 3, 4"
accelerators order in the menu was really surprising.

Remove wxEVT_UPDATE_UI handlers as they complicated things in the sample
code (which is supposed to be simple, after all) without much benefit
and arguably even added to the confusion during run-time as menu items
could both be manually selected and checked automatically.
2020-03-27 11:43:19 +01:00
Vadim Zeitlin
62bb47cfdb Use white background for drawing lines in the drawing sample
This makes the display more readable, black on red was really not ideal.

No real changes.
2020-03-27 11:39:03 +01:00
Scott Talbert
8886f47ee4 Update GPL and LGPL license texts to the latest versions
This corrects the outdated FSF address and reformats the text slightly.

References:
https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
https://www.gnu.org/licenses/old-licenses/lgpl-2.0.txt
2020-03-26 19:50:13 -04:00
Maarten Bent
5767a906eb Disable embedding manifest via linker in .vcproj files
This causes errors (<=2010) and warnings (<=2012) with older VS versions.

See #18665
2020-03-26 22:51:38 +01:00
Robin Dunn
501e55f949 Add missing wxMemoryDC::GetSelectedBitmap 2020-03-23 20:17:22 -07:00
Vadim Zeitlin
eb0b4af073 Merge branch 'travis-test-fail'
Run "make failtest" in Travis CI builds.

See https://github.com/wxWidgets/wxWidgets/pull/1767
2020-03-24 03:24:00 +01:00
Vadim Zeitlin
ebb6f89e13 Fix wxMSW build error with wxUSE_UXTHEME==0
Explicitly include <commctrl.h> instead of relying on it being done
implicitly by wx/msw/uxtheme.h, as this doesn't happen when
wxUSE_UXTHEME is 0.

Closes #18702.
2020-03-24 03:22:13 +01:00