diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 71564675..e5ad01ee 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -4105,19 +4105,29 @@ void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask) } } -void Notepad_plus::notifyBufferActivated(BufferID bufid, int view) { +void Notepad_plus::notifyBufferActivated(BufferID bufid, int view) +{ + Buffer * buf = MainFileManager->getBufferByID(bufid); buf->increaseRecentTag(); - if (view == MAIN_VIEW) { - _autoCompleteMain.setLanguage(buf->getLangType()); - } else if (view == SUB_VIEW) { - _autoCompleteSub.setLanguage(buf->getLangType()); + NppParameters *pNppParam = NppParameters::getInstance(); + const NppGUI & nppGUI = pNppParam->getNppGUI(); + if (nppGUI._autocStatus == nppGUI.autoc_func) + { + if (view == MAIN_VIEW) + { + _autoCompleteMain.setLanguage(buf->getLangType()); + } + else if (view == SUB_VIEW) + { + _autoCompleteSub.setLanguage(buf->getLangType()); + } } - if (view != currentView()) { + if (view != currentView()) return; //dont care if another view did something - } + checkDocState(); dynamicCheckMenuAndTB(); diff --git a/PowerEditor/src/ScitillaComponent/AutoCompletion.cpp b/PowerEditor/src/ScitillaComponent/AutoCompletion.cpp index 3d9b955e..bea24d77 100644 --- a/PowerEditor/src/ScitillaComponent/AutoCompletion.cpp +++ b/PowerEditor/src/ScitillaComponent/AutoCompletion.cpp @@ -28,13 +28,6 @@ static bool isInList(generic_string word, const vector & wordArr return false; }; -AutoCompletion::AutoCompletion(ScintillaEditView * pEditView) : _funcCompletionActive(false), _pEditView(pEditView), _funcCalltip(pEditView), - _curLang(L_TEXT), _XmlFile(TEXT("")), _activeCompletion(CompletionNone), - _pXmlKeyword(NULL), _ignoreCase(true), _keyWords(TEXT("")) -{ - //Do not load any language yet -} - bool AutoCompletion::showAutoComplete() { if (!_funcCompletionActive) return false; @@ -214,13 +207,16 @@ bool AutoCompletion::setLanguage(LangType language) { lstrcat(path, getApiFileName()); lstrcat(path, TEXT(".xml")); - _XmlFile = TiXmlDocument(path); - _funcCompletionActive = _XmlFile.LoadFile(); + if (_pXmlFile) + delete _pXmlFile; + + _pXmlFile = new TiXmlDocument(path); + _funcCompletionActive = _pXmlFile->LoadFile(); TiXmlNode * pAutoNode = NULL; if (_funcCompletionActive) { _funcCompletionActive = false; //safety - TiXmlNode * pNode = _XmlFile.FirstChild(TEXT("NotepadPlus")); + TiXmlNode * pNode = _pXmlFile->FirstChild(TEXT("NotepadPlus")); if (!pNode) return false; pAutoNode = pNode = pNode->FirstChildElement(TEXT("AutoComplete")); diff --git a/PowerEditor/src/ScitillaComponent/AutoCompletion.h b/PowerEditor/src/ScitillaComponent/AutoCompletion.h index b74fe943..591bd825 100644 --- a/PowerEditor/src/ScitillaComponent/AutoCompletion.h +++ b/PowerEditor/src/ScitillaComponent/AutoCompletion.h @@ -31,7 +31,18 @@ class ScintillaEditView; class AutoCompletion { public: enum ActiveCompletion {CompletionNone = 0, CompletionAuto, CompletionWord, CompletionFunc}; - AutoCompletion(ScintillaEditView * pEditView); + + AutoCompletion(ScintillaEditView * pEditView) : _funcCompletionActive(false), _pEditView(pEditView), _funcCalltip(pEditView), + _curLang(L_TEXT), _pXmlFile(NULL), _activeCompletion(CompletionNone), + _pXmlKeyword(NULL), _ignoreCase(true), _keyWords(TEXT("")) { + //Do not load any language yet + }; + + ~AutoCompletion(){ + if (_pXmlFile) + delete _pXmlFile; + }; + bool setLanguage(LangType language); //AutoComplete from the list @@ -48,8 +59,8 @@ private: bool _funcCompletionActive; ScintillaEditView * _pEditView; LangType _curLang; - TiXmlDocument _XmlFile; - TiXmlElement * _pXmlKeyword; + TiXmlDocument *_pXmlFile; + TiXmlElement *_pXmlKeyword; ActiveCompletion _activeCompletion; bool _ignoreCase; diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h index 8fe8b810..4d892807 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h @@ -880,7 +880,7 @@ protected: bool isCJK() const { return ((_codepage == CP_CHINESE_TRADITIONAL) || (_codepage == CP_CHINESE_SIMPLIFIED) || - (_codepage == CP_JAPANESE) || (_codepage == CP_KOREAN) || (_codepage == CP_GREEK)); + (_codepage == CP_JAPANESE) || (_codepage == CP_KOREAN)); }; int codepage2CharSet() const { diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index 77250226..79285d28 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -1713,39 +1713,6 @@ BOOL CALLBACK PrintSettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM) } -/* -BOOL CALLBACK PrintSettings2Dlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM) -{ - NppParameters *pNppParam = NppParameters::getInstance(); - NppGUI & nppGUI = (NppGUI & )pNppParam->getNppGUI(); - - switch (Message) - { - case WM_INITDIALOG : - { - - } - case WM_COMMAND : - { - if (HIWORD(wParam) == EN_CHANGE) - { - - - - } - - - switch (wParam) - { - - - } - return TRUE; - } - } - return FALSE; -} -*/ BOOL CALLBACK BackupDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM) {