Import fmit upstream version 0.97.6
[fmit.git] / src / modules / DialView.h
1 // Copyright 2004 "Gilles Degottex"
2
3 // This file is part of "fmit"
4
5 // "fmit" 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 of the License, or
8 // (at your option) any later version.
9 // 
10 // "fmit" 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; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
19 #ifndef _DialView_h_
20 #define _DialView_h_
21
22 #include <qframe.h>
23 #include <qaction.h>
24 #include <qspinbox.h>
25 #include <qsettings.h>
26 #include "View.h"
27
28 class DialView : public QFrame, public View
29 {
30         Q_OBJECT
31
32         virtual void drawContents(QPainter* p);
33         virtual void mouseReleaseEvent(QMouseEvent* e){View::mouseReleaseEvent(e);}
34         void drawTextTickCent(QPainter& p, int bigw, int bigh, int r);
35         void drawTicksCent(QPainter& p, int bigw, int bigh, int r, int ticks_size, int h);
36         void drawTextTickFrac(QPainter& p, int bigw, int bigh, int num, int den);
37         void drawTicksFrac(QPainter& p, int bigw, int bigh, float r, int ticks_size, int h);
38
39         float m_error;
40
41   public:
42         DialView(QWidget* parent);
43
44         void setError(float error);
45
46         float m_min_error;
47         float m_max_error;
48         float m_avg_error;
49
50         // settings
51         QAction* setting_showTolerance;
52         QAction* setting_showTrace;
53         QAction* setting_useCents;
54         QSpinBox* setting_spinScale;
55         virtual void save();
56         virtual void load();
57         virtual void clearSettings();
58 };
59
60 #endif // _DialView_h_
61