Vadim Zeitlin [Tue, 22 Mar 2011 15:07:20 +0000 (15:07 +0000)]
Correctly align background brush when erasing owner drawn bitmaps in wxMSW.
Add a hack to work around the problem with background alignment when drawing
the owner-drawn buttons in wxMSW. This fixes the alignment for any custom
brushes used for background painting but doesn't help with user-defined
EVT_ERASE_BACKGROUND handlers which still don't work well with the owner-drawn
buttons. Unfortunately DrawThemeParentBackground() remains a mystery and I
couldn't understand why not only doesn't it position the DC correctly on its
own but also ignores any attempts to do it manually.
This also doesn't help with the stubbornly remaining one pixel non-transparent
border around non-owner-drawn buttons which I just can't get rid of.
Applied patch by snowleopard2 fixing a bunch of typos such as misspellings and double words in the documentation. Combined the patch with some local queued typos waiting to be committed as well as adding new typo fixes inspired by the patch.
Function names with American spelling were not changed nor was third-party code touched. The only code changes involve some changes in strings that are translated ("Can not" -> "Cannot").
Jaakko Salli [Tue, 22 Mar 2011 09:56:40 +0000 (09:56 +0000)]
To have better support for themed and custom backgrounds for wxMSW wxComboCtrl, use WS_EX_COMPOSITED and wxBG_STYLE_ERASE instead of custom double-buffering (when made possible by the OS version)
Vadim Zeitlin [Mon, 21 Mar 2011 10:59:59 +0000 (10:59 +0000)]
Allow using milliseconds in wxLog timestamp.
Use wxDateTime::UNow() instead of time() and wxDateTime::Format() instead of
localtime() to make it possible to use "%l" specifier in wxLog time stamp.
Vadim Zeitlin [Sun, 20 Mar 2011 22:33:16 +0000 (22:33 +0000)]
Don't draw the mysterious black rectangle in the erase sample.
The black rectangle drawn in EVT_PAINT handler in the sample prevented the
custom background from showing through the wxStaticBitmap. Maybe it was
initially done intentionally but this makes the sample look broken so just
don't do this.
Read a few TIFF tags that assist with having a similar TIFF file when saving the image again, instead of (by default) always saving as a 24-bit RGB image. Also, in accordance with libtiff, allow reading X and Y resolution values even if the resolution unit tag is not set.
Applied (modified) patch by scottb. Closes #13015.
Jaakko Salli [Sun, 20 Mar 2011 10:59:22 +0000 (10:59 +0000)]
Redone (generic) wxComboCtrl background painting and handling. The 'actual' wxWindow background colour is now largely ignored and overridden to refer the text-area's background colour instead (as is usually the case with controls like this). Base 'transparent' background is now only painted when double-buffered rendering is required, and otherwise delegated to the system, as appropriate. This should significantly improve control's appearance and compliancy with GTK+ and OS X themes and custom backgrounds.
No changes, synchronised source names that appear commented at the top of files with the actual path to the files.
Fixed commented names (path, filename, and extension) of files in include/ and src/. Prepended the names in src/ with "src/" everywhere, while starting those in include/wx/ with "wx/".
Vadim Zeitlin [Sun, 20 Mar 2011 00:00:49 +0000 (00:00 +0000)]
Add wxPanel::SetBackgroundBitmap().
This method provides a simple way to set a background bitmap without defining
an EVT_ERASE_BACKGROUND handler and, more importantly, one that works
correctly in wxMSW for a window with children as it paints the background of
transparent children too.
Vadim Zeitlin [Sun, 20 Mar 2011 00:00:42 +0000 (00:00 +0000)]
Deprecate old style wxPanel ctor taking separate coordinates.
wxPanel had a ctor in very old (wx 1.x-compatible?) style which was marked as
"old" and not documented but not officially deprecated. Do deprecate it now in
view of removing it in later releases.
Vadim Zeitlin [Sun, 20 Mar 2011 00:00:38 +0000 (00:00 +0000)]
Split wxPanel in wxPanelBase and platform-specific files.
So far we have only wxMSW-specific implementation (and also a trivial
wxUniv-specific one) but it's still tidier to have all platform-specific code
in separate files, especially as we're going to have more of it for wxMSW
soon.
Vadim Zeitlin [Sun, 20 Mar 2011 00:00:29 +0000 (00:00 +0000)]
No changes, just refactor wxMSW background brush methods.
Factor out MSWGetCustomBgBrush() from MSWGetBgBrushForChild(). This is useful
as in the vast majority of cases the parent window will want to use the same
background brush for all of its children so it doesn't really care about the
concrete child passed to MSWGetBgBrushForChild() and we can adjust the brush
to the child origin in the common code instead of asking each derived class
overriding MSWGetBgBrushForChild() to do this.
This doesn't change anything but will make the upcoming changes to wxPanel
background painting simpler.
Vadim Zeitlin [Sat, 19 Mar 2011 11:57:13 +0000 (11:57 +0000)]
Fix wxRegKey::GetKeyInfo() output parameters in 64 bit builds.
Use intermediate 32 bit DWORD variables for ::RegQueryInfoKey() outputs as
size_t is 64 bit in 64 bit MSW builds and so the variables of type size_t
can't/shouldn't be passed directly to this function to avoid only filling
their lower 32 bits.
A C-style comment was not closed and resulted in the explanation of wxIMAGE_QUALITY_NORMAL additionally containing the explanation of wxIMAGE_QUALITY_BOX_AVERAGE and the latter having none. Regression since r67203.
Vadim Zeitlin [Fri, 18 Mar 2011 09:16:19 +0000 (09:16 +0000)]
Fix exporting clipboard data to primary selection in wxGTK.
Honour the requested selection in our selection handler instead of always
returning the default one resulting in wrong data being pasted when using
primary selection (e.g. middle clicking).
Add a method which can be used to indicate that the help window should prevent
the application from exiting and use it in the help sample to prevent it from
closing prematurely.
Vadim Zeitlin [Fri, 18 Mar 2011 09:16:06 +0000 (09:16 +0000)]
Limit the search in wxMSW virtual wxListCtrl by time.
Instead of performing the search only up to a certain number of items, do it
for as long as it takes less than the given time threshold (currently fixed at
half a second).
Vadim Zeitlin [Thu, 17 Mar 2011 11:35:37 +0000 (11:35 +0000)]
Add a wxStaticText to the erase simple.
This control explains better what is going on in the sample and also allows to
test whether wxStaticText itself has properly transparent background (this is
not currently the case under MSW).
Changed behaviour of wxImageResizeQuality parameter in wxImage.Scale and wxImage.Rescale.
Made the following changes:
* Formerly specifying to resize using wxIMAGE_QUALITY_BICUBIC or wxIMAGE_QUALITY_BILINEAR could result in the ResampleBox method being used. Now always resize with the method that the user actually specified.
* Added wxIMAGE_QUALITY_BOX_AVERAGE to explicitly allow resizing with the ResampleBox method.
* Previously wxIMAGE_QUALITY_HIGH was equal to wxIMAGE_QUALITY_BICUBIC. It has been changed to use wxIMAGE_QUALITY_BOX_AVERAGE when reducing the size of an image and wxIMAGE_QUALITY_BICUBIC in all other cases.
Changed wxImage.ResampleBox to always use a box size of at least 2 by 2 pixels.
Previously when resizing by more than 50% (for example resizing from 100x100 to 51x51 or 140x140) a box size of 1x1 would be used which effectively would give the same result as using nearest neighbour. Make sure that at least a box size of 2x2 pixels is always used.
Vadim Zeitlin [Tue, 15 Mar 2011 11:10:42 +0000 (11:10 +0000)]
Use consistent sizes for all icons used in the button page of widgets sample.
Explicitly pass wxART_BUTTON to wxArtProvider to ensure that all the icons are
returned in the same size, otherwise they didn't look well and could result in
an assert too, see #12909.
Vadim Zeitlin [Mon, 14 Mar 2011 11:55:05 +0000 (11:55 +0000)]
Show wx{Note,Tool}book-specific styles in the notebook sample too.
Demonstrate the use of styles such as wxNB_FIXEDWIDTH or wxTBK_HORZ_LAYOUT
specific to particular controls and not only the ones common to all of them.
Vadim Zeitlin [Mon, 14 Mar 2011 11:55:01 +0000 (11:55 +0000)]
Don't generate wxEVT_CHAR_HOOK events while the mouse is captured.
This prevents the parent TLW from interfering with the keyboard handling of
the window that captured the mouse which very often needs Escape for itself to
cancel the capture.
In particular, this fixes the problems with Escape closing the entire dialog
containing the controls instead of closing just the combobox drop down or a
popup menu in wxMSW.
Also modify wxGTK for consistency and update the documentation.
Vadim Zeitlin [Mon, 14 Mar 2011 11:54:51 +0000 (11:54 +0000)]
Don't intercept Escape key while IME is active.
Escape is used by IME and intercepting it at wxWidgets level to generate
EVT_CHAR_HOOK breaks the IME UI and may result in unexpected loss of data
entered by user.
To work around this, don't generate EVT_CHAR_HOOK for Escape while IME is
active by checking for the special semaphore variable (which could be also
used for other things in the future, see #9102) value.
Vadim Zeitlin [Mon, 14 Mar 2011 11:54:43 +0000 (11:54 +0000)]
Produce correct SVG files in all locales.
Using wxSVGFileDC in locales using comma as decimal separator resulted in
invalid SVG files being created as a decimal period should always be used in
them.
Fix this by replacing "%g" format specification with wxString::FromCDouble()
call (wrapped in a convenient NumStr() helper function).
Vadim Zeitlin [Mon, 14 Mar 2011 11:54:39 +0000 (11:54 +0000)]
Fix changing the size of the bitmaps in wxMSW wxButton.
The size of the wxImageList used to store the bitmaps wasn't updated before
and so the old bitmap size continued to be used even after changing the actual
bitmaps.
Recreate wxXPButtonImageData to ensure that the image list size does change.
Vadim Zeitlin [Mon, 14 Mar 2011 11:54:35 +0000 (11:54 +0000)]
Print everything by default in non-interactive mode.
IF we don't show the dialog allowing the user to select the pages range, we
should print everything by default instead of printing nothing at all as we
used to do.
Vadim Zeitlin [Mon, 14 Mar 2011 11:54:32 +0000 (11:54 +0000)]
Allow wxThread::Wait() and Delete() to block, even under wxMSW.
Add "wait mode" parameter to these methods which can be used to make them
block even under wxMSW where they currently dispatch messages when called
which can be totally unexpected.
Do keep the old behaviour for compatibility however, although it will change i
3.2.
Vadim Zeitlin [Mon, 14 Mar 2011 11:54:26 +0000 (11:54 +0000)]
Respect alignment flags for owner-drawn buttons in wxMSW.
Honour wxBU_{LEFT,RIGHT,TOP,BOTTOM} flags for owner drawn buttons too, this
ensures that you can both change the colour and align the text differently for
buttons under XP and later.
Vadim Zeitlin [Sun, 13 Mar 2011 13:53:54 +0000 (13:53 +0000)]
Added precision parameter to wxString::From[C]Double().
Optionally support fixed precision in wxString::FromDouble() and FromCDouble()
methods. This is mostly useful for the latter to be able to format numbers in
portable way (using dot as decimal separator) without loss of precision but
also do it for the former for consistency.
Vadim Zeitlin [Wed, 9 Mar 2011 16:35:56 +0000 (16:35 +0000)]
Make brush hatches in wxGTK consistent with wxMSW.
The cross, vertically and horizontally hatched brushes used 4 pixels between
the hatches in wxGTK but 7 in wxMSW which was very noticeable. Use the same
pattern in wxGTK as MSW uses (as we can't change it there anyhow).
Vadim Zeitlin [Wed, 9 Mar 2011 16:35:43 +0000 (16:35 +0000)]
Don't pop up annoying message box in the drawing sample.
The rubber banding selection message box was shown even after a simple click,
i.e. when nothing was actually selected which was quite annoying, so don't do
this.
Also remove unnecessary casts and use wxLogMessage() instead of
wxString::Printf() + wxMessageBox().
Vadim Zeitlin [Wed, 9 Mar 2011 10:07:58 +0000 (10:07 +0000)]
Corrections to wxTextCtrl::HitTest() documentation.
Fix the signature of the overload returning row and column which got corrupted
during transition to Doxygen and document the overload returning the position
as well. Also document all the parameters.
Vadim Zeitlin [Wed, 9 Mar 2011 09:28:41 +0000 (09:28 +0000)]
Fix search for item by text in wxMSW wxListCtrl.
LVN_ODFINDITEM handler could enter infinite loop if its selection was 0 and a
key not matching any of the items first letters was pressed.
Rewrite the loop in a simpler form to ensure that it is correct. Also clarify
some comments. Finally, fix the behaviour when no matching item was found (if
it didn't hang in infinite loop, it used to select the first item in the
control).
Vadim Zeitlin [Wed, 9 Mar 2011 09:28:34 +0000 (09:28 +0000)]
Don't assert if starting search position in LVN_ODFINDITEM is invalid.
Just use wxLogDebug() if this happens, asserting here is not the right thing
to do as it doesn't indicate an error in the program but rather invalid
external input and, moreover, we can recover from it easily.
Jaakko Salli [Mon, 7 Mar 2011 13:02:33 +0000 (13:02 +0000)]
To prevent wxPropertyGrid from stealing frocus from other controls, only let SetFocusOnCanvas() move focus to the main grid 'canvas' if focus was already in on the grid's child controls