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.
Vadim Zeitlin [Wed, 17 Oct 2012 22:35:49 +0000 (22:35 +0000)]
Factor out text measurement from wxDC and wxWindow into wxTextMeasure.
Add a new private wxTextMeasure class implementing methods for measuring text
and move the often duplicated (but not always identically) code for doing the
same from wxDC and wxWindow into it.
Currently this class is only really implemented in wxMSW and wxGTK.
Also extend the test for text measuring functions and rename it to
MeasuringTextTestCase from MeasuringContextTestCase as it's not wxGC-specific
any more.
Vadim Zeitlin [Wed, 17 Oct 2012 16:44:02 +0000 (16:44 +0000)]
Fix wxGrid editors background painting.
There were two fundamental problems: first, we painted on a separately created
wxClientDC instead of using the wxPaintDC already available in wxGrid. Second,
we invalidated the control while painting, resulting in endless repainting, at
least under wxGTK.
Fix the first problem by passing wxDC to wxGridCellEditor::PaintBackground()
and the second one by not refreshing the control from there as it just seems
unnecessary.
Also pass the attribute by reference for consistency with
wxGridCellRenderer::Draw() and because this pointer can never be NULL.
Vadim Zeitlin [Mon, 15 Oct 2012 01:17:21 +0000 (01:17 +0000)]
Correctly document the library the classes belong to.
Many classes were documented as being in a wrong library, mostly a lot of
wxbase vs wxcore confusion but we even managed to document wxAuiManager as
being in wxbase. Correct all this.
Vadim Zeitlin [Mon, 15 Oct 2012 01:13:01 +0000 (01:13 +0000)]
Make help strings for --enable-webview* configure options match their names.
The options didn't have the underscore shown in the help message, so remove
the underscore (while it could be argued that underscore makes the option
names more readable, it seems better to preserve the existing names for
compatibility).
Vadim Zeitlin [Mon, 15 Oct 2012 01:09:25 +0000 (01:09 +0000)]
Check for filespec when generating events in wxFileSystemWatcher.
Instead of setting watches on individual files when a non-empty filespec is
given, always watch all the files but just ignore the events from the ones not
matching the filespec. This makes the code simpler and fixes several bugs.
Vadim Zeitlin [Mon, 15 Oct 2012 01:09:01 +0000 (01:09 +0000)]
Add support for symlinks to wxFileName.
Allow to work with the symlinks themselves and not the file they reference by
calling the new wxFileName::DontFollowLink().
Update Unix wxDir implementation to not treat symlinks to directories as
directories, this ensures that we don't recurse into the directories outside
of the original parent accidentally.
Vadim Zeitlin [Mon, 15 Oct 2012 01:08:37 +0000 (01:08 +0000)]
Make wxFileSystemWatcher watch entries reference-counted.
This helps to avoid problems that arise from watching the same physical file
system path multiple times, which could happen when adding a watch for a path
already watched because of a recursive watch on a parent directory, for
example.
Václav Slavík [Sun, 14 Oct 2012 19:30:46 +0000 (19:30 +0000)]
anybutton.cpp compilation fix for wxUSE_IMAGE=0.
Disabled bitmaps are not rendered properly in this configuration, they
look the same as normal ones. This is hardly ideal, but such
degradations are to be expected when disabling something as widely used
as wxImage.
Vadim Zeitlin [Sun, 14 Oct 2012 14:55:32 +0000 (14:55 +0000)]
Make GetClippingBox() work for wxPrinterDC in wxGTK.
GetClippingBox() implementation relies on wxDCImpl::m_clip[XY][12] being
updated in DoSetClippingRegion() but this wasn't done here. Fix this by adding
the code to do this to the base class version of this method and calling it
from wxGtkPrinterDCImpl.
Also, refactor wxGCDCImpl to reuse the same code instead of duplicating it.
Vadim Zeitlin [Sat, 13 Oct 2012 22:55:18 +0000 (22:55 +0000)]
Make TAB behaviour in wxGrid more configurable.
Allow making TAB/Shift-TAB wrap to the next/previous row or going to the
next/previous control when the cursor is at the end/beginning of the current
row easily.
Also add wxEVT_GRID_TABBING event to allow customizing TAB behaviour even
further.
Update the sample to show the different possible standard behaviours and a
stupid example of a custom one (it would be probably more useful to implement
something a tad more realistic, e.g. tabbing to the next non-empty cell).
Vadim Zeitlin [Sat, 13 Oct 2012 22:53:46 +0000 (22:53 +0000)]
Display system-provided drag images during drag-and-drop in wxMSW.
This is especially useful when dragging files from Explorer as it provides
big, informative drag images for them that can be easily displayed using
Windows shell support for them.
Vadim Zeitlin [Sat, 13 Oct 2012 22:52:59 +0000 (22:52 +0000)]
Set the standard sample icon for the exec sample.
Do this for consistency with all the other ones and also because it makes it
simpler to notice any unwanted icons for hidden windows created by this sample.
Vadim Zeitlin [Sat, 13 Oct 2012 22:52:35 +0000 (22:52 +0000)]
Freeze wxTreeCtrl in wxMSW by hiding it.
This is far from perfect but better than alternative as freezing this control
by sending WM_SETREDRAW to it can result in completely broken behaviour as
explained in http://support.microsoft.com/kb/130611. And not freezing it at
all shows horrible flicker when adding even a relatively small number of items
at once to the control because it recalculates and repositions its scrollbars
after every parent node addition.
Vadim Zeitlin [Sat, 13 Oct 2012 22:52:12 +0000 (22:52 +0000)]
Set wxTAB_TRAVERSAL for wxNavigationEnabled<> windows with focusable children.
We need to have this flag under wxMSW in order for navigation events to be
generated for the window. As wxNavigationEnabled can't set this flag on
creation because its ctor is called too early, do it in overridden AddChild().
Vadim Zeitlin [Sat, 13 Oct 2012 22:51:50 +0000 (22:51 +0000)]
Allow using windows that can't be focused with wxNavigationEnabled<>.
The code in wxNavigationEnabled<> assumed that the window itself could be
focused if it didn't have any focusable children because it was originally
extracted from wxPanel that can, indeed, be focused. This is however not the
case for all windows, notably not for wxStaticBox which now derives from
wxNavigationEnabled as well but can never be focused itself.
Add wxControlContainer::DisableSelfFocus() and call it from wxStaticBox to
support this situation. This required splitting m_acceptsFocus flag into
m_acceptsFocusSelf and m_acceptsFocusChildren and updating various methods
using them.
Vadim Zeitlin [Sat, 13 Oct 2012 22:51:27 +0000 (22:51 +0000)]
Use WS_EX_CONTROLPARENT for wxStaticBox in wxMSW.
This doesn't change anything currently but it seems correct to use this style
with wxStaticBox as it can now contain other windows (and so be "control
parent"), so it could allow Windows or other programs checking for this style
to handle it more correctly.
TABs appear simply as a space under MSW (because we don't use LBS_USETABSTOPS
style there) but are aligned to (multiple of 8?) tab stops under GTK. It's not
clear which behaviour is actually preferable so for now just document the
inconsistency and advise people to use spaces instead.