Commit Graph

68693 Commits

Author SHA1 Message Date
Vadim Zeitlin
a400a380f2 Add wxGrid::DoEnableCellEditControl() with bool return value
Checking the new function return value is simpler than checking the
value of m_cellEditCtrlEnabled after calling EnableCellEditControl().

Do this now also when starting editing using the mouse, as it was simply
forgotten before and so StartingClick() was still called even if editing
was vetoed.

Also add DoDisableCellEditControl(), but this one exists purely for the
symmetry.
2020-06-28 01:47:06 +02:00
Vadim Zeitlin
2d9112bd9b Add DoHideCellEditControl() for symmetry
This also allows to reset m_cellEditCtrlEnabled earlier, as we don't
have to keep it true for the duration of HideCellEditControl()
execution.

No real changes, as with the previous commit, this one is best viewed
ignoring whitespace changes.
2020-06-28 00:40:09 +02:00
Vadim Zeitlin
c73634c520 Add DoShowCellEditControl() showing the editor unconditionally
It doesn't make sense to perform the checks in ShowCellEditControl()
when it's called from EnableCellEditControl() and this makes the code
unnecessarily fragile as m_cellEditCtrlEnabled needs to be set at just
the right moment for it to work correctly.

Call the new DoShowCellEditControl() instead and perform the checks only
in the public function, for compatibility.

Also note in a comment and the documentation that ShowCellEditControl()
is not very useful anyhow and that EnableCellEditControl() should most
often be used instead.

No real changes (the commit is best viewed ignoring whitespace changes).
2020-06-28 00:30:57 +02:00
Vadim Zeitlin
181747f462 Remove useless IsCellEditControlEnabled() checks
There is no need to do this before calling DisableCellEditControl() as
it won't do anything if the cell edit control is already disabled.
2020-06-28 00:21:23 +02:00
Vadim Zeitlin
c14008f287 Add file allowing to always ignore some commits with git-blame
Skip some commits that don't introduce any interesting changes when
running git-blame, as we never really care about them.
2020-06-28 00:11:53 +02:00
Vadim Zeitlin
63643eb122 Fix typo in wxGrid::EnableCellEditControl() documentation
Just s/show/shown/
2020-06-28 00:02:43 +02:00
Vadim Zeitlin
45bc2e648b Remove check for read only cells from IsCellEditControlEnabled()
This check was introduced back in 283b7808d8 (added support for readonly
cells and 3d border drawing, 2000-02-16), but was wrong even then and
remained wrong ever since: we must not set m_cellEditCtrlEnabled to true
when the current cell is read-only, so there is no need to check for the
latter condition if m_cellEditCtrlEnabled is indeed true.

Ensure that we really never erroneously set m_cellEditCtrlEnabled for
the read-only cells by replacing an wxASSERT_MSG checking for this in
EnableCellEditControl() with wxCHECK_RET().

Also explicitly document this function precondition, also added back in
b54ba67107 ([...] added CanEnableCellControl() and use it before calling
EnableEC, 2000-02-17) but never documented so far.
2020-06-28 00:02:29 +02:00
Vadim Zeitlin
1a330bb43e Remove apparently useless call to ShowCellEditControl()
This code seems to have been there ever since da6af900f1 (Added
drag-shrinking, 2000-02-04), but while it probably made sense back then,
it lost its purpose a long time ago as the cell editor is now not only
hidden, but also disabled when drag-resizing starts, so it doesn't make
sense to attempt showing it back when the mouse button is released: it's
never going to do anything (and didn't).

Just remove this code, as hiding the editor while drag-resizing is not
the behaviour we want from the UI point of view anyhow. And, again,
removing it doesn't actually change anything in the current version of
the code.
2020-06-27 23:34:11 +02:00
Vadim Zeitlin
fca9460522 Fix typo in wxWebViewEdgeImpl::Uninitialize() name
As this is a private header, we can fix this without any compatibility
concerns.

Thanks codespell for finding it.
2020-06-27 22:56:22 +02:00
Vadim Zeitlin
d7f19ee610 Fix spelling in comments and documentation using codespell
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*
2020-06-27 22:56:22 +02:00
Vadim Zeitlin
4b1f057d74 Factor out DoAcceptCellEditControl() into a separate function
This allows to fold the last DoSaveEditControlValue() call into this
function, so that it's only called from DoAcceptCellEditControl() or
from SaveEditControlValue() (which is public, and hence can't be
changed, even if its behaviour doesn't make much sense).

This commit means that m_cellEditCtrlEnabled is now reset to false when
AcceptCellEditControlIfShown() is called, which was not the case before,
but this seems to make sense, as we shouldn't be just hiding the editor
while leaving it enabled, and, also, doesn't really seem to change
anything as hiding the editor indirectly results in a call to
DisableCellEditControl(), via wxGrid::OnHideEditor(), and so it was
actually already reset before -- but now this happens slightly earlier
and more explicitly.
2020-06-27 17:13:04 +02:00
Vadim Zeitlin
3a874471c3 Add helper AcceptCellEditControlIfShown() function
This is just another refactoring in order to avoid duplicating calls to
HideCellEditControl() and SaveEditControlValue() in several different
places.

Also call DoSaveEditControlValue() because if the editor is shown, it is
also necessarily enabled and there is no need to check for this.
2020-06-27 16:57:40 +02:00
Vadim Zeitlin
0fb153a2bd Use ProcessWindowEvent() in wxGrid code
No real changes, just replace multiple calls to ProcessEvent() on
GetEventHandler() with a simpler call to ProcessWindowEvent().
2020-06-27 16:46:52 +02:00
Vadim Zeitlin
2a368fec9f Document that using wxClientDC for drawing is not portable
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.
2020-06-27 16:37:48 +02:00
Vadim Zeitlin
ed0f58c2dd Add helper wxGrid::GetCurrentCellEditorPtr() and use it
No real changes, just simplify the code by using a single function to
retrieve the editor to use for the current cell.

This also allows to get rid of a few temporary variables, further
amplifying the simplification.
2020-06-27 16:00:02 +02:00
Vadim Zeitlin
d5e568c2d9 Merge branch 'stc-tech-fix'
Fix size and position of STC popups when using DirectWrite.

See https://github.com/wxWidgets/wxWidgets/pull/1906
2020-06-27 13:51:36 +02:00
Vadim Zeitlin
3bd832b2f3 Add comment after closing "#endif" for clarify
No real changes.
2020-06-27 13:51:01 +02:00
Vadim Zeitlin
8129b38ee4 Remove unnecessary pointer check before deleting it
No real changes.
2020-06-27 13:50:59 +02:00
Vadim Zeitlin
b7e7bb763a Fix rare crash when using native header in wxGrid under MSW
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.
2020-06-27 01:42:57 +02:00
Hertatijanto Hartono
04f4ac32b1 Remove inconsistencies and updates to Indonesian translation
Closes https://github.com/wxWidgets/wxWidgets/pull/1907
2020-06-26 22:22:26 +02:00
Vadim Zeitlin
1905f60b2d Merge branch 'grid-enhance'
Many enhancement to wxGrid UI: fix redraw and (some) flicker bugs; fix
bugs with mouse handling; improve editors positioning etc.

See https://github.com/wxWidgets/wxWidgets/pull/1902
2020-06-26 22:20:41 +02:00
Vadim Zeitlin
f5647828d0 Respect cell alignment when positioning the editors
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.
2020-06-26 22:19:49 +02:00
Vadim Zeitlin
4b9161f546 Make header cells of numeric columns read only in the sample
This avoid asserts when trying to edit them, as the corresponding
editors expect the cell to have a numeric value.
2020-06-26 22:19:49 +02:00
Vadim Zeitlin
c4fef08d39 Disallow resizing rows by dragging cell corners if disabled
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.
2020-06-26 22:19:49 +02:00
Vadim Zeitlin
7e79925fb7 Do erase background even in wxGridCellTextEditor
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.
2020-06-26 22:19:49 +02:00
Vadim Zeitlin
32edcde5bd Remove unused wxGridCellChoiceEditor::PaintBackground() override
This overridden method didn't do anything except calling the base class
version, so just remove it.
2020-06-26 22:19:49 +02:00
Vadim Zeitlin
dddcdf62df Don't expand wxChoice-based grid editor vertically
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.
2020-06-26 22:19:49 +02:00
Vadim Zeitlin
a204981d74 Add a test of wxSpinCtrl-based editor to the grid sample
Just show an example of wxGridCellNumberEditor with range limits in
action to make testing it simpler.
2020-06-26 22:19:49 +02:00
Vadim Zeitlin
6fb85af1f3 Simplify centering wxGridCellNumberEditor vertically
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.
2020-06-26 22:19:49 +02:00
New Pagodi
74332e9132 Add comments for wxSTCListBoxD2D and its methods 2020-06-26 14:40:17 -05:00
New Pagodi
7f78e97021 Use ellipsis char not 3 periods to shorten label 2020-06-26 14:11:39 -05:00
New Pagodi
71fdad5f6d Prevent warning in wxSTCListBoxWin ctr
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.
2020-06-26 14:06:32 -05:00
Vadim Zeitlin
f66199222e Remove obsolete code using sleep() in wxMicroSleep() for BeOS
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.
2020-06-26 18:49:32 +02:00
New Pagodi
01b3bf7eef Remove double strlen call in wxSTCListBoxD2D
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.
2020-06-25 21:45:04 -05:00
New Pagodi
a3a6938673 Add other changes requested in comments for PR 1906 2020-06-25 21:41:33 -05:00
New Pagodi
0a6eea9bb5 Remove duplicate code in wxSTCListBox::OnDrawItem
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.
2020-06-25 20:49:50 -05:00
Maarten Bent
f49f899856 Move wxSTC DirectDraw specific code to derived class 2020-06-25 20:13:29 -05:00
New Pagodi
24fad36d0c Add changes requested in comments for PR 1906 2020-06-25 17:15:24 -05:00
Stefan Csomor
31581c0f41 supporting native large control sizes 2020-06-25 16:12:55 +02:00
Stefan Csomor
80610cb383 switching from AvailabilityMacros.h to Availability.h
The old version is not updated for 10.16 therefore switch to the ‚newer‘ version - that existed since 10.6 - starting with double underscores
2020-06-25 15:59:53 +02:00
Stefan Csomor
c7f6feadfd proper delayed release fix for 10.16 2020-06-25 11:20:39 +02:00
Stefan Csomor
5e687861c1 make app schemes shared 2020-06-25 09:46:18 +02:00
Stefan Csomor
90c4a9ea0e changing Xcode target names
otherwise ‚dynamic‘ and ‚static‘ were existing both in the app and in the library project, leading to problems with newer Xcode versions
2020-06-25 09:08:15 +02:00
Maarten Bent
b912dc380a Fix the DPI in wxSTC IME window
This same modification was made to the Scintilla/SciTE source.
2020-06-24 17:25:19 -05:00
New Pagodi
4e3e264228 Fix size of stc autocomp popup with Direct2D
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.
2020-06-24 17:24:43 -05:00
New Pagodi
c11582320d Fix location of stc autocomp popup with images
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.
2020-06-24 17:23:28 -05:00
Hertatijanto Hartono
8ff434c2a5 Fix typo in settings.h and wxListCtrl Class Reference
Consistently use "colour" spelling.

Closes https://github.com/wxWidgets/wxWidgets/pull/1903
2020-06-23 01:35:54 +02:00
tellowkrinkle
9278c3e01c Round frame sizes up, not down in wxOSX
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
2020-06-23 01:34:54 +02:00
Ian McInerney
4ac648901d Don't allow using GetPath/GetFilename() with wxFD_MULTIPLE
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
2020-06-22 14:04:10 +02:00
Vadim Zeitlin
f80ff6f459 Tweak width of the date editor
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.
2020-06-22 02:44:58 +02:00