亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? pluginsmanager.cpp

?? 文字編輯器源碼 Text editor source code
?? CPP
字號:
//this file is part of notepad++
//Copyright (C)2003 Don HO ( donho@altern.org )
//
//This program is free software; you can redistribute it and/or
//modify it under the terms of the GNU General Public License
//as published by the Free Software Foundation; either
//version 2 of the License, or (at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

#include <shlwapi.h>
#include "PluginsManager.h"

const TCHAR * USERMSG = TEXT("This plugin is not compatible with current version of Notepad++.\n\n\
Do you want to remove this plugin from plugins directory to prevent this message from the next launch time?");

bool PluginsManager::loadPlugins(const TCHAR *dir)
{
	if (_isDisabled)
		return false;

	vector<generic_string> dllNames;
	vector<generic_string> dll2Remove;
	const TCHAR *pNppPath = (NppParameters::getInstance())->getNppPath();

	generic_string pluginsFullPathFilter = (dir && dir[0])?dir:pNppPath;

	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:pNppPath;
		plugins1stFullPath += TEXT("\\plugins\\");
		plugins1stFullPath += foundData.cFileName;
		dllNames.push_back(plugins1stFullPath);

		while (::FindNextFile(hFindFile, &foundData))
		{
			generic_string fullPath = (dir && dir[0])?dir:pNppPath;
			fullPath += TEXT("\\plugins\\");
			fullPath += foundData.cFileName;
			dllNames.push_back(fullPath);
		}
		::FindClose(hFindFile);

		size_t i = 0;

		for ( ; i < dllNames.size() ; i++)
		{
			PluginInfo *pi = new PluginInfo;
			try {
				TCHAR tmpStr[MAX_PATH];
				lstrcpy(tmpStr, dllNames[i].c_str());
				lstrcpy(pi->_moduleName, PathFindFileName(tmpStr));
				
				pi->_hLib = ::LoadLibrary(dllNames[i].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];
					lstrcpy(lexDesc, TEXT(""));

					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());
					PathAppend(xmlPath, TEXT("plugins\\Config"));
					PathAppend(xmlPath, pi->_moduleName);
					PathRemoveExtension(xmlPath);
					PathAddExtension(xmlPath, TEXT(".xml"));

					if (!PathFileExists(xmlPath))
					{
						throw generic_string(generic_string(xmlPath) + TEXT(" is missing."));
					}

					TiXmlDocument *_pXmlDoc = new TiXmlDocument(xmlPath);

					if (!_pXmlDoc->LoadFile())
					{
						delete _pXmlDoc;
						_pXmlDoc = NULL;
						throw generic_string(generic_string(xmlPath) + TEXT(" failed to load."));
					}
					
					for (int x = 0; x < numLexers; x++) // postpone adding in case the xml is missing/corrupt
						if (containers[x] != NULL)
							nppParams->addExternalLangToEnd(containers[x]);

					nppParams->getExternalLexerFromXmlTree(_pXmlDoc);
					nppParams->getExternalLexerDoc()->push_back(_pXmlDoc);
#ifdef UNICODE
					const char *pDllName = wmc->wchar2char(dllNames[i].c_str(), CP_ACP);
#else
					const char *pDllName = dllNames[i].c_str();
#endif
					::SendMessage(_nppData._scintillaMainHandle, SCI_LOADLEXERLIBRARY, 0, (LPARAM)pDllName);
				}
				_pluginInfos.push_back(pi);
			}
			catch(generic_string s)
			{
				s += TEXT("\n\n");
				s += USERMSG;
				if (::MessageBox(NULL, s.c_str(), dllNames[i].c_str(), MB_YESNO) == IDYES)
				{
					dll2Remove.push_back(dllNames[i]);
				}
				delete pi;
			}
			catch(...)
			{
				generic_string msg = TEXT("Fail loaded");
				msg += TEXT("\n\n");
				msg += USERMSG;
				if (::MessageBox(NULL, msg.c_str(), dllNames[i].c_str(), MB_YESNO) == IDYES)
				{
					dll2Remove.push_back(dllNames[i]);
				}
				delete pi;
			}
		}
	}

	for (size_t j = 0 ; j < dll2Remove.size() ; j++)
		::DeleteFile(dll2Remove[j].c_str());

	return true;
}

// return true if cmdID found and its shortcut is enable
// false otherwise
bool PluginsManager::getShortcutByCmdID(int cmdID, ShortcutKey *sk)
{
	if (cmdID == 0 || !sk)
		return false;

	const vector<PluginCmdShortcut> & pluginCmdSCList = (NppParameters::getInstance())->getPluginCommandList();

	for (size_t i = 0 ; i < pluginCmdSCList.size() ; i++)
	{
		if (pluginCmdSCList[i].getID() == cmdID)
		{
			const KeyCombo & kc = pluginCmdSCList[i].getKeyCombo();
			if (kc._key == 0x00)
				return false;

			sk->_isAlt = kc._isAlt;
			sk->_isCtrl = kc._isCtrl;
			sk->_isShift = kc._isShift;
			sk->_key = kc._key;
			return true;
		}
	}
	return false;
}

void PluginsManager::setMenu(HMENU hMenu, const TCHAR *menuName)
{
	if (hasPlugins())
	{
		vector<PluginCmdShortcut> & pluginCmdSCList = (NppParameters::getInstance())->getPluginCommandList();
		const TCHAR *nom_menu = (menuName && menuName[0])?menuName:TEXT("Plugins");

		_hPluginsMenu = ::CreateMenu();
		::InsertMenu(hMenu, 9, MF_BYPOSITION | MF_POPUP, (UINT_PTR)_hPluginsMenu, nom_menu);

		for (size_t i = 0 ; i < _pluginInfos.size() ; i++)
		{
			::InsertMenu(_hPluginsMenu, i, MF_BYPOSITION | MF_POPUP, (UINT_PTR)_pluginInfos[i]->_pluginMenu, _pluginInfos[i]->_pFuncGetName());

			for (int j = 0 ; j < _pluginInfos[i]->_nbFuncItem ; j++)
			{
				if (_pluginInfos[i]->_funcItems[j]._pFunc == NULL)
				{
					::InsertMenu(_pluginInfos[i]->_pluginMenu, j, MF_BYPOSITION | MF_SEPARATOR, 0, TEXT(""));
					continue;
				}
				
				_pluginsCommands.push_back(PluginCommand(_pluginInfos[i]->_moduleName, j, _pluginInfos[i]->_funcItems[j]._pFunc));
				
				int cmdID = ID_PLUGINS_CMD + (_pluginsCommands.size() - 1);
				_pluginInfos[i]->_funcItems[j]._cmdID = cmdID;
				generic_string itemName = _pluginInfos[i]->_funcItems[j]._itemName;

				if (_pluginInfos[i]->_funcItems[j]._pShKey)
				{
					ShortcutKey & sKey = *(_pluginInfos[i]->_funcItems[j]._pShKey);
					PluginCmdShortcut pcs(Shortcut(itemName.c_str(), sKey._isCtrl, sKey._isAlt, sKey._isShift, sKey._key), cmdID, _pluginInfos[i]->_moduleName, j);
					pluginCmdSCList.push_back(pcs);
					itemName += TEXT("\t");
					itemName += pcs.toString();
				}
				else
				{	//no ShortcutKey is provided, add an disabled shortcut (so it can still be mapped, Paramaters class can still index any changes and the toolbar wont funk out
					PluginCmdShortcut pcs(Shortcut(itemName.c_str(), false, false, false, 0x00), cmdID, _pluginInfos[i]->_moduleName, j);	//VK_NULL and everything disabled, the menu name is left alone
					pluginCmdSCList.push_back(pcs);
				}
				::InsertMenu(_pluginInfos[i]->_pluginMenu, j, MF_BYPOSITION, cmdID, itemName.c_str());

				if (_pluginInfos[i]->_funcItems[j]._init2Check)
					::CheckMenuItem(_hPluginsMenu, cmdID, MF_BYCOMMAND | MF_CHECKED);
			}
		}
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲日本中文字幕区| 在线不卡免费欧美| 亚洲欧美另类在线| 色乱码一区二区三区88| 综合久久国产九一剧情麻豆| 色婷婷国产精品久久包臀 | 天天色天天操综合| 91精品国产品国语在线不卡| 美女网站色91| wwwwxxxxx欧美| www.久久久久久久久| 亚洲国产综合人成综合网站| 日韩视频不卡中文| 国产传媒久久文化传媒| 一区二区三区中文在线| 91精品国产色综合久久不卡蜜臀| 精品综合久久久久久8888| 国产日韩av一区| 色狠狠桃花综合| 蜜桃免费网站一区二区三区| 国产精品理论在线观看| 欧美三级在线看| 国产一区二区导航在线播放| 亚洲天天做日日做天天谢日日欢| 777奇米成人网| 不卡的av中国片| 石原莉奈在线亚洲三区| 欧美国产精品v| 欧美日韩免费电影| 成人性视频免费网站| 亚洲国产成人av| 国产日韩精品一区| 欧美精品少妇一区二区三区| 国产不卡高清在线观看视频| 午夜影视日本亚洲欧洲精品| 中文在线免费一区三区高中清不卡| 欧美日本视频在线| 成人av网站在线| 美女视频黄a大片欧美| 一区二区三区91| 中文字幕不卡一区| 精品理论电影在线观看| 在线视频中文字幕一区二区| 成人一级片在线观看| 久久成人免费网站| 午夜成人在线视频| 亚洲三级电影网站| 国产女人18毛片水真多成人如厕| 在线电影欧美成精品| 色综合激情久久| 成人性视频免费网站| 国产精品一卡二| 捆绑调教一区二区三区| 亚洲专区一二三| 亚洲色图视频网| 国产精品亲子伦对白| 久久久久97国产精华液好用吗| 日韩午夜电影av| 678五月天丁香亚洲综合网| 91九色最新地址| www.在线成人| 不卡视频免费播放| 成人免费va视频| 国产精品一区二区不卡| 国产一区二区免费在线| 精品一区二区在线视频| 美女视频网站黄色亚洲| 久久99精品久久只有精品| 日本欧美韩国一区三区| 午夜精品一区二区三区免费视频| 夜夜嗨av一区二区三区网页| 最新久久zyz资源站| 亚洲欧洲性图库| 中文字幕一区在线观看视频| 国产精品第一页第二页第三页| 国产欧美日韩综合精品一区二区| xvideos.蜜桃一区二区| 精品国产三级a在线观看| 精品免费99久久| 精品国产一区a| 久久精品一区二区三区不卡| 久久青草国产手机看片福利盒子 | 久久精品国产第一区二区三区| 日韩福利电影在线| 久久99精品久久久| 国产永久精品大片wwwapp| 国产伦理精品不卡| 成人精品视频一区二区三区| zzijzzij亚洲日本少妇熟睡| 色欲综合视频天天天| 欧美亚洲精品一区| 91麻豆精品国产91久久久久久久久| 宅男在线国产精品| 欧美mv日韩mv亚洲| 中文字幕一区二区三| 一区二区三区成人| 蜜桃一区二区三区在线| 国产传媒一区在线| 欧日韩精品视频| 日韩精品一区二区三区中文精品| 国产色综合一区| 亚洲女子a中天字幕| 亚洲va国产va欧美va观看| 久久99国产精品久久| 成人高清免费在线播放| 欧美伊人久久久久久久久影院 | 成人动漫一区二区三区| 欧美午夜在线观看| 久久综合九色综合久久久精品综合 | 国产成人av一区二区三区在线| 色综合天天性综合| 91精品国模一区二区三区| 国产欧美日韩视频在线观看| 亚洲一区二区三区美女| 久久99蜜桃精品| 色婷婷精品久久二区二区蜜臂av| 欧美一区二区免费视频| 亚洲欧美在线视频| 蜜桃久久精品一区二区| 99国产精品99久久久久久| 91精品国产免费| 国产精品久久久久影院老司 | 国产精品乡下勾搭老头1| 91婷婷韩国欧美一区二区| 5858s免费视频成人| 国产精品日日摸夜夜摸av| 人人爽香蕉精品| 色嗨嗨av一区二区三区| 日韩精品在线一区二区| 亚洲视频一区二区在线| 国产一区二区三区日韩| 欧美日韩一区不卡| 中文字幕一区二区三区在线不卡 | 日韩二区在线观看| www.av亚洲| 精品奇米国产一区二区三区| 亚洲线精品一区二区三区| 成人黄色综合网站| 精品国产乱码久久久久久蜜臀 | 亚洲激情自拍视频| 国产成人精品免费网站| 欧美一二三四在线| 亚洲国产aⅴ天堂久久| 91在线视频播放地址| 欧美韩国日本不卡| 久久av中文字幕片| 日韩欧美黄色影院| 亚洲国产欧美日韩另类综合 | 不卡区在线中文字幕| 久久综合狠狠综合久久激情 | 午夜成人在线视频| 在线观看一区不卡| 亚洲欧美日韩国产综合| av在线播放成人| 国产精品视频一区二区三区不卡| 国产一区二区看久久| 精品国产伦一区二区三区观看方式 | 亚洲精品在线三区| 蜜臀久久99精品久久久久宅男| 在线不卡a资源高清| 日韩高清中文字幕一区| 91精品国产综合久久久久久久久久| 一区二区三区丝袜| 欧美午夜宅男影院| 午夜精品福利一区二区三区蜜桃| 欧美中文字幕一区二区三区亚洲| 一区二区在线观看视频| 一本久久a久久免费精品不卡| 亚洲乱码中文字幕| 91福利视频久久久久| 一区二区在线观看视频| 欧美色网一区二区| 日本不卡123| 精品国产三级a在线观看| 国产美女av一区二区三区| 久久精品综合网| 不卡一区二区三区四区| 亚洲精品国产无天堂网2021 | 日韩欧美激情四射| 国产精品影视在线| 中文字幕亚洲区| 欧美三级资源在线| 麻豆成人免费电影| 国产欧美一区二区精品婷婷| 成人免费毛片高清视频| 一区二区三区资源| 欧美精品xxxxbbbb| 国产美女精品在线| 亚洲欧美日韩国产成人精品影院 | 亚洲一区在线观看视频| 欧美一区在线视频| 国产乱一区二区| 国产精品欧美一区二区三区| 在线免费观看日本一区| 丝袜美腿亚洲色图| 精品国产精品一区二区夜夜嗨| 懂色av一区二区在线播放| 一区二区三区影院| 欧美成人一区二区三区在线观看 | 欧美日韩在线电影|