@@ -1071,6 +1071,36 @@ COLORREF iBackColour = BLACK;
1071
1071
startcol = MIN (m_selstart_col, pLine->len );
1072
1072
endcol = MIN (m_selend_col, pLine->len );
1073
1073
1074
+ // line preamble - version 4.62
1075
+
1076
+ CString strPreamble;
1077
+ COLORREF cPreambleText,
1078
+ cPreambleBack;
1079
+
1080
+ // get appropriate preamble text, and colours, depending on line type
1081
+ if (pLine->flags & COMMENT)
1082
+ {
1083
+ strPreamble = pDoc->m_strOutputLinePreambleNotes ;
1084
+ cPreambleText = pDoc->m_OutputLinePreambleNotesTextColour ;
1085
+ cPreambleBack = pDoc->m_OutputLinePreambleNotesBackColour ;
1086
+ }
1087
+ else if (pLine->flags & USER_INPUT)
1088
+ {
1089
+ strPreamble = pDoc->m_strOutputLinePreambleInput ;
1090
+ cPreambleText = pDoc->m_OutputLinePreambleInputTextColour ;
1091
+ cPreambleBack = pDoc->m_OutputLinePreambleInputBackColour ;
1092
+ }
1093
+ else
1094
+ {
1095
+ strPreamble = pDoc->m_strOutputLinePreambleOutput ;
1096
+ cPreambleText = pDoc->m_OutputLinePreambleOutputTextColour ;
1097
+ cPreambleBack = pDoc->m_OutputLinePreambleOutputBackColour ;
1098
+ }
1099
+
1100
+ // convert codes like %H:%M:%S
1101
+ if (!strPreamble.IsEmpty ())
1102
+ strPreamble = pDoc->FormatTime (pLine->m_theTime , strPreamble, false );
1103
+
1074
1104
// Draw the background and then the text
1075
1105
1076
1106
for (int iPass = 0 ; iPass < 2 ; iPass++)
@@ -1081,41 +1111,14 @@ COLORREF iBackColour = BLACK;
1081
1111
1082
1112
// line preamble - version 4.62
1083
1113
1084
- CString strPreamble;
1085
- COLORREF cPreambleText,
1086
- cPreambleBack;
1087
-
1088
- // get appropriate preamble text, and colours, depending on line type
1089
- if (pLine->flags & COMMENT)
1090
- {
1091
- strPreamble = pDoc->m_strOutputLinePreambleNotes ;
1092
- cPreambleText = pDoc->m_OutputLinePreambleNotesTextColour ;
1093
- cPreambleBack = pDoc->m_OutputLinePreambleNotesBackColour ;
1094
- }
1095
- else if (pLine->flags & USER_INPUT)
1096
- {
1097
- strPreamble = pDoc->m_strOutputLinePreambleInput ;
1098
- cPreambleText = pDoc->m_OutputLinePreambleInputTextColour ;
1099
- cPreambleBack = pDoc->m_OutputLinePreambleInputBackColour ;
1100
- }
1101
- else
1102
- {
1103
- strPreamble = pDoc->m_strOutputLinePreambleOutput ;
1104
- cPreambleText = pDoc->m_OutputLinePreambleOutputTextColour ;
1105
- cPreambleBack = pDoc->m_OutputLinePreambleOutputBackColour ;
1106
- }
1107
-
1108
1114
// if not empty, do the work of drawing it
1109
1115
if (!strPreamble.IsEmpty ())
1110
1116
{
1111
- // convert codes like %H:%M:%S
1112
- strPreamble = pDoc->FormatTime (pLine->m_theTime , strPreamble, false );
1113
1117
1114
1118
// get plain font
1115
1119
pDC->SelectObject (pDoc->m_font [0 ]);
1116
1120
1117
1121
// find how big, so we can fill the background
1118
-
1119
1122
RECT r;
1120
1123
CSize textsize = pDC->GetTextExtent (strPreamble, strPreamble.GetLength ());
1121
1124
@@ -1137,6 +1140,7 @@ COLORREF iBackColour = BLACK;
1137
1140
pDC->FillSolidRect (&r, pDoc->TranslateColour (cPreambleBack));
1138
1141
else
1139
1142
{
1143
+ pDC->SetBkMode (TRANSPARENT); // trouble brewing if this isn't here!
1140
1144
pDC->SetTextColor (pDoc->TranslateColour (cPreambleText));
1141
1145
pDC->ExtTextOut (r.left ,
1142
1146
r.top ,
@@ -1146,6 +1150,7 @@ COLORREF iBackColour = BLACK;
1146
1150
strPreamble.GetLength (),
1147
1151
NULL );
1148
1152
}
1153
+ pLine->m_iPreambleOffset = textsize.cx ; // for selection calculations
1149
1154
pixel += textsize.cx ; // start rest of line further over
1150
1155
1151
1156
}
@@ -1726,6 +1731,7 @@ long pixel;
1726
1731
point.y -= pDoc->m_TextRectangle .top ;
1727
1732
point.x -= pDoc->m_TextRectangle .left ;
1728
1733
1734
+
1729
1735
line = (point.y + pDoc->m_iPixelOffset + m_scroll_position.y ) / pDoc->m_FontHeight ;
1730
1736
1731
1737
// include partial last line if necessary
@@ -1744,14 +1750,16 @@ long pixel;
1744
1750
1745
1751
CLine * pLine = pDoc->m_LineList .GetAt (pDoc->GetLinePosition (line));
1746
1752
1753
+ // point.x -= pLine->m_iPreambleOffset;
1754
+
1747
1755
// calculate which column we must be at
1748
1756
1749
- for (col = pixel = 0 ;
1757
+ for (col = 0 , pixel = pLine-> m_iPreambleOffset ;
1750
1758
pixel < point.x && col <= pLine->len ;
1751
1759
col++)
1752
1760
{
1753
1761
lastx = pixel;
1754
- pixel = calculate_width (line, col, pDoc, dc) + pDoc->m_iPixelOffset ;
1762
+ pixel = calculate_width (line, col, pDoc, dc) + pDoc->m_iPixelOffset + pLine-> m_iPreambleOffset ;
1755
1763
}
1756
1764
1757
1765
col--; // columns are zero-relative
@@ -2357,7 +2365,7 @@ int line,
2357
2365
2358
2366
// first work out the line/column the mouse is over
2359
2367
2360
- calculate_line_and_column (point, dc, line, col, false );
2368
+ calculate_line_and_column (point, dc, line, col, true );
2361
2369
2362
2370
// tooltips stuff
2363
2371
@@ -2374,10 +2382,6 @@ int line,
2374
2382
m_nLastToolTipColumn = col;
2375
2383
}
2376
2384
2377
- // first work out the line/column the mouse is over
2378
-
2379
- calculate_line_and_column (point, dc, line, col, true );
2380
-
2381
2385
// end of tooltips stuff
2382
2386
2383
2387
// only if the user is currently drawing a new stroke by dragging
@@ -2722,7 +2726,10 @@ ASSERT_VALID(pDoc);
2722
2726
POSITION foundpos;
2723
2727
2724
2728
// don't show finger pointer *past* end of last word
2725
- long pixel = calculate_width (line, pLine->len , pDoc, dc) + pDoc->m_iPixelOffset + pDoc->m_TextRectangle .left ;
2729
+ long pixel = calculate_width (line, pLine->len , pDoc, dc) +
2730
+ pDoc->m_iPixelOffset +
2731
+ pDoc->m_TextRectangle .left +
2732
+ pLine->m_iPreambleOffset ;
2726
2733
2727
2734
if (pDoc->FindStyle (pLine, col, iCol, pStyle, foundpos))
2728
2735
{
0 commit comments