Commit Graph

65326 Commits

Author SHA1 Message Date
Vadim Zeitlin
61c7cf9a9c Fix yet another division by 0 when parsing WAV data
Ensure that the size of one sample (including all the channels) is non
zero before dividing by it.
2017-12-30 18:52:57 +01:00
Vadim Zeitlin
932f384c87 Avoid division by 0 when parsing WAV data
Don't divide by waveformat.uiBlockAlign which could be 0, but rather
multiply by it and verify that we get the expected result. This is more
robust, as it prevents crashes on malformed input and also slightly more
efficient even for correct input.
2017-12-30 18:52:57 +01:00
Vadim Zeitlin
45e8d13e13 Add format sub-chunk size check to WAV parsing
This fixes a crash due to reading beyond the buffer bounds when checking
for "data" if WAVEFORMAT::uiSize was too big.
2017-12-30 18:52:57 +01:00
nowhere
69cd6039eb Make parsing WAV data more robust
Check that we have enough data in the input instead of happily reading
out of bounds memory.

This fixes the most common problem of crashing on bad data which doesn't
look like WAV at all, but doesn't fix problems with parsing input which
does look like WAV, but is incorrect -- this will be done in subsequent
commits.
2017-12-30 18:52:36 +01:00
Vadim Zeitlin
c65eaac529 Fix harmless warning about comparing values of different enums
This avoids a bunch of -Wenum-compare-switch warnings from clang 6.
2017-12-30 18:51:05 +01:00
adrian5
6c7aaa9e95 Improve wording and formatting in "Hello World" example
Minor fixes to the "Hello World" example in the manual to make its style
more consistent and the text more readable.

Closes https://github.com/wxWidgets/wxWidgets/pull/657
2017-12-29 20:13:29 +01:00
Frédéric Bron
f4b56f67ec Improve documentation of wxPropertyGrid::MakeColumnEditable()
Explain that column must be different from 1 in the documentation and in
the (already existing) assert checking it.

Closes https://github.com/wxWidgets/wxWidgets/pull/656
2017-12-29 20:06:04 +01:00
orbitcowboy
f423b88ded Replace post-increment on iterators with pre-increment
This is a micro-optimization, as pre-increment is at least as efficient
as post-increment and typically slightly more so because it doesn't need
to make a copy of the iterator, and better conforms to the prevailing
C++ style.

Closes https://github.com/wxWidgets/wxWidgets/pull/655
2017-12-29 19:59:24 +01:00
Vadim Zeitlin
f83d16aa46 Undefine min and max before using them in wx/valnum.h
Avoid problems when using this header in code also include <windows.h>
(and not doing it via wx/msw/wrapwin.h) by ensuring that min and max
used here are not defined as macros.
2017-12-26 04:29:42 +01:00
VZ
fdf2ee425f Use postfix operator when iterating over containers
No real changes, just avoid a micro-pessimization.

See https://github.com/wxWidgets/wxWidgets/pull/652
2017-12-26 04:25:44 +01:00
Vadim Zeitlin
c697b62d46 Compilation fix for PCH-less build after last commit
Include the headers required by the new code in src/msw/textentry.cpp.

See #12613.
2017-12-26 04:24:23 +01:00
orbitcowboy
0790698345 Use postfix operator when iterating over containers. 2017-12-26 00:25:52 +01:00
Vadim Zeitlin
5a949efc5c Fix sending wxEVT_TEXT_ENTER when using auto-completion in wxMSW
We need to explicitly generate this event from the char hook handler as
we don't get the normal WM_CHAR for it, it is apparently intercepted by
the window proc installed by the auto-completing code, so check if
wxTE_PROCESS_ENTER is used for the text entry and call a special new
MSWProcessSpecialKey() method to do the right thing if it is.

Similarly, handle Tab presses correctly if wxTE_PROCESS_TAB is used.

Closes #12613.
2017-12-25 19:29:25 +01:00
Vadim Zeitlin
f32edbe1fc Test wxTE_PROCESS_TAB support on text page of widgets sample too
Do it for completeness and symmetry with the already existing checkbox
enabling wxTE_PROCESS_ENTER.
2017-12-25 18:45:06 +01:00
Vadim Zeitlin
610c164988 Always let DefWndProc() process column resizing in wxListCtrl
If we don't pass these messages to it, the selected items highlight
rectangle doesn't get updated when the columns are resized when using
visual themes, as could be seen in the listctrl sample.

While this did work if the wxEVT_LIST_COL_DRAGGING event handler skipped
the event, prefer to not require doing this as things work without this
call to wxEvent::Skip() under the other platforms and even MSW with
themes disabled.

Closes #18032.
2017-12-25 17:14:56 +01:00
Vadim Zeitlin
0df05d5377 Merge branch 'msw-listctrl-painting'
Improve rules drawing in wxMSW wxListCtrl.

See https://github.com/wxWidgets/wxWidgets/pull/643 and https://github.com/wxWidgets/wxWidgets/pull/278
2017-12-25 16:54:44 +01:00
Vadim Zeitlin
3e8d63d256 Merge branch 'gesturesamplefixes' of https://github.com/NewPagodi/wxWidgets
Several cosmetic improvements to the gesture demo in the events sample.

See https://github.com/wxWidgets/wxWidgets/pull/651
2017-12-25 16:50:51 +01:00
New Pagodi
a636141b56 Use consistent letter case in log message strings 2017-12-24 18:25:26 -06:00
New Pagodi
0fa033df61 Remove newline characters from log message strings 2017-12-24 18:24:45 -06:00
New Pagodi
d3fd17db04 Use wxAutoBufferedPaintDC to reduce flicker with wxMSW 2017-12-24 18:24:05 -06:00
New Pagodi
ca1b76ba49 Set a minimum size for MyGestureFrame 2017-12-24 18:23:13 -06:00
Vadim Zeitlin
fdf47e8e12 Fix colours and fonts of wxStaticBox label window in wxMSW
Inherit from wxCompositeWindowSettersOnly<> to make sure all the usual
setters, such as SetForegroundColour() and SetFont(), called on
wxStaticBox are propagated to the label window too.

However also prevent SetBackgroundColour() from being propagated
unnecessarily -- because the checkbox already inherits the parent
background colour by default in wxMSW anyhow -- and still override
SetFont() to adjust the label window position after the font change,
otherwise it could be truncated after increasing the font size, for
example.

Because of these issues, wxCompositeWindowSettersOnly is not ideally
suited for its use here, but on balance it still seems to be better to
use it rather than reimplement parts of its functionality here.
2017-12-24 22:38:10 +01:00
Vadim Zeitlin
329af399eb Factor out wxCompositeWindowSettersOnly class
Extract this class from wxCompositeWindow, as sometimes it can be
convenient to just define the setter functions to do the right thing for
a window containing sub-windows, but without dealing with focus too.

This will be used in wxMSW wxStaticBox in the next commit.
2017-12-24 22:38:10 +01:00
Vadim Zeitlin
687192d86a Add support for arbitrary window labels in wxStaticBox to wxMSW
Just reparent the label window and position it accordingly and, also,
avoid painting over it in MSW-specific code.
2017-12-24 22:38:10 +01:00
Vadim Zeitlin
36c4b7651e Fix background of wxCheckBoxes inside wxStaticBox in wxMSW
Erase background of the partially transparent native child controls,
such as wxCheckBox, using our own background colour if we have it
instead of using the parent's colour.

For some reason, we -- seemingly intentionally, judging from the comment
-- didn't do it before, but this meant that checkboxes inside static
boxes didn't inherit the box background colour, if it was set, which was
ugly and inconsistent with at least wxGTK. So do use our own background
if we have it now by just reusing the existing PaintBackground() instead
of manually using the parent background brush in WM_PRINTCLIENT handler.
2017-12-24 22:38:10 +01:00
Vadim Zeitlin
3ff9846a22 Document alignment styles in wxStaticBox
Mention that they work in wxGTK, even if it seems to be the only
platform supporting them currently.
2017-12-24 22:38:10 +01:00
Vadim Zeitlin
59ca9b93a0 Make wxCompositeWindow ctor protected
As this class is only supposed to be used as a base class, its ctor
doesn't need to be, and hence ought not to be, public.

Also update an outdated comment stating that the ctor didn't do anything
when it, in fact, does perform an important task.
2017-12-24 22:38:10 +01:00
Vadim Zeitlin
598c62a267 Don't change wxCompositeWindow size from SetLayoutDirection()
Remove wxSIZE_AUTO from the SetSize() call, this was completely
unnecessary and unexpectedly (and wrongly) resized composite windows
managed by sizers as SetLayoutDirection() side-effect.
2017-12-24 22:38:10 +01:00
Vadim Zeitlin
4a4d164319 Keep attributes after recreating static controls in widgets sample
Preserve the colours, font etc after recreating the widgets to
facilitate testing.
2017-12-24 22:38:10 +01:00
Vadim Zeitlin
900c6d5d75 Slightly decrease the top margin of wxMSW wxStaticBox
Use the same offset we already use in the drawing code, this is a bit
less arbitrary than what we did before and looks slightly better too.
2017-12-24 22:38:10 +01:00
Vadim Zeitlin
dfba063d53 Adjust wxMSW wxStaticBox pixel constants for DPI
Use FromDIP() with all constants expressed in pixels, this should result
in better appearance when using high DPI.
2017-12-24 22:38:10 +01:00
Vadim Zeitlin
23a830ae16 Use symbolic names in wxMSW wxStaticBox drawing code
Introduce symbolic constants instead of using raw magic numbers.

No real changes and these numbers are still as magic as before, but at
least they will be easier to change now.
2017-12-24 22:38:10 +01:00
Vadim Zeitlin
b34a1c036a Account for label window in wxStaticBoxBase::GetBordersForSizer()
Take the window used as label into account in the default implementation
of this method.
2017-12-24 22:38:10 +01:00
Vadim Zeitlin
67225fb07e Remove borders from wxStaticBoxSizer items in the widgets sample
This allows to see better whether the borders returned by
wxStaticBox::GetBordersForSizer() are correct.
2017-12-24 22:38:10 +01:00
Vadim Zeitlin
91875045ac Don't make wxStaticBoxBase::GetBordersForSizer() inline
Move the function definition to the source file, there doesn't seem to
be any reason to keep it in the header.
2017-12-24 22:38:10 +01:00
Vadim Zeitlin
8c06a24da4 Move m_labelWin to wxStaticBoxBase itself
It will be reused by all platforms and is not specific to wxGTK.

This also means WXDestroyWithoutChildren() doesn't need to be virtual
any longer.
2017-12-24 22:38:10 +01:00
Vadim Zeitlin
7c849276f8 Add support for using arbitrary windows as wxStaticBox labels
This commit implements the new feature in wxGTK and updates the sample
and the documentation.
2017-12-24 22:38:10 +01:00
Vadim Zeitlin
29bd25b757 Add GTKDoApplyWidgetStyle() helper
This allows to call the protected wxWindowGTK::DoApplyWidgetStyle()
method when it's really necessary, e.g. when forwarding to it from
DoApplyWidgetStyle() implementation for another window.
2017-12-24 22:35:45 +01:00
Vadim Zeitlin
aa47c15abd Add WXDestroyWithoutChildren() and use it from wxStaticBoxSizer
Factor out the code from wxStaticBoxSizer dtor into a wxStaticBox method
to improve encapsulation: the static box knows better than another class
how to detach its children from it before destroying it.

No real changes yet.
2017-12-24 22:35:45 +01:00
Vadim Zeitlin
87afebd6f2 Inline wxStaticBox ctors in wxGTK
No real changes, just make the trivial ctors of this class inline for
consistency with the new ctor about to be added.
2017-12-24 22:35:45 +01:00
John Roberts
f36973875e Silence uninitialized variable warning in wxMac PanGestureEvent
Even though the value of this variable is not actually used in this
case, we still must initialize it to something before comparing with
NSGestureRecognizerState{Began,Ended} below.

Closes https://github.com/wxWidgets/wxWidgets/pull/645
2017-12-24 15:54:51 +01:00
jonkraber
7f52ff751f Fix clipping of cell contents in wxGrid
Use wxDCClipper, now that it doesn't lose the previously set clipping
region any more, in wxGridCellStringRenderer::Draw() to ensure that we
don't overflow the area allocated for the cell.

Closes #17872.
2017-12-24 15:46:57 +01:00
John Roberts
ba719c576e Document the new wxDCClipper behaviour after last commit change
wxDCClipper does restore the (bounding box of the) previously active
clipping region now.

See #13834.
2017-12-24 15:46:57 +01:00
jonkraber
2a8c290e0d Restore previous clipping box in wxDCClipper
Remember the clipping box of the previously active clipping region in
wxDCClipper ctor and restore it in its dtor.

See #13834.
2017-12-24 15:46:57 +01:00
skruse
3de89b2710 Fix auto-sizing multiline wxGrid column labels with empty lines
Account for the empty lines explicitly by reserving enough vertical
space for them, as wxDC::GetTextExtent() wouldn't do it as it simply
returns 0 for empty strings.

Closes #18028.
2017-12-24 15:20:23 +01:00
Artur Wieczorek
4f7fb24ef4 Use composite template to create GtkAssertDialog as a composite children
GtkAssertDialog UI is now defined with GtkBuilder XML because
gtk_widget_push_composite_child() and gtk_widget_pop_composite_child() are
deprecated since 3.10 and composite widget templates should be used
to make composite children.
2017-12-24 00:40:58 +01:00
Paul Cornett
be35405129 Apply current style to wxStaticBox container when it's created
Background may have been set before adding any children
See #15466
2017-12-21 10:06:10 -08:00
Paul Cornett
c867e0a23b Fix wxRadioBox non-default background with GTK+2 2017-12-20 22:33:07 -08:00
Paul Cornett
121ac8742d Fix wxStaticBox non-default background with GTK+2
See #15466
2017-12-20 22:29:21 -08:00
Paul Cornett
c23cac4c79 Avoid GtkAlignment with GTK+4 2017-12-19 21:49:13 -08:00