mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-27 15:54:17 +02:00
[UPDATE] (Author: Sin Thesis) Refactoring (in progress).
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@628 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
b127612e16
commit
d7133d0011
File diff suppressed because it is too large
Load Diff
@ -169,27 +169,26 @@ struct VisibleGUIConf {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class FileDialog;
|
class FileDialog;
|
||||||
|
class Notepad_plus_Window;
|
||||||
|
|
||||||
|
|
||||||
|
class Notepad_plus {
|
||||||
|
|
||||||
|
friend class Notepad_plus_Window;
|
||||||
|
|
||||||
class Notepad_plus : public Window {
|
|
||||||
enum comment_mode {cm_comment, cm_uncomment, cm_toggle};
|
|
||||||
public:
|
public:
|
||||||
Notepad_plus();
|
Notepad_plus();
|
||||||
virtual ~Notepad_plus();
|
virtual ~Notepad_plus();
|
||||||
void init(HINSTANCE, HWND, const TCHAR *cmdLine, CmdLineParams *cmdLineParams);
|
LRESULT init(HWND hwnd);
|
||||||
|
LRESULT process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
|
||||||
void killAllChildren();
|
void killAllChildren();
|
||||||
virtual void destroy(){
|
|
||||||
::DestroyWindow(_hSelf);
|
|
||||||
};
|
|
||||||
|
|
||||||
static const TCHAR * Notepad_plus::getClassName() {
|
enum comment_mode {cm_comment, cm_uncomment, cm_toggle};
|
||||||
return _className;
|
|
||||||
};
|
|
||||||
|
|
||||||
void setTitle();
|
void setTitle();
|
||||||
void getTaskListInfo(TaskListInfo *tli);
|
void getTaskListInfo(TaskListInfo *tli);
|
||||||
|
|
||||||
// For filtering the modeless Dialog message
|
// For filtering the modeless Dialog message
|
||||||
bool isDlgsMsg(MSG *msg, bool unicodeSupported) const;
|
|
||||||
|
|
||||||
// fileOperations
|
// fileOperations
|
||||||
//The doXXX functions apply to a single buffer and dont need to worry about views, with the excpetion of doClose, since closing one view doesnt have to mean the document is gone
|
//The doXXX functions apply to a single buffer and dont need to worry about views, with the excpetion of doClose, since closing one view doesnt have to mean the document is gone
|
||||||
@ -255,9 +254,7 @@ public:
|
|||||||
bool doStreamComment();
|
bool doStreamComment();
|
||||||
void doTrimTrailing();
|
void doTrimTrailing();
|
||||||
|
|
||||||
HACCEL getAccTable() const{
|
|
||||||
return _accelerator.getAccTable();
|
|
||||||
};
|
|
||||||
|
|
||||||
bool addCurrentMacro();
|
bool addCurrentMacro();
|
||||||
|
|
||||||
@ -267,9 +264,8 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
bool loadSession(Session & session);
|
bool loadSession(Session & session);
|
||||||
winVer getWinVersion() const {return _winVersion;};
|
|
||||||
|
|
||||||
bool emergency(generic_string emergencySavedDir);
|
|
||||||
|
|
||||||
void notifyBufferChanged(Buffer * buffer, int mask);
|
void notifyBufferChanged(Buffer * buffer, int mask);
|
||||||
bool findInFiles();
|
bool findInFiles();
|
||||||
@ -277,10 +273,14 @@ public:
|
|||||||
void setFindReplaceFolderFilter(const TCHAR *dir, const TCHAR *filters);
|
void setFindReplaceFolderFilter(const TCHAR *dir, const TCHAR *filters);
|
||||||
vector<generic_string> addNppComponents(const TCHAR *destDir, const TCHAR *extFilterName, const TCHAR *extFilter);
|
vector<generic_string> addNppComponents(const TCHAR *destDir, const TCHAR *extFilterName, const TCHAR *extFilter);
|
||||||
int getHtmlXmlEncoding(const TCHAR *fileName) const;
|
int getHtmlXmlEncoding(const TCHAR *fileName) const;
|
||||||
|
HACCEL getAccTable() const{
|
||||||
|
return _accelerator.getAccTable();
|
||||||
|
};
|
||||||
|
bool emergency(generic_string emergencySavedDir);
|
||||||
|
|
||||||
static HWND gNppHWND; //static handle to Notepad++ window, NULL if non-existant
|
|
||||||
private:
|
private:
|
||||||
static const TCHAR _className[32];
|
Notepad_plus_Window *_pPublicInterface;
|
||||||
Window *_pMainWindow;
|
Window *_pMainWindow;
|
||||||
DockingManager _dockingManager;
|
DockingManager _dockingManager;
|
||||||
|
|
||||||
@ -336,7 +336,7 @@ private:
|
|||||||
HMENU _mainMenuHandle;
|
HMENU _mainMenuHandle;
|
||||||
|
|
||||||
bool _sysMenuEntering;
|
bool _sysMenuEntering;
|
||||||
bool _isPrelaunch;
|
|
||||||
|
|
||||||
// For FullScreen/PostIt features
|
// For FullScreen/PostIt features
|
||||||
VisibleGUIConf _beforeSpecialView;
|
VisibleGUIConf _beforeSpecialView;
|
||||||
@ -385,7 +385,6 @@ private:
|
|||||||
PluginsManager _pluginsManager;
|
PluginsManager _pluginsManager;
|
||||||
ButtonDlg _restoreButton;
|
ButtonDlg _restoreButton;
|
||||||
|
|
||||||
winVer _winVersion;
|
|
||||||
bool _isFileOpening;
|
bool _isFileOpening;
|
||||||
|
|
||||||
ScintillaCtrls _scintillaCtrls4Plugins;
|
ScintillaCtrls _scintillaCtrls4Plugins;
|
||||||
@ -394,8 +393,7 @@ private:
|
|||||||
StyleArray _hotspotStyles;
|
StyleArray _hotspotStyles;
|
||||||
bool _rememberThisSession; // always true. except -nosession is indicated on the launch time
|
bool _rememberThisSession; // always true. except -nosession is indicated on the launch time
|
||||||
|
|
||||||
static LRESULT CALLBACK Notepad_plus_Proc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
|
|
||||||
LRESULT runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
|
|
||||||
|
|
||||||
BOOL notify(SCNotification *notification);
|
BOOL notify(SCNotification *notification);
|
||||||
void specialCmd(int id, int param);
|
void specialCmd(int id, int param);
|
||||||
@ -584,4 +582,5 @@ private:
|
|||||||
bool goToNextIndicator(int indicID2Search, bool isWrap = true) const;
|
bool goToNextIndicator(int indicID2Search, bool isWrap = true) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif //NOTEPAD_PLUS_H
|
#endif //NOTEPAD_PLUS_H
|
||||||
|
215
PowerEditor/src/Notepad_plus_Window.cpp
Normal file
215
PowerEditor/src/Notepad_plus_Window.cpp
Normal file
@ -0,0 +1,215 @@
|
|||||||
|
//this file is part of notepad++
|
||||||
|
//Copyright (C)2010 Don HO <don.h@free.fr>
|
||||||
|
//
|
||||||
|
//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 "precompiledHeaders.h"
|
||||||
|
#include "Notepad_plus_Window.h"
|
||||||
|
|
||||||
|
const TCHAR Notepad_plus_Window::_className[32] = TEXT("Notepad++");
|
||||||
|
HWND Notepad_plus_Window::gNppHWND = NULL;
|
||||||
|
|
||||||
|
void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLine, CmdLineParams *cmdLineParams)
|
||||||
|
{
|
||||||
|
time_t timestampBegin = 0;
|
||||||
|
if (cmdLineParams->_showLoadingTime)
|
||||||
|
timestampBegin = time(NULL);
|
||||||
|
|
||||||
|
Window::init(hInst, parent);
|
||||||
|
WNDCLASS nppClass;
|
||||||
|
|
||||||
|
nppClass.style = CS_BYTEALIGNWINDOW | CS_DBLCLKS;
|
||||||
|
nppClass.lpfnWndProc = Notepad_plus_Proc;
|
||||||
|
nppClass.cbClsExtra = 0;
|
||||||
|
nppClass.cbWndExtra = 0;
|
||||||
|
nppClass.hInstance = _hInst;
|
||||||
|
nppClass.hIcon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_M30ICON));
|
||||||
|
nppClass.hCursor = ::LoadCursor(NULL, IDC_ARROW);
|
||||||
|
nppClass.hbrBackground = ::CreateSolidBrush(::GetSysColor(COLOR_MENU));
|
||||||
|
nppClass.lpszMenuName = MAKEINTRESOURCE(IDR_M30_MENU);
|
||||||
|
nppClass.lpszClassName = _className;
|
||||||
|
|
||||||
|
_isPrelaunch = cmdLineParams->_isPreLaunch;
|
||||||
|
|
||||||
|
if (!::RegisterClass(&nppClass))
|
||||||
|
{
|
||||||
|
systemMessage(TEXT("System Err"));
|
||||||
|
throw int(98);
|
||||||
|
}
|
||||||
|
|
||||||
|
RECT workAreaRect;
|
||||||
|
::SystemParametersInfo(SPI_GETWORKAREA, 0, &workAreaRect, 0);
|
||||||
|
|
||||||
|
NppParameters *pNppParams = NppParameters::getInstance();
|
||||||
|
const NppGUI & nppGUI = pNppParams->getNppGUI();
|
||||||
|
|
||||||
|
if (cmdLineParams->_isNoPlugin)
|
||||||
|
_notepad_plus_plus_core._pluginsManager.disable();
|
||||||
|
|
||||||
|
_hSelf = ::CreateWindowEx(
|
||||||
|
WS_EX_ACCEPTFILES | (_notepad_plus_plus_core._nativeLangSpeaker.isRTL()?WS_EX_LAYOUTRTL:0),\
|
||||||
|
_className,\
|
||||||
|
TEXT("Notepad++"),\
|
||||||
|
WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,\
|
||||||
|
// CreateWindowEx bug : set all 0 to walk around the pb
|
||||||
|
0, 0, 0, 0,\
|
||||||
|
_hParent,\
|
||||||
|
NULL,\
|
||||||
|
_hInst,\
|
||||||
|
(LPVOID)this); // pass the ptr of this instantiated object
|
||||||
|
// for retrieve it in Notepad_plus_Proc from
|
||||||
|
// the CREATESTRUCT.lpCreateParams afterward.
|
||||||
|
|
||||||
|
if (!_hSelf)
|
||||||
|
{
|
||||||
|
systemMessage(TEXT("System Err"));
|
||||||
|
throw int(777);
|
||||||
|
}
|
||||||
|
|
||||||
|
gNppHWND = _hSelf;
|
||||||
|
|
||||||
|
// In setting the startup window position, take into account that the last-saved
|
||||||
|
// position might have assumed a second monitor that's no longer available.
|
||||||
|
POINT newUpperLeft;
|
||||||
|
newUpperLeft.x = nppGUI._appPos.left + workAreaRect.left;
|
||||||
|
newUpperLeft.y = nppGUI._appPos.top + workAreaRect.top;
|
||||||
|
|
||||||
|
// GetSystemMetrics does not support the multi-monitor values on Windows NT and Windows 95.
|
||||||
|
winVer winVersion = pNppParams->getWinVersion();
|
||||||
|
if ((winVersion != WV_95) && (winVersion != WV_NT))
|
||||||
|
{
|
||||||
|
int margin = ::GetSystemMetrics(SM_CYSMCAPTION);
|
||||||
|
if (newUpperLeft.x > ::GetSystemMetrics(SM_CXVIRTUALSCREEN)-margin)
|
||||||
|
newUpperLeft.x = workAreaRect.right - nppGUI._appPos.right;
|
||||||
|
if (newUpperLeft.x + nppGUI._appPos.right < ::GetSystemMetrics(SM_XVIRTUALSCREEN)+margin)
|
||||||
|
newUpperLeft.x = workAreaRect.left;
|
||||||
|
if (newUpperLeft.y > ::GetSystemMetrics(SM_CYVIRTUALSCREEN)-margin)
|
||||||
|
newUpperLeft.y = workAreaRect.bottom - nppGUI._appPos.bottom;
|
||||||
|
if (newUpperLeft.y + nppGUI._appPos.bottom < ::GetSystemMetrics(SM_YVIRTUALSCREEN)+margin)
|
||||||
|
newUpperLeft.y = workAreaRect.top;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cmdLineParams->isPointValid())
|
||||||
|
::MoveWindow(_hSelf, cmdLineParams->_point.x, cmdLineParams->_point.y, nppGUI._appPos.right, nppGUI._appPos.bottom, TRUE);
|
||||||
|
else
|
||||||
|
::MoveWindow(_hSelf, newUpperLeft.x, newUpperLeft.y, nppGUI._appPos.right, nppGUI._appPos.bottom, TRUE);
|
||||||
|
|
||||||
|
if (nppGUI._tabStatus & TAB_MULTILINE)
|
||||||
|
::SendMessage(_hSelf, WM_COMMAND, IDM_VIEW_DRAWTABBAR_MULTILINE, 0);
|
||||||
|
|
||||||
|
if (!nppGUI._menuBarShow)
|
||||||
|
::SetMenu(_hSelf, NULL);
|
||||||
|
|
||||||
|
if (cmdLineParams->_isNoTab || (nppGUI._tabStatus & TAB_HIDE))
|
||||||
|
{
|
||||||
|
::SendMessage(_hSelf, NPPM_HIDETABBAR, 0, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
_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(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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Notepad_plus_Window::isDlgsMsg(MSG *msg, bool unicodeSupported) const
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < _notepad_plus_plus_core._hModelessDlgs.size(); i++)
|
||||||
|
{
|
||||||
|
if (unicodeSupported?(::IsDialogMessageW(_notepad_plus_plus_core._hModelessDlgs[i], msg)):(::IsDialogMessageA(_notepad_plus_plus_core._hModelessDlgs[i], msg)))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
67
PowerEditor/src/Notepad_plus_Window.h
Normal file
67
PowerEditor/src/Notepad_plus_Window.h
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
//this file is part of notepad++
|
||||||
|
//Copyright (C)2010 Don HO <don.h@free.fr>
|
||||||
|
//
|
||||||
|
//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.
|
||||||
|
|
||||||
|
#ifndef NOTEPAD_PLUS_WINDOW_H
|
||||||
|
#define NOTEPAD_PLUS_WINDOW_H
|
||||||
|
|
||||||
|
//#include "Window.h"
|
||||||
|
#include "Notepad_plus.h"
|
||||||
|
|
||||||
|
class Notepad_plus_Window : public Window {
|
||||||
|
public:
|
||||||
|
Notepad_plus_Window() {};
|
||||||
|
void init(HINSTANCE, HWND, const TCHAR *cmdLine, CmdLineParams *cmdLineParams);
|
||||||
|
|
||||||
|
bool isDlgsMsg(MSG *msg, bool unicodeSupported) const;
|
||||||
|
|
||||||
|
HACCEL getAccTable() const{
|
||||||
|
return _notepad_plus_plus_core.getAccTable();
|
||||||
|
};
|
||||||
|
|
||||||
|
bool emergency(generic_string emergencySavedDir)
|
||||||
|
{
|
||||||
|
return _notepad_plus_plus_core.emergency(emergencySavedDir);
|
||||||
|
};
|
||||||
|
|
||||||
|
bool isPrelaunch() const {
|
||||||
|
return _isPrelaunch;
|
||||||
|
};
|
||||||
|
|
||||||
|
void setIsPrelaunch(bool val) {
|
||||||
|
_isPrelaunch = val;
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void destroy(){
|
||||||
|
::DestroyWindow(_hSelf);
|
||||||
|
};
|
||||||
|
|
||||||
|
static const TCHAR * Notepad_plus_Window::getClassName() {
|
||||||
|
return _className;
|
||||||
|
};
|
||||||
|
static HWND gNppHWND; //static handle to Notepad++ window, NULL if non-existant
|
||||||
|
|
||||||
|
private:
|
||||||
|
Notepad_plus _notepad_plus_plus_core;
|
||||||
|
static LRESULT CALLBACK Notepad_plus_Proc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
|
||||||
|
LRESULT runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
|
static const TCHAR _className[32];
|
||||||
|
bool _isPrelaunch;
|
||||||
|
bool _disablePluginsManager;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //NOTEPAD_PLUS_WINDOW_H
|
@ -16,7 +16,7 @@
|
|||||||
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
#include "precompiledHeaders.h"
|
#include "precompiledHeaders.h"
|
||||||
#include "Notepad_plus.h"
|
#include "Notepad_plus_Window.h"
|
||||||
#include "TaskListDlg.h"
|
#include "TaskListDlg.h"
|
||||||
#include "ImageListSet.h"
|
#include "ImageListSet.h"
|
||||||
|
|
||||||
@ -39,99 +39,48 @@ struct SortTaskListPred
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
int docTabIconIDs[] = {IDI_SAVED_ICON, IDI_UNSAVED_ICON, IDI_READONLY_ICON};
|
|
||||||
|
|
||||||
ToolBarButtonUnit toolBarIcons[] = {
|
LRESULT CALLBACK Notepad_plus_Window::Notepad_plus_Proc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
||||||
{IDM_FILE_NEW, IDI_NEW_OFF_ICON, IDI_NEW_ON_ICON, IDI_NEW_OFF_ICON, IDR_FILENEW},
|
|
||||||
{IDM_FILE_OPEN, IDI_OPEN_OFF_ICON, IDI_OPEN_ON_ICON, IDI_NEW_OFF_ICON, IDR_FILEOPEN},
|
|
||||||
{IDM_FILE_SAVE, IDI_SAVE_OFF_ICON, IDI_SAVE_ON_ICON, IDI_SAVE_DISABLE_ICON, IDR_FILESAVE},
|
|
||||||
{IDM_FILE_SAVEALL, IDI_SAVEALL_OFF_ICON, IDI_SAVEALL_ON_ICON, IDI_SAVEALL_DISABLE_ICON, IDR_SAVEALL},
|
|
||||||
{IDM_FILE_CLOSE, IDI_CLOSE_OFF_ICON, IDI_CLOSE_ON_ICON, IDI_CLOSE_OFF_ICON, IDR_CLOSEFILE},
|
|
||||||
{IDM_FILE_CLOSEALL, IDI_CLOSEALL_OFF_ICON, IDI_CLOSEALL_ON_ICON, IDI_CLOSEALL_OFF_ICON, IDR_CLOSEALL},
|
|
||||||
{IDM_FILE_PRINTNOW, IDI_PRINT_OFF_ICON, IDI_PRINT_ON_ICON, IDI_PRINT_OFF_ICON, IDR_PRINT},
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------//
|
|
||||||
{0, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON},
|
|
||||||
//-------------------------------------------------------------------------------------//
|
|
||||||
|
|
||||||
{IDM_EDIT_CUT, IDI_CUT_OFF_ICON, IDI_CUT_ON_ICON, IDI_CUT_DISABLE_ICON, IDR_CUT},
|
|
||||||
{IDM_EDIT_COPY, IDI_COPY_OFF_ICON, IDI_COPY_ON_ICON, IDI_COPY_DISABLE_ICON, IDR_COPY},
|
|
||||||
{IDM_EDIT_PASTE, IDI_PASTE_OFF_ICON, IDI_PASTE_ON_ICON, IDI_PASTE_DISABLE_ICON, IDR_PASTE},
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------//
|
|
||||||
{0, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON},
|
|
||||||
//-------------------------------------------------------------------------------------//
|
|
||||||
|
|
||||||
{IDM_EDIT_UNDO, IDI_UNDO_OFF_ICON, IDI_UNDO_ON_ICON, IDI_UNDO_DISABLE_ICON, IDR_UNDO},
|
|
||||||
{IDM_EDIT_REDO, IDI_REDO_OFF_ICON, IDI_REDO_ON_ICON, IDI_REDO_DISABLE_ICON, IDR_REDO},
|
|
||||||
//-------------------------------------------------------------------------------------//
|
|
||||||
{0, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON},
|
|
||||||
//-------------------------------------------------------------------------------------//
|
|
||||||
|
|
||||||
{IDM_SEARCH_FIND, IDI_FIND_OFF_ICON, IDI_FIND_ON_ICON, IDI_FIND_OFF_ICON, IDR_FIND},
|
|
||||||
{IDM_SEARCH_REPLACE, IDI_REPLACE_OFF_ICON, IDI_REPLACE_ON_ICON, IDI_REPLACE_OFF_ICON, IDR_REPLACE},
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------//
|
|
||||||
{0, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON},
|
|
||||||
//-------------------------------------------------------------------------------------//
|
|
||||||
{IDM_VIEW_ZOOMIN, IDI_ZOOMIN_OFF_ICON, IDI_ZOOMIN_ON_ICON, IDI_ZOOMIN_OFF_ICON, IDR_ZOOMIN},
|
|
||||||
{IDM_VIEW_ZOOMOUT, IDI_ZOOMOUT_OFF_ICON, IDI_ZOOMOUT_ON_ICON, IDI_ZOOMOUT_OFF_ICON, IDR_ZOOMOUT},
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------//
|
|
||||||
{0, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON},
|
|
||||||
//-------------------------------------------------------------------------------------//
|
|
||||||
{IDM_VIEW_SYNSCROLLV, IDI_SYNCV_OFF_ICON, IDI_SYNCV_ON_ICON, IDI_SYNCV_DISABLE_ICON, IDR_SYNCV},
|
|
||||||
{IDM_VIEW_SYNSCROLLH, IDI_SYNCH_OFF_ICON, IDI_SYNCH_ON_ICON, IDI_SYNCH_DISABLE_ICON, IDR_SYNCH},
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------//
|
|
||||||
{0, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON},
|
|
||||||
//-------------------------------------------------------------------------------------//
|
|
||||||
{IDM_VIEW_WRAP, IDI_VIEW_WRAP_OFF_ICON, IDI_VIEW_WRAP_ON_ICON, IDI_VIEW_WRAP_OFF_ICON, IDR_WRAP},
|
|
||||||
{IDM_VIEW_ALL_CHARACTERS, IDI_VIEW_ALL_CHAR_OFF_ICON, IDI_VIEW_ALL_CHAR_ON_ICON, IDI_VIEW_ALL_CHAR_OFF_ICON, IDR_INVISIBLECHAR},
|
|
||||||
{IDM_VIEW_INDENT_GUIDE, IDI_VIEW_INDENT_OFF_ICON, IDI_VIEW_INDENT_ON_ICON, IDI_VIEW_INDENT_OFF_ICON, IDR_INDENTGUIDE},
|
|
||||||
{IDM_VIEW_USER_DLG, IDI_VIEW_UD_DLG_OFF_ICON, IDI_VIEW_UD_DLG_ON_ICON, IDI_VIEW_UD_DLG_OFF_ICON, IDR_SHOWPANNEL},
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------//
|
|
||||||
{0, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON},
|
|
||||||
//-------------------------------------------------------------------------------------//
|
|
||||||
|
|
||||||
{IDM_MACRO_STARTRECORDINGMACRO, IDI_STARTRECORD_OFF_ICON, IDI_STARTRECORD_ON_ICON, IDI_STARTRECORD_DISABLE_ICON, IDR_STARTRECORD},
|
|
||||||
{IDM_MACRO_STOPRECORDINGMACRO, IDI_STOPRECORD_OFF_ICON, IDI_STOPRECORD_ON_ICON, IDI_STOPRECORD_DISABLE_ICON, IDR_STOPRECORD},
|
|
||||||
{IDM_MACRO_PLAYBACKRECORDEDMACRO, IDI_PLAYRECORD_OFF_ICON, IDI_PLAYRECORD_ON_ICON, IDI_PLAYRECORD_DISABLE_ICON, IDR_PLAYRECORD},
|
|
||||||
{IDM_MACRO_RUNMULTIMACRODLG, IDI_MMPLAY_OFF_ICON, IDI_MMPLAY_ON_ICON, IDI_MMPLAY_DIS_ICON, IDR_M_PLAYRECORD},
|
|
||||||
{IDM_MACRO_SAVECURRENTMACRO, IDI_SAVERECORD_OFF_ICON, IDI_SAVERECORD_ON_ICON, IDI_SAVERECORD_DISABLE_ICON, IDR_SAVERECORD}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LRESULT CALLBACK Notepad_plus::Notepad_plus_Proc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
|
||||||
{
|
{
|
||||||
|
switch(Message)
|
||||||
static bool isFirstGetMinMaxInfoMsg = true;
|
|
||||||
|
|
||||||
switch(Message)
|
|
||||||
{
|
|
||||||
case WM_NCCREATE : // First message we get the ptr of instantiated object
|
|
||||||
// then stock it into GWL_USERDATA index in order to retrieve afterward
|
|
||||||
{
|
{
|
||||||
Notepad_plus *pM30ide = (Notepad_plus *)(((LPCREATESTRUCT)lParam)->lpCreateParams);
|
case WM_NCCREATE : // First message we get the ptr of instantiated object
|
||||||
pM30ide->_hSelf = hwnd;
|
// then stock it into GWL_USERDATA index in order to retrieve afterward
|
||||||
::SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)pM30ide);
|
{
|
||||||
|
Notepad_plus_Window *pM30ide = (Notepad_plus_Window *)(((LPCREATESTRUCT)lParam)->lpCreateParams);
|
||||||
|
pM30ide->_hSelf = hwnd;
|
||||||
|
::SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)pM30ide);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
default :
|
||||||
|
{
|
||||||
|
return ((Notepad_plus_Window *)::GetWindowLongPtr(hwnd, GWL_USERDATA))->runProc(hwnd, Message, wParam, lParam);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
default :
|
LRESULT Notepad_plus_Window::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
return ((Notepad_plus *)::GetWindowLongPtr(hwnd, GWL_USERDATA))->runProc(hwnd, Message, wParam, lParam);
|
LRESULT result = FALSE;
|
||||||
}
|
switch (Message)
|
||||||
}
|
{
|
||||||
|
case WM_CREATE:
|
||||||
|
{
|
||||||
|
_notepad_plus_plus_core._pPublicInterface = this;
|
||||||
|
result = _notepad_plus_plus_core.init(hwnd);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (this)
|
||||||
|
return _notepad_plus_plus_core.process(hwnd, Message, wParam, lParam);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
||||||
LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
|
||||||
{
|
{
|
||||||
LRESULT result = FALSE;
|
LRESULT result = FALSE;
|
||||||
|
|
||||||
@ -144,434 +93,6 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
::SendMessage(_dockingManager.getHSelf(), WM_NCACTIVATE, wParam, (LPARAM)-1);
|
::SendMessage(_dockingManager.getHSelf(), WM_NCACTIVATE, wParam, (LPARAM)-1);
|
||||||
return ::DefWindowProc(hwnd, Message, wParam, lParam);
|
return ::DefWindowProc(hwnd, Message, wParam, lParam);
|
||||||
}
|
}
|
||||||
case WM_CREATE:
|
|
||||||
{
|
|
||||||
NppGUI & nppGUI = (NppGUI &)pNppParam->getNppGUI();
|
|
||||||
|
|
||||||
// Menu
|
|
||||||
_mainMenuHandle = ::GetMenu(hwnd);
|
|
||||||
int langPos2BeRemoved = MENUINDEX_LANGUAGE+1;
|
|
||||||
if (nppGUI._isLangMenuCompact)
|
|
||||||
langPos2BeRemoved = MENUINDEX_LANGUAGE;
|
|
||||||
::RemoveMenu(_mainMenuHandle, langPos2BeRemoved, MF_BYPOSITION);
|
|
||||||
|
|
||||||
//Views
|
|
||||||
_pDocTab = &_mainDocTab;
|
|
||||||
_pEditView = &_mainEditView;
|
|
||||||
_pNonDocTab = &_subDocTab;
|
|
||||||
_pNonEditView = &_subEditView;
|
|
||||||
|
|
||||||
_mainEditView.init(_hInst, hwnd);
|
|
||||||
_subEditView.init(_hInst, hwnd);
|
|
||||||
|
|
||||||
_fileEditView.init(_hInst, hwnd);
|
|
||||||
MainFileManager->init(this, &_fileEditView); //get it up and running asap.
|
|
||||||
|
|
||||||
pNppParam->setFontList(hwnd);
|
|
||||||
|
|
||||||
|
|
||||||
_mainWindowStatus = WindowMainActive;
|
|
||||||
_activeView = MAIN_VIEW;
|
|
||||||
|
|
||||||
const ScintillaViewParams & svp1 = pNppParam->getSVP(SCIV_PRIMARY);
|
|
||||||
const ScintillaViewParams & svp2 = pNppParam->getSVP(SCIV_SECOND);
|
|
||||||
|
|
||||||
int tabBarStatus = nppGUI._tabStatus;
|
|
||||||
_toReduceTabBar = ((tabBarStatus & TAB_REDUCE) != 0);
|
|
||||||
_docTabIconList.create(_toReduceTabBar?13:20, _hInst, docTabIconIDs, sizeof(docTabIconIDs)/sizeof(int));
|
|
||||||
|
|
||||||
_mainDocTab.init(_hInst, hwnd, &_mainEditView, &_docTabIconList);
|
|
||||||
_subDocTab.init(_hInst, hwnd, &_subEditView, &_docTabIconList);
|
|
||||||
|
|
||||||
_mainEditView.display();
|
|
||||||
|
|
||||||
_invisibleEditView.init(_hInst, hwnd);
|
|
||||||
_invisibleEditView.execute(SCI_SETUNDOCOLLECTION);
|
|
||||||
_invisibleEditView.execute(SCI_EMPTYUNDOBUFFER);
|
|
||||||
_invisibleEditView.wrap(false); // Make sure no slow down
|
|
||||||
|
|
||||||
// Configuration of 2 scintilla views
|
|
||||||
_mainEditView.showMargin(ScintillaEditView::_SC_MARGE_LINENUMBER, svp1._lineNumberMarginShow);
|
|
||||||
_subEditView.showMargin(ScintillaEditView::_SC_MARGE_LINENUMBER, svp2._lineNumberMarginShow);
|
|
||||||
_mainEditView.showMargin(ScintillaEditView::_SC_MARGE_SYBOLE, svp1._bookMarkMarginShow);
|
|
||||||
_subEditView.showMargin(ScintillaEditView::_SC_MARGE_SYBOLE, svp2._bookMarkMarginShow);
|
|
||||||
|
|
||||||
_mainEditView.showIndentGuideLine(svp1._indentGuideLineShow);
|
|
||||||
_subEditView.showIndentGuideLine(svp2._indentGuideLineShow);
|
|
||||||
|
|
||||||
::SendMessage(hwnd, NPPM_INTERNAL_SETCARETWIDTH, 0, 0);
|
|
||||||
::SendMessage(hwnd, NPPM_INTERNAL_SETCARETBLINKRATE, 0, 0);
|
|
||||||
|
|
||||||
_configStyleDlg.init(_hInst, hwnd);
|
|
||||||
_preference.init(_hInst, hwnd);
|
|
||||||
|
|
||||||
//Marker Margin config
|
|
||||||
_mainEditView.setMakerStyle(svp1._folderStyle);
|
|
||||||
_subEditView.setMakerStyle(svp2._folderStyle);
|
|
||||||
|
|
||||||
_mainEditView.execute(SCI_SETCARETLINEVISIBLE, svp1._currentLineHilitingShow);
|
|
||||||
_subEditView.execute(SCI_SETCARETLINEVISIBLE, svp2._currentLineHilitingShow);
|
|
||||||
|
|
||||||
_mainEditView.execute(SCI_SETCARETLINEVISIBLEALWAYS, true);
|
|
||||||
_subEditView.execute(SCI_SETCARETLINEVISIBLEALWAYS, true);
|
|
||||||
|
|
||||||
_mainEditView.wrap(svp1._doWrap);
|
|
||||||
_subEditView.wrap(svp2._doWrap);
|
|
||||||
|
|
||||||
_mainEditView.execute(SCI_SETEDGECOLUMN, svp1._edgeNbColumn);
|
|
||||||
_mainEditView.execute(SCI_SETEDGEMODE, svp1._edgeMode);
|
|
||||||
_subEditView.execute(SCI_SETEDGECOLUMN, svp2._edgeNbColumn);
|
|
||||||
_subEditView.execute(SCI_SETEDGEMODE, svp2._edgeMode);
|
|
||||||
|
|
||||||
_mainEditView.showEOL(svp1._eolShow);
|
|
||||||
_subEditView.showEOL(svp2._eolShow);
|
|
||||||
|
|
||||||
_mainEditView.showWSAndTab(svp1._whiteSpaceShow);
|
|
||||||
_subEditView.showWSAndTab(svp2._whiteSpaceShow);
|
|
||||||
|
|
||||||
_mainEditView.showWrapSymbol(svp1._wrapSymbolShow);
|
|
||||||
_subEditView.showWrapSymbol(svp2._wrapSymbolShow);
|
|
||||||
|
|
||||||
_mainEditView.performGlobalStyles();
|
|
||||||
_subEditView.performGlobalStyles();
|
|
||||||
|
|
||||||
_zoomOriginalValue = _pEditView->execute(SCI_GETZOOM);
|
|
||||||
_mainEditView.execute(SCI_SETZOOM, svp1._zoom);
|
|
||||||
_subEditView.execute(SCI_SETZOOM, svp2._zoom);
|
|
||||||
|
|
||||||
::SendMessage(hwnd, NPPM_INTERNAL_SETMULTISELCTION, 0, 0);
|
|
||||||
|
|
||||||
_mainEditView.execute(SCI_SETADDITIONALSELECTIONTYPING, true);
|
|
||||||
_subEditView.execute(SCI_SETADDITIONALSELECTIONTYPING, true);
|
|
||||||
|
|
||||||
_mainEditView.execute(SCI_SETVIRTUALSPACEOPTIONS, SCVS_RECTANGULARSELECTION);
|
|
||||||
_subEditView.execute(SCI_SETVIRTUALSPACEOPTIONS, SCVS_RECTANGULARSELECTION);
|
|
||||||
|
|
||||||
TabBarPlus::doDragNDrop(true);
|
|
||||||
|
|
||||||
if (_toReduceTabBar)
|
|
||||||
{
|
|
||||||
HFONT hf = (HFONT)::GetStockObject(DEFAULT_GUI_FONT);
|
|
||||||
|
|
||||||
if (hf)
|
|
||||||
{
|
|
||||||
::SendMessage(_mainDocTab.getHSelf(), WM_SETFONT, (WPARAM)hf, MAKELPARAM(TRUE, 0));
|
|
||||||
::SendMessage(_subDocTab.getHSelf(), WM_SETFONT, (WPARAM)hf, MAKELPARAM(TRUE, 0));
|
|
||||||
}
|
|
||||||
TabCtrl_SetItemSize(_mainDocTab.getHSelf(), 45, 20);
|
|
||||||
TabCtrl_SetItemSize(_subDocTab.getHSelf(), 45, 20);
|
|
||||||
}
|
|
||||||
_mainDocTab.display();
|
|
||||||
|
|
||||||
|
|
||||||
TabBarPlus::doDragNDrop((tabBarStatus & TAB_DRAGNDROP) != 0);
|
|
||||||
TabBarPlus::setDrawTopBar((tabBarStatus & TAB_DRAWTOPBAR) != 0);
|
|
||||||
TabBarPlus::setDrawInactiveTab((tabBarStatus & TAB_DRAWINACTIVETAB) != 0);
|
|
||||||
TabBarPlus::setDrawTabCloseButton((tabBarStatus & TAB_CLOSEBUTTON) != 0);
|
|
||||||
TabBarPlus::setDbClk2Close((tabBarStatus & TAB_DBCLK2CLOSE) != 0);
|
|
||||||
TabBarPlus::setVertical((tabBarStatus & TAB_VERTICAL) != 0);
|
|
||||||
drawTabbarColoursFromStylerArray();
|
|
||||||
|
|
||||||
//--Splitter Section--//
|
|
||||||
bool isVertical = (nppGUI._splitterPos == POS_VERTICAL);
|
|
||||||
|
|
||||||
_subSplitter.init(_hInst, hwnd);
|
|
||||||
_subSplitter.create(&_mainDocTab, &_subDocTab, 8, DYNAMIC, 50, isVertical);
|
|
||||||
|
|
||||||
//--Status Bar Section--//
|
|
||||||
bool willBeShown = nppGUI._statusBarShow;
|
|
||||||
_statusBar.init(_hInst, hwnd, 6);
|
|
||||||
_statusBar.setPartWidth(STATUSBAR_DOC_SIZE, 250);
|
|
||||||
_statusBar.setPartWidth(STATUSBAR_CUR_POS, 300);
|
|
||||||
_statusBar.setPartWidth(STATUSBAR_EOF_FORMAT, 80);
|
|
||||||
_statusBar.setPartWidth(STATUSBAR_UNICODE_TYPE, 100);
|
|
||||||
_statusBar.setPartWidth(STATUSBAR_TYPING_MODE, 30);
|
|
||||||
_statusBar.display(willBeShown);
|
|
||||||
|
|
||||||
_pMainWindow = &_mainDocTab;
|
|
||||||
|
|
||||||
_dockingManager.init(_hInst, hwnd, &_pMainWindow);
|
|
||||||
|
|
||||||
if (nppGUI._isMinimizedToTray && _pTrayIco == NULL)
|
|
||||||
_pTrayIco = new trayIconControler(hwnd, IDI_M30ICON, IDC_MINIMIZED_TRAY, ::LoadIcon(_hInst, MAKEINTRESOURCE(IDI_M30ICON)), TEXT(""));
|
|
||||||
|
|
||||||
checkSyncState();
|
|
||||||
|
|
||||||
// Plugin Manager
|
|
||||||
NppData nppData;
|
|
||||||
nppData._nppHandle = hwnd;
|
|
||||||
nppData._scintillaMainHandle = _mainEditView.getHSelf();
|
|
||||||
nppData._scintillaSecondHandle = _subEditView.getHSelf();
|
|
||||||
|
|
||||||
_scintillaCtrls4Plugins.init(_hInst, hwnd);
|
|
||||||
_pluginsManager.init(nppData);
|
|
||||||
_pluginsManager.loadPlugins();
|
|
||||||
const TCHAR *appDataNpp = pNppParam->getAppDataNppDir();
|
|
||||||
if (appDataNpp[0])
|
|
||||||
_pluginsManager.loadPlugins(appDataNpp);
|
|
||||||
|
|
||||||
_restoreButton.init(_hInst, hwnd);
|
|
||||||
|
|
||||||
|
|
||||||
// ------------ //
|
|
||||||
// Menu Section //
|
|
||||||
// ------------ //
|
|
||||||
|
|
||||||
// Macro Menu
|
|
||||||
std::vector<MacroShortcut> & macros = pNppParam->getMacroList();
|
|
||||||
HMENU hMacroMenu = ::GetSubMenu(_mainMenuHandle, MENUINDEX_MACRO);
|
|
||||||
size_t const posBase = 6;
|
|
||||||
size_t nbMacro = macros.size();
|
|
||||||
if (nbMacro >= 1)
|
|
||||||
::InsertMenu(hMacroMenu, posBase - 1, MF_BYPOSITION, (unsigned int)-1, 0);
|
|
||||||
for (size_t i = 0 ; i < nbMacro ; i++)
|
|
||||||
{
|
|
||||||
::InsertMenu(hMacroMenu, posBase + i, MF_BYPOSITION, ID_MACRO + i, macros[i].toMenuItemString().c_str());
|
|
||||||
}
|
|
||||||
// Run Menu
|
|
||||||
std::vector<UserCommand> & userCommands = pNppParam->getUserCommandList();
|
|
||||||
HMENU hRunMenu = ::GetSubMenu(_mainMenuHandle, MENUINDEX_RUN);
|
|
||||||
int const runPosBase = 2;
|
|
||||||
size_t nbUserCommand = userCommands.size();
|
|
||||||
if (nbUserCommand >= 1)
|
|
||||||
::InsertMenu(hRunMenu, runPosBase - 1, MF_BYPOSITION, (unsigned int)-1, 0);
|
|
||||||
for (size_t i = 0 ; i < nbUserCommand ; i++)
|
|
||||||
{
|
|
||||||
::InsertMenu(hRunMenu, runPosBase + i, MF_BYPOSITION, ID_USER_CMD + i, userCommands[i].toMenuItemString().c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Updater menu item
|
|
||||||
if (!nppGUI._doesExistUpdater)
|
|
||||||
{
|
|
||||||
//::MessageBox(NULL, TEXT("pas de updater"), TEXT(""), MB_OK);
|
|
||||||
::DeleteMenu(_mainMenuHandle, IDM_UPDATE_NPP, MF_BYCOMMAND);
|
|
||||||
::DrawMenuBar(hwnd);
|
|
||||||
}
|
|
||||||
//Languages Menu
|
|
||||||
HMENU hLangMenu = ::GetSubMenu(_mainMenuHandle, MENUINDEX_LANGUAGE);
|
|
||||||
|
|
||||||
// Add external languages to menu
|
|
||||||
for (int i = 0 ; i < pNppParam->getNbExternalLang() ; i++)
|
|
||||||
{
|
|
||||||
ExternalLangContainer & externalLangContainer = pNppParam->getELCFromIndex(i);
|
|
||||||
|
|
||||||
int numLangs = ::GetMenuItemCount(hLangMenu);
|
|
||||||
const int bufferSize = 100;
|
|
||||||
TCHAR buffer[bufferSize];
|
|
||||||
|
|
||||||
int x;
|
|
||||||
for(x = 0; (x == 0 || lstrcmp(externalLangContainer._name, buffer) > 0) && x < numLangs; x++)
|
|
||||||
{
|
|
||||||
::GetMenuString(hLangMenu, x, buffer, bufferSize, MF_BYPOSITION);
|
|
||||||
}
|
|
||||||
|
|
||||||
::InsertMenu(hLangMenu, x-1, MF_BYPOSITION, IDM_LANG_EXTERNAL + i, externalLangContainer._name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nppGUI._excludedLangList.size() > 0)
|
|
||||||
{
|
|
||||||
for (size_t i = 0 ; i < nppGUI._excludedLangList.size() ; i++)
|
|
||||||
{
|
|
||||||
int cmdID = pNppParam->langTypeToCommandID(nppGUI._excludedLangList[i]._langType);
|
|
||||||
const int itemSize = 256;
|
|
||||||
TCHAR itemName[itemSize];
|
|
||||||
::GetMenuString(hLangMenu, cmdID, itemName, itemSize, MF_BYCOMMAND);
|
|
||||||
nppGUI._excludedLangList[i]._cmdID = cmdID;
|
|
||||||
nppGUI._excludedLangList[i]._langName = itemName;
|
|
||||||
::DeleteMenu(hLangMenu, cmdID, MF_BYCOMMAND);
|
|
||||||
DrawMenuBar(hwnd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add User Define Languages Entry
|
|
||||||
int udlpos = ::GetMenuItemCount(hLangMenu) - 1;
|
|
||||||
|
|
||||||
for (int i = 0 ; i < pNppParam->getNbUserLang() ; i++)
|
|
||||||
{
|
|
||||||
UserLangContainer & userLangContainer = pNppParam->getULCFromIndex(i);
|
|
||||||
::InsertMenu(hLangMenu, udlpos + i, MF_BYPOSITION, IDM_LANG_USER + i + 1, userLangContainer.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
//Add recent files
|
|
||||||
HMENU hFileMenu = ::GetSubMenu(_mainMenuHandle, MENUINDEX_FILE);
|
|
||||||
int nbLRFile = pNppParam->getNbLRFile();
|
|
||||||
int pos = IDM_FILEMENU_LASTONE - IDM_FILE + 2;
|
|
||||||
|
|
||||||
_lastRecentFileList.initMenu(hFileMenu, IDM_FILEMENU_LASTONE + 1, pos);
|
|
||||||
_lastRecentFileList.setLangEncoding(_nativeLangSpeaker.getLangEncoding());
|
|
||||||
for (int i = 0 ; i < nbLRFile ; i++)
|
|
||||||
{
|
|
||||||
generic_string * stdStr = pNppParam->getLRFile(i);
|
|
||||||
if (!nppGUI._checkHistoryFiles || PathFileExists(stdStr->c_str()))
|
|
||||||
{
|
|
||||||
_lastRecentFileList.add(stdStr->c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Plugin menu
|
|
||||||
_pluginsManager.setMenu(_mainMenuHandle, NULL);
|
|
||||||
|
|
||||||
//Main menu is loaded, now load context menu items
|
|
||||||
pNppParam->getContextMenuFromXmlTree(_mainMenuHandle);
|
|
||||||
|
|
||||||
if (pNppParam->hasCustomContextMenu())
|
|
||||||
{
|
|
||||||
_mainEditView.execute(SCI_USEPOPUP, FALSE);
|
|
||||||
_subEditView.execute(SCI_USEPOPUP, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
generic_string pluginsTrans, windowTrans;
|
|
||||||
_nativeLangSpeaker.changeMenuLang(_mainMenuHandle, pluginsTrans, windowTrans);
|
|
||||||
::DrawMenuBar(_hSelf);
|
|
||||||
|
|
||||||
if (_pluginsManager.hasPlugins() && pluginsTrans != TEXT(""))
|
|
||||||
{
|
|
||||||
::ModifyMenu(_mainMenuHandle, MENUINDEX_PLUGINS, MF_BYPOSITION, 0, pluginsTrans.c_str());
|
|
||||||
}
|
|
||||||
//Windows menu
|
|
||||||
_windowsMenu.init(_hInst, _mainMenuHandle, windowTrans.c_str());
|
|
||||||
|
|
||||||
// Update context menu strings
|
|
||||||
vector<MenuItemUnit> & tmp = pNppParam->getContextMenuItems();
|
|
||||||
size_t len = tmp.size();
|
|
||||||
TCHAR menuName[64];
|
|
||||||
for (size_t i = 0 ; i < len ; i++)
|
|
||||||
{
|
|
||||||
if (tmp[i]._itemName == TEXT(""))
|
|
||||||
{
|
|
||||||
::GetMenuString(_mainMenuHandle, tmp[i]._cmdID, menuName, 64, MF_BYCOMMAND);
|
|
||||||
tmp[i]._itemName = purgeMenuItemString(menuName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Input all the menu item names into shortcut list
|
|
||||||
//This will automatically do all translations, since menu translation has been done already
|
|
||||||
vector<CommandShortcut> & shortcuts = pNppParam->getUserShortcuts();
|
|
||||||
len = shortcuts.size();
|
|
||||||
|
|
||||||
for(size_t i = 0; i < len; i++)
|
|
||||||
{
|
|
||||||
CommandShortcut & csc = shortcuts[i];
|
|
||||||
if (!csc.getName()[0])
|
|
||||||
{ //no predefined name, get name from menu and use that
|
|
||||||
::GetMenuString(_mainMenuHandle, csc.getID(), menuName, 64, MF_BYCOMMAND);
|
|
||||||
csc.setName(purgeMenuItemString(menuName, true).c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Translate non-menu shortcuts
|
|
||||||
_nativeLangSpeaker.changeShortcutLang();
|
|
||||||
|
|
||||||
//Update plugin shortcuts, all plugin commands should be available now
|
|
||||||
pNppParam->reloadPluginCmds();
|
|
||||||
|
|
||||||
// Shortcut Accelerator : should be the last one since it will capture all the shortcuts
|
|
||||||
_accelerator.init(_mainMenuHandle, hwnd);
|
|
||||||
pNppParam->setAccelerator(&_accelerator);
|
|
||||||
|
|
||||||
// Scintilla key accelerator
|
|
||||||
vector<HWND> scints;
|
|
||||||
scints.push_back(_mainEditView.getHSelf());
|
|
||||||
scints.push_back(_subEditView.getHSelf());
|
|
||||||
_scintaccelerator.init(&scints, _mainMenuHandle, hwnd);
|
|
||||||
|
|
||||||
pNppParam->setScintillaAccelerator(&_scintaccelerator);
|
|
||||||
_scintaccelerator.updateKeys();
|
|
||||||
|
|
||||||
::DrawMenuBar(hwnd);
|
|
||||||
|
|
||||||
|
|
||||||
//-- Tool Bar Section --//
|
|
||||||
toolBarStatusType tbStatus = nppGUI._toolBarStatus;
|
|
||||||
willBeShown = nppGUI._toolbarShow;
|
|
||||||
|
|
||||||
// To notify plugins that toolbar icons can be registered
|
|
||||||
SCNotification scnN;
|
|
||||||
scnN.nmhdr.code = NPPN_TBMODIFICATION;
|
|
||||||
scnN.nmhdr.hwndFrom = hwnd;
|
|
||||||
scnN.nmhdr.idFrom = 0;
|
|
||||||
_pluginsManager.notify(&scnN);
|
|
||||||
|
|
||||||
_toolBar.init(_hInst, hwnd, tbStatus, toolBarIcons, sizeof(toolBarIcons)/sizeof(ToolBarButtonUnit));
|
|
||||||
|
|
||||||
changeToolBarIcons();
|
|
||||||
|
|
||||||
_rebarTop.init(_hInst, hwnd);
|
|
||||||
_rebarBottom.init(_hInst, hwnd);
|
|
||||||
_toolBar.addToRebar(&_rebarTop);
|
|
||||||
_rebarTop.setIDVisible(REBAR_BAR_TOOLBAR, willBeShown);
|
|
||||||
|
|
||||||
//--Init dialogs--//
|
|
||||||
_findReplaceDlg.init(_hInst, hwnd, &_pEditView);
|
|
||||||
_incrementFindDlg.init(_hInst, hwnd, &_findReplaceDlg, _nativeLangSpeaker.isRTL());
|
|
||||||
_incrementFindDlg.addToRebar(&_rebarBottom);
|
|
||||||
_goToLineDlg.init(_hInst, hwnd, &_pEditView);
|
|
||||||
_colEditorDlg.init(_hInst, hwnd, &_pEditView);
|
|
||||||
_aboutDlg.init(_hInst, hwnd);
|
|
||||||
_runDlg.init(_hInst, hwnd);
|
|
||||||
_runMacroDlg.init(_hInst, hwnd);
|
|
||||||
|
|
||||||
//--User Define Dialog Section--//
|
|
||||||
int uddStatus = nppGUI._userDefineDlgStatus;
|
|
||||||
UserDefineDialog *udd = _pEditView->getUserDefineDlg();
|
|
||||||
|
|
||||||
bool uddShow = false;
|
|
||||||
switch (uddStatus)
|
|
||||||
{
|
|
||||||
case UDD_SHOW : // show & undocked
|
|
||||||
udd->doDialog(true, _nativeLangSpeaker.isRTL());
|
|
||||||
_nativeLangSpeaker.changeUserDefineLang(udd);
|
|
||||||
uddShow = true;
|
|
||||||
break;
|
|
||||||
case UDD_DOCKED : { // hide & docked
|
|
||||||
_isUDDocked = true;
|
|
||||||
break;}
|
|
||||||
case (UDD_SHOW | UDD_DOCKED) : // show & docked
|
|
||||||
udd->doDialog(true, _nativeLangSpeaker.isRTL());
|
|
||||||
_nativeLangSpeaker.changeUserDefineLang(udd);
|
|
||||||
::SendMessage(udd->getHSelf(), WM_COMMAND, IDC_DOCK_BUTTON, 0);
|
|
||||||
uddShow = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default : // hide & undocked
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// UserDefine Dialog
|
|
||||||
|
|
||||||
checkMenuItem(IDM_VIEW_USER_DLG, uddShow);
|
|
||||||
_toolBar.setCheck(IDM_VIEW_USER_DLG, uddShow);
|
|
||||||
|
|
||||||
//launch the plugin dlg memorized at the last session
|
|
||||||
DockingManagerData &dmd = nppGUI._dockingData;
|
|
||||||
|
|
||||||
_dockingManager.setDockedContSize(CONT_LEFT , nppGUI._dockingData._leftWidth);
|
|
||||||
_dockingManager.setDockedContSize(CONT_RIGHT , nppGUI._dockingData._rightWidth);
|
|
||||||
_dockingManager.setDockedContSize(CONT_TOP , nppGUI._dockingData._topHeight);
|
|
||||||
_dockingManager.setDockedContSize(CONT_BOTTOM, nppGUI._dockingData._bottomHight);
|
|
||||||
|
|
||||||
for (size_t i = 0 ; i < dmd._pluginDockInfo.size() ; i++)
|
|
||||||
{
|
|
||||||
PlugingDlgDockingInfo & pdi = dmd._pluginDockInfo[i];
|
|
||||||
|
|
||||||
if (pdi._isVisible)
|
|
||||||
_pluginsManager.runPluginCommand(pdi._name.c_str(), pdi._internalID);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (size_t i = 0 ; i < dmd._containerTabInfo.size() ; i++)
|
|
||||||
{
|
|
||||||
ContainerTabInfo & cti = dmd._containerTabInfo[i];
|
|
||||||
_dockingManager.setActiveTab(cti._cont, cti._activeTab);
|
|
||||||
}
|
|
||||||
//Load initial docs into doctab
|
|
||||||
loadBufferIntoView(_mainEditView.getCurrentBufferID(), MAIN_VIEW);
|
|
||||||
loadBufferIntoView(_subEditView.getCurrentBufferID(), SUB_VIEW);
|
|
||||||
activateBuffer(_mainEditView.getCurrentBufferID(), MAIN_VIEW);
|
|
||||||
activateBuffer(_subEditView.getCurrentBufferID(), SUB_VIEW);
|
|
||||||
MainFileManager->increaseDocNr(); //so next doc starts at 2
|
|
||||||
|
|
||||||
::SetFocus(_mainEditView.getHSelf());
|
|
||||||
result = TRUE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WM_DRAWITEM :
|
case WM_DRAWITEM :
|
||||||
{
|
{
|
||||||
@ -858,7 +379,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
{
|
{
|
||||||
RECT rc;
|
RECT rc;
|
||||||
getClientRect(rc);
|
_pPublicInterface->getClientRect(rc);
|
||||||
if (lParam == 0) {
|
if (lParam == 0) {
|
||||||
lParam = MAKELPARAM(rc.right - rc.left, rc.bottom - rc.top);
|
lParam = MAKELPARAM(rc.right - rc.left, rc.bottom - rc.top);
|
||||||
}
|
}
|
||||||
@ -1030,7 +551,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
{
|
{
|
||||||
if (lstrlen(fileStr) >= int(wParam))
|
if (lstrlen(fileStr) >= int(wParam))
|
||||||
{
|
{
|
||||||
::MessageBox(_hSelf, TEXT("Allocated buffer size is not enough to copy the string."), TEXT("NPPM error"), MB_OK);
|
::MessageBox(_pPublicInterface->getHSelf(), TEXT("Allocated buffer size is not enough to copy the string."), TEXT("NPPM error"), MB_OK);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1051,7 +572,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
{
|
{
|
||||||
if (lstrlen(str) >= int(wParam)) //buffer too small
|
if (lstrlen(str) >= int(wParam)) //buffer too small
|
||||||
{
|
{
|
||||||
::MessageBox(_hSelf, TEXT("Allocated buffer size is not enough to copy the string."), TEXT("NPPM_GETCURRENTWORD error"), MB_OK);
|
::MessageBox(_pPublicInterface->getHSelf(), TEXT("Allocated buffer size is not enough to copy the string."), TEXT("NPPM_GETCURRENTWORD error"), MB_OK);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
else //buffer large enough, perform safe copy
|
else //buffer large enough, perform safe copy
|
||||||
@ -1079,7 +600,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
{
|
{
|
||||||
if (lstrlen(str) >= int(wParam))
|
if (lstrlen(str) >= int(wParam))
|
||||||
{
|
{
|
||||||
::MessageBox(_hSelf, TEXT("Allocated buffer size is not enough to copy the string."), TEXT("NPPM_GETNPPDIRECTORY error"), MB_OK);
|
::MessageBox(_pPublicInterface->getHSelf(), TEXT("Allocated buffer size is not enough to copy the string."), TEXT("NPPM_GETNPPDIRECTORY error"), MB_OK);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1196,7 +717,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
pNppParam->_isTaskListRBUTTONUP_Active = true;
|
pNppParam->_isTaskListRBUTTONUP_Active = true;
|
||||||
short zDelta = (short) HIWORD(wParam);
|
short zDelta = (short) HIWORD(wParam);
|
||||||
return ::SendMessage(_hSelf, WM_COMMAND, zDelta>0?IDC_PREV_DOC:IDC_NEXT_DOC, 0);
|
return ::SendMessage(_pPublicInterface->getHSelf(), WM_COMMAND, zDelta>0?IDC_PREV_DOC:IDC_NEXT_DOC, 0);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -1359,7 +880,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
nmhdr.hwndFrom = (whichView == MAIN_VIEW)?_mainDocTab.getHSelf():_subDocTab.getHSelf();
|
nmhdr.hwndFrom = (whichView == MAIN_VIEW)?_mainDocTab.getHSelf():_subDocTab.getHSelf();
|
||||||
|
|
||||||
nmhdr.idFrom = ::GetDlgCtrlID(nmhdr.hwndFrom);
|
nmhdr.idFrom = ::GetDlgCtrlID(nmhdr.hwndFrom);
|
||||||
::SendMessage(_hSelf, WM_NOTIFY, nmhdr.idFrom, (LPARAM)&nmhdr);
|
::SendMessage(_pPublicInterface->getHSelf(), WM_NOTIFY, nmhdr.idFrom, (LPARAM)&nmhdr);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -1436,7 +957,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
for (Macro::iterator step = m.begin(); step != m.end(); step++)
|
for (Macro::iterator step = m.begin(); step != m.end(); step++)
|
||||||
step->PlayBack(this, _pEditView);
|
step->PlayBack(this->_pPublicInterface, _pEditView);
|
||||||
|
|
||||||
counter++;
|
counter++;
|
||||||
if ( times >= 0 )
|
if ( times >= 0 )
|
||||||
@ -1474,7 +995,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
case NPPM_CREATESCINTILLAHANDLE :
|
case NPPM_CREATESCINTILLAHANDLE :
|
||||||
{
|
{
|
||||||
return (LRESULT)_scintillaCtrls4Plugins.createSintilla((lParam == NULL?_hSelf:(HWND)lParam));
|
return (LRESULT)_scintillaCtrls4Plugins.createSintilla((lParam == NULL?_pPublicInterface->getHSelf():(HWND)lParam));
|
||||||
}
|
}
|
||||||
|
|
||||||
case NPPM_DESTROYSCINTILLAHANDLE :
|
case NPPM_DESTROYSCINTILLAHANDLE :
|
||||||
@ -1567,7 +1088,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
case NPPM_INTERNAL_CMDLIST_MODIFIED :
|
case NPPM_INTERNAL_CMDLIST_MODIFIED :
|
||||||
{
|
{
|
||||||
//changeMenuShortcut(lParam, (const TCHAR *)wParam);
|
//changeMenuShortcut(lParam, (const TCHAR *)wParam);
|
||||||
::DrawMenuBar(_hSelf);
|
::DrawMenuBar(_pPublicInterface->getHSelf());
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1673,7 +1194,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
{
|
{
|
||||||
isEnable.push_back((::GetMenuState(_mainMenuHandle, tmp[i]._cmdID, MF_BYCOMMAND)&MF_DISABLED) == 0);
|
isEnable.push_back((::GetMenuState(_mainMenuHandle, tmp[i]._cmdID, MF_BYCOMMAND)&MF_DISABLED) == 0);
|
||||||
}
|
}
|
||||||
scintillaContextmenu.create(_hSelf, tmp);
|
scintillaContextmenu.create(_pPublicInterface->getHSelf(), tmp);
|
||||||
for (size_t i = 0 ; i < isEnable.size() ; i++)
|
for (size_t i = 0 ; i < isEnable.size() ; i++)
|
||||||
scintillaContextmenu.enableItem(tmp[i]._cmdID, isEnable[i]);
|
scintillaContextmenu.enableItem(tmp[i]._cmdID, isEnable[i]);
|
||||||
|
|
||||||
@ -1786,7 +1307,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
// Notify plugins of update to styles xml
|
// Notify plugins of update to styles xml
|
||||||
SCNotification scnN;
|
SCNotification scnN;
|
||||||
scnN.nmhdr.code = NPPN_WORDSTYLESUPDATED;
|
scnN.nmhdr.code = NPPN_WORDSTYLESUPDATED;
|
||||||
scnN.nmhdr.hwndFrom = _hSelf;
|
scnN.nmhdr.hwndFrom = _pPublicInterface->getHSelf();
|
||||||
scnN.nmhdr.idFrom = (uptr_t) _pEditView->getCurrentBufferID();
|
scnN.nmhdr.idFrom = (uptr_t) _pEditView->getCurrentBufferID();
|
||||||
_pluginsManager.notify(&scnN);
|
_pluginsManager.notify(&scnN);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -1795,9 +1316,9 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
case WM_QUERYENDSESSION:
|
case WM_QUERYENDSESSION:
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
{
|
{
|
||||||
if (_isPrelaunch)
|
if (_pPublicInterface->isPrelaunch())
|
||||||
{
|
{
|
||||||
SendMessage(_hSelf, WM_SYSCOMMAND, SC_MINIMIZE, 0);
|
SendMessage(_pPublicInterface->getHSelf(), WM_SYSCOMMAND, SC_MINIMIZE, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1836,7 +1357,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
SCNotification scnN;
|
SCNotification scnN;
|
||||||
scnN.nmhdr.code = NPPN_SHUTDOWN;
|
scnN.nmhdr.code = NPPN_SHUTDOWN;
|
||||||
scnN.nmhdr.hwndFrom = _hSelf;
|
scnN.nmhdr.hwndFrom = _pPublicInterface->getHSelf();
|
||||||
scnN.nmhdr.idFrom = 0;
|
scnN.nmhdr.idFrom = 0;
|
||||||
_pluginsManager.notify(&scnN);
|
_pluginsManager.notify(&scnN);
|
||||||
|
|
||||||
@ -1861,17 +1382,17 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
{
|
{
|
||||||
killAllChildren();
|
killAllChildren();
|
||||||
::PostQuitMessage(0);
|
::PostQuitMessage(0);
|
||||||
gNppHWND = NULL;
|
_pPublicInterface->gNppHWND = NULL;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_SYSCOMMAND:
|
case WM_SYSCOMMAND:
|
||||||
{
|
{
|
||||||
NppGUI & nppgui = (NppGUI &)(pNppParam->getNppGUI());
|
NppGUI & nppgui = (NppGUI &)(pNppParam->getNppGUI());
|
||||||
if ((nppgui._isMinimizedToTray || _isPrelaunch) && (wParam == SC_MINIMIZE))
|
if ((nppgui._isMinimizedToTray || _pPublicInterface->isPrelaunch()) && (wParam == SC_MINIMIZE))
|
||||||
{
|
{
|
||||||
if (!_pTrayIco)
|
if (!_pTrayIco)
|
||||||
_pTrayIco = new trayIconControler(_hSelf, IDI_M30ICON, IDC_MINIMIZED_TRAY, ::LoadIcon(_hInst, MAKEINTRESOURCE(IDI_M30ICON)), TEXT(""));
|
_pTrayIco = new trayIconControler(_pPublicInterface->getHSelf(), IDI_M30ICON, IDC_MINIMIZED_TRAY, ::LoadIcon(_pPublicInterface->getHinst(), MAKEINTRESOURCE(IDI_M30ICON)), TEXT(""));
|
||||||
|
|
||||||
_pTrayIco->doTrayIcon(ADD);
|
_pTrayIco->doTrayIcon(ADD);
|
||||||
::ShowWindow(hwnd, SW_HIDE);
|
::ShowWindow(hwnd, SW_HIDE);
|
||||||
@ -1892,7 +1413,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
case WM_LBUTTONDBLCLK:
|
case WM_LBUTTONDBLCLK:
|
||||||
{
|
{
|
||||||
::SendMessage(_hSelf, WM_COMMAND, IDM_FILE_NEW, 0);
|
::SendMessage(_pPublicInterface->getHSelf(), WM_COMMAND, IDM_FILE_NEW, 0);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1903,10 +1424,10 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
//case WM_LBUTTONDBLCLK:
|
//case WM_LBUTTONDBLCLK:
|
||||||
case WM_LBUTTONUP :
|
case WM_LBUTTONUP :
|
||||||
_pEditView->getFocus();
|
_pEditView->getFocus();
|
||||||
::ShowWindow(_hSelf, SW_SHOW);
|
::ShowWindow(_pPublicInterface->getHSelf(), SW_SHOW);
|
||||||
if (!_isPrelaunch)
|
if (!_pPublicInterface->isPrelaunch())
|
||||||
_pTrayIco->doTrayIcon(REMOVE);
|
_pTrayIco->doTrayIcon(REMOVE);
|
||||||
::SendMessage(_hSelf, WM_SIZE, 0, 0);
|
::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case WM_MBUTTONUP:
|
case WM_MBUTTONUP:
|
||||||
@ -1920,11 +1441,11 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
HMENU hmenu; // menu template
|
HMENU hmenu; // menu template
|
||||||
HMENU hTrayIconMenu; // shortcut menu
|
HMENU hTrayIconMenu; // shortcut menu
|
||||||
hmenu = ::LoadMenu(_hInst, MAKEINTRESOURCE(IDR_SYSTRAYPOPUP_MENU));
|
hmenu = ::LoadMenu(_pPublicInterface->getHinst(), MAKEINTRESOURCE(IDR_SYSTRAYPOPUP_MENU));
|
||||||
hTrayIconMenu = ::GetSubMenu(hmenu, 0);
|
hTrayIconMenu = ::GetSubMenu(hmenu, 0);
|
||||||
SetForegroundWindow(_hSelf);
|
SetForegroundWindow(_pPublicInterface->getHSelf());
|
||||||
TrackPopupMenu(hTrayIconMenu, TPM_LEFTALIGN, p.x, p.y, 0, _hSelf, NULL);
|
TrackPopupMenu(hTrayIconMenu, TPM_LEFTALIGN, p.x, p.y, 0, _pPublicInterface->getHSelf(), NULL);
|
||||||
PostMessage(_hSelf, WM_NULL, 0, 0);
|
PostMessage(_pPublicInterface->getHSelf(), WM_NULL, 0, 0);
|
||||||
DestroyMenu(hmenu);
|
DestroyMenu(hmenu);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -2008,7 +1529,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
case NPPM_GETWINDOWSVERSION:
|
case NPPM_GETWINDOWSVERSION:
|
||||||
{
|
{
|
||||||
return _winVersion;
|
return (NppParameters::getInstance())->getWinVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
case NPPM_MAKECURRENTBUFFERDIRTY :
|
case NPPM_MAKECURRENTBUFFERDIRTY :
|
||||||
@ -2057,7 +1578,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
if (hide == oldVal) return oldVal;
|
if (hide == oldVal) return oldVal;
|
||||||
|
|
||||||
DocTabView::setHideTabBarStatus(hide);
|
DocTabView::setHideTabBarStatus(hide);
|
||||||
::SendMessage(_hSelf, WM_SIZE, 0, 0);
|
::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0);
|
||||||
|
|
||||||
NppGUI & nppGUI = (NppGUI &)((NppParameters::getInstance())->getNppGUI());
|
NppGUI & nppGUI = (NppGUI &)((NppParameters::getInstance())->getNppGUI());
|
||||||
if (hide)
|
if (hide)
|
||||||
@ -2089,22 +1610,22 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
case NPPM_HIDEMENU :
|
case NPPM_HIDEMENU :
|
||||||
{
|
{
|
||||||
bool hide = (lParam == TRUE);
|
bool hide = (lParam == TRUE);
|
||||||
bool isHidden = ::GetMenu(_hSelf) == NULL;
|
bool isHidden = ::GetMenu(_pPublicInterface->getHSelf()) == NULL;
|
||||||
if (hide == isHidden)
|
if (hide == isHidden)
|
||||||
return isHidden;
|
return isHidden;
|
||||||
|
|
||||||
NppGUI & nppGUI = (NppGUI &)pNppParam->getNppGUI();
|
NppGUI & nppGUI = (NppGUI &)pNppParam->getNppGUI();
|
||||||
nppGUI._menuBarShow = !hide;
|
nppGUI._menuBarShow = !hide;
|
||||||
if (nppGUI._menuBarShow)
|
if (nppGUI._menuBarShow)
|
||||||
::SetMenu(_hSelf, _mainMenuHandle);
|
::SetMenu(_pPublicInterface->getHSelf(), _mainMenuHandle);
|
||||||
else
|
else
|
||||||
::SetMenu(_hSelf, NULL);
|
::SetMenu(_pPublicInterface->getHSelf(), NULL);
|
||||||
|
|
||||||
return isHidden;
|
return isHidden;
|
||||||
}
|
}
|
||||||
case NPPM_ISMENUHIDDEN :
|
case NPPM_ISMENUHIDDEN :
|
||||||
{
|
{
|
||||||
return (::GetMenu(_hSelf) == NULL);
|
return (::GetMenu(_pPublicInterface->getHSelf()) == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
case NPPM_HIDESTATUSBAR:
|
case NPPM_HIDESTATUSBAR:
|
||||||
@ -2117,11 +1638,11 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
return oldVal;
|
return oldVal;
|
||||||
}
|
}
|
||||||
RECT rc;
|
RECT rc;
|
||||||
getClientRect(rc);
|
_pPublicInterface->getClientRect(rc);
|
||||||
|
|
||||||
nppGUI._statusBarShow = show;
|
nppGUI._statusBarShow = show;
|
||||||
_statusBar.display(nppGUI._statusBarShow);
|
_statusBar.display(nppGUI._statusBarShow);
|
||||||
::SendMessage(_hSelf, WM_SIZE, SIZE_RESTORED, MAKELONG(rc.bottom, rc.right));
|
::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, SIZE_RESTORED, MAKELONG(rc.bottom, rc.right));
|
||||||
return oldVal;
|
return oldVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2222,7 +1743,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
{
|
{
|
||||||
NppGUI & nppgui = (NppGUI &)(pNppParam->getNppGUI());
|
NppGUI & nppgui = (NppGUI &)(pNppParam->getNppGUI());
|
||||||
if (!nppgui._menuBarShow && !wParam && !_sysMenuEntering)
|
if (!nppgui._menuBarShow && !wParam && !_sysMenuEntering)
|
||||||
::SetMenu(_hSelf, _mainMenuHandle);
|
::SetMenu(_pPublicInterface->getHSelf(), _mainMenuHandle);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -2231,7 +1752,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
{
|
{
|
||||||
NppGUI & nppgui = (NppGUI &)(pNppParam->getNppGUI());
|
NppGUI & nppgui = (NppGUI &)(pNppParam->getNppGUI());
|
||||||
if (!nppgui._menuBarShow && !wParam && !_sysMenuEntering)
|
if (!nppgui._menuBarShow && !wParam && !_sysMenuEntering)
|
||||||
::SetMenu(_hSelf, NULL);
|
::SetMenu(_pPublicInterface->getHSelf(), NULL);
|
||||||
_sysMenuEntering = false;
|
_sysMenuEntering = false;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
#include "precompiledHeaders.h"
|
#include "precompiledHeaders.h"
|
||||||
#include "Notepad_plus.h"
|
#include "Notepad_plus_Window.h"
|
||||||
#include "EncodingMapper.h"
|
#include "EncodingMapper.h"
|
||||||
#include "ShortcutMapper.h"
|
#include "ShortcutMapper.h"
|
||||||
#include "TaskListDlg.h"
|
#include "TaskListDlg.h"
|
||||||
@ -91,7 +91,7 @@ void Notepad_plus::command(int id)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case IDM_FILE_EXIT:
|
case IDM_FILE_EXIT:
|
||||||
::SendMessage(_hSelf, WM_CLOSE, 0, 0);
|
::SendMessage(_pPublicInterface->getHSelf(), WM_CLOSE, 0, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDM_EDIT_UNDO:
|
case IDM_EDIT_UNDO:
|
||||||
@ -165,7 +165,7 @@ void Notepad_plus::command(int id)
|
|||||||
_pEditView->execute(SCI_BEGINUNDOACTION);
|
_pEditView->execute(SCI_BEGINUNDOACTION);
|
||||||
|
|
||||||
for (Macro::iterator step = _macro.begin(); step != _macro.end(); step++)
|
for (Macro::iterator step = _macro.begin(); step != _macro.end(); step++)
|
||||||
step->PlayBack(this, _pEditView);
|
step->PlayBack(this->_pPublicInterface, _pEditView);
|
||||||
|
|
||||||
_pEditView->execute(SCI_ENDUNDOACTION);
|
_pEditView->execute(SCI_ENDUNDOACTION);
|
||||||
}
|
}
|
||||||
@ -237,7 +237,7 @@ void Notepad_plus::command(int id)
|
|||||||
|
|
||||||
case IDM_SEARCH_FINDINFILES :
|
case IDM_SEARCH_FINDINFILES :
|
||||||
{
|
{
|
||||||
::SendMessage(_hSelf, NPPM_LAUNCHFINDINFILESDLG, 0, 0);
|
::SendMessage(_pPublicInterface->getHSelf(), NPPM_LAUNCHFINDINFILESDLG, 0, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IDM_SEARCH_FINDINCREMENT :
|
case IDM_SEARCH_FINDINCREMENT :
|
||||||
@ -509,7 +509,7 @@ void Notepad_plus::command(int id)
|
|||||||
else
|
else
|
||||||
_pMainWindow = _pDocTab;
|
_pMainWindow = _pDocTab;
|
||||||
|
|
||||||
::SendMessage(_hSelf, WM_SIZE, 0, 0);
|
::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0);
|
||||||
|
|
||||||
udd->display(false);
|
udd->display(false);
|
||||||
_mainWindowStatus &= ~WindowUserActive;
|
_mainWindowStatus &= ~WindowUserActive;
|
||||||
@ -519,7 +519,7 @@ void Notepad_plus::command(int id)
|
|||||||
if (!_pMainSplitter)
|
if (!_pMainSplitter)
|
||||||
{
|
{
|
||||||
_pMainSplitter = new SplitterContainer;
|
_pMainSplitter = new SplitterContainer;
|
||||||
_pMainSplitter->init(_hInst, _hSelf);
|
_pMainSplitter->init(_pPublicInterface->getHinst(), _pPublicInterface->getHSelf());
|
||||||
|
|
||||||
Window *pWindow;
|
Window *pWindow;
|
||||||
if (bothActive())
|
if (bothActive())
|
||||||
@ -534,7 +534,7 @@ void Notepad_plus::command(int id)
|
|||||||
|
|
||||||
_pMainSplitter->setWin0((bothActive())?(Window *)&_subSplitter:(Window *)_pDocTab);
|
_pMainSplitter->setWin0((bothActive())?(Window *)&_subSplitter:(Window *)_pDocTab);
|
||||||
|
|
||||||
::SendMessage(_hSelf, WM_SIZE, 0, 0);
|
::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0);
|
||||||
_pMainWindow->display();
|
_pMainWindow->display();
|
||||||
|
|
||||||
_mainWindowStatus |= WindowUserActive;
|
_mainWindowStatus |= WindowUserActive;
|
||||||
@ -659,7 +659,7 @@ void Notepad_plus::command(int id)
|
|||||||
{
|
{
|
||||||
int check = (::GetMenuState(_mainMenuHandle, id, MF_BYCOMMAND) == MF_CHECKED)?MF_UNCHECKED:MF_CHECKED;
|
int check = (::GetMenuState(_mainMenuHandle, id, MF_BYCOMMAND) == MF_CHECKED)?MF_UNCHECKED:MF_CHECKED;
|
||||||
::CheckMenuItem(_mainMenuHandle, id, MF_BYCOMMAND | check);
|
::CheckMenuItem(_mainMenuHandle, id, MF_BYCOMMAND | check);
|
||||||
SetWindowPos(_hSelf, check == MF_CHECKED?HWND_TOPMOST:HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
|
SetWindowPos(_pPublicInterface->getHSelf(), check == MF_CHECKED?HWND_TOPMOST:HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -757,13 +757,13 @@ void Notepad_plus::command(int id)
|
|||||||
::SendMessage(_subDocTab.getHSelf(), WM_SETFONT, (WPARAM)hf, MAKELPARAM(TRUE, 0));
|
::SendMessage(_subDocTab.getHSelf(), WM_SETFONT, (WPARAM)hf, MAKELPARAM(TRUE, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
::SendMessage(_hSelf, WM_SIZE, 0, 0);
|
::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case IDM_VIEW_REFRESHTABAR :
|
case IDM_VIEW_REFRESHTABAR :
|
||||||
{
|
{
|
||||||
::SendMessage(_hSelf, WM_SIZE, 0, 0);
|
::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IDM_VIEW_LOCKTABBAR:
|
case IDM_VIEW_LOCKTABBAR:
|
||||||
@ -797,7 +797,7 @@ void Notepad_plus::command(int id)
|
|||||||
TabCtrl_SetItemSize(_mainDocTab.getHSelf(), 45, tabHeight);
|
TabCtrl_SetItemSize(_mainDocTab.getHSelf(), 45, tabHeight);
|
||||||
TabCtrl_SetItemSize(_subDocTab.getHSelf(), 45, tabHeight);
|
TabCtrl_SetItemSize(_subDocTab.getHSelf(), 45, tabHeight);
|
||||||
}
|
}
|
||||||
::SendMessage(_hSelf, WM_SIZE, 0, 0);
|
::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -810,14 +810,14 @@ void Notepad_plus::command(int id)
|
|||||||
case IDM_VIEW_DRAWTABBAR_VERTICAL :
|
case IDM_VIEW_DRAWTABBAR_VERTICAL :
|
||||||
{
|
{
|
||||||
TabBarPlus::setVertical(!TabBarPlus::isVertical());
|
TabBarPlus::setVertical(!TabBarPlus::isVertical());
|
||||||
::SendMessage(_hSelf, WM_SIZE, 0, 0);
|
::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case IDM_VIEW_DRAWTABBAR_MULTILINE :
|
case IDM_VIEW_DRAWTABBAR_MULTILINE :
|
||||||
{
|
{
|
||||||
TabBarPlus::setMultiLine(!TabBarPlus::isMultiLine());
|
TabBarPlus::setMultiLine(!TabBarPlus::isMultiLine());
|
||||||
::SendMessage(_hSelf, WM_SIZE, 0, 0);
|
::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1185,7 +1185,7 @@ void Notepad_plus::command(int id)
|
|||||||
|
|
||||||
if (um != uni8Bit)
|
if (um != uni8Bit)
|
||||||
{
|
{
|
||||||
::SendMessage(_hSelf, WM_COMMAND, idEncoding, 0);
|
::SendMessage(_pPublicInterface->getHSelf(), WM_COMMAND, idEncoding, 0);
|
||||||
_pEditView->execute(SCI_EMPTYUNDOBUFFER);
|
_pEditView->execute(SCI_EMPTYUNDOBUFFER);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1208,7 +1208,7 @@ void Notepad_plus::command(int id)
|
|||||||
|
|
||||||
if (um != uni8Bit)
|
if (um != uni8Bit)
|
||||||
{
|
{
|
||||||
::SendMessage(_hSelf, WM_COMMAND, idEncoding, 0);
|
::SendMessage(_pPublicInterface->getHSelf(), WM_COMMAND, idEncoding, 0);
|
||||||
_pEditView->execute(SCI_EMPTYUNDOBUFFER);
|
_pEditView->execute(SCI_EMPTYUNDOBUFFER);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1231,7 +1231,7 @@ void Notepad_plus::command(int id)
|
|||||||
|
|
||||||
if (um != uni8Bit)
|
if (um != uni8Bit)
|
||||||
{
|
{
|
||||||
::SendMessage(_hSelf, WM_COMMAND, idEncoding, 0);
|
::SendMessage(_pPublicInterface->getHSelf(), WM_COMMAND, idEncoding, 0);
|
||||||
_pEditView->execute(SCI_EMPTYUNDOBUFFER);
|
_pEditView->execute(SCI_EMPTYUNDOBUFFER);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1253,7 +1253,7 @@ void Notepad_plus::command(int id)
|
|||||||
return;
|
return;
|
||||||
if (um != uni8Bit)
|
if (um != uni8Bit)
|
||||||
{
|
{
|
||||||
::SendMessage(_hSelf, WM_COMMAND, idEncoding, 0);
|
::SendMessage(_pPublicInterface->getHSelf(), WM_COMMAND, idEncoding, 0);
|
||||||
_pEditView->execute(SCI_EMPTYUNDOBUFFER);
|
_pEditView->execute(SCI_EMPTYUNDOBUFFER);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1264,7 +1264,7 @@ void Notepad_plus::command(int id)
|
|||||||
if (idEncoding != -1)
|
if (idEncoding != -1)
|
||||||
{
|
{
|
||||||
// Save the current clipboard content
|
// Save the current clipboard content
|
||||||
::OpenClipboard(_hSelf);
|
::OpenClipboard(_pPublicInterface->getHSelf());
|
||||||
HANDLE clipboardData = ::GetClipboardData(CF_TEXT);
|
HANDLE clipboardData = ::GetClipboardData(CF_TEXT);
|
||||||
int len = ::GlobalSize(clipboardData);
|
int len = ::GlobalSize(clipboardData);
|
||||||
LPVOID clipboardDataPtr = ::GlobalLock(clipboardData);
|
LPVOID clipboardDataPtr = ::GlobalLock(clipboardData);
|
||||||
@ -1286,14 +1286,14 @@ void Notepad_plus::command(int id)
|
|||||||
|
|
||||||
// Change to the proper buffer, save buffer status
|
// Change to the proper buffer, save buffer status
|
||||||
|
|
||||||
::SendMessage(_hSelf, WM_COMMAND, idEncoding, 0);
|
::SendMessage(_pPublicInterface->getHSelf(), WM_COMMAND, idEncoding, 0);
|
||||||
|
|
||||||
// Paste the texte, restore buffer status
|
// Paste the texte, restore buffer status
|
||||||
_pEditView->execute(SCI_PASTE);
|
_pEditView->execute(SCI_PASTE);
|
||||||
_pEditView->restoreCurrentPos();
|
_pEditView->restoreCurrentPos();
|
||||||
|
|
||||||
// Restore the previous clipboard data
|
// Restore the previous clipboard data
|
||||||
::OpenClipboard(_hSelf);
|
::OpenClipboard(_pPublicInterface->getHSelf());
|
||||||
::EmptyClipboard();
|
::EmptyClipboard();
|
||||||
::SetClipboardData(CF_TEXT, clipboardData2);
|
::SetClipboardData(CF_TEXT, clipboardData2);
|
||||||
::CloseClipboard();
|
::CloseClipboard();
|
||||||
@ -1393,10 +1393,10 @@ void Notepad_plus::command(int id)
|
|||||||
|
|
||||||
ValueDlg valDlg;
|
ValueDlg valDlg;
|
||||||
NppGUI & nppGUI = (NppGUI &)((NppParameters::getInstance())->getNppGUI());
|
NppGUI & nppGUI = (NppGUI &)((NppParameters::getInstance())->getNppGUI());
|
||||||
valDlg.init(_hInst, _preference.getHSelf(), nppGUI._autocFromLen, TEXT("Nb char : "));
|
valDlg.init(_pPublicInterface->getHinst(), _preference.getHSelf(), nppGUI._autocFromLen, TEXT("Nb char : "));
|
||||||
POINT p;
|
POINT p;
|
||||||
::GetCursorPos(&p);
|
::GetCursorPos(&p);
|
||||||
::ScreenToClient(_hParent, &p);
|
::ScreenToClient(_pPublicInterface->getHParent(), &p);
|
||||||
int size = valDlg.doDialog(p, _nativeLangSpeaker.isRTL());
|
int size = valDlg.doDialog(p, _nativeLangSpeaker.isRTL());
|
||||||
|
|
||||||
if (size != -1)
|
if (size != -1)
|
||||||
@ -1415,10 +1415,10 @@ void Notepad_plus::command(int id)
|
|||||||
{
|
{
|
||||||
ValueDlg nbHistoryDlg;
|
ValueDlg nbHistoryDlg;
|
||||||
NppParameters *pNppParam = NppParameters::getInstance();
|
NppParameters *pNppParam = NppParameters::getInstance();
|
||||||
nbHistoryDlg.init(_hInst, _preference.getHSelf(), pNppParam->getNbMaxFile(), TEXT("Max File : "));
|
nbHistoryDlg.init(_pPublicInterface->getHinst(), _preference.getHSelf(), pNppParam->getNbMaxFile(), TEXT("Max File : "));
|
||||||
POINT p;
|
POINT p;
|
||||||
::GetCursorPos(&p);
|
::GetCursorPos(&p);
|
||||||
::ScreenToClient(_hParent, &p);
|
::ScreenToClient(_pPublicInterface->getHParent(), &p);
|
||||||
int size = nbHistoryDlg.doDialog(p, _nativeLangSpeaker.isRTL());
|
int size = nbHistoryDlg.doDialog(p, _nativeLangSpeaker.isRTL());
|
||||||
|
|
||||||
if (size != -1)
|
if (size != -1)
|
||||||
@ -1450,7 +1450,7 @@ void Notepad_plus::command(int id)
|
|||||||
}
|
}
|
||||||
if (!_pluginsManager.getMenuHandle())
|
if (!_pluginsManager.getMenuHandle())
|
||||||
_pluginsManager.setMenu(_mainMenuHandle, NULL);
|
_pluginsManager.setMenu(_mainMenuHandle, NULL);
|
||||||
::DrawMenuBar(_hSelf);
|
::DrawMenuBar(_pPublicInterface->getHSelf());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1484,7 +1484,7 @@ void Notepad_plus::command(int id)
|
|||||||
case IDM_SETTING_SHORTCUT_MAPPER :
|
case IDM_SETTING_SHORTCUT_MAPPER :
|
||||||
{
|
{
|
||||||
ShortcutMapper shortcutMapper;
|
ShortcutMapper shortcutMapper;
|
||||||
shortcutMapper.init(_hInst, _hSelf);
|
shortcutMapper.init(_pPublicInterface->getHinst(), _pPublicInterface->getHSelf());
|
||||||
_nativeLangSpeaker.changeShortcutmapperLang(&shortcutMapper);
|
_nativeLangSpeaker.changeShortcutmapperLang(&shortcutMapper);
|
||||||
shortcutMapper.doDialog(_nativeLangSpeaker.isRTL());
|
shortcutMapper.doDialog(_nativeLangSpeaker.isRTL());
|
||||||
shortcutMapper.destroy();
|
shortcutMapper.destroy();
|
||||||
@ -1572,7 +1572,7 @@ void Notepad_plus::command(int id)
|
|||||||
{
|
{
|
||||||
generic_string msg = nppHelpPath;
|
generic_string msg = nppHelpPath;
|
||||||
msg += TEXT("\rdoesn't exist. Please download it on Notepad++ site.");
|
msg += TEXT("\rdoesn't exist. Please download it on Notepad++ site.");
|
||||||
::MessageBox(_hSelf, msg.c_str(), TEXT("File does not exist"), MB_OK);
|
::MessageBox(_pPublicInterface->getHSelf(), msg.c_str(), TEXT("File does not exist"), MB_OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1721,7 +1721,7 @@ void Notepad_plus::command(int id)
|
|||||||
{
|
{
|
||||||
TaskListDlg tld;
|
TaskListDlg tld;
|
||||||
HIMAGELIST hImgLst = _docTabIconList.getHandle();
|
HIMAGELIST hImgLst = _docTabIconList.getHandle();
|
||||||
tld.init(_hInst, _hSelf, hImgLst, direction);
|
tld.init(_pPublicInterface->getHinst(), _pPublicInterface->getHSelf(), hImgLst, direction);
|
||||||
tld.doDialog();
|
tld.doDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1760,7 +1760,7 @@ void Notepad_plus::command(int id)
|
|||||||
case IDM_WINDOW_WINDOWS :
|
case IDM_WINDOW_WINDOWS :
|
||||||
{
|
{
|
||||||
WindowsDlg _windowsDlg;
|
WindowsDlg _windowsDlg;
|
||||||
_windowsDlg.init(_hInst, _hSelf, _pDocTab);
|
_windowsDlg.init(_pPublicInterface->getHinst(), _pPublicInterface->getHSelf(), _pDocTab);
|
||||||
|
|
||||||
const TiXmlNodeA *nativeLangA = _nativeLangSpeaker.getNativeLangA();
|
const TiXmlNodeA *nativeLangA = _nativeLangSpeaker.getNativeLangA();
|
||||||
TiXmlNodeA *dlgNode = NULL;
|
TiXmlNodeA *dlgNode = NULL;
|
||||||
@ -1778,7 +1778,7 @@ void Notepad_plus::command(int id)
|
|||||||
case IDM_SYSTRAYPOPUP_NEWDOC:
|
case IDM_SYSTRAYPOPUP_NEWDOC:
|
||||||
{
|
{
|
||||||
NppGUI & nppGUI = (NppGUI &)((NppParameters::getInstance())->getNppGUI());
|
NppGUI & nppGUI = (NppGUI &)((NppParameters::getInstance())->getNppGUI());
|
||||||
::ShowWindow(_hSelf, nppGUI._isMaximized?SW_MAXIMIZE:SW_SHOW);
|
::ShowWindow(_pPublicInterface->getHSelf(), nppGUI._isMaximized?SW_MAXIMIZE:SW_SHOW);
|
||||||
fileNew();
|
fileNew();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1786,14 +1786,14 @@ void Notepad_plus::command(int id)
|
|||||||
case IDM_SYSTRAYPOPUP_ACTIVATE :
|
case IDM_SYSTRAYPOPUP_ACTIVATE :
|
||||||
{
|
{
|
||||||
NppGUI & nppGUI = (NppGUI &)((NppParameters::getInstance())->getNppGUI());
|
NppGUI & nppGUI = (NppGUI &)((NppParameters::getInstance())->getNppGUI());
|
||||||
::ShowWindow(_hSelf, nppGUI._isMaximized?SW_MAXIMIZE:SW_SHOW);
|
::ShowWindow(_pPublicInterface->getHSelf(), nppGUI._isMaximized?SW_MAXIMIZE:SW_SHOW);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDM_SYSTRAYPOPUP_NEW_AND_PASTE:
|
case IDM_SYSTRAYPOPUP_NEW_AND_PASTE:
|
||||||
{
|
{
|
||||||
NppGUI & nppGUI = (NppGUI &)((NppParameters::getInstance())->getNppGUI());
|
NppGUI & nppGUI = (NppGUI &)((NppParameters::getInstance())->getNppGUI());
|
||||||
::ShowWindow(_hSelf, 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);
|
||||||
if (!buf->isUntitled() || buf->docLength() != 0)
|
if (!buf->isUntitled() || buf->docLength() != 0)
|
||||||
@ -1807,17 +1807,17 @@ void Notepad_plus::command(int id)
|
|||||||
case IDM_SYSTRAYPOPUP_OPENFILE:
|
case IDM_SYSTRAYPOPUP_OPENFILE:
|
||||||
{
|
{
|
||||||
NppGUI & nppGUI = (NppGUI &)((NppParameters::getInstance())->getNppGUI());
|
NppGUI & nppGUI = (NppGUI &)((NppParameters::getInstance())->getNppGUI());
|
||||||
::ShowWindow(_hSelf, nppGUI._isMaximized?SW_MAXIMIZE:SW_SHOW);
|
::ShowWindow(_pPublicInterface->getHSelf(), nppGUI._isMaximized?SW_MAXIMIZE:SW_SHOW);
|
||||||
fileOpen();
|
fileOpen();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDM_SYSTRAYPOPUP_CLOSE:
|
case IDM_SYSTRAYPOPUP_CLOSE:
|
||||||
{
|
{
|
||||||
_isPrelaunch = false;
|
_pPublicInterface->setIsPrelaunch(false);
|
||||||
_pTrayIco->doTrayIcon(REMOVE);
|
_pTrayIco->doTrayIcon(REMOVE);
|
||||||
if (!::IsWindowVisible(_hSelf))
|
if (!::IsWindowVisible(_pPublicInterface->getHSelf()))
|
||||||
::SendMessage(_hSelf, WM_CLOSE, 0,0);
|
::SendMessage(_pPublicInterface->getHSelf(), WM_CLOSE, 0,0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1847,7 +1847,7 @@ void Notepad_plus::command(int id)
|
|||||||
_pEditView->execute(SCI_BEGINUNDOACTION);
|
_pEditView->execute(SCI_BEGINUNDOACTION);
|
||||||
|
|
||||||
for (Macro::iterator step = macro.begin(); step != macro.end(); step++)
|
for (Macro::iterator step = macro.begin(); step != macro.end(); step++)
|
||||||
step->PlayBack(this, _pEditView);
|
step->PlayBack(this->_pPublicInterface, _pEditView);
|
||||||
|
|
||||||
_pEditView->execute(SCI_ENDUNDOACTION);
|
_pEditView->execute(SCI_ENDUNDOACTION);
|
||||||
|
|
||||||
@ -1859,7 +1859,7 @@ void Notepad_plus::command(int id)
|
|||||||
UserCommand ucmd = theUserCommands[i];
|
UserCommand ucmd = theUserCommands[i];
|
||||||
|
|
||||||
Command cmd(ucmd.getCmd());
|
Command cmd(ucmd.getCmd());
|
||||||
cmd.run(_hSelf);
|
cmd.run(_pPublicInterface->getHSelf());
|
||||||
}
|
}
|
||||||
else if ((id >= ID_PLUGINS_CMD) && (id < ID_PLUGINS_CMD_LIMIT))
|
else if ((id >= ID_PLUGINS_CMD) && (id < ID_PLUGINS_CMD_LIMIT))
|
||||||
{
|
{
|
||||||
@ -1870,7 +1870,7 @@ void Notepad_plus::command(int id)
|
|||||||
else if ((id >= ID_PLUGINS_REMOVING) && (id < ID_PLUGINS_REMOVING_END))
|
else if ((id >= ID_PLUGINS_REMOVING) && (id < ID_PLUGINS_REMOVING_END))
|
||||||
{
|
{
|
||||||
int i = id - ID_PLUGINS_REMOVING;
|
int i = id - ID_PLUGINS_REMOVING;
|
||||||
_pluginsManager.unloadPlugin(i, _hSelf);
|
_pluginsManager.unloadPlugin(i, _pPublicInterface->getHSelf());
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
else if ((id >= IDM_WINDOW_MRU_FIRST) && (id <= IDM_WINDOW_MRU_LIMIT))
|
else if ((id >= IDM_WINDOW_MRU_FIRST) && (id <= IDM_WINDOW_MRU_LIMIT))
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
#include "precompiledHeaders.h"
|
#include "precompiledHeaders.h"
|
||||||
#include "Notepad_plus.h"
|
#include "Notepad_plus_Window.h"
|
||||||
#include "FileDialog.h"
|
#include "FileDialog.h"
|
||||||
|
|
||||||
|
|
||||||
@ -51,10 +51,10 @@ BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isReadOnly, int encodi
|
|||||||
{
|
{
|
||||||
if (_pTrayIco->isInTray())
|
if (_pTrayIco->isInTray())
|
||||||
{
|
{
|
||||||
::ShowWindow(_hSelf, SW_SHOW);
|
::ShowWindow(_pPublicInterface->getHSelf(), SW_SHOW);
|
||||||
if (!_isPrelaunch)
|
if (!_pPublicInterface->isPrelaunch())
|
||||||
_pTrayIco->doTrayIcon(REMOVE);
|
_pTrayIco->doTrayIcon(REMOVE);
|
||||||
::SendMessage(_hSelf, WM_SIZE, 0, 0);
|
::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return test;
|
return test;
|
||||||
@ -78,13 +78,13 @@ BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isReadOnly, int encodi
|
|||||||
{
|
{
|
||||||
wsprintf(str2display, TEXT("%s doesn't exist. Create it?"), longFileName);
|
wsprintf(str2display, TEXT("%s doesn't exist. Create it?"), longFileName);
|
||||||
|
|
||||||
if (::MessageBox(_hSelf, str2display, TEXT("Create new file"), MB_YESNO) == IDYES)
|
if (::MessageBox(_pPublicInterface->getHSelf(), str2display, TEXT("Create new file"), MB_YESNO) == IDYES)
|
||||||
{
|
{
|
||||||
bool res = MainFileManager->createEmptyFile(longFileName);
|
bool res = MainFileManager->createEmptyFile(longFileName);
|
||||||
if (!res)
|
if (!res)
|
||||||
{
|
{
|
||||||
wsprintf(str2display, TEXT("Cannot create the file \"%s\""), longFileName);
|
wsprintf(str2display, TEXT("Cannot create the file \"%s\""), longFileName);
|
||||||
::MessageBox(_hSelf, str2display, TEXT("Create new file"), MB_OK);
|
::MessageBox(_pPublicInterface->getHSelf(), str2display, TEXT("Create new file"), MB_OK);
|
||||||
return BUFFER_INVALID;
|
return BUFFER_INVALID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -103,7 +103,7 @@ BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isReadOnly, int encodi
|
|||||||
// Plugins can should use this notification to filter SCN_MODIFIED
|
// Plugins can should use this notification to filter SCN_MODIFIED
|
||||||
SCNotification scnN;
|
SCNotification scnN;
|
||||||
scnN.nmhdr.code = NPPN_FILEBEFORELOAD;
|
scnN.nmhdr.code = NPPN_FILEBEFORELOAD;
|
||||||
scnN.nmhdr.hwndFrom = _hSelf;
|
scnN.nmhdr.hwndFrom = _pPublicInterface->getHSelf();
|
||||||
scnN.nmhdr.idFrom = NULL;
|
scnN.nmhdr.idFrom = NULL;
|
||||||
_pluginsManager.notify(&scnN);
|
_pluginsManager.notify(&scnN);
|
||||||
|
|
||||||
@ -134,10 +134,10 @@ BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isReadOnly, int encodi
|
|||||||
{
|
{
|
||||||
if (_pTrayIco->isInTray())
|
if (_pTrayIco->isInTray())
|
||||||
{
|
{
|
||||||
::ShowWindow(_hSelf, SW_SHOW);
|
::ShowWindow(_pPublicInterface->getHSelf(), SW_SHOW);
|
||||||
if (!_isPrelaunch)
|
if (!_pPublicInterface->isPrelaunch())
|
||||||
_pTrayIco->doTrayIcon(REMOVE);
|
_pTrayIco->doTrayIcon(REMOVE);
|
||||||
::SendMessage(_hSelf, WM_SIZE, 0, 0);
|
::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PathRemoveFileSpec(longFileName);
|
PathRemoveFileSpec(longFileName);
|
||||||
@ -156,7 +156,6 @@ BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isReadOnly, int encodi
|
|||||||
{
|
{
|
||||||
if (::PathIsDirectory(fileName))
|
if (::PathIsDirectory(fileName))
|
||||||
{
|
{
|
||||||
//::MessageBox(_hSelf, fileName, TEXT("Dir"), MB_OK);
|
|
||||||
vector<generic_string> fileNames;
|
vector<generic_string> fileNames;
|
||||||
vector<generic_string> patterns;
|
vector<generic_string> patterns;
|
||||||
patterns.push_back(TEXT("*.*"));
|
patterns.push_back(TEXT("*.*"));
|
||||||
@ -168,7 +167,6 @@ BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isReadOnly, int encodi
|
|||||||
getMatchedFileNames(fileNameStr.c_str(), patterns, fileNames, true, false);
|
getMatchedFileNames(fileNameStr.c_str(), patterns, fileNames, true, false);
|
||||||
for (size_t i = 0 ; i < fileNames.size() ; i++)
|
for (size_t i = 0 ; i < fileNames.size() ; i++)
|
||||||
{
|
{
|
||||||
//::MessageBox(_hSelf, fileNames[i].c_str(), TEXT("Dir"), MB_OK);
|
|
||||||
doOpen(fileNames[i].c_str());
|
doOpen(fileNames[i].c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -177,7 +175,7 @@ BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isReadOnly, int encodi
|
|||||||
generic_string msg = TEXT("Can not open file \"");
|
generic_string msg = TEXT("Can not open file \"");
|
||||||
msg += longFileName;
|
msg += longFileName;
|
||||||
msg += TEXT("\".");
|
msg += TEXT("\".");
|
||||||
::MessageBox(_hSelf, msg.c_str(), TEXT("ERR"), MB_OK);
|
::MessageBox(_pPublicInterface->getHSelf(), msg.c_str(), TEXT("ERR"), MB_OK);
|
||||||
_isFileOpening = false;
|
_isFileOpening = false;
|
||||||
|
|
||||||
scnN.nmhdr.code = NPPN_FILELOADFAILED;
|
scnN.nmhdr.code = NPPN_FILELOADFAILED;
|
||||||
@ -198,7 +196,7 @@ bool Notepad_plus::doReload(BufferID id, bool alert)
|
|||||||
*/
|
*/
|
||||||
if (alert)
|
if (alert)
|
||||||
{
|
{
|
||||||
if (::MessageBox(_hSelf, TEXT("Are you sure you want to reload the current file and lose the changes made in Notepad++?"), TEXT("Reload"), MB_YESNO | MB_ICONEXCLAMATION | MB_APPLMODAL) != IDYES)
|
if (::MessageBox(_pPublicInterface->getHSelf(), TEXT("Are you sure you want to reload the current file and lose the changes made in Notepad++?"), TEXT("Reload"), MB_YESNO | MB_ICONEXCLAMATION | MB_APPLMODAL) != IDYES)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,7 +238,7 @@ bool Notepad_plus::doSave(BufferID id, const TCHAR * filename, bool isCopy)
|
|||||||
{
|
{
|
||||||
|
|
||||||
scnN.nmhdr.code = NPPN_FILEBEFORESAVE;
|
scnN.nmhdr.code = NPPN_FILEBEFORESAVE;
|
||||||
scnN.nmhdr.hwndFrom = _hSelf;
|
scnN.nmhdr.hwndFrom = _pPublicInterface->getHSelf();
|
||||||
scnN.nmhdr.idFrom = (uptr_t)id;
|
scnN.nmhdr.idFrom = (uptr_t)id;
|
||||||
_pluginsManager.notify(&scnN);
|
_pluginsManager.notify(&scnN);
|
||||||
}
|
}
|
||||||
@ -254,7 +252,7 @@ bool Notepad_plus::doSave(BufferID id, const TCHAR * filename, bool isCopy)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!res)
|
if (!res)
|
||||||
::MessageBox(_hSelf, TEXT("Please check whether if this file is opened in another program"), TEXT("Save failed"), MB_OK);
|
::MessageBox(_pPublicInterface->getHSelf(), TEXT("Please check whether if this file is opened in another program"), TEXT("Save failed"), MB_OK);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,7 +262,7 @@ void Notepad_plus::doClose(BufferID id, int whichOne) {
|
|||||||
// Notify plugins that current file is about to be closed
|
// Notify plugins that current file is about to be closed
|
||||||
SCNotification scnN;
|
SCNotification scnN;
|
||||||
scnN.nmhdr.code = NPPN_FILEBEFORECLOSE;
|
scnN.nmhdr.code = NPPN_FILEBEFORECLOSE;
|
||||||
scnN.nmhdr.hwndFrom = _hSelf;
|
scnN.nmhdr.hwndFrom = _pPublicInterface->getHSelf();
|
||||||
scnN.nmhdr.idFrom = (uptr_t)id;
|
scnN.nmhdr.idFrom = (uptr_t)id;
|
||||||
_pluginsManager.notify(&scnN);
|
_pluginsManager.notify(&scnN);
|
||||||
|
|
||||||
@ -728,7 +726,7 @@ bool Notepad_plus::fileSaveAs(BufferID id, bool isSaveCopy)
|
|||||||
bufferID = _pEditView->getCurrentBufferID();
|
bufferID = _pEditView->getCurrentBufferID();
|
||||||
Buffer * buf = MainFileManager->getBufferByID(bufferID);
|
Buffer * buf = MainFileManager->getBufferByID(bufferID);
|
||||||
|
|
||||||
FileDialog fDlg(_hSelf, _hInst);
|
FileDialog fDlg(_pPublicInterface->getHSelf(), _pPublicInterface->getHinst());
|
||||||
|
|
||||||
fDlg.setExtFilter(TEXT("All types"), TEXT(".*"), NULL);
|
fDlg.setExtFilter(TEXT("All types"), TEXT(".*"), NULL);
|
||||||
int langTypeIndex = setFileOpenSaveDlgFilters(fDlg, buf->getLangType());
|
int langTypeIndex = setFileOpenSaveDlgFilters(fDlg, buf->getLangType());
|
||||||
@ -749,7 +747,7 @@ bool Notepad_plus::fileSaveAs(BufferID id, bool isSaveCopy)
|
|||||||
}
|
}
|
||||||
else //cannot save, other view has buffer already open, activate it
|
else //cannot save, other view has buffer already open, activate it
|
||||||
{
|
{
|
||||||
::MessageBox(_hSelf, TEXT("The file is already opened in the Notepad++."), TEXT("ERROR"), MB_OK | MB_ICONSTOP);
|
::MessageBox(_pPublicInterface->getHSelf(), TEXT("The file is already opened in the Notepad++."), TEXT("ERROR"), MB_OK | MB_ICONSTOP);
|
||||||
switchToFile(other);
|
switchToFile(other);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -768,7 +766,7 @@ bool Notepad_plus::fileRename(BufferID id)
|
|||||||
bufferID = _pEditView->getCurrentBufferID();
|
bufferID = _pEditView->getCurrentBufferID();
|
||||||
Buffer * buf = MainFileManager->getBufferByID(bufferID);
|
Buffer * buf = MainFileManager->getBufferByID(bufferID);
|
||||||
|
|
||||||
FileDialog fDlg(_hSelf, _hInst);
|
FileDialog fDlg(_pPublicInterface->getHSelf(), _pPublicInterface->getHinst());
|
||||||
|
|
||||||
fDlg.setExtFilter(TEXT("All types"), TEXT(".*"), NULL);
|
fDlg.setExtFilter(TEXT("All types"), TEXT(".*"), NULL);
|
||||||
setFileOpenSaveDlgFilters(fDlg);
|
setFileOpenSaveDlgFilters(fDlg);
|
||||||
@ -797,7 +795,7 @@ bool Notepad_plus::fileDelete(BufferID id)
|
|||||||
{
|
{
|
||||||
if (!MainFileManager->deleteFile(bufferID))
|
if (!MainFileManager->deleteFile(bufferID))
|
||||||
{
|
{
|
||||||
::MessageBox(_hSelf, TEXT("Delete File failed"), TEXT("Delete File"), MB_OK);
|
::MessageBox(_pPublicInterface->getHSelf(), TEXT("Delete File failed"), TEXT("Delete File"), MB_OK);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
doClose(bufferID, MAIN_VIEW);
|
doClose(bufferID, MAIN_VIEW);
|
||||||
@ -809,7 +807,7 @@ bool Notepad_plus::fileDelete(BufferID id)
|
|||||||
|
|
||||||
void Notepad_plus::fileOpen()
|
void Notepad_plus::fileOpen()
|
||||||
{
|
{
|
||||||
FileDialog fDlg(_hSelf, _hInst);
|
FileDialog fDlg(_pPublicInterface->getHSelf(), _pPublicInterface->getHinst());
|
||||||
fDlg.setExtFilter(TEXT("All types"), TEXT(".*"), NULL);
|
fDlg.setExtFilter(TEXT("All types"), TEXT(".*"), NULL);
|
||||||
|
|
||||||
setFileOpenSaveDlgFilters(fDlg);
|
setFileOpenSaveDlgFilters(fDlg);
|
||||||
@ -1004,7 +1002,7 @@ bool Notepad_plus::fileLoadSession(const TCHAR *fn)
|
|||||||
const TCHAR *sessionFileName = NULL;
|
const TCHAR *sessionFileName = NULL;
|
||||||
if (fn == NULL)
|
if (fn == NULL)
|
||||||
{
|
{
|
||||||
FileDialog fDlg(_hSelf, _hInst);
|
FileDialog fDlg(_pPublicInterface->getHSelf(), _pPublicInterface->getHinst());
|
||||||
fDlg.setExtFilter(TEXT("All types"), TEXT(".*"), NULL);
|
fDlg.setExtFilter(TEXT("All types"), TEXT(".*"), NULL);
|
||||||
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("");
|
||||||
@ -1065,7 +1063,7 @@ const TCHAR * Notepad_plus::fileSaveSession(size_t nbFile, TCHAR ** fileNames)
|
|||||||
{
|
{
|
||||||
const TCHAR *sessionFileName = NULL;
|
const TCHAR *sessionFileName = NULL;
|
||||||
|
|
||||||
FileDialog fDlg(_hSelf, _hInst);
|
FileDialog fDlg(_pPublicInterface->getHSelf(), _pPublicInterface->getHinst());
|
||||||
const TCHAR *ext = NppParameters::getInstance()->getNppGUI()._definedSessionExt.c_str();
|
const TCHAR *ext = NppParameters::getInstance()->getNppGUI()._definedSessionExt.c_str();
|
||||||
|
|
||||||
fDlg.setExtFilter(TEXT("All types"), TEXT(".*"), NULL);
|
fDlg.setExtFilter(TEXT("All types"), TEXT(".*"), NULL);
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
#include "precompiledHeaders.h"
|
#include "precompiledHeaders.h"
|
||||||
#include "Notepad_plus.h"
|
#include "Notepad_plus_Window.h"
|
||||||
#include "xmlMatchedTagsHighlighter.h"
|
#include "xmlMatchedTagsHighlighter.h"
|
||||||
|
|
||||||
BOOL Notepad_plus::notify(SCNotification *notification)
|
BOOL Notepad_plus::notify(SCNotification *notification)
|
||||||
@ -246,7 +246,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
|
|||||||
vector<MenuItemUnit> itemUnitArray;
|
vector<MenuItemUnit> itemUnitArray;
|
||||||
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_GOTO_ANOTHER_VIEW, goToView));
|
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_GOTO_ANOTHER_VIEW, goToView));
|
||||||
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_CLONE_TO_ANOTHER_VIEW, cloneToView));
|
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_CLONE_TO_ANOTHER_VIEW, cloneToView));
|
||||||
_tabPopupDropMenu.create(_hSelf, itemUnitArray);
|
_tabPopupDropMenu.create(_pPublicInterface->getHSelf(), itemUnitArray);
|
||||||
_nativeLangSpeaker.changeLangTabDrapContextMenu(_tabPopupDropMenu.getMenuHandle());
|
_nativeLangSpeaker.changeLangTabDrapContextMenu(_tabPopupDropMenu.getMenuHandle());
|
||||||
}
|
}
|
||||||
_tabPopupDropMenu.display(p);
|
_tabPopupDropMenu.display(p);
|
||||||
@ -260,7 +260,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
RECT nppZone;
|
RECT nppZone;
|
||||||
::GetWindowRect(_hSelf, &nppZone);
|
::GetWindowRect(_pPublicInterface->getHSelf(), &nppZone);
|
||||||
bool isInNppZone = (((p.x >= nppZone.left) && (p.x <= nppZone.right)) && (p.y >= nppZone.top) && (p.y <= nppZone.bottom));
|
bool isInNppZone = (((p.x >= nppZone.left) && (p.x <= nppZone.right)) && (p.y >= nppZone.top) && (p.y <= nppZone.bottom));
|
||||||
if (isInNppZone)
|
if (isInNppZone)
|
||||||
{
|
{
|
||||||
@ -278,7 +278,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
|
|||||||
HWND hWinParent = ::GetParent(hWin);
|
HWND hWinParent = ::GetParent(hWin);
|
||||||
TCHAR className[MAX_PATH];
|
TCHAR className[MAX_PATH];
|
||||||
::GetClassName(hWinParent,className, sizeof(className));
|
::GetClassName(hWinParent,className, sizeof(className));
|
||||||
if (lstrcmp(className, _className) == 0 && hWinParent != _hSelf) // another Notepad++
|
if (lstrcmp(className, _pPublicInterface->getClassName()) == 0 && hWinParent != _pPublicInterface->getHSelf()) // another Notepad++
|
||||||
{
|
{
|
||||||
int index = _pDocTab->getCurrentTabIndex();
|
int index = _pDocTab->getCurrentTabIndex();
|
||||||
BufferID bufferToClose = notifyDocTab->getBufferByIndex(index);
|
BufferID bufferToClose = notifyDocTab->getBufferByIndex(index);
|
||||||
@ -286,17 +286,17 @@ BOOL Notepad_plus::notify(SCNotification *notification)
|
|||||||
int iView = isFromPrimary?MAIN_VIEW:SUB_VIEW;
|
int iView = isFromPrimary?MAIN_VIEW:SUB_VIEW;
|
||||||
if (buf->isDirty())
|
if (buf->isDirty())
|
||||||
{
|
{
|
||||||
::MessageBox(_hSelf, TEXT("Document is modified, save it then try again."), TEXT("Move to new Notepad++ Instance"), MB_OK);
|
::MessageBox(_pPublicInterface->getHSelf(), TEXT("Document is modified, save it then try again."), TEXT("Move to new Notepad++ Instance"), MB_OK);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
::SendMessage(hWinParent, NPPM_INTERNAL_SWITCHVIEWFROMHWND, 0, (LPARAM)hWin);
|
::SendMessage(hWinParent, NPPM_INTERNAL_SWITCHVIEWFROMHWND, 0, (LPARAM)hWin);
|
||||||
::SendMessage(hWinParent, WM_COPYDATA, (WPARAM)_hInst, (LPARAM)&fileNamesData);
|
::SendMessage(hWinParent, WM_COPYDATA, (WPARAM)_pPublicInterface->getHinst(), (LPARAM)&fileNamesData);
|
||||||
if (!isInCtrlStat)
|
if (!isInCtrlStat)
|
||||||
{
|
{
|
||||||
fileClose(bufferToClose, iView);
|
fileClose(bufferToClose, iView);
|
||||||
if (noOpenedDoc())
|
if (noOpenedDoc())
|
||||||
::SendMessage(_hSelf, WM_CLOSE, 0, 0);
|
::SendMessage(_pPublicInterface->getHSelf(), WM_CLOSE, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -436,7 +436,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
|
|||||||
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_GOTO_NEW_INSTANCE, TEXT("Move to New Instance")));
|
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_GOTO_NEW_INSTANCE, TEXT("Move to New Instance")));
|
||||||
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_LOAD_IN_NEW_INSTANCE, TEXT("Open in New Instance")));
|
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_LOAD_IN_NEW_INSTANCE, TEXT("Open in New Instance")));
|
||||||
|
|
||||||
_tabPopupMenu.create(_hSelf, itemUnitArray);
|
_tabPopupMenu.create(_pPublicInterface->getHSelf(), itemUnitArray);
|
||||||
_nativeLangSpeaker.changeLangTabContextMenu(_tabPopupMenu.getMenuHandle());
|
_nativeLangSpeaker.changeLangTabContextMenu(_tabPopupMenu.getMenuHandle());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -561,8 +561,8 @@ BOOL Notepad_plus::notify(SCNotification *notification)
|
|||||||
|
|
||||||
POINT p;
|
POINT p;
|
||||||
::GetCursorPos(&p);
|
::GetCursorPos(&p);
|
||||||
::ScreenToClient(_hSelf, &p);
|
::ScreenToClient(_pPublicInterface->getHSelf(), &p);
|
||||||
HWND hWin = ::RealChildWindowFromPoint(_hSelf, p);
|
HWND hWin = ::RealChildWindowFromPoint(_pPublicInterface->getHSelf(), p);
|
||||||
const int tipMaxLen = 1024;
|
const int tipMaxLen = 1024;
|
||||||
static TCHAR docTip[tipMaxLen];
|
static TCHAR docTip[tipMaxLen];
|
||||||
docTip[0] = '\0';
|
docTip[0] = '\0';
|
||||||
@ -662,7 +662,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
|
|||||||
TCHAR currentWord[MAX_PATH*2];
|
TCHAR currentWord[MAX_PATH*2];
|
||||||
notifyView->getGenericText(currentWord, startPos, endPos);
|
notifyView->getGenericText(currentWord, startPos, endPos);
|
||||||
|
|
||||||
::ShellExecute(_hSelf, TEXT("open"), currentWord, NULL, NULL, SW_SHOW);
|
::ShellExecute(_pPublicInterface->getHSelf(), TEXT("open"), currentWord, NULL, NULL, SW_SHOW);
|
||||||
_isHotspotDblClicked = true;
|
_isHotspotDblClicked = true;
|
||||||
notifyView->execute(SCI_SETCHARSDEFAULT);
|
notifyView->execute(SCI_SETCHARSDEFAULT);
|
||||||
break;
|
break;
|
||||||
@ -689,7 +689,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
|
|||||||
|
|
||||||
case RBN_HEIGHTCHANGE:
|
case RBN_HEIGHTCHANGE:
|
||||||
{
|
{
|
||||||
SendMessage(_hSelf, WM_SIZE, 0, 0);
|
SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case RBN_CHEVRONPUSHED:
|
case RBN_CHEVRONPUSHED:
|
||||||
|
@ -31,7 +31,7 @@ typedef sptr_t Document;
|
|||||||
enum DocFileStatus{
|
enum DocFileStatus{
|
||||||
DOC_REGULAR = 0x01, //should not be combined with anything
|
DOC_REGULAR = 0x01, //should not be combined with anything
|
||||||
DOC_UNNAMED = 0x02, //not saved (new ##)
|
DOC_UNNAMED = 0x02, //not saved (new ##)
|
||||||
DOC_DELETED = 0x04, //doesnt exist in environment anymore, but not DOC_UNNAMED
|
DOC_DELETED = 0x04, //doesn't exist in environment anymore, but not DOC_UNNAMED
|
||||||
DOC_MODIFIED = 0x08 //File in environment has changed
|
DOC_MODIFIED = 0x08 //File in environment has changed
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include "Parameters.h"
|
#include "Parameters.h"
|
||||||
#include "ScintillaEditView.h"
|
#include "ScintillaEditView.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "Notepad_plus.h"
|
#include "Notepad_plus_Window.h"
|
||||||
|
|
||||||
#include "keys.h"
|
#include "keys.h"
|
||||||
const int KEY_STR_LEN = 16;
|
const int KEY_STR_LEN = 16;
|
||||||
@ -310,7 +310,7 @@ void getNameStrFromCmd(DWORD cmd, generic_string & str)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HWND hNotepad_plus = ::FindWindow(Notepad_plus::getClassName(), NULL);
|
HWND hNotepad_plus = ::FindWindow(Notepad_plus_Window::getClassName(), NULL);
|
||||||
const int commandSize = 64;
|
const int commandSize = 64;
|
||||||
TCHAR cmdName[commandSize];
|
TCHAR cmdName[commandSize];
|
||||||
int nbChar = ::GetMenuString((HMENU)::SendMessage(hNotepad_plus, NPPM_INTERNAL_GETMENU, 0, 0), cmd, cmdName, commandSize, MF_BYCOMMAND);
|
int nbChar = ::GetMenuString((HMENU)::SendMessage(hNotepad_plus, NPPM_INTERNAL_GETMENU, 0, 0), cmd, cmdName, commandSize, MF_BYCOMMAND);
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
#include "precompiledHeaders.h"
|
#include "precompiledHeaders.h"
|
||||||
#include "Notepad_plus.h"
|
#include "Notepad_plus_Window.h"
|
||||||
#include "Process.h"
|
#include "Process.h"
|
||||||
|
|
||||||
#include "Win32Exception.h" //Win32 exception
|
#include "Win32Exception.h" //Win32 exception
|
||||||
@ -174,7 +174,7 @@ notepad++ [--help] [-multiInst] [-noPlugins] [-lLanguage] [-nLineNumber] [-cColu
|
|||||||
fullFilePathName : file name to open (absolute or relative path name)\r\
|
fullFilePathName : file name to open (absolute or relative path name)\r\
|
||||||
");
|
");
|
||||||
|
|
||||||
void doException(Notepad_plus & notepad_plus_plus);
|
void doException(Notepad_plus_Window & notepad_plus_plus);
|
||||||
|
|
||||||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
|
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
|
||||||
{
|
{
|
||||||
@ -250,11 +250,11 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
|
|||||||
|
|
||||||
if ((!isMultiInst) && (!TheFirstOne))
|
if ((!isMultiInst) && (!TheFirstOne))
|
||||||
{
|
{
|
||||||
HWND hNotepad_plus = ::FindWindow(Notepad_plus::getClassName(), NULL);
|
HWND hNotepad_plus = ::FindWindow(Notepad_plus_Window::getClassName(), NULL);
|
||||||
for (int i = 0 ;!hNotepad_plus && i < 5 ; i++)
|
for (int i = 0 ;!hNotepad_plus && i < 5 ; i++)
|
||||||
{
|
{
|
||||||
Sleep(100);
|
Sleep(100);
|
||||||
hNotepad_plus = ::FindWindow(Notepad_plus::getClassName(), NULL);
|
hNotepad_plus = ::FindWindow(Notepad_plus_Window::getClassName(), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hNotepad_plus)
|
if (hNotepad_plus)
|
||||||
@ -297,7 +297,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
|
|||||||
}
|
}
|
||||||
|
|
||||||
pNppParameters->load();
|
pNppParameters->load();
|
||||||
Notepad_plus notepad_plus_plus;
|
Notepad_plus_Window notepad_plus_plus;
|
||||||
|
|
||||||
NppGUI & nppGui = (NppGUI &)pNppParameters->getNppGUI();
|
NppGUI & nppGui = (NppGUI &)pNppParameters->getNppGUI();
|
||||||
|
|
||||||
@ -309,7 +309,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
|
|||||||
generic_string version = TEXT("-v");
|
generic_string version = TEXT("-v");
|
||||||
version += VERSION_VALUE;
|
version += VERSION_VALUE;
|
||||||
|
|
||||||
winVer curWinVer = notepad_plus_plus.getWinVersion();
|
winVer curWinVer = pNppParameters->getWinVersion();
|
||||||
|
|
||||||
bool isUpExist = nppGui._doesExistUpdater = (::PathFileExists(updaterFullPath.c_str()) == TRUE);
|
bool isUpExist = nppGui._doesExistUpdater = (::PathFileExists(updaterFullPath.c_str()) == TRUE);
|
||||||
bool winSupported = (curWinVer >= WV_W2K);
|
bool winSupported = (curWinVer >= WV_W2K);
|
||||||
@ -345,7 +345,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
|
|||||||
Win32Exception::installHandler();
|
Win32Exception::installHandler();
|
||||||
try {
|
try {
|
||||||
notepad_plus_plus.init(hInstance, NULL, quotFileName.c_str(), &cmdLineParams);
|
notepad_plus_plus.init(hInstance, NULL, quotFileName.c_str(), &cmdLineParams);
|
||||||
bool unicodeSupported = notepad_plus_plus.getWinVersion() >= WV_NT;
|
bool unicodeSupported = pNppParameters->getWinVersion() >= WV_NT;
|
||||||
bool going = true;
|
bool going = true;
|
||||||
while (going)
|
while (going)
|
||||||
{
|
{
|
||||||
@ -362,7 +362,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
|
|||||||
::DispatchMessageW(&msg);
|
::DispatchMessageW(&msg);
|
||||||
else
|
else
|
||||||
::DispatchMessage(&msg);
|
::DispatchMessage(&msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -373,7 +373,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
|
|||||||
TCHAR str[50] = TEXT("God Damned Exception : ");
|
TCHAR str[50] = TEXT("God Damned Exception : ");
|
||||||
TCHAR code[10];
|
TCHAR code[10];
|
||||||
wsprintf(code, TEXT("%d"), i);
|
wsprintf(code, TEXT("%d"), i);
|
||||||
::MessageBox(Notepad_plus::gNppHWND, lstrcat(str, code), TEXT("Notepad++ Exception"), MB_OK);
|
::MessageBox(Notepad_plus_Window::gNppHWND, lstrcat(str, code), TEXT("Notepad++ Exception"), MB_OK);
|
||||||
doException(notepad_plus_plus);
|
doException(notepad_plus_plus);
|
||||||
}
|
}
|
||||||
} catch (const Win32Exception & ex) {
|
} catch (const Win32Exception & ex) {
|
||||||
@ -385,13 +385,13 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
|
|||||||
TEXT("Code:\t0x%08X\r\nType:\t%s\r\nException address: 0x%08X"),
|
TEXT("Code:\t0x%08X\r\nType:\t%s\r\nException address: 0x%08X"),
|
||||||
#endif
|
#endif
|
||||||
ex.code(), ex.what(), ex.where());
|
ex.code(), ex.what(), ex.where());
|
||||||
::MessageBox(Notepad_plus::gNppHWND, message, TEXT("Win32Exception"), MB_OK | MB_ICONERROR);
|
::MessageBox(Notepad_plus_Window::gNppHWND, message, TEXT("Win32Exception"), MB_OK | MB_ICONERROR);
|
||||||
mdump.writeDump(ex.info());
|
mdump.writeDump(ex.info());
|
||||||
doException(notepad_plus_plus);
|
doException(notepad_plus_plus);
|
||||||
} catch(std::exception ex) {
|
} catch(std::exception ex) {
|
||||||
#ifdef UNICODE
|
#ifdef UNICODE
|
||||||
const wchar_t * text = WcharMbcsConvertor::getInstance()->char2wchar(ex.what(), CP_ACP);
|
const wchar_t * text = WcharMbcsConvertor::getInstance()->char2wchar(ex.what(), CP_ACP);
|
||||||
::MessageBox(Notepad_plus::gNppHWND, text, TEXT("C++ Exception"), MB_OK);
|
::MessageBox(Notepad_plus_Window::gNppHWND, text, TEXT("C++ Exception"), MB_OK);
|
||||||
#else
|
#else
|
||||||
::MessageBox(Notepad_plus::gNppHWND, ex.what(), TEXT("C++ Exception"), MB_OK);
|
::MessageBox(Notepad_plus::gNppHWND, ex.what(), TEXT("C++ Exception"), MB_OK);
|
||||||
#endif
|
#endif
|
||||||
@ -403,9 +403,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
|
|||||||
return (UINT)msg.wParam;
|
return (UINT)msg.wParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
void doException(Notepad_plus & notepad_plus_plus) {
|
void doException(Notepad_plus_Window & notepad_plus_plus) {
|
||||||
Win32Exception::removeHandler(); //disable exception handler after excpetion, we dont want corrupt data structurs to crash the exception handler
|
Win32Exception::removeHandler(); //disable exception handler after excpetion, we dont want corrupt data structurs to crash the exception handler
|
||||||
::MessageBox(Notepad_plus::gNppHWND, TEXT("Notepad++ will attempt to save any unsaved data. However, dataloss is very likely."), TEXT("Recovery initiating"), MB_OK | MB_ICONINFORMATION);
|
::MessageBox(Notepad_plus_Window::gNppHWND, TEXT("Notepad++ will attempt to save any unsaved data. However, dataloss is very likely."), TEXT("Recovery initiating"), MB_OK | MB_ICONINFORMATION);
|
||||||
|
|
||||||
TCHAR tmpDir[1024];
|
TCHAR tmpDir[1024];
|
||||||
GetTempPath(1024, tmpDir);
|
GetTempPath(1024, tmpDir);
|
||||||
@ -416,8 +416,8 @@ void doException(Notepad_plus & notepad_plus_plus) {
|
|||||||
if (res) {
|
if (res) {
|
||||||
generic_string displayText = TEXT("Notepad++ was able to successfully recover some unsaved documents, or nothing to be saved could be found.\r\nYou can find the results at :\r\n");
|
generic_string displayText = TEXT("Notepad++ was able to successfully recover some unsaved documents, or nothing to be saved could be found.\r\nYou can find the results at :\r\n");
|
||||||
displayText += emergencySavedDir;
|
displayText += emergencySavedDir;
|
||||||
::MessageBox(Notepad_plus::gNppHWND, displayText.c_str(), TEXT("Recovery success"), MB_OK | MB_ICONINFORMATION);
|
::MessageBox(Notepad_plus_Window::gNppHWND, displayText.c_str(), TEXT("Recovery success"), MB_OK | MB_ICONINFORMATION);
|
||||||
} else {
|
} else {
|
||||||
::MessageBox(Notepad_plus::gNppHWND, TEXT("Unfortunatly, Notepad++ was not able to save your work. We are sorry for any lost data."), TEXT("Recovery failure"), MB_OK | MB_ICONERROR);
|
::MessageBox(Notepad_plus_Window::gNppHWND, TEXT("Unfortunatly, Notepad++ was not able to save your work. We are sorry for any lost data."), TEXT("Recovery failure"), MB_OK | MB_ICONERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -502,6 +502,10 @@
|
|||||||
RelativePath="..\src\Notepad_plus.cpp"
|
RelativePath="..\src\Notepad_plus.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\src\Notepad_plus_Window.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\src\NppBigSwitch.cpp"
|
RelativePath="..\src\NppBigSwitch.cpp"
|
||||||
>
|
>
|
||||||
@ -839,6 +843,10 @@
|
|||||||
RelativePath="..\src\Misc\PluginsManager\Notepad_plus_msgs.h"
|
RelativePath="..\src\Misc\PluginsManager\Notepad_plus_msgs.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\src\Notepad_plus_Window.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\src\Parameters.h"
|
RelativePath="..\src\Parameters.h"
|
||||||
>
|
>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user