本文整理汇总了C++中NppParameters::getNppPath方法的典型用法代码示例。如果您正苦于以下问题:C++ NppParameters::getNppPath方法的具体用法?C++ NppParameters::getNppPath怎么用?C++ NppParameters::getNppPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NppParameters
的用法示例。
在下文中一共展示了NppParameters::getNppPath方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadPlugins
bool PluginsManager::loadPlugins(const TCHAR *dir)
{
if (_isDisabled)
return false;
vector<generic_string> dllNames;
vector<generic_string> dll2Remove;
NppParameters * nppParams = NppParameters::getInstance();
generic_string nppPath = nppParams->getNppPath();
generic_string pluginsFullPathFilter = (dir && dir[0])?dir:nppPath;
pluginsFullPathFilter += TEXT("\\plugins\\*.dll");
WIN32_FIND_DATA foundData;
HANDLE hFindFile = ::FindFirstFile(pluginsFullPathFilter.c_str(), &foundData);
if (hFindFile != INVALID_HANDLE_VALUE)
{
generic_string plugins1stFullPath = (dir && dir[0])?dir:nppPath;
plugins1stFullPath += TEXT("\\plugins\\");
plugins1stFullPath += foundData.cFileName;
dllNames.push_back(plugins1stFullPath);
while (::FindNextFile(hFindFile, &foundData))
{
bool isInBlackList = nppParams->isInBlackList(foundData.cFileName);
if (!isInBlackList)
{
generic_string fullPath = (dir && dir[0])?dir:nppPath;
fullPath += TEXT("\\plugins\\");
fullPath += foundData.cFileName;
dllNames.push_back(fullPath);
}
PluginList & pl = nppParams->getPluginList();
pl.add(foundData.cFileName, isInBlackList);
}
::FindClose(hFindFile);
for (size_t i = 0, len = dllNames.size(); i < len ; ++i)
{
loadPlugin(dllNames[i].c_str(), dll2Remove);
}
}
for (size_t j = 0, len = dll2Remove.size() ; j < len ; ++j)
::DeleteFile(dll2Remove[j].c_str());
std::sort(_pluginInfos.begin(), _pluginInfos.end(), [](const PluginInfo *a, const PluginInfo *b) { return a->_funcName < b->_funcName; });
return true;
}
示例2: WinMain
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
{
LPTSTR cmdLine = ::GetCommandLine();
ParamVector params;
parseCommandLine(cmdLine, params);
MiniDumper mdump; //for debugging purposes.
bool TheFirstOne = true;
::SetLastError(NO_ERROR);
::CreateMutex(NULL, false, TEXT("nppInstance"));
if (::GetLastError() == ERROR_ALREADY_EXISTS)
TheFirstOne = false;
bool isParamePresent;
bool showHelp = isInList(FLAG_HELP, params);
bool isMultiInst = isInList(FLAG_MULTI_INSTANCE, params);
CmdLineParams cmdLineParams;
cmdLineParams._isNoTab = isInList(FLAG_NOTABBAR, params);
cmdLineParams._isNoPlugin = isInList(FLAG_NO_PLUGIN, params);
cmdLineParams._isReadOnly = isInList(FLAG_READONLY, params);
cmdLineParams._isNoSession = isInList(FLAG_NOSESSION, params);
cmdLineParams._isPreLaunch = isInList(FLAG_SYSTRAY, params);
cmdLineParams._alwaysOnTop = isInList(FLAG_ALWAYS_ON_TOP, params);
cmdLineParams._showLoadingTime = isInList(FLAG_LOADINGTIME, params);
cmdLineParams._isSessionFile = isInList(FLAG_OPENSESSIONFILE, params);
cmdLineParams._isRecursive = isInList(FLAG_RECURSIVE, params);
cmdLineParams._langType = getLangTypeFromParam(params);
cmdLineParams._localizationPath = getLocalizationPathFromParam(params);
cmdLineParams._line2go = getNumberFromParam('n', params, isParamePresent);
cmdLineParams._column2go = getNumberFromParam('c', params, isParamePresent);
cmdLineParams._point.x = getNumberFromParam('x', params, cmdLineParams._isPointXValid);
cmdLineParams._point.y = getNumberFromParam('y', params, cmdLineParams._isPointYValid);
if (showHelp)
{
::MessageBox(NULL, COMMAND_ARG_HELP, TEXT("Notepad++ Command Argument Help"), MB_OK);
}
NppParameters *pNppParameters = NppParameters::getInstance();
if (cmdLineParams._localizationPath != TEXT(""))
{
pNppParameters->setStartWithLocFileName(cmdLineParams._localizationPath);
}
pNppParameters->load();
// override the settings if notepad style is present
if (pNppParameters->asNotepadStyle())
{
isMultiInst = true;
cmdLineParams._isNoTab = true;
cmdLineParams._isNoSession = true;
}
// override the settings if multiInst is choosen by user in the preference dialog
const NppGUI & nppGUI = pNppParameters->getNppGUI();
if (nppGUI._multiInstSetting == multiInst)
{
isMultiInst = true;
// Only the first launch remembers the session
if (!TheFirstOne)
cmdLineParams._isNoSession = true;
}
generic_string quotFileName = TEXT("");
// tell the running instance the FULL path to the new files to load
size_t nrFilesToOpen = params.size();
const TCHAR * currentFile;
TCHAR fullFileName[MAX_PATH];
for(size_t i = 0; i < nrFilesToOpen; ++i)
{
currentFile = params.at(i);
if (currentFile[0])
{
//check if relative or full path. Relative paths dont have a colon for driveletter
BOOL isRelative = ::PathIsRelative(currentFile);
quotFileName += TEXT("\"");
if (isRelative)
{
::GetFullPathName(currentFile, MAX_PATH, fullFileName, NULL);
quotFileName += fullFileName;
}
else
{
if ((currentFile[0] == '\\' && currentFile[1] != '\\') || currentFile[0] == '/')
{
quotFileName += getDriveLetter();
quotFileName += ':';
}
quotFileName += currentFile;
}
quotFileName += TEXT("\" ");
}
}
//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
//.........这里部分代码省略.........
示例3: loadPlugin
int PluginsManager::loadPlugin(const generic_string& pluginFilePath, std::vector<generic_string> & dll2Remove)
{
PluginInfo *pi = new PluginInfo;
try {
pi->_moduleName = PathFindFileName(pluginFilePath.c_str());
pi->_hLib = ::LoadLibrary(pluginFilePath.c_str());
if (!pi->_hLib)
throw generic_string(TEXT("Load Library is failed.\nMake \"Runtime Library\" setting of this project as \"Multi-threaded(/MT)\" may cure this problem."));
pi->_pFuncIsUnicode = (PFUNCISUNICODE)GetProcAddress(pi->_hLib, "isUnicode");
#ifdef UNICODE
if (!pi->_pFuncIsUnicode || !pi->_pFuncIsUnicode())
throw generic_string(TEXT("This ANSI plugin is not compatible with your Unicode Notepad++."));
#else
if (pi->_pFuncIsUnicode)
throw generic_string(TEXT("This Unicode plugin is not compatible with your ANSI mode Notepad++."));
#endif
pi->_pFuncSetInfo = (PFUNCSETINFO)GetProcAddress(pi->_hLib, "setInfo");
if (!pi->_pFuncSetInfo)
throw generic_string(TEXT("Missing \"setInfo\" function"));
pi->_pFuncGetName = (PFUNCGETNAME)GetProcAddress(pi->_hLib, "getName");
if (!pi->_pFuncGetName)
throw generic_string(TEXT("Missing \"getName\" function"));
pi->_pBeNotified = (PBENOTIFIED)GetProcAddress(pi->_hLib, "beNotified");
if (!pi->_pBeNotified)
throw generic_string(TEXT("Missing \"beNotified\" function"));
pi->_pMessageProc = (PMESSAGEPROC)GetProcAddress(pi->_hLib, "messageProc");
if (!pi->_pMessageProc)
throw generic_string(TEXT("Missing \"messageProc\" function"));
pi->_pFuncSetInfo(_nppData);
pi->_pFuncGetFuncsArray = (PFUNCGETFUNCSARRAY)GetProcAddress(pi->_hLib, "getFuncsArray");
if (!pi->_pFuncGetFuncsArray)
throw generic_string(TEXT("Missing \"getFuncsArray\" function"));
pi->_funcItems = pi->_pFuncGetFuncsArray(&pi->_nbFuncItem);
if ((!pi->_funcItems) || (pi->_nbFuncItem <= 0))
throw generic_string(TEXT("Missing \"FuncItems\" array, or the nb of Function Item is not set correctly"));
pi->_pluginMenu = ::CreateMenu();
GetLexerCountFn GetLexerCount = (GetLexerCountFn)::GetProcAddress(pi->_hLib, "GetLexerCount");
// it's a lexer plugin
if (GetLexerCount)
{
GetLexerNameFn GetLexerName = (GetLexerNameFn)::GetProcAddress(pi->_hLib, "GetLexerName");
if (!GetLexerName)
throw generic_string(TEXT("Loading GetLexerName function failed."));
GetLexerStatusTextFn GetLexerStatusText = (GetLexerStatusTextFn)::GetProcAddress(pi->_hLib, "GetLexerStatusText");
if (!GetLexerStatusText)
throw generic_string(TEXT("Loading GetLexerStatusText function failed."));
// Assign a buffer for the lexer name.
char lexName[MAX_EXTERNAL_LEXER_NAME_LEN];
lexName[0] = '\0';
TCHAR lexDesc[MAX_EXTERNAL_LEXER_DESC_LEN];
lexDesc[0] = '\0';
int numLexers = GetLexerCount();
NppParameters * nppParams = NppParameters::getInstance();
ExternalLangContainer *containers[30];
#ifdef UNICODE
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
#endif
for (int x = 0; x < numLexers; x++)
{
GetLexerName(x, lexName, MAX_EXTERNAL_LEXER_NAME_LEN);
GetLexerStatusText(x, lexDesc, MAX_EXTERNAL_LEXER_DESC_LEN);
#ifdef UNICODE
const TCHAR *pLexerName = wmc->char2wchar(lexName, CP_ACP);
#else
const TCHAR *pLexerName = lexName;
#endif
if (!nppParams->isExistingExternalLangName(pLexerName) && nppParams->ExternalLangHasRoom())
containers[x] = new ExternalLangContainer(pLexerName, lexDesc);
else
containers[x] = NULL;
}
TCHAR xmlPath[MAX_PATH];
lstrcpy(xmlPath, nppParams->getNppPath().c_str());
PathAppend(xmlPath, TEXT("plugins\\Config"));
PathAppend(xmlPath, pi->_moduleName.c_str());
PathRemoveExtension(xmlPath);
PathAddExtension(xmlPath, TEXT(".xml"));
if (!PathFileExists(xmlPath))
{
//.........这里部分代码省略.........
示例4: init
//.........这里部分代码省略.........
::SetMenu(_hSelf, NULL);
if (cmdLineParams->_isNoTab || (nppGUI._tabStatus & TAB_HIDE))
{
::SendMessage(_hSelf, NPPM_HIDETABBAR, 0, TRUE);
}
if (cmdLineParams->_alwaysOnTop)
{
::SendMessage(_hSelf, WM_COMMAND, IDM_VIEW_ALWAYSONTOP, 0);
}
_notepad_plus_plus_core._rememberThisSession = !cmdLineParams->_isNoSession;
if (nppGUI._rememberLastSession && !cmdLineParams->_isNoSession)
{
_notepad_plus_plus_core.loadLastSession();
}
if (!cmdLineParams->_isPreLaunch)
{
if (cmdLineParams->isPointValid())
::ShowWindow(_hSelf, SW_SHOW);
else
::ShowWindow(_hSelf, nppGUI._isMaximized?SW_MAXIMIZE:SW_SHOW);
}
else
{
_notepad_plus_plus_core._pTrayIco = new trayIconControler(_hSelf, IDI_M30ICON, IDC_MINIMIZED_TRAY, ::LoadIcon(_hInst, MAKEINTRESOURCE(IDI_M30ICON)), TEXT(""));
_notepad_plus_plus_core._pTrayIco->doTrayIcon(ADD);
}
if (cmdLine)
{
_notepad_plus_plus_core.loadCommandlineParams(cmdLine, cmdLineParams);
}
vector<generic_string> fileNames;
vector<generic_string> patterns;
patterns.push_back(TEXT("*.xml"));
generic_string nppDir = pNppParams->getNppPath();
#ifdef UNICODE
LocalizationSwitcher & localizationSwitcher = pNppParams->getLocalizationSwitcher();
wstring localizationDir = nppDir;
PathAppend(localizationDir, TEXT("localization\\"));
_notepad_plus_plus_core.getMatchedFileNames(localizationDir.c_str(), patterns, fileNames, false, false);
for (size_t i = 0 ; i < fileNames.size() ; i++)
{
localizationSwitcher.addLanguageFromXml(fileNames[i].c_str());
}
#endif
fileNames.clear();
ThemeSwitcher & themeSwitcher = pNppParams->getThemeSwitcher();
// Get themes from both npp install themes dir and app data themes dir with the per user
// overriding default themes of the same name.
generic_string themeDir;
if (pNppParams->getAppDataNppDir() && pNppParams->getAppDataNppDir()[0])
{
themeDir = pNppParams->getAppDataNppDir();
PathAppend(themeDir, TEXT("themes\\"));
_notepad_plus_plus_core.getMatchedFileNames(themeDir.c_str(), patterns, fileNames, false, false);
for (size_t i = 0 ; i < fileNames.size() ; i++)
{
themeSwitcher.addThemeFromXml(fileNames[i].c_str());
}
}
fileNames.clear();
themeDir.clear();
themeDir = nppDir.c_str(); // <- should use the pointer to avoid the constructor of copy
PathAppend(themeDir, TEXT("themes\\"));
_notepad_plus_plus_core.getMatchedFileNames(themeDir.c_str(), patterns, fileNames, false, false);
for (size_t i = 0 ; i < fileNames.size() ; i++)
{
generic_string themeName( themeSwitcher.getThemeFromXmlFileName(fileNames[i].c_str()) );
if (! themeSwitcher.themeNameExists(themeName.c_str()) )
{
themeSwitcher.addThemeFromXml(fileNames[i].c_str());
}
}
// Notify plugins that Notepad++ is ready
SCNotification scnN;
scnN.nmhdr.code = NPPN_READY;
scnN.nmhdr.hwndFrom = _hSelf;
scnN.nmhdr.idFrom = 0;
_notepad_plus_plus_core._pluginsManager.notify(&scnN);
if (cmdLineParams->_showLoadingTime)
{
time_t timestampEnd = time(NULL);
double loadTime = difftime(timestampEnd, timestampBegin);
char dest[256];
sprintf(dest, "Loading time : %.2lf seconds", loadTime);
::MessageBoxA(NULL, dest, "", MB_OK);
}
}
示例5: init
//.........这里部分代码省略.........
if (cmdLineParams->_alwaysOnTop)
{
::SendMessage(_hSelf, WM_COMMAND, IDM_VIEW_ALWAYSONTOP, 0);
}
nppGUI._isCmdlineNosessionActivated = cmdLineParams->_isNoSession;
if (nppGUI._rememberLastSession && !cmdLineParams->_isNoSession)
{
_notepad_plus_plus_core.loadLastSession();
}
if (!cmdLineParams->_isPreLaunch)
{
if (cmdLineParams->isPointValid())
::ShowWindow(_hSelf, SW_SHOW);
else
::ShowWindow(_hSelf, nppGUI._isMaximized?SW_MAXIMIZE:SW_SHOW);
}
else
{
_notepad_plus_plus_core._pTrayIco = new trayIconControler(_hSelf, IDI_M30ICON, IDC_MINIMIZED_TRAY, ::LoadIcon(_hInst, MAKEINTRESOURCE(IDI_M30ICON)), TEXT(""));
_notepad_plus_plus_core._pTrayIco->doTrayIcon(ADD);
}
if (cmdLine)
{
_notepad_plus_plus_core.loadCommandlineParams(cmdLine, cmdLineParams);
}
vector<generic_string> fileNames;
vector<generic_string> patterns;
patterns.push_back(TEXT("*.xml"));
generic_string nppDir = pNppParams->getNppPath();
#ifdef UNICODE
LocalizationSwitcher & localizationSwitcher = pNppParams->getLocalizationSwitcher();
wstring localizationDir = nppDir;
PathAppend(localizationDir, TEXT("localization\\"));
_notepad_plus_plus_core.getMatchedFileNames(localizationDir.c_str(), patterns, fileNames, false, false);
for (size_t i = 0, len = fileNames.size(); i < len ; ++i)
{
localizationSwitcher.addLanguageFromXml(fileNames[i].c_str());
}
#endif
fileNames.clear();
ThemeSwitcher & themeSwitcher = pNppParams->getThemeSwitcher();
// Get themes from both npp install themes dir and app data themes dir with the per user
// overriding default themes of the same name.
generic_string themeDir;
if (pNppParams->getAppDataNppDir() && pNppParams->getAppDataNppDir()[0])
{
themeDir = pNppParams->getAppDataNppDir();
PathAppend(themeDir, TEXT("themes\\"));
_notepad_plus_plus_core.getMatchedFileNames(themeDir.c_str(), patterns, fileNames, false, false);
for (size_t i = 0, len = fileNames.size() ; i < len ; ++i)
{
themeSwitcher.addThemeFromXml(fileNames[i].c_str());
}
}
fileNames.clear();
themeDir.clear();
themeDir = nppDir.c_str(); // <- should use the pointer to avoid the constructor of copy
示例6: TEXT
bool PluginsManager::loadPluginsV2(const TCHAR* dir)
{
if (_isDisabled)
return false;
vector<generic_string> dllNames;
vector<generic_string> dll2Remove;
NppParameters * nppParams = NppParameters::getInstance();
generic_string nppPath = nppParams->getNppPath();
generic_string pluginsFolder;
if (dir && dir[0])
{
pluginsFolder = dir;
}
else
{
pluginsFolder = nppPath;
PathAppend(pluginsFolder, TEXT("plugins"));
}
generic_string pluginsFolderFilter = pluginsFolder;
PathAppend(pluginsFolderFilter, TEXT("*.*"));
WIN32_FIND_DATA foundData;
HANDLE hFindFolder = ::FindFirstFile(pluginsFolderFilter.c_str(), &foundData);
HANDLE hFindDll = INVALID_HANDLE_VALUE;
// get plugin folder
if (hFindFolder != INVALID_HANDLE_VALUE && (foundData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
generic_string pluginsFullPathFilter = pluginsFolder;
PathAppend(pluginsFullPathFilter, foundData.cFileName);
generic_string pluginsFolderPath = pluginsFullPathFilter;
generic_string dllName = foundData.cFileName;
dllName += TEXT(".dll");
PathAppend(pluginsFullPathFilter, dllName);
// get plugin
hFindDll = ::FindFirstFile(pluginsFullPathFilter.c_str(), &foundData);
if (hFindDll != INVALID_HANDLE_VALUE && !(foundData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
dllNames.push_back(pluginsFullPathFilter);
PluginList & pl = nppParams->getPluginList();
pl.add(foundData.cFileName, false);
}
// get plugin folder
while (::FindNextFile(hFindFolder, &foundData))
{
generic_string pluginsFullPathFilter2 = pluginsFolder;
PathAppend(pluginsFullPathFilter2, foundData.cFileName);
generic_string pluginsFolderPath2 = pluginsFullPathFilter2;
generic_string dllName2 = foundData.cFileName;
dllName2 += TEXT(".dll");
PathAppend(pluginsFullPathFilter2, dllName2);
// get plugin
hFindDll = ::FindFirstFile(pluginsFullPathFilter2.c_str(), &foundData);
if (hFindDll != INVALID_HANDLE_VALUE && !(foundData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
dllNames.push_back(pluginsFullPathFilter2);
PluginList & pl = nppParams->getPluginList();
pl.add(foundData.cFileName, false);
}
}
}
::FindClose(hFindFolder);
::FindClose(hFindDll);
for (size_t i = 0, len = dllNames.size(); i < len; ++i)
{
loadPlugin(dllNames[i].c_str(), dll2Remove);
}
return true;
}
示例7: loadPlugin
int PluginsManager::loadPlugin(const TCHAR *pluginFilePath, vector<generic_string> & dll2Remove)
{
const TCHAR *pluginFileName = ::PathFindFileName(pluginFilePath);
if (isInLoadedDlls(pluginFileName))
return 0;
NppParameters * nppParams = NppParameters::getInstance();
PluginInfo *pi = new PluginInfo;
try
{
pi->_moduleName = pluginFileName;
if (GetBinaryArchitectureType(pluginFilePath) != ARCH_TYPE)
throw generic_string(ARCH_ERR_MSG);
pi->_hLib = ::LoadLibrary(pluginFilePath);
if (!pi->_hLib)
{
generic_string lastErrorMsg = GetLastErrorAsString();
if (lastErrorMsg.empty())
throw generic_string(TEXT("Load Library has failed.\nChanging the project's \"Runtime Library\" setting to \"Multi-threaded(/MT)\" might solve this problem."));
else
throw generic_string(lastErrorMsg.c_str());
}
pi->_pFuncIsUnicode = (PFUNCISUNICODE)GetProcAddress(pi->_hLib, "isUnicode");
if (!pi->_pFuncIsUnicode || !pi->_pFuncIsUnicode())
throw generic_string(TEXT("This ANSI plugin is not compatible with your Unicode Notepad++."));
pi->_pFuncSetInfo = (PFUNCSETINFO)GetProcAddress(pi->_hLib, "setInfo");
if (!pi->_pFuncSetInfo)
throw generic_string(TEXT("Missing \"setInfo\" function"));
pi->_pFuncGetName = (PFUNCGETNAME)GetProcAddress(pi->_hLib, "getName");
if (!pi->_pFuncGetName)
throw generic_string(TEXT("Missing \"getName\" function"));
pi->_funcName = pi->_pFuncGetName();
pi->_pBeNotified = (PBENOTIFIED)GetProcAddress(pi->_hLib, "beNotified");
if (!pi->_pBeNotified)
throw generic_string(TEXT("Missing \"beNotified\" function"));
pi->_pMessageProc = (PMESSAGEPROC)GetProcAddress(pi->_hLib, "messageProc");
if (!pi->_pMessageProc)
throw generic_string(TEXT("Missing \"messageProc\" function"));
pi->_pFuncSetInfo(_nppData);
pi->_pFuncGetFuncsArray = (PFUNCGETFUNCSARRAY)GetProcAddress(pi->_hLib, "getFuncsArray");
if (!pi->_pFuncGetFuncsArray)
throw generic_string(TEXT("Missing \"getFuncsArray\" function"));
pi->_funcItems = pi->_pFuncGetFuncsArray(&pi->_nbFuncItem);
if ((!pi->_funcItems) || (pi->_nbFuncItem <= 0))
throw generic_string(TEXT("Missing \"FuncItems\" array, or the nb of Function Item is not set correctly"));
pi->_pluginMenu = ::CreateMenu();
GetLexerCountFn GetLexerCount = (GetLexerCountFn)::GetProcAddress(pi->_hLib, "GetLexerCount");
// it's a lexer plugin
if (GetLexerCount)
{
GetLexerNameFn GetLexerName = (GetLexerNameFn)::GetProcAddress(pi->_hLib, "GetLexerName");
if (!GetLexerName)
throw generic_string(TEXT("Loading GetLexerName function failed."));
GetLexerStatusTextFn GetLexerStatusText = (GetLexerStatusTextFn)::GetProcAddress(pi->_hLib, "GetLexerStatusText");
if (!GetLexerStatusText)
throw generic_string(TEXT("Loading GetLexerStatusText function failed."));
// Assign a buffer for the lexer name.
char lexName[MAX_EXTERNAL_LEXER_NAME_LEN];
lexName[0] = '\0';
TCHAR lexDesc[MAX_EXTERNAL_LEXER_DESC_LEN];
lexDesc[0] = '\0';
int numLexers = GetLexerCount();
ExternalLangContainer *containers[30];
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
for (int x = 0; x < numLexers; ++x)
{
GetLexerName(x, lexName, MAX_EXTERNAL_LEXER_NAME_LEN);
GetLexerStatusText(x, lexDesc, MAX_EXTERNAL_LEXER_DESC_LEN);
const TCHAR *pLexerName = wmc->char2wchar(lexName, CP_ACP);
if (!nppParams->isExistingExternalLangName(pLexerName) && nppParams->ExternalLangHasRoom())
containers[x] = new ExternalLangContainer(pLexerName, lexDesc);
else
containers[x] = NULL;
}
TCHAR xmlPath[MAX_PATH];
lstrcpy(xmlPath, nppParams->getNppPath().c_str());
PathAppend(xmlPath, TEXT("plugins\\Config"));
PathAppend(xmlPath, pi->_moduleName.c_str());
//.........这里部分代码省略.........
示例8: init
//.........这里部分代码省略.........
{
// Restore old settings when tab bar has been hidden from tab bar.
nppGUI._tabStatus = tabStatusOld;
}
}
if (cmdLineParams->_alwaysOnTop)
::SendMessage(_hSelf, WM_COMMAND, IDM_VIEW_ALWAYSONTOP, 0);
nppGUI._isCmdlineNosessionActivated = cmdLineParams->_isNoSession;
if (nppGUI._rememberLastSession && !cmdLineParams->_isNoSession)
_notepad_plus_plus_core.loadLastSession();
if (not cmdLineParams->_isPreLaunch)
{
if (cmdLineParams->isPointValid())
::ShowWindow(_hSelf, SW_SHOW);
else
::ShowWindow(_hSelf, nppGUI._isMaximized ? SW_MAXIMIZE : SW_SHOW);
}
else
{
_notepad_plus_plus_core._pTrayIco = new trayIconControler(_hSelf, IDI_M30ICON, IDC_MINIMIZED_TRAY, ::LoadIcon(_hInst, MAKEINTRESOURCE(IDI_M30ICON)), TEXT(""));
_notepad_plus_plus_core._pTrayIco->doTrayIcon(ADD);
}
if (cmdLine)
_notepad_plus_plus_core.loadCommandlineParams(cmdLine, cmdLineParams);
std::vector<generic_string> fileNames;
std::vector<generic_string> patterns;
patterns.push_back(TEXT("*.xml"));
generic_string nppDir = pNppParams->getNppPath();
LocalizationSwitcher & localizationSwitcher = pNppParams->getLocalizationSwitcher();
std::wstring localizationDir = nppDir;
PathAppend(localizationDir, TEXT("localization\\"));
_notepad_plus_plus_core.getMatchedFileNames(localizationDir.c_str(), patterns, fileNames, false, false);
for (size_t i = 0, len = fileNames.size(); i < len; ++i)
localizationSwitcher.addLanguageFromXml(fileNames[i].c_str());
fileNames.clear();
ThemeSwitcher & themeSwitcher = pNppParams->getThemeSwitcher();
// Get themes from both npp install themes dir and app data themes dir with the per user
// overriding default themes of the same name.
generic_string themeDir;
if (pNppParams->getAppDataNppDir() && pNppParams->getAppDataNppDir()[0])
{
themeDir = pNppParams->getAppDataNppDir();
PathAppend(themeDir, TEXT("themes\\"));
_notepad_plus_plus_core.getMatchedFileNames(themeDir.c_str(), patterns, fileNames, false, false);
for (size_t i = 0, len = fileNames.size() ; i < len ; ++i)
{
themeSwitcher.addThemeFromXml(fileNames[i].c_str());
}
}
fileNames.clear();
themeDir.clear();
themeDir = nppDir.c_str(); // <- should use the pointer to avoid the constructor of copy
PathAppend(themeDir, TEXT("themes\\"));
_notepad_plus_plus_core.getMatchedFileNames(themeDir.c_str(), patterns, fileNames, false, false);
示例9: WinMain
//.........这里部分代码省略.........
isMultiInst = true;
cmdLineParams._isNoTab = true;
cmdLineParams._isNoSession = true;
}
// override the settings if multiInst is choosen by user in the preference dialog
const NppGUI & nppGUI = pNppParameters->getNppGUI();
if (nppGUI._multiInstSetting == multiInst)
{
isMultiInst = true;
// Only the first launch remembers the session
if (!TheFirstOne)
cmdLineParams._isNoSession = true;
}
generic_string quotFileName = TEXT("");
// tell the running instance the FULL path to the new files to load
size_t nbFilesToOpen = params.size();
for (size_t i = 0; i < nbFilesToOpen; ++i)
{
const TCHAR * currentFile = params.at(i).c_str();
if (currentFile[0])
{
//check if relative or full path. Relative paths dont have a colon for driveletter
quotFileName += TEXT("\"");
quotFileName += relativeFilePathToFullFilePath(currentFile);
quotFileName += TEXT("\" ");
}
}
//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
if ((!isMultiInst) && (!TheFirstOne))
{
HWND hNotepad_plus = ::FindWindow(Notepad_plus_Window::getClassName(), NULL);
for (int i = 0 ;!hNotepad_plus && i < 5 ; ++i)
{
Sleep(100);
hNotepad_plus = ::FindWindow(Notepad_plus_Window::getClassName(), NULL);
}
if (hNotepad_plus)
{
// First of all, destroy static object NppParameters
pNppParameters->destroyInstance();
MainFileManager->destroyInstance();
int sw = 0;
if (::IsZoomed(hNotepad_plus))
sw = SW_MAXIMIZE;
else if (::IsIconic(hNotepad_plus))
sw = SW_RESTORE;
if (sw != 0)
::ShowWindow(hNotepad_plus, sw);
::SetForegroundWindow(hNotepad_plus);
if (params.size() > 0) //if there are files to open, use the WM_COPYDATA system
{
CmdLineParamsDTO dto = CmdLineParamsDTO::FromCmdLineParams(cmdLineParams);