author | zautrix <zautrix> | 2005-03-20 19:18:26 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-20 19:18:26 (UTC) |
commit | d998afaaf0fe1af0b9b5e3d6f4cb504e35e35025 (patch) (unidiff) | |
tree | 075ab57af7f72bba7c25458026c6781db8fa7b53 /korganizer | |
parent | a9e08041c8978d52cfcabc84f579784af45eb8d9 (diff) | |
download | kdepimpi-d998afaaf0fe1af0b9b5e3d6f4cb504e35e35025.zip kdepimpi-d998afaaf0fe1af0b9b5e3d6f4cb504e35e35025.tar.gz kdepimpi-d998afaaf0fe1af0b9b5e3d6f4cb504e35e35025.tar.bz2 |
layout fix
-rw-r--r-- | korganizer/kodaymatrix.cpp | 48 |
1 files changed, 35 insertions, 13 deletions
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index 15a1cb4..507f18e 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -637,13 +637,13 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) | |||
637 | int dwidth = daysize.width(); | 637 | int dwidth = daysize.width(); |
638 | int row,col; | 638 | int row,col; |
639 | int selw, selh; | 639 | int selw, selh; |
640 | int xyOff = frameWidth(); | 640 | int xyOff = frameWidth(); |
641 | int colModulo = sz.width() % 7; | 641 | int colModulo = sz.width() % 7; |
642 | int rowModulo = sz.height() % 6; | 642 | int rowModulo = sz.height() % 6; |
643 | qDebug("off %d col %d row %d ",xyOff,colModulo,rowModulo ); | 643 | //qDebug("off %d col %d row %d ",xyOff,colModulo,rowModulo ); |
644 | 644 | ||
645 | bool isRTL = KOGlobals::self()->reverseLayout(); | 645 | bool isRTL = KOGlobals::self()->reverseLayout(); |
646 | 646 | ||
647 | // draw background and topleft frame | 647 | // draw background and topleft frame |
648 | p.fillRect(pevent->rect(), mDefaultBackColor); | 648 | p.fillRect(pevent->rect(), mDefaultBackColor); |
649 | p.setPen(mDefaultTextColor); | 649 | p.setPen(mDefaultTextColor); |
@@ -677,13 +677,15 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) | |||
677 | col = mSelStartT -row*7; | 677 | col = mSelStartT -row*7; |
678 | QColor selcol = KOPrefs::instance()->mHighlightColor; | 678 | QColor selcol = KOPrefs::instance()->mHighlightColor; |
679 | 679 | ||
680 | 680 | ||
681 | 681 | ||
682 | int addCol = 0; | 682 | int addCol = 0; |
683 | int addRow = 0; | 683 | int addRow = 0; |
684 | int addRow2 = 0; | ||
685 | int addCol2 = 0; | ||
684 | #if 0 | 686 | #if 0 |
685 | if ( colModulo ) { | 687 | if ( colModulo ) { |
686 | if ( col >= 7 - colModulo ) | 688 | if ( col >= 7 - colModulo ) |
687 | addCol = col - 7 + colModulo; | 689 | addCol = col - 7 + colModulo; |
688 | } | 690 | } |
689 | if ( rowModulo ) { | 691 | if ( rowModulo ) { |
@@ -699,30 +701,50 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) | |||
699 | if (row == mSelEndT/7) { | 701 | if (row == mSelEndT/7) { |
700 | if ( rowModulo ) { | 702 | if ( rowModulo ) { |
701 | if ( row >= 6 - rowModulo ) | 703 | if ( row >= 6 - rowModulo ) |
702 | addRow = row - 5 + rowModulo; | 704 | addRow = row - 5 + rowModulo; |
703 | } | 705 | } |
704 | if ( colModulo ) { | 706 | if ( colModulo ) { |
705 | if ( mSelEndT-mSelStartT+1 >= 7 - colModulo ) | 707 | int colt1 = mSelEndT%7; |
706 | addCol = mSelEndT-mSelStartT+1 - 7 + colModulo; | 708 | //qDebug("colt1 %d ", colt1 ); |
709 | if ( colt1 >= 7 - colModulo ) | ||
710 | addCol = colt1 - 7 + colModulo+1; | ||
711 | int colt = mSelStartT%7; | ||
712 | if ( colt >= 7 - colModulo ) | ||
713 | addCol2 = colt - 7 + colModulo; | ||
714 | addCol -= addCol2; | ||
715 | //qDebug("COL %d %d %d %d ",col , colt1 ,addCol ,addCol2 ); | ||
707 | } | 716 | } |
708 | // Single row selection | 717 | // Single row selection |
709 | if ( row == 0) | 718 | if ( row == 0) |
710 | addRow = 1; | 719 | addRow = 1; |
711 | p.fillRect(isRTL ? (7 - (mSelEndT-mSelStartT+1) - col)*dwidth : col*dwidth+1, | 720 | p.fillRect(isRTL ? (7 - (mSelEndT-mSelStartT+1) - col)*dwidth : col*dwidth+1+addCol2, |
712 | row*dheight+addRow, (mSelEndT-mSelStartT+1)*dwidth+addCol, dheight+1, selcol); | 721 | row*dheight+addRow, (mSelEndT-mSelStartT+1)*dwidth+addCol, dheight+1, selcol); |
713 | } else { | 722 | } else { |
714 | // draw first row to the right | 723 | // draw first row to the right |
724 | if ( colModulo ) { | ||
725 | if ( col >= 7 - colModulo ) | ||
726 | addCol2 = col - 7 + colModulo; | ||
727 | } | ||
728 | if ( rowModulo ) { | ||
729 | if ( row >= 6 - rowModulo ) | ||
730 | addRow = row - 5 + rowModulo; | ||
731 | } | ||
715 | if ( row == 0) | 732 | if ( row == 0) |
716 | addRow = 1; | 733 | addRow = 1; |
717 | p.fillRect(isRTL ? 0 : col*dwidth+1, row*dheight+addRow, (7-col)*dwidth+colModulo, | 734 | p.fillRect(isRTL ? 0 : col*dwidth+1+addCol2, row*dheight+addRow, (7-col)*dwidth+colModulo, |
718 | dheight, selcol); | 735 | dheight+1, selcol); |
719 | // draw full block till last line | 736 | // draw full block till last line |
720 | selh = mSelEndT/7-row; | 737 | selh = mSelEndT/7-row; |
738 | addRow = 0; | ||
739 | if ( rowModulo ) { | ||
740 | if ( mSelEndT/7 >= 6 - rowModulo ) | ||
741 | addRow = mSelEndT/7 - 5 + rowModulo; | ||
742 | } | ||
721 | if (selh > 1) { | 743 | if (selh > 1) { |
722 | p.fillRect(1, (row+1)*dheight, 7*dwidth+colModulo, (selh-1)*dheight,selcol); | 744 | p.fillRect(1, (row+1)*dheight, 7*dwidth+colModulo, (selh-1)*dheight+addRow,selcol); |
723 | } | 745 | } |
724 | // draw last block from left to mSelEndT | 746 | // draw last block from left to mSelEndT |
725 | selw = mSelEndT-7*(mSelEndT/7)+1; | 747 | selw = mSelEndT-7*(mSelEndT/7)+1; |
726 | //qDebug("esl %d ",selw ); | 748 | //qDebug("esl %d ",selw ); |
727 | int add = 0; | 749 | int add = 0; |
728 | if ( colModulo ) { | 750 | if ( colModulo ) { |
@@ -730,14 +752,14 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) | |||
730 | if ( selw > add ) | 752 | if ( selw > add ) |
731 | add = selw - add; | 753 | add = selw - add; |
732 | else | 754 | else |
733 | add = 0; | 755 | add = 0; |
734 | } | 756 | } |
735 | //qDebug("add %d ", add); | 757 | //qDebug("add %d ", add); |
736 | p.fillRect(isRTL ? (7-selw)*dwidth : 1, (row+selh)*dheight, | 758 | p.fillRect(isRTL ? (7-selw)*dwidth : 1, (row+selh)*dheight+addRow, |
737 | selw*dwidth+add, dheight, selcol); | 759 | selw*dwidth+add, dheight+1, selcol); |
738 | } | 760 | } |
739 | } | 761 | } |
740 | } | 762 | } |
741 | 763 | ||
742 | // iterate over all days in the matrix and draw the day label in appropriate colors | 764 | // iterate over all days in the matrix and draw the day label in appropriate colors |
743 | QColor actcol = mDefaultTextColorShaded; | 765 | QColor actcol = mDefaultTextColorShaded; |
@@ -824,13 +846,13 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) | |||
824 | } | 846 | } |
825 | if ( rowModulo ) { | 847 | if ( rowModulo ) { |
826 | if ( row >= 6 - rowModulo ) | 848 | if ( row >= 6 - rowModulo ) |
827 | addRow = row - 5 + rowModulo; | 849 | addRow = row - 5 + rowModulo; |
828 | } | 850 | } |
829 | //qDebug("add %d %d -- %d %d ", col, addCol, row, addRow); | 851 | //qDebug("add %d %d -- %d %d ", col, addCol, row, addRow); |
830 | ++addCol;++addCol; | 852 | ++addCol;//++addCol; |
831 | p.drawText(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight, | 853 | p.drawText(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight, |
832 | Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]); | 854 | Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]); |
833 | 855 | ||
834 | // reset color to actual color | 856 | // reset color to actual color |
835 | if (!mHolidays[i].isNull()) { | 857 | if (!mHolidays[i].isNull()) { |
836 | p.setPen(actcol); | 858 | p.setPen(actcol); |