annotate netinstall/choose.cc @ 4709:db7068430402

Add explicit GPL v2 or later notices to Bill Perry's code, where such notices are missing. This is done with Bill Perry's stated permission, in private email to me.
author Jerry James <james@xemacs.org>
date Mon, 05 Oct 2009 11:08:59 -0600
parents ce0b3f2eff35
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
1 /*
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
2 * Copyright (c) 2000, Red Hat, Inc.
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
3 *
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
4 * This program is free software; you can redistribute it and/or modify
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
7 * (at your option) any later version.
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
8 *
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
9 * A copy of the GNU General Public License can be found at
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
10 * http://www.gnu.org/
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
11 *
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
12 * Written by DJ Delorie <dj@cygnus.com>
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
13 *
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
14 */
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
15
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
16 /* The purpose of this file is to let the user choose which packages
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
17 to install, and which versions of the package when more than one
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
18 version is provided. The "trust" level serves as an indication as
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
19 to which version should be the default choice. At the moment, all
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
20 we do is compare with previously installed packages to skip any
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
21 that are already installed (by setting the action to ACTION_SAME).
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
22 While the "trust" stuff is supported, it's not really implemented
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
23 yet. We always prefer the "current" option. In the future, this
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
24 file might have a user dialog added to let the user choose to not
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
25 install packages, or to install packages that aren't installed by
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
26 default. */
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
27
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
28 #include "win32.h"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
29 #include <stdio.h>
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
30 #include <stdlib.h>
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
31 #include <ctype.h>
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
32
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
33 #include "dialog.h"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
34 #include "resource.h"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
35 #include "state.h"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
36 #include "ini.h"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
37 #include "concat.h"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
38 #include "msg.h"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
39 #include "log.h"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
40 #include "find.h"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
41 #include "reginfo.h"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
42
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
43 #define HMARGIN 10
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
44 #define ROW_MARGIN 5
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
45 #define ICON_MARGIN 4
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
46
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
47 #define CHECK_SIZE 11
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
48
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
49 #define TRUST_KEEP 101
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
50 #define TRUST_UNINSTALL 102
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
51 #define TRUST_NONE 103
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
52
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
53 static int initialized = 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
54
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
55 static int full_list = 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
56
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
57 static int scroll_ulc_x, scroll_ulc_y;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
58
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
59 static HWND lv, nextbutton;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
60 static TEXTMETRIC tm;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
61 static int header_height;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
62 static HANDLE sysfont;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
63 static int row_height;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
64 static HANDLE bm_spin, bm_rtarrow, bm_checkyes, bm_checkno, bm_checkna;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
65 static HDC bitmap_dc;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
66
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
67 static struct {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
68 char *text;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
69 int slen;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
70 int width;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
71 int x;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
72 } headers[] = {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
73 { "Current", 7, 0, 0 },
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
74 #define CURRENT_COL 0
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
75 { "New", 3, 0, 0 },
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
76 #define NEW_COL 1
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
77 { "Src?", 4, 0, 0 },
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
78 #define SRC_COL 2
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
79 { "Package", 7, 0, 0 },
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
80 #define PACKAGE_COL 3
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
81 { 0, 0, 0, 0 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
82 };
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
83 #define NUM_COLUMNS (sizeof(headers)/(sizeof(headers[0]))-1)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
84
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
85 int *package_indexes, nindexes;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
86
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
87 struct ExtraPackageInfo {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
88 char *installed_file; /* filename of previous "install" file */
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
89 char *installed_ver; /* version part */
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
90 int installed_size; /* ditto, size. */
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
91
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
92 int in_partial_list;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
93 int pick;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
94 int npick;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
95 int which_is_installed; /* == TRUST* or -1 */
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
96
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
97 struct {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
98 int src_avail;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
99 int trust; /* may be keep or uninstall */
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
100 char *caption; /* ==0 at EOL */
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
101 } chooser[NTRUST+3]; /* one extra for NULL above */
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
102 };
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
103
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
104 static ExtraPackageInfo *extra;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
105
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
106 static void
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
107 paint (HWND hwnd)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
108 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
109 HDC hdc;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
110 PAINTSTRUCT ps;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
111 int x, y, i, ii;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
112
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
113 hdc = BeginPaint (hwnd, &ps);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
114
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
115 SelectObject (hdc, sysfont);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
116
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
117 RECT cr;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
118 GetClientRect (hwnd, &cr);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
119
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
120 POINT p;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
121
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
122 x = cr.left - scroll_ulc_x;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
123 y = cr.top - scroll_ulc_y + header_height;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
124
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
125
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
126 for (i=0; headers[i].text; i++)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
127 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
128 TextOut (hdc, x+headers[i].x, 3, headers[i].text, headers[i].slen);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
129 MoveToEx (hdc, x+headers[i].x, header_height-3, &p);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
130 LineTo (hdc, x+headers[i].x+headers[i].width, header_height-3);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
131 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
132
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
133 IntersectClipRect (hdc, cr.left, cr.top+header_height, cr.right, cr.bottom);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
134
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
135 for (ii=0; ii<nindexes; ii++)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
136 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
137 i = package_indexes[ii];
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
138 int r = y + ii * row_height;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
139 int by = r + tm.tmHeight - 11;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
140 if (extra[i].installed_ver && extra[i].installed_ver[0])
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
141 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
142 TextOut (hdc, x+headers[CURRENT_COL].x, r,
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
143 extra[i].installed_ver, strlen (extra[i].installed_ver));
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
144 SelectObject (bitmap_dc, bm_rtarrow);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
145 BitBlt (hdc, x+headers[CURRENT_COL].x+headers[0].width+ICON_MARGIN/2+HMARGIN/2, by,
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
146 11, 11, bitmap_dc, 0, 0, SRCCOPY);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
147 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
148
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
149 char *s = extra[i].chooser[extra[i].pick].caption;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
150 if (s)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
151 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
152 TextOut (hdc, x+headers[NEW_COL].x + 11 + ICON_MARGIN, r,
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
153 s, strlen (s));
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
154 if (extra[i].npick > 1)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
155 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
156 SelectObject (bitmap_dc, bm_spin);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
157 BitBlt (hdc, x+headers[NEW_COL].x, by, 11, 11,
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
158 bitmap_dc, 0, 0, SRCCOPY);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
159 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
160 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
161
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
162 HANDLE check_bm = bm_checkna;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
163 if (extra[i].chooser[extra[i].pick].src_avail)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
164 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
165 if (package[i].srcaction == SRCACTION_NO)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
166 check_bm = bm_checkno;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
167 else if (package[i].srcaction == SRCACTION_YES)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
168 check_bm = bm_checkyes;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
169 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
170 SelectObject (bitmap_dc, check_bm);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
171 BitBlt (hdc, x+headers[SRC_COL].x, by, 11, 11,
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
172 bitmap_dc, 0, 0, SRCCOPY);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
173
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
174 if (package[i].name)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
175 TextOut (hdc, x+headers[PACKAGE_COL].x, r, package[i].name, strlen(package[i].name));
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
176 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
177
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
178 if (nindexes == 0)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
179 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
180 static char *m = "Nothing to Install/Update";
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
181 TextOut (hdc, HMARGIN, header_height, m, strlen (m));
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
182 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
183
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
184 EndPaint (hwnd, &ps);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
185 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
186
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
187 static void
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
188 scroll_common (HWND hwnd, int which, int *var, int code)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
189 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
190 SCROLLINFO si;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
191 si.cbSize = sizeof (si);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
192 si.fMask = SIF_ALL;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
193 GetScrollInfo (hwnd, which, &si);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
194
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
195 switch (code)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
196 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
197 case SB_THUMBTRACK:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
198 si.nPos = si.nTrackPos;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
199 break;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
200 case SB_THUMBPOSITION:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
201 break;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
202 case SB_BOTTOM:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
203 si.nPos = si.nMax;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
204 break;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
205 case SB_TOP:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
206 si.nPos = 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
207 break;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
208 case SB_LINEDOWN:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
209 si.nPos += row_height;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
210 break;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
211 case SB_LINEUP:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
212 si.nPos -= row_height;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
213 break;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
214 case SB_PAGEDOWN:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
215 si.nPos += si.nPage * 9/10;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
216 break;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
217 case SB_PAGEUP:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
218 si.nPos -= si.nPage * 9/10;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
219 break;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
220 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
221
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
222 if ((int)si.nPos < 0)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
223 si.nPos = 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
224 if ((int)(si.nPos + si.nPage) > si.nMax)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
225 si.nPos = si.nMax - si.nPage;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
226
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
227 si.fMask = SIF_POS;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
228 SetScrollInfo (hwnd, which, &si, TRUE);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
229
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
230 int ox = scroll_ulc_x;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
231 int oy = scroll_ulc_y;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
232 *var = si.nPos;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
233
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
234 RECT cr, sr;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
235 GetClientRect (hwnd, &cr);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
236 sr = cr;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
237 sr.top += header_height;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
238 ScrollWindow (hwnd, ox - scroll_ulc_x, oy - scroll_ulc_y, &sr, &sr);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
239 sr.bottom = sr.top;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
240 sr.top = cr.top;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
241 ScrollWindow (hwnd, ox - scroll_ulc_x, 0, &sr, &sr);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
242 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
243
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
244 static LRESULT CALLBACK
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
245 list_vscroll (HWND hwnd, HWND hctl, UINT code, int pos)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
246 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
247 scroll_common (hwnd, SB_VERT, &scroll_ulc_y, code);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
248 return FALSE;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
249 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
250
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
251 static LRESULT CALLBACK
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
252 list_hscroll (HWND hwnd, HWND hctl, UINT code, int pos)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
253 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
254 scroll_common (hwnd, SB_HORZ, &scroll_ulc_x, code);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
255 return FALSE;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
256 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
257
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
258 static LRESULT CALLBACK
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
259 list_click (HWND hwnd, BOOL dblclk, int x, int y, UINT hitCode)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
260 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
261 int r;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
262
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
263 if (nindexes == 0)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
264 return 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
265
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
266 if (y < header_height)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
267 return 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
268 x += scroll_ulc_x;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
269 y += scroll_ulc_y - header_height;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
270
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
271 r = (y + ROW_MARGIN/2) / row_height;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
272
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
273 if (r < 0 || r >= npackages)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
274 return 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
275
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
276 int p = package_indexes[r];
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
277
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
278 if (x >= headers[NEW_COL].x - HMARGIN/2 && x <= headers[NEW_COL+1].x - HMARGIN/2)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
279 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
280 extra[p].pick ++;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
281 if (extra[p].chooser[extra[p].pick].caption == 0)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
282 extra[p].pick = 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
283 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
284
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
285 if (x >= headers[SRC_COL].x - HMARGIN/2 && x <= headers[SRC_COL+1].x - HMARGIN/2)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
286 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
287 if (extra[p].chooser[extra[p].pick].src_avail)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
288 package[p].srcaction ^= (SRCACTION_NO^SRCACTION_YES);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
289 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
290
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
291 RECT rect;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
292 rect.left = headers[NEW_COL].x - scroll_ulc_x;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
293 rect.right = headers[SRC_COL+1].x - scroll_ulc_x;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
294 rect.top = header_height + r * row_height - scroll_ulc_y;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
295 rect.bottom = rect.top + row_height;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
296 InvalidateRect (hwnd, &rect, TRUE);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
297 return FALSE;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
298 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
299
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
300 static LRESULT CALLBACK
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
301 listview_proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
302 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
303 switch (message) {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
304 case WM_HSCROLL:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
305 return HANDLE_WM_HSCROLL (hwnd, wParam, lParam, list_hscroll);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
306 case WM_VSCROLL:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
307 return HANDLE_WM_VSCROLL (hwnd, wParam, lParam, list_vscroll);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
308 case WM_LBUTTONDOWN:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
309 return HANDLE_WM_LBUTTONDOWN (hwnd, wParam, lParam, list_click);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
310 case WM_PAINT:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
311 paint (hwnd);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
312 return 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
313 default:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
314 return DefWindowProc (hwnd, message, wParam, lParam);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
315 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
316 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
317
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
318 static void
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
319 register_windows (HINSTANCE hinst)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
320 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
321 WNDCLASSEX wcex;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
322 static int done = 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
323
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
324 if (done)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
325 return;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
326 done = 1;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
327
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
328 memset (&wcex, 0, sizeof (wcex));
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
329 wcex.cbSize = sizeof (WNDCLASSEX);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
330 wcex.style = CS_HREDRAW | CS_VREDRAW;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
331 wcex.lpfnWndProc = listview_proc;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
332 wcex.hInstance = hinst;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
333 wcex.hIcon = LoadIcon (0, IDI_APPLICATION);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
334 wcex.hCursor = LoadCursor (0, IDC_ARROW);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
335 wcex.hbrBackground = (HBRUSH) (COLOR_WINDOW+1);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
336 wcex.lpszClassName = "listview";
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
337
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
338 RegisterClassEx (&wcex);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
339 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
340
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
341 static void
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
342 note_width (HDC dc, char *string, int addend, int column)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
343 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
344 if (!string)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
345 return;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
346 SIZE s;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
347 GetTextExtentPoint32 (dc, string, strlen (string), &s);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
348 if (headers[column].width < s.cx + addend)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
349 headers[column].width = s.cx + addend;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
350 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
351
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
352 static int
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
353 best_trust (int p, int trust)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
354 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
355 int t;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
356 for (t=trust; t>=0; t--)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
357 if (package[p].info[t].install)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
358 return t;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
359 for (t=trust+1; t<=NTRUST; t++)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
360 if (package[p].info[t].install)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
361 return t;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
362 if (extra[p].installed_file)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
363 return TRUST_KEEP;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
364 return TRUST_NONE;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
365 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
366
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
367 static void
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
368 default_trust (HWND h, int trust)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
369 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
370 int i, t, c;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
371
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
372 for (i=0; i<npackages; i++)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
373 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
374 t = best_trust (i, trust);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
375 extra[i].pick = 1;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
376 for (c=0; c<extra[i].npick; c++)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
377 if (t == extra[i].chooser[c].trust)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
378 extra[i].pick = c;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
379 if (install_type == IDC_INSTALL_NATIVE
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
380 && package[i].type == TY_CYGWIN
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
381 ||
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
382 install_type == IDC_INSTALL_CYGWIN
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
383 && package[i].type == TY_NATIVE)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
384 extra[i].pick = extra[i].npick -1;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
385 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
386 RECT r;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
387 GetClientRect (h, &r);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
388 InvalidateRect (h, &r, TRUE);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
389 if (nextbutton)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
390 SetFocus (nextbutton);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
391 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
392
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
393 static void
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
394 set_full_list (HWND h, int isfull)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
395 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
396 int i, j;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
397 full_list = isfull;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
398 if (package_indexes == 0)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
399 package_indexes = (int *) malloc (npackages * sizeof (int));
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
400 for (i=j=0; i<npackages; i++)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
401 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
402 if (isfull || extra[i].in_partial_list)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
403 package_indexes[j++] = i;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
404 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
405 nindexes = j;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
406
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
407 RECT r;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
408 GetClientRect (h, &r);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
409 SCROLLINFO si;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
410 memset (&si, 0, sizeof (si));
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
411 si.cbSize = sizeof (si);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
412 si.fMask = SIF_ALL;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
413 si.nMin = 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
414 si.nMax = headers[2].x + headers[2].width + HMARGIN;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
415 si.nPage = r.right;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
416 SetScrollInfo (h, SB_HORZ, &si, TRUE);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
417
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
418 si.nMax = nindexes * row_height;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
419 si.nPage = r.bottom - header_height;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
420 SetScrollInfo (h, SB_VERT, &si, TRUE);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
421
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
422 scroll_ulc_x = scroll_ulc_y = 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
423
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
424 InvalidateRect (h, &r, TRUE);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
425
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
426 if (nextbutton)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
427 SetFocus (nextbutton);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
428 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
429
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
430 static void
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
431 build_labels ()
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
432 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
433 int i;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
434 for (i=0; i<npackages; i++)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
435 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
436 int c = 0, t;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
437
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
438 #define C extra[i].chooser[c]
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
439 if (extra[i].installed_ver)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
440 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
441 C.caption = "Uninstall";
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
442 C.trust = TRUST_UNINSTALL;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
443 c++;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
444 C.caption = "Keep";
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
445 C.trust = TRUST_KEEP;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
446 c++;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
447 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
449 for (t=TRUST_PREV; t<NTRUST; t++)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
450 if (package[i].info[t].install)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
451 if (t != extra[i].which_is_installed)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
452 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
453 C.caption = package[i].info[t].version;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
454 if (C.caption == 0 || C.caption[0] == 0)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
455 C.caption = "0.0";
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
456 C.trust = t;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
457 if (package[i].info[t].source)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
458 C.src_avail = 1;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
459 c++;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
460 /* we intentionally skip TRUST_PREV */
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
461 if (t != TRUST_PREV || !extra[i].installed_ver)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
462 extra[i].in_partial_list = 1;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
463
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
464 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
465
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
466 if (c == 0)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
467 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
468 C.caption = "N/A";
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
469 C.trust = TRUST_NONE;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
470 c++;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
471 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
472
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
473 if (! extra[i].installed_file)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
474 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
475 C.caption = "Skip";
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
476 C.trust = TRUST_NONE;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
477 c++;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
478 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
479
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
480 C.caption = 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
481 extra[i].npick = c;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
482 #undef C
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
483 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
484 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
485
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
486 static void
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
487 create_listview (HWND dlg, RECT *r)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
488 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
489 int i, t;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
490 lv = CreateWindowEx (WS_EX_CLIENTEDGE,
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
491 "listview",
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
492 "listviewwindow",
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
493 WS_CHILD | WS_HSCROLL | WS_VSCROLL | WS_VISIBLE,
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
494 r->left, r->top,
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
495 r->right-r->left+1, r->bottom-r->top+1,
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
496 dlg,
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
497 NULL, // ??? MAKEINTRESOURCE(IDC_CHOOSE_LIST),
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
498 hinstance,
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
499 0);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
500 ShowWindow (lv, SW_SHOW);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
501
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
502 for (i=0; headers[i].text; i++)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
503 headers[i].width = 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
504
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
505 HDC dc = GetDC (lv);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
506 sysfont = GetStockObject (DEFAULT_GUI_FONT);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
507 SelectObject (dc, sysfont);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
508 GetTextMetrics (dc, &tm);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
509 header_height = tm.tmHeight + 5 + 3;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
510
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
511 bitmap_dc = CreateCompatibleDC (dc);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
512
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
513 row_height = (tm.tmHeight + tm.tmExternalLeading + ROW_MARGIN);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
514 int irh = tm.tmExternalLeading + tm.tmDescent + 11 + ROW_MARGIN;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
515 if (row_height < irh)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
516 row_height = irh;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
517
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
518 for (i=0; headers[i].text; i++)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
519 note_width (dc, headers[i].text, 0, i);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
520 for (i=0; i<npackages; i++)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
521 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
522 note_width (dc, extra[i].installed_ver, 0, CURRENT_COL);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
523 note_width (dc, extra[i].installed_ver, 11+ICON_MARGIN, NEW_COL);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
524 for (t=0; t<NTRUST; t++)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
525 note_width (dc, package[i].info[t].version, 11+ICON_MARGIN, NEW_COL);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
526 note_width (dc, package[i].name, 0, PACKAGE_COL);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
527 note_width (dc, package[i].sdesc, 0, PACKAGE_COL);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
528 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
529 note_width (dc, "keep", 11+ICON_MARGIN, NEW_COL);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
530 note_width (dc, "uninstall", 11+ICON_MARGIN, NEW_COL);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
531
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
532 headers[CURRENT_COL].x = HMARGIN/2;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
533 headers[NEW_COL].x = (headers[CURRENT_COL].x + headers[CURRENT_COL].width
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
534 + HMARGIN + 11 + ICON_MARGIN);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
535 headers[SRC_COL].x = headers[NEW_COL].x + headers[NEW_COL].width + HMARGIN;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
536 headers[PACKAGE_COL].x = headers[SRC_COL].x + headers[SRC_COL].width + HMARGIN;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
537
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
538 set_full_list (lv, full_list);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
539 default_trust (lv, TRUST_CURR);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
540
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
541 ReleaseDC (lv, dc);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
542 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
543
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
544 static BOOL
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
545 dialog_cmd (HWND h, int id, HWND hwndctl, UINT code)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
546 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
547 switch (id)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
548 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
549
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
550 case IDC_CHOOSE_PREV:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
551 default_trust (lv, TRUST_PREV);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
552 break;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
553 case IDC_CHOOSE_CURR:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
554 default_trust (lv, TRUST_CURR);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
555 break;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
556 case IDC_CHOOSE_EXP:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
557 default_trust (lv, TRUST_TEST);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
558 break;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
559 case IDC_CHOOSE_FULLPART:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
560 set_full_list (lv, !full_list);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
561 break;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
562
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
563 case IDOK:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
564 if (source == IDC_SOURCE_CWD)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
565 NEXT (IDD_S_INSTALL);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
566 else
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
567 NEXT (IDD_S_DOWNLOAD);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
568 break;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
569
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
570 case IDC_BACK:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
571 initialized = 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
572 if (source == IDC_SOURCE_CWD)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
573 NEXT (IDD_ROOT);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
574 else
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
575 NEXT (IDD_SITE);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
576 break;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
577
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
578 case IDCANCEL:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
579 NEXT (0);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
580 break;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
581 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
582 return FALSE;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
583 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
584
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
585 static void
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
586 GetParentRect (HWND parent, HWND child, RECT *r)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
587 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
588 POINT p;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
589 GetWindowRect (child, r);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
590 p.x = r->left;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
591 p.y = r->top;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
592 ScreenToClient (parent, &p);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
593 r->left = p.x;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
594 r->top = p.y;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
595 p.x = r->right;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
596 p.y = r->bottom;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
597 ScreenToClient (parent, &p);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
598 r->right = p.x;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
599 r->bottom = p.y;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
600 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
601
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
602 static BOOL CALLBACK
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
603 dialog_proc (HWND h, UINT message, WPARAM wParam, LPARAM lParam)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
604 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
605 HWND frame;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
606 RECT r;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
607 switch (message)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
608 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
609 case WM_INITDIALOG:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
610 nextbutton = GetDlgItem (h, IDOK);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
611 frame = GetDlgItem (h, IDC_LISTVIEW_POS);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
612 GetParentRect (h, frame, &r);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
613 r.top += 2;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
614 r.bottom -= 2;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
615 create_listview (h, &r);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
616 #if 0
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
617 load_dialog (h);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
618 #endif
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
619 return FALSE;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
620 case WM_COMMAND:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
621 return HANDLE_WM_COMMAND (h, wParam, lParam, dialog_cmd);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
622 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
623 return FALSE;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
624 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
625
657
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents: 448
diff changeset
626 char *
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
627 base (char *s)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
628 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
629 if (!s)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
630 return 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
631 char *rv = s;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
632 while (*s)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
633 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
634 if ((*s == '/' || *s == ':' || *s == '\\') && s[1])
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
635 rv = s+1;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
636 s++;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
637 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
638 return rv;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
639 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
640
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
641 static void
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
642 scan2 (char *path, unsigned int size)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
643 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
644 int i, t;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
645 for (i=0; i<npackages; i++)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
646 for (t=0; t<NTRUST; t++)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
647 if (package[i].info[t].install
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
648 && strcmp (base (package[i].info[t].install), base (path)) == 0
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
649 && package[i].info[t].install_size == (int)size)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
650 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
651 extra[i].installed_file = package[i].info[t].install;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
652 extra[i].installed_size = size;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
653 extra[i].which_is_installed = t;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
654 extra[i].installed_ver = package[i].info[t].version;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
655 if (!extra[i].installed_ver)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
656 extra[i].installed_ver = "0";
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
657 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
658 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
659
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
660 static void
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
661 scan_downloaded_files ()
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
662 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
663 find (".", scan2);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
664 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
665
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
666 static void
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
667 read_installed_db ()
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
668 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
669 int i;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
670 if (!root_dir)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
671 return;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
672
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
673 char line[1000], pkg[1000], inst[1000], src[1000];
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
674 int instsz, srcsz;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
675
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
676 FILE *db = fopen (concat (root_dir, XEMACS_SETUP_DIR, "installed.db", 0), "rt");
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
677 if (!db)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
678 return;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
679
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
680 while (fgets (line, 1000, db))
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
681 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
682 src[0] = 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
683 srcsz = 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
684 sscanf (line, "%s %s %d %s %d", pkg, inst, &instsz, src, &srcsz);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
685
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
686 for (i=0; i<npackages; i++)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
687 if (strcmp (package[i].name, pkg) == 0)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
688 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
689 int t;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
690 extra[i].installed_file = inst;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
691 extra[i].installed_size = instsz;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
692
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
693 for (t=0; t<NTRUST; t++)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
694 if (package[i].info[t].install
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
695 && strcmp (base (package[i].info[t].install), base (inst)) == 0)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
696 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
697 extra[i].which_is_installed = t;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
698 extra[i].installed_ver = package[i].info[t].version;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
699 break;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
700 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
701
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
702 if (extra[i].installed_ver == 0) /* still */
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
703 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
704 char *v, *d;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
705 for (v=base (inst); *v; v++)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
706 if (*v == '-' && isdigit(v[1]))
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
707 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
708 v++;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
709 break;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
710 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
711 if (!v)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
712 v = inst;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
713 for (d=v; *d; d++)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
714 if (strncmp (d, ".tar", 4) == 0
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
715 || strncmp (d, "-pkg", 4) == 0)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
716 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
717 *d = 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
718 break;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
719 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
720 if (v[0])
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
721 extra[i].installed_ver = strdup (v);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
722 else
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
723 extra[i].installed_ver = "0";
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
724 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
725 break;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
726 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
727 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
728 fclose (db);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
729 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
730
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
731 int CDECL
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
732 package_sort (const void *va, const void *vb)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
733 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
734 Package *a = (Package *)va;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
735 Package *b = (Package *)vb;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
736 return strcmp (a->name, b->name);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
737 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
738
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
739 void
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
740 do_choose (HINSTANCE h)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
741 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
742 int rv, i;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
743
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
744 qsort (package, npackages, sizeof (package[0]), package_sort);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
745
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
746 nextbutton = 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
747 bm_spin = LoadImage (h, MAKEINTRESOURCE (IDB_SPIN), IMAGE_BITMAP, 0, 0, 0);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
748 bm_rtarrow = LoadImage (h, MAKEINTRESOURCE (IDB_RTARROW), IMAGE_BITMAP, 0, 0, 0);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
749
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
750 bm_checkyes = LoadImage (h, MAKEINTRESOURCE (IDB_CHECK_YES), IMAGE_BITMAP, 0, 0, 0);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
751 bm_checkno = LoadImage (h, MAKEINTRESOURCE (IDB_CHECK_NO), IMAGE_BITMAP, 0, 0, 0);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
752 bm_checkna = LoadImage (h, MAKEINTRESOURCE (IDB_CHECK_NA), IMAGE_BITMAP, 0, 0, 0);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
753
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
754 extra = (ExtraPackageInfo *) malloc (npackages * sizeof (ExtraPackageInfo));
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
755 memset (extra, 0, npackages * sizeof (ExtraPackageInfo));
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
756 for (i=0; i<npackages; i++)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
757 extra[i].which_is_installed = -1;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
758
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
759 register_windows (h);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
760
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
761 if (source == IDC_SOURCE_DOWNLOAD)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
762 scan_downloaded_files ();
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
763 else
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
764 read_installed_db ();
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
765 build_labels ();
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
766
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
767 rv = DialogBox (h, MAKEINTRESOURCE (IDD_CHOOSE), 0, dialog_proc);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
768 if (rv == -1)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
769 fatal (IDS_DIALOG_FAILED);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
770
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
771 for (i=0; i<npackages; i++)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
772 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
773 switch (extra[i].chooser[extra[i].pick].trust)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
774 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
775 case TRUST_PREV:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
776 case TRUST_CURR:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
777 case TRUST_TEST:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
778 if (extra[i].installed_file)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
779 package[i].action = ACTION_UPGRADE;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
780 else
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
781 package[i].action = ACTION_NEW;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
782 package[i].trust = extra[i].chooser[extra[i].pick].trust;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
783 // pick up the actual core package to install
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
784 if (package[i].type == TY_CYGWIN || package[i].type == TY_NATIVE
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
785 && xemacs_package == 0)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
786 xemacs_package = &package[i];
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
787 break;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
788
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
789 case TRUST_UNINSTALL:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
790 package[i].action = ACTION_UNINSTALL;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
791 break;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
792
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
793 case TRUST_KEEP:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
794 case TRUST_NONE:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
795 default:
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
796 package[i].action = ACTION_SAME;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
797 break;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
798 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
799 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
800
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
801 log (LOG_BABBLE, "Chooser results...");
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
802 for (i=0; i<npackages; i++)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
803 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
804 static char *infos[] = {"prev", "curr", "test"};
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
805 const char *trust = ((package[i].trust == TRUST_PREV) ? "prev"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
806 : (package[i].trust == TRUST_CURR) ? "curr"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
807 : (package[i].trust == TRUST_TEST) ? "test"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
808 : "unknown");
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
809 const char *action = ((package[i].action == ACTION_UNKNOWN) ? "unknown"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
810 : (package[i].action == ACTION_SAME) ? "same"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
811 : (package[i].action == ACTION_NEW) ? "new"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
812 : (package[i].action == ACTION_UPGRADE) ? "upgrade"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
813 : (package[i].action == ACTION_UNINSTALL) ? "uninstall"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
814 : (package[i].action == ACTION_ERROR) ? "error"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
815 : "unknown");
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
816
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
817 log (LOG_BABBLE, "[%s] action=%s trust=%s src? %s", package[i].name, action, trust,
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
818 package[i].srcaction == SRCACTION_NO ? "no" : "yes");
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
819 for (int t=0; t<NTRUST; t++)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
820 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
821 if (package[i].info[t].install)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
822 log (LOG_BABBLE, "[%s] ver %s inst %s %d src %s %d",
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
823 infos[t],
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
824 package[i].info[t].version ? package[i].info[t].version : "(none)",
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
825 package[i].info[t].install ? package[i].info[t].install : "(none)",
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
826 package[i].info[t].install_size,
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
827 package[i].info[t].source ? package[i].info[t].source : "(none)",
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
828 package[i].info[t].source_size);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
829 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
830 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
831 }