Commit Graph

39762 Commits

Author SHA1 Message Date
Vadim Zeitlin
97924a3b81 Use internalYToRow() instead of YToRow(true)
No real changes, just be consistent: as we have internalYToRow() macro
which passes true as "clipToMinMax" YToRow() parameter instead of the
default false, use it everywhere instead of using it almost everywhere
and still using YToRow(true) and XToCol(true) explicitly just once each.

Also add a comment explaining the difference between internalAToB() and
public AToB() functions.
2020-07-05 14:58:02 +02:00
Stefan Csomor
c15d805a9f macOS new DragSession API (#1919)
* new dragsession API

* Update src/osx/cocoa/dnd.mm

Co-authored-by: VZ <vz-github@zeitlins.org>

* Update src/osx/cocoa/dnd.mm

Co-authored-by: VZ <vz-github@zeitlins.org>

* Update src/osx/cocoa/dnd.mm

Co-authored-by: VZ <vz-github@zeitlins.org>

* avoid NSDragOperationDelete

* adding SDK 10.10 compatibility

* remove conditional compilation, upgrading travis to Xcode 7.3

* adding typedef NSPasteboardType for SDK < 10.13

Co-authored-by: VZ <vz-github@zeitlins.org>
2020-07-05 11:04:09 +02:00
Stefan Csomor
3e5b21e982 cleanup, make clause symmetric 2020-07-05 08:38:15 +02:00
Stefan Csomor
0f3bc09109 lower systems are not supported anymore, cleanup 2020-07-05 08:37:14 +02:00
Stefan Csomor
89761300c8 always available with 10.11 SDK 2020-07-04 21:03:41 +02:00
Stefan Csomor
d49875f34f SDK 10.11 minimum 2020-07-04 20:47:20 +02:00
Stefan Csomor
81e3760e4a avoiding assertion on macOS in wxOwnerDrawnComboBox::DoClear
wxTextEntry on macOS is calling GetEditableWindow to arrive at the native text entry view, which in this case fails, so route things directly
2020-07-04 15:06:38 +02:00
Vadim Zeitlin
3c87ffdaec Fix dumping wrong selector in wxOSX trace message
No real changes, just pass the correct (and interesting) value to
wxLogTrace() to actually see which selector are we called for.
2020-07-04 14:10:45 +02:00
Vadim Zeitlin
9ea0f6de3c Merge branch 'gendirctrl-fixes' of https://github.com/MaartenBent/wxWidgets
Fixes for handling filters in wxGenericDirCtrl.

See https://github.com/wxWidgets/wxWidgets/pull/1925
2020-07-04 13:15:39 +02:00
Gilbert Pelletier
76c7f723fc Add wxFontDialog::RestrictSelection() to disallow raster fonts
Under MSW it is possible to restrict the native font dialog to showing
only scalable fonts only, disallowing the raster fonts, so add a method
to wxFontDialog exposing this functionality in wxWidgets API.

Closes https://github.com/wxWidgets/wxWidgets/pull/1926

Closes #16988.
2020-07-04 13:14:38 +02:00
Maarten Bent
1f0e548e3a Fix null pointer reference when changing filter in wxGenericDirCtrl
See #18799
2020-07-03 23:01:42 +02:00
Maarten Bent
be405158cb Fix height of filter list in wxGenericDirCtrl
Closes #18799
2020-07-03 23:01:41 +02:00
Hertatijanto Hartono
bfca375f17 Remove unused wxBitmapDataObject::m_pictCreated
This variable was initialized, but never used, so just remove it.
2020-07-02 16:03:32 +02:00
Hertatijanto Hartono
1676d52d2b Use NULL, not 0, for CGImageRef initialization
No real changes, just improve consistency.
2020-07-02 16:01:45 +02:00
Hertatijanto Hartono
bb1c1e0fa0 Remove useless casting to CGContextRef
This is not necessary any more after the changes done in 360240a70b
(Replace deprecated methods from utilscocoa.mm (#1916), 2020-06-30).

Closes https://github.com/wxWidgets/wxWidgets/pull/1922
2020-07-02 14:50:06 +02:00
Vadim Zeitlin
5a0723223d Merge branch 'grid-activatable-editors'
Add support for activatable editors in wxGrid and make
wxGridCellBoolEditor activatable.

Also a couple of editor-related bug fixes.

See https://github.com/wxWidgets/wxWidgets/pull/1917
2020-07-01 14:37:44 +02:00
Vadim Zeitlin
3cde77244b Actually use the validator passed to wxGridCellTextEditor
SetValidator() had no effect if it was called after creating the editor,
but in some situations it is convenient to call it from BeginEdit(), as
we don't have the cell coordinates before it is called, so ensure that
the validator set using this function is actually used even if it's
called after creating the text control.
2020-07-01 02:20:04 +02:00
Fabian Cenedese
a571a13d44 Fix bug in wxFileName::Normalize() with leading ".."
Don't discard initial ".." when there is more than one such component in
the beginning of the path.

Closes #18800.
2020-06-30 23:00:06 +02:00
Artur Wieczorek
016924e14c Update wxSpinCtrl size while changing the base under OSX
Changing the base changes the textual representation of the number
so we need to reset the best size of numeric box to enforce
size recalculation.
2020-06-30 19:29:55 +02:00
Artur Wieczorek
5a676ac855 Set proper value of wxSpinEvent generated by wxSpinCtrl
Current way of converting wxSpinCtrl value to integer does not work
for negative values. We can just use here integer value returned
by GetValue().

Closes #18802.
2020-06-30 19:24:58 +02:00
Vadim Zeitlin
13e1b384e7 Fix another possible bug in wxEVT_GRID_CELL_CHANGED handling
Even when wxEVT_GRID_CELL_CHANGED is really vetoed, it's still possible
that m_currentCellCoords was changed by the handler, so use the row/col
coordinates of the cell that was really changed instead of the possibly
different m_currentCellCoords value to avoid a bug similar to the one
fixed by the previous commit.
2020-06-30 19:15:15 +02:00
Vadim Zeitlin
8445d1993e Fix bug in workaround for event handlers deleting wxGrid cells
The changes of e6e6dbe077 (Fix problems due to deleting grid cells in
the event handlers, 2020-05-02) fixed the bug (see #18731), but
introduced another one in place: if wxEVT_GRID_CELL_CHANGED handler
deleted any cells, wxGrid code could mistakenly restore the "old" cell
value (actually it restored the value for a different cell, as the
current cell coordinates necessarily changed too in this case).

This bug became more visible after the addition of activatable editors
as the new code asserts, instead of trying to restore the old value, if
wxEVT_GRID_CELL_CHANGED is vetoed, which also resulted in asserts if the
handler deleted the current cell instead.

Fix this by separating the cases of event being really vetoed and of the
event handler deleting the cell for which the event was generated and
handle the latter separately from the former where it matters.

This commit is best viewed ignoring whitespace changes.
2020-06-30 19:04:52 +02:00
Vadim Zeitlin
f877106663 Use EventResult enum instead of magic numbers in wxGrid code
This is more verbose, but also much more clear (and so allows to remove
some previously necessary comments).

No real changes, even keep the same values for the enum elements as were
previously used: this is probably unnecessary but do it just to minimize
changes.
2020-06-30 18:51:13 +02:00
Tobias Taschner
d881f2e72b Include macOS 11 name in wxGetOsDescription() (#1918) 2020-06-30 18:14:19 +02:00
Stefan Csomor
6b460d64a8 replacing deprecated methods 2020-06-30 10:20:37 +02:00
Stefan Csomor
1d67ef6cef Replacing Handle based code with CFData 2020-06-30 08:19:08 +02:00
Vadim Zeitlin
505a6f0807 Fix double-to-float conversion warnings in wxWebViewIE
Avoid warnings about truncating double literals to float introduced by
the recent 895424ecc0 (Add wxWebView::SetZoomFactor(float) and
GetZoomFactor(), 2020-06-13) by using float literals in the first place.

See https://github.com/wxWidgets/wxWidgets/pull/1894

See #18769.
2020-06-30 02:36:49 +02:00
Vadim Zeitlin
dc69cb79d7 Support activation in wxGridCellBoolEditor
This makes it much more convenient to use interactively, as the cell
value is toggled immediately and, even more importantly, the UI doesn't
enter the confusing editing mode which doesn't look any different from
the normal grid appearance except for the current cell border absence.

Note that we still keep support for classic in-place editing to preserve
compatibility with the code which calls EnableCellEditControl()
explicitly and expects an editor to be shown, but perhaps we could
switch to using only activation in the future.
2020-06-30 02:31:29 +02:00
Vadim Zeitlin
3cc3236f10 Add support for "activatable" editors to wxGrid
This is useful for editors which don't really need to show any control
as they can change their value directly and will be used to reimplement
wxGridCellBoolEditor in the upcoming commits.
2020-06-30 02:25:14 +02:00
Vadim Zeitlin
f845a8dc71 Always initialize wxGridCellBoolEditor::m_value
Do it even when the cell value is not one of the recognized boolean
representations, as we later use m_value as an index into a 2 element
array and leaving it uninitialized could result in an out of bound
access, so make sure this doesn't happen.
2020-06-30 01:04:31 +02:00
Vadim Zeitlin
251584b73b Refactor wxGridCellBoolEditor to make some functions reusable
No real changes, just factor out code for getting and setting the grid
cell value as bool from {Begin,Apply}Edit() to {Get,Set}GridValue() to
make it possible to reuse these functions in the upcoming commits.

This commit is best viewed with the --color-moved option.
2020-06-30 01:04:03 +02:00
Vadim Zeitlin
d14a33bf37 Merge branch 'grid-streamline'
Various simplifications and bug fixes in wxGrid code, mostly related to
handling in-place cell editing.

See https://github.com/wxWidgets/wxWidgets/pull/1910
2020-06-30 00:25:46 +02:00
Maarten Bent
dec895e1d7 Add more initialization checks for wxSTC SurfaceD2D target
Return early if the check fails. No functional changes.

This commit is best viewed ignoring whitespace changes.

Closes https://github.com/wxWidgets/wxWidgets/pull/1914
2020-06-30 00:23:31 +02:00
Artur Wieczorek
0065799965 Fix calculating the size of wxSpinCtrl numeric box under wxOSX
Since 8189ce89ed (Improve wxTextCtrl::DoGetSizeFromTextSize() in wxOSX, 2020-05-28) GetSizeFromTextSize() is fully functional under wxOSX
so we can revert 39d586421b (Don't call GetSizeFromText() under wxOSX, 2020-05-21) and use GetSizeFromText() in calculating text box size.

Closes #18766.
2020-06-29 23:23:27 +02:00
Stefan Csomor
ce9b7bcd81 replace deprecated constants 2020-06-29 22:42:09 +02:00
Stefan Csomor
f739fd13ca switching to 10.10+ API 2020-06-29 22:37:01 +02:00
dvertx
360240a70b Replace deprecated methods from utilscocoa.mm (#1916) 2020-06-29 22:27:25 +02:00
Vadim Zeitlin
4e62b24042 Fix bug with Shift-Enter selecting cells while editing
It was unexpected that pressing Shift-Enter while an editor was active
didn't close it, but just selected the cell below (and then the one
below it if pressed again and so on), so now always finish editing when
it's pressed.

It could be argued that it's still unexpected for Shift-Enter to select
the cell below after closing the editor, but this is consistent with how
Tab works, and so shouldn't be as confusing as the old behaviour.
2020-06-28 23:14:32 +02:00
Vadim Zeitlin
3747169660 Remove apparently unnecessary wxGrid::m_inOnKeyDown
Although this variable, and a check for it in OnKeyDown(), was present
since the first version of this code added back in f85afd4e46 (Added new
wxGrid classes[...], 1999-10-06), there doesn't seem to be any
indication that it has ever been needed, so remove it to simplify the
code and make it possible to add early returns to this function easily.

No real changes yet.
2020-06-28 22:53:10 +02:00
Vadim Zeitlin
a5f172bacb Fix hiding the editor when the mouse simply moved around
Since the changes done in 8b2237cd2d (Make row/column drag-resizing in
wxGrid "live", 2020-03-01) the grid editor was dismissed whenever the
mouse crossed any row/column separator, which was, of course, wrong, as
it was only supposed to be hidden when row/column was actually resized,
i.e. when the separator was dragged by the mouse.

Fix this by moving calls to DoStartResizeRowOrCol() to more appropriate
places and do it only when the button is pressed now.

Note that it might actually be better to just disable column/row
resizing while a cell is being edited, but for now keep things working
as they did before and at least fix the latest regression which is
definitely unwanted.
2020-06-28 18:54:45 +02:00
Stefan Csomor
d3d508b7e6 Fix visibility of embedded controls in non-native toolbar 2020-06-28 17:46:16 +02:00
Vadim Zeitlin
47adeb14b9 Remove unnecessary Mac-specific IsShownOnScreen() implementation
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/1911

Closes #18645.
2020-06-28 15:38:50 +02:00
Vadim Zeitlin
b7bfe53bed Merge branch 'spelling-fixes'
Fix spelling mistakes found by codespell in the headers and
documentation.

See https://github.com/wxWidgets/wxWidgets/pull/1909
2020-06-28 15:31:54 +02:00
Stefan Csomor
199a3f51ef remove older code for new macos 10.10 base requirement 2020-06-28 08:47:50 +02:00
Vadim Zeitlin
c7f77afbf4 Avoid macOS debug messages about invalid glyph index
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.
2020-06-28 02:18:56 +02:00
Vadim Zeitlin
7235c77f81 Use GetCellSize() return value instead of checking rows/columns
No real changes, just use the value returned by the function to
determine if the cell is inside a multi-cell, instead of comparing
rows/columns with 0 to make code slightly more readable and self
explanatory.
2020-06-28 01:55:17 +02:00
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