summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-03-20 19:52:47 (UTC)
committer zautrix <zautrix>2005-03-20 19:52:47 (UTC)
commit64068741e3b82a34c1b8a67da412ac88841b640c (patch) (unidiff)
tree70a665bab53da7aa211f523daebbdbff08136df4
parentd998afaaf0fe1af0b9b5e3d6f4cb504e35e35025 (diff)
downloadkdepimpi-64068741e3b82a34c1b8a67da412ac88841b640c.zip
kdepimpi-64068741e3b82a34c1b8a67da412ac88841b640c.tar.gz
kdepimpi-64068741e3b82a34c1b8a67da412ac88841b640c.tar.bz2
nf
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kodaymatrix.cpp42
1 files changed, 20 insertions, 22 deletions
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index 507f18e..f864022 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -450,24 +450,26 @@ int KODayMatrix::getDayIndexFrom(int x, int y)
450// ---------------------------------------------------------------------------- 450// ----------------------------------------------------------------------------
451// M O U S E E V E N T H A N D L I N G 451// M O U S E E V E N T H A N D L I N G
452// ---------------------------------------------------------------------------- 452// ----------------------------------------------------------------------------
453 453
454void KODayMatrix::mousePressEvent (QMouseEvent* e) 454void KODayMatrix::mousePressEvent (QMouseEvent* e)
455{ 455{
456 456
457 if ( e->button() == LeftButton ) 457 if ( e->button() == LeftButton )
458 mouseDown = true; 458 mouseDown = true;
459 mSelStart = getDayIndexFrom(e->x(), e->y()); 459 mSelStart = getDayIndexFrom(e->x(), e->y());
460 if (mSelStart > NUMDAYS-1) mSelStart=NUMDAYS-1; 460 if (mSelStart > NUMDAYS-1) mSelStart=NUMDAYS-1;
461 mSelInit = mSelStart; 461 mSelInit = mSelStart;
462 mSelEnd = mSelStart;
463 repaint(false);
462} 464}
463 465
464void KODayMatrix::mouseReleaseEvent (QMouseEvent* e) 466void KODayMatrix::mouseReleaseEvent (QMouseEvent* e)
465{ 467{
466 if ( e->button() == LeftButton ) 468 if ( e->button() == LeftButton )
467 if ( ! mouseDown ) { 469 if ( ! mouseDown ) {
468 return; 470 return;
469 } 471 }
470 else 472 else
471 mouseDown = false; 473 mouseDown = false;
472 int tmp = getDayIndexFrom(e->x(), e->y()); 474 int tmp = getDayIndexFrom(e->x(), e->y());
473 if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; 475 if (tmp > NUMDAYS-1) tmp=NUMDAYS-1;
@@ -631,25 +633,25 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent)
631 } 633 }
632 QPainter p(&myPix); 634 QPainter p(&myPix);
633 p.setFont(font()); 635 p.setFont(font());
634 636
635 637
636 int dheight = daysize.height(); 638 int dheight = daysize.height();
637 int dwidth = daysize.width(); 639 int dwidth = daysize.width();
638 int row,col; 640 int row,col;
639 int selw, selh; 641 int selw, selh;
640 int xyOff = frameWidth(); 642 int xyOff = frameWidth();
641 int colModulo = sz.width() % 7; 643 int colModulo = sz.width() % 7;
642 int rowModulo = sz.height() % 6; 644 int rowModulo = sz.height() % 6;
643 //qDebug("off %d col %d row %d ",xyOff,colModulo,rowModulo ); 645 qDebug("col %d row %d ",colModulo,rowModulo );
644 646
645 bool isRTL = KOGlobals::self()->reverseLayout(); 647 bool isRTL = KOGlobals::self()->reverseLayout();
646 648
647 // draw background and topleft frame 649 // draw background and topleft frame
648 p.fillRect(pevent->rect(), mDefaultBackColor); 650 p.fillRect(pevent->rect(), mDefaultBackColor);
649 p.setPen(mDefaultTextColor); 651 p.setPen(mDefaultTextColor);
650 p.drawRect(0, 0, sz.width()+1, sz.height()+1); 652 p.drawRect(0, 0, sz.width()+1, sz.height()+1);
651 int mSelStartT = mSelStart; 653 int mSelStartT = mSelStart;
652 int mSelEndT = mSelEnd; 654 int mSelEndT = mSelEnd;
653 if ( mSelEndT >= NUMDAYS ) 655 if ( mSelEndT >= NUMDAYS )
654 mSelEndT = NUMDAYS-1; 656 mSelEndT = NUMDAYS-1;
655 // draw selected days with highlighted background color 657 // draw selected days with highlighted background color
@@ -667,46 +669,28 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent)
667 mSelStartT += add +1; 669 mSelStartT += add +1;
668 } 670 }
669 if ( days[mSelEndT].month() != mo ) { 671 if ( days[mSelEndT].month() != mo ) {
670 int sub = days[mSelEndT].day(); 672 int sub = days[mSelEndT].day();
671 mSelEndT -= sub ; 673 mSelEndT -= sub ;
672 } 674 }
673 } 675 }
674 } 676 }
675 if ( ! skip ) { 677 if ( ! skip ) {
676 row = mSelStartT/7; 678 row = mSelStartT/7;
677 col = mSelStartT -row*7; 679 col = mSelStartT -row*7;
678 QColor selcol = KOPrefs::instance()->mHighlightColor; 680 QColor selcol = KOPrefs::instance()->mHighlightColor;
679
680
681
682 int addCol = 0; 681 int addCol = 0;
683 int addRow = 0; 682 int addRow = 0;
684 int addRow2 = 0; 683 int addRow2 = 0;
685 int addCol2 = 0; 684 int addCol2 = 0;
686#if 0
687 if ( colModulo ) {
688 if ( col >= 7 - colModulo )
689 addCol = col - 7 + colModulo;
690 }
691 if ( rowModulo ) {
692 if ( row >= 6 - rowModulo )
693 addRow = row - 5 + rowModulo;
694 }
695#endif
696
697
698
699
700
701 if (row == mSelEndT/7) { 685 if (row == mSelEndT/7) {
702 if ( rowModulo ) { 686 if ( rowModulo ) {
703 if ( row >= 6 - rowModulo ) 687 if ( row >= 6 - rowModulo )
704 addRow = row - 5 + rowModulo; 688 addRow = row - 5 + rowModulo;
705 } 689 }
706 if ( colModulo ) { 690 if ( colModulo ) {
707 int colt1 = mSelEndT%7; 691 int colt1 = mSelEndT%7;
708 //qDebug("colt1 %d ", colt1 ); 692 //qDebug("colt1 %d ", colt1 );
709 if ( colt1 >= 7 - colModulo ) 693 if ( colt1 >= 7 - colModulo )
710 addCol = colt1 - 7 + colModulo+1; 694 addCol = colt1 - 7 + colModulo+1;
711 int colt = mSelStartT%7; 695 int colt = mSelStartT%7;
712 if ( colt >= 7 - colModulo ) 696 if ( colt >= 7 - colModulo )
@@ -783,41 +767,55 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent)
783 continue; 767 continue;
784 } 768 }
785 } 769 }
786 //Reset pen color after selected days block 770 //Reset pen color after selected days block
787 if (i == mSelEndT+1) { 771 if (i == mSelEndT+1) {
788 p.setPen(actcol); 772 p.setPen(actcol);
789 } 773 }
790 774
791 // if today then draw rectangle around day 775 // if today then draw rectangle around day
792 if (today == i) { 776 if (today == i) {
793 tmppen = p.pen(); 777 tmppen = p.pen();
794 QPen mTodayPen(p.pen()); 778 QPen mTodayPen(p.pen());
795 779 if ( daysize.width() < 20 )
796 mTodayPen.setWidth(mTodayMarginWidth); 780 mTodayPen.setWidth(1);
781 else
782 mTodayPen.setWidth(mTodayMarginWidth);
797 //draw red rectangle for holidays 783 //draw red rectangle for holidays
798 if (!mHolidays[i].isNull()) { 784 if (!mHolidays[i].isNull()) {
799 if (actcol == mDefaultTextColor) { 785 if (actcol == mDefaultTextColor) {
800 mTodayPen.setColor(KOPrefs::instance()->mHolidayColor); 786 mTodayPen.setColor(KOPrefs::instance()->mHolidayColor);
801 } else { 787 } else {
802 mTodayPen.setColor(mHolidayColorShaded); 788 mTodayPen.setColor(mHolidayColorShaded);
803 } 789 }
804 } 790 }
805 //draw gray rectangle for today if in selection 791 //draw gray rectangle for today if in selection
806 if (i >= mSelStartT && i <= mSelEndT) { 792 if (i >= mSelStartT && i <= mSelEndT) {
807 QColor grey("grey"); 793 QColor grey("grey");
808 mTodayPen.setColor(grey); 794 mTodayPen.setColor(grey);
809 } 795 }
810 p.setPen(mTodayPen); 796 p.setPen(mTodayPen);
811 p.drawRect(col*dwidth, row*dheight, dwidth, dheight); 797
798
799 int addCol = 0;
800 int addRow = 0;
801 if (rowModulo) {
802 if ( row >= 6 - rowModulo )
803 addRow = row - 5 + rowModulo;
804 }
805 if ( colModulo ) {
806 if ( col >= 7 - colModulo )
807 addCol = col - 6 + colModulo-1;
808 }
809 p.drawRect(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight+1);
812 p.setPen(tmppen); 810 p.setPen(tmppen);
813 } 811 }
814 812
815 // if any events are on that day then draw it using a bold font 813 // if any events are on that day then draw it using a bold font
816 if (events[i] > 0) { 814 if (events[i] > 0) {
817 QFont myFont = font(); 815 QFont myFont = font();
818 myFont.setBold(true); 816 myFont.setBold(true);
819 p.setFont(myFont); 817 p.setFont(myFont);
820 } 818 }
821 819
822 // if it is a holiday then use the default holiday color 820 // if it is a holiday then use the default holiday color
823 if (!mHolidays[i].isNull()) { 821 if (!mHolidays[i].isNull()) {