aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2012-07-24 15:29:48 +1000
committernyamatongwe <devnull@localhost>2012-07-24 15:29:48 +1000
commit6728875a9748d11ca2fb92ad36a2e640b03aed38 (patch)
tree2a8bc6dbfd6213e0f292744e1cc52675ef4303fe
parent28a6b6543584a15ce128408ed523b88c8b588394 (diff)
downloadscintilla-mirror-6728875a9748d11ca2fb92ad36a2e640b03aed38.tar.gz
Add ncurses platform. Rest of the implementation is an external project.
From Mitchell Foral.
-rw-r--r--include/Platform.h5
-rw-r--r--src/AutoComplete.cxx4
-rw-r--r--src/AutoComplete.h2
-rw-r--r--src/CallTip.cxx16
-rw-r--r--src/CallTip.h5
-rw-r--r--src/Editor.cxx8
-rw-r--r--src/Editor.h3
-rw-r--r--src/ScintillaBase.cxx4
8 files changed, 34 insertions, 13 deletions
diff --git a/include/Platform.h b/include/Platform.h
index 1b5dfbe3d..70a9cccb3 100644
--- a/include/Platform.h
+++ b/include/Platform.h
@@ -22,6 +22,7 @@
#define PLAT_WX 0
#define PLAT_QT 0
#define PLAT_FOX 0
+#define PLAT_NCURSES 0
#if defined(FOX)
#undef PLAT_FOX
@@ -31,6 +32,10 @@
#undef PLAT_WX
#define PLAT_WX 1
+#elif defined(NCURSES)
+#undef PLAT_NCURSES
+#define PLAT_NCURSES 1
+
#elif defined(SCINTILLA_QT)
#undef PLAT_QT
#define PLAT_QT 1
diff --git a/src/AutoComplete.cxx b/src/AutoComplete.cxx
index 82773f4db..bab123a99 100644
--- a/src/AutoComplete.cxx
+++ b/src/AutoComplete.cxx
@@ -34,7 +34,9 @@ AutoComplete::AutoComplete() :
cancelAtStartPos(true),
autoHide(true),
dropRestOfWord(false),
- ignoreCaseBehaviour(SC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE) {
+ ignoreCaseBehaviour(SC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE),
+ widthLBDefault(100),
+ heightLBDefault(100) {
lb = ListBox::Allocate();
stopChars[0] = '\0';
fillUpChars[0] = '\0';
diff --git a/src/AutoComplete.h b/src/AutoComplete.h
index 91e084857..4d27e6add 100644
--- a/src/AutoComplete.h
+++ b/src/AutoComplete.h
@@ -34,6 +34,8 @@ public:
bool autoHide;
bool dropRestOfWord;
unsigned int ignoreCaseBehaviour;
+ int widthLBDefault;
+ int heightLBDefault;
AutoComplete();
~AutoComplete();
diff --git a/src/CallTip.cxx b/src/CallTip.cxx
index 9f17e592a..d5ba3bd09 100644
--- a/src/CallTip.cxx
+++ b/src/CallTip.cxx
@@ -18,9 +18,6 @@
using namespace Scintilla;
#endif
-static const int insetX = 5; // text inset in x from calltip border
-static const int widthArrow = 14;
-
CallTip::CallTip() {
wCallTip = 0;
inCallTipMode = false;
@@ -36,6 +33,11 @@ CallTip::CallTip() {
above = false;
useStyleCallTip = false; // for backwards compatibility
+ insetX = 5;
+ widthArrow = 14;
+ borderHeight = 2; // Extra line for border and an empty line at top and bottom.
+ verticalOffset = 1;
+
#ifdef __APPLE__
// proper apple colours for the default
colourBG = ColourDesired(0xff, 0xff, 0xc6);
@@ -284,15 +286,15 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, int textHeight, const char *
}
lineHeight = surfaceMeasure->Height(font);
- // Extra line for border and an empty line at top and bottom. The returned
+ // The returned
// rectangle is aligned to the right edge of the last arrow encountered in
// the tip text, else to the tip text left edge.
- int height = lineHeight * numLines - surfaceMeasure->InternalLeading(font) + 2 + 2;
+ int height = lineHeight * numLines - surfaceMeasure->InternalLeading(font) + borderHeight * 2;
delete surfaceMeasure;
if (above) {
- return PRectangle(pt.x - offsetMain, pt.y - 1 - height, pt.x + width - offsetMain, pt.y - 1);
+ return PRectangle(pt.x - offsetMain, pt.y - verticalOffset - height, pt.x + width - offsetMain, pt.y - verticalOffset);
} else {
- return PRectangle(pt.x - offsetMain, pt.y + 1 + textHeight, pt.x + width - offsetMain, pt.y + 1 + textHeight + height);
+ return PRectangle(pt.x - offsetMain, pt.y + verticalOffset + textHeight, pt.x + width - offsetMain, pt.y + verticalOffset + textHeight + height);
}
}
diff --git a/src/CallTip.h b/src/CallTip.h
index 657e0caa1..fdc4db86f 100644
--- a/src/CallTip.h
+++ b/src/CallTip.h
@@ -50,6 +50,11 @@ public:
int codePage;
int clickPlace;
+ int insetX; // text inset in x from calltip border
+ int widthArrow;
+ int borderHeight;
+ int verticalOffset; // pixel offset up or down of the calltip with respect to the line
+
CallTip();
~CallTip();
diff --git a/src/Editor.cxx b/src/Editor.cxx
index c3f1b984e..4a52f38ce 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -218,6 +218,9 @@ Editor::Editor() {
convertPastes = true;
+ marginNumberPadding = 3;
+ ctrlCharPadding = 3; // +3 For a blank on front and rounded edge each side
+
hsStart = -1;
hsEnd = -1;
@@ -1957,7 +1960,7 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
PRectangle rcNumber = rcMarker;
// Right justify
XYPOSITION width = surface->WidthText(vs.styles[STYLE_LINENUMBER].font, number, istrlen(number));
- XYPOSITION xpos = rcNumber.right - width - 3;
+ XYPOSITION xpos = rcNumber.right - width - marginNumberPadding;
rcNumber.left = xpos;
surface->DrawTextNoClip(rcNumber, vs.styles[STYLE_LINENUMBER].font,
rcNumber.top + vs.maxAscent, number, istrlen(number),
@@ -2199,9 +2202,8 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
} else if (controlCharSymbol < 32) {
if (ctrlCharWidth[ll->chars[charInLine]] == 0) {
const char *ctrlChar = ControlCharacterString(ll->chars[charInLine]);
- // +3 For a blank on front and rounded edge each side:
ctrlCharWidth[ll->chars[charInLine]] =
- surface->WidthText(ctrlCharsFont, ctrlChar, istrlen(ctrlChar)) + 3;
+ surface->WidthText(ctrlCharsFont, ctrlChar, istrlen(ctrlChar)) + ctrlCharPadding;
}
ll->positions[charInLine + 1] = ctrlCharWidth[ll->chars[charInLine]];
} else {
diff --git a/src/Editor.h b/src/Editor.h
index 0ae1f115f..cb1141b61 100644
--- a/src/Editor.h
+++ b/src/Editor.h
@@ -269,6 +269,9 @@ protected: // ScintillaBase subclass needs access to much of Editor
bool convertPastes;
+ int marginNumberPadding; // the right-side padding of the number margin
+ int ctrlCharPadding; // the padding around control character text blobs
+
Document *pdoc;
Editor();
diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx
index cc3992f8f..b3b0b679f 100644
--- a/src/ScintillaBase.cxx
+++ b/src/ScintillaBase.cxx
@@ -226,8 +226,8 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
if (rcPopupBounds.Height() == 0)
rcPopupBounds = rcClient;
- int heightLB = 100;
- int widthLB = 100;
+ int heightLB = ac.heightLBDefault;
+ int widthLB = ac.widthLBDefault;
if (pt.x >= rcClient.right - widthLB) {
HorizontalScrollTo(xOffset + pt.x - rcClient.right + widthLB);
Redraw();