It ended up returning the result of the base class method anyhow, just
after doing a lot of unnecessary work, so this commit shouldn't change
anything, but should significantly speed up this function.
We may want to explore the possibility of implementing this method
natively using GetPeer()->IsVisible() later, as it could be faster than
our own implementation, but we need to ensure that this always returns
the same result as before, which might not be the case when the TLW is
in the process of being shown or hidden, so don't do this for now.
Closes https://github.com/wxWidgets/wxWidgets/pull/1911Closes#18645.
Don't use NSLayoutManager lineFragmentRectForGlyphAtIndex:effectiveRange
when NSTextView is empty, as this result in debug error messages.
Fall back to using the font height in this case instead, as this seems
to be the only thing to do in this case.
Closes#18793.
Apply the utility from https://github.com/codespell-project/codespell/
to fix spelling issues in the headers under both include and interface
directories and add a file with a couple of exceptions.
The exact command line used was:
$ codespell -w -I misc/scripts/codespell.ignore -i 3 in*
We can't make wxClientDC work on the platforms not supporting drawing
outside of wxEVT_PAINT handler, but at least document that this doesn't
work.
Also add an example of using this class for the purpose for which it
still works (measuring) and remove references to it and wxWindowDC from
wxPaintDC documentation as we don't want to encourage people using it.
See #17820.
Pressing Esc while double clicking on the column separator in the native
header in wxGrid could result in a crash due to using invalid index when
calling GetColLeft(m_dragRowOrCol) in GetPositionForResizeEvent() called
from DoHeaderEndDragResizeCol() because m_dragRowOrCol had been already
reset to -1.
Guard against the crash with a check in GetPositionForResizeEvent()
itself and also add a check to DoHeaderDragResizeCol() to avoid calling
the former function in this case.
Reproducing the original problem is relatively simple as it's enough to
just keep double clicking a column separator while also pressing Esc,
but catching it under debugger is much more complicated and so it's not
really clear how exactly does this happen, but tracing shows that the
native control just decides to generate two HDN_ENDTRACK messages
without any intervening HDN_BEGINTRACK, so it doesn't seem like we can
do anything else than just silently ignore the unwanted HDN_ENDTRACK, as
it's done in this commit.
Define the common logic for positioning editors not taking the entire
cell area (i.e. basically anything other than wxGridCellTextEditor) in
the new DoPositionEditor() function.
Also use the cell and editor alignment to decide where to position the
control if it's smaller than the cell, as it looks better if e.g.
wxGridCellDateEditor appears near the place where the date is displayed
instead of being centered in the middle of a wide column.
Even when resizing rows by dragging their edges was disabled via
DisableDragRowSize(), it was still possible to try to resize them when
the mouse was over the cell corner.
Fix this and remove the special case for the corners entirely, it's not
necessary as the existing cases cover this one already.
Just rearrange them in the right order to prefer column resizing, as
this seems to be a much more commonly used operation than row resizing.
It is necessary to do it since the switch to double buffering wxGrid
painting in ebbadae09a (Double buffer wxGridWindow drawing, 2020-01-28)
as even a "full cell" editor such as wxGridCellTextEditor still doesn't
fill the entire cell, as there are margins around it, and the backing
bitmap could keep whatever junk happened to be there if we didn't erase
it, so do erase it now.
Remove the code doing the same thing from ShowCellEditControl(),
however, as it's redundant and doesn't do anything except creating some
flicker, and also doesn't work on the platforms not supporting the use
of wxClientDC anyhow.
This just looks very strange if the row has much bigger height than
default and it already isn't done for other editors, e.g. those using
wxSpinCtrl or wxDatePickerCtrl, for the same reason, so this is also
more consistent.
There is no need to check that the rectangle fits as it's done by wxGrid
itself, so just use a single wxRect::CenterIn() call instead of several
lines doing it manually.
No real changes.
Currently 1 argument for the constructor is only used in an #ifdef
block, and so some compilers give an unused parameter warning. Instead
use the parameter with a switch statement to avoid the warning.
This code never worked (as proved by the conversion in it which was
wrong by a factor of 1e12) and should never be needed anyhow.
Simplify configure and give an error, not warning, if neither
nanosleep() nor usleep() are available, as otherwise we'd just get a
build error later when compiling utilsunx.cpp later.
The length of a string in wxSTCListBoxD2D::OnDrawItemText was being
calculated twice - first when measured and again when drawn. Instead
store the length the first time it is calculated. Also, pass a copy of
the string in wx2stclen to allow the calculation to work in ASCII
builds.
To remove code duplication in the OnDrawItem in wxSTCListBox and
wxSTCListBoxD2D, move the code for drawing just the text to a new
virtual method named OnDrawItemText. Then have the OnDrawItem method
call the new function.
Due to a confusion between DIPs and Pts, the stc autocomp window was
a little larger than it should have been when Direct2D was used.
Instead use the methods defined in SurfaceD2D so the popup will be
measured and drawn the same way the main editor window is.
The stc autocomp popup is supposed to report the location at which text
is drawn with the wxSTCListBox::CaretFromEdge function. To return the
correct value, the popup needs to compute the largest width of any
bitmap used for icons in the popup since text is drawn to the right of
the popup's images.
Previously the wxSTCListBox tried to compute this largest width when
the listbox items were set. However, Scintilla actually calls
CaretFromEdge before setting the listbox items. Consequently the
CaretFromEdge was returning a value that assumed zero width for the
list's images since images had not been set yet.
Instead, keep a running tally of the widest image width when images are
registered. This means that this variable must be moved to the
wxSTCListBoxVisualData class since that is where image registration is
handled. Also track the largest image height since that is also needed.
On Retina display macs, those values can contain halves. If you round
them down, you end up cutting off content (e.g. cutting off the last
letter in a text label).
Closes https://github.com/wxWidgets/wxWidgets/pull/1905
GetPaths/GetFilenames() must be used instead when more than one file
could be selected: document this and assert if the wrong functions are
called.
Closes https://github.com/wxWidgets/wxWidgets/pull/1883
Don't make it larger than 150% than its normal width and also don't make
it larger than its normal width at all if it's not going to be large
enough to cover the entire cell anyhow -- this just looks strange, as
the editor is both too wide and not wide enough.