]> cygwin.com Git - cygwin-apps/setup.git/blame - source.cc
* localdir.cc: new, local package directory selection dialog; cd
[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"
89b1a15b 28#include "log.h"
23c9e63c
DD
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);
c92e1307 68 NEXT (IDD_LOCAL_DIR);
23c9e63c
DD
69 break;
70
71 case IDC_BACK:
1fd6d0a2
DD
72 save_dialog (h);
73 NEXT (0);
23c9e63c
DD
74 break;
75
76 case IDCANCEL:
1fd6d0a2 77 NEXT (0);
23c9e63c
DD
78 break;
79 }
80}
81
82static BOOL CALLBACK
83dialog_proc (HWND h, UINT message, WPARAM wParam, LPARAM lParam)
84{
85 switch (message)
86 {
87 case WM_INITDIALOG:
1fd6d0a2 88 load_dialog (h);
23c9e63c
DD
89 return FALSE;
90 case WM_COMMAND:
1fd6d0a2 91 return HANDLE_WM_COMMAND (h, wParam, lParam, dialog_cmd);
23c9e63c
DD
92 }
93 return FALSE;
94}
95
96void
97do_source (HINSTANCE h)
98{
99 int rv = 0;
100 rv = DialogBox (h, MAKEINTRESOURCE (IDD_SOURCE), 0, dialog_proc);
101 if (rv == -1)
102 fatal (IDS_DIALOG_FAILED);
89b1a15b
DD
103
104 log (0, "source: %s",
105 (source == IDC_SOURCE_DOWNLOAD) ? "download" :
106 (source == IDC_SOURCE_NETINST) ? "network install" : "from cwd");
23c9e63c
DD
107}
108
This page took 0.033282 seconds and 5 git commands to generate.