Browse Source

[NEW_FEATURE] AutoC finished.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@30 f5eea248-9336-0410-98b8-ebc06183d4e3
pull/343/head^2
donho 17 years ago
parent
commit
30a7f93cb9
  1. 6
      PowerEditor/src/Notepad_plus.cpp
  2. 2
      PowerEditor/src/Notepad_plus.h
  3. 20
      PowerEditor/src/Parameters.cpp
  4. 2
      PowerEditor/src/Parameters.h

6
PowerEditor/src/Notepad_plus.cpp

@ -1844,7 +1844,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
charAdded(static_cast<char>(notification->ch));
const NppGUI & nppGUI = NppParameters::getInstance()->getNppGUI();
if (nppGUI._autocStatus == nppGUI.autoc_word)
autoCompFromCurrentFile();
autoCompFromCurrentFile(false);
else if (nppGUI._autocStatus == nppGUI.autoc_func)
showAutoComp();
@ -4494,7 +4494,7 @@ static bool isInList(string word, const vector<string> & wordArray)
return false;
};
void Notepad_plus::autoCompFromCurrentFile()
void Notepad_plus::autoCompFromCurrentFile(bool autoInsert)
{
int curPos = int(_pEditView->execute(SCI_GETCURRENTPOS));
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() == 1)
if (wordArray.size() == 1 && autoInsert)
{
_pEditView->execute(SCI_SETTARGETSTART, startPos);
_pEditView->execute(SCI_SETTARGETEND, curPos);

2
PowerEditor/src/Notepad_plus.h

@ -827,7 +827,7 @@ private:
void updateStatusBar();
void showAutoComp();
void autoCompFromCurrentFile();
void autoCompFromCurrentFile(bool autoInsert = true);
void getApiFileName(LangType langType, std::string &fn);
void changeStyleCtrlsLang(HWND hDlg, int *idArray, const char **translatedText);

20
PowerEditor/src/Parameters.cpp

@ -2045,6 +2045,12 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
_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 URLExist = false;
bool globalOverrideExist = false;
bool autocExist = false;
TiXmlNode *dockingParamNode = NULL;
@ -2499,6 +2506,12 @@ void NppParameters::writeGUIParams()
pStr = _nppGUI._globalOverride.enableUnderLine?"yes":"no";
element->SetAttribute("underline", pStr);
}
if (!strcmp(nm, "auto-completion"))
{
autocExist = true;
element->SetAttribute("autoCAction", _nppGUI._autocStatus);
}
}
if (!autoDetectionExist)
@ -2593,6 +2606,13 @@ void NppParameters::writeGUIParams()
GUIConfigElement->SetAttribute("italic", _nppGUI._globalOverride.enableItalic?"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)
{

2
PowerEditor/src/Parameters.h

@ -490,7 +490,7 @@ struct NppGUI
_splitterPos(POS_HORIZOTAL), _userDefineDlgStatus(UDD_DOCKED), _tabSize(8),\
_tabReplacedBySpace(false), _fileAutoDetection(cdEnabled), _checkHistoryFiles(true),\
_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.top = 0;
_appPos.right = 700;

Loading…
Cancel
Save