Changed the procedure for writing a comment to a GIF image.
Use wxImage.SetOption with newly introduced wxIMAGE_OPTION_GIF_COMMENT to set a GIF's image comment now. Formerly this was done (since recently) using wxGIFHandler::ms_comment which has now been removed.
Vadim Zeitlin [Thu, 27 Jan 2011 13:27:09 +0000 (13:27 +0000)]
Fix link errors under Cygwin with wxUSE_GRAPHICS_CONTEXT==1.
Define ourselves _GdipStringFormatCachedGenericTypographic variable referenced
by Cygwin GDI+ headers to fix linking errors due to the fact that we don't
link with gdiplus.lib at all but load gdiplus.dll dynamically.
Fixed heap corruption when reading a corrupted RLE TGA image.
There were no boundary checks in place to verify an indicated repeat of pixels would still be inside the image's data. Added these checks and a unit test making sure these kind of TGAs now fail to load.
Jaakko Salli [Sun, 23 Jan 2011 10:13:49 +0000 (10:13 +0000)]
To work around harmless memory leaks reported by Visual C++ static runtime libs, assume that C++ typeid operator works well with VC++ 9.0 and later (fixes #12023)
The code and its assumptions were correct only for generic wxHeaderCtrl,
it didn't work for MSW implementation. Fixed by updating all columns
every time.
Use wxString's empty() when checking if the string is (non-)empty throughout wx.
Instead of constructs such as if "( s.length() )" and "if (s.length() > 0)" use "if ( !s.empty() )" instead. Similarly for "if (s.length() == 0)" or "if ( s.IsNull() )", use "if ( s.empty() )".
No code changes intended except for a few instances where a construct like "if ( s.length() && wxFileExists(s) )" was changed to not check the length of the string and let wxFileExists handle such cases.
Vadim Zeitlin [Thu, 20 Jan 2011 15:06:09 +0000 (15:06 +0000)]
Further improve caching of locale-specific data in wxNumberFormatter.
Also update the cached data if setlocale() was called explicitly instead of
using wxLocale to change the locale because at least under Unix systems
calling setlocale() changes the result of wxLocale::GetInfo() and so the
result returned by wxNumberFormatter::GetDecimalSeparator() and
GetThousandsSeparatorIfUsed() could be inconsistent with the locale being
really used.
Vadim Zeitlin [Wed, 19 Jan 2011 23:47:09 +0000 (23:47 +0000)]
Work around wxNumValidator compilation problems with MSVC 6.
Surprisingly, MSVC 6 seems to be able to compile most of the code but chokes
on a wxCOMPILE_TIME_ASSERT involving an inherited typedef. As this assert is
not critical, simply disable it for this compiler.
Vadim Zeitlin [Wed, 19 Jan 2011 15:08:11 +0000 (15:08 +0000)]
Use setUp/tearDown() for NumFormatter test case locale setup.
Setting the locale in the ctor of the test object doesn't work because the
locale is changed by the other tests that run before this one, use the
initialization method provided by cppunit to change the locale instead, this
is somewhat wasteful but at least it does work, unlike the old version.
Improved detection of alpha channels in TIFF images.
Some TIFF images are not properly formed, for example having an extra channel marked as being unspecified data while they should be treated as being an alpha channel. Detect some of those cases so that these TIFF images now will have alpha.
Applied (modified) patch by troelsk. Also added a basic unit test for checking the frames of a saved animated GIF (a previous unit test already handles content of a GIF with a single frame).
Vadim Zeitlin [Wed, 19 Jan 2011 10:48:10 +0000 (10:48 +0000)]
Update cached values in wxNumberFormatter when locale changes.
Caching the decimal and thousands separators in wxNumberFormatter is a useful
performance optimization, however it can give wrong results if the locale
changed since the cached values were initialized. So remember the locale used
for the initialization and redo it if it changed. This should still be almost
as fast as the previous version but now also correct (still not MT-safe
though).
Vadim Zeitlin [Wed, 19 Jan 2011 10:47:57 +0000 (10:47 +0000)]
Add support for long long to wxNumberFormatter.
It seems to make sense to allow using it for formatting and parsing long long
values as well as it can be done trivially using almost the same code as for
long.
It would be nice to support long double in a similar way but we don't wrap
C99 strtold() right now so it wouldn't be as simple, leave it for later.
Vadim Zeitlin [Wed, 19 Jan 2011 10:47:49 +0000 (10:47 +0000)]
Add wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG symbol.
Instead of writing a rather unreadable "defined(wxLongLong_t) &&
!defined(wxLongLongIsLong)" expression every time we need to decide if a
function needs to be overloaded for both long and long long, add a new symbol
which can be tested directly.
Jaakko Salli [Wed, 19 Jan 2011 09:33:17 +0000 (09:33 +0000)]
In wxStringProperty::ValueToString(), regenerate composed value string also when it was empty. This is needed in cases where property's children were added before property itself was added to the wxPropertyGrid (fixes #12877).
Robin Dunn [Wed, 19 Jan 2011 08:09:51 +0000 (08:09 +0000)]
On OSX don't propogate the alignment setting from column to renderer if it is a custom renderer. This allows the Render function to deal with the alignment itself and brings the behavior into alignment (pun intended!) with the GTK and generic DV classes. Fixes #12883
Jaakko Salli [Mon, 17 Jan 2011 10:11:49 +0000 (10:11 +0000)]
Changed wxMSW wxGraphicsContext font rendering and extent calculation to take into the account that the page scale has been manually changed when using print contexts (fixes #12830)
Vadim Zeitlin [Sun, 16 Jan 2011 23:24:21 +0000 (23:24 +0000)]
Override HasTransparentBackground() in wxHyperlinkCtrl to return true.
At least in wxMSW the control must override HasTransparentBackground() to
return true if it really wants its background to be transparent, so do it in
wxHyperlinkCtrlBase to fix the background appearance when using the generic
implementation in wxMSW.
Julian Smart [Fri, 14 Jan 2011 11:57:44 +0000 (11:57 +0000)]
Implemented text boxes and tables, and further editing pages for backgrounds, borders and margins.
wxRTC functions now operate on the currently focused object, which by default is the whole buffer.
Up to three property commands are now shown on the context menu, depending on
available objects in the current hierarchy.
Vadim Zeitlin [Thu, 13 Jan 2011 14:49:55 +0000 (14:49 +0000)]
Fixes for parsing invalid HTML without tag ends.
The code in wxHtmlParser supposed in many places that a '<' character must be
always followed by a '>' one and could create (and sometimes dereference)
invalid iterators if this wasn't the case resulting in asserts from MSVC debug
CRT and possibly crashes.
Fix this by ensuring that only valid iterators are used and add a trivial unit
test for wxHtmlParser which checks that it can parse invalid HTML without
crashing.
Vadim Zeitlin [Thu, 13 Jan 2011 14:49:44 +0000 (14:49 +0000)]
No changes, just remove a level of indentation in wxHtmlTagsCache ctor.
Get rid of characters not starting a tag immediately in the beginning of the
loop instead of putting the entire loop body inside an if statement. This
doesn't change anything (this becomes more apparent if the patch is viewed
with "ignore white space changes" option) except making the code easier to
read and modify.
Vadim Zeitlin [Wed, 12 Jan 2011 13:39:24 +0000 (13:39 +0000)]
Disable deprecation and other warnings in MFC sample.
VC8+ give tons of deprecation warnings for the standard functions which are
usually suppressed by wx headers but they need to be included first for the
suppression to be effective. In the MFC sample they were not resulting in many
useless warnings.
Fix this by pre-defining _CRT_SECURE_NO_WARNINGS to suppress them in the
sample itself.
Also suppress a warning about WINVER being undefined.
Vadim Zeitlin [Wed, 12 Jan 2011 13:39:16 +0000 (13:39 +0000)]
Fix entry point in Unicode build of the MFC sample.
MFC needs the entry point to be wWinMainCRTStartup() in Unicode builds but the
bakefile-generated projects use the default WinMain() so the sample didn't
link in Unicode.
Fix this by providing WinMain() which simply forwards to wWinMainCRTStartup()
as this seems to work for all MSVC/CRT versions.
Vadim Zeitlin [Mon, 10 Jan 2011 12:00:54 +0000 (12:00 +0000)]
Check index in wxItemContainer methods working with client data.
The test for index validity should be done by the base class public methods
themselves so that the protected methods in the derived classes don't need to
do it because this allows to have the check in one place only and not in every
port-specific derived class and also because a protected method can reasonably
expect to be called with already validated parameters.
This makes it unnecessary to perform the same check in many derived classes
and fixes the problem with those that forgot to check for item validity at all
before (like wxGTK wxChoice).
Also add a unit test checking for the correct behaviour. Unfortunately we
don't have any way to test for the precise assert being triggered so the test
passed for wxGTK wxChoice even before in debug builds because the expected
assert was raised by wxArray::Item() but the code crashed in release build --
whereas now it doesn't any more.