summaryrefslogtreecommitdiffabout
path: root/microkde/KDGanttMinimizeSplitter.cpp
Unidiff
Diffstat (limited to 'microkde/KDGanttMinimizeSplitter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/KDGanttMinimizeSplitter.cpp194
1 files changed, 103 insertions, 91 deletions
diff --git a/microkde/KDGanttMinimizeSplitter.cpp b/microkde/KDGanttMinimizeSplitter.cpp
index 72c4e60..4172cd0 100644
--- a/microkde/KDGanttMinimizeSplitter.cpp
+++ b/microkde/KDGanttMinimizeSplitter.cpp
@@ -35,57 +35,67 @@
35#ifndef QT_NO_SPLITTER___ 35#ifndef QT_NO_SPLITTER___
36 36
37#include "qpainter.h" 37#include "qpainter.h"
38#include "qdrawutil.h" 38#include "qdrawutil.h"
39#include "qbitmap.h" 39#include "qbitmap.h"
40#if QT_VERSION >= 0x030000 40#if QT_VERSION >= 0x030000
41#include "qptrlist.h" 41#include "q3ptrlist.h"
42#include "qmemarray.h" 42#include "q3memarray.h"
43#else 43#else
44#include <qlist.h> 44#include <qlist.h>
45#include <qarray.h> 45#include <qarray.h>
46#define QPtrList QList 46#define Q3PtrList QList
47#define QMemArray QArray 47#define Q3MemArray QArray
48#endif 48#endif
49#include "qlayoutengine_p.h" 49#include "qlayoutengine_p.h"
50#include "qobjectlist.h" 50#include "qobject.h"
51#include "qstyle.h" 51#include "qstyle.h"
52#include "qapplication.h" //sendPostedEvents 52#include "qapplication.h" //sendPostedEvents
53#include <qvaluelist.h> 53#include <q3valuelist.h>
54#include <qcursor.h> 54#include <qcursor.h>
55#include <qframe.h> 55#include <q3frame.h>
56#include <QDesktopWidget>
57//Added by qt3to4:
58#include <Q3PointArray>
59#include <QPixmap>
60#include <QResizeEvent>
61#include <QMouseEvent>
62#include <QChildEvent>
63#include <QEvent>
64#include <QPaintEvent>
56#ifndef KDGANTT_MASTER_CVS 65#ifndef KDGANTT_MASTER_CVS
57//#include "KDGanttMinimizeSplitter.moc" 66//#include "KDGanttMinimizeSplitter.moc"
58#endif 67#endif
59 68
60 69
61 70
62#ifndef DOXYGEN_SKIP_INTERNAL 71#ifndef DOXYGEN_SKIP_INTERNAL
63 72
64#if QT_VERSION >= 232 73#if QT_VERSION >= 232
65static int mouseOffset; 74static int mouseOffset;
66static int opaqueOldPos = -1; //### there's only one mouse, but this is a bit risky 75static int opaqueOldPos = -1; //### there's only one mouse, but this is a bit risky
67 76
68class KDRubberBand: public QFrame 77class KDRubberBand: public Q3Frame
69{ 78{
70public: 79public:
71 KDRubberBand( QWidget *parent, const char * name, WFlags f ) :QFrame ( parent, name, f ) {;} 80 KDRubberBand( QWidget *parent, const char * name, Qt::WFlags f ) :Q3Frame ( parent, name, f ) {;}
72 81
73protected: 82protected:
74 virtual void mousePressEvent ( QMouseEvent * ) 83 virtual void mousePressEvent ( QMouseEvent * )
75 { 84 {
76 close(); 85 close();
77 }; 86 };
78 87
79}; 88};
80 89
81KDGanttSplitterHandle::KDGanttSplitterHandle( Qt::Orientation o, 90KDGanttSplitterHandle::KDGanttSplitterHandle( Qt::Orientation o,
82 KDGanttMinimizeSplitter *parent, const char * name ) 91 KDGanttMinimizeSplitter *parent, const char * name )
83 : QWidget( parent, name ), _activeButton( 0 ), _collapsed( false ) 92 : _activeButton( 0 ), _collapsed( false )
84{ 93{
85 94 setObjectName(name);
95 setParent(parent);
86 if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->width() < 650 ) { 96 if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->width() < 650 ) {
87 mSizeHint = QSize(7,7); 97 mSizeHint = QSize(7,7);
88 mUseOffset = true; 98 mUseOffset = true;
89 } else { 99 } else {
90 mSizeHint = QSize(6,6); 100 mSizeHint = QSize(6,6);
91 mUseOffset = false; 101 mUseOffset = false;
@@ -103,24 +113,24 @@ QSize KDGanttSplitterHandle::sizeHint() const
103} 113}
104 114
105void KDGanttSplitterHandle::setOrientation( Qt::Orientation o ) 115void KDGanttSplitterHandle::setOrientation( Qt::Orientation o )
106{ 116{
107 orient = o; 117 orient = o;
108#ifndef QT_NO_CURSOR 118#ifndef QT_NO_CURSOR
109 if ( o == KDGanttMinimizeSplitter::Horizontal ) 119 if ( o == Qt::Horizontal )
110 setCursor( splitHCursor ); 120 setCursor( Qt::splitHCursor );
111 else 121 else
112 setCursor( splitVCursor ); 122 setCursor( Qt::splitVCursor );
113#endif 123#endif
114} 124}
115 125
116 126
117void KDGanttSplitterHandle::mouseMoveEvent( QMouseEvent *e ) 127void KDGanttSplitterHandle::mouseMoveEvent( QMouseEvent *e )
118{ 128{
119 updateCursor( e->pos() ); 129 updateCursor( e->pos() );
120 if ( !(e->state()&LeftButton) ) 130 if ( !(e->state()&Qt::LeftButton) )
121 return; 131 return;
122 132
123 if ( _activeButton != 0) 133 if ( _activeButton != 0)
124 return; 134 return;
125 135
126 QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos())) 136 QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos()))
@@ -134,31 +144,31 @@ void KDGanttSplitterHandle::mouseMoveEvent( QMouseEvent *e )
134 } 144 }
135 _collapsed = false; 145 _collapsed = false;
136} 146}
137 147
138void KDGanttSplitterHandle::mousePressEvent( QMouseEvent *e ) 148void KDGanttSplitterHandle::mousePressEvent( QMouseEvent *e )
139{ 149{
140 if ( e->button() == LeftButton ) { 150 if ( e->button() == Qt::LeftButton ) {
141 _activeButton = onButton( e->pos() ); 151 _activeButton = onButton( e->pos() );
142 mouseOffset = s->pick(e->pos()); 152 mouseOffset = s->pick(e->pos());
143 mMouseDown = true; 153 mMouseDown = true;
144 repaint(); 154 repaint();
145 updateCursor( e->pos() ); 155 updateCursor( e->pos() );
146 } 156 }
147} 157}
148 158
149void KDGanttSplitterHandle::updateCursor( const QPoint& p) 159void KDGanttSplitterHandle::updateCursor( const QPoint& p)
150{ 160{
151 if ( onButton( p ) != 0 ) { 161 if ( onButton( p ) != 0 ) {
152 setCursor( arrowCursor ); 162 setCursor( Qt::arrowCursor );
153 } 163 }
154 else { 164 else {
155 if ( orient == KDGanttMinimizeSplitter::Horizontal ) 165 if ( orient == Qt::Horizontal )
156 setCursor( splitHCursor ); 166 setCursor( Qt::splitHCursor );
157 else 167 else
158 setCursor( splitVCursor ); 168 setCursor( Qt::splitVCursor );
159 } 169 }
160} 170}
161void KDGanttSplitterHandle::toggle() 171void KDGanttSplitterHandle::toggle()
162{ 172{
163 int pos; 173 int pos;
164 int min, max; 174 int min, max;
@@ -192,13 +202,13 @@ void KDGanttSplitterHandle::mouseReleaseEvent( QMouseEvent *e )
192 toggle(); 202 toggle();
193 } 203 }
194 _activeButton = 0; 204 _activeButton = 0;
195 updateCursor( e->pos() ); 205 updateCursor( e->pos() );
196 } 206 }
197 else { 207 else {
198 if ( !opaque() && e->button() == LeftButton ) { 208 if ( !opaque() && e->button() == Qt::LeftButton ) {
199 QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos())) 209 QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos()))
200 - mouseOffset; 210 - mouseOffset;
201 s->setRubberband( -1 ); 211 s->setRubberband( -1 );
202 s->moveSplitter( pos, id() ); 212 s->moveSplitter( pos, id() );
203 } 213 }
204 } 214 }
@@ -208,16 +218,16 @@ void KDGanttSplitterHandle::mouseReleaseEvent( QMouseEvent *e )
208 } 218 }
209 repaint(); 219 repaint();
210} 220}
211 221
212int KDGanttSplitterHandle::onButton( const QPoint& p ) 222int KDGanttSplitterHandle::onButton( const QPoint& p )
213{ 223{
214 QValueList<QPointArray> list = buttonRegions(); 224 Q3ValueList<Q3PointArray> list = buttonRegions();
215 int index = 1; 225 int index = 1;
216 int add = 12; 226 int add = 12;
217 for( QValueList<QPointArray>::Iterator it = list.begin(); it != list.end(); ++it ) { 227 for( Q3ValueList<Q3PointArray>::Iterator it = list.begin(); it != list.end(); ++it ) {
218 QRect rect = (*it).boundingRect(); 228 QRect rect = (*it).boundingRect();
219 rect.setLeft( rect.left()- add ); 229 rect.setLeft( rect.left()- add );
220 rect.setRight( rect.right() + add); 230 rect.setRight( rect.right() + add);
221 rect.setTop( rect.top()- add ); 231 rect.setTop( rect.top()- add );
222 rect.setBottom( rect.bottom() + add); 232 rect.setBottom( rect.bottom() + add);
223 if ( rect.contains( p ) ) { 233 if ( rect.contains( p ) ) {
@@ -226,22 +236,22 @@ int KDGanttSplitterHandle::onButton( const QPoint& p )
226 index++; 236 index++;
227 } 237 }
228 return 0; 238 return 0;
229} 239}
230 240
231 241
232QValueList<QPointArray> KDGanttSplitterHandle::buttonRegions() 242Q3ValueList<Q3PointArray> KDGanttSplitterHandle::buttonRegions()
233{ 243{
234 QValueList<QPointArray> list; 244 Q3ValueList<Q3PointArray> list;
235 245
236 int sw = 8; 246 int sw = 8;
237 int yyy = 1; 247 int yyy = 1;
238 int xxx = 1; 248 int xxx = 1;
239 int voffset[] = { (int) -sw*3, (int) sw*3 }; 249 int voffset[] = { (int) -sw*3, (int) sw*3 };
240 for ( int i = 0; i < 2; i++ ) { 250 for ( int i = 0; i < 2; i++ ) {
241 QPointArray arr; 251 Q3PointArray arr;
242 if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Right || 252 if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Right ||
243 _collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Left) { 253 _collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Left) {
244 int mid = height()/2 + voffset[i]; 254 int mid = height()/2 + voffset[i];
245 arr.setPoints( 3, 255 arr.setPoints( 3,
246 1-xxx, mid - sw + 4, 256 1-xxx, mid - sw + 4,
247 sw-3-xxx, mid, 257 sw-3-xxx, mid,
@@ -308,17 +318,17 @@ void KDGanttSplitterHandle::paintEvent( QPaintEvent * )
308 col = colorGroup().background().dark( 150 ); 318 col = colorGroup().background().dark( 150 );
309 } 319 }
310 //QColor col = backgroundColor().dark( 130 ); 320 //QColor col = backgroundColor().dark( 130 );
311 p.setBrush( col ); 321 p.setBrush( col );
312 p.setPen( col ); 322 p.setPen( col );
313 323
314 QValueList<QPointArray> list = buttonRegions(); 324 Q3ValueList<Q3PointArray> list = buttonRegions();
315 int index = 1; 325 int index = 1;
316 if ( mUseOffset ) 326 if ( mUseOffset )
317 p.translate( 0, 1 ); 327 p.translate( 0, 1 );
318 for ( QValueList<QPointArray>::Iterator it = list.begin(); it != list.end(); ++it ) { 328 for ( Q3ValueList<Q3PointArray>::Iterator it = list.begin(); it != list.end(); ++it ) {
319 if ( index == _activeButton ) { 329 if ( index == _activeButton ) {
320 330
321 /* 331 /*
322 if ( ! _collapsed ) { 332 if ( ! _collapsed ) {
323 p.save(); 333 p.save();
324 // p.translate( parentWidget()->style().pixelMetric( QStyle::PM_ButtonShiftHorizontal ), 334 // p.translate( parentWidget()->style().pixelMetric( QStyle::PM_ButtonShiftHorizontal ),
@@ -374,18 +384,18 @@ public:
374 384
375class QSplitterData 385class QSplitterData
376{ 386{
377public: 387public:
378 QSplitterData() : opaque( FALSE ), firstShow( TRUE ) {} 388 QSplitterData() : opaque( FALSE ), firstShow( TRUE ) {}
379 389
380 QPtrList<QSplitterLayoutStruct> list; 390 Q3PtrList<QSplitterLayoutStruct> list;
381 bool opaque; 391 bool opaque;
382 bool firstShow; 392 bool firstShow;
383}; 393};
384 394
385void kdganttGeomCalc( QMemArray<QLayoutStruct> &chain, int start, int count, int pos, 395void kdganttGeomCalc( Q3MemArray<QLayoutStruct> &chain, int start, int count, int pos,
386 int space, int spacer ); 396 int space, int spacer );
387#endif // DOXYGEN_SKIP_INTERNAL 397#endif // DOXYGEN_SKIP_INTERNAL
388 398
389 399
390/*! 400/*!
391 \class KDGanttMinimizeSplitter KDGanttMinimizeSplitter.h 401 \class KDGanttMinimizeSplitter KDGanttMinimizeSplitter.h
@@ -458,30 +468,31 @@ static QSize minSizeHint( const QWidget* w )
458 468
459/*! 469/*!
460 Constructs a horizontal splitter with the \a parent and \a 470 Constructs a horizontal splitter with the \a parent and \a
461 name arguments being passed on to the QFrame constructor. 471 name arguments being passed on to the QFrame constructor.
462*/ 472*/
463KDGanttMinimizeSplitter::KDGanttMinimizeSplitter( QWidget *parent, const char *name ) 473KDGanttMinimizeSplitter::KDGanttMinimizeSplitter( QWidget *parent, const char *name )
464 :QFrame(parent,name,WPaintUnclipped) 474 :Q3Frame(parent,name)
465{ 475{
476 setAttribute(Qt::WA_PaintUnclipped);
466 mRubberBand = 0; 477 mRubberBand = 0;
467 mFirstHandle = 0; 478 mFirstHandle = 0;
468#if QT_VERSION >= 232 479#if QT_VERSION >= 232
469 orient = Horizontal; 480 orient = Qt::Horizontal;
470 init(); 481 init();
471#endif 482#endif
472} 483}
473 484
474/*! 485/*!
475 Constructs a splitter with orientation \a o with the \a parent 486 Constructs a splitter with orientation \a o with the \a parent
476 and \a name arguments being passed on to the QFrame constructor. 487 and \a name arguments being passed on to the QFrame constructor.
477*/ 488*/
478KDGanttMinimizeSplitter::KDGanttMinimizeSplitter( Orientation o, QWidget *parent, const char *name ) 489KDGanttMinimizeSplitter::KDGanttMinimizeSplitter( Qt::Orientation o, QWidget *parent, const char *name )
479 :QFrame(parent,name,WPaintUnclipped) 490 :Q3Frame(parent,name)
480{ 491{
481 492 setAttribute(Qt::WA_PaintUnclipped);
482 mRubberBand = 0; 493 mRubberBand = 0;
483 mFirstHandle = 0; 494 mFirstHandle = 0;
484#if QT_VERSION >= 232 495#if QT_VERSION >= 232
485 orient = o; 496 orient = o;
486 init(); 497 init();
487#endif 498#endif
@@ -502,13 +513,13 @@ KDGanttMinimizeSplitter::~KDGanttMinimizeSplitter()
502 513
503 514
504#if QT_VERSION >= 232 515#if QT_VERSION >= 232
505void KDGanttMinimizeSplitter::init() 516void KDGanttMinimizeSplitter::init()
506{ 517{
507 data = new QSplitterData; 518 data = new QSplitterData;
508 if ( orient == Horizontal ) 519 if ( orient == Qt::Horizontal )
509 setSizePolicy( QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum) ); 520 setSizePolicy( QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum) );
510 else 521 else
511 setSizePolicy( QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Expanding) ); 522 setSizePolicy( QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Expanding) );
512#ifndef DESKTOP_VERSION 523#ifndef DESKTOP_VERSION
513 setOpaqueResize( false ); 524 setOpaqueResize( false );
514#else 525#else
@@ -531,20 +542,20 @@ void KDGanttMinimizeSplitter::toggle()
531/*! 542/*!
532 \brief the orientation of the splitter 543 \brief the orientation of the splitter
533 544
534 By default the orientation is horizontal (the widgets are side by side). 545 By default the orientation is horizontal (the widgets are side by side).
535 The possible orientations are Qt:Vertical and Qt::Horizontal (the default). 546 The possible orientations are Qt:Vertical and Qt::Horizontal (the default).
536*/ 547*/
537void KDGanttMinimizeSplitter::setOrientation( Orientation o ) 548void KDGanttMinimizeSplitter::setOrientation( Qt::Orientation o )
538{ 549{
539#if QT_VERSION >= 232 550#if QT_VERSION >= 232
540 if ( orient == o ) 551 if ( orient == o )
541 return; 552 return;
542 orient = o; 553 orient = o;
543 554
544 if ( orient == Horizontal ) 555 if ( orient == Qt::Horizontal )
545 setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); 556 setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
546 else 557 else
547 setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ) ); 558 setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ) );
548 559
549 QSplitterLayoutStruct *s = data->list.first(); 560 QSplitterLayoutStruct *s = data->list.first();
550 while ( s ) { 561 while ( s ) {
@@ -583,27 +594,27 @@ QSplitterLayoutStruct *KDGanttMinimizeSplitter::addWidget( QWidget *w, bool firs
583 if ( data->list.count() > 0 ) { 594 if ( data->list.count() > 0 ) {
584 s = new QSplitterLayoutStruct; 595 s = new QSplitterLayoutStruct;
585 s->mode = KeepSize; 596 s->mode = KeepSize;
586 QString tmp = "qt_splithandle_"; 597 QString tmp = "qt_splithandle_";
587 tmp += w->name(); 598 tmp += w->name();
588 newHandle = new KDGanttSplitterHandle( orientation(), this, tmp.latin1() ); 599 newHandle = new KDGanttSplitterHandle( orientation(), this, tmp.latin1() );
589 if ( ! mFirstHandle ) 600 if ( ! mFirstHandle )
590 mFirstHandle = newHandle; 601 mFirstHandle = newHandle;
591 s->wid = newHandle; 602 s->wid = newHandle;
592 newHandle->setId(data->list.count()); 603 newHandle->setId(data->list.count());
593 s->isSplitter = TRUE; 604 s->isSplitter = TRUE;
594 s->sizer = pick( newHandle->sizeHint() ); 605 s->sizer = pick( newHandle->sizeHint() );
595 if ( first ) 606 if ( first )
596 data->list.insert( 0, s ); 607 data->list.insert( 0, s );
597 else 608 else
598 data->list.append( s ); 609 data->list.append( s );
599 } 610 }
600 s = new QSplitterLayoutStruct; 611 s = new QSplitterLayoutStruct;
601 s->mode = Stretch; 612 s->mode = Stretch;
602 s->wid = w; 613 s->wid = w;
603 if ( !testWState( WState_Resized ) && w->sizeHint().isValid() ) 614 if ( !testAttribute( Qt::WA_Resized ) && w->sizeHint().isValid() )
604 s->sizer = pick( w->sizeHint() ); 615 s->sizer = pick( w->sizeHint() );
605 else 616 else
606 s->sizer = pick( w->size() ); 617 s->sizer = pick( w->size() );
607 s->isSplitter = FALSE; 618 s->isSplitter = FALSE;
608 if ( first ) 619 if ( first )
609 data->list.insert( 0, s ); 620 data->list.insert( 0, s );
@@ -618,26 +629,32 @@ QSplitterLayoutStruct *KDGanttMinimizeSplitter::addWidget( QWidget *w, bool firs
618/*! 629/*!
619 Tells the splitter that a child widget has been inserted or removed. 630 Tells the splitter that a child widget has been inserted or removed.
620 The event is passed in \a c. 631 The event is passed in \a c.
621*/ 632*/
622void KDGanttMinimizeSplitter::childEvent( QChildEvent *c ) 633void KDGanttMinimizeSplitter::childEvent( QChildEvent *c )
623{ 634{
624 if ( c->type() == QEvent::ChildInserted ) { 635 if ( c->type() == QEvent::ChildAdded ) {
625 if ( !c->child()->isWidgetType() ) 636 if ( !c->child()->isWidgetType() )
626 return; 637 return;
627 638
628 if ( ((QWidget*)c->child())->testWFlags( WType_TopLevel ) ) 639 QWidget *cw = (QWidget*)c->child();
640
641 if ( (cw->windowFlags())&Qt::Window )
642 return;
643
644 // avoid infinite recursion
645 if(cw->objectName().startsWith("qt_splithandle_"))
629 return; 646 return;
630 647
631 QSplitterLayoutStruct *s = data->list.first(); 648 QSplitterLayoutStruct *s = data->list.first();
632 while ( s ) { 649 while ( s ) {
633 if ( s->wid == c->child() ) 650 if ( s->wid == cw )
634 return; 651 return;
635 s = data->list.next(); 652 s = data->list.next();
636 } 653 }
637 addWidget( (QWidget*)c->child() ); 654 addWidget( cw );
638 recalc( isVisible() ); 655 recalc( isVisible() );
639 656
640 } else if ( c->type() == QEvent::ChildRemoved ) { 657 } else if ( c->type() == QEvent::ChildRemoved ) {
641 QSplitterLayoutStruct *p = 0; 658 QSplitterLayoutStruct *p = 0;
642 if ( data->list.count() > 1 ) 659 if ( data->list.count() > 1 )
643 p = data->list.at(1); //remove handle _after_ first widget. 660 p = data->list.at(1); //remove handle _after_ first widget.
@@ -667,23 +684,23 @@ void KDGanttMinimizeSplitter::childEvent( QChildEvent *c )
667 rubber band is removed. 684 rubber band is removed.
668*/ 685*/
669void KDGanttMinimizeSplitter::setRubberband( int p ) 686void KDGanttMinimizeSplitter::setRubberband( int p )
670{ 687{
671#ifdef DESKTOP_VERSION 688#ifdef DESKTOP_VERSION
672 QPainter paint( this ); 689 QPainter paint( this );
673 paint.setPen( gray ); 690 paint.setPen( Qt::gray );
674 paint.setBrush( gray ); 691 paint.setBrush( Qt::gray );
675 paint.setRasterOp( XorROP ); 692 paint.setCompositionMode( QPainter::CompositionMode_Xor );
676 QRect r = contentsRect(); 693 QRect r = contentsRect();
677 const int rBord = 3; //Themable???? 694 const int rBord = 3; //Themable????
678#if QT_VERSION >= 0x030000 695#if QT_VERSION >= 0x030000
679 int sw = style().pixelMetric(QStyle::PM_SplitterWidth, this); 696 int sw = style()->pixelMetric(QStyle::PM_SplitterWidth, 0, this);
680#else 697#else
681 int sw = style().splitterWidth(); 698 int sw = style().splitterWidth();
682#endif 699#endif
683 if ( orient == Horizontal ) { 700 if ( orient == Qt::Horizontal ) {
684 if ( opaqueOldPos >= 0 ) 701 if ( opaqueOldPos >= 0 )
685 paint.drawRect( opaqueOldPos + sw/2 - rBord , r.y(), 702 paint.drawRect( opaqueOldPos + sw/2 - rBord , r.y(),
686 2*rBord, r.height() ); 703 2*rBord, r.height() );
687 if ( p >= 0 ) 704 if ( p >= 0 )
688 paint.drawRect( p + sw/2 - rBord, r.y(), 2*rBord, r.height() ); 705 paint.drawRect( p + sw/2 - rBord, r.y(), 2*rBord, r.height() );
689 } else { 706 } else {
@@ -693,13 +710,13 @@ void KDGanttMinimizeSplitter::setRubberband( int p )
693 if ( p >= 0 ) 710 if ( p >= 0 )
694 paint.drawRect( r.x(), p + sw/2 - rBord, r.width(), 2*rBord ); 711 paint.drawRect( r.x(), p + sw/2 - rBord, r.width(), 2*rBord );
695 } 712 }
696 opaqueOldPos = p; 713 opaqueOldPos = p;
697#else 714#else
698 if ( !mRubberBand ) { 715 if ( !mRubberBand ) {
699 mRubberBand = new KDRubberBand( 0, "rubber", WStyle_NoBorder | WStyle_Customize | WStyle_StaysOnTop); 716 mRubberBand = new KDRubberBand( 0, "rubber", Qt::WStyle_NoBorder | Qt::WStyle_Customize | Qt::WStyle_StaysOnTop);
700 mRubberBand->setFrameStyle( Box | Raised ); 717 mRubberBand->setFrameStyle( Box | Raised );
701 //mRubberBand->setPalette( QPalette ( Qt::red.light(),Qt::red.dark() ) ); 718 //mRubberBand->setPalette( QPalette ( Qt::red.light(),Qt::red.dark() ) );
702 mRubberBand->setPalette( QPalette ( colorGroup().background().light(), colorGroup().background().dark() )); 719 mRubberBand->setPalette( QPalette ( colorGroup().background().light(), colorGroup().background().dark() ));
703 } 720 }
704 QRect r = contentsRect(); 721 QRect r = contentsRect();
705 static int rBord = 0; //Themable???? 722 static int rBord = 0; //Themable????
@@ -707,13 +724,13 @@ void KDGanttMinimizeSplitter::setRubberband( int p )
707 if (QApplication::desktop()->width() <= 320 ) 724 if (QApplication::desktop()->width() <= 320 )
708 rBord = 3; 725 rBord = 3;
709 else 726 else
710 rBord = 4; 727 rBord = 4;
711 } 728 }
712 int sw = style().splitterWidth(); 729 int sw = style().splitterWidth();
713 if ( orient == Horizontal ) { 730 if ( orient == Qt::Horizontal ) {
714 if ( p >= 0 ) { 731 if ( p >= 0 ) {
715 QPoint geo = mapToGlobal (QPoint ( p + sw/2 - rBord, r.y())); 732 QPoint geo = mapToGlobal (QPoint ( p + sw/2 - rBord, r.y()));
716 mRubberBand->setGeometry( geo.x(), geo.y(), 2*rBord, r.height() ); 733 mRubberBand->setGeometry( geo.x(), geo.y(), 2*rBord, r.height() );
717 } 734 }
718 } else { 735 } else {
719 if ( p >= 0 ) { 736 if ( p >= 0 ) {
@@ -729,13 +746,13 @@ void KDGanttMinimizeSplitter::setRubberband( int p )
729} 746}
730 747
731 748
732/*! \reimp */ 749/*! \reimp */
733bool KDGanttMinimizeSplitter::event( QEvent *e ) 750bool KDGanttMinimizeSplitter::event( QEvent *e )
734{ 751{
735 if ( e->type() == QEvent::LayoutHint || ( e->type() == QEvent::Show && data->firstShow ) ) { 752 if ( e->type() == QEvent::LayoutRequest || ( e->type() == QEvent::Show && data->firstShow ) ) {
736 recalc( isVisible() ); 753 recalc( isVisible() );
737 if ( e->type() == QEvent::Show ) 754 if ( e->type() == QEvent::Show )
738 data->firstShow = FALSE; 755 data->firstShow = FALSE;
739 } 756 }
740 return QWidget::event( e ); 757 return QWidget::event( e );
741} 758}
@@ -752,13 +769,13 @@ void KDGanttMinimizeSplitter::drawSplitter( QPainter *p,
752 QCOORD x, QCOORD y, QCOORD w, QCOORD h ) 769 QCOORD x, QCOORD y, QCOORD w, QCOORD h )
753{ 770{
754#if 0 771#if 0
755 // LR 772 // LR
756 style().drawPrimitive(QStyle::PE_Splitter, p, QRect(x, y, w, h), colorGroup(), 773 style().drawPrimitive(QStyle::PE_Splitter, p, QRect(x, y, w, h), colorGroup(),
757 (orientation() == Qt::Horizontal ? 774 (orientation() == Qt::Horizontal ?
758 QStyle::Style_Horizontal : 0)); 775 QStyle::State_Horizontal : 0));
759#endif 776#endif
760} 777}
761 778
762 779
763/*! 780/*!
764 Returns the id of the splitter to the right of or below the widget \a w, 781 Returns the id of the splitter to the right of or below the widget \a w,
@@ -793,15 +810,15 @@ int KDGanttMinimizeSplitter::idAfter( QWidget* w ) const
793 \sa idAfter() 810 \sa idAfter()
794*/ 811*/
795void KDGanttMinimizeSplitter::moveSplitter( QCOORD p, int id ) 812void KDGanttMinimizeSplitter::moveSplitter( QCOORD p, int id )
796{ 813{
797 p = adjustPos( p, id ); 814 p = adjustPos( p, id );
798 QSplitterLayoutStruct *s = data->list.at(id); 815 QSplitterLayoutStruct *s = data->list.at(id);
799 int oldP = orient == Horizontal ? s->wid->x() : s->wid->y(); 816 int oldP = orient == Qt::Horizontal ? s->wid->x() : s->wid->y();
800 bool upLeft; 817 bool upLeft;
801 if ( false && orient == Horizontal ) { 818 if ( false && orient == Qt::Horizontal ) {
802 p += s->wid->width(); 819 p += s->wid->width();
803 upLeft = p > oldP; 820 upLeft = p > oldP;
804 } else 821 } else
805 upLeft = p < oldP; 822 upLeft = p < oldP;
806 823
807 moveAfter( p, id, upLeft ); 824 moveAfter( p, id, upLeft );
@@ -810,14 +827,14 @@ void KDGanttMinimizeSplitter::moveSplitter( QCOORD p, int id )
810 storeSizes(); 827 storeSizes();
811} 828}
812 829
813 830
814void KDGanttMinimizeSplitter::setG( QWidget *w, int p, int s, bool isSplitter ) 831void KDGanttMinimizeSplitter::setG( QWidget *w, int p, int s, bool isSplitter )
815{ 832{
816 if ( orient == Horizontal ) { 833 if ( orient == Qt::Horizontal ) {
817 if ( false && orient == Horizontal && !isSplitter ) 834 if ( false && orient == Qt::Horizontal && !isSplitter )
818 p = contentsRect().width() - p - s; 835 p = contentsRect().width() - p - s;
819 w->setGeometry( p, contentsRect().y(), s, contentsRect().height() ); 836 w->setGeometry( p, contentsRect().y(), s, contentsRect().height() );
820 } else 837 } else
821 w->setGeometry( contentsRect().x(), p, contentsRect().width(), s ); 838 w->setGeometry( contentsRect().x(), p, contentsRect().width(), s );
822} 839}
823 840
@@ -837,13 +854,13 @@ void KDGanttMinimizeSplitter::moveBefore( int pos, int id, bool upLeft )
837 QWidget *w = s->wid; 854 QWidget *w = s->wid;
838 if ( w->isHidden() ) { 855 if ( w->isHidden() ) {
839 moveBefore( pos, id-1, upLeft ); 856 moveBefore( pos, id-1, upLeft );
840 } else if ( s->isSplitter ) { 857 } else if ( s->isSplitter ) {
841 int pos1, pos2; 858 int pos1, pos2;
842 int dd = s->sizer; 859 int dd = s->sizer;
843 if( false && orient == Horizontal ) { 860 if( false && orient == Qt::Horizontal ) {
844 pos1 = pos; 861 pos1 = pos;
845 pos2 = pos + dd; 862 pos2 = pos + dd;
846 } else { 863 } else {
847 pos2 = pos - dd; 864 pos2 = pos - dd;
848 pos1 = pos2 + 1; 865 pos1 = pos2 + 1;
849 } 866 }
@@ -853,13 +870,13 @@ void KDGanttMinimizeSplitter::moveBefore( int pos, int id, bool upLeft )
853 } else { 870 } else {
854 moveBefore( pos2, id-1, upLeft ); 871 moveBefore( pos2, id-1, upLeft );
855 setG( w, pos1, dd, TRUE ); 872 setG( w, pos1, dd, TRUE );
856 } 873 }
857 } else { 874 } else {
858 int dd, newLeft, nextPos; 875 int dd, newLeft, nextPos;
859 if( false && orient == Horizontal ) { 876 if( false && orient == Qt::Horizontal ) {
860 dd = w->geometry().right() - pos; 877 dd = w->geometry().right() - pos;
861 dd = QMAX( pick(minSize(w)), QMIN(dd, pick(w->maximumSize()))); 878 dd = QMAX( pick(minSize(w)), QMIN(dd, pick(w->maximumSize())));
862 newLeft = pos+1; 879 newLeft = pos+1;
863 nextPos = newLeft + dd; 880 nextPos = newLeft + dd;
864 } else { 881 } else {
865 dd = pos - pick( w->pos() ) + 1; 882 dd = pos - pick( w->pos() ) + 1;
@@ -890,13 +907,13 @@ void KDGanttMinimizeSplitter::moveAfter( int pos, int id, bool upLeft )
890 } else if ( pick( w->pos() ) == pos ) { 907 } else if ( pick( w->pos() ) == pos ) {
891 //No need to do anything if it's already there. 908 //No need to do anything if it's already there.
892 return; 909 return;
893 } else if ( s->isSplitter ) { 910 } else if ( s->isSplitter ) {
894 int dd = s->sizer; 911 int dd = s->sizer;
895 int pos1, pos2; 912 int pos1, pos2;
896 if( false && orient == Horizontal ) { 913 if( false && orient == Qt::Horizontal ) {
897 pos2 = pos - dd; 914 pos2 = pos - dd;
898 pos1 = pos2 + 1; 915 pos1 = pos2 + 1;
899 } else { 916 } else {
900 pos1 = pos; 917 pos1 = pos;
901 pos2 = pos + dd; 918 pos2 = pos + dd;
902 } 919 }
@@ -907,13 +924,13 @@ void KDGanttMinimizeSplitter::moveAfter( int pos, int id, bool upLeft )
907 moveAfter( pos2, id+1, upLeft ); 924 moveAfter( pos2, id+1, upLeft );
908 setG( w, pos1, dd, TRUE ); 925 setG( w, pos1, dd, TRUE );
909 } 926 }
910 } else { 927 } else {
911 int left = pick( w->pos() ); 928 int left = pick( w->pos() );
912 int right, dd,/* newRight,*/ newLeft, nextPos; 929 int right, dd,/* newRight,*/ newLeft, nextPos;
913 if ( false && orient == Horizontal ) { 930 if ( false && orient == Qt::Horizontal ) {
914 dd = pos - left + 1; 931 dd = pos - left + 1;
915 dd = QMAX( pick(minSize(w)), QMIN(dd, pick(w->maximumSize()))); 932 dd = QMAX( pick(minSize(w)), QMIN(dd, pick(w->maximumSize())));
916 newLeft = pos-dd+1; 933 newLeft = pos-dd+1;
917 nextPos = newLeft - 1; 934 nextPos = newLeft - 1;
918 } else { 935 } else {
919 right = pick( w->geometry().bottomRight() ); 936 right = pick( w->geometry().bottomRight() );
@@ -985,15 +1002,15 @@ void KDGanttMinimizeSplitter::getRange( int id, int *min, int *max )
985 } else { 1002 } else {
986 minA += pick( minSize(s->wid) ); 1003 minA += pick( minSize(s->wid) );
987 maxA += pick( s->wid->maximumSize() ); 1004 maxA += pick( s->wid->maximumSize() );
988 } 1005 }
989 } 1006 }
990 QRect r = contentsRect(); 1007 QRect r = contentsRect();
991 if ( orient == Horizontal && false ) { 1008 if ( orient == Qt::Horizontal && false ) {
992#if QT_VERSION >= 0x030000 1009#if QT_VERSION >= 0x030000
993 int splitterWidth = style().pixelMetric(QStyle::PM_SplitterWidth, this); 1010 int splitterWidth = style()->pixelMetric(QStyle::PM_SplitterWidth, 0,this);
994#else 1011#else
995 int splitterWidth = style().splitterWidth(); 1012 int splitterWidth = style().splitterWidth();
996#endif 1013#endif
997 1014
998 if ( min ) 1015 if ( min )
999 *min = pick(r.topRight()) - QMIN( maxB, pick(r.size())-minA ) - splitterWidth; 1016 *min = pick(r.topRight()) - QMIN( maxB, pick(r.size())-minA ) - splitterWidth;
@@ -1027,13 +1044,13 @@ int KDGanttMinimizeSplitter::adjustPos( int p, int id )
1027 1044
1028void KDGanttMinimizeSplitter::doResize() 1045void KDGanttMinimizeSplitter::doResize()
1029{ 1046{
1030 QRect r = contentsRect(); 1047 QRect r = contentsRect();
1031 int i; 1048 int i;
1032 int n = data->list.count(); 1049 int n = data->list.count();
1033 QMemArray<QLayoutStruct> a( n ); 1050 Q3MemArray<QLayoutStruct> a( n );
1034 for ( i = 0; i< n; i++ ) { 1051 for ( i = 0; i< n; i++ ) {
1035 a[i].init(); 1052 a[i].init();
1036 QSplitterLayoutStruct *s = data->list.at(i); 1053 QSplitterLayoutStruct *s = data->list.at(i);
1037 if ( s->wid->isHidden() ) { 1054 if ( s->wid->isHidden() ) {
1038 a[i].stretch = 0; 1055 a[i].stretch = 0;
1039 a[i].sizeHint = a[i].minimumSize = 0; 1056 a[i].sizeHint = a[i].minimumSize = 0;
@@ -1129,13 +1146,13 @@ void KDGanttMinimizeSplitter::recalc( bool update )
1129 } else { 1146 } else {
1130 maxl = QMIN( maxl, QWIDGETSIZE_MAX ); 1147 maxl = QMIN( maxl, QWIDGETSIZE_MAX );
1131 } 1148 }
1132 if ( maxt < mint ) 1149 if ( maxt < mint )
1133 maxt = mint; 1150 maxt = mint;
1134 1151
1135 if ( orient == Horizontal ) { 1152 if ( orient == Qt::Horizontal ) {
1136 setMaximumSize( maxl, maxt ); 1153 setMaximumSize( maxl, maxt );
1137 setMinimumSize( minl, mint ); 1154 setMinimumSize( minl, mint );
1138 } else { 1155 } else {
1139 setMaximumSize( maxt, maxl ); 1156 setMaximumSize( maxt, maxl );
1140 setMinimumSize( mint, minl ); 1157 setMinimumSize( mint, minl );
1141 } 1158 }
@@ -1264,60 +1281,54 @@ void KDGanttMinimizeSplitter::recalcId()
1264*/ 1281*/
1265QSize KDGanttMinimizeSplitter::sizeHint() const 1282QSize KDGanttMinimizeSplitter::sizeHint() const
1266{ 1283{
1267 constPolish(); 1284 constPolish();
1268 int l = 0; 1285 int l = 0;
1269 int t = 0; 1286 int t = 0;
1270 if ( children() ) { 1287 if ( !children().empty() ) {
1271 const QObjectList * c = children(); 1288 const QObjectList c = children();
1272 QObjectListIt it( *c ); 1289 for(QObjectList::const_iterator i=c.begin();i!=c.end();++i) {
1273 QObject * o; 1290 QObject * o = *i;
1274
1275 while( (o=it.current()) != 0 ) {
1276 ++it;
1277 if ( o->isWidgetType() && 1291 if ( o->isWidgetType() &&
1278 !((QWidget*)o)->isHidden() ) { 1292 !((QWidget*)o)->isHidden() ) {
1279 QSize s = ((QWidget*)o)->sizeHint(); 1293 QSize s = ((QWidget*)o)->sizeHint();
1280 if ( s.isValid() ) { 1294 if ( s.isValid() ) {
1281 l += pick( s ); 1295 l += pick( s );
1282 t = QMAX( t, trans( s ) ); 1296 t = QMAX( t, trans( s ) );
1283 } 1297 }
1284 } 1298 }
1285 } 1299 }
1286 } 1300 }
1287 return orientation() == Horizontal ? QSize( l, t ) : QSize( t, l ); 1301 return orientation() == Qt::Horizontal ? QSize( l, t ) : QSize( t, l );
1288} 1302}
1289 1303
1290 1304
1291/*! 1305/*!
1292\reimp 1306\reimp
1293*/ 1307*/
1294 1308
1295QSize KDGanttMinimizeSplitter::minimumSizeHint() const 1309QSize KDGanttMinimizeSplitter::minimumSizeHint() const
1296{ 1310{
1297 constPolish(); 1311 constPolish();
1298 int l = 0; 1312 int l = 0;
1299 int t = 0; 1313 int t = 0;
1300 if ( children() ) { 1314 if ( !children().empty() ) {
1301 const QObjectList * c = children(); 1315 const QObjectList c = children();
1302 QObjectListIt it( *c ); 1316 for(QObjectList::const_iterator i=c.begin();i!=c.end();++i) {
1303 QObject * o; 1317 QObject * o = *i;
1304
1305 while( (o=it.current()) != 0 ) {
1306 ++it;
1307 if ( o->isWidgetType() && 1318 if ( o->isWidgetType() &&
1308 !((QWidget*)o)->isHidden() ) { 1319 !((QWidget*)o)->isHidden() ) {
1309 QSize s = minSizeHint((QWidget*)o); 1320 QSize s = minSizeHint((QWidget*)o);
1310 if ( s.isValid() ) { 1321 if ( s.isValid() ) {
1311 l += pick( s ); 1322 l += pick( s );
1312 t = QMAX( t, trans( s ) ); 1323 t = QMAX( t, trans( s ) );
1313 } 1324 }
1314 } 1325 }
1315 } 1326 }
1316 } 1327 }
1317 return orientation() == Horizontal ? QSize( l, t ) : QSize( t, l ); 1328 return orientation() == Qt::Horizontal ? QSize( l, t ) : QSize( t, l );
1318} 1329}
1319 1330
1320 1331
1321/* 1332/*
1322 Calculates stretch parameters from current sizes 1333 Calculates stretch parameters from current sizes
1323*/ 1334*/
@@ -1399,19 +1410,20 @@ bool KDGanttMinimizeSplitter::isHidden( QWidget *w ) const
1399 } 1410 }
1400 \endcode 1411 \endcode
1401 1412
1402 \sa setSizes() 1413 \sa setSizes()
1403*/ 1414*/
1404 1415
1405QValueList<int> KDGanttMinimizeSplitter::sizes() const 1416Q3ValueList<int> KDGanttMinimizeSplitter::sizes() const
1406{ 1417{
1418 /* TODO: hacker
1407 if ( !testWState(WState_Polished) ) { 1419 if ( !testWState(WState_Polished) ) {
1408 QWidget* that = (QWidget*) this; 1420 QWidget* that = (QWidget*) this;
1409 that->polish(); 1421 that->polish();
1410 } 1422 } */
1411 QValueList<int> list; 1423 Q3ValueList<int> list;
1412 QSplitterLayoutStruct *s = data->list.first(); 1424 QSplitterLayoutStruct *s = data->list.first();
1413 while ( s ) { 1425 while ( s ) {
1414 if ( !s->isSplitter ) 1426 if ( !s->isSplitter )
1415 list.append( s->sizer ); 1427 list.append( s->sizer );
1416 s = data->list.next(); 1428 s = data->list.next();
1417 } 1429 }
@@ -1430,16 +1442,16 @@ QValueList<int> KDGanttMinimizeSplitter::sizes() const
1430 If \a list contains too few values, the result is undefined 1442 If \a list contains too few values, the result is undefined
1431 but the program will still be well-behaved. 1443 but the program will still be well-behaved.
1432 1444
1433 \sa sizes() 1445 \sa sizes()
1434*/ 1446*/
1435 1447
1436void KDGanttMinimizeSplitter::setSizes( QValueList<int> list ) 1448void KDGanttMinimizeSplitter::setSizes( Q3ValueList<int> list )
1437{ 1449{
1438 processChildEvents(); 1450 processChildEvents();
1439 QValueList<int>::Iterator it = list.begin(); 1451 Q3ValueList<int>::Iterator it = list.begin();
1440 QSplitterLayoutStruct *s = data->list.first(); 1452 QSplitterLayoutStruct *s = data->list.first();
1441 while ( s && it != list.end() ) { 1453 while ( s && it != list.end() ) {
1442 if ( !s->isSplitter ) { 1454 if ( !s->isSplitter ) {
1443 s->sizer = *it; 1455 s->sizer = *it;
1444 ++it; 1456 ++it;
1445 } 1457 }
@@ -1453,36 +1465,36 @@ void KDGanttMinimizeSplitter::setSizes( QValueList<int> list )
1453 Gets all posted child events, ensuring that the internal state of 1465 Gets all posted child events, ensuring that the internal state of
1454 the splitter is consistent. 1466 the splitter is consistent.
1455*/ 1467*/
1456 1468
1457void KDGanttMinimizeSplitter::processChildEvents() 1469void KDGanttMinimizeSplitter::processChildEvents()
1458{ 1470{
1459 QApplication::sendPostedEvents( this, QEvent::ChildInserted ); 1471 QApplication::sendPostedEvents( this, QEvent::ChildAdded );
1460} 1472}
1461 1473
1462 1474
1463/*! 1475/*!
1464 \reimp 1476 \reimp
1465*/ 1477*/
1466 1478
1467void KDGanttMinimizeSplitter::styleChange( QStyle& old ) 1479void KDGanttMinimizeSplitter::styleChange( QStyle& old )
1468{ 1480{
1469 1481
1470#if QT_VERSION >= 0x030000 1482#if QT_VERSION >= 0x030000
1471 int sw = style().pixelMetric(QStyle::PM_SplitterWidth, this); 1483 int sw = style()->pixelMetric(QStyle::PM_SplitterWidth, 0, this);
1472#else 1484#else
1473 int sw = style().splitterWidth(); 1485 int sw = style().splitterWidth();
1474#endif 1486#endif
1475 QSplitterLayoutStruct *s = data->list.first(); 1487 QSplitterLayoutStruct *s = data->list.first();
1476 while ( s ) { 1488 while ( s ) {
1477 if ( s->isSplitter ) 1489 if ( s->isSplitter )
1478 s->sizer = sw; 1490 s->sizer = sw;
1479 s = data->list.next(); 1491 s = data->list.next();
1480 } 1492 }
1481 doResize(); 1493 doResize();
1482 QFrame::styleChange( old ); 1494 Q3Frame::styleChange( old );
1483} 1495}
1484 1496
1485#endif 1497#endif
1486 1498
1487/*! 1499/*!
1488 Specifies the direction of the minimize buttons. 1500 Specifies the direction of the minimize buttons.
@@ -1509,13 +1521,13 @@ KDGanttMinimizeSplitter::Direction KDGanttMinimizeSplitter::minimizeDirection()
1509 unfortunately isn't exported. 1521 unfortunately isn't exported.
1510*/ 1522*/
1511static inline int toFixed( int i ) { return i * 256; } 1523static inline int toFixed( int i ) { return i * 256; }
1512static inline int fRound( int i ) { 1524static inline int fRound( int i ) {
1513 return ( i % 256 < 128 ) ? i / 256 : 1 + i / 256; 1525 return ( i % 256 < 128 ) ? i / 256 : 1 + i / 256;
1514} 1526}
1515void kdganttGeomCalc( QMemArray<QLayoutStruct> &chain, int start, int count, int pos, 1527void kdganttGeomCalc( Q3MemArray<QLayoutStruct> &chain, int start, int count, int pos,
1516 int space, int spacer ) 1528 int space, int spacer )
1517{ 1529{
1518 typedef int fixed; 1530 typedef int fixed;
1519 int cHint = 0; 1531 int cHint = 0;
1520 int cMin = 0; 1532 int cMin = 0;
1521 int cMax = 0; 1533 int cMax = 0;