Skip to content

Commit 8b9ea8d

Browse files
author
Nada Al Tayan
committed
Added the support to debug the file in PDB, bumped the version
1 parent b2d8a30 commit 8b9ea8d

File tree

4 files changed

+34
-21
lines changed

4 files changed

+34
-21
lines changed

PluginDefinition.cpp

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,31 +48,35 @@ void pluginCleanUp()
4848

4949
void commandMenuInit()
5050
{
51+
int idx = 0;
5152
ShortcutKey* key = new ShortcutKey();
5253
key->_isAlt = true;
5354
key->_isCtrl = true;
5455
key->_isShift = false;
5556
key->_key = 0x74; //F5
56-
setCommand(0, TEXT("Run file in Python"), runFile, key, false);
57+
setCommand(idx++, TEXT("Run file in Python"), runFile, key, false);
5758

5859
key = new ShortcutKey();
5960
key->_isAlt = true;
6061
key->_isCtrl = false;
6162
key->_isShift = true;
6263
key->_key = 0x74;
63-
setCommand(1, TEXT("Run file in Python Interactive"), runFileInteractive, key, false);
64+
setCommand(idx++, TEXT("Run file in Python Interactive"), runFileInteractive, key, false);
6465

6566
key = new ShortcutKey();
6667
key->_isAlt = true;
6768
key->_isCtrl = true;
6869
key->_isShift = true;
6970
key->_key = 0x74;
70-
setCommand(2, TEXT("Run file in PythonW"), runFileW, key, false);
71+
setCommand(idx++, TEXT("Run file in PythonW"), runFileW, key, false);
7172

72-
lstrcpy(funcItem[3]._itemName, TEXT("-SEPARATOR-"));
73+
key = new ShortcutKey();
74+
setCommand(idx++, TEXT("Debug the file (PDB)"), runFilePDB, key, false);
75+
76+
lstrcpy(funcItem[idx++]._itemName, TEXT("-SEPARATOR-"));
7377

74-
setCommand(4, TEXT("Options"), showOptionsDlg, 0, false);
75-
setCommand(5, TEXT("About PyNPP"), showAboutDlg, 0, false);
78+
setCommand(idx++, TEXT("Options"), showOptionsDlg, 0, false);
79+
setCommand(idx++, TEXT("About PyNPP"), showAboutDlg, 0, false);
7680
}
7781

7882
void commandMenuCleanUp()
@@ -137,7 +141,7 @@ std::wstring getCurrentFile(bool &ok)
137141
return wPath;
138142
}
139143

140-
std::wstring buildRunCommand(std::wstring &filePath, std::wstring &pypath, bool isW = false, bool isI = false)
144+
std::wstring buildRunCommand(std::wstring &filePath, std::wstring &pypath, bool isW = false, bool isI = false, bool isPDB = false)
141145
{
142146
std::wstring command = pypath;
143147
if (command[command.length() - 1] != '\\')
@@ -148,6 +152,8 @@ std::wstring buildRunCommand(std::wstring &filePath, std::wstring &pypath, bool
148152
command += TEXT(".exe ");
149153
if (isI)
150154
command += TEXT("-i ");
155+
if (isPDB)
156+
command += TEXT("-m pdb ");
151157
command += TEXT("\"");
152158
command += filePath;
153159
command += TEXT("\"");
@@ -190,7 +196,7 @@ bool launchPython(std::wstring &command, std::wstring &path)
190196
return result;
191197
}
192198

193-
void run(bool isW, bool isI) {
199+
void run(bool isW, bool isI, bool isPDB) {
194200
std::wstring pythonLoc = pythonPath;
195201

196202
if(pythonPath == L"")
@@ -210,7 +216,7 @@ void run(bool isW, bool isI) {
210216
break;
211217
}
212218
}
213-
std::wstring command = buildRunCommand(file, pythonLoc, isW, isI);
219+
std::wstring command = buildRunCommand(file, pythonLoc, isW, isI, isPDB);
214220

215221
if(!launchPython(command, path)) {
216222
int errorCode = GetLastError();
@@ -233,13 +239,17 @@ void run(bool isW, bool isI) {
233239
}
234240

235241
void runFile() {
236-
run(false, false);
242+
run(false, false, false);
237243
}
238244

239245
void runFileInteractive() {
240-
run(false, true);
246+
run(false, true, false);
241247
}
242248

243249
void runFileW() {
244-
run(true, false);
245-
}
250+
run(true, false, false);
251+
}
252+
253+
void runFilePDB() {
254+
run(false, false, true);
255+
}

PluginDefinition.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
const TCHAR NPP_PLUGIN_NAME[] = TEXT("PyNPP");
2424

25-
const int nbFunc = 6;
25+
const int nbFunc = 7;
2626

2727

2828
//
@@ -57,8 +57,10 @@ bool setCommand(size_t index, TCHAR *cmdName, PFUNCPLUGINCMD pFunc, ShortcutKey
5757
// Your plugin command functions
5858
//
5959
void runFile();
60+
void runFilePDB();
6061
void runFileInteractive();
6162
void runFileW();
63+
void runFileWPDB();
6264
void run(bool isW);
6365
void showOptionsDlg();
6466
void showAboutDlg();

PyNPP_RES.rc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
//
88
// Generated from the TEXTINCLUDE 2 resource.
99
//
10-
#include "afxres.h"
10+
#include "WinResrc.h"
11+
#define IDC_STATIC -1
1112

1213
/////////////////////////////////////////////////////////////////////////////
1314
#undef APSTUDIO_READONLY_SYMBOLS
@@ -70,7 +71,7 @@ CAPTION "About PyNPP"
7071
FONT 8, "MS Shell Dlg", 400, 0, 0x1
7172
BEGIN
7273
DEFPUSHBUTTON "OK",IDOK,51,82,50,14
73-
CTEXT "PyNPP\nA Notepad++ plugin to run Python scripts from inside Notepad++.\n\nCreated by\nAbd Allah Diab\[email protected]\nhttp://mpcabd.igeex.biz",IDC_STATIC,7,7,136,72
74+
CTEXT "PyNPP\nA Notepad++ plugin to run Python scripts from inside Notepad++.\n\nCreated by\nAbdullah Diab\[email protected]\nhttp://mpcabd.igeex.biz",IDC_STATIC,7,7,135,72
7475
END
7576

7677

versionRC.rc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#include <windows.h>
22

3-
#define VER_FILEVERSION 1,1,0,0
4-
#define VER_FILEVERSION_STR "1.1\0"
3+
#define VER_FILEVERSION 1,2,0,0
4+
#define VER_FILEVERSION_STR "1.2\0"
55

6-
#define VER_PRODUCTVERSION 1,1,0,0
7-
#define VER_PRODUCTVERSION_STR "1.1\0"
6+
#define VER_PRODUCTVERSION 1,2,0,0
7+
#define VER_PRODUCTVERSION_STR "1.2\0"
88

99
#ifndef DEBUG
1010
#define VER_DEBUG 0
@@ -25,7 +25,7 @@ BEGIN
2525
BEGIN
2626
BLOCK "040904E4"
2727
BEGIN
28-
VALUE "CompanyName", "Abd Allah Diab\0"
28+
VALUE "CompanyName", "Abdullah Diab\0"
2929
VALUE "FileDescription", "PyNPP Notepad++ Plugin\0"
3030
VALUE "FileVersion", VER_FILEVERSION_STR
3131
VALUE "InternalName", "PyNPP\0"

0 commit comments

Comments
 (0)