OSDN Git Service

Commit DialogBox compile Okay
[tortoisegit/TortoiseGitJp.git] / ext / scintilla / src / Indicator.cxx
diff --git a/ext/scintilla/src/Indicator.cxx b/ext/scintilla/src/Indicator.cxx
new file mode 100644 (file)
index 0000000..653dc40
--- /dev/null
@@ -0,0 +1,81 @@
+// Scintilla source code edit control\r
+/** @file Indicator.cxx\r
+ ** Defines the style of indicators which are text decorations such as underlining.\r
+ **/\r
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>\r
+// The License.txt file describes the conditions under which this software may be distributed.\r
+\r
+#include "Platform.h"\r
+\r
+#include "Scintilla.h"\r
+#include "Indicator.h"\r
+\r
+#ifdef SCI_NAMESPACE\r
+using namespace Scintilla;\r
+#endif\r
+\r
+void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine) {\r
+       surface->PenColour(fore.allocated);\r
+       int ymid = (rc.bottom + rc.top) / 2;\r
+       if (style == INDIC_SQUIGGLE) {\r
+               surface->MoveTo(rc.left, rc.top);\r
+               int x = rc.left + 2;\r
+               int y = 2;\r
+               while (x < rc.right) {\r
+                       surface->LineTo(x, rc.top + y);\r
+                       x += 2;\r
+                       y = 2 - y;\r
+               }\r
+               surface->LineTo(rc.right, rc.top + y);  // Finish the line\r
+       } else if (style == INDIC_TT) {\r
+               surface->MoveTo(rc.left, ymid);\r
+               int x = rc.left + 5;\r
+               while (x < rc.right) {\r
+                       surface->LineTo(x, ymid);\r
+                       surface->MoveTo(x-3, ymid);\r
+                       surface->LineTo(x-3, ymid+2);\r
+                       x++;\r
+                       surface->MoveTo(x, ymid);\r
+                       x += 5;\r
+               }\r
+               surface->LineTo(rc.right, ymid);        // Finish the line\r
+               if (x - 3 <= rc.right) {\r
+                       surface->MoveTo(x-3, ymid);\r
+                       surface->LineTo(x-3, ymid+2);\r
+               }\r
+       } else if (style == INDIC_DIAGONAL) {\r
+               int x = rc.left;\r
+               while (x < rc.right) {\r
+                       surface->MoveTo(x, rc.top+2);\r
+                       int endX = x+3;\r
+                       int endY = rc.top - 1;\r
+                       if (endX > rc.right) {\r
+                               endY += endX - rc.right;\r
+                               endX = rc.right;\r
+                       }\r
+                       surface->LineTo(endX, endY);\r
+                       x += 4;\r
+               }\r
+       } else if (style == INDIC_STRIKE) {\r
+               surface->MoveTo(rc.left, rc.top - 4);\r
+               surface->LineTo(rc.right, rc.top - 4);\r
+       } else if (style == INDIC_HIDDEN) {\r
+               // Draw nothing\r
+       } else if (style == INDIC_BOX) {\r
+               surface->MoveTo(rc.left, ymid+1);\r
+               surface->LineTo(rc.right, ymid+1);\r
+               surface->LineTo(rc.right, rcLine.top+1);\r
+               surface->LineTo(rc.left, rcLine.top+1);\r
+               surface->LineTo(rc.left, ymid+1);\r
+       } else if (style == INDIC_ROUNDBOX) {\r
+               PRectangle rcBox = rcLine;\r
+               rcBox.top = rcLine.top + 1;\r
+               rcBox.left = rc.left;\r
+               rcBox.right = rc.right;\r
+               surface->AlphaRectangle(rcBox, 1, fore.allocated, 30, fore.allocated, 50, 0);\r
+       } else {        // Either INDIC_PLAIN or unknown\r
+               surface->MoveTo(rc.left, ymid);\r
+               surface->LineTo(rc.right, ymid);\r
+       }\r
+}\r
+\r