Allow loading 8-bit TGA images when wxUSE_PALETTE is set to 0.
Previously the image would only be loaded when wxPalette is available. This is unneccessary and probably not wanted. Instead decode as usual but use a plain memory buffer for the palette instead of wxPalette functions and don't set the image's palette.
Always save PNG as a true colour image instead of possibly a palettised image when wxUSE_PALETTE is set to 0.
With wxUSE_PALETTE set to 0 and the user forcing to want a wxPNG_TYPE_PALETTE format the image would (partially) be marked as PNG_COLOR_TYPE_GRAY or PNG_COLOR_TYPE_GRAY_ALPHA instead and also saving would fail later on. Instead detect this specific case and save in the wxPNG_TYPE_COLOUR format.
Vadim Zeitlin [Tue, 4 Jan 2011 21:33:16 +0000 (21:33 +0000)]
Disable wxCompositeWindow<> code for VC6.
Revert the attempt to work around VC6 bug from the last commit and simply
disable this code completely for VC6, it's not worth the trouble to try to fix
it for this compiler.
Vadim Zeitlin [Tue, 4 Jan 2011 16:21:42 +0000 (16:21 +0000)]
Remove duplicate IMPLEMENT_XXX_CLASS macros from wxUniv code.
The RTTI macros are now used in common code only and having them in wxUniv too
results in linker errors because of duplicate symbols. Just remove them to fix
this.
Vadim Zeitlin [Tue, 4 Jan 2011 14:13:29 +0000 (14:13 +0000)]
Use wxControl instead of wxControlWithItems with wxRTTI macros.
wxControlWithItems is just a convenient combination of wxControl and
wxItemContainer mix-in and it is not useful to include it in wxRTTI classes
hierarchy. Also, using wxControlWithItems as the base class for wxChoice and
wxListBox but not for wxComboBox is inconsistent but wxControlWithItems can't
be used for the latter so resolve this by not using it at all.
Ideally we'd have a way of retrieving the list of supported interfaces (such
as wxItemContainer or wxTextEntry) via wxRTTI too.
Vadim Zeitlin [Tue, 4 Jan 2011 14:13:17 +0000 (14:13 +0000)]
Use wxControl as wxComboBox base class for wxRTTI in all ports.
wxComboBox only derives from wxChoice in wxMSW but not in the other ports so
use wxControl as its base class in wxIMPLEMENT_DYNAMIC_CLASS_XTI() macro in
all ports.
Since upgrading to a newer libpng its structure members are marked as deprecated (probably as a way to discourage their direct usage). Replaced accessing them by using function calls instead.
Applied patch by troelsk which mostly makes the GIF decoder more readable by using named constants instead of magic numbers. Left out the edits that changed unsigned char to wxUint8. In addition removed unnecessary casts around wxInputStream.GetC() calls.
Vadim Zeitlin [Tue, 4 Jan 2011 11:33:19 +0000 (11:33 +0000)]
wxMSW compilation fix for wxCompositeWindow.
Not all ports override SetXXX() methods in their wxWindow class so use the
versions from wxWindowBase which are definitely known to exist. Notice that
the call itself is still virtual so it doesn't matter which base class do we
use.
Vadim Zeitlin [Mon, 3 Jan 2011 18:44:16 +0000 (18:44 +0000)]
Add "virtual" keywords to the overridden functions in the printing sample.
There are no real changes, just make it easier to understand that the sample
code overrides the base class virtual methods by reusing the virtual keyword
in the derived class.
Vadim Zeitlin [Mon, 3 Jan 2011 15:57:30 +0000 (15:57 +0000)]
Don't hardcode wxPreviewControlBar size in print preview code.
For some reason the control bar height was hard coded to 40 pixels which could
be not enough to use the buttons of the appropriate size. Don't hardcode its
size any more and let the sizer determine it instead.
Vadim Zeitlin [Mon, 3 Jan 2011 14:58:26 +0000 (14:58 +0000)]
Allow selecting any kind of file in the sound sample.
This is especially useful under Mac where wxSound can play files other than
.wav too (e.g. .aiff files which can be found under /System/Library/Sounds).
Vadim Zeitlin [Mon, 3 Jan 2011 11:24:13 +0000 (11:24 +0000)]
Add wxCompositeWindow<> and use it in wxDatePickerCtrlGeneric.
wxCompositeWindow<> is a convenient base class for composite windows, i.e.
windows consisting of several other wxWindows. Currently it just automatically
forwards various attributes setters calls to all of the composite window parts
but it could become more useful in the future.
Similarly, for now it is only used in wxDatePickerCtrlGeneric but it could
(and should) be used for other composite controls later and we probably should
even make this class public to allow its use in the client code.
Vadim Zeitlin [Mon, 3 Jan 2011 11:23:49 +0000 (11:23 +0000)]
No real changes, just remove an unneeded header dependency.
There was some commented out code in (core) valgen.cpp file using
wxDatePickerCtrl (from adv library). Also comment out the inclusion of
wx/datectrl.h header as it's not needed as long as this code remains commented
out and creates an unexpected dependency of a core library file on an adv
library header.
Only including wx/datectrl.h does not always include wx/generic/datectrl.h, for example it does not for MSW non-Universal. As a result when compiling datectlg.cpp wxDatePickerCtrlGeneric is unknown and compilation fails. Fixed by including wx/generic/datectrl.h again (regression since r66524).
Vadim Zeitlin [Sun, 2 Jan 2011 22:05:14 +0000 (22:05 +0000)]
Remove calls to wxApp::SetTopWindow() from the samples and documentation.
It is definitely not necessary to call SetTopWindow() when there is only a
single top level window and it is arguable whether it's useful to do it even
when there are many of them so don't encourage its use in the documentation
and also remove all its occurrences from the samples.
Vadim Zeitlin [Sun, 2 Jan 2011 22:03:56 +0000 (22:03 +0000)]
Forward declare classes instead of including their declarations.
No real changes, just reduce the compilation dependencies a bit by only
forward declaring wxComboCtrl and wxCalendarCtrl in wx/generic/datectrl.h
instead of including the headers with their full declarations.
Vadim Zeitlin [Fri, 31 Dec 2010 17:39:37 +0000 (17:39 +0000)]
Add wxUSE_ARTPROVIDER_STD build option.
Make it possible to exclude wxDefaultArtProvider from build. Now that a
Tango-based provider exists, it may make sense to disable the standard bitmaps
if the program doesn't need the few of them not provided by Tango anyhow.
Vadim Zeitlin [Fri, 31 Dec 2010 17:39:25 +0000 (17:39 +0000)]
Add wxArtProvider using Tango icons.
The icons are embedded as PNG images directly in the source code to avoid the
need for installing them. This does make the library larger though so provide
a wxUSE_ARTPROVIDER_TANGO option to turn the new code and associated bloat off.
Also turn it off by default under wxGTK as the native art provider is used
there anyhow.
Vadim Zeitlin [Fri, 31 Dec 2010 17:39:01 +0000 (17:39 +0000)]
Add go to first/last and plus/minus art provider icons.
These icons will be used in the upcoming new implementation of the print
preview frame and as they are also natively supported by GTK+ it makes sense
to have support for them in wx itself.
Notice that the existing bookmark add/remove icons are already mapped to the
icons which look like plus and minus signs respectively in wxGTK but we need
plus/minus in print preview in the other ports too so add these icons under
explicit names.
Vadim Zeitlin [Fri, 31 Dec 2010 17:38:40 +0000 (17:38 +0000)]
Add an option to embed image size in its name to PNG-to-C script.
When a PNG image exists in several sizes it makes sense to use its size as a
suffix to distinguish the different versions, so update the png2c script to
optionally allow to do this.
Current implementation simply checks the PNG header directly to avoid any
extra dependencies.
Vadim Zeitlin [Fri, 31 Dec 2010 17:38:35 +0000 (17:38 +0000)]
Show wxART_BUTTON icons in art provider sample resource browser.
The button icons have a different size from all the other clients in wxGTK so
it may be interesting to see them in the sample, add wxART_BUTTON to the list
of art clients that can be chosen in it.
Vadim Zeitlin [Fri, 31 Dec 2010 17:38:29 +0000 (17:38 +0000)]
Accept file names with dashes in PNG-to-C converter.
Tango icon files often have dashes in their names so accept them in png2c
conversion script and simply replace them with underscores to form a C
identifier for the array containing the image data.
Vadim Zeitlin [Fri, 31 Dec 2010 17:29:39 +0000 (17:29 +0000)]
Use open command to run the GUI unit test on Mac build slave.
Running the application binary directly still doesn't work quite the same as
when it's opened from Finder (or executed using open) and some tests involving
event loops fail because of this.
Run it using open even if it means that we lose the detailed log output.
Vadim Zeitlin [Fri, 31 Dec 2010 13:12:56 +0000 (13:12 +0000)]
Document how to get the previous selection in wxEVT_GRID_SELECT_CELL handler.
Make explicit the fact that the cell coordinates in the event are the
coordinates of the newly selected cell and that the previously selected one is
available from wxGrid itself.
Vadim Zeitlin [Thu, 30 Dec 2010 22:37:17 +0000 (22:37 +0000)]
Move wxMSW wxCommandLinkButton files to native-only part.
wxMSW wxCommandLinkButton implementation shouldn't be used in wxUniv so move
src/msw/commandlinkbutton.cpp and include/wx/msw/commandlinkbutton.h to
ADVANCED_MSW_NATIVE_{SRC,HDR} from ADVANCED_MSW_{SRC,HDR} in files.bkl and
rebake the makefiles.
Vadim Zeitlin [Thu, 30 Dec 2010 22:37:03 +0000 (22:37 +0000)]
Move wxGetLibraryVersionInfo() to core from base.
This function uses the GUI toolkit information and so can't be defined in
wxBase. The code only compiled before because the function was erroneously
defined in wxCore even though it was declared as WXDLLIMPEXP_BASE.
Fix this by declaring it with WXDLLIMPEXP_CORE too. This corrects problems in
MSW DLL build.
If we need to get a string containing user-readable wxBase version too, we
should add another function (as it's not possible to virtualize this one) but
such function doesn't seem incredibly useful to have anyhow.
Tightened icon and cursor file detection heuristics.
When loading a TGA file that has an image type of uncompressed true colour it would be falsely detected as a cursor file and as an icon file if type is of uncompressed colour mapped. Lower the chance of this happening by also checking the remaining member of an ICO and CUR header which represents the number of images in the file. This member has to be non-zero (checked against all found ICO and CUR files in an XP installation).
Supports saving 24-bit and 32-bit (RGB with alpha).
Updated image unit test to verify the alpha channel of saved TGA images. Also removed a condition skipping a test which only was in place for TGA (formerly its saving handler would do nothing yet say saving was succesful).
Expanded existing image saving test to also verify alpha content of saved images.
Compare the alpha data of saved images (where applicable, currently for PNG only) to a generated alpha channel. Refactored most of ImageTestCase.CompareSavedImage into (static) function CompareImage to easily compare with a 24-bit image and then a 32-bit one.
Added some simple unit tests for verifying pixel content of loaded and saved images.
Compare the data of loaded images in different formats against a reference image (one for 8-bit images, another for 24-bit). Do the same for images saved using SaveFile. Excluded some formats because they are either lossy or don't pass the test right now.
Updated manual regarding image alpha support for BMP, PNG, and TIFF handlers.
For PNG it was mentioned only loading supports alpha, but alpha saving support has been available since r32414. Similarly there was no mention of alpha loading support for TIFF (supported since r47204) as well as BMP (since r54942).