author | zautrix <zautrix> | 2005-07-04 21:06:02 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-04 21:06:02 (UTC) |
commit | 2767ffda27fa0e88816832d4b2c6efdd0c52a8eb (patch) (unidiff) | |
tree | 8194ee4b7019698d08d47892e428e254f45d5500 /korganizer | |
parent | 16898aecbedb978169efef1e1e0233578a42a46e (diff) | |
download | kdepimpi-2767ffda27fa0e88816832d4b2c6efdd0c52a8eb.zip kdepimpi-2767ffda27fa0e88816832d4b2c6efdd0c52a8eb.tar.gz kdepimpi-2767ffda27fa0e88816832d4b2c6efdd0c52a8eb.tar.bz2 |
highlight pix smaller
-rw-r--r-- | korganizer/koagenda.cpp | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 94c3b22..63fdecd 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -1259,74 +1259,92 @@ void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) | |||
1259 | mSelectionCellX * mGridSpacingX; | 1259 | mSelectionCellX * mGridSpacingX; |
1260 | contentsToViewport ( cx, cy, vx,vy); | 1260 | contentsToViewport ( cx, cy, vx,vy); |
1261 | //qDebug(" %d %d %d %d %d", cx, cy, cw,ch,mGridSpacingX-1) ; | 1261 | //qDebug(" %d %d %d %d %d", cx, cy, cw,ch,mGridSpacingX-1) ; |
1262 | 1262 | ||
1263 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) { | 1263 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) { |
1264 | if ( mGridSpacingX == cw && mSelectionHeight > 0 && ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && | 1264 | if ( mGridSpacingX == cw && mSelectionHeight > 0 && ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && |
1265 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) ) { | 1265 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) ) { |
1266 | 1266 | ||
1267 | int vxSel, vySel; | 1267 | int vxSel, vySel; |
1268 | contentsToViewport ( selectionX, mSelectionYTop, vxSel,vySel); | 1268 | contentsToViewport ( selectionX, mSelectionYTop, vxSel,vySel); |
1269 | int off = mSelectionHeight; | 1269 | int off = mSelectionHeight; |
1270 | if ( vySel < 0 ) | 1270 | if ( vySel < 0 ) |
1271 | off += vySel; | 1271 | off += vySel; |
1272 | //qDebug("OFF %d %d %d", off,vySel, vy ); | 1272 | //qDebug("OFF %d %d %d", off,vySel, vy ); |
1273 | bitBlt ( pd, vx, vy+off, &mPaintPixmap, cx, cy+off, cw , ch-off ,CopyROP); | 1273 | bitBlt ( pd, vx, vy+off, &mPaintPixmap, cx, cy+off, cw , ch-off ,CopyROP); |
1274 | } else { | 1274 | } else { |
1275 | bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); | 1275 | bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); |
1276 | } | 1276 | } |
1277 | } | 1277 | } |
1278 | if ( mSelectionHeight > 0 ) { | 1278 | if ( mSelectionHeight > 0 ) { |
1279 | //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); | 1279 | //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); |
1280 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && | 1280 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && |
1281 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { | 1281 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { |
1282 | contentsToViewport ( selectionX, mSelectionYTop, vx,vy); | 1282 | contentsToViewport ( selectionX, mSelectionYTop, vx,vy); |
1283 | bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); | 1283 | // bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); |
1284 | int hei = mSelectionHeight; | ||
1285 | int offset = 0; | ||
1286 | while ( hei > 0 ) { | ||
1287 | int p_hei = 5; | ||
1288 | if ( hei < 5 ) p_hei = hei; | ||
1289 | hei -= 5; | ||
1290 | bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,CopyROP); | ||
1291 | offset += 5; | ||
1292 | } | ||
1284 | } | 1293 | } |
1285 | } | 1294 | } |
1286 | p->begin( pd ); | 1295 | p->begin( pd ); |
1287 | } else { | 1296 | } else { |
1288 | 1297 | ||
1289 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) | 1298 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) |
1290 | ;//drawContentsToPainter(); | 1299 | ;//drawContentsToPainter(); |
1291 | 1300 | ||
1292 | QPaintDevice* pd = p->device(); | 1301 | QPaintDevice* pd = p->device(); |
1293 | p->end(); | 1302 | p->end(); |
1294 | int vx, vy; | 1303 | int vx, vy; |
1295 | int selectionX = KOGlobals::self()->reverseLayout() ? | 1304 | int selectionX = KOGlobals::self()->reverseLayout() ? |
1296 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : | 1305 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : |
1297 | mSelectionCellX * mGridSpacingX; | 1306 | mSelectionCellX * mGridSpacingX; |
1298 | contentsToViewport ( cx, cy, vx,vy); | 1307 | contentsToViewport ( cx, cy, vx,vy); |
1299 | // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ; | 1308 | // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ; |
1300 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) | 1309 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) |
1301 | bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); | 1310 | bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); |
1302 | 1311 | ||
1303 | if ( mSelectionHeight > 0 ) { | 1312 | if ( mSelectionHeight > 0 ) { |
1304 | //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); | 1313 | //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); |
1305 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && | 1314 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && |
1306 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { | 1315 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { |
1307 | contentsToViewport ( selectionX, mSelectionYTop, vx,vy); | 1316 | contentsToViewport ( selectionX, mSelectionYTop, vx,vy); |
1308 | bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); | 1317 | //bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); |
1318 | int hei = mSelectionHeight; | ||
1319 | int offset = 0; | ||
1320 | while ( hei > 0 ) { | ||
1321 | int p_hei = 5; | ||
1322 | if ( hei < 5 ) p_hei = hei; | ||
1323 | hei -= 5; | ||
1324 | bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,CopyROP); | ||
1325 | offset += 5; | ||
1326 | } | ||
1309 | } | 1327 | } |
1310 | } | 1328 | } |
1311 | p->begin( pd ); | 1329 | p->begin( pd ); |
1312 | } | 1330 | } |
1313 | 1331 | ||
1314 | } | 1332 | } |
1315 | 1333 | ||
1316 | void KOAgenda::finishUpdate() | 1334 | void KOAgenda::finishUpdate() |
1317 | { | 1335 | { |
1318 | 1336 | ||
1319 | KOAgendaItem *item; | 1337 | KOAgendaItem *item; |
1320 | globalFlagBlockAgendaItemPaint = 1; | 1338 | globalFlagBlockAgendaItemPaint = 1; |
1321 | // Adjust sub cell geometry of all conflict items of all conflict items of all conflict items ... of the conflict item with the max number of conflictitems | 1339 | // Adjust sub cell geometry of all conflict items of all conflict items of all conflict items ... of the conflict item with the max number of conflictitems |
1322 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1340 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1323 | if ( !item->checkLayout() ) { | 1341 | if ( !item->checkLayout() ) { |
1324 | //qDebug(" conflictitem found "); | 1342 | //qDebug(" conflictitem found "); |
1325 | int newSubCellWidth; | 1343 | int newSubCellWidth; |
1326 | if (mAllDayMode) newSubCellWidth = mGridSpacingY / item->subCells(); | 1344 | if (mAllDayMode) newSubCellWidth = mGridSpacingY / item->subCells(); |
1327 | else newSubCellWidth = mGridSpacingX / item->subCells(); | 1345 | else newSubCellWidth = mGridSpacingX / item->subCells(); |
1328 | 1346 | ||
1329 | if (mAllDayMode) { | 1347 | if (mAllDayMode) { |
1330 | item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth); | 1348 | item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth); |
1331 | } else { | 1349 | } else { |
1332 | item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); | 1350 | item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); |
@@ -1357,50 +1375,50 @@ void KOAgenda::finishUpdate() | |||
1357 | item->repaint( false ); | 1375 | item->repaint( false ); |
1358 | } | 1376 | } |
1359 | 1377 | ||
1360 | } | 1378 | } |
1361 | 1379 | ||
1362 | /* | 1380 | /* |
1363 | Draw grid in the background of the agenda. | 1381 | Draw grid in the background of the agenda. |
1364 | */ | 1382 | */ |
1365 | void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// int cx, int cy, int cw, int ch) | 1383 | void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// int cx, int cy, int cw, int ch) |
1366 | { | 1384 | { |
1367 | 1385 | ||
1368 | 1386 | ||
1369 | if ( ! mGridSpacingX || ! mGridSpacingY ||! mHolidayMask ) | 1387 | if ( ! mGridSpacingX || ! mGridSpacingY ||! mHolidayMask ) |
1370 | return; | 1388 | return; |
1371 | if ( globalFlagBlockAgenda > 1 && globalFlagBlockAgenda < 4 ) | 1389 | if ( globalFlagBlockAgenda > 1 && globalFlagBlockAgenda < 4 ) |
1372 | return; | 1390 | return; |
1373 | int cx = 0, cy = 0, cw = contentsWidth(), ch = contentsHeight(); | 1391 | int cx = 0, cy = 0, cw = contentsWidth(), ch = contentsHeight(); |
1374 | if ( ch < 1 ) | 1392 | if ( ch < 1 ) |
1375 | ch = 1; | 1393 | ch = 1; |
1376 | if ( mPaintPixmap.width() < contentsWidth()+42 || mPaintPixmap.height() < ch ) { | 1394 | if ( mPaintPixmap.width() < contentsWidth()+42 || mPaintPixmap.height() < ch ) { |
1377 | mPaintPixmap.resize( contentsWidth()+42, ch ); | 1395 | mPaintPixmap.resize( contentsWidth()+42, ch ); |
1378 | } | 1396 | } |
1379 | mCurPixWid = contentsWidth(); | 1397 | mCurPixWid = contentsWidth(); |
1380 | mCurPixHei = ch; | 1398 | mCurPixHei = ch; |
1381 | if ( mHighlightPixmap.width() < mGridSpacingX-1 || mHighlightPixmap.height() < ch ) { | 1399 | if ( mHighlightPixmap.width() < mGridSpacingX-1 ) { |
1382 | mHighlightPixmap.resize( mGridSpacingX-1, ch ); | 1400 | mHighlightPixmap.resize( mGridSpacingX-1, 5 ); |
1383 | mHighlightPixmap.fill ( KOPrefs::instance()->mHighlightColor ); | 1401 | mHighlightPixmap.fill ( KOPrefs::instance()->mHighlightColor ); |
1384 | } | 1402 | } |
1385 | mPixPainter.begin( &mPaintPixmap) ; | 1403 | mPixPainter.begin( &mPaintPixmap) ; |
1386 | //qDebug("wid %d hei %d ",mPaintPixmap.width(),mPaintPixmap.height() ); | 1404 | //qDebug("wid %d hei %d ",mPaintPixmap.width(),mPaintPixmap.height() ); |
1387 | QPainter * p ; | 1405 | QPainter * p ; |
1388 | if (paint == 0) { | 1406 | if (paint == 0) { |
1389 | mPaintPixmap.fill(KOPrefs::instance()->mAgendaBgColor); | 1407 | mPaintPixmap.fill(KOPrefs::instance()->mAgendaBgColor); |
1390 | p = &mPixPainter; | 1408 | p = &mPixPainter; |
1391 | } | 1409 | } |
1392 | else | 1410 | else |
1393 | p = paint ; | 1411 | p = paint ; |
1394 | // qDebug("++++++KOAgenda::drawContentsTo Painter %d %d %d %d ", cx, cy, cw, ch); | 1412 | // qDebug("++++++KOAgenda::drawContentsTo Painter %d %d %d %d ", cx, cy, cw, ch); |
1395 | 1413 | ||
1396 | //--cx;++cw; | 1414 | //--cx;++cw; |
1397 | int lGridSpacingY = mGridSpacingY*2; | 1415 | int lGridSpacingY = mGridSpacingY*2; |
1398 | int selDay; | 1416 | int selDay; |
1399 | if ( !backgroundOnly ) | 1417 | if ( !backgroundOnly ) |
1400 | for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay) | 1418 | for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay) |
1401 | { | 1419 | { |
1402 | if ( mSelectedDates[selDay] == QDateTime::currentDateTime ().date() && KOPrefs::instance()->mHighlightCurrentDay) { | 1420 | if ( mSelectedDates[selDay] == QDateTime::currentDateTime ().date() && KOPrefs::instance()->mHighlightCurrentDay) { |
1403 | int x1 = cx; | 1421 | int x1 = cx; |
1404 | int y1 = 0; | 1422 | int y1 = 0; |
1405 | if (y1 < cy) y1 = cy; | 1423 | if (y1 < cy) y1 = cy; |
1406 | int x2 = cx+cw-1; | 1424 | int x2 = cx+cw-1; |