]> cygwin.com Git - cygwin-apps/setup.git/blame - source.cc
* (all): add cvsid tags
[cygwin-apps/setup.git] / source.cc
CommitLineData
23c9e63c
DD
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
8507f105
DD
20static char *cvsid = "\n%%% $Id$\n";
21
23c9e63c
DD
22#include "win32.h"
23#include <stdio.h>
24#include "dialog.h"
25#include "resource.h"
26#include "state.h"
27#include "msg.h"
28
29
30static int rb[] = { IDC_SOURCE_DOWNLOAD, IDC_SOURCE_NETINST, IDC_SOURCE_CWD, 0 };
31
32static void
33check_if_enable_next (HWND h)
34{
35 EnableWindow (GetDlgItem (h, IDOK), source ? 1 : 0);
36}
37
38static void
39load_dialog (HWND h)
40{
41 int i;
42 rbset (h, rb, source);
43 check_if_enable_next (h);
44}
45
46static void
47save_dialog (HWND h)
48{
49 int i;
50 source = rbget (h, rb);
51}
52
53static BOOL
54dialog_cmd (HWND h, int id, HWND hwndctl, UINT code)
55{
56 switch (id)
57 {
58
59 case IDC_SOURCE_DOWNLOAD:
60 case IDC_SOURCE_NETINST:
61 case IDC_SOURCE_CWD:
62 save_dialog (h);
63 check_if_enable_next (h);
64 break;
65
66 case IDOK:
1fd6d0a2 67 save_dialog (h);
23c9e63c
DD
68 switch (source)
69 {
70 case IDC_SOURCE_DOWNLOAD:
1fd6d0a2 71 NEXT (IDD_NET);
23c9e63c
DD
72 break;
73 case IDC_SOURCE_NETINST:
74 case IDC_SOURCE_CWD:
1fd6d0a2 75 NEXT (IDD_ROOT);
23c9e63c
DD
76 break;
77 }
78 break;
79
80 case IDC_BACK:
1fd6d0a2
DD
81 save_dialog (h);
82 NEXT (0);
23c9e63c
DD
83 break;
84
85 case IDCANCEL:
1fd6d0a2 86 NEXT (0);
23c9e63c
DD
87 break;
88 }
89}
90
91static BOOL CALLBACK
92dialog_proc (HWND h, UINT message, WPARAM wParam, LPARAM lParam)
93{
94 switch (message)
95 {
96 case WM_INITDIALOG:
1fd6d0a2 97 load_dialog (h);
23c9e63c
DD
98 return FALSE;
99 case WM_COMMAND:
1fd6d0a2 100 return HANDLE_WM_COMMAND (h, wParam, lParam, dialog_cmd);
23c9e63c
DD
101 }
102 return FALSE;
103}
104
105void
106do_source (HINSTANCE h)
107{
108 int rv = 0;
109 rv = DialogBox (h, MAKEINTRESOURCE (IDD_SOURCE), 0, dialog_proc);
110 if (rv == -1)
111 fatal (IDS_DIALOG_FAILED);
112}
113
This page took 0.03265 seconds and 5 git commands to generate.