annotate netinstall/source.cc @ 5591:c40d3f96af55 g++-warning-removal-2008-10-28

Close branch.
author Stephen J. Turnbull <stephen@xemacs.org>
date Sat, 29 Oct 2011 17:08:32 +0900
parents a307f9a2021d
children
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 load_dialog (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 rbset (h, rb, source);
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 save_dialog (HWND h)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
39 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
40 source = rbget (h, rb);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
41 }
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 static BOOL
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
44 dialog_cmd (HWND h, int id, HWND hwndctl, UINT code)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
45 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
46 switch (id)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
47 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
48
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
49 case IDC_SOURCE_DOWNLOAD:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
50 case IDC_SOURCE_NETINST:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
51 case IDC_SOURCE_CWD:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
52 save_dialog (h);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
53 break;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
54
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
55 case IDOK:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
56 save_dialog (h);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
57 NEXT (IDD_LOCAL_DIR);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
58 break;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
59
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
60 case IDC_BACK:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
61 save_dialog (h);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
62 NEXT (0);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
63 break;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
64
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
65 case IDCANCEL:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
66 NEXT (0);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
67 break;
673
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 448
diff changeset
68
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 448
diff changeset
69 default:
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 448
diff changeset
70 break;
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
71 }
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
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
74 static BOOL CALLBACK
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
75 dialog_proc (HWND h, UINT message, WPARAM wParam, LPARAM lParam)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
76 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
77 switch (message)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
78 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
79 case WM_INITDIALOG:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
80 load_dialog (h);
673
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 448
diff changeset
81 // 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
82 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
83 && (!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
84 {
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 448
diff changeset
85 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
86 }
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
87 return FALSE;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
88 case WM_COMMAND:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
89 return HANDLE_WM_COMMAND (h, wParam, lParam, dialog_cmd);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
90 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
91 return FALSE;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
92 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
93
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
94 void
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
95 do_source (HINSTANCE h)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
96 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
97 int rv = 0;
673
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 448
diff changeset
98 /* source = IDC_SOURCE_CWD;*/
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 448
diff changeset
99 source = IDC_SOURCE_NETINST;
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
100 rv = DialogBox (h, MAKEINTRESOURCE (IDD_SOURCE), 0, dialog_proc);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
101 if (rv == -1)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
102 fatal (IDS_DIALOG_FAILED);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
103
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
104 log (0, "source: %s",
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
105 (source == IDC_SOURCE_DOWNLOAD) ? "download" :
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
106 (source == IDC_SOURCE_NETINST) ? "network install" : "from cwd");
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
107 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
108