Vadim Zeitlin [Sun, 27 Feb 2011 12:48:13 +0000 (12:48 +0000)]
Add wxDC::GetFontMetrics() and implement it for wxMSW.
Add a new wxDC method allowing to retrieve the font characteristics not
available from GetTextExtent(), notably the internal leading (and also the
average font width).
Currently this is implemented for wxMSW only, the internal leading is always 0
in the other ports.
Vadim Zeitlin [Sun, 27 Feb 2011 12:47:48 +0000 (12:47 +0000)]
Restore height tweaking in wxMSWButton::GetFittingSize().
The change of r66893 was wrong, we do need to adjust the button height here
because the increase to standard height is not enough if we use bigger fonts
that require making taller buttons.
The real problem was the use of EDIT_HEIGHT_FROM_CHAR_HEIGHT() which added too
much to the height, so replace it with something based on the actual font
height. This is still arbitrary but slightly better.
Vadim Zeitlin [Sun, 27 Feb 2011 12:47:43 +0000 (12:47 +0000)]
Initialize wxButton::m_authNeeded in ctor and not Create() in wxMSW.
Ensure that the member is always initialized as calling GetAuthNeeded() for a
default-constructed button would access a non-initialized variable before.
Vadim Zeitlin [Sun, 27 Feb 2011 12:47:36 +0000 (12:47 +0000)]
No changes, just do wxButton fields initialization in Init() in wxMSW.
Add a helper function called from ctors and initialize m_imageData in it
instead of doing it in each ctor -- this will be more important when we add
more wxButton members.
Vadim Zeitlin [Sun, 27 Feb 2011 12:47:26 +0000 (12:47 +0000)]
Replace wxST_MARKUP style with wxControl::SetLabelMarkup().
This is an incompatible change which removes the wxStaticText-specific
wxST_MARKUP style and adds wxControl::SetLabelMarkup() replacing it.
It doesn't actually change anything yet but it simplifies wxStaticText code a
lot by getting rid of many markup-related functions in it which had to behave
differently depending on whether wxST_MARKUP was used or not and also paves
way for adding markup support for the other controls in the future.
Vadim Zeitlin [Sun, 27 Feb 2011 12:47:15 +0000 (12:47 +0000)]
Don't call base class SetLabel() from GTKSetLabelForLabel().
Calling wxControlBase::SetLabel() only from GTKSetLabelForLabel() made its
behaviour inconsistent with GTKSetLabelWithMarkupForLabel() and also was
redundant in all but two places from which it was called, so remove this call
from this function itself and instead add it to its callers where it's really
needed.
Vadim Zeitlin [Sun, 27 Feb 2011 12:47:11 +0000 (12:47 +0000)]
Remove unnecessary use of RemoveMarkup() in wxMSW wxHyperlinkCtrl.
Only the ampersands need to be escaped when setting the text of a native hyper
link control in MSW and this is done by wxControl::EscapeMnemonics(), not by
wxStaticText::RemoveMarkup() which also removes any tags which is not wanted
at all here.
Vadim Zeitlin [Sun, 27 Feb 2011 12:47:05 +0000 (12:47 +0000)]
Add wxFont::SetSymbolicSize() and SetSymbolicSizeRelativeTo().
These methods allow to set the font size using CSS-like absolute size
specifications.
Notice that the factors used here are incompatible with (but better than) the
ones used in wxBuildFontSizes() in src/html/winpars.cpp. In the future it
would be nice to reuse the new wxFont functions in wxHTML code.
Vadim Zeitlin [Sun, 27 Feb 2011 12:46:55 +0000 (12:46 +0000)]
Use wxMarkupParser in wxStaticText for dealing with markup.
No real changes, just remove markup parsing code from wxStaticText
implementation and reuse wxMarkupParser methods there instead.
This makes include/wx/private/stattext.h file unnecessary as it is used only
in a single place now so remove it and move its remaining contents to
src/gtk/mnemonics.cpp.
Vadim Zeitlin [Sun, 27 Feb 2011 12:46:34 +0000 (12:46 +0000)]
Add a simple wxStack<> template class based on wxVector<>.
This is still simpler than std::stack<> which can be used with any container
and not just wxVector<> but better than the WX_DECLARE_STACK() macro which was
all that we had before.
Vadim Zeitlin [Sun, 27 Feb 2011 12:45:30 +0000 (12:45 +0000)]
Disable NumValidatorTestCase::Interactive() for build bot slaves.
This test consistently fails on the MSW build slave machines (see e.g.
http://buildbot.tt-solutions.com/wx/builders/XPSP2 VC9 wxMSW trunk release/builds/2084/steps/test/logs/stdio)
for unknown reason so disable it for them. Notice that it does pass when ran
locally so it looks like another instance of a problem with wxUIActionSimulator
on these machines rather than the problem with the class itself.
Vadim Zeitlin [Sun, 27 Feb 2011 12:45:24 +0000 (12:45 +0000)]
Only use wxBU_EXACTFIT for width calculations in wxMSW wxButton.
wxBU_EXACTFIT should affect the width of the button best size but not its
height which should be at least the same as the height of a standard button
even when wxBU_EXACTFIT is specified, otherwise buttons created with it (like
the one in generic wxCollapsiblePane implementation) look completely ugly.
This commit restores the old behaviour which was recently changed by wxButton
sizing code simplifications.
Vadim Zeitlin [Sun, 27 Feb 2011 12:45:19 +0000 (12:45 +0000)]
Specify correct size for disabled image list in wxMSW wxToolBar.
Use the real bitmap size instead of the default tool size when creating the
disabled image list as the actual bitmap size could be less than the default
one and in this case adding images to the image list later would fail (as
could be seen by using custom bitmaps in the toolbar sample).
Vadim Zeitlin [Sat, 26 Feb 2011 17:51:34 +0000 (17:51 +0000)]
Fix libraries order in screenshotgen bakefile.
The richtext library must come before the adv one as it depends on the classes
in the latter and with the old libraries order linking failed in static build.
Vadim Zeitlin [Sat, 26 Feb 2011 17:46:54 +0000 (17:46 +0000)]
Don't use wxTE_PROCESS_ENTER in wxSpinCtrlGeneric.
We don't need to catch Enter presses to generate spin control events as we do
it anyhow when we lose focus. So simply remove the Enter handling code
entirely (it could be used to generate wxEVT_COMMAND_TEXT_ENTER events but we
don't generate them nor wxEVT_COMMAND_TEXT_UPDATED at all currently in the
generic version).
Jaakko Salli [Fri, 25 Feb 2011 13:00:57 +0000 (13:00 +0000)]
In wxPGProperty::SetValueImage(), use wxImage::Rescale() for scaling down the bitmap instead of wx(Memory)DC functions. Results should look much nicer and also retains alpha channel with much less effert.
Vadim Zeitlin [Tue, 22 Feb 2011 13:26:00 +0000 (13:26 +0000)]
Test for cairo_push_group() in configure.
This function is required by wxGraphicsContext Cairo-based implementation but
is missing in old Cairo versions so check for it in configure and disable
wxGraphicsContext is it's not available.
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.