@@ -37,7 +37,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
3737#include " ../NppPlugin/nppexec_msgs.h"
3838
3939/* global explorer params */
40- extern ExProp exProp ;
40+ extern Settings settings ;
4141
4242namespace {
4343 constexpr UINT_PTR CONTEXT_MENU_SUBCLASS_ID = 1 ;
@@ -231,13 +231,13 @@ UINT ContextMenu::ShowContextMenu(HINSTANCE hInst, HWND hWndNpp, HWND hWndParent
231231 .srcModuleName = PathFindFileName (szPath),
232232 .info = &dwExecVer,
233233 };
234- Editor::Instance ().SendMsgToPlugin (exProp. nppExecProp .szAppName , &ci);
234+ Editor::Instance ().SendMsgToPlugin (settings. GetNppExecProp () .szAppName , &ci);
235235
236236 /* get acivity state of NppExec */
237237 ci.internalMsg = NPEM_GETSTATE;
238238 ci.srcModuleName = PathFindFileName (szPath);
239239 ci.info = &dwExecState;
240- Editor::Instance ().SendMsgToPlugin (exProp. nppExecProp .szAppName , &ci);
240+ Editor::Instance ().SendMsgToPlugin (settings. GetNppExecProp () .szAppName , &ci);
241241
242242 /* Add notepad menu items */
243243 if (isFolder) {
@@ -260,14 +260,14 @@ UINT ContextMenu::ShowContextMenu(HINSTANCE hInst, HWND hWndNpp, HWND hWndParent
260260 _strNppScripts.clear ();
261261
262262 /* add backslash if necessary */
263- if ((exProp. nppExecProp .szScriptPath [0 ] == ' .' ) &&
264- (exProp. nppExecProp .szScriptPath [1 ] == ' .' )) {
263+ if ((settings. GetNppExecProp () .szScriptPath [0 ] == ' .' ) &&
264+ (settings. GetNppExecProp () .szScriptPath [1 ] == ' .' )) {
265265 /* module path of notepad */
266266 GetModuleFileName (hInst, TEMP, sizeof (TEMP));
267267 PathRemoveFileSpec (TEMP);
268- PathAppend (TEMP, exProp. nppExecProp .szScriptPath );
268+ PathAppend (TEMP, settings. GetNppExecProp () .szScriptPath . c_str () );
269269 } else {
270- _tcsncpy (TEMP, exProp. nppExecProp .szScriptPath , MAX_PATH-1 );
270+ _tcsncpy (TEMP, settings. GetNppExecProp () .szScriptPath . c_str () , MAX_PATH-1 );
271271 }
272272 if (TEMP[wcslen (TEMP) - 1 ] != ' \\ ' ) {
273273 wcscat (TEMP, L" \\ " );
@@ -298,7 +298,7 @@ UINT ContextMenu::ShowContextMenu(HINSTANCE hInst, HWND hWndNpp, HWND hWndParent
298298 }
299299 ::AppendMenu (hMainMenu, MF_STRING, CTX_OPEN_CMD, L" Open Command Window Here" );
300300 ::AppendMenu (hMainMenu, MF_STRING, CTX_SET_AS_ROOT_FOLDER, L" Set as Root Folder" );
301- if (!exProp. rootFolder .empty ()) {
301+ if (!settings. GetRootFolder () .empty ()) {
302302 ::AppendMenu (hMainMenu, MF_STRING, CTX_GO_TO_ROOT_FOLDER, L" Go to Root Folder" );
303303 ::AppendMenu (hMainMenu, MF_STRING, CTX_CLEAR_ROOT_FOLDER, L" Clear Root Folder" );
304304 }
@@ -848,7 +848,7 @@ void ContextMenu::openPrompt()
848848 path.erase (pos, path.size ());
849849 }
850850 }
851- ::ShellExecute (_hWndNpp, L" open" , exProp.cphProgram .szAppName, nullptr , path.c_str(), SW_SHOW);
851+ ::ShellExecute (_hWndNpp, L" open" , settings.GetCphProgram() .szAppName.c_str() , nullptr, path.c_str(), SW_SHOW);
852852 }
853853}
854854
@@ -864,18 +864,18 @@ void ContextMenu::setRootFolder()
864864 }
865865 }
866866
867- exProp. rootFolder = path;
867+ settings. SetRootFolder ( path) ;
868868}
869869
870870void ContextMenu::gotoRootFolder ()
871871{
872872 extern ExplorerDialog explorerDlg;
873- explorerDlg.gotoFileLocation (exProp. rootFolder );
873+ explorerDlg.gotoFileLocation (settings. GetRootFolder () );
874874}
875875
876876void ContextMenu::clearRootFolder ()
877877{
878- exProp. rootFolder . clear ( );
878+ settings. SetRootFolder ( L" " );
879879}
880880
881881
@@ -974,14 +974,14 @@ void ContextMenu::openScriptPath(HMODULE hInst)
974974{
975975 WCHAR TEMP[MAX_PATH];
976976
977- if (exProp. nppExecProp .szScriptPath [0 ] == ' .' ) {
977+ if (settings. GetNppExecProp () .szScriptPath [0 ] == ' .' ) {
978978 /* module path of notepad */
979979 GetModuleFileName (hInst, TEMP, _countof (TEMP));
980980 PathRemoveFileSpec (TEMP);
981- PathAppend (TEMP, exProp. nppExecProp .szScriptPath );
981+ PathAppend (TEMP, settings. GetNppExecProp () .szScriptPath . c_str () );
982982 }
983983 else {
984- wcscpy (TEMP, exProp. nppExecProp .szScriptPath );
984+ wcscpy (TEMP, settings. GetNppExecProp () .szScriptPath . c_str () );
985985 }
986986 ::SendMessage (_hWndParent, EXM_OPENDIR, 0 , (LPARAM)TEMP);
987987}
@@ -991,14 +991,14 @@ void ContextMenu::startNppExec(HMODULE hInst, UINT cmdID)
991991 WCHAR szScriptPath[MAX_PATH];
992992
993993 /* concatinate execute command */
994- if (exProp. nppExecProp .szScriptPath [0 ] == ' .' ) {
994+ if (settings. GetNppExecProp () .szScriptPath [0 ] == ' .' ) {
995995 /* module path of notepad */
996996 GetModuleFileName (hInst, szScriptPath, _countof (szScriptPath));
997997 PathRemoveFileSpec (szScriptPath);
998- PathAppend (szScriptPath, exProp. nppExecProp .szScriptPath );
998+ PathAppend (szScriptPath, settings. GetNppExecProp () .szScriptPath . c_str () );
999999 }
10001000 else {
1001- wcscpy (szScriptPath, exProp. nppExecProp .szScriptPath );
1001+ wcscpy (szScriptPath, settings. GetNppExecProp () .szScriptPath . c_str () );
10021002 }
10031003 if (szScriptPath[wcslen (szScriptPath) - 1 ] != ' \\ ' ) {
10041004 wcscat (szScriptPath, L" \\ " );
0 commit comments