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.
Correct handling of %hs and %ls in our wxPrintf() implementation.
The strings corresponding to %hs and %ls are always narrow/wide independently
of the build so using wxArgNormalizedString which is defined differently in
different builds doesn't make sense in wxPrintf().
Instead, simply expect the parameter of the appropriate matching type for
these conversion specifications. Any conversions to it, if necessary, had been
already done before by wxFormatString.
This fixes some VsnprintfTestCase::BigToSmallBuffer() unit test failures.
Fix handling of asterisks in wxPrintf() implementation.
Count the number of asterisks before modifying the string we use to do this,
otherwise we were off by one for the format specifications containing two of
them.
This really fixes the handling of asterisks (used for width/precision) in
wxPrintf() format string, it wasn't done correctly by r60120 but now
VsnprintfTestCase::Asterisk() test does pass.
Somehow the expected assert is not generated by wxString::Format("%d", ptr)
with VC6. Disable this test to make the test suite pass for VC6 for now to at
least be able to monitor the appearance of the new errors in it.
Of course, this one should ideally be debugged (by someone who is interested
in VC6 support) as well...
Insert another item in the list control in its unit test.
For some reason the test fails with a single item in the control when running
on the buildbot slave, check if this is still the case if we add another item
to the control.
We can't clear a NULL buffer, the code didn't make any sense any more because
it wasn't updated when the function was changed as part of UTF-8 transition.
No changes whatsoever, just remove trailing whitespace.
There are no real changes in this commit but it removes all trailing white
space from our source files. This avoids problems when applying patches and
making diffs and it would be nice to prevent it from reappearing.
Include or forward declares the classes used by the header to make it
self-contained. Do not include wx/wx.h from the source file to make compiling
it faster when not using PCH.
This fixes compilation under Unix after SOC2010_RTC_IMAGES branch merge.
Added floating images and image property dialog to wxRichTextCtrl, by Mingquan
Yang as part of GSOC 2010. Also changed image block creation to use a memory
stream instead of creating a temporary file.
Ignore the unknown types of the script result, in particular don't crash
trying to dereference an uninitialized pointer if the script didn't return
anything.
Return wxFONTFAMILY_DEFAULT, not UNKNOWN, from wxFont::GetFamily().
Although returning wxFONTFAMILY_UNKNOWN when the font family is not recognized
makes more sense, it breaks a lot of existing code including all the
font-related code generated by DialogBlocks, so prefer to return
wxFONTFAMILY_DEFAULT instead -- which can't be confused for a valid font
family neither but can be passed to wxFont ctor or SetFamily() without
problems.
To ensure that this behaviour is correctly implemented by all ports, rename
the existing wxFont::GetFamily() to DoGetFamily() and call the new method from
wxFontBase::GetFamily() which adjusts the return value if needed.
Include wx/defs.h before testing for wxUSE_RADIOBOX.
We need to include wx/defs.h that (indirectly) defines wxUSE_RADIOBOX
before testing for it in wx/radiobox.h, otherwise the test may fail if the
latter header is the first wx header included by the user code.
This is similar to r65210 fix for wxUSE_CHECKLISTBOX.
Move wxObjectEventFunctor::operator() definition after wxEvtHandler
declaration as it uses call through a pointer to member of this class and Sun
CC refuses to compile this without having the full class declaration.
Use wxString methods for UTF-8 conversions in wxX11 code.
Use wxString::utf8_str() and FromUTF8() to convert to and from UTF-8. This is
more efficient than using wxConvUTF8 as the code did before as it avoids the
conversion entirely when wxString uses UTF-8 internally (as it does by default
in wxX11) and also has the advantage of compiling in STL build unlike the old
code.
Close a modal dialog even when it doesn't have any buttons.
The close button in the dialog title bar should work even if there are no
buttons in the dialog itself (unlike the Escape key which works as an
accelerator for a button), so close the dialog explicitly if the emulated
button click wasn't processed in wxDialogBase::OnCloseWindow().
std::tr1::unordeded_map<T *>::find() doesn't accept "const T *" pointer, at
least with MinGW 4.4.0 standard library version, so add an explicit
const_cast<> to fix compilation.
Compilation fix for MinGW 4.x in new keyboard code.
Explicitly choose the comparison operator to use when comparing wchar_t and
int values, otherwise MinGW (correctly) complains about ambiguity between
(int, int) and (wchar_t, const wxUniChar&) overloads.
There doesn't seem any reason to allow access to all the other struct Tm
fields but not yday so make it public, fill it in correctly when creating Tm
without using its ctor from struct tm and document struct Tm itself including
its yday field.
Set Tm::yday to a fixed value in the ctor as well instead of not initializing
it at all.
This bug actually didn't have any visible consequences as yday is currently a
private member of struct tm and didn't seem to be used anywhere but it at
least avoids MinGW 4.x warnings about possibly uninitialized variable and
might become important in the future if we allow accessing this field.