[NEW_FEATURE] AutoC finished.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@30 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
8d99c62d5f
commit
30a7f93cb9
|
@ -1844,7 +1844,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
|
||||||
charAdded(static_cast<char>(notification->ch));
|
charAdded(static_cast<char>(notification->ch));
|
||||||
const NppGUI & nppGUI = NppParameters::getInstance()->getNppGUI();
|
const NppGUI & nppGUI = NppParameters::getInstance()->getNppGUI();
|
||||||
if (nppGUI._autocStatus == nppGUI.autoc_word)
|
if (nppGUI._autocStatus == nppGUI.autoc_word)
|
||||||
autoCompFromCurrentFile();
|
autoCompFromCurrentFile(false);
|
||||||
else if (nppGUI._autocStatus == nppGUI.autoc_func)
|
else if (nppGUI._autocStatus == nppGUI.autoc_func)
|
||||||
showAutoComp();
|
showAutoComp();
|
||||||
|
|
||||||
|
@ -4494,7 +4494,7 @@ static bool isInList(string word, const vector<string> & wordArray)
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
void Notepad_plus::autoCompFromCurrentFile()
|
void Notepad_plus::autoCompFromCurrentFile(bool autoInsert)
|
||||||
{
|
{
|
||||||
int curPos = int(_pEditView->execute(SCI_GETCURRENTPOS));
|
int curPos = int(_pEditView->execute(SCI_GETCURRENTPOS));
|
||||||
int startPos = int(_pEditView->execute(SCI_WORDSTARTPOSITION, curPos, true));
|
int startPos = int(_pEditView->execute(SCI_WORDSTARTPOSITION, curPos, true));
|
||||||
|
@ -4542,7 +4542,7 @@ void Notepad_plus::autoCompFromCurrentFile()
|
||||||
}
|
}
|
||||||
if (wordArray.size() == 0) return;
|
if (wordArray.size() == 0) return;
|
||||||
|
|
||||||
if (wordArray.size() == 1)
|
if (wordArray.size() == 1 && autoInsert)
|
||||||
{
|
{
|
||||||
_pEditView->execute(SCI_SETTARGETSTART, startPos);
|
_pEditView->execute(SCI_SETTARGETSTART, startPos);
|
||||||
_pEditView->execute(SCI_SETTARGETEND, curPos);
|
_pEditView->execute(SCI_SETTARGETEND, curPos);
|
||||||
|
|
|
@ -827,7 +827,7 @@ private:
|
||||||
|
|
||||||
void updateStatusBar();
|
void updateStatusBar();
|
||||||
void showAutoComp();
|
void showAutoComp();
|
||||||
void autoCompFromCurrentFile();
|
void autoCompFromCurrentFile(bool autoInsert = true);
|
||||||
void getApiFileName(LangType langType, std::string &fn);
|
void getApiFileName(LangType langType, std::string &fn);
|
||||||
|
|
||||||
void changeStyleCtrlsLang(HWND hDlg, int *idArray, const char **translatedText);
|
void changeStyleCtrlsLang(HWND hDlg, int *idArray, const char **translatedText);
|
||||||
|
|
|
@ -2045,6 +2045,12 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||||
_nppGUI._globalOverride.enableUnderLine = true;
|
_nppGUI._globalOverride.enableUnderLine = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (!strcmp(nm, "auto-completion"))
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
if (element->Attribute("autoCAction", &i))
|
||||||
|
_nppGUI._autocStatus = (NppGUI::AutocStatus)i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2317,6 +2323,7 @@ void NppParameters::writeGUIParams()
|
||||||
bool saveOpenFileInSameDirExist = false;
|
bool saveOpenFileInSameDirExist = false;
|
||||||
bool URLExist = false;
|
bool URLExist = false;
|
||||||
bool globalOverrideExist = false;
|
bool globalOverrideExist = false;
|
||||||
|
bool autocExist = false;
|
||||||
|
|
||||||
TiXmlNode *dockingParamNode = NULL;
|
TiXmlNode *dockingParamNode = NULL;
|
||||||
|
|
||||||
|
@ -2499,6 +2506,12 @@ void NppParameters::writeGUIParams()
|
||||||
pStr = _nppGUI._globalOverride.enableUnderLine?"yes":"no";
|
pStr = _nppGUI._globalOverride.enableUnderLine?"yes":"no";
|
||||||
element->SetAttribute("underline", pStr);
|
element->SetAttribute("underline", pStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!strcmp(nm, "auto-completion"))
|
||||||
|
{
|
||||||
|
autocExist = true;
|
||||||
|
element->SetAttribute("autoCAction", _nppGUI._autocStatus);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!autoDetectionExist)
|
if (!autoDetectionExist)
|
||||||
|
@ -2593,6 +2606,13 @@ void NppParameters::writeGUIParams()
|
||||||
GUIConfigElement->SetAttribute("italic", _nppGUI._globalOverride.enableItalic?"yes":"no");
|
GUIConfigElement->SetAttribute("italic", _nppGUI._globalOverride.enableItalic?"yes":"no");
|
||||||
GUIConfigElement->SetAttribute("underline", _nppGUI._globalOverride.enableUnderLine?"yes":"no");
|
GUIConfigElement->SetAttribute("underline", _nppGUI._globalOverride.enableUnderLine?"yes":"no");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!autocExist)
|
||||||
|
{
|
||||||
|
TiXmlElement *GUIConfigElement = (GUIRoot->InsertEndChild(TiXmlElement("GUIConfig")))->ToElement();
|
||||||
|
GUIConfigElement->SetAttribute("name", "auto-completion");
|
||||||
|
GUIConfigElement->SetAttribute("autoCAction", _nppGUI._autocStatus);
|
||||||
|
}
|
||||||
|
|
||||||
if (!saveOpenFileInSameDirExist)
|
if (!saveOpenFileInSameDirExist)
|
||||||
{
|
{
|
||||||
|
|
|
@ -490,7 +490,7 @@ struct NppGUI
|
||||||
_splitterPos(POS_HORIZOTAL), _userDefineDlgStatus(UDD_DOCKED), _tabSize(8),\
|
_splitterPos(POS_HORIZOTAL), _userDefineDlgStatus(UDD_DOCKED), _tabSize(8),\
|
||||||
_tabReplacedBySpace(false), _fileAutoDetection(cdEnabled), _checkHistoryFiles(true),\
|
_tabReplacedBySpace(false), _fileAutoDetection(cdEnabled), _checkHistoryFiles(true),\
|
||||||
_isMaximized(false), _isMinimizedToTray(false), _rememberLastSession(true), _backup(bak_none), _useDir(false),\
|
_isMaximized(false), _isMinimizedToTray(false), _rememberLastSession(true), _backup(bak_none), _useDir(false),\
|
||||||
_doTaskList(true), _maitainIndent(true), _saveOpenKeepInSameDir(false), _styleMRU(true), _styleURL(0) {
|
_doTaskList(true), _maitainIndent(true), _saveOpenKeepInSameDir(false), _styleMRU(true), _styleURL(0), _autocStatus(autoc_none) {
|
||||||
_appPos.left = 0;
|
_appPos.left = 0;
|
||||||
_appPos.top = 0;
|
_appPos.top = 0;
|
||||||
_appPos.right = 700;
|
_appPos.right = 700;
|
||||||
|
|
Loading…
Reference in New Issue