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.
Vadim Zeitlin [Sat, 13 Oct 2012 22:49:56 +0000 (22:49 +0000)]
Improve explanation of maximal number of wxListBox items in the documentation.
Don't say that it's limited -- because, strictly speaking, it isn't -- but
mention other controls that are better alternatives for large numbers of items.
Vadim Zeitlin [Sat, 13 Oct 2012 22:49:33 +0000 (22:49 +0000)]
Do give focus to the wxNotebook page when switching to it under MSW.
Switching to the page but keeping the focus on the notebook itself makes it
difficult to use the UI from keyboard and is inconsistent with the behaviour
of native property sheets. Do restore the code to set the focus to the page as
the bug that resulted in a wrong radio button being selected when we did this
was apparently fixed elsewhere in the meanwhile because it doesn't happen any
more even with this change.
Vadim Zeitlin [Thu, 11 Oct 2012 12:41:07 +0000 (12:41 +0000)]
Use "true" by default in wxGenericListCtrl::EnableBellOnNoMatch().
The changes of r72639 mistakenly omitted the default value for
EnableBellOnNoMatch() argument in this class (although it was present in the
base class and in wxGenericTreeCtrl), fix this.
Vadim Zeitlin [Tue, 9 Oct 2012 21:28:33 +0000 (21:28 +0000)]
Do return the protocol part from GetLocaltion() for local wxFSFiles.
wxLocalFSHandler created wxFSFile without the protocol information which means
that calling GetLocaltion() on this file later doesn't return it, contrary to
the documentation.
Vadim Zeitlin [Tue, 9 Oct 2012 21:02:17 +0000 (21:02 +0000)]
Generate text events in generic wxSpinCtrl itself.
The text events in a wxSpinCtrl should originate from the control itself but
they were just propagated upwards from wxTextCtrl embedded into it and hence
had wrong event object and event ID fields.
Fix this by making EVT_TEXT come from wxSpinCtrl itself, in addition to
EVT_TEXT_ENTER ones which we already forwarded like this.
Vadim Zeitlin [Tue, 9 Oct 2012 21:01:53 +0000 (21:01 +0000)]
Copy wxCommandEvent string explicitly in its copy ctor.
Due to the optimization used in wxCommandEvent::GetString(), which returns the
string from the text control that generated the event only if it's really
needed, wxCommandEvent::m_cmdString field may be empty even when it does have
an associated string. As we lose the possibility to retrieve the value on
demand from wxTextCtrl when we make a copy (because it can be associated with
a different object), we need to explicitly copy the string to avoid losing
this data entirely.
This fixes GetString() value for the text events generated by generic
wxSearchCtrl.
Vadim Zeitlin [Tue, 9 Oct 2012 21:01:29 +0000 (21:01 +0000)]
Fix printing in landscape mode in wxGTK.
Only apply Cairo transforms in StartPage(), doing it earlier interferes with
the code doing the coordinate system rotation inside GTK+ itself when a
non-portrait printing mode is used.
Vadim Zeitlin [Sun, 7 Oct 2012 22:42:50 +0000 (22:42 +0000)]
Ensure that key events are sent to focused window first in wxGTK.
Start processing key events from the currently focused window, this ensures
that its key event handlers are tried before the top level window
accelerators.
This is consistent with wxMSW and allows a window to locally override the
global accelerators which really makes sense.
Vadim Zeitlin [Sun, 7 Oct 2012 22:42:27 +0000 (22:42 +0000)]
Implement incremental search in wxGenericListCtrl.
Mostly copy wxGenericTreeCtrl incremental search implementation to
wxGenericListCtrl (unfortunately there is no simple way to reuse this code
currently), including the recently added EnableBellOnNoMatch() method.
Update the sample to test it, the key event handling in it had to be modified
to allow it.
Vadim Zeitlin [Sun, 7 Oct 2012 22:41:15 +0000 (22:41 +0000)]
Handle successive key presses better in wxGenericTreeCtrl search code.
Go to the next item starting with the given character if the same one is
pressed multiple times. This is more useful than searching for an item
starting with multiple occurrences of this character (which usually won't
exist) and is more consistent with how Windows handles this.
Vadim Zeitlin [Sun, 7 Oct 2012 22:40:29 +0000 (22:40 +0000)]
Fix spurious label editing in generic wx{List,Tree,DataView}Ctrl.
Clicking on the control to give it focus must not start editing the label of
an item in it, this is bad UI as you need to carefully select where do you
click to avoid starting to edit the label and nobody else does it like this
(probably because of the former reason).
As a side note, it would be really great to abstract the item handling in a
class that could be reused by all these controls instead of having to update 3
slightly different versions of the same code every time.
Vadim Zeitlin [Sun, 7 Oct 2012 22:40:06 +0000 (22:40 +0000)]
Don't set focus explicitly in wxGenericListCtrl mouse handling code.
Just skip the event to allow the system to set the focus to the control
itself. This is more consistent with the other controls and should result in
correct behaviour everywhere automatically.
Vadim Zeitlin [Sun, 7 Oct 2012 22:39:43 +0000 (22:39 +0000)]
Don't set focus to generic wxDataViewCtrl on any button press.
Only set focus if the left button was pressed for consistency with just about
everything else. Also, just skip the event instead of setting the focus
explicitly.
Vadim Zeitlin [Sun, 7 Oct 2012 22:38:32 +0000 (22:38 +0000)]
Flush log messages from other threads on shutdown too.
Add a call to wxLog::FlushActive() to the shutdown code as calling just
wxLog::SetActiveTarget(NULL) is not enough, it flushes the current log target
only but not the ones used by other threads.
Vadim Zeitlin [Sun, 7 Oct 2012 22:37:47 +0000 (22:37 +0000)]
Fix drawing of wxAuiNotebook with GTK theme when active tab is invisible.
Draw a box using gtk_paint_box() for the tabs, without border for the active
one to avoid an extra line across the gap, and with the border for the others.
Václav Slavík [Sun, 7 Oct 2012 16:49:28 +0000 (16:49 +0000)]
Fix wxGenericCollapsiblePane to expand frame's size.
wxGenericCollapsiblePane::DoGetBestSize() is dynamic, returning
different values for collapsed and open states. Therefore the control
must invalidate best sizes cache every time its state changes.
Vadim Zeitlin [Wed, 3 Oct 2012 08:32:49 +0000 (08:32 +0000)]
Do use IsEscapeKey() in wxDialog escape key handling.
This method was added back in r40686 but was never actually used anywhere. Do
use it in wxDialogBase::OnCharHook() now instead of hard-coding the check for
WXK_ESCAPE, this should allow using Cmd+. to work like Escape under Mac which
was apparently the intention of the code in src/osx/dialog_osx.cpp.
Also fix IsEscapeKey() itself to ignore any modifiers as at least under MSW
Esc always closes the dialog, even if Shift or Alt is pressed.
Vadim Zeitlin [Mon, 1 Oct 2012 09:40:06 +0000 (09:40 +0000)]
Fix PCH-less build after the changes of r72589.
Use wx{SOLID,TRANSPARENT} instead of wxBRUSHSTYLE_{SOLID,TRANSPARENT}. This
makes more sense as we're setting background mode, not brush style, here and
also fixed compilation when not using PCH.
Small optimization of wxFFile::ReadAll(): avoid extra string copy.
Use swap() to move the newly created string into its destination instead of
copying it there. This can be relatively important as the string represents an
entire file contents here and so could be quite long.
Reimplement wxTextEntry::DoSetValue() in wxStyledTextCtrl.
The version inherited from the base class does work already but calling
Scintilla SetText() directly should be more efficient than selecting
everything and then calling ReplaceSelection() as the base class version does,
less code is executed.
Fix wxStyledTextCtrl::WriteText() to replace the selection.
WriteText() must replace the selection, not just insert the new text,
otherwise SetValue() implementation inherited from the base class doesn't work
as it doesn't clear the old contents of the control before adding new text to
it.
Don't call ClearAll() before LoadFile() in the stc sample.
There is no need to clear the control contents before loading a file into it
because LoadFile() is supposed to do this on its own (although currently it
doesn't, which will be fixed soon).
Add per-direction wxSocket wait flags and byte counters.
Allow to specify whether the socket should block until all the data is read or
written or, on the contrary, avoid blocking only when reading or writing
instead of always using the same behaviour in both directions.
Also add separate counters for the bytes read/written instead of using the
same one for both.
These changes make it possible to use the same socket for reading/writing in
different threads.
Don't crash in generic wxDataViewCtrl if it doesn't have any model.
A model may be dissociated from a still existing control, don't crash if it
happens (notice that we still would crash in the native GTK version right now,
so this still remains to be fixed there).
Fix handling of not fully specified min/max size in wxBoxSizer.
wxSizerItem::AddBorderToSize() added in r72344 (see #11497) didn't work
correctly as it replaced unspecified (i.e. set to -1) components of wxSize
with the small positive values that did take effect, contrary to the
intention.
Fix it to only adjust the actually set component(s) of wxSize.
Revert "Don't use StringFormat::GenericTypographic() in MSW wxGraphicsContext."
This reverts r72442 and restores the use of GenericTypographic string format
for GDI+ text rendering. While it's true that using this flag with small font
sizes results in pretty bad output, especially under Windows XP, not using it
results in wrong text extent calculations for all sizes which is even worse.
Clear the search control automatically when it's "Cancel" button is pressed.
This should be the desired behaviour in the vast majority of cases, so do it
by default.
Replace the useless OnSearchButton() doing nothing with search button events
with OnCancelButton() handling cancel button events and clearing the control.
Don't use text control foreground colour for generic wxSearchCtrl itself.
Logically, it should be done in the other direction and also doing it like
this means that the search and cancel icons, rendered using the current
foreground colour, are barely visible when using generic wxTextCtrl::SetHint()
implementation, as in wxGTK, because the text control foreground is set to
light grey in this case.
Robin Dunn [Sun, 30 Sep 2012 02:33:56 +0000 (02:33 +0000)]
Use Refresh when the initial paint was abandoned by Scintilla so it will trigger a repaint of the whole window. This is done for things like style changes, word wrapping or brace highlights where more than the current line is affected. Fixes #14653.
The best size of its text control part was not calculated correctly any more
because a wrong best size was cached during wxSearchTextCtrl construction,
when the final class overridden DoGetBestSize() was not called.
Fix this by explicitly invalidating the best size at the end of constructor
for now even though it would be arguably better to fix this in some way not
requiring anything extra to be done to always take the overridden method into
account, especially as it used to work before. But it's not clear how exactly
to restore this so for now do at least fix wxSearchCtrl appearance.