comparison netinstall/source.cc @ 673:685b588e92d8

[xemacs-hg @ 2001-10-30 05:13:26 by andyp] merge of windows 21.4.5 codeline
author andyp
date Tue, 30 Oct 2001 05:13:31 +0000
parents 3078fd1074e8
children a307f9a2021d
comparison
equal deleted inserted replaced
672:42a8626b741e 673:685b588e92d8
9 * A copy of the GNU General Public License can be found at 9 * A copy of the GNU General Public License can be found at
10 * http://www.gnu.org/ 10 * http://www.gnu.org/
11 * 11 *
12 * Written by DJ Delorie <dj@cygnus.com> 12 * Written by DJ Delorie <dj@cygnus.com>
13 * 13 *
14 * Sync'ed with cinstall 2001-10-16
14 */ 15 */
15 16
16 /* The purpose of this file is to manage the dialog box that lets the 17 /* The purpose of this file is to manage the dialog box that lets the
17 user choose the source of the install - from the net, from the 18 user choose the source of the install - from the net, from the
18 current directory, or to just download files. */ 19 current directory, or to just download files. */
23 #include "resource.h" 24 #include "resource.h"
24 #include "state.h" 25 #include "state.h"
25 #include "msg.h" 26 #include "msg.h"
26 #include "log.h" 27 #include "log.h"
27 28
28 static int rb[] = { IDC_SOURCE_DOWNLOAD, IDC_SOURCE_NETINST, IDC_SOURCE_CWD, 0 }; 29 static int rb[] = { IDC_SOURCE_NETINST, IDC_SOURCE_DOWNLOAD, IDC_SOURCE_CWD, 0 };
29 30
30 static void 31 static void
31 check_if_enable_next (HWND h) 32 check_if_enable_next (HWND h)
32 { 33 {
33 EnableWindow (GetDlgItem (h, IDOK), source ? 1 : 0); 34 EnableWindow (GetDlgItem (h, IDOK), source ? 1 : 0);
34 } 35 }
35 36
36 static void 37 static void
37 load_dialog (HWND h) 38 load_dialog (HWND h)
38 { 39 {
40 int i;
39 rbset (h, rb, source); 41 rbset (h, rb, source);
40 check_if_enable_next (h);
41 } 42 }
42 43
43 static void 44 static void
44 save_dialog (HWND h) 45 save_dialog (HWND h)
45 { 46 {
47 int i;
46 source = rbget (h, rb); 48 source = rbget (h, rb);
47 } 49 }
48 50
49 static BOOL 51 static BOOL
50 dialog_cmd (HWND h, int id, HWND hwndctl, UINT code) 52 dialog_cmd (HWND h, int id, HWND hwndctl, UINT code)
54 56
55 case IDC_SOURCE_DOWNLOAD: 57 case IDC_SOURCE_DOWNLOAD:
56 case IDC_SOURCE_NETINST: 58 case IDC_SOURCE_NETINST:
57 case IDC_SOURCE_CWD: 59 case IDC_SOURCE_CWD:
58 save_dialog (h); 60 save_dialog (h);
59 check_if_enable_next (h);
60 break; 61 break;
61 62
62 case IDOK: 63 case IDOK:
63 save_dialog (h); 64 save_dialog (h);
64 NEXT (IDD_LOCAL_DIR); 65 NEXT (IDD_LOCAL_DIR);
70 break; 71 break;
71 72
72 case IDCANCEL: 73 case IDCANCEL:
73 NEXT (0); 74 NEXT (0);
74 break; 75 break;
76
77 default:
78 break;
75 } 79 }
76 return FALSE;
77 } 80 }
78 81
79 static BOOL CALLBACK 82 static BOOL CALLBACK
80 dialog_proc (HWND h, UINT message, WPARAM wParam, LPARAM lParam) 83 dialog_proc (HWND h, UINT message, WPARAM wParam, LPARAM lParam)
81 { 84 {
82 switch (message) 85 switch (message)
83 { 86 {
84 case WM_INITDIALOG: 87 case WM_INITDIALOG:
85 load_dialog (h); 88 load_dialog (h);
89 // Check to see if any radio buttons are selected. If not, select a default.
90 if ((!SendMessage(GetDlgItem (h, IDC_SOURCE_DOWNLOAD), BM_GETCHECK, 0, 0) == BST_CHECKED)
91 && (!SendMessage(GetDlgItem (h, IDC_SOURCE_CWD), BM_GETCHECK, 0, 0) == BST_CHECKED))
92 {
93 SendMessage(GetDlgItem (h, IDC_SOURCE_NETINST), BM_SETCHECK, BST_CHECKED, 0);
94 }
86 return FALSE; 95 return FALSE;
87 case WM_COMMAND: 96 case WM_COMMAND:
88 return HANDLE_WM_COMMAND (h, wParam, lParam, dialog_cmd); 97 return HANDLE_WM_COMMAND (h, wParam, lParam, dialog_cmd);
89 } 98 }
90 return FALSE; 99 return FALSE;
92 101
93 void 102 void
94 do_source (HINSTANCE h) 103 do_source (HINSTANCE h)
95 { 104 {
96 int rv = 0; 105 int rv = 0;
106 /* source = IDC_SOURCE_CWD;*/
107 source = IDC_SOURCE_NETINST;
97 rv = DialogBox (h, MAKEINTRESOURCE (IDD_SOURCE), 0, dialog_proc); 108 rv = DialogBox (h, MAKEINTRESOURCE (IDD_SOURCE), 0, dialog_proc);
98 if (rv == -1) 109 if (rv == -1)
99 fatal (IDS_DIALOG_FAILED); 110 fatal (IDS_DIALOG_FAILED);
100 111
101 log (0, "source: %s", 112 log (0, "source: %s",