Code improvement for NppParameters

This commit is contained in:
Don HO 2019-08-14 22:13:24 +02:00
parent bbc55d06f2
commit 06db9ee338
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E
50 changed files with 921 additions and 931 deletions

View File

@ -123,7 +123,7 @@ int PluginsManager::loadPlugin(const TCHAR *pluginFilePath)
if (isInLoadedDlls(pluginFileName)) if (isInLoadedDlls(pluginFileName))
return 0; return 0;
NppParameters * nppParams = NppParameters::getInstance(); NppParameters& nppParams = NppParameters::getInstance();
PluginInfo *pi = new PluginInfo; PluginInfo *pi = new PluginInfo;
try try
@ -208,14 +208,14 @@ int PluginsManager::loadPlugin(const TCHAR *pluginFilePath)
GetLexerName(x, lexName, MAX_EXTERNAL_LEXER_NAME_LEN); GetLexerName(x, lexName, MAX_EXTERNAL_LEXER_NAME_LEN);
GetLexerStatusText(x, lexDesc, MAX_EXTERNAL_LEXER_DESC_LEN); GetLexerStatusText(x, lexDesc, MAX_EXTERNAL_LEXER_DESC_LEN);
const TCHAR *pLexerName = wmc.char2wchar(lexName, CP_ACP); const TCHAR *pLexerName = wmc.char2wchar(lexName, CP_ACP);
if (!nppParams->isExistingExternalLangName(pLexerName) && nppParams->ExternalLangHasRoom()) if (!nppParams.isExistingExternalLangName(pLexerName) && nppParams.ExternalLangHasRoom())
containers[x] = new ExternalLangContainer(pLexerName, lexDesc); containers[x] = new ExternalLangContainer(pLexerName, lexDesc);
else else
containers[x] = NULL; containers[x] = NULL;
} }
TCHAR xmlPath[MAX_PATH]; TCHAR xmlPath[MAX_PATH];
wcscpy_s(xmlPath, nppParams->getNppPath().c_str()); wcscpy_s(xmlPath, nppParams.getNppPath().c_str());
PathAppend(xmlPath, TEXT("plugins\\Config")); PathAppend(xmlPath, TEXT("plugins\\Config"));
PathAppend(xmlPath, pi->_moduleName.c_str()); PathAppend(xmlPath, pi->_moduleName.c_str());
PathRemoveExtension(xmlPath); PathRemoveExtension(xmlPath);
@ -224,7 +224,7 @@ int PluginsManager::loadPlugin(const TCHAR *pluginFilePath)
if (!PathFileExists(xmlPath)) if (!PathFileExists(xmlPath))
{ {
lstrcpyn(xmlPath, TEXT("\0"), MAX_PATH ); lstrcpyn(xmlPath, TEXT("\0"), MAX_PATH );
wcscpy_s(xmlPath, nppParams->getAppDataNppDir() ); wcscpy_s(xmlPath, nppParams.getAppDataNppDir() );
PathAppend(xmlPath, TEXT("plugins\\Config")); PathAppend(xmlPath, TEXT("plugins\\Config"));
PathAppend(xmlPath, pi->_moduleName.c_str()); PathAppend(xmlPath, pi->_moduleName.c_str());
PathRemoveExtension( xmlPath ); PathRemoveExtension( xmlPath );
@ -248,11 +248,11 @@ int PluginsManager::loadPlugin(const TCHAR *pluginFilePath)
for (int x = 0; x < numLexers; ++x) // postpone adding in case the xml is missing/corrupt for (int x = 0; x < numLexers; ++x) // postpone adding in case the xml is missing/corrupt
{ {
if (containers[x] != NULL) if (containers[x] != NULL)
nppParams->addExternalLangToEnd(containers[x]); nppParams.addExternalLangToEnd(containers[x]);
} }
nppParams->getExternalLexerFromXmlTree(pXmlDoc); nppParams.getExternalLexerFromXmlTree(pXmlDoc);
nppParams->getExternalLexerDoc()->push_back(pXmlDoc); nppParams.getExternalLexerDoc()->push_back(pXmlDoc);
const char *pDllName = wmc.wchar2char(pluginFilePath, CP_ACP); const char *pDllName = wmc.wchar2char(pluginFilePath, CP_ACP);
::SendMessage(_nppData._scintillaMainHandle, SCI_LOADLEXERLIBRARY, 0, reinterpret_cast<LPARAM>(pDllName)); ::SendMessage(_nppData._scintillaMainHandle, SCI_LOADLEXERLIBRARY, 0, reinterpret_cast<LPARAM>(pDllName));
@ -300,8 +300,8 @@ bool PluginsManager::loadPluginsV2(const TCHAR* dir)
vector<generic_string> dllNames; vector<generic_string> dllNames;
NppParameters * nppParams = NppParameters::getInstance(); NppParameters& nppParams = NppParameters::getInstance();
generic_string nppPath = nppParams->getNppPath(); generic_string nppPath = nppParams.getNppPath();
generic_string pluginsFolder; generic_string pluginsFolder;
if (dir && dir[0]) if (dir && dir[0])
@ -339,7 +339,7 @@ bool PluginsManager::loadPluginsV2(const TCHAR* dir)
{ {
dllNames.push_back(pluginsFullPathFilter); dllNames.push_back(pluginsFullPathFilter);
PluginList & pl = nppParams->getPluginList(); PluginList & pl = nppParams.getPluginList();
pl.add(foundFileName, false); pl.add(foundFileName, false);
} }
} }
@ -367,7 +367,7 @@ bool PluginsManager::loadPluginsV2(const TCHAR* dir)
{ {
dllNames.push_back(pluginsFullPathFilter2); dllNames.push_back(pluginsFullPathFilter2);
PluginList & pl = nppParams->getPluginList(); PluginList & pl = nppParams.getPluginList();
pl.add(foundFileName2, false); pl.add(foundFileName2, false);
} }
} }
@ -392,7 +392,7 @@ bool PluginsManager::getShortcutByCmdID(int cmdID, ShortcutKey *sk)
if (cmdID == 0 || !sk) if (cmdID == 0 || !sk)
return false; return false;
const vector<PluginCmdShortcut> & pluginCmdSCList = (NppParameters::getInstance())->getPluginCommandList(); const vector<PluginCmdShortcut> & pluginCmdSCList = (NppParameters::getInstance()).getPluginCommandList();
for (size_t i = 0, len = pluginCmdSCList.size(); i < len ; ++i) for (size_t i = 0, len = pluginCmdSCList.size(); i < len ; ++i)
{ {
@ -417,8 +417,8 @@ bool PluginsManager::removeShortcutByCmdID(int cmdID)
{ {
if (cmdID == 0) { return false; } if (cmdID == 0) { return false; }
NppParameters *nppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
vector<PluginCmdShortcut> & pluginCmdSCList = nppParam->getPluginCommandList(); vector<PluginCmdShortcut> & pluginCmdSCList = nppParam.getPluginCommandList();
for (size_t i = 0, len = pluginCmdSCList.size(); i < len; ++i) for (size_t i = 0, len = pluginCmdSCList.size(); i < len; ++i)
{ {
@ -428,10 +428,10 @@ bool PluginsManager::removeShortcutByCmdID(int cmdID)
pluginCmdSCList[i].clear(); pluginCmdSCList[i].clear();
// inform accelerator instance // inform accelerator instance
nppParam->getAccelerator()->updateShortcuts(); nppParam.getAccelerator()->updateShortcuts();
// set dirty flag to force writing shortcuts.xml on shutdown // set dirty flag to force writing shortcuts.xml on shutdown
nppParam->setShortcutDirty(); nppParam.setShortcutDirty();
break; break;
} }
} }
@ -440,7 +440,7 @@ bool PluginsManager::removeShortcutByCmdID(int cmdID)
void PluginsManager::addInMenuFromPMIndex(int i) void PluginsManager::addInMenuFromPMIndex(int i)
{ {
vector<PluginCmdShortcut> & pluginCmdSCList = (NppParameters::getInstance())->getPluginCommandList(); vector<PluginCmdShortcut> & pluginCmdSCList = (NppParameters::getInstance()).getPluginCommandList();
::InsertMenu(_hPluginsMenu, i, MF_BYPOSITION | MF_POPUP, (UINT_PTR)_pluginInfos[i]->_pluginMenu, _pluginInfos[i]->_funcName.c_str()); ::InsertMenu(_hPluginsMenu, i, MF_BYPOSITION | MF_POPUP, (UINT_PTR)_pluginInfos[i]->_pluginMenu, _pluginInfos[i]->_funcName.c_str());
unsigned short j = 0; unsigned short j = 0;

View File

@ -30,7 +30,7 @@ INT_PTR CALLBACK HashFromFilesDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
int fontDpiDynamicalHeight = NppParameters::getInstance()->_dpiManager.scaleY(13); int fontDpiDynamicalHeight = NppParameters::getInstance()._dpiManager.scaleY(13);
HFONT hFont = ::CreateFontA(fontDpiDynamicalHeight, 0, 0, 0, 0, FALSE, FALSE, FALSE, ANSI_CHARSET, HFONT hFont = ::CreateFontA(fontDpiDynamicalHeight, 0, 0, 0, 0, FALSE, FALSE, FALSE, ANSI_CHARSET,
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
DEFAULT_PITCH | FF_DONTCARE, "Courier New"); DEFAULT_PITCH | FF_DONTCARE, "Courier New");
@ -261,7 +261,7 @@ INT_PTR CALLBACK HashFromTextDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
int fontDpiDynamicalHeight = NppParameters::getInstance()->_dpiManager.scaleY(13); int fontDpiDynamicalHeight = NppParameters::getInstance()._dpiManager.scaleY(13);
HFONT hFont = ::CreateFontA(fontDpiDynamicalHeight, 0, 0, 0, 0, FALSE, FALSE, FALSE, ANSI_CHARSET, HFONT hFont = ::CreateFontA(fontDpiDynamicalHeight, 0, 0, 0, 0, FALSE, FALSE, FALSE, ANSI_CHARSET,
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
DEFAULT_PITCH | FF_DONTCARE, "Courier New"); DEFAULT_PITCH | FF_DONTCARE, "Courier New");

View File

@ -136,19 +136,19 @@ Notepad_plus::Notepad_plus()
ZeroMemory(&_prevSelectedRange, sizeof(_prevSelectedRange)); ZeroMemory(&_prevSelectedRange, sizeof(_prevSelectedRange));
TiXmlDocumentA *nativeLangDocRootA = (NppParameters::getInstance())->getNativeLangA(); TiXmlDocumentA *nativeLangDocRootA = (NppParameters::getInstance()).getNativeLangA();
_nativeLangSpeaker.init(nativeLangDocRootA); _nativeLangSpeaker.init(nativeLangDocRootA);
LocalizationSwitcher & localizationSwitcher = (NppParameters::getInstance())->getLocalizationSwitcher(); LocalizationSwitcher & localizationSwitcher = (NppParameters::getInstance()).getLocalizationSwitcher();
const char *fn = _nativeLangSpeaker.getFileName(); const char *fn = _nativeLangSpeaker.getFileName();
if (fn) if (fn)
{ {
localizationSwitcher.setFileName(fn); localizationSwitcher.setFileName(fn);
} }
(NppParameters::getInstance())->setNativeLangSpeaker(&_nativeLangSpeaker); (NppParameters::getInstance()).setNativeLangSpeaker(&_nativeLangSpeaker);
TiXmlDocument *toolIconsDocRoot = (NppParameters::getInstance())->getToolIcons(); TiXmlDocument *toolIconsDocRoot = (NppParameters::getInstance()).getToolIcons();
if (toolIconsDocRoot) if (toolIconsDocRoot)
{ {
@ -157,7 +157,7 @@ Notepad_plus::Notepad_plus()
// Determine if user is administrator. // Determine if user is administrator.
BOOL is_admin; BOOL is_admin;
winVer ver = NppParameters::getInstance()->getWinVersion(); winVer ver = NppParameters::getInstance().getWinVersion();
if (ver >= WV_VISTA || ver == WV_UNKNOWN) if (ver >= WV_VISTA || ver == WV_UNKNOWN)
{ {
SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY; SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
@ -183,7 +183,7 @@ Notepad_plus::~Notepad_plus()
// the destruction of its children windows' handles, // the destruction of its children windows' handles,
// its children windows' handles will be destroyed automatically! // its children windows' handles will be destroyed automatically!
(NppParameters::getInstance())->destroyInstance(); (NppParameters::getInstance()).destroyInstance();
delete _pTrayIco; delete _pTrayIco;
delete _pAnsiCharPanel; delete _pAnsiCharPanel;
@ -199,8 +199,8 @@ Notepad_plus::~Notepad_plus()
LRESULT Notepad_plus::init(HWND hwnd) LRESULT Notepad_plus::init(HWND hwnd)
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
NppGUI & nppGUI = const_cast<NppGUI &>(pNppParam->getNppGUI()); NppGUI & nppGUI = const_cast<NppGUI &>(nppParam.getNppGUI());
// Menu // Menu
_mainMenuHandle = ::GetMenu(hwnd); _mainMenuHandle = ::GetMenu(hwnd);
@ -221,17 +221,17 @@ LRESULT Notepad_plus::init(HWND hwnd)
_fileEditView.init(_pPublicInterface->getHinst(), hwnd); _fileEditView.init(_pPublicInterface->getHinst(), hwnd);
MainFileManager.init(this, &_fileEditView); //get it up and running asap. MainFileManager.init(this, &_fileEditView); //get it up and running asap.
pNppParam->setFontList(hwnd); nppParam.setFontList(hwnd);
_mainWindowStatus = WindowMainActive; _mainWindowStatus = WindowMainActive;
_activeView = MAIN_VIEW; _activeView = MAIN_VIEW;
const ScintillaViewParams & svp1 = pNppParam->getSVP(); const ScintillaViewParams & svp1 = nppParam.getSVP();
int tabBarStatus = nppGUI._tabStatus; int tabBarStatus = nppGUI._tabStatus;
_toReduceTabBar = ((tabBarStatus & TAB_REDUCE) != 0); _toReduceTabBar = ((tabBarStatus & TAB_REDUCE) != 0);
int iconDpiDynamicalSize = pNppParam->_dpiManager.scaleY(_toReduceTabBar?13:20); int iconDpiDynamicalSize = nppParam._dpiManager.scaleY(_toReduceTabBar?13:20);
_docTabIconList.create(iconDpiDynamicalSize, _pPublicInterface->getHinst(), docTabIconIDs, sizeof(docTabIconIDs)/sizeof(int)); _docTabIconList.create(iconDpiDynamicalSize, _pPublicInterface->getHinst(), docTabIconIDs, sizeof(docTabIconIDs)/sizeof(int));
_mainDocTab.init(_pPublicInterface->getHinst(), hwnd, &_mainEditView, &_docTabIconList); _mainDocTab.init(_pPublicInterface->getHinst(), hwnd, &_mainEditView, &_docTabIconList);
@ -341,8 +341,8 @@ LRESULT Notepad_plus::init(HWND hwnd)
::SendMessage(_mainDocTab.getHSelf(), WM_SETFONT, reinterpret_cast<WPARAM>(hf), MAKELPARAM(TRUE, 0)); ::SendMessage(_mainDocTab.getHSelf(), WM_SETFONT, reinterpret_cast<WPARAM>(hf), MAKELPARAM(TRUE, 0));
::SendMessage(_subDocTab.getHSelf(), WM_SETFONT, reinterpret_cast<WPARAM>(hf), MAKELPARAM(TRUE, 0)); ::SendMessage(_subDocTab.getHSelf(), WM_SETFONT, reinterpret_cast<WPARAM>(hf), MAKELPARAM(TRUE, 0));
} }
int tabDpiDynamicalHeight = pNppParam->_dpiManager.scaleY(22); int tabDpiDynamicalHeight = nppParam._dpiManager.scaleY(22);
int tabDpiDynamicalWidth = pNppParam->_dpiManager.scaleX(45); int tabDpiDynamicalWidth = nppParam._dpiManager.scaleX(45);
TabCtrl_SetItemSize(_mainDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight); TabCtrl_SetItemSize(_mainDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight);
TabCtrl_SetItemSize(_subDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight); TabCtrl_SetItemSize(_subDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight);
} }
@ -366,11 +366,11 @@ LRESULT Notepad_plus::init(HWND hwnd)
//--Status Bar Section--// //--Status Bar Section--//
bool willBeShown = nppGUI._statusBarShow; bool willBeShown = nppGUI._statusBarShow;
_statusBar.init(_pPublicInterface->getHinst(), hwnd, 6); _statusBar.init(_pPublicInterface->getHinst(), hwnd, 6);
_statusBar.setPartWidth(STATUSBAR_DOC_SIZE, pNppParam->_dpiManager.scaleX(200)); _statusBar.setPartWidth(STATUSBAR_DOC_SIZE, nppParam._dpiManager.scaleX(200));
_statusBar.setPartWidth(STATUSBAR_CUR_POS, pNppParam->_dpiManager.scaleX(260)); _statusBar.setPartWidth(STATUSBAR_CUR_POS, nppParam._dpiManager.scaleX(260));
_statusBar.setPartWidth(STATUSBAR_EOF_FORMAT, pNppParam->_dpiManager.scaleX(110)); _statusBar.setPartWidth(STATUSBAR_EOF_FORMAT, nppParam._dpiManager.scaleX(110));
_statusBar.setPartWidth(STATUSBAR_UNICODE_TYPE, pNppParam->_dpiManager.scaleX(120)); _statusBar.setPartWidth(STATUSBAR_UNICODE_TYPE, nppParam._dpiManager.scaleX(120));
_statusBar.setPartWidth(STATUSBAR_TYPING_MODE, pNppParam->_dpiManager.scaleX(30)); _statusBar.setPartWidth(STATUSBAR_TYPING_MODE, nppParam._dpiManager.scaleX(30));
_statusBar.display(willBeShown); _statusBar.display(willBeShown);
_pMainWindow = &_mainDocTab; _pMainWindow = &_mainDocTab;
@ -394,7 +394,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
_scintillaCtrls4Plugins.init(_pPublicInterface->getHinst(), hwnd); _scintillaCtrls4Plugins.init(_pPublicInterface->getHinst(), hwnd);
_pluginsManager.init(nppData); _pluginsManager.init(nppData);
_pluginsManager.loadPluginsV2(pNppParam->getPluginRootDir()); _pluginsManager.loadPluginsV2(nppParam.getPluginRootDir());
_restoreButton.init(_pPublicInterface->getHinst(), hwnd); _restoreButton.init(_pPublicInterface->getHinst(), hwnd);
// ------------ // // ------------ //
@ -402,7 +402,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
// ------------ // // ------------ //
// Macro Menu // Macro Menu
std::vector<MacroShortcut> & macros = pNppParam->getMacroList(); std::vector<MacroShortcut> & macros = nppParam.getMacroList();
HMENU hMacroMenu = ::GetSubMenu(_mainMenuHandle, MENUINDEX_MACRO); HMENU hMacroMenu = ::GetSubMenu(_mainMenuHandle, MENUINDEX_MACRO);
size_t const posBase = 6; size_t const posBase = 6;
size_t nbMacro = macros.size(); size_t nbMacro = macros.size();
@ -419,7 +419,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
} }
// Run Menu // Run Menu
std::vector<UserCommand> & userCommands = pNppParam->getUserCommandList(); std::vector<UserCommand> & userCommands = nppParam.getUserCommandList();
HMENU hRunMenu = ::GetSubMenu(_mainMenuHandle, MENUINDEX_RUN); HMENU hRunMenu = ::GetSubMenu(_mainMenuHandle, MENUINDEX_RUN);
int const runPosBase = 2; int const runPosBase = 2;
size_t nbUserCommand = userCommands.size(); size_t nbUserCommand = userCommands.size();
@ -453,9 +453,9 @@ LRESULT Notepad_plus::init(HWND hwnd)
HMENU hLangMenu = ::GetSubMenu(_mainMenuHandle, MENUINDEX_LANGUAGE); HMENU hLangMenu = ::GetSubMenu(_mainMenuHandle, MENUINDEX_LANGUAGE);
// Add external languages to menu // Add external languages to menu
for (int i = 0 ; i < pNppParam->getNbExternalLang() ; ++i) for (int i = 0 ; i < nppParam.getNbExternalLang() ; ++i)
{ {
ExternalLangContainer & externalLangContainer = pNppParam->getELCFromIndex(i); ExternalLangContainer & externalLangContainer = nppParam.getELCFromIndex(i);
int numLangs = ::GetMenuItemCount(hLangMenu); int numLangs = ::GetMenuItemCount(hLangMenu);
const int bufferSize = 100; const int bufferSize = 100;
@ -474,7 +474,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
{ {
for (size_t i = 0, len = nppGUI._excludedLangList.size(); i < len ; ++i) for (size_t i = 0, len = nppGUI._excludedLangList.size(); i < len ; ++i)
{ {
int cmdID = pNppParam->langTypeToCommandID(nppGUI._excludedLangList[i]._langType); int cmdID = nppParam.langTypeToCommandID(nppGUI._excludedLangList[i]._langType);
const int itemSize = 256; const int itemSize = 256;
TCHAR itemName[itemSize]; TCHAR itemName[itemSize];
::GetMenuString(hLangMenu, cmdID, itemName, itemSize, MF_BYCOMMAND); ::GetMenuString(hLangMenu, cmdID, itemName, itemSize, MF_BYCOMMAND);
@ -488,22 +488,22 @@ LRESULT Notepad_plus::init(HWND hwnd)
// Add User Defined Languages Entry // Add User Defined Languages Entry
int udlpos = ::GetMenuItemCount(hLangMenu) - 1; int udlpos = ::GetMenuItemCount(hLangMenu) - 1;
for (int i = 0, len = pNppParam->getNbUserLang(); i < len ; ++i) for (int i = 0, len = nppParam.getNbUserLang(); i < len ; ++i)
{ {
UserLangContainer & userLangContainer = pNppParam->getULCFromIndex(i); UserLangContainer & userLangContainer = nppParam.getULCFromIndex(i);
::InsertMenu(hLangMenu, udlpos + i, MF_BYPOSITION, IDM_LANG_USER + i + 1, userLangContainer.getName()); ::InsertMenu(hLangMenu, udlpos + i, MF_BYPOSITION, IDM_LANG_USER + i + 1, userLangContainer.getName());
} }
//Add recent files //Add recent files
HMENU hFileMenu = ::GetSubMenu(_mainMenuHandle, MENUINDEX_FILE); HMENU hFileMenu = ::GetSubMenu(_mainMenuHandle, MENUINDEX_FILE);
int nbLRFile = pNppParam->getNbLRFile(); int nbLRFile = nppParam.getNbLRFile();
//int pos = IDM_FILEMENU_LASTONE - IDM_FILE + 1 /* +1 : because of IDM_FILE_PRINTNOW */; //int pos = IDM_FILEMENU_LASTONE - IDM_FILE + 1 /* +1 : because of IDM_FILE_PRINTNOW */;
_lastRecentFileList.initMenu(hFileMenu, IDM_FILEMENU_LASTONE + 1, IDM_FILEMENU_EXISTCMDPOSITION, &_accelerator, pNppParam->putRecentFileInSubMenu()); _lastRecentFileList.initMenu(hFileMenu, IDM_FILEMENU_LASTONE + 1, IDM_FILEMENU_EXISTCMDPOSITION, &_accelerator, nppParam.putRecentFileInSubMenu());
_lastRecentFileList.setLangEncoding(_nativeLangSpeaker.getLangEncoding()); _lastRecentFileList.setLangEncoding(_nativeLangSpeaker.getLangEncoding());
for (int i = 0 ; i < nbLRFile ; ++i) for (int i = 0 ; i < nbLRFile ; ++i)
{ {
generic_string * stdStr = pNppParam->getLRFile(i); generic_string * stdStr = nppParam.getLRFile(i);
if (!nppGUI._checkHistoryFiles || PathFileExists(stdStr->c_str())) if (!nppGUI._checkHistoryFiles || PathFileExists(stdStr->c_str()))
{ {
_lastRecentFileList.add(stdStr->c_str()); _lastRecentFileList.add(stdStr->c_str());
@ -517,9 +517,9 @@ LRESULT Notepad_plus::init(HWND hwnd)
//Main menu is loaded, now load context menu items //Main menu is loaded, now load context menu items
pNppParam->getContextMenuFromXmlTree(_mainMenuHandle, _pluginsManager.getMenuHandle()); nppParam.getContextMenuFromXmlTree(_mainMenuHandle, _pluginsManager.getMenuHandle());
if (pNppParam->hasCustomContextMenu()) if (nppParam.hasCustomContextMenu())
{ {
_mainEditView.execute(SCI_USEPOPUP, FALSE); _mainEditView.execute(SCI_USEPOPUP, FALSE);
_subEditView.execute(SCI_USEPOPUP, FALSE); _subEditView.execute(SCI_USEPOPUP, FALSE);
@ -538,7 +538,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
_windowsMenu.init(_pPublicInterface->getHinst(), _mainMenuHandle, windowTrans.c_str()); _windowsMenu.init(_pPublicInterface->getHinst(), _mainMenuHandle, windowTrans.c_str());
// Update context menu strings (translated) // Update context menu strings (translated)
vector<MenuItemUnit> & tmp = pNppParam->getContextMenuItems(); vector<MenuItemUnit> & tmp = nppParam.getContextMenuItems();
size_t len = tmp.size(); size_t len = tmp.size();
TCHAR menuName[64]; TCHAR menuName[64];
for (size_t i = 0 ; i < len ; ++i) for (size_t i = 0 ; i < len ; ++i)
@ -552,7 +552,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
//Input all the menu item names into shortcut list //Input all the menu item names into shortcut list
//This will automatically do all translations, since menu translation has been done already //This will automatically do all translations, since menu translation has been done already
vector<CommandShortcut> & shortcuts = pNppParam->getUserShortcuts(); vector<CommandShortcut> & shortcuts = nppParam.getUserShortcuts();
len = shortcuts.size(); len = shortcuts.size();
for (size_t i = 0; i < len; ++i) for (size_t i = 0; i < len; ++i)
@ -576,11 +576,11 @@ LRESULT Notepad_plus::init(HWND hwnd)
_nativeLangSpeaker.changeShortcutLang(); _nativeLangSpeaker.changeShortcutLang();
//Update plugin shortcuts, all plugin commands should be available now //Update plugin shortcuts, all plugin commands should be available now
pNppParam->reloadPluginCmds(); nppParam.reloadPluginCmds();
// Shortcut Accelerator : should be the last one since it will capture all the shortcuts // Shortcut Accelerator : should be the last one since it will capture all the shortcuts
_accelerator.init(_mainMenuHandle, hwnd); _accelerator.init(_mainMenuHandle, hwnd);
pNppParam->setAccelerator(&_accelerator); nppParam.setAccelerator(&_accelerator);
// Scintilla key accelerator // Scintilla key accelerator
vector<HWND> scints; vector<HWND> scints;
@ -588,7 +588,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
scints.push_back(_subEditView.getHSelf()); scints.push_back(_subEditView.getHSelf());
_scintaccelerator.init(&scints, _mainMenuHandle, hwnd); _scintaccelerator.init(&scints, _mainMenuHandle, hwnd);
pNppParam->setScintillaAccelerator(&_scintaccelerator); nppParam.setScintillaAccelerator(&_scintaccelerator);
_scintaccelerator.updateKeys(); _scintaccelerator.updateKeys();
::DrawMenuBar(hwnd); ::DrawMenuBar(hwnd);
@ -682,13 +682,13 @@ LRESULT Notepad_plus::init(HWND hwnd)
// Initialize the default foreground & background color // Initialize the default foreground & background color
// //
{ {
StyleArray & globalStyles = pNppParam->getGlobalStylers(); StyleArray & globalStyles = nppParam.getGlobalStylers();
int i = globalStyles.getStylerIndexByID(STYLE_DEFAULT); int i = globalStyles.getStylerIndexByID(STYLE_DEFAULT);
if (i != -1) if (i != -1)
{ {
Style & style = globalStyles.getStyler(i); Style & style = globalStyles.getStyler(i);
pNppParam->setCurrentDefaultFgColor(style._fgColor); nppParam.setCurrentDefaultFgColor(style._fgColor);
pNppParam->setCurrentDefaultBgColor(style._bgColor); nppParam.setCurrentDefaultBgColor(style._bgColor);
} }
} }
@ -759,7 +759,7 @@ void Notepad_plus::killAllChildren()
bool Notepad_plus::saveGUIParams() bool Notepad_plus::saveGUIParams()
{ {
NppGUI & nppGUI = const_cast<NppGUI &>((NppParameters::getInstance())->getNppGUI()); NppGUI & nppGUI = const_cast<NppGUI &>((NppParameters::getInstance()).getNppGUI());
nppGUI._toolbarShow = _rebarTop.getIDVisible(REBAR_BAR_TOOLBAR); nppGUI._toolbarShow = _rebarTop.getIDVisible(REBAR_BAR_TOOLBAR);
nppGUI._toolBarStatus = _toolBar.getState(); nppGUI._toolBarStatus = _toolBar.getState();
@ -791,7 +791,7 @@ bool Notepad_plus::saveGUIParams()
nppGUI._isMaximized = ((IsZoomed(_pPublicInterface->getHSelf()) != 0) || (posInfo.flags & WPF_RESTORETOMAXIMIZED)); nppGUI._isMaximized = ((IsZoomed(_pPublicInterface->getHSelf()) != 0) || (posInfo.flags & WPF_RESTORETOMAXIMIZED));
saveDockingParams(); saveDockingParams();
(NppParameters::getInstance())->createXmlTreeFromGUIParams(); (NppParameters::getInstance()).createXmlTreeFromGUIParams();
return true; return true;
} }
@ -800,19 +800,19 @@ bool Notepad_plus::saveProjectPanelsParams()
if (_pProjectPanel_1) if (_pProjectPanel_1)
{ {
_pProjectPanel_1->checkIfNeedSave(TEXT("Project Panel 1")); _pProjectPanel_1->checkIfNeedSave(TEXT("Project Panel 1"));
(NppParameters::getInstance())->setWorkSpaceFilePath(0, _pProjectPanel_1->getWorkSpaceFilePath()); (NppParameters::getInstance()).setWorkSpaceFilePath(0, _pProjectPanel_1->getWorkSpaceFilePath());
} }
if (_pProjectPanel_2) if (_pProjectPanel_2)
{ {
_pProjectPanel_2->checkIfNeedSave(TEXT("Project Panel 2")); _pProjectPanel_2->checkIfNeedSave(TEXT("Project Panel 2"));
(NppParameters::getInstance())->setWorkSpaceFilePath(1, _pProjectPanel_2->getWorkSpaceFilePath()); (NppParameters::getInstance()).setWorkSpaceFilePath(1, _pProjectPanel_2->getWorkSpaceFilePath());
} }
if (_pProjectPanel_3) if (_pProjectPanel_3)
{ {
_pProjectPanel_3->checkIfNeedSave(TEXT("Project Panel 3")); _pProjectPanel_3->checkIfNeedSave(TEXT("Project Panel 3"));
(NppParameters::getInstance())->setWorkSpaceFilePath(2, _pProjectPanel_3->getWorkSpaceFilePath()); (NppParameters::getInstance()).setWorkSpaceFilePath(2, _pProjectPanel_3->getWorkSpaceFilePath());
} }
return (NppParameters::getInstance())->writeProjectPanelsSettings(); return (NppParameters::getInstance()).writeProjectPanelsSettings();
} }
bool Notepad_plus::saveFileBrowserParam() bool Notepad_plus::saveFileBrowserParam()
@ -821,14 +821,14 @@ bool Notepad_plus::saveFileBrowserParam()
{ {
vector<generic_string> rootPaths = _pFileBrowser->getRoots(); vector<generic_string> rootPaths = _pFileBrowser->getRoots();
generic_string selectedItemPath = _pFileBrowser->getSelectedItemPath(); generic_string selectedItemPath = _pFileBrowser->getSelectedItemPath();
return (NppParameters::getInstance())->writeFileBrowserSettings(rootPaths, selectedItemPath); return (NppParameters::getInstance()).writeFileBrowserSettings(rootPaths, selectedItemPath);
} }
return true; // nothing to save so true is returned return true; // nothing to save so true is returned
} }
void Notepad_plus::saveDockingParams() void Notepad_plus::saveDockingParams()
{ {
NppGUI & nppGUI = const_cast<NppGUI &>((NppParameters::getInstance())->getNppGUI()); NppGUI & nppGUI = const_cast<NppGUI &>((NppParameters::getInstance()).getNppGUI());
// Save the docking information // Save the docking information
nppGUI._dockingData._leftWidth = _dockingManager.getDockedContSize(CONT_LEFT); nppGUI._dockingData._leftWidth = _dockingManager.getDockedContSize(CONT_LEFT);
@ -932,20 +932,20 @@ void Notepad_plus::saveDockingParams()
void Notepad_plus::saveUserDefineLangs() void Notepad_plus::saveUserDefineLangs()
{ {
(NppParameters::getInstance())->writeNeed2SaveUDL(); (NppParameters::getInstance()).writeNeed2SaveUDL();
} }
void Notepad_plus::saveShortcuts() void Notepad_plus::saveShortcuts()
{ {
NppParameters::getInstance()->writeShortcuts(); NppParameters::getInstance().writeShortcuts();
} }
void Notepad_plus::saveFindHistory() void Notepad_plus::saveFindHistory()
{ {
_findReplaceDlg.saveFindHistory(); _findReplaceDlg.saveFindHistory();
(NppParameters::getInstance())->writeFindHistory(); (NppParameters::getInstance()).writeFindHistory();
} }
@ -961,8 +961,8 @@ int Notepad_plus::getHtmlXmlEncoding(const TCHAR *fileName) const
{ {
return -1; return -1;
} }
NppParameters *pNppParamInst = NppParameters::getInstance(); NppParameters& nppParamInst = NppParameters::getInstance();
LangType langT = pNppParamInst->getLangFromExt(ext); LangType langT = nppParamInst.getLangFromExt(ext);
if ((langT != L_XML) && (langT != L_HTML)) if ((langT != L_XML) && (langT != L_HTML))
return -1; return -1;
@ -1763,7 +1763,7 @@ bool Notepad_plus::findInFiles()
_findReplaceDlg.putFindResult(nbTotal); _findReplaceDlg.putFindResult(nbTotal);
FindHistory & findHistory = (NppParameters::getInstance())->getFindHistory(); FindHistory & findHistory = (NppParameters::getInstance()).getFindHistory();
if (nbTotal && !findHistory._isDlgAlwaysVisible) if (nbTotal && !findHistory._isDlgAlwaysVisible)
_findReplaceDlg.display(false); _findReplaceDlg.display(false);
return true; return true;
@ -1818,7 +1818,7 @@ bool Notepad_plus::findInOpenedFiles()
_findReplaceDlg.putFindResult(nbTotal); _findReplaceDlg.putFindResult(nbTotal);
FindHistory & findHistory = (NppParameters::getInstance())->getFindHistory(); FindHistory & findHistory = (NppParameters::getInstance()).getFindHistory();
if (nbTotal && !findHistory._isDlgAlwaysVisible) if (nbTotal && !findHistory._isDlgAlwaysVisible)
_findReplaceDlg.display(false); _findReplaceDlg.display(false);
return true; return true;
@ -1851,7 +1851,7 @@ bool Notepad_plus::findInCurrentFile()
_findReplaceDlg.putFindResult(nbTotal); _findReplaceDlg.putFindResult(nbTotal);
FindHistory & findHistory = (NppParameters::getInstance())->getFindHistory(); FindHistory & findHistory = (NppParameters::getInstance()).getFindHistory();
if (nbTotal && !findHistory._isDlgAlwaysVisible) if (nbTotal && !findHistory._isDlgAlwaysVisible)
_findReplaceDlg.display(false); _findReplaceDlg.display(false);
return true; return true;
@ -2030,7 +2030,7 @@ void Notepad_plus::checkMacroState()
enableCommand(IDM_MACRO_PLAYBACKRECORDEDMACRO, !_macro.empty() && !_recordingMacro, MENU | TOOLBAR); enableCommand(IDM_MACRO_PLAYBACKRECORDEDMACRO, !_macro.empty() && !_recordingMacro, MENU | TOOLBAR);
enableCommand(IDM_MACRO_SAVECURRENTMACRO, !_macro.empty() && !_recordingMacro && !_recordingSaved, MENU | TOOLBAR); enableCommand(IDM_MACRO_SAVECURRENTMACRO, !_macro.empty() && !_recordingMacro && !_recordingSaved, MENU | TOOLBAR);
enableCommand(IDM_MACRO_RUNMULTIMACRODLG, (!_macro.empty() && !_recordingMacro) || !((NppParameters::getInstance())->getMacroList()).empty(), MENU | TOOLBAR); enableCommand(IDM_MACRO_RUNMULTIMACRODLG, (!_macro.empty() && !_recordingMacro) || !((NppParameters::getInstance()).getMacroList()).empty(), MENU | TOOLBAR);
} }
void Notepad_plus::checkSyncState() void Notepad_plus::checkSyncState()
@ -2086,7 +2086,7 @@ void Notepad_plus::checkLangsMenu(int id) const
Buffer * curBuf = _pEditView->getCurrentBuffer(); Buffer * curBuf = _pEditView->getCurrentBuffer();
if (id == -1) if (id == -1)
{ {
id = (NppParameters::getInstance())->langTypeToCommandID(curBuf->getLangType()); id = (NppParameters::getInstance()).langTypeToCommandID(curBuf->getLangType());
if (id == IDM_LANG_USER) if (id == IDM_LANG_USER)
{ {
if (curBuf->isUserDefineLangExt()) if (curBuf->isUserDefineLangExt())
@ -2116,9 +2116,9 @@ void Notepad_plus::checkLangsMenu(int id) const
generic_string Notepad_plus::getLangDesc(LangType langType, bool getName) generic_string Notepad_plus::getLangDesc(LangType langType, bool getName)
{ {
if ((langType >= L_EXTERNAL) && (langType < NppParameters::getInstance()->L_END)) if ((langType >= L_EXTERNAL) && (langType < NppParameters::getInstance().L_END))
{ {
ExternalLangContainer & elc = NppParameters::getInstance()->getELCFromIndex(langType - L_EXTERNAL); ExternalLangContainer & elc = NppParameters::getInstance().getELCFromIndex(langType - L_EXTERNAL);
if (getName) if (getName)
return generic_string(elc._name); return generic_string(elc._name);
else else
@ -2500,7 +2500,7 @@ void Notepad_plus::addHotSpot()
auto isUnderline = _pEditView->execute(SCI_STYLEGETUNDERLINE, idStyleMSBunset); auto isUnderline = _pEditView->execute(SCI_STYLEGETUNDERLINE, idStyleMSBunset);
hotspotStyle._fontStyle = (isBold?FONTSTYLE_BOLD:0) | (isItalic?FONTSTYLE_ITALIC:0) | (isUnderline?FONTSTYLE_UNDERLINE:0); hotspotStyle._fontStyle = (isBold?FONTSTYLE_BOLD:0) | (isItalic?FONTSTYLE_ITALIC:0) | (isUnderline?FONTSTYLE_UNDERLINE:0);
int urlAction = (NppParameters::getInstance())->getNppGUI()._styleURL; int urlAction = (NppParameters::getInstance()).getNppGUI()._styleURL;
if (urlAction == 2) if (urlAction == 2)
hotspotStyle._fontStyle |= FONTSTYLE_UNDERLINE; hotspotStyle._fontStyle |= FONTSTYLE_UNDERLINE;
@ -2975,7 +2975,7 @@ LangType Notepad_plus::menuID2LangType(int cmdID)
void Notepad_plus::setTitle() void Notepad_plus::setTitle()
{ {
const NppGUI & nppGUI = NppParameters::getInstance()->getNppGUI(); const NppGUI & nppGUI = NppParameters::getInstance().getNppGUI();
//Get the buffer //Get the buffer
Buffer * buf = _pEditView->getCurrentBuffer(); Buffer * buf = _pEditView->getCurrentBuffer();
@ -3274,8 +3274,8 @@ void Notepad_plus::dropFiles(HDROP hdrop)
} }
} }
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
bool isOldMode = pNppParam->getNppGUI()._isFolderDroppedOpenFiles; bool isOldMode = nppParam.getNppGUI()._isFolderDroppedOpenFiles;
if (isOldMode || folderPaths.size() == 0) // old mode or new mode + only files if (isOldMode || folderPaths.size() == 0) // old mode or new mode + only files
{ {
@ -3408,8 +3408,8 @@ void Notepad_plus::hideView(int whichOne)
bool Notepad_plus::loadStyles() bool Notepad_plus::loadStyles()
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
return pNppParam->reloadStylers(); return nppParam.reloadStylers();
} }
bool Notepad_plus::canHideView(int whichOne) bool Notepad_plus::canHideView(int whichOne)
@ -3557,7 +3557,7 @@ int Notepad_plus::switchEditViewTo(int gid)
_pDocMap->initWrapMap(); _pDocMap->initWrapMap();
} }
if (NppParameters::getInstance()->getNppGUI().isSnapshotMode()) if (NppParameters::getInstance().getNppGUI().isSnapshotMode())
{ {
// Before switching off, synchronize backup file // Before switching off, synchronize backup file
MainFileManager.backupCurrentBuffer(); MainFileManager.backupCurrentBuffer();
@ -3741,7 +3741,7 @@ void Notepad_plus::docGotoAnotherEditView(FileTransferMode mode)
bool Notepad_plus::activateBuffer(BufferID id, int whichOne) bool Notepad_plus::activateBuffer(BufferID id, int whichOne)
{ {
bool isSnapshotMode = NppParameters::getInstance()->getNppGUI().isSnapshotMode(); bool isSnapshotMode = NppParameters::getInstance().getNppGUI().isSnapshotMode();
if (isSnapshotMode) if (isSnapshotMode)
{ {
// Before switching off, synchronize backup file // Before switching off, synchronize backup file
@ -3784,7 +3784,7 @@ bool Notepad_plus::activateBuffer(BufferID id, int whichOne)
notifyBufferActivated(id, whichOne); notifyBufferActivated(id, whichOne);
bool isCurrBuffDetection = (NppParameters::getInstance()->getNppGUI()._fileAutoDetection & cdEnabledNew) ? true : false; bool isCurrBuffDetection = (NppParameters::getInstance().getNppGUI()._fileAutoDetection & cdEnabledNew) ? true : false;
if (!reload && isCurrBuffDetection) if (!reload && isCurrBuffDetection)
{ {
// Buffer has been activated, now check for file modification // Buffer has been activated, now check for file modification
@ -3795,8 +3795,8 @@ bool Notepad_plus::activateBuffer(BufferID id, int whichOne)
} }
void Notepad_plus::performPostReload(int whichOne) { void Notepad_plus::performPostReload(int whichOne) {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
const NppGUI & nppGUI = pNppParam->getNppGUI(); const NppGUI & nppGUI = nppParam.getNppGUI();
bool toEnd = (nppGUI._fileAutoDetection & cdGo2end) ? true : false; bool toEnd = (nppGUI._fileAutoDetection & cdGo2end) ? true : false;
if (!toEnd) if (!toEnd)
return; return;
@ -4032,7 +4032,7 @@ bool Notepad_plus::doBlockComment(comment_mode currCommentMode)
if (buf->getLangType() == L_USER) if (buf->getLangType() == L_USER)
{ {
UserLangContainer * userLangContainer = NppParameters::getInstance()->getULCFromName(buf->getUserDefineLangName()); UserLangContainer * userLangContainer = NppParameters::getInstance().getULCFromName(buf->getUserDefineLangName());
if (!userLangContainer) if (!userLangContainer)
return false; return false;
@ -4329,7 +4329,7 @@ bool Notepad_plus::doStreamComment()
if (buf->getLangType() == L_USER) if (buf->getLangType() == L_USER)
{ {
UserLangContainer * userLangContainer = NppParameters::getInstance()->getULCFromName(buf->getUserDefineLangName()); UserLangContainer * userLangContainer = NppParameters::getInstance().getULCFromName(buf->getUserDefineLangName());
if (!userLangContainer) if (!userLangContainer)
return false; return false;
@ -4401,16 +4401,16 @@ bool Notepad_plus::doStreamComment()
void Notepad_plus::saveScintillasZoom() void Notepad_plus::saveScintillasZoom()
{ {
NppParameters * pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
ScintillaViewParams & svp = (ScintillaViewParams &)pNppParam->getSVP(); ScintillaViewParams & svp = (ScintillaViewParams &)nppParam.getSVP();
svp._zoom = static_cast<int>(_mainEditView.execute(SCI_GETZOOM)); svp._zoom = static_cast<int>(_mainEditView.execute(SCI_GETZOOM));
svp._zoom2 = static_cast<int>(_subEditView.execute(SCI_GETZOOM)); svp._zoom2 = static_cast<int>(_subEditView.execute(SCI_GETZOOM));
} }
bool Notepad_plus::addCurrentMacro() bool Notepad_plus::addCurrentMacro()
{ {
NppParameters* nppParams = NppParameters::getInstance(); NppParameters& nppParams = NppParameters::getInstance();
vector<MacroShortcut> & theMacros = nppParams->getMacroList(); vector<MacroShortcut> & theMacros = nppParams.getMacroList();
int nbMacro = static_cast<int32_t>(theMacros.size()); int nbMacro = static_cast<int32_t>(theMacros.size());
@ -4429,7 +4429,7 @@ bool Notepad_plus::addCurrentMacro()
// Insert the separator and modify/delete command // Insert the separator and modify/delete command
::InsertMenu(hMacroMenu, posBase + nbMacro + 1, MF_BYPOSITION, static_cast<UINT>(-1), 0); ::InsertMenu(hMacroMenu, posBase + nbMacro + 1, MF_BYPOSITION, static_cast<UINT>(-1), 0);
NativeLangSpeaker *pNativeLangSpeaker = nppParams->getNativeLangSpeaker(); NativeLangSpeaker *pNativeLangSpeaker = nppParams.getNativeLangSpeaker();
generic_string nativeLangShortcutMapperMacro = pNativeLangSpeaker->getNativeLangMenuString(IDM_SETTING_SHORTCUT_MAPPER_MACRO); generic_string nativeLangShortcutMapperMacro = pNativeLangSpeaker->getNativeLangMenuString(IDM_SETTING_SHORTCUT_MAPPER_MACRO);
if (nativeLangShortcutMapperMacro == TEXT("")) if (nativeLangShortcutMapperMacro == TEXT(""))
nativeLangShortcutMapperMacro = TEXT("Modify Shortcut/Delete Macro..."); nativeLangShortcutMapperMacro = TEXT("Modify Shortcut/Delete Macro...");
@ -4439,7 +4439,7 @@ bool Notepad_plus::addCurrentMacro()
theMacros.push_back(ms); theMacros.push_back(ms);
::InsertMenu(hMacroMenu, posBase + nbMacro, MF_BYPOSITION, cmdID, ms.toMenuItemString().c_str()); ::InsertMenu(hMacroMenu, posBase + nbMacro, MF_BYPOSITION, cmdID, ms.toMenuItemString().c_str());
_accelerator.updateShortcuts(); _accelerator.updateShortcuts();
nppParams->setShortcutDirty(); nppParams.setShortcutDirty();
return true; return true;
} }
return false; return false;
@ -4542,7 +4542,7 @@ bool Notepad_plus::goToPreviousIndicator(int indicID2Search, bool isWrap) const
// found // found
if (_pEditView->execute(SCI_INDICATORVALUEAT, indicID2Search, posStart)) if (_pEditView->execute(SCI_INDICATORVALUEAT, indicID2Search, posStart))
{ {
NppGUI & nppGUI = const_cast<NppGUI &>((NppParameters::getInstance())->getNppGUI()); NppGUI & nppGUI = const_cast<NppGUI &>((NppParameters::getInstance()).getNppGUI());
nppGUI._disableSmartHiliteTmp = true; nppGUI._disableSmartHiliteTmp = true;
auto currentline = _pEditView->execute(SCI_LINEFROMPOSITION, posEnd); auto currentline = _pEditView->execute(SCI_LINEFROMPOSITION, posEnd);
@ -4595,7 +4595,7 @@ bool Notepad_plus::goToNextIndicator(int indicID2Search, bool isWrap) const
// found // found
if (_pEditView->execute(SCI_INDICATORVALUEAT, indicID2Search, posStart)) if (_pEditView->execute(SCI_INDICATORVALUEAT, indicID2Search, posStart))
{ {
NppGUI & nppGUI = const_cast<NppGUI &>((NppParameters::getInstance())->getNppGUI()); NppGUI & nppGUI = const_cast<NppGUI &>((NppParameters::getInstance()).getNppGUI());
nppGUI._disableSmartHiliteTmp = true; nppGUI._disableSmartHiliteTmp = true;
auto currentline = _pEditView->execute(SCI_LINEFROMPOSITION, posEnd); auto currentline = _pEditView->execute(SCI_LINEFROMPOSITION, posEnd);
@ -4755,10 +4755,10 @@ void Notepad_plus::fullScreenToggle()
void Notepad_plus::postItToggle() void Notepad_plus::postItToggle()
{ {
NppParameters * pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
if (!_beforeSpecialView.isPostIt) // PostIt disabled, enable it if (!_beforeSpecialView.isPostIt) // PostIt disabled, enable it
{ {
NppGUI & nppGUI = const_cast<NppGUI &>(pNppParam->getNppGUI()); NppGUI & nppGUI = const_cast<NppGUI &>(nppParam.getNppGUI());
// get current status before switch to postIt // get current status before switch to postIt
//check these always //check these always
{ {
@ -4931,7 +4931,7 @@ void Notepad_plus::doSynScorll(HWND whichView)
bool Notepad_plus::getIntegralDockingData(tTbData & dockData, int & iCont, bool & isVisible) bool Notepad_plus::getIntegralDockingData(tTbData & dockData, int & iCont, bool & isVisible)
{ {
DockingManagerData & dockingData = (DockingManagerData &)(NppParameters::getInstance())->getNppGUI()._dockingData; DockingManagerData & dockingData = (DockingManagerData &)(NppParameters::getInstance()).getNppGUI()._dockingData;
for (size_t i = 0, len = dockingData._pluginDockInfo.size(); i < len ; ++i) for (size_t i = 0, len = dockingData._pluginDockInfo.size(); i < len ; ++i)
{ {
@ -5108,8 +5108,8 @@ void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask)
// Checking the validity of current instance is necessary. // Checking the validity of current instance is necessary.
if (!this) return; if (!this) return;
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
const NppGUI & nppGUI = pNppParam->getNppGUI(); const NppGUI & nppGUI = nppParam.getNppGUI();
_mainEditView.bufferUpdated(buffer, mask); _mainEditView.bufferUpdated(buffer, mask);
_subEditView.bufferUpdated(buffer, mask); _subEditView.bufferUpdated(buffer, mask);
@ -5339,14 +5339,14 @@ std::vector<generic_string> Notepad_plus::loadCommandlineParams(const TCHAR * co
if (!commandLine || ! pCmdParams) if (!commandLine || ! pCmdParams)
return std::vector<generic_string>(); return std::vector<generic_string>();
NppParameters *nppParams = NppParameters::getInstance(); NppParameters& nppParams = NppParameters::getInstance();
FileNameStringSplitter fnss(commandLine); FileNameStringSplitter fnss(commandLine);
// loading file as session file is allowed only when there is only one file // loading file as session file is allowed only when there is only one file
if (pCmdParams->_isSessionFile && fnss.size() == 1) if (pCmdParams->_isSessionFile && fnss.size() == 1)
{ {
Session session2Load; Session session2Load;
if ((NppParameters::getInstance())->loadSession(session2Load, fnss.getFileName(0))) if ((NppParameters::getInstance()).loadSession(session2Load, fnss.getFileName(0)))
{ {
loadSession(session2Load); loadSession(session2Load);
} }
@ -5380,7 +5380,7 @@ std::vector<generic_string> Notepad_plus::loadCommandlineParams(const TCHAR * co
lastOpened = bufID; lastOpened = bufID;
if (lt != L_EXTERNAL && lt < nppParams->L_END) if (lt != L_EXTERNAL && lt < nppParams.L_END)
{ {
Buffer * pBuf = MainFileManager.getBufferByID(bufID); Buffer * pBuf = MainFileManager.getBufferByID(bufID);
pBuf->setLangType(lt); pBuf->setLangType(lt);
@ -5423,13 +5423,13 @@ std::vector<generic_string> Notepad_plus::loadCommandlineParams(const TCHAR * co
void Notepad_plus::setFindReplaceFolderFilter(const TCHAR *dir, const TCHAR *filter) void Notepad_plus::setFindReplaceFolderFilter(const TCHAR *dir, const TCHAR *filter)
{ {
generic_string fltr; generic_string fltr;
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
FindHistory & findHistory = pNppParam->getFindHistory(); FindHistory & findHistory = nppParam.getFindHistory();
// get current directory in case it's not provided. // get current directory in case it's not provided.
if (!dir && findHistory._isFolderFollowDoc) if (!dir && findHistory._isFolderFollowDoc)
{ {
dir = pNppParam->getWorkingDir(); dir = nppParam.getWorkingDir();
} }
// get current language file extensions in case it's not provided. // get current language file extensions in case it's not provided.
@ -5442,13 +5442,13 @@ void Notepad_plus::setFindReplaceFolderFilter(const TCHAR *dir, const TCHAR *fil
if (lt == L_USER) if (lt == L_USER)
{ {
Buffer * buf = _pEditView->getCurrentBuffer(); Buffer * buf = _pEditView->getCurrentBuffer();
UserLangContainer * userLangContainer = pNppParam->getULCFromName(buf->getUserDefineLangName()); UserLangContainer * userLangContainer = nppParam.getULCFromName(buf->getUserDefineLangName());
if (userLangContainer) if (userLangContainer)
ext = userLangContainer->getExtention(); ext = userLangContainer->getExtention();
} }
else else
{ {
ext = NppParameters::getInstance()->getLangExtFromLangType(lt); ext = NppParameters::getInstance().getLangExtFromLangType(lt);
} }
if (ext && ext[0]) if (ext && ext[0])
@ -5481,7 +5481,7 @@ vector<generic_string> Notepad_plus::addNppComponents(const TCHAR *destDir, cons
if (stringVector *pfns = fDlg.doOpenMultiFilesDlg()) if (stringVector *pfns = fDlg.doOpenMultiFilesDlg())
{ {
// Get plugins dir // Get plugins dir
generic_string destDirName = (NppParameters::getInstance())->getNppPath(); generic_string destDirName = (NppParameters::getInstance()).getNppPath();
PathAppend(destDirName, destDir); PathAppend(destDirName, destDir);
if (!::PathFileExists(destDirName.c_str())) if (!::PathFileExists(destDirName.c_str()))
@ -5517,7 +5517,7 @@ vector<generic_string> Notepad_plus::addNppPlugins(const TCHAR *extFilterName, c
if (stringVector *pfns = fDlg.doOpenMultiFilesDlg()) if (stringVector *pfns = fDlg.doOpenMultiFilesDlg())
{ {
// Get plugins dir // Get plugins dir
generic_string destDirName = (NppParameters::getInstance())->getPluginRootDir(); generic_string destDirName = (NppParameters::getInstance()).getPluginRootDir();
if (!::PathFileExists(destDirName.c_str())) if (!::PathFileExists(destDirName.c_str()))
{ {
@ -5555,16 +5555,16 @@ vector<generic_string> Notepad_plus::addNppPlugins(const TCHAR *extFilterName, c
void Notepad_plus::setWorkingDir(const TCHAR *dir) void Notepad_plus::setWorkingDir(const TCHAR *dir)
{ {
NppParameters * params = NppParameters::getInstance(); NppParameters& params = NppParameters::getInstance();
if (params->getNppGUI()._openSaveDir == dir_last) if (params.getNppGUI()._openSaveDir == dir_last)
return; return;
if (params->getNppGUI()._openSaveDir == dir_userDef) if (params.getNppGUI()._openSaveDir == dir_userDef)
{ {
params->setWorkingDir(NULL); params.setWorkingDir(NULL);
} }
else if (dir && PathIsDirectory(dir)) else if (dir && PathIsDirectory(dir))
{ {
params->setWorkingDir(dir); params.setWorkingDir(dir);
} }
} }
@ -5604,7 +5604,7 @@ generic_string Notepad_plus::getLangFromMenu(const Buffer * buf)
const int nbChar = 32; const int nbChar = 32;
TCHAR menuLangName[nbChar]; TCHAR menuLangName[nbChar];
id = (NppParameters::getInstance())->langTypeToCommandID( buf->getLangType() ); id = (NppParameters::getInstance()).langTypeToCommandID( buf->getLangType() );
if ( ( id != IDM_LANG_USER ) || !( buf->isUserDefineLangExt() ) ) if ( ( id != IDM_LANG_USER ) || !( buf->isUserDefineLangExt() ) )
{ {
::GetMenuString(_mainMenuHandle, id, menuLangName, nbChar-1, MF_BYCOMMAND); ::GetMenuString(_mainMenuHandle, id, menuLangName, nbChar-1, MF_BYCOMMAND);
@ -5619,7 +5619,7 @@ generic_string Notepad_plus::getLangFromMenu(const Buffer * buf)
Style * Notepad_plus::getStyleFromName(const TCHAR *styleName) Style * Notepad_plus::getStyleFromName(const TCHAR *styleName)
{ {
StyleArray & stylers = (NppParameters::getInstance())->getMiscStylerArray(); StyleArray & stylers = (NppParameters::getInstance()).getMiscStylerArray();
int i = stylers.getStylerIndexByName(styleName); int i = stylers.getStylerIndexByName(styleName);
Style * st = NULL; Style * st = NULL;
@ -5647,14 +5647,14 @@ bool Notepad_plus::noOpenedDoc() const
bool Notepad_plus::reloadLang() bool Notepad_plus::reloadLang()
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
if (!pNppParam->reloadLang()) if (!nppParam.reloadLang())
{ {
return false; return false;
} }
TiXmlDocumentA *nativeLangDocRootA = pNppParam->getNativeLangA(); TiXmlDocumentA *nativeLangDocRootA = nppParam.getNativeLangA();
if (!nativeLangDocRootA) if (!nativeLangDocRootA)
{ {
return false; return false;
@ -5662,7 +5662,7 @@ bool Notepad_plus::reloadLang()
_nativeLangSpeaker.init(nativeLangDocRootA, true); _nativeLangSpeaker.init(nativeLangDocRootA, true);
pNppParam->reloadContextMenuFromXmlTree(_mainMenuHandle, _pluginsManager.getMenuHandle()); nppParam.reloadContextMenuFromXmlTree(_mainMenuHandle, _pluginsManager.getMenuHandle());
generic_string pluginsTrans, windowTrans; generic_string pluginsTrans, windowTrans;
_nativeLangSpeaker.changeMenuLang(_mainMenuHandle, pluginsTrans, windowTrans); _nativeLangSpeaker.changeMenuLang(_mainMenuHandle, pluginsTrans, windowTrans);
@ -5682,7 +5682,7 @@ bool Notepad_plus::reloadLang()
::ModifyMenu(_mainMenuHandle, IDM_WINDOW_WINDOWS, MF_BYCOMMAND, IDM_WINDOW_WINDOWS, windowTrans.c_str()); ::ModifyMenu(_mainMenuHandle, IDM_WINDOW_WINDOWS, MF_BYCOMMAND, IDM_WINDOW_WINDOWS, windowTrans.c_str());
} }
// Update scintilla context menu strings // Update scintilla context menu strings
vector<MenuItemUnit> & tmp = pNppParam->getContextMenuItems(); vector<MenuItemUnit> & tmp = nppParam.getContextMenuItems();
size_t len = tmp.size(); size_t len = tmp.size();
TCHAR menuName[64]; TCHAR menuName[64];
for (size_t i = 0 ; i < len ; ++i) for (size_t i = 0 ; i < len ; ++i)
@ -5694,7 +5694,7 @@ bool Notepad_plus::reloadLang()
} }
} }
vector<CommandShortcut> & shortcuts = pNppParam->getUserShortcuts(); vector<CommandShortcut> & shortcuts = nppParam.getUserShortcuts();
len = shortcuts.size(); len = shortcuts.size();
for (size_t i = 0; i < len; ++i) for (size_t i = 0; i < len; ++i)
@ -5827,7 +5827,7 @@ void Notepad_plus::launchClipboardHistoryPanel()
// in this case is DOCKABLE_DEMO_INDEX // in this case is DOCKABLE_DEMO_INDEX
// In the case of Notepad++ internal function, it'll be the command ID which triggers this dialog // In the case of Notepad++ internal function, it'll be the command ID which triggers this dialog
data.dlgID = IDM_EDIT_CLIPBOARDHISTORY_PANEL; data.dlgID = IDM_EDIT_CLIPBOARDHISTORY_PANEL;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string title_temp = pNativeSpeaker->getAttrNameStr(CH_PROJECTPANELTITLE, "ClipboardHistory", "PanelTitle"); generic_string title_temp = pNativeSpeaker->getAttrNameStr(CH_PROJECTPANELTITLE, "ClipboardHistory", "PanelTitle");
static TCHAR title[32]; static TCHAR title[32];
if (title_temp.length() < 32) if (title_temp.length() < 32)
@ -5837,8 +5837,8 @@ void Notepad_plus::launchClipboardHistoryPanel()
} }
::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast<LPARAM>(&data)); ::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast<LPARAM>(&data));
COLORREF fgColor = (NppParameters::getInstance())->getCurrentDefaultFgColor(); COLORREF fgColor = (NppParameters::getInstance()).getCurrentDefaultFgColor();
COLORREF bgColor = (NppParameters::getInstance())->getCurrentDefaultBgColor(); COLORREF bgColor = (NppParameters::getInstance()).getCurrentDefaultBgColor();
_pClipboardHistoryPanel->setBackgroundColor(bgColor); _pClipboardHistoryPanel->setBackgroundColor(bgColor);
_pClipboardHistoryPanel->setForegroundColor(fgColor); _pClipboardHistoryPanel->setForegroundColor(fgColor);
@ -5870,7 +5870,7 @@ void Notepad_plus::launchFileSwitcherPanel()
// In the case of Notepad++ internal function, it'll be the command ID which triggers this dialog // In the case of Notepad++ internal function, it'll be the command ID which triggers this dialog
data.dlgID = IDM_VIEW_FILESWITCHER_PANEL; data.dlgID = IDM_VIEW_FILESWITCHER_PANEL;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string title_temp = pNativeSpeaker->getAttrNameStr(FS_PROJECTPANELTITLE, "DocSwitcher", "PanelTitle"); generic_string title_temp = pNativeSpeaker->getAttrNameStr(FS_PROJECTPANELTITLE, "DocSwitcher", "PanelTitle");
static TCHAR title[32]; static TCHAR title[32];
if (title_temp.length() < 32) if (title_temp.length() < 32)
@ -5880,8 +5880,8 @@ void Notepad_plus::launchFileSwitcherPanel()
} }
::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast<LPARAM>(&data)); ::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast<LPARAM>(&data));
COLORREF fgColor = (NppParameters::getInstance())->getCurrentDefaultFgColor(); COLORREF fgColor = (NppParameters::getInstance()).getCurrentDefaultFgColor();
COLORREF bgColor = (NppParameters::getInstance())->getCurrentDefaultBgColor(); COLORREF bgColor = (NppParameters::getInstance()).getCurrentDefaultBgColor();
_pFileSwitcherPanel->setBackgroundColor(bgColor); _pFileSwitcherPanel->setBackgroundColor(bgColor);
_pFileSwitcherPanel->setForegroundColor(fgColor); _pFileSwitcherPanel->setForegroundColor(fgColor);
@ -5911,7 +5911,7 @@ void Notepad_plus::launchAnsiCharPanel()
// In the case of Notepad++ internal function, it'll be the command ID which triggers this dialog // In the case of Notepad++ internal function, it'll be the command ID which triggers this dialog
data.dlgID = IDM_EDIT_CHAR_PANEL; data.dlgID = IDM_EDIT_CHAR_PANEL;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string title_temp = pNativeSpeaker->getAttrNameStr(AI_PROJECTPANELTITLE, "AsciiInsertion", "PanelTitle"); generic_string title_temp = pNativeSpeaker->getAttrNameStr(AI_PROJECTPANELTITLE, "AsciiInsertion", "PanelTitle");
static TCHAR title[85]; static TCHAR title[85];
if (title_temp.length() < 85) if (title_temp.length() < 85)
@ -5921,8 +5921,8 @@ void Notepad_plus::launchAnsiCharPanel()
} }
::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast<LPARAM>(&data)); ::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast<LPARAM>(&data));
COLORREF fgColor = (NppParameters::getInstance())->getCurrentDefaultFgColor(); COLORREF fgColor = (NppParameters::getInstance()).getCurrentDefaultFgColor();
COLORREF bgColor = (NppParameters::getInstance())->getCurrentDefaultBgColor(); COLORREF bgColor = (NppParameters::getInstance()).getCurrentDefaultBgColor();
_pAnsiCharPanel->setBackgroundColor(bgColor); _pAnsiCharPanel->setBackgroundColor(bgColor);
_pAnsiCharPanel->setForegroundColor(fgColor); _pAnsiCharPanel->setForegroundColor(fgColor);
@ -5954,7 +5954,7 @@ void Notepad_plus::launchFileBrowser(const vector<generic_string> & folders, boo
// In the case of Notepad++ internal function, it'll be the command ID which triggers this dialog // In the case of Notepad++ internal function, it'll be the command ID which triggers this dialog
data.dlgID = IDM_VIEW_FILEBROWSER; data.dlgID = IDM_VIEW_FILEBROWSER;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string title_temp = pNativeSpeaker->getAttrNameStr(FB_PANELTITLE, "FolderAsWorkspace", "PanelTitle"); generic_string title_temp = pNativeSpeaker->getAttrNameStr(FB_PANELTITLE, "FolderAsWorkspace", "PanelTitle");
static TCHAR title[32]; static TCHAR title[32];
@ -5965,8 +5965,8 @@ void Notepad_plus::launchFileBrowser(const vector<generic_string> & folders, boo
} }
::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast<LPARAM>(&data)); ::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast<LPARAM>(&data));
COLORREF fgColor = (NppParameters::getInstance())->getCurrentDefaultFgColor(); COLORREF fgColor = (NppParameters::getInstance()).getCurrentDefaultFgColor();
COLORREF bgColor = (NppParameters::getInstance())->getCurrentDefaultBgColor(); COLORREF bgColor = (NppParameters::getInstance()).getCurrentDefaultBgColor();
_pFileBrowser->setBackgroundColor(bgColor); _pFileBrowser->setBackgroundColor(bgColor);
_pFileBrowser->setForegroundColor(fgColor); _pFileBrowser->setForegroundColor(fgColor);
@ -5994,11 +5994,11 @@ void Notepad_plus::launchProjectPanel(int cmdID, ProjectPanel ** pProjPanel, int
{ {
if (!(*pProjPanel)) if (!(*pProjPanel))
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
(*pProjPanel) = new ProjectPanel; (*pProjPanel) = new ProjectPanel;
(*pProjPanel)->init(_pPublicInterface->getHinst(), _pPublicInterface->getHSelf()); (*pProjPanel)->init(_pPublicInterface->getHinst(), _pPublicInterface->getHSelf());
(*pProjPanel)->setWorkSpaceFilePath(pNppParam->getWorkSpaceFilePath(panelID)); (*pProjPanel)->setWorkSpaceFilePath(nppParam.getWorkSpaceFilePath(panelID));
tTbData data; tTbData data;
memset(&data, 0, sizeof(data)); memset(&data, 0, sizeof(data));
@ -6016,7 +6016,7 @@ void Notepad_plus::launchProjectPanel(int cmdID, ProjectPanel ** pProjPanel, int
// In the case of Notepad++ internal function, it'll be the command ID which triggers this dialog // In the case of Notepad++ internal function, it'll be the command ID which triggers this dialog
data.dlgID = cmdID; data.dlgID = cmdID;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string title_temp = pNativeSpeaker->getAttrNameStr(PM_PROJECTPANELTITLE, "ProjectManager", "PanelTitle"); generic_string title_temp = pNativeSpeaker->getAttrNameStr(PM_PROJECTPANELTITLE, "ProjectManager", "PanelTitle");
static TCHAR title[32]; static TCHAR title[32];
@ -6027,8 +6027,8 @@ void Notepad_plus::launchProjectPanel(int cmdID, ProjectPanel ** pProjPanel, int
} }
::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast<LPARAM>(&data)); ::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast<LPARAM>(&data));
COLORREF fgColor = (NppParameters::getInstance())->getCurrentDefaultFgColor(); COLORREF fgColor = (NppParameters::getInstance()).getCurrentDefaultFgColor();
COLORREF bgColor = (NppParameters::getInstance())->getCurrentDefaultBgColor(); COLORREF bgColor = (NppParameters::getInstance()).getCurrentDefaultBgColor();
(*pProjPanel)->setBackgroundColor(bgColor); (*pProjPanel)->setBackgroundColor(bgColor);
(*pProjPanel)->setForegroundColor(fgColor); (*pProjPanel)->setForegroundColor(fgColor);
@ -6039,7 +6039,7 @@ void Notepad_plus::launchProjectPanel(int cmdID, ProjectPanel ** pProjPanel, int
void Notepad_plus::launchDocMap() void Notepad_plus::launchDocMap()
{ {
if (!(NppParameters::getInstance())->isTransparentAvailable()) if (!(NppParameters::getInstance()).isTransparentAvailable())
{ {
_nativeLangSpeaker.messageBox("PrehistoricSystemDetected", _nativeLangSpeaker.messageBox("PrehistoricSystemDetected",
_pPublicInterface->getHSelf(), _pPublicInterface->getHSelf(),
@ -6069,7 +6069,7 @@ void Notepad_plus::launchDocMap()
// In the case of Notepad++ internal function, it'll be the command ID which triggers this dialog // In the case of Notepad++ internal function, it'll be the command ID which triggers this dialog
data.dlgID = IDM_VIEW_DOC_MAP; data.dlgID = IDM_VIEW_DOC_MAP;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string title_temp = pNativeSpeaker->getAttrNameStr(DM_PANELTITLE, "DocumentMap", "PanelTitle"); generic_string title_temp = pNativeSpeaker->getAttrNameStr(DM_PANELTITLE, "DocumentMap", "PanelTitle");
static TCHAR title[32]; static TCHAR title[32];
if (title_temp.length() < 32) if (title_temp.length() < 32)
@ -6109,7 +6109,7 @@ void Notepad_plus::launchFunctionList()
// In the case of Notepad++ internal function, it'll be the command ID which triggers this dialog // In the case of Notepad++ internal function, it'll be the command ID which triggers this dialog
data.dlgID = IDM_VIEW_FUNC_LIST; data.dlgID = IDM_VIEW_FUNC_LIST;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string title_temp = pNativeSpeaker->getAttrNameStr(FL_PANELTITLE, "FunctionList", "PanelTitle"); generic_string title_temp = pNativeSpeaker->getAttrNameStr(FL_PANELTITLE, "FunctionList", "PanelTitle");
static TCHAR title[32]; static TCHAR title[32];
@ -6120,8 +6120,8 @@ void Notepad_plus::launchFunctionList()
} }
::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast<LPARAM>(&data)); ::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast<LPARAM>(&data));
COLORREF fgColor = (NppParameters::getInstance())->getCurrentDefaultFgColor(); COLORREF fgColor = (NppParameters::getInstance()).getCurrentDefaultFgColor();
COLORREF bgColor = (NppParameters::getInstance())->getCurrentDefaultBgColor(); COLORREF bgColor = (NppParameters::getInstance()).getCurrentDefaultBgColor();
_pFuncList->setBackgroundColor(bgColor); _pFuncList->setBackgroundColor(bgColor);
_pFuncList->setForegroundColor(fgColor); _pFuncList->setForegroundColor(fgColor);
@ -6434,7 +6434,7 @@ DWORD WINAPI Notepad_plus::threadTextPlayer(void *params)
else if (qParams->_encoding >= 0) else if (qParams->_encoding >= 0)
pCurrentView->execute(SCI_SETCODEPAGE, qParams->_encoding); pCurrentView->execute(SCI_SETCODEPAGE, qParams->_encoding);
int langMenuId = (NppParameters::getInstance())->langTypeToCommandID(qParams->_lang); int langMenuId = (NppParameters::getInstance()).langTypeToCommandID(qParams->_lang);
::SendMessage(hNpp, NPPM_MENUCOMMAND, 0, langMenuId); ::SendMessage(hNpp, NPPM_MENUCOMMAND, 0, langMenuId);
int x = 2, y = 1; int x = 2, y = 1;
@ -6749,21 +6749,15 @@ DWORD WINAPI Notepad_plus::backupDocument(void * /*param*/)
bool isSnapshotMode = true; bool isSnapshotMode = true;
while (isSnapshotMode) while (isSnapshotMode)
{ {
NppParameters *nppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
if (!nppParam)
return FALSE;
size_t timer = nppParam->getNppGUI()._snapshotBackupTiming; size_t timer = nppParam.getNppGUI()._snapshotBackupTiming;
if (timer < 1000) if (timer < 1000)
timer = 1000; timer = 1000;
::Sleep(DWORD(timer)); ::Sleep(DWORD(timer));
nppParam = NppParameters::getInstance(); isSnapshotMode = nppParam.getNppGUI().isSnapshotMode();
if (!nppParam)
return FALSE;
isSnapshotMode = nppParam->getNppGUI().isSnapshotMode();
if (!isSnapshotMode) if (!isSnapshotMode)
break; break;
@ -6797,7 +6791,7 @@ bool Notepad_plus::undoStreamComment(bool tryBlockComment)
return false; return false;
if (buf->getLangType() == L_USER) if (buf->getLangType() == L_USER)
{ {
UserLangContainer * userLangContainer = NppParameters::getInstance()->getULCFromName(buf->getUserDefineLangName()); UserLangContainer * userLangContainer = NppParameters::getInstance().getULCFromName(buf->getUserDefineLangName());
if (!userLangContainer) if (!userLangContainer)
return false; return false;

View File

@ -93,8 +93,8 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
throw std::runtime_error("Notepad_plus_Window::init : RegisterClass() function failed"); throw std::runtime_error("Notepad_plus_Window::init : RegisterClass() function failed");
} }
NppParameters *pNppParams = NppParameters::getInstance(); NppParameters& nppParams = NppParameters::getInstance();
NppGUI & nppGUI = const_cast<NppGUI &>(pNppParams->getNppGUI()); NppGUI & nppGUI = const_cast<NppGUI &>(nppParams.getNppGUI());
if (cmdLineParams->_isNoPlugin) if (cmdLineParams->_isNoPlugin)
_notepad_plus_plus_core._pluginsManager.disable(); _notepad_plus_plus_core._pluginsManager.disable();
@ -193,9 +193,9 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
std::vector<generic_string> patterns; std::vector<generic_string> patterns;
patterns.push_back(TEXT("*.xml")); patterns.push_back(TEXT("*.xml"));
generic_string nppDir = pNppParams->getNppPath(); generic_string nppDir = nppParams.getNppPath();
LocalizationSwitcher & localizationSwitcher = pNppParams->getLocalizationSwitcher(); LocalizationSwitcher & localizationSwitcher = nppParams.getLocalizationSwitcher();
std::wstring localizationDir = nppDir; std::wstring localizationDir = nppDir;
PathAppend(localizationDir, TEXT("localization\\")); PathAppend(localizationDir, TEXT("localization\\"));
@ -204,15 +204,15 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
localizationSwitcher.addLanguageFromXml(fileNames[i].c_str()); localizationSwitcher.addLanguageFromXml(fileNames[i].c_str());
fileNames.clear(); fileNames.clear();
ThemeSwitcher & themeSwitcher = pNppParams->getThemeSwitcher(); ThemeSwitcher & themeSwitcher = nppParams.getThemeSwitcher();
// Get themes from both npp install themes dir and app data themes dir with the per user // Get themes from both npp install themes dir and app data themes dir with the per user
// overriding default themes of the same name. // overriding default themes of the same name.
generic_string themeDir; generic_string themeDir;
if (pNppParams->getAppDataNppDir() && pNppParams->getAppDataNppDir()[0]) if (nppParams.getAppDataNppDir() && nppParams.getAppDataNppDir()[0])
{ {
themeDir = pNppParams->getAppDataNppDir(); themeDir = nppParams.getAppDataNppDir();
PathAppend(themeDir, TEXT("themes\\")); PathAppend(themeDir, TEXT("themes\\"));
_notepad_plus_plus_core.getMatchedFileNames(themeDir.c_str(), patterns, fileNames, false, false); _notepad_plus_plus_core.getMatchedFileNames(themeDir.c_str(), patterns, fileNames, false, false);
for (size_t i = 0, len = fileNames.size() ; i < len ; ++i) for (size_t i = 0, len = fileNames.size() ; i < len ; ++i)
@ -328,10 +328,10 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
// Make this call later to take effect // Make this call later to take effect
::SendMessage(_hSelf, NPPM_INTERNAL_SETWORDCHARS, 0, 0); ::SendMessage(_hSelf, NPPM_INTERNAL_SETWORDCHARS, 0, 0);
if (pNppParams->doFunctionListExport()) if (nppParams.doFunctionListExport())
::SendMessage(_hSelf, NPPM_INTERNAL_EXPORTFUNCLISTANDQUIT, 0, 0); ::SendMessage(_hSelf, NPPM_INTERNAL_EXPORTFUNCLISTANDQUIT, 0, 0);
if (pNppParams->doPrintAndExit()) if (nppParams.doPrintAndExit())
::SendMessage(_hSelf, NPPM_INTERNAL_PRNTANDQUIT, 0, 0); ::SendMessage(_hSelf, NPPM_INTERNAL_PRNTANDQUIT, 0, 0);
} }

View File

@ -131,7 +131,7 @@ int CharacterIs(TCHAR c, const TCHAR *any)
LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
LRESULT result = FALSE; LRESULT result = FALSE;
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
switch (message) switch (message)
{ {
@ -489,7 +489,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_DISABLEAUTOUPDATE: case NPPM_DISABLEAUTOUPDATE:
{ {
NppGUI & nppGUI = const_cast<NppGUI &>(pNppParam->getNppGUI()); NppGUI & nppGUI = const_cast<NppGUI &>(nppParam.getNppGUI());
nppGUI._autoUpdateOpt._doAutoUpdate = false; nppGUI._autoUpdateOpt._doAutoUpdate = false;
return TRUE; return TRUE;
} }
@ -556,7 +556,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
const DWORD cmdLineParamsSize = pCopyData->cbData; // CmdLineParams size from another instance const DWORD cmdLineParamsSize = pCopyData->cbData; // CmdLineParams size from another instance
if (sizeof(CmdLineParamsDTO) == cmdLineParamsSize) // make sure the structure is the same if (sizeof(CmdLineParamsDTO) == cmdLineParamsSize) // make sure the structure is the same
{ {
pNppParam->setCmdlineParam(*cmdLineParam); nppParam.setCmdlineParam(*cmdLineParam);
} }
else else
{ {
@ -565,7 +565,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
#endif #endif
} }
NppGUI nppGui = (NppGUI)pNppParam->getNppGUI(); NppGUI nppGui = (NppGUI)nppParam.getNppGUI();
nppGui._isCmdlineNosessionActivated = cmdLineParam->_isNoSession; nppGui._isCmdlineNosessionActivated = cmdLineParam->_isNoSession;
break; break;
} }
@ -573,7 +573,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case COPYDATA_FILENAMESA: case COPYDATA_FILENAMESA:
{ {
char *fileNamesA = static_cast<char *>(pCopyData->lpData); char *fileNamesA = static_cast<char *>(pCopyData->lpData);
const CmdLineParamsDTO & cmdLineParams = pNppParam->getCmdLineParams(); const CmdLineParamsDTO & cmdLineParams = nppParam.getCmdLineParams();
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
const wchar_t *fileNamesW = wmc.char2wchar(fileNamesA, CP_ACP); const wchar_t *fileNamesW = wmc.char2wchar(fileNamesA, CP_ACP);
loadCommandlineParams(fileNamesW, &cmdLineParams); loadCommandlineParams(fileNamesW, &cmdLineParams);
@ -583,7 +583,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case COPYDATA_FILENAMESW: case COPYDATA_FILENAMESW:
{ {
wchar_t *fileNamesW = static_cast<wchar_t *>(pCopyData->lpData); wchar_t *fileNamesW = static_cast<wchar_t *>(pCopyData->lpData);
const CmdLineParamsDTO & cmdLineParams = pNppParam->getCmdLineParams(); const CmdLineParamsDTO & cmdLineParams = nppParam.getCmdLineParams();
loadCommandlineParams(fileNamesW, &cmdLineParams); loadCommandlineParams(fileNamesW, &cmdLineParams);
break; break;
} }
@ -616,21 +616,21 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_INTERNAL_SAVECURRENTSESSION: case NPPM_INTERNAL_SAVECURRENTSESSION:
{ {
NppParameters *nppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
const NppGUI& nppGui = nppParam->getNppGUI(); const NppGUI& nppGui = nppParam.getNppGUI();
if (nppGui._rememberLastSession && !nppGui._isCmdlineNosessionActivated) if (nppGui._rememberLastSession && !nppGui._isCmdlineNosessionActivated)
{ {
Session currentSession; Session currentSession;
getCurrentOpenedFiles(currentSession, true); getCurrentOpenedFiles(currentSession, true);
nppParam->writeSession(currentSession); nppParam.writeSession(currentSession);
} }
return TRUE; return TRUE;
} }
case NPPM_INTERNAL_SAVEBACKUP: case NPPM_INTERNAL_SAVEBACKUP:
{ {
if (NppParameters::getInstance()->getNppGUI().isSnapshotMode()) if (NppParameters::getInstance().getNppGUI().isSnapshotMode())
{ {
MainFileManager.backupCurrentBuffer(); MainFileManager.backupCurrentBuffer();
} }
@ -913,7 +913,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
return TRUE; return TRUE;
} }
if (NppParameters::getInstance()->getNppGUI()._styleMRU) if (NppParameters::getInstance().getNppGUI()._styleMRU)
{ {
tli->_currentIndex = 0; tli->_currentIndex = 0;
std::sort(tli->_tlfsLst.begin(),tli->_tlfsLst.end(),SortTaskListPred(_mainDocTab,_subDocTab)); std::sort(tli->_tlfsLst.begin(),tli->_tlfsLst.end(),SortTaskListPred(_mainDocTab,_subDocTab));
@ -939,7 +939,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
{ {
// redirect to the IDC_PREV_DOC or IDC_NEXT_DOC so that we have the unified process // redirect to the IDC_PREV_DOC or IDC_NEXT_DOC so that we have the unified process
pNppParam->_isTaskListRBUTTONUP_Active = true; nppParam._isTaskListRBUTTONUP_Active = true;
short zDelta = (short) HIWORD(wParam); short zDelta = (short) HIWORD(wParam);
return ::SendMessage(hwnd, WM_COMMAND, zDelta>0?IDC_PREV_DOC:IDC_NEXT_DOC, 0); return ::SendMessage(hwnd, WM_COMMAND, zDelta>0?IDC_PREV_DOC:IDC_NEXT_DOC, 0);
} }
@ -970,7 +970,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
if ((!sessionFileName) || (sessionFileName[0] == '\0')) if ((!sessionFileName) || (sessionFileName[0] == '\0'))
return 0; return 0;
Session session2Load; Session session2Load;
if (pNppParam->loadSession(session2Load, sessionFileName)) if (nppParam.loadSession(session2Load, sessionFileName))
return session2Load.nbMainFiles() + session2Load.nbSubFiles(); return session2Load.nbMainFiles() + session2Load.nbSubFiles();
return 0; return 0;
} }
@ -984,7 +984,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
return FALSE; return FALSE;
Session session2Load; Session session2Load;
if (pNppParam->loadSession(session2Load, sessionFileName)) if (nppParam.loadSession(session2Load, sessionFileName))
{ {
size_t i = 0; size_t i = 0;
for ( ; i < session2Load.nbMainFiles() ; ) for ( ; i < session2Load.nbMainFiles() ; )
@ -1181,7 +1181,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
if (indexMacro != -1) if (indexMacro != -1)
{ {
vector<MacroShortcut> & ms = pNppParam->getMacroList(); vector<MacroShortcut> & ms = nppParam.getMacroList();
m = ms[indexMacro].getMacro(); m = ms[indexMacro].getMacro();
} }
@ -1259,7 +1259,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
{ {
if (lParam) if (lParam)
*(reinterpret_cast<int *>(lParam)) = IDM_LANG_USER; *(reinterpret_cast<int *>(lParam)) = IDM_LANG_USER;
return pNppParam->getNbUserLang(); return nppParam.getNbUserLang();
} }
case NPPM_GETCURRENTDOCINDEX: case NPPM_GETCURRENTDOCINDEX:
@ -1378,7 +1378,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_INTERNAL_SETCARETWIDTH: case NPPM_INTERNAL_SETCARETWIDTH:
{ {
const NppGUI & nppGUI = pNppParam->getNppGUI(); const NppGUI & nppGUI = nppParam.getNppGUI();
if (nppGUI._caretWidth < 4) if (nppGUI._caretWidth < 4)
{ {
@ -1415,7 +1415,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_INTERNAL_SCROLLBEYONDLASTLINE: case NPPM_INTERNAL_SCROLLBEYONDLASTLINE:
{ {
const bool endAtLastLine = not (pNppParam->getSVP())._scrollBeyondLastLine; const bool endAtLastLine = not (nppParam.getSVP())._scrollBeyondLastLine;
_mainEditView.execute(SCI_SETENDATLASTLINE, endAtLastLine); _mainEditView.execute(SCI_SETENDATLASTLINE, endAtLastLine);
_subEditView.execute(SCI_SETENDATLASTLINE, endAtLastLine); _subEditView.execute(SCI_SETENDATLASTLINE, endAtLastLine);
return TRUE; return TRUE;
@ -1430,7 +1430,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_INTERNAL_SETMULTISELCTION: case NPPM_INTERNAL_SETMULTISELCTION:
{ {
const NppGUI & nppGUI = pNppParam->getNppGUI(); const NppGUI & nppGUI = nppParam.getNppGUI();
_mainEditView.execute(SCI_SETMULTIPLESELECTION, nppGUI._enableMultiSelection); _mainEditView.execute(SCI_SETMULTIPLESELECTION, nppGUI._enableMultiSelection);
_subEditView.execute(SCI_SETMULTIPLESELECTION, nppGUI._enableMultiSelection); _subEditView.execute(SCI_SETMULTIPLESELECTION, nppGUI._enableMultiSelection);
return TRUE; return TRUE;
@ -1438,7 +1438,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_INTERNAL_SETCARETBLINKRATE: case NPPM_INTERNAL_SETCARETBLINKRATE:
{ {
const NppGUI & nppGUI = pNppParam->getNppGUI(); const NppGUI & nppGUI = nppParam.getNppGUI();
_mainEditView.execute(SCI_SETCARETPERIOD, nppGUI._caretBlinkRate); _mainEditView.execute(SCI_SETCARETPERIOD, nppGUI._caretBlinkRate);
_subEditView.execute(SCI_SETCARETPERIOD, nppGUI._caretBlinkRate); _subEditView.execute(SCI_SETCARETPERIOD, nppGUI._caretBlinkRate);
return TRUE; return TRUE;
@ -1485,9 +1485,9 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case WM_CONTEXTMENU: case WM_CONTEXTMENU:
{ {
if (pNppParam->_isTaskListRBUTTONUP_Active) if (nppParam._isTaskListRBUTTONUP_Active)
{ {
pNppParam->_isTaskListRBUTTONUP_Active = false; nppParam._isTaskListRBUTTONUP_Active = false;
} }
else else
{ {
@ -1501,7 +1501,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
POINT p; POINT p;
::GetCursorPos(&p); ::GetCursorPos(&p);
ContextMenu scintillaContextmenu; ContextMenu scintillaContextmenu;
std::vector<MenuItemUnit>& tmp = pNppParam->getContextMenuItems(); std::vector<MenuItemUnit>& tmp = nppParam.getContextMenuItems();
scintillaContextmenu.create(hwnd, tmp, _mainMenuHandle); scintillaContextmenu.create(hwnd, tmp, _mainMenuHandle);
scintillaContextmenu.display(p); scintillaContextmenu.display(p);
return TRUE; return TRUE;
@ -1551,7 +1551,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
if (currBuf && currBuf->isMonitoringOn()) if (currBuf && currBuf->isMonitoringOn())
::PathFileExists(currBuf->getFullPathName()); ::PathFileExists(currBuf->getFullPathName());
const NppGUI & nppgui = pNppParam->getNppGUI(); const NppGUI & nppgui = nppParam.getNppGUI();
if (nppgui._fileAutoDetection != cdDisabled) if (nppgui._fileAutoDetection != cdDisabled)
{ {
bool bCheckOnlyCurrentBuffer = (nppgui._fileAutoDetection & cdEnabledNew) ? true : false; bool bCheckOnlyCurrentBuffer = (nppgui._fileAutoDetection & cdEnabledNew) ? true : false;
@ -1620,7 +1620,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_INTERNAL_ENABLECHECKDOCOPT: case NPPM_INTERNAL_ENABLECHECKDOCOPT:
{ {
NppGUI& nppgui = const_cast<NppGUI&>((pNppParam->getNppGUI())); NppGUI& nppgui = const_cast<NppGUI&>((nppParam.getNppGUI()));
if (wParam == CHECKDOCOPT_NONE) if (wParam == CHECKDOCOPT_NONE)
nppgui._fileAutoDetection = cdDisabled; nppgui._fileAutoDetection = cdDisabled;
else if (wParam == CHECKDOCOPT_UPDATESILENTLY) else if (wParam == CHECKDOCOPT_UPDATESILENTLY)
@ -1659,11 +1659,11 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
drawTabbarColoursFromStylerArray(); drawTabbarColoursFromStylerArray();
// Update default fg/bg colors in Parameters for both internal/plugins docking dialog // Update default fg/bg colors in Parameters for both internal/plugins docking dialog
StyleArray & globalStyles = (NppParameters::getInstance())->getGlobalStylers(); StyleArray & globalStyles = (NppParameters::getInstance()).getGlobalStylers();
int i = globalStyles.getStylerIndexByID(STYLE_DEFAULT); int i = globalStyles.getStylerIndexByID(STYLE_DEFAULT);
Style & style = globalStyles.getStyler(i); Style & style = globalStyles.getStyler(i);
(NppParameters::getInstance())->setCurrentDefaultFgColor(style._fgColor); (NppParameters::getInstance()).setCurrentDefaultFgColor(style._fgColor);
(NppParameters::getInstance())->setCurrentDefaultBgColor(style._bgColor); (NppParameters::getInstance()).setCurrentDefaultBgColor(style._bgColor);
// Set default fg/bg colors on internal docking dialog // Set default fg/bg colors on internal docking dialog
if (_pFuncList) if (_pFuncList)
@ -1745,7 +1745,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
if (_pTrayIco) if (_pTrayIco)
_pTrayIco->doTrayIcon(REMOVE); _pTrayIco->doTrayIcon(REMOVE);
const NppGUI & nppgui = pNppParam->getNppGUI(); const NppGUI & nppgui = nppParam.getNppGUI();
bool isSnapshotMode = nppgui.isSnapshotMode(); bool isSnapshotMode = nppgui.isSnapshotMode();
@ -1802,7 +1802,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
// //
// saving config.xml // saving config.xml
// //
pNppParam->saveConfig_xml(); nppParam.saveConfig_xml();
// //
// saving userDefineLang.xml // saving userDefineLang.xml
@ -1821,9 +1821,9 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
saveSession(currentSession); saveSession(currentSession);
// write settings on cloud if enabled, if the settings files don't exist // write settings on cloud if enabled, if the settings files don't exist
if (nppgui._cloudPath != TEXT("") && pNppParam->isCloudPathChanged()) if (nppgui._cloudPath != TEXT("") && nppParam.isCloudPathChanged())
{ {
bool isOK = pNppParam->writeSettingsFilesOnCloudForThe1stTime(nppgui._cloudPath); bool isOK = nppParam.writeSettingsFilesOnCloudForThe1stTime(nppgui._cloudPath);
if (!isOK) if (!isOK)
{ {
_nativeLangSpeaker.messageBox("SettingsOnCloudError", _nativeLangSpeaker.messageBox("SettingsOnCloudError",
@ -1831,7 +1831,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
TEXT("It seems the path of settings on cloud is set on a read only drive,\ror on a folder needed privilege right for writting access.\rYour settings on cloud will be canceled. Please reset a coherent value via Preference dialog."), TEXT("It seems the path of settings on cloud is set on a read only drive,\ror on a folder needed privilege right for writting access.\rYour settings on cloud will be canceled. Please reset a coherent value via Preference dialog."),
TEXT("Settings on Cloud"), TEXT("Settings on Cloud"),
MB_OK | MB_APPLMODAL); MB_OK | MB_APPLMODAL);
pNppParam->removeCloudChoice(); nppParam.removeCloudChoice();
} }
} }
@ -1842,11 +1842,11 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
if (message == WM_CLOSE) if (message == WM_CLOSE)
::DestroyWindow(hwnd); ::DestroyWindow(hwnd);
generic_string updaterFullPath = pNppParam->getWingupFullPath(); generic_string updaterFullPath = nppParam.getWingupFullPath();
if (!updaterFullPath.empty()) if (!updaterFullPath.empty())
{ {
Process updater(updaterFullPath.c_str(), pNppParam->getWingupParams().c_str(), pNppParam->getWingupDir().c_str()); Process updater(updaterFullPath.c_str(), nppParam.getWingupParams().c_str(), nppParam.getWingupDir().c_str());
updater.run(pNppParam->shouldDoUAC()); updater.run(nppParam.shouldDoUAC());
} }
} }
return TRUE; return TRUE;
@ -1869,7 +1869,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case WM_SYSCOMMAND: case WM_SYSCOMMAND:
{ {
const NppGUI & nppgui = (pNppParam->getNppGUI()); const NppGUI & nppgui = (nppParam.getNppGUI());
if (((nppgui._isMinimizedToTray && !_isAdministrator) || _pPublicInterface->isPrelaunch()) && (wParam == SC_MINIMIZE)) if (((nppgui._isMinimizedToTray && !_isAdministrator) || _pPublicInterface->isPrelaunch()) && (wParam == SC_MINIMIZE))
{ {
if (nullptr == _pTrayIco) if (nullptr == _pTrayIco)
@ -2016,7 +2016,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_GETWINDOWSVERSION: case NPPM_GETWINDOWSVERSION:
{ {
return (NppParameters::getInstance())->getWinVersion(); return (NppParameters::getInstance()).getWinVersion();
} }
case NPPM_MAKECURRENTBUFFERDIRTY: case NPPM_MAKECURRENTBUFFERDIRTY:
@ -2027,12 +2027,12 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_GETENABLETHEMETEXTUREFUNC: case NPPM_GETENABLETHEMETEXTUREFUNC:
{ {
return (LRESULT)pNppParam->getEnableThemeDlgTexture(); return (LRESULT)nppParam.getEnableThemeDlgTexture();
} }
case NPPM_GETPLUGINSCONFIGDIR: case NPPM_GETPLUGINSCONFIGDIR:
{ {
generic_string userPluginConfDir = pNppParam->getUserPluginConfDir(); generic_string userPluginConfDir = nppParam.getUserPluginConfDir();
if (lParam != 0) if (lParam != 0)
{ {
if (userPluginConfDir.length() >= static_cast<size_t>(wParam)) if (userPluginConfDir.length() >= static_cast<size_t>(wParam))
@ -2049,7 +2049,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_GETPLUGINHOMEPATH: case NPPM_GETPLUGINHOMEPATH:
{ {
generic_string pluginHomePath = pNppParam->getPluginRootDir(); generic_string pluginHomePath = nppParam.getPluginRootDir();
if (lParam != 0) if (lParam != 0)
{ {
if (pluginHomePath.length() >= static_cast<size_t>(wParam)) if (pluginHomePath.length() >= static_cast<size_t>(wParam))
@ -2090,7 +2090,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
DocTabView::setHideTabBarStatus(hide); DocTabView::setHideTabBarStatus(hide);
::SendMessage(hwnd, WM_SIZE, 0, 0); ::SendMessage(hwnd, WM_SIZE, 0, 0);
NppGUI & nppGUI = const_cast<NppGUI &>(((NppParameters::getInstance())->getNppGUI())); NppGUI & nppGUI = const_cast<NppGUI &>(((NppParameters::getInstance()).getNppGUI()));
if (hide) if (hide)
nppGUI._tabStatus |= TAB_HIDE; nppGUI._tabStatus |= TAB_HIDE;
else else
@ -2125,7 +2125,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
if (hide == isHidden) if (hide == isHidden)
return isHidden; return isHidden;
NppGUI & nppGUI = const_cast<NppGUI &>(pNppParam->getNppGUI()); NppGUI & nppGUI = const_cast<NppGUI &>(nppParam.getNppGUI());
nppGUI._menuBarShow = !hide; nppGUI._menuBarShow = !hide;
if (nppGUI._menuBarShow) if (nppGUI._menuBarShow)
::SetMenu(hwnd, _mainMenuHandle); ::SetMenu(hwnd, _mainMenuHandle);
@ -2143,7 +2143,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_HIDESTATUSBAR: case NPPM_HIDESTATUSBAR:
{ {
bool show = (lParam != TRUE); bool show = (lParam != TRUE);
NppGUI & nppGUI = const_cast<NppGUI &>(pNppParam->getNppGUI()); NppGUI & nppGUI = const_cast<NppGUI &>(nppParam.getNppGUI());
bool oldVal = nppGUI._statusBarShow; bool oldVal = nppGUI._statusBarShow;
if (show == oldVal) if (show == oldVal)
return oldVal; return oldVal;
@ -2159,7 +2159,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_ISSTATUSBARHIDDEN: case NPPM_ISSTATUSBARHIDDEN:
{ {
const NppGUI & nppGUI = pNppParam->getNppGUI(); const NppGUI & nppGUI = nppParam.getNppGUI();
return !nppGUI._statusBarShow; return !nppGUI._statusBarShow;
} }
@ -2221,7 +2221,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_INTERNAL_DISABLEAUTOUPDATE: case NPPM_INTERNAL_DISABLEAUTOUPDATE:
{ {
//printStr(TEXT("you've got me")); //printStr(TEXT("you've got me"));
NppGUI & nppGUI = const_cast<NppGUI &>(pNppParam->getNppGUI()); NppGUI & nppGUI = const_cast<NppGUI &>(nppParam.getNppGUI());
nppGUI._autoUpdateOpt._doAutoUpdate = false; nppGUI._autoUpdateOpt._doAutoUpdate = false;
return TRUE; return TRUE;
} }
@ -2245,7 +2245,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_DOCSWITCHERDISABLECOLUMN: case NPPM_DOCSWITCHERDISABLECOLUMN:
{ {
BOOL isOff = static_cast<BOOL>(lParam); BOOL isOff = static_cast<BOOL>(lParam);
NppGUI & nppGUI = const_cast<NppGUI &>(pNppParam->getNppGUI()); NppGUI & nppGUI = const_cast<NppGUI &>(nppParam.getNppGUI());
nppGUI._fileSwitcherWithoutExtColumn = isOff == TRUE; nppGUI._fileSwitcherWithoutExtColumn = isOff == TRUE;
if (_pFileSwitcherPanel) if (_pFileSwitcherPanel)
@ -2260,8 +2260,8 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_GETEDITORDEFAULTBACKGROUNDCOLOR: case NPPM_GETEDITORDEFAULTBACKGROUNDCOLOR:
{ {
return (message == NPPM_GETEDITORDEFAULTFOREGROUNDCOLOR return (message == NPPM_GETEDITORDEFAULTFOREGROUNDCOLOR
?(NppParameters::getInstance())->getCurrentDefaultFgColor() ?(NppParameters::getInstance()).getCurrentDefaultFgColor()
:(NppParameters::getInstance())->getCurrentDefaultBgColor()); :(NppParameters::getInstance()).getCurrentDefaultBgColor());
} }
case NPPM_SHOWDOCSWITCHER: case NPPM_SHOWDOCSWITCHER:
@ -2296,7 +2296,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
// if doLocal - not allowed. Otherwise - allowed. // if doLocal - not allowed. Otherwise - allowed.
case NPPM_GETAPPDATAPLUGINSALLOWED: case NPPM_GETAPPDATAPLUGINSALLOWED:
{ {
const TCHAR *appDataNpp = pNppParam->getAppDataNppDir(); const TCHAR *appDataNpp = nppParam.getAppDataNppDir();
if (appDataNpp[0]) // if not doLocal if (appDataNpp[0]) // if not doLocal
{ {
return TRUE; return TRUE;
@ -2315,13 +2315,13 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
// //
case NPPM_INTERNAL_SETTING_HISTORY_SIZE: case NPPM_INTERNAL_SETTING_HISTORY_SIZE:
{ {
_lastRecentFileList.setUserMaxNbLRF(pNppParam->getNbMaxRecentFile()); _lastRecentFileList.setUserMaxNbLRF(nppParam.getNbMaxRecentFile());
break; break;
} }
case NPPM_INTERNAL_SETTING_EDGE_SIZE: case NPPM_INTERNAL_SETTING_EDGE_SIZE:
{ {
ScintillaViewParams & svp = (ScintillaViewParams &)(NppParameters::getInstance())->getSVP(); ScintillaViewParams & svp = (ScintillaViewParams &)(NppParameters::getInstance()).getSVP();
_mainEditView.execute(SCI_SETEDGECOLUMN, svp._edgeNbColumn); _mainEditView.execute(SCI_SETEDGECOLUMN, svp._edgeNbColumn);
_subEditView.execute(SCI_SETEDGECOLUMN, svp._edgeNbColumn); _subEditView.execute(SCI_SETEDGECOLUMN, svp._edgeNbColumn);
break; break;
@ -2355,7 +2355,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case WM_ENTERMENULOOP: case WM_ENTERMENULOOP:
{ {
const NppGUI & nppgui = pNppParam->getNppGUI(); const NppGUI & nppgui = nppParam.getNppGUI();
if (!nppgui._menuBarShow && !wParam && !_sysMenuEntering) if (!nppgui._menuBarShow && !wParam && !_sysMenuEntering)
::SetMenu(hwnd, _mainMenuHandle); ::SetMenu(hwnd, _mainMenuHandle);
@ -2364,7 +2364,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case WM_EXITMENULOOP: case WM_EXITMENULOOP:
{ {
const NppGUI & nppgui = pNppParam->getNppGUI(); const NppGUI & nppgui = nppParam.getNppGUI();
if (!nppgui._menuBarShow && !wParam && !_sysMenuEntering) if (!nppgui._menuBarShow && !wParam && !_sysMenuEntering)
::SetMenu(hwnd, NULL); ::SetMenu(hwnd, NULL);
_sysMenuEntering = false; _sysMenuEntering = false;

View File

@ -194,7 +194,7 @@ void Notepad_plus::command(int id)
case IDM_FILE_CLOSEALL: case IDM_FILE_CLOSEALL:
{ {
bool isSnapshotMode = NppParameters::getInstance()->getNppGUI().isSnapshotMode(); bool isSnapshotMode = NppParameters::getInstance().getNppGUI().isSnapshotMode();
fileCloseAll(isSnapshotMode, false); fileCloseAll(isSnapshotMode, false);
checkDocState(); checkDocState();
break; break;
@ -459,7 +459,7 @@ void Notepad_plus::command(int id)
if (_pEditView->execute(SCI_GETSELECTIONS) != 1) // Multi-Selection || Column mode || no selection if (_pEditView->execute(SCI_GETSELECTIONS) != 1) // Multi-Selection || Column mode || no selection
return; return;
const NppGUI & nppGui = (NppParameters::getInstance())->getNppGUI(); const NppGUI & nppGui = (NppParameters::getInstance()).getNppGUI();
generic_string url; generic_string url;
if (nppGui._searchEngineChoice == nppGui.se_custom) if (nppGui._searchEngineChoice == nppGui.se_custom)
{ {
@ -703,8 +703,8 @@ void Notepad_plus::command(int id)
{ {
if (_pFileBrowser == nullptr) // first launch, check in params to open folders if (_pFileBrowser == nullptr) // first launch, check in params to open folders
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
launchFileBrowser(pNppParam->getFileBrowserRoots()); launchFileBrowser(nppParam.getFileBrowserRoots());
if (_pFileBrowser != nullptr) if (_pFileBrowser != nullptr)
{ {
checkMenuItem(IDM_VIEW_FILEBROWSER, true); checkMenuItem(IDM_VIEW_FILEBROWSER, true);
@ -1698,11 +1698,11 @@ void Notepad_plus::command(int id)
_toReduceTabBar = !_toReduceTabBar; _toReduceTabBar = !_toReduceTabBar;
//Resize the icon //Resize the icon
int iconDpiDynamicalSize = NppParameters::getInstance()->_dpiManager.scaleY(_toReduceTabBar?12:18); int iconDpiDynamicalSize = NppParameters::getInstance()._dpiManager.scaleY(_toReduceTabBar?12:18);
//Resize the tab height //Resize the tab height
int tabDpiDynamicalWidth = NppParameters::getInstance()->_dpiManager.scaleX(45); int tabDpiDynamicalWidth = NppParameters::getInstance()._dpiManager.scaleX(45);
int tabDpiDynamicalHeight = NppParameters::getInstance()->_dpiManager.scaleY(_toReduceTabBar?22:25); int tabDpiDynamicalHeight = NppParameters::getInstance()._dpiManager.scaleY(_toReduceTabBar?22:25);
TabCtrl_SetItemSize(_mainDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight); TabCtrl_SetItemSize(_mainDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight);
TabCtrl_SetItemSize(_subDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight); TabCtrl_SetItemSize(_subDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight);
_docTabIconList.setIconSize(iconDpiDynamicalSize); _docTabIconList.setIconSize(iconDpiDynamicalSize);
@ -1750,8 +1750,8 @@ void Notepad_plus::command(int id)
TabBarPlus::setDrawTabCloseButton(!TabBarPlus::drawTabCloseButton()); TabBarPlus::setDrawTabCloseButton(!TabBarPlus::drawTabCloseButton());
// This part is just for updating (redraw) the tabs // This part is just for updating (redraw) the tabs
int tabDpiDynamicalHeight = NppParameters::getInstance()->_dpiManager.scaleY(22); int tabDpiDynamicalHeight = NppParameters::getInstance()._dpiManager.scaleY(22);
int tabDpiDynamicalWidth = NppParameters::getInstance()->_dpiManager.scaleX(TabBarPlus::drawTabCloseButton() ? 60 : 45); int tabDpiDynamicalWidth = NppParameters::getInstance()._dpiManager.scaleX(TabBarPlus::drawTabCloseButton() ? 60 : 45);
TabCtrl_SetItemSize(_mainDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight); TabCtrl_SetItemSize(_mainDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight);
TabCtrl_SetItemSize(_subDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight); TabCtrl_SetItemSize(_subDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight);
@ -1865,7 +1865,7 @@ void Notepad_plus::command(int id)
_subEditView.showEOL(false); _subEditView.showEOL(false);
_subEditView.showWSAndTab(isChecked); _subEditView.showWSAndTab(isChecked);
ScintillaViewParams & svp1 = (ScintillaViewParams &)(NppParameters::getInstance())->getSVP(); ScintillaViewParams & svp1 = (ScintillaViewParams &)(NppParameters::getInstance()).getSVP();
svp1._whiteSpaceShow = isChecked; svp1._whiteSpaceShow = isChecked;
svp1._eolShow = false; svp1._eolShow = false;
break; break;
@ -1882,7 +1882,7 @@ void Notepad_plus::command(int id)
_mainEditView.showWSAndTab(false); _mainEditView.showWSAndTab(false);
_subEditView.showWSAndTab(false); _subEditView.showWSAndTab(false);
ScintillaViewParams & svp1 = (ScintillaViewParams &)(NppParameters::getInstance())->getSVP(); ScintillaViewParams & svp1 = (ScintillaViewParams &)(NppParameters::getInstance()).getSVP();
svp1._whiteSpaceShow = false; svp1._whiteSpaceShow = false;
svp1._eolShow = isChecked; svp1._eolShow = isChecked;
break; break;
@ -1897,7 +1897,7 @@ void Notepad_plus::command(int id)
_subEditView.showInvisibleChars(isChecked); _subEditView.showInvisibleChars(isChecked);
_toolBar.setCheck(IDM_VIEW_ALL_CHARACTERS, isChecked); _toolBar.setCheck(IDM_VIEW_ALL_CHARACTERS, isChecked);
ScintillaViewParams & svp1 = (ScintillaViewParams &)(NppParameters::getInstance())->getSVP(); ScintillaViewParams & svp1 = (ScintillaViewParams &)(NppParameters::getInstance()).getSVP();
svp1._whiteSpaceShow = isChecked; svp1._whiteSpaceShow = isChecked;
svp1._eolShow = isChecked; svp1._eolShow = isChecked;
break; break;
@ -1910,7 +1910,7 @@ void Notepad_plus::command(int id)
_toolBar.setCheck(IDM_VIEW_INDENT_GUIDE, _pEditView->isShownIndentGuide()); _toolBar.setCheck(IDM_VIEW_INDENT_GUIDE, _pEditView->isShownIndentGuide());
checkMenuItem(IDM_VIEW_INDENT_GUIDE, _pEditView->isShownIndentGuide()); checkMenuItem(IDM_VIEW_INDENT_GUIDE, _pEditView->isShownIndentGuide());
ScintillaViewParams & svp1 = (ScintillaViewParams &)(NppParameters::getInstance())->getSVP(); ScintillaViewParams & svp1 = (ScintillaViewParams &)(NppParameters::getInstance()).getSVP();
svp1._indentGuideLineShow = _pEditView->isShownIndentGuide(); svp1._indentGuideLineShow = _pEditView->isShownIndentGuide();
break; break;
} }
@ -1931,7 +1931,7 @@ void Notepad_plus::command(int id)
_toolBar.setCheck(IDM_VIEW_WRAP, isWraped); _toolBar.setCheck(IDM_VIEW_WRAP, isWraped);
checkMenuItem(IDM_VIEW_WRAP, isWraped); checkMenuItem(IDM_VIEW_WRAP, isWraped);
ScintillaViewParams & svp1 = (ScintillaViewParams &)(NppParameters::getInstance())->getSVP(); ScintillaViewParams & svp1 = (ScintillaViewParams &)(NppParameters::getInstance()).getSVP();
svp1._doWrap = isWraped; svp1._doWrap = isWraped;
if (_pDocMap) if (_pDocMap)
@ -1947,7 +1947,7 @@ void Notepad_plus::command(int id)
_subEditView.showWrapSymbol(!_pEditView->isWrapSymbolVisible()); _subEditView.showWrapSymbol(!_pEditView->isWrapSymbolVisible());
checkMenuItem(IDM_VIEW_WRAP_SYMBOL, _pEditView->isWrapSymbolVisible()); checkMenuItem(IDM_VIEW_WRAP_SYMBOL, _pEditView->isWrapSymbolVisible());
ScintillaViewParams & svp1 = (ScintillaViewParams &)(NppParameters::getInstance())->getSVP(); ScintillaViewParams & svp1 = (ScintillaViewParams &)(NppParameters::getInstance()).getSVP();
svp1._wrapSymbolShow = _pEditView->isWrapSymbolVisible(); svp1._wrapSymbolShow = _pEditView->isWrapSymbolVisible();
break; break;
} }
@ -2019,7 +2019,7 @@ void Notepad_plus::command(int id)
int64_t fileLen = curBuf->getFileLength(); int64_t fileLen = curBuf->getFileLength();
// localization for summary date // localization for summary date
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
if (pNativeSpeaker) if (pNativeSpeaker)
{ {
@ -2525,7 +2525,7 @@ void Notepad_plus::command(int id)
// Tell users to restart Notepad++ to load plugin // Tell users to restart Notepad++ to load plugin
if (copiedFiles.size()) if (copiedFiles.size())
{ {
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
pNativeSpeaker->messageBox("NeedToRestartToLoadPlugins", pNativeSpeaker->messageBox("NeedToRestartToLoadPlugins",
NULL, NULL,
TEXT("You have to restart Notepad++ to load plugins you installed."), TEXT("You have to restart Notepad++ to load plugins you installed."),
@ -2543,8 +2543,8 @@ void Notepad_plus::command(int id)
const TCHAR *destDir = TEXT("themes"); const TCHAR *destDir = TEXT("themes");
// load styler // load styler
NppParameters *pNppParams = NppParameters::getInstance(); NppParameters& nppParams = NppParameters::getInstance();
ThemeSwitcher & themeSwitcher = pNppParams->getThemeSwitcher(); ThemeSwitcher & themeSwitcher = nppParams.getThemeSwitcher();
vector<generic_string> copiedFiles = addNppComponents(destDir, extFilterName, extFilter); vector<generic_string> copiedFiles = addNppComponents(destDir, extFilterName, extFilter);
for (size_t i = 0, len = copiedFiles.size(); i < len ; ++i) for (size_t i = 0, len = copiedFiles.size(); i < len ; ++i)
@ -2576,7 +2576,7 @@ void Notepad_plus::command(int id)
case IDM_SETTING_OPENPLUGINSDIR: case IDM_SETTING_OPENPLUGINSDIR:
{ {
const TCHAR* pluginHomePath = NppParameters::getInstance()->getPluginRootDir(); const TCHAR* pluginHomePath = NppParameters::getInstance().getPluginRootDir();
if (pluginHomePath && pluginHomePath[0]) if (pluginHomePath && pluginHomePath[0])
{ {
::ShellExecute(NULL, NULL, pluginHomePath, NULL, NULL, SW_SHOWNORMAL); ::ShellExecute(NULL, NULL, pluginHomePath, NULL, NULL, SW_SHOWNORMAL);
@ -2615,8 +2615,8 @@ void Notepad_plus::command(int id)
TEXT("Editing contextMenu"), TEXT("Editing contextMenu"),
MB_OK|MB_APPLMODAL); MB_OK|MB_APPLMODAL);
NppParameters *pNppParams = NppParameters::getInstance(); NppParameters& nppParams = NppParameters::getInstance();
BufferID bufID = doOpen((pNppParams->getContextMenuPath())); BufferID bufID = doOpen((nppParams.getContextMenuPath()));
switchToFile(bufID); switchToFile(bufID);
break; break;
} }
@ -2776,7 +2776,7 @@ void Notepad_plus::command(int id)
} }
else if (iQuote == -2) else if (iQuote == -2)
{ {
generic_string noEasterEggsPath((NppParameters::getInstance())->getNppPath()); generic_string noEasterEggsPath((NppParameters::getInstance()).getNppPath());
noEasterEggsPath.append(TEXT("\\noEasterEggs.xml")); noEasterEggsPath.append(TEXT("\\noEasterEggs.xml"));
if (!::PathFileExists(noEasterEggsPath.c_str())) if (!::PathFileExists(noEasterEggsPath.c_str()))
showAllQuotes(); showAllQuotes();
@ -2784,7 +2784,7 @@ void Notepad_plus::command(int id)
} }
if (iQuote != -1) if (iQuote != -1)
{ {
generic_string noEasterEggsPath((NppParameters::getInstance())->getNppPath()); generic_string noEasterEggsPath((NppParameters::getInstance()).getNppPath());
noEasterEggsPath.append(TEXT("\\noEasterEggs.xml")); noEasterEggsPath.append(TEXT("\\noEasterEggs.xml"));
if (!::PathFileExists(noEasterEggsPath.c_str())) if (!::PathFileExists(noEasterEggsPath.c_str()))
showQuoteFromIndex(iQuote); showQuoteFromIndex(iQuote);
@ -2814,7 +2814,7 @@ void Notepad_plus::command(int id)
case IDM_HELP : case IDM_HELP :
{ {
generic_string tmp((NppParameters::getInstance())->getNppPath()); generic_string tmp((NppParameters::getInstance()).getNppPath());
generic_string nppHelpPath = tmp.c_str(); generic_string nppHelpPath = tmp.c_str();
nppHelpPath += TEXT("\\user.manual\\documentation\\notepad-online-document.html"); nppHelpPath += TEXT("\\user.manual\\documentation\\notepad-online-document.html");
@ -2881,7 +2881,7 @@ void Notepad_plus::command(int id)
case IDM_CONFUPDATERPROXY : case IDM_CONFUPDATERPROXY :
{ {
// wingup doesn't work with the obsolete security layer (API) under xp since downloadings are secured with SSL on notepad_plus_plus.org // wingup doesn't work with the obsolete security layer (API) under xp since downloadings are secured with SSL on notepad_plus_plus.org
winVer ver = NppParameters::getInstance()->getWinVersion(); winVer ver = NppParameters::getInstance().getWinVersion();
if (ver <= WV_XP) if (ver <= WV_XP)
{ {
long res = _nativeLangSpeaker.messageBox("XpUpdaterProblem", long res = _nativeLangSpeaker.messageBox("XpUpdaterProblem",
@ -2897,7 +2897,7 @@ void Notepad_plus::command(int id)
} }
else else
{ {
generic_string updaterDir = (NppParameters::getInstance())->getNppPath(); generic_string updaterDir = (NppParameters::getInstance()).getNppPath();
PathAppend(updaterDir, TEXT("updater")); PathAppend(updaterDir, TEXT("updater"));
generic_string updaterFullPath = updaterDir; generic_string updaterFullPath = updaterDir;
@ -2923,7 +2923,7 @@ void Notepad_plus::command(int id)
param = TEXT("-verbose -v"); param = TEXT("-verbose -v");
param += VERSION_VALUE; param += VERSION_VALUE;
if (NppParameters::getInstance()->isx64()) if (NppParameters::getInstance().isx64())
{ {
param += TEXT(" -px64"); param += TEXT(" -px64");
} }
@ -3063,7 +3063,7 @@ void Notepad_plus::command(int id)
size_t nbDoc = viewVisible(MAIN_VIEW) ? _mainDocTab.nbItem() : 0; size_t nbDoc = viewVisible(MAIN_VIEW) ? _mainDocTab.nbItem() : 0;
nbDoc += viewVisible(SUB_VIEW)?_subDocTab.nbItem():0; nbDoc += viewVisible(SUB_VIEW)?_subDocTab.nbItem():0;
bool doTaskList = ((NppParameters::getInstance())->getNppGUI())._doTaskList; bool doTaskList = ((NppParameters::getInstance()).getNppGUI())._doTaskList;
_isFolding = true; _isFolding = true;
if (nbDoc > 1) if (nbDoc > 1)
{ {
@ -3145,7 +3145,7 @@ void Notepad_plus::command(int id)
case IDM_SYSTRAYPOPUP_NEWDOC: case IDM_SYSTRAYPOPUP_NEWDOC:
{ {
NppGUI & nppGUI = const_cast<NppGUI &>((NppParameters::getInstance())->getNppGUI()); NppGUI & nppGUI = const_cast<NppGUI &>((NppParameters::getInstance()).getNppGUI());
::ShowWindow(_pPublicInterface->getHSelf(), nppGUI._isMaximized?SW_MAXIMIZE:SW_SHOW); ::ShowWindow(_pPublicInterface->getHSelf(), nppGUI._isMaximized?SW_MAXIMIZE:SW_SHOW);
fileNew(); fileNew();
} }
@ -3153,7 +3153,7 @@ void Notepad_plus::command(int id)
case IDM_SYSTRAYPOPUP_ACTIVATE : case IDM_SYSTRAYPOPUP_ACTIVATE :
{ {
NppGUI & nppGUI = const_cast<NppGUI &>((NppParameters::getInstance())->getNppGUI()); NppGUI & nppGUI = const_cast<NppGUI &>((NppParameters::getInstance()).getNppGUI());
::ShowWindow(_pPublicInterface->getHSelf(), nppGUI._isMaximized?SW_MAXIMIZE:SW_SHOW); ::ShowWindow(_pPublicInterface->getHSelf(), nppGUI._isMaximized?SW_MAXIMIZE:SW_SHOW);
// Send sizing info to make window fit (specially to show tool bar. Fixed issue #2600) // Send sizing info to make window fit (specially to show tool bar. Fixed issue #2600)
@ -3163,7 +3163,7 @@ void Notepad_plus::command(int id)
case IDM_SYSTRAYPOPUP_NEW_AND_PASTE: case IDM_SYSTRAYPOPUP_NEW_AND_PASTE:
{ {
NppGUI & nppGUI = const_cast<NppGUI &>((NppParameters::getInstance())->getNppGUI()); NppGUI & nppGUI = const_cast<NppGUI &>((NppParameters::getInstance()).getNppGUI());
::ShowWindow(_pPublicInterface->getHSelf(), nppGUI._isMaximized?SW_MAXIMIZE:SW_SHOW); ::ShowWindow(_pPublicInterface->getHSelf(), nppGUI._isMaximized?SW_MAXIMIZE:SW_SHOW);
BufferID bufferID = _pEditView->getCurrentBufferID(); BufferID bufferID = _pEditView->getCurrentBufferID();
Buffer * buf = MainFileManager.getBufferByID(bufferID); Buffer * buf = MainFileManager.getBufferByID(bufferID);
@ -3177,7 +3177,7 @@ void Notepad_plus::command(int id)
case IDM_SYSTRAYPOPUP_OPENFILE: case IDM_SYSTRAYPOPUP_OPENFILE:
{ {
NppGUI & nppGUI = const_cast<NppGUI &>((NppParameters::getInstance())->getNppGUI()); NppGUI & nppGUI = const_cast<NppGUI &>((NppParameters::getInstance()).getNppGUI());
::ShowWindow(_pPublicInterface->getHSelf(), nppGUI._isMaximized?SW_MAXIMIZE:SW_SHOW); ::ShowWindow(_pPublicInterface->getHSelf(), nppGUI._isMaximized?SW_MAXIMIZE:SW_SHOW);
// Send sizing info to make window fit (specially to show tool bar. Fixed issue #2600) // Send sizing info to make window fit (specially to show tool bar. Fixed issue #2600)
@ -3248,7 +3248,7 @@ void Notepad_plus::command(int id)
case IDM_VIEW_CURLINE_HILITING: case IDM_VIEW_CURLINE_HILITING:
{ {
COLORREF colour = (NppParameters::getInstance())->getCurLineHilitingColour(); COLORREF colour = (NppParameters::getInstance()).getCurLineHilitingColour();
_mainEditView.setCurrentLineHiLiting(!_pEditView->isCurrentLineHiLiting(), colour); _mainEditView.setCurrentLineHiLiting(!_pEditView->isCurrentLineHiLiting(), colour);
_subEditView.setCurrentLineHiLiting(!_pEditView->isCurrentLineHiLiting(), colour); _subEditView.setCurrentLineHiLiting(!_pEditView->isCurrentLineHiLiting(), colour);
} }
@ -3320,13 +3320,13 @@ void Notepad_plus::command(int id)
else if ((id >= ID_MACRO) && (id < ID_MACRO_LIMIT)) else if ((id >= ID_MACRO) && (id < ID_MACRO_LIMIT))
{ {
int i = id - ID_MACRO; int i = id - ID_MACRO;
vector<MacroShortcut> & theMacros = (NppParameters::getInstance())->getMacroList(); vector<MacroShortcut> & theMacros = (NppParameters::getInstance()).getMacroList();
macroPlayback(theMacros[i].getMacro()); macroPlayback(theMacros[i].getMacro());
} }
else if ((id >= ID_USER_CMD) && (id < ID_USER_CMD_LIMIT)) else if ((id >= ID_USER_CMD) && (id < ID_USER_CMD_LIMIT))
{ {
int i = id - ID_USER_CMD; int i = id - ID_USER_CMD;
vector<UserCommand> & theUserCommands = (NppParameters::getInstance())->getUserCommandList(); vector<UserCommand> & theUserCommands = (NppParameters::getInstance()).getUserCommandList();
UserCommand ucmd = theUserCommands[i]; UserCommand ucmd = theUserCommands[i];
Command cmd(ucmd.getCmd()); Command cmd(ucmd.getCmd());

View File

@ -127,7 +127,7 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive,
//If the lpBuffer buffer is too small to contain the path, the return value [of GetFullPathName] is the size, in TCHARs, of the buffer that is required to hold the path and the terminating null character. //If the lpBuffer buffer is too small to contain the path, the return value [of GetFullPathName] is the size, in TCHARs, of the buffer that is required to hold the path and the terminating null character.
//If [GetFullPathName] fails for any other reason, the return value is zero. //If [GetFullPathName] fails for any other reason, the return value is zero.
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
TCHAR longFileName[longFileNameBufferSize]; TCHAR longFileName[longFileNameBufferSize];
const DWORD getFullPathNameResult = ::GetFullPathName(fileName.c_str(), longFileNameBufferSize, longFileName, NULL); const DWORD getFullPathNameResult = ::GetFullPathName(fileName.c_str(), longFileNameBufferSize, longFileName, NULL);
@ -197,7 +197,7 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive,
if (isFileWorkspace(longFileName) && PathFileExists(longFileName)) if (isFileWorkspace(longFileName) && PathFileExists(longFileName))
{ {
pNppParam->setWorkSpaceFilePath(0, longFileName); nppParam.setWorkSpaceFilePath(0, longFileName);
command(IDM_VIEW_PROJECT_PANEL_1); command(IDM_VIEW_PROJECT_PANEL_1);
return BUFFER_INVALID; return BUFFER_INVALID;
} }
@ -205,7 +205,7 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive,
bool isWow64Off = false; bool isWow64Off = false;
if (!PathFileExists(longFileName)) if (!PathFileExists(longFileName))
{ {
pNppParam->safeWow64EnableWow64FsRedirection(FALSE); nppParam.safeWow64EnableWow64FsRedirection(FALSE);
isWow64Off = true; isWow64Off = true;
} }
@ -262,7 +262,7 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive,
{ {
if (isWow64Off) if (isWow64Off)
{ {
pNppParam->safeWow64EnableWow64FsRedirection(TRUE); nppParam.safeWow64EnableWow64FsRedirection(TRUE);
isWow64Off = false; isWow64Off = false;
} }
return BUFFER_INVALID; return BUFFER_INVALID;
@ -417,7 +417,7 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive,
if (isWow64Off) if (isWow64Off)
{ {
pNppParam->safeWow64EnableWow64FsRedirection(TRUE); nppParam.safeWow64EnableWow64FsRedirection(TRUE);
//isWow64Off = false; //isWow64Off = false;
} }
return buffer; return buffer;
@ -517,7 +517,7 @@ bool Notepad_plus::doSave(BufferID id, const TCHAR * filename, bool isCopy)
// try to open Notepad++ in admin mode // try to open Notepad++ in admin mode
if (!_isAdministrator) if (!_isAdministrator)
{ {
bool isSnapshotMode = NppParameters::getInstance()->getNppGUI().isSnapshotMode(); bool isSnapshotMode = NppParameters::getInstance().getNppGUI().isSnapshotMode();
if (isSnapshotMode) // if both rememberSession && backup mode are enabled if (isSnapshotMode) // if both rememberSession && backup mode are enabled
{ // Open the 2nd Notepad++ instance in Admin mode, then close the 1st instance. { // Open the 2nd Notepad++ instance in Admin mode, then close the 1st instance.
int openInAdminModeRes = _nativeLangSpeaker.messageBox("OpenInAdminMode", int openInAdminModeRes = _nativeLangSpeaker.messageBox("OpenInAdminMode",
@ -651,11 +651,11 @@ void Notepad_plus::doClose(BufferID id, int whichOne, bool doDeleteBackup)
// if the file doesn't exist, it could be redirected // if the file doesn't exist, it could be redirected
// So we turn Wow64 off // So we turn Wow64 off
bool isWow64Off = false; bool isWow64Off = false;
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
const TCHAR *fn = buf->getFullPathName(); const TCHAR *fn = buf->getFullPathName();
if (!PathFileExists(fn)) if (!PathFileExists(fn))
{ {
pNppParam->safeWow64EnableWow64FsRedirection(FALSE); nppParam.safeWow64EnableWow64FsRedirection(FALSE);
isWow64Off = true; isWow64Off = true;
} }
@ -665,7 +665,7 @@ void Notepad_plus::doClose(BufferID id, int whichOne, bool doDeleteBackup)
// We enable Wow64 system, if it was disabled // We enable Wow64 system, if it was disabled
if (isWow64Off) if (isWow64Off)
{ {
pNppParam->safeWow64EnableWow64FsRedirection(TRUE); nppParam.safeWow64EnableWow64FsRedirection(TRUE);
//isWow64Off = false; //isWow64Off = false;
} }
} }
@ -713,7 +713,7 @@ void Notepad_plus::doClose(BufferID id, int whichOne, bool doDeleteBackup)
} }
command(IDM_VIEW_REFRESHTABAR); command(IDM_VIEW_REFRESHTABAR);
if (NppParameters::getInstance()->getNppGUI()._tabStatus & TAB_QUITONEMPTY) if (NppParameters::getInstance().getNppGUI()._tabStatus & TAB_QUITONEMPTY)
{ {
// the user closed the last open tab // the user closed the last open tab
if (numInitialOpenBuffers == 1 && isEmpty() && !_isAttemptingCloseOnQuit) if (numInitialOpenBuffers == 1 && isEmpty() && !_isAttemptingCloseOnQuit)
@ -777,11 +777,11 @@ generic_string Notepad_plus::exts2Filters(const generic_string& exts) const
int Notepad_plus::setFileOpenSaveDlgFilters(FileDialog & fDlg, int langType) int Notepad_plus::setFileOpenSaveDlgFilters(FileDialog & fDlg, int langType)
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
NppGUI & nppGUI = (NppGUI & )pNppParam->getNppGUI(); NppGUI & nppGUI = (NppGUI & )nppParam.getNppGUI();
int i = 0; int i = 0;
Lang *l = NppParameters::getInstance()->getLangFromIndex(i++); Lang *l = NppParameters::getInstance().getLangFromIndex(i++);
int ltIndex = 0; int ltIndex = 0;
bool ltFound = false; bool ltFound = false;
@ -805,7 +805,7 @@ int Notepad_plus::setFileOpenSaveDlgFilters(FileDialog & fDlg, int langType)
const TCHAR *defList = l->getDefaultExtList(); const TCHAR *defList = l->getDefaultExtList();
const TCHAR *userList = NULL; const TCHAR *userList = NULL;
LexerStylerArray &lsa = (NppParameters::getInstance())->getLStylerArray(); LexerStylerArray &lsa = (NppParameters::getInstance()).getLStylerArray();
const TCHAR *lName = l->getLangName(); const TCHAR *lName = l->getLangName();
LexerStyler *pLS = lsa.getLexerStylerByName(lName); LexerStyler *pLS = lsa.getLexerStylerByName(lName);
@ -841,7 +841,7 @@ int Notepad_plus::setFileOpenSaveDlgFilters(FileDialog & fDlg, int langType)
} }
} }
} }
l = (NppParameters::getInstance())->getLangFromIndex(i++); l = (NppParameters::getInstance()).getLangFromIndex(i++);
} }
if (!ltFound) if (!ltFound)
@ -888,7 +888,7 @@ bool Notepad_plus::fileClose(BufferID id, int curView)
if (curView != -1) if (curView != -1)
viewToClose = curView; viewToClose = curView;
bool isSnapshotMode = NppParameters::getInstance()->getNppGUI().isSnapshotMode(); bool isSnapshotMode = NppParameters::getInstance().getNppGUI().isSnapshotMode();
doClose(bufferID, viewToClose, isSnapshotMode); doClose(bufferID, viewToClose, isSnapshotMode);
return true; return true;
} }
@ -1141,7 +1141,7 @@ bool Notepad_plus::fileCloseAllGiven(const std::vector<int> &krvecBufferIndexes)
} }
// Now we close. // Now we close.
bool isSnapshotMode = NppParameters::getInstance()->getNppGUI().isSnapshotMode(); bool isSnapshotMode = NppParameters::getInstance().getNppGUI().isSnapshotMode();
for (std::vector<int>::const_iterator itIndex = krvecBufferIndexes.begin(); itIndex != itIndexesEnd; ++itIndex) for (std::vector<int>::const_iterator itIndex = krvecBufferIndexes.begin(); itIndex != itIndexesEnd; ++itIndex)
{ {
doClose(_pDocTab->getBufferByIndex(*itIndex), currentView(), isSnapshotMode); doClose(_pDocTab->getBufferByIndex(*itIndex), currentView(), isSnapshotMode);
@ -1302,7 +1302,7 @@ bool Notepad_plus::fileCloseAllButCurrent()
// We may have to restore previous view after saving new files // We may have to restore previous view after saving new files
switchEditViewTo(activeViewID); switchEditViewTo(activeViewID);
bool isSnapshotMode = NppParameters::getInstance()->getNppGUI().isSnapshotMode(); bool isSnapshotMode = NppParameters::getInstance().getNppGUI().isSnapshotMode();
//Then start closing, inactive view first so the active is left open //Then start closing, inactive view first so the active is left open
if (bothActive()) if (bothActive())
{ {
@ -1344,7 +1344,7 @@ bool Notepad_plus::fileSave(BufferID id)
return fileSaveAs(bufferID); return fileSaveAs(bufferID);
} }
const NppGUI & nppgui = (NppParameters::getInstance())->getNppGUI(); const NppGUI & nppgui = (NppParameters::getInstance()).getNppGUI();
BackupFeature backup = nppgui._backup; BackupFeature backup = nppgui._backup;
if (backup != bak_none) if (backup != bak_none)
@ -1490,14 +1490,14 @@ bool Notepad_plus::fileSaveAs(BufferID id, bool isSaveCopy)
fDlg.setExtIndex(langTypeIndex+1); // +1 for "All types" fDlg.setExtIndex(langTypeIndex+1); // +1 for "All types"
// Disable file autodetection before opening save dialog to prevent use-after-delete bug. // Disable file autodetection before opening save dialog to prevent use-after-delete bug.
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
auto cdBefore = pNppParam->getNppGUI()._fileAutoDetection; auto cdBefore = nppParam.getNppGUI()._fileAutoDetection;
(const_cast<NppGUI &>(pNppParam->getNppGUI()))._fileAutoDetection = cdDisabled; (const_cast<NppGUI &>(nppParam.getNppGUI()))._fileAutoDetection = cdDisabled;
TCHAR *pfn = fDlg.doSaveDlg(); TCHAR *pfn = fDlg.doSaveDlg();
// Enable file autodetection again. // Enable file autodetection again.
(const_cast<NppGUI &>(pNppParam->getNppGUI()))._fileAutoDetection = cdBefore; (const_cast<NppGUI &>(nppParam.getNppGUI()))._fileAutoDetection = cdBefore;
if (pfn) if (pfn)
{ {
@ -1578,7 +1578,7 @@ bool Notepad_plus::fileRename(BufferID id)
{ {
success = true; success = true;
buf->setFileName(tabNewName); buf->setFileName(tabNewName);
bool isSnapshotMode = NppParameters::getInstance()->getNppGUI().isSnapshotMode(); bool isSnapshotMode = NppParameters::getInstance().getNppGUI().isSnapshotMode();
if (isSnapshotMode) if (isSnapshotMode)
{ {
generic_string oldBackUpFile = buf->getBackupFileName(); generic_string oldBackUpFile = buf->getBackupFileName();
@ -1613,7 +1613,7 @@ bool Notepad_plus::fileDelete(BufferID id)
Buffer * buf = MainFileManager.getBufferByID(bufferID); Buffer * buf = MainFileManager.getBufferByID(bufferID);
const TCHAR *fileNamePath = buf->getFullPathName(); const TCHAR *fileNamePath = buf->getFullPathName();
winVer winVersion = (NppParameters::getInstance())->getWinVersion(); winVer winVersion = (NppParameters::getInstance()).getWinVersion();
bool goAhead = true; bool goAhead = true;
if (winVersion >= WV_WIN8 || winVersion == WV_UNKNOWN) if (winVersion >= WV_WIN8 || winVersion == WV_UNKNOWN)
{ {
@ -1642,7 +1642,7 @@ bool Notepad_plus::fileDelete(BufferID id)
return false; return false;
} }
bool isSnapshotMode = NppParameters::getInstance()->getNppGUI().isSnapshotMode(); bool isSnapshotMode = NppParameters::getInstance().getNppGUI().isSnapshotMode();
doClose(bufferID, MAIN_VIEW, isSnapshotMode); doClose(bufferID, MAIN_VIEW, isSnapshotMode);
doClose(bufferID, SUB_VIEW, isSnapshotMode); doClose(bufferID, SUB_VIEW, isSnapshotMode);
@ -1697,7 +1697,7 @@ bool Notepad_plus::fileReload()
bool Notepad_plus::isFileSession(const TCHAR * filename) { bool Notepad_plus::isFileSession(const TCHAR * filename) {
// if file2open matches the ext of user defined session file ext, then it'll be opened as a session // if file2open matches the ext of user defined session file ext, then it'll be opened as a session
const TCHAR *definedSessionExt = NppParameters::getInstance()->getNppGUI()._definedSessionExt.c_str(); const TCHAR *definedSessionExt = NppParameters::getInstance().getNppGUI()._definedSessionExt.c_str();
if (*definedSessionExt != '\0') if (*definedSessionExt != '\0')
{ {
generic_string fncp = filename; generic_string fncp = filename;
@ -1720,7 +1720,7 @@ bool Notepad_plus::isFileSession(const TCHAR * filename) {
bool Notepad_plus::isFileWorkspace(const TCHAR * filename) { bool Notepad_plus::isFileWorkspace(const TCHAR * filename) {
// if filename matches the ext of user defined workspace file ext, then it'll be opened as a workspace // if filename matches the ext of user defined workspace file ext, then it'll be opened as a workspace
const TCHAR *definedWorkspaceExt = NppParameters::getInstance()->getNppGUI()._definedWorkspaceExt.c_str(); const TCHAR *definedWorkspaceExt = NppParameters::getInstance().getNppGUI()._definedWorkspaceExt.c_str();
if (*definedWorkspaceExt != '\0') if (*definedWorkspaceExt != '\0')
{ {
generic_string fncp = filename; generic_string fncp = filename;
@ -1743,9 +1743,9 @@ bool Notepad_plus::isFileWorkspace(const TCHAR * filename) {
void Notepad_plus::loadLastSession() void Notepad_plus::loadLastSession()
{ {
NppParameters *nppParams = NppParameters::getInstance(); NppParameters& nppParams = NppParameters::getInstance();
const NppGUI & nppGui = nppParams->getNppGUI(); const NppGUI & nppGui = nppParams.getNppGUI();
Session lastSession = nppParams->getSession(); Session lastSession = nppParams.getSession();
bool isSnapshotMode = nppGui.isSnapshotMode(); bool isSnapshotMode = nppGui.isSnapshotMode();
_isFolding = true; _isFolding = true;
loadSession(lastSession, isSnapshotMode); loadSession(lastSession, isSnapshotMode);
@ -1754,7 +1754,7 @@ void Notepad_plus::loadLastSession()
bool Notepad_plus::loadSession(Session & session, bool isSnapshotMode) bool Notepad_plus::loadSession(Session & session, bool isSnapshotMode)
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
bool allSessionFilesLoaded = true; bool allSessionFilesLoaded = true;
BufferID lastOpened = BUFFER_INVALID; BufferID lastOpened = BUFFER_INVALID;
//size_t i = 0; //size_t i = 0;
@ -1777,7 +1777,7 @@ bool Notepad_plus::loadSession(Session & session, bool isSnapshotMode)
bool isWow64Off = false; bool isWow64Off = false;
if (!PathFileExists(pFn)) if (!PathFileExists(pFn))
{ {
pNppParam->safeWow64EnableWow64FsRedirection(FALSE); nppParam.safeWow64EnableWow64FsRedirection(FALSE);
isWow64Off = true; isWow64Off = true;
} }
if (PathFileExists(pFn)) if (PathFileExists(pFn))
@ -1797,7 +1797,7 @@ bool Notepad_plus::loadSession(Session & session, bool isSnapshotMode)
} }
if (isWow64Off) if (isWow64Off)
{ {
pNppParam->safeWow64EnableWow64FsRedirection(TRUE); nppParam.safeWow64EnableWow64FsRedirection(TRUE);
isWow64Off = false; isWow64Off = false;
} }
@ -1878,7 +1878,7 @@ bool Notepad_plus::loadSession(Session & session, bool isSnapshotMode)
bool isWow64Off = false; bool isWow64Off = false;
if (!PathFileExists(pFn)) if (!PathFileExists(pFn))
{ {
pNppParam->safeWow64EnableWow64FsRedirection(FALSE); nppParam.safeWow64EnableWow64FsRedirection(FALSE);
isWow64Off = true; isWow64Off = true;
} }
if (PathFileExists(pFn)) if (PathFileExists(pFn))
@ -1903,7 +1903,7 @@ bool Notepad_plus::loadSession(Session & session, bool isSnapshotMode)
} }
if (isWow64Off) if (isWow64Off)
{ {
pNppParam->safeWow64EnableWow64FsRedirection(TRUE); nppParam.safeWow64EnableWow64FsRedirection(TRUE);
isWow64Off = false; isWow64Off = false;
} }
@ -2008,7 +2008,7 @@ bool Notepad_plus::fileLoadSession(const TCHAR *fn)
if (fn == NULL) if (fn == NULL)
{ {
FileDialog fDlg(_pPublicInterface->getHSelf(), _pPublicInterface->getHinst()); FileDialog fDlg(_pPublicInterface->getHSelf(), _pPublicInterface->getHinst());
const TCHAR *ext = NppParameters::getInstance()->getNppGUI()._definedSessionExt.c_str(); const TCHAR *ext = NppParameters::getInstance().getNppGUI()._definedSessionExt.c_str();
generic_string sessionExt = TEXT(""); generic_string sessionExt = TEXT("");
if (*ext != '\0') if (*ext != '\0')
{ {
@ -2027,8 +2027,8 @@ bool Notepad_plus::fileLoadSession(const TCHAR *fn)
} }
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
const NppGUI & nppGUI = pNppParam->getNppGUI(); const NppGUI & nppGUI = nppParam.getNppGUI();
if (sessionFileName) if (sessionFileName)
{ {
bool isEmptyNpp = false; bool isEmptyNpp = false;
@ -2056,13 +2056,13 @@ bool Notepad_plus::fileLoadSession(const TCHAR *fn)
bool isAllSuccessful = true; bool isAllSuccessful = true;
Session session2Load; Session session2Load;
if ((NppParameters::getInstance())->loadSession(session2Load, sessionFileName)) if ((NppParameters::getInstance()).loadSession(session2Load, sessionFileName))
{ {
isAllSuccessful = loadSession(session2Load); isAllSuccessful = loadSession(session2Load);
result = true; result = true;
} }
if (!isAllSuccessful) if (!isAllSuccessful)
(NppParameters::getInstance())->writeSession(session2Load, sessionFileName); (NppParameters::getInstance()).writeSession(session2Load, sessionFileName);
} }
if (result == false) if (result == false)
{ {
@ -2092,7 +2092,7 @@ const TCHAR * Notepad_plus::fileSaveSession(size_t nbFile, TCHAR ** fileNames, c
else else
getCurrentOpenedFiles(currentSession); getCurrentOpenedFiles(currentSession);
(NppParameters::getInstance())->writeSession(currentSession, sessionFile2save); (NppParameters::getInstance()).writeSession(currentSession, sessionFile2save);
return sessionFile2save; return sessionFile2save;
} }
return NULL; return NULL;
@ -2103,7 +2103,7 @@ const TCHAR * Notepad_plus::fileSaveSession(size_t nbFile, TCHAR ** fileNames)
const TCHAR *sessionFileName = NULL; const TCHAR *sessionFileName = NULL;
FileDialog fDlg(_pPublicInterface->getHSelf(), _pPublicInterface->getHinst()); FileDialog fDlg(_pPublicInterface->getHSelf(), _pPublicInterface->getHinst());
const TCHAR *ext = NppParameters::getInstance()->getNppGUI()._definedSessionExt.c_str(); const TCHAR *ext = NppParameters::getInstance().getNppGUI()._definedSessionExt.c_str();
generic_string sessionExt = TEXT(""); generic_string sessionExt = TEXT("");
if (*ext != '\0') if (*ext != '\0')
@ -2123,7 +2123,7 @@ const TCHAR * Notepad_plus::fileSaveSession(size_t nbFile, TCHAR ** fileNames)
void Notepad_plus::saveSession(const Session & session) void Notepad_plus::saveSession(const Session & session)
{ {
(NppParameters::getInstance())->writeSession(session); (NppParameters::getInstance()).writeSession(session);
} }

View File

@ -127,7 +127,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
} }
bool isDirty = notification->nmhdr.code == SCN_SAVEPOINTLEFT; bool isDirty = notification->nmhdr.code == SCN_SAVEPOINTLEFT;
bool isSnapshotMode = NppParameters::getInstance()->getNppGUI().isSnapshotMode(); bool isSnapshotMode = NppParameters::getInstance().getNppGUI().isSnapshotMode();
if (isSnapshotMode && !isDirty) if (isSnapshotMode && !isDirty)
{ {
bool canUndo = _pEditView->execute(SCI_CANUNDO) == TRUE; bool canUndo = _pEditView->execute(SCI_CANUNDO) == TRUE;
@ -152,9 +152,9 @@ BOOL Notepad_plus::notify(SCNotification *notification)
case TCN_MOUSEHOVERING: case TCN_MOUSEHOVERING:
case TCN_MOUSEHOVERSWITCHING: case TCN_MOUSEHOVERSWITCHING:
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
bool doPeekOnTab = pNppParam->getNppGUI()._isDocPeekOnTab; bool doPeekOnTab = nppParam.getNppGUI()._isDocPeekOnTab;
bool doPeekOnMap = pNppParam->getNppGUI()._isDocPeekOnMap; bool doPeekOnMap = nppParam.getNppGUI()._isDocPeekOnMap;
if (doPeekOnTab) if (doPeekOnTab)
{ {
@ -218,9 +218,9 @@ BOOL Notepad_plus::notify(SCNotification *notification)
case TCN_MOUSELEAVING: case TCN_MOUSELEAVING:
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
bool doPeekOnTab = pNppParam->getNppGUI()._isDocPeekOnTab; bool doPeekOnTab = nppParam.getNppGUI()._isDocPeekOnTab;
bool doPeekOnMap = pNppParam->getNppGUI()._isDocPeekOnMap; bool doPeekOnMap = nppParam.getNppGUI()._isDocPeekOnMap;
if (doPeekOnTab) if (doPeekOnTab)
{ {
@ -388,7 +388,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
} }
else if (notification->nmhdr.hwndFrom == _mainDocTab.getHSelf() && _activeView == SUB_VIEW) else if (notification->nmhdr.hwndFrom == _mainDocTab.getHSelf() && _activeView == SUB_VIEW)
{ {
bool isSnapshotMode = NppParameters::getInstance()->getNppGUI().isSnapshotMode(); bool isSnapshotMode = NppParameters::getInstance().getNppGUI().isSnapshotMode();
if (isSnapshotMode) if (isSnapshotMode)
{ {
// Before switching off, synchronize backup file // Before switching off, synchronize backup file
@ -399,7 +399,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
} }
else if (notification->nmhdr.hwndFrom == _subDocTab.getHSelf() && _activeView == MAIN_VIEW) else if (notification->nmhdr.hwndFrom == _subDocTab.getHSelf() && _activeView == MAIN_VIEW)
{ {
bool isSnapshotMode = NppParameters::getInstance()->getNppGUI().isSnapshotMode(); bool isSnapshotMode = NppParameters::getInstance().getNppGUI().isSnapshotMode();
if (isSnapshotMode) if (isSnapshotMode)
{ {
// Before switching off, synchronize backup file // Before switching off, synchronize backup file
@ -611,7 +611,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
if (!_isFolding) if (!_isFolding)
{ {
int urlAction = (NppParameters::getInstance())->getNppGUI()._styleURL; int urlAction = (NppParameters::getInstance()).getNppGUI()._styleURL;
if ((urlAction == 1) || (urlAction == 2)) if ((urlAction == 1) || (urlAction == 2))
addHotSpot(); addHotSpot();
} }
@ -626,7 +626,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
{ {
if (!_recordingMacro && !_playingBackMacro) // No macro recording or playing back if (!_recordingMacro && !_playingBackMacro) // No macro recording or playing back
{ {
const NppGUI & nppGui = NppParameters::getInstance()->getNppGUI(); const NppGUI & nppGui = NppParameters::getInstance().getNppGUI();
bool indentMaintain = nppGui._maitainIndent; bool indentMaintain = nppGui._maitainIndent;
if (indentMaintain) if (indentMaintain)
maintainIndentation(static_cast<TCHAR>(notification->ch)); maintainIndentation(static_cast<TCHAR>(notification->ch));
@ -647,7 +647,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
if (notification->modifiers == SCMOD_CTRL) if (notification->modifiers == SCMOD_CTRL)
{ {
const NppGUI & nppGUI = NppParameters::getInstance()->getNppGUI(); const NppGUI & nppGUI = NppParameters::getInstance().getNppGUI();
std::string bufstring; std::string bufstring;
@ -798,19 +798,19 @@ BOOL Notepad_plus::notify(SCNotification *notification)
if (not notifyView) if (not notifyView)
return FALSE; return FALSE;
NppParameters *nppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
NppGUI & nppGui = const_cast<NppGUI &>(nppParam->getNppGUI()); NppGUI & nppGui = const_cast<NppGUI &>(nppParam.getNppGUI());
// replacement for obsolete custom SCN_SCROLLED // replacement for obsolete custom SCN_SCROLLED
if (notification->updated & SC_UPDATE_V_SCROLL) if (notification->updated & SC_UPDATE_V_SCROLL)
{ {
int urlAction = (NppParameters::getInstance())->getNppGUI()._styleURL; int urlAction = (NppParameters::getInstance()).getNppGUI()._styleURL;
if ((urlAction == 1) || (urlAction == 2)) if ((urlAction == 1) || (urlAction == 2))
addHotSpot(); addHotSpot();
} }
// if it's searching/replacing, then do nothing // if it's searching/replacing, then do nothing
if (nppParam->_isFindReplacing) if (nppParam._isFindReplacing)
break; break;
if (notification->nmhdr.hwndFrom != _pEditView->getHSelf()) // notification come from unfocus view - both views ae visible if (notification->nmhdr.hwndFrom != _pEditView->getHSelf()) // notification come from unfocus view - both views ae visible
@ -963,12 +963,12 @@ BOOL Notepad_plus::notify(SCNotification *notification)
if (_syncInfo.doSync()) if (_syncInfo.doSync())
doSynScorll(HWND(notification->nmhdr.hwndFrom)); doSynScorll(HWND(notification->nmhdr.hwndFrom));
NppParameters *nppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
// if it's searching/replacing, then do nothing // if it's searching/replacing, then do nothing
if ((_linkTriggered && !nppParam->_isFindReplacing) || notification->wParam == LINKTRIGGERED) if ((_linkTriggered && !nppParam._isFindReplacing) || notification->wParam == LINKTRIGGERED)
{ {
int urlAction = (NppParameters::getInstance())->getNppGUI()._styleURL; int urlAction = (NppParameters::getInstance()).getNppGUI()._styleURL;
if ((urlAction == 1) || (urlAction == 2)) if ((urlAction == 1) || (urlAction == 2))
addHotSpot(); addHotSpot();
_linkTriggered = false; _linkTriggered = false;

View File

@ -827,7 +827,7 @@ winVer NppParameters::getWindowsVersion()
return WV_UNKNOWN; return WV_UNKNOWN;
} }
int FileDialog::_dialogFileBoxId = (NppParameters::getInstance())->getWinVersion() < WV_W2K?edt1:cmb13; int FileDialog::_dialogFileBoxId = (NppParameters::getInstance()).getWinVersion() < WV_W2K?edt1:cmb13;
NppParameters::NppParameters() NppParameters::NppParameters()
@ -1381,7 +1381,7 @@ bool NppParameters::load()
PathAppend(_sessionPath, TEXT("session.xml")); PathAppend(_sessionPath, TEXT("session.xml"));
// Don't load session.xml if not required in order to speed up!! // Don't load session.xml if not required in order to speed up!!
const NppGUI & nppGUI = (NppParameters::getInstance())->getNppGUI(); const NppGUI & nppGUI = (NppParameters::getInstance()).getNppGUI();
if (nppGUI._rememberLastSession) if (nppGUI._rememberLastSession)
{ {
_pXmlSessionDoc = new TiXmlDocument(_sessionPath); _pXmlSessionDoc = new TiXmlDocument(_sessionPath);
@ -3749,7 +3749,7 @@ LangType NppParameters::getLangIDFromStr(const TCHAR *langName)
LangType l = (LangType)lang; LangType l = (LangType)lang;
if (l == L_EXTERNAL) //try find external lexer if (l == L_EXTERNAL) //try find external lexer
{ {
int id = NppParameters::getInstance()->getExternalLangIndexFromName(langName); int id = NppParameters::getInstance().getExternalLangIndexFromName(langName);
if (id != -1) return (LangType)(id + L_EXTERNAL); if (id != -1) return (LangType)(id + L_EXTERNAL);
} }

View File

@ -1290,9 +1290,9 @@ const int RECENTFILES_SHOWONLYFILENAME = 0;
class NppParameters final class NppParameters final
{ {
public: public:
static NppParameters* getInstance() { static NppParameters& getInstance() {
static NppParameters instance; static NppParameters instance;
return &instance; return instance;
}; };
static LangType getLangIDFromStr(const TCHAR *langName); static LangType getLangIDFromStr(const TCHAR *langName);
static generic_string getLocPathFromStr(const generic_string & localizationCode); static generic_string getLocPathFromStr(const generic_string & localizationCode);

View File

@ -133,7 +133,7 @@ bool AutoCompletion::showApiAndWordComplete()
void AutoCompletion::getWordArray(vector<generic_string> & wordArray, TCHAR *beginChars) void AutoCompletion::getWordArray(vector<generic_string> & wordArray, TCHAR *beginChars)
{ {
const size_t bufSize = 256; const size_t bufSize = 256;
const NppGUI & nppGUI = NppParameters::getInstance()->getNppGUI(); const NppGUI & nppGUI = NppParameters::getInstance().getNppGUI();
if (nppGUI._autocIgnoreNumbers && isAllDigits(beginChars)) if (nppGUI._autocIgnoreNumbers && isAllDigits(beginChars))
return; return;
@ -723,7 +723,7 @@ void AutoCompletion::update(int character)
if (!character) if (!character)
return; return;
const NppGUI & nppGUI = NppParameters::getInstance()->getNppGUI(); const NppGUI & nppGUI = NppParameters::getInstance().getNppGUI();
if (!_funcCompletionActive && nppGUI._autocStatus == nppGUI.autoc_func) if (!_funcCompletionActive && nppGUI._autocStatus == nppGUI.autoc_func)
return; return;
@ -890,8 +890,8 @@ const TCHAR * AutoCompletion::getApiFileName()
} }
} }
if (_curLang >= L_EXTERNAL && _curLang < NppParameters::getInstance()->L_END) if (_curLang >= L_EXTERNAL && _curLang < NppParameters::getInstance().L_END)
return NppParameters::getInstance()->getELCFromIndex(_curLang - L_EXTERNAL)._name; return NppParameters::getInstance().getELCFromIndex(_curLang - L_EXTERNAL)._name;
if (_curLang > L_EXTERNAL) if (_curLang > L_EXTERNAL)
_curLang = L_TEXT; _curLang = L_TEXT;

View File

@ -74,8 +74,8 @@ Buffer::Buffer(FileManager * pManager, BufferID id, Document doc, DocFileStatus
// type must be either DOC_REGULAR or DOC_UNNAMED // type must be either DOC_REGULAR or DOC_UNNAMED
: _pManager(pManager) , _id(id), _doc(doc), _lang(L_TEXT) : _pManager(pManager) , _id(id), _doc(doc), _lang(L_TEXT)
{ {
NppParameters* pNppParamInst = NppParameters::getInstance(); NppParameters& nppParamInst = NppParameters::getInstance();
const NewDocDefaultSettings& ndds = (pNppParamInst->getNppGUI()).getNewDocDefaultSettings(); const NewDocDefaultSettings& ndds = (nppParamInst.getNppGUI()).getNewDocDefaultSettings();
_eolFormat = ndds._format; _eolFormat = ndds._format;
_unicodeMode = ndds._unicodeMode; _unicodeMode = ndds._unicodeMode;
@ -163,7 +163,7 @@ void Buffer::updateTimeStamp()
// If the ext is not in the list, the defaultLang passed as argument will be set. // If the ext is not in the list, the defaultLang passed as argument will be set.
void Buffer::setFileName(const TCHAR *fn, LangType defaultLang) void Buffer::setFileName(const TCHAR *fn, LangType defaultLang)
{ {
NppParameters *pNppParamInst = NppParameters::getInstance(); NppParameters& nppParamInst = NppParameters::getInstance();
if (_fullPathName == fn) if (_fullPathName == fn)
{ {
updateTimeStamp(); updateTimeStamp();
@ -182,7 +182,7 @@ void Buffer::setFileName(const TCHAR *fn, LangType defaultLang)
ext += 1; ext += 1;
// Define User Lang firstly // Define User Lang firstly
const TCHAR* langName = pNppParamInst->getUserDefinedLangNameFromExt(ext, _fileName); const TCHAR* langName = nppParamInst.getUserDefinedLangNameFromExt(ext, _fileName);
if (langName) if (langName)
{ {
newLang = L_USER; newLang = L_USER;
@ -191,7 +191,7 @@ void Buffer::setFileName(const TCHAR *fn, LangType defaultLang)
else // if it's not user lang, then check if it's supported lang else // if it's not user lang, then check if it's supported lang
{ {
_userLangExt.clear(); _userLangExt.clear();
newLang = pNppParamInst->getLangFromExt(ext); newLang = nppParamInst.getLangFromExt(ext);
} }
} }
@ -230,11 +230,11 @@ bool Buffer::checkFileState() // returns true if the status has been changed (it
WIN32_FILE_ATTRIBUTE_DATA attributes; WIN32_FILE_ATTRIBUTE_DATA attributes;
bool isWow64Off = false; bool isWow64Off = false;
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
if (not PathFileExists(_fullPathName.c_str())) if (not PathFileExists(_fullPathName.c_str()))
{ {
pNppParam->safeWow64EnableWow64FsRedirection(FALSE); nppParam.safeWow64EnableWow64FsRedirection(FALSE);
isWow64Off = true; isWow64Off = true;
} }
@ -299,7 +299,7 @@ bool Buffer::checkFileState() // returns true if the status has been changed (it
if (isWow64Off) if (isWow64Off)
{ {
pNppParam->safeWow64EnableWow64FsRedirection(TRUE); nppParam.safeWow64EnableWow64FsRedirection(TRUE);
} }
return isOK; return isOK;
} }
@ -414,16 +414,16 @@ const std::vector<size_t> & Buffer::getHeaderLineState(const ScintillaEditView *
Lang * Buffer::getCurrentLang() const Lang * Buffer::getCurrentLang() const
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
int i = 0; int i = 0;
Lang *l = pNppParam->getLangFromIndex(i); Lang *l = nppParam.getLangFromIndex(i);
++i; ++i;
while (l) while (l)
{ {
if (l->_langID == _lang) if (l->_langID == _lang)
return l; return l;
l = pNppParam->getLangFromIndex(i); l = nppParam.getLangFromIndex(i);
++i; ++i;
} }
return nullptr; return nullptr;
@ -690,8 +690,8 @@ void FileManager::setLoadedBufferEncodingAndEol(Buffer* buf, const Utf8_16_Read&
{ {
if (encoding == -1) if (encoding == -1)
{ {
NppParameters *pNppParamInst = NppParameters::getInstance(); NppParameters& nppParamInst = NppParameters::getInstance();
const NewDocDefaultSettings & ndds = (pNppParamInst->getNppGUI()).getNewDocDefaultSettings(); const NewDocDefaultSettings & ndds = (nppParamInst.getNppGUI()).getNewDocDefaultSettings();
UniMode um = UnicodeConvertor.getEncoding(); UniMode um = UnicodeConvertor.getEncoding();
if (um == uni7Bit) if (um == uni7Bit)
@ -822,7 +822,7 @@ bool FileManager::backupCurrentBuffer()
if (backupFilePath.empty()) if (backupFilePath.empty())
{ {
// Create file // Create file
backupFilePath = NppParameters::getInstance()->getUserPath(); backupFilePath = NppParameters::getInstance().getUserPath();
backupFilePath += TEXT("\\backup\\"); backupFilePath += TEXT("\\backup\\");
// if "backup" folder doesn't exist, create it. // if "backup" folder doesn't exist, create it.
@ -1279,7 +1279,7 @@ bool FileManager::loadFileData(Document doc, const TCHAR * filename, char* data,
// As a 32bit application, we cannot allocate 2 buffer of more than INT_MAX size (it takes the whole address space) // As a 32bit application, we cannot allocate 2 buffer of more than INT_MAX size (it takes the whole address space)
if (bufferSizeRequested > INT_MAX) if (bufferSizeRequested > INT_MAX)
{ {
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
pNativeSpeaker->messageBox("FileTooBigToOpen", pNativeSpeaker->messageBox("FileTooBigToOpen",
NULL, NULL,
TEXT("File is too big to be opened by Notepad++"), TEXT("File is too big to be opened by Notepad++"),
@ -1308,7 +1308,7 @@ bool FileManager::loadFileData(Document doc, const TCHAR * filename, char* data,
else else
{ {
int id = fileFormat._language - L_EXTERNAL; int id = fileFormat._language - L_EXTERNAL;
TCHAR * name = NppParameters::getInstance()->getELCFromIndex(id)._name; TCHAR * name = NppParameters::getInstance().getELCFromIndex(id)._name;
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
const char *pName = wmc.wchar2char(name, CP_ACP); const char *pName = wmc.wchar2char(name, CP_ACP);
_pscratchTilla->execute(SCI_SETLEXERLANGUAGE, 0, reinterpret_cast<LPARAM>(pName)); _pscratchTilla->execute(SCI_SETLEXERLANGUAGE, 0, reinterpret_cast<LPARAM>(pName));
@ -1347,7 +1347,7 @@ bool FileManager::loadFileData(Document doc, const TCHAR * filename, char* data,
} }
else if (fileFormat._encoding == -1) else if (fileFormat._encoding == -1)
{ {
if (NppParameters::getInstance()->getNppGUI()._detectEncoding) if (NppParameters::getInstance().getNppGUI()._detectEncoding)
fileFormat._encoding = detectCodepage(data, lenFile); fileFormat._encoding = detectCodepage(data, lenFile);
} }
@ -1400,7 +1400,7 @@ bool FileManager::loadFileData(Document doc, const TCHAR * filename, char* data,
} }
__except(EXCEPTION_EXECUTE_HANDLER) //TODO: should filter correctly for other exceptions; the old filter(GetExceptionCode(), GetExceptionInformation()) was only catching access violations __except(EXCEPTION_EXECUTE_HANDLER) //TODO: should filter correctly for other exceptions; the old filter(GetExceptionCode(), GetExceptionInformation()) was only catching access violations
{ {
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
pNativeSpeaker->messageBox("FileTooBigToOpen", pNativeSpeaker->messageBox("FileTooBigToOpen",
NULL, NULL,
TEXT("File is too big to be opened by Notepad++"), TEXT("File is too big to be opened by Notepad++"),
@ -1414,8 +1414,8 @@ bool FileManager::loadFileData(Document doc, const TCHAR * filename, char* data,
// broadcast the format // broadcast the format
if (format == EolType::unknown) if (format == EolType::unknown)
{ {
NppParameters *pNppParamInst = NppParameters::getInstance(); NppParameters& nppParamInst = NppParameters::getInstance();
const NewDocDefaultSettings & ndds = (pNppParamInst->getNppGUI()).getNewDocDefaultSettings(); // for ndds._format const NewDocDefaultSettings & ndds = (nppParamInst.getNppGUI()).getNewDocDefaultSettings(); // for ndds._format
fileFormat._eolFormat = ndds._format; fileFormat._eolFormat = ndds._format;
//for empty files, if the default for new files is UTF8, and "Apply to opened ANSI files" is set, apply it //for empty files, if the default for new files is UTF8, and "Apply to opened ANSI files" is set, apply it

View File

@ -212,7 +212,7 @@ void DocTabView::setBuffer(size_t index, BufferID id)
void DocTabView::reSizeTo(RECT & rc) void DocTabView::reSizeTo(RECT & rc)
{ {
int borderWidth = ((NppParameters::getInstance())->getSVP())._borderWidth; int borderWidth = ((NppParameters::getInstance()).getSVP())._borderWidth;
if (_hideTabBarStatus) if (_hideTabBarStatus)
{ {
RECT rcTmp = rc; RECT rcTmp = rc;

View File

@ -266,7 +266,7 @@ void FindReplaceDlg::create(int dialogID, bool isRTL, bool msgDestParent)
//::GetWindowRect(_hSelf, &rect); //::GetWindowRect(_hSelf, &rect);
getClientRect(rect); getClientRect(rect);
_tab.init(_hInst, _hSelf, false, true); _tab.init(_hInst, _hSelf, false, true);
int tabDpiDynamicalHeight = NppParameters::getInstance()->_dpiManager.scaleY(13); int tabDpiDynamicalHeight = NppParameters::getInstance()._dpiManager.scaleY(13);
_tab.setFont(TEXT("Tahoma"), tabDpiDynamicalHeight); _tab.setFont(TEXT("Tahoma"), tabDpiDynamicalHeight);
const TCHAR *find = TEXT("Find"); const TCHAR *find = TEXT("Find");
@ -300,8 +300,8 @@ void FindReplaceDlg::create(int dialogID, bool isRTL, bool msgDestParent)
void FindReplaceDlg::fillFindHistory() void FindReplaceDlg::fillFindHistory()
{ {
NppParameters *nppParams = NppParameters::getInstance(); NppParameters& nppParams = NppParameters::getInstance();
FindHistory & findHistory = nppParams->getFindHistory(); FindHistory & findHistory = nppParams.getFindHistory();
fillComboHistory(IDFINDWHAT, findHistory._findHistoryFinds); fillComboHistory(IDFINDWHAT, findHistory._findHistoryFinds);
fillComboHistory(IDREPLACEWITH, findHistory._findHistoryReplaces); fillComboHistory(IDREPLACEWITH, findHistory._findHistoryReplaces);
@ -337,7 +337,7 @@ void FindReplaceDlg::fillFindHistory()
::EnableWindow(GetDlgItem(_hSelf, IDREDOTMATCHNL), true); ::EnableWindow(GetDlgItem(_hSelf, IDREDOTMATCHNL), true);
} }
if (nppParams->isTransparentAvailable()) if (nppParams.isTransparentAvailable())
{ {
::ShowWindow(::GetDlgItem(_hSelf, IDC_TRANSPARENT_CHECK), SW_SHOW); ::ShowWindow(::GetDlgItem(_hSelf, IDC_TRANSPARENT_CHECK), SW_SHOW);
::ShowWindow(::GetDlgItem(_hSelf, IDC_TRANSPARENT_GRPBOX), SW_SHOW); ::ShowWindow(::GetDlgItem(_hSelf, IDC_TRANSPARENT_GRPBOX), SW_SHOW);
@ -367,7 +367,7 @@ void FindReplaceDlg::fillFindHistory()
else else
{ {
id = IDC_TRANSPARENT_ALWAYS_RADIO; id = IDC_TRANSPARENT_ALWAYS_RADIO;
(NppParameters::getInstance())->SetTransparent(_hSelf, findHistory._transparency); (NppParameters::getInstance()).SetTransparent(_hSelf, findHistory._transparency);
} }
::SendDlgItemMessage(_hSelf, id, BM_SETCHECK, TRUE, 0); ::SendDlgItemMessage(_hSelf, id, BM_SETCHECK, TRUE, 0);
@ -398,7 +398,7 @@ void FindReplaceDlg::fillComboHistory(int id, const vector<generic_string> & str
void FindReplaceDlg::saveFindHistory() void FindReplaceDlg::saveFindHistory()
{ {
if (! isCreated()) return; if (! isCreated()) return;
FindHistory& findHistory = (NppParameters::getInstance())->getFindHistory(); FindHistory& findHistory = (NppParameters::getInstance()).getFindHistory();
saveComboHistory(IDD_FINDINFILES_DIR_COMBO, findHistory._nbMaxFindHistoryPath, findHistory._findHistoryPaths, false); saveComboHistory(IDD_FINDINFILES_DIR_COMBO, findHistory._nbMaxFindHistoryPath, findHistory._findHistoryPaths, false);
saveComboHistory(IDD_FINDINFILES_FILTERS_COMBO, findHistory._nbMaxFindHistoryFilter, findHistory._findHistoryFilters, true); saveComboHistory(IDD_FINDINFILES_FILTERS_COMBO, findHistory._nbMaxFindHistoryFilter, findHistory._findHistoryFilters, true);
@ -684,7 +684,7 @@ INT_PTR CALLBACK FindInFinderDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
pNativeSpeaker->changeDlgLang(_hSelf, "FindInFinder"); pNativeSpeaker->changeDlgLang(_hSelf, "FindInFinder");
initFromOptions(); initFromOptions();
} }
@ -863,7 +863,7 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
_countInSelFramePos.top = countP.y - 9; _countInSelFramePos.top = countP.y - 9;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string searchButtonTip = pNativeSpeaker->getLocalizedStrFromID("shift-change-direction-tip", TEXT("Use Shift+Enter to search in the opposite direction.")); generic_string searchButtonTip = pNativeSpeaker->getLocalizedStrFromID("shift-change-direction-tip", TEXT("Use Shift+Enter to search in the opposite direction."));
_shiftTrickUpTip = CreateToolTip(IDOK, _hSelf, _hInst, const_cast<PTSTR>(searchButtonTip.c_str())); _shiftTrickUpTip = CreateToolTip(IDOK, _hSelf, _hInst, const_cast<PTSTR>(searchButtonTip.c_str()));
@ -904,11 +904,11 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
if (reinterpret_cast<HWND>(lParam) == ::GetDlgItem(_hSelf, IDC_PERCENTAGE_SLIDER)) if (reinterpret_cast<HWND>(lParam) == ::GetDlgItem(_hSelf, IDC_PERCENTAGE_SLIDER))
{ {
int percent = static_cast<int32_t>(::SendDlgItemMessage(_hSelf, IDC_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0)); int percent = static_cast<int32_t>(::SendDlgItemMessage(_hSelf, IDC_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0));
FindHistory & findHistory = (NppParameters::getInstance())->getFindHistory(); FindHistory & findHistory = (NppParameters::getInstance()).getFindHistory();
findHistory._transparency = percent; findHistory._transparency = percent;
if (isCheckedOrNot(IDC_TRANSPARENT_ALWAYS_RADIO)) if (isCheckedOrNot(IDC_TRANSPARENT_ALWAYS_RADIO))
{ {
(NppParameters::getInstance())->SetTransparent(_hSelf, percent); (NppParameters::getInstance()).SetTransparent(_hSelf, percent);
} }
} }
return TRUE; return TRUE;
@ -975,11 +975,11 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
if (LOWORD(wParam) == WA_INACTIVE && isVisible()) if (LOWORD(wParam) == WA_INACTIVE && isVisible())
{ {
int percent = static_cast<int32_t>(::SendDlgItemMessage(_hSelf, IDC_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0)); int percent = static_cast<int32_t>(::SendDlgItemMessage(_hSelf, IDC_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0));
(NppParameters::getInstance())->SetTransparent(_hSelf, percent); (NppParameters::getInstance()).SetTransparent(_hSelf, percent);
} }
else else
{ {
(NppParameters::getInstance())->removeTransparent(_hSelf); (NppParameters::getInstance()).removeTransparent(_hSelf);
} }
} }
@ -1002,8 +1002,8 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
case WM_COMMAND : case WM_COMMAND :
{ {
bool isMacroRecording = (::SendMessage(_hParent, WM_GETCURRENTMACROSTATUS,0,0) == MACRO_RECORDING_IN_PROGRESS); bool isMacroRecording = (::SendMessage(_hParent, WM_GETCURRENTMACROSTATUS,0,0) == MACRO_RECORDING_IN_PROGRESS);
NppParameters *nppParamInst = NppParameters::getInstance(); NppParameters& nppParamInst = NppParameters::getInstance();
FindHistory & findHistory = nppParamInst->getFindHistory(); FindHistory & findHistory = nppParamInst.getFindHistory();
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
//Single actions //Single actions
@ -1034,7 +1034,7 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
_options._str2Search = getTextFromCombo(hFindCombo); _options._str2Search = getTextFromCombo(hFindCombo);
updateCombo(IDFINDWHAT); updateCombo(IDFINDWHAT);
nppParamInst->_isFindReplacing = true; nppParamInst._isFindReplacing = true;
if (isMacroRecording) if (isMacroRecording)
saveInMacro(wParam, FR_OP_FIND); saveInMacro(wParam, FR_OP_FIND);
@ -1064,7 +1064,7 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
// restore search direction which may have been overwritten because shift-key was pressed // restore search direction which may have been overwritten because shift-key was pressed
_options._whichDirection = direction_bak; _options._whichDirection = direction_bak;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
if (findStatus == FSEndReached) if (findStatus == FSEndReached)
{ {
generic_string msg = pNativeSpeaker->getLocalizedStrFromID("find-status-end-reached", TEXT("Find: Found the 1st occurrence from the top. The end of the document has been reached.")); generic_string msg = pNativeSpeaker->getLocalizedStrFromID("find-status-end-reached", TEXT("Find: Found the 1st occurrence from the top. The end of the document has been reached."));
@ -1076,7 +1076,7 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
setStatusbarMessage(msg, FSTopReached); setStatusbarMessage(msg, FSTopReached);
} }
nppParamInst->_isFindReplacing = false; nppParamInst._isFindReplacing = false;
} }
return TRUE; return TRUE;
@ -1096,10 +1096,10 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
_options._str4Replace = getTextFromCombo(hReplaceCombo); _options._str4Replace = getTextFromCombo(hReplaceCombo);
updateCombos(); updateCombos();
nppParamInst->_isFindReplacing = true; nppParamInst._isFindReplacing = true;
if (isMacroRecording) saveInMacro(wParam, FR_OP_REPLACE); if (isMacroRecording) saveInMacro(wParam, FR_OP_REPLACE);
processReplace(_options._str2Search.c_str(), _options._str4Replace.c_str()); processReplace(_options._str2Search.c_str(), _options._str4Replace.c_str());
nppParamInst->_isFindReplacing = false; nppParamInst._isFindReplacing = false;
} }
} }
return TRUE; return TRUE;
@ -1114,10 +1114,10 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
_options._str2Search = getTextFromCombo(hFindCombo); _options._str2Search = getTextFromCombo(hFindCombo);
updateCombo(IDFINDWHAT); updateCombo(IDFINDWHAT);
nppParamInst->_isFindReplacing = true; nppParamInst._isFindReplacing = true;
if (isMacroRecording) saveInMacro(wParam, FR_OP_FIND + FR_OP_GLOBAL); if (isMacroRecording) saveInMacro(wParam, FR_OP_FIND + FR_OP_GLOBAL);
findAllIn(ALL_OPEN_DOCS); findAllIn(ALL_OPEN_DOCS);
nppParamInst->_isFindReplacing = false; nppParamInst._isFindReplacing = false;
} }
} }
return TRUE; return TRUE;
@ -1130,10 +1130,10 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
_options._str2Search = getTextFromCombo(hFindCombo); _options._str2Search = getTextFromCombo(hFindCombo);
updateCombo(IDFINDWHAT); updateCombo(IDFINDWHAT);
nppParamInst->_isFindReplacing = true; nppParamInst._isFindReplacing = true;
if (isMacroRecording) saveInMacro(wParam, FR_OP_FIND + FR_OP_GLOBAL); if (isMacroRecording) saveInMacro(wParam, FR_OP_FIND + FR_OP_GLOBAL);
findAllIn(CURRENT_DOC); findAllIn(CURRENT_DOC);
nppParamInst->_isFindReplacing = false; nppParamInst._isFindReplacing = false;
} }
return TRUE; return TRUE;
@ -1160,10 +1160,10 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
_options._str2Search = getTextFromCombo(hFindCombo); _options._str2Search = getTextFromCombo(hFindCombo);
updateCombo(IDFINDWHAT); updateCombo(IDFINDWHAT);
nppParamInst->_isFindReplacing = true; nppParamInst._isFindReplacing = true;
if (isMacroRecording) saveInMacro(wParam, FR_OP_FIND + FR_OP_FIF); if (isMacroRecording) saveInMacro(wParam, FR_OP_FIND + FR_OP_FIF);
findAllIn(FILES_IN_DIR); findAllIn(FILES_IN_DIR);
nppParamInst->_isFindReplacing = false; nppParamInst._isFindReplacing = false;
} }
return TRUE; return TRUE;
@ -1199,10 +1199,10 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
updateCombo(IDFINDWHAT); updateCombo(IDFINDWHAT);
updateCombo(IDREPLACEWITH); updateCombo(IDREPLACEWITH);
nppParamInst->_isFindReplacing = true; nppParamInst._isFindReplacing = true;
if (isMacroRecording) saveInMacro(wParam, FR_OP_REPLACE + FR_OP_FIF); if (isMacroRecording) saveInMacro(wParam, FR_OP_REPLACE + FR_OP_FIF);
::SendMessage(_hParent, WM_REPLACEINFILES, 0, 0); ::SendMessage(_hParent, WM_REPLACEINFILES, 0, 0);
nppParamInst->_isFindReplacing = false; nppParamInst._isFindReplacing = false;
} }
} }
return TRUE; return TRUE;
@ -1219,10 +1219,10 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
_options._str4Replace = getTextFromCombo(hReplaceCombo); _options._str4Replace = getTextFromCombo(hReplaceCombo);
updateCombos(); updateCombos();
nppParamInst->_isFindReplacing = true; nppParamInst._isFindReplacing = true;
if (isMacroRecording) saveInMacro(wParam, FR_OP_REPLACE + FR_OP_GLOBAL); if (isMacroRecording) saveInMacro(wParam, FR_OP_REPLACE + FR_OP_GLOBAL);
replaceAllInOpenedDocs(); replaceAllInOpenedDocs();
nppParamInst->_isFindReplacing = false; nppParamInst._isFindReplacing = false;
} }
} }
return TRUE; return TRUE;
@ -1235,7 +1235,7 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
setStatusbarMessage(TEXT(""), FSNoMessage); setStatusbarMessage(TEXT(""), FSNoMessage);
if ((*_ppEditView)->getCurrentBuffer()->isReadOnly()) if ((*_ppEditView)->getCurrentBuffer()->isReadOnly())
{ {
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string msg = pNativeSpeaker->getLocalizedStrFromID("find-status-replace-readonly", TEXT("Replace: Cannot replace text. The current document is read only.")); generic_string msg = pNativeSpeaker->getLocalizedStrFromID("find-status-replace-readonly", TEXT("Replace: Cannot replace text. The current document is read only."));
setStatusbarMessage(msg, FSNotFound); setStatusbarMessage(msg, FSNotFound);
return TRUE; return TRUE;
@ -1247,15 +1247,15 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
_options._str4Replace = getTextFromCombo(hReplaceCombo); _options._str4Replace = getTextFromCombo(hReplaceCombo);
updateCombos(); updateCombos();
nppParamInst->_isFindReplacing = true; nppParamInst._isFindReplacing = true;
if (isMacroRecording) saveInMacro(wParam, FR_OP_REPLACE); if (isMacroRecording) saveInMacro(wParam, FR_OP_REPLACE);
(*_ppEditView)->execute(SCI_BEGINUNDOACTION); (*_ppEditView)->execute(SCI_BEGINUNDOACTION);
int nbReplaced = processAll(ProcessReplaceAll, &_options); int nbReplaced = processAll(ProcessReplaceAll, &_options);
(*_ppEditView)->execute(SCI_ENDUNDOACTION); (*_ppEditView)->execute(SCI_ENDUNDOACTION);
nppParamInst->_isFindReplacing = false; nppParamInst._isFindReplacing = false;
generic_string result; generic_string result;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
if (nbReplaced < 0) if (nbReplaced < 0)
{ {
result = pNativeSpeaker->getLocalizedStrFromID("find-status-replaceall-re-malformed", TEXT("Replace All: The regular expression is malformed.")); result = pNativeSpeaker->getLocalizedStrFromID("find-status-replaceall-re-malformed", TEXT("Replace All: The regular expression is malformed."));
@ -1290,7 +1290,7 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
int nbCounted = processAll(ProcessCountAll, &_options); int nbCounted = processAll(ProcessCountAll, &_options);
generic_string result; generic_string result;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
if (nbCounted < 0) if (nbCounted < 0)
{ {
result = pNativeSpeaker->getLocalizedStrFromID("find-status-count-re-malformed", TEXT("Count: The regular expression to search is malformed.")); result = pNativeSpeaker->getLocalizedStrFromID("find-status-count-re-malformed", TEXT("Count: The regular expression to search is malformed."));
@ -1325,12 +1325,12 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
updateCombo(IDFINDWHAT); updateCombo(IDFINDWHAT);
if (isMacroRecording) saveInMacro(wParam, FR_OP_FIND); if (isMacroRecording) saveInMacro(wParam, FR_OP_FIND);
nppParamInst->_isFindReplacing = true; nppParamInst._isFindReplacing = true;
int nbMarked = processAll(ProcessMarkAll, &_options); int nbMarked = processAll(ProcessMarkAll, &_options);
nppParamInst->_isFindReplacing = false; nppParamInst._isFindReplacing = false;
generic_string result; generic_string result;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
if (nbMarked < 0) if (nbMarked < 0)
{ {
result = pNativeSpeaker->getLocalizedStrFromID("find-status-mark-re-malformed", TEXT("Mark: The regular expression to search is malformed.")); result = pNativeSpeaker->getLocalizedStrFromID("find-status-mark-re-malformed", TEXT("Mark: The regular expression to search is malformed."));
@ -1465,7 +1465,7 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
{ {
::SendDlgItemMessage(_hSelf, IDC_TRANSPARENT_LOSSFOCUS_RADIO, BM_SETCHECK, BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDC_TRANSPARENT_LOSSFOCUS_RADIO, BM_SETCHECK, BST_UNCHECKED, 0);
::SendDlgItemMessage(_hSelf, IDC_TRANSPARENT_ALWAYS_RADIO, BM_SETCHECK, BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDC_TRANSPARENT_ALWAYS_RADIO, BM_SETCHECK, BST_UNCHECKED, 0);
(NppParameters::getInstance())->removeTransparent(_hSelf); (NppParameters::getInstance()).removeTransparent(_hSelf);
findHistory._transparencyMode = FindHistory::none; findHistory._transparencyMode = FindHistory::none;
} }
@ -1475,14 +1475,14 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
case IDC_TRANSPARENT_ALWAYS_RADIO : case IDC_TRANSPARENT_ALWAYS_RADIO :
{ {
int percent = static_cast<int32_t>(::SendDlgItemMessage(_hSelf, IDC_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0)); int percent = static_cast<int32_t>(::SendDlgItemMessage(_hSelf, IDC_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0));
(NppParameters::getInstance())->SetTransparent(_hSelf, percent); (NppParameters::getInstance()).SetTransparent(_hSelf, percent);
findHistory._transparencyMode = FindHistory::persistant; findHistory._transparencyMode = FindHistory::persistant;
} }
return TRUE; return TRUE;
case IDC_TRANSPARENT_LOSSFOCUS_RADIO : case IDC_TRANSPARENT_LOSSFOCUS_RADIO :
{ {
(NppParameters::getInstance())->removeTransparent(_hSelf); (NppParameters::getInstance()).removeTransparent(_hSelf);
findHistory._transparencyMode = FindHistory::onLossingFocus; findHistory._transparencyMode = FindHistory::onLossingFocus;
} }
return TRUE; return TRUE;
@ -1513,8 +1513,8 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
if (findHistory._isFolderFollowDoc) if (findHistory._isFolderFollowDoc)
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
const TCHAR * dir = pNppParam->getWorkingDir(); const TCHAR * dir = nppParam.getWorkingDir();
::SetDlgItemText(_hSelf, IDD_FINDINFILES_DIR_COMBO, dir); ::SetDlgItemText(_hSelf, IDD_FINDINFILES_DIR_COMBO, dir);
} }
@ -1666,7 +1666,7 @@ bool FindReplaceDlg::processFindNext(const TCHAR *txt2find, const FindOption *op
if (NotIncremental == pOptions->_incrementalType) //incremental search doesnt trigger messages if (NotIncremental == pOptions->_incrementalType) //incremental search doesnt trigger messages
{ {
generic_string newTxt2find = stringReplace(txt2find, TEXT("&"), TEXT("&&")); generic_string newTxt2find = stringReplace(txt2find, TEXT("&"), TEXT("&&"));
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string msg = pNativeSpeaker->getLocalizedStrFromID("find-status-cannot-find", TEXT("Find: Can't find the text \"$STR_REPLACE$\"")); generic_string msg = pNativeSpeaker->getLocalizedStrFromID("find-status-cannot-find", TEXT("Find: Can't find the text \"$STR_REPLACE$\""));
msg = stringReplace(msg, TEXT("$STR_REPLACE$"), newTxt2find); msg = stringReplace(msg, TEXT("$STR_REPLACE$"), newTxt2find);
setStatusbarMessage(msg, FSNotFound); setStatusbarMessage(msg, FSNotFound);
@ -1687,7 +1687,7 @@ bool FindReplaceDlg::processFindNext(const TCHAR *txt2find, const FindOption *op
} }
else if (posFind == -2) // Invalid Regular expression else if (posFind == -2) // Invalid Regular expression
{ {
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string msg = pNativeSpeaker->getLocalizedStrFromID("find-status-invalid-re", TEXT("Find: Invalid regular expression")); generic_string msg = pNativeSpeaker->getLocalizedStrFromID("find-status-invalid-re", TEXT("Find: Invalid regular expression"));
setStatusbarMessage(msg, FSNotFound); setStatusbarMessage(msg, FSNotFound);
return false; return false;
@ -1728,7 +1728,7 @@ bool FindReplaceDlg::processReplace(const TCHAR *txt2find, const TCHAR *txt2repl
if ((*_ppEditView)->getCurrentBuffer()->isReadOnly()) if ((*_ppEditView)->getCurrentBuffer()->isReadOnly())
{ {
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string msg = pNativeSpeaker->getLocalizedStrFromID("find-status-replace-readonly", TEXT("Replace: Cannot replace text. The current document is read only.")); generic_string msg = pNativeSpeaker->getLocalizedStrFromID("find-status-replace-readonly", TEXT("Replace: Cannot replace text. The current document is read only."));
setStatusbarMessage(msg, FSNotFound); setStatusbarMessage(msg, FSNotFound);
return false; return false;
@ -1775,7 +1775,7 @@ bool FindReplaceDlg::processReplace(const TCHAR *txt2find, const TCHAR *txt2repl
} }
(*_ppEditView)->execute(SCI_SETSEL, start + replacedLen, start + replacedLen); (*_ppEditView)->execute(SCI_SETSEL, start + replacedLen, start + replacedLen);
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
// Do the next find // Do the next find
moreMatches = processFindNext(txt2find, &replaceOptions, &status, FINDNEXTTYPE_REPLACENEXT); moreMatches = processFindNext(txt2find, &replaceOptions, &status, FINDNEXTTYPE_REPLACENEXT);
@ -1803,7 +1803,7 @@ bool FindReplaceDlg::processReplace(const TCHAR *txt2find, const TCHAR *txt2repl
} }
else else
{ {
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string msg = pNativeSpeaker->getLocalizedStrFromID("find-status-replace-not-found", TEXT("Replace: no occurrence was found.")); generic_string msg = pNativeSpeaker->getLocalizedStrFromID("find-status-replace-not-found", TEXT("Replace: no occurrence was found."));
setStatusbarMessage(msg, FSNotFound); setStatusbarMessage(msg, FSNotFound);
} }
@ -1837,7 +1837,7 @@ int FindReplaceDlg::processAll(ProcessOperation op, const FindOption *opt, bool
{ {
if (op == ProcessReplaceAll && (*_ppEditView)->getCurrentBuffer()->isReadOnly()) if (op == ProcessReplaceAll && (*_ppEditView)->getCurrentBuffer()->isReadOnly())
{ {
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string msg = pNativeSpeaker->getLocalizedStrFromID("find-status-replaceall-readonly", TEXT("Replace All: Cannot replace text. The current document is read only.")); generic_string msg = pNativeSpeaker->getLocalizedStrFromID("find-status-replaceall-readonly", TEXT("Replace All: Cannot replace text. The current document is read only."));
setStatusbarMessage(msg, FSNotFound); setStatusbarMessage(msg, FSNotFound);
return 0; return 0;
@ -2640,57 +2640,57 @@ void FindReplaceDlg::execSavedCommand(int cmd, uptr_t intValue, const generic_st
break; break;
case IDC_FRCOMMAND_EXEC: case IDC_FRCOMMAND_EXEC:
{ {
NppParameters *nppParamInst = NppParameters::getInstance(); NppParameters& nppParamInst = NppParameters::getInstance();
switch (intValue) switch (intValue)
{ {
case IDOK: case IDOK:
nppParamInst->_isFindReplacing = true; nppParamInst._isFindReplacing = true;
processFindNext(_env->_str2Search.c_str()); processFindNext(_env->_str2Search.c_str());
nppParamInst->_isFindReplacing = false; nppParamInst._isFindReplacing = false;
break; break;
case IDC_FINDNEXT: case IDC_FINDNEXT:
{ {
nppParamInst->_isFindReplacing = true; nppParamInst._isFindReplacing = true;
_options._whichDirection = DIR_DOWN; _options._whichDirection = DIR_DOWN;
processFindNext(_env->_str2Search.c_str()); processFindNext(_env->_str2Search.c_str());
nppParamInst->_isFindReplacing = false; nppParamInst._isFindReplacing = false;
} }
break; break;
case IDC_FINDPREV: case IDC_FINDPREV:
{ {
nppParamInst->_isFindReplacing = true; nppParamInst._isFindReplacing = true;
_env->_whichDirection = DIR_UP; _env->_whichDirection = DIR_UP;
processFindNext(_env->_str2Search.c_str()); processFindNext(_env->_str2Search.c_str());
nppParamInst->_isFindReplacing = false; nppParamInst._isFindReplacing = false;
} }
break; break;
case IDREPLACE: case IDREPLACE:
nppParamInst->_isFindReplacing = true; nppParamInst._isFindReplacing = true;
processReplace(_env->_str2Search.c_str(), _env->_str4Replace.c_str(), _env); processReplace(_env->_str2Search.c_str(), _env->_str4Replace.c_str(), _env);
nppParamInst->_isFindReplacing = false; nppParamInst._isFindReplacing = false;
break; break;
case IDC_FINDALL_OPENEDFILES: case IDC_FINDALL_OPENEDFILES:
nppParamInst->_isFindReplacing = true; nppParamInst._isFindReplacing = true;
findAllIn(ALL_OPEN_DOCS); findAllIn(ALL_OPEN_DOCS);
nppParamInst->_isFindReplacing = false; nppParamInst._isFindReplacing = false;
break; break;
case IDC_FINDALL_CURRENTFILE: case IDC_FINDALL_CURRENTFILE:
nppParamInst->_isFindReplacing = true; nppParamInst._isFindReplacing = true;
findAllIn(CURRENT_DOC); findAllIn(CURRENT_DOC);
nppParamInst->_isFindReplacing = false; nppParamInst._isFindReplacing = false;
break; break;
case IDC_REPLACE_OPENEDFILES: case IDC_REPLACE_OPENEDFILES:
nppParamInst->_isFindReplacing = true; nppParamInst._isFindReplacing = true;
replaceAllInOpenedDocs(); replaceAllInOpenedDocs();
nppParamInst->_isFindReplacing = false; nppParamInst._isFindReplacing = false;
break; break;
case IDD_FINDINFILES_FIND_BUTTON: case IDD_FINDINFILES_FIND_BUTTON:
nppParamInst->_isFindReplacing = true; nppParamInst._isFindReplacing = true;
findAllIn(FILES_IN_DIR); findAllIn(FILES_IN_DIR);
nppParamInst->_isFindReplacing = false; nppParamInst._isFindReplacing = false;
break; break;
case IDD_FINDINFILES_REPLACEINFILES: case IDD_FINDINFILES_REPLACEINFILES:
@ -2702,22 +2702,22 @@ void FindReplaceDlg::execSavedCommand(int cmd, uptr_t intValue, const generic_st
if (::MessageBox(_hParent, msg.c_str(), TEXT("Are you sure?"), MB_OKCANCEL | MB_DEFBUTTON2) == IDOK) if (::MessageBox(_hParent, msg.c_str(), TEXT("Are you sure?"), MB_OKCANCEL | MB_DEFBUTTON2) == IDOK)
{ {
nppParamInst->_isFindReplacing = true; nppParamInst._isFindReplacing = true;
::SendMessage(_hParent, WM_REPLACEINFILES, 0, 0); ::SendMessage(_hParent, WM_REPLACEINFILES, 0, 0);
nppParamInst->_isFindReplacing = false; nppParamInst._isFindReplacing = false;
} }
break; break;
} }
case IDREPLACEALL: case IDREPLACEALL:
{ {
nppParamInst->_isFindReplacing = true; nppParamInst._isFindReplacing = true;
(*_ppEditView)->execute(SCI_BEGINUNDOACTION); (*_ppEditView)->execute(SCI_BEGINUNDOACTION);
int nbReplaced = processAll(ProcessReplaceAll, _env); int nbReplaced = processAll(ProcessReplaceAll, _env);
(*_ppEditView)->execute(SCI_ENDUNDOACTION); (*_ppEditView)->execute(SCI_ENDUNDOACTION);
nppParamInst->_isFindReplacing = false; nppParamInst._isFindReplacing = false;
generic_string result; generic_string result;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
if (nbReplaced < 0) if (nbReplaced < 0)
{ {
result = pNativeSpeaker->getLocalizedStrFromID("find-status-replaceall-re-malformed", TEXT("Replace All: The regular expression is malformed.")); result = pNativeSpeaker->getLocalizedStrFromID("find-status-replaceall-re-malformed", TEXT("Replace All: The regular expression is malformed."));
@ -2743,7 +2743,7 @@ void FindReplaceDlg::execSavedCommand(int cmd, uptr_t intValue, const generic_st
{ {
int nbCounted = processAll(ProcessCountAll, _env); int nbCounted = processAll(ProcessCountAll, _env);
generic_string result; generic_string result;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
if (nbCounted < 0) if (nbCounted < 0)
{ {
result = pNativeSpeaker->getLocalizedStrFromID("find-status-count-re-malformed", TEXT("Count: The regular expression to search is malformed.")); result = pNativeSpeaker->getLocalizedStrFromID("find-status-count-re-malformed", TEXT("Count: The regular expression to search is malformed."));
@ -2766,12 +2766,12 @@ void FindReplaceDlg::execSavedCommand(int cmd, uptr_t intValue, const generic_st
case IDCMARKALL: case IDCMARKALL:
{ {
nppParamInst->_isFindReplacing = true; nppParamInst._isFindReplacing = true;
int nbMarked = processAll(ProcessMarkAll, _env); int nbMarked = processAll(ProcessMarkAll, _env);
nppParamInst->_isFindReplacing = false; nppParamInst._isFindReplacing = false;
generic_string result; generic_string result;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
if (nbMarked < 0) if (nbMarked < 0)
{ {
result = pNativeSpeaker->getLocalizedStrFromID("find-status-mark-re-malformed", TEXT("Mark: The regular expression to search is malformed.")); result = pNativeSpeaker->getLocalizedStrFromID("find-status-mark-re-malformed", TEXT("Mark: The regular expression to search is malformed."));
@ -3249,7 +3249,7 @@ void Finder::setFinderStyle()
// Set current line background color for the finder // Set current line background color for the finder
const TCHAR * lexerName = ScintillaEditView::langNames[L_SEARCHRESULT].lexerName; const TCHAR * lexerName = ScintillaEditView::langNames[L_SEARCHRESULT].lexerName;
LexerStyler *pStyler = (_scintView._pParameter->getLStylerArray()).getLexerStylerByName(lexerName); LexerStyler *pStyler = (NppParameters::getInstance().getLStylerArray()).getLexerStylerByName(lexerName);
if (pStyler) if (pStyler)
{ {
int i = pStyler->getStylerIndexByID(SCE_SEARCHRESULT_CURRENT_LINE); int i = pStyler->getStylerIndexByID(SCE_SEARCHRESULT_CURRENT_LINE);
@ -3262,14 +3262,14 @@ void Finder::setFinderStyle()
_scintView.setSearchResultLexer(); _scintView.setSearchResultLexer();
// Override foreground & background colour by default foreground & background coulour // Override foreground & background colour by default foreground & background coulour
StyleArray & stylers = _scintView._pParameter->getMiscStylerArray(); StyleArray & stylers = NppParameters::getInstance().getMiscStylerArray();
int iStyleDefault = stylers.getStylerIndexByID(STYLE_DEFAULT); int iStyleDefault = stylers.getStylerIndexByID(STYLE_DEFAULT);
if (iStyleDefault != -1) if (iStyleDefault != -1)
{ {
Style & styleDefault = stylers.getStyler(iStyleDefault); Style & styleDefault = stylers.getStyler(iStyleDefault);
_scintView.setStyle(styleDefault); _scintView.setStyle(styleDefault);
GlobalOverride & go = _scintView._pParameter->getGlobalOverrideStyle(); GlobalOverride & go = NppParameters::getInstance().getGlobalOverrideStyle();
if (go.isEnable()) if (go.isEnable())
{ {
int iGlobalOverride = stylers.getStylerIndexByName(TEXT("Global override")); int iGlobalOverride = stylers.getStylerIndexByName(TEXT("Global override"));
@ -3370,7 +3370,7 @@ INT_PTR CALLBACK Finder::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
ContextMenu scintillaContextmenu; ContextMenu scintillaContextmenu;
vector<MenuItemUnit> tmp; vector<MenuItemUnit> tmp;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string findInFinder = pNativeSpeaker->getLocalizedStrFromID("finder-find-in-finder", TEXT("Find in these found results...")); generic_string findInFinder = pNativeSpeaker->getLocalizedStrFromID("finder-find-in-finder", TEXT("Find in these found results..."));
generic_string closeThis = pNativeSpeaker->getLocalizedStrFromID("finder-close-this", TEXT("Close this finder")); generic_string closeThis = pNativeSpeaker->getLocalizedStrFromID("finder-close-this", TEXT("Close this finder"));

View File

@ -230,7 +230,7 @@ public :
FindReplaceDlg() : StaticDialog(), _pFinder(NULL), _isRTL(false),\ FindReplaceDlg() : StaticDialog(), _pFinder(NULL), _isRTL(false),\
_fileNameLenMax(1024) { _fileNameLenMax(1024) {
_uniFileName = new char[(_fileNameLenMax + 3) * 2]; _uniFileName = new char[(_fileNameLenMax + 3) * 2];
_winVer = (NppParameters::getInstance())->getWinVersion(); _winVer = (NppParameters::getInstance()).getWinVersion();
_env = &_options; _env = &_options;
}; };
~FindReplaceDlg(); ~FindReplaceDlg();

View File

@ -83,7 +83,7 @@ size_t Printer::doPrint(bool justDoIt)
return 0; return 0;
*/ */
const NppGUI & nppGUI = (NppParameters::getInstance())->getNppGUI(); const NppGUI & nppGUI = (NppParameters::getInstance()).getNppGUI();
POINT ptPage; POINT ptPage;
POINT ptDpi; POINT ptDpi;

View File

@ -271,7 +271,7 @@ void ScintillaEditView::init(HINSTANCE hInst, HWND hPere)
execute(SCI_MARKERDEFINE, MARK_HIDELINESUNDERLINE, SC_MARK_UNDERLINE); execute(SCI_MARKERDEFINE, MARK_HIDELINESUNDERLINE, SC_MARK_UNDERLINE);
execute(SCI_MARKERSETBACK, MARK_HIDELINESUNDERLINE, 0x77CC77); execute(SCI_MARKERSETBACK, MARK_HIDELINESUNDERLINE, 0x77CC77);
if (NppParameters::getInstance()->_dpiManager.scaleX(100) >= 150) if (NppParameters::getInstance()._dpiManager.scaleX(100) >= 150)
{ {
execute(SCI_RGBAIMAGESETWIDTH, 18); execute(SCI_RGBAIMAGESETWIDTH, 18);
execute(SCI_RGBAIMAGESETHEIGHT, 18); execute(SCI_RGBAIMAGESETHEIGHT, 18);
@ -328,7 +328,6 @@ void ScintillaEditView::init(HINSTANCE hInst, HWND hPere)
execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_FOUND_STYLE_EXT3, true); execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_FOUND_STYLE_EXT3, true);
execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_FOUND_STYLE_EXT4, true); execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_FOUND_STYLE_EXT4, true);
execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_FOUND_STYLE_EXT5, true); execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_FOUND_STYLE_EXT5, true);
_pParameter = NppParameters::getInstance();
_codepage = ::GetACP(); _codepage = ::GetACP();
@ -364,7 +363,7 @@ LRESULT CALLBACK ScintillaEditView::scintillaStatic_Proc(HWND hwnd, UINT Message
char synapticsHack[26]; char synapticsHack[26];
GetClassNameA(hwndOnMouse, (LPSTR)&synapticsHack, 26); GetClassNameA(hwndOnMouse, (LPSTR)&synapticsHack, 26);
bool isSynpnatic = std::string(synapticsHack) == "SynTrackCursorWindowClass"; bool isSynpnatic = std::string(synapticsHack) == "SynTrackCursorWindowClass";
bool makeTouchPadCompetible = ((NppParameters::getInstance())->getSVP())._disableAdvancedScrolling; bool makeTouchPadCompetible = ((NppParameters::getInstance()).getSVP())._disableAdvancedScrolling;
if (pScint && (isSynpnatic || makeTouchPadCompetible)) if (pScint && (isSynpnatic || makeTouchPadCompetible))
return (pScint->scintillaNew_Proc(hwnd, Message, wParam, lParam)); return (pScint->scintillaNew_Proc(hwnd, Message, wParam, lParam));
@ -527,7 +526,7 @@ void ScintillaEditView::setSpecialStyle(const Style & styleToSet)
{ {
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
if (not _pParameter->isInFontList(styleToSet._fontName)) if (!NppParameters::getInstance().isInFontList(styleToSet._fontName))
{ {
execute(SCI_STYLESETFONT, styleID, reinterpret_cast<LPARAM>(DEFAULT_FONT_NAME)); execute(SCI_STYLESETFONT, styleID, reinterpret_cast<LPARAM>(DEFAULT_FONT_NAME));
} }
@ -564,11 +563,11 @@ void ScintillaEditView::setHotspotStyle(Style& styleToSet)
void ScintillaEditView::setStyle(Style styleToSet) void ScintillaEditView::setStyle(Style styleToSet)
{ {
GlobalOverride & go = _pParameter->getGlobalOverrideStyle(); GlobalOverride & go = NppParameters::getInstance().getGlobalOverrideStyle();
if (go.isEnable()) if (go.isEnable())
{ {
StyleArray & stylers = _pParameter->getMiscStylerArray(); StyleArray & stylers = NppParameters::getInstance().getMiscStylerArray();
int i = stylers.getStylerIndexByName(TEXT("Global override")); int i = stylers.getStylerIndexByName(TEXT("Global override"));
if (i != -1) if (i != -1)
{ {
@ -655,7 +654,7 @@ void ScintillaEditView::setXmlLexer(LangType type)
else if ((type == L_HTML) || (type == L_PHP) || (type == L_ASP) || (type == L_JSP)) else if ((type == L_HTML) || (type == L_PHP) || (type == L_ASP) || (type == L_JSP))
{ {
execute(SCI_SETLEXER, SCLEX_HTML); execute(SCI_SETLEXER, SCLEX_HTML);
const TCHAR *htmlKeyWords_generic =_pParameter->getWordList(L_HTML, LANG_INDEX_INSTR); const TCHAR *htmlKeyWords_generic = NppParameters::getInstance().getWordList(L_HTML, LANG_INDEX_INSTR);
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
const char *htmlKeyWords = wmc.wchar2char(htmlKeyWords_generic, CP_ACP); const char *htmlKeyWords = wmc.wchar2char(htmlKeyWords_generic, CP_ACP);
@ -757,7 +756,7 @@ void ScintillaEditView::setUserLexer(const TCHAR *userLangName)
int setKeywordsCounter = 0; int setKeywordsCounter = 0;
execute(SCI_SETLEXER, SCLEX_USER); execute(SCI_SETLEXER, SCLEX_USER);
UserLangContainer * userLangContainer = userLangName?_pParameter->getULCFromName(userLangName):_userDefineDlg._pCurrentUserLang; UserLangContainer * userLangContainer = userLangName? NppParameters::getInstance().getULCFromName(userLangName):_userDefineDlg._pCurrentUserLang;
if (!userLangContainer) if (!userLangContainer)
return; return;
@ -885,14 +884,14 @@ void ScintillaEditView::setUserLexer(const TCHAR *userLangName)
void ScintillaEditView::setExternalLexer(LangType typeDoc) void ScintillaEditView::setExternalLexer(LangType typeDoc)
{ {
int id = typeDoc - L_EXTERNAL; int id = typeDoc - L_EXTERNAL;
TCHAR * name = _pParameter->getELCFromIndex(id)._name; TCHAR * name = NppParameters::getInstance().getELCFromIndex(id)._name;
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
const char *pName = wmc.wchar2char(name, CP_ACP); const char *pName = wmc.wchar2char(name, CP_ACP);
execute(SCI_SETLEXERLANGUAGE, 0, reinterpret_cast<LPARAM>(pName)); execute(SCI_SETLEXERLANGUAGE, 0, reinterpret_cast<LPARAM>(pName));
LexerStyler *pStyler = (_pParameter->getLStylerArray()).getLexerStylerByName(name); LexerStyler *pStyler = (NppParameters::getInstance().getLStylerArray()).getLexerStylerByName(name);
if (pStyler) if (pStyler)
{ {
for (int i = 0 ; i < pStyler->getNbStyler() ; ++i) for (int i = 0 ; i < pStyler->getNbStyler() ; ++i)
@ -918,7 +917,7 @@ void ScintillaEditView::setCppLexer(LangType langType)
{ {
const char *cppInstrs; const char *cppInstrs;
const char *cppTypes; const char *cppTypes;
const TCHAR *doxygenKeyWords = _pParameter->getWordList(L_CPP, LANG_INDEX_TYPE2); const TCHAR *doxygenKeyWords = NppParameters::getInstance().getWordList(L_CPP, LANG_INDEX_TYPE2);
execute(SCI_SETLEXER, SCLEX_CPP); execute(SCI_SETLEXER, SCLEX_CPP);
@ -967,7 +966,7 @@ void ScintillaEditView::setCppLexer(LangType langType)
void ScintillaEditView::setJsLexer() void ScintillaEditView::setJsLexer()
{ {
const TCHAR *doxygenKeyWords = _pParameter->getWordList(L_CPP, LANG_INDEX_TYPE2); const TCHAR *doxygenKeyWords = NppParameters::getInstance().getWordList(L_CPP, LANG_INDEX_TYPE2);
execute(SCI_SETLEXER, SCLEX_CPP); execute(SCI_SETLEXER, SCLEX_CPP);
const TCHAR *pKwArray[10] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; const TCHAR *pKwArray[10] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
@ -981,7 +980,7 @@ void ScintillaEditView::setJsLexer()
} }
const TCHAR *newLexerName = ScintillaEditView::langNames[L_JAVASCRIPT].lexerName; const TCHAR *newLexerName = ScintillaEditView::langNames[L_JAVASCRIPT].lexerName;
LexerStyler *pNewStyler = (_pParameter->getLStylerArray()).getLexerStylerByName(newLexerName); LexerStyler *pNewStyler = (NppParameters::getInstance().getLStylerArray()).getLexerStylerByName(newLexerName);
if (pNewStyler) // New js styler is available, so we can use it do more modern styling if (pNewStyler) // New js styler is available, so we can use it do more modern styling
{ {
for (int i = 0, nb = pNewStyler->getNbStyler(); i < nb; ++i) for (int i = 0, nb = pNewStyler->getNbStyler(); i < nb; ++i)
@ -1022,7 +1021,7 @@ void ScintillaEditView::setJsLexer()
else // New js styler is not available, we use the old styling for the sake of retro-compatibility else // New js styler is not available, we use the old styling for the sake of retro-compatibility
{ {
const TCHAR *lexerName = ScintillaEditView::langNames[L_JS].lexerName; const TCHAR *lexerName = ScintillaEditView::langNames[L_JS].lexerName;
LexerStyler *pOldStyler = (_pParameter->getLStylerArray()).getLexerStylerByName(lexerName); LexerStyler *pOldStyler = (NppParameters::getInstance().getLStylerArray()).getLexerStylerByName(lexerName);
if (pOldStyler) if (pOldStyler)
{ {
@ -1149,7 +1148,7 @@ void ScintillaEditView::setObjCLexer(LangType langType)
basic_string<char> doxygenKeyWordsString(""); basic_string<char> doxygenKeyWordsString("");
const TCHAR *doxygenKeyWordsW = _pParameter->getWordList(L_CPP, LANG_INDEX_TYPE2); const TCHAR *doxygenKeyWordsW = NppParameters::getInstance().getWordList(L_CPP, LANG_INDEX_TYPE2);
if (doxygenKeyWordsW) if (doxygenKeyWordsW)
{ {
doxygenKeyWordsString = wstring2string(doxygenKeyWordsW, CP_ACP); doxygenKeyWordsString = wstring2string(doxygenKeyWordsW, CP_ACP);
@ -1231,7 +1230,7 @@ void ScintillaEditView::setLexer(int lexerID, LangType langType, int whichList)
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold.compact"), reinterpret_cast<LPARAM>("0")); execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold.compact"), reinterpret_cast<LPARAM>("0"));
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold.comment"), reinterpret_cast<LPARAM>("1")); execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold.comment"), reinterpret_cast<LPARAM>("1"));
ScintillaViewParams & svp = (ScintillaViewParams &)_pParameter->getSVP(); ScintillaViewParams & svp = (ScintillaViewParams &)NppParameters::getInstance().getSVP();
if (svp._indentGuideLineShow) if (svp._indentGuideLineShow)
{ {
@ -1248,7 +1247,7 @@ void ScintillaEditView::setLexer(int lexerID, LangType langType, int whichList)
void ScintillaEditView::makeStyle(LangType language, const TCHAR **keywordArray) void ScintillaEditView::makeStyle(LangType language, const TCHAR **keywordArray)
{ {
const TCHAR * lexerName = ScintillaEditView::langNames[language].lexerName; const TCHAR * lexerName = ScintillaEditView::langNames[language].lexerName;
LexerStyler *pStyler = (_pParameter->getLStylerArray()).getLexerStylerByName(lexerName); LexerStyler *pStyler = (NppParameters::getInstance().getLStylerArray()).getLexerStylerByName(lexerName);
if (pStyler) if (pStyler)
{ {
for (int i = 0, nb = pStyler->getNbStyler(); i < nb ; ++i) for (int i = 0, nb = pStyler->getNbStyler(); i < nb ; ++i)
@ -1271,8 +1270,8 @@ void ScintillaEditView::restoreDefaultWordChars()
void ScintillaEditView::addCustomWordChars() void ScintillaEditView::addCustomWordChars()
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
const NppGUI & nppGUI = pNppParam->getNppGUI(); const NppGUI & nppGUI = nppParam.getNppGUI();
if (nppGUI._customWordChars.empty()) if (nppGUI._customWordChars.empty())
return; return;
@ -1307,8 +1306,8 @@ void ScintillaEditView::addCustomWordChars()
void ScintillaEditView::setWordChars() void ScintillaEditView::setWordChars()
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
const NppGUI & nppGUI = pNppParam->getNppGUI(); const NppGUI & nppGUI = nppParam.getNppGUI();
if (nppGUI._isWordCharDefault) if (nppGUI._isWordCharDefault)
restoreDefaultWordChars(); restoreDefaultWordChars();
else else
@ -1317,7 +1316,7 @@ void ScintillaEditView::setWordChars()
void ScintillaEditView::defineDocType(LangType typeDoc) void ScintillaEditView::defineDocType(LangType typeDoc)
{ {
StyleArray & stylers = _pParameter->getMiscStylerArray(); StyleArray & stylers = NppParameters::getInstance().getMiscStylerArray();
int iStyleDefault = stylers.getStylerIndexByID(STYLE_DEFAULT); int iStyleDefault = stylers.getStylerIndexByID(STYLE_DEFAULT);
if (iStyleDefault != -1) if (iStyleDefault != -1)
{ {
@ -1445,7 +1444,7 @@ void ScintillaEditView::defineDocType(LangType typeDoc)
} }
} }
ScintillaViewParams & svp = (ScintillaViewParams &)_pParameter->getSVP(); ScintillaViewParams & svp = (ScintillaViewParams &)NppParameters::getInstance().getSVP();
if (svp._folderStyle != FOLDER_STYLE_NONE) if (svp._folderStyle != FOLDER_STYLE_NONE)
showMargin(_SC_MARGE_FOLDER, isNeededFolderMarge(typeDoc)); showMargin(_SC_MARGE_FOLDER, isNeededFolderMarge(typeDoc));
@ -1503,7 +1502,7 @@ void ScintillaEditView::defineDocType(LangType typeDoc)
case L_ASCII : case L_ASCII :
{ {
LexerStyler *pStyler = (_pParameter->getLStylerArray()).getLexerStylerByName(TEXT("nfo")); LexerStyler *pStyler = (NppParameters::getInstance().getLStylerArray()).getLexerStylerByName(TEXT("nfo"));
Style nfoStyle; Style nfoStyle;
nfoStyle._styleID = STYLE_DEFAULT; nfoStyle._styleID = STYLE_DEFAULT;
@ -1716,7 +1715,7 @@ void ScintillaEditView::defineDocType(LangType typeDoc)
case L_TEXT : case L_TEXT :
default : default :
if (typeDoc >= L_EXTERNAL && typeDoc < _pParameter->L_END) if (typeDoc >= L_EXTERNAL && typeDoc < NppParameters::getInstance().L_END)
setExternalLexer(typeDoc); setExternalLexer(typeDoc);
else else
execute(SCI_SETLEXER, (_codepage == CP_CHINESE_TRADITIONAL)?SCLEX_MAKEFILE:SCLEX_NULL); execute(SCI_SETLEXER, (_codepage == CP_CHINESE_TRADITIONAL)?SCLEX_MAKEFILE:SCLEX_NULL);
@ -1749,7 +1748,7 @@ void ScintillaEditView::defineDocType(LangType typeDoc)
Style & styleLN = stylers.getStyler(indexLineNumber); Style & styleLN = stylers.getStyler(indexLineNumber);
setSpecialStyle(styleLN); setSpecialStyle(styleLN);
} }
setTabSettings(_pParameter->getLangFromID(typeDoc)); setTabSettings(NppParameters::getInstance().getLangFromID(typeDoc));
/* /*
execute(SCI_SETSTYLEBITS, 8); // Always use 8 bit mask in Document class (Document::stylingBitsMask), execute(SCI_SETSTYLEBITS, 8); // Always use 8 bit mask in Document class (Document::stylingBitsMask),
// in that way Editor::PositionIsHotspot will return correct hotspot styleID. // in that way Editor::PositionIsHotspot will return correct hotspot styleID.
@ -2478,7 +2477,7 @@ void ScintillaEditView::expand(size_t& line, bool doExpand, bool force, int visL
void ScintillaEditView::performGlobalStyles() void ScintillaEditView::performGlobalStyles()
{ {
StyleArray & stylers = _pParameter->getMiscStylerArray(); StyleArray & stylers = NppParameters::getInstance().getMiscStylerArray();
int i = stylers.getStylerIndexByName(TEXT("Current line background colour")); int i = stylers.getStylerIndexByName(TEXT("Current line background colour"));
if (i != -1) if (i != -1)
@ -2530,7 +2529,7 @@ void ScintillaEditView::performGlobalStyles()
COLORREF foldfgColor = white, foldbgColor = grey, activeFoldFgColor = red; COLORREF foldfgColor = white, foldbgColor = grey, activeFoldFgColor = red;
getFoldColor(foldfgColor, foldbgColor, activeFoldFgColor); getFoldColor(foldfgColor, foldbgColor, activeFoldFgColor);
ScintillaViewParams & svp = (ScintillaViewParams &)_pParameter->getSVP(); ScintillaViewParams & svp = (ScintillaViewParams &)NppParameters::getInstance().getSVP();
for (int j = 0 ; j < NB_FOLDER_STATE ; ++j) for (int j = 0 ; j < NB_FOLDER_STATE ; ++j)
defineMarker(_markersArray[FOLDER_TYPE][j], _markersArray[svp._folderStyle][j], foldfgColor, foldbgColor, activeFoldFgColor); defineMarker(_markersArray[FOLDER_TYPE][j], _markersArray[svp._folderStyle][j], foldfgColor, foldbgColor, activeFoldFgColor);
@ -2624,7 +2623,7 @@ void ScintillaEditView::updateLineNumberWidth()
const char * ScintillaEditView::getCompleteKeywordList(std::basic_string<char> & kwl, LangType langType, int keywordIndex) const char * ScintillaEditView::getCompleteKeywordList(std::basic_string<char> & kwl, LangType langType, int keywordIndex)
{ {
kwl += " "; kwl += " ";
const TCHAR *defKwl_generic = _pParameter->getWordList(langType, keywordIndex); const TCHAR *defKwl_generic = NppParameters::getInstance().getWordList(langType, keywordIndex);
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
const char * defKwl = wmc.wchar2char(defKwl_generic, CP_ACP); const char * defKwl = wmc.wchar2char(defKwl_generic, CP_ACP);
@ -3412,7 +3411,7 @@ void ScintillaEditView::setTabSettings(Lang *lang)
{ {
if (lang->_langID == L_JAVASCRIPT) if (lang->_langID == L_JAVASCRIPT)
{ {
Lang *ljs = _pParameter->getLangFromID(L_JS); Lang *ljs = NppParameters::getInstance().getLangFromID(L_JS);
execute(SCI_SETTABWIDTH, ljs->_tabSize > 0 ? ljs->_tabSize : lang->_tabSize); execute(SCI_SETTABWIDTH, ljs->_tabSize > 0 ? ljs->_tabSize : lang->_tabSize);
execute(SCI_SETUSETABS, !ljs->_isTabReplacedBySpace); execute(SCI_SETUSETABS, !ljs->_isTabReplacedBySpace);
return; return;
@ -3422,7 +3421,7 @@ void ScintillaEditView::setTabSettings(Lang *lang)
} }
else else
{ {
const NppGUI & nppgui = _pParameter->getNppGUI(); const NppGUI & nppgui = NppParameters::getInstance().getNppGUI();
execute(SCI_SETTABWIDTH, nppgui._tabSize > 0 ? nppgui._tabSize : lang->_tabSize); execute(SCI_SETTABWIDTH, nppgui._tabSize > 0 ? nppgui._tabSize : lang->_tabSize);
execute(SCI_SETUSETABS, !nppgui._tabReplacedBySpace); execute(SCI_SETUSETABS, !nppgui._tabReplacedBySpace);
} }
@ -3546,7 +3545,7 @@ void ScintillaEditView::setBorderEdge(bool doWithBorderEdge)
void ScintillaEditView::getFoldColor(COLORREF& fgColor, COLORREF& bgColor, COLORREF& activeFgColor) void ScintillaEditView::getFoldColor(COLORREF& fgColor, COLORREF& bgColor, COLORREF& activeFgColor)
{ {
StyleArray & stylers = _pParameter->getMiscStylerArray(); StyleArray & stylers = NppParameters::getInstance().getMiscStylerArray();
int i = stylers.getStylerIndexByName(TEXT("Fold")); int i = stylers.getStylerIndexByName(TEXT("Fold"));
if (i != -1) if (i != -1)

View File

@ -326,9 +326,9 @@ public:
{ {
int width = 3; int width = 3;
if (whichMarge == _SC_MARGE_SYBOLE) if (whichMarge == _SC_MARGE_SYBOLE)
width = NppParameters::getInstance()->_dpiManager.scaleX(100) >= 150 ? 20 : 16; width = NppParameters::getInstance()._dpiManager.scaleX(100) >= 150 ? 20 : 16;
else if (whichMarge == _SC_MARGE_FOLDER) else if (whichMarge == _SC_MARGE_FOLDER)
width = NppParameters::getInstance()->_dpiManager.scaleX(100) >= 150 ? 18 : 14; width = NppParameters::getInstance()._dpiManager.scaleX(100) >= 150 ? 18 : 14;
execute(SCI_SETMARGINWIDTHN, whichMarge, willBeShowed ? width : 0); execute(SCI_SETMARGINWIDTHN, whichMarge, willBeShowed ? width : 0);
} }
}; };
@ -538,7 +538,7 @@ public:
void convertSelectedTextToLowerCase() { void convertSelectedTextToLowerCase() {
// if system is w2k or xp // if system is w2k or xp
if ((NppParameters::getInstance())->isTransparentAvailable()) if ((NppParameters::getInstance()).isTransparentAvailable())
convertSelectedTextTo(LOWERCASE); convertSelectedTextTo(LOWERCASE);
else else
execute(SCI_LOWERCASE); execute(SCI_LOWERCASE);
@ -546,7 +546,7 @@ public:
void convertSelectedTextToUpperCase() { void convertSelectedTextToUpperCase() {
// if system is w2k or xp // if system is w2k or xp
if ((NppParameters::getInstance())->isTransparentAvailable()) if ((NppParameters::getInstance()).isTransparentAvailable())
convertSelectedTextTo(UPPERCASE); convertSelectedTextTo(UPPERCASE);
else else
execute(SCI_UPPERCASE); execute(SCI_UPPERCASE);
@ -554,7 +554,7 @@ public:
void convertSelectedTextToNewerCase(const TextCase & caseToConvert) { void convertSelectedTextToNewerCase(const TextCase & caseToConvert) {
// if system is w2k or xp // if system is w2k or xp
if ((NppParameters::getInstance())->isTransparentAvailable()) if ((NppParameters::getInstance()).isTransparentAvailable())
convertSelectedTextTo(caseToConvert); convertSelectedTextTo(caseToConvert);
else else
::MessageBox(_hSelf, TEXT("This function needs a newer OS version."), TEXT("Change Case Error"), MB_OK | MB_ICONHAND); ::MessageBox(_hSelf, TEXT("This function needs a newer OS version."), TEXT("Change Case Error"), MB_OK | MB_ICONHAND);
@ -571,10 +571,6 @@ public:
void foldCurrentPos(bool mode); void foldCurrentPos(bool mode);
int getCodepage() const {return _codepage;}; int getCodepage() const {return _codepage;};
NppParameters * getParameter() {
return _pParameter;
};
ColumnModeInfos getColumnModeSelectInfo(); ColumnModeInfos getColumnModeSelectInfo();
void columnReplace(ColumnModeInfos & cmi, const TCHAR *str); void columnReplace(ColumnModeInfos & cmi, const TCHAR *str);
@ -669,7 +665,6 @@ protected:
BufferID _currentBufferID = nullptr; BufferID _currentBufferID = nullptr;
Buffer * _currentBuffer = nullptr; Buffer * _currentBuffer = nullptr;
NppParameters *_pParameter = nullptr;
int _codepage = CP_ACP; int _codepage = CP_ACP;
bool _lineNumbersShown = false; bool _lineNumbersShown = false;
bool _wrapRestoreNeeded = false; bool _wrapRestoreNeeded = false;
@ -730,7 +725,7 @@ protected:
void setSqlLexer() { void setSqlLexer() {
const bool kbBackSlash = NppParameters::getInstance()->getNppGUI()._backSlashIsEscapeCharacterForSql; const bool kbBackSlash = NppParameters::getInstance().getNppGUI()._backSlashIsEscapeCharacterForSql;
setLexer(SCLEX_SQL, L_SQL, LIST_0); setLexer(SCLEX_SQL, L_SQL, LIST_0);
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("sql.backslash.escapes"), reinterpret_cast<LPARAM>(kbBackSlash ? "1" : "0")); execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("sql.backslash.escapes"), reinterpret_cast<LPARAM>(kbBackSlash ? "1" : "0"));
}; };

View File

@ -57,13 +57,13 @@ void SmartHighlighter::highlightViewWithWord(ScintillaEditView * pHighlightView,
bool isWordOnly = true; bool isWordOnly = true;
bool isCaseSensentive = true; bool isCaseSensentive = true;
const NppGUI & nppGUI = NppParameters::getInstance()->getNppGUI(); const NppGUI & nppGUI = NppParameters::getInstance().getNppGUI();
if (nppGUI._smartHiliteUseFindSettings) if (nppGUI._smartHiliteUseFindSettings)
{ {
// fetch find dialog's setting // fetch find dialog's setting
NppParameters *nppParams = NppParameters::getInstance(); NppParameters& nppParams = NppParameters::getInstance();
FindHistory &findHistory = nppParams->getFindHistory(); FindHistory &findHistory = nppParams.getFindHistory();
isWordOnly = findHistory._isMatchWord; isWordOnly = findHistory._isMatchWord;
isCaseSensentive = findHistory._isMatchCase; isCaseSensentive = findHistory._isMatchCase;
} }
@ -112,7 +112,7 @@ void SmartHighlighter::highlightView(ScintillaEditView * pHighlightView, Scintil
// Clear marks // Clear marks
pHighlightView->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE_SMART); pHighlightView->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE_SMART);
const NppGUI & nppGUI = NppParameters::getInstance()->getNppGUI(); const NppGUI & nppGUI = NppParameters::getInstance().getNppGUI();
// If nothing selected or smart highlighting disabled, don't mark anything // If nothing selected or smart highlighting disabled, don't mark anything
if ((!nppGUI._enableSmartHilite) || (pHighlightView->execute(SCI_GETSELECTIONEMPTY) == 1)) if ((!nppGUI._enableSmartHilite) || (pHighlightView->execute(SCI_GETSELECTIONEMPTY) == 1))
@ -135,8 +135,8 @@ void SmartHighlighter::highlightView(ScintillaEditView * pHighlightView, Scintil
if (nppGUI._smartHiliteUseFindSettings) if (nppGUI._smartHiliteUseFindSettings)
{ {
// fetch find dialog's setting // fetch find dialog's setting
NppParameters *nppParams = NppParameters::getInstance(); NppParameters& nppParams = NppParameters::getInstance();
FindHistory &findHistory = nppParams->getFindHistory(); FindHistory &findHistory = nppParams.getFindHistory();
isWordOnly = findHistory._isMatchWord; isWordOnly = findHistory._isMatchWord;
} }
else else

View File

@ -881,12 +881,12 @@ UserDefineDialog::~UserDefineDialog()
void UserDefineDialog::reloadLangCombo() void UserDefineDialog::reloadLangCombo()
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_RESETCONTENT, 0, 0); ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_RESETCONTENT, 0, 0);
::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(TEXT("User Defined Language"))); ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(TEXT("User Defined Language")));
for (int i = 0, nb = pNppParam->getNbUserLang(); i < nb ; ++i) for (int i = 0, nb = nppParam.getNbUserLang(); i < nb ; ++i)
{ {
UserLangContainer & userLangContainer = pNppParam->getULCFromIndex(i); UserLangContainer & userLangContainer = nppParam.getULCFromIndex(i);
::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(userLangContainer.getName())); ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(userLangContainer.getName()));
} }
} }
@ -918,7 +918,7 @@ void UserDefineDialog::changeStyle()
void UserDefineDialog::enableLangAndControlsBy(size_t index) void UserDefineDialog::enableLangAndControlsBy(size_t index)
{ {
_pUserLang = (index == 0)?_pCurrentUserLang:&((NppParameters::getInstance())->getULCFromIndex(index - 1)); _pUserLang = (index == 0)?_pCurrentUserLang:&((NppParameters::getInstance()).getULCFromIndex(index - 1));
if (index != 0) if (index != 0)
::SetWindowText(::GetDlgItem(_hSelf, IDC_EXT_EDIT), _pUserLang->_ext.c_str()); ::SetWindowText(::GetDlgItem(_hSelf, IDC_EXT_EDIT), _pUserLang->_ext.c_str());
@ -933,8 +933,8 @@ void UserDefineDialog::updateDlg()
int i = static_cast<int32_t>(::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETCURSEL, 0, 0)); int i = static_cast<int32_t>(::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETCURSEL, 0, 0));
if (i > 0) // the first menu item is generic UDL if (i > 0) // the first menu item is generic UDL
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
pNppParam->setUdlXmlDirtyFromIndex(i - 1); nppParam.setUdlXmlDirtyFromIndex(i - 1);
} }
::SendDlgItemMessage(_hSelf, IDC_LANGNAME_IGNORECASE_CHECK, BM_SETCHECK, _pUserLang->_isCaseIgnored, 0); ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_IGNORECASE_CHECK, BM_SETCHECK, _pUserLang->_isCaseIgnored, 0);
@ -947,8 +947,8 @@ void UserDefineDialog::updateDlg()
INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
NativeLangSpeaker * pNativeSpeaker = pNppParam->getNativeLangSpeaker(); NativeLangSpeaker * pNativeSpeaker = nppParam.getNativeLangSpeaker();
switch (message) switch (message)
{ {
@ -957,7 +957,7 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR
_pUserLang = _pCurrentUserLang; _pUserLang = _pCurrentUserLang;
_ctrlTab.init(_hInst, _hSelf, false); _ctrlTab.init(_hInst, _hSelf, false);
int tabDpiDynamicalHeight = pNppParam->_dpiManager.scaleY(13); int tabDpiDynamicalHeight = nppParam._dpiManager.scaleY(13);
_ctrlTab.setFont(TEXT("Tahoma"), tabDpiDynamicalHeight); _ctrlTab.setFont(TEXT("Tahoma"), tabDpiDynamicalHeight);
_folderStyleDlg.init(_hInst, _hSelf); _folderStyleDlg.init(_hInst, _hSelf);
@ -1008,7 +1008,7 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR
enableLangAndControlsBy(0); enableLangAndControlsBy(0);
if (pNppParam->isTransparentAvailable()) if (nppParam.isTransparentAvailable())
{ {
::ShowWindow(::GetDlgItem(_hSelf, IDC_UD_TRANSPARENT_CHECK), SW_SHOW); ::ShowWindow(::GetDlgItem(_hSelf, IDC_UD_TRANSPARENT_CHECK), SW_SHOW);
::ShowWindow(::GetDlgItem(_hSelf, IDC_UD_PERCENTAGE_SLIDER), SW_SHOW); ::ShowWindow(::GetDlgItem(_hSelf, IDC_UD_PERCENTAGE_SLIDER), SW_SHOW);
@ -1059,7 +1059,7 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR
if (reinterpret_cast<HWND>(lParam) == ::GetDlgItem(_hSelf, IDC_UD_PERCENTAGE_SLIDER)) if (reinterpret_cast<HWND>(lParam) == ::GetDlgItem(_hSelf, IDC_UD_PERCENTAGE_SLIDER))
{ {
int percent = static_cast<int32_t>(::SendDlgItemMessage(_hSelf, IDC_UD_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0)); int percent = static_cast<int32_t>(::SendDlgItemMessage(_hSelf, IDC_UD_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0));
pNppParam->SetTransparent(_hSelf, percent); nppParam.SetTransparent(_hSelf, percent);
} }
return TRUE; return TRUE;
} }
@ -1093,9 +1093,9 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR
if (_status == UNDOCK) if (_status == UNDOCK)
{ {
if (pNppParam->isTransparentAvailable()) if (nppParam.isTransparentAvailable())
{ {
pNppParam->removeTransparent(_hSelf); nppParam.removeTransparent(_hSelf);
::ShowWindow(::GetDlgItem(_hSelf, IDC_UD_TRANSPARENT_CHECK), SW_HIDE); ::ShowWindow(::GetDlgItem(_hSelf, IDC_UD_TRANSPARENT_CHECK), SW_HIDE);
::ShowWindow(::GetDlgItem(_hSelf, IDC_UD_PERCENTAGE_SLIDER), SW_HIDE); ::ShowWindow(::GetDlgItem(_hSelf, IDC_UD_PERCENTAGE_SLIDER), SW_HIDE);
} }
@ -1106,13 +1106,13 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR
if (_status == UNDOCK) if (_status == UNDOCK)
{ {
if (pNppParam->isTransparentAvailable()) if (nppParam.isTransparentAvailable())
{ {
bool isChecked = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_UD_TRANSPARENT_CHECK, BM_GETCHECK, 0, 0)); bool isChecked = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_UD_TRANSPARENT_CHECK, BM_GETCHECK, 0, 0));
if (isChecked) if (isChecked)
{ {
int percent = static_cast<int32_t>(::SendDlgItemMessage(_hSelf, IDC_UD_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0)); int percent = static_cast<int32_t>(::SendDlgItemMessage(_hSelf, IDC_UD_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0));
pNppParam->SetTransparent(_hSelf, percent); nppParam.SetTransparent(_hSelf, percent);
} }
::ShowWindow(::GetDlgItem(_hSelf, IDC_UD_TRANSPARENT_CHECK), SW_SHOW); ::ShowWindow(::GetDlgItem(_hSelf, IDC_UD_TRANSPARENT_CHECK), SW_SHOW);
::ShowWindow(::GetDlgItem(_hSelf, IDC_UD_PERCENTAGE_SLIDER), SW_SHOW); ::ShowWindow(::GetDlgItem(_hSelf, IDC_UD_PERCENTAGE_SLIDER), SW_SHOW);
@ -1131,7 +1131,7 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR
case IDC_REMOVELANG_BUTTON : case IDC_REMOVELANG_BUTTON :
{ {
int result = pNppParam->getNativeLangSpeaker()->messageBox("UDLRemoveCurrentLang", int result = nppParam.getNativeLangSpeaker()->messageBox("UDLRemoveCurrentLang",
_hSelf, _hSelf,
TEXT("Are you sure?"), TEXT("Are you sure?"),
TEXT("Remove the current language"), TEXT("Remove the current language"),
@ -1154,7 +1154,7 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR
::SendMessage(_hSelf, WM_COMMAND, MAKELONG(IDC_LANGNAME_COMBO, CBN_SELCHANGE), reinterpret_cast<LPARAM>(::GetDlgItem(_hSelf, IDC_LANGNAME_COMBO))); ::SendMessage(_hSelf, WM_COMMAND, MAKELONG(IDC_LANGNAME_COMBO, CBN_SELCHANGE), reinterpret_cast<LPARAM>(::GetDlgItem(_hSelf, IDC_LANGNAME_COMBO)));
//remove current language from userLangArray //remove current language from userLangArray
pNppParam->removeUserLang(i-1); nppParam.removeUserLang(i-1);
//remove current language from langMenu //remove current language from langMenu
HWND hNpp = ::GetParent(_hSelf); HWND hNpp = ::GetParent(_hSelf);
@ -1187,9 +1187,9 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR
if (newName) if (newName)
{ {
if (pNppParam->isExistingUserLangName(newName)) if (nppParam.isExistingUserLangName(newName))
{ {
pNppParam->getNativeLangSpeaker()->messageBox("UDLNewNameError", nppParam.getNativeLangSpeaker()->messageBox("UDLNewNameError",
_hSelf, _hSelf,
TEXT("This name is used by another language,\rplease give another one."), TEXT("This name is used by another language,\rplease give another one."),
TEXT("UDL Error"), TEXT("UDL Error"),
@ -1203,7 +1203,7 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR
::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_SETCURSEL, i, 0); ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_SETCURSEL, i, 0);
//rename current language name in userLangArray //rename current language name in userLangArray
UserLangContainer & userLangContainer = pNppParam->getULCFromIndex(i-1); UserLangContainer & userLangContainer = nppParam.getULCFromIndex(i-1);
userLangContainer._name = newName; userLangContainer._name = newName;
//rename current language name in langMenu //rename current language name in langMenu
@ -1241,7 +1241,7 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR
generic_string newNameString(tmpName); generic_string newNameString(tmpName);
const TCHAR *newName = newNameString.c_str(); const TCHAR *newName = newNameString.c_str();
if (pNppParam->isExistingUserLangName(newName)) if (nppParam.isExistingUserLangName(newName))
{ {
pNativeSpeaker->messageBox("UDLNewNameError", pNativeSpeaker->messageBox("UDLNewNameError",
_hSelf, _hSelf,
@ -1252,8 +1252,8 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR
return TRUE; return TRUE;
} }
//add current language in userLangArray at the end as a new lang //add current language in userLangArray at the end as a new lang
UserLangContainer & userLang = (wParam == IDC_SAVEAS_BUTTON)?pNppParam->getULCFromIndex(i-1):*_pCurrentUserLang; UserLangContainer & userLang = (wParam == IDC_SAVEAS_BUTTON)?nppParam.getULCFromIndex(i-1):*_pCurrentUserLang;
int newIndex = pNppParam->addUserLangToEnd(userLang, newName); int newIndex = nppParam.addUserLangToEnd(userLang, newName);
//add new language name in combobox //add new language name in combobox
::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_ADDSTRING, 0, LPARAM(newName)); ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_ADDSTRING, 0, LPARAM(newName));
@ -1277,7 +1277,7 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR
if (!fn) break; if (!fn) break;
generic_string sourceFile = fn; generic_string sourceFile = fn;
bool isSuccessful = pNppParam->importUDLFromFile(sourceFile); bool isSuccessful = nppParam.importUDLFromFile(sourceFile);
if (isSuccessful) if (isSuccessful)
{ {
auto i = ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETCURSEL, 0, 0); auto i = ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETCURSEL, 0, 0);
@ -1311,7 +1311,7 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR
if (i2Export > 0) if (i2Export > 0)
{ {
bool isSuccessful = pNppParam->exportUDLToFile(i2Export - 1, fileName2save); bool isSuccessful = nppParam.exportUDLToFile(i2Export - 1, fileName2save);
if (isSuccessful) if (isSuccessful)
{ {
printStr(TEXT("Export successful")); printStr(TEXT("Export successful"));
@ -1330,10 +1330,10 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR
if (isChecked) if (isChecked)
{ {
int percent = static_cast<int32_t>(::SendDlgItemMessage(_hSelf, IDC_UD_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0)); int percent = static_cast<int32_t>(::SendDlgItemMessage(_hSelf, IDC_UD_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0));
pNppParam->SetTransparent(_hSelf, percent); nppParam.SetTransparent(_hSelf, percent);
} }
else else
pNppParam->removeTransparent(_hSelf); nppParam.removeTransparent(_hSelf);
::EnableWindow(::GetDlgItem(_hSelf, IDC_UD_PERCENTAGE_SLIDER), isChecked); ::EnableWindow(::GetDlgItem(_hSelf, IDC_UD_PERCENTAGE_SLIDER), isChecked);
return TRUE; return TRUE;
@ -1464,7 +1464,7 @@ INT_PTR CALLBACK StringDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
::SendDlgItemMessage(_hSelf, IDC_STRING_EDIT, EM_SETLIMITTEXT, _txtLen, 0); ::SendDlgItemMessage(_hSelf, IDC_STRING_EDIT, EM_SETLIMITTEXT, _txtLen, 0);
// localization for OK and Cancel // localization for OK and Cancel
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
if (pNativeSpeaker) if (pNativeSpeaker)
{ {
generic_string ok = pNativeSpeaker->getLocalizedStrFromID("common-ok", TEXT("OK")); generic_string ok = pNativeSpeaker->getLocalizedStrFromID("common-ok", TEXT("OK"));
@ -1584,13 +1584,13 @@ void StringDlg::HandlePaste(HWND hEdit)
INT_PTR CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) INT_PTR CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
StylerDlg * dlg = (StylerDlg *)::GetProp(hwnd, TEXT("Styler dialog prop")); StylerDlg * dlg = (StylerDlg *)::GetProp(hwnd, TEXT("Styler dialog prop"));
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
switch (message) switch (message)
{ {
case WM_INITDIALOG : case WM_INITDIALOG :
{ {
NativeLangSpeaker *pNativeLangSpeaker = pNppParam->getNativeLangSpeaker(); NativeLangSpeaker *pNativeLangSpeaker = nppParam.getNativeLangSpeaker();
pNativeLangSpeaker->changeUserDefineLangPopupDlg(hwnd); pNativeLangSpeaker->changeUserDefineLangPopupDlg(hwnd);
::SetProp(hwnd, TEXT("Styler dialog prop"), (HANDLE)lParam); ::SetProp(hwnd, TEXT("Styler dialog prop"), (HANDLE)lParam);
@ -1625,7 +1625,7 @@ INT_PTR CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPAR
// for the font name combo // for the font name combo
HWND hFontNameCombo = ::GetDlgItem(hwnd, IDC_STYLER_COMBO_FONT_NAME); HWND hFontNameCombo = ::GetDlgItem(hwnd, IDC_STYLER_COMBO_FONT_NAME);
const std::vector<generic_string> & fontlist = pNppParam->getFontList(); const std::vector<generic_string> & fontlist = nppParam.getFontList();
for (size_t j = 0, len = fontlist.size() ; j < len ; ++j) for (size_t j = 0, len = fontlist.size() ; j < len ; ++j)
{ {
auto k = ::SendMessage(hFontNameCombo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(fontlist[j].c_str())); auto k = ::SendMessage(hFontNameCombo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(fontlist[j].c_str()));

View File

@ -59,8 +59,8 @@ INT_PTR CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
::SendDlgItemMessage(_hSelf, IDC_COL_DEC_RADIO, BM_SETCHECK, TRUE, 0); ::SendDlgItemMessage(_hSelf, IDC_COL_DEC_RADIO, BM_SETCHECK, TRUE, 0);
goToCenter(); goToCenter();
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
ETDTProc enableDlgTheme = (ETDTProc)pNppParam->getEnableThemeDlgTexture(); ETDTProc enableDlgTheme = (ETDTProc)nppParam.getEnableThemeDlgTexture();
if (enableDlgTheme) if (enableDlgTheme)
{ {
enableDlgTheme(_hSelf, ETDT_ENABLETAB); enableDlgTheme(_hSelf, ETDT_ENABLETAB);
@ -334,3 +334,4 @@ UCHAR ColumnEditorDlg::getFormat()
f = 3; f = 3;
return (f | (isLeadingZeros?MASK_ZERO_LEADING:0)); return (f | (isLeadingZeros?MASK_ZERO_LEADING:0));
} }

View File

@ -48,8 +48,8 @@ INT_PTR CALLBACK AboutDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPara
buildTime += TEXT(" - "); buildTime += TEXT(" - ");
buildTime += wmc.char2wchar(__TIME__, CP_ACP); buildTime += wmc.char2wchar(__TIME__, CP_ACP);
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
LPCTSTR bitness = pNppParam ->isx64() ? TEXT("(64-bit)") : TEXT("(32-bit)"); LPCTSTR bitness = nppParam.isx64() ? TEXT("(64-bit)") : TEXT("(32-bit)");
::SetDlgItemText(_hSelf, IDC_VERSION_BIT, bitness); ::SetDlgItemText(_hSelf, IDC_VERSION_BIT, bitness);
::SendMessage(compileDateHandle, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(buildTime.c_str())); ::SendMessage(compileDateHandle, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(buildTime.c_str()));
@ -67,7 +67,7 @@ INT_PTR CALLBACK AboutDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPara
getClientRect(_rc); getClientRect(_rc);
ETDTProc enableDlgTheme = (ETDTProc)pNppParam->getEnableThemeDlgTexture(); ETDTProc enableDlgTheme = (ETDTProc)nppParam.getEnableThemeDlgTexture();
if (enableDlgTheme) if (enableDlgTheme)
{ {
enableDlgTheme(_hSelf, ETDT_ENABLETAB); enableDlgTheme(_hSelf, ETDT_ENABLETAB);
@ -126,11 +126,11 @@ INT_PTR CALLBACK DebugInfoDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM /
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
// Notepad++ version // Notepad++ version
_debugInfoStr = NOTEPAD_PLUS_VERSION; _debugInfoStr = NOTEPAD_PLUS_VERSION;
_debugInfoStr += pNppParam->isx64() ? TEXT(" (64-bit)") : TEXT(" (32-bit)"); _debugInfoStr += nppParam.isx64() ? TEXT(" (64-bit)") : TEXT(" (32-bit)");
_debugInfoStr += TEXT("\r\n"); _debugInfoStr += TEXT("\r\n");
// Build time // Build time
@ -157,7 +157,7 @@ INT_PTR CALLBACK DebugInfoDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM /
// local conf // local conf
_debugInfoStr += TEXT("Local Conf mode : "); _debugInfoStr += TEXT("Local Conf mode : ");
bool doLocalConf = (NppParameters::getInstance())->isLocal(); bool doLocalConf = (NppParameters::getInstance()).isLocal();
_debugInfoStr += (doLocalConf ? TEXT("ON") : TEXT("OFF")); _debugInfoStr += (doLocalConf ? TEXT("ON") : TEXT("OFF"));
_debugInfoStr += TEXT("\r\n"); _debugInfoStr += TEXT("\r\n");
@ -198,7 +198,7 @@ INT_PTR CALLBACK DebugInfoDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM /
// Get alternative OS information // Get alternative OS information
if (szProductName[0] == '\0') if (szProductName[0] == '\0')
{ {
generic_sprintf(szProductName, TEXT("%s"), (NppParameters::getInstance())->getWinVersionStr().c_str()); generic_sprintf(szProductName, TEXT("%s"), (NppParameters::getInstance()).getWinVersionStr().c_str());
} }
if (szCurrentBuildNumber[0] == '\0') if (szCurrentBuildNumber[0] == '\0')
{ {
@ -212,7 +212,7 @@ INT_PTR CALLBACK DebugInfoDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM /
_debugInfoStr += TEXT("OS Name : "); _debugInfoStr += TEXT("OS Name : ");
_debugInfoStr += szProductName; _debugInfoStr += szProductName;
_debugInfoStr += TEXT(" ("); _debugInfoStr += TEXT(" (");
_debugInfoStr += (NppParameters::getInstance())->getWinVerBitStr(); _debugInfoStr += (NppParameters::getInstance()).getWinVerBitStr();
_debugInfoStr += TEXT(") "); _debugInfoStr += TEXT(") ");
_debugInfoStr += TEXT("\r\n"); _debugInfoStr += TEXT("\r\n");
@ -319,7 +319,7 @@ void DoSaveOrNotBox::changeLang()
{ {
generic_string msg; generic_string msg;
generic_string defaultMessage = TEXT("Save file \"$STR_REPLACE$\" ?"); generic_string defaultMessage = TEXT("Save file \"$STR_REPLACE$\" ?");
NativeLangSpeaker* nativeLangSpeaker = NppParameters::getInstance()->getNativeLangSpeaker(); NativeLangSpeaker* nativeLangSpeaker = NppParameters::getInstance().getNativeLangSpeaker();
if (nativeLangSpeaker->changeDlgLang(_hSelf, "DoSaveOrNot")) if (nativeLangSpeaker->changeDlgLang(_hSelf, "DoSaveOrNot"))
{ {

View File

@ -42,19 +42,19 @@ INT_PTR CALLBACK AnsiCharPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM
{ {
case WM_INITDIALOG : case WM_INITDIALOG :
{ {
NppParameters *nppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
NativeLangSpeaker *pNativeSpeaker = nppParam->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = nppParam.getNativeLangSpeaker();
generic_string valStr = pNativeSpeaker->getAttrNameStr(TEXT("Value"), "AsciiInsertion", "ColumnVal"); generic_string valStr = pNativeSpeaker->getAttrNameStr(TEXT("Value"), "AsciiInsertion", "ColumnVal");
generic_string hexStr = pNativeSpeaker->getAttrNameStr(TEXT("Hex"), "AsciiInsertion", "ColumnHex"); generic_string hexStr = pNativeSpeaker->getAttrNameStr(TEXT("Hex"), "AsciiInsertion", "ColumnHex");
generic_string charStr = pNativeSpeaker->getAttrNameStr(TEXT("Character"), "AsciiInsertion", "ColumnChar"); generic_string charStr = pNativeSpeaker->getAttrNameStr(TEXT("Character"), "AsciiInsertion", "ColumnChar");
generic_string htmlNumberStr = pNativeSpeaker->getAttrNameStr(TEXT("HTML Number"), "AsciiInsertion", "ColumnHtmlNumber"); generic_string htmlNumberStr = pNativeSpeaker->getAttrNameStr(TEXT("HTML Number"), "AsciiInsertion", "ColumnHtmlNumber");
generic_string htmlNameStr = pNativeSpeaker->getAttrNameStr(TEXT("HTML Name"), "AsciiInsertion", "ColumnHtmlName"); generic_string htmlNameStr = pNativeSpeaker->getAttrNameStr(TEXT("HTML Name"), "AsciiInsertion", "ColumnHtmlName");
_listView.addColumn(columnInfo(valStr, nppParam->_dpiManager.scaleX(45))); _listView.addColumn(columnInfo(valStr, nppParam._dpiManager.scaleX(45)));
_listView.addColumn(columnInfo(hexStr, nppParam->_dpiManager.scaleX(45))); _listView.addColumn(columnInfo(hexStr, nppParam._dpiManager.scaleX(45)));
_listView.addColumn(columnInfo(charStr, nppParam->_dpiManager.scaleX(70))); _listView.addColumn(columnInfo(charStr, nppParam._dpiManager.scaleX(70)));
_listView.addColumn(columnInfo(htmlNumberStr, nppParam->_dpiManager.scaleX(100))); _listView.addColumn(columnInfo(htmlNumberStr, nppParam._dpiManager.scaleX(100)));
_listView.addColumn(columnInfo(htmlNameStr, nppParam->_dpiManager.scaleX(90))); _listView.addColumn(columnInfo(htmlNameStr, nppParam._dpiManager.scaleX(90)));
_listView.init(_hInst, _hSelf); _listView.init(_hInst, _hSelf);
int codepage = (*_ppEditView)->getCurrentBuffer()->getEncoding(); int codepage = (*_ppEditView)->getCurrentBuffer()->getEncoding();

View File

@ -69,7 +69,7 @@ LRESULT CALLBACK ColourStaticTextHooker::colourStaticProc(HWND hwnd, UINT Messag
} }
void WordStyleDlg::updateGlobalOverrideCtrls() void WordStyleDlg::updateGlobalOverrideCtrls()
{ {
const NppGUI & nppGUI = (NppParameters::getInstance())->getNppGUI(); const NppGUI & nppGUI = (NppParameters::getInstance()).getNppGUI();
::SendDlgItemMessage(_hSelf, IDC_GLOBAL_FG_CHECK, BM_SETCHECK, nppGUI._globalOverride.enableFg, 0); ::SendDlgItemMessage(_hSelf, IDC_GLOBAL_FG_CHECK, BM_SETCHECK, nppGUI._globalOverride.enableFg, 0);
::SendDlgItemMessage(_hSelf, IDC_GLOBAL_BG_CHECK, BM_SETCHECK, nppGUI._globalOverride.enableBg, 0); ::SendDlgItemMessage(_hSelf, IDC_GLOBAL_BG_CHECK, BM_SETCHECK, nppGUI._globalOverride.enableBg, 0);
::SendDlgItemMessage(_hSelf, IDC_GLOBAL_FONT_CHECK, BM_SETCHECK, nppGUI._globalOverride.enableFont, 0); ::SendDlgItemMessage(_hSelf, IDC_GLOBAL_FONT_CHECK, BM_SETCHECK, nppGUI._globalOverride.enableFont, 0);
@ -85,7 +85,7 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
{ {
case WM_INITDIALOG : case WM_INITDIALOG :
{ {
NppParameters *nppParamInst = NppParameters::getInstance(); NppParameters& nppParamInst = NppParameters::getInstance();
_hCheckBold = ::GetDlgItem(_hSelf, IDC_BOLD_CHECK); _hCheckBold = ::GetDlgItem(_hSelf, IDC_BOLD_CHECK);
_hCheckItalic = ::GetDlgItem(_hSelf, IDC_ITALIC_CHECK); _hCheckItalic = ::GetDlgItem(_hSelf, IDC_ITALIC_CHECK);
@ -105,12 +105,12 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
_currentThemeIndex = -1; _currentThemeIndex = -1;
int defaultThemeIndex = 0; int defaultThemeIndex = 0;
ThemeSwitcher & themeSwitcher = nppParamInst->getThemeSwitcher(); ThemeSwitcher & themeSwitcher = nppParamInst.getThemeSwitcher();
for (size_t i = 0 ; i < themeSwitcher.size() ; ++i) for (size_t i = 0 ; i < themeSwitcher.size() ; ++i)
{ {
pair<generic_string, generic_string> & themeInfo = themeSwitcher.getElementFromIndex(i); pair<generic_string, generic_string> & themeInfo = themeSwitcher.getElementFromIndex(i);
int j = static_cast<int32_t>(::SendMessage(_hSwitch2ThemeCombo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(themeInfo.first.c_str()))); int j = static_cast<int32_t>(::SendMessage(_hSwitch2ThemeCombo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(themeInfo.first.c_str())));
if (! themeInfo.second.compare( nppParamInst->getNppGUI()._themeName ) ) if (! themeInfo.second.compare( nppParamInst.getNppGUI()._themeName ) )
{ {
_currentThemeIndex = j; _currentThemeIndex = j;
_themeName.assign(themeInfo.second); _themeName.assign(themeInfo.second);
@ -129,7 +129,7 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
for (int i = 0 ; i < sizeof(fontSizeStrs)/(3*sizeof(TCHAR)) ; ++i) for (int i = 0 ; i < sizeof(fontSizeStrs)/(3*sizeof(TCHAR)) ; ++i)
::SendMessage(_hFontSizeCombo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(fontSizeStrs[i])); ::SendMessage(_hFontSizeCombo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(fontSizeStrs[i]));
const std::vector<generic_string> & fontlist = (NppParameters::getInstance())->getFontList(); const std::vector<generic_string> & fontlist = (NppParameters::getInstance()).getFontList();
for (size_t i = 0, len = fontlist.size() ; i < len ; ++i) for (size_t i = 0, len = fontlist.size() ; i < len ; ++i)
{ {
auto j = ::SendMessage(_hFontNameCombo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(fontlist[i].c_str())); auto j = ::SendMessage(_hFontNameCombo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(fontlist[i].c_str()));
@ -157,7 +157,7 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
::EnableWindow(::GetDlgItem(_hSelf, IDOK), _isDirty); ::EnableWindow(::GetDlgItem(_hSelf, IDOK), _isDirty);
::EnableWindow(::GetDlgItem(_hSelf, IDC_SAVECLOSE_BUTTON), FALSE/*!_isSync*/); ::EnableWindow(::GetDlgItem(_hSelf, IDC_SAVECLOSE_BUTTON), FALSE/*!_isSync*/);
ETDTProc enableDlgTheme = (ETDTProc)nppParamInst->getEnableThemeDlgTexture(); ETDTProc enableDlgTheme = (ETDTProc)nppParamInst.getEnableThemeDlgTexture();
if (enableDlgTheme) if (enableDlgTheme)
{ {
enableDlgTheme(_hSelf, ETDT_ENABLETAB); enableDlgTheme(_hSelf, ETDT_ENABLETAB);
@ -186,7 +186,7 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
if (reinterpret_cast<HWND>(lParam) == ::GetDlgItem(_hSelf, IDC_SC_PERCENTAGE_SLIDER)) if (reinterpret_cast<HWND>(lParam) == ::GetDlgItem(_hSelf, IDC_SC_PERCENTAGE_SLIDER))
{ {
int percent = static_cast<int32_t>(::SendDlgItemMessage(_hSelf, IDC_SC_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0)); int percent = static_cast<int32_t>(::SendDlgItemMessage(_hSelf, IDC_SC_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0));
(NppParameters::getInstance())->SetTransparent(_hSelf, percent); (NppParameters::getInstance()).SetTransparent(_hSelf, percent);
} }
return TRUE; return TRUE;
} }
@ -234,15 +234,15 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
case IDCANCEL : case IDCANCEL :
if (_isDirty) if (_isDirty)
{ {
NppParameters *nppParamInst = NppParameters::getInstance(); NppParameters& nppParamInst = NppParameters::getInstance();
if (_restoreInvalid) if (_restoreInvalid)
{ {
generic_string str( nppParamInst->getNppGUI()._themeName ); generic_string str( nppParamInst.getNppGUI()._themeName );
nppParamInst->reloadStylers( &str[0] ); nppParamInst.reloadStylers( &str[0] );
} }
LexerStylerArray & lsArray = nppParamInst->getLStylerArray(); LexerStylerArray & lsArray = nppParamInst.getLStylerArray();
StyleArray & globalStyles = nppParamInst->getGlobalStylers(); StyleArray & globalStyles = nppParamInst.getGlobalStylers();
if (_restoreInvalid) if (_restoreInvalid)
{ {
@ -263,7 +263,7 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
setVisualFromStyleList(); setVisualFromStyleList();
//(nppParamInst->getNppGUI())._themeName //(nppParamInst.getNppGUI())._themeName
::SendMessage(_hSwitch2ThemeCombo, CB_SETCURSEL, _currentThemeIndex, 0); ::SendMessage(_hSwitch2ThemeCombo, CB_SETCURSEL, _currentThemeIndex, 0);
::SendMessage(_hParent, WM_UPDATESCINTILLAS, 0, 0); ::SendMessage(_hParent, WM_UPDATESCINTILLAS, 0, 0);
} }
@ -275,8 +275,8 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
{ {
if (_isDirty) if (_isDirty)
{ {
LexerStylerArray & lsa = (NppParameters::getInstance())->getLStylerArray(); LexerStylerArray & lsa = (NppParameters::getInstance()).getLStylerArray();
StyleArray & globalStyles = (NppParameters::getInstance())->getGlobalStylers(); StyleArray & globalStyles = (NppParameters::getInstance()).getGlobalStylers();
_lsArray = lsa; _lsArray = lsa;
_globalStyles = globalStyles; _globalStyles = globalStyles;
@ -288,7 +288,7 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
_isDirty = false; _isDirty = false;
} }
_isThemeDirty = false; _isThemeDirty = false;
(NppParameters::getInstance())->writeStyles(_lsArray, _globalStyles); (NppParameters::getInstance()).writeStyles(_lsArray, _globalStyles);
::EnableWindow(::GetDlgItem(_hSelf, IDC_SAVECLOSE_BUTTON), FALSE); ::EnableWindow(::GetDlgItem(_hSelf, IDC_SAVECLOSE_BUTTON), FALSE);
//_isSync = true; //_isSync = true;
display(false); display(false);
@ -302,10 +302,10 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
if (isChecked) if (isChecked)
{ {
int percent = static_cast<int32_t>(::SendDlgItemMessage(_hSelf, IDC_SC_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0)); int percent = static_cast<int32_t>(::SendDlgItemMessage(_hSelf, IDC_SC_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0));
(NppParameters::getInstance())->SetTransparent(_hSelf, percent); (NppParameters::getInstance()).SetTransparent(_hSelf, percent);
} }
else else
(NppParameters::getInstance())->removeTransparent(_hSelf); (NppParameters::getInstance()).removeTransparent(_hSelf);
::EnableWindow(::GetDlgItem(_hSelf, IDC_SC_PERCENTAGE_SLIDER), isChecked); ::EnableWindow(::GetDlgItem(_hSelf, IDC_SC_PERCENTAGE_SLIDER), isChecked);
return TRUE; return TRUE;
@ -313,7 +313,7 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
case IDC_GLOBAL_FG_CHECK : case IDC_GLOBAL_FG_CHECK :
{ {
GlobalOverride & glo = (NppParameters::getInstance())->getGlobalOverrideStyle(); GlobalOverride & glo = (NppParameters::getInstance()).getGlobalOverrideStyle();
glo.enableFg = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), BM_GETCHECK, 0, 0)); glo.enableFg = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), BM_GETCHECK, 0, 0));
notifyDataModified(); notifyDataModified();
apply(); apply();
@ -322,7 +322,7 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
case IDC_GLOBAL_BG_CHECK: case IDC_GLOBAL_BG_CHECK:
{ {
GlobalOverride & glo = (NppParameters::getInstance())->getGlobalOverrideStyle(); GlobalOverride & glo = (NppParameters::getInstance()).getGlobalOverrideStyle();
glo.enableBg = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), BM_GETCHECK, 0, 0)); glo.enableBg = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), BM_GETCHECK, 0, 0));
notifyDataModified(); notifyDataModified();
apply(); apply();
@ -331,7 +331,7 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
case IDC_GLOBAL_FONT_CHECK : case IDC_GLOBAL_FONT_CHECK :
{ {
GlobalOverride & glo = (NppParameters::getInstance())->getGlobalOverrideStyle(); GlobalOverride & glo = (NppParameters::getInstance()).getGlobalOverrideStyle();
glo.enableFont = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), BM_GETCHECK, 0, 0)); glo.enableFont = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), BM_GETCHECK, 0, 0));
notifyDataModified(); notifyDataModified();
apply(); apply();
@ -339,7 +339,7 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
} }
case IDC_GLOBAL_FONTSIZE_CHECK : case IDC_GLOBAL_FONTSIZE_CHECK :
{ {
GlobalOverride & glo = (NppParameters::getInstance())->getGlobalOverrideStyle(); GlobalOverride & glo = (NppParameters::getInstance()).getGlobalOverrideStyle();
glo.enableFontSize = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), BM_GETCHECK, 0, 0)); glo.enableFontSize = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), BM_GETCHECK, 0, 0));
notifyDataModified(); notifyDataModified();
apply(); apply();
@ -347,7 +347,7 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
} }
case IDC_GLOBAL_BOLD_CHECK : case IDC_GLOBAL_BOLD_CHECK :
{ {
GlobalOverride & glo = (NppParameters::getInstance())->getGlobalOverrideStyle(); GlobalOverride & glo = (NppParameters::getInstance()).getGlobalOverrideStyle();
glo.enableBold = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), BM_GETCHECK, 0, 0)); glo.enableBold = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), BM_GETCHECK, 0, 0));
notifyDataModified(); notifyDataModified();
apply(); apply();
@ -356,7 +356,7 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
case IDC_GLOBAL_ITALIC_CHECK : case IDC_GLOBAL_ITALIC_CHECK :
{ {
GlobalOverride & glo = (NppParameters::getInstance())->getGlobalOverrideStyle(); GlobalOverride & glo = (NppParameters::getInstance()).getGlobalOverrideStyle();
glo.enableItalic = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), BM_GETCHECK, 0, 0)); glo.enableItalic = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), BM_GETCHECK, 0, 0));
notifyDataModified(); notifyDataModified();
apply(); apply();
@ -364,7 +364,7 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
} }
case IDC_GLOBAL_UNDERLINE_CHECK : case IDC_GLOBAL_UNDERLINE_CHECK :
{ {
GlobalOverride & glo = (NppParameters::getInstance())->getGlobalOverrideStyle(); GlobalOverride & glo = (NppParameters::getInstance()).getGlobalOverrideStyle();
glo.enableUnderLine = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), BM_GETCHECK, 0, 0)); glo.enableUnderLine = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), BM_GETCHECK, 0, 0));
notifyDataModified(); notifyDataModified();
apply(); apply();
@ -463,9 +463,9 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
void WordStyleDlg::loadLangListFromNppParam() void WordStyleDlg::loadLangListFromNppParam()
{ {
NppParameters *nppParamInst = NppParameters::getInstance(); NppParameters& nppParamInst = NppParameters::getInstance();
_lsArray = nppParamInst->getLStylerArray(); _lsArray = nppParamInst.getLStylerArray();
_globalStyles = nppParamInst->getGlobalStylers(); _globalStyles = nppParamInst.getGlobalStylers();
// Clean up Language List // Clean up Language List
::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_RESETCONTENT, 0, 0); ::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_RESETCONTENT, 0, 0);
@ -484,8 +484,8 @@ void WordStyleDlg::loadLangListFromNppParam()
void WordStyleDlg::updateThemeName(const generic_string& themeName) void WordStyleDlg::updateThemeName(const generic_string& themeName)
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
NppGUI & nppGUI = (NppGUI & )pNppParam->getNppGUI(); NppGUI & nppGUI = (NppGUI & )nppParam.getNppGUI();
nppGUI._themeName.assign( themeName ); nppGUI._themeName.assign( themeName );
} }
@ -635,8 +635,8 @@ void WordStyleDlg::switchToTheme()
generic_string prevThemeName(_themeName); generic_string prevThemeName(_themeName);
_themeName.clear(); _themeName.clear();
NppParameters *nppParamInst = NppParameters::getInstance(); NppParameters& nppParamInst = NppParameters::getInstance();
ThemeSwitcher & themeSwitcher = nppParamInst->getThemeSwitcher(); ThemeSwitcher & themeSwitcher = nppParamInst.getThemeSwitcher();
pair<generic_string, generic_string> & themeInfo = themeSwitcher.getElementFromIndex(iSel); pair<generic_string, generic_string> & themeInfo = themeSwitcher.getElementFromIndex(iSel);
_themeName = themeInfo.second; _themeName = themeInfo.second;
@ -653,9 +653,9 @@ void WordStyleDlg::switchToTheme()
themeFileName, themeFileName,
MB_ICONWARNING | MB_YESNO | MB_APPLMODAL | MB_SETFOREGROUND ); MB_ICONWARNING | MB_YESNO | MB_APPLMODAL | MB_SETFOREGROUND );
if ( mb_response == IDYES ) if ( mb_response == IDYES )
(NppParameters::getInstance())->writeStyles(_lsArray, _globalStyles); (NppParameters::getInstance()).writeStyles(_lsArray, _globalStyles);
} }
nppParamInst->reloadStylers(&_themeName[0]); nppParamInst.reloadStylers(&_themeName[0]);
loadLangListFromNppParam(); loadLangListFromNppParam();
_restoreInvalid = true; _restoreInvalid = true;
@ -673,7 +673,7 @@ void WordStyleDlg::setStyleListFromLexer(int index)
if (index) if (index)
{ {
const TCHAR *langName = _lsArray.getLexerNameFromIndex(index - 1); const TCHAR *langName = _lsArray.getLexerNameFromIndex(index - 1);
const TCHAR *ext = NppParameters::getInstance()->getLangExtFromName(langName); const TCHAR *ext = NppParameters::getInstance().getLangExtFromName(langName);
const TCHAR *userExt = (_lsArray.getLexerStylerByName(langName))->getLexerUserExt(); const TCHAR *userExt = (_lsArray.getLexerStylerByName(langName))->getLexerUserExt();
::SendDlgItemMessage(_hSelf, IDC_DEF_EXT_EDIT, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(ext)); ::SendDlgItemMessage(_hSelf, IDC_DEF_EXT_EDIT, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(ext));
@ -830,15 +830,15 @@ void WordStyleDlg::setVisualFromStyleList()
{ {
LexerStyler & lexerStyler = _lsArray.getLexerFromIndex(_currentLexerIndex - 1); LexerStyler & lexerStyler = _lsArray.getLexerFromIndex(_currentLexerIndex - 1);
NppParameters *pNppParams = NppParameters::getInstance(); NppParameters& nppParams = NppParameters::getInstance();
LangType lType = pNppParams->getLangIDFromStr(lexerStyler.getLexerName()); LangType lType = nppParams.getLangIDFromStr(lexerStyler.getLexerName());
if (lType == L_TEXT) if (lType == L_TEXT)
{ {
generic_string lexerNameStr = lexerStyler.getLexerName(); generic_string lexerNameStr = lexerStyler.getLexerName();
lexerNameStr += TEXT(" is not defined in NppParameters::getLangIDFromStr()"); lexerNameStr += TEXT(" is not defined in NppParameters::getLangIDFromStr()");
printStr(lexerNameStr.c_str()); printStr(lexerNameStr.c_str());
} }
const TCHAR *kws = pNppParams->getWordList(lType, style._keywordClass); const TCHAR *kws = nppParams.getWordList(lType, style._keywordClass);
if (!kws) if (!kws)
kws = TEXT(""); kws = TEXT("");
::SendDlgItemMessage(_hSelf, IDC_DEF_KEYWORDS_EDIT, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(kws)); ::SendDlgItemMessage(_hSelf, IDC_DEF_KEYWORDS_EDIT, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(kws));
@ -862,7 +862,7 @@ void WordStyleDlg::create(int dialogID, bool isRTL, bool msgDestParent)
{ {
StaticDialog::create(dialogID, isRTL, msgDestParent); StaticDialog::create(dialogID, isRTL, msgDestParent);
if ((NppParameters::getInstance())->isTransparentAvailable()) if ((NppParameters::getInstance()).isTransparentAvailable())
{ {
::ShowWindow(::GetDlgItem(_hSelf, IDC_SC_TRANSPARENT_CHECK), SW_SHOW); ::ShowWindow(::GetDlgItem(_hSelf, IDC_SC_TRANSPARENT_CHECK), SW_SHOW);
::ShowWindow(::GetDlgItem(_hSelf, IDC_SC_PERCENTAGE_SLIDER), SW_SHOW); ::ShowWindow(::GetDlgItem(_hSelf, IDC_SC_PERCENTAGE_SLIDER), SW_SHOW);
@ -877,8 +877,8 @@ void WordStyleDlg::create(int dialogID, bool isRTL, bool msgDestParent)
void WordStyleDlg::apply() void WordStyleDlg::apply()
{ {
LexerStylerArray & lsa = (NppParameters::getInstance())->getLStylerArray(); LexerStylerArray & lsa = (NppParameters::getInstance()).getLStylerArray();
StyleArray & globalStyles = (NppParameters::getInstance())->getGlobalStylers(); StyleArray & globalStyles = (NppParameters::getInstance()).getGlobalStylers();
lsa = _lsArray; lsa = _lsArray;
globalStyles = _globalStyles; globalStyles = _globalStyles;

View File

@ -91,9 +91,9 @@ public :
}; };
void prepare2Cancel() { void prepare2Cancel() {
_styles2restored = (NppParameters::getInstance())->getLStylerArray(); _styles2restored = (NppParameters::getInstance()).getLStylerArray();
_gstyles2restored = (NppParameters::getInstance())->getGlobalStylers(); _gstyles2restored = (NppParameters::getInstance()).getGlobalStylers();
_gOverride2restored = (NppParameters::getInstance())->getGlobalOverrideStyle(); _gOverride2restored = (NppParameters::getInstance()).getGlobalOverrideStyle();
}; };
virtual void redraw(bool forceUpdate = false) const { virtual void redraw(bool forceUpdate = false) const {
@ -104,15 +104,15 @@ public :
}; };
void restoreGlobalOverrideValues() { void restoreGlobalOverrideValues() {
GlobalOverride & gOverride = (NppParameters::getInstance())->getGlobalOverrideStyle(); GlobalOverride & gOverride = (NppParameters::getInstance()).getGlobalOverrideStyle();
gOverride = _gOverride2restored; gOverride = _gOverride2restored;
}; };
void apply(); void apply();
void addLastThemeEntry() { void addLastThemeEntry() {
NppParameters *nppParamInst = NppParameters::getInstance(); NppParameters& nppParamInst = NppParameters::getInstance();
ThemeSwitcher & themeSwitcher = nppParamInst->getThemeSwitcher(); ThemeSwitcher & themeSwitcher = nppParamInst.getThemeSwitcher();
std::pair<generic_string, generic_string> & themeInfo = themeSwitcher.getElementFromIndex(themeSwitcher.size() - 1); std::pair<generic_string, generic_string> & themeInfo = themeSwitcher.getElementFromIndex(themeSwitcher.size() - 1);
::SendMessage(_hSwitch2ThemeCombo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(themeInfo.first.c_str())); ::SendMessage(_hSwitch2ThemeCombo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(themeInfo.first.c_str()));
}; };

View File

@ -86,13 +86,13 @@ DockingCont::DockingCont()
_bDrawOgLine = TRUE; _bDrawOgLine = TRUE;
_vTbData.clear(); _vTbData.clear();
_captionHeightDynamic = NppParameters::getInstance()->_dpiManager.scaleY(_captionHeightDynamic); _captionHeightDynamic = NppParameters::getInstance()._dpiManager.scaleY(_captionHeightDynamic);
_captionGapDynamic = NppParameters::getInstance()->_dpiManager.scaleY(_captionGapDynamic); _captionGapDynamic = NppParameters::getInstance()._dpiManager.scaleY(_captionGapDynamic);
_closeButtonPosLeftDynamic = NppParameters::getInstance()->_dpiManager.scaleX(_closeButtonPosLeftDynamic); _closeButtonPosLeftDynamic = NppParameters::getInstance()._dpiManager.scaleX(_closeButtonPosLeftDynamic);
_closeButtonPosTopDynamic = NppParameters::getInstance()->_dpiManager.scaleY(_closeButtonPosTopDynamic); _closeButtonPosTopDynamic = NppParameters::getInstance()._dpiManager.scaleY(_closeButtonPosTopDynamic);
_closeButtonWidth = NppParameters::getInstance()->_dpiManager.scaleX(12); // bitmap image is 12x12 _closeButtonWidth = NppParameters::getInstance()._dpiManager.scaleX(12); // bitmap image is 12x12
_closeButtonHeight = NppParameters::getInstance()->_dpiManager.scaleY(12); _closeButtonHeight = NppParameters::getInstance()._dpiManager.scaleY(12);
} }
DockingCont::~DockingCont() DockingCont::~DockingCont()
@ -878,7 +878,7 @@ void DockingCont::drawTabItem(DRAWITEMSTRUCT *pDrawItemStruct)
ImageList_GetImageInfo(hImageList, iPosImage, &info); ImageList_GetImageInfo(hImageList, iPosImage, &info);
int iconDpiDynamicalY = NppParameters::getInstance()->_dpiManager.scaleY(7); int iconDpiDynamicalY = NppParameters::getInstance()._dpiManager.scaleY(7);
ImageList_Draw(hImageList, iPosImage, hDc, rc.left + 3, iconDpiDynamicalY, ILD_NORMAL); ImageList_Draw(hImageList, iPosImage, hDc, rc.left + 3, iconDpiDynamicalY, ILD_NORMAL);
if (isSelected) if (isSelected)
@ -933,7 +933,7 @@ INT_PTR CALLBACK DockingCont::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lP
_hDefaultTabProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_hContTab, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(wndTabProc))); _hDefaultTabProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_hContTab, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(wndTabProc)));
// set min tab width // set min tab width
int tabDpiDynamicalMinWidth = NppParameters::getInstance()->_dpiManager.scaleY(24); int tabDpiDynamicalMinWidth = NppParameters::getInstance()._dpiManager.scaleY(24);
::SendMessage(_hContTab, TCM_SETMINTABWIDTH, 0, tabDpiDynamicalMinWidth); ::SendMessage(_hContTab, TCM_SETMINTABWIDTH, 0, tabDpiDynamicalMinWidth);
break; break;
@ -1023,7 +1023,7 @@ void DockingCont::onSize()
if (iItemCnt >= 1) if (iItemCnt >= 1)
{ {
// resize to docked window // resize to docked window
int tabDpiDynamicalHeight = NppParameters::getInstance()->_dpiManager.scaleY(24); int tabDpiDynamicalHeight = NppParameters::getInstance()._dpiManager.scaleY(24);
if (_isFloating == false) if (_isFloating == false)
{ {
// draw caption // draw caption

View File

@ -570,7 +570,7 @@ void DockingManager::createDockableDlg(tTbData data, int iCont, bool isVisible)
// create image list if not exist // create image list if not exist
if (_hImageList == NULL) if (_hImageList == NULL)
{ {
int iconDpiDynamicalSize = NppParameters::getInstance()->_dpiManager.scaleY(14); int iconDpiDynamicalSize = NppParameters::getInstance()._dpiManager.scaleY(14);
_hImageList = ::ImageList_Create(iconDpiDynamicalSize,iconDpiDynamicalSize,ILC_COLOR8, 0, 0); _hImageList = ::ImageList_Create(iconDpiDynamicalSize,iconDpiDynamicalSize,ILC_COLOR8, 0, 0);
} }

View File

@ -259,7 +259,7 @@ void Gripper::create()
// start hooking // start hooking
::SetWindowPos(_pCont->getHSelf(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); ::SetWindowPos(_pCont->getHSelf(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
::SetCapture(_hSelf); ::SetCapture(_hSelf);
winVer ver = (NppParameters::getInstance())->getWinVersion(); winVer ver = (NppParameters::getInstance()).getWinVersion();
hookMouse = ::SetWindowsHookEx(WH_MOUSE_LL, hookProcMouse, _hInst, 0); hookMouse = ::SetWindowsHookEx(WH_MOUSE_LL, hookProcMouse, _hInst, 0);
if (!hookMouse) if (!hookMouse)

View File

@ -377,7 +377,7 @@ INT_PTR CALLBACK DocumentMap::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
_vzDlg.init(::GetModuleHandle(NULL), _hSelf); _vzDlg.init(::GetModuleHandle(NULL), _hSelf);
_vzDlg.doDialog(); _vzDlg.doDialog();
(NppParameters::getInstance())->SetTransparent(_vzDlg.getHSelf(), 50); // 0 <= transparancy < 256 (NppParameters::getInstance()).SetTransparent(_vzDlg.getHSelf(), 50); // 0 <= transparancy < 256
setSyntaxHiliting(); setSyntaxHiliting();

View File

@ -246,7 +246,7 @@ INT_PTR CALLBACK FileBrowser::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
void FileBrowser::initPopupMenus() void FileBrowser::initPopupMenus()
{ {
NativeLangSpeaker* pNativeSpeaker = NppParameters::getInstance()->getNativeLangSpeaker(); NativeLangSpeaker* pNativeSpeaker = NppParameters::getInstance().getNativeLangSpeaker();
generic_string addRoot = pNativeSpeaker->getFileBrowserLangMenuStr(IDM_FILEBROWSER_ADDROOT, FB_ADDROOT); generic_string addRoot = pNativeSpeaker->getFileBrowserLangMenuStr(IDM_FILEBROWSER_ADDROOT, FB_ADDROOT);
generic_string removeAllRoot = pNativeSpeaker->getFileBrowserLangMenuStr(IDM_FILEBROWSER_REMOVEALLROOTS, FB_REMOVEALLROOTS); generic_string removeAllRoot = pNativeSpeaker->getFileBrowserLangMenuStr(IDM_FILEBROWSER_REMOVEALLROOTS, FB_REMOVEALLROOTS);
@ -748,7 +748,7 @@ void FileBrowser::popupMenuCmd(int cmdID)
case IDM_FILEBROWSER_ADDROOT: case IDM_FILEBROWSER_ADDROOT:
{ {
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string openWorkspaceStr = pNativeSpeaker->getAttrNameStr(TEXT("Select a folder to add in Folder as Workspace panel"), "FolderAsWorkspace", "SelectFolderFromBrowserString"); generic_string openWorkspaceStr = pNativeSpeaker->getAttrNameStr(TEXT("Select a folder to add in Folder as Workspace panel"), "FolderAsWorkspace", "SelectFolderFromBrowserString");
generic_string folderPath = folderBrowser(_hParent, openWorkspaceStr.c_str()); generic_string folderPath = folderBrowser(_hParent, openWorkspaceStr.c_str());
if (!folderPath.empty()) if (!folderPath.empty())
@ -910,7 +910,7 @@ void FileBrowser::addRootFolder(generic_string rootFolderPath)
if (isRelatedRootFolder(rootFolderPath, _folderUpdaters[i]->_rootFolder._rootPath)) if (isRelatedRootFolder(rootFolderPath, _folderUpdaters[i]->_rootFolder._rootPath))
{ {
NppParameters::getInstance()->getNativeLangSpeaker()->messageBox("FolderAsWorspaceSubfolderExists", NppParameters::getInstance().getNativeLangSpeaker()->messageBox("FolderAsWorspaceSubfolderExists",
_hParent, _hParent,
TEXT("A sub-folder of the folder you want to add exists.\rPlease remove its root from the panel before you add folder \"$STR_REPLACE$\"."), TEXT("A sub-folder of the folder you want to add exists.\rPlease remove its root from the panel before you add folder \"$STR_REPLACE$\"."),
TEXT("Folder as Worspace adding folder problem"), TEXT("Folder as Worspace adding folder problem"),

View File

@ -62,7 +62,7 @@ INT_PTR CALLBACK FindCharsInRangeDlg::run_dlgProc(UINT message, WPARAM wParam, L
if (!getRangeFromUI(startRange, endRange)) if (!getRangeFromUI(startRange, endRange))
{ {
//STOP! //STOP!
NppParameters::getInstance()->getNativeLangSpeaker()->messageBox("FindCharRangeValueError", NppParameters::getInstance().getNativeLangSpeaker()->messageBox("FindCharRangeValueError",
_hSelf, _hSelf,
TEXT("You should type between 0 and 255."), TEXT("You should type between 0 and 255."),
TEXT("Range Value problem"), TEXT("Range Value problem"),

View File

@ -239,7 +239,7 @@ bool FunctionListPanel::serialize(const generic_string & outputFilename)
const TCHAR *fullFilePath = currentBuf->getFullPathName(); const TCHAR *fullFilePath = currentBuf->getFullPathName();
// Export function list from an existing file // Export function list from an existing file
bool exportFuncntionList = (NppParameters::getInstance())->doFunctionListExport(); bool exportFuncntionList = (NppParameters::getInstance()).doFunctionListExport();
if (exportFuncntionList && ::PathFileExists(fullFilePath)) if (exportFuncntionList && ::PathFileExists(fullFilePath))
{ {
fname2write = fullFilePath; fname2write = fullFilePath;
@ -444,16 +444,16 @@ void FunctionListPanel::init(HINSTANCE hInst, HWND hPere, ScintillaEditView **pp
{ {
DockingDlgInterface::init(hInst, hPere); DockingDlgInterface::init(hInst, hPere);
_ppEditView = ppEditView; _ppEditView = ppEditView;
bool doLocalConf = (NppParameters::getInstance())->isLocal(); bool doLocalConf = (NppParameters::getInstance()).isLocal();
if (!doLocalConf) if (!doLocalConf)
{ {
generic_string funcListXmlPath = (NppParameters::getInstance())->getUserPath(); generic_string funcListXmlPath = (NppParameters::getInstance()).getUserPath();
PathAppend(funcListXmlPath, TEXT("functionList.xml")); PathAppend(funcListXmlPath, TEXT("functionList.xml"));
if (!PathFileExists(funcListXmlPath.c_str())) if (!PathFileExists(funcListXmlPath.c_str()))
{ {
generic_string funcListDefaultXmlPath = (NppParameters::getInstance())->getNppPath(); generic_string funcListDefaultXmlPath = (NppParameters::getInstance()).getNppPath();
PathAppend(funcListDefaultXmlPath, TEXT("functionList.xml")); PathAppend(funcListDefaultXmlPath, TEXT("functionList.xml"));
if (PathFileExists(funcListDefaultXmlPath.c_str())) if (PathFileExists(funcListDefaultXmlPath.c_str()))
{ {
@ -468,7 +468,7 @@ void FunctionListPanel::init(HINSTANCE hInst, HWND hPere, ScintillaEditView **pp
} }
else else
{ {
generic_string funcListDefaultXmlPath = (NppParameters::getInstance())->getNppPath(); generic_string funcListDefaultXmlPath = (NppParameters::getInstance()).getNppPath();
PathAppend(funcListDefaultXmlPath, TEXT("functionList.xml")); PathAppend(funcListDefaultXmlPath, TEXT("functionList.xml"));
if (PathFileExists(funcListDefaultXmlPath.c_str())) if (PathFileExists(funcListDefaultXmlPath.c_str()))
{ {
@ -695,9 +695,9 @@ INT_PTR CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPA
case WM_INITDIALOG : case WM_INITDIALOG :
{ {
int editWidth = NppParameters::getInstance()->_dpiManager.scaleX(100); int editWidth = NppParameters::getInstance()._dpiManager.scaleX(100);
int editWidthSep = NppParameters::getInstance()->_dpiManager.scaleX(105); //editWidth + 5 int editWidthSep = NppParameters::getInstance()._dpiManager.scaleX(105); //editWidth + 5
int editHeight = NppParameters::getInstance()->_dpiManager.scaleY(20); int editHeight = NppParameters::getInstance()._dpiManager.scaleY(20);
// Create toolbar menu // Create toolbar menu
int style = WS_CHILD | WS_VISIBLE | CCS_ADJUSTABLE | TBSTYLE_AUTOSIZE | TBSTYLE_FLAT | TBSTYLE_LIST | TBSTYLE_TRANSPARENT | BTNS_AUTOSIZE | BTNS_SEP | TBSTYLE_TOOLTIPS; int style = WS_CHILD | WS_VISIBLE | CCS_ADJUSTABLE | TBSTYLE_AUTOSIZE | TBSTYLE_FLAT | TBSTYLE_LIST | TBSTYLE_TRANSPARENT | BTNS_AUTOSIZE | BTNS_SEP | TBSTYLE_TOOLTIPS;
@ -741,7 +741,7 @@ INT_PTR CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPA
ShowWindow(_hToolbarMenu, SW_SHOW); ShowWindow(_hToolbarMenu, SW_SHOW);
// tips text for toolbar buttons // tips text for toolbar buttons
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
_sortTipStr = pNativeSpeaker->getAttrNameStr(_sortTipStr.c_str(), FL_FUCTIONLISTROOTNODE, FL_SORTLOCALNODENAME); _sortTipStr = pNativeSpeaker->getAttrNameStr(_sortTipStr.c_str(), FL_FUCTIONLISTROOTNODE, FL_SORTLOCALNODENAME);
_reloadTipStr = pNativeSpeaker->getAttrNameStr(_reloadTipStr.c_str(), FL_FUCTIONLISTROOTNODE, FL_RELOADLOCALNODENAME); _reloadTipStr = pNativeSpeaker->getAttrNameStr(_reloadTipStr.c_str(), FL_FUCTIONLISTROOTNODE, FL_RELOADLOCALNODENAME);
@ -810,7 +810,7 @@ INT_PTR CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPA
{ {
int width = LOWORD(lParam); int width = LOWORD(lParam);
int height = HIWORD(lParam); int height = HIWORD(lParam);
int extraValue = NppParameters::getInstance()->_dpiManager.scaleX(4); int extraValue = NppParameters::getInstance()._dpiManager.scaleX(4);
RECT toolbarMenuRect; RECT toolbarMenuRect;
::GetClientRect(_hToolbarMenu, &toolbarMenuRect); ::GetClientRect(_hToolbarMenu, &toolbarMenuRect);

View File

@ -56,7 +56,7 @@ void ShortcutMapper::initTabs()
::GetWindowPlacement(hTab, &wp); ::GetWindowPlacement(hTab, &wp);
::SendMessage(hTab, TCM_GETITEMRECT, 0, reinterpret_cast<LPARAM>(&rcTab)); ::SendMessage(hTab, TCM_GETITEMRECT, 0, reinterpret_cast<LPARAM>(&rcTab));
wp.rcNormalPosition.bottom = NppParameters::getInstance()->_dpiManager.scaleY(30); wp.rcNormalPosition.bottom = NppParameters::getInstance()._dpiManager.scaleY(30);
wp.rcNormalPosition.top = wp.rcNormalPosition.bottom - rcTab.bottom; wp.rcNormalPosition.top = wp.rcNormalPosition.bottom - rcTab.bottom;
::SetWindowPlacement(hTab, &wp); ::SetWindowPlacement(hTab, &wp);
@ -66,10 +66,10 @@ void ShortcutMapper::getClientRect(RECT & rc) const
{ {
Window::getClientRect(rc); Window::getClientRect(rc);
rc.top += NppParameters::getInstance()->_dpiManager.scaleY(30); rc.top += NppParameters::getInstance()._dpiManager.scaleY(30);
rc.bottom -= NppParameters::getInstance()->_dpiManager.scaleY(108); rc.bottom -= NppParameters::getInstance()._dpiManager.scaleY(108);
rc.left += NppParameters::getInstance()->_dpiManager.scaleX(5); rc.left += NppParameters::getInstance()._dpiManager.scaleX(5);
rc.right -= NppParameters::getInstance()->_dpiManager.scaleX(5); rc.right -= NppParameters::getInstance()._dpiManager.scaleX(5);
} }
generic_string ShortcutMapper::getTabString(size_t i) const generic_string ShortcutMapper::getTabString(size_t i) const
@ -77,7 +77,7 @@ generic_string ShortcutMapper::getTabString(size_t i) const
if (i >= _nbTab) if (i >= _nbTab)
return TEXT(""); return TEXT("");
NativeLangSpeaker* nativeLangSpeaker = NppParameters::getInstance()->getNativeLangSpeaker(); NativeLangSpeaker* nativeLangSpeaker = NppParameters::getInstance().getNativeLangSpeaker();
switch (i) switch (i)
{ {
case 1: case 1:
@ -107,11 +107,11 @@ void ShortcutMapper::initBabyGrid() {
_hGridFonts.resize(MAX_GRID_FONTS); _hGridFonts.resize(MAX_GRID_FONTS);
_hGridFonts.at(GFONT_HEADER) = ::CreateFont( _hGridFonts.at(GFONT_HEADER) = ::CreateFont(
NppParameters::getInstance()->_dpiManager.scaleY(18), 0, 0, 0, FW_BOLD, NppParameters::getInstance()._dpiManager.scaleY(18), 0, 0, 0, FW_BOLD,
FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH,
TEXT("MS Shell Dlg")); TEXT("MS Shell Dlg"));
_hGridFonts.at(GFONT_ROWS) = ::CreateFont( _hGridFonts.at(GFONT_ROWS) = ::CreateFont(
NppParameters::getInstance()->_dpiManager.scaleY(16), 0, 0, 0, FW_NORMAL, NppParameters::getInstance()._dpiManager.scaleY(16), 0, 0, 0, FW_NORMAL,
FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH,
TEXT("MS Shell Dlg")); TEXT("MS Shell Dlg"));
@ -125,16 +125,16 @@ void ShortcutMapper::initBabyGrid() {
_babygrid.makeColAutoWidth(true); _babygrid.makeColAutoWidth(true);
_babygrid.setAutoRow(true); _babygrid.setAutoRow(true);
_babygrid.setColsNumbered(false); _babygrid.setColsNumbered(false);
_babygrid.setColWidth(0, NppParameters::getInstance()->_dpiManager.scaleX(30)); // Force the first col to be small, others col will be automatically sized _babygrid.setColWidth(0, NppParameters::getInstance()._dpiManager.scaleX(30)); // Force the first col to be small, others col will be automatically sized
_babygrid.setHeaderHeight(NppParameters::getInstance()->_dpiManager.scaleY(21)); _babygrid.setHeaderHeight(NppParameters::getInstance()._dpiManager.scaleY(21));
_babygrid.setRowHeight(NppParameters::getInstance()->_dpiManager.scaleY(21)); _babygrid.setRowHeight(NppParameters::getInstance()._dpiManager.scaleY(21));
_babygrid.setHighlightColorNoFocus(RGB(200,200,210)); _babygrid.setHighlightColorNoFocus(RGB(200,200,210));
_babygrid.setProtectColor(RGB(255,130,120)); _babygrid.setProtectColor(RGB(255,130,120));
_babygrid.setHighlightColorProtect(RGB(244,10,20)); _babygrid.setHighlightColorProtect(RGB(244,10,20));
_babygrid.setHighlightColorProtectNoFocus(RGB(230,194,190)); _babygrid.setHighlightColorProtectNoFocus(RGB(230,194,190));
NativeLangSpeaker* nativeLangSpeaker = NppParameters::getInstance()->getNativeLangSpeaker(); NativeLangSpeaker* nativeLangSpeaker = NppParameters::getInstance().getNativeLangSpeaker();
nativeLangSpeaker->changeDlgLang(_hSelf, "ShortcutMapper"); nativeLangSpeaker->changeDlgLang(_hSelf, "ShortcutMapper");
_conflictInfoOk = nativeLangSpeaker->getShortcutMapperLangStr("ConflictInfoOk", TEXT("No shortcut conflicts for this item.")); _conflictInfoOk = nativeLangSpeaker->getShortcutMapperLangStr("ConflictInfoOk", TEXT("No shortcut conflicts for this item."));
_conflictInfoEditing = nativeLangSpeaker->getShortcutMapperLangStr("ConflictInfoEditing", TEXT("No conflicts . . .")); _conflictInfoEditing = nativeLangSpeaker->getShortcutMapperLangStr("ConflictInfoEditing", TEXT("No conflicts . . ."));
@ -183,13 +183,13 @@ bool ShortcutMapper::isFilterValid(PluginCmdShortcut sc)
void ShortcutMapper::fillOutBabyGrid() void ShortcutMapper::fillOutBabyGrid()
{ {
NppParameters *nppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
_babygrid.clear(); _babygrid.clear();
_babygrid.setInitialContent(true); _babygrid.setInitialContent(true);
_shortcutIndex.clear(); _shortcutIndex.clear();
size_t nbItems = 0; size_t nbItems = 0;
NativeLangSpeaker* nativeLangSpeaker = nppParam->getNativeLangSpeaker(); NativeLangSpeaker* nativeLangSpeaker = nppParam.getNativeLangSpeaker();
generic_string nameStr = nativeLangSpeaker->getShortcutMapperLangStr("ColumnName", TEXT("Name")); generic_string nameStr = nativeLangSpeaker->getShortcutMapperLangStr("ColumnName", TEXT("Name"));
generic_string shortcutStr = nativeLangSpeaker->getShortcutMapperLangStr("ColumnShortcut", TEXT("Shortcut")); generic_string shortcutStr = nativeLangSpeaker->getShortcutMapperLangStr("ColumnShortcut", TEXT("Shortcut"));
@ -200,7 +200,7 @@ void ShortcutMapper::fillOutBabyGrid()
{ {
case STATE_MENU: case STATE_MENU:
{ {
nbItems = nppParam->getUserShortcuts().size(); nbItems = nppParam.getUserShortcuts().size();
_babygrid.setLineColNumber(nbItems, 3); _babygrid.setLineColNumber(nbItems, 3);
generic_string categoryStr = nativeLangSpeaker->getShortcutMapperLangStr("ColumnCategory", TEXT("Category")); generic_string categoryStr = nativeLangSpeaker->getShortcutMapperLangStr("ColumnCategory", TEXT("Category"));
_babygrid.setText(0, 3, categoryStr.c_str()); _babygrid.setText(0, 3, categoryStr.c_str());
@ -209,21 +209,21 @@ void ShortcutMapper::fillOutBabyGrid()
case STATE_MACRO: case STATE_MACRO:
{ {
nbItems = nppParam->getMacroList().size(); nbItems = nppParam.getMacroList().size();
_babygrid.setLineColNumber(nbItems, 2); _babygrid.setLineColNumber(nbItems, 2);
} }
break; break;
case STATE_USER: case STATE_USER:
{ {
nbItems = nppParam->getUserCommandList().size(); nbItems = nppParam.getUserCommandList().size();
_babygrid.setLineColNumber(nbItems, 2); _babygrid.setLineColNumber(nbItems, 2);
} }
break; break;
case STATE_PLUGIN: case STATE_PLUGIN:
{ {
nbItems = nppParam->getPluginCommandList().size(); nbItems = nppParam.getPluginCommandList().size();
_babygrid.setLineColNumber(nbItems, 3); _babygrid.setLineColNumber(nbItems, 3);
generic_string pluginStr = nativeLangSpeaker->getShortcutMapperLangStr("ColumnPlugin", TEXT("Plugin")); generic_string pluginStr = nativeLangSpeaker->getShortcutMapperLangStr("ColumnPlugin", TEXT("Plugin"));
_babygrid.setText(0, 3, pluginStr.c_str()); _babygrid.setText(0, 3, pluginStr.c_str());
@ -232,7 +232,7 @@ void ShortcutMapper::fillOutBabyGrid()
case STATE_SCINTILLA: case STATE_SCINTILLA:
{ {
nbItems = nppParam->getScintillaKeyList().size(); nbItems = nppParam.getScintillaKeyList().size();
_babygrid.setLineColNumber(nbItems, 2); _babygrid.setLineColNumber(nbItems, 2);
} }
break; break;
@ -246,7 +246,7 @@ void ShortcutMapper::fillOutBabyGrid()
{ {
case STATE_MENU: case STATE_MENU:
{ {
vector<CommandShortcut> & cshortcuts = nppParam->getUserShortcuts(); vector<CommandShortcut> & cshortcuts = nppParam.getUserShortcuts();
cs_index = 1; cs_index = 1;
for (size_t i = 0; i < nbItems; ++i) for (size_t i = 0; i < nbItems; ++i)
{ {
@ -274,7 +274,7 @@ void ShortcutMapper::fillOutBabyGrid()
case STATE_MACRO: case STATE_MACRO:
{ {
vector<MacroShortcut> & cshortcuts = nppParam->getMacroList(); vector<MacroShortcut> & cshortcuts = nppParam.getMacroList();
cs_index = 1; cs_index = 1;
for (size_t i = 0; i < nbItems; ++i) for (size_t i = 0; i < nbItems; ++i)
{ {
@ -303,7 +303,7 @@ void ShortcutMapper::fillOutBabyGrid()
case STATE_USER: case STATE_USER:
{ {
vector<UserCommand> & cshortcuts = nppParam->getUserCommandList(); vector<UserCommand> & cshortcuts = nppParam.getUserCommandList();
cs_index = 1; cs_index = 1;
for (size_t i = 0; i < nbItems; ++i) for (size_t i = 0; i < nbItems; ++i)
{ {
@ -333,7 +333,7 @@ void ShortcutMapper::fillOutBabyGrid()
case STATE_PLUGIN: case STATE_PLUGIN:
{ {
vector<PluginCmdShortcut> & cshortcuts = nppParam->getPluginCommandList(); vector<PluginCmdShortcut> & cshortcuts = nppParam.getPluginCommandList();
cs_index = 1; cs_index = 1;
for (size_t i = 0; i < nbItems; ++i) for (size_t i = 0; i < nbItems; ++i)
{ {
@ -363,7 +363,7 @@ void ShortcutMapper::fillOutBabyGrid()
case STATE_SCINTILLA: case STATE_SCINTILLA:
{ {
vector<ScintillaKeyMap> & cshortcuts = nppParam->getScintillaKeyList(); vector<ScintillaKeyMap> & cshortcuts = nppParam.getScintillaKeyList();
cs_index=1; cs_index=1;
for (size_t i = 0; i < nbItems; ++i) for (size_t i = 0; i < nbItems; ++i)
{ {
@ -581,7 +581,7 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
if (_babygrid.getNumberRows() < 1) if (_babygrid.getNumberRows() < 1)
return TRUE; return TRUE;
NppParameters *nppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
int row = _babygrid.getSelectedRow(); int row = _babygrid.getSelectedRow();
size_t shortcutIndex = _shortcutIndex[row-1]; size_t shortcutIndex = _shortcutIndex[row-1];
bool isModified = false; bool isModified = false;
@ -591,12 +591,12 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
case STATE_MENU: case STATE_MENU:
{ {
//Get CommandShortcut corresponding to row //Get CommandShortcut corresponding to row
vector<CommandShortcut> & shortcuts = nppParam->getUserShortcuts(); vector<CommandShortcut> & shortcuts = nppParam.getUserShortcuts();
CommandShortcut csc = shortcuts[shortcutIndex]; CommandShortcut csc = shortcuts[shortcutIndex];
csc.clear(); csc.clear();
shortcuts[shortcutIndex] = csc; shortcuts[shortcutIndex] = csc;
//shortcut was altered //shortcut was altered
nppParam->addUserModifiedIndex(shortcutIndex); nppParam.addUserModifiedIndex(shortcutIndex);
//save the current view //save the current view
_lastHomeRow[_currentState] = _babygrid.getHomeRow(); _lastHomeRow[_currentState] = _babygrid.getHomeRow();
@ -606,15 +606,15 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
isModified = true; isModified = true;
//Notify current Accelerator class to update everything //Notify current Accelerator class to update everything
nppParam->getAccelerator()->updateShortcuts(); nppParam.getAccelerator()->updateShortcuts();
nppParam->setShortcutDirty(); nppParam.setShortcutDirty();
} }
break; break;
case STATE_MACRO: case STATE_MACRO:
{ {
//Get MacroShortcut corresponding to row //Get MacroShortcut corresponding to row
vector<MacroShortcut> & shortcuts = nppParam->getMacroList(); vector<MacroShortcut> & shortcuts = nppParam.getMacroList();
MacroShortcut msc = shortcuts[shortcutIndex]; MacroShortcut msc = shortcuts[shortcutIndex];
msc.clear(); msc.clear();
shortcuts[shortcutIndex] = msc; shortcuts[shortcutIndex] = msc;
@ -626,15 +626,15 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
isModified = true; isModified = true;
//Notify current Accelerator class to update everything //Notify current Accelerator class to update everything
nppParam->getAccelerator()->updateShortcuts(); nppParam.getAccelerator()->updateShortcuts();
nppParam->setShortcutDirty(); nppParam.setShortcutDirty();
} }
break; break;
case STATE_USER: case STATE_USER:
{ {
//Get UserCommand corresponding to row //Get UserCommand corresponding to row
vector<UserCommand> & shortcuts = nppParam->getUserCommandList(); vector<UserCommand> & shortcuts = nppParam.getUserCommandList();
UserCommand ucmd = shortcuts[shortcutIndex]; UserCommand ucmd = shortcuts[shortcutIndex];
ucmd.clear(); ucmd.clear();
@ -649,19 +649,19 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
isModified = true; isModified = true;
//Notify current Accelerator class to update everything //Notify current Accelerator class to update everything
nppParam->getAccelerator()->updateShortcuts(); nppParam.getAccelerator()->updateShortcuts();
nppParam->setShortcutDirty(); nppParam.setShortcutDirty();
} }
break; break;
case STATE_PLUGIN: case STATE_PLUGIN:
{ {
//Get PluginCmdShortcut corresponding to row //Get PluginCmdShortcut corresponding to row
vector<PluginCmdShortcut> & shortcuts = nppParam->getPluginCommandList(); vector<PluginCmdShortcut> & shortcuts = nppParam.getPluginCommandList();
PluginCmdShortcut pcsc = shortcuts[shortcutIndex]; PluginCmdShortcut pcsc = shortcuts[shortcutIndex];
pcsc.clear(); pcsc.clear();
//shortcut was altered //shortcut was altered
nppParam->addPluginModifiedIndex(shortcutIndex); nppParam.addPluginModifiedIndex(shortcutIndex);
shortcuts[shortcutIndex] = pcsc; shortcuts[shortcutIndex] = pcsc;
//save the current view //save the current view
@ -672,7 +672,7 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
isModified = true; isModified = true;
//Notify current Accelerator class to update everything //Notify current Accelerator class to update everything
nppParam->getAccelerator()->updateShortcuts(); nppParam.getAccelerator()->updateShortcuts();
unsigned long cmdID = pcsc.getID(); unsigned long cmdID = pcsc.getID();
ShortcutKey shortcut; ShortcutKey shortcut;
shortcut._isAlt = FALSE; shortcut._isAlt = FALSE;
@ -681,7 +681,7 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
shortcut._key = '\0'; shortcut._key = '\0';
::SendMessage(_hParent, NPPM_INTERNAL_PLUGINSHORTCUTMOTIFIED, cmdID, reinterpret_cast<LPARAM>(&shortcut)); ::SendMessage(_hParent, NPPM_INTERNAL_PLUGINSHORTCUTMOTIFIED, cmdID, reinterpret_cast<LPARAM>(&shortcut));
nppParam->setShortcutDirty(); nppParam.setShortcutDirty();
} }
break; break;
@ -704,7 +704,7 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
if (_babygrid.getNumberRows() < 1) if (_babygrid.getNumberRows() < 1)
return TRUE; return TRUE;
NppParameters *nppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
int row = _babygrid.getSelectedRow(); int row = _babygrid.getSelectedRow();
size_t shortcutIndex = _shortcutIndex[row-1]; size_t shortcutIndex = _shortcutIndex[row-1];
bool isModified = false; bool isModified = false;
@ -714,13 +714,13 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
case STATE_MENU: case STATE_MENU:
{ {
//Get CommandShortcut corresponding to row //Get CommandShortcut corresponding to row
vector<CommandShortcut> & shortcuts = nppParam->getUserShortcuts(); vector<CommandShortcut> & shortcuts = nppParam.getUserShortcuts();
CommandShortcut csc = shortcuts[shortcutIndex], prevcsc = shortcuts[shortcutIndex]; CommandShortcut csc = shortcuts[shortcutIndex], prevcsc = shortcuts[shortcutIndex];
csc.init(_hInst, _hSelf); csc.init(_hInst, _hSelf);
if (csc.doDialog() != -1 && prevcsc != csc) if (csc.doDialog() != -1 && prevcsc != csc)
{ {
//shortcut was altered //shortcut was altered
nppParam->addUserModifiedIndex(shortcutIndex); nppParam.addUserModifiedIndex(shortcutIndex);
shortcuts[shortcutIndex] = csc; shortcuts[shortcutIndex] = csc;
//save the current view //save the current view
@ -731,8 +731,8 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
isModified = true; isModified = true;
//Notify current Accelerator class to update everything //Notify current Accelerator class to update everything
nppParam->getAccelerator()->updateShortcuts(); nppParam.getAccelerator()->updateShortcuts();
nppParam->setShortcutDirty(); nppParam.setShortcutDirty();
} }
} }
break; break;
@ -740,7 +740,7 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
case STATE_MACRO: case STATE_MACRO:
{ {
//Get MacroShortcut corresponding to row //Get MacroShortcut corresponding to row
vector<MacroShortcut> & shortcuts = nppParam->getMacroList(); vector<MacroShortcut> & shortcuts = nppParam.getMacroList();
MacroShortcut msc = shortcuts[shortcutIndex], prevmsc = shortcuts[shortcutIndex]; MacroShortcut msc = shortcuts[shortcutIndex], prevmsc = shortcuts[shortcutIndex];
msc.init(_hInst, _hSelf); msc.init(_hInst, _hSelf);
if (msc.doDialog() != -1 && prevmsc != msc) if (msc.doDialog() != -1 && prevmsc != msc)
@ -756,8 +756,8 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
isModified = true; isModified = true;
//Notify current Accelerator class to update everything //Notify current Accelerator class to update everything
nppParam->getAccelerator()->updateShortcuts(); nppParam.getAccelerator()->updateShortcuts();
nppParam->setShortcutDirty(); nppParam.setShortcutDirty();
} }
} }
break; break;
@ -765,7 +765,7 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
case STATE_USER: case STATE_USER:
{ {
//Get UserCommand corresponding to row //Get UserCommand corresponding to row
vector<UserCommand> & shortcuts = nppParam->getUserCommandList(); vector<UserCommand> & shortcuts = nppParam.getUserCommandList();
UserCommand ucmd = shortcuts[shortcutIndex]; UserCommand ucmd = shortcuts[shortcutIndex];
ucmd.init(_hInst, _hSelf); ucmd.init(_hInst, _hSelf);
UserCommand prevucmd = ucmd; UserCommand prevucmd = ucmd;
@ -782,8 +782,8 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
isModified = true; isModified = true;
//Notify current Accelerator class to update everything //Notify current Accelerator class to update everything
nppParam->getAccelerator()->updateShortcuts(); nppParam.getAccelerator()->updateShortcuts();
nppParam->setShortcutDirty(); nppParam.setShortcutDirty();
} }
} }
break; break;
@ -791,14 +791,14 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
case STATE_PLUGIN: case STATE_PLUGIN:
{ {
//Get PluginCmdShortcut corresponding to row //Get PluginCmdShortcut corresponding to row
vector<PluginCmdShortcut> & shortcuts = nppParam->getPluginCommandList(); vector<PluginCmdShortcut> & shortcuts = nppParam.getPluginCommandList();
PluginCmdShortcut pcsc = shortcuts[shortcutIndex]; PluginCmdShortcut pcsc = shortcuts[shortcutIndex];
pcsc.init(_hInst, _hSelf); pcsc.init(_hInst, _hSelf);
PluginCmdShortcut prevpcsc = pcsc; PluginCmdShortcut prevpcsc = pcsc;
if (pcsc.doDialog() != -1 && prevpcsc != pcsc) if (pcsc.doDialog() != -1 && prevpcsc != pcsc)
{ {
//shortcut was altered //shortcut was altered
nppParam->addPluginModifiedIndex(shortcutIndex); nppParam.addPluginModifiedIndex(shortcutIndex);
shortcuts[shortcutIndex] = pcsc; shortcuts[shortcutIndex] = pcsc;
//save the current view //save the current view
@ -809,7 +809,7 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
isModified = true; isModified = true;
//Notify current Accelerator class to update everything //Notify current Accelerator class to update everything
nppParam->getAccelerator()->updateShortcuts(); nppParam.getAccelerator()->updateShortcuts();
unsigned long cmdID = pcsc.getID(); unsigned long cmdID = pcsc.getID();
ShortcutKey shortcut; ShortcutKey shortcut;
shortcut._isAlt = pcsc.getKeyCombo()._isAlt; shortcut._isAlt = pcsc.getKeyCombo()._isAlt;
@ -818,7 +818,7 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
shortcut._key = pcsc.getKeyCombo()._key; shortcut._key = pcsc.getKeyCombo()._key;
::SendMessage(_hParent, NPPM_INTERNAL_PLUGINSHORTCUTMOTIFIED, cmdID, reinterpret_cast<LPARAM>(&shortcut)); ::SendMessage(_hParent, NPPM_INTERNAL_PLUGINSHORTCUTMOTIFIED, cmdID, reinterpret_cast<LPARAM>(&shortcut));
nppParam->setShortcutDirty(); nppParam.setShortcutDirty();
} }
} }
break; break;
@ -826,13 +826,13 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
case STATE_SCINTILLA: case STATE_SCINTILLA:
{ {
//Get ScintillaKeyMap corresponding to row //Get ScintillaKeyMap corresponding to row
vector<ScintillaKeyMap> & shortcuts = nppParam->getScintillaKeyList(); vector<ScintillaKeyMap> & shortcuts = nppParam.getScintillaKeyList();
ScintillaKeyMap skm = shortcuts[shortcutIndex], prevskm = shortcuts[shortcutIndex]; ScintillaKeyMap skm = shortcuts[shortcutIndex], prevskm = shortcuts[shortcutIndex];
skm.init(_hInst, _hSelf); skm.init(_hInst, _hSelf);
if (skm.doDialog() != -1 && prevskm != skm) if (skm.doDialog() != -1 && prevskm != skm)
{ {
//shortcut was altered //shortcut was altered
nppParam->addScintillaModifiedIndex((int)shortcutIndex); nppParam.addScintillaModifiedIndex((int)shortcutIndex);
shortcuts[shortcutIndex] = skm; shortcuts[shortcutIndex] = skm;
//save the current view //save the current view
@ -844,8 +844,8 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
isModified = true; isModified = true;
//Notify current Accelerator class to update key //Notify current Accelerator class to update key
nppParam->getScintillaAccelerator()->updateKeys(); nppParam.getScintillaAccelerator()->updateKeys();
nppParam->setShortcutDirty(); nppParam.setShortcutDirty();
} }
} }
break; break;
@ -862,8 +862,8 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
if (_babygrid.getNumberRows() < 1) if (_babygrid.getNumberRows() < 1)
return TRUE; return TRUE;
NppParameters *nppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
int res = nppParam->getNativeLangSpeaker()->messageBox("SCMapperDoDeleteOrNot", int res = nppParam.getNativeLangSpeaker()->messageBox("SCMapperDoDeleteOrNot",
_hSelf, _hSelf,
TEXT("Are you sure you want to delete this shortcut?"), TEXT("Are you sure you want to delete this shortcut?"),
TEXT("Are you sure?"), TEXT("Are you sure?"),
@ -891,7 +891,7 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
case STATE_MACRO: case STATE_MACRO:
{ {
vector<MacroShortcut> & theMacros = nppParam->getMacroList(); vector<MacroShortcut> & theMacros = nppParam.getMacroList();
vector<MacroShortcut>::iterator it = theMacros.begin(); vector<MacroShortcut>::iterator it = theMacros.begin();
cmdID = theMacros[shortcutIndex].getID(); cmdID = theMacros[shortcutIndex].getID();
theMacros.erase(it + shortcutIndex); theMacros.erase(it + shortcutIndex);
@ -925,7 +925,7 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
case STATE_USER: case STATE_USER:
{ {
vector<UserCommand> & theUserCmds = nppParam->getUserCommandList(); vector<UserCommand> & theUserCmds = nppParam.getUserCommandList();
vector<UserCommand>::iterator it = theUserCmds.begin(); vector<UserCommand>::iterator it = theUserCmds.begin();
cmdID = theUserCmds[shortcutIndex].getID(); cmdID = theUserCmds[shortcutIndex].getID();
theUserCmds.erase(it + shortcutIndex); theUserCmds.erase(it + shortcutIndex);
@ -959,8 +959,8 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
} }
// updateShortcuts() will update all menu item - the menu items will be shifted // updateShortcuts() will update all menu item - the menu items will be shifted
nppParam->getAccelerator()->updateShortcuts(); nppParam.getAccelerator()->updateShortcuts();
nppParam->setShortcutDirty(); nppParam.setShortcutDirty();
// All menu items are shifted up. So we delete the last item // All menu items are shifted up. So we delete the last item
::RemoveMenu(hMenu, posBase + static_cast<int32_t>(nbElem), MF_BYPOSITION); ::RemoveMenu(hMenu, posBase + static_cast<int32_t>(nbElem), MF_BYPOSITION);
@ -1053,7 +1053,7 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
if (_babygrid.getNumberRows() < 1) if (_babygrid.getNumberRows() < 1)
return TRUE; return TRUE;
NppParameters *nppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
const size_t currentIndex = LOWORD(lParam) - 1; const size_t currentIndex = LOWORD(lParam) - 1;
generic_string conflictInfo; generic_string conflictInfo;
@ -1061,35 +1061,35 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
{ {
case STATE_MENU: case STATE_MENU:
{ {
vector<CommandShortcut> & vShortcuts = nppParam->getUserShortcuts(); vector<CommandShortcut> & vShortcuts = nppParam.getUserShortcuts();
findKeyConflicts(&conflictInfo, vShortcuts[currentIndex].getKeyCombo(), currentIndex); findKeyConflicts(&conflictInfo, vShortcuts[currentIndex].getKeyCombo(), currentIndex);
} }
break; break;
case STATE_MACRO: case STATE_MACRO:
{ {
vector<MacroShortcut> & vShortcuts = nppParam->getMacroList(); vector<MacroShortcut> & vShortcuts = nppParam.getMacroList();
findKeyConflicts(&conflictInfo, vShortcuts[currentIndex].getKeyCombo(), currentIndex); findKeyConflicts(&conflictInfo, vShortcuts[currentIndex].getKeyCombo(), currentIndex);
} }
break; break;
case STATE_USER: case STATE_USER:
{ {
vector<UserCommand> & vShortcuts = nppParam->getUserCommandList(); vector<UserCommand> & vShortcuts = nppParam.getUserCommandList();
findKeyConflicts(&conflictInfo, vShortcuts[currentIndex].getKeyCombo(), currentIndex); findKeyConflicts(&conflictInfo, vShortcuts[currentIndex].getKeyCombo(), currentIndex);
} }
break; break;
case STATE_PLUGIN: case STATE_PLUGIN:
{ {
vector<PluginCmdShortcut> & vShortcuts = nppParam->getPluginCommandList(); vector<PluginCmdShortcut> & vShortcuts = nppParam.getPluginCommandList();
findKeyConflicts(&conflictInfo, vShortcuts[currentIndex].getKeyCombo(), currentIndex); findKeyConflicts(&conflictInfo, vShortcuts[currentIndex].getKeyCombo(), currentIndex);
} }
break; break;
case STATE_SCINTILLA: case STATE_SCINTILLA:
{ {
vector<ScintillaKeyMap> & vShortcuts = nppParam->getScintillaKeyList(); vector<ScintillaKeyMap> & vShortcuts = nppParam.getScintillaKeyList();
size_t sciCombos = vShortcuts[currentIndex].getSize(); size_t sciCombos = vShortcuts[currentIndex].getSize();
for (size_t sciIndex = 0; sciIndex < sciCombos; ++sciIndex) for (size_t sciIndex = 0; sciIndex < sciCombos; ++sciIndex)
findKeyConflicts(&conflictInfo, vShortcuts[currentIndex].getKeyComboByIndex(sciIndex), currentIndex); findKeyConflicts(&conflictInfo, vShortcuts[currentIndex].getKeyComboByIndex(sciIndex), currentIndex);
@ -1132,7 +1132,7 @@ bool ShortcutMapper::findKeyConflicts(__inout_opt generic_string * const keyConf
return false; return false;
bool retIsConflict = false; //returns true when a conflict is found bool retIsConflict = false; //returns true when a conflict is found
NppParameters * nppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
for (size_t gridState = STATE_MENU; gridState <= STATE_SCINTILLA; ++gridState) for (size_t gridState = STATE_MENU; gridState <= STATE_SCINTILLA; ++gridState)
{ {
@ -1140,7 +1140,7 @@ bool ShortcutMapper::findKeyConflicts(__inout_opt generic_string * const keyConf
{ {
case STATE_MENU: case STATE_MENU:
{ {
vector<CommandShortcut> & vShortcuts = nppParam->getUserShortcuts(); vector<CommandShortcut> & vShortcuts = nppParam.getUserShortcuts();
size_t nbItems = vShortcuts.size(); size_t nbItems = vShortcuts.size();
for (size_t itemIndex = 0; itemIndex < nbItems; ++itemIndex) for (size_t itemIndex = 0; itemIndex < nbItems; ++itemIndex)
{ {
@ -1174,7 +1174,7 @@ bool ShortcutMapper::findKeyConflicts(__inout_opt generic_string * const keyConf
} //case STATE_MENU } //case STATE_MENU
case STATE_MACRO: case STATE_MACRO:
{ {
vector<MacroShortcut> & vShortcuts = nppParam->getMacroList(); vector<MacroShortcut> & vShortcuts = nppParam.getMacroList();
size_t nbItems = vShortcuts.size(); size_t nbItems = vShortcuts.size();
for (size_t itemIndex = 0; itemIndex < nbItems; ++itemIndex) for (size_t itemIndex = 0; itemIndex < nbItems; ++itemIndex)
{ {
@ -1208,7 +1208,7 @@ bool ShortcutMapper::findKeyConflicts(__inout_opt generic_string * const keyConf
} //case STATE_MACRO } //case STATE_MACRO
case STATE_USER: case STATE_USER:
{ {
vector<UserCommand> & vShortcuts = nppParam->getUserCommandList(); vector<UserCommand> & vShortcuts = nppParam.getUserCommandList();
size_t nbItems = vShortcuts.size(); size_t nbItems = vShortcuts.size();
for (size_t itemIndex = 0; itemIndex < nbItems; ++itemIndex) for (size_t itemIndex = 0; itemIndex < nbItems; ++itemIndex)
{ {
@ -1242,7 +1242,7 @@ bool ShortcutMapper::findKeyConflicts(__inout_opt generic_string * const keyConf
} //case STATE_USER } //case STATE_USER
case STATE_PLUGIN: case STATE_PLUGIN:
{ {
vector<PluginCmdShortcut> & vShortcuts = nppParam->getPluginCommandList(); vector<PluginCmdShortcut> & vShortcuts = nppParam.getPluginCommandList();
size_t nbItems = vShortcuts.size(); size_t nbItems = vShortcuts.size();
for (size_t itemIndex = 0; itemIndex < nbItems; ++itemIndex) for (size_t itemIndex = 0; itemIndex < nbItems; ++itemIndex)
{ {
@ -1276,7 +1276,7 @@ bool ShortcutMapper::findKeyConflicts(__inout_opt generic_string * const keyConf
} //case STATE_PLUGIN } //case STATE_PLUGIN
case STATE_SCINTILLA: case STATE_SCINTILLA:
{ {
vector<ScintillaKeyMap> & vShortcuts = nppParam->getScintillaKeyList(); vector<ScintillaKeyMap> & vShortcuts = nppParam.getScintillaKeyList();
size_t nbItems = vShortcuts.size(); size_t nbItems = vShortcuts.size();
for (size_t itemIndex = 0; itemIndex < nbItems; ++itemIndex) for (size_t itemIndex = 0; itemIndex < nbItems; ++itemIndex)
{ {

View File

@ -41,7 +41,7 @@ FileDialog::FileDialog(HWND hwnd, HINSTANCE hInst)
staticThis = this; staticThis = this;
memset(_fileName, 0, sizeof(_fileName)); memset(_fileName, 0, sizeof(_fileName));
_winVersion = (NppParameters::getInstance())->getWinVersion(); _winVersion = (NppParameters::getInstance()).getWinVersion();
_ofn.lStructSize = sizeof(_ofn); _ofn.lStructSize = sizeof(_ofn);
if (_winVersion < WV_W2K) if (_winVersion < WV_W2K)
@ -162,12 +162,12 @@ TCHAR* FileDialog::doOpenSingleFileDlg()
{ {
TCHAR dir[MAX_PATH]; TCHAR dir[MAX_PATH];
::GetCurrentDirectory(MAX_PATH, dir); ::GetCurrentDirectory(MAX_PATH, dir);
NppParameters * params = NppParameters::getInstance(); NppParameters& params = NppParameters::getInstance();
_ofn.lpstrInitialDir = params->getWorkingDir(); _ofn.lpstrInitialDir = params.getWorkingDir();
_ofn.Flags |= OFN_FILEMUSTEXIST; _ofn.Flags |= OFN_FILEMUSTEXIST;
if (!params->useNewStyleSaveDlg()) if (!params.useNewStyleSaveDlg())
{ {
_ofn.Flags |= OFN_ENABLEHOOK | OFN_NOVALIDATE; _ofn.Flags |= OFN_ENABLEHOOK | OFN_NOVALIDATE;
_ofn.lpfnHook = OFNHookProc; _ofn.lpfnHook = OFNHookProc;
@ -178,10 +178,10 @@ TCHAR* FileDialog::doOpenSingleFileDlg()
{ {
fn = ::GetOpenFileName(&_ofn) ? _fileName : NULL; fn = ::GetOpenFileName(&_ofn) ? _fileName : NULL;
if (params->getNppGUI()._openSaveDir == dir_last) if (params.getNppGUI()._openSaveDir == dir_last)
{ {
::GetCurrentDirectory(MAX_PATH, dir); ::GetCurrentDirectory(MAX_PATH, dir);
params->setWorkingDir(dir); params.setWorkingDir(dir);
} }
} }
catch (std::exception& e) catch (std::exception& e)
@ -208,22 +208,22 @@ stringVector * FileDialog::doOpenMultiFilesDlg()
TCHAR dir[MAX_PATH]; TCHAR dir[MAX_PATH];
::GetCurrentDirectory(MAX_PATH, dir); ::GetCurrentDirectory(MAX_PATH, dir);
NppParameters * params = NppParameters::getInstance(); NppParameters& params = NppParameters::getInstance();
_ofn.lpstrInitialDir = params->getWorkingDir(); _ofn.lpstrInitialDir = params.getWorkingDir();
_ofn.Flags |= OFN_FILEMUSTEXIST | OFN_ALLOWMULTISELECT | OFN_ENABLESIZING; _ofn.Flags |= OFN_FILEMUSTEXIST | OFN_ALLOWMULTISELECT | OFN_ENABLESIZING;
if (!params->useNewStyleSaveDlg()) if (!params.useNewStyleSaveDlg())
{ {
_ofn.Flags |= OFN_ENABLEHOOK | OFN_NOVALIDATE; _ofn.Flags |= OFN_ENABLEHOOK | OFN_NOVALIDATE;
_ofn.lpfnHook = OFNHookProc; _ofn.lpfnHook = OFNHookProc;
} }
BOOL res = ::GetOpenFileName(&_ofn); BOOL res = ::GetOpenFileName(&_ofn);
if (params->getNppGUI()._openSaveDir == dir_last) if (params.getNppGUI()._openSaveDir == dir_last)
{ {
::GetCurrentDirectory(MAX_PATH, dir); ::GetCurrentDirectory(MAX_PATH, dir);
params->setWorkingDir(dir); params.setWorkingDir(dir);
} }
::SetCurrentDirectory(dir); ::SetCurrentDirectory(dir);
@ -265,12 +265,12 @@ TCHAR * FileDialog::doSaveDlg()
TCHAR dir[MAX_PATH]; TCHAR dir[MAX_PATH];
::GetCurrentDirectory(MAX_PATH, dir); ::GetCurrentDirectory(MAX_PATH, dir);
NppParameters * params = NppParameters::getInstance(); NppParameters& params = NppParameters::getInstance();
_ofn.lpstrInitialDir = params->getWorkingDir(); _ofn.lpstrInitialDir = params.getWorkingDir();
_ofn.Flags |= OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_ENABLESIZING; _ofn.Flags |= OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_ENABLESIZING;
if (!params->useNewStyleSaveDlg()) if (!params.useNewStyleSaveDlg())
{ {
_ofn.Flags |= OFN_ENABLEHOOK | OFN_NOVALIDATE; _ofn.Flags |= OFN_ENABLEHOOK | OFN_NOVALIDATE;
_ofn.lpfnHook = OFNHookProc; _ofn.lpfnHook = OFNHookProc;
@ -280,10 +280,10 @@ TCHAR * FileDialog::doSaveDlg()
try try
{ {
fn = ::GetSaveFileName(&_ofn) ? _fileName : NULL; fn = ::GetSaveFileName(&_ofn) ? _fileName : NULL;
if (params->getNppGUI()._openSaveDir == dir_last) if (params.getNppGUI()._openSaveDir == dir_last)
{ {
::GetCurrentDirectory(MAX_PATH, dir); ::GetCurrentDirectory(MAX_PATH, dir);
params->setWorkingDir(dir); params.setWorkingDir(dir);
} }
} }
catch (std::exception& e) catch (std::exception& e)
@ -387,8 +387,8 @@ UINT_PTR CALLBACK FileDialog::OFNHookProc(HWND hWnd, UINT uMsg, WPARAM wParam, L
{ {
case WM_INITDIALOG : case WM_INITDIALOG :
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
int index = pNppParam->getFileSaveDlgFilterIndex(); int index = nppParam.getFileSaveDlgFilterIndex();
::SetWindowLongPtr(hWnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(staticThis)); ::SetWindowLongPtr(hWnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(staticThis));
hFileDlg = ::GetParent(hWnd); hFileDlg = ::GetParent(hWnd);
@ -453,8 +453,8 @@ BOOL APIENTRY FileDialog::run(HWND hWnd, UINT uMsg, WPARAM, LPARAM lParam)
{ {
HWND typeControl = ::GetDlgItem(::GetParent(hWnd), cmb1); HWND typeControl = ::GetDlgItem(::GetParent(hWnd), cmb1);
int index = static_cast<int32_t>(::SendMessage(typeControl, CB_GETCURSEL, 0, 0)); int index = static_cast<int32_t>(::SendMessage(typeControl, CB_GETCURSEL, 0, 0));
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
pNppParam->setFileSaveDlgFilterIndex(index); nppParam.setFileSaveDlgFilterIndex(index);
// change forward-slash to back-slash directory paths so dialog can interpret // change forward-slash to back-slash directory paths so dialog can interpret
OPENFILENAME* ofn = reinterpret_cast<LPOFNOTIFY>(lParam)->lpOFN; OPENFILENAME* ofn = reinterpret_cast<LPOFNOTIFY>(lParam)->lpOFN;

View File

@ -270,7 +270,7 @@ void PluginsAdminDlg::create(int dialogID, bool isRTL, bool msgDestParent)
RECT rect; RECT rect;
getClientRect(rect); getClientRect(rect);
_tab.init(_hInst, _hSelf, false, true); _tab.init(_hInst, _hSelf, false, true);
int tabDpiDynamicalHeight = NppParameters::getInstance()->_dpiManager.scaleY(13); int tabDpiDynamicalHeight = NppParameters::getInstance()._dpiManager.scaleY(13);
_tab.setFont(TEXT("Tahoma"), tabDpiDynamicalHeight); _tab.setFont(TEXT("Tahoma"), tabDpiDynamicalHeight);
const TCHAR *available = TEXT("Available"); const TCHAR *available = TEXT("Available");
@ -350,31 +350,31 @@ void PluginsAdminDlg::create(int dialogID, bool isRTL, bool msgDestParent)
descRect.left += marge; descRect.left += marge;
descRect.right -= marge * 2; descRect.right -= marge * 2;
NppParameters *nppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
NativeLangSpeaker *pNativeSpeaker = nppParam->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = nppParam.getNativeLangSpeaker();
generic_string pluginStr = pNativeSpeaker->getAttrNameStr(TEXT("Plugin"), "PluginAdmin", "Plugin"); generic_string pluginStr = pNativeSpeaker->getAttrNameStr(TEXT("Plugin"), "PluginAdmin", "Plugin");
generic_string vesionStr = pNativeSpeaker->getAttrNameStr(TEXT("Version"), "PluginAdmin", "Version"); generic_string vesionStr = pNativeSpeaker->getAttrNameStr(TEXT("Version"), "PluginAdmin", "Version");
//generic_string stabilityStr = pNativeSpeaker->getAttrNameStr(TEXT("Stability"), "PluginAdmin", "Stability"); //generic_string stabilityStr = pNativeSpeaker->getAttrNameStr(TEXT("Stability"), "PluginAdmin", "Stability");
_availableList.addColumn(columnInfo(pluginStr, nppParam->_dpiManager.scaleX(200))); _availableList.addColumn(columnInfo(pluginStr, nppParam._dpiManager.scaleX(200)));
_availableList.addColumn(columnInfo(vesionStr, nppParam->_dpiManager.scaleX(100))); _availableList.addColumn(columnInfo(vesionStr, nppParam._dpiManager.scaleX(100)));
//_availableList.addColumn(columnInfo(stabilityStr, nppParam->_dpiManager.scaleX(70))); //_availableList.addColumn(columnInfo(stabilityStr, nppParam._dpiManager.scaleX(70)));
_availableList.setViewStyleOption(LVS_EX_CHECKBOXES); _availableList.setViewStyleOption(LVS_EX_CHECKBOXES);
_availableList.initView(_hInst, _hSelf); _availableList.initView(_hInst, _hSelf);
_availableList.reSizeView(listRect); _availableList.reSizeView(listRect);
_updateList.addColumn(columnInfo(pluginStr, nppParam->_dpiManager.scaleX(200))); _updateList.addColumn(columnInfo(pluginStr, nppParam._dpiManager.scaleX(200)));
_updateList.addColumn(columnInfo(vesionStr, nppParam->_dpiManager.scaleX(100))); _updateList.addColumn(columnInfo(vesionStr, nppParam._dpiManager.scaleX(100)));
//_updateList.addColumn(columnInfo(stabilityStr, nppParam->_dpiManager.scaleX(70))); //_updateList.addColumn(columnInfo(stabilityStr, nppParam._dpiManager.scaleX(70)));
_updateList.setViewStyleOption(LVS_EX_CHECKBOXES); _updateList.setViewStyleOption(LVS_EX_CHECKBOXES);
_updateList.initView(_hInst, _hSelf); _updateList.initView(_hInst, _hSelf);
_updateList.reSizeView(listRect); _updateList.reSizeView(listRect);
_installedList.addColumn(columnInfo(pluginStr, nppParam->_dpiManager.scaleX(200))); _installedList.addColumn(columnInfo(pluginStr, nppParam._dpiManager.scaleX(200)));
_installedList.addColumn(columnInfo(vesionStr, nppParam->_dpiManager.scaleX(100))); _installedList.addColumn(columnInfo(vesionStr, nppParam._dpiManager.scaleX(100)));
//_installedList.addColumn(columnInfo(stabilityStr, nppParam->_dpiManager.scaleX(70))); //_installedList.addColumn(columnInfo(stabilityStr, nppParam._dpiManager.scaleX(70)));
_installedList.setViewStyleOption(LVS_EX_CHECKBOXES); _installedList.setViewStyleOption(LVS_EX_CHECKBOXES);
_installedList.initView(_hInst, _hSelf); _installedList.initView(_hInst, _hSelf);
@ -395,11 +395,11 @@ void PluginsAdminDlg::create(int dialogID, bool isRTL, bool msgDestParent)
void PluginsAdminDlg::collectNppCurrentStatusInfos() void PluginsAdminDlg::collectNppCurrentStatusInfos()
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
_nppCurrentStatus._nppInstallPath = pNppParam->getNppPath(); _nppCurrentStatus._nppInstallPath = nppParam.getNppPath();
_nppCurrentStatus._isAppDataPluginsAllowed = ::SendMessage(_hParent, NPPM_GETAPPDATAPLUGINSALLOWED, 0, 0) == TRUE; _nppCurrentStatus._isAppDataPluginsAllowed = ::SendMessage(_hParent, NPPM_GETAPPDATAPLUGINSALLOWED, 0, 0) == TRUE;
_nppCurrentStatus._appdataPath = pNppParam->getAppDataNppDir(); _nppCurrentStatus._appdataPath = nppParam.getAppDataNppDir();
generic_string programFilesPath = NppParameters::getSpecialFolderLocation(CSIDL_PROGRAM_FILES); generic_string programFilesPath = NppParameters::getSpecialFolderLocation(CSIDL_PROGRAM_FILES);
_nppCurrentStatus._isInProgramFiles = (_nppCurrentStatus._nppInstallPath.find(programFilesPath) == 0); _nppCurrentStatus._isInProgramFiles = (_nppCurrentStatus._nppInstallPath.find(programFilesPath) == 0);
@ -423,14 +423,14 @@ vector<PluginUpdateInfo*> PluginViewList::fromUiIndexesToPluginInfos(const std::
PluginsAdminDlg::PluginsAdminDlg() PluginsAdminDlg::PluginsAdminDlg()
{ {
// Get wingup path // Get wingup path
NppParameters *pNppParameters = NppParameters::getInstance(); NppParameters& nppParameters = NppParameters::getInstance();
_updaterDir = pNppParameters->getNppPath(); _updaterDir = nppParameters.getNppPath();
PathAppend(_updaterDir, TEXT("updater")); PathAppend(_updaterDir, TEXT("updater"));
_updaterFullPath = _updaterDir; _updaterFullPath = _updaterDir;
PathAppend(_updaterFullPath, TEXT("gup.exe")); PathAppend(_updaterFullPath, TEXT("gup.exe"));
// get plugin-list path // get plugin-list path
_pluginListFullPath = pNppParameters->getPluginConfDir(); _pluginListFullPath = nppParameters.getPluginConfDir();
#ifdef DEBUG // if not debug, then it's release #ifdef DEBUG // if not debug, then it's release
// load from nppPluginList.json instead of nppPluginList.dll // load from nppPluginList.json instead of nppPluginList.dll
@ -452,8 +452,8 @@ bool PluginsAdminDlg::exitToInstallRemovePlugins(Operation op, const vector<Plug
else else
return false; return false;
NppParameters *pNppParameters = NppParameters::getInstance(); NppParameters& nppParameters = NppParameters::getInstance();
generic_string updaterDir = pNppParameters->getNppPath(); generic_string updaterDir = nppParameters.getNppPath();
updaterDir += TEXT("\\updater\\"); updaterDir += TEXT("\\updater\\");
generic_string updaterFullPath = updaterDir + TEXT("gup.exe"); generic_string updaterFullPath = updaterDir + TEXT("gup.exe");
@ -467,7 +467,7 @@ bool PluginsAdminDlg::exitToInstallRemovePlugins(Operation op, const vector<Plug
updaterParams += TEXT("\" "); updaterParams += TEXT("\" ");
updaterParams += TEXT("\""); updaterParams += TEXT("\"");
updaterParams += pNppParameters->getPluginRootDir(); updaterParams += nppParameters.getPluginRootDir();
updaterParams += TEXT("\""); updaterParams += TEXT("\"");
for (auto i : puis) for (auto i : puis)
@ -503,7 +503,7 @@ bool PluginsAdminDlg::exitToInstallRemovePlugins(Operation op, const vector<Plug
} }
// Ask user's confirmation // Ask user's confirmation
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = nppParameters.getNativeLangSpeaker();
auto res = pNativeSpeaker->messageBox("ExitToUpdatePlugins", auto res = pNativeSpeaker->messageBox("ExitToUpdatePlugins",
_hSelf, _hSelf,
TEXT("If you click YES, you will quit Notepad++ to continue the operations.\nNotepad++ will be restarted after all the operations are terminated.\nContinue?"), TEXT("If you click YES, you will quit Notepad++ to continue the operations.\nNotepad++ will be restarted after all the operations are terminated.\nContinue?"),
@ -512,19 +512,19 @@ bool PluginsAdminDlg::exitToInstallRemovePlugins(Operation op, const vector<Plug
if (res == IDYES) if (res == IDYES)
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
// gup path: makes trigger ready // gup path: makes trigger ready
pNppParam->setWingupFullPath(updaterFullPath); nppParam.setWingupFullPath(updaterFullPath);
// op: -clean or "-clean -unzip" // op: -clean or "-clean -unzip"
// application path: Notepad++ path to be relaunched // application path: Notepad++ path to be relaunched
// plugin global path // plugin global path
// plugin names or "plugin names + download url" // plugin names or "plugin names + download url"
pNppParam->setWingupParams(updaterParams); nppParam.setWingupParams(updaterParams);
// gup folder path // gup folder path
pNppParam->setWingupDir(updaterDir); nppParam.setWingupDir(updaterDir);
// Quite Notepad++ so just before quitting Notepad++ launches gup with needed arguments // Quite Notepad++ so just before quitting Notepad++ launches gup with needed arguments
::PostMessage(_hParent, WM_COMMAND, IDM_FILE_EXIT, 0); ::PostMessage(_hParent, WM_COMMAND, IDM_FILE_EXIT, 0);
@ -700,7 +700,7 @@ typedef const char * (__cdecl * PFUNCGETPLUGINLIST)();
bool PluginsAdminDlg::isValide() bool PluginsAdminDlg::isValide()
{ {
// GUP.exe doesn't work under XP // GUP.exe doesn't work under XP
winVer winVersion = (NppParameters::getInstance())->getWinVersion(); winVer winVersion = (NppParameters::getInstance()).getWinVersion();
if (winVersion <= WV_XP) if (winVersion <= WV_XP)
{ {
return false; return false;

View File

@ -174,9 +174,9 @@ INT_PTR CALLBACK PreferenceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
RECT rc; RECT rc;
getClientRect(rc); getClientRect(rc);
rc.top += NppParameters::getInstance()->_dpiManager.scaleY(10); rc.top += NppParameters::getInstance()._dpiManager.scaleY(10);
rc.bottom -= NppParameters::getInstance()->_dpiManager.scaleY(50); rc.bottom -= NppParameters::getInstance()._dpiManager.scaleY(50);
rc.left += NppParameters::getInstance()->_dpiManager.scaleX(150); rc.left += NppParameters::getInstance()._dpiManager.scaleX(150);
_barsDlg.reSizeTo(rc); _barsDlg.reSizeTo(rc);
_marginsDlg.reSizeTo(rc); _marginsDlg.reSizeTo(rc);
@ -195,8 +195,8 @@ INT_PTR CALLBACK PreferenceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
_settingsOnCloudDlg.reSizeTo(rc); _settingsOnCloudDlg.reSizeTo(rc);
_searchEngineDlg.reSizeTo(rc); _searchEngineDlg.reSizeTo(rc);
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
ETDTProc enableDlgTheme = (ETDTProc)pNppParam->getEnableThemeDlgTexture(); ETDTProc enableDlgTheme = (ETDTProc)nppParam.getEnableThemeDlgTexture();
if (enableDlgTheme) if (enableDlgTheme)
enableDlgTheme(_hSelf, ETDT_ENABLETAB); enableDlgTheme(_hSelf, ETDT_ENABLETAB);
@ -347,13 +347,13 @@ void PreferenceDlg::destroy()
INT_PTR CALLBACK BarsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) INT_PTR CALLBACK BarsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
switch (message) switch (message)
{ {
case WM_INITDIALOG : case WM_INITDIALOG :
{ {
const NppGUI & nppGUI = pNppParam->getNppGUI(); const NppGUI & nppGUI = nppParam.getNppGUI();
toolBarStatusType tbStatus = nppGUI._toolBarStatus; toolBarStatusType tbStatus = nppGUI._toolBarStatus;
int tabBarStatus = nppGUI._tabStatus; int tabBarStatus = nppGUI._tabStatus;
bool showTool = nppGUI._toolbarShow; bool showTool = nppGUI._toolbarShow;
@ -395,7 +395,7 @@ INT_PTR CALLBACK BarsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
::SendDlgItemMessage(_hSelf, IDC_CHECK_DOCSWITCH, BM_SETCHECK, showDocSwitcher, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_DOCSWITCH, BM_SETCHECK, showDocSwitcher, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_DOCSWITCH_NOEXTCOLUMN, BM_SETCHECK, nppGUI._fileSwitcherWithoutExtColumn, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_DOCSWITCH_NOEXTCOLUMN, BM_SETCHECK, nppGUI._fileSwitcherWithoutExtColumn, 0);
LocalizationSwitcher & localizationSwitcher = pNppParam->getLocalizationSwitcher(); LocalizationSwitcher & localizationSwitcher = nppParam.getLocalizationSwitcher();
for (size_t i = 0, len = localizationSwitcher.size(); i < len ; ++i) for (size_t i = 0, len = localizationSwitcher.size(); i < len ; ++i)
{ {
@ -403,7 +403,7 @@ INT_PTR CALLBACK BarsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(localizationInfo.first.c_str())); ::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(localizationInfo.first.c_str()));
} }
wstring lang = TEXT("English"); // Set default language as Englishs wstring lang = TEXT("English"); // Set default language as Englishs
if (pNppParam->getNativeLangA()) // if nativeLangA is not NULL, then we can be sure the default language (English) is not used if (nppParam.getNativeLangA()) // if nativeLangA is not NULL, then we can be sure the default language (English) is not used
{ {
string fn = localizationSwitcher.getFileName(); string fn = localizationSwitcher.getFileName();
wstring fnW = s2ws(fn); wstring fnW = s2ws(fn);
@ -413,7 +413,7 @@ INT_PTR CALLBACK BarsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
if (index != CB_ERR) if (index != CB_ERR)
::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_SETCURSEL, index, 0); ::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_SETCURSEL, index, 0);
ETDTProc enableDlgTheme = reinterpret_cast<ETDTProc>(pNppParam->getEnableThemeDlgTexture()); ETDTProc enableDlgTheme = reinterpret_cast<ETDTProc>(nppParam.getEnableThemeDlgTexture());
if (enableDlgTheme) if (enableDlgTheme)
enableDlgTheme(_hSelf, ETDT_ENABLETAB); enableDlgTheme(_hSelf, ETDT_ENABLETAB);
@ -479,7 +479,7 @@ INT_PTR CALLBACK BarsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
case IDC_CHECK_TAB_LAST_EXIT: case IDC_CHECK_TAB_LAST_EXIT:
{ {
NppGUI & nppGUI = const_cast<NppGUI &>(pNppParam->getNppGUI()); NppGUI & nppGUI = const_cast<NppGUI &>(nppParam.getNppGUI());
nppGUI._tabStatus ^= TAB_QUITONEMPTY; nppGUI._tabStatus ^= TAB_QUITONEMPTY;
} }
return TRUE; return TRUE;
@ -537,7 +537,7 @@ INT_PTR CALLBACK BarsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
{ {
case IDC_COMBO_LOCALIZATION : case IDC_COMBO_LOCALIZATION :
{ {
LocalizationSwitcher & localizationSwitcher = pNppParam->getLocalizationSwitcher(); LocalizationSwitcher & localizationSwitcher = nppParam.getLocalizationSwitcher();
auto index = ::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_GETCURSEL, 0, 0); auto index = ::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_GETCURSEL, 0, 0);
TCHAR langName[MAX_PATH]; TCHAR langName[MAX_PATH];
auto cbTextLen = ::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_GETLBTEXTLEN, index, 0); auto cbTextLen = ::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_GETLBTEXTLEN, index, 0);
@ -575,8 +575,8 @@ INT_PTR CALLBACK BarsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
void MarginsDlg::initScintParam() void MarginsDlg::initScintParam()
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
const ScintillaViewParams & svp = pNppParam->getSVP(); const ScintillaViewParams & svp = nppParam.getSVP();
::SendDlgItemMessage(_hSelf, IDC_RADIO_BOX, BM_SETCHECK, FALSE, 0); ::SendDlgItemMessage(_hSelf, IDC_RADIO_BOX, BM_SETCHECK, FALSE, 0);
::SendDlgItemMessage(_hSelf, IDC_RADIO_CIRCLE, BM_SETCHECK, FALSE, 0); ::SendDlgItemMessage(_hSelf, IDC_RADIO_CIRCLE, BM_SETCHECK, FALSE, 0);
@ -642,8 +642,8 @@ void MarginsDlg::initScintParam()
INT_PTR CALLBACK MarginsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) INT_PTR CALLBACK MarginsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
NppGUI & nppGUI = const_cast<NppGUI &>(pNppParam->getNppGUI()); NppGUI & nppGUI = const_cast<NppGUI &>(nppParam.getNppGUI());
switch (message) switch (message)
{ {
case WM_INITDIALOG : case WM_INITDIALOG :
@ -670,13 +670,13 @@ INT_PTR CALLBACK MarginsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPa
::SendMessage(::GetDlgItem(_hSelf, IDC_BORDERWIDTH_SLIDER),TBM_SETRANGEMIN, TRUE, BORDERWIDTH_SMALLEST); ::SendMessage(::GetDlgItem(_hSelf, IDC_BORDERWIDTH_SLIDER),TBM_SETRANGEMIN, TRUE, BORDERWIDTH_SMALLEST);
::SendMessage(::GetDlgItem(_hSelf, IDC_BORDERWIDTH_SLIDER),TBM_SETRANGEMAX, TRUE, BORDERWIDTH_LARGEST); ::SendMessage(::GetDlgItem(_hSelf, IDC_BORDERWIDTH_SLIDER),TBM_SETRANGEMAX, TRUE, BORDERWIDTH_LARGEST);
::SendMessage(::GetDlgItem(_hSelf, IDC_BORDERWIDTH_SLIDER),TBM_SETPAGESIZE, 0, BLINKRATE_INTERVAL); ::SendMessage(::GetDlgItem(_hSelf, IDC_BORDERWIDTH_SLIDER),TBM_SETPAGESIZE, 0, BLINKRATE_INTERVAL);
const ScintillaViewParams & svp = pNppParam->getSVP(); const ScintillaViewParams & svp = nppParam.getSVP();
::SendMessage(::GetDlgItem(_hSelf, IDC_BORDERWIDTH_SLIDER),TBM_SETPOS, TRUE, svp._borderWidth); ::SendMessage(::GetDlgItem(_hSelf, IDC_BORDERWIDTH_SLIDER),TBM_SETPOS, TRUE, svp._borderWidth);
::SetDlgItemInt(_hSelf, IDC_BORDERWIDTHVAL_STATIC, svp._borderWidth, FALSE); ::SetDlgItemInt(_hSelf, IDC_BORDERWIDTHVAL_STATIC, svp._borderWidth, FALSE);
initScintParam(); initScintParam();
ETDTProc enableDlgTheme = (ETDTProc)pNppParam->getEnableThemeDlgTexture(); ETDTProc enableDlgTheme = (ETDTProc)nppParam.getEnableThemeDlgTexture();
if (enableDlgTheme) if (enableDlgTheme)
enableDlgTheme(_hSelf, ETDT_ENABLETAB); enableDlgTheme(_hSelf, ETDT_ENABLETAB);
return TRUE; return TRUE;
@ -698,7 +698,7 @@ INT_PTR CALLBACK MarginsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPa
else if (reinterpret_cast<HWND>(lParam) == hBorderWidthSlider) else if (reinterpret_cast<HWND>(lParam) == hBorderWidthSlider)
{ {
auto borderWidth = ::SendMessage(hBorderWidthSlider, TBM_GETPOS, 0, 0); auto borderWidth = ::SendMessage(hBorderWidthSlider, TBM_GETPOS, 0, 0);
ScintillaViewParams & svp = (ScintillaViewParams &)pNppParam->getSVP(); ScintillaViewParams & svp = (ScintillaViewParams &)nppParam.getSVP();
svp._borderWidth = static_cast<int>(borderWidth); svp._borderWidth = static_cast<int>(borderWidth);
::SetDlgItemInt(_hSelf, IDC_BORDERWIDTHVAL_STATIC, static_cast<UINT>(borderWidth), FALSE); ::SetDlgItemInt(_hSelf, IDC_BORDERWIDTHVAL_STATIC, static_cast<UINT>(borderWidth), FALSE);
::SendMessage(::GetParent(_hParent), WM_SIZE, 0, 0); ::SendMessage(::GetParent(_hParent), WM_SIZE, 0, 0);
@ -708,7 +708,7 @@ INT_PTR CALLBACK MarginsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPa
case WM_COMMAND : case WM_COMMAND :
{ {
ScintillaViewParams & svp = (ScintillaViewParams &)pNppParam->getSVP(); ScintillaViewParams & svp = (ScintillaViewParams &)nppParam.getSVP();
switch (wParam) switch (wParam)
{ {
case IDC_CHECK_SMOOTHFONT: case IDC_CHECK_SMOOTHFONT:
@ -808,7 +808,7 @@ INT_PTR CALLBACK MarginsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPa
case IDC_COLONENUMBER_STATIC: case IDC_COLONENUMBER_STATIC:
{ {
NativeLangSpeaker *pNativeSpeaker = pNppParam->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = nppParam.getNativeLangSpeaker();
generic_string strNbCol = pNativeSpeaker->getLocalizedStrFromID("edit-verticaledge-nb-col", TEXT("Nb of column:")); generic_string strNbCol = pNativeSpeaker->getLocalizedStrFromID("edit-verticaledge-nb-col", TEXT("Nb of column:"));
ValueDlg nbColumnEdgeDlg; ValueDlg nbColumnEdgeDlg;
@ -874,8 +874,8 @@ const size_t fileUpdateChoiceEnable4All = 1;
const size_t fileUpdateChoiceDisable = 2; const size_t fileUpdateChoiceDisable = 2;
INT_PTR CALLBACK SettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) INT_PTR CALLBACK SettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
NppGUI & nppGUI = const_cast<NppGUI &>(pNppParam->getNppGUI()); NppGUI & nppGUI = const_cast<NppGUI &>(nppParam.getNppGUI());
switch (message) switch (message)
{ {
case WM_INITDIALOG : case WM_INITDIALOG :
@ -948,7 +948,7 @@ INT_PTR CALLBACK SettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
::SendDlgItemMessage(_hSelf, IDC_CHECK_STYLEMRU, BM_SETCHECK, nppGUI._styleMRU, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_STYLEMRU, BM_SETCHECK, nppGUI._styleMRU, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_SHORTTITLE, BM_SETCHECK, nppGUI._shortTitlebar, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_SHORTTITLE, BM_SETCHECK, nppGUI._shortTitlebar, 0);
ETDTProc enableDlgTheme = (ETDTProc)pNppParam->getEnableThemeDlgTexture(); ETDTProc enableDlgTheme = (ETDTProc)nppParam.getEnableThemeDlgTexture();
if (enableDlgTheme) if (enableDlgTheme)
enableDlgTheme(_hSelf, ETDT_ENABLETAB); enableDlgTheme(_hSelf, ETDT_ENABLETAB);
@ -1148,8 +1148,8 @@ void RecentFilesHistoryDlg::setCustomLen(int val)
INT_PTR CALLBACK DefaultNewDocDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) INT_PTR CALLBACK DefaultNewDocDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
NppGUI & nppGUI = (NppGUI & )pNppParam->getNppGUI(); NppGUI & nppGUI = (NppGUI & )nppParam.getNppGUI();
NewDocDefaultSettings & ndds = (NewDocDefaultSettings &)nppGUI.getNewDocDefaultSettings(); NewDocDefaultSettings & ndds = (NewDocDefaultSettings &)nppGUI.getNewDocDefaultSettings();
switch (message) switch (message)
@ -1225,12 +1225,12 @@ INT_PTR CALLBACK DefaultNewDocDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_OPENANSIASUTF8), ID2Check == IDC_RADIO_UTF8SANSBOM); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_OPENANSIASUTF8), ID2Check == IDC_RADIO_UTF8SANSBOM);
size_t index = 0; size_t index = 0;
for (int i = L_TEXT ; i < pNppParam->L_END ; ++i) for (int i = L_TEXT ; i < nppParam.L_END ; ++i)
{ {
str.clear(); str.clear();
if (static_cast<LangType>(i) != L_USER) if (static_cast<LangType>(i) != L_USER)
{ {
int cmdID = pNppParam->langTypeToCommandID(static_cast<LangType>(i)); int cmdID = nppParam.langTypeToCommandID(static_cast<LangType>(i));
if ((cmdID != -1)) if ((cmdID != -1))
{ {
getNameStrFromCmd(cmdID, str); getNameStrFromCmd(cmdID, str);
@ -1249,7 +1249,7 @@ INT_PTR CALLBACK DefaultNewDocDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
// //
// To avoid the white control background to be displayed in dialog // To avoid the white control background to be displayed in dialog
// //
ETDTProc enableDlgTheme = (ETDTProc)pNppParam->getEnableThemeDlgTexture(); ETDTProc enableDlgTheme = (ETDTProc)nppParam.getEnableThemeDlgTexture();
if (enableDlgTheme) if (enableDlgTheme)
enableDlgTheme(_hSelf, ETDT_ENABLETAB); enableDlgTheme(_hSelf, ETDT_ENABLETAB);
} }
@ -1348,8 +1348,8 @@ INT_PTR CALLBACK DefaultNewDocDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
INT_PTR CALLBACK DefaultDirectoryDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) INT_PTR CALLBACK DefaultDirectoryDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
NppGUI & nppGUI = (NppGUI & )pNppParam->getNppGUI(); NppGUI & nppGUI = (NppGUI & )nppParam.getNppGUI();
switch (message) switch (message)
{ {
@ -1380,7 +1380,7 @@ INT_PTR CALLBACK DefaultDirectoryDlg::run_dlgProc(UINT message, WPARAM wParam, L
// //
// To avoid the white control background to be displayed in dialog // To avoid the white control background to be displayed in dialog
// //
ETDTProc enableDlgTheme = (ETDTProc)pNppParam->getEnableThemeDlgTexture(); ETDTProc enableDlgTheme = (ETDTProc)nppParam.getEnableThemeDlgTexture();
if (enableDlgTheme) if (enableDlgTheme)
enableDlgTheme(_hSelf, ETDT_ENABLETAB); enableDlgTheme(_hSelf, ETDT_ENABLETAB);
@ -1400,7 +1400,7 @@ INT_PTR CALLBACK DefaultDirectoryDlg::run_dlgProc(UINT message, WPARAM wParam, L
::SendDlgItemMessage(_hSelf, IDC_OPENSAVEDIR_ALWAYSON_EDIT, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(inputDir)); ::SendDlgItemMessage(_hSelf, IDC_OPENSAVEDIR_ALWAYSON_EDIT, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(inputDir));
wcscpy_s(nppGUI._defaultDir, inputDir); wcscpy_s(nppGUI._defaultDir, inputDir);
::ExpandEnvironmentStrings(nppGUI._defaultDir, nppGUI._defaultDirExp, _countof(nppGUI._defaultDirExp)); ::ExpandEnvironmentStrings(nppGUI._defaultDir, nppGUI._defaultDirExp, _countof(nppGUI._defaultDirExp));
pNppParam->setWorkingDir(nppGUI._defaultDirExp); nppParam.setWorkingDir(nppGUI._defaultDirExp);
return TRUE; return TRUE;
} }
} }
@ -1446,16 +1446,16 @@ INT_PTR CALLBACK DefaultDirectoryDlg::run_dlgProc(UINT message, WPARAM wParam, L
INT_PTR CALLBACK RecentFilesHistoryDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) INT_PTR CALLBACK RecentFilesHistoryDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
NppGUI & nppGUI = (NppGUI & )pNppParam->getNppGUI(); NppGUI & nppGUI = (NppGUI & )nppParam.getNppGUI();
NativeLangSpeaker *pNativeSpeaker = pNppParam->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = nppParam.getNativeLangSpeaker();
switch (message) switch (message)
{ {
case WM_INITDIALOG : case WM_INITDIALOG :
{ {
// Max number recent file setting // Max number recent file setting
::SetDlgItemInt(_hSelf, IDC_MAXNBFILEVAL_STATIC, pNppParam->getNbMaxRecentFile(), FALSE); ::SetDlgItemInt(_hSelf, IDC_MAXNBFILEVAL_STATIC, nppParam.getNbMaxRecentFile(), FALSE);
_nbHistoryVal.init(_hInst, _hSelf); _nbHistoryVal.init(_hInst, _hSelf);
_nbHistoryVal.create(::GetDlgItem(_hSelf, IDC_MAXNBFILEVAL_STATIC), IDC_MAXNBFILEVAL_STATIC); _nbHistoryVal.create(::GetDlgItem(_hSelf, IDC_MAXNBFILEVAL_STATIC), IDC_MAXNBFILEVAL_STATIC);
@ -1463,10 +1463,10 @@ INT_PTR CALLBACK RecentFilesHistoryDlg::run_dlgProc(UINT message, WPARAM wParam,
::SendDlgItemMessage(_hSelf, IDC_CHECK_DONTCHECKHISTORY, BM_SETCHECK, !nppGUI._checkHistoryFiles, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_DONTCHECKHISTORY, BM_SETCHECK, !nppGUI._checkHistoryFiles, 0);
// Display in submenu setting // Display in submenu setting
::SendDlgItemMessage(_hSelf, IDC_CHECK_INSUBMENU, BM_SETCHECK, pNppParam->putRecentFileInSubMenu(), 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_INSUBMENU, BM_SETCHECK, nppParam.putRecentFileInSubMenu(), 0);
// Recent File menu entry length setting // Recent File menu entry length setting
int customLength = pNppParam->getRecentFileCustomLength(); int customLength = nppParam.getRecentFileCustomLength();
int id = IDC_RADIO_CUSTOMIZELENTH; int id = IDC_RADIO_CUSTOMIZELENTH;
int length = customLength; int length = customLength;
@ -1491,7 +1491,7 @@ INT_PTR CALLBACK RecentFilesHistoryDlg::run_dlgProc(UINT message, WPARAM wParam,
// //
// To avoid the white control background to be displayed in dialog // To avoid the white control background to be displayed in dialog
// //
ETDTProc enableDlgTheme = (ETDTProc)pNppParam->getEnableThemeDlgTexture(); ETDTProc enableDlgTheme = (ETDTProc)nppParam.getEnableThemeDlgTexture();
if (enableDlgTheme) if (enableDlgTheme)
enableDlgTheme(_hSelf, ETDT_ENABLETAB); enableDlgTheme(_hSelf, ETDT_ENABLETAB);
} }
@ -1508,7 +1508,7 @@ INT_PTR CALLBACK RecentFilesHistoryDlg::run_dlgProc(UINT message, WPARAM wParam,
{ {
generic_string staticText = pNativeSpeaker->getLocalizedStrFromID("recent-file-history-maxfile", TEXT("Max File: ")); generic_string staticText = pNativeSpeaker->getLocalizedStrFromID("recent-file-history-maxfile", TEXT("Max File: "));
ValueDlg nbFileMaxDlg; ValueDlg nbFileMaxDlg;
nbFileMaxDlg.init(NULL, _hSelf, pNppParam->getNbMaxRecentFile(), staticText.c_str()); nbFileMaxDlg.init(NULL, _hSelf, nppParam.getNbMaxRecentFile(), staticText.c_str());
POINT p; POINT p;
::GetCursorPos(&p); ::GetCursorPos(&p);
@ -1519,7 +1519,7 @@ INT_PTR CALLBACK RecentFilesHistoryDlg::run_dlgProc(UINT message, WPARAM wParam,
if (nbMaxFile > NB_MAX_LRF_FILE) if (nbMaxFile > NB_MAX_LRF_FILE)
nbMaxFile = NB_MAX_LRF_FILE; nbMaxFile = NB_MAX_LRF_FILE;
pNppParam->setNbMaxRecentFile(nbMaxFile); nppParam.setNbMaxRecentFile(nbMaxFile);
::SetDlgItemInt(_hSelf, IDC_MAXNBFILEVAL_STATIC, nbMaxFile, FALSE); ::SetDlgItemInt(_hSelf, IDC_MAXNBFILEVAL_STATIC, nbMaxFile, FALSE);
// Validate modified value // Validate modified value
@ -1529,27 +1529,27 @@ INT_PTR CALLBACK RecentFilesHistoryDlg::run_dlgProc(UINT message, WPARAM wParam,
} }
case IDC_CHECK_INSUBMENU: case IDC_CHECK_INSUBMENU:
pNppParam->setPutRecentFileInSubMenu(isCheckedOrNot(IDC_CHECK_INSUBMENU)); nppParam.setPutRecentFileInSubMenu(isCheckedOrNot(IDC_CHECK_INSUBMENU));
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_RECENTFILELIST_SWITCH, 0, 0); ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_RECENTFILELIST_SWITCH, 0, 0);
return TRUE; return TRUE;
case IDC_RADIO_ONLYFILENAME: case IDC_RADIO_ONLYFILENAME:
setCustomLen(0); setCustomLen(0);
pNppParam->setRecentFileCustomLength(0); nppParam.setRecentFileCustomLength(0);
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_RECENTFILELIST_UPDATE, 0, 0); ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_RECENTFILELIST_UPDATE, 0, 0);
return TRUE; return TRUE;
case IDC_RADIO_FULLFILENAMEPATH: case IDC_RADIO_FULLFILENAMEPATH:
setCustomLen(0); setCustomLen(0);
pNppParam->setRecentFileCustomLength(-1); nppParam.setRecentFileCustomLength(-1);
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_RECENTFILELIST_UPDATE, 0, 0); ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_RECENTFILELIST_UPDATE, 0, 0);
return TRUE; return TRUE;
case IDC_RADIO_CUSTOMIZELENTH: case IDC_RADIO_CUSTOMIZELENTH:
{ {
int len = pNppParam->getRecentFileCustomLength(); int len = nppParam.getRecentFileCustomLength();
if (len <= 0) if (len <= 0)
{ {
setCustomLen(100); setCustomLen(100);
pNppParam->setRecentFileCustomLength(100); nppParam.setRecentFileCustomLength(100);
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_RECENTFILELIST_UPDATE, 0, 0); ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_RECENTFILELIST_UPDATE, 0, 0);
} }
return TRUE; return TRUE;
@ -1558,7 +1558,7 @@ INT_PTR CALLBACK RecentFilesHistoryDlg::run_dlgProc(UINT message, WPARAM wParam,
case IDC_CUSTOMIZELENGTHVAL_STATIC: case IDC_CUSTOMIZELENGTHVAL_STATIC:
{ {
ValueDlg customLengthDlg; ValueDlg customLengthDlg;
customLengthDlg.init(NULL, _hSelf, pNppParam->getRecentFileCustomLength(), TEXT("Length: ")); customLengthDlg.init(NULL, _hSelf, nppParam.getRecentFileCustomLength(), TEXT("Length: "));
customLengthDlg.setNBNumber(3); customLengthDlg.setNBNumber(3);
POINT p; POINT p;
@ -1568,7 +1568,7 @@ INT_PTR CALLBACK RecentFilesHistoryDlg::run_dlgProc(UINT message, WPARAM wParam,
if (size != -1) if (size != -1)
{ {
::SetDlgItemInt(_hSelf, IDC_CUSTOMIZELENGTHVAL_STATIC, size, FALSE); ::SetDlgItemInt(_hSelf, IDC_CUSTOMIZELENGTHVAL_STATIC, size, FALSE);
pNppParam->setRecentFileCustomLength(size); nppParam.setRecentFileCustomLength(size);
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_RECENTFILELIST_UPDATE, 0, 0); ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_RECENTFILELIST_UPDATE, 0, 0);
} }
return TRUE; return TRUE;
@ -1583,9 +1583,9 @@ INT_PTR CALLBACK RecentFilesHistoryDlg::run_dlgProc(UINT message, WPARAM wParam,
INT_PTR CALLBACK LangMenuDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) INT_PTR CALLBACK LangMenuDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
NppGUI & nppGUI = const_cast<NppGUI &>(pNppParam->getNppGUI()); NppGUI & nppGUI = const_cast<NppGUI &>(nppParam.getNppGUI());
NativeLangSpeaker *pNativeSpeaker = pNppParam->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = nppParam.getNativeLangSpeaker();
switch (message) switch (message)
{ {
@ -1594,12 +1594,12 @@ INT_PTR CALLBACK LangMenuDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
// //
// Lang Menu // Lang Menu
// //
for (int i = L_TEXT ; i < pNppParam->L_END ; ++i) for (int i = L_TEXT ; i < nppParam.L_END ; ++i)
{ {
generic_string str; generic_string str;
if (static_cast<LangType>(i) != L_USER) if (static_cast<LangType>(i) != L_USER)
{ {
int cmdID = pNppParam->langTypeToCommandID(static_cast<LangType>(i)); int cmdID = nppParam.langTypeToCommandID(static_cast<LangType>(i));
if ((cmdID != -1)) if ((cmdID != -1))
{ {
getNameStrFromCmd(cmdID, str); getNameStrFromCmd(cmdID, str);
@ -1632,10 +1632,10 @@ INT_PTR CALLBACK LangMenuDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
::SendDlgItemMessage(_hSelf, IDC_CHECK_REPLACEBYSPACE, BM_SETCHECK, nppGUI._tabReplacedBySpace, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_REPLACEBYSPACE, BM_SETCHECK, nppGUI._tabReplacedBySpace, 0);
::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_ADDSTRING, 0, reinterpret_cast<LPARAM>(TEXT("[Default]"))); ::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_ADDSTRING, 0, reinterpret_cast<LPARAM>(TEXT("[Default]")));
const int nbLang = pNppParam->getNbLang(); const int nbLang = nppParam.getNbLang();
for (int i = 0; i < nbLang; ++i) for (int i = 0; i < nbLang; ++i)
{ {
::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_ADDSTRING, 0, reinterpret_cast<LPARAM>(pNppParam->getLangFromIndex(i)->_langName.c_str())); ::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_ADDSTRING, 0, reinterpret_cast<LPARAM>(nppParam.getLangFromIndex(i)->_langName.c_str()));
} }
const int index2Begin = 0; const int index2Begin = 0;
::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_SETCURSEL, 0, index2Begin); ::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_SETCURSEL, 0, index2Begin);
@ -1644,7 +1644,7 @@ INT_PTR CALLBACK LangMenuDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
::EnableWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_DISABLE_STATIC), FALSE); ::EnableWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_DISABLE_STATIC), FALSE);
::ShowWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_DISABLE_STATIC), SW_HIDE); ::ShowWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_DISABLE_STATIC), SW_HIDE);
ETDTProc enableDlgTheme = reinterpret_cast<ETDTProc>(pNppParam->getEnableThemeDlgTexture()); ETDTProc enableDlgTheme = reinterpret_cast<ETDTProc>(nppParam.getEnableThemeDlgTexture());
if (enableDlgTheme) if (enableDlgTheme)
enableDlgTheme(_hSelf, ETDT_ENABLETAB); enableDlgTheme(_hSelf, ETDT_ENABLETAB);
@ -1694,7 +1694,7 @@ INT_PTR CALLBACK LangMenuDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
if (index) if (index)
{ {
Lang *lang = pNppParam->getLangFromIndex(index - 1); Lang *lang = nppParam.getLangFromIndex(index - 1);
if (!lang) return FALSE; if (!lang) return FALSE;
bool useDefaultTab = (lang->_tabSize == -1 || lang->_tabSize == 0); bool useDefaultTab = (lang->_tabSize == -1 || lang->_tabSize == 0);
@ -1817,12 +1817,12 @@ INT_PTR CALLBACK LangMenuDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
::EnableWindow(::GetDlgItem(_hSelf, idButton2Enable), TRUE); ::EnableWindow(::GetDlgItem(_hSelf, idButton2Enable), TRUE);
::EnableWindow(::GetDlgItem(_hSelf, idButton2Disable), FALSE); ::EnableWindow(::GetDlgItem(_hSelf, idButton2Disable), FALSE);
if ((lmi._langType >= L_EXTERNAL) && (lmi._langType < pNppParam->L_END)) if ((lmi._langType >= L_EXTERNAL) && (lmi._langType < nppParam.L_END))
{ {
bool found(false); bool found(false);
for (size_t x = 0; x < pNppParam->getExternalLexerDoc()->size() && !found; ++x) for (size_t x = 0; x < nppParam.getExternalLexerDoc()->size() && !found; ++x)
{ {
TiXmlNode *lexersRoot = pNppParam->getExternalLexerDoc()->at(x)->FirstChild(TEXT("NotepadPlus"))->FirstChildElement(TEXT("LexerStyles")); TiXmlNode *lexersRoot = nppParam.getExternalLexerDoc()->at(x)->FirstChild(TEXT("NotepadPlus"))->FirstChildElement(TEXT("LexerStyles"));
for (TiXmlNode *childNode = lexersRoot->FirstChildElement(TEXT("LexerType")); for (TiXmlNode *childNode = lexersRoot->FirstChildElement(TEXT("LexerType"));
childNode ; childNode ;
childNode = childNode->NextSibling(TEXT("LexerType"))) childNode = childNode->NextSibling(TEXT("LexerType")))
@ -1832,7 +1832,7 @@ INT_PTR CALLBACK LangMenuDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
if (generic_string(element->Attribute(TEXT("name"))) == lmi._langName) if (generic_string(element->Attribute(TEXT("name"))) == lmi._langName)
{ {
element->SetAttribute(TEXT("excluded"), (LOWORD(wParam)==IDC_BUTTON_REMOVE)?TEXT("yes"):TEXT("no")); element->SetAttribute(TEXT("excluded"), (LOWORD(wParam)==IDC_BUTTON_REMOVE)?TEXT("yes"):TEXT("no"));
pNppParam->getExternalLexerDoc()->at(x)->SaveFile(); nppParam.getExternalLexerDoc()->at(x)->SaveFile();
found = true; found = true;
break; break;
} }
@ -1890,23 +1890,23 @@ INT_PTR CALLBACK LangMenuDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
if (index != 0) if (index != 0)
{ {
Lang *lang = pNppParam->getLangFromIndex(index - 1); Lang *lang = nppParam.getLangFromIndex(index - 1);
if (!lang) return FALSE; if (!lang) return FALSE;
if (lang->_langID == L_JS) if (lang->_langID == L_JS)
{ {
Lang *ljs = pNppParam->getLangFromID(L_JAVASCRIPT); Lang *ljs = nppParam.getLangFromID(L_JAVASCRIPT);
ljs->_tabSize = size; ljs->_tabSize = size;
} }
else if (lang->_langID == L_JAVASCRIPT) else if (lang->_langID == L_JAVASCRIPT)
{ {
Lang *ljavascript = pNppParam->getLangFromID(L_JS); Lang *ljavascript = nppParam.getLangFromID(L_JS);
ljavascript->_tabSize = size; ljavascript->_tabSize = size;
} }
lang->_tabSize = size; lang->_tabSize = size;
// write in langs.xml // write in langs.xml
pNppParam->insertTabInfo(lang->getLangName(), lang->getTabInfo()); nppParam.insertTabInfo(lang->getLangName(), lang->getTabInfo());
} }
else else
{ {
@ -1924,26 +1924,26 @@ INT_PTR CALLBACK LangMenuDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
if (index == LB_ERR) return FALSE; if (index == LB_ERR) return FALSE;
if (index != 0) if (index != 0)
{ {
Lang *lang = pNppParam->getLangFromIndex(index - 1); Lang *lang = nppParam.getLangFromIndex(index - 1);
if (!lang) return FALSE; if (!lang) return FALSE;
if (!lang->_tabSize || lang->_tabSize == -1) if (!lang->_tabSize || lang->_tabSize == -1)
lang->_tabSize = nppGUI._tabSize; lang->_tabSize = nppGUI._tabSize;
if (lang->_langID == L_JS) if (lang->_langID == L_JS)
{ {
Lang *ljs = pNppParam->getLangFromID(L_JAVASCRIPT); Lang *ljs = nppParam.getLangFromID(L_JAVASCRIPT);
ljs->_isTabReplacedBySpace = isTabReplacedBySpace; ljs->_isTabReplacedBySpace = isTabReplacedBySpace;
} }
else if (lang->_langID == L_JAVASCRIPT) else if (lang->_langID == L_JAVASCRIPT)
{ {
Lang *ljavascript = pNppParam->getLangFromID(L_JS); Lang *ljavascript = nppParam.getLangFromID(L_JS);
ljavascript->_isTabReplacedBySpace = isTabReplacedBySpace; ljavascript->_isTabReplacedBySpace = isTabReplacedBySpace;
} }
lang->_isTabReplacedBySpace = isTabReplacedBySpace; lang->_isTabReplacedBySpace = isTabReplacedBySpace;
// write in langs.xml // write in langs.xml
pNppParam->insertTabInfo(lang->getLangName(), lang->getTabInfo()); nppParam.insertTabInfo(lang->getLangName(), lang->getTabInfo());
} }
else else
{ {
@ -1960,7 +1960,7 @@ INT_PTR CALLBACK LangMenuDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
if (index == LB_ERR || index == 0) // index == 0 shouldn't happen if (index == LB_ERR || index == 0) // index == 0 shouldn't happen
return FALSE; return FALSE;
Lang *lang = pNppParam->getLangFromIndex(index - 1); Lang *lang = nppParam.getLangFromIndex(index - 1);
if (!lang) if (!lang)
return FALSE; return FALSE;
@ -1979,7 +1979,7 @@ INT_PTR CALLBACK LangMenuDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
// write in langs.xml // write in langs.xml
if (useDefaultTab) if (useDefaultTab)
pNppParam->insertTabInfo(lang->getLangName(), -1); nppParam.insertTabInfo(lang->getLangName(), -1);
return TRUE; return TRUE;
} }
@ -1991,8 +1991,8 @@ INT_PTR CALLBACK LangMenuDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
INT_PTR CALLBACK Highlighting::run_dlgProc(UINT message, WPARAM wParam, LPARAM/* lParam*/) INT_PTR CALLBACK Highlighting::run_dlgProc(UINT message, WPARAM wParam, LPARAM/* lParam*/)
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
NppGUI & nppGUI = (NppGUI & )pNppParam->getNppGUI(); NppGUI & nppGUI = (NppGUI & )nppParam.getNppGUI();
switch (message) switch (message)
{ {
@ -2016,7 +2016,7 @@ INT_PTR CALLBACK Highlighting::run_dlgProc(UINT message, WPARAM wParam, LPARAM/*
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_SMARTHILITEUSEFINDSETTINGS), nppGUI._enableSmartHilite); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_SMARTHILITEUSEFINDSETTINGS), nppGUI._enableSmartHilite);
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_SMARTHILITEANOTHERRVIEW), nppGUI._enableSmartHilite); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_SMARTHILITEANOTHERRVIEW), nppGUI._enableSmartHilite);
ETDTProc enableDlgTheme = reinterpret_cast<ETDTProc>(pNppParam->getEnableThemeDlgTexture()); ETDTProc enableDlgTheme = reinterpret_cast<ETDTProc>(nppParam.getEnableThemeDlgTexture());
if (enableDlgTheme) if (enableDlgTheme)
enableDlgTheme(_hSelf, ETDT_ENABLETAB); enableDlgTheme(_hSelf, ETDT_ENABLETAB);
@ -2141,8 +2141,8 @@ void trim(generic_string & str)
INT_PTR CALLBACK PrintSettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) INT_PTR CALLBACK PrintSettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
NppGUI & nppGUI = (NppGUI & )pNppParam->getNppGUI(); NppGUI & nppGUI = (NppGUI & )nppParam.getNppGUI();
switch (message) switch (message)
{ {
@ -2187,7 +2187,7 @@ INT_PTR CALLBACK PrintSettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
::SendDlgItemMessage(_hSelf, IDC_COMBO_HFONTSIZE, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(intStr)); ::SendDlgItemMessage(_hSelf, IDC_COMBO_HFONTSIZE, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(intStr));
::SendDlgItemMessage(_hSelf, IDC_COMBO_FFONTSIZE, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(intStr)); ::SendDlgItemMessage(_hSelf, IDC_COMBO_FFONTSIZE, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(intStr));
} }
const std::vector<generic_string> & fontlist = pNppParam->getFontList(); const std::vector<generic_string> & fontlist = nppParam.getFontList();
for (size_t i = 0, len = fontlist.size() ; i < len ; ++i) for (size_t i = 0, len = fontlist.size() ; i < len ; ++i)
{ {
auto j = ::SendDlgItemMessage(_hSelf, IDC_COMBO_HFONTNAME, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(fontlist[i].c_str())); auto j = ::SendDlgItemMessage(_hSelf, IDC_COMBO_HFONTNAME, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(fontlist[i].c_str()));
@ -2233,7 +2233,7 @@ INT_PTR CALLBACK PrintSettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
ETDTProc enableDlgTheme = (ETDTProc)pNppParam->getEnableThemeDlgTexture(); ETDTProc enableDlgTheme = (ETDTProc)nppParam.getEnableThemeDlgTexture();
if (enableDlgTheme) if (enableDlgTheme)
enableDlgTheme(_hSelf, ETDT_ENABLETAB); enableDlgTheme(_hSelf, ETDT_ENABLETAB);
break; break;
@ -2461,8 +2461,8 @@ INT_PTR CALLBACK PrintSettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
INT_PTR CALLBACK BackupDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) INT_PTR CALLBACK BackupDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
NppGUI & nppGUI = const_cast<NppGUI &>(pNppParam->getNppGUI()); NppGUI & nppGUI = const_cast<NppGUI &>(nppParam.getNppGUI());
switch (message) switch (message)
{ {
case WM_INITDIALOG : case WM_INITDIALOG :
@ -2472,7 +2472,7 @@ INT_PTR CALLBACK BackupDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
::SendDlgItemMessage(_hSelf, IDC_BACKUPDIR_RESTORESESSION_CHECK, BM_SETCHECK, snapshotCheck?BST_CHECKED:BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDC_BACKUPDIR_RESTORESESSION_CHECK, BM_SETCHECK, snapshotCheck?BST_CHECKED:BST_UNCHECKED, 0);
auto periodicBackupInSec = static_cast<UINT>(nppGUI._snapshotBackupTiming / 1000); auto periodicBackupInSec = static_cast<UINT>(nppGUI._snapshotBackupTiming / 1000);
::SetDlgItemInt(_hSelf, IDC_BACKUPDIR_RESTORESESSION_EDIT,periodicBackupInSec, FALSE); ::SetDlgItemInt(_hSelf, IDC_BACKUPDIR_RESTORESESSION_EDIT,periodicBackupInSec, FALSE);
generic_string backupFilePath = NppParameters::getInstance()->getUserPath(); generic_string backupFilePath = NppParameters::getInstance().getUserPath();
backupFilePath += TEXT("\\backup\\"); backupFilePath += TEXT("\\backup\\");
::SetDlgItemText(_hSelf, IDD_BACKUPDIR_RESTORESESSION_PATH_EDIT, backupFilePath.c_str()); ::SetDlgItemText(_hSelf, IDD_BACKUPDIR_RESTORESESSION_PATH_EDIT, backupFilePath.c_str());
@ -2655,8 +2655,8 @@ void BackupDlg::updateBackupGUI()
INT_PTR CALLBACK AutoCompletionDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) INT_PTR CALLBACK AutoCompletionDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
NppGUI & nppGUI = const_cast<NppGUI &>(pNppParam->getNppGUI()); NppGUI & nppGUI = const_cast<NppGUI &>(nppParam.getNppGUI());
switch (message) switch (message)
{ {
case WM_INITDIALOG : case WM_INITDIALOG :
@ -2871,7 +2871,7 @@ INT_PTR CALLBACK AutoCompletionDlg::run_dlgProc(UINT message, WPARAM wParam, LPA
const int NB_MIN_CHAR = 1; const int NB_MIN_CHAR = 1;
const int NB_MAX_CHAR = 9; const int NB_MAX_CHAR = 9;
NativeLangSpeaker *pNativeSpeaker = pNppParam->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = nppParam.getNativeLangSpeaker();
generic_string strNbChar = pNativeSpeaker->getLocalizedStrFromID("autocomplete-nb-char", TEXT("Nb char : ")); generic_string strNbChar = pNativeSpeaker->getLocalizedStrFromID("autocomplete-nb-char", TEXT("Nb char : "));
ValueDlg valDlg; ValueDlg valDlg;
@ -2949,7 +2949,7 @@ INT_PTR CALLBACK AutoCompletionDlg::run_dlgProc(UINT message, WPARAM wParam, LPA
INT_PTR CALLBACK MultiInstDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) INT_PTR CALLBACK MultiInstDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
{ {
NppGUI & nppGUI = const_cast<NppGUI &>((NppParameters::getInstance())->getNppGUI()); NppGUI & nppGUI = const_cast<NppGUI &>((NppParameters::getInstance()).getNppGUI());
switch (message) switch (message)
{ {
case WM_INITDIALOG : case WM_INITDIALOG :
@ -3008,7 +3008,7 @@ void DelimiterSettingsDlg::detectSpace(const char *text2Check, int & nbSp, int &
generic_string DelimiterSettingsDlg::getWarningText(size_t nbSp, size_t nbTab) const generic_string DelimiterSettingsDlg::getWarningText(size_t nbSp, size_t nbTab) const
{ {
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string msg; generic_string msg;
if (nbSp && nbTab) if (nbSp && nbTab)
@ -3095,7 +3095,7 @@ generic_string DelimiterSettingsDlg::getWarningText(size_t nbSp, size_t nbTab) c
void DelimiterSettingsDlg::setWarningIfNeed() const void DelimiterSettingsDlg::setWarningIfNeed() const
{ {
generic_string msg; generic_string msg;
NppGUI & nppGUI = const_cast<NppGUI &>((NppParameters::getInstance())->getNppGUI()); NppGUI & nppGUI = const_cast<NppGUI &>((NppParameters::getInstance()).getNppGUI());
if (not nppGUI._isWordCharDefault) if (not nppGUI._isWordCharDefault)
{ {
int nbSp = 0; int nbSp = 0;
@ -3108,7 +3108,7 @@ void DelimiterSettingsDlg::setWarningIfNeed() const
INT_PTR CALLBACK DelimiterSettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) INT_PTR CALLBACK DelimiterSettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
{ {
NppGUI & nppGUI = const_cast<NppGUI &>((NppParameters::getInstance())->getNppGUI()); NppGUI & nppGUI = const_cast<NppGUI &>((NppParameters::getInstance()).getNppGUI());
switch (message) switch (message)
{ {
case WM_INITDIALOG : case WM_INITDIALOG :
@ -3164,7 +3164,7 @@ INT_PTR CALLBACK DelimiterSettingsDlg::run_dlgProc(UINT message, WPARAM wParam,
setWarningIfNeed(); setWarningIfNeed();
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string tip2show = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-tip", TEXT("This allows you to include additional character into current word characters while double clicking for selection or searching with \"Match whole word only\" option checked.")); generic_string tip2show = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-tip", TEXT("This allows you to include additional character into current word characters while double clicking for selection or searching with \"Match whole word only\" option checked."));
_tip = CreateToolTip(IDD_WORDCHAR_QUESTION_BUTTON, _hSelf, _hInst, const_cast<PTSTR>(tip2show.c_str())); _tip = CreateToolTip(IDD_WORDCHAR_QUESTION_BUTTON, _hSelf, _hInst, const_cast<PTSTR>(tip2show.c_str()));
@ -3281,8 +3281,8 @@ INT_PTR CALLBACK DelimiterSettingsDlg::run_dlgProc(UINT message, WPARAM wParam,
INT_PTR CALLBACK SettingsOnCloudDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) INT_PTR CALLBACK SettingsOnCloudDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
{ {
NppParameters * nppParams = NppParameters::getInstance(); NppParameters& nppParams = NppParameters::getInstance();
NppGUI & nppGUI = const_cast<NppGUI &>(nppParams->getNppGUI()); NppGUI & nppGUI = const_cast<NppGUI &>(nppParams.getNppGUI());
if (HIWORD(wParam) == EN_CHANGE) if (HIWORD(wParam) == EN_CHANGE)
{ {
@ -3294,14 +3294,14 @@ INT_PTR CALLBACK SettingsOnCloudDlg::run_dlgProc(UINT message, WPARAM wParam, LP
TCHAR inputDirExpanded[MAX_PATH] = {'\0'}; TCHAR inputDirExpanded[MAX_PATH] = {'\0'};
::SendDlgItemMessage(_hSelf, IDC_CLOUDPATH_EDIT, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(inputDir)); ::SendDlgItemMessage(_hSelf, IDC_CLOUDPATH_EDIT, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(inputDir));
::ExpandEnvironmentStrings(inputDir, inputDirExpanded, MAX_PATH); ::ExpandEnvironmentStrings(inputDir, inputDirExpanded, MAX_PATH);
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
if (::PathFileExists(inputDirExpanded)) if (::PathFileExists(inputDirExpanded))
{ {
nppGUI._cloudPath = inputDirExpanded; nppGUI._cloudPath = inputDirExpanded;
nppParams->setCloudChoice(inputDirExpanded); nppParams.setCloudChoice(inputDirExpanded);
generic_string message; generic_string message;
if (nppParams->isCloudPathChanged()) if (nppParams.isCloudPathChanged())
{ {
message = pNativeSpeaker->getLocalizedStrFromID("cloud-restart-warning", TEXT("Please restart Notepad++ to take effect.")); message = pNativeSpeaker->getLocalizedStrFromID("cloud-restart-warning", TEXT("Please restart Notepad++ to take effect."));
} }
@ -3315,7 +3315,7 @@ INT_PTR CALLBACK SettingsOnCloudDlg::run_dlgProc(UINT message, WPARAM wParam, LP
generic_string message = pNativeSpeaker->getLocalizedStrFromID("cloud-invalid-warning", TEXT("Invalid path.")); generic_string message = pNativeSpeaker->getLocalizedStrFromID("cloud-invalid-warning", TEXT("Invalid path."));
::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, message.c_str()); ::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, message.c_str());
nppParams->removeCloudChoice(); nppParams.removeCloudChoice();
} }
} }
return TRUE; return TRUE;
@ -3349,16 +3349,16 @@ INT_PTR CALLBACK SettingsOnCloudDlg::run_dlgProc(UINT message, WPARAM wParam, LP
case WM_COMMAND: case WM_COMMAND:
{ {
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
switch (wParam) switch (wParam)
{ {
case IDC_NOCLOUD_RADIO: case IDC_NOCLOUD_RADIO:
{ {
nppGUI._cloudPath = TEXT(""); nppGUI._cloudPath = TEXT("");
nppParams->removeCloudChoice(); nppParams.removeCloudChoice();
generic_string message; generic_string message;
if (nppParams->isCloudPathChanged()) if (nppParams.isCloudPathChanged())
{ {
message = pNativeSpeaker->getLocalizedStrFromID("cloud-restart-warning", TEXT("Please restart Notepad++ to take effect.")); message = pNativeSpeaker->getLocalizedStrFromID("cloud-restart-warning", TEXT("Please restart Notepad++ to take effect."));
} }
@ -3399,8 +3399,8 @@ INT_PTR CALLBACK SettingsOnCloudDlg::run_dlgProc(UINT message, WPARAM wParam, LP
INT_PTR CALLBACK SearchEngineChoiceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) INT_PTR CALLBACK SearchEngineChoiceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
{ {
NppParameters * nppParams = NppParameters::getInstance(); NppParameters& nppParams = NppParameters::getInstance();
NppGUI & nppGUI = const_cast<NppGUI &>(nppParams->getNppGUI()); NppGUI & nppGUI = const_cast<NppGUI &>(nppParams.getNppGUI());
if (HIWORD(wParam) == EN_CHANGE) if (HIWORD(wParam) == EN_CHANGE)
{ {

View File

@ -59,7 +59,7 @@ INT_PTR CALLBACK ProjectPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM l
0,0,0,0,_hSelf, nullptr, _hInst, nullptr); 0,0,0,0,_hSelf, nullptr, _hInst, nullptr);
TBBUTTON tbButtons[2]; TBBUTTON tbButtons[2];
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string workspace_entry = pNativeSpeaker->getProjectPanelLangMenuStr("Entries", 0, PM_WORKSPACEMENUENTRY); generic_string workspace_entry = pNativeSpeaker->getProjectPanelLangMenuStr("Entries", 0, PM_WORKSPACEMENUENTRY);
generic_string edit_entry = pNativeSpeaker->getProjectPanelLangMenuStr("Entries", 1, PM_EDITMENUENTRY); generic_string edit_entry = pNativeSpeaker->getProjectPanelLangMenuStr("Entries", 1, PM_EDITMENUENTRY);
@ -183,7 +183,7 @@ void ProjectPanel::checkIfNeedSave(const TCHAR *title)
{ {
display(); display();
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
int res = pNativeSpeaker->messageBox("ProjectPanelChanged", int res = pNativeSpeaker->messageBox("ProjectPanelChanged",
_hSelf, _hSelf,
TEXT("The workspace was modified. Do you want to save it?"), TEXT("The workspace was modified. Do you want to save it?"),
@ -212,7 +212,7 @@ void ProjectPanel::initMenus()
{ {
_hWorkSpaceMenu = ::CreatePopupMenu(); _hWorkSpaceMenu = ::CreatePopupMenu();
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string new_workspace = pNativeSpeaker->getProjectPanelLangMenuStr("WorkspaceMenu", IDM_PROJECT_NEWWS, PM_NEWWORKSPACE); generic_string new_workspace = pNativeSpeaker->getProjectPanelLangMenuStr("WorkspaceMenu", IDM_PROJECT_NEWWS, PM_NEWWORKSPACE);
generic_string open_workspace = pNativeSpeaker->getProjectPanelLangMenuStr("WorkspaceMenu", IDM_PROJECT_OPENWS, PM_OPENWORKSPACE); generic_string open_workspace = pNativeSpeaker->getProjectPanelLangMenuStr("WorkspaceMenu", IDM_PROJECT_OPENWS, PM_OPENWORKSPACE);
@ -388,7 +388,7 @@ bool ProjectPanel::openWorkSpace(const TCHAR *projectFileName)
_treeView.removeAllItems(); _treeView.removeAllItems();
_workSpaceFilePath = projectFileName; _workSpaceFilePath = projectFileName;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string workspace = pNativeSpeaker->getAttrNameStr(PM_WORKSPACEROOTNAME, "ProjectManager", "WorkspaceRootName"); generic_string workspace = pNativeSpeaker->getAttrNameStr(PM_WORKSPACEROOTNAME, "ProjectManager", "WorkspaceRootName");
HTREEITEM rootItem = _treeView.addItem(workspace.c_str(), TVI_ROOT, INDEX_CLEAN_ROOT); HTREEITEM rootItem = _treeView.addItem(workspace.c_str(), TVI_ROOT, INDEX_CLEAN_ROOT);
@ -406,7 +406,7 @@ bool ProjectPanel::openWorkSpace(const TCHAR *projectFileName)
void ProjectPanel::newWorkSpace() void ProjectPanel::newWorkSpace()
{ {
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string workspace = pNativeSpeaker->getAttrNameStr(PM_WORKSPACEROOTNAME, "ProjectManager", "WorkspaceRootName"); generic_string workspace = pNativeSpeaker->getAttrNameStr(PM_WORKSPACEROOTNAME, "ProjectManager", "WorkspaceRootName");
_treeView.addItem(workspace.c_str(), TVI_ROOT, INDEX_CLEAN_ROOT); _treeView.addItem(workspace.c_str(), TVI_ROOT, INDEX_CLEAN_ROOT);
setWorkSpaceDirty(false); setWorkSpaceDirty(false);
@ -888,7 +888,7 @@ void ProjectPanel::popupMenuCmd(int cmdID)
{ {
HTREEITEM root = _treeView.getRoot(); HTREEITEM root = _treeView.getRoot();
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string newProjectLabel = pNativeSpeaker->getAttrNameStr(PM_NEWPROJECTNAME, "ProjectManager", "NewProjectName"); generic_string newProjectLabel = pNativeSpeaker->getAttrNameStr(PM_NEWPROJECTNAME, "ProjectManager", "NewProjectName");
HTREEITEM addedItem = _treeView.addItem(newProjectLabel.c_str(), root, INDEX_PROJECT); HTREEITEM addedItem = _treeView.addItem(newProjectLabel.c_str(), root, INDEX_PROJECT);
setWorkSpaceDirty(true); setWorkSpaceDirty(true);
@ -901,7 +901,7 @@ void ProjectPanel::popupMenuCmd(int cmdID)
{ {
if (_isDirty) if (_isDirty)
{ {
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
int res = pNativeSpeaker->messageBox("ProjectPanelNewDoSaveDirtyWsOrNot", int res = pNativeSpeaker->messageBox("ProjectPanelNewDoSaveDirtyWsOrNot",
_hSelf, _hSelf,
TEXT("The current workspace was modified. Do you want to save the current project?"), TEXT("The current workspace was modified. Do you want to save the current project?"),
@ -933,7 +933,7 @@ void ProjectPanel::popupMenuCmd(int cmdID)
case IDM_PROJECT_NEWFOLDER : case IDM_PROJECT_NEWFOLDER :
{ {
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string newFolderLabel = pNativeSpeaker->getAttrNameStr(PM_NEWFOLDERNAME, "ProjectManager", "NewFolderName"); generic_string newFolderLabel = pNativeSpeaker->getAttrNameStr(PM_NEWFOLDERNAME, "ProjectManager", "NewFolderName");
addFolder(hTreeItem, newFolderLabel.c_str()); addFolder(hTreeItem, newFolderLabel.c_str());
setWorkSpaceDirty(true); setWorkSpaceDirty(true);
@ -972,7 +972,7 @@ void ProjectPanel::popupMenuCmd(int cmdID)
case IDM_PROJECT_OPENWS: case IDM_PROJECT_OPENWS:
{ {
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
if (_isDirty) if (_isDirty)
{ {
@ -1017,7 +1017,7 @@ void ProjectPanel::popupMenuCmd(int cmdID)
case IDM_PROJECT_RELOADWS: case IDM_PROJECT_RELOADWS:
{ {
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
if (_isDirty) if (_isDirty)
{ {
int res = pNativeSpeaker->messageBox("ProjectPanelReloadDirty", int res = pNativeSpeaker->messageBox("ProjectPanelReloadDirty",
@ -1068,7 +1068,7 @@ void ProjectPanel::popupMenuCmd(int cmdID)
if (_treeView.getChildFrom(hTreeItem) != NULL) if (_treeView.getChildFrom(hTreeItem) != NULL)
{ {
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
int res = pNativeSpeaker->messageBox("ProjectPanelRemoveFolderFromProject", int res = pNativeSpeaker->messageBox("ProjectPanelRemoveFolderFromProject",
_hSelf, _hSelf,
TEXT("All the sub-items will be removed.\rAre you sure you want to remove this folder from the project?"), TEXT("All the sub-items will be removed.\rAre you sure you want to remove this folder from the project?"),
@ -1094,7 +1094,7 @@ void ProjectPanel::popupMenuCmd(int cmdID)
{ {
HTREEITEM parent = _treeView.getParent(hTreeItem); HTREEITEM parent = _treeView.getParent(hTreeItem);
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
int res = pNativeSpeaker->messageBox("ProjectPanelRemoveFileFromProject", int res = pNativeSpeaker->messageBox("ProjectPanelRemoveFileFromProject",
_hSelf, _hSelf,
TEXT("Are you sure you want to remove this file from the project?"), TEXT("Are you sure you want to remove this file from the project?"),
@ -1167,7 +1167,7 @@ bool ProjectPanel::saveWorkSpaceAs(bool saveCopyAs)
void ProjectPanel::setFileExtFilter(FileDialog & fDlg) void ProjectPanel::setFileExtFilter(FileDialog & fDlg)
{ {
const TCHAR *ext = NppParameters::getInstance()->getNppGUI()._definedWorkspaceExt.c_str(); const TCHAR *ext = NppParameters::getInstance().getNppGUI()._definedWorkspaceExt.c_str();
generic_string workspaceExt = TEXT(""); generic_string workspaceExt = TEXT("");
if (*ext != '\0') if (*ext != '\0')
{ {

View File

@ -48,7 +48,7 @@ void TreeView::init(HINSTANCE hInst, HWND parent, int treeViewID)
_hInst, _hInst,
(LPVOID)0); (LPVOID)0);
int itemHeight = NppParameters::getInstance()->_dpiManager.scaleY(CY_ITEMHEIGHT); int itemHeight = NppParameters::getInstance()._dpiManager.scaleY(CY_ITEMHEIGHT);
TreeView_SetItemHeight(_hSelf, itemHeight); TreeView_SetItemHeight(_hSelf, itemHeight);
::SetWindowLongPtr(_hSelf, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this)); ::SetWindowLongPtr(_hSelf, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this));

View File

@ -277,7 +277,7 @@ INT_PTR CALLBACK RunDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
case IDC_BUTTON_SAVE : case IDC_BUTTON_SAVE :
{ {
std::vector<UserCommand> & theUserCmds = (NppParameters::getInstance())->getUserCommandList(); std::vector<UserCommand> & theUserCmds = (NppParameters::getInstance()).getUserCommandList();
int nbCmd = static_cast<int32_t>(theUserCmds.size()); int nbCmd = static_cast<int32_t>(theUserCmds.size());
@ -299,20 +299,20 @@ INT_PTR CALLBACK RunDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
theUserCmds.push_back(uc); theUserCmds.push_back(uc);
::InsertMenu(hRunMenu, posBase + nbCmd, MF_BYPOSITION, cmdID, uc.toMenuItemString().c_str()); ::InsertMenu(hRunMenu, posBase + nbCmd, MF_BYPOSITION, cmdID, uc.toMenuItemString().c_str());
NppParameters* nppParams = NppParameters::getInstance(); NppParameters& nppParams = NppParameters::getInstance();
if (nbCmd == 0) if (nbCmd == 0)
{ {
// Insert the separator and modify/delete command // Insert the separator and modify/delete command
::InsertMenu(hRunMenu, posBase + nbCmd + 1, MF_BYPOSITION, static_cast<unsigned int>(-1), 0); ::InsertMenu(hRunMenu, posBase + nbCmd + 1, MF_BYPOSITION, static_cast<unsigned int>(-1), 0);
NativeLangSpeaker *pNativeLangSpeaker = nppParams->getNativeLangSpeaker(); NativeLangSpeaker *pNativeLangSpeaker = nppParams.getNativeLangSpeaker();
generic_string nativeLangShortcutMapperMacro = pNativeLangSpeaker->getNativeLangMenuString(IDM_SETTING_SHORTCUT_MAPPER_MACRO); generic_string nativeLangShortcutMapperMacro = pNativeLangSpeaker->getNativeLangMenuString(IDM_SETTING_SHORTCUT_MAPPER_MACRO);
if (nativeLangShortcutMapperMacro == TEXT("")) if (nativeLangShortcutMapperMacro == TEXT(""))
nativeLangShortcutMapperMacro = TEXT("Modify Shortcut/Delete Command..."); nativeLangShortcutMapperMacro = TEXT("Modify Shortcut/Delete Command...");
::InsertMenu(hRunMenu, posBase + nbCmd + 2, MF_BYCOMMAND, IDM_SETTING_SHORTCUT_MAPPER_RUN, nativeLangShortcutMapperMacro.c_str()); ::InsertMenu(hRunMenu, posBase + nbCmd + 2, MF_BYCOMMAND, IDM_SETTING_SHORTCUT_MAPPER_RUN, nativeLangShortcutMapperMacro.c_str());
} }
nppParams->getAccelerator()->updateShortcuts(); nppParams.getAccelerator()->updateShortcuts();
nppParams->setShortcutDirty(); nppParams.setShortcutDirty();
} }
return TRUE; return TRUE;
} }

View File

@ -379,8 +379,8 @@ void TabBarPlus::doOwnerDrawTab()
::SetWindowLongPtr(_hwndArray[i], GWL_STYLE, style); ::SetWindowLongPtr(_hwndArray[i], GWL_STYLE, style);
::InvalidateRect(_hwndArray[i], NULL, TRUE); ::InvalidateRect(_hwndArray[i], NULL, TRUE);
const int paddingSizeDynamicW = NppParameters::getInstance()->_dpiManager.scaleX(6); const int paddingSizeDynamicW = NppParameters::getInstance()._dpiManager.scaleX(6);
const int paddingSizePlusClosebuttonDynamicW = NppParameters::getInstance()->_dpiManager.scaleX(9); const int paddingSizePlusClosebuttonDynamicW = NppParameters::getInstance()._dpiManager.scaleX(9);
::SendMessage(_hwndArray[i], TCM_SETPADDING, 0, MAKELPARAM(_drawTabCloseButton ? paddingSizePlusClosebuttonDynamicW : paddingSizeDynamicW, 0)); ::SendMessage(_hwndArray[i], TCM_SETPADDING, 0, MAKELPARAM(_drawTabCloseButton ? paddingSizePlusClosebuttonDynamicW : paddingSizeDynamicW, 0));
} }
} }
@ -548,7 +548,7 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara
// get index of the first visible tab // get index of the first visible tab
TC_HITTESTINFO hti; TC_HITTESTINFO hti;
LONG xy = NppParameters::getInstance()->_dpiManager.scaleX(12); // an arbitrary coordinate inside the first visible tab LONG xy = NppParameters::getInstance()._dpiManager.scaleX(12); // an arbitrary coordinate inside the first visible tab
hti.pt = { xy, xy }; hti.pt = { xy, xy };
int scrollTabIndex = static_cast<int32_t>(::SendMessage(_hSelf, TCM_HITTEST, 0, reinterpret_cast<LPARAM>(&hti))); int scrollTabIndex = static_cast<int32_t>(::SendMessage(_hSelf, TCM_HITTEST, 0, reinterpret_cast<LPARAM>(&hti)));
@ -557,7 +557,7 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara
// maximal width/height of the msctls_updown32 class (arrow box in the tab bar), // maximal width/height of the msctls_updown32 class (arrow box in the tab bar),
// this area may hide parts of the last tab and needs to be excluded // this area may hide parts of the last tab and needs to be excluded
LONG maxLengthUpDownCtrl = NppParameters::getInstance()->_dpiManager.scaleX(44); // sufficient static value LONG maxLengthUpDownCtrl = NppParameters::getInstance()._dpiManager.scaleX(44); // sufficient static value
// scroll forward as long as the last tab is hidden; scroll backward till the first tab // scroll forward as long as the last tab is hidden; scroll backward till the first tab
if ((_isVertical ? ((rcTabCtrl.bottom - rcLastTab.bottom) < maxLengthUpDownCtrl) : ((rcTabCtrl.right - rcLastTab.right) < maxLengthUpDownCtrl)) || not isForward) if ((_isVertical ? ((rcTabCtrl.bottom - rcLastTab.bottom) < maxLengthUpDownCtrl) : ((rcTabCtrl.right - rcLastTab.right) < maxLengthUpDownCtrl)) || not isForward)
@ -896,8 +896,8 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct)
::DeleteObject((HGDIOBJ)hBrush); ::DeleteObject((HGDIOBJ)hBrush);
// equalize drawing areas of active and inactive tabs // equalize drawing areas of active and inactive tabs
int paddingDynamicTwoX = NppParameters::getInstance()->_dpiManager.scaleX(2); int paddingDynamicTwoX = NppParameters::getInstance()._dpiManager.scaleX(2);
int paddingDynamicTwoY = NppParameters::getInstance()->_dpiManager.scaleY(2); int paddingDynamicTwoY = NppParameters::getInstance()._dpiManager.scaleY(2);
if (isSelected) if (isSelected)
{ {
// the drawing area of the active tab extends on all borders by default // the drawing area of the active tab extends on all borders by default
@ -954,15 +954,15 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct)
{ {
if (_drawTopBar) if (_drawTopBar)
{ {
int topBarHeight = NppParameters::getInstance()->_dpiManager.scaleX(4); int topBarHeight = NppParameters::getInstance()._dpiManager.scaleX(4);
if (_isVertical) if (_isVertical)
{ {
barRect.left -= NppParameters::getInstance()->_dpiManager.scaleX(2); barRect.left -= NppParameters::getInstance()._dpiManager.scaleX(2);
barRect.right = barRect.left + topBarHeight; barRect.right = barRect.left + topBarHeight;
} }
else else
{ {
barRect.top -= NppParameters::getInstance()->_dpiManager.scaleY(2); barRect.top -= NppParameters::getInstance()._dpiManager.scaleY(2);
barRect.bottom = barRect.top + topBarHeight; barRect.bottom = barRect.top + topBarHeight;
} }
@ -1005,8 +1005,8 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct)
BITMAP bmp; BITMAP bmp;
::GetObject(hBmp, sizeof(bmp), &bmp); ::GetObject(hBmp, sizeof(bmp), &bmp);
int bmDpiDynamicalWidth = NppParameters::getInstance()->_dpiManager.scaleX(bmp.bmWidth); int bmDpiDynamicalWidth = NppParameters::getInstance()._dpiManager.scaleX(bmp.bmWidth);
int bmDpiDynamicalHeight = NppParameters::getInstance()->_dpiManager.scaleY(bmp.bmHeight); int bmDpiDynamicalHeight = NppParameters::getInstance()._dpiManager.scaleY(bmp.bmHeight);
RECT buttonRect = _closeButtonZone.getButtonRectFrom(rect, _isVertical); RECT buttonRect = _closeButtonZone.getButtonRectFrom(rect, _isVertical);
@ -1241,8 +1241,8 @@ void TabBarPlus::exchangeItemData(POINT point)
CloseButtonZone::CloseButtonZone() CloseButtonZone::CloseButtonZone()
{ {
// TODO: get width/height of close button dynamically // TODO: get width/height of close button dynamically
_width = NppParameters::getInstance()->_dpiManager.scaleX(11); _width = NppParameters::getInstance()._dpiManager.scaleX(11);
_height = NppParameters::getInstance()->_dpiManager.scaleY(11); _height = NppParameters::getInstance()._dpiManager.scaleY(11);
} }
bool CloseButtonZone::isHit(int x, int y, const RECT & tabRect, bool isVertical) const bool CloseButtonZone::isHit(int x, int y, const RECT & tabRect, bool isVertical) const

View File

@ -85,7 +85,7 @@ INT_PTR CALLBACK TaskListDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lP
i2set = 0; i2set = 0;
_taskList.init(_hInst, _hSelf, _hImalist, nbTotal, i2set); _taskList.init(_hInst, _hSelf, _hImalist, nbTotal, i2set);
_taskList.setFont(TEXT("Verdana"), NppParameters::getInstance()->_dpiManager.scaleY(14)); _taskList.setFont(TEXT("Verdana"), NppParameters::getInstance()._dpiManager.scaleY(14));
_rc = _taskList.adjustSize(); _rc = _taskList.adjustSize();
reSizeTo(_rc); reSizeTo(_rc);
@ -93,7 +93,7 @@ INT_PTR CALLBACK TaskListDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lP
_taskList.display(true); _taskList.display(true);
hWndServer = _hSelf; hWndServer = _hSelf;
windowsVersion = NppParameters::getInstance()->getWinVersion(); windowsVersion = NppParameters::getInstance().getWinVersion();
#ifndef WH_MOUSE_LL #ifndef WH_MOUSE_LL
#define WH_MOUSE_LL 14 #define WH_MOUSE_LL 14

View File

@ -106,7 +106,7 @@ bool ToolBar::init( HINSTANCE hInst, HWND hPere, toolBarStatusType type, ToolBar
{ {
Window::init(hInst, hPere); Window::init(hInst, hPere);
_state = type; _state = type;
int iconSize = NppParameters::getInstance()->_dpiManager.scaleX(_state == TB_LARGE?32:16); int iconSize = NppParameters::getInstance()._dpiManager.scaleX(_state == TB_LARGE?32:16);
_toolBarIcons.init(buttonUnitArray, arraySize); _toolBarIcons.init(buttonUnitArray, arraySize);
_toolBarIcons.create(_hInst, iconSize); _toolBarIcons.create(_hInst, iconSize);
@ -214,7 +214,7 @@ void ToolBar::reduce()
if (_state == TB_SMALL) if (_state == TB_SMALL)
return; return;
int iconDpiDynamicalSize = NppParameters::getInstance()->_dpiManager.scaleX(16); int iconDpiDynamicalSize = NppParameters::getInstance()._dpiManager.scaleX(16);
_toolBarIcons.resizeIcon(iconDpiDynamicalSize); _toolBarIcons.resizeIcon(iconDpiDynamicalSize);
bool recreate = (_state == TB_STANDARD || _state == TB_LARGE); bool recreate = (_state == TB_STANDARD || _state == TB_LARGE);
setState(TB_SMALL); setState(TB_SMALL);
@ -227,7 +227,7 @@ void ToolBar::enlarge()
if (_state == TB_LARGE) if (_state == TB_LARGE)
return; return;
int iconDpiDynamicalSize = NppParameters::getInstance()->_dpiManager.scaleX(32); int iconDpiDynamicalSize = NppParameters::getInstance()._dpiManager.scaleX(32);
_toolBarIcons.resizeIcon(iconDpiDynamicalSize); _toolBarIcons.resizeIcon(iconDpiDynamicalSize);
bool recreate = (_state == TB_STANDARD || _state == TB_SMALL); bool recreate = (_state == TB_STANDARD || _state == TB_SMALL);
setState(TB_LARGE); setState(TB_LARGE);
@ -296,7 +296,7 @@ void ToolBar::reset(bool create)
else else
{ {
//Else set the internal imagelist with standard bitmaps //Else set the internal imagelist with standard bitmaps
int iconDpiDynamicalSize = NppParameters::getInstance()->_dpiManager.scaleX(16);; int iconDpiDynamicalSize = NppParameters::getInstance()._dpiManager.scaleX(16);;
::SendMessage(_hSelf, TB_SETBITMAPSIZE, 0, MAKELPARAM(iconDpiDynamicalSize, iconDpiDynamicalSize)); ::SendMessage(_hSelf, TB_SETBITMAPSIZE, 0, MAKELPARAM(iconDpiDynamicalSize, iconDpiDynamicalSize));
//TBADDBITMAP addbmp = {_hInst, 0}; //TBADDBITMAP addbmp = {_hInst, 0};

View File

@ -100,10 +100,10 @@ void VerticalFileSwitcherListView::initList()
HWND colHeader = reinterpret_cast<HWND>(SendMessage(_hSelf, LVM_GETHEADER, 0, 0)); HWND colHeader = reinterpret_cast<HWND>(SendMessage(_hSelf, LVM_GETHEADER, 0, 0));
int columnCount = static_cast<int32_t>(SendMessage(colHeader, HDM_GETITEMCOUNT, 0, 0)); int columnCount = static_cast<int32_t>(SendMessage(colHeader, HDM_GETITEMCOUNT, 0, 0));
NppParameters *nppParams = NppParameters::getInstance(); NppParameters& nppParams = NppParameters::getInstance();
NativeLangSpeaker *pNativeSpeaker = nppParams->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = nppParams.getNativeLangSpeaker();
bool isExtColumn = !nppParams->getNppGUI()._fileSwitcherWithoutExtColumn; bool isExtColumn = !nppParams.getNppGUI()._fileSwitcherWithoutExtColumn;
// check if columns need to be added // check if columns need to be added
if (columnCount <= 1) if (columnCount <= 1)
@ -214,7 +214,7 @@ void VerticalFileSwitcherListView::setItemIconStatus(BufferID bufferID)
TCHAR fn[MAX_PATH]; TCHAR fn[MAX_PATH];
wcscpy_s(fn, ::PathFindFileName(buf->getFileName())); wcscpy_s(fn, ::PathFindFileName(buf->getFileName()));
bool isExtColumn = !(NppParameters::getInstance())->getNppGUI()._fileSwitcherWithoutExtColumn; bool isExtColumn = !(NppParameters::getInstance()).getNppGUI()._fileSwitcherWithoutExtColumn;
if (isExtColumn) if (isExtColumn)
{ {
::PathRemoveExtension(fn); ::PathRemoveExtension(fn);
@ -291,7 +291,7 @@ int VerticalFileSwitcherListView::add(BufferID bufferID, int iView)
TCHAR fn[MAX_PATH]; TCHAR fn[MAX_PATH];
wcscpy_s(fn, ::PathFindFileName(fileName)); wcscpy_s(fn, ::PathFindFileName(fileName));
bool isExtColumn = !(NppParameters::getInstance())->getNppGUI()._fileSwitcherWithoutExtColumn; bool isExtColumn = !(NppParameters::getInstance()).getNppGUI()._fileSwitcherWithoutExtColumn;
if (isExtColumn) if (isExtColumn)
{ {
::PathRemoveExtension(fn); ::PathRemoveExtension(fn);
@ -370,8 +370,8 @@ void VerticalFileSwitcherListView::insertColumn(const TCHAR *name, int width, in
void VerticalFileSwitcherListView::resizeColumns(int totalWidth) void VerticalFileSwitcherListView::resizeColumns(int totalWidth)
{ {
NppParameters *nppParams = NppParameters::getInstance(); NppParameters& nppParams = NppParameters::getInstance();
bool isExtColumn = !nppParams->getNppGUI()._fileSwitcherWithoutExtColumn; bool isExtColumn = !nppParams.getNppGUI()._fileSwitcherWithoutExtColumn;
if (isExtColumn) if (isExtColumn)
{ {
ListView_SetColumnWidth(_hSelf, 0, totalWidth - 50); ListView_SetColumnWidth(_hSelf, 0, totalWidth - 50);

View File

@ -243,7 +243,7 @@ INT_PTR CALLBACK WindowsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPa
{ {
case WM_INITDIALOG : case WM_INITDIALOG :
{ {
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
pNativeSpeaker->changeDlgLang(_hSelf, "Window"); pNativeSpeaker->changeDlgLang(_hSelf, "Window");
return MyBaseClass::run_dlgProc(message, wParam, lParam); return MyBaseClass::run_dlgProc(message, wParam, lParam);
} }
@ -361,8 +361,8 @@ INT_PTR CALLBACK WindowsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPa
else if (pLvdi->item.iSubItem == 2) // Type else if (pLvdi->item.iSubItem == 2) // Type
{ {
int len = pLvdi->item.cchTextMax; int len = pLvdi->item.cchTextMax;
NppParameters *pNppParameters = NppParameters::getInstance(); NppParameters& nppParameters = NppParameters::getInstance();
Lang *lang = pNppParameters->getLangFromID(buf->getLangType()); Lang *lang = nppParameters.getLangFromID(buf->getLangType());
if (NULL != lang) if (NULL != lang)
{ {
generic_strncpy(pLvdi->item.pszText, lang->getLangName(), len-1); generic_strncpy(pLvdi->item.pszText, lang->getLangName(), len-1);
@ -502,7 +502,7 @@ BOOL WindowsDlg::onInitDialog()
lvColumn.fmt = LVCFMT_LEFT; lvColumn.fmt = LVCFMT_LEFT;
generic_string columnText; generic_string columnText;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
columnText = TEXT("\u21F5 ") + pNativeSpeaker->getAttrNameStr(TEXT("Name"), WD_ROOTNODE, WD_CLMNNAME); columnText = TEXT("\u21F5 ") + pNativeSpeaker->getAttrNameStr(TEXT("Name"), WD_ROOTNODE, WD_CLMNNAME);
lvColumn.pszText = const_cast<TCHAR *>(columnText.c_str()); lvColumn.pszText = const_cast<TCHAR *>(columnText.c_str());
@ -544,7 +544,7 @@ void WindowsDlg::updateColumnNames()
lvColumn.fmt = LVCFMT_LEFT; lvColumn.fmt = LVCFMT_LEFT;
generic_string columnText; generic_string columnText;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
columnText = pNativeSpeaker->getAttrNameStr(TEXT("Name"), WD_ROOTNODE, WD_CLMNNAME); columnText = pNativeSpeaker->getAttrNameStr(TEXT("Name"), WD_ROOTNODE, WD_CLMNNAME);
if (_currentColumn != 0) if (_currentColumn != 0)

View File

@ -36,8 +36,8 @@ void RunMacroDlg::initMacroList()
{ {
if (!isCreated()) return; if (!isCreated()) return;
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
std::vector<MacroShortcut> & macroList = pNppParam->getMacroList(); std::vector<MacroShortcut> & macroList = nppParam.getMacroList();
::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_RESETCONTENT, 0, 0); ::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_RESETCONTENT, 0, 0);
@ -143,3 +143,4 @@ int RunMacroDlg::getMacro2Exec() const
bool isCurMacroPresent = ::SendMessage(_hParent, WM_GETCURRENTMACROSTATUS, 0, 0) == MACRO_RECORDING_HAS_STOPPED; bool isCurMacroPresent = ::SendMessage(_hParent, WM_GETCURRENTMACROSTATUS, 0, 0) == MACRO_RECORDING_HAS_STOPPED;
return isCurMacroPresent?(_macroIndex - 1):_macroIndex; return isCurMacroPresent?(_macroIndex - 1):_macroIndex;
} }

View File

@ -303,19 +303,19 @@ void getNameStrFromCmd(DWORD cmd, generic_string & str)
{ {
if ((cmd >= ID_MACRO) && (cmd < ID_MACRO_LIMIT)) if ((cmd >= ID_MACRO) && (cmd < ID_MACRO_LIMIT))
{ {
vector<MacroShortcut> & theMacros = (NppParameters::getInstance())->getMacroList(); vector<MacroShortcut> & theMacros = (NppParameters::getInstance()).getMacroList();
int i = cmd - ID_MACRO; int i = cmd - ID_MACRO;
str = theMacros[i].getName(); str = theMacros[i].getName();
} }
else if ((cmd >= ID_USER_CMD) && (cmd < ID_USER_CMD_LIMIT)) else if ((cmd >= ID_USER_CMD) && (cmd < ID_USER_CMD_LIMIT))
{ {
vector<UserCommand> & userCommands = (NppParameters::getInstance())->getUserCommandList(); vector<UserCommand> & userCommands = (NppParameters::getInstance()).getUserCommandList();
int i = cmd - ID_USER_CMD; int i = cmd - ID_USER_CMD;
str = userCommands[i].getName(); str = userCommands[i].getName();
} }
else if ((cmd >= ID_PLUGINS_CMD) && (cmd < ID_PLUGINS_CMD_LIMIT)) else if ((cmd >= ID_PLUGINS_CMD) && (cmd < ID_PLUGINS_CMD_LIMIT))
{ {
vector<PluginCmdShortcut> & pluginCmds = (NppParameters::getInstance())->getPluginCommandList(); vector<PluginCmdShortcut> & pluginCmds = (NppParameters::getInstance()).getPluginCommandList();
size_t i = 0; size_t i = 0;
for (size_t j = 0, len = pluginCmds.size(); j < len ; ++j) for (size_t j = 0, len = pluginCmds.size(); j < len ; ++j)
{ {
@ -410,7 +410,7 @@ INT_PTR CALLBACK Shortcut::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
::ShowWindow(::GetDlgItem(_hSelf, IDC_WARNING_STATIC), SW_HIDE); ::ShowWindow(::GetDlgItem(_hSelf, IDC_WARNING_STATIC), SW_HIDE);
updateConflictState(); updateConflictState();
NativeLangSpeaker* nativeLangSpeaker = NppParameters::getInstance()->getNativeLangSpeaker(); NativeLangSpeaker* nativeLangSpeaker = NppParameters::getInstance().getNativeLangSpeaker();
nativeLangSpeaker->changeDlgLang(_hSelf, "ShortcutMapperSubDialg"); nativeLangSpeaker->changeDlgLang(_hSelf, "ShortcutMapperSubDialg");
goToCenter(); goToCenter();
return TRUE; return TRUE;
@ -490,12 +490,12 @@ void Accelerator::updateShortcuts()
{ {
const array<unsigned long, 3> incrFindAccIds = { IDM_SEARCH_FINDNEXT, IDM_SEARCH_FINDPREV, IDM_SEARCH_FINDINCREMENT }; const array<unsigned long, 3> incrFindAccIds = { IDM_SEARCH_FINDNEXT, IDM_SEARCH_FINDPREV, IDM_SEARCH_FINDINCREMENT };
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
vector<CommandShortcut> & shortcuts = pNppParam->getUserShortcuts(); vector<CommandShortcut> & shortcuts = nppParam.getUserShortcuts();
vector<MacroShortcut> & macros = pNppParam->getMacroList(); vector<MacroShortcut> & macros = nppParam.getMacroList();
vector<UserCommand> & userCommands = pNppParam->getUserCommandList(); vector<UserCommand> & userCommands = nppParam.getUserCommandList();
vector<PluginCmdShortcut> & pluginCommands = pNppParam->getPluginCommandList(); vector<PluginCmdShortcut> & pluginCommands = nppParam.getPluginCommandList();
size_t nbMenu = shortcuts.size(); size_t nbMenu = shortcuts.size();
size_t nbMacro = macros.size(); size_t nbMacro = macros.size();
@ -602,26 +602,26 @@ void Accelerator::updateShortcuts()
void Accelerator::updateFullMenu() void Accelerator::updateFullMenu()
{ {
NppParameters * pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
vector<CommandShortcut> commands = pNppParam->getUserShortcuts(); vector<CommandShortcut> commands = nppParam.getUserShortcuts();
for (size_t i = 0; i < commands.size(); ++i) for (size_t i = 0; i < commands.size(); ++i)
{ {
updateMenuItemByCommand(commands[i]); updateMenuItemByCommand(commands[i]);
} }
vector<MacroShortcut> mcommands = pNppParam->getMacroList(); vector<MacroShortcut> mcommands = nppParam.getMacroList();
for (size_t i = 0; i < mcommands.size(); ++i) for (size_t i = 0; i < mcommands.size(); ++i)
{ {
updateMenuItemByCommand(mcommands[i]); updateMenuItemByCommand(mcommands[i]);
} }
vector<UserCommand> ucommands = pNppParam->getUserCommandList(); vector<UserCommand> ucommands = nppParam.getUserCommandList();
for (size_t i = 0; i < ucommands.size(); ++i) for (size_t i = 0; i < ucommands.size(); ++i)
{ {
updateMenuItemByCommand(ucommands[i]); updateMenuItemByCommand(ucommands[i]);
} }
vector<PluginCmdShortcut> pcommands = pNppParam->getPluginCommandList(); vector<PluginCmdShortcut> pcommands = nppParam.getPluginCommandList();
for (size_t i = 0; i < pcommands.size(); ++i) for (size_t i = 0; i < pcommands.size(); ++i)
{ {
updateMenuItemByCommand(pcommands[i]); updateMenuItemByCommand(pcommands[i]);
@ -880,8 +880,8 @@ void ScintillaAccelerator::init(vector<HWND> * vScintillas, HMENU hMenu, HWND me
void ScintillaAccelerator::updateKeys() void ScintillaAccelerator::updateKeys()
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
vector<ScintillaKeyMap> & map = pNppParam->getScintillaKeyList(); vector<ScintillaKeyMap> & map = nppParam.getScintillaKeyList();
size_t mapSize = map.size(); size_t mapSize = map.size();
size_t index; size_t index;
size_t nb = nbScintillas(); size_t nb = nbScintillas();
@ -1017,7 +1017,7 @@ INT_PTR CALLBACK ScintillaKeyMap::run_dlgProc(UINT Message, WPARAM wParam, LPARA
// Hide this warning on startup // Hide this warning on startup
::ShowWindow(::GetDlgItem(_hSelf, IDC_WARNING_STATIC), SW_HIDE); ::ShowWindow(::GetDlgItem(_hSelf, IDC_WARNING_STATIC), SW_HIDE);
NativeLangSpeaker* nativeLangSpeaker = NppParameters::getInstance()->getNativeLangSpeaker(); NativeLangSpeaker* nativeLangSpeaker = NppParameters::getInstance().getNativeLangSpeaker();
nativeLangSpeaker->changeDlgLang(_hSelf, "ShortcutMapperSubDialg"); nativeLangSpeaker->changeDlgLang(_hSelf, "ShortcutMapperSubDialg");
goToCenter(); goToCenter();
return TRUE; return TRUE;

View File

@ -94,12 +94,12 @@ void LastRecentFileList::switchMode()
void LastRecentFileList::updateMenu() void LastRecentFileList::updateMenu()
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
if (!_hasSeparators && _size > 0) if (!_hasSeparators && _size > 0)
{ {
//add separators //add separators
NativeLangSpeaker *pNativeLangSpeaker = pNppParam->getNativeLangSpeaker(); NativeLangSpeaker *pNativeLangSpeaker = nppParam.getNativeLangSpeaker();
generic_string recentFileList = pNativeLangSpeaker->getSpecialMenuEntryName("RecentFiles"); generic_string recentFileList = pNativeLangSpeaker->getSpecialMenuEntryName("RecentFiles");
generic_string openRecentClosedFile = pNativeLangSpeaker->getNativeLangMenuString(IDM_FILE_RESTORELASTCLOSEDFILE); generic_string openRecentClosedFile = pNativeLangSpeaker->getNativeLangMenuString(IDM_FILE_RESTORELASTCLOSEDFILE);
@ -160,7 +160,7 @@ void LastRecentFileList::updateMenu()
//Then readd them, so everything stays in sync //Then readd them, so everything stays in sync
for (int j = 0; j < _size; ++j) for (int j = 0; j < _size; ++j)
{ {
generic_string strBuffer(BuildMenuFileName(pNppParam->getRecentFileCustomLength(), j, _lrfl.at(j)._name)); generic_string strBuffer(BuildMenuFileName(nppParam.getRecentFileCustomLength(), j, _lrfl.at(j)._name));
::InsertMenu(_hMenu, _posBase + j, MF_BYPOSITION, _lrfl.at(j)._id, strBuffer.c_str()); ::InsertMenu(_hMenu, _posBase + j, MF_BYPOSITION, _lrfl.at(j)._id, strBuffer.c_str());
} }
@ -269,12 +269,12 @@ void LastRecentFileList::setUserMaxNbLRF(int size)
void LastRecentFileList::saveLRFL() void LastRecentFileList::saveLRFL()
{ {
NppParameters *pNppParams = NppParameters::getInstance(); NppParameters& nppParams = NppParameters::getInstance();
if (pNppParams->writeRecentFileHistorySettings(_userMax)) if (nppParams.writeRecentFileHistorySettings(_userMax))
{ {
for (int i = _size - 1; i >= 0; i--) //reverse order: so loading goes in correct order for (int i = _size - 1; i >= 0; i--) //reverse order: so loading goes in correct order
{ {
pNppParams->writeHistory(_lrfl.at(i)._name.c_str()); nppParams.writeHistory(_lrfl.at(i)._name.c_str());
} }
} }
} }

View File

@ -43,7 +43,7 @@ class LastRecentFileList
{ {
public: public:
LastRecentFileList() { LastRecentFileList() {
_userMax = (NppParameters::getInstance())->getNbMaxRecentFile(); _userMax = (NppParameters::getInstance()).getNbMaxRecentFile();
for (int i = 0; i < NB_MAX_LRF_FILE; i++) for (int i = 0; i < NB_MAX_LRF_FILE; i++)
_idFreeArray[i] = false; _idFreeArray[i] = false;
}; };

View File

@ -716,7 +716,7 @@ void NativeLangSpeaker::changeFindReplaceDlgLang(FindReplaceDlg & findReplaceDlg
TiXmlNodeA *dlgNode = _nativeLangA->FirstChild("Dialog"); TiXmlNodeA *dlgNode = _nativeLangA->FirstChild("Dialog");
if (dlgNode) if (dlgNode)
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
dlgNode = searchDlgNode(dlgNode, "Find"); dlgNode = searchDlgNode(dlgNode, "Find");
if (dlgNode) if (dlgNode)
{ {
@ -730,26 +730,26 @@ void NativeLangSpeaker::changeFindReplaceDlgLang(FindReplaceDlg & findReplaceDlg
if (titre1 && titre1[0]) if (titre1 && titre1[0])
{ {
basic_string<wchar_t> nameW = wmc.char2wchar(titre1, _nativeLangEncoding); basic_string<wchar_t> nameW = wmc.char2wchar(titre1, _nativeLangEncoding);
pNppParam->getFindDlgTabTitiles()._find = nameW; nppParam.getFindDlgTabTitiles()._find = nameW;
findReplaceDlg.changeTabName(FIND_DLG, pNppParam->getFindDlgTabTitiles()._find.c_str()); findReplaceDlg.changeTabName(FIND_DLG, nppParam.getFindDlgTabTitiles()._find.c_str());
} }
if (titre2 && titre2[0]) if (titre2 && titre2[0])
{ {
basic_string<wchar_t> nameW = wmc.char2wchar(titre2, _nativeLangEncoding); basic_string<wchar_t> nameW = wmc.char2wchar(titre2, _nativeLangEncoding);
pNppParam->getFindDlgTabTitiles()._replace = nameW; nppParam.getFindDlgTabTitiles()._replace = nameW;
findReplaceDlg.changeTabName(REPLACE_DLG, pNppParam->getFindDlgTabTitiles()._replace.c_str()); findReplaceDlg.changeTabName(REPLACE_DLG, nppParam.getFindDlgTabTitiles()._replace.c_str());
} }
if (titre3 && titre3[0]) if (titre3 && titre3[0])
{ {
basic_string<wchar_t> nameW = wmc.char2wchar(titre3, _nativeLangEncoding); basic_string<wchar_t> nameW = wmc.char2wchar(titre3, _nativeLangEncoding);
pNppParam->getFindDlgTabTitiles()._findInFiles = nameW; nppParam.getFindDlgTabTitiles()._findInFiles = nameW;
findReplaceDlg.changeTabName(FINDINFILES_DLG, pNppParam->getFindDlgTabTitiles()._findInFiles.c_str()); findReplaceDlg.changeTabName(FINDINFILES_DLG, nppParam.getFindDlgTabTitiles()._findInFiles.c_str());
} }
if (titre4 && titre4[0]) if (titre4 && titre4[0])
{ {
basic_string<wchar_t> nameW = wmc.char2wchar(titre4, _nativeLangEncoding); basic_string<wchar_t> nameW = wmc.char2wchar(titre4, _nativeLangEncoding);
pNppParam->getFindDlgTabTitiles()._mark = nameW; nppParam.getFindDlgTabTitiles()._mark = nameW;
findReplaceDlg.changeTabName(MARK_DLG, pNppParam->getFindDlgTabTitiles()._mark.c_str()); findReplaceDlg.changeTabName(MARK_DLG, nppParam.getFindDlgTabTitiles()._mark.c_str());
} }
} }
} }
@ -941,9 +941,9 @@ void NativeLangSpeaker::changeShortcutLang()
{ {
if (!_nativeLangA) return; if (!_nativeLangA) return;
NppParameters * pNppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
vector<CommandShortcut> & mainshortcuts = pNppParam->getUserShortcuts(); vector<CommandShortcut> & mainshortcuts = nppParam.getUserShortcuts();
vector<ScintillaKeyMap> & scinshortcuts = pNppParam->getScintillaKeyList(); vector<ScintillaKeyMap> & scinshortcuts = nppParam.getScintillaKeyList();
TiXmlNodeA *shortcuts = _nativeLangA->FirstChild("Shortcuts"); TiXmlNodeA *shortcuts = _nativeLangA->FirstChild("Shortcuts");
if (!shortcuts) return; if (!shortcuts) return;

View File

@ -38,7 +38,7 @@ namespace
{ {
void allowWmCopydataMessages(Notepad_plus_Window& notepad_plus_plus, const NppParameters* pNppParameters, winVer ver) void allowWmCopydataMessages(Notepad_plus_Window& notepad_plus_plus, const NppParameters& nppParameters, winVer ver)
{ {
#ifndef MSGFLT_ADD #ifndef MSGFLT_ADD
const DWORD MSGFLT_ADD = 1; const DWORD MSGFLT_ADD = 1;
@ -55,7 +55,7 @@ void allowWmCopydataMessages(Notepad_plus_Window& notepad_plus_plus, const NppPa
{ {
// According to MSDN ChangeWindowMessageFilter may not be supported in future versions of Windows, // According to MSDN ChangeWindowMessageFilter may not be supported in future versions of Windows,
// that is why we use ChangeWindowMessageFilterEx if it is available (windows version >= Win7). // that is why we use ChangeWindowMessageFilterEx if it is available (windows version >= Win7).
if (pNppParameters->getWinVersion() == WV_VISTA) if (nppParameters.getWinVersion() == WV_VISTA)
{ {
typedef BOOL (WINAPI *MESSAGEFILTERFUNC)(UINT message,DWORD dwFlag); typedef BOOL (WINAPI *MESSAGEFILTERFUNC)(UINT message,DWORD dwFlag);
@ -408,8 +408,8 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR pCmdLine, int)
if (showHelp) if (showHelp)
::MessageBox(NULL, COMMAND_ARG_HELP, TEXT("Notepad++ Command Argument Help"), MB_OK); ::MessageBox(NULL, COMMAND_ARG_HELP, TEXT("Notepad++ Command Argument Help"), MB_OK);
NppParameters *pNppParameters = NppParameters::getInstance(); NppParameters& nppParameters = NppParameters::getInstance();
NppGUI & nppGui = const_cast<NppGUI &>(pNppParameters->getNppGUI()); NppGUI & nppGui = const_cast<NppGUI &>(nppParameters.getNppGUI());
bool doUpdateNpp = nppGui._autoUpdateOpt._doAutoUpdate; bool doUpdateNpp = nppGui._autoUpdateOpt._doAutoUpdate;
bool doUpdatePluginList = nppGui._autoUpdateOpt._doAutoUpdate; bool doUpdatePluginList = nppGui._autoUpdateOpt._doAutoUpdate;
@ -422,15 +422,15 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR pCmdLine, int)
if (cmdLineParams._localizationPath != TEXT("")) if (cmdLineParams._localizationPath != TEXT(""))
{ {
pNppParameters->setStartWithLocFileName(cmdLineParams._localizationPath); nppParameters.setStartWithLocFileName(cmdLineParams._localizationPath);
} }
pNppParameters->load(); nppParameters.load();
pNppParameters->setFunctionListExportBoolean(doFunctionListExport); nppParameters.setFunctionListExportBoolean(doFunctionListExport);
pNppParameters->setPrintAndExitBoolean(doPrintAndQuit); nppParameters.setPrintAndExitBoolean(doPrintAndQuit);
// override the settings if notepad style is present // override the settings if notepad style is present
if (pNppParameters->asNotepadStyle()) if (nppParameters.asNotepadStyle())
{ {
isMultiInst = true; isMultiInst = true;
cmdLineParams._isNoTab = true; cmdLineParams._isNoTab = true;
@ -438,7 +438,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR pCmdLine, int)
} }
// override the settings if multiInst is choosen by user in the preference dialog // override the settings if multiInst is choosen by user in the preference dialog
const NppGUI & nppGUI = pNppParameters->getNppGUI(); const NppGUI & nppGUI = nppParameters.getNppGUI();
if (nppGUI._multiInstSetting == multiInst) if (nppGUI._multiInstSetting == multiInst)
{ {
isMultiInst = true; isMultiInst = true;
@ -465,7 +465,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR pCmdLine, int)
} }
//Only after loading all the file paths set the working directory //Only after loading all the file paths set the working directory
::SetCurrentDirectory(NppParameters::getInstance()->getNppPath().c_str()); //force working directory to path of module, preventing lock ::SetCurrentDirectory(NppParameters::getInstance().getNppPath().c_str()); //force working directory to path of module, preventing lock
if ((!isMultiInst) && (!TheFirstOne)) if ((!isMultiInst) && (!TheFirstOne))
{ {
@ -479,7 +479,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR pCmdLine, int)
if (hNotepad_plus) if (hNotepad_plus)
{ {
// First of all, destroy static object NppParameters // First of all, destroy static object NppParameters
pNppParameters->destroyInstance(); nppParameters.destroyInstance();
int sw = 0; int sw = 0;
@ -516,7 +516,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR pCmdLine, int)
Notepad_plus_Window notepad_plus_plus; Notepad_plus_Window notepad_plus_plus;
generic_string updaterDir = pNppParameters->getNppPath(); generic_string updaterDir = nppParameters.getNppPath();
updaterDir += TEXT("\\updater\\"); updaterDir += TEXT("\\updater\\");
generic_string updaterFullPath = updaterDir + TEXT("gup.exe"); generic_string updaterFullPath = updaterDir + TEXT("gup.exe");
@ -540,7 +540,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR pCmdLine, int)
} }
// wingup doesn't work with the obsolet security layer (API) under xp since downloadings are secured with SSL on notepad_plus_plus.org // wingup doesn't work with the obsolet security layer (API) under xp since downloadings are secured with SSL on notepad_plus_plus.org
winVer ver = pNppParameters->getWinVersion(); winVer ver = nppParameters.getWinVersion();
bool isGtXP = ver > WV_XP; bool isGtXP = ver > WV_XP;
SecurityGard securityGard; SecurityGard securityGard;
@ -548,7 +548,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR pCmdLine, int)
if (TheFirstOne && isUpExist && isGtXP && isSignatureOK) if (TheFirstOne && isUpExist && isGtXP && isSignatureOK)
{ {
if (pNppParameters->isx64()) if (nppParameters.isx64())
{ {
updaterParams += TEXT(" -px64"); updaterParams += TEXT(" -px64");
} }
@ -589,7 +589,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR pCmdLine, int)
try try
{ {
notepad_plus_plus.init(hInstance, NULL, quotFileName.c_str(), &cmdLineParams); notepad_plus_plus.init(hInstance, NULL, quotFileName.c_str(), &cmdLineParams);
allowWmCopydataMessages(notepad_plus_plus, pNppParameters, ver); allowWmCopydataMessages(notepad_plus_plus, nppParameters, ver);
bool going = true; bool going = true;
while (going) while (going)
{ {