Vadim Zeitlin [Mon, 1 Oct 2012 09:40:06 +0000 (09:40 +0000)]
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.
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.
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.
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.
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).
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.
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).
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.
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.
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.
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.
Robin Dunn [Sun, 30 Sep 2012 02:33:56 +0000 (02:33 +0000)]
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.
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.
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.
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.
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.
_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.
Account correctly for the controller when computing wxBookCtrl best size.
We must not increase the total control size in the direction along the
controller window as the size of the controller in this direction is
determined by the size of the control itself. So doing this resulted in always
increasing best size in this direction to be at least equal to the current
size which was wrong.
Avoid useless iteration on all pages in wxBookCtrlBase::DoGetBestSize().
If m_fitToCurrentPage is true, there is no need to iterate over all the pages
computing their max best size only in order to overwrite it with the best size
of the current page later.
This doesn't result in any changes in the behaviour, just avoids useless best
size computations.
This results in the destruction of the widgets of all of its menu and when
wxMenu objects are themselves destroyed in the base class dtor, we try to
destroy their already destroyed widgets, resulting in critical GTK warnings.
Simply don't do anything in wxMenuBar dtor itself if the menu bar is not
attached to a frame as the workaround was only needed in case of destroying
attached menu bars.
Fix GTK warnings when destroying unattached wxMenuBar.
Reset m_focusWidget to NULL when destroying m_widget in wxMenuBar dtor,
otherwise we try to use this already destroyed (because it's the same as
m_widget) widget in wxWindow dtor later resulting in critical GTK warnings.
Robin Dunn [Tue, 25 Sep 2012 23:53:14 +0000 (23:53 +0000)]
Scintilla's Point class no longer matches the structure of wxPoint, so we need to copy points to a wxPoint array instead of just typcasting Scintilla's array. Fixes #14687
Really fix stack dumps for asserts and wxStackWalker::Walk() calls.
The code apparently tried to compensate for the wrong "skip" values used in
the calls to wxStackWalker::Walk() by skipping too much in Walk() itself which
was wrong as it dropped the frames that should have been shown.
Fix this by skipping only the one extra (compared to Walk() itself) frame we
add in wxStackWalker Unix implementation and not 3 of them and do skip more
frames when calling Walk() from assert failure handlers.
Also fix the wrong number of frames used in ProcessFrames(): we must not
subtract the number of skipped frames, they were already skipped.
No changes, just reuse a bit of code in wxMSW wxMDIParentFrame.
Call wxMDIChildFrame::Activate() instead of redoing the same thing. This also
ensures that iconized MDI children are restored before being activated (see
previous commit).
Correct best size computation for wxCheckBox with borders under MSW.
As wxCheckBox can now have borders (see previous commit), we must override
DoGetBestClientSize() and not DoGetBestSize() in it to take account of them.
Respect styles translated to WS_EX_XXX in wxMSW wxCheckBox and wxRadioButton.
Take into account the window styles that translate to extended Windows styles
at MSW level.
Also override MSWGetStyle() in these classes, just as in most (all?) other
ones, for consistency instead of doing wx-to-MSW styles translation directly
in Create().
Notice that as a side effect of this change, border styles now work for
wxCheckBox which wasn't the case before. It's not clear if this is really
wanted but OTOH there doesn't seem to be any real reason to forbid them
neither.
Allow wxWrapSizer to request more size than it used previously.
The code in wxWrapSizer::CalcMin() ensured that the sizer never requested more
space than what it had been already given which, while clearly done
intentionally, seems to be wrong because it can never end up with enough space
for all its rows/columns unless it is set to up to expand in the containing
sizer.
In other words, the old code could return the size which was not enough to
show the sizer contents fully which is against CalcMin() contract.
Change this by simply removing the check for the new minimal size being less
than the old one. This allows the wrap sizer demo in the layout sample to work
correctly whereas before the sizer contents was completely invisible initially.
A valid RECT pointer must be passed to DoVerb(OLEIVERB_INPLACEACTIVATE) but
r72027 (see #14209) broke this and passed it NULL resulting in an instant
crash.
Revert this part of the change and do pass out window client area.
The values of m_ourFirst and m_ourLast were inversed in wxPluginLibrary ctor.
Fix this and explain in a comment that "first" and "last" here refer to the
order in the linked list and not the chronological order.
Fix wrong configure test for abi::__forced_unwind in previous commit.
The previous commit was accidental and contained an initial version of the
patch which didn't test for NPTL abi::__forced_unwind correctly and just
tested whether cxxabi.h header was available.
Tighten the check to work on the other systems and check for __forced_unwind
existence itself.
Also check for cxxabi.h before testing for __cxa_demangle as there is no need
to try to compile another test program if we already know that this entire
header is unavailable anyhow.
Rethrow abi::__forced_unwind in wxThread code under Unix.
We must always rethrow the special abi::__forced_unwind exception when
handling exception in threads under Linux as the NPTL simply terminates the
process at first opportunity if this exception is not rethrown.
See http://udrepper.livejournal.com/21541.html for more details.
Add public (but not documented) wxCheckBox::MSWMakeOwnerDrawn().
It can be useful to explicitly make a check box owner drawn, so make the
private MakeOwnerDrawn() public and add "MSW" prefix to it to allow doing this
from the user code.
Fix and enhance support for client data in wxRibbonButtonBar.
Add the possibility to retrieve the client data associated with a button and
not only set it (which wasn't very useful on its own).
Also allow having both typed (owned) and untyped (not owned) client data, as
in the other wxWidgets controls.
To avoid confusion between two different kinds of data, remove "client_data"
argument from the functions adding buttons and provide separate methods with
distinct names for setting and getting client data.
Fix alpha handling in Scintilla when not using wxGraphicsContext.
When using raw bitmap data access classes such as wxAlphaPixelData we must
destroy them to ensure that the changes done via them are committed to the
bitmap before drawing the bitmap.
Just add an extra block (the diff should be viewed ignoring white space to see
the only significant change) to ensure that wxAlphaPixelData is destroyed
before DrawBitmap() is called.
Make it possible to TAB-navigate among wxStaticBox children.
As wxStaticBox can now contain child windows, derive it from
wxNavigationEnabled<> to allow TAB-navigating among them. Without this, it was
impossible to switch focus from keyboard to any of the controls inside
wxStaticBox.
These functions also change the rectangle right/bottom position, unlike
Set{Right,Bottom}() that change its width/height respectively. This is not
very logical but impossible to change for compatibility reasons, so at least
document it clearly.
Add wxStyledTextCtrl::SelectNone() to the template header file too.
This method was only added to the generated include/wx/stc/stc.h but not to
src/stc/stc.h.in from which it is created in r72490, do update the latter file
too now.
Fix incorrect code sorting pages by their widths in wxRibbon.
The "sneaky obj array trickery" wasn't very sneaky but was just plain wrong
and misused object array of pages in a way that was invalid and didn't crash
just because of sheer luck.
Rewrite this code to use a temporary wxVector of pages that can be sorted
independently of the main m_pages array. This is 100% safe and also more
clear.
Update wxGTK.spec to work with openSUSE build server.
Changes from Marcin Wojdyr fixing issues for different RPM-using systems:
- added all necessary BuildRequires fields
- for openSuse wxGTK-gl package is named libwx_gtk*_gl... (it's
enforced that package with one shared lib has name matching the
library name)
- added missing '%dir's - on some distros rpms didn't built without it
- Fedora, Suse and Mandriva have all different set of known Groups,
I've changed group from 'X11/Libraries' to 'System/Libraries' -- it's
defined at least in Suse and Mandriva. (in recent distro releases
Group can be skipped, so it's becoming irrelevant).
- removed 'Packager' field and dots ending Summary field - AFAIR these
were errors on Opensuse
- added '= %{version}' to Provides
- for Redhat5 use GCC4.4 (build crashed with default 4.2)
Let wxWindow::Fit[Inside]() work even for windows without children.
The best [virtual] size of the window is usually determined by its children
but it's also possible to have a min size constraint set on the window sizer
so set the window to its best size in Fit() independently of whether it has
children or not.