Compilation fix after wxTextEntry::SetMargins() changes.
We need to include wx/gdicmn.h to define wxPoint which is now used in
wx/textentry.h, it is not necessarily already included and in fact compilation
was broken in PCH-less build.
Fix after changes of r61832: SDK checks should be done for Mac ports only as
they are useless under the other systems and break configure because sw_vers
is Mac-only and unsurprisingly using it results in errors under the other
systems:
/usr/local/src/wx/HEAD/configure: line 18215: sw_vers: command not found
checking if C compiler works with SDK/version options... configure: error: no.
Try a different SDK
Jaakko Salli [Sat, 5 Sep 2009 12:39:12 +0000 (12:39 +0000)]
wxTextEntry::SetMargins(), GetMargins() - implemented on wxMSW and wxGTK (GTK+ 2.10+); also added similar functions into wxComboCtrl, deprecated old indent-functions; wxPropertyGrid modified to use the new functionality
Kevin Ollivier [Sat, 5 Sep 2009 00:12:39 +0000 (00:12 +0000)]
If gcc-4.2+ is specified for compiling OS X Carbon or 10.4 compatilbility is specified, switch to gcc-4.0 to avoid configuration conflicts. Also, do not default to 10.4 compatibility when building OS X Cocoa so that we can get 64-bit builds on Snow Leopard by default.
Fix regression with logging messages during wxApp initialization.
Changes in r61450 broke logging of the messages for errors occurring during
wxApp initialization, such as the message about the failure to establish
connection to the X server. Instead of being shown on stderr, wxLogGui was
used resulting in a crash. Creating wxLogOutputBest in wxLog code before
wxTheApp creation was not enough as this error occurred after wxTheApp
creation -- but before it became usable.
Fix this by explicitly asking wxLog to instantiate a safe log target in
DoCommonPreInit() if the user hadn't set up his own yet and using it until the
GUI is fully initialized.
Tweak the default wxApp::GetAppDisplayName() logic.
Don't capitalize the app name if it had been explicitly set with SetAppName()
as this can result in unexpectedly wrong value. Do capitalize the program name
which is used as app name by default and don't store the program name in
m_appName to be able to distinguish between the two cases.
React to errors on socket correctly when using epoll().
Even though the socket is not registered for wxFDIO_EXCEPTION events,
wxEpollDispatcher will currently generate them anyhow so we shouldn't assert
if wxSocketImplUnix::OnExceptionWaiting() is called.
Instead, notify the socket about the connection loss if this happens.
Vadim Zeitlin [Sun, 30 Aug 2009 20:42:46 +0000 (20:42 +0000)]
Use correct font instead of DEFAULT_GUI_FONT.
DEFAULT_GUI_FONT is a misnomer, not only is it not a default (and never was)
but it shouldn't be used at all. Instead use lfMessageFont from the
NONCLIENTMETRICS structure as it seems to correspond to the font used by
the native controls under 2000, XP and Vista and respects Vista global DPI
setting unlike DEFAULT_GUI_FONT.
Vadim Zeitlin [Sun, 30 Aug 2009 17:25:42 +0000 (17:25 +0000)]
Fix buffer overflow in wxURLDataObject.
The code in CFSTR_SHELLURLDataObject::GetDataHere() was confused by
ANSI/Unicode and ended up overwriting output buffer because of it. Moreover,
this function was actually completely unnecessary as the base class version
did work correctly.
Vadim Zeitlin [Sun, 30 Aug 2009 17:25:28 +0000 (17:25 +0000)]
Fix off by one errors in wxURLDataObject.
wxTextDataObject::SetData() adds the terminating NUL automatically so there is
no need to add it to the length when calling it from wxURLDataObject::SetURL().
This change is necessary to fix the unit test in the upcoming fix for #11102.
Vadim Zeitlin [Sun, 30 Aug 2009 17:25:19 +0000 (17:25 +0000)]
Output the extracted number from wxString::ToXXX() even if it returns false.
After the changes in r50710 wxString numeric conversion functions didn't
update their output parameter any more if the conversion failed because not
entire string was converted. This was incompatible with the old behaviour
which some existing code did rely on, so restore it and now always return the
number which was extracted from the beginning of the string if we found
anything at all, even if the function returns false.
Add unit test for the correct behaviour and updated the documentation.
Vadim Zeitlin [Sun, 30 Aug 2009 17:25:02 +0000 (17:25 +0000)]
Use GetBestSize() rather than DoGetBestSize().
Call GetBestSize() from wxWindowMSW::DoSetSize() so that it works correctly
for the classes which only override DoGetBestClientSize() and not
DoGetBestSize() itself, such as wxStaticText.
Vadim Zeitlin [Sun, 30 Aug 2009 17:24:53 +0000 (17:24 +0000)]
Fix selection events generation in multi-select wxTreeCtrl.
Only deselect the items when the mouse is released if really necessary: add a
flag indicating when it is instead of trying to deduce it in the mouse up
handler.
Vadim Zeitlin [Sun, 30 Aug 2009 17:24:45 +0000 (17:24 +0000)]
Don't generate duplicated events for clicks on tree +/- buttons.
In multiple selection mode we process mouse events manually in wxTreeCtrl
itself and already take care of mouse clicks on the buttons there so don't
pass them on to the base class which would generate another event.
Vadim Zeitlin [Fri, 28 Aug 2009 10:44:25 +0000 (10:44 +0000)]
Compilation fix for wxUSE_PROTOCOL && !wxUSE_URL.
IMPLEMENT_CLASS(wxProtoInfo) wasn't compiled in in this build configuration
because it was in url.cpp instead of protocol.cpp and so was guarded by
wxUSE_URL and not wxUSE_PROTOCOL as it should have been.
Vadim Zeitlin [Wed, 26 Aug 2009 20:44:09 +0000 (20:44 +0000)]
Use correct array size for weekday names.
DAYS_PER_400_YEARS was erroneously used instead of DAYS_PER_WEEK which
resulted in creation of much larger object file than needed as the array is
initialized.
Vadim Zeitlin [Mon, 24 Aug 2009 21:42:27 +0000 (21:42 +0000)]
Don't append text following CDATA section to its node itself.
Reset wxXmlParsingContext::lastAsText flag when CDATA section ends to avoid
appending the text following it to its node. Instead new text nodes should be
created for it.
Also update the unit test to not work around the bug any more.
Vadim Zeitlin [Sun, 23 Aug 2009 22:48:35 +0000 (22:48 +0000)]
Allow entering minus sign in wxMSW wxSpinCtrl if needed.
Only restrict input to wxMSW wxSpinCtrl to digits only if it doesn't support
negative values, otherwise the user can't enter any negative numbers. As there
is no built in support for entering digits and minus sign only, simply allow
all characters to be used if the negative numbers must indeed be possible to
enter.
Vadim Zeitlin [Sun, 23 Aug 2009 22:25:12 +0000 (22:25 +0000)]
Never overflow the output buffer in wxBase64Decode().
Don't write extra NUL bytes obtained by decoding the padding at the end of
input into the output buffer as there may be not enough place in it for them.
And in any case the buffer is not (always) NUL-terminated as no NUL bytes are
obtained in absence of padding, so it's better to never terminate it for
consistency.
Vadim Zeitlin [Sun, 23 Aug 2009 22:24:48 +0000 (22:24 +0000)]
Added wxGridSize::GetEffective{Cols,Rows}Count().
These functions return the number of columns or rows being currently used and
not 0, unlike the existing Get{Cols,Rows}(), if the corresponding number is
determined dynamically.
Vadim Zeitlin [Sun, 23 Aug 2009 21:31:14 +0000 (21:31 +0000)]
Extract event handlers chain documentation in a separate section.
The explanation of event handlers chaining was too big and distracted from the
main point of the event processing section which was to explain in which order
different handlers are looked up.
Vadim Zeitlin [Sat, 22 Aug 2009 13:59:14 +0000 (13:59 +0000)]
Document wxGraphicsPath::AddArc() better.
The angles passed to it are measured clockwise from the horizontal axis,
contrary to the usual mathematical convention so take care to mention this in
the documentation.
Vadim Zeitlin [Fri, 21 Aug 2009 15:25:09 +0000 (15:25 +0000)]
Do wait for connection in the server socket.
The code returned immediately from wxSocketBase::DoWait() if it wasn't
connected but it only made sense for the client sockets, not server ones which
could be calling this function precisely in order to wait until a connection
is made.
Also added a test for this bug in the sockets/server sample.
Vadim Zeitlin [Fri, 21 Aug 2009 10:54:53 +0000 (10:54 +0000)]
Allow creating initially hidden controls in wxOSX/Cocoa.
If wxWindow is hidden before being really created, we must create the native
control hidden too. Not only this allows to create the controls initially
hidden, as intended, but it also avoids the wx and native visibility flags
from getting out of sync which results in many other problems.
Vadim Zeitlin [Thu, 20 Aug 2009 00:44:47 +0000 (00:44 +0000)]
Fix signatures of various image handlers methods.
Use wxBitmapType instead of long for the type parameter and made SaveFile()
methods const to follow the base class changes.
Now that the signatures are the same as in the base class these handlers have
a chance to work again while their methods couldn't be called at all before
this change.
Vadim Zeitlin [Thu, 20 Aug 2009 00:44:42 +0000 (00:44 +0000)]
Refactor and clean up slider labels drawing code.
This change fixes multiple g++ 4 warnings about unsafe expressions with
bit-wise operators (completely justified, for once, as the expressions were
absolutely incomprehensible and almost certainly incorrect too) and refactors
the determination of where to draw the slider labels in a single function
instead of triplicating it.
Also reformat to follow wxWidgets conventions and use more clear variable
names.
Vadim Zeitlin [Thu, 20 Aug 2009 00:44:22 +0000 (00:44 +0000)]
Rename wxRendererNative::DrawRadioButton() to DrawRadioBitmap().
This old name function conflicted with the one in wxRenderer in wxUniv and
also was misleading as this function draws only a bitmap and not the entire
wxRadioButton control.
The old workaround for the warnings about the function names conflict was ugly
and unmaintainable, as proven by the fact that wxRenderer method signature
already became different from the wxRendererNative one.
Vadim Zeitlin [Thu, 20 Aug 2009 00:44:11 +0000 (00:44 +0000)]
Fix extraction of standard command line arguments in wxX11.
The original number of arguments should be used when checking the argument
index for validity. Additionally, memmove() wasn't moving the correct number
of bytes because of forgotten sizeof().
Vadim Zeitlin [Wed, 19 Aug 2009 23:51:24 +0000 (23:51 +0000)]
Flush log events in console applications as well.
Move wxLog::FlushActive() call from wxAppBase::ProcessIdle() to
wxAppConsoleBase::ProcessIdle().
Now that log messages from background threads are queued until the main thread
log target is flushed, we need to call wxLog::FlushActive() periodically to
see them at all, see #11115.
Besides, even though the default log target in console applications outputs
the messages immediately without queuing them, it is quite possible to use a
non-default target which does require flushing so this change also fixes a
potential bug with non-default log targets.
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).