Jaakko Salli [Wed, 9 Sep 2009 16:41:23 +0000 (16:41 +0000)]
Various improvements to wxComboCtrl's text ctrl left margin setup: less #defines, better margin when SetCustomPaintWidth() has been called, fixed SetFont() behavior on wxMSW
Set correct foreground default in wxControl::DoMSWControlColor().
Instead of hard-coding GetSysColor(COLOR_WINDOWTEXT), use
GetForegroundColour() which will call GetDefaultAttributes() to retrieve the
default foreground appropriate for this control.
This also allows to make the code simpler by calling SetTextColor() only once.
Don't always override the default background colours.
The wxColour argument taken by wxControl::DoMSWControlColor() allows to
override the default colour, it shouldn't be used in MSWControlColor() as this
resulted in always using custom colours for the controls, even when the user
hadn't changed them. Fix this by not passing any valid colour to it in this
case and allowing it to deduce the correct colour to use on its own.
The default colours for this control are wxTextCtrl-like and not wxButton-like
(which is the default). Override GetDefaultAttributes() to indicate this and
to avoid returning a wrong background from wxControl::DoMSWControlColor() when
just a foreground is set.
Using 32bpp image lists (ILC_COLOR32) is required as we need to be able to put
32bpp bitmaps in them and results in better (albeit still broken, see #9050)
display when the display depth is < 32.
This change was tested under Windows 2000, 2003 and Vista in 8 (Win2k-only),
16 and 32bpp display depth modes.
Show the order in which different event handlers are called.
Update the event sample to define (as) many (as possible) event handlers for a
test button and log messages in all of the handlers to leave a trace of the
order in which they were executed.
Add a pointer to this feature of the event sample to the events overview.
Fix bug with parsing concatenated switches in wxCmdLineParser.
The constructs such as "-abcd" were not parsed correctly, i.e. the same as "-a
-b -c -d" because the code tried to parse a non-existent option "abcd" even if
it was supposed to not do this -- fix this.
Recognize the buddy text control as part of wxSpinCtrl.
This allows the code in wxWindowMSW::HandleCtlColor() to find the correct
control when handling the messages from the buddy control and hence setting
the colours for wxSpinCtrl works after this change.
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.