Commit Graph

68693 Commits

Author SHA1 Message Date
Vadim Zeitlin
74377ecf38 Center date editor vertically in the grid
Do it for consistency with the other editors and because it looks better
when the date picker is taller than the line height.
2020-06-22 02:44:58 +02:00
Vadim Zeitlin
097f1a17cb Fix positioning of grid editor inside the grid client area
The existing logic for adjusting the editor window position by moving it
was flawed as it didn't take into account the fact that the editor could
decide to use a different (and usually bigger) rectangle than the one we
provided it with, if it doesn't fit into the given one. Fix it to ensure
that the editor window is fully inside the grid client area by moving it
only after letting it choose its own size.

The existing code was also inconsistent as CalcDimensions() didn't take
any adjustment to the cell rectangle done in ShowCellEditControl() into
account at all and always just blithely assumed it was positioned at the
cell top left corner, which resulted in wrong virtual size calculation
and could make scrollbars appear when starting editing, as happened in
the "Bugs table" example of the grid sample when showing any comboboxes
in the last grid row. Fix this code to use the actual editor rectangle
instead.
2020-06-22 01:53:59 +02:00
Vadim Zeitlin
f8a0438385 Also avoid updating wxHeaderCtrl column when resizing in wxGrid
This is another attempt to get rid of the flicker when using the native
header control with wxGrid under MSW and avoid calling UpdateColumn(),
which is currently implemented in a very inefficient way in wxHeaderCtrl
under MSW, during interactive resizing.

See #18794.
2020-06-21 23:46:59 +02:00
Vadim Zeitlin
bf266ca348 Avoid unnecessarily refreshing native header in wxGrid
We don't need to refresh it after resizing, it takes care of itself and
calling Refresh() just results in extra flicker.

See #18794.
2020-06-21 19:29:37 +02:00
Vadim Zeitlin
867cc2a3eb Handle clicks on grid edges normally when not using drag-resizing
Clicking on (or near) the grid column or row edges was handled specially
to allow dragging them in order to resize the column or row, but this
doesn't need to be done if drag-resizing the columns or rows is not
allowed in the first place and resulted in surprising user-visible
behaviour: e.g. when using row selection, clicking mostly anywhere in
the row selected it, except if the click happened to be between the two
columns, in which case it didn't.

Fix this and always select the row in such scenario now.

Unfortunately, doing this required adding yet more CanDragXXX()
functions in addition to the already impressive panoply of them in
wxGrid, but we need CanDragGridColEdges() as none of the existing
functions checked for m_useNativeHeader (there was instead an ad hoc
check for it directly in the mouse handling code) and the row version
had to be added for symmetry.
2020-06-21 19:29:37 +02:00
Vadim Zeitlin
3fa942795e Avoid annoying beep when using Alt-Backspace in MSW text controls
Although the native (single line) text control understands Alt-Backspace
as an accelerator for "Undo", using it was not really practical because
it resulted in an annoying beep due to Alt-anything trying to find an
item with matching mnemonic in the menu.

Work around this native (mis)feature by pretending to handle this
particular Alt-combination ourselves when the currently focused control
is text-like, as indicated by it overriding WXGetTextEntry() -- this is
not ideal, but seems to be the best we can currently do. An alternative
could be to just mark Alt-Backspace as handled unconditionally.
2020-06-21 19:29:37 +02:00
Vadim Zeitlin
284cf9a872 Merge branch 'cmake-ios' of https://github.com/MaartenBent/wxWidgets
Build wxiOS on Travis CI.

See https://github.com/wxWidgets/wxWidgets/pull/1895
2020-06-21 19:02:54 +02:00
Richard Reznicek
99cd70e7b8 Reduce page increment of GTK wxSpinButton for narrow range
Gradually reduce the page increment in the case of a narrow range for
convenience and to limit possible EVT_SPIN_UP/EVT_SPIN_DOWN ambiguity
when wrapping is on.

Closes https://github.com/wxWidgets/wxWidgets/pull/1900
2020-06-21 16:44:39 +02:00
Vadim Zeitlin
350ae65cb6 Fix parameter name in wxDC::DrawBitmap() documentation
Closes #18795.
2020-06-21 00:07:01 +02:00
Vadim Zeitlin
1208aa116a Accept space as starting key for editing numbers in wxGrid
Not being able to use space for starting editing the values of the
numeric columns was inconsistent with most (if not all) the other ones
and so surprising and inconvenient. Make space work for these columns
too, but just ignore it, i.e. in particular do not erase the current
cell contents when it's pressed, to avoid changing the old behaviour too
much.
2020-06-20 19:52:43 +02:00
Vadim Zeitlin
6f36d2e2f8 Merge branch 'im/buildfix' of https://github.com/imciner2/wxWidgets
Fix disabling unwanted libraries when building built-in libtiff.

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

Closes #18791.
2020-06-20 14:50:16 +02:00
orbitcowboy
915dcce320 Fix typo in a comment in dataview sample
No real changes, just fix a typo in "invisible".

Closes https://github.com/wxWidgets/wxWidgets/pull/1899
2020-06-20 14:44:10 +02:00
Hertatijanto Hartono
858f705058 Update translation for Indonesian language 2020-06-19 21:08:26 +07:00
Maarten Bent
e4437c4974 Add iOS CMake build to Travis CI
Use the following CMake flags:
-DCMAKE_SYSTEM_NAME=iOS - for specifying it is an iOS build
-DCMAKE_FIND_ROOT_PATH=/usr/local - dir to search for the built wxWidgets libraries
-DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=NO - don't require signing app packages
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.12 - specify a target so both the libraries and sample will use the same architecture

Also use the code signing flag when testing precompiled header support.
Don't build the default samples, widgets sample has features that are not supported by the iOS build.

Xcode seems to rebuild the libraries when installing, so call CMake only once.
2020-06-18 21:20:21 +02:00
Maarten Bent
21e92cbcf1 CMake: don't add cross compile suffix to wx-config library names for iOS build
The libraries do not have this suffix. And configure also doesn't do it.
2020-06-18 20:28:54 +02:00
Maarten Bent
49a23c1dfa CMake: fix try_compile and other checks for iOS build 2020-06-18 20:28:42 +02:00
Maarten Bent
cf46dde182 CMake: fix building and copying wxrc util for iOS
An app bundle is built, instead of a single executable.
2020-06-18 20:28:36 +02:00
Maarten Bent
5041915001 CMake: fix building media and gl lib for iOS 2020-06-18 20:28:19 +02:00
Maarten Bent
3ab4d9461b CMake: add missing libraries for iOS build
Remove unused section from file list.
2020-06-18 20:28:12 +02:00
Maarten Bent
3d705dd867 Remove non-existing file from file list 2020-06-18 20:17:06 +02:00
Maarten Bent
78500e4a3b Improve folding in Travis CI log
Start the fold before echoing the description, so the description is shown when folded.
Combine Xcode checks into one statement.
Add missing '-G' argument when building sample using CMake.
2020-06-18 19:48:03 +02:00
Václav Slavík
c8f4d5e669 Fix MacReopenApp() in presence of hidden windows
wxOSX's wxApp::MacReopenApp() previously contained logic to unhide
hidden windows, but this code was commended out since 2013 as
problematic - it was showing windows like closed, but not yet
destroyed, non-modal dialogs.

Unfortunately while this part was commented out, the rest of the code
that handled existence of hidden windows was not, resulting in a bug
where nothing happened after clicking app icon in the Dock if the
application didn't have any visible window at the moment, but had a
"technical" hidden one, e.g. after opening and closing
wxPreferencesEditor.

Fixed by simplyfing and removing all (functionally commented-out) code
related to hidden windows. Instead, the logic is now:
1. do nothing if some window is already visible
2. restore an iconized window if there's one
3. call MacNewFile() if neither happened
2020-06-18 10:58:50 +02:00
Hertatijanto Hartono
895424ecc0 Add wxWebView::SetZoomFactor(float) and GetZoomFactor()
The new method allows to set the zoom level more precisely than the
existing SetZoom(wxWebViewZoom).

Also improve the webview sample by using radio menu items instead of
check items and manually resetting them.

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

Closes #18769.
2020-06-18 03:13:00 +02:00
Ian McInerney
b7600b0b1b Ensure jbig support is disabled for builtin libtiff 2020-06-17 23:14:01 +01:00
Ian McInerney
10a958562d Fix configure for builtin libtiff
We need to ensure the configure arguments to disable features
are passed in immediately before calling, because the builtin
is the fallback if the system library is not found.

Fixes #18791
2020-06-17 22:46:48 +01:00
Vadim Zeitlin
dc9040cc89 Merge branch 'grid-autosize'
Optimize wxGrid::AutoSizeColumns() for big grids.

This includes an optimization of wxDC::GetTextExtent() at the price of
slightly reduced precision in wxMSW.

See https://github.com/wxWidgets/wxWidgets/pull/1893
2020-06-16 20:37:57 +02:00
Vadim Zeitlin
14aa0f9e9f Check for valid font in wxTextMeasure before using it
It turns out that wxEnhMetaFileDC doesn't have any valid font in wxMSW,
so the changes of 70768a33d2 (Dramatically speed up measuring text
extent in wxMSW, 2020-06-10) broke its GetTextExtent().

Fix this by checking if we have a valid font explicitly, although
perhaps a better fix would be to ensure that wxEnhMetaFileDC also always
has a default font, as the other wxDC classes.
2020-06-13 23:45:51 +02:00
Vadim Zeitlin
036ab992d5 Merge branch 'list-deselect-event'
Consistently send DESELECTED events from virtual wxListCtrl.

See https://github.com/wxWidgets/wxWidgets/pull/1857
2020-06-13 22:50:55 +02:00
Vadim Zeitlin
6f0a2b66b4 Remove hard TAB from the recently added test
No real changes.
2020-06-13 22:50:36 +02:00
Vadim Zeitlin
cc21b1bff2 Revert "A test button to the listctrl sample"
This reverts commit 9d9b0c51c8 as it was
only meant for temporary testing and shouldn't be merged.
2020-06-13 22:49:22 +02:00
Vadim Zeitlin
585ed986a2 Make wxGridCellChoiceEditor big enough in both directions
Previously, we ensured that the combobox was tall enough, but not that
it was wide enough, which could result in truncation of its contents if
the cell rectangle was too small.

Fix this by increasing the size in both directions, if necessary.

Also make the code simpler by using higher-level wxSize and wxRect
methods instead of fiddling with the coordinates directly.
2020-06-13 17:29:20 +02:00
Vadim Zeitlin
d2a403408f Implement wxGridCellNumberRenderer::GetMaxBestSize()
This allows to make computing the best width of numeric columns an O(1)
operation instead of O(number-of-rows), which can make a huge difference
for big grids.
2020-06-13 16:37:21 +02:00
Vadim Zeitlin
96de24d1bb Add wxGridCellChoiceRenderer to optimize column size calculation
Previously columns using a set of predetermined values used plain
wxGridCellStringRenderer, which didn't allow to determine their best
size efficiently, as wxGrid had to iterate over all the rows of the
table, even if they only took a couple of possible values.

Add wxGridCellChoiceRenderer (refactoring wxGridCellEnumRenderer to
extract the common code from it in the process) which implements
GetMaxBestSize() by just finding the best size of all of these values,
which is much faster for large grids.

This does result in a change in behaviour, as the column now adapts to
its "theoretical" best size and not just the size of the values actually
shown in it, but this seems to be a worthwhile trade-off and could even
be seen as an advantage, as editing a cell won't make its value overflow
the auto-sized column width any more, as it is wide enough to show any
of the column values.
2020-06-13 16:10:14 +02:00
Vadim Zeitlin
71d42a8290 Add wxGridCellRenderer::GetMaxBestSize()
This is another optimization, useful for the renderers that are used
with the values of a fixed form or part of a limited set, as it is much
faster to compute the best size for all values of the set rather than
computing them for all the cells in the column.
2020-06-13 15:51:20 +02:00
Vadim Zeitlin
a1a5c8c1ae Merge branch 'toolbar-bottom'
Fix handling of toolbars using both wxTB_HORIZONTAL and wxTB_BOTTOM (or
both wxTB_VERTICAL and wxTB_RIGHT) styles.

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

Closes #18769.
2020-06-13 14:59:00 +02:00
PB
13b15fecc0 Simplify code dealing with toolbar position in associated frame 2020-06-13 14:57:30 +02:00
Richard Reznicek
83ca3c4ef2 Fix flickering when resizing MDI parent frame in wxMSW
The wxMDIParentFrame::Create() function simply called
wxApp::GetRegisteredClassName(wxT("wxMDIFrame")) without providing
apropriate flags parameter depending on the presence/absence of the
wxFULL_REPAINT_ON_RESIZE flag in style. Thus, the MDI parent frame was
always created using the window class with the CS_HREDRAW | CS_VREDRAW
style flags set. Choosing the appropriate value for the flags parameter
of the wxApp::GetRegisteredClassName() function (like in the
wxWindowMSW::GetMSWClassName() function) fixes the flicker issue. The
wxApp::GetRegisteredClassName() call in wxMDIChildFrame::Create()
is adapted as well just for the sake of consistency.

See #18213.

Closes https://github.com/wxWidgets/wxWidgets/pull/1892
2020-06-13 13:42:25 +02:00
Vadim Zeitlin
b0f7ecbd0d Fix the initial wxTextCtrl size in wxGTK
We need to explicitly call SetInitialSize() after setting the value of
the control (if it's not empty), as the first call, done from inside of
PostCreation(), doesn't take the initial control contents into account
and so doesn't allocate the height correctly for multiline text controls
containing more than 2 lines of text, for example.

Closes https://github.com/wxWidgets/wxWidgets/pull/1891
2020-06-12 16:11:15 +02:00
Artur Wieczorek
dc92f2e9dc Add compilation guards for macOS 10.14 to avoid warnings
NSColor.linkColor is not available since macOS 10.10 as
it is stated in the Appkit documentation but since 10.14 -
see http://codeworkshop.net/objc-diff/sdkdiffs/macos/10.14/AppKit.html
2020-06-11 15:47:39 +02:00
Artur Wieczorek
32bb2edac7 Mark overriding functions with wxOVERRIDE 2020-06-11 15:47:35 +02:00
Artur Wieczorek
7c3d540c70 Validate input in generic wxSpinCtrl and wxSpinCtrlDouble
Use respective validator to control what is typed in the text field.

Closes #17882.
2020-06-11 15:47:12 +02:00
Vadim Zeitlin
249db04dd3 Add wxGridTableBase::CanMeasureColUsingSameAttr()
This allows to optimize AutoSizeColumns() in the common case when all
cells in the same column can be measured using the same attribute.
2020-06-11 10:03:13 +02:00
Vadim Zeitlin
70768a33d2 Dramatically speed up measuring text extent in wxMSW
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.
2020-06-10 23:46:13 +02:00
Vadim Zeitlin
bfeae1922d Minor optimizations in GetMultiLineTextExtent()
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.
2020-06-10 23:41:24 +02:00
Vadim Zeitlin
09ecfaec8f Reuse wxDC::GetMultiLineTextExtent() in wxGridCellStringRenderer
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.
2020-06-10 22:57:17 +02:00
Vadim Zeitlin
0ca6be3cf4 Link samples using STC with imm32.lib
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.
2020-06-10 19:30:48 +02:00
Vadim Zeitlin
5e06174c95 Merge branch 'cotaskmemptr' of https://github.com/PBfordev/wxWidgets
Add wxCoTaskMemPtr and use it instead of manual calls to
::CoTaskMemFree().

See https://github.com/wxWidgets/wxWidgets/pull/1890
2020-06-10 18:02:50 +02:00
PB
88965fc588 Fix whitespace 2020-06-10 17:17:48 +02:00
Vadim Zeitlin
968e94c36d Merge branch 'mac-textctrl-size-refactor'
Don't call GetBestSize() from DoGetSizeFromTextSize() in wxOSX.

See https://github.com/wxWidgets/wxWidgets/pull/1888
2020-06-10 15:48:57 +02:00
Vadim Zeitlin
13477ee164 Merge branch 'xrc-generic-animation-ctrl'
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
2020-06-10 00:02:59 +02:00