summaryrefslogtreecommitdiffabout
path: root/korganizer/lineview.cpp
Unidiff
Diffstat (limited to 'korganizer/lineview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/lineview.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/lineview.cpp b/korganizer/lineview.cpp
index e72e41c..012455e 100644
--- a/korganizer/lineview.cpp
+++ b/korganizer/lineview.cpp
@@ -1,93 +1,93 @@
1#include <qpainter.h> 1#include <qpainter.h>
2 2
3#include <kdebug.h> 3#include <kdebug.h>
4 4
5#include "koprefs.h" 5#include "koprefs.h"
6 6
7#include "lineview.h" 7#include "lineview.h"
8 8
9LineView::LineView( QWidget *parent, const char *name ) : 9LineView::LineView( QWidget *parent, const char *name ) :
10 QScrollView( parent, name ) 10 Q3ScrollView( parent, name )
11{ 11{
12 mPixelWidth = 1000; 12 mPixelWidth = 1000;
13 13
14 mLines.setAutoDelete( true ); 14 mLines.setAutoDelete( true );
15 15
16 resizeContents( mPixelWidth, contentsHeight() ); 16 resizeContents( mPixelWidth, contentsHeight() );
17 17
18 viewport()->setBackgroundColor(KOPrefs::instance()->mAgendaBgColor); 18 viewport()->setBackgroundColor(KOPrefs::instance()->mAgendaBgColor);
19} 19}
20 20
21LineView::~LineView() 21LineView::~LineView()
22{ 22{
23} 23}
24 24
25int LineView::pixelWidth() 25int LineView::pixelWidth()
26{ 26{
27 return mPixelWidth; 27 return mPixelWidth;
28} 28}
29 29
30void LineView::addLine( int start, int end ) 30void LineView::addLine( int start, int end )
31{ 31{
32 int count = mLines.count(); 32 int count = mLines.count();
33 33
34 if( start < 0 ) start = 0; 34 if( start < 0 ) start = 0;
35 if( end > mPixelWidth) end = mPixelWidth; 35 if( end > mPixelWidth) end = mPixelWidth;
36 36
37 kdDebug() << "LineView::addLine() col: " << count << " start: " << start 37 kdDebug() << "LineView::addLine() col: " << count << " start: " << start
38 << " end: " << end << endl; 38 << " end: " << end << endl;
39 39
40 mLines.append( new Line( count, start, end ) ); 40 mLines.append( new Line( count, start, end ) );
41} 41}
42 42
43void LineView::clear() 43void LineView::clear()
44{ 44{
45 mLines.clear(); 45 mLines.clear();
46 update(); 46 update();
47} 47}
48 48
49void LineView::drawContents(QPainter* p, int cx, int cy, int cw, int ch) 49void LineView::drawContents(QPainter* p, int cx, int cy, int cw, int ch)
50{ 50{
51// kdDebug() << "LineView::drawContents()" << endl; 51// kdDebug() << "LineView::drawContents()" << endl;
52 52
53 int mGridSpacingX = 10; 53 int mGridSpacingX = 10;
54 int mGridSpacingY = 20; 54 int mGridSpacingY = 20;
55 55
56#if 0 56#if 0
57 // Draw vertical lines of grid 57 // Draw vertical lines of grid
58 // kdDebug() << "drawContents cx: " << cx << " cy: " << cy << " cw: " << cw << " ch: " << ch << endl; 58 // kdDebug() << "drawContents cx: " << cx << " cy: " << cy << " cw: " << cw << " ch: " << ch << endl;
59 int x = ((int)(cx/mGridSpacingX))*mGridSpacingX; 59 int x = ((int)(cx/mGridSpacingX))*mGridSpacingX;
60 while (x < cx + cw) { 60 while (x < cx + cw) {
61 p->drawLine(x,cy,x,cy+ch); 61 p->drawLine(x,cy,x,cy+ch);
62 x+=mGridSpacingX; 62 x+=mGridSpacingX;
63 } 63 }
64#endif 64#endif
65 65
66 // Draw horizontal lines of grid 66 // Draw horizontal lines of grid
67 int y = ((int)(cy/mGridSpacingY))*mGridSpacingY + 10; 67 int y = ((int)(cy/mGridSpacingY))*mGridSpacingY + 10;
68 while (y < cy + ch) { 68 while (y < cy + ch) {
69// kdDebug() << " y: " << y << endl; 69// kdDebug() << " y: " << y << endl;
70 p->drawLine(cx,y,cx+cw,y); 70 p->drawLine(cx,y,cx+cw,y);
71 y+=mGridSpacingY; 71 y+=mGridSpacingY;
72 } 72 }
73 73
74 Line *line; 74 Line *line;
75 for( line = mLines.first(); line; line = mLines.next() ) { 75 for( line = mLines.first(); line; line = mLines.next() ) {
76 int ctop = line->column * 20 + 10 - 5; 76 int ctop = line->column * 20 + 10 - 5;
77 int cbottom = line->column * 20 + 10 + 5; 77 int cbottom = line->column * 20 + 10 + 5;
78 int s = line->start; 78 int s = line->start;
79 int e = line->end; 79 int e = line->end;
80// kdDebug() << " LineView::drawContents(): ctop: " << ctop << " cbottom: " 80// kdDebug() << " LineView::drawContents(): ctop: " << ctop << " cbottom: "
81// << cbottom << " s: " << s << " e: " << e << endl; 81// << cbottom << " s: " << s << " e: " << e << endl;
82 if ( ctop <= (cy+ch) && cbottom >= cy && 82 if ( ctop <= (cy+ch) && cbottom >= cy &&
83 s <= (cx+cw) && e >= cx ) { 83 s <= (cx+cw) && e >= cx ) {
84 if ( s < cx ) s = cx; 84 if ( s < cx ) s = cx;
85 if ( e > (cx+cw) ) e = cx+cw; 85 if ( e > (cx+cw) ) e = cx+cw;
86 if ( ctop < cy ) ctop = cy; 86 if ( ctop < cy ) ctop = cy;
87 if ( cbottom > (cy+ch) ) cbottom = cy+ch; 87 if ( cbottom > (cy+ch) ) cbottom = cy+ch;
88// kdDebug() << " drawContents(): ctop: " << ctop << " cbottom: " 88// kdDebug() << " drawContents(): ctop: " << ctop << " cbottom: "
89// << cbottom << " s: " << s << " e: " << e << endl; 89// << cbottom << " s: " << s << " e: " << e << endl;
90 p->fillRect( s, ctop, e - s + 1, cbottom - ctop + 1, QBrush("red") ); 90 p->fillRect( s, ctop, e - s + 1, cbottom - ctop + 1, QBrush("red") );
91 } 91 }
92 } 92 }
93} 93}