Václav Slavík [Sat, 21 Sep 2013 09:28:47 +0000 (09:28 +0000)]
Revert "using #ifdef wxABORT_ON_CONFIG_ERROR not just #if as elsewhere"
This reverts commit r74656, because it breaks initialization order by
calling OnInit() too late. See
https://groups.google.com/d/topic/wx-dev/H5vgc2VO7K4/discussion
Use std::isfinite() for wxFinite() for C++11 compilers.
This should fix compilation with MinGW 4.8.1 cross-compiler in C++11 mode as
it doesn't seem to provide finite() any more then.
Also, only defined wxFinite() and wxIsNaN() for C++, not C. This makes the
checks for __cplusplus >= 201103 simpler and is consistent with how
wxIsSameDouble() and wxRound() were already only defined for C++ (this is also
the source of most of the changes in this diff, viewing it ignoring whitespace
will show the only real changes).
Václav Slavík [Wed, 18 Sep 2013 16:03:31 +0000 (16:03 +0000)]
Add wxTranslations::GetTranslatedString().
Replace GetString(), which always returns something (possibly the
original string) with GetTranslatedString() that returns either a
pointer to translated string or NULL.
This simplifies the code a bit, all handling of missing translations is
now done in wxGetTranslation().
Václav Slavík [Wed, 18 Sep 2013 16:03:20 +0000 (16:03 +0000)]
Make _() and friends safe to call from any thread.
The GetUntranslatedString() hack keeps a global copy of all strings, so
that it can return a const reference as wxGetTranslation() return value.
A global wxHashSet instance shared by all threads won't do, even guarded
with a critical section, because it may internally copy values on any
insert and thus invalidate pointers that may still be used on another
thread.
Add wxDataViewRendererBase::GetEffectiveAlignment() and use it.
This helper method falls back on the alignment of the column if the renderer
alignment is not specified. This is almost always what should be used instead
of GetAlignment() to determine the alignment that really should be used in the
drawing code.
In particular, using GetEffectiveAlignment() in wxDataViewCustomRenderer fixes
the problem with bitmap columns ignoring column alignment for their bitmaps.
Show full screen windows with WS_POPUP style in wxMSW.
This doesn't make any difference for most windows but fixes a problem with
wxGLCanvas windows using stereo support of Nvidia cards and generally it does
make sense to use WS_POPUP with full screen windows as they are definitely not
overlapped, so just use this style unconditionally.
Propagate the event handling fixes to wxVarScrollHelperBase.
Merge the fixes to wxScrollHelperBase::ProcessEvent() of r64358, r64370,
r64464, r72939 and possibly a few more in wxVarScrollHelperBase to fix its
behaviour too, as it wasn't generating the correct events any longer.
Unfortunately the fix right now is to physically copy the code from one class
to the other. This should be avoided, of course, and a more in depth
refactoring should be done to move the code common to both classes into
wxAnyScrollHelperBase after 3.0 release. But for now continuing to duplicate
code is better than not having a working wxVarScrollHelperBase.
Add wxAnyScrollHelperBase to reduce code duplication in wxVarScrollHelperBase.
This is just a small refactoring to move some trivially common parts of
wxScrollHelperBase and wxVarScrollHelperBase in a new common base class.
This will make it possible to apply other corrections to wxVarScrollHelperBase
without having to physically duplicate the code from wxScrollHelperBase in it.
Fix flickering of wxStaticBox background in wxMSW.
First of all, don't erase background in WM_ERASEBKGND at all if we erase it
anyhow in WM_PAINT, this is totally useless and is what wxBG_STYLE_PAINT is for.
Second, clip out not only the siblings of the static box but also its children
when erasing the background to avoid painting over the controls created as the
box children, which is the preferred way to create them now.
Don't crash when laying out wxGridBagSizer with only hidden elements.
wxGridBagSizer lay out algorithm needs at least a single row and a single
column to work, so simply don't run it at all if there is nothing to lay out.
Mention that wxSizer::Clear() always deletes child sizers.
The existence of "delete_windows" argument could mislead people into thinking
that sizers were not deleted neither when it had false value, see #15475.
Improve composite flags handling in the property grid wxFlagsProperty.
Don't consider that a flag is on just because one of its bits is enabled in
the current flags, for the composite flags (e.g. something like "BOTH = ONE |
TWO") all the bits composing the flag must be on for it to be enabled.
Steve Lamerton [Fri, 13 Sep 2013 12:55:08 +0000 (12:55 +0000)]
Handle WebKitWebView create-web-view.
In some cases a new window is signalled using create-web-view rather than new-window-policy-decision-requested and so we need to handle it to emit the correct new window events.
Handle non-ASCII output from lsb_release in wxGetLinuxDistributionInfo().
Assume that lsb_release always output UTF-8 text as this seems to be the case
right now for the only (common) Linux distribution which uses anything but
ASCII for its code name (Fedora 19 "Schrödinger's Cat").
Václav Slavík [Wed, 11 Sep 2013 15:20:21 +0000 (15:20 +0000)]
Don't lie about wxImageList in XRC format spec.
The documentation for setting image lists on controls was a complete
fabrication. It pretended that image lists were created as child
<object>s, while in reality they are properties just as e.g. fonts are.
Fix this and also better document the related 'image' property.
Václav Slavík [Wed, 11 Sep 2013 15:20:13 +0000 (15:20 +0000)]
Better name for wxXmlResource::GetDirection() argument.
'dir' is not very descriptive (of course it's a direction!), it's better
to include 'default' in the name to indicate this is the default value
to use in absence of a specific one.
Consistently handle DST start time in wxDateTime::Set().
Always move the dates invalid due to DST (i.e. falling into the "missing" hour
on the DST start date) forward, as GNU libc does, even when using a different
CRT implementation, such as MSVC one which moves the invalid dates backwards.
This seems more expected and also fixes an especially bad problem which
happened due to moving the date backwards in Brazilian time zone where DST
starts at midnight as doing this changed the day and totally broke ParseDate()
assumption that setting wxDateTime to 00:00:00 at the given date really did
set it to this date.
Add a convenience ShowWindowModalThenDo() variant of ShowWindowModal()
that takes a functor argument and calls it when the dialog is closed.
This is, of course, particularly useful when the argument is a C++11
lambda, especially when having more than one window-modal dialog invoked
from the same window, which can get messy quickly with all the
wxEVT_WINDOW_MODAL_DIALOG_CLOSED handlers.
Václav Slavík [Fri, 6 Sep 2013 17:09:05 +0000 (17:09 +0000)]
Add wxCondition::Wait() overload that also tests the condition.
Add Wait() overload that takes a functor argument and doesn't return
until the condition is signaled _and_ the predicate returns true. This
is useful for dealing with spurious wakeups and is modeled after C++11
std::condition_variable's corresponding method.
Fix bug with not selecting wxAuiNotebook page when its child was focused.
The code in OnChildFocusNotebook() handler only worked correctly if the page
itself was focused but not if the focus was given to one of its children --
which should still make the page itself current.
Revert wxDO_LOG_IF_ENABLED() change for MSVC6 in r74735.
The old solution worked fine for that compiler and the new one fails when
wxLogXXX() is used inside a switch statement to the wrong rules used by VC6
for the scope of the variables defined inside the for loop.
Simply revert back to using the old version for it, this will be easy to
re-revert after 3.0 by simply removing the check for it.
Restore correct wx-config creation and work around MinGW lack of symlinks.
This undoes the changes of r72205 and r72249 (see #14517) as using relative
paths for wx-config symlink didn't work correctly if non-default values for
$bindir and/or $libdir were used (i.e. if they were not siblings).
Instead, fix the original problem of lack of symlinks when using MinGW
directly: just use "cp -p" if "ln -s" fails. This should work everywhere and
do the right thing.
Correct erasing of background behind controls in a toolbar in wxMSW.
We need to handle WM_PRINTCLIENT in wxToolBar itself as the default handler
for this message forwards to WM_ERASEBKGND of the parent window and our
handler for that message only erases the client part of the window, in wx
sense, i.e. including a relatively big vertical offset accounting for the
toolbar. This means that when we get WM_PRINTCLIENT from the embedded control
drawing code, we don't erase anything at all as the control rectangle height
is smaller than the offset.
This fix is not perfect as ideally the existing MSWGetBgBrushForChild() should
be taken into account automatically by the default MSWPrintChild()
implementation but at least it fixes the ugly visual artefacts.
Add a test for a tooltip for a control inside a static box.
Also create the controls as children of the static box, not its siblings, to
make the tooltip work under wxGTK and because this is how we recommend doing
things now.
Add wxDEPRECATED_MSG() and use it in a couple of places.
This macro should be used instead of wxDEPRECATED() for the new deprecations
as it allows to give a helpful explanatory message (if supported by the
compiler) and also is simpler to use as it doesn't require wrapping the entire
declaration in it but can be simply used before it.
Also add wxDEPRECATED() support for clang as a side effect.
Remove superfluous mouse capturing in wxGrid row/column labels windows.
This code recaptured the mouse in the window which had already had it, thus
triggering the (recently added, see r74677) asserts in CaptureMouse(). It also
didn't preserve the invariant of m_winCapture always having the capture. And
it was apparently completely unnecessary too.
So simply remove it to fix the asserts while drag-resizing wxGrid rows/columns.
The code there was pretty wild, making clearly wrong assumptions (column size
doesn't, and AFAICS never did, include 20 pixel margin) and also was clearly
uncertain about what it was doing by trying to limit the number of iterations
to some arbitrary cutoff when it is pretty clear that the loop increasing the
width and decreasing the height on each iteration will reach the condition of
"width >= height*1.68" sooner or later.
Paul Cornett [Tue, 3 Sep 2013 05:37:30 +0000 (05:37 +0000)]
Fix referencing of cairo_t returned from wxDCImpl::GetCairoContext().
It was assumed that all callers were going to unref the cairo_t, but that is not
true, so callers that are going to unref it should ref it themselves.
See #15455
Vadim Zeitlin [Sat, 31 Aug 2013 17:41:16 +0000 (17:41 +0000)]
Rewrite wxLogXXX() macros to avoid "ambiguous else" warnings.
Use a dummy for loop instead of an if statement to avoid all problems with the
dangling else clauses: both the need for an artificially inversed "if" to make
the code like
if ( something )
wxLogError("...");
else
something-else;
to work as expected and to avoid warnings given by some versions of g++ and
clang for the code above advising to add explicit braces.
Vadim Zeitlin [Sat, 31 Aug 2013 17:41:13 +0000 (17:41 +0000)]
Removed a method using wxColour from non-GUI benchmark code.
No idea how could this work before but the presence of this code in the
non-GUI benchmark project prevented it from building. As it's not used anyhow,
just remove it.
Paul Cornett [Sat, 31 Aug 2013 03:25:12 +0000 (03:25 +0000)]
Don't update position of widgets in a wxPizza from size_allocate handler.
The values in m_{x,y} are not the same as client coordinates if the wxPizza is scrolled.
Closes #15444