diff options
author | nyamatongwe <unknown> | 2007-07-07 02:54:22 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2007-07-07 02:54:22 +0000 |
commit | f6a09392bbf959d95cd112b9ce1378a0f952776f (patch) | |
tree | 7681b30a848dc22928a9a8c6fb1b1e71ea2c51fc /src/ScintillaBase.cxx | |
parent | eaeb779814bcf5487015c8ddc99e8ff5df4ff34f (diff) | |
download | scintilla-mirror-f6a09392bbf959d95cd112b9ce1378a0f952776f.tar.gz |
Allows the popup to be displayed below as long as it can fit on the monitor
the cursor is on rather than flipping up above the current point when near
bottom of window.
Implemented for GTK+ by John Ehresman.
Partial Windows implementation #ifdefed out because it uses calls
unavailable on Windows 95.
Diffstat (limited to 'src/ScintillaBase.cxx')
-rw-r--r-- | src/ScintillaBase.cxx | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index e2dd9473e..f8571e962 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -231,6 +231,9 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) { PRectangle rcClient = GetClientRectangle(); Point pt = LocationFromPosition(currentPos - lenEntered); + PRectangle rcPopupBounds = wMain.GetMonitorRect(pt); + if (rcPopupBounds.Height() == 0) + rcPopupBounds = rcClient; int heightLB = 100; int widthLB = 100; @@ -241,18 +244,18 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) { } PRectangle rcac; rcac.left = pt.x - ac.lb->CaretFromEdge(); - if (pt.y >= rcClient.bottom - heightLB && // Wont fit below. - pt.y >= (rcClient.bottom + rcClient.top) / 2) { // and there is more room above. + if (pt.y >= rcPopupBounds.bottom - heightLB && // Wont fit below. + pt.y >= (rcPopupBounds.bottom + rcPopupBounds.top) / 2) { // and there is more room above. rcac.top = pt.y - heightLB; - if (rcac.top < 0) { - heightLB += rcac.top; - rcac.top = 0; + if (rcac.top < rcPopupBounds.top) { + heightLB -= (rcPopupBounds.top - rcac.top); + rcac.top = rcPopupBounds.top; } } else { rcac.top = pt.y + vs.lineHeight; } rcac.right = rcac.left + widthLB; - rcac.bottom = Platform::Minimum(rcac.top + heightLB, rcClient.bottom); + rcac.bottom = Platform::Minimum(rcac.top + heightLB, rcPopupBounds.bottom); ac.lb->SetPositionRelative(rcac, wMain); ac.lb->SetFont(vs.styles[STYLE_DEFAULT].font); unsigned int aveCharWidth = vs.styles[STYLE_DEFAULT].aveCharWidth; @@ -270,8 +273,8 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) { // Make an allowance for large strings in list rcList.left = pt.x - ac.lb->CaretFromEdge(); rcList.right = rcList.left + widthLB; - if (((pt.y + vs.lineHeight) >= (rcClient.bottom - heightAlloced)) && // Wont fit below. - ((pt.y + vs.lineHeight / 2) >= (rcClient.bottom + rcClient.top) / 2)) { // and there is more room above. + if (((pt.y + vs.lineHeight) >= (rcPopupBounds.bottom - heightAlloced)) && // Wont fit below. + ((pt.y + vs.lineHeight / 2) >= (rcPopupBounds.bottom + rcPopupBounds.top) / 2)) { // and there is more room above. rcList.top = pt.y - heightAlloced; } else { rcList.top = pt.y + vs.lineHeight; |