Vadim Zeitlin [Wed, 31 Oct 2012 00:17:17 +0000 (00:17 +0000)]
Define wxSOCKET_XXX flags as wxSOCKET_XXX_READ|wxSOCKET_XXX_WRITE.
The recently introduced (in r72591) wxSOCKET_{WAITALL,NOWAIT}_{READ,WRITE}
flags weere for some reason completely different and unrelated to the existing
bidirectional wxSOCKET_{WAITALL,NOWAIT} ones. Change this by defining the
bidirectional version simply as the sum of the two others. This makes much
more sense than testing for either wxSOCKET_XXX or wxSOCKET_XXX_READ or
wxSOCKET_XXX_WRITE being specified.
And it also fixes an assert in wxSocketWaitModeChanger where a sanity check
failed when this class was used with wxSOCKET_WAITALL|wxSOCKET_WAITALL_READ.
Vadim Zeitlin [Mon, 29 Oct 2012 14:50:42 +0000 (14:50 +0000)]
Get rid of wxAuiToolBar::m_style and just use base class m_windowStyle.
This fixes an assert exposed by the addition of wxAuiToolBar::Create() in
r72785: as m_style was not initialized before, calling GetWindowStyle() from
wxControl::Create() returned wrong flags.
Fix this by just removing m_style completely, there doesn't seem to be any
need for it nor for overriding GetWindowStyleFlag().
Vadim Zeitlin [Mon, 29 Oct 2012 01:20:21 +0000 (01:20 +0000)]
Avoid double destruction of wxTipWindow under wxOSX.
Hiding the window results in wxEVT_KILL_FOCUS under OS X and this destroys it
already, so when we call Destroy() from wxTipWindow::Close() later, it
triggers assert about destroying it twice.
Avoid doing this under OS X for now, even though the real problem is probably
the discrepancy in wxEVT_KILL_FOCUS event generation under different platforms.
Vadim Zeitlin [Sat, 27 Oct 2012 12:28:00 +0000 (12:28 +0000)]
Allow using wxTextMeasure::GetLargestStringExtent() with wxArrayString.
Change the signature of this method to take the number of strings and the
pointer to the first of them instead of wxVector<wxString> as this allows it
to be used with all of wxVector<wxString>, wxArrayString and raw arrays of
wxStrings.
Also return the computed size from it instead of filling output parameters.
Vadim Zeitlin [Sat, 27 Oct 2012 00:46:58 +0000 (00:46 +0000)]
Break implicit dependency of "core" on "adv" via wxXmlResourceHandlerImplBase.
wxXmlResourceHandlerImplBase::GetAnimation() returned wxAnimation by value
which created references to wxAnimationCtrlNameStr and wxNullAnimation
symbols, defined in the "adv" library, in "core" when using Sun CC even though
they were not referenced directly.
Fix this by returning wxAnimation by pointer to keep it opaque for "core" code.
Vadim Zeitlin [Thu, 25 Oct 2012 23:26:36 +0000 (23:26 +0000)]
Store the selected directory in wxGTK wxDirDialog.
This should help with the selected directory not being remembered since
GTK+ 2.24.11 as apparently gtk_file_chooser_get_filename() doesn't work any
more now after hiding the dialog -- so call it before doing this and save the
result.
Also get rid of the ugly and apparently completely unnecessary OnFakeOk().
Vadim Zeitlin [Thu, 25 Oct 2012 23:26:32 +0000 (23:26 +0000)]
Prevent pasting too much text into limited length wxTextCtrl in wxGTK.
Improve insert-text signal handler to block pasting text into the control,
which may overflow the specified max length in one action, and not only
entering individual characters.
Vadim Zeitlin [Thu, 25 Oct 2012 22:30:43 +0000 (22:30 +0000)]
Make wxFILE_EXISTS_SYMLINK work on its own, without wxFILE_EXISTS_NO_FOLLOW.
Include the wxFILE_EXISTS_NO_FOLLOW bit in wxFILE_EXISTS_SYMLINK definition to
allow using just wxFileName::Exists(wxFILE_EXISTS_SYMLINK) which used to never
work because the link was followed.
Vadim Zeitlin [Thu, 25 Oct 2012 22:19:20 +0000 (22:19 +0000)]
Include wx/xml/xml.h from the XRC handlers that need it.
Including this header from wx/xrc/xmlres.h itself only when WXMAKINGDLL_XRC is
defined doesn't work when we're building a static library and not a shared/DLL
one and we don't have any symbol defined in this case, so just don't try to be
smart and include this header from the files that need it.
Vadim Zeitlin [Wed, 24 Oct 2012 18:34:19 +0000 (18:34 +0000)]
Try to avoid accidental use of wxXmlNode in XRC handlers.
Now that the handlers can be defined outside of the XRC library, we can't use
wxXmlNode in them because this would create an (unsatisfied) link dependency
on the xml library.
To avoid this happening accidentally, don't include wx/xml/xml.h from the XRC
header, unless building the xrc library itself.
Vadim Zeitlin [Wed, 24 Oct 2012 18:33:57 +0000 (18:33 +0000)]
Disable dropdown menu support in wxRibbonXmlHandler.
The code handling it uses wxXmlNode directly as it's written now which isn't
allowed as it introduces a dependency of ribbon library on the xml one and so
currently breaks linking of the ribbon DLL under MSW.
Vadim Zeitlin [Wed, 24 Oct 2012 18:22:39 +0000 (18:22 +0000)]
Don't call wxSafeYield() from wxGenericListCtrl::EditLabel().
This could result in wxYield() reentrancy and while it could be avoided by
using wxSafeYield(NULL, true /* only if needed */) it seems that we don't
actually need to yield here at all and a simple Update() should be enough.
Vadim Zeitlin [Wed, 24 Oct 2012 00:25:09 +0000 (00:25 +0000)]
Don't use Shift-TAB in keyboard test.
This key combination seems to be intercepted by GTK now for keyboard
navigation purposes and we never get key up events for it. Just use a
different key.
Vadim Zeitlin [Tue, 23 Oct 2012 23:58:17 +0000 (23:58 +0000)]
Don't follow symlinks in wxFileName::Rmdir(wxPATH_RMDIR_RECURSIVE).
Following symlinks, possibly leading outside of the directory being removed,
is at best surprising and at worst dangerous, so don't do it and just mimic
the behaviour of "rm -rf", i.e. remove everything inside this directory,
including the symlinks themselves, but don't follow them.
Vadim Zeitlin [Tue, 23 Oct 2012 23:57:54 +0000 (23:57 +0000)]
Mention wxFILE_EXISTS_NO_FOLLOW in wxFILE_EXISTS_SYMLINK description.
Using wxFILE_EXISTS_SYMLINK without wxFILE_EXISTS_NO_FOLLOW can only be
fruitless, so mention that they should normally be used together in the
documentation.
An alternative solution would be to always add wxFILE_EXISTS_NO_FOLLOW
automatically if wxFILE_EXISTS_SYMLINK is used, perhaps we should do this
instead.
Vadim Zeitlin [Tue, 23 Oct 2012 23:57:32 +0000 (23:57 +0000)]
Add wxDIR_NO_FOLLOW flag for wxDir iteration.
This flag allows to avoid following the symbolic links during the directory
traversal. In particular, this means that links to the directories
(potentially outside the directory being traversed) are not considered as
directories at all when it is used, potentially avoiding surprises.
Vadim Zeitlin [Tue, 23 Oct 2012 23:57:07 +0000 (23:57 +0000)]
Change the way directory iteration flags are constructed.
Instead of explicitly constructing the flags from the flags that should be
included, construct them by excluding the flags that shouldn't be used. This
makes the code more stable in the sense that it will continue to work when new
flags, such as the upcoming wxDIR_NO_FOLLOW, are added.
Vadim Zeitlin [Tue, 23 Oct 2012 14:03:53 +0000 (14:03 +0000)]
Guard gmake-specific syntax with IF_GNU_MAKE in make_dist.mk.
Debian distribution target uses GNU make extensions to make syntax which makes
the entire makefile impossible to use with other make versions, e.g. Solaris
make.
Fix this by prepending IF_GNU_MAKE to all Debian-specific lines, there should
be never any need to use them with non-GNU make.
Vadim Zeitlin [Tue, 23 Oct 2012 13:51:32 +0000 (13:51 +0000)]
Refactor wxXRC to allow defining handlers outside of xrc library.
Split wxXmlResourceHandler into an ABC and the real implementation to allow
referencing the ABC in the core library itself but without pulling in all of
the XRC into it. This also allows defining XRC handlers, which only depend on
this ABC and not the xrc library, in other libraries, such as richtext, as
demonstrated by the now enabled wxRichTextXMLHandler.
Vadim Zeitlin [Tue, 23 Oct 2012 12:02:47 +0000 (12:02 +0000)]
Process pending events from wxYield() in wxGTK.
Calling wxYield() is supposed to process the pending events but it didn't, any
more, in wxGTK. Restore this by explicitly calling ProcessPendingEvents() from
wxGTK wxYield() implementation as wxGUIEventLoop::ProcessIdle() does not call
it, in spite of a comment to the contrary in the sources.
Vadim Zeitlin [Tue, 23 Oct 2012 12:02:24 +0000 (12:02 +0000)]
Add wxEvtHandler::CallAfter() for asynchronous method calls.
Add wxAsyncMethodCallEvent that is handled simply by calling the method this
event was created for and add default handler for this event to wxEvtHandler.
Implement CallAfter() overloads for up to 2 parameters only for now.
Vadim Zeitlin [Mon, 22 Oct 2012 21:46:46 +0000 (21:46 +0000)]
Fix border size computation in wxAuiTabArt.
Space was reserved for the borders even when it wasn't filled, resulting in
visual artefacts. Fix this by virtualizing the function returning the
additional space needed for the borders and only overriding it to return non
zero in wxAuiGtkTabArt.
Vadim Zeitlin [Mon, 22 Oct 2012 15:51:49 +0000 (15:51 +0000)]
Set C++ global locale too in wxAppTraitsBase::SetLocale().
Ensure that C++ locale matches the C one, otherwise operations on C++ streams
may get much slower because some implementations (notable MinGW-64) change and
reset the C locale on every function call in this case.
Vadim Zeitlin [Mon, 22 Oct 2012 15:51:26 +0000 (15:51 +0000)]
Revert accidental incompatible change to wxFileName::DirExists().
The non-static version tests for the existence of the directory part of the
object only as is explicitly mentioned in the documentation, so do the test on
GetPath() and not GetFullPath() as we did since r72707.
Vadim Zeitlin [Mon, 22 Oct 2012 11:21:02 +0000 (11:21 +0000)]
Ensure the correct cleanup order for GDI+-related modules in wxMSW.
GDI+ DLL could be unloaded by wxGdiPlusModule before wxGDIPlusRendererModule::
OnExit() was called, resulting in a crash when trying to call a GDI+ function
from the latter.
Fix this by adding a correct dependency between the modules.
Vadim Zeitlin [Fri, 19 Oct 2012 22:02:15 +0000 (22:02 +0000)]
Allow testing for existence of specific file types in wxFileName.
Add "flags" parameter to wxFileName::Exists() to allow testing for the
existing of files of specific type: not only regular or directory but also
symlink, device, FIFO or socket.
And also to pass wxFILE_EXISTS_NO_FOLLOW flag inhibiting following the
symlinks without using DontFollowLink().
Vadim Zeitlin [Fri, 19 Oct 2012 11:06:14 +0000 (11:06 +0000)]
Remove assert checking for valid font in wxMSW wxDC::GetTextExtent().
It wasn't there before wxTextMEasure changes and it doesn't seem obvious why
should it be there, it should be possible to measure the text using the
default wxDC font without setting one explicitly.
Vadim Zeitlin [Fri, 19 Oct 2012 10:42:57 +0000 (10:42 +0000)]
Invalidate wxGrid best size when the grid is changed.
Don't keep using the cached best size if rows/columns are added/removed
to/from wxGrid or resized, doing this meant that we always used the first
computed best size which was way too small after adding rows/columns to the
grid.
There could be more places where the grid best size may need to be invalidated
but this should be a good start.