~ubuntu-branches/ubuntu/dapper/lmms/dapper

« back to all changes in this revision

Viewing changes to include/knob.h

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ragwitz
  • Date: 2005-12-22 16:22:50 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20051222162250-key3p7x0212jy6dn
Tags: 0.1.2-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * knob.h - powerful knob-widget
3
3
 *
4
 
 * This file is based on the knob-widget of the Qwt Widget Library by Josef Wilgen
 
4
 * This file is based on the knob-widget of the Qwt Widget Library by
 
5
 * Josef Wilgen
5
6
 *
6
 
 * Linux MultiMedia Studio
7
 
 * Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.sourceforge.net>
 
7
 * Copyright (c) 2004-2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
 
8
 * 
 
9
 * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
8
10
 *
9
11
 * This program is free software; you can redistribute it and/or
10
12
 * modify it under the terms of the GNU General Public
42
44
#endif
43
45
 
44
46
 
45
 
#include "templates.h"
46
 
 
47
 
 
48
47
class QPixmap;
49
48
class textFloat;
50
49
 
63
62
        knob( int _knob_num, QWidget * _parent, const QString & _name );
64
63
        virtual ~knob();
65
64
 
66
 
        enum ScrollMode
67
 
        {
68
 
                ScrNone,
69
 
                ScrMouse,
70
 
                ScrTimer,
71
 
                ScrDirect,
72
 
                ScrPage
73
 
        } ;
74
65
    
75
 
        void setTracking( bool _enable );
76
66
        void setHintText( const QString & _txt_before,
77
67
                                                const QString & _txt_after );
78
68
        void setLabel( const QString & _txt );
112
102
        void reset( void );
113
103
        void copyValue( void );
114
104
        void pasteValue( void );
 
105
        void enterValue( void );
115
106
        void connectToMidiDevice( void );
116
107
        void displayHelp( void );
117
108
 
124
115
    
125
116
 
126
117
protected:
127
 
        virtual void paintEvent( QPaintEvent * _me );
128
 
        virtual void resizeEvent( QResizeEvent * _me );
 
118
        virtual void contextMenuEvent( QContextMenuEvent * _me );
 
119
        virtual void dragEnterEvent( QDragEnterEvent * _dee );
 
120
        virtual void dropEvent( QDropEvent * _de );
129
121
        virtual void mousePressEvent( QMouseEvent * _me );
130
122
        virtual void mouseReleaseEvent( QMouseEvent * _me );
131
123
        virtual void mouseMoveEvent( QMouseEvent * _me );
 
124
        virtual void mouseDoubleClickEvent( QMouseEvent * _me );
 
125
        virtual void paintEvent( QPaintEvent * _me );
 
126
        virtual void resizeEvent( QResizeEvent * _me );
132
127
        virtual void wheelEvent( QWheelEvent * _me );
133
 
        virtual void contextMenuEvent( QContextMenuEvent * _me );
134
128
 
135
129
        void drawKnob( QPainter * _p );
136
130
        void setPosition( const QPoint & _p );
137
131
 
138
 
  
139
 
private:
 
132
 
 
133
// TODO: Need to figure out what is really used by tempoSyncKnob
 
134
// to get the private/protected attributes sorted out.  Right
 
135
// now, just make everything protected.
 
136
//private:
140
137
        void layoutKnob( bool _update = TRUE );
141
138
        float getValue( const QPoint & _p );
142
 
        void getScrollMode( const QPoint & _p, int & _scroll_mode,
143
 
                                                        int & _direction );
144
139
        void recalcAngle( void );
145
140
    
146
141
        void valueChange( void );
149
144
 
150
145
        void buttonReleased( void );
151
146
 
152
 
        void setNewValue( float x, int align = 0 );
 
147
        void setNewValue( float _x, bool _align = FALSE );
153
148
 
154
149
 
155
150
        static float s_copiedValue;
156
151
        static textFloat * s_textFloat;
157
152
 
158
153
 
159
 
        int m_knobWidth;
160
 
        int m_scrollMode;
161
154
        float m_mouseOffset;
162
 
        int m_direction;
163
 
        int m_tracking;
164
155
        QPoint m_origMousePos;
 
156
        bool m_buttonPressed;
165
157
 
166
158
 
167
159
        float m_angle;
168
 
        float m_oldAngle;
169
160
        float m_totalAngle;
170
 
        float m_nTurns;
171
161
 
172
162
        QPixmap * m_knobPixmap;
173
163
        int m_knobNum;