~ubuntu-branches/ubuntu/oneiric/guayadeque/oneiric

« back to all changes in this revision

Viewing changes to src/.svn/text-base/TimeLine.h.svn-base

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2011-05-14 15:08:03 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110514150803-8b5evqetnaj35j34
Tags: 0.3.1~dfsg0-1
* New upstream release.
* Strip wxsqlite3 stuff out of upstream's tarballs.
* Update get-orig-source target in debian/rules.
* Update gbp config file.
* Bump Standards.
* Build-depend on libwxsqlite3-2.8-dev
* Enable parallel builds.
* Link binaries against the system-wide copy of wxsqlite3.
* Point sources to the correct wxcurl's headers location.
* Update copyright file as per DEP-5
* Improve debian/watch to handle the ~dfsg\d* suffix.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// -------------------------------------------------------------------------------- //
2
 
//      Copyright (C) 2008-2010 J.Rios
3
 
//      anonbeat@gmail.com
4
 
//
5
 
//    This Program is free software; you can redistribute it and/or modify
6
 
//    it under the terms of the GNU General Public License as published by
7
 
//    the Free Software Foundation; either version 2, or (at your option)
8
 
//    any later version.
9
 
//
10
 
//    This Program is distributed in the hope that it will be useful,
11
 
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
 
//    GNU General Public License for more details.
14
 
//
15
 
//    You should have received a copy of the GNU General Public License
16
 
//    along with this program; see the file LICENSE.  If not, write to
17
 
//    the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18
 
//    http://www.gnu.org/copyleft/gpl.html
19
 
//
20
 
//  Bassed on the QTimeLine class from QT
21
 
// -------------------------------------------------------------------------------- //
22
 
#ifndef guTIMELINE_H
23
 
#define guTIMELINE_H
24
 
 
25
 
#include <wx/event.h>
26
 
#include <gst/gst.h>
27
 
 
28
 
// -------------------------------------------------------------------------------- //
29
 
class guTimeLine
30
 
{
31
 
  public :
32
 
    enum guState {
33
 
        NotRunning,
34
 
        Paused,
35
 
        Running
36
 
    };
37
 
 
38
 
    enum guDirection {
39
 
        Forward,
40
 
        Backward
41
 
    };
42
 
 
43
 
    enum guCurveShape {
44
 
        EaseInCurve,
45
 
        EaseOutCurve,
46
 
        EaseInOutCurve,
47
 
        LinearCurve,
48
 
        SineCurve
49
 
    };
50
 
 
51
 
  private :
52
 
    int                 m_StartTime;
53
 
    int                 m_StartFrame;
54
 
    int                 m_EndFrame;
55
 
    int                 m_TotalLoopCount;
56
 
    int                 m_CurrentLoopCount;
57
 
 
58
 
    int                 m_TimerId;
59
 
 
60
 
    guState             m_State;
61
 
 
62
 
    void                ChangeCurrentTime( const int msec );
63
 
 
64
 
  protected :
65
 
    int                 m_Duration;
66
 
    int                 m_UpdateInterval;
67
 
    int                 m_CurrentTime;
68
 
    guDirection         m_Direction;
69
 
    int                 m_LoopCount;
70
 
    guCurveShape        m_CurveShape;
71
 
 
72
 
    wxEvtHandler *      m_Parent;
73
 
 
74
 
  public :
75
 
    guTimeLine( int duration = 1000, wxEvtHandler * parent = NULL );
76
 
    ~guTimeLine();
77
 
 
78
 
    int             Duration( void ) const { return m_Duration; }
79
 
    void            SetDuration( const int duration ) { m_Duration = duration; }
80
 
    int             UpdateInterval( void ) const { return m_UpdateInterval; }
81
 
    void            SetUpdateInterval( const int interval ) { m_UpdateInterval = interval; }
82
 
    int             CurrentTime( void ) const { return m_CurrentTime; }
83
 
    void            SetCurrentTime( const int time );
84
 
    guDirection     Direction( void ) const { return m_Direction; }
85
 
    void            SetDirection( const guDirection direction );
86
 
    int             LoopCount( void ) const { return m_LoopCount; }
87
 
    void            SetLoopCount( const int count ) { m_LoopCount = count; }
88
 
    guCurveShape    CurveShape( void ) const { return m_CurveShape; }
89
 
    void            SetCurveShape( const guCurveShape shape ) { m_CurveShape = shape; }
90
 
 
91
 
    guState         State( void ) const { return m_State; }
92
 
    void            SetState( guState state ) { if( m_State != state ) StateChanged( state ); }
93
 
 
94
 
    int             StartFrame( void ) const { return m_StartFrame; }
95
 
    void            SetStartFrame( const int frame ) { m_StartFrame = frame; }
96
 
    int             EndFrame( void ) const { return m_EndFrame; }
97
 
    void            SetEndFrame( const int frame ) { m_EndFrame = frame; }
98
 
    void            SetFrameRange( const int start, const int end ) { m_StartFrame = start; m_EndFrame = end; }
99
 
 
100
 
    int             CurrentFrame( void ) { return FrameForTime( m_CurrentTime ); }
101
 
    float           CurrentValue( void ) { return ValueForTime( m_CurrentTime ); }
102
 
 
103
 
    int             FrameForTime( int msec ) { return m_StartFrame + int( ( m_EndFrame - m_StartFrame ) * ValueForTime( msec ) ); }
104
 
    virtual float   ValueForTime( int msec );
105
 
 
106
 
    void            Start( void );
107
 
    void            Stop( void );
108
 
    void            SetPaused( const bool paused );
109
 
    void            ToggleDirection( void ) { SetDirection( m_Direction == guTimeLine::Forward ? guTimeLine::Backward : guTimeLine::Forward ); }
110
 
 
111
 
    virtual void    ValueChanged( float value );
112
 
    virtual void    FrameChanged( int frame );
113
 
    virtual void    StateChanged( guState state );
114
 
    virtual void    Finished( void );
115
 
 
116
 
    virtual void    TimerEvent( void );
117
 
    virtual int     TimerCreate( void );
118
 
    virtual void    TimerDestroy( void ) { g_source_remove( m_TimerId ); }
119
 
 
120
 
};
121
 
 
122
 
#endif
123
 
// -------------------------------------------------------------------------------- //
124