summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp10
-rw-r--r--korganizer/koagendaview.h2
-rw-r--r--korganizer/kodaymatrix.cpp17
-rw-r--r--korganizer/kodaymatrix.h1
4 files changed, 26 insertions, 4 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 2996acb..218396d 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -76,18 +76,20 @@ extern int globalFlagBlockAgendaItemUpdate;
extern int globalFlagBlockLabel;
using namespace KOrg;
TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) :
QScrollView(parent,name,f)
{
+ myPix.resize( 1, 1 );
mRows = rows;
+ mRedrawNeeded = true;
setMinimumHeight( 20 );
mCellHeight = KOPrefs::instance()->mHourSize*4;
enableClipper(true);
setHScrollBarMode(AlwaysOff);
setVScrollBarMode(AlwaysOff);
@@ -111,16 +113,17 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch)
// if ( globalFlagBlockAgenda )
// return;
// bug: the parameters cx, cy, cw, ch are the areas that need to be
// redrawn, not the area of the widget. unfortunately, this
// code assumes the latter...
// now, for a workaround...
// these two assignments fix the weird redraw bug
+ if ( mRedrawNeeded ) {
cx = contentsX() + 2;
cw = contentsWidth() - 2;
// end of workaround
int cell = ((int)(cy/mCellHeight));
int y = cell * mCellHeight;
QFontMetrics fm = fontMetrics();
QString hour;
@@ -178,29 +181,36 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch)
p->setFont( sFont );
offset = startW - tw2-1;
p->drawText(cx - borderWidth + offset, y+ sHei, suffix);
// increment indices
y += mCellHeight;
cell++;
}
+ } else {
+ //qDebug("NO redraw ");
+ }
+ // double buffer not yet implemented
+ //bitBlt (this, 0, 0, &myPix, 0 ,0,width(), height() ,CopyROP);
+ //mRedrawNeeded = false;
}
/**
Calculates the minimum width.
*/
int TimeLabels::minimumWidth() const
{
return mMiniWidth;
}
/** updates widget's internal state */
void TimeLabels::updateConfig()
{
+ mRedrawNeeded = true;
// set the font
// config->setGroup("Fonts");
// QFont font = config->readFontEntry("TimeBar Font");
setFont(KOPrefs::instance()->mTimeBarFont);
QString test = "88:88";
if (KGlobal::locale()->use12Clock())
test += "i";
mMiniWidth = fontMetrics().width(test) + frameWidth()*2 +1 ;
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h
index 6dc81c6..30c9b05 100644
--- a/korganizer/koagendaview.h
+++ b/korganizer/koagendaview.h
@@ -96,16 +96,18 @@ class TimeLabels : public QScrollView {
/** update time label positions */
void positionChanged();
signals:
void scaleChanged();
protected:
void drawContents(QPainter *p,int cx, int cy, int cw, int ch);
private:
+ QPixmap myPix;
+ bool mRedrawNeeded;
int mMiniWidth;
int mMouseDownY;
QString mOrgCap;
int mRows;
int mCellHeight;
/** */
KOAgenda* mAgenda;
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index d543aaf..dfc6af7 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -105,16 +105,17 @@ 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];
@@ -381,16 +382,17 @@ void KODayMatrix::updateViewTimed()
//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 ");
@@ -415,25 +417,26 @@ void KODayMatrix::updateView(QDate actdate)
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()
{
@@ -673,17 +676,21 @@ 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;
@@ -922,19 +929,21 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent)
}
// 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 *)
{
diff --git a/korganizer/kodaymatrix.h b/korganizer/kodaymatrix.h
index 38a7f92..731117c 100644
--- a/korganizer/kodaymatrix.h
+++ b/korganizer/kodaymatrix.h
@@ -222,16 +222,17 @@ protected:
void dragLeaveEvent(QDragLeaveEvent *);
void dropEvent(QDropEvent *);
void resizeEvent(QResizeEvent *);
private:
+ bool mRedrawNeeded;
KODaymatrixWhatsThis* mKODaymatrixWhatsThis;
bool mouseDown;
QBitArray bDays;
QBitArray hDays;
QBitArray eDays;
QPixmap myPix;
QTimer* mUpdateTimer;
QTimer* mRepaintTimer;