From e0eaaea9610cd92f699f1ef491d007684fa3437e Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sat, 7 Jun 2008 01:11:34 +0000 Subject: =?UTF-8?q?Added=20AutoCCancelled=20event=20implementation=20from?= =?UTF-8?q?=20Enrico=20Tr=C3=B6ger.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/ScintillaDoc.html | 5 +++++ include/Scintilla.h | 1 + include/Scintilla.iface | 1 + src/ScintillaBase.cxx | 21 ++++++++++++++------- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 0ed4ffa8a..9bc173fec 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -4808,6 +4808,7 @@ struct SCNotification { SCN_INDICATORRELEASE
SCN_CALLTIPCLICK
SCN_AUTOCSELECTION
+ SCN_AUTOCCANCELLED

The following SCI_* messages are associated with these notifications:

@@ -5443,6 +5444,10 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next +

SCN_AUTOCCANCELLED
+ The user has cancelled an autocompletion list. + There is no other information in SCNotification. +

GTK+

On GTK+, the following functions create a Scintilla widget, communicate with it and allow resources to be released after all Scintilla widgets hace been destroyed.

diff --git a/include/Scintilla.h b/include/Scintilla.h index 90e7669ed..b1e6e3504 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -751,6 +751,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCN_AUTOCSELECTION 2022 #define SCN_INDICATORCLICK 2023 #define SCN_INDICATORRELEASE 2024 +#define SCN_AUTOCCANCELLED 2025 //--Autogenerated -- end of section automatically generated from Scintilla.iface // These structures are defined to be exactly the same shape as the Win32 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index edecbec51..32a257345 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -3326,6 +3326,7 @@ evt void CallTipClick=2021(int position) evt void AutoCSelection=2022(string text) evt void IndicatorClick=2023(int modifiers, int position) evt void IndicatorRelease=2024(int modifiers, int position) +evt void AutoCCancelled=2025(void) cat Deprecated diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index 679cc1d1f..d1d9ad4cb 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -173,7 +173,7 @@ int ScintillaBase::KeyCommand(unsigned int iMessage) { return 0; default: - ac.Cancel(); + AutoCompleteCancel(); } } @@ -287,6 +287,13 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) { } void ScintillaBase::AutoCompleteCancel() { + if (ac.Active()) { + SCNotification scn = {0}; + scn.nmhdr.code = SCN_AUTOCCANCELLED; + scn.wParam = 0; + scn.listType = 0; + NotifyParent(scn); + } ac.Cancel(); } @@ -308,7 +315,7 @@ void ScintillaBase::AutoCompleteCharacterAdded(char ch) { if (ac.IsFillUpChar(ch)) { AutoCompleteCompleted(); } else if (ac.IsStopChar(ch)) { - ac.Cancel(); + AutoCompleteCancel(); } else { AutoCompleteMoveToCurrentWord(); } @@ -316,9 +323,9 @@ void ScintillaBase::AutoCompleteCharacterAdded(char ch) { void ScintillaBase::AutoCompleteCharacterDeleted() { if (currentPos < ac.posStart - ac.startLen) { - ac.Cancel(); + AutoCompleteCancel(); } else if (ac.cancelAtStartPos && (currentPos <= ac.posStart)) { - ac.Cancel(); + AutoCompleteCancel(); } else { AutoCompleteMoveToCurrentWord(); } @@ -331,7 +338,7 @@ void ScintillaBase::AutoCompleteCompleted() { if (item != -1) { ac.lb->GetValue(item, selected, sizeof(selected)); } else { - ac.Cancel(); + AutoCompleteCancel(); return; } @@ -378,7 +385,7 @@ int ScintillaBase::AutoCompleteGetCurrent() { } void ScintillaBase::CallTipShow(Point pt, const char *defn) { - AutoCompleteCancel(); + 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 @@ -518,7 +525,7 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara break; case SCI_AUTOCCANCEL: - AutoCompleteCancel(); + ac.Cancel(); break; case SCI_AUTOCACTIVE: -- cgit v1.2.3