Browse files

3.6 Beta 3 feature: save last used directory with option to disable

  • Loading branch information...
1 parent 4e23353 commit e99a519e5c99830d61a5422a4fff593bad50e430 @alexd committed Mar 3, 2011
Showing with 25 additions and 10 deletions.
  1. +16 −4 metapad.c
  2. +8 −6 metapad.rc
  3. +1 −0 resource.h
View
20 metapad.c
@@ -143,9 +143,9 @@ extern atoi(const char*);
#endif
#else
#ifdef USE_RICH_EDIT
-#define STR_ABOUT_NORMAL _T("metapad 3.6 beta 2")
+#define STR_ABOUT_NORMAL _T("metapad 3.6 beta 3")
#else
-#define STR_ABOUT_NORMAL _T("metapad LE 3.6 beta 2")
+#define STR_ABOUT_NORMAL _T("metapad LE 3.6 beta 3")
#endif
#endif
@@ -260,6 +260,7 @@ typedef struct tag_options {
BOOL bQuickExit;
BOOL bSaveWindowPlacement;
BOOL bSaveMenuSettings;
+ BOOL bSaveDirectory;
BOOL bLaunchClose;
int nTabStops;
int nPrimaryFont;
@@ -2124,6 +2125,7 @@ void LoadOptions(void)
options.bSystemColours = TRUE;
options.bSystemColours2 = TRUE;
options.bSaveMenuSettings = TRUE;
+ options.bSaveDirectory = TRUE;
options.bNoSmartHome = FALSE;
options.bNoAutoSaveExt = FALSE;
options.bContextCursor = FALSE;
@@ -2208,6 +2210,7 @@ void LoadOptions(void)
LoadOptionNumeric(key, _T("bQuickExit"), (LPBYTE)&options.bQuickExit, dwBufferSize);
LoadOptionNumeric(key, _T("bSaveWindowPlacement"), (LPBYTE)&options.bSaveWindowPlacement, dwBufferSize);
LoadOptionNumeric(key, _T("bSaveMenuSettings"), (LPBYTE)&options.bSaveMenuSettings, dwBufferSize);
+ LoadOptionNumeric(key, _T("bSaveDirectory"), (LPBYTE)&options.bSaveDirectory, dwBufferSize);
LoadOptionNumeric(key, _T("bLaunchClose"), (LPBYTE)&options.bLaunchClose, dwBufferSize);
LoadOptionNumeric(key, _T("bNoFaves"), (LPBYTE)&options.bNoFaves, dwBufferSize);
#ifndef USE_RICH_EDIT
@@ -2435,6 +2438,7 @@ void SaveOptions(void)
writeSucceeded &= SaveOption(key, _T("bQuickExit"), REG_DWORD, (LPBYTE)&options.bQuickExit, sizeof(BOOL));
writeSucceeded &= SaveOption(key, _T("bSaveWindowPlacement"), REG_DWORD, (LPBYTE)&options.bSaveWindowPlacement, sizeof(BOOL));
writeSucceeded &= SaveOption(key, _T("bSaveMenuSettings"), REG_DWORD, (LPBYTE)&options.bSaveMenuSettings, sizeof(BOOL));
+ writeSucceeded &= SaveOption(key, _T("bSaveDirectory"), REG_DWORD, (LPBYTE)&options.bSaveDirectory, sizeof(BOOL));
writeSucceeded &= SaveOption(key, _T("bLaunchClose"), REG_DWORD, (LPBYTE)&options.bLaunchClose, sizeof(BOOL));
writeSucceeded &= SaveOption(key, _T("bNoFaves"), REG_DWORD, (LPBYTE)&options.bNoFaves, sizeof(BOOL));
#ifndef USE_RICH_EDIT
@@ -2573,9 +2577,12 @@ void LoadMenusAndData(void)
LoadBoundedOptionString(key, keyname, (LPBYTE)&ReplaceArray[i], MAXFIND);
}
}
-
#endif
}
+
+ if (options.bSaveDirectory) {
+ LoadOptionString(key, _T("szLastDirectory"), (LPBYTE)&szDir, sizeof(szDir));
+ }
}
lstrcpy(szReplaceText, ReplaceArray[0]);
@@ -2682,6 +2689,10 @@ void SaveMenusAndData(void)
#endif
}
+ if (options.bSaveDirectory) {
+ SaveOption(key, _T("szLastDirectory"), REG_SZ, (LPBYTE)szDir, sizeof(TCHAR) * (lstrlen(szDir) + 1));
+ }
+
if (key != NULL) {
RegCloseKey(key);
}
@@ -4974,7 +4985,7 @@ BOOL CALLBACK GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
SetDlgItemText(hwndDlg, IDC_EDIT_QUOTE, options.szQuote);
SendDlgItemMessage(hwndDlg, IDC_CHECK_QUICKEXIT, BM_SETCHECK, (WPARAM) options.bQuickExit, 0);
SendDlgItemMessage(hwndDlg, IDC_CHECK_SAVEWINDOWPLACEMENT, BM_SETCHECK, (WPARAM) options.bSaveWindowPlacement, 0);
- SendDlgItemMessage(hwndDlg, IDC_CHECK_SAVEMENUSETTINGS, BM_SETCHECK, (WPARAM) options.bSaveMenuSettings, 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHECK_SAVEDIRECTORY, BM_SETCHECK, (WPARAM) options.bSaveDirectory, 0);
SendDlgItemMessage(hwndDlg, IDC_CHECK_LAUNCH_CLOSE, BM_SETCHECK, (WPARAM) options.bLaunchClose, 0);
SendDlgItemMessage(hwndDlg, IDC_FIND_AUTO_WRAP, BM_SETCHECK, (WPARAM)options.bFindAutoWrap, 0);
SendDlgItemMessage(hwndDlg, IDC_AUTO_INDENT, BM_SETCHECK, (WPARAM)options.bAutoIndent, 0);
@@ -5039,6 +5050,7 @@ BOOL CALLBACK GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
options.bQuickExit = (BST_CHECKED == SendDlgItemMessage(hwndDlg, IDC_CHECK_QUICKEXIT, BM_GETCHECK, 0, 0));
options.bSaveWindowPlacement = (BST_CHECKED == SendDlgItemMessage(hwndDlg, IDC_CHECK_SAVEWINDOWPLACEMENT, BM_GETCHECK, 0, 0));
options.bSaveMenuSettings = (BST_CHECKED == SendDlgItemMessage(hwndDlg, IDC_CHECK_SAVEMENUSETTINGS, BM_GETCHECK, 0, 0));
+ options.bSaveDirectory = (BST_CHECKED == SendDlgItemMessage(hwndDlg, IDC_CHECK_SAVEDIRECTORY, BM_GETCHECK, 0, 0));
}
break;
}
View
14 metapad.rc
@@ -236,15 +236,17 @@ BEGIN
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,45,104,8
CONTROL "Aut&o-search at end of file ",IDC_FIND_AUTO_WRAP,"Button",
BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,58,98,8
- CONTROL "A&uto-indent text",IDC_AUTO_INDENT,"Button",
+ CONTROL "Remem&ber last folder",IDC_CHECK_SAVEDIRECTORY,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,119,7,98,8
- CONTROL "&Insert tabs as spaces",IDC_INSERT_SPACES,"Button",
+ CONTROL "A&uto-indent text",IDC_AUTO_INDENT,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,119,19,98,8
- LTEXT "&Tab size:",IDC_STATIC,119,39,33,8
- EDITTEXT IDC_TAB_STOP,157,37,18,12,ES_CENTER | ES_AUTOHSCROLL |
+ CONTROL "&Insert tabs as spaces",IDC_INSERT_SPACES,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,119,31,98,8
+ LTEXT "&Tab size:",IDC_STATIC,119,45,33,8
+ EDITTEXT IDC_TAB_STOP,160,43,18,12,ES_CENTER | ES_AUTOHSCROLL |
ES_NUMBER
- LTEXT "&Quote string:",IDC_STATIC,119,58,41,8
- EDITTEXT IDC_EDIT_QUOTE,165,56,18,12,ES_AUTOHSCROLL
+ LTEXT "&Quote with:",IDC_STATIC,119,58,41,8
+ EDITTEXT IDC_EDIT_QUOTE,160,57,18,12,ES_AUTOHSCROLL
LTEXT "&Primary external viewer:",IDC_STATIC,7,72,78,8
EDITTEXT IDC_EDIT_BROWSER,7,83,138,12,ES_AUTOHSCROLL
PUSHBUTTON "...",IDC_BUTTON_BROWSE,148,83,14,12
View
1 resource.h
@@ -157,6 +157,7 @@
#define IDC_CHECK_SAVEMENUSETTINGS 1038
#define IDC_EDIT_ARGS 1039
#define IDC_EDIT_ARGS2 1040
+#define IDC_CHECK_SAVEDIRECTORY 1041
#define IDC_RECENT 1042
#define IDC_INSERT_TIME 1043
#define IDC_OFFSET_TEXT 1043

0 comments on commit e99a519

Please sign in to comment.