Diffstat (limited to 'noncore/apps/checkbook/graph.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/checkbook/graph.cpp | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/noncore/apps/checkbook/graph.cpp b/noncore/apps/checkbook/graph.cpp index acdb846..389972e 100644 --- a/noncore/apps/checkbook/graph.cpp +++ b/noncore/apps/checkbook/graph.cpp | |||
@@ -1,81 +1,79 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | =. | 3 | =. |
4 | .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> | 4 | .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This file is free software; you can | 6 | _;:, .> :=|. This file is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This file is distributed in the hope that | 13 | .i_,=:_. -<s. This file is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ..}^=.= = ; Public License for more details. | 18 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "graph.h" | 29 | #include "graph.h" |
30 | #include "graphinfo.h" | 30 | #include "graphinfo.h" |
31 | 31 | ||
32 | #include <qcolor.h> | ||
33 | #include <qfontmetrics.h> | ||
34 | #include <qpainter.h> | 32 | #include <qpainter.h> |
35 | 33 | ||
36 | #include <math.h> | 34 | #include <math.h> |
37 | 35 | ||
38 | Graph::Graph( QWidget *parent, GraphInfo *d, const QString &name, int flags ) | 36 | Graph::Graph( QWidget *parent, GraphInfo *d, const QString &name, int flags ) |
39 | : QWidget( parent, name, flags ) | 37 | : QWidget( parent, name, flags ) |
40 | { | 38 | { |
41 | data = d; | 39 | data = d; |
42 | 40 | ||
43 | graph.setOptimization( QPixmap::BestOptim ); | 41 | graph.setOptimization( QPixmap::BestOptim ); |
44 | } | 42 | } |
45 | 43 | ||
46 | void Graph::setGraphInfo( GraphInfo *d ) | 44 | void Graph::setGraphInfo( GraphInfo *d ) |
47 | { | 45 | { |
48 | data = d; | 46 | data = d; |
49 | } | 47 | } |
50 | 48 | ||
51 | void Graph::drawGraph( bool regen ) | 49 | void Graph::drawGraph( bool regen ) |
52 | { | 50 | { |
53 | if ( regen ) | 51 | if ( regen ) |
54 | { | 52 | { |
55 | initGraph(); | 53 | initGraph(); |
56 | } | 54 | } |
57 | QPainter p( this ); | 55 | QPainter p( this ); |
58 | p.drawPixmap( 0, 0, graph ); | 56 | p.drawPixmap( 0, 0, graph ); |
59 | } | 57 | } |
60 | 58 | ||
61 | void Graph::paintEvent( QPaintEvent * ) | 59 | void Graph::paintEvent( QPaintEvent * ) |
62 | { | 60 | { |
63 | drawGraph( FALSE ); | 61 | drawGraph( FALSE ); |
64 | } | 62 | } |
65 | 63 | ||
66 | void Graph::resizeEvent( QResizeEvent * ) | 64 | void Graph::resizeEvent( QResizeEvent * ) |
67 | { | 65 | { |
68 | drawGraph( TRUE ); | 66 | drawGraph( TRUE ); |
69 | } | 67 | } |
70 | 68 | ||
71 | void Graph::initGraph() | 69 | void Graph::initGraph() |
72 | { | 70 | { |
73 | graph.resize( width(), height() ); | 71 | graph.resize( width(), height() ); |
74 | graph.fill( QColor( 255, 255, 255 ) ); | 72 | graph.fill( QColor( 255, 255, 255 ) ); |
75 | 73 | ||
76 | if ( !data ) | 74 | if ( !data ) |
77 | { | 75 | { |
78 | return; | 76 | return; |
79 | } | 77 | } |
80 | 78 | ||
81 | // Any common stuff here (titles, ???) | 79 | // Any common stuff here (titles, ???) |