]> cygwin.com Git - cygwin-apps/setup.git/blame - source.cc
2001-12-22 Gary R. Van Sickle <g.r.vansickle@worldnet.att.net>
[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
b24c88b3
RC
20#if 0
21static const char *cvsid =
22 "\n%%% $Id$\n";
23#endif
8507f105 24
23c9e63c
DD
25#include "win32.h"
26#include <stdio.h>
27#include "dialog.h"
28#include "resource.h"
29#include "state.h"
30#include "msg.h"
89b1a15b 31#include "log.h"
cbfc4215 32#include "package_db.h"
23c9e63c 33
ab57ceaa
RC
34#include "source.h"
35
b24c88b3
RC
36static int rb[] =
37 { IDC_SOURCE_NETINST, IDC_SOURCE_DOWNLOAD, IDC_SOURCE_CWD, 0 };
23c9e63c
DD
38
39static void
40load_dialog (HWND h)
41{
23c9e63c 42 rbset (h, rb, source);
23c9e63c
DD
43}
44
45static void
46save_dialog (HWND h)
47{
23c9e63c 48 source = rbget (h, rb);
cbfc4215 49 packagedb db;
ab57ceaa
RC
50 db.task =
51 source == IDC_SOURCE_DOWNLOAD ? PackageDB_Download : PackageDB_Install;
23c9e63c
DD
52}
53
54static BOOL
55dialog_cmd (HWND h, int id, HWND hwndctl, UINT code)
56{
57 switch (id)
58 {
59
60 case IDC_SOURCE_DOWNLOAD:
61 case IDC_SOURCE_NETINST:
62 case IDC_SOURCE_CWD:
63 save_dialog (h);
23c9e63c
DD
64 break;
65
8a09aa99
CF
66 default:
67 break;
23c9e63c 68 }
b24c88b3 69 return 0;
23c9e63c
DD
70}
71
ab57ceaa
RC
72bool
73SourcePage::Create ()
23c9e63c 74{
ab57ceaa 75 return PropertyPage::Create (NULL, dialog_cmd, IDD_SOURCE);
23c9e63c
DD
76}
77
78void
ab57ceaa 79SourcePage::OnActivate ()
23c9e63c 80{
2db33f10
RC
81 if (!source)
82 source = IDC_SOURCE_NETINST;
ab57ceaa
RC
83 load_dialog (GetHWND ());
84 // Check to see if any radio buttons are selected. If not, select a default.
85 if ((!SendMessage
86 (GetDlgItem (IDC_SOURCE_DOWNLOAD), BM_GETCHECK, 0,
87 0) == BST_CHECKED)
88 && (!SendMessage (GetDlgItem (IDC_SOURCE_CWD), BM_GETCHECK, 0, 0)
89 == BST_CHECKED))
90 {
91 SendMessage (GetDlgItem (IDC_SOURCE_NETINST), BM_SETCHECK,
92 BST_CHECKED, 0);
93 }
94}
89b1a15b 95
ab57ceaa
RC
96long
97SourcePage::OnNext ()
98{
99 HWND h = GetHWND ();
100
101 save_dialog (h);
102 if (source == IDC_SOURCE_DOWNLOAD)
103 {
104 // If all we're doing is downloading,skip the root directory page
105 return IDD_LOCAL_DIR;
106 }
107
108 return 0;
109}
110
111long
112SourcePage::OnBack ()
113{
114 save_dialog (GetHWND ());
115 return 0;
116}
117
118void
119SourcePage::OnDeactivate ()
120{
89b1a15b
DD
121 log (0, "source: %s",
122 (source == IDC_SOURCE_DOWNLOAD) ? "download" :
123 (source == IDC_SOURCE_NETINST) ? "network install" : "from cwd");
23c9e63c 124}
This page took 0.042233 seconds and 5 git commands to generate.