Vadim Zeitlin [Tue, 22 Feb 2011 13:25:51 +0000 (13:25 +0000)]
Put storage class outside WXDLLIMPEXP_DATA_CORE() macros.
The storage class must come first in a declaration so put it in front of
WXDLLIMPEXP_DATA_CORE() and not inside it to avoid warnings from some
compilers (notably Intel one).
Václav Slavík [Sun, 20 Feb 2011 18:18:51 +0000 (18:18 +0000)]
Put normal space between Back and Next buttons in wxWizard.
Use regular space between these two buttons even on Windows, where they
were previously close together. This used to be done in older Windows
versions, but modern Windows HIG documents show wizards with equal
spacing between all buttons and that's what Windows OS itself does. In
other words, not treating this pair of buttons specially is more native.
Vadim Zeitlin [Sat, 19 Feb 2011 14:16:58 +0000 (14:16 +0000)]
Remove extra semicolons in Objective-C code.
The semicolons after the method signature in its implementation are useless
and, in fact, provoke warnings from the compiler used by Xcode 4. Simply
remove them.
Vadim Zeitlin [Sat, 19 Feb 2011 12:33:08 +0000 (12:33 +0000)]
Add wxAutomationInstance_SilentIfNone flag for wxMSW OLE code.
This flag allows to suppress the error message in case there are no currently
running instances of this object and can be useful if the caller doesn't know
in advance whether it's available or not.
Vadim Zeitlin [Sat, 19 Feb 2011 12:32:59 +0000 (12:32 +0000)]
Move "static" keyword out from wxDEPRECATED() macros to placate icc.
Intel compiler gives warnings if the static keyword is not at the beginning of
the declaration and this happened when using it inside wxDEPRECATED() and
related macros because the declaration started with __declspec(deprecated) or
__attribute__((deprecated)) instead.
To avoid this problem, simply move "static" outside the macro.
Vadim Zeitlin [Sat, 19 Feb 2011 12:32:53 +0000 (12:32 +0000)]
Correct signed/unsigned comparison in wxGridBagSizer code.
Casting a signed value to unsigned type is a recipe for disaster if it
actually turns out to be negative because the comparison remains always false
and the loop becomes practically infinite. So cast the unsigned value to
signed int instead, this should be perfectly safe as the number of columns or
rows in a sizer can't exceed INT_MAX anyhow.
Notice that after the changes of the previous revision the signed value
should actually be always positive so this change is not strictly needed but
it is still safer to write the comparison like this.
Vadim Zeitlin [Sat, 19 Feb 2011 12:32:48 +0000 (12:32 +0000)]
Don't accept invalid values for rows/columns in wxGBSpan ctor.
wxGBSpan must have strictly positive row and column span as otherwise the grid
bag sizer code could enter an infinite loop trying to exceed a negative number
which it casted to an unsigned one. And while the cast itself is incorrect too
the program still behaves undesirably (produces a lot of asserts in debug
build and then crashes or crashes directly in release) if a zero size span is
used so it seems better to prevent this from happening.
Vadim Zeitlin [Sat, 19 Feb 2011 00:30:32 +0000 (00:30 +0000)]
Fix out of bounds string access in wxMSW wxDirDialog.
Using the initial directory of "/" (or "\\" or in fact any string consisting
solely of slashes and backslashes) resulted in a crash as the code incorrectly
tried to read the character before the beginning of the string.
Fix this by checking that the string is not empty before using s.end()-1
iterator.
Vadim Zeitlin [Mon, 14 Feb 2011 22:12:16 +0000 (22:12 +0000)]
Don't increase button height in wxMSWButton::GetFittingSize().
This is unnecessary and resulted in too high buttons in some cases for buttons
with images. As we increase the button height to at least the standard value
later in all code using function anyhow, it's not necessary to do anything
with the height inside it.
Now the buttons with an image get the same height whether they have the text
or not.
This change also gets rid of (completely arbitrary) decision to use 11/10 of
the label height when computing the fitting button size and it's always nice
to get rid of dirty hacks like this.
Vadim Zeitlin [Mon, 14 Feb 2011 22:12:10 +0000 (22:12 +0000)]
Don't make buttons with images too wide in wxMSW.
We used to increase the button size to the standard size first and then add
the extra padding the buttons with images. This resulted in too much padding
for the buttons with short text labels and images.
Instead, add the padding for the image first and only then increase the button
size to the standard one if still needed.
Vadim Zeitlin [Mon, 14 Feb 2011 22:12:04 +0000 (22:12 +0000)]
Don't add margins for buttons with text and images by default in wxMSW.
For some reason wxXPButtonImageData added (big) margins around the button by
default resulting in too much padding. Simply remove these margins to make it
behave similarly to wxODButtonImageData.
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.