Peter Cawley [Wed, 20 Oct 2010 17:49:42 +0000 (17:49 +0000)]
Improve support for ribbon panel sizers: panels with sizers should now automatically minimise at small sizes, and behave properly when popping up from a minimised state.
Patch by johnr in trac issue #12580.
Vadim Zeitlin [Mon, 18 Oct 2010 23:43:25 +0000 (23:43 +0000)]
Change wxSP_XXX flags values to avoid clashes with wxTE_XXX.
wxSP_ARROW_KEYS conflicted with wxTE_AUTO_URL (which was probably not
important in practice as URLs don't appear in spin controls anyhow) and wxSPWR
conflicted with wxTE_NOHIDESEL (which could conceivably be a problem).
Change their values to reuse the bits of wxTE_CHARWRAP and wxTE_RICH2 neither
of which definitely makes sense for a spin control.
Vadim Zeitlin [Mon, 18 Oct 2010 23:43:14 +0000 (23:43 +0000)]
Correctly handle S_FALSE return value of IActiveMovie::get_Duration().
IActiveMovie::get_Duration() can return S_FALSE in which case outDuration
isn't initialized and so wxAMMediaBackend::GetDuration() would return a
completely wrong value.
Fix this by returning 0 from it instead which seems like the only reasonable
thing to do (in the absence of documentation of this interface it's not really
clear what does S_FALSE return value mean nor why didn't it return it before).
Jaakko Salli [Mon, 18 Oct 2010 13:55:40 +0000 (13:55 +0000)]
Call wxScrollHelper::AdjustScrollbars() to fix scroll bar setup that broke after wxPropertyGrid was changed to inherit from wxScrollHelper instead of wxScrolledWindow
Vadim Zeitlin [Sun, 17 Oct 2010 18:17:30 +0000 (18:17 +0000)]
Fix wxSTC compilation without wxUSE_DRAG_AND_DROP after r65827.
Correct the changes of r65827 to also compile with wxUSE_DRAG_AND_DROP==0
(especially important for the ports without dnd support such as wxX11 and
wxDFB).
Also do the changes in the correct files, i.e. src/stc/stc.{h,cpp}.in and not
in the generated files themselves to prevent them from being overwritten the
next time gen_iface.py is ran.
Finally keep backwards compatibility as SetDragAllowMove(bool) is a public
method so preserve its old semantics and add a new SetDragFlags() instead of
silently breaking the existing code using SetDragAllowMove().
Vadim Zeitlin [Sun, 17 Oct 2010 13:59:42 +0000 (13:59 +0000)]
Return valid buffer from wxMBConv::c{MB,WC}2{WC,MB} for empty input.
Returning invalid buffer for empty input is unexpected and resulted in e.g.
wxString::utf8_str() returning NULL and not "" in ANSI build for empty strings
(which, in turn, resulted in crashes in the test suite and undoubtedly not
only) as well as crashes when calling GTK+ functions (see #12432). Other uses
of cMB2WC() also show that NULL return value from it is unexpected as it is
often passed to CRT functions not accepting NULL.
So return empty buffer instead for empty input to avoid all these problems.
Vadim Zeitlin [Sat, 16 Oct 2010 23:05:26 +0000 (23:05 +0000)]
Fix FileTestCase to really test strings with embedded NULs.
The test was intended to verify that round trip via wxFile::Write/Read()
worked even for the strings with embedded NULs but as the string wasn't
constructed correctly it didn't actually contain any NULs but was ended by the
first of them.
Fix this by using explicit length of the string as usual when dealing with
strings with embedded NULs. Also fix the conversion back to Unicode to use the
correct length.
Vadim Zeitlin [Sat, 16 Oct 2010 23:05:20 +0000 (23:05 +0000)]
Disable tests for UTF-encoded files in FileTestCase in ANSI build.
These tests didn't work correctly in ANSI build because the conversion
parameter of wxFile::Write() isn't used there, the contents of an ANSI
wxString is always written to the file as is -- hence reading it back using
UTF-16 or UTF-32 conversion fails.
The test would need to be totally rewritten for ANSI build of wx and it
wouldn't test wxFile but rather conversion functions already tested elsewhere
so just disable it instead.
This fixes a crash (due to passing NULL pointer to memcmp()) which prevented
the test suite from running to completion in ANSI build.
Vadim Zeitlin [Sat, 16 Oct 2010 23:05:15 +0000 (23:05 +0000)]
Compilation fix for STL build after r65830.
Explicit conversion from wxString to "const char *" is needed in STL build.
And even in non-STL build it's wrong to rely on implicit conversion as it
wouldn't work correctly in non-UTF-8 locales.
Vadim Zeitlin [Sat, 16 Oct 2010 18:11:32 +0000 (18:11 +0000)]
Avoid crashes in wxGenericListCtrl client<->screen conversion code.
At least in wxUniv build, DoScreenToClient() can be called before the main
control window is created which results in a crash when attempting to forward
to its DoScreenToClient() version.
Check for m_mainWin being non-NULL before using it to at least avoid the
crash, even if it's not really clear whether this is a 100% correct fix.
In particular, create a valid GtkPrintOperation object instead of using an
uninitialized pointer to it in wxGtkPrintDialog::ShowModal(), resulting in
crashes or, at best, GTK errors.
Vadim Zeitlin [Sat, 16 Oct 2010 18:11:06 +0000 (18:11 +0000)]
Restore text drag-and-drop in wxSTC broken by Scintilla 2 update.
Drag and drop in wxStyledTextCtrl was broken, apparently since upgrade to
Scintilla 2. Restore it by using the correct wxDrag_XXX constants instead of
boolean values in the code for wxEVT_STC_START_DRAG events generation.
Vadim Zeitlin [Sat, 16 Oct 2010 18:10:58 +0000 (18:10 +0000)]
Don't return invalid buffer from wxConvertToGTK("").
The result of wxConvertToGTK() is often passed to GTK+ functions directly and
not all of them handle NULLs gracefully, e.g. gtk_editable_insert_text() just
crashes.
Return an empty string from wxConvertToGTK() explicitly for empty string input
to avoid such problems.
Another potential solution might have been to change wxMBConv::cMB2WC() to
return empty buffer instead of invalid one for empty input but it's not clear
if this is not going to break something else.
Vadim Zeitlin [Sat, 16 Oct 2010 18:10:51 +0000 (18:10 +0000)]
Add wxHAS_3STATE_CHECKBOX symbol.
This symbol is defined for the ports that support wxCHK_3STATE style. While
most of the ports do support it, a couple still do not and having this symbol
makes it more convenient to exclude 3-state-checkbox-specific code, like in
CheckBoxTestCase.
Vadim Zeitlin [Sat, 16 Oct 2010 18:10:42 +0000 (18:10 +0000)]
Improve validation of wxCheckBox styles.
Detect when incompatible styles are used (this required changing the value of
wxCHK_2STATE to be non-null) and sanitize the styles (after asserting) in this
case.
Put the validation code in wxCheckBoxBase instead of having slightly different
versions of it in port-specific wxCheckBox implementations.
Add a unit test checking that the expected asserts are indeed generated.
Vadim Zeitlin [Fri, 15 Oct 2010 23:46:46 +0000 (23:46 +0000)]
Add wx{Pen,Brush}::Is[Non]Transparent() methods and use them.
Using GetStyle() == wx{PEN,BRUSH}STYLE_TRANSPARENT doesn't work for
uninitialized pen or brush objects so add convenient helpers which do work for
them.
Use the new helper functions everywhere instead of explicitly checking for
style. This makes the code shorter and more clear and also fixes some bugs (at
least those in GTK printing code).
Notice that this patch removes the main reason for explicitly initializing
m_pen and m_brush in wxGTKDCImpl ctor but this initialization still can't be
removed, at least for the latter, as doing this somehow breaks GetPixel(). It
would be nice to understand why and do remove this initialization so that a
newly created DC doesn't have any non-default pen nor brush.
Vadim Zeitlin [Fri, 15 Oct 2010 23:46:32 +0000 (23:46 +0000)]
Add "GTK" prefix to wxChoice::{Dis,En}ableEvents() methods in wxGTK.
This is more than a cosmetic change: adding "GTK" prefix in wxComboBox and not
doing it in wxChoice in r64436 broke the event generation for wxComboBox as it
didn't override wxChoice methods any longer but defined its own (useless) ones.
Using the same name for the methods in both classes notably fixes unexpected
event generation from wxComboBox::SetSelection().
Vadim Zeitlin [Fri, 15 Oct 2010 23:46:19 +0000 (23:46 +0000)]
Check for task dialog availability even under Vista and later.
Task dialogs are not always available under Vista and later Windows versions
because we might not be using the right (i.e. 6+) version of comctl32.dll.
Improve the check for task dialog availability and fall back to the classic
message box if we can't use it.
Vadim Zeitlin [Fri, 15 Oct 2010 23:46:04 +0000 (23:46 +0000)]
Fix GTK+ development RPM dependency in wxGTK.spec.
Apparently the standard name for this RPM is gtk2-devel and not
gtk+-2.0-devel, at least rpmfind.net database doesn't have any matches for the
latter and plenty for the former.
Vadim Zeitlin [Fri, 15 Oct 2010 23:45:58 +0000 (23:45 +0000)]
Fix button order in wxGTK wxMessageDialog and wxStdDialogButtonSizer.
The order of buttons in wxGTK wxMessageDialog was accidentally broken since
r55482 and wxStdDialogButtonSizer implementation for wxGTK was subsequently
modified to work in the same way as the broken version of wxMessageDialog.
Fix wxMessageDialog and remove the "compatibility" workarounds from
wxStdDialogButtonSizer to restore correct behaviour in both places.
Jaakko Salli [Fri, 15 Oct 2010 15:15:27 +0000 (15:15 +0000)]
Added wxNumericPropertyValidator, which is a custom wxTextValidator with more accurate filtering of inappropriate input for wxIntProperty, wxFloatProperty and wxUIntProperty (fixes #12563).
Vadim Zeitlin [Wed, 13 Oct 2010 22:53:50 +0000 (22:53 +0000)]
Skip Windows-only samples when making Unix distribution.
Some samples are by definition Windows-only so they don't have Makefile.in
files for Unix at all, skip them when creating the Unix distribution to avoid
errors due to attempts to copy non-existent files.
Julian Smart [Wed, 6 Oct 2010 20:22:03 +0000 (20:22 +0000)]
Eliminated redundant wxRichTextAnchoredObject class; refactored XML I/O code
so that objects can stream themselves; added a wxXmlDocument-based method
of writing XML, though this turned out to be much slower than writing directly
so the direct approach is retained and is the default (can be changed with wxRICHTEXT_USE_XMLDOCUMENT_OUTPUT).
Loading and saving new attributes implemented. Added custom properties to objects.
Vadim Zeitlin [Tue, 5 Oct 2010 13:38:05 +0000 (13:38 +0000)]
Destroy the in-place edit control in wxGenericListCtrl dtor.
If the in-place text control was still alive when wxGenericListCtrl was
destroyed, it resulted in asserts from wxWindow dtor about child windows still
being alive, so explicitly destroy it from wxListMainWindow dtor.
As this required a slightly different behaviour from wxListTextCtrlWrapper::
EndEdit(), replace its bool argument with an enum one which can take more than
2 values. Not using bool values when calling it also made the code more clear.
Finally, added a unit test verifying that the in-place control is indeed
destroyed correctly.
Julian Smart [Tue, 5 Oct 2010 06:17:22 +0000 (06:17 +0000)]
Added a flag suppressing node content conversion when saving to XML.
This helps improve the extremely poor performance of XML saving if
you have, for example, hex data that does not need conversion.
Vadim Zeitlin [Mon, 4 Oct 2010 10:53:37 +0000 (10:53 +0000)]
Don't throw assert failure exception in the test suite if it's unsafe.
Don't throw when already handling an exception as it would result in a call to
terminate() and no useful information about the test failure would be given.
Abort ourselves instead to at least give the message about the assert failure.
This should help debug the mysterious ListCtrlTestCase failures in buildbot
wxGTK builds.
Julian Smart [Mon, 4 Oct 2010 08:37:31 +0000 (08:37 +0000)]
wxRTC no longer derives from wxTextCtrlBase; added wxRichTextAttr deriving from wxTextAttr
with CSS-like attributes for future developments; removed image-specific attributes object
Vadim Zeitlin [Sun, 3 Oct 2010 17:34:22 +0000 (17:34 +0000)]
Fix use of DELETE and BACKSPACE when starting editing grid with them.
Using the current insertion position in wxGridCellTextEditor::StartingKey()
didn't make much sense, it was always 0 -- so DELETE worked as expected and
did delete the first character of the cell but BACKSPACE never did anything.
Just always delete the first character when DELETE is used and always delete
the last one when BACKSPACE is.
Vadim Zeitlin [Sun, 3 Oct 2010 17:34:15 +0000 (17:34 +0000)]
Fix non-ASCII key handling in wxGrid editors.
Use wxKeyEvent::GetUnicodeKey() correctly, there is no need to guess about
what does it return now that its correct behaviour is documented and
implemented. Simply check if it returns WXK_NONE to check for non-characters.
Also use WXK_START instead of hard-coded 255 when checking GetKeyCode()
result.
Vadim Zeitlin [Sun, 3 Oct 2010 17:16:15 +0000 (17:16 +0000)]
Disable the use of __thread with MinGW.
__thread keyword doesn't work correctly with at least some MinGW builds and in
particular TLS unit tests failed with the official 4.4 version.
Disable the use of __thread with MinGW entirely for now to be sure that the
generated code behaves correctly. In the future we should white list the known
good versions of MinGW and/or use run-time test for __thread support in
configure instead of compile-time one only.
Vadim Zeitlin [Sun, 3 Oct 2010 17:16:09 +0000 (17:16 +0000)]
Update CRT environment in wxSetEnv() for MinGW too.
MinGW uses the same CRT as MSVC so we can use the same _putenv() call for it
too. This ensures that wxGetenv() returns the value updated by wxSetEnv() and
fixes CrtTestCase::SetGetEnv() unit test when using MinGW.
Vadim Zeitlin [Sun, 3 Oct 2010 17:16:00 +0000 (17:16 +0000)]
Use wxUSING_VC_CRT_IO for MSVC CRT-specific test results.
Move USING_VC_CRT into testprec.h to allow its reuse in other files and rename
it to wxUSING_VC_CRT_IO as it only checks whether we're using MSVC STDIO
implementation and could be false even when we are otherwise using MSVC CRT.
Use this symbol for the tests whose result depends on the concrete version of
the CRT we use.
This fixes StringTestCase::FromDouble() failure under MinGW.
Vadim Zeitlin [Sun, 3 Oct 2010 17:15:52 +0000 (17:15 +0000)]
Fix DirTestCase to run on the systems without "C:" drive.
"C:" drive doesn't need to exist under Windows, rely on HOMEDRIVE environment
variable defined in all recent Windows versions to get a valid drive letter
(still fall back to "C:" if the variable is not defined -- we could have use
wxFSVolume to find it then but this seems like an overkill).
Vadim Zeitlin [Sun, 3 Oct 2010 17:15:46 +0000 (17:15 +0000)]
Run MBConvTestCase::LibcTests() only for MSVC and not other Windows compilers.
This test fails for MinGW, probably because its CRT doesn't use the same
locale names as MSVC CRT. Just disable it for now, as it was already disabled
for non-MSW platforms.
Also use LocaleSetter class (extracted from CLocaleSetter) to change the
locale for this test duration only to avoid affecting any tests running after
it.
Vadim Zeitlin [Sun, 3 Oct 2010 17:15:31 +0000 (17:15 +0000)]
No real changes, just simplify some MBConvTestCase code.
Remove unnecessary casts and initialize the variable with its contents
directly instead of using strange looking wxWCharBuffer ctor from size_t (even
if it did work, it was unnecessary).
Vadim Zeitlin [Sun, 3 Oct 2010 17:15:24 +0000 (17:15 +0000)]
Exclude tests relying on last error being set under MinGW.
The value of the last error seems to change somewhere between our code and
::GetLastError() call, probably in MinGW CRT, so exclude the tests relying on
it being preserved.
Vadim Zeitlin [Sun, 3 Oct 2010 17:15:18 +0000 (17:15 +0000)]
Correct wxConvAuto::ToWChar() behaviour with wxNO_LEN input size.
We didn't handle the case when the length of the input buffer was not
specified correctly and wxConvAuto::DetectBOM() could read beyond the end of
input. Moreover, the unit test actually relied on this as it didn't pass the
correct length for the literal strings with embedded NULs. This somehow worked
with MSVC but failed with MinGW (see #10713).
Correct the code to handle wxNO_LEN case correctly and fix the unit test to
pass the correct lengths.
Vadim Zeitlin [Sun, 3 Oct 2010 17:15:10 +0000 (17:15 +0000)]
Fix VsnprintfTestCase for recent MinGW versions.
MinGW now uses its own printf() implementation which handles %p differently
from the VC CRT one and uses %8x instead of %8X for it. Compare the results of
wxPrintf("%p") case-insensitively to let the test pass in any case.
Also introduce a USING_VC_CRT macro instead of testing for
__USE_MINGW_ANSI_STDIO in two different places.
Jaakko Salli [Sun, 3 Oct 2010 10:51:50 +0000 (10:51 +0000)]
In wxBitmapComboBox::RecreateControl(), always get recreated control's height from the best size, and also set the ComboBox item height with CB_SETITEMHEIGHT message (fixes #12515).
Vadim Zeitlin [Fri, 1 Oct 2010 13:05:42 +0000 (13:05 +0000)]
Add non-vararg wxFileTypeInfo ctor and various setters.
This allows to create wxFileTypeInfo objects in a more readable even if more
verbose way.
This should also incidentally fix the unit tests compilation with VC6 which
seems to have some existential troubles with the vararg ctor in debug DLL
build (only). Using the non-vararg ctor should hopefully make it happy and let
the unit tests pass with this compiler.
Also document wxFileTypeInfo class which wasn't documented at all.
Vadim Zeitlin [Fri, 1 Oct 2010 13:05:36 +0000 (13:05 +0000)]
Add wxHAS_BITMAPTOGGLEBUTTON and test for it in the unit test.
Not all ports define wxBitmapToggleButton class currently, so add a special
symbol which is defined only if this class is indeed available and test for it
in the unit test for this class.
Vadim Zeitlin [Fri, 1 Oct 2010 13:05:30 +0000 (13:05 +0000)]
Disable ItemClick() unit test for wxListCtrl under wxMSW.
This test just doesn't want to work on MSW buildbot slaves even though it
works perfectly locally. No idea why but disable it when running on a build
bot slave for now to let the entire test suite pass.
Also add a comment explaining why the test is disabled for wxGTK.
Disable wxEVT_COMMAND_LIST_ITEM_FOCUSED test for wxMSW.
This test fails on MSW buildbot slaves for unknown reasons so disable it to
make the test suite pass. The failure is irreproducible locally so no idea how
to debug this unfortunately.
Correctly convert wxPrintf() to a buffer even when it doesn't fit.
ConvertStringToBuf() helper function was defined incorrectly for converting
wxString to a char* buffer as it didn't fill the buffer at all if the string
didn't fit into it entirely instead of putting as much of the string into it
as possible as was already done for the conversion to wchar_t* buffer. This
broke wxSprintf()-related functions in when the ASCII output buffer was not
big enough as it was not filled at all.