When converting a fixed number of characters we need to take any NULs inside
the buffer being converted into account for our return value -- but this
wasn't done and converting 2 characters 'x' and '\0' returned only 1, even if
the length 2 was explicitly specified.
All files in svn are supposed to use UTF-8 now so convert this one to UTF-8
too before committing more changes to it (which would be otherwise rejected by
pre-commit hook).
Refactor wxStyledTextCtrl to share common file save/load code.
Keep the code for saving and loading text contents from files in a single
place instead of doing it differently in wxTextCtrl and wxStyledTextCtrl.
This required adding Set/GetValue() methods to wxTextAreaBase just so that its
DoLoad/SaveFile() could use them, even if they are the same as wxTextEntryBase
methods and are overridden in wxTextCtrlBase to be implemented in terms of the
latter.
Notice that wxRichTextCtrl might need to be refactored to use this code too in
the future.
Also notice that this reverts the change of r62081 which replaced SetValue()
with ChangeValue() in DoLoadFile() as wxTextAreaBase only has SetValue() and
it's not worth adding ChangeValue() to it too just to preserve this recent
change in behaviour.
Handle deprecated background styles correctly in wxMSW.
Handle wxBG_STYLE_TRANSPARENT as wxBG_STYLE_PAINT and wxBG_STYLE_COLOUR as
wxBG_STYLE_ERASE instead of asserting (and almost surely crashing next, as
this assert is in the code called when the window is repainted and so will be
called again when the assert dialog is shown resulting in reentrant assert).
Due to what seems a compiler bug, MSVC tries to instantiate objects of
abstract wxGridXXXHeaderRenderer classes when compiling operators ?: using
references to them. Add explicit static_cast<>s to help it do the right thing.
Fixes compilation with this compiler broken in r62037.
Mention that Remove() uses binary search for sorted arrays so the item removed
by it is not necessarily the first one. Also correct documentation of Index()
for sorted arrays which was incorrectly the same as for the normal kind.
Exclude binary files from the checks done by the pre-commit hook.
We shouldn't check that binary files are UTF-8 so determine whether the file
is binary by looking at its svn:mime-type and only do the check for the text
files.
Extract default grid header renderers from wxGridCellAttrProvider.
We must be able to use them even when we have no attributes at all
and even when we have no associated table, so use default renderers in wxGrid
implementation of Draw{Row,Column}Label()/DrawBorder() in this case.
As this class has only inline methods it doesn't need to be exported from the
DLL and actually exporting it results in linking problems when using
wxScrolled<wxWindow> (which, unlike wxScrolled<wxPanel>, is not used in wx
itself and so doesn't seem to be instantiated) in DLL client even with VC > 6.
An alternative solution would be to change WXDLLIMPEXP_TEMPLATE_INSTANCE_CORE
macro to explicitly instantiate the template in the DLL even for VC > 6 but
this wouldn't solve the problem for wxScrolled<CustomClass> while removing the
DLL export declaration should.
Also use wxScrolled<wxWindow> in addition to wxScrolled<wxPanel> in the scroll
sample to test that it links correctly.
Call wxApp::ProcessPendingEvents() from wxX11 event loop.
Now that this function is not called from idle time (because it should be
called before, see r61441), the event loop must call explicitly so do it from
wxGUIEventLoop::Dispatch() in wxX11.
A probably better (but more time-consuming) fix would be to make wxX11 use
wxEventLoopManual as there doesn't seem to be any reason not to.
Override DrawLabel() to avoid crossing out disabled labels in mono theme.
DrawButtonLabel() crosses out the buttons to indicate that they are disabled
(for lack of any other options in mono renderer) but this looks really bad for
the labels, so don't do it.
Add a separate wxControlRenderer::DrawButtonLabel() too.
wxControlRenderer::DrawLabel() was used by both wxStaticText and wxButton but
their labels may need to be drawn differently and wxRenderer does have
different DrawLabel() and DrawButtonLabel() to do it. Now also add a separate
method for the buttons to wxControlRenderer.
Now that wxGetActiveWindow() is used when showing modal dialogs, it became
critical to implement it as otherwise an assert happens every time a dialog is
shown and because creating the assert dialog itself results in another (same)
assert, this immediately results in a crash.
So implement it even if in a very trivial (but hopefully not too incorrect)
way.
As some wxUniv classes implement DoGetBestClientSize(), the new code in
wxWindow::DoGetBestSize() implementation calls DoGetBorderSize() which asserts
because it's not implemented, making it impossible to even start the minimal
sample -- fix this.
Define wxSetDetectableAutoRepeat() for X11-based ports only.
This function is not needed in wxGTK2 as GTK+ sets detectable auto-repeat on
its own in gdk_display_open() anyhow, so move its implementation to
src/x11/utilsx.cpp where it can be used by wxX11 and wxMotif which do need it.
Move wxSetDetectableAutoRepeat() to a section compiled in wxCore.
This function was mistakenly defined in a section of utilscmn.cpp compiled as
part of wxBase, so it wasn't correctly exported from the core library and
linking any wxX11 applications failed when using compiler with visibility
support.
Situation with wxBK_XXX vs wxXXB_XXX remains confusing, the comments in the
code suggest that the former is preferred but the latter are documented for
wxListbook and wxChoicebook (although they don't even exist for wxTreebook).
So it seems unwise to not recognize the wxXXB_XXX versions in XRC as people
could easily decide to use them instead of wxBK_XXX values -- and this is also
consisten with wxNotebookXmlHandler which does recognize both wxBK_XXX and
wxNB_XXX already.
Change wxListbookXmlHandler and wxChoicebookXmlHandler to also always
recognize these styles.
The change of the counter to a simple boolean in r61985 broke the code which
called both Initialize() and Shutdown() multiple (but the same number of)
times. As this is the documented correct behaviour, restore the counter to
cater for it even if we don't really need it any longer.
Throwing an exception from worker threads is useless as it is not caught by
our wxUnitTestProtector which only protects the main thread, so abort
immediately to be sure to provide at least some information about the problem
as otherwise nothing may be output at all and the program can end up
deadlocked.
Account for the margins used by Windows around status bar text.
Because Windows uses margins around the text drawn in the status bar, naively
setting a field width to the size of the text didn't work (see previous
commit for an example). As this seems a natural enough thing to do, account
for this margin inside wxStatusBar itself to avoid the user code the trouble
of having to call some special function to do it. Notice that this does mean
that fields not containing text may be slightly larger than needed, but we
consider that this (rarer) case is less important.
Also account correctly for the status bar grip size. And while we still hard
code its size, do it in a clearly named function instead of using completely
mysterious constants here and there.
Modify the status bar sample to use two fields of just the right size for
their contents to confirm that this doesn't work correctly under at least MSW
currently (see #10696).
Notice that we need two fields because the behaviour/problem is different for
the last field and all the other ones.