Tools__TextDiff3Tool.st
branchjv
changeset 16617 69e7de1ef22f
parent 15950 23be8cf85415
parent 16603 5bfc8ece7e14
equal deleted inserted replaced
16599:c8ee873681f8 16617:69e7de1ef22f
  1123     "Modified: / 30-11-2012 / 13:45:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1123     "Modified: / 30-11-2012 / 13:45:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1124 ! !
  1124 ! !
  1125 
  1125 
  1126 !TextDiff3Tool::MergeService methodsFor:'drawing'!
  1126 !TextDiff3Tool::MergeService methodsFor:'drawing'!
  1127 
  1127 
  1128 drawLine:lineNo in:view atX:x y:y width:w height:h from:startCol to:endColOrNil with:fg and:bg 
  1128 drawLine:lineNo in:view atX:x y:yBaseline width:w height:hFont ascent:aFont
       
  1129     from:startCol to:endColOrNil with:fg and:bg 
  1129     "Called by both gutterView and textView (well, not yet) to
  1130     "Called by both gutterView and textView (well, not yet) to
  1130      allow services to draw custom things on text view.
  1131      allow services to draw custom things on text view.
  1131      Ask JV what the args means if unsure (I'm lazy to document
  1132      Ask JV what the args means if unsure (I'm lazy to document
  1132      them, now it is just an experiment...)"
  1133      them, now it is just an experiment...)"
  1133 
  1134 
  1134     | info color sectionInterval |
  1135     | info color sectionInterval |
  1135 
  1136 
  1136     sectionInterval := self sectionInterval.
  1137     sectionInterval := self sectionInterval.
  1137     view == gutterView ifFalse:[ ^ self ].
  1138     view == gutterView ifFalse:[ ^ self ].
       
  1139     
  1138     info := self infoAtLine: lineNo.
  1140     info := self infoAtLine: lineNo.
  1139     info notNil ifTrue:[ 
  1141     info notNil ifTrue:[ 
  1140         color := info color.
  1142         color := info color.
  1141         color notNil ifTrue:[
  1143         color notNil ifTrue:[
  1142             view fillRectangleX: x y:y - h 
  1144             view fillRectangleX:x y:yBaseline - hFont 
  1143                     width: 8 
  1145                  width:8 
  1144                     height:h + textView lineSpacing + 5"Magic constant to make it look nicer"
  1146                  height:hFont + textView lineSpacing + 5"Magic constant to make it look nicer"
  1145                     color: color.
  1147                  color:color.
  1146         ].
  1148         ].
  1147     ].
  1149     ].
  1148 
  1150 
  1149     (sectionInterval notNil and:[sectionInterval includes: lineNo]) ifTrue:[
  1151     (sectionInterval notNil and:[sectionInterval includes: lineNo]) ifTrue:[
  1150             "Drawing outside annotation area is not nice, but..."
  1152         "Drawing outside annotation area is not nice, but..."
  1151             view fillRectangleX:view width - 7 y:y - h 
  1153         view fillRectangleX:view width - 7 y:yBaseline - hFont 
  1152                 width:4 
  1154              width:4 
  1153                 height:h + textView lineSpacing + 5"Magic constant to make it look nicer"
  1155              height:hFont + textView lineSpacing + 5"Magic constant to make it look nicer"
  1154                 color: Color gray.
  1156              color:(Color gray).
  1155     ]
  1157     ]
  1156 
  1158 
  1157     "Created: / 19-03-2012 / 13:15:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1159     "Created: / 19-03-2012 / 13:15:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1158     "Modified: / 30-11-2012 / 13:46:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1160     "Modified: / 30-11-2012 / 13:46:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1159 ! !
  1161 ! !