Added animation classes to contrib hierarchy
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10856 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
335
contrib/include/wx/animate/animate.h
Normal file
335
contrib/include/wx/animate/animate.h
Normal file
@@ -0,0 +1,335 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: animate.h
|
||||
// Purpose: Animation classes
|
||||
// Author: Julian Smart and Guillermo Rodriguez Garcia
|
||||
// Modified by:
|
||||
// Created: 13/8/99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart and Guillermo Rodriguez Garcia
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_ANIMATEH__
|
||||
#define _WX_ANIMATEH__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "animate.h"
|
||||
#endif
|
||||
|
||||
#include <wx/defs.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/list.h>
|
||||
#include <wx/timer.h>
|
||||
|
||||
//#define ANIMDLLEXPORT WXDLLEXPORT
|
||||
#define ANIMDLLEXPORT
|
||||
|
||||
class ANIMDLLEXPORT wxAnimationBase;
|
||||
class ANIMDLLEXPORT wxAnimationPlayer;
|
||||
class WXDLLEXPORT wxImage;
|
||||
|
||||
enum wxAnimationDisposal
|
||||
{
|
||||
wxANIM_UNSPECIFIED = -1,
|
||||
wxANIM_DONOTREMOVE = 0,
|
||||
wxANIM_TOBACKGROUND = 1,
|
||||
wxANIM_TOPREVIOUS = 2
|
||||
} ;
|
||||
|
||||
class ANIMDLLEXPORT wxAnimationTimer: public wxTimer
|
||||
{
|
||||
public:
|
||||
wxAnimationTimer() { m_player = (wxAnimationPlayer*) NULL; }
|
||||
|
||||
virtual void Notify();
|
||||
void SetPlayer(wxAnimationPlayer* player) { m_player = player; }
|
||||
|
||||
protected:
|
||||
wxAnimationPlayer* m_player;
|
||||
};
|
||||
|
||||
/* wxAnimationPlayer
|
||||
* Create an object of this class, and either pass an wxXXXAnimation object in the constructor,
|
||||
* or call SetAnimation. Then call Play().
|
||||
* The wxAnimation object is only destroyed in the destructor if destroyAnimation is TRUE
|
||||
* in the constructor.
|
||||
*/
|
||||
|
||||
class ANIMDLLEXPORT wxAnimationPlayer : public wxObject
|
||||
{
|
||||
DECLARE_CLASS(wxAnimationPlayer)
|
||||
|
||||
public:
|
||||
wxAnimationPlayer(wxAnimationBase *animation = (wxAnimationBase *) NULL, bool destroyAnimation = FALSE);
|
||||
~wxAnimationPlayer();
|
||||
//// Accessors
|
||||
|
||||
void SetAnimation(wxAnimationBase* animation, bool destroyAnimation = FALSE);
|
||||
wxAnimationBase* GetAnimation() const { return m_animation; }
|
||||
|
||||
void SetDestroyAnimation(bool destroyAnimation) { m_destroyAnimation = destroyAnimation; };
|
||||
bool GetDestroyAnimation() const { return m_destroyAnimation; }
|
||||
|
||||
void SetCurrentFrame(int currentFrame) { m_currentFrame = currentFrame; };
|
||||
int GetCurrentFrame() const { return m_currentFrame; }
|
||||
|
||||
void SetWindow(wxWindow* window) { m_window = window; };
|
||||
wxWindow* GetWindow() const { return m_window; }
|
||||
|
||||
void SetPosition(const wxPoint& pos) { m_position = pos; };
|
||||
wxPoint GetPosition() const { return m_position; }
|
||||
|
||||
void SetLooped(bool looped) { m_looped = looped; };
|
||||
bool GetLooped() const { return m_looped; }
|
||||
|
||||
bool HasAnimation() const { return (m_animation != (wxAnimationBase*) NULL); }
|
||||
|
||||
bool IsPlaying() const { return m_isPlaying; }
|
||||
|
||||
// Specify whether the GIF's background colour is to be shown,
|
||||
// or whether the window background should show through (the default)
|
||||
void UseBackgroundColour(bool useBackground) { m_useBackgroundColour = useBackground; }
|
||||
bool UsingBackgroundColour() const { return m_useBackgroundColour; }
|
||||
|
||||
// Set and use a user-specified background colour (valid for transparent
|
||||
// animations only)
|
||||
void SetCustomBackgroundColour(const wxColour& col, bool useCustomBackgroundColour = TRUE)
|
||||
{ m_customBackgroundColour = col; m_useCustomBackgroundColour = useCustomBackgroundColour; }
|
||||
|
||||
bool UsingCustomBackgroundColour() const { return m_useCustomBackgroundColour; }
|
||||
const wxColour& GetCustomBackgroundColour() const { return m_customBackgroundColour; }
|
||||
|
||||
// Another refinement - suppose we're drawing the animation in a separate
|
||||
// control or window. We may wish to use the background of the parent
|
||||
// window as the background of our animation. This allows us to specify
|
||||
// whether to grab from the parent or from this window.
|
||||
void UseParentBackground(bool useParent) { m_useParentBackground = useParent; }
|
||||
bool UsingParentBackground() const { return m_useParentBackground; }
|
||||
|
||||
//// Operations
|
||||
|
||||
// Play
|
||||
virtual bool Play(wxWindow& window, const wxPoint& pos = wxPoint(0, 0), bool looped = TRUE);
|
||||
|
||||
// Build animation (list of wxImages). If not called before Play
|
||||
// is called, Play will call this automatically.
|
||||
virtual bool Build();
|
||||
|
||||
// Stop the animation
|
||||
virtual void Stop();
|
||||
|
||||
// Draw the current view of the animation into this DC.
|
||||
// Call this from your OnPaint, for example.
|
||||
virtual void Draw(wxDC& dc);
|
||||
|
||||
//// Accessing the current animation
|
||||
|
||||
virtual int GetFrameCount() const;
|
||||
virtual wxImage* GetFrame(int i) const; // Creates a new wxImage
|
||||
virtual wxAnimationDisposal GetDisposalMethod(int i) const;
|
||||
virtual wxRect GetFrameRect(int i) const; // Position and size of frame
|
||||
virtual int GetDelay(int i) const; // Delay for this frame
|
||||
|
||||
virtual wxSize GetLogicalScreenSize() const;
|
||||
virtual bool GetBackgroundColour(wxColour& col) const ;
|
||||
virtual bool GetTransparentColour(wxColour& col) const ;
|
||||
|
||||
//// Implementation
|
||||
|
||||
// Play the frame
|
||||
virtual bool PlayFrame(int frame, wxWindow& window, wxPoint& pos);
|
||||
virtual bool PlayFrame();
|
||||
virtual void DrawFrame(int frame, wxDC& dc, const wxPoint& pos);
|
||||
virtual void DrawBackground(wxDC& dc, const wxPoint& pos, const wxColour& colour);
|
||||
|
||||
// Clear the wxImage cache
|
||||
virtual void ClearCache();
|
||||
|
||||
// Save the pertinent area of the window so we can restore
|
||||
// it if drawing transparently
|
||||
void SaveBackground(const wxRect& rect);
|
||||
|
||||
wxBitmap& GetBackingStore() { return m_backingStore; }
|
||||
|
||||
//// Data members
|
||||
protected:
|
||||
wxAnimationBase* m_animation;
|
||||
bool m_destroyAnimation; // Destroy m_animation on deletion of this object
|
||||
wxList m_frames; // List of cached wxBitmap frames.
|
||||
int m_currentFrame; // Current frame
|
||||
wxWindow* m_window; // Window to draw into
|
||||
wxPoint m_position; // Position to draw at
|
||||
bool m_looped; // Looped, or not
|
||||
wxAnimationTimer m_timer; // The timer
|
||||
bool m_isPlaying; // Is the animation playing?
|
||||
wxBitmap m_savedBackground; // Saved background of window portion
|
||||
wxBitmap m_backingStore; // The player draws into this
|
||||
bool m_useBackgroundColour; // Use colour or background
|
||||
wxColour m_customBackgroundColour; // Override animation background
|
||||
bool m_useCustomBackgroundColour;
|
||||
bool m_useParentBackground; // Grab background from parent?
|
||||
};
|
||||
|
||||
/* wxAnimationBase
|
||||
* Base class for animations.
|
||||
* A wxXXXAnimation only stores the animation, providing accessors to wxAnimationPlayer.
|
||||
* Currently an animation is read-only, but we could extend the API for adding frames
|
||||
* programmatically, and perhaps have a wxMemoryAnimation class that stores its frames
|
||||
* in memory, and is able to save all files with suitable filenames. You could then use
|
||||
* e.g. Ulead GIF Animator to load the image files into a GIF animation.
|
||||
*/
|
||||
|
||||
class ANIMDLLEXPORT wxAnimationBase : public wxObject
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(wxAnimationBase)
|
||||
|
||||
public:
|
||||
wxAnimationBase() {};
|
||||
~wxAnimationBase() {};
|
||||
|
||||
//// Accessors. Should be overridden by each derived class.
|
||||
|
||||
virtual int GetFrameCount() const = 0;
|
||||
virtual wxImage* GetFrame(int i) const = 0; // Creates a new wxImage
|
||||
virtual wxAnimationDisposal GetDisposalMethod(int i) const = 0;
|
||||
virtual wxRect GetFrameRect(int i) const = 0; // Position and size of frame
|
||||
virtual int GetDelay(int i) const = 0; // Delay for this frame
|
||||
|
||||
virtual wxSize GetLogicalScreenSize() const = 0;
|
||||
virtual bool GetBackgroundColour(wxColour& col) const = 0;
|
||||
virtual bool GetTransparentColour(wxColour& col) const = 0;
|
||||
|
||||
// Is the animation OK?
|
||||
virtual bool IsValid() const = 0;
|
||||
|
||||
//// Operations
|
||||
|
||||
virtual bool LoadFile(const wxString& filename) { return FALSE; }
|
||||
};
|
||||
|
||||
/* wxGIFAnimation
|
||||
* This will be moved to a separate file in due course.
|
||||
*/
|
||||
|
||||
class ANIMDLLEXPORT wxGIFDecoder;
|
||||
|
||||
class ANIMDLLEXPORT wxGIFAnimation : public wxAnimationBase
|
||||
{
|
||||
DECLARE_CLASS(wxGIFAnimation)
|
||||
|
||||
public:
|
||||
wxGIFAnimation() ;
|
||||
~wxGIFAnimation() ;
|
||||
|
||||
//// Accessors
|
||||
|
||||
virtual int GetFrameCount() const;
|
||||
virtual wxImage* GetFrame(int i) const;
|
||||
virtual wxAnimationDisposal GetDisposalMethod(int i) const;
|
||||
virtual wxRect GetFrameRect(int i) const; // Position and size of frame
|
||||
virtual int GetDelay(int i) const; // Delay for this frame
|
||||
|
||||
virtual wxSize GetLogicalScreenSize() const ;
|
||||
virtual bool GetBackgroundColour(wxColour& col) const ;
|
||||
virtual bool GetTransparentColour(wxColour& col) const ;
|
||||
|
||||
virtual bool IsValid() const;
|
||||
|
||||
//// Operations
|
||||
|
||||
virtual bool LoadFile(const wxString& filename);
|
||||
|
||||
protected:
|
||||
|
||||
wxGIFDecoder* m_decoder;
|
||||
};
|
||||
|
||||
/*
|
||||
* wxAnimationCtrlBase
|
||||
* Abstract base class for format-specific animation controls.
|
||||
* This class implements most of the functionality; all a derived
|
||||
* class has to do is create the appropriate animation class on demand.
|
||||
*/
|
||||
|
||||
// Resize to animation size if this is set
|
||||
#define wxAN_FIT_ANIMATION 0x0010
|
||||
|
||||
class ANIMDLLEXPORT wxAnimationCtrlBase: public wxControl
|
||||
{
|
||||
public:
|
||||
wxAnimationCtrlBase() { }
|
||||
wxAnimationCtrlBase(wxWindow *parent, wxWindowID id,
|
||||
const wxString& filename = wxEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = wxAN_FIT_ANIMATION|wxNO_BORDER,
|
||||
const wxString& name = wxT("animationControl"))
|
||||
{
|
||||
Create(parent, id, filename, pos, size, style, name);
|
||||
}
|
||||
~wxAnimationCtrlBase();
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID id,
|
||||
const wxString& filename = wxEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = wxAN_FIT_ANIMATION|wxNO_BORDER,
|
||||
const wxString& name = wxT("animationControl"));
|
||||
|
||||
//// Operations
|
||||
virtual bool LoadFile(const wxString& filename = wxEmptyString);
|
||||
virtual bool Play(bool looped = TRUE) ;
|
||||
virtual void Stop() { m_animationPlayer.Stop(); }
|
||||
virtual void FitToAnimation();
|
||||
|
||||
//// Accessors
|
||||
virtual bool IsPlaying() const { return m_animationPlayer.IsPlaying(); }
|
||||
virtual wxAnimationPlayer& GetPlayer() { return m_animationPlayer; }
|
||||
virtual wxAnimationBase* GetAnimation() { return m_animation; }
|
||||
|
||||
const wxString& GetFilename() const { return m_filename; }
|
||||
void SetFilename(const wxString& filename) { m_filename = filename; }
|
||||
|
||||
//// Event handlers
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
|
||||
protected:
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
// Override this in derived classes
|
||||
virtual wxAnimationBase* DoCreateAnimation(const wxString& filename) = 0;
|
||||
|
||||
wxAnimationPlayer m_animationPlayer;
|
||||
wxAnimationBase* m_animation;
|
||||
wxString m_filename;
|
||||
|
||||
private:
|
||||
DECLARE_ABSTRACT_CLASS(wxAnimationCtrlBase)
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
/*
|
||||
* wxGIFAnimationCtrl
|
||||
* Provides a GIF animation class when required.
|
||||
*/
|
||||
|
||||
class ANIMDLLEXPORT wxGIFAnimationCtrl: public wxAnimationCtrlBase
|
||||
{
|
||||
public:
|
||||
wxGIFAnimationCtrl() { }
|
||||
wxGIFAnimationCtrl(wxWindow *parent, wxWindowID id,
|
||||
const wxString& filename = wxEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = wxAN_FIT_ANIMATION|wxNO_BORDER,
|
||||
const wxString& name = wxT("animationControl"))
|
||||
{
|
||||
Create(parent, id, filename, pos, size, style, name);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual wxAnimationBase* DoCreateAnimation(const wxString& filename) ;
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxGIFAnimationCtrl)
|
||||
};
|
||||
|
||||
#endif // _WX_ANIMATEH__
|
||||
|
223
contrib/samples/animate/AniTestVC.dsp
Normal file
223
contrib/samples/animate/AniTestVC.dsp
Normal file
@@ -0,0 +1,223 @@
|
||||
# Microsoft Developer Studio Project File - Name="AniTestVC" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=AniTestVC - Win32 UnivDebug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "AniTestVC.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "AniTestVC.mak" CFG="AniTestVC - Win32 UnivDebug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "AniTestVC - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "AniTestVC - Win32 Debug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "AniTestVC - Win32 Debug DLL" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "AniTestVC - Win32 Release DLL" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "AniTestVC - Win32 UnivRelease" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "AniTestVC - Win32 UnivDebug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "AniTestVC - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../../include" /I "../../../contrib/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||
# ADD BASE RSC /l 0x809 /d "NDEBUG"
|
||||
# ADD RSC /l 0x809 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx.lib png.lib zlib.lib jpeg.lib tiff.lib anim.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /nodefaultlib:"msvcrtd.lib" /out:"Release/anitest.exe" /libpath:"../../../lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "AniTestVC - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../../include" /I "../../../contrib/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /c
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||
# ADD RSC /l 0x809 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxd.lib pngd.lib zlibd.lib jpegd.lib tiffd.lib animd.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /nodefaultlib:"msvcrt.lib" /out:"Debug/anitest.exe" /pdbtype:sept /libpath:"../../../lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "AniTestVC - Win32 Debug DLL"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "DebugDLL"
|
||||
# PROP BASE Intermediate_Dir "DebugDLL"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "DebugDLL"
|
||||
# PROP Intermediate_Dir "DebugDLL"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../../include" /I "../../../contrib/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D WXUSINGDLL=1 /Yu"wx/wxprec.h" /FD /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||
# ADD RSC /l 0x809 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx23_2d.lib animd.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /out:"DebugDLL/anitest.exe" /pdbtype:sept /libpath:"../../../lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "AniTestVC - Win32 Release DLL"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "ReleaseDLL"
|
||||
# PROP BASE Intermediate_Dir "ReleaseDLL"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "ReleaseDLL"
|
||||
# PROP Intermediate_Dir "ReleaseDLL"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../../include" /I "../../../contrib/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D WXUSINGDLL=1 /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||
# ADD BASE RSC /l 0x809 /d "NDEBUG"
|
||||
# ADD RSC /l 0x809 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx23_2.lib anim.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /out:"ReleaseDLL/anitest.exe" /libpath:"../../../lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "AniTestVC - Win32 UnivRelease"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "UnivRelease"
|
||||
# PROP BASE Intermediate_Dir "UnivRelease"
|
||||
# PROP BASE Ignore_Export_Lib 0
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "UnivRelease"
|
||||
# PROP Intermediate_Dir "UnivRelease"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../../include" /I "../../../contrib/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /c
|
||||
# SUBTRACT BASE CPP /YX
|
||||
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../../include" /I "../../../contrib/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WXUNIVERSAL__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||
# ADD BASE RSC /l 0x809 /d "NDEBUG"
|
||||
# ADD RSC /l 0x809 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx.lib png.lib zlib.lib jpeg.lib tiff.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /nodefaultlib:"msvcrtd.lib" /out:"Release/minimal.exe" /libpath:"../../lib" /libpath:"../../contrib/lib"
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx_univ.lib png.lib zlib.lib jpeg.lib tiff.lib anim.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /nodefaultlib:"msvcrtd.lib" /out:"UnivRelease/anitest.exe" /libpath:"../../../lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "AniTestVC - Win32 UnivDebug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "UnivDebug"
|
||||
# PROP BASE Intermediate_Dir "UnivDebug"
|
||||
# PROP BASE Ignore_Export_Lib 0
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "UnivDebug"
|
||||
# PROP Intermediate_Dir "UnivDebug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../../include" /I "../../../contrib/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /Yu"wx/wxprec.h" /FD /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../../include" /I "../../../contrib/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WXUNIVERSAL__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /c
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||
# ADD RSC /l 0x809 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxd.lib pngd.lib zlibd.lib jpegd.lib tiffd.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /nodefaultlib:"msvcrt.lib" /out:"Debug/minimal.exe" /pdbtype:sept /libpath:"../../lib" /libpath:"../../contrib/lib"
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx_univd.lib pngd.lib zlibd.lib jpegd.lib tiffd.lib animd.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /nodefaultlib:"msvcrt.lib" /out:"UnivDebug/anitest.exe" /pdbtype:sept /libpath:"../../../lib"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "AniTestVC - Win32 Release"
|
||||
# Name "AniTestVC - Win32 Debug"
|
||||
# Name "AniTestVC - Win32 Debug DLL"
|
||||
# Name "AniTestVC - Win32 Release DLL"
|
||||
# Name "AniTestVC - Win32 UnivRelease"
|
||||
# Name "AniTestVC - Win32 UnivDebug"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\anitest.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\anitest.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\anitest.rc
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
29
contrib/samples/animate/AniTestVC.dsw
Normal file
29
contrib/samples/animate/AniTestVC.dsw
Normal file
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 5.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "AniTestVC"=.\AniTestVC.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
24
contrib/samples/animate/Makefile.in
Normal file
24
contrib/samples/animate/Makefile.in
Normal file
@@ -0,0 +1,24 @@
|
||||
#
|
||||
# File: makefile.unx
|
||||
# Author: Julian Smart
|
||||
# Created: 1998
|
||||
# Updated:
|
||||
# Copyright: (c) 1998 Julian Smart
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile for anitest example (UNIX).
|
||||
|
||||
top_srcdir = @top_srcdir@/..
|
||||
top_builddir = ../../..
|
||||
program_dir = contrib/samples/animate
|
||||
|
||||
PROGRAM=anitest
|
||||
|
||||
OBJECTS=$(PROGRAM).o
|
||||
|
||||
APPEXTRALIBS=$(top_builddir)/lib/libwx_anim.@WX_TARGET_LIBRARY_TYPE@
|
||||
APPEXTRADEFS=-I$(top_srcdir)/contrib/include
|
||||
|
||||
include $(top_builddir)/src/makeprog.env
|
||||
|
197
contrib/samples/animate/anitest.cpp
Normal file
197
contrib/samples/animate/anitest.cpp
Normal file
@@ -0,0 +1,197 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: anitest.cpp
|
||||
// Purpose: Animation sample
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 02/07/2001
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ===========================================================================
|
||||
// declarations
|
||||
// ===========================================================================
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// headers
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
|
||||
#if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__)
|
||||
#include "mondrian.xpm"
|
||||
#endif
|
||||
|
||||
#include "anitest.h"
|
||||
|
||||
IMPLEMENT_APP(MyApp)
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// global variables
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// event tables
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_MENU(ANITEST_ABOUT, MyFrame::OnAbout)
|
||||
EVT_MENU(ANITEST_QUIT, MyFrame::OnQuit)
|
||||
EVT_MENU(ANITEST_OPEN, MyFrame::OnOpen)
|
||||
|
||||
EVT_SIZE(MyFrame::OnSize)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
// ===========================================================================
|
||||
// implementation
|
||||
// ===========================================================================
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// MyApp
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// Initialise this in OnInit, not statically
|
||||
bool MyApp::OnInit()
|
||||
{
|
||||
// Create the main frame window
|
||||
|
||||
MyFrame* frame = new MyFrame((wxFrame *)NULL, -1, "Animation Demo",
|
||||
wxPoint(-1, -1), wxSize(500, 400),
|
||||
wxDEFAULT_FRAME_STYLE);
|
||||
|
||||
// Give it an icon
|
||||
#ifdef __WXMSW__
|
||||
frame->SetIcon(wxIcon("mdi_icn"));
|
||||
#else
|
||||
frame->SetIcon(wxIcon( mondrian_xpm ));
|
||||
#endif
|
||||
|
||||
// Make a menubar
|
||||
wxMenu *file_menu = new wxMenu;
|
||||
|
||||
file_menu->Append(ANITEST_OPEN, "&Open Animation...\tCtrl+O", "Open a GIF animation");
|
||||
file_menu->Append(ANITEST_QUIT, "&Exit\tAlt+X", "Quit the program");
|
||||
|
||||
wxMenu *help_menu = new wxMenu;
|
||||
help_menu->Append(ANITEST_ABOUT, "&About\tF1");
|
||||
|
||||
wxMenuBar *menu_bar = new wxMenuBar;
|
||||
|
||||
menu_bar->Append(file_menu, "&File");
|
||||
menu_bar->Append(help_menu, "&Help");
|
||||
|
||||
// Associate the menu bar with the frame
|
||||
frame->SetMenuBar(menu_bar);
|
||||
|
||||
frame->CreateStatusBar();
|
||||
|
||||
frame->Show(TRUE);
|
||||
|
||||
SetTopWindow(frame);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// MyFrame
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// Define my frame constructor
|
||||
MyFrame::MyFrame(wxWindow *parent,
|
||||
const wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
const long style)
|
||||
: wxFrame(parent, id, title, pos, size,
|
||||
style | wxNO_FULL_REPAINT_ON_RESIZE)
|
||||
{
|
||||
// m_animation = NULL;
|
||||
m_canvas = new MyCanvas(this, wxPoint(0, 0), wxSize(-1, -1));
|
||||
#if 0
|
||||
m_player.SetDestroyAnimation(FALSE);
|
||||
m_player.SetWindow(m_canvas);
|
||||
m_player.SetPosition(wxPoint(0, 0));
|
||||
#endif
|
||||
m_animationCtrl = new wxGIFAnimationCtrl(m_canvas, -1, wxEmptyString,
|
||||
wxPoint(0, 0), wxSize(200, 200));
|
||||
}
|
||||
|
||||
MyFrame::~MyFrame()
|
||||
{
|
||||
// m_player.Stop();
|
||||
}
|
||||
|
||||
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
(void)wxMessageBox("wxWindows 2 Animation Demo\n"
|
||||
"Author: Julian Smart (c) 2001\n",
|
||||
"About Animation Demo");
|
||||
}
|
||||
|
||||
void MyFrame::OnOpen(wxCommandEvent& event)
|
||||
{
|
||||
wxFileDialog dialog(this, wxT("Please choose an animated GIF"),
|
||||
wxEmptyString, wxEmptyString, wxT("*.gif"), wxOPEN);
|
||||
if (dialog.ShowModal() == wxID_OK)
|
||||
{
|
||||
wxString filename(dialog.GetPath());
|
||||
|
||||
m_animationCtrl->Stop();
|
||||
if (m_animationCtrl->LoadFile(filename))
|
||||
{
|
||||
m_animationCtrl->Play();
|
||||
}
|
||||
else
|
||||
{
|
||||
wxMessageBox("Sorry, this animation was not a valid animated GIF.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// MyCanvas
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
|
||||
EVT_PAINT(MyCanvas::OnPaint)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
// Define a constructor for my canvas
|
||||
MyCanvas::MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size)
|
||||
: wxScrolledWindow(parent, -1, pos, size,
|
||||
wxSUNKEN_BORDER |
|
||||
wxNO_FULL_REPAINT_ON_RESIZE |
|
||||
wxVSCROLL | wxHSCROLL)
|
||||
{
|
||||
SetBackgroundColour(wxColour("YELLOW"));
|
||||
}
|
||||
|
||||
void MyCanvas::OnPaint(wxPaintEvent& event)
|
||||
{
|
||||
wxPaintDC dc(this);
|
||||
#if 0
|
||||
MyFrame* frame = (MyFrame*) GetParent();
|
||||
if (frame->GetPlayer().IsPlaying())
|
||||
{
|
||||
frame->GetPlayer().Draw(dc);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
71
contrib/samples/animate/anitest.h
Normal file
71
contrib/samples/animate/anitest.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: anitest.cpp
|
||||
// Purpose: anitest sample
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 02/07/2001
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "wx/animate/animate.h"
|
||||
|
||||
// Define a new application
|
||||
class MyApp : public wxApp
|
||||
{
|
||||
public:
|
||||
bool OnInit();
|
||||
};
|
||||
|
||||
class MyCanvas : public wxScrolledWindow
|
||||
{
|
||||
public:
|
||||
MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size);
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
|
||||
private:
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
// Define a new frame
|
||||
class MyFrame : public wxFrame
|
||||
{
|
||||
public:
|
||||
|
||||
MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title,
|
||||
const wxPoint& pos, const wxSize& size, const long style);
|
||||
~MyFrame();
|
||||
|
||||
void OnAbout(wxCommandEvent& event);
|
||||
void OnQuit(wxCommandEvent& event);
|
||||
|
||||
void OnOpen(wxCommandEvent& event);
|
||||
|
||||
MyCanvas* GetCanvas() const { return m_canvas; }
|
||||
wxGIFAnimationCtrl* GetAnimationCtrl() const { return m_animationCtrl; }
|
||||
|
||||
#if 0
|
||||
wxAnimationPlayer& GetPlayer() { return m_player; }
|
||||
wxAnimationBase& GetAnimation() { return m_animation; }
|
||||
#endif
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
protected:
|
||||
MyCanvas* m_canvas;
|
||||
wxGIFAnimationCtrl* m_animationCtrl;
|
||||
#if 0
|
||||
wxAnimationPlayer m_player;
|
||||
wxGIFAnimation m_animation;
|
||||
#endif
|
||||
};
|
||||
|
||||
// menu items ids
|
||||
enum
|
||||
{
|
||||
ANITEST_QUIT = 100,
|
||||
ANITEST_OPEN,
|
||||
ANITEST_ABOUT
|
||||
};
|
BIN
contrib/samples/animate/bttrfly.gif
Normal file
BIN
contrib/samples/animate/bttrfly.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.1 KiB |
BIN
contrib/samples/animate/hooked.gif
Normal file
BIN
contrib/samples/animate/hooked.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
BIN
contrib/samples/animate/make_cw.mcp
Normal file
BIN
contrib/samples/animate/make_cw.mcp
Normal file
Binary file not shown.
17
contrib/samples/animate/makefile.b32
Normal file
17
contrib/samples/animate/makefile.b32
Normal file
@@ -0,0 +1,17 @@
|
||||
#
|
||||
# File: makefile.b32
|
||||
# Author: Julian Smart
|
||||
# Created: 1999
|
||||
# Updated:
|
||||
# Copyright:
|
||||
#
|
||||
# Makefile : Builds sample for 32-bit BC++
|
||||
|
||||
WXDIR = $(WXWIN)
|
||||
|
||||
TARGET=anitest
|
||||
EXTRALIBS=$(WXDIR)\lib\anim.lib
|
||||
OBJECTS = $(TARGET).obj
|
||||
|
||||
!include $(WXDIR)\src\makeprog.b32
|
||||
|
19
contrib/samples/animate/makefile.g95
Normal file
19
contrib/samples/animate/makefile.g95
Normal file
@@ -0,0 +1,19 @@
|
||||
#
|
||||
# File: makefile.g95
|
||||
# Author: Julian Smart
|
||||
# Created: 1999
|
||||
# Updated:
|
||||
# Copyright: (c) Julian Smart, 1999
|
||||
#
|
||||
# Makefile for wxWindows sample (Cygwin/Mingw32).
|
||||
|
||||
WXDIR = ../../..
|
||||
|
||||
TARGET=anitest
|
||||
OBJECTS = $(TARGET).o
|
||||
EXTRAINC = -I$(WXDIR)/contrib/include
|
||||
RCEXTRAINC = --include-dir $(WXDIR)/contrib/include
|
||||
EXTRALIBS = -lanim
|
||||
|
||||
include $(WXDIR)/src/makeprog.g95
|
||||
|
36
contrib/samples/animate/makefile.sc
Normal file
36
contrib/samples/animate/makefile.sc
Normal file
@@ -0,0 +1,36 @@
|
||||
# Symantec C++ makefile
|
||||
|
||||
WXDIR = $(WXWIN)
|
||||
WXLIB = $(WXDIR)\lib\wx.lib
|
||||
INCDIR = $(WXDIR)\include
|
||||
INCLUDE=$(INCDIR)
|
||||
TARGET=minimal
|
||||
|
||||
include $(WXDIR)\src\makesc.env
|
||||
|
||||
minimal.exe: minimal.obj $(DEFFILE) minimal.res
|
||||
*$(CC) $(LDFLAGS) -o$@ $** $(LIBS)
|
||||
*$(RC) -k minimal.res
|
||||
|
||||
sc32.def:
|
||||
echo EXETYPE NT > sc32.def
|
||||
echo SUBSYSTEM WINDOWS >> sc32.def
|
||||
|
||||
sc16.def:
|
||||
echo NAME $(TARGET) > sc16.def
|
||||
echo EXETYPE WINDOWS >> sc16.def
|
||||
echo STUB 'WINSTUB.EXE' >> sc16.def
|
||||
echo CODE PRELOAD MOVEABLE DISCARDABLE >> sc16.def
|
||||
echo DATA PRELOAD MOVEABLE MULTIPLE >> sc16.def
|
||||
echo HEAPSIZE 1024 >> sc16.def
|
||||
echo STACKSIZE 8192 >> sc16.def
|
||||
|
||||
clean:
|
||||
-del *.obj
|
||||
-del *.exe
|
||||
-del *.res
|
||||
-del *.map
|
||||
-del *.rws
|
||||
-del sc32.def
|
||||
-del sc16.def
|
||||
|
35
contrib/samples/animate/makefile.unx
Normal file
35
contrib/samples/animate/makefile.unx
Normal file
@@ -0,0 +1,35 @@
|
||||
#
|
||||
# File: Makefile for samples
|
||||
# Author: Robert Roebling
|
||||
# Created: 1999
|
||||
# Updated:
|
||||
# Copyright: (c) 1998 Robert Roebling
|
||||
#
|
||||
# This makefile requires a Unix version of wxWindows
|
||||
# to be installed on your system. This is most often
|
||||
# done typing "make install" when using the complete
|
||||
# sources of wxWindows or by installing the two
|
||||
# RPM packages wxGTK.XXX.rpm and wxGTK-devel.XXX.rpm
|
||||
# under Linux.
|
||||
#
|
||||
|
||||
CC = gcc
|
||||
|
||||
PROGRAM = anitest
|
||||
|
||||
OBJECTS = $(PROGRAM).o animate.o
|
||||
|
||||
# implementation
|
||||
|
||||
.SUFFIXES: .o .cpp
|
||||
|
||||
.cpp.o :
|
||||
$(CC) -c `wx-config --cflags` -o $@ $<
|
||||
|
||||
all: $(PROGRAM)
|
||||
|
||||
$(PROGRAM): $(OBJECTS)
|
||||
$(CC) -o $(PROGRAM) $(OBJECTS) `wx-config --libs`
|
||||
|
||||
clean:
|
||||
rm -f *.o $(PROGRAM)
|
44
contrib/samples/animate/makefile.va
Normal file
44
contrib/samples/animate/makefile.va
Normal file
@@ -0,0 +1,44 @@
|
||||
#
|
||||
# File: makefile.va
|
||||
# Author: David Webster
|
||||
# Created: 1999
|
||||
# Updated:
|
||||
# Copyright: (c) David Webster
|
||||
#
|
||||
# Makefile : Builds sample (VisualAgeC++ V3.0, OS/2 PM)
|
||||
# Use FINAL=1 argument to nmake to build final version with no debug info.
|
||||
|
||||
# Set WXDIR for your system
|
||||
WXDIR=$(WXWIN)
|
||||
|
||||
!include $(WXDIR)\src\makeva.env
|
||||
|
||||
#
|
||||
# Define which program this is and what it's path is and where to output to
|
||||
#
|
||||
PROGRAM=anitest
|
||||
THISDIR=$(WXWIN)\samples\$(PROGRAM)
|
||||
OPATH=$(THISDIR)\$D
|
||||
|
||||
#
|
||||
# Make sure output directory is available
|
||||
#
|
||||
!if [md $(OPATH)]
|
||||
!endif
|
||||
|
||||
#
|
||||
# Standard definitions
|
||||
#
|
||||
PROGRC=$(THISDIR)\$(PROGRAM).rcO
|
||||
OBJECTS=$(OPATH)\$(PROGRAM).obj $(OPATH)\animate.obj
|
||||
PROGRES=$(OPATH)\$(PROGRAM).res
|
||||
PROGTARGET=$(OPATH)\$(PROGRAM).exe
|
||||
|
||||
.cpp{$OPATH}.obj:
|
||||
@echo $<
|
||||
icc @<<
|
||||
$(CPPFLAGS) /Fo$@ /Tp $<
|
||||
<<
|
||||
|
||||
!include $(WXDIR)\src\makeprog.va
|
||||
|
9
contrib/samples/animate/makefile.vc
Normal file
9
contrib/samples/animate/makefile.vc
Normal file
@@ -0,0 +1,9 @@
|
||||
WXDIR = $(WXWIN)
|
||||
PROGRAM = anitest
|
||||
|
||||
OBJECTS = $(PROGRAM).obj
|
||||
EXTRALIBS = $(WXDIR)\lib\anim$(LIBEXT).lib
|
||||
EXTRAINC = -I$(WXDIR)\contrib\include
|
||||
|
||||
!include $(WXDIR)\src\makeprog.vc
|
||||
|
15
contrib/samples/animate/makefile.wat
Normal file
15
contrib/samples/animate/makefile.wat
Normal file
@@ -0,0 +1,15 @@
|
||||
#
|
||||
# Makefile for WATCOM
|
||||
#
|
||||
# Created by Julian Smart, January 1999
|
||||
#
|
||||
#
|
||||
|
||||
WXDIR = $(%WXWIN)
|
||||
|
||||
PROGRAM = anitest
|
||||
OBJECTS = $(PROGRAM).obj animate.obj
|
||||
|
||||
!include $(WXDIR)\src\makeprog.wat
|
||||
|
||||
|
BIN
contrib/samples/animate/makemac.mcp
Normal file
BIN
contrib/samples/animate/makemac.mcp
Normal file
Binary file not shown.
BIN
contrib/samples/animate/makemac6.mcp
Normal file
BIN
contrib/samples/animate/makemac6.mcp
Normal file
Binary file not shown.
BIN
contrib/samples/animate/mondrian.ico
Normal file
BIN
contrib/samples/animate/mondrian.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 766 B |
BIN
contrib/samples/animate/tbttrfly.gif
Normal file
BIN
contrib/samples/animate/tbttrfly.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.1 KiB |
@@ -9,7 +9,7 @@ PROGRAM=plot
|
||||
|
||||
OBJECTS=plot.o
|
||||
|
||||
APPEXTRALIBS=$(top_builddir)/lib/libplot.@WX_TARGET_LIBRARY_TYPE@
|
||||
APPEXTRALIBS=$(top_builddir)/lib/libwx_plot.@WX_TARGET_LIBRARY_TYPE@
|
||||
APPEXTRADEFS=-I$(top_srcdir)/contrib/include
|
||||
|
||||
include $(top_builddir)/src/makeprog.env
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# $Id$
|
||||
|
||||
CONTRIB_SUBDIRS=ogl mmedia stc xrc applet
|
||||
CONTRIB_SUBDIRS=ogl mmedia stc xrc applet plot canvas animate
|
||||
|
||||
all:
|
||||
@for d in $(CONTRIB_SUBDIRS); do (cd $$d && $(MAKE)); done
|
||||
|
98
contrib/src/animate/AnimateVC.dsp
Normal file
98
contrib/src/animate/AnimateVC.dsp
Normal file
@@ -0,0 +1,98 @@
|
||||
# Microsoft Developer Studio Project File - Name="AnimateVC" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=AnimateVC - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "AnimateVC.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "AnimateVC.mak" CFG="AnimateVC - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "AnimateVC - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "AnimateVC - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "AnimateVC - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../../include" /I "../../include" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE RSC /l 0x809
|
||||
# ADD RSC /l 0x809
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"..\..\..\lib\anim.lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "AnimateVC - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MDd /W3 /GX /Z7 /Od /I "../../../include" /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE RSC /l 0x809
|
||||
# ADD RSC /l 0x809
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"..\..\..\lib\animd.lib"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "AnimateVC - Win32 Release"
|
||||
# Name "AnimateVC - Win32 Debug"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\animate.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\wx\animate\animate.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\readme.txt
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
29
contrib/src/animate/AnimateVC.dsw
Normal file
29
contrib/src/animate/AnimateVC.dsw
Normal file
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "AnimateVC"=.\AnimateVC.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
23
contrib/src/animate/Makefile.in
Normal file
23
contrib/src/animate/Makefile.in
Normal file
@@ -0,0 +1,23 @@
|
||||
# $Id$
|
||||
|
||||
top_srcdir = @top_srcdir@/..
|
||||
top_builddir = ../../..
|
||||
libsrc_dir = contrib/src/animate
|
||||
|
||||
TARGET_LIBNAME=libwx_anim
|
||||
|
||||
LIBVERSION_CURRENT=1
|
||||
LIBVERSION_REVISION=0
|
||||
LIBVERSION_AGE=0
|
||||
|
||||
HEADER_PATH=$(top_srcdir)/contrib/include/wx
|
||||
HEADER_SUBDIR=plot
|
||||
|
||||
HEADERS=animate.h
|
||||
|
||||
OBJECTS=animate.o
|
||||
|
||||
APPEXTRADEFS=-I$(top_srcdir)/contrib/include
|
||||
|
||||
include $(top_builddir)/src/makelib.env
|
||||
|
666
contrib/src/animate/animate.cpp
Normal file
666
contrib/src/animate/animate.cpp
Normal file
@@ -0,0 +1,666 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: animate.cpp
|
||||
// Purpose: Implementation of wxAnimation classes
|
||||
// Author: Julian Smart and Guillermo Rodriguez Garcia
|
||||
// Modified by:
|
||||
// Created: 13/8/99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart and Guillermo Rodriguez Garcia
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "animate.h"
|
||||
#endif
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif //__BORLANDC__
|
||||
|
||||
#include "wx/wfstream.h"
|
||||
#include "wx/image.h"
|
||||
#include "wx/gifdecod.h"
|
||||
#include "wx/animate/animate.h"
|
||||
|
||||
/*
|
||||
* wxAnimationPlayer
|
||||
*/
|
||||
|
||||
IMPLEMENT_CLASS(wxAnimationPlayer, wxObject)
|
||||
|
||||
wxAnimationPlayer::wxAnimationPlayer(wxAnimationBase *animation, bool destroyAnimation)
|
||||
{
|
||||
m_animation = animation;
|
||||
m_destroyAnimation = destroyAnimation;
|
||||
m_currentFrame = 0;
|
||||
m_window = (wxWindow*) NULL;
|
||||
m_position = wxPoint(0, 0);
|
||||
m_looped = TRUE;
|
||||
m_isPlaying = FALSE;
|
||||
m_useBackgroundColour = FALSE;
|
||||
m_customBackgroundColour = wxColour(0, 0, 0);
|
||||
m_useCustomBackgroundColour = FALSE;
|
||||
m_useParentBackground = FALSE;
|
||||
m_timer.SetPlayer(this);
|
||||
}
|
||||
|
||||
wxAnimationPlayer::~wxAnimationPlayer()
|
||||
{
|
||||
Stop();
|
||||
ClearCache();
|
||||
|
||||
if (m_destroyAnimation)
|
||||
delete m_animation;
|
||||
}
|
||||
|
||||
void wxAnimationPlayer::SetAnimation(wxAnimationBase* animation, bool destroyAnimation)
|
||||
{
|
||||
ClearCache();
|
||||
if (m_destroyAnimation)
|
||||
delete m_animation;
|
||||
m_animation = animation;
|
||||
m_destroyAnimation = destroyAnimation;
|
||||
}
|
||||
|
||||
// Play
|
||||
bool wxAnimationPlayer::Play(wxWindow& window, const wxPoint& pos, bool looped)
|
||||
{
|
||||
m_window = & window;
|
||||
|
||||
if (!m_animation || !m_animation->IsValid())
|
||||
return FALSE;
|
||||
|
||||
wxSize sz = GetLogicalScreenSize();
|
||||
wxRect rect(pos, sz);
|
||||
SaveBackground(rect);
|
||||
|
||||
if (m_frames.Number() == 0)
|
||||
{
|
||||
if (!Build())
|
||||
{
|
||||
wxLogWarning("wxAnimationPlayer::Play: could not build the image cache.");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
m_currentFrame = 0;
|
||||
|
||||
// Create the backing store
|
||||
m_backingStore.Create(sz.x, sz.y);
|
||||
|
||||
PlayFrame();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Build animation (list of wxImages). If not called before Play
|
||||
// is called, Play will call this automatically.
|
||||
bool wxAnimationPlayer::Build()
|
||||
{
|
||||
ClearCache();
|
||||
if (m_animation)
|
||||
{
|
||||
int n = GetFrameCount();
|
||||
int i;
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
wxBitmap* bitmap = NULL;
|
||||
wxImage* image = GetFrame(i);
|
||||
if (image)
|
||||
{
|
||||
// If the frame has transparency,
|
||||
// set the colour so converting to a bitmap
|
||||
// will create a mask
|
||||
wxColour transparentColour;
|
||||
if (GetTransparentColour(transparentColour))
|
||||
image->SetMaskColour(transparentColour.Red(), transparentColour.Green(), transparentColour.Blue());
|
||||
|
||||
bitmap = new wxBitmap(image->ConvertToBitmap());
|
||||
delete image;
|
||||
if (bitmap)
|
||||
m_frames.Append(bitmap);
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Stop the animation
|
||||
void wxAnimationPlayer::Stop()
|
||||
{
|
||||
m_timer.Stop();
|
||||
m_isPlaying = FALSE;
|
||||
}
|
||||
|
||||
// Draw the current view of the animation into this DC.
|
||||
// Call this from your OnPaint, for example.
|
||||
void wxAnimationPlayer::Draw(wxDC& dc)
|
||||
{
|
||||
dc.DrawBitmap(m_backingStore, m_position.x, m_position.y);
|
||||
}
|
||||
|
||||
|
||||
int wxAnimationPlayer::GetFrameCount() const
|
||||
{
|
||||
if (m_animation)
|
||||
return m_animation->GetFrameCount();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
wxImage* wxAnimationPlayer::GetFrame(int i) const
|
||||
{
|
||||
if (m_animation)
|
||||
return m_animation->GetFrame(i);
|
||||
else
|
||||
return (wxImage*) NULL;
|
||||
}
|
||||
|
||||
wxAnimationDisposal wxAnimationPlayer::GetDisposalMethod(int i) const
|
||||
{
|
||||
if (m_animation)
|
||||
return m_animation->GetDisposalMethod(i);
|
||||
else
|
||||
return wxANIM_UNSPECIFIED;
|
||||
}
|
||||
|
||||
wxRect wxAnimationPlayer::GetFrameRect(int i) const
|
||||
{
|
||||
if (m_animation)
|
||||
return m_animation->GetFrameRect(i);
|
||||
else
|
||||
return wxRect(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
int wxAnimationPlayer::GetDelay(int i) const
|
||||
{
|
||||
if (m_animation)
|
||||
return m_animation->GetDelay(i);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
wxSize wxAnimationPlayer::GetLogicalScreenSize() const
|
||||
{
|
||||
if (m_animation)
|
||||
return m_animation->GetLogicalScreenSize();
|
||||
else
|
||||
return wxSize(0, 0);
|
||||
}
|
||||
|
||||
bool wxAnimationPlayer::GetBackgroundColour(wxColour& col) const
|
||||
{
|
||||
if (m_animation)
|
||||
return m_animation->GetBackgroundColour(col);
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxAnimationPlayer::GetTransparentColour(wxColour& col) const
|
||||
{
|
||||
if (m_animation)
|
||||
return m_animation->GetTransparentColour(col);
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Play the frame
|
||||
bool wxAnimationPlayer::PlayFrame(int frame, wxWindow& window, wxPoint& pos)
|
||||
{
|
||||
wxMemoryDC dc;
|
||||
dc.SelectObject(m_backingStore);
|
||||
|
||||
// Draw the background: colour or area beneath animation
|
||||
wxColour col(255, 255, 255);
|
||||
|
||||
if (UsingBackgroundColour())
|
||||
{
|
||||
if (UsingCustomBackgroundColour())
|
||||
col = GetCustomBackgroundColour();
|
||||
else
|
||||
{
|
||||
GetBackgroundColour(col);
|
||||
}
|
||||
|
||||
// Draw the background colour loaded from the animation
|
||||
// (or set by the user)
|
||||
DrawBackground(dc, wxPoint(0, 0), col);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Draw background we saved
|
||||
dc.DrawBitmap(m_savedBackground, 0, 0);
|
||||
}
|
||||
|
||||
// Draw all intermediate frames that haven't been removed from the
|
||||
// animation
|
||||
int i;
|
||||
for (i = 0; i < (frame - 1); i++)
|
||||
{
|
||||
if ((GetDisposalMethod(i) == wxANIM_DONOTREMOVE) || (GetDisposalMethod(i) == wxANIM_UNSPECIFIED))
|
||||
{
|
||||
DrawFrame(i, dc, wxPoint(0, 0));
|
||||
}
|
||||
}
|
||||
DrawFrame(frame, dc, wxPoint(0, 0));
|
||||
|
||||
dc.SelectObject(wxNullBitmap);
|
||||
|
||||
// Draw from backing bitmap onto window
|
||||
wxClientDC clientDC(& window);
|
||||
Draw(clientDC);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxAnimationPlayer::PlayFrame()
|
||||
{
|
||||
m_isPlaying = TRUE;
|
||||
|
||||
PlayFrame(GetCurrentFrame(), * GetWindow(), GetPosition());
|
||||
|
||||
// Set the timer for the next frame
|
||||
m_timer.Start(GetDelay(GetCurrentFrame()));
|
||||
|
||||
m_currentFrame ++;
|
||||
|
||||
if (m_currentFrame == GetFrameCount())
|
||||
{
|
||||
// Should a non-looped animation display the last frame?
|
||||
if (!m_looped)
|
||||
{
|
||||
m_timer.Stop();
|
||||
m_isPlaying = FALSE;
|
||||
}
|
||||
else
|
||||
m_currentFrame = 0;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Clear the wxImage cache
|
||||
void wxAnimationPlayer::ClearCache()
|
||||
{
|
||||
wxNode* node = m_frames.First();
|
||||
while (node)
|
||||
{
|
||||
wxNode* next = node->Next();
|
||||
wxBitmap* bitmap = (wxBitmap*) node->Data();
|
||||
delete bitmap;
|
||||
delete node;
|
||||
node = next;
|
||||
}
|
||||
}
|
||||
|
||||
// Draw the background colour
|
||||
void wxAnimationPlayer::DrawBackground(wxDC& dc, const wxPoint& pos, const wxColour& colour)
|
||||
{
|
||||
wxASSERT_MSG( (m_animation != NULL), "Animation not present in wxAnimationPlayer");
|
||||
wxASSERT_MSG( (m_frames.Number() != 0), "Animation cache not present in wxAnimationPlayer");
|
||||
|
||||
// Optimization: if the first frame fills the whole area, and is non-transparent,
|
||||
// don't bother drawing the background
|
||||
|
||||
wxBitmap* firstBitmap = (wxBitmap*) m_frames.First()->Data() ;
|
||||
wxSize screenSize = GetLogicalScreenSize();
|
||||
if (!firstBitmap->GetMask() && (firstBitmap->GetWidth() == screenSize.x) && (firstBitmap->GetHeight() == screenSize.y))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
wxBrush brush(colour, wxSOLID);
|
||||
wxPen pen(colour, 1, wxSOLID);
|
||||
dc.SetBrush(brush);
|
||||
dc.SetPen(pen);
|
||||
dc.SetLogicalFunction(wxCOPY);
|
||||
|
||||
dc.DrawRectangle(pos.x, pos.y, screenSize.x, screenSize.y);
|
||||
}
|
||||
|
||||
// Save the pertinent area of the window so we can restore
|
||||
// it if drawing transparently
|
||||
void wxAnimationPlayer::SaveBackground(const wxRect& rect)
|
||||
{
|
||||
wxASSERT( GetWindow() );
|
||||
|
||||
if (!GetWindow())
|
||||
return;
|
||||
|
||||
m_savedBackground.Create(rect.width, rect.height);
|
||||
|
||||
wxMemoryDC memDC;
|
||||
memDC.SelectObject(m_savedBackground);
|
||||
|
||||
if (m_useParentBackground && GetWindow()->GetParent())
|
||||
{
|
||||
wxWindow* parent = GetWindow()->GetParent();
|
||||
wxClientDC dc(parent);
|
||||
|
||||
// Translate the point to coordinates in the
|
||||
// parent's client area, going via screen coordinates
|
||||
wxPoint pt(rect.x, rect.y);
|
||||
wxPoint screenPt = GetWindow()->ClientToScreen(pt);
|
||||
wxPoint parentPt = parent->ScreenToClient(screenPt);
|
||||
|
||||
memDC.Blit(0, 0, rect.width, rect.height, & dc, parentPt.x, parentPt.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
wxClientDC dc(GetWindow());
|
||||
|
||||
memDC.Blit(0, 0, rect.width, rect.height, & dc, rect.x, rect.y);
|
||||
}
|
||||
memDC.SelectObject(wxNullBitmap);
|
||||
}
|
||||
|
||||
// Draw this frame
|
||||
void wxAnimationPlayer::DrawFrame(int frame, wxDC& dc, const wxPoint& pos)
|
||||
{
|
||||
wxASSERT_MSG( (m_animation != NULL), "Animation not present in wxAnimationPlayer");
|
||||
wxASSERT_MSG( (m_frames.Number() != 0), "Animation cache not present in wxAnimationPlayer");
|
||||
wxASSERT_MSG( (m_frames.Nth(frame) != (wxNode*) NULL), "Image not present in wxAnimationPlayer::DrawFrame");
|
||||
|
||||
wxBitmap* bitmap = (wxBitmap*) m_frames.Nth(frame)->Data() ;
|
||||
|
||||
wxRect rect = GetFrameRect(frame);
|
||||
|
||||
dc.DrawBitmap(* bitmap, pos.x + rect.x, pos.y + rect.y, (bitmap->GetMask() != NULL));
|
||||
}
|
||||
|
||||
void wxAnimationTimer::Notify()
|
||||
{
|
||||
m_player->PlayFrame();
|
||||
}
|
||||
|
||||
/*
|
||||
* wxAnimationBase
|
||||
*/
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxAnimationBase, wxObject)
|
||||
|
||||
/*
|
||||
* wxGIFAnimation
|
||||
*/
|
||||
|
||||
IMPLEMENT_CLASS(wxGIFAnimation, wxAnimationBase)
|
||||
|
||||
wxGIFAnimation::wxGIFAnimation()
|
||||
{
|
||||
m_decoder = (wxGIFDecoder*) NULL;
|
||||
}
|
||||
|
||||
wxGIFAnimation::~wxGIFAnimation()
|
||||
{
|
||||
delete m_decoder;
|
||||
}
|
||||
|
||||
int wxGIFAnimation::GetFrameCount() const
|
||||
{
|
||||
wxASSERT_MSG( (m_decoder != (wxGIFDecoder*) NULL), "m_decoder must be non-NULL");
|
||||
|
||||
return m_decoder->GetNumberOfFrames();
|
||||
}
|
||||
|
||||
wxImage* wxGIFAnimation::GetFrame(int i) const
|
||||
{
|
||||
wxASSERT_MSG( (m_decoder != (wxGIFDecoder*) NULL), "m_decoder must be non-NULL");
|
||||
|
||||
m_decoder->GoFrame(i);
|
||||
|
||||
wxImage* image = new wxImage;
|
||||
m_decoder->ConvertToImage(image);
|
||||
return image;
|
||||
}
|
||||
|
||||
wxAnimationDisposal wxGIFAnimation::GetDisposalMethod(int i) const
|
||||
{
|
||||
wxASSERT_MSG( (m_decoder != (wxGIFDecoder*) NULL), "m_decoder must be non-NULL");
|
||||
|
||||
m_decoder->GoFrame(i);
|
||||
|
||||
int disposalMethod = m_decoder->GetDisposalMethod();
|
||||
return (wxAnimationDisposal) disposalMethod;
|
||||
}
|
||||
|
||||
wxRect wxGIFAnimation::GetFrameRect(int i) const
|
||||
{
|
||||
wxASSERT_MSG( (m_decoder != (wxGIFDecoder*) NULL), "m_decoder must be non-NULL");
|
||||
|
||||
m_decoder->GoFrame(i);
|
||||
|
||||
wxRect rect(m_decoder->GetLeft(), m_decoder->GetTop(), m_decoder->GetWidth(), m_decoder->GetHeight());
|
||||
return rect;
|
||||
}
|
||||
|
||||
int wxGIFAnimation::GetDelay(int i) const
|
||||
{
|
||||
wxASSERT_MSG( (m_decoder != (wxGIFDecoder*) NULL), "m_decoder must be non-NULL");
|
||||
|
||||
m_decoder->GoFrame(i);
|
||||
return m_decoder->GetDelay();
|
||||
}
|
||||
|
||||
wxSize wxGIFAnimation::GetLogicalScreenSize() const
|
||||
{
|
||||
wxASSERT_MSG( (m_decoder != (wxGIFDecoder*) NULL), "m_decoder must be non-NULL");
|
||||
|
||||
return wxSize(m_decoder->GetLogicalScreenWidth(), m_decoder->GetLogicalScreenHeight());
|
||||
}
|
||||
|
||||
bool wxGIFAnimation::GetBackgroundColour(wxColour& col) const
|
||||
{
|
||||
wxASSERT_MSG( (m_decoder != (wxGIFDecoder*) NULL), "m_decoder must be non-NULL");
|
||||
|
||||
int i = m_decoder->GetBackgroundColour();
|
||||
if (i == -1)
|
||||
return FALSE;
|
||||
else
|
||||
{
|
||||
unsigned char* pal = m_decoder->GetPalette();
|
||||
|
||||
if (pal)
|
||||
{
|
||||
col = wxColour(pal[3*i + 0], pal[3*i + 1], pal[3*i + 2]);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
bool wxGIFAnimation::GetTransparentColour(wxColour& col) const
|
||||
{
|
||||
wxASSERT_MSG( (m_decoder != (wxGIFDecoder*) NULL), "m_decoder must be non-NULL");
|
||||
|
||||
int i = m_decoder->GetTransparentColour();
|
||||
if (i == -1)
|
||||
return FALSE;
|
||||
else
|
||||
{
|
||||
unsigned char* pal = m_decoder->GetPalette();
|
||||
|
||||
if (pal)
|
||||
{
|
||||
col = wxColour(pal[3*i + 0], pal[3*i + 1], pal[3*i + 2]);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
bool wxGIFAnimation::IsValid() const
|
||||
{
|
||||
return ((m_decoder != NULL) && (m_decoder->IsAnimation()));
|
||||
}
|
||||
|
||||
bool wxGIFAnimation::LoadFile(const wxString& filename)
|
||||
{
|
||||
if (m_decoder)
|
||||
delete m_decoder;
|
||||
m_decoder = NULL;
|
||||
|
||||
if (wxFileExists(filename))
|
||||
{
|
||||
wxFileInputStream stream(filename);
|
||||
m_decoder = new wxGIFDecoder(& stream, TRUE);
|
||||
|
||||
if (m_decoder->ReadGIF() != wxGIF_OK)
|
||||
{
|
||||
delete m_decoder;
|
||||
m_decoder = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!m_decoder->IsAnimation())
|
||||
{
|
||||
delete m_decoder;
|
||||
m_decoder = NULL;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* wxAnimationCtrlBase
|
||||
* Abstract base class for format-specific animation controls.
|
||||
* This class implements most of the functionality; all a derived
|
||||
* class has to do is create the appropriate animation class on demand.
|
||||
*/
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxAnimationCtrlBase, wxControl)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxAnimationCtrlBase, wxControl)
|
||||
EVT_PAINT(wxAnimationCtrlBase::OnPaint)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
bool wxAnimationCtrlBase::Create(wxWindow *parent, wxWindowID id,
|
||||
const wxString& filename, const wxPoint& pos,
|
||||
const wxSize& size, long style, const wxString& name)
|
||||
{
|
||||
m_animation = NULL;
|
||||
m_filename = filename;
|
||||
|
||||
if (!wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name))
|
||||
return FALSE;
|
||||
|
||||
SetBackgroundColour(parent->GetBackgroundColour());
|
||||
|
||||
m_animationPlayer.SetCustomBackgroundColour(GetBackgroundColour());
|
||||
|
||||
// Want to give the impression of transparency by painting
|
||||
// the parent background
|
||||
// if (parent)
|
||||
// m_animationPlayer.UseParentBackground(TRUE);
|
||||
m_animationPlayer.SetWindow(this);
|
||||
m_animationPlayer.SetPosition(wxPoint(0, 0));
|
||||
m_animationPlayer.SetDestroyAnimation(FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
wxAnimationCtrlBase::~wxAnimationCtrlBase()
|
||||
{
|
||||
if (m_animationPlayer.IsPlaying())
|
||||
m_animationPlayer.Stop();
|
||||
m_animationPlayer.SetAnimation(NULL, FALSE);
|
||||
delete m_animation;
|
||||
}
|
||||
|
||||
bool wxAnimationCtrlBase::LoadFile(const wxString& filename)
|
||||
{
|
||||
if (m_animationPlayer.IsPlaying())
|
||||
m_animationPlayer.Stop();
|
||||
|
||||
wxString filename1(filename);
|
||||
|
||||
if (filename1.IsEmpty())
|
||||
filename1 = m_filename;
|
||||
|
||||
if (filename1.IsEmpty())
|
||||
return FALSE;
|
||||
|
||||
if (m_animation)
|
||||
{
|
||||
delete m_animation;
|
||||
m_animation = NULL;
|
||||
}
|
||||
|
||||
m_animation = DoCreateAnimation(filename1);
|
||||
if (!m_animation)
|
||||
return FALSE;
|
||||
|
||||
if (!m_animation->LoadFile(filename) || !m_animation->IsValid())
|
||||
{
|
||||
delete m_animation;
|
||||
m_animation = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
m_animationPlayer.SetAnimation(m_animation, FALSE);
|
||||
|
||||
if (GetWindowStyle() & wxAN_FIT_ANIMATION)
|
||||
FitToAnimation();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxAnimationCtrlBase::Play(bool looped)
|
||||
{
|
||||
return m_animationPlayer.Play(*this, wxPoint(0, 0), looped);
|
||||
}
|
||||
|
||||
wxSize wxAnimationCtrlBase::DoGetBestSize() const
|
||||
{
|
||||
if (m_animationPlayer.HasAnimation() && (GetWindowStyle() & wxAN_FIT_ANIMATION))
|
||||
{
|
||||
return m_animationPlayer.GetLogicalScreenSize();
|
||||
}
|
||||
else
|
||||
{
|
||||
return GetSize();
|
||||
}
|
||||
}
|
||||
|
||||
void wxAnimationCtrlBase::FitToAnimation()
|
||||
{
|
||||
if (!m_animationPlayer.HasAnimation())
|
||||
return;
|
||||
|
||||
wxSize sz = m_animationPlayer.GetLogicalScreenSize();
|
||||
SetClientSize(sz);
|
||||
}
|
||||
|
||||
void wxAnimationCtrlBase::OnPaint(wxPaintEvent& event)
|
||||
{
|
||||
wxPaintDC dc(this);
|
||||
|
||||
if (GetPlayer().IsPlaying())
|
||||
{
|
||||
GetPlayer().Draw(dc);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* wxGIFAnimationCtrl
|
||||
* Provides a GIF animation class when required.
|
||||
*/
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxGIFAnimationCtrl, wxAnimationCtrlBase)
|
||||
|
||||
wxAnimationBase* wxGIFAnimationCtrl::DoCreateAnimation(const wxString& WXUNUSED(filename))
|
||||
{
|
||||
return new wxGIFAnimation;
|
||||
}
|
17
contrib/src/animate/makefile.b32
Normal file
17
contrib/src/animate/makefile.b32
Normal file
@@ -0,0 +1,17 @@
|
||||
#
|
||||
# File: makefile.b32
|
||||
# Author: Julian Smart
|
||||
# Created: 1999
|
||||
# Updated:
|
||||
# Copyright:
|
||||
#
|
||||
# Makefile : Builds Animation library for 32-bit BC++
|
||||
|
||||
WXDIR = $(WXWIN)
|
||||
|
||||
LIBTARGET=$(WXDIR)\lib\anim.lib
|
||||
|
||||
OBJECTS = animate.obj
|
||||
|
||||
!include $(WXDIR)\src\makelib.b32
|
||||
|
16
contrib/src/animate/makefile.g95
Normal file
16
contrib/src/animate/makefile.g95
Normal file
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# File: makefile.g95
|
||||
# Author: Julian Smart
|
||||
# Created: 1999
|
||||
# Updated:
|
||||
# Copyright: (c) Julian Smart, 1999
|
||||
#
|
||||
# Makefile for wxWindows Animation library Cygwin/Mingw32).
|
||||
|
||||
WXDIR = ../../..
|
||||
|
||||
LIBTARGET=$(WXDIR)/lib/libanim.a
|
||||
OBJECTS = animate.o
|
||||
|
||||
include $(WXDIR)/src/makelib.g95
|
||||
|
144
contrib/src/animate/makefile.vc
Normal file
144
contrib/src/animate/makefile.vc
Normal file
@@ -0,0 +1,144 @@
|
||||
|
||||
# File: makefile.vc
|
||||
# Author: Julian Smart
|
||||
# Created: 2001
|
||||
# Updated:
|
||||
# Copyright: (c) 2001, Julian Smart
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile : Builds Plot class library (MS VC++).
|
||||
# Use FINAL=1 argument to nmake to build final version with no debugging
|
||||
# info
|
||||
|
||||
|
||||
# Set WXDIR for your system
|
||||
WXDIR = $(WXWIN)
|
||||
GIZMOSDIR = $(WXDIR)\contrib\src\animate
|
||||
GIZMOSINC = $(WXDIR)\contrib\include\wx\animate
|
||||
THISDIR = $(WXDIR)\contrib\src\animate
|
||||
DOCDIR=$(WXDIR)\contrib\docs
|
||||
LOCALDOCDIR=$(WXDIR)\contrib\docs\latex\animate
|
||||
|
||||
!include $(WXDIR)\src\makevc.env
|
||||
|
||||
OBJECTS = $(D)\animate.obj
|
||||
|
||||
LIBTARGET=$(WXDIR)\lib\anim$(LIBEXT).lib
|
||||
|
||||
all: $(D) $(LIBTARGET)
|
||||
|
||||
$(D) :
|
||||
mkdir $(D)
|
||||
|
||||
wx:
|
||||
cd $(WXDIR)\src\msw
|
||||
nmake -f makefile.vc FINAL=$(FINAL)
|
||||
cd $(THISDIR)
|
||||
|
||||
wxclean:
|
||||
cd $(WXDIR)\src\msw
|
||||
nmake -f makefile.vc clean
|
||||
cd $(THISDIR)
|
||||
|
||||
$(LIBTARGET): $(OBJECTS)
|
||||
-erase $(LIBTARGET)
|
||||
$(implib) @<<
|
||||
-out:$(LIBTARGET)
|
||||
-machine:$(CPU)
|
||||
$(OBJECTS)
|
||||
<<
|
||||
|
||||
$(D)\animate.obj: animate.$(SRCSUFF)
|
||||
cl @<<
|
||||
$(CPPFLAGS) /c /Fo$@ /Tp $(*B).$(SRCSUFF)
|
||||
<<
|
||||
|
||||
clean:
|
||||
-erase $(D)\*.obj
|
||||
-erase *.sbr
|
||||
-erase *.exe
|
||||
-erase *.res
|
||||
-erase *.map
|
||||
-erase *.pdb
|
||||
-erase $(LIBTARGET)
|
||||
|
||||
DOCSOURCES=$(LOCALDOCDIR)\animate.tex \
|
||||
$(LOCALDOCDIR)\bugs.tex $(LOCALDOCDIR)\changes.tex\
|
||||
$(LOCALDOCDIR)\classes.tex $(LOCALDOCDIR)\intro.tex\
|
||||
$(LOCALDOCDIR)\topics.tex $(LOCALDOCDIR)\sample.tex
|
||||
|
||||
html: $(DOCDIR)\html\animate\animate.htm
|
||||
htmlhelp: $(DOCDIR)\htmlhelp\animate.chm
|
||||
htb: $(DOCDIR)\htb\animate.htb
|
||||
hlp: $(DOCDIR)\winhelp\animate.hlp
|
||||
pdfrtf: $(DOCDIR)\pdf\animate.rtf
|
||||
ps: $(DOCDIR)\ps\animate.ps
|
||||
|
||||
touchmanual:
|
||||
touch $(LOCALDOCDIR)\animate.tex
|
||||
|
||||
|
||||
$(DOCDIR)\winhelp\animate.hlp: $(LOCALDOCDIR)\animate.rtf $(LOCALDOCDIR)\animate.hpj
|
||||
cd $(LOCALDOCDIR)
|
||||
-erase animate.ph
|
||||
hc animate
|
||||
move animate.hlp $(DOCDIR)\winhelp\animate.hlp
|
||||
move animate.cnt $(DOCDIR)\winhelp\animate.cnt
|
||||
cd $(THISDIR)
|
||||
|
||||
$(LOCALDOCDIR)\animate.rtf: $(DOCSOURCES)
|
||||
cd $(LOCALDOCDIR)
|
||||
-start $(WAITFLAG) tex2rtf $(LOCALDOCDIR)\animate.tex $(LOCALDOCDIR)\animate.rtf -twice -winhelp
|
||||
cd $(THISDIR)
|
||||
|
||||
$(DOCDIR)\pdf\animate.rtf: $(DOCSOURCES)
|
||||
cd $(LOCALDOCDIR)
|
||||
-copy *.bmp $(DOCDIR)\pdf
|
||||
-start $(WAITFLAG) tex2rtf $(LOCALDOCDIR)\animate.tex $(DOCDIR)\pdf\animate.rtf -twice -rtf
|
||||
cd $(THISDIR)
|
||||
|
||||
$(DOCDIR)\html\animate\animate.htm: $(DOCSOURCES)
|
||||
cd $(LOCALDOCDIR)
|
||||
-mkdir $(DOCDIR)\html\animate
|
||||
copy *.gif $(DOCDIR)\html\animate
|
||||
-start $(WAITFLAG) tex2rtf $(LOCALDOCDIR)\animate.tex $(DOCDIR)\html\animate\animate.htm -twice -html
|
||||
-erase $(DOCDIR)\html\animate\*.con
|
||||
-erase *.con
|
||||
-erase $(DOCDIR)\html\animate\*.ref
|
||||
cd $(THISDIR)
|
||||
|
||||
$(DOCDIR)\htmlhelp\animate.chm: $(DOCDIR)\html\animate\animate.htm $(DOCDIR)\html\animate\animate.hhp
|
||||
cd $(DOCDIR)\html\animate
|
||||
-hhc animate.hhp
|
||||
move animate.chm $(DOCDIR)\htmlhelp\animate.chm
|
||||
cd $(THISDIR)
|
||||
|
||||
# An htb file is a zip file containing the .htm, .gif, .hhp, .hhc and .hhk
|
||||
# files, renamed to htb.
|
||||
# This can then be used with e.g. helpview.
|
||||
# Optionally, a cached version of the .hhp file can be generated with hhp2cached.
|
||||
$(DOCDIR)\htb\animate.htb: $(DOCDIR)\html\animate\animate.htm
|
||||
cd $(DOCDIR)\html\animate
|
||||
-erase animate.zip animate.htb
|
||||
zip animate.zip *.htm *.gif *.hhp *.hhc *.hhk
|
||||
-mkdir $(DOCDIR)\htb
|
||||
move animate.zip $(DOCDIR)\htb\animate.htb
|
||||
cd $(THISDIR)
|
||||
|
||||
$(LOCALDOCDIR)\animate.dvi: $(DOCSOURCES)
|
||||
cd $(LOCALDOCDIR)
|
||||
-latex animate
|
||||
-latex animate
|
||||
-makeindx animate
|
||||
-bibtex animate
|
||||
-latex animate
|
||||
-latex animate
|
||||
cd $(THISDIR)
|
||||
|
||||
$(WXDIR)\docs\ps\animate.ps: $(LOCALDOCDIR)\animate.dvi
|
||||
cd $(LOCALDOCDIR)
|
||||
-dvips32 -o animate.ps animate
|
||||
move animate.ps $(WXDIR)\docs\ps\animate.ps
|
||||
cd $(THISDIR)
|
||||
|
35
contrib/src/animate/readme.txt
Normal file
35
contrib/src/animate/readme.txt
Normal file
@@ -0,0 +1,35 @@
|
||||
Animation sample
|
||||
================
|
||||
|
||||
Every now and then someone asks whether there are animation
|
||||
classes in wxWindows. I started these animation player classes
|
||||
nearly two years ago and never got round to finishing them.
|
||||
Now I've done some hacking on them and (after very limited testing)
|
||||
it seems to work on Windows for animated GIFs, both transparent
|
||||
and non-transparent.
|
||||
|
||||
Basically the classes makes use of the existing GIF decoder in
|
||||
wxWindows to read an animated GIF into wxGIFAnimation, and then
|
||||
play that animation using wxAnimationPlayer. It's very much tied
|
||||
to the animated GIF format, so don't expect anything too generic.
|
||||
However, it would be quite possible to write code to convert an animated
|
||||
GIF into a PNG-based invented format, and then write a wxPNGAnimation
|
||||
handler.
|
||||
|
||||
The next steps are:
|
||||
|
||||
1. Test on other platforms.
|
||||
2. Write control classes to make it easy to embed animations in dialogs, etc.
|
||||
See my thoughts in animate.h.
|
||||
3. Write documentation.
|
||||
|
||||
*** IMPORTANT NOTE: to compile this, you must first edit the
|
||||
file:
|
||||
|
||||
include/wx/gifdecod.h
|
||||
|
||||
and change the keyword 'protected' to 'public', then recompile
|
||||
wxWindows. If you have downloaded the latest code from the CVS trunk,
|
||||
the problem has been corrected already.
|
||||
|
||||
Julian Smart, 5th July 2001
|
@@ -91,6 +91,19 @@ contrib/samples/gizmos/editlbox/*.rc
|
||||
contrib/samples/gizmos/editlbox/EditlboxVC.dsp
|
||||
contrib/samples/gizmos/editlbox/EditlboxVC.dsw
|
||||
|
||||
contrib/samples/animate/*.cpp
|
||||
contrib/samples/animate/*.h
|
||||
contrib/samples/animate/*.def
|
||||
contrib/samples/animate/makefile*
|
||||
contrib/samples/animate/*.xbm
|
||||
contrib/samples/animate/*.xpm
|
||||
contrib/samples/animate/*.txt
|
||||
contrib/samples/animate/*.ico
|
||||
contrib/samples/animate/*.bmp
|
||||
contrib/samples/animate/*.rc
|
||||
contrib/samples/animate/AnimVC.dsp
|
||||
contrib/samples/animate/AnimVC.dsw
|
||||
|
||||
contrib/src/canvas/*.cpp
|
||||
contrib/src/canvas/*.h
|
||||
contrib/src/canvas/make*
|
||||
@@ -127,3 +140,11 @@ contrib/include/wx/applet/*.xpm
|
||||
contrib/include/wx/applet/*.bmp
|
||||
contrib/include/wx/applet/*.rc
|
||||
|
||||
contrib/src/animate/*.cpp
|
||||
contrib/src/animate/*.h
|
||||
contrib/src/animate/make*
|
||||
contrib/src/animate/readme.txt
|
||||
contrib/src/animate/AnimateVC.dsp
|
||||
contrib/src/animate/AnimateVC.dsw
|
||||
contrib/include/wx/animate/*.h
|
||||
|
||||
|
@@ -95,6 +95,7 @@ contrib/src/mmedia/Makefile.in
|
||||
contrib/src/stc/Makefile.in
|
||||
contrib/src/plot/Makefile.in
|
||||
contrib/src/gizmos/Makefile.in
|
||||
contrib/src/animate/Makefile.in
|
||||
|
||||
contrib/samples/Makefile.in
|
||||
contrib/samples/canvas/test/Makefile.in
|
||||
@@ -111,6 +112,7 @@ contrib/samples/mmedia/Makefile.in
|
||||
contrib/samples/plot/Makefile.in
|
||||
contrib/samples/stc/Makefile.in
|
||||
contrib/samples/applet/Makefile.in
|
||||
contrib/samples/animate/Makefile.in
|
||||
|
||||
contrib/utils/Makefile.in
|
||||
|
||||
|
@@ -319,3 +319,11 @@ contrib/samples/gizmos/multicell/MulticellVC.dsp
|
||||
contrib/samples/gizmos/multicell/MulticellVC.dsw
|
||||
contrib/samples/gizmos/splittree/TreeVC.dsp
|
||||
contrib/samples/gizmos/splittree/TreeVC.dsw
|
||||
contrib/samples/gizmos/editlbox/EditlboxVC.dsp
|
||||
contrib/samples/gizmos/editlbox/EditlboxVC.dsw
|
||||
|
||||
contrib/src/animate/AnimateVC.dsp
|
||||
contrib/src/animate/AnimateVC.dsw
|
||||
contrib/samples/animate/AniTestVC.dsp
|
||||
contrib/samples/animate/AniTestVC.dsw
|
||||
|
||||
|
Reference in New Issue
Block a user