Index: src/winhugs/DlgOptions.c =================================================================== RCS file: /cvs/hugs98/src/winhugs/DlgOptions.c,v retrieving revision 1.3 diff -u -r1.3 DlgOptions.c --- src/winhugs/DlgOptions.c 5 Sep 2005 11:23:52 -0000 1.3 +++ src/winhugs/DlgOptions.c 6 Sep 2005 10:16:49 -0000 @@ -133,75 +133,10 @@ UpdateFontPreview(hDlg); } -/* editorIndex refers to the Editors array in InitOptionsEditor() */ -BOOL EditorPath(int editorIndex, char* Buffer) -{ - DWORD Size = MAX_PATH; - switch (editorIndex) { - case 0: //Notepad - GetWindowsDirectory(Buffer, MAX_PATH); - strcat(Buffer, "\\notepad.exe"); - break; - - case 1: //Textpad - //[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\TextPad.exe] - //@="D:\\Program Files\\TextPad 4\\TextPad.exe" - { - char* s; - - Buffer[0] = 0; - if (RegQueryValue(HKEY_LOCAL_MACHINE, - "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\TextPad.exe", - Buffer, &Size) != ERROR_SUCCESS) - return FALSE; - - s = strrchr(Buffer, '\\'); - if (s == NULL) return FALSE; - - strcpy(&s[1], "System\\DDEOPN32.EXE TextPad %s(%d)"); - } - break; - - case 2: //Vim - // x = HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Vim.Application\CLSID - // vi = HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\$x$\LocalServer32 - // cmd = "$vi$" +%d %s - { - char Buf2[1000]; - Buffer[0] = 0; - - if (RegQueryValue(HKEY_LOCAL_MACHINE, - "SOFTWARE\\Classes\\Vim.Application\\CLSID", - Buffer, &Size) != ERROR_SUCCESS) - return FALSE; - - sprintf(Buf2, "SOFTWARE\\Classes\\CLSID\\%s\\LocalServer32", Buffer); - if (RegQueryValue(HKEY_LOCAL_MACHINE, Buf2, - &Buffer[1], &Size) != ERROR_SUCCESS) - return FALSE; - - Buffer[0] = '\"'; - strcat(Buffer, "\" --remote-silent +%d %s"); - } - break; - - default: - Buffer[0] = 0; - break; - } - return TRUE; -} - void InitOptionsEditor(HWND hDlg) { HWND hLst = GetDlgItem(hDlg, lstEditor); - const LPCTSTR Editors[] = { - "Notepad", - "Textpad (www.textpad.com)", - "Vim (www.vim.org)", - NULL - }; char* s; char Buffer[MAX_PATH]; int i; @@ -215,10 +150,11 @@ // and figure out if it corresponds to any defaults SetDlgItemText(hDlg, txtEditor, s); - for (i = 0; Editors[i]; i++) { - BOOL Res = EditorPath(i, Buffer); - if (Res) { - int NewIndex = (int) SendMessage(hLst, CB_ADDSTRING, 0, (LPARAM) Editors[i]); + for (i = 0; ; i++) { + LPCTSTR EditorName = GetEditor(i, Buffer); + if (EditorName == NULL) break; + if (Buffer[0]) { + int NewIndex = (int) SendMessage(hLst, CB_ADDSTRING, 0, (LPARAM) EditorName); SendMessage(hLst, CB_SETITEMDATA, NewIndex, i); if (stricmp(Buffer, s) == 0) SendMessage(hLst, CB_SETCURSEL, NewIndex, 0); @@ -267,7 +203,7 @@ if (CurData != -1) { CHAR Buffer[MAX_PATH]; - EditorPath(CurData, Buffer); + GetEditor(CurData, Buffer); SetWindowText(hTxt, Buffer); } } Index: src/winhugs/Header.h =================================================================== RCS file: /cvs/hugs98/src/winhugs/Header.h,v retrieving revision 1.1 diff -u -r1.1 Header.h --- src/winhugs/Header.h 1 Sep 2005 12:22:19 -0000 1.1 +++ src/winhugs/Header.h 6 Sep 2005 09:59:56 -0000 @@ -45,6 +45,7 @@ void ShowAboutDialog(HWND hParent); BOOL ShowOptionsDialog(HWND hParent); LPSTR ExpandFileName(LPSTR what); +LPCTSTR GetEditor(int Index, LPTSTR Buffer); // From WinBrowse2.c void DrawClassesHierarchy();