|
|
|
@ -55,6 +55,11 @@ namespace // anonymous
|
|
|
|
|
void Notepad_plus_Window::setStartupBgColor(COLORREF BgColor)
|
|
|
|
|
{
|
|
|
|
|
RECT windowClientArea;
|
|
|
|
|
/// 定义窗口的变量
|
|
|
|
|
///
|
|
|
|
|
/// 获取对应的设备来方便绘制图形
|
|
|
|
|
/// 该函数用于设置窗口的整体颜色
|
|
|
|
|
///
|
|
|
|
|
HDC hdc = GetDCEx(_hSelf, NULL, DCX_CACHE | DCX_LOCKWINDOWUPDATE); //lock window update flag due to PaintLocker
|
|
|
|
|
GetClientRect(_hSelf, &windowClientArea);
|
|
|
|
|
FillRect(hdc, &windowClientArea, CreateSolidBrush(BgColor));
|
|
|
|
@ -63,6 +68,8 @@ void Notepad_plus_Window::setStartupBgColor(COLORREF BgColor)
|
|
|
|
|
|
|
|
|
|
void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR* cmdLine, CmdLineParams* cmdLineParams)
|
|
|
|
|
{
|
|
|
|
|
/// 该函数用于在最初的时候初始化窗口变量,
|
|
|
|
|
/// 建立窗口变量
|
|
|
|
|
// ³õʼ»¯Ê±¼ä´Á
|
|
|
|
|
time_t timestampBegin = 0;
|
|
|
|
|
if (cmdLineParams->_showLoadingTime)
|
|
|
|
@ -304,7 +311,7 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR* cmdLin
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 恢复上次会话中的可停靠面板
|
|
|
|
|
// 恢复上次会话的情况
|
|
|
|
|
for (size_t i = 0, len = _notepad_plus_plus_core._internalFuncIDs.size(); i < len; ++i)
|
|
|
|
|
::SendMessage(_hSelf, WM_COMMAND, _notepad_plus_plus_core._internalFuncIDs[i], 0);
|
|
|
|
|
|
|
|
|
@ -313,12 +320,10 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR* cmdLin
|
|
|
|
|
if (cmdLine)
|
|
|
|
|
fns = _notepad_plus_plus_core.loadCommandlineParams(cmdLine, cmdLineParams);
|
|
|
|
|
|
|
|
|
|
// 如果是快照模式,则检查修改过的文档并启动备份任务
|
|
|
|
|
bool isSnapshotMode = nppGUI.isSnapshotMode();
|
|
|
|
|
if (isSnapshotMode)
|
|
|
|
|
{
|
|
|
|
|
_notepad_plus_plus_core.checkModifiedDocument(false);
|
|
|
|
|
// 启动备份任务
|
|
|
|
|
_notepad_plus_plus_core.launchDocumentBackupTask();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -326,11 +331,11 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR* cmdLin
|
|
|
|
|
::SendMessage(_hSelf, NPPM_INTERNAL_SETWORDCHARS, 0, 0);
|
|
|
|
|
::SendMessage(_hSelf, NPPM_INTERNAL_SETNPC, 0, 0);
|
|
|
|
|
|
|
|
|
|
// 导出功能列表并退出
|
|
|
|
|
// 导出功能列表
|
|
|
|
|
if (nppParams.doFunctionListExport())
|
|
|
|
|
::SendMessage(_hSelf, NPPM_INTERNAL_EXPORTFUNCLISTANDQUIT, 0, 0);
|
|
|
|
|
|
|
|
|
|
// 打印并退出
|
|
|
|
|
// 打印
|
|
|
|
|
if (nppParams.doPrintAndExit())
|
|
|
|
|
::SendMessage(_hSelf, NPPM_INTERNAL_PRNTANDQUIT, 0, 0);
|
|
|
|
|
|
|
|
|
@ -344,14 +349,12 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR* cmdLin
|
|
|
|
|
::MessageBoxA(NULL, dest, "", MB_OK);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 通知插件 Notepad++ 已准备就绪
|
|
|
|
|
SCNotification scnN{};
|
|
|
|
|
scnN.nmhdr.code = NPPN_READY;
|
|
|
|
|
scnN.nmhdr.hwndFrom = _hSelf;
|
|
|
|
|
scnN.nmhdr.idFrom = 0;
|
|
|
|
|
_notepad_plus_plus_core._pluginsManager.notify(&scnN);
|
|
|
|
|
|
|
|
|
|
// 处理命令行参数中的彩蛋
|
|
|
|
|
if (!cmdLineParams->_easterEggName.empty())
|
|
|
|
|
{
|
|
|
|
|
if (cmdLineParams->_quoteType == 0) // Easter Egg Name
|
|
|
|
@ -405,7 +408,11 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR* cmdLin
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 用于检查MSG类型的变量msg是否是一种特定的消息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="msg"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
bool Notepad_plus_Window::isDlgsMsg(MSG *msg) const
|
|
|
|
|
{
|
|
|
|
|
for (size_t i = 0, len = _notepad_plus_plus_core._hModelessDlgs.size(); i < len; ++i)
|
|
|
|
|