Commit Graph

68484 Commits

Author SHA1 Message Date
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
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
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
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
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
Vadim Zeitlin
9e2434d013 Document wxGenericAnimationCtrl XRC handler and it to XRC schema
It's actually the same handler as for wxAnimationCtrl, but it still
needs to be mentioned in the XRC format description and recognized by
its schema.
2020-06-10 00:02:34 +02:00
Maarten Bent
1ed8197dfa CMake: prevent mismatched package name warnings
Use all caps for the packages.

Closes https://github.com/wxWidgets/wxWidgets/pull/1886
2020-06-09 23:57:53 +02:00
Vadim Zeitlin
f72f2bec3a Merge branch 'dpi-stc' of https://github.com/MaartenBent/wxWidgets
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
2020-06-09 23:56:37 +02:00
PB
9ff095a852 Use wxCoTaskMemPtr
Use RAII class wxCoTaskMemPtr to manage pointers that must
be freed with ::CoTaskMemFree().
2020-06-09 20:17:25 +02:00
PB
d445111e77 Create wxCoTaskMemPtr class
wxCoTaskMemPtr is a barebone RAII class for pointers
that must freed with ::CoTaskMemFree().
2020-06-09 20:14:33 +02:00
Vadim Zeitlin
8ff6fa6f54 Use GetAnimation() in wxAnimationCtrlXmlHandler again
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.
2020-06-09 18:07:10 +02:00
Vadim Zeitlin
2c4b0b4271 Get rid of src/xrc/xmladv.cpp file
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.
2020-06-09 18:07:10 +02:00
Ilya Sinitsyn
b1a744ce07 Fix an issue with the background in wxGenericAnimationCtrl
Static bitmap with alpha channel must also be drawn on the memory DC
instead of being used directly, just as the bitmaps with a mask.
2020-06-09 18:07:10 +02:00
Vadim Zeitlin
ac7c40b141 Add dummy wxBitmap::HasAlpha() to wxX11
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.
2020-06-09 18:07:10 +02:00