]> cygwin.com Git - cygwin-apps/setup.git/blame - source.cc
* coding standards fixups, many files
[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
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
28static int rb[] = { IDC_SOURCE_DOWNLOAD, IDC_SOURCE_NETINST, IDC_SOURCE_CWD, 0 };
29
30static void
31check_if_enable_next (HWND h)
32{
33 EnableWindow (GetDlgItem (h, IDOK), source ? 1 : 0);
34}
35
36static void
37load_dialog (HWND h)
38{
39 int i;
40 rbset (h, rb, source);
41 check_if_enable_next (h);
42}
43
44static void
45save_dialog (HWND h)
46{
47 int i;
48 source = rbget (h, rb);
49}
50
51static BOOL
52dialog_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:
1fd6d0a2 65 save_dialog (h);
23c9e63c
DD
66 switch (source)
67 {
68 case IDC_SOURCE_DOWNLOAD:
1fd6d0a2 69 NEXT (IDD_NET);
23c9e63c
DD
70 break;
71 case IDC_SOURCE_NETINST:
72 case IDC_SOURCE_CWD:
1fd6d0a2 73 NEXT (IDD_ROOT);
23c9e63c
DD
74 break;
75 }
76 break;
77
78 case IDC_BACK:
1fd6d0a2
DD
79 save_dialog (h);
80 NEXT (0);
23c9e63c
DD
81 break;
82
83 case IDCANCEL:
1fd6d0a2 84 NEXT (0);
23c9e63c
DD
85 break;
86 }
87}
88
89static BOOL CALLBACK
90dialog_proc (HWND h, UINT message, WPARAM wParam, LPARAM lParam)
91{
92 switch (message)
93 {
94 case WM_INITDIALOG:
1fd6d0a2 95 load_dialog (h);
23c9e63c
DD
96 return FALSE;
97 case WM_COMMAND:
1fd6d0a2 98 return HANDLE_WM_COMMAND (h, wParam, lParam, dialog_cmd);
23c9e63c
DD
99 }
100 return FALSE;
101}
102
103void
104do_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.034599 seconds and 5 git commands to generate.