Vadim Zeitlin [Mon, 14 Feb 2011 12:30:43 +0000 (12:30 +0000)]
Remove X11-specific wxWindowIsVisible() from common Unix file.
XGetWindowAttributes() used in this function resulted in link problems under
Fedora 14 because we don't explicitly link with libX11. Instead of doing this,
simply get rid of this function as it seems to be used in exactly one place in
wxX11 code only anyhow.
Václav Slavík [Wed, 9 Feb 2011 19:52:34 +0000 (19:52 +0000)]
Don't eliminate text completely in Ellipsize().
If the shortened text is so short there's nothing left of the original,
show one character and "...". This is standard behaviour on both
Windows and OS X, in addition to making lot of sense.
Václav Slavík [Wed, 9 Feb 2011 19:52:22 +0000 (19:52 +0000)]
Calculate ellipsized width exactly.
Width calculation using partial extents is just an inaccurate
estimate: partial extents have sub-pixel precision and are rounded
by GetPartialTextExtents(). Use partial extents to
estimate string width and only verify it with GetTextExtent()
when it looks good.
Václav Slavík [Wed, 9 Feb 2011 19:52:10 +0000 (19:52 +0000)]
Don't shorten text too much in wxControl::Ellipsize().
If the allowed width is so small that nothing reasonable can fit it,
overlap it. Ellipsized text must always contain "..." to indicate that
it was shortened, it isn't acceptable to omit it.
Václav Slavík [Wed, 9 Feb 2011 19:51:58 +0000 (19:51 +0000)]
Ellipsization can't shorten 1-character string.
It doesn't make sense to attempt to shorten 1 character long string, so
don't do it. Note that 2 characters strings may be shortened (consider
e.g. "mm" in some typefaces).
Václav Slavík [Wed, 9 Feb 2011 19:51:47 +0000 (19:51 +0000)]
Remove "safety margin" from wxControl::Ellipsize().
When ellipsizing kicks in, the text is much shorter than the available
space -- there's a "safety margin" of one character's width that is
always left unused. This appears to be some kludge that worked around
algorithm defects, not something that should really be needed.
Vadim Zeitlin [Tue, 8 Feb 2011 17:24:50 +0000 (17:24 +0000)]
Tweak offset in the RichTextCtrlTestCase::UrlEvent() to make it pass.
The mouse was not positioned over the URL in this test so clicking it didn't
work. Tweak the offset to make it pass but it would be better to have some
more fool-proof way of finding the real position of the text in the control.
Vadim Zeitlin [Tue, 8 Feb 2011 17:24:45 +0000 (17:24 +0000)]
Use wxLocale instead of setlocale() to change the locale in the tests.
Numeric validator tests rely on wxLocale::GetInfo() returning the decimal
point and calling setlocale() is not enough to ensure this under MSW, we must
use wxLocale for this currently.
Vadim Zeitlin [Sun, 6 Feb 2011 01:00:48 +0000 (01:00 +0000)]
Use Explorer style for wxTreeCtrl with wxTR_TWIST_BUTTONS in wxMSW.
The tree control style used by Explorer uses rotating triangles instead of the
standard "+/-" buttons and so seems to correspond relatively well to this
style. And this provides a possibility to have a more standard-looking tree
controls in wxWidgets programs.
Vadim Zeitlin [Sun, 6 Feb 2011 01:00:40 +0000 (01:00 +0000)]
Clean up wxMSW wxTreeCtrl code by removing obsolete workarounds.
Remove wxUSE_COMCTL32_SAFELY that hasn't been needed for years, the current
code seems to work just fine on all the systems so remove this obsolete
workaround to simplify it.
Vadim Zeitlin [Sat, 5 Feb 2011 20:25:09 +0000 (20:25 +0000)]
Link console programs with PNG library in monolithic build.
PNG images are used by the main wxWidgets library itself now and so linking
with the monolithic wx library introduces dependencies on PNG as well, even
for the console applications. Link them with linpng to avoid linker errors.
Vadim Zeitlin [Sat, 5 Feb 2011 20:24:52 +0000 (20:24 +0000)]
Correct decoding of 4-byte integers in png2c script.
Wrong multiplier was used for the most significant byte. Fix it even though it
doesn't risk to be a problem in practice as the images of such gigantic size
would surely break some limit anyhow.
Vadim Zeitlin [Sat, 5 Feb 2011 20:24:47 +0000 (20:24 +0000)]
Re-enable generation of wxEVT_MOVE_{START,END} events under wxMSW.
Handling of WM_{ENTER,EXIT}SIZEMOVE was disabled as a side-effect of r47927,
possibly unintentionally. Revert this change to generate these events again.
Vadim Zeitlin [Sat, 5 Feb 2011 16:38:53 +0000 (16:38 +0000)]
Don't adjust menu item positions for title for menubar menus in wxMSW.
The code in wxMSW menu code which accounted for the extra items used to show
popup menu title has become incorrect since the changes of r66178 as now the
non-popup menus have titles as well.
Correct the check to only do the adjustment for the popup menus.
Vadim Zeitlin [Sat, 5 Feb 2011 16:36:30 +0000 (16:36 +0000)]
Deprecate second parameter of wxSlider::SetTickFreq().
This parameter was never needed nor properly documented. Simply remove it from
SetTickFreq() and keep the overload still taking it for backwards
compatibility only.
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.