annotate netinstall/source.cc @ 691:1df69dc58840

[xemacs-hg @ 2001-12-13 20:53:20 by wmperry] Fix strange 'floating gutter tab' bug.
author wmperry
date Thu, 13 Dec 2001 20:53:21 +0000
parents 685b588e92d8
children a307f9a2021d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
1 /*
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
2 * Copyright (c) 2000, Red Hat, Inc.
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
3 *
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
4 * This program is free software; you can redistribute it and/or modify
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
7 * (at your option) any later version.
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
8 *
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
9 * A copy of the GNU General Public License can be found at
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
10 * http://www.gnu.org/
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
11 *
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
12 * Written by DJ Delorie <dj@cygnus.com>
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
13 *
673
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 448
diff changeset
14 * Sync'ed with cinstall 2001-10-16
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
15 */
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
16
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
17 /* The purpose of this file is to manage the dialog box that lets the
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
18 user choose the source of the install - from the net, from the
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
19 current directory, or to just download files. */
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
20
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
21 #include "win32.h"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
22 #include <stdio.h>
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
23 #include "dialog.h"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
24 #include "resource.h"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
25 #include "state.h"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
26 #include "msg.h"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
27 #include "log.h"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
28
673
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 448
diff changeset
29 static int rb[] = { IDC_SOURCE_NETINST, IDC_SOURCE_DOWNLOAD, IDC_SOURCE_CWD, 0 };
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
30
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
31 static void
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
32 check_if_enable_next (HWND h)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
33 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
34 EnableWindow (GetDlgItem (h, IDOK), source ? 1 : 0);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
35 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
36
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
37 static void
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
38 load_dialog (HWND h)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
39 {
673
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 448
diff changeset
40 int i;
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
41 rbset (h, rb, source);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
42 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
43
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
44 static void
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
45 save_dialog (HWND h)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
46 {
673
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 448
diff changeset
47 int i;
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
48 source = rbget (h, rb);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
49 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
50
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
51 static BOOL
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
52 dialog_cmd (HWND h, int id, HWND hwndctl, UINT code)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
53 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
54 switch (id)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
55 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
56
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
57 case IDC_SOURCE_DOWNLOAD:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
58 case IDC_SOURCE_NETINST:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
59 case IDC_SOURCE_CWD:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
60 save_dialog (h);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
61 break;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
62
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
63 case IDOK:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
64 save_dialog (h);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
65 NEXT (IDD_LOCAL_DIR);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
66 break;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
67
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
68 case IDC_BACK:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
69 save_dialog (h);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
70 NEXT (0);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
71 break;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
72
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
73 case IDCANCEL:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
74 NEXT (0);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
75 break;
673
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 448
diff changeset
76
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 448
diff changeset
77 default:
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 448
diff changeset
78 break;
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
79 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
80 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
81
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
82 static BOOL CALLBACK
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
83 dialog_proc (HWND h, UINT message, WPARAM wParam, LPARAM lParam)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
84 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
85 switch (message)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
86 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
87 case WM_INITDIALOG:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
88 load_dialog (h);
673
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 448
diff changeset
89 // Check to see if any radio buttons are selected. If not, select a default.
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 448
diff changeset
90 if ((!SendMessage(GetDlgItem (h, IDC_SOURCE_DOWNLOAD), BM_GETCHECK, 0, 0) == BST_CHECKED)
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 448
diff changeset
91 && (!SendMessage(GetDlgItem (h, IDC_SOURCE_CWD), BM_GETCHECK, 0, 0) == BST_CHECKED))
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 448
diff changeset
92 {
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 448
diff changeset
93 SendMessage(GetDlgItem (h, IDC_SOURCE_NETINST), BM_SETCHECK, BST_CHECKED, 0);
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 448
diff changeset
94 }
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
95 return FALSE;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
96 case WM_COMMAND:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
97 return HANDLE_WM_COMMAND (h, wParam, lParam, dialog_cmd);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
98 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
99 return FALSE;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
100 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
101
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
102 void
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
103 do_source (HINSTANCE h)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
104 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
105 int rv = 0;
673
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 448
diff changeset
106 /* source = IDC_SOURCE_CWD;*/
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 448
diff changeset
107 source = IDC_SOURCE_NETINST;
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
108 rv = DialogBox (h, MAKEINTRESOURCE (IDD_SOURCE), 0, dialog_proc);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
109 if (rv == -1)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
110 fatal (IDS_DIALOG_FAILED);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
111
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
112 log (0, "source: %s",
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
113 (source == IDC_SOURCE_DOWNLOAD) ? "download" :
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
114 (source == IDC_SOURCE_NETINST) ? "network install" : "from cwd");
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
115 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
116