Vadim Zeitlin [Tue, 18 Aug 2009 01:22:48 +0000 (01:22 +0000)]
Fix last error display in wxLogSysError().
After recent changes of wxLogXXX() functions into macros the last error was
overwritten by wxString::Format() called between the call to wxLogSysError()
and wxLog::CallDoLogNow() which called wxSysErrorCode() and so its original
value was lost and, unless the last error was specified explicitly, it always
came out as 0.
To fix this, call wxSysErrorCode() directly when calling wxLogSysError(). This
may be unnecessary (if the error is given explicitly) but there doesn't seem
to be any other way to fix it and the overhead of calling wxSysErrorCode()
shouldn't be that big.
Also add a unit test checking that wxLogSysError() behaves as expected.
Vadim Zeitlin [Tue, 18 Aug 2009 00:27:21 +0000 (00:27 +0000)]
Don't define wxArrayPGProperty as std::vector in STL build.
wxArray::Remove() method is used on it so defining it as std::vector<> breaks
compilation in STL build. It is also insonsistent with all the other arrays in
wx none of which used "#if wxUSE_STL" around its definition.
Vadim Zeitlin [Mon, 17 Aug 2009 23:02:56 +0000 (23:02 +0000)]
Force linking of src/osx/core/sockosx.cpp.
Without this the file was omitted by linker entirely in the static build and
the correct socket manager wasn't used for the GUI applications (see #11030).
Vadim Zeitlin [Mon, 17 Aug 2009 23:02:46 +0000 (23:02 +0000)]
Cleanly separate GUI socket-related code from net library.
This fixes linking problems under Unix introduced by recent changes which
fixed previous problems which were due to files not being linked in at all.
In order to provide a clean separation between base, net and core libraries we
now use the same wxSocketManager (wxSocketFDBasedManager), defined in net
library for both console and GUI Unix applications and just use different FD
IO manager for them: the latter can be defined in base and core libraries as
it doesn't involve wxSocketImpl at all, only its base wxFDIOHandler class.
At more detailed level, these changes required:
1. Adding the new wxFDIOManager class.
2. Refactoring the old (and now removed) wxSocketFDIOManager to use the same
code as wxSocketFDIOManager. This involved:
a) Adding handler and direction parameter to RemoveInput().
b) Storing the mask of registered events in wxFDIOHandler itself.
c) Defining wxFDIOManagerUnix which works with wxFDIODispatcher.
3. Changing the traits classes in Unix ports to define GetFDIOManager()
instead of GetSocketManager().
Vadim Zeitlin [Mon, 17 Aug 2009 23:02:34 +0000 (23:02 +0000)]
No changes, just put the files in alphabetical order.
List files in BASE_UNIX_AND_DARWIN_SRC in alphabetical order for consistency
with the other file names variables and to make it more convenient to update
it.
Vadim Zeitlin [Mon, 17 Aug 2009 23:02:29 +0000 (23:02 +0000)]
Extract wxFDIOHandler in its own header.
The files defining classes processing events on file descriptor only need this
class and not wxFDIODispatcher itself so reduce build dependencies by extracting
wxFDIOHandler in a separate header which they can include instead of the
entire fdiodispatcher.h.
Vadim Zeitlin [Mon, 17 Aug 2009 23:02:18 +0000 (23:02 +0000)]
Added wxFDIOHandler::IsOk() and use it with wxSocketImplUnix.
This will allow to use the base wxFDIOHandler class only in GUI-specific
network code and this remove its dependency on wxSocketImplUnix. IOW it paves
the way for a proper solution of the problem fixed by r61336 without the hack
of r61335 which results in linking problems (which went undiscovered until now
but were, in fact, always present, i.e. r61335 couldn't work).
Vadim Zeitlin [Sun, 16 Aug 2009 23:14:07 +0000 (23:14 +0000)]
Fix hangups when using sockets under OS X.
A socket event apparently doesn't count as a real event under OS X and our
wxEventLoop::DispatchTimeout() doesn't return when it happens -- so we need to
generate an artificial wake up event ourselves to make it do it and return
control to the code in wxSocket::DoWait() in order for it to process the event.
Vadim Zeitlin [Sun, 16 Aug 2009 23:13:55 +0000 (23:13 +0000)]
Use CF socket manager in GUI OS X applications.
wxSocketManagerMac was never created under OS X since wxSocket code
refactoring as wxGUIAppTraits::GetSocketManager() wasn't overridden.
Doing this required an extra nasty hack with a global variable in the base
library which is used just to pass the socket manager pointer from the net
library to the core one without creating a dependency between them but this
seems unfortunately unavoidable.
Vadim Zeitlin [Sun, 16 Aug 2009 23:13:45 +0000 (23:13 +0000)]
Virtualize wxSocketImpl creation by routing it via wxSocketManager.
This is necessary to create different kinds of sockets for the console and GUI
applications under OS X: unlike Unix which use different socket managers for
the console and GUI programs but still use the same data structures in both
cases as X11 and derived toolkits APIs are very similar, Core Foundation
sockets don't have anything in common with their console counterparts and so
we need to use different wxSocketImpl versions too.
A side effect of this commit is that now we need to force linking of
src/msw/sockmsw.cpp when using sockets: this wasn't necessary before because
it contained wxSocketImpl method definition but now that there are no more
direct dependencies on it, MSVC linker simply discards the object file unless
we force it to link with it.
Notice that this commit doesn't change anything yet, it simply refactors the
code to use wxSocketManager::CreateSocket() instead of wxSocketImpl::Create()
in preparation for the next change.
It may be useful to change the directory where it is generated to allow the
users to find it more quickly. Also allow changing the crash report base name
for completeness.
Vadim Zeitlin [Tue, 11 Aug 2009 18:16:39 +0000 (18:16 +0000)]
Create compressed debug report file outside of temporary directory.
Otherwise the compressed file is deleted when the temporary directory is (it
doesn't happen if temporarily files are left because an error occurred while
the report generation but perversely enough no useful information was left if
no errors happened).
Vadim Zeitlin [Tue, 11 Aug 2009 10:54:40 +0000 (10:54 +0000)]
Another compilation fix after wxFlexGridSizer ctors change.
wxFlexGridSizer ctor was even used incorrectly even in layout sample itself,
once again the code was supposed to create 3*3 sizer, not 3-column sizer with
3 pixel vertical gap.
Changed ctors to be more explicit and to use a 5 pixel gap in both directions.
Vadim Zeitlin [Mon, 10 Aug 2009 11:18:23 +0000 (11:18 +0000)]
Update wxFlexGridSizer ctors to match (new) wxGridSizer ones.
Confusing wxFlexGridSizer(int cols, int vgap = 0, int hgap = 0) was removed as
well as corresponding wxGridSizer ctor overload. New ctor overloads taking gap
as wxSize were added.
Vadim Zeitlin [Mon, 10 Aug 2009 11:18:09 +0000 (11:18 +0000)]
Made wxWindow::HasScrollbar() do what it says.
Added wxWindow::CanScroll() with the old HasScrollbar() meaning but changed
HasScrollbar() to check for the scrollbar existence instead of just checking
if it might exist.
Vadim Zeitlin [Thu, 6 Aug 2009 00:01:43 +0000 (00:01 +0000)]
Don't pop explicitly changed status messages.
Calls to SetStatusText() in between Push/PopStatusText() were simply lost
before, now the text explicitly changed by SetStatusText() is preserved by the
next call to PopStatusText().
This required adding a new virtual method, called DoUpdateStatusText(), which
is now implemented in all the derived classes instead of overriding
SetStatusText() (on the bright side, it doesn't need to do any checks already
done in the base class any more).
Also fix PushStatusText() to actually show the text being pushed at all under
wxMSW as a side effect.
And further reduce code duplication between wxStatusBarBase and the derived
classes.
Vadim Zeitlin [Thu, 6 Aug 2009 00:00:47 +0000 (00:00 +0000)]
Add test for Push/PopStatusText().
Allow to interactively push and pop status messages for the selected field.
This shows that currently PushStatusText() is completely broken under wxMSW
as it never shows the text being pushed at all because it is "optimized" away
due to an incorrect comparison with the old value (which turns out to be the
new one)
Vadim Zeitlin [Thu, 6 Aug 2009 00:00:39 +0000 (00:00 +0000)]
Provide saner UI for setting status bar fields.
Instead of asking the user to enter N values in a row (which is really
annoying even for N=2 already), allow to select the status bar to set the
value for and only show a single dialog asking for the value of this pane.
Vadim Zeitlin [Wed, 5 Aug 2009 17:25:27 +0000 (17:25 +0000)]
wxSplitterWindow mouse capture improvements and cleanup.
- Handle mouse-capture-lost event to abort dragging mode.
- Remember mouse and sash position on buttondown event and use them as
absolute reference during dragging. Avoid delta values from one mousemove to
the next as this may introduce a skew during dragging and especially when
coordinate clipping occurs.
- Clear the requested sash position when dragging in live mode.
- Draw the tracker at correct coordinates - taking into account the width of
the pen used to draw the tracker.
- The old code did not clearly distinguish between live vs. tracking mode in
some places.
Vadim Zeitlin [Wed, 5 Aug 2009 17:25:14 +0000 (17:25 +0000)]
Generate scroll events for key presses in wxScrolledWindow.
Don't duplicate the existing wxScrolledWindow::CalcScrollInc() logic in
HandleOnChar(), simply generate scrolling events from it, this simplifies the
code and ensures that it is more correct.
Vadim Zeitlin [Wed, 5 Aug 2009 17:24:50 +0000 (17:24 +0000)]
Cleaned up low level OS X sources.
The low level files are those which are used by wxUniversal and so shouldn't
contain native controls implementations -- moved them from OSX_LOWLEVEL_SRC to
OSX_CARBON_COCOA_SRC.
Also removed the now unnecessary check for __WXUNIVERSAL__ in src/osx/accel.cpp.
Vadim Zeitlin [Mon, 3 Aug 2009 20:37:03 +0000 (20:37 +0000)]
Correct week day returned from wxCalendarCtrl::HitTest() on header click.
A combination of a wx bug in conversion from native control week days to
wxDateTime week days and a bug of native control itself when the first week
day is not Monday resulted in the day being off by one it did start with
Monday. The new code works correctly in both Monday and Sunday cases, at least
until the bug in comctl32.dll is corrected.
Vadim Zeitlin [Mon, 3 Aug 2009 20:10:31 +0000 (20:10 +0000)]
Always use MCHITTESTINFO of minimal size.
This struct has gained additional fields under Vista which are not supported under previous versions. We don't use these fields but just using a bigger struct makes functions using it fail under pre-Vista systems, so don't do this.
Vadim Zeitlin [Sun, 2 Aug 2009 00:59:31 +0000 (00:59 +0000)]
Check indices validity better in wxGridStringTable.
Calling GetValue(-1, -1) could crash as the code naively only checked upper boundary (and didn't use unsigned which would have made the extra check unnecessary but it's too late for this now).
Václav Slavík [Fri, 31 Jul 2009 18:48:34 +0000 (18:48 +0000)]
compilation fix: only one wxInitialize form may have default argument values. It doesn't make sense to specify only argc>0, so removed default values and added default wxInitializer ctor.
Václav Slavík [Thu, 30 Jul 2009 07:09:43 +0000 (07:09 +0000)]
Use wxInitializer in wxEntryReal() instead of directly calling wxEntryStart() without refcounting. This makes it possible to write hybrid CLI/GUI wx applications.
It was left uninitialized before resulting in the key being closed on access because the check for being opened in a mode with enough permissions failed even for Read.
Long version is constructed by concatenating "Version " with the short version but can be overridden for the platforms which use it (currently MSW and OS X).