mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-25 14:54:39 +02:00
Add Debug Info feature
This commit is contained in:
parent
48e9b84bb2
commit
773397d6ea
@ -541,3 +541,14 @@ bool PluginsManager::allocateMarker(int numberRequired, int *start)
|
|||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
generic_string PluginsManager::getLoadedPluginNames() const
|
||||||
|
{
|
||||||
|
generic_string pluginPaths;
|
||||||
|
for (size_t i = 0; i < _loadedDlls.size(); ++i)
|
||||||
|
{
|
||||||
|
pluginPaths += _loadedDlls[i];
|
||||||
|
pluginPaths += TEXT(" ");
|
||||||
|
}
|
||||||
|
return pluginPaths;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -57,9 +57,7 @@ struct PluginCommand
|
|||||||
|
|
||||||
struct PluginInfo
|
struct PluginInfo
|
||||||
{
|
{
|
||||||
PluginInfo() :_hLib(NULL), _pluginMenu(NULL), _pFuncSetInfo(NULL),\
|
PluginInfo() {}
|
||||||
_pFuncGetFuncsArray(NULL), _pFuncGetName(NULL), _funcItems(NULL),\
|
|
||||||
_nbFuncItem(0){}
|
|
||||||
~PluginInfo()
|
~PluginInfo()
|
||||||
{
|
{
|
||||||
if (_pluginMenu)
|
if (_pluginMenu)
|
||||||
@ -69,25 +67,25 @@ struct PluginInfo
|
|||||||
::FreeLibrary(_hLib);
|
::FreeLibrary(_hLib);
|
||||||
}
|
}
|
||||||
|
|
||||||
HINSTANCE _hLib;
|
HINSTANCE _hLib = NULL;
|
||||||
HMENU _pluginMenu;
|
HMENU _pluginMenu = NULL;
|
||||||
|
|
||||||
PFUNCSETINFO _pFuncSetInfo;
|
PFUNCSETINFO _pFuncSetInfo = NULL;
|
||||||
PFUNCGETNAME _pFuncGetName;
|
PFUNCGETNAME _pFuncGetName = NULL;
|
||||||
PBENOTIFIED _pBeNotified;
|
PBENOTIFIED _pBeNotified = NULL;
|
||||||
PFUNCGETFUNCSARRAY _pFuncGetFuncsArray;
|
PFUNCGETFUNCSARRAY _pFuncGetFuncsArray = NULL;
|
||||||
PMESSAGEPROC _pMessageProc;
|
PMESSAGEPROC _pMessageProc = NULL;
|
||||||
PFUNCISUNICODE _pFuncIsUnicode;
|
PFUNCISUNICODE _pFuncIsUnicode = NULL;
|
||||||
|
|
||||||
FuncItem *_funcItems;
|
FuncItem *_funcItems = NULL;
|
||||||
int _nbFuncItem;
|
int _nbFuncItem = 0;
|
||||||
generic_string _moduleName;
|
generic_string _moduleName;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PluginsManager
|
class PluginsManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PluginsManager() : _hPluginsMenu(NULL), _isDisabled(false), _dynamicIDAlloc(ID_PLUGINS_CMD_DYNAMIC, ID_PLUGINS_CMD_DYNAMIC_LIMIT),
|
PluginsManager() : _dynamicIDAlloc(ID_PLUGINS_CMD_DYNAMIC, ID_PLUGINS_CMD_DYNAMIC_LIMIT),
|
||||||
_markerAlloc(MARKER_PLUGINS, MARKER_PLUGINS_LIMIT) {}
|
_markerAlloc(MARKER_PLUGINS, MARKER_PLUGINS_LIMIT) {}
|
||||||
~PluginsManager()
|
~PluginsManager()
|
||||||
{
|
{
|
||||||
@ -128,15 +126,16 @@ public:
|
|||||||
bool inDynamicRange(int id) { return _dynamicIDAlloc.isInRange(id); }
|
bool inDynamicRange(int id) { return _dynamicIDAlloc.isInRange(id); }
|
||||||
|
|
||||||
bool allocateMarker(int numberRequired, int *start);
|
bool allocateMarker(int numberRequired, int *start);
|
||||||
|
generic_string getLoadedPluginNames() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NppData _nppData;
|
NppData _nppData;
|
||||||
HMENU _hPluginsMenu;
|
HMENU _hPluginsMenu = NULL;
|
||||||
|
|
||||||
std::vector<PluginInfo *> _pluginInfos;
|
std::vector<PluginInfo *> _pluginInfos;
|
||||||
std::vector<PluginCommand> _pluginsCommands;
|
std::vector<PluginCommand> _pluginsCommands;
|
||||||
std::vector<generic_string> _loadedDlls;
|
std::vector<generic_string> _loadedDlls;
|
||||||
bool _isDisabled;
|
bool _isDisabled = false;
|
||||||
IDAllocator _dynamicIDAlloc;
|
IDAllocator _dynamicIDAlloc;
|
||||||
IDAllocator _markerAlloc;
|
IDAllocator _markerAlloc;
|
||||||
|
|
||||||
|
@ -616,6 +616,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
|
|||||||
_findCharsInRangeDlg.init(_pPublicInterface->getHinst(), hwnd, &_pEditView);
|
_findCharsInRangeDlg.init(_pPublicInterface->getHinst(), hwnd, &_pEditView);
|
||||||
_colEditorDlg.init(_pPublicInterface->getHinst(), hwnd, &_pEditView);
|
_colEditorDlg.init(_pPublicInterface->getHinst(), hwnd, &_pEditView);
|
||||||
_aboutDlg.init(_pPublicInterface->getHinst(), hwnd);
|
_aboutDlg.init(_pPublicInterface->getHinst(), hwnd);
|
||||||
|
_debugInfoDlg.init(_pPublicInterface->getHinst(), hwnd, _isAdministrator, _pluginsManager.getLoadedPluginNames());
|
||||||
_runDlg.init(_pPublicInterface->getHinst(), hwnd);
|
_runDlg.init(_pPublicInterface->getHinst(), hwnd);
|
||||||
_runMacroDlg.init(_pPublicInterface->getHinst(), hwnd);
|
_runMacroDlg.init(_pPublicInterface->getHinst(), hwnd);
|
||||||
|
|
||||||
|
@ -341,6 +341,7 @@ private:
|
|||||||
FindReplaceDlg _findReplaceDlg;
|
FindReplaceDlg _findReplaceDlg;
|
||||||
FindIncrementDlg _incrementFindDlg;
|
FindIncrementDlg _incrementFindDlg;
|
||||||
AboutDlg _aboutDlg;
|
AboutDlg _aboutDlg;
|
||||||
|
DebugInfoDlg _debugInfoDlg;
|
||||||
RunDlg _runDlg;
|
RunDlg _runDlg;
|
||||||
GoToLineDlg _goToLineDlg;
|
GoToLineDlg _goToLineDlg;
|
||||||
ColumnEditorDlg _colEditorDlg;
|
ColumnEditorDlg _colEditorDlg;
|
||||||
|
@ -855,6 +855,7 @@ BEGIN
|
|||||||
MENUITEM "Update Notepad++", IDM_UPDATE_NPP
|
MENUITEM "Update Notepad++", IDM_UPDATE_NPP
|
||||||
MENUITEM "Set Updater Proxy...", IDM_CONFUPDATERPROXY
|
MENUITEM "Set Updater Proxy...", IDM_CONFUPDATERPROXY
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
|
MENUITEM "Debug Info", IDM_DEBUGINFO
|
||||||
MENUITEM "About Notepad++", IDM_ABOUT
|
MENUITEM "About Notepad++", IDM_ABOUT
|
||||||
END
|
END
|
||||||
|
|
||||||
@ -894,6 +895,18 @@ BEGIN
|
|||||||
EDITTEXT IDC_LICENCE_EDIT,31,99,209,96,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | NOT WS_BORDER | WS_VSCROLL
|
EDITTEXT IDC_LICENCE_EDIT,31,99,209,96,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | NOT WS_BORDER | WS_VSCROLL
|
||||||
END
|
END
|
||||||
|
|
||||||
|
IDD_DEBUGINFOBOX DIALOGEX 0, 0, 271, 200
|
||||||
|
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||||
|
EXSTYLE WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE
|
||||||
|
CAPTION "Debug Info"
|
||||||
|
FONT 8, TEXT("MS Shell Dlg"), 0, 0, 0x1
|
||||||
|
BEGIN
|
||||||
|
EDITTEXT IDC_DEBUGINFO_EDIT,31,20,220,96,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | NOT WS_BORDER | WS_VSCROLL
|
||||||
|
LTEXT "Copy debug info into clipboard",IDC_DEBUGINFO_COPYLINK,31,120,126,8
|
||||||
|
DEFPUSHBUTTON "OK",IDOK,106,160,50,14,BS_FLAT,WS_EX_STATICEDGE
|
||||||
|
END
|
||||||
|
|
||||||
|
|
||||||
IDD_GOLINE DIALOGEX 26, 41, 261, 88
|
IDD_GOLINE DIALOGEX 26, 41, 261, 88
|
||||||
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||||
EXSTYLE WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE
|
EXSTYLE WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE
|
||||||
|
@ -2196,6 +2196,12 @@ void Notepad_plus::command(int id)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case IDM_DEBUGINFO:
|
||||||
|
{
|
||||||
|
_debugInfoDlg.doDialog();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case IDM_ABOUT:
|
case IDM_ABOUT:
|
||||||
{
|
{
|
||||||
bool doAboutDlg = false;
|
bool doAboutDlg = false;
|
||||||
|
@ -6040,6 +6040,28 @@ int NppParameters::langTypeToCommandID(LangType lt) const
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
generic_string NppParameters:: getWinVersionStr() const
|
||||||
|
{
|
||||||
|
switch (_winVersion)
|
||||||
|
{
|
||||||
|
case WV_WIN32S: return TEXT("Windows 3.1");
|
||||||
|
case WV_95: return TEXT("Windows 95");
|
||||||
|
case WV_98: return TEXT("Windows 98");
|
||||||
|
case WV_ME: return TEXT("Windows Millennium Edition");
|
||||||
|
case WV_NT: return TEXT("Windows NT");
|
||||||
|
case WV_W2K: return TEXT("Windows 2000");
|
||||||
|
case WV_XP: return TEXT("Windows XP");
|
||||||
|
case WV_S2003: return TEXT("Windows Server 2003");
|
||||||
|
case WV_XPX64: return TEXT("Windows XP 64 bits");
|
||||||
|
case WV_VISTA: return TEXT("Windows Vista");
|
||||||
|
case WV_WIN7: return TEXT("Windows 7");
|
||||||
|
case WV_WIN8: return TEXT("Windows 8");
|
||||||
|
case WV_WIN81: return TEXT("Windows 8.1");
|
||||||
|
case WV_WIN10: return TEXT("Windows 10");
|
||||||
|
default: /*case WV_UNKNOWN:*/ return TEXT("Windows unknown version");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void NppParameters::writeStyles(LexerStylerArray & lexersStylers, StyleArray & globalStylers)
|
void NppParameters::writeStyles(LexerStylerArray & lexersStylers, StyleArray & globalStylers)
|
||||||
{
|
{
|
||||||
TiXmlNode *lexersRoot = (_pXmlUserStylerDoc->FirstChild(TEXT("NotepadPlus")))->FirstChildElement(TEXT("LexerStyles"));
|
TiXmlNode *lexersRoot = (_pXmlUserStylerDoc->FirstChild(TEXT("NotepadPlus")))->FirstChildElement(TEXT("LexerStyles"));
|
||||||
|
@ -1495,7 +1495,8 @@ public:
|
|||||||
|
|
||||||
bool getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU pluginsMenu);
|
bool getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU pluginsMenu);
|
||||||
bool reloadContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU pluginsMenu);
|
bool reloadContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU pluginsMenu);
|
||||||
winVer getWinVersion() { return _winVersion;};
|
winVer getWinVersion() const {return _winVersion;};
|
||||||
|
generic_string getWinVersionStr() const;
|
||||||
FindHistory & getFindHistory() {return _findHistory;};
|
FindHistory & getFindHistory() {return _findHistory;};
|
||||||
bool _isFindReplacing; // an on the fly variable for find/replace functions
|
bool _isFindReplacing; // an on the fly variable for find/replace functions
|
||||||
void safeWow64EnableWow64FsRedirection(BOOL Wow64FsEnableRedirection);
|
void safeWow64EnableWow64FsRedirection(BOOL Wow64FsEnableRedirection);
|
||||||
|
@ -2566,7 +2566,7 @@ void Finder::copy()
|
|||||||
const generic_string toClipboard = stringJoin(lines, TEXT("\r\n"));
|
const generic_string toClipboard = stringJoin(lines, TEXT("\r\n"));
|
||||||
if (!toClipboard.empty())
|
if (!toClipboard.empty())
|
||||||
{
|
{
|
||||||
if (!str2Clipboard(toClipboard.c_str(), _hSelf))
|
if (!str2Clipboard(toClipboard, _hSelf))
|
||||||
{
|
{
|
||||||
assert(false);
|
assert(false);
|
||||||
::MessageBox(NULL, TEXT("Error placing text in clipboard."), TEXT("Notepad++"), MB_ICONINFORMATION);
|
::MessageBox(NULL, TEXT("Error placing text in clipboard."), TEXT("Notepad++"), MB_ICONINFORMATION);
|
||||||
|
@ -111,5 +111,106 @@ void AboutDlg::doDialog()
|
|||||||
|
|
||||||
// Adjust the position of AboutBox
|
// Adjust the position of AboutBox
|
||||||
goToCenter();
|
goToCenter();
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
|
INT_PTR CALLBACK DebugInfoDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM /*lParam*/)
|
||||||
|
{
|
||||||
|
switch (message)
|
||||||
|
{
|
||||||
|
case WM_INITDIALOG:
|
||||||
|
{
|
||||||
|
// Notepad++ version
|
||||||
|
_debugInfoStr = NOTEPAD_PLUS_VERSION;
|
||||||
|
_debugInfoStr += TEXT("\r\n");
|
||||||
|
|
||||||
|
// Build time
|
||||||
|
_debugInfoStr += TEXT("Build time : ");
|
||||||
|
generic_string buildTime;
|
||||||
|
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
||||||
|
buildTime += wmc->char2wchar(__DATE__, CP_ACP);
|
||||||
|
buildTime += TEXT(" - ");
|
||||||
|
buildTime += wmc->char2wchar(__TIME__, CP_ACP);
|
||||||
|
_debugInfoStr += buildTime;
|
||||||
|
_debugInfoStr += TEXT("\r\n");
|
||||||
|
|
||||||
|
// Binary path
|
||||||
|
_debugInfoStr += TEXT("Path : ");
|
||||||
|
TCHAR nppFullPath[MAX_PATH];
|
||||||
|
::GetModuleFileName(NULL, nppFullPath, MAX_PATH);
|
||||||
|
_debugInfoStr += nppFullPath;
|
||||||
|
_debugInfoStr += TEXT("\r\n");
|
||||||
|
|
||||||
|
// Administrator mode
|
||||||
|
_debugInfoStr += TEXT("Admin mode : ");
|
||||||
|
_debugInfoStr += (_isAdmin ? TEXT("ON") : TEXT("OFF"));
|
||||||
|
_debugInfoStr += TEXT("\r\n");
|
||||||
|
|
||||||
|
// local conf
|
||||||
|
_debugInfoStr += TEXT("Local Conf mode : ");
|
||||||
|
bool doLocalConf = (NppParameters::getInstance())->isLocal();
|
||||||
|
_debugInfoStr += (doLocalConf ? TEXT("ON") : TEXT("OFF"));
|
||||||
|
_debugInfoStr += TEXT("\r\n");
|
||||||
|
|
||||||
|
// OS version
|
||||||
|
_debugInfoStr += TEXT("OS : ");
|
||||||
|
_debugInfoStr += (NppParameters::getInstance())->getWinVersionStr();
|
||||||
|
_debugInfoStr += TEXT("\r\n");
|
||||||
|
|
||||||
|
// Plugins
|
||||||
|
_debugInfoStr += TEXT("Plugins : ");
|
||||||
|
_debugInfoStr += _loadedPlugins;
|
||||||
|
_debugInfoStr += TEXT("\r\n");
|
||||||
|
|
||||||
|
::SetDlgItemText(_hSelf, IDC_DEBUGINFO_EDIT, _debugInfoStr.c_str());
|
||||||
|
|
||||||
|
_copyToClipboardLink.init(_hInst, _hSelf);
|
||||||
|
_copyToClipboardLink.create(::GetDlgItem(_hSelf, IDC_DEBUGINFO_COPYLINK), IDC_DEBUGINFO_COPYLINK);
|
||||||
|
|
||||||
|
getClientRect(_rc);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
case WM_COMMAND:
|
||||||
|
{
|
||||||
|
switch (wParam)
|
||||||
|
{
|
||||||
|
case IDCANCEL:
|
||||||
|
case IDOK:
|
||||||
|
display(false);
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
case IDC_DEBUGINFO_COPYLINK:
|
||||||
|
{
|
||||||
|
if ((GetKeyState(VK_LBUTTON) & 0x100) != 0)
|
||||||
|
{
|
||||||
|
// Visual effect
|
||||||
|
::SendDlgItemMessage(_hSelf, IDC_DEBUGINFO_EDIT, EM_SETSEL, 0, _debugInfoStr.length() - 1);
|
||||||
|
|
||||||
|
// Copy to clipboard
|
||||||
|
str2Clipboard(_debugInfoStr, _hSelf);
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
case WM_DESTROY:
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DebugInfoDlg::doDialog()
|
||||||
|
{
|
||||||
|
if (!isCreated())
|
||||||
|
create(IDD_DEBUGINFOBOX);
|
||||||
|
|
||||||
|
// Adjust the position of AboutBox
|
||||||
|
goToCenter();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,6 @@ along with this program; if not, write to the Free Software \
|
|||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.")
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class AboutDlg : public StaticDialog
|
class AboutDlg : public StaticDialog
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
@ -76,4 +75,33 @@ private :
|
|||||||
URLCtrl _pageLink;
|
URLCtrl _pageLink;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class DebugInfoDlg : public StaticDialog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DebugInfoDlg() : StaticDialog() {};
|
||||||
|
|
||||||
|
void init(HINSTANCE hInst, HWND parent, bool isAdmin, generic_string loadedPlugins) {
|
||||||
|
_isAdmin = isAdmin;
|
||||||
|
_loadedPlugins = loadedPlugins;
|
||||||
|
Window::init(hInst, parent);
|
||||||
|
};
|
||||||
|
|
||||||
|
void doDialog();
|
||||||
|
|
||||||
|
virtual void destroy() {
|
||||||
|
_copyToClipboardLink.destroy();
|
||||||
|
};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
|
private:
|
||||||
|
generic_string _debugInfoStr;
|
||||||
|
bool _isAdmin = false;
|
||||||
|
generic_string _loadedPlugins;
|
||||||
|
URLCtrl _copyToClipboardLink;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif //ABOUT_DLG_H
|
#endif //ABOUT_DLG_H
|
||||||
|
@ -487,6 +487,7 @@
|
|||||||
#define IDM_CONFUPDATERPROXY (IDM_ABOUT + 9)
|
#define IDM_CONFUPDATERPROXY (IDM_ABOUT + 9)
|
||||||
#define IDM_CMDLINEARGUMENTS (IDM_ABOUT + 10)
|
#define IDM_CMDLINEARGUMENTS (IDM_ABOUT + 10)
|
||||||
#define IDM_ONLINESUPPORT (IDM_ABOUT + 11)
|
#define IDM_ONLINESUPPORT (IDM_ABOUT + 11)
|
||||||
|
#define IDM_DEBUGINFO (IDM_ABOUT + 12)
|
||||||
|
|
||||||
|
|
||||||
#define IDM_SETTING (IDM + 8000)
|
#define IDM_SETTING (IDM + 8000)
|
||||||
|
@ -277,6 +277,11 @@
|
|||||||
#define IDC_ONLINEHELP_ADDR 1704
|
#define IDC_ONLINEHELP_ADDR 1704
|
||||||
#define IDC_AUTHOR_NAME 1705
|
#define IDC_AUTHOR_NAME 1705
|
||||||
#define IDC_BUILD_DATETIME 1706 //LS: CompileDateInAboutDialog: Automatically insert compile date as additional version info in About-dialog!
|
#define IDC_BUILD_DATETIME 1706 //LS: CompileDateInAboutDialog: Automatically insert compile date as additional version info in About-dialog!
|
||||||
|
|
||||||
|
#define IDD_DEBUGINFOBOX 1750
|
||||||
|
#define IDC_DEBUGINFO_EDIT 1751
|
||||||
|
#define IDC_DEBUGINFO_COPYLINK 1752
|
||||||
|
|
||||||
//#define IDD_USER_DEFINE_BOX 1800
|
//#define IDD_USER_DEFINE_BOX 1800
|
||||||
|
|
||||||
//#define IDD_RUN_DLG 1900
|
//#define IDD_RUN_DLG 1900
|
||||||
|
Loading…
x
Reference in New Issue
Block a user