aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authornyamatongwe <unknown>2003-02-14 11:16:27 +0000
committernyamatongwe <unknown>2003-02-14 11:16:27 +0000
commitbff17e28eb0ae421cf238e67c2a6818b9a7d91f6 (patch)
tree092c6aeed136330310fe0e5ab12f16a70df8252c /src
parent833789ddb3385ab194e526d4edc731633e022297 (diff)
downloadscintilla-mirror-bff17e28eb0ae421cf238e67c2a6818b9a7d91f6.tar.gz
May have fixed a problem with wrapping where an added character is
initially in style 0 and so is narrower than its real styled width. So moved the wrapping until after the styling. Pixmap setup moved out of Paint into a separate method. Shortening of fold margin colour code.
Diffstat (limited to 'src')
-rw-r--r--src/Editor.cxx70
-rw-r--r--src/Editor.h1
2 files changed, 36 insertions, 35 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 54a9980b0..4fe42874f 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -2211,24 +2211,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
}
}
-void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
- //Platform::DebugPrintf("Paint:%1d (%3d,%3d) ... (%3d,%3d)\n",
- // paintingAllText, rcArea.left, rcArea.top, rcArea.right, rcArea.bottom);
-
- RefreshStyleData();
-
- PRectangle rcClient = GetClientRectangle();
- //Platform::DebugPrintf("Client: (%3d,%3d) ... (%3d,%3d) %d\n",
- // rcClient.left, rcClient.top, rcClient.right, rcClient.bottom);
-
- if (WrapLines()) {
- // The wrapping process has changed the height of some lines so abandon this
- // paint for a complete repaint.
- if (AbandonPaint()) {
- return;
- }
- }
-
+void Editor::RefreshPixMaps(Surface *surfaceWindow) {
if (!pixmapSelPattern->Initialised()) {
pixmapSelPattern->InitPixMap(8, 8, surfaceWindow);
// This complex procedure is to reproduce the checker board dithered pattern used by windows
@@ -2238,27 +2221,21 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
PRectangle rcPattern(0, 0, 8, 8);
// Default to highlight edge colour in case unusual colour scheme chosen
- ColourAllocated colourFMFill = vs.selbarlight.allocated;
+ ColourAllocated colourFMFill = vs.selbar.allocated;
ColourAllocated colourFMStripes = vs.selbarlight.allocated;
- if (vs.foldmarginColourSet && !vs.foldmarginHighlightColourSet) {
- // Only Fold Margin Colour Set
- colourFMFill = vs.foldmarginColour.allocated;
- colourFMStripes = vs.selbarlight.allocated;
- } else if (!vs.foldmarginColourSet && vs.foldmarginHighlightColourSet) {
- // Only Fold Margin Highlight Colour Set
- colourFMFill = vs.selbar.allocated;
- colourFMStripes = vs.foldmarginHighlightColour.allocated;
- } else if (vs.foldmarginColourSet && vs.foldmarginHighlightColourSet) {
- // Both Fold Margin Colour and Fold Margin Highlight Colour Set
+ if (!(vs.selbarlight.desired == ColourDesired(0xff, 0xff, 0xff))) {
+ // User has chosen an unusual chrome colour scheme so just use the highlight edge colour.
+ colourFMFill = vs.selbarlight.allocated;
+ }
+ if (vs.foldmarginColourSet) {
+ // override default fold margin colour
colourFMFill = vs.foldmarginColour.allocated;
+ }
+ if (vs.foldmarginHighlightColourSet) {
+ // override default fold margin highlight colour
colourFMStripes = vs.foldmarginHighlightColour.allocated;
- } else if (!vs.foldmarginColourSet && !vs.foldmarginHighlightColourSet) {
- // Neither Fold Margin Colour nor Fold Margin Highlight Colour is Set so take Default [2/9/2003 16:54]
- if (vs.selbarlight.desired == ColourDesired(0xff, 0xff, 0xff)) {
- colourFMFill = vs.selbar.allocated;
- colourFMStripes = vs.selbarlight.allocated;
- }
}
+
pixmapSelPattern->FillRectangle(rcPattern, colourFMFill);
pixmapSelPattern->PenColour(colourFMStripes);
for (int stripe = 0; stripe < 8; stripe++) {
@@ -2266,6 +2243,7 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
pixmapSelPattern->LineTo(8, stripe * 2 - 8);
}
}
+
if (!pixmapIndentGuide->Initialised()) {
// 1 extra pixel in height so can handle odd/even positions and so produce a continuous line
pixmapIndentGuide->InitPixMap(1, vs.lineHeight + 1, surfaceWindow);
@@ -2285,12 +2263,26 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
if (bufferedDraw) {
if (!pixmapLine->Initialised()) {
+ PRectangle rcClient = GetClientRectangle();
pixmapLine->InitPixMap(rcClient.Width(), rcClient.Height(),
surfaceWindow);
pixmapSelMargin->InitPixMap(vs.fixedColumnWidth,
rcClient.Height(), surfaceWindow);
}
}
+}
+
+void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
+ //Platform::DebugPrintf("Paint:%1d (%3d,%3d) ... (%3d,%3d)\n",
+ // paintingAllText, rcArea.left, rcArea.top, rcArea.right, rcArea.bottom);
+
+ RefreshStyleData();
+
+ RefreshPixMaps(surfaceWindow);
+
+ PRectangle rcClient = GetClientRectangle();
+ //Platform::DebugPrintf("Client: (%3d,%3d) ... (%3d,%3d) %d\n",
+ // rcClient.left, rcClient.top, rcClient.right, rcClient.bottom);
surfaceWindow->SetPalette(&palette, true);
pixmapLine->SetPalette(&palette, !hasFocus);
@@ -2320,6 +2312,14 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
PaintSelMargin(surfaceWindow, rcArea);
+ if (WrapLines()) {
+ // The wrapping process has changed the height of some lines so abandon this
+ // paint for a complete repaint.
+ if (AbandonPaint()) {
+ return;
+ }
+ }
+
PRectangle rcRightMargin = rcClient;
rcRightMargin.left = rcRightMargin.right - vs.rightMarginWidth;
if (rcArea.Intersects(rcRightMargin)) {
diff --git a/src/Editor.h b/src/Editor.h
index 5b8813bb3..1769b7b06 100644
--- a/src/Editor.h
+++ b/src/Editor.h
@@ -362,6 +362,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
bool overrideBackground, ColourAllocated background);
void DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart,
PRectangle rcLine, LineLayout *ll, int subLine=0);
+ void RefreshPixMaps(Surface *surfaceWindow);
void Paint(Surface *surfaceWindow, PRectangle rcArea);
long FormatRange(bool draw, RangeToFormat *pfr);
int TextWidth(int style, const char *text);