diff options
author | nyamatongwe <unknown> | 2005-03-25 05:08:20 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2005-03-25 05:08:20 +0000 |
commit | 66622bd04e7666e7b0556b17902dc683a22bc249 (patch) | |
tree | c11a0777465efddd66120e05cc73d7745d31ae50 /src/ScintillaBase.cxx | |
parent | 3ab465e5e5e653cc00298c2cca632deea54e0ff0 (diff) | |
download | scintilla-mirror-66622bd04e7666e7b0556b17902dc683a22bc249.tar.gz |
Patch from Blair McGlashan for autocompletion on Windows to
* Set maximum width of list
* set maximum height of list
* better calculate width
* use ellipsis when text is truncated to fit window
* use popup window so it can extend past parent window
* disallow resizing too small
* draw to bottom edge when resized so last item not full line high
* improve time to display by by 90%
Minor tweaks by me to fix warnings, layout etc.
Diffstat (limited to 'src/ScintillaBase.cxx')
-rw-r--r-- | src/ScintillaBase.cxx | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index 9526ab968..adf21ce6b 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -38,6 +38,7 @@ ScintillaBase::ScintillaBase() { displayPopupMenu = true; listType = 0; + maxListWidth = 0; #ifdef SCI_LEXER lexLanguage = SCLEX_CONTAINER; lexCurrent = 0; @@ -214,7 +215,8 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) { return; } } - ac.Start(wMain, idAutoComplete, currentPos, lenEntered, vs.lineHeight, IsUnicodeMode()); + ac.Start(wMain, idAutoComplete, currentPos, LocationFromPosition(currentPos), + lenEntered, vs.lineHeight, IsUnicodeMode()); PRectangle rcClient = GetClientRectangle(); Point pt = LocationFromPosition(currentPos - lenEntered); @@ -242,7 +244,8 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) { rcac.bottom = Platform::Minimum(rcac.top + heightLB, rcClient.bottom); ac.lb->SetPositionRelative(rcac, wMain); ac.lb->SetFont(vs.styles[STYLE_DEFAULT].font); - ac.lb->SetAverageCharWidth(vs.styles[STYLE_DEFAULT].aveCharWidth); + unsigned int aveCharWidth = vs.styles[STYLE_DEFAULT].aveCharWidth; + ac.lb->SetAverageCharWidth(aveCharWidth); ac.lb->SetDoubleClickAction(AutoCompleteDoubleClick, this); ac.SetList(list); @@ -251,6 +254,8 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) { PRectangle rcList = ac.lb->GetDesiredRect(); int heightAlloced = rcList.bottom - rcList.top; widthLB = Platform::Maximum(widthLB, rcList.right - rcList.left); + if (maxListWidth != 0) + widthLB = Platform::Minimum(widthLB, aveCharWidth*maxListWidth); // Make an allowance for large strings in list rcList.left = pt.x - ac.lb->CaretFromEdge(); rcList.right = rcList.left + widthLB; @@ -559,6 +564,20 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara case SCI_AUTOCGETDROPRESTOFWORD: return ac.dropRestOfWord; + case SCI_AUTOCSETMAXHEIGHT: + ac.lb->SetVisibleRows(wParam); + break; + + case SCI_AUTOCGETMAXHEIGHT: + return ac.lb->GetVisibleRows(); + + case SCI_AUTOCSETMAXWIDTH: + maxListWidth = wParam; + break; + + case SCI_AUTOCGETMAXWIDTH: + return maxListWidth; + case SCI_REGISTERIMAGE: ac.lb->RegisterImage(wParam, reinterpret_cast<const char *>(lParam)); break; |