annotate netinstall/source.cc @ 555:93749ba3e629

[xemacs-hg @ 2001-05-21 08:07:13 by yoshiki] Karl M. Hegbloom's patch "[cus-edit.el] Edit faces: Support GTK Window System also.", <87d7bdfwxw.fsf@microsharp.com> * cus-edit.el (custom-display): Support the GTK Window System also.
author yoshiki
date Mon, 21 May 2001 08:07:14 +0000
parents 3078fd1074e8
children 685b588e92d8
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 *
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
14 */
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 /* 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
17 user choose the source of the install - from the net, from the
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
18 current directory, or to just download files. */
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
19
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
20 #include "win32.h"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
21 #include <stdio.h>
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
22 #include "dialog.h"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
23 #include "resource.h"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
24 #include "state.h"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
25 #include "msg.h"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
26 #include "log.h"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
27
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
28 static int rb[] = { IDC_SOURCE_DOWNLOAD, IDC_SOURCE_NETINST, IDC_SOURCE_CWD, 0 };
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
29
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
30 static void
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
31 check_if_enable_next (HWND h)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
32 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
33 EnableWindow (GetDlgItem (h, IDOK), source ? 1 : 0);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
34 }
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 static void
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
37 load_dialog (HWND h)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
38 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
39 rbset (h, rb, source);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
40 check_if_enable_next (h);
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 void
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
44 save_dialog (HWND h)
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 source = rbget (h, rb);
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 static BOOL
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
50 dialog_cmd (HWND h, int id, HWND hwndctl, UINT code)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
51 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
52 switch (id)
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
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
55 case IDC_SOURCE_DOWNLOAD:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
56 case IDC_SOURCE_NETINST:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
57 case IDC_SOURCE_CWD:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
58 save_dialog (h);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
59 check_if_enable_next (h);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
60 break;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
61
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
62 case IDOK:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
63 save_dialog (h);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
64 NEXT (IDD_LOCAL_DIR);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
65 break;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
66
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
67 case IDC_BACK:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
68 save_dialog (h);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
69 NEXT (0);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
70 break;
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 case IDCANCEL:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
73 NEXT (0);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
74 break;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
75 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
76 return FALSE;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
77 }
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 static BOOL CALLBACK
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
80 dialog_proc (HWND h, UINT message, WPARAM wParam, LPARAM lParam)
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 switch (message)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
83 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
84 case WM_INITDIALOG:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
85 load_dialog (h);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
86 return FALSE;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
87 case WM_COMMAND:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
88 return HANDLE_WM_COMMAND (h, wParam, lParam, dialog_cmd);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
89 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
90 return FALSE;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
91 }
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 void
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
94 do_source (HINSTANCE h)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
95 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
96 int rv = 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
97 rv = DialogBox (h, MAKEINTRESOURCE (IDD_SOURCE), 0, dialog_proc);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
98 if (rv == -1)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
99 fatal (IDS_DIALOG_FAILED);
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 log (0, "source: %s",
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
102 (source == IDC_SOURCE_DOWNLOAD) ? "download" :
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
103 (source == IDC_SOURCE_NETINST) ? "network install" : "from cwd");
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