Skip correction for the under/overhang for non-italic fonts: it seems to
be pretty small for them and avoiding the calls to ::GetCharABCWidths()
makes GetTextExtent() 7-8 times faster, which seems to be a worthwhile
compensation.
If we decide to restore these calls in the future, we will need to
implement some kind of cache for them, as they're just too slow
otherwise.
Handle the case of a single line string specially, it's faster to do
this than use slow loop over all characters.
Also avoid constructing the string with the characters to measure one by
one and do it all at once instead.
Add a possibility to benchmark GetMultiLineTextExtent() rather than
GetTextExtent() in the graphics benchmark.
There is no need to reimplement the same logic in wxGrid code when we
already have a perfectly cromulent way to do it in wxDC itself (which
hadn't existed when this code was originally written, explaining why it
wasn't used here before).
This makes the code shorter and also a bit faster, as we avoid using
wxStringTokenizer unnecessarily.
No changes in behaviour.
This completes the changes of f730da3c14 (Add imm32.lib to
wxStyledTextCtrl, 2020-05-10) that didn't take care of MSW makefiles,
that need to contain the new required library as well.
Closes#18788.
Extend wxAnimationCtrl XRC handler to cover wxGenericAnimationCtrl too.
Also fix a bug with wxGenericAnimationCtrl inactive bitmap background.
See https://github.com/wxWidgets/wxWidgets/pull/1889
Fix and improve DPI handling in wxStyledTextCtrl.
Fix cursor size after DPI change.
Enable handling DPI events in wxSTCPopupWindow and other popup windows
(that do not inherit from wxTopLevelWindow).
Some cleanup of STC example, and add option to select drawing
technology.
See https://github.com/wxWidgets/wxWidgets/pull/1885
This function basically only exists in order to be used in this handler,
so extend it to allow doing it by adding wxAnimationCtrlBase argument to
it, allowing it to create wxAnimation object compatible with the given
control.
This reduces code duplication and, incidentally, makes GetAnimation()
more useful for any user-defined XRC handlers.
It contained a single function which can be defined in xh_animatctrl.cpp
instead as it's only used there anyhow, and this file has no more reason
to exist, as "adv" library itself doesn't exist any longer.
This allows to write code using this function without any preprocessor
checks.
It should arguably be added to wxBitmapBase to ensure that it's
available in all ports, but should be done together with UseAlpha(),
which is not quite trivial, so leave it for later.
This is consistent with the current behaviour of GetSizeFromTextSize()
and the behaviour of GetBestSize() before the changes in this branch.
This is still not consistent with the behaviour of the other ports, but
this will be addressed later, by replacing the currently hardcoded 5.
Note that calling usedRectForTextContainer: here was apparently wrong in
any case because we were not sure to have already performed a layout and
we should have had a call to ensureLayoutForTextContainer: before it to
make it actually work. However, this made it work "too well" because it
then correctly returned potentially very big sizes for the text controls
containing a lot of text, which is not what we need here, as explained
in the comment added by this commit.
This could easily result in infinite recursion, as it is very natural to
implement DoGetBestSize() in terms of GetSizeFromTextSize() and, in
fact, our own implementation of the generic wxSpinCtrl did exactly this.
Avoid such problems by only calling GetSizeFromTextSize() from
DoGetBestSize(), but not in the other direction.
This shouldn't have any effect on the returned size values.
This reverts the changes of 63bcc669d8 (fixing setting initial value
under osx_cocoa for single line text controls, 2009-10-01) and fixes the
problem which this commit probably tried to fix in a different way,
using the same approach as in 98f5315405 (Don't set initial label in
wxNativeWindow on OS X, 2016-04-29) as the real root of the problem was
that the text set in CreateTextControl() was overwritten later when the
label was set from SetPeer().
This change means that the text is now set correctly before SetPeer()
calls SetInitialSize() call, which makes it possible to set the correct
initial size based on the initial text, as will be done in later
commits.
It also makes Cocoa port more consistent with iOS one, as a nice side
effect.
Mention that RecalcSizes() shouldn't be called any more, after the
changes of 622deec262 (Replace wxSizer::RecalcSizes() with
RepositionChildren(), 2015-10-11), and that RepositionChildren()
replacing it shouldn't be directly called neither.
The old version resulted in
error: this condition has identical branches [-Werror=duplicated-branches]
| (dlg ? typeid(*dlg) : typeid(T)).name());
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
from gcc 10 when compiling with -O2.
Change the code to avoid using this condition entirely: not only this
avoids the warning, but it also makes it unnecessary to make
wxGetDialogClassDescription() function a template, so should result in
slightly faster compilation and smaller code size too.
No real changes.
The correct condition for adding the extra border to the buttons that
would be clipped without it due to the bezel style used for them is to
check that their height is < 20, as SetBezelStyleFromBorderFlags(),
which determines the bezel to use, does, and not if their width is 16,
as this is not the same thing, especially for non-square buttons.
Closes https://github.com/wxWidgets/wxWidgets/pull/1887
It's not really clear why do we have this function at all, but
SetMinSize() name is more clear and consistent with wxWindow, so prefer
using it instead.
This function explicitly accepts ASCII strings only, so it's limited to
"const char*", but was incorrectly documented as taking wxString.
Closes https://github.com/wxWidgets/wxWidgets/pull/1879
After a DPI change, the position of the popup is wrong. It is not shown at the
cursor position anymore.
The correct size and position are calculated by scintilla, and there is no easy
way to access this without modifying scintilla sources.
This way, other windows (like wxPopupWindow) will also be able to handle DPI events.
Override InheritAttributes() and use it to set the initial DPI values.
wxSYS_ANSI_FIXED_FONT uses 'Courier' font, which is rendered small on high DPI displays.
Use wxFONTFAMILY_TELETYPE instead, which will use font 'Courier New'.
Adjusting the zoom level does not work correctly. It could lead to ever
increasing zoom.
Instead, set the correct DPI of the underlying device context.