]> cygwin.com Git - cygwin-apps/setup.git/blob - source.cc
* coding standards fixups, many files
[cygwin-apps/setup.git] / source.cc
1 /*
2 * Copyright (c) 2000, Red Hat, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * A copy of the GNU General Public License can be found at
10 * http://www.gnu.org/
11 *
12 * Written by DJ Delorie <dj@cygnus.com>
13 *
14 */
15
16 /* 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 current directory, or to just download files. */
19
20 #include "win32.h"
21 #include <stdio.h>
22 #include "dialog.h"
23 #include "resource.h"
24 #include "state.h"
25 #include "msg.h"
26
27
28 static int rb[] = { IDC_SOURCE_DOWNLOAD, IDC_SOURCE_NETINST, IDC_SOURCE_CWD, 0 };
29
30 static void
31 check_if_enable_next (HWND h)
32 {
33 EnableWindow (GetDlgItem (h, IDOK), source ? 1 : 0);
34 }
35
36 static void
37 load_dialog (HWND h)
38 {
39 int i;
40 rbset (h, rb, source);
41 check_if_enable_next (h);
42 }
43
44 static void
45 save_dialog (HWND h)
46 {
47 int i;
48 source = rbget (h, rb);
49 }
50
51 static BOOL
52 dialog_cmd (HWND h, int id, HWND hwndctl, UINT code)
53 {
54 switch (id)
55 {
56
57 case IDC_SOURCE_DOWNLOAD:
58 case IDC_SOURCE_NETINST:
59 case IDC_SOURCE_CWD:
60 save_dialog (h);
61 check_if_enable_next (h);
62 break;
63
64 case IDOK:
65 save_dialog (h);
66 switch (source)
67 {
68 case IDC_SOURCE_DOWNLOAD:
69 NEXT (IDD_NET);
70 break;
71 case IDC_SOURCE_NETINST:
72 case IDC_SOURCE_CWD:
73 NEXT (IDD_ROOT);
74 break;
75 }
76 break;
77
78 case IDC_BACK:
79 save_dialog (h);
80 NEXT (0);
81 break;
82
83 case IDCANCEL:
84 NEXT (0);
85 break;
86 }
87 }
88
89 static BOOL CALLBACK
90 dialog_proc (HWND h, UINT message, WPARAM wParam, LPARAM lParam)
91 {
92 switch (message)
93 {
94 case WM_INITDIALOG:
95 load_dialog (h);
96 return FALSE;
97 case WM_COMMAND:
98 return HANDLE_WM_COMMAND (h, wParam, lParam, dialog_cmd);
99 }
100 return FALSE;
101 }
102
103 void
104 do_source (HINSTANCE h)
105 {
106 int rv = 0;
107 rv = DialogBox (h, MAKEINTRESOURCE (IDD_SOURCE), 0, dialog_proc);
108 if (rv == -1)
109 fatal (IDS_DIALOG_FAILED);
110 }
111
This page took 0.039771 seconds and 5 git commands to generate.