author | zautrix <zautrix> | 2005-04-01 19:05:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-01 19:05:18 (UTC) |
commit | 1022d8763a5185c74d1fb1fba9857d6e3afd9ff5 (patch) (side-by-side diff) | |
tree | 116b7ac7aef10e27c20ce30f3bae548ebde84da0 | |
parent | edc032c21ae3788d02a632ea8066e4ac5a4feedb (diff) | |
download | kdepimpi-1022d8763a5185c74d1fb1fba9857d6e3afd9ff5.zip kdepimpi-1022d8763a5185c74d1fb1fba9857d6e3afd9ff5.tar.gz kdepimpi-1022d8763a5185c74d1fb1fba9857d6e3afd9ff5.tar.bz2 |
fixes
-rw-r--r-- | korganizer/koagendaview.cpp | 30 | ||||
-rw-r--r-- | korganizer/kodaymatrix.cpp | 4 |
2 files changed, 16 insertions, 18 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 072d464..99f547a 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -108,136 +108,132 @@ void TimeLabels::setCellHeight(int height) is redrawn. Unfortunately, this is not called by default paintEvent() method. */ 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 mRedrawNeeded = true; if ( mRedrawNeeded ) { cx = contentsX() + frameWidth()*2; cw = contentsWidth() ; // end of workaround int cell = ((int)(cy/mCellHeight)); int y = cell * mCellHeight; QFontMetrics fm = fontMetrics(); QString hour; QString suffix; - int tW = fm.width("24:00i"); - int timeHeight = fm.height(); - //timeHeight -= (timeHeight/4-2); - int borderWidth = 0; + int timeHeight = fm.ascent(); QFont nFont = p->font(); if (!KGlobal::locale()->use12Clock()) suffix = "00"; - else - borderWidth = 0; + if ( timeHeight > mCellHeight ) { timeHeight = mCellHeight-1; int pointS = nFont.pointSize(); while ( pointS > 4 ) { nFont.setPointSize( pointS ); fm = QFontMetrics( nFont ); - if ( fm.height() < mCellHeight ) + if ( fm.ascent() < mCellHeight ) break; -- pointS; } fm = QFontMetrics( nFont ); - borderWidth = 4; - timeHeight = fm.height(); + timeHeight = fm.ascent(); } //timeHeight -= (timeHeight/4-2); QFont sFont = nFont; - sFont.setPointSize( sFont.pointSize()/2+2 ); + sFont.setPointSize( sFont.pointSize()/2 ); QFontMetrics fmS( sFont ); - int sHei = fmS.height(); + int sHei = fmS.ascent() ; //sHei -= (sHei/4-2); - int startW = this->width() - frameWidth()-1; + int startW = this->width() - 2*frameWidth()-1; + int tw2 = fmS.width(suffix); while (y < cy + ch) { - p->drawLine(cx,y,cx+tW,y); + p->drawLine(cx,y,cw,y); hour.setNum(cell); // handle 24h and am/pm time formats if (KGlobal::locale()->use12Clock()) { if (cell > 11) suffix = "pm"; else suffix = "am"; if (cell == 0) hour.setNum(12); if (cell > 12) hour.setNum(cell - 12); + tw2 = fmS.width(suffix); } // center and draw the time label int timeWidth = fm.width(hour); - int tw2 = fm.width(suffix); int offset = startW - timeWidth - tw2 ; p->setFont( nFont ); p->drawText( offset, y+ timeHeight, hour); p->setFont( sFont ); offset = startW - tw2+1; p->drawText( 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"; + QString test = "20oo"; if (KGlobal::locale()->use12Clock()) - test += "i"; + test = "12mi"; mMiniWidth = fontMetrics().width(test) + frameWidth()*2 +1 ; // update geometry restrictions based on new settings - setFixedWidth(minimumWidth()); + setFixedWidth( mMiniWidth ); // update HourSize mCellHeight = KOPrefs::instance()->mHourSize*4; resizeContents(50,mRows * mCellHeight); } /** update time label positions */ void TimeLabels::positionChanged() { int adjustment = mAgenda->contentsY(); setContentsPos(0, adjustment); } /** */ void TimeLabels::setAgenda(KOAgenda* agenda) { mAgenda = agenda; } void TimeLabels::contentsMousePressEvent ( QMouseEvent * e) { mMouseDownY = e->pos().y(); mOrgCap = topLevelWidget()->caption(); } diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index c55f7d7..5b5703f 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp @@ -856,49 +856,51 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) } else { mTodayPen.setColor(mHolidayColorShaded); } } //draw gray rectangle for today if in selection if (i >= mSelStartT && i <= mSelEndT) { QColor grey("grey"); mTodayPen.setColor(grey); } p.setPen(mTodayPen); int addCol = 0; int addRow = 0; if (rowModulo) { if ( row >= 6 - rowModulo ) addRow = row - 5 + rowModulo; } if ( colModulo ) { if ( col >= 7 - colModulo ) addCol = col - 6 + colModulo-1; } addCol += 1; - p.drawRect(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight+1); + if ( row == 0 ) + addRow = 1; + p.drawRect(col*dwidth+addCol, row*dheight+addRow, dwidth+1, dheight+1); p.setPen(tmppen); } // if any events are on that day then draw it using a bold font if ( eDays.testBit(i) ) { QFont myFont = font(); myFont.setBold(true); p.setFont(myFont); } // if it is a holiday then use the default holiday color if ( !mHolidays[i].isNull()) { if ( bDays.testBit(i) ) { if ( hDays.testBit(i) ) p.setPen(QColor(Qt::green)); else p.setPen(QColor(Qt::green).dark()); } else { if (actcol == mDefaultTextColor ) { p.setPen(KOPrefs::instance()->mHolidayColor); } else { p.setPen(mHolidayColorShaded); } } |