Added support for reading comments from a GIF image.
Applied (modified) patch by troelsk. Changed comments (which are allowed per frame in an animated GIF) to be read using wxIMAGE_OPTION_GIF_COMMENT with wxImage.GetOption. Added unit tests for reading and writing GIF comments.
Václav Slavík [Mon, 31 Jan 2011 18:23:32 +0000 (18:23 +0000)]
Account for first removal char with wxELLIPSIZE_MIDDLE.
wxControl::Ellipsize() in wxELLIPSIZE_MIDDLE mode starts the
string-shortening loop with the removal interval initially set to remove
only the len/2-th character. But it didn't add its size to the running
total of removal characters' length, thus always removing one more
character. Fixed by making the initial interval 0-sized rather than
1-sized.
Václav Slavík [Mon, 31 Jan 2011 18:23:29 +0000 (18:23 +0000)]
Remove chars one-by-one with wxELLIPSIZE_MIDDLE.
Previously, Ellipsize() would always remove two characters at a time in
wxELLIPSIZE_MIDDLE mode. This was clearly a bug: it led to shortening
the text more than was strictly necessary.
Václav Slavík [Mon, 31 Jan 2011 16:54:03 +0000 (16:54 +0000)]
Fix vertical rules rendering in generic wxDataViewCtrl.
Vertical rules are now drawn in the last pixel of a column instead of in
the first, so that they align perfectly with native MSW wxHeaderCtrl as
well as for consistency with MSW native list control. There's no
vertical rule at the most-left side of the control anymore.
Vadim Zeitlin [Sat, 29 Jan 2011 13:55:40 +0000 (13:55 +0000)]
Revert "Set up pages range in the wxMSW print dialog correctly."
This patch changed the relative order of calls to wxPrintout::GetPageInfo()
and OnPreparePrinting(), breaking the existing code and the documentation
promise about OnPreparePrinting() being called first, so revert it.
Added support for writing a long comment to a GIF image.
Instead of limiting a comment to a maximum length of 255 bytes write multiple comment data blocks (each a Pascal string) followed by the block terminator.
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.