diff options
-rw-r--r-- | Readme-mod.txt | 2 | ||||
-rw-r--r-- | scintilla/include/Scintilla.h | 1 | ||||
-rw-r--r-- | scintilla/include/Scintilla.iface | 3 | ||||
-rw-r--r-- | scintilla/src/CallTip.cxx | 15 | ||||
-rw-r--r-- | scintilla/src/CallTip.h | 6 | ||||
-rw-r--r-- | scintilla/src/ScintillaBase.cxx | 17 |
6 files changed, 37 insertions, 7 deletions
diff --git a/Readme-mod.txt b/Readme-mod.txt index 4f85c10..2f10143 100644 --- a/Readme-mod.txt +++ b/Readme-mod.txt @@ -24,4 +24,4 @@ More information: Notepad2-mod 4.2.25 has been created with Scintilla 2.29. The unused lexers
are commented out in "scintilla/src/Catalogue.cxx". You can use WDK 7.1,
-or MSVC 2010, or Intel Parallel Composer 2011 to build Notepad2-mod.
+MSVC 2010, or Intel Parallel Composer 2011 to build Notepad2-mod.
diff --git a/scintilla/include/Scintilla.h b/scintilla/include/Scintilla.h index 8355551..217a90d 100644 --- a/scintilla/include/Scintilla.h +++ b/scintilla/include/Scintilla.h @@ -415,6 +415,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_CALLTIPSETFORE 2206
#define SCI_CALLTIPSETFOREHLT 2207
#define SCI_CALLTIPUSESTYLE 2212
+#define SCI_CALLTIPSETPOSITION 2213
#define SCI_VISIBLEFROMDOCLINE 2220
#define SCI_DOCLINEFROMVISIBLE 2221
#define SCI_WRAPCOUNT 2235
diff --git a/scintilla/include/Scintilla.iface b/scintilla/include/Scintilla.iface index 3c2741c..e2c116a 100644 --- a/scintilla/include/Scintilla.iface +++ b/scintilla/include/Scintilla.iface @@ -1039,6 +1039,9 @@ set void CallTipSetForeHlt=2207(colour fore,) # Enable use of STYLE_CALLTIP and set call tip tab size in pixels.
set void CallTipUseStyle=2212(int tabSize,)
+# Set position of calltip, above or below text.
+set void CallTipSetPosition=2213(bool above,)
+
# Find the display line of a document line taking hidden lines into account.
fun int VisibleFromDocLine=2220(int line,)
diff --git a/scintilla/src/CallTip.cxx b/scintilla/src/CallTip.cxx index 04c93b0..1729d68 100644 --- a/scintilla/src/CallTip.cxx +++ b/scintilla/src/CallTip.cxx @@ -33,6 +33,7 @@ CallTip::CallTip() { startHighlight = 0;
endHighlight = 0;
tabSize = 0;
+ above = false;
useStyleCallTip = false; // for backwards compatibility
#ifdef __APPLE__
@@ -245,7 +246,7 @@ void CallTip::MouseClick(Point pt) { clickPlace = 2;
}
-PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn,
+PRectangle CallTip::CallTipStart(int pos, Point pt, int textHeight, const char *defn,
const char *faceName, int size,
int codePage_, int characterSet,
int technology, Window &wParent) {
@@ -288,7 +289,11 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn, // the tip text, else to the tip text left edge.
int height = lineHeight * numLines - surfaceMeasure->InternalLeading(font) + 2 + 2;
delete surfaceMeasure;
- return PRectangle(pt.x - offsetMain, pt.y + 1, pt.x + width - offsetMain, pt.y + 1 + height);
+ if (above) {
+ return PRectangle(pt.x - offsetMain, pt.y - 1 - height, pt.x + width - offsetMain, pt.y - 1);
+ } else {
+ return PRectangle(pt.x - offsetMain, pt.y + 1 + textHeight, pt.x + width - offsetMain, pt.y + 1 + textHeight + height);
+ }
}
void CallTip::CallTipCancel() {
@@ -316,6 +321,12 @@ void CallTip::SetTabSize(int tabSz) { useStyleCallTip = true;
}
+// Set the calltip position, below the text by default or if above is false
+// else above the text.
+void CallTip::SetPosition(bool aboveText) {
+ above = aboveText;
+}
+
// It might be better to have two access functions for this and to use
// them for all settings of colours.
void CallTip::SetForeBack(const ColourDesired &fore, const ColourDesired &back) {
diff --git a/scintilla/src/CallTip.h b/scintilla/src/CallTip.h index 74cd05a..7b296ec 100644 --- a/scintilla/src/CallTip.h +++ b/scintilla/src/CallTip.h @@ -25,6 +25,7 @@ class CallTip { int offsetMain; // The alignment point of the call tip
int tabSize; // Tab size in pixels, <=0 no TAB expand
bool useStyleCallTip; // if true, STYLE_CALLTIP should be used
+ bool above; // if true, display calltip above text
// Private so CallTip objects can not be copied
CallTip(const CallTip &);
@@ -57,7 +58,7 @@ public: void MouseClick(Point pt);
/// Setup the calltip and return a rectangle of the area required.
- PRectangle CallTipStart(int pos, Point pt, const char *defn,
+ PRectangle CallTipStart(int pos, Point pt, int textHeight, const char *defn,
const char *faceName, int size, int codePage_,
int characterSet, int technology, Window &wParent);
@@ -70,6 +71,9 @@ public: /// Set the tab size in pixels for the call tip. 0 or -ve means no tab expand.
void SetTabSize(int tabSz);
+ /// Set calltip position.
+ void SetPosition(bool aboveText);
+
/// Used to determine which STYLE_xxxx to use for call tip information
bool UseStyleCallTip() const { return useStyleCallTip;}
diff --git a/scintilla/src/ScintillaBase.cxx b/scintilla/src/ScintillaBase.cxx index 27c45c5..f8fdb5b 100644 --- a/scintilla/src/ScintillaBase.cxx +++ b/scintilla/src/ScintillaBase.cxx @@ -400,7 +400,6 @@ int ScintillaBase::AutoCompleteGetCurrentText(char *buffer) { void ScintillaBase::CallTipShow(Point pt, const char *defn) {
ac.Cancel();
- pt.y += vs.lineHeight;
// If container knows about STYLE_CALLTIP then use it in place of the
// STYLE_DEFAULT for the face name, size and character set. Also use it
// for the foreground and background colour.
@@ -409,6 +408,7 @@ void ScintillaBase::CallTipShow(Point pt, const char *defn) { ct.SetForeBack(vs.styles[STYLE_CALLTIP].fore, vs.styles[STYLE_CALLTIP].back);
}
PRectangle rc = ct.CallTipStart(sel.MainCaret(), pt,
+ vs.lineHeight,
defn,
vs.styles[ctStyle].fontName,
vs.styles[ctStyle].sizeZoomed,
@@ -417,10 +417,16 @@ void ScintillaBase::CallTipShow(Point pt, const char *defn) { vs.technology,
wMain);
// If the call-tip window would be out of the client
- // space, adjust so it displays above the text.
+ // space
PRectangle rcClient = GetClientRectangle();
+ int offset = vs.lineHeight + rc.Height();
+ // adjust so it displays below the text.
+ if (rc.top < rcClient.top) {
+ rc.top += offset;
+ rc.bottom += offset;
+ }
+ // adjust so it displays above the text.
if (rc.bottom > rcClient.bottom) {
- int offset = vs.lineHeight + rc.Height();
rc.top -= offset;
rc.bottom -= offset;
}
@@ -814,6 +820,11 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara InvalidateStyleRedraw();
break;
+ case SCI_CALLTIPSETPOSITION:
+ ct.SetPosition(wParam != 0);
+ InvalidateStyleRedraw();
+ break;
+
case SCI_USEPOPUP:
displayPopupMenu = wParam != 0;
break;
|