Commit Graph

56080 Commits

Author SHA1 Message Date
Vadim Zeitlin
06a086e8d2 Fix fatal bug in the recently added wxFile::ReadAll().
Make sure we exit the loop when reading the file in chunks in
wxFile::ReadAll() and add a unit test for it to ensure that it's really
correct.

Closes #14725.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72614 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-04 22:47:44 +00:00
Paul Cornett
825417a419 non-pch build fix
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72613 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-04 16:08:30 +00:00
Paul Cornett
975c496df1 remove always-true comparison of unsigned value >= 0
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72612 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-04 15:58:11 +00:00
Paul Cornett
7d1214cd72 silence warnings about shadowed variables with GCC -Wshadow
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72611 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-04 15:55:06 +00:00
Vadim Zeitlin
f821bc3617 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.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72610 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-03 08:32:49 +00:00
Vadim Zeitlin
b785d15d50 Add missing header to fix MiscGUIFuncsTestCase compilation.
Need full wxPanel declaration here now.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72609 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-03 07:58:56 +00:00
Vadim Zeitlin
92c9a59d7a Fix wxFindWindowAtPoint() unit test to pass under GTK.
We need to ensure that all windows are realized before querying their
positions on screen, so add an extra wxYield().

Also adjust the tests slightly as the windows are now all created in the
beginning of the function.

Finally, use Destroy() instead of wxDELETE() for windows.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72608 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-03 00:16:53 +00:00
Vadim Zeitlin
44040e5eca Added a simple unit test for wxWindow::ClientToScreen().
Check that this function works consistently for the TLW and its children and
grand-children.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72607 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-03 00:16:30 +00:00
Vadim Zeitlin
ab45fb147b Avoid creating children of wxButton in MiscGUIFuncsTestCase.
This doesn't work in wxGTK, use a normal wxWindow instead of wxButton in this
case.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72606 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-03 00:16:07 +00:00
Paul Cornett
84f623f883 remove some unnecessary casts
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72605 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-02 16:19:33 +00:00
Paul Cornett
95dc31e001 make more Init() functions private
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72604 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-02 15:57:03 +00:00
Vadim Zeitlin
f33a5bc61c Fix assert about passing long as "%d" in wxXRC code.
Closes #14718.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72603 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-01 10:47:24 +00:00
Vadim Zeitlin
bdc43642fb No changes, just remove some unneeded variables initializations.
Closes #14716, #14717.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72602 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-01 09:55:50 +00:00
Vadim Zeitlin
91ad3a26e3 Test for wxAuiMDIClientWindow being non-NULL before using it.
wxAuiMDIParentFrame::GetActiveChild() may be called before the client window
is created, don't crash in this case but just return NULL.

Closes #14684.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72601 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-01 09:55:27 +00:00
Vadim Zeitlin
77dd7daad2 Add wxDateTime::DiffAsDateSpan().
This method returns the difference between the dates as wxDateSpan, unlike the
existing Subtract() and overloaded operator-() that return wxTimeSpan.

Closes #14704.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72600 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-01 09:55:05 +00:00
Vadim Zeitlin
1f4bb1d7f2 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.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72599 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-01 09:40:06 +00:00
Vadim Zeitlin
e6aed765fc Read and write files using binary mode in wxStyledTextCtrl.
Use binary mode to preserve the original file EOLs when loading it and also to
save it with the same EOLs later.

Add very primitive EOL auto-detection to LoadFile().

Also add SaveFile()/LoadFile() which were missing in !wxUSE_TEXTCTRL case.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72598 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-30 22:28:53 +00:00
Vadim Zeitlin
3bc69d48db 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.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72597 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-30 22:28:31 +00:00
Vadim Zeitlin
614108e211 Added wxFile::ReadAll() for consistency with wxFFile::ReadAll().
Make it possible to use wxFFile and wxFile interchangeably for simply reading
the entire contents of the file as a string.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72596 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-30 22:28:08 +00:00
Vadim Zeitlin
ce364c4ecd 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.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72595 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-30 22:27:44 +00:00
Vadim Zeitlin
933be2dc39 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.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72594 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-30 22:27:21 +00:00
Vadim Zeitlin
0015757fec 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).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72593 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-30 22:26:58 +00:00
Vadim Zeitlin
1d178139b2 Make stc sample startup faster.
Don't show "About" dialog on startup, this has nothing to do with the purpose
of this sample and is just annoying.

Also, don't select the entire file after opening it.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72592 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-30 22:26:36 +00:00
Vadim Zeitlin
294a09aa8c 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.

Closes #14506.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72591 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-30 22:21:44 +00:00
Vadim Zeitlin
be4162218d 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).

See #14616.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72590 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-30 22:21:20 +00:00
Vadim Zeitlin
f5413b878c Add support for background-color style to span element in wxHTML.
Add code for setting/restoring background mode and use it to implement support
for changing the text background colour.

Closes #14443.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72589 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-30 22:20:58 +00:00
Vadim Zeitlin
a0393f9725 Fix handling of spaces after <img> tag in wxHTML.
Don't collapse the spaces following this tag with the ones preceding it.

See #14557.

Closes #2980.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72588 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-30 22:20:34 +00:00
Vadim Zeitlin
9915cdc960 Convert image tags to text using their alt attribute in wxHTML.
This is useful when copying wxHtmlWindow contents to clipboard, for example.

Closes #14557.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72587 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-30 22:20:11 +00:00
Vadim Zeitlin
b8885bb39b 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.

Closes #14696.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72586 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-30 22:19:47 +00:00
Vadim Zeitlin
6f2df68ec4 No changes, just fix some typos in comments in wxXRC code.
Closes #14714.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72585 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-30 22:19:24 +00:00
Vadim Zeitlin
e708cadacb No changes, just remove unneeded variable initialization.
Closes #14712, #14713.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72584 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-30 22:19:01 +00:00
Vadim Zeitlin
669f031b94 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.

See #14537.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72583 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-30 20:35:56 +00:00
Vadim Zeitlin
5d83eee7dd Fix computation of menu button best size in generic wxSearchCtrl.
Invalidate the cached best size when the bitmap changes.

Closes #14708.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72582 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-30 20:35:33 +00:00
Vadim Zeitlin
e5eff43833 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.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72581 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-30 20:35:10 +00:00
Vadim Zeitlin
274e4265a8 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.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72580 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-30 20:34:46 +00:00
Paul Cornett
ec373f2a81 make wxWindowGTK::Init() private, it is not meant to be called from derived classes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72579 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-30 16:55:40 +00:00
Robin Dunn
337c5edd43 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.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72578 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-30 02:33:56 +00:00
Vadim Zeitlin
241708ca47 Fix generic wxSearchCtrl best size calculation.
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.

Closes #14708.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72577 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-28 23:50:27 +00:00
Vadim Zeitlin
07d304d2aa Fix wxSearchCtrl recreation in the widgets sample.
The control wasn't readded to the sizer correctly after being recreated.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72576 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-28 23:50:05 +00:00
Vadim Zeitlin
ceddf94945 Remove unused SearchCtrlWidgetsPage::Reset() from widgets sample.
This method was simply unused and unneeded.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72575 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-28 23:49:42 +00:00
Vadim Zeitlin
209dc298e2 Don't send events for disabled ribbon bar buttons.
Hover and activation events were sent even for the disabled buttons which was
unexpected and inconsistent with wxRibbonToolBar, so don't do it.

Closes #14709.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72574 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-28 23:49:20 +00:00
Vadim Zeitlin
eae48ea12d Make wxHelpControllerBase::SetFrameParameters() title more clear.
Describe it as "title format string" and call it "titleFormat" and not just
"title" because this is what it is.

Closes #14707.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72573 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-28 23:48:57 +00:00
Vadim Zeitlin
45df4bb6c2 Add "inherit" to <font> XRC tag.
This allows to construct a font based on the parent window font instead of
either fully specifying all font parameters or basing it on a standard font.

Closes #14632.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72572 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-28 23:48:34 +00:00
Vadim Zeitlin
9696657f22 Fix testing for existence of paths with trailing separators in wxMSW.
We removed the trailing separators, that prevented GetFileAttributes() from
working correctly, from the path but then didn't pass the modified path to it
but the original one. Fix this and do use the updated path.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72571 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-28 23:48:09 +00:00
Paul Cornett
603e7f6d0c Avoid unrealizing a frozen window
It seems to continue to prevent updates to the affected area

Fixes #13543


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72569 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-28 16:09:12 +00:00
Vadim Zeitlin
97c15a53f2 Make wxTextEntryDialog resizable.
It can be used for entry of relatively long text now, especially when
wxTE_MULTILINE flag is used, so allow the user to resize it to facilitate the
entry.

Closes #14702.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72568 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-27 22:41:55 +00:00
Vadim Zeitlin
b8d6be7f57 Add two step creation to wxTextEntryDialog.
Add Create() method and default ctor for consistency with the other classes.

See #14702.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72567 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-27 22:41:33 +00:00
Vadim Zeitlin
70680b6177 Use SelectAll() instead of SetSelection(-1, -1).
The former is more clear and also shorter.

Closes #14701.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72566 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-27 22:41:09 +00:00
Vadim Zeitlin
732281950a Remove the now unnecessary wxRichTextCtrl::SelectAll().
It is already inherited from the base wxTextEntry class.

See #14701.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72565 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-27 22:40:46 +00:00
Vadim Zeitlin
d993c262a1 Fix _tputenv() return value test in wxSetEnv().
_tputenv() returns -1, not 0, on error, as all the other CRT functions, so the
test added by r72496 resulted in wxSetEnv() and wxUnsetEnv() always failing
when using MSVC.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72564 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-27 13:58:26 +00:00