summaryrefslogtreecommitdiffabout
path: root/korganizer/kodaymatrix.cpp
authorzautrix <zautrix>2005-04-01 14:41:00 (UTC)
committer zautrix <zautrix>2005-04-01 14:41:00 (UTC)
commite5ec0ef6a256b96a758815ef861526f53d1ad7a5 (patch) (side-by-side diff)
tree3fa188da9108c867c1437157731c7b7a3d4e641d /korganizer/kodaymatrix.cpp
parent93003b1f8348f112648d3cc20acb21b062220e21 (diff)
downloadkdepimpi-e5ec0ef6a256b96a758815ef861526f53d1ad7a5.zip
kdepimpi-e5ec0ef6a256b96a758815ef861526f53d1ad7a5.tar.gz
kdepimpi-e5ec0ef6a256b96a758815ef861526f53d1ad7a5.tar.bz2
fix
Diffstat (limited to 'korganizer/kodaymatrix.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/kodaymatrix.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index d543aaf..dfc6af7 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -101,24 +101,25 @@ void DynamicTip::maybeTip( const QPoint &pos )
const int KODayMatrix::NOSELECTION = -1000;
const int KODayMatrix::NUMDAYS = 42;
KODayMatrix::KODayMatrix( QWidget *parent, const char *name )
: QFrame( parent, name , Qt::WRepaintNoErase ), mCalendar( 0 )
#if 0
KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name) :
QFrame(parent, name)
#endif
{
+ mRedrawNeeded = true;
mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this);
mPendingUpdateBeforeRepaint = false;
mouseDown = false;
// initialize dynamic arrays
bDays.resize ( NUMDAYS );
hDays.resize ( NUMDAYS );;
eDays.resize ( NUMDAYS );;
days = new QDate[NUMDAYS];
daylbls = new QString[NUMDAYS];
//events = new int[NUMDAYS];
mToolTip = new DynamicTip(this);
@@ -377,24 +378,25 @@ void KODayMatrix::updateViewTimed()
}
}
if ( numEvents )
eDays.setBit(i);
//if it is a holy day then draw it red. Sundays are consider holidays, too
if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) ||
!holiStr.isEmpty()) {
mHolidays[i] = holiStr;
} else {
mHolidays[i] = QString::null;
}
}
+ mRedrawNeeded = true;
if ( ! mPendingUpdateBeforeRepaint )
repaint(false);
}
void KODayMatrix::updateView(QDate actdate)
{
if ( ! actdate.isValid() ) {
//qDebug("date not valid ");
return;
}
mDayChanged = false;
//flag to indicate if the starting day of the matrix has changed by this call
@@ -411,33 +413,34 @@ void KODayMatrix::updateView(QDate actdate)
if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) {
// nested if is required for next X display pushed from a different month - correction required
// otherwise, for month forward and backward, it must be avoided
if( mSelStart > NUMDAYS || mSelStart < 0 )
mSelStart = mSelStart + tmp;
if( mSelEnd > NUMDAYS || mSelEnd < 0 )
mSelEnd = mSelEnd + tmp;
}
}
startdate = actdate;
mDayChanged = true;
recalculateToday();
+ mRedrawNeeded = true;
}
//qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() );
if ( !isVisible() ) {
mPendingUpdateBeforeRepaint = true;
} else {
#ifdef DESKTOP_VERSION
//mRepaintTimer->start( 100 );
//updateViewTimed();
- mUpdateTimer->start( 20 );
+ mUpdateTimer->start( 50 );
#else
mRepaintTimer->start( 350 );
mUpdateTimer->start( 1200 );
#endif
}
}
void KODayMatrix::updateEvents()
{
if ( !mCalendar ) return;
for( int i = 0; i < NUMDAYS; i++ ) {
// if events are set for the day then remember to draw it bold
@@ -669,25 +672,29 @@ void KODayMatrix::dropEvent(QDropEvent *e)
void KODayMatrix::paintEvent(QPaintEvent * pevent)
{
if ( width() <= 0 || height() <= 0 )
return;
if ( mPendingUpdateBeforeRepaint ) {
updateViewTimed();
mPendingUpdateBeforeRepaint = false;
}
if ( myPix.width() != width() || myPix.height()!=height() ) {
myPix.resize(size() );
+ mRedrawNeeded = true;
}
+
+ if ( mRedrawNeeded ) {
+ //qDebug("REDRAW ");
QPainter p(&myPix);
p.setFont(font());
int dheight = daysize.height();
int dwidth = daysize.width();
int row,col;
int selw, selh;
int xyOff = frameWidth();
int colModulo = (width()-2) % 7;
int rowModulo = (height()-2) % 6;
//qDebug("col %d row %d ",colModulo,rowModulo );
@@ -918,27 +925,29 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent)
// reset color to actual color
if (!mHolidays[i].isNull()) {
p.setPen(actcol);
}
// reset bold font to plain font
if ( eDays.testBit(i)) {
QFont myFont = font();
myFont.setBold(false);
p.setFont(myFont);
}
}
- int off = 0;//xyOff;
- bitBlt (this, off, off, &myPix, 0 ,0,width(), height() ,CopyROP);
- //qDebug("ffffffffff %d ", off);
+ } else {
+ //qDebug("NO redraw ");
+ }
+ bitBlt (this, 0, 0, &myPix, 0 ,0,width(), height() ,CopyROP);
+ mRedrawNeeded = false;
}
// ----------------------------------------------------------------------------
// R E SI Z E E V E N T H A N D L I N G
// ----------------------------------------------------------------------------
void KODayMatrix::resizeEvent(QResizeEvent *)
{
QRect sz = frameRect();
daysize.setHeight(sz.height()*7 / NUMDAYS);
daysize.setWidth(sz.width() / 7);
}