]>
Commit | Line | Data |
---|---|---|
ab57ceaa RC |
1 | ? ar |
2 | ? copyandspawn.cc | |
3 | ? foo.patch | |
4 | ? Guidelines.txt | |
5 | ? io_stream-net_latest.diff | |
6 | ? io_stream-net_latest_Makefile.in.diff | |
7 | ? pavel20011206.patch | |
8 | ? Proprety.patch | |
9 | ? replaceself.patch | |
10 | ? setupfix.patch | |
11 | ? URLParser.cc | |
12 | ? URLParser.h | |
13 | Index: Makefile.in | |
14 | =================================================================== | |
15 | RCS file: /cvs/src/src/winsup/cinstall/Makefile.in,v | |
16 | retrieving revision 2.39 | |
17 | diff -u -p -r2.39 Makefile.in | |
18 | --- Makefile.in 2001/12/20 11:49:53 2.39 | |
19 | +++ Makefile.in 2001/12/20 12:35:57 | |
20 | @@ -87,6 +87,7 @@ OBJS = \ | |
21 | autoload.o \ | |
22 | category.o \ | |
23 | choose.o \ | |
24 | + cistring.o \ | |
25 | compress.o \ | |
26 | compress_bz.o \ | |
27 | compress_gz.o \ | |
28 | @@ -129,6 +130,8 @@ OBJS = \ | |
29 | package_source.o \ | |
30 | package_version.o \ | |
31 | postinstall.o \ | |
32 | + proppage.o \ | |
33 | + propsheet.o \ | |
34 | res.o \ | |
35 | rfc1738.o \ | |
36 | root.o \ | |
37 | @@ -138,7 +141,9 @@ OBJS = \ | |
38 | source.o \ | |
39 | splash.o \ | |
40 | state.o \ | |
41 | + threebar.o \ | |
42 | version.o \ | |
43 | + window.o \ | |
44 | $E | |
45 | ||
46 | .SUFFIXES: | |
47 | Index: choose.cc | |
48 | =================================================================== | |
49 | RCS file: /cvs/src/src/winsup/cinstall/choose.cc,v | |
50 | retrieving revision 2.79 | |
51 | diff -u -p -r2.79 choose.cc | |
52 | --- choose.cc 2001/12/20 11:49:53 2.79 | |
53 | +++ choose.cc 2001/12/20 12:35:59 | |
54 | @@ -36,6 +36,7 @@ static const char *cvsid = | |
55 | #include <stdlib.h> | |
56 | #include <io.h> | |
57 | #include <ctype.h> | |
58 | +#include <process.h> | |
59 | ||
60 | #include "dialog.h" | |
61 | #include "resource.h" | |
62 | @@ -47,6 +48,7 @@ static const char *cvsid = | |
63 | #include "find.h" | |
64 | #include "filemanip.h" | |
65 | #include "io_stream.h" | |
66 | +#include "propsheet.h" | |
67 | #include "choose.h" | |
68 | #include "category.h" | |
69 | ||
70 | @@ -55,6 +57,8 @@ static const char *cvsid = | |
71 | #include "package_version.h" | |
72 | ||
73 | #include "port.h" | |
74 | +#include "threebar.h" | |
75 | +extern ThreeBarProgressPage Progress; | |
76 | ||
77 | #define alloca __builtin_alloca | |
78 | ||
79 | @@ -1089,6 +1093,7 @@ dialog_proc (HWND h, UINT message, WPARA | |
80 | r.top += 2; | |
81 | r.bottom -= 2; | |
82 | create_listview (h, &r); | |
83 | + | |
84 | #if 0 | |
85 | load_dialog (h); | |
86 | #endif | |
87 | @@ -1193,7 +1198,7 @@ scan_downloaded_files () | |
88 | } | |
89 | ||
90 | void | |
91 | -do_choose (HINSTANCE h) | |
92 | +do_choose (HINSTANCE h, HWND owner) | |
93 | { | |
94 | int rv; | |
95 | ||
96 | @@ -1217,9 +1222,9 @@ do_choose (HINSTANCE h) | |
97 | set_existence (); | |
98 | fill_missing_category (); | |
99 | ||
100 | - rv = DialogBox (h, MAKEINTRESOURCE (IDD_CHOOSE), 0, dialog_proc); | |
101 | + rv = DialogBox (h, MAKEINTRESOURCE (IDD_CHOOSE), owner, dialog_proc); | |
102 | if (rv == -1) | |
103 | - fatal (IDS_DIALOG_FAILED); | |
104 | + fatal (owner, IDS_DIALOG_FAILED); | |
105 | ||
106 | log (LOG_BABBLE, "Chooser results..."); | |
107 | packagedb db; | |
108 | @@ -1302,4 +1307,63 @@ do_choose (HINSTANCE h) | |
109 | } | |
110 | #endif | |
111 | } | |
112 | +} | |
113 | + | |
114 | +#define WM_APP_START_CHOOSE WM_APP+0 | |
115 | +#define WM_APP_CHOOSE_IS_FINISHED WM_APP+1 | |
116 | + | |
117 | +extern void | |
118 | +do_choose (HINSTANCE h, HWND owner); | |
119 | + | |
120 | +void do_choose_thread(void *p) | |
121 | +{ | |
122 | + ChooserPage *cp; | |
123 | + | |
124 | + cp = static_cast<ChooserPage*>(p); | |
125 | + | |
126 | + do_choose(cp->GetInstance(), cp->GetHWND()); | |
127 | + | |
128 | + cp->PostMessage(WM_APP_CHOOSE_IS_FINISHED); | |
129 | + | |
130 | + _endthread(); | |
131 | +} | |
132 | + | |
133 | +bool ChooserPage::Create() | |
134 | +{ | |
135 | + return PropertyPage::Create(IDD_CHOOSER); | |
136 | +} | |
137 | + | |
138 | +void ChooserPage::OnActivate() | |
139 | +{ | |
140 | + GetOwner()->SetButtons(0); | |
141 | + PostMessage(WM_APP_START_CHOOSE); | |
142 | +} | |
143 | + | |
144 | +bool ChooserPage::OnMessageApp(UINT uMsg, WPARAM wParam, LPARAM lParam) | |
145 | +{ | |
146 | + switch(uMsg) | |
147 | + { | |
148 | + case WM_APP_START_CHOOSE: | |
149 | + { | |
150 | + // Start the chooser thread. | |
151 | + _beginthread(do_choose_thread, 0, this); | |
152 | + break; | |
153 | + } | |
154 | + case WM_APP_CHOOSE_IS_FINISHED: | |
155 | + { | |
156 | + if(next_dialog == 0) | |
157 | + { | |
158 | + // Cancel | |
159 | + GetOwner()->PressButton(PSBTN_CANCEL); | |
160 | + break; | |
161 | + } | |
162 | + Progress.SetActivateTask(WM_APP_START_DOWNLOAD); | |
163 | + GetOwner()->SetActivePageByID(IDD_INSTATUS); | |
164 | + break; | |
165 | + } | |
166 | + default: | |
167 | + return false; | |
168 | + break; | |
169 | + } | |
170 | + return true; | |
171 | } | |
172 | Index: choose.h | |
173 | =================================================================== | |
174 | RCS file: /cvs/src/src/winsup/cinstall/choose.h,v | |
175 | retrieving revision 2.9 | |
176 | diff -u -p -r2.9 choose.h | |
177 | --- choose.h 2001/12/20 11:49:53 2.9 | |
178 | +++ choose.h 2001/12/20 12:35:59 | |
179 | @@ -16,6 +16,8 @@ | |
180 | #ifndef _CHOOSE_H_ | |
181 | #define _CHOOSE_H_ | |
182 | ||
183 | +#include "proppage.h" | |
184 | + | |
185 | class Category; | |
186 | class packagemeta; | |
187 | ||
188 | @@ -195,5 +197,18 @@ private: | |
189 | void set_headers (); | |
190 | void init_headers (HDC dc); | |
191 | }; | |
192 | + | |
193 | +class ChooserPage : public PropertyPage | |
194 | +{ | |
195 | +public: | |
196 | + ChooserPage() {}; | |
197 | + virtual ~ChooserPage() {}; | |
198 | + | |
199 | + virtual bool OnMessageApp(UINT uMsg, WPARAM wParam, LPARAM lParam); | |
200 | + | |
201 | + bool Create(); | |
202 | + virtual void OnActivate(); | |
203 | +}; | |
204 | + | |
205 | #endif /* __cplusplus */ | |
206 | #endif /* _CHOOSE_H_ */ | |
207 | Index: cistring.cc | |
208 | =================================================================== | |
209 | RCS file: cistring.cc | |
210 | diff -N cistring.cc | |
211 | --- /dev/null Tue May 5 13:32:27 1998 | |
212 | +++ cistring.cc Thu Dec 20 04:35:59 2001 | |
213 | @@ -0,0 +1,52 @@ | |
214 | +/* | |
215 | + * Copyright (c) 2001, Gary R. Van Sickle. | |
216 | + * | |
217 | + * This program is free software; you can redistribute it and/or modify | |
218 | + * it under the terms of the GNU General Public License as published by | |
219 | + * the Free Software Foundation; either version 2 of the License, or | |
220 | + * (at your option) any later version. | |
221 | + * | |
222 | + * A copy of the GNU General Public License can be found at | |
223 | + * http://www.gnu.org/ | |
224 | + * | |
225 | + * Written by Gary R. Van Sickle <g.r.vansickle@worldnet.att.net> | |
226 | + * | |
227 | + */ | |
228 | + | |
229 | +// Yep, another string class | |
230 | + | |
231 | +#include "cistring.h" | |
232 | +#include <stdlib.h> | |
233 | + | |
234 | +DWORD | |
235 | +cistring::Format (UINT i, ...) | |
236 | +{ | |
237 | + TCHAR FormatStringBuffer[256]; | |
238 | + TCHAR *Buff; | |
239 | + va_list arglist; | |
240 | + DWORD numchars; | |
241 | + | |
242 | + // Get the string from the stringtable (FormatMessage() can only work with | |
243 | + // literal strings or *message*table entries, which are different for some | |
244 | + // inexplicable reason). | |
245 | + LoadString (GetModuleHandle (NULL), i, FormatStringBuffer, 256); | |
246 | + | |
247 | + va_start (arglist, i); | |
248 | + numchars =:: | |
249 | + FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER | | |
250 | + FORMAT_MESSAGE_FROM_STRING, FormatStringBuffer, i, 0, | |
251 | + (LPTSTR) & Buff, 0, &arglist); | |
252 | + va_end (arglist); | |
253 | + | |
254 | + if (numchars == 0) | |
255 | + { | |
256 | + // Something went wrong. | |
257 | + return 0; | |
258 | + } | |
259 | + | |
260 | + buffer = new TCHAR[(numchars + 1) * sizeof (TCHAR)]; | |
261 | + memcpy (buffer, Buff, (numchars + 1) * sizeof (TCHAR)); | |
262 | + LocalFree (Buff); | |
263 | + | |
264 | + return numchars; | |
265 | +} | |
266 | Index: cistring.h | |
267 | =================================================================== | |
268 | RCS file: cistring.h | |
269 | diff -N cistring.h | |
270 | --- /dev/null Tue May 5 13:32:27 1998 | |
271 | +++ cistring.h Thu Dec 20 04:35:59 2001 | |
272 | @@ -0,0 +1,41 @@ | |
273 | +/* | |
274 | + * Copyright (c) 2001, Gary R. Van Sickle. | |
275 | + * | |
276 | + * This program is free software; you can redistribute it and/or modify | |
277 | + * it under the terms of the GNU General Public License as published by | |
278 | + * the Free Software Foundation; either version 2 of the License, or | |
279 | + * (at your option) any later version. | |
280 | + * | |
281 | + * A copy of the GNU General Public License can be found at | |
282 | + * http://www.gnu.org/ | |
283 | + * | |
284 | + * Written by Gary R. Van Sickle <g.r.vansickle@worldnet.att.net> | |
285 | + * | |
286 | + */ | |
287 | + | |
288 | +// Yep, another string class | |
289 | + | |
290 | +#include <windows.h> | |
291 | + | |
292 | +class cistring | |
293 | +{ | |
294 | + TCHAR *buffer; | |
295 | +public: | |
296 | + cistring () | |
297 | + { | |
298 | + buffer = NULL; | |
299 | + }; | |
300 | + cistring (const TCHAR * s); | |
301 | + ~cistring () | |
302 | + { | |
303 | + if (buffer != NULL) | |
304 | + delete[]buffer; | |
305 | + }; | |
306 | + | |
307 | + const TCHAR *c_str () | |
308 | + { | |
309 | + return buffer; | |
310 | + }; | |
311 | + | |
312 | + DWORD Format (UINT i, ...); | |
313 | +}; | |
314 | Index: desktop.cc | |
315 | =================================================================== | |
316 | RCS file: /cvs/src/src/winsup/cinstall/desktop.cc,v | |
317 | retrieving revision 2.19 | |
318 | diff -u -p -r2.19 desktop.cc | |
319 | --- desktop.cc 2001/12/20 11:49:53 2.19 | |
320 | +++ desktop.cc 2001/12/20 12:35:59 | |
321 | @@ -48,6 +48,8 @@ static const char *cvsid = | |
322 | #include "package_meta.h" | |
323 | #include "package_version.h" | |
324 | ||
325 | +#include "desktop.h" | |
326 | + | |
327 | static OSVERSIONINFO verinfo; | |
328 | ||
329 | /* Lines starting with '@' are conditionals - include 'N' for NT, | |
330 | @@ -444,56 +446,48 @@ dialog_cmd (HWND h, int id, HWND hwndctl | |
331 | save_dialog (h); | |
332 | check_if_enable_next (h); | |
333 | break; | |
334 | - | |
335 | - case IDOK: | |
336 | - save_dialog (h); | |
337 | - do_desktop_setup (); | |
338 | - NEXT (IDD_S_POSTINSTALL); | |
339 | - break; | |
340 | - | |
341 | - case IDC_BACK: | |
342 | - save_dialog (h); | |
343 | - NEXT (IDD_CHOOSE); | |
344 | - break; | |
345 | - | |
346 | - case IDCANCEL: | |
347 | - NEXT (0); | |
348 | - break; | |
349 | } | |
350 | return 0; | |
351 | } | |
352 | ||
353 | -static BOOL CALLBACK | |
354 | -dialog_proc (HWND h, UINT message, WPARAM wParam, LPARAM lParam) | |
355 | +bool | |
356 | +DesktopSetupPage::Create () | |
357 | { | |
358 | - switch (message) | |
359 | - { | |
360 | - case WM_INITDIALOG: | |
361 | - load_dialog (h); | |
362 | - return FALSE; | |
363 | - case WM_COMMAND: | |
364 | - return HANDLE_WM_COMMAND (h, wParam, lParam, dialog_cmd); | |
365 | - } | |
366 | - return FALSE; | |
367 | + return PropertyPage::Create (NULL, dialog_cmd, IDD_DESKTOP); | |
368 | } | |
369 | ||
370 | void | |
371 | -do_desktop (HINSTANCE h) | |
372 | +DesktopSetupPage::OnInit () | |
373 | { | |
374 | + // FIXME: This CoInitialize() feels like it could be moved to startup in main.cc. | |
375 | CoInitialize (NULL); | |
376 | - | |
377 | verinfo.dwOSVersionInfoSize = sizeof (verinfo); | |
378 | GetVersionEx (&verinfo); | |
379 | - | |
380 | root_desktop = | |
381 | check_desktop ("Cygwin", backslash (cygpath ("/cygwin.bat", 0))); | |
382 | root_menu = | |
383 | check_startmenu ("Cygwin Bash Shell", | |
384 | backslash (cygpath ("/cygwin.bat", 0))); | |
385 | + load_dialog (GetHWND ()); | |
386 | +} | |
387 | ||
388 | - int rv = 0; | |
389 | +long | |
390 | +DesktopSetupPage::OnBack () | |
391 | +{ | |
392 | + HWND h = GetHWND (); | |
393 | + save_dialog (h); | |
394 | + NEXT (IDD_CHOOSE); | |
395 | + return IDD_CHOOSER; | |
396 | +} | |
397 | + | |
398 | +bool | |
399 | +DesktopSetupPage::OnFinish () | |
400 | +{ | |
401 | + HWND h = GetHWND (); | |
402 | + save_dialog (h); | |
403 | + do_desktop_setup (); | |
404 | + NEXT (IDD_S_POSTINSTALL); | |
405 | + do_postinstall (GetInstance (), h); | |
406 | ||
407 | - rv = DialogBox (h, MAKEINTRESOURCE (IDD_DESKTOP), 0, dialog_proc); | |
408 | - if (rv == -1) | |
409 | - fatal (IDS_DIALOG_FAILED); | |
410 | + return true; | |
411 | } | |
412 | Index: desktop.h | |
413 | =================================================================== | |
414 | RCS file: desktop.h | |
415 | diff -N desktop.h | |
416 | --- /dev/null Tue May 5 13:32:27 1998 | |
417 | +++ desktop.h Thu Dec 20 04:35:59 2001 | |
418 | @@ -0,0 +1,41 @@ | |
419 | +#ifndef CINSTALL_DESKTOP_H | |
420 | +#define CINSTALL_DESKTOP_H | |
421 | + | |
422 | +/* | |
423 | + * Copyright (c) 2001, Gary R. Van Sickle. | |
424 | + * | |
425 | + * This program is free software; you can redistribute it and/or modify | |
426 | + * it under the terms of the GNU General Public License as published by | |
427 | + * the Free Software Foundation; either version 2 of the License, or | |
428 | + * (at your option) any later version. | |
429 | + * | |
430 | + * A copy of the GNU General Public License can be found at | |
431 | + * http://www.gnu.org/ | |
432 | + * | |
433 | + * Written by Gary R. Van Sickle <g.r.vansickle@worldnet.att.net> | |
434 | + * | |
435 | + */ | |
436 | + | |
437 | +// This is the header for the DesktopSetupPage class. Allows selection | |
438 | +// of "create desktop icon" and "add to start menu". | |
439 | + | |
440 | +#include "proppage.h" | |
441 | + | |
442 | +class DesktopSetupPage:public PropertyPage | |
443 | +{ | |
444 | +public: | |
445 | + DesktopSetupPage () | |
446 | + { | |
447 | + }; | |
448 | + virtual ~ DesktopSetupPage () | |
449 | + { | |
450 | + }; | |
451 | + | |
452 | + bool Create (); | |
453 | + | |
454 | + virtual void OnInit (); | |
455 | + virtual bool OnFinish (); | |
456 | + virtual long OnBack (); | |
457 | +}; | |
458 | + | |
459 | +#endif // CINSTALL_DESKTOP_H | |
460 | Index: dialog.h | |
461 | =================================================================== | |
462 | RCS file: /cvs/src/src/winsup/cinstall/dialog.h,v | |
463 | retrieving revision 2.4 | |
464 | diff -u -p -r2.4 dialog.h | |
465 | --- dialog.h 2001/11/13 01:49:31 2.4 | |
466 | +++ dialog.h 2001/12/20 12:35:59 | |
467 | @@ -22,7 +22,7 @@ extern int next_dialog; | |
468 | /* either "nothing to do" or "setup complete" or something like that */ | |
469 | extern int exit_msg; | |
470 | ||
471 | -#define D(x) void x(HINSTANCE _h) | |
472 | +#define D(x) void x(HINSTANCE _h, HWND owner) | |
473 | ||
474 | /* prototypes for all the do_* functions (most called by main.cc) */ | |
475 | ||
476 | Index: download.cc | |
477 | =================================================================== | |
478 | RCS file: /cvs/src/src/winsup/cinstall/download.cc,v | |
479 | retrieving revision 2.18 | |
480 | diff -u -p -r2.18 download.cc | |
481 | --- download.cc 2001/12/20 11:49:53 2.18 | |
482 | +++ download.cc 2001/12/20 12:35:59 | |
483 | @@ -25,6 +25,7 @@ static const char *cvsid = | |
484 | ||
485 | #include <stdio.h> | |
486 | #include <unistd.h> | |
487 | +#include <process.h> | |
488 | ||
489 | #include "resource.h" | |
490 | #include "msg.h" | |
491 | @@ -47,6 +48,9 @@ static const char *cvsid = | |
492 | ||
493 | #include "rfc1738.h" | |
494 | ||
495 | +#include "threebar.h" | |
496 | +extern ThreeBarProgressPage Progress; | |
497 | + | |
498 | /* 0 on failure | |
499 | */ | |
500 | static int | |
501 | @@ -95,7 +99,7 @@ check_for_cached (packagesource & pkgsou | |
502 | ||
503 | /* download a file from a mirror site to the local cache. */ | |
504 | static int | |
505 | -download_one (packagesource & pkgsource) | |
506 | +download_one (packagesource & pkgsource, HWND owner) | |
507 | { | |
508 | if (check_for_cached (pkgsource) && source != IDC_SOURCE_DOWNLOAD) | |
509 | return 0; | |
510 | @@ -106,14 +110,15 @@ download_one (packagesource & pkgsource) | |
511 | for (size_t n = 1; n <= pkgsource.sites.number () && !success; n++) | |
512 | { | |
513 | const char *local = concat (local_dir, "/", | |
514 | - rfc1738_escape_part (pkgsource.sites[n]->key), "/", | |
515 | + rfc1738_escape_part (pkgsource.sites[n]-> | |
516 | + key), "/", | |
517 | pkgsource.Canonical (), 0); | |
518 | io_stream::mkpath_p (PATH_TO_FILE, concat ("file://", local, 0)); | |
519 | ||
520 | if (get_url_to_file | |
521 | (concat | |
522 | (pkgsource.sites[n]->key, "/", pkgsource.Canonical (), 0), | |
523 | - concat (local, ".tmp", 0), pkgsource.size)) | |
524 | + concat (local, ".tmp", 0), pkgsource.size, owner)) | |
525 | { | |
526 | /* FIXME: note new source ? */ | |
527 | continue; | |
528 | @@ -146,8 +151,8 @@ download_one (packagesource & pkgsource) | |
529 | return 1; | |
530 | } | |
531 | ||
532 | -void | |
533 | -do_download (HINSTANCE h) | |
534 | +static void | |
535 | +do_download_thread (HINSTANCE h, HWND owner) | |
536 | { | |
537 | int errors = 0; | |
538 | total_download_bytes = 0; | |
539 | @@ -157,19 +162,19 @@ do_download (HINSTANCE h) | |
540 | /* calculate the amount needed */ | |
541 | for (size_t n = 1; n < db.packages.number (); n++) | |
542 | { | |
543 | - packagemeta &pkg = * db.packages[n]; | |
544 | + packagemeta & pkg = *db.packages[n]; | |
545 | if (pkg.desired && (pkg.desired->srcpicked || pkg.desired->binpicked)) | |
546 | - { | |
547 | - packageversion *version = pkg.desired; | |
548 | - if (! | |
549 | - (check_for_cached (version->bin) | |
550 | - && source != IDC_SOURCE_DOWNLOAD)) | |
551 | - total_download_bytes += version->bin.size; | |
552 | - if (! | |
553 | - (check_for_cached (version->src) | |
554 | - && source != IDC_SOURCE_DOWNLOAD)) | |
555 | - total_download_bytes += version->src.size; | |
556 | - } | |
557 | + { | |
558 | + packageversion *version = pkg.desired; | |
559 | + if (! | |
560 | + (check_for_cached (version->bin) | |
561 | + && source != IDC_SOURCE_DOWNLOAD) && pkg.desired->binpicked) | |
562 | + total_download_bytes += version->bin.size; | |
563 | + if (! | |
564 | + (check_for_cached (version->src) | |
565 | + && source != IDC_SOURCE_DOWNLOAD) && pkg.desired->srcpicked) | |
566 | + total_download_bytes += version->src.size; | |
567 | + } | |
568 | } | |
569 | ||
570 | /* and do the download. FIXME: This here we assign a new name for the cached version | |
571 | @@ -177,28 +182,28 @@ do_download (HINSTANCE h) | |
572 | */ | |
573 | for (size_t n = 1; n < db.packages.number (); n++) | |
574 | { | |
575 | - packagemeta &pkg = * db.packages[n]; | |
576 | - if (pkg.desired && (pkg.desired->srcpicked || pkg.desired->binpicked)) | |
577 | - { | |
578 | - int e = 0; | |
579 | - packageversion *version = pkg.desired; | |
580 | - if (version->binpicked) | |
581 | - e += download_one (version->bin); | |
582 | - if (version->srcpicked) | |
583 | - e += download_one (version->src); | |
584 | - errors += e; | |
585 | + packagemeta & pkg = *db.packages[n]; | |
586 | + if (pkg.desired && (pkg.desired->srcpicked || pkg.desired->binpicked)) | |
587 | + { | |
588 | + int e = 0; | |
589 | + packageversion *version = pkg.desired; | |
590 | + if (version->binpicked) | |
591 | + e += download_one (version->bin, owner); | |
592 | + if (version->srcpicked) | |
593 | + e += download_one (version->src, owner); | |
594 | + errors += e; | |
595 | #if 0 | |
596 | - if (e) | |
597 | - pkg->action = ACTION_ERROR; | |
598 | + if (e) | |
599 | + pkg->action = ACTION_ERROR; | |
600 | #endif | |
601 | - } | |
602 | + } | |
603 | } | |
604 | ||
605 | dismiss_url_status_dialog (); | |
606 | ||
607 | if (errors) | |
608 | { | |
609 | - if (yesno (IDS_DOWNLOAD_INCOMPLETE) == IDYES) | |
610 | + if (yesno (owner, IDS_DOWNLOAD_INCOMPLETE) == IDYES) | |
611 | { | |
612 | next_dialog = IDD_SITE; | |
613 | return; | |
614 | @@ -215,4 +220,29 @@ do_download (HINSTANCE h) | |
615 | } | |
616 | else | |
617 | next_dialog = IDD_S_INSTALL; | |
618 | +} | |
619 | + | |
620 | +static void | |
621 | +do_download_reflector (void *p) | |
622 | +{ | |
623 | + HANDLE *context; | |
624 | + context = (HANDLE *) p; | |
625 | + | |
626 | + do_download_thread ((HINSTANCE) context[0], (HWND) context[1]); | |
627 | + | |
628 | + // Tell the progress page that we're done downloading | |
629 | + Progress.PostMessage (WM_APP_DOWNLOAD_THREAD_COMPLETE, 0, next_dialog); | |
630 | + | |
631 | + _endthread (); | |
632 | +} | |
633 | + | |
634 | +static HANDLE context[2]; | |
635 | + | |
636 | +void | |
637 | +do_download (HINSTANCE h, HWND owner) | |
638 | +{ | |
639 | + context[0] = h; | |
640 | + context[1] = owner; | |
641 | + | |
642 | + _beginthread (do_download_reflector, 0, context); | |
643 | } | |
644 | Index: fromcwd.cc | |
645 | =================================================================== | |
646 | RCS file: /cvs/src/src/winsup/cinstall/fromcwd.cc,v | |
647 | retrieving revision 2.16 | |
648 | diff -u -p -r2.16 fromcwd.cc | |
649 | --- fromcwd.cc 2001/12/20 11:49:53 2.16 | |
650 | +++ fromcwd.cc 2001/12/20 12:36:00 | |
651 | @@ -118,7 +118,7 @@ check_ini (char *path, unsigned int fsiz | |
652 | } | |
653 | ||
654 | void | |
655 | -do_fromcwd (HINSTANCE h) | |
656 | +do_fromcwd (HINSTANCE h, HWND owner) | |
657 | { | |
658 | found_ini = true; | |
659 | find (".", check_ini); | |
660 | Index: geturl.cc | |
661 | =================================================================== | |
662 | RCS file: /cvs/src/src/winsup/cinstall/geturl.cc,v | |
663 | retrieving revision 2.15 | |
664 | diff -u -p -r2.15 geturl.cc | |
665 | --- geturl.cc 2001/12/02 03:25:11 2.15 | |
666 | +++ geturl.cc 2001/12/20 12:36:00 | |
667 | @@ -43,119 +43,33 @@ static const char *cvsid = | |
668 | #include "diskfull.h" | |
669 | #include "mount.h" | |
670 | ||
671 | -static HWND gw_dialog = 0; | |
672 | -static HWND gw_url = 0; | |
673 | -static HWND gw_rate = 0; | |
674 | -static HWND gw_progress = 0; | |
675 | -static HWND gw_pprogress = 0; | |
676 | -static HWND gw_iprogress = 0; | |
677 | -static HWND gw_progress_text = 0; | |
678 | -static HWND gw_pprogress_text = 0; | |
679 | -static HWND gw_iprogress_text = 0; | |
680 | -static HANDLE init_event; | |
681 | +#include "threebar.h" | |
682 | +extern ThreeBarProgressPage Progress; | |
683 | + | |
684 | static int max_bytes = 0; | |
685 | static int is_local_install = 0; | |
686 | ||
687 | int total_download_bytes = 0; | |
688 | int total_download_bytes_sofar = 0; | |
689 | ||
690 | -static BOOL | |
691 | -dialog_cmd (HWND h, int id, HWND hwndctl, UINT code) | |
692 | -{ | |
693 | - switch (id) | |
694 | - { | |
695 | - case IDCANCEL: | |
696 | - exit_setup (0); | |
697 | - } | |
698 | - return 0; | |
699 | -} | |
700 | - | |
701 | -static BOOL CALLBACK | |
702 | -dialog_proc (HWND h, UINT message, WPARAM wParam, LPARAM lParam) | |
703 | -{ | |
704 | - switch (message) | |
705 | - { | |
706 | - case WM_INITDIALOG: | |
707 | - gw_dialog = h; | |
708 | - gw_url = GetDlgItem (h, IDC_DLS_URL); | |
709 | - gw_rate = GetDlgItem (h, IDC_DLS_RATE); | |
710 | - gw_progress = GetDlgItem (h, IDC_DLS_PROGRESS); | |
711 | - gw_pprogress = GetDlgItem (h, IDC_DLS_PPROGRESS); | |
712 | - gw_iprogress = GetDlgItem (h, IDC_DLS_IPROGRESS); | |
713 | - gw_progress_text = GetDlgItem (h, IDC_DLS_PROGRESS_TEXT); | |
714 | - gw_pprogress_text = GetDlgItem (h, IDC_DLS_PPROGRESS_TEXT); | |
715 | - gw_iprogress_text = GetDlgItem (h, IDC_DLS_IPROGRESS_TEXT); | |
716 | - SetEvent (init_event); | |
717 | - return TRUE; | |
718 | - case WM_COMMAND: | |
719 | - return HANDLE_WM_COMMAND (h, wParam, lParam, dialog_cmd); | |
720 | - } | |
721 | - return FALSE; | |
722 | -} | |
723 | - | |
724 | -static WINAPI DWORD | |
725 | -dialog (void *) | |
726 | -{ | |
727 | - MSG m; | |
728 | - HWND local_gw_dialog = | |
729 | - CreateDialog (hinstance, MAKEINTRESOURCE (IDD_DLSTATUS), | |
730 | - 0, dialog_proc); | |
731 | - ShowWindow (local_gw_dialog, SW_SHOWNORMAL); | |
732 | - UpdateWindow (local_gw_dialog); | |
733 | - while (GetMessage (&m, 0, 0, 0) > 0) | |
734 | - { | |
735 | - TranslateMessage (&m); | |
736 | - DispatchMessage (&m); | |
737 | - } | |
738 | - return 0; | |
739 | -} | |
740 | - | |
741 | static DWORD start_tics; | |
742 | ||
743 | static void | |
744 | -init_dialog (char const *url, int length) | |
745 | +init_dialog (char const *url, int length, HWND owner) | |
746 | { | |
747 | if (is_local_install) | |
748 | return; | |
749 | - if (gw_dialog == 0) | |
750 | - { | |
751 | - DWORD tid; | |
752 | - HANDLE thread; | |
753 | - init_event = CreateEvent (0, 0, 0, 0); | |
754 | - thread = CreateThread (0, 0, dialog, 0, 0, &tid); | |
755 | - WaitForSingleObject (init_event, 1000); | |
756 | - CloseHandle (init_event); | |
757 | - SendMessage (gw_progress, PBM_SETRANGE, 0, MAKELPARAM (0, 100)); | |
758 | - SendMessage (gw_pprogress, PBM_SETRANGE, 0, MAKELPARAM (0, 100)); | |
759 | - SendMessage (gw_iprogress, PBM_SETRANGE, 0, MAKELPARAM (0, 100)); | |
760 | - } | |
761 | + | |
762 | char const *sl = url; | |
763 | char const *cp; | |
764 | for (cp = url; *cp; cp++) | |
765 | if (*cp == '/' || *cp == '\\' || *cp == ':') | |
766 | sl = cp + 1; | |
767 | max_bytes = length; | |
768 | - SetWindowText (gw_url, sl); | |
769 | - SetWindowText (gw_rate, "Connecting..."); | |
770 | - SendMessage (gw_progress, PBM_SETPOS, (WPARAM) 0, 0); | |
771 | - ShowWindow (gw_progress, (length > 0) ? SW_SHOW : SW_HIDE); | |
772 | - if (length > 0) | |
773 | - SetWindowText (gw_progress_text, "Package"); | |
774 | - else | |
775 | - SetWindowText (gw_progress_text, " "); | |
776 | - ShowWindow (gw_pprogress, (total_download_bytes > 0) ? SW_SHOW : SW_HIDE); | |
777 | - if (total_download_bytes > 0) | |
778 | - { | |
779 | - SetWindowText (gw_pprogress_text, "Total"); | |
780 | - SetWindowText (gw_iprogress_text, "Disk"); | |
781 | - } | |
782 | - else | |
783 | - { | |
784 | - SetWindowText (gw_pprogress_text, " "); | |
785 | - SetWindowText (gw_iprogress_text, " "); | |
786 | - } | |
787 | - ShowWindow (gw_iprogress, (total_download_bytes > 0) ? SW_SHOW : SW_HIDE); | |
788 | - ShowWindow (gw_dialog, SW_SHOWNORMAL); | |
789 | + Progress.SetText1 ("Downloading..."); | |
790 | + Progress.SetText2 (sl); | |
791 | + Progress.SetText3 ("Connecting..."); | |
792 | + Progress.SetBar1 (0); | |
793 | start_tics = GetTickCount (); | |
794 | } | |
795 | ||
796 | @@ -166,7 +80,7 @@ progress (int bytes) | |
797 | if (is_local_install) | |
798 | return; | |
799 | static char buf[100]; | |
800 | - int kbps; | |
801 | + double kbps; | |
802 | static unsigned int last_tics = 0; | |
803 | DWORD tics = GetTickCount (); | |
804 | if (tics == start_tics) // to prevent division by zero | |
805 | @@ -175,36 +89,31 @@ progress (int bytes) | |
806 | return; | |
807 | last_tics = tics; | |
808 | ||
809 | - kbps = bytes / (tics - start_tics); | |
810 | - ShowWindow (gw_progress, (max_bytes > 0) ? SW_SHOW : SW_HIDE); | |
811 | - ShowWindow (gw_pprogress, (total_download_bytes > 0) ? SW_SHOW : SW_HIDE); | |
812 | - ShowWindow (gw_iprogress, (total_download_bytes > 0) ? SW_SHOW : SW_HIDE); | |
813 | - if (max_bytes > 100) | |
814 | - { | |
815 | - int perc = bytes / (max_bytes / 100); | |
816 | - SendMessage (gw_progress, PBM_SETPOS, (WPARAM) perc, 0); | |
817 | - sprintf (buf, "%3d %% (%dk/%dk) %d kb/s\n", | |
818 | + kbps = ((double) bytes) / (double) (tics - start_tics); | |
819 | + if (max_bytes > 0) | |
820 | + { | |
821 | + int perc = (int) (100.0 * ((double) bytes) / (double) max_bytes); | |
822 | + Progress.SetBar1 (bytes, max_bytes); | |
823 | + sprintf (buf, "%3d %% (%dk/%dk) %2.1f kb/s\n", | |
824 | perc, bytes / 1000, max_bytes / 1000, kbps); | |
825 | if (total_download_bytes > 0) | |
826 | { | |
827 | - int totalperc = | |
828 | - (total_download_bytes_sofar + | |
829 | - bytes) / (total_download_bytes / 100); | |
830 | - SendMessage (gw_pprogress, PBM_SETPOS, (WPARAM) totalperc, 0); | |
831 | + Progress.SetBar2 (total_download_bytes_sofar + bytes, | |
832 | + total_download_bytes); | |
833 | } | |
834 | } | |
835 | else | |
836 | - sprintf (buf, "%d %d kb/s\n", bytes, kbps); | |
837 | + sprintf (buf, "%d %2.1f kb/s\n", bytes, kbps); | |
838 | ||
839 | - SetWindowText (gw_rate, buf); | |
840 | + Progress.SetText3 (buf); | |
841 | } | |
842 | ||
843 | io_stream * | |
844 | -get_url_to_membuf (char const *_url) | |
845 | +get_url_to_membuf (char const *_url, HWND owner) | |
846 | { | |
847 | log (LOG_BABBLE, "get_url_to_membuf %s", _url); | |
848 | is_local_install = (source == IDC_SOURCE_CWD); | |
849 | - init_dialog (_url, 0); | |
850 | + init_dialog (_url, 0, owner); | |
851 | NetIO *n = NetIO::open (_url); | |
852 | if (!n || !n->ok ()) | |
853 | { | |
854 | @@ -254,9 +163,9 @@ get_url_to_membuf (char const *_url) | |
855 | } | |
856 | ||
857 | char * | |
858 | -get_url_to_string (char const *_url) | |
859 | +get_url_to_string (char const *_url, HWND owner) | |
860 | { | |
861 | - io_stream *stream = get_url_to_membuf (_url); | |
862 | + io_stream *stream = get_url_to_membuf (_url, owner); | |
863 | if (!stream) | |
864 | return 0; | |
865 | size_t bytes = stream->get_size (); | |
866 | @@ -264,10 +173,11 @@ get_url_to_string (char const *_url) | |
867 | { | |
868 | /* zero length, or error retrieving length */ | |
869 | delete stream; | |
870 | - log (LOG_BABBLE, "get_url_to_string(): couldn't retrieve buffer size, or zero length buffer"); | |
871 | + log (LOG_BABBLE, | |
872 | + "get_url_to_string(): couldn't retrieve buffer size, or zero length buffer"); | |
873 | return 0; | |
874 | } | |
875 | - char *rv = new char [bytes + 1]; | |
876 | + char *rv = new char[bytes + 1]; | |
877 | if (!rv) | |
878 | { | |
879 | delete stream; | |
880 | @@ -276,22 +186,22 @@ get_url_to_string (char const *_url) | |
881 | } | |
882 | /* membufs are quite safe */ | |
883 | stream->read (rv, bytes); | |
884 | - rv [bytes] = '\0'; | |
885 | + rv[bytes] = '\0'; | |
886 | delete stream; | |
887 | return rv; | |
888 | } | |
889 | ||
890 | int | |
891 | get_url_to_file (char *_url, char *_filename, int expected_length, | |
892 | - BOOL allow_ftp_auth) | |
893 | + HWND owner, BOOL allow_ftp_auth) | |
894 | { | |
895 | log (LOG_BABBLE, "get_url_to_file %s %s", _url, _filename); | |
896 | if (total_download_bytes > 0) | |
897 | { | |
898 | int df = diskfull (get_root_dir ()); | |
899 | - SendMessage (gw_iprogress, PBM_SETPOS, (WPARAM) df, 0); | |
900 | + Progress.SetBar3 (df); | |
901 | } | |
902 | - init_dialog (_url, expected_length); | |
903 | + init_dialog (_url, expected_length, owner); | |
904 | ||
905 | remove (_filename); /* but ignore errors */ | |
906 | ||
907 | @@ -309,7 +219,7 @@ get_url_to_file (char *_url, char *_file | |
908 | const char *err = strerror (errno); | |
909 | if (!err) | |
910 | err = "(unknown error)"; | |
911 | - fatal (IDS_ERR_OPEN_WRITE, _filename, err); | |
912 | + fatal (owner, IDS_ERR_OPEN_WRITE, _filename, err); | |
913 | } | |
914 | ||
915 | if (n->file_size) | |
916 | @@ -338,15 +248,16 @@ get_url_to_file (char *_url, char *_file | |
917 | if (total_download_bytes > 0) | |
918 | { | |
919 | int df = diskfull (get_root_dir ()); | |
920 | - SendMessage (gw_iprogress, PBM_SETPOS, (WPARAM) df, 0); | |
921 | + Progress.SetBar3 (df); | |
922 | } | |
923 | ||
924 | return 0; | |
925 | } | |
926 | ||
927 | +// FIXME: I think this can go now, I don't think anything calls it. | |
928 | void | |
929 | dismiss_url_status_dialog () | |
930 | { | |
931 | - if (!is_local_install) | |
932 | - ShowWindow (gw_dialog, SW_HIDE); | |
933 | + //if (!is_local_install) | |
934 | + //ShowWindow (gw_dialog, SW_HIDE); | |
935 | } | |
936 | Index: geturl.h | |
937 | =================================================================== | |
938 | RCS file: /cvs/src/src/winsup/cinstall/geturl.h,v | |
939 | retrieving revision 2.4 | |
940 | diff -u -p -r2.4 geturl.h | |
941 | --- geturl.h 2001/12/02 03:25:11 2.4 | |
942 | +++ geturl.h 2001/12/20 12:36:00 | |
943 | @@ -21,8 +21,8 @@ extern int total_download_bytes_sofar; | |
944 | ||
945 | class io_stream; | |
946 | ||
947 | -io_stream *get_url_to_membuf (char const *); | |
948 | -char *get_url_to_string (char const *); | |
949 | +io_stream *get_url_to_membuf (char const *, HWND owner); | |
950 | +char *get_url_to_string (char const *, HWND owner); | |
951 | int get_url_to_file (char *_url, char *_filename, int expected_size, | |
952 | - BOOL allow_ftp_auth = FALSE); | |
953 | + HWND owner, BOOL allow_ftp_auth = FALSE); | |
954 | void dismiss_url_status_dialog (); | |
955 | Index: ini.cc | |
956 | =================================================================== | |
957 | RCS file: /cvs/src/src/winsup/cinstall/ini.cc,v | |
958 | retrieving revision 2.15 | |
959 | diff -u -p -r2.15 ini.cc | |
960 | --- ini.cc 2001/12/03 22:22:09 2.15 | |
961 | +++ ini.cc 2001/12/20 12:36:00 | |
962 | @@ -28,6 +28,7 @@ static const char *cvsid = | |
963 | #include <stdio.h> | |
964 | #include <stdlib.h> | |
965 | #include <stdarg.h> | |
966 | +#include <process.h> | |
967 | ||
968 | #include "ini.h" | |
969 | #include "resource.h" | |
970 | @@ -45,6 +46,9 @@ static const char *cvsid = | |
971 | ||
972 | #include "io_stream.h" | |
973 | ||
974 | +#include "threebar.h" | |
975 | +extern ThreeBarProgressPage Progress; | |
976 | + | |
977 | unsigned int setup_timestamp = 0; | |
978 | char *setup_version = 0; | |
979 | ||
980 | @@ -59,50 +63,54 @@ static int local_ini; | |
981 | static void | |
982 | find_routine (char *path, unsigned int fsize) | |
983 | { | |
984 | - if (!strstr (path, "/setup.ini") ) | |
985 | + if (!strstr (path, "/setup.ini")) | |
986 | return; | |
987 | - io_stream *ini_file = io_stream::open (concat ("file://", local_dir,"/", path, 0), "rb"); | |
988 | + io_stream *ini_file = | |
989 | + io_stream::open (concat ("file://", local_dir, "/", path, 0), "rb"); | |
990 | if (!ini_file) | |
991 | { | |
992 | - note (IDS_SETUPINI_MISSING, path); | |
993 | - return; | |
994 | + note (NULL, IDS_SETUPINI_MISSING, path); | |
995 | + return; | |
996 | } | |
997 | ||
998 | /* FIXME: only use most recent copy */ | |
999 | setup_timestamp = 0; | |
1000 | setup_version = 0; | |
1001 | ||
1002 | - ini_init (ini_file, concat ("file://", local_dir,"/", path, 0)); | |
1003 | + ini_init (ini_file, concat ("file://", local_dir, "/", path, 0)); | |
1004 | ||
1005 | /*yydebug = 1; */ | |
1006 | ||
1007 | if (yyparse () || error_count > 0) | |
1008 | - MessageBox (0, error_buf, error_count == 1 ? "Parse Error" : "Parse Errors", 0); | |
1009 | + MessageBox (0, error_buf, | |
1010 | + error_count == 1 ? "Parse Error" : "Parse Errors", 0); | |
1011 | else | |
1012 | local_ini++; | |
1013 | } | |
1014 | ||
1015 | static int | |
1016 | -do_local_ini () | |
1017 | +do_local_ini (HWND owner) | |
1018 | { | |
1019 | local_ini = 0; | |
1020 | find (local_dir, find_routine); | |
1021 | - return local_ini; | |
1022 | + return local_ini; | |
1023 | } | |
1024 | ||
1025 | static int | |
1026 | -do_remote_ini () | |
1027 | +do_remote_ini (HWND owner) | |
1028 | { | |
1029 | size_t ini_count = 0; | |
1030 | + | |
1031 | for (size_t n = 1; n <= site_list.number (); n++) | |
1032 | { | |
1033 | io_stream *ini_file = | |
1034 | - get_url_to_membuf (concat (site_list[n]->url, "/setup.ini", 0)); | |
1035 | + get_url_to_membuf (concat (site_list[n]->url, "/setup.ini", 0), | |
1036 | + owner); | |
1037 | dismiss_url_status_dialog (); | |
1038 | ||
1039 | if (!ini_file) | |
1040 | { | |
1041 | - note (IDS_SETUPINI_MISSING, site_list[n]->url); | |
1042 | + note (owner, IDS_SETUPINI_MISSING, site_list[n]->url); | |
1043 | continue; | |
1044 | } | |
1045 | ||
1046 | @@ -139,14 +147,14 @@ do_remote_ini () | |
1047 | return ini_count; | |
1048 | } | |
1049 | ||
1050 | -void | |
1051 | -do_ini (HINSTANCE h) | |
1052 | +static void | |
1053 | +do_ini_thread (HINSTANCE h, HWND owner) | |
1054 | { | |
1055 | size_t ini_count = 0; | |
1056 | if (source == IDC_SOURCE_CWD) | |
1057 | - ini_count = do_local_ini (); | |
1058 | + ini_count = do_local_ini (owner); | |
1059 | else | |
1060 | - ini_count = do_remote_ini (); | |
1061 | + ini_count = do_remote_ini (owner); | |
1062 | ||
1063 | if (ini_count == 0) | |
1064 | { | |
1065 | @@ -171,7 +179,7 @@ do_ini (HINSTANCE h) | |
1066 | if (old_timestamp && setup_timestamp | |
1067 | && (old_timestamp > setup_timestamp)) | |
1068 | { | |
1069 | - int yn = yesno (IDS_OLD_SETUPINI); | |
1070 | + int yn = yesno (owner, IDS_OLD_SETUPINI); | |
1071 | if (yn == IDNO) | |
1072 | exit_setup (1); | |
1073 | } | |
1074 | @@ -197,11 +205,37 @@ do_ini (HINSTANCE h) | |
1075 | char *ini_version = canonicalize_version (setup_version); | |
1076 | char *our_version = canonicalize_version (version); | |
1077 | if (strcmp (our_version, ini_version) < 0) | |
1078 | - note (IDS_OLD_SETUP_VERSION, version, setup_version); | |
1079 | + note (owner, IDS_OLD_SETUP_VERSION, version, setup_version); | |
1080 | } | |
1081 | + | |
1082 | + next_dialog = IDD_CHOOSER; | |
1083 | +} | |
1084 | + | |
1085 | +static void | |
1086 | +do_ini_thread_reflector (void *p) | |
1087 | +{ | |
1088 | + HANDLE *context; | |
1089 | + context = (HANDLE *) p; | |
1090 | + | |
1091 | + do_ini_thread ((HINSTANCE) context[0], (HWND) context[1]); | |
1092 | + | |
1093 | + // Tell the progress page that we're done downloading | |
1094 | + Progress.PostMessage (WM_APP_SETUP_INI_DOWNLOAD_COMPLETE, 0, next_dialog); | |
1095 | + | |
1096 | + _endthread (); | |
1097 | +} | |
1098 | ||
1099 | - next_dialog = IDD_CHOOSE; | |
1100 | +static HANDLE context[2]; | |
1101 | + | |
1102 | +void | |
1103 | +do_ini (HINSTANCE h, HWND owner) | |
1104 | +{ | |
1105 | + context[0] = h; | |
1106 | + context[1] = owner; | |
1107 | + | |
1108 | + _beginthread (do_ini_thread_reflector, 0, context); | |
1109 | } | |
1110 | + | |
1111 | ||
1112 | extern int yylineno; | |
1113 | ||
1114 | Index: install.cc | |
1115 | =================================================================== | |
1116 | RCS file: /cvs/src/src/winsup/cinstall/install.cc,v | |
1117 | retrieving revision 2.31 | |
1118 | diff -u -p -r2.31 install.cc | |
1119 | --- install.cc 2001/12/20 11:49:53 2.31 | |
1120 | +++ install.cc 2001/12/20 12:36:00 | |
1121 | @@ -33,6 +33,8 @@ static const char *cvsid = | |
1122 | #include <sys/types.h> | |
1123 | #include <sys/stat.h> | |
1124 | #include <errno.h> | |
1125 | +#include <process.h> | |
1126 | + | |
1127 | #include "zlib/zlib.h" | |
1128 | ||
1129 | #include "resource.h" | |
1130 | @@ -61,109 +63,31 @@ static const char *cvsid = | |
1131 | ||
1132 | #include "port.h" | |
1133 | ||
1134 | -static HWND ins_dialog = 0; | |
1135 | -static HWND ins_action = 0; | |
1136 | -static HWND ins_pkgname = 0; | |
1137 | -static HWND ins_filename = 0; | |
1138 | -static HWND ins_pprogress = 0; | |
1139 | -static HWND ins_iprogress = 0; | |
1140 | -static HWND ins_diskfull = 0; | |
1141 | -static HANDLE init_event; | |
1142 | +#include "threebar.h" | |
1143 | +extern ThreeBarProgressPage Progress; | |
1144 | ||
1145 | static int total_bytes = 0; | |
1146 | static int total_bytes_sofar = 0; | |
1147 | static int package_bytes = 0; | |
1148 | ||
1149 | -static bool | |
1150 | -dialog_cmd (HWND h, int id, HWND hwndctl, UINT code) | |
1151 | -{ | |
1152 | - switch (id) | |
1153 | - { | |
1154 | - case IDCANCEL: | |
1155 | - exit_setup (1); | |
1156 | - } | |
1157 | - return 0; | |
1158 | -} | |
1159 | - | |
1160 | -static BOOL CALLBACK | |
1161 | -dialog_proc (HWND h, UINT message, WPARAM wParam, LPARAM lParam) | |
1162 | -{ | |
1163 | - switch (message) | |
1164 | - { | |
1165 | - case WM_INITDIALOG: | |
1166 | - ins_dialog = h; | |
1167 | - ins_action = GetDlgItem (h, IDC_INS_ACTION); | |
1168 | - ins_pkgname = GetDlgItem (h, IDC_INS_PKG); | |
1169 | - ins_filename = GetDlgItem (h, IDC_INS_FILE); | |
1170 | - ins_pprogress = GetDlgItem (h, IDC_INS_PPROGRESS); | |
1171 | - ins_iprogress = GetDlgItem (h, IDC_INS_IPROGRESS); | |
1172 | - ins_diskfull = GetDlgItem (h, IDC_INS_DISKFULL); | |
1173 | - SetEvent (init_event); | |
1174 | - return TRUE; | |
1175 | - case WM_COMMAND: | |
1176 | - return HANDLE_WM_COMMAND (h, wParam, lParam, dialog_cmd); | |
1177 | - } | |
1178 | - return FALSE; | |
1179 | -} | |
1180 | - | |
1181 | -static WINAPI DWORD | |
1182 | -dialog (void *) | |
1183 | -{ | |
1184 | - int rv = 0; | |
1185 | - MSG m; | |
1186 | - HWND ins_dialog = CreateDialog (hinstance, MAKEINTRESOURCE (IDD_INSTATUS), | |
1187 | - 0, dialog_proc); | |
1188 | - if (ins_dialog == 0) | |
1189 | - fatal ("create dialog"); | |
1190 | - ShowWindow (ins_dialog, SW_SHOWNORMAL); | |
1191 | - UpdateWindow (ins_dialog); | |
1192 | - while (GetMessage (&m, 0, 0, 0) > 0) | |
1193 | - { | |
1194 | - TranslateMessage (&m); | |
1195 | - DispatchMessage (&m); | |
1196 | - } | |
1197 | - return rv; | |
1198 | -} | |
1199 | - | |
1200 | static void | |
1201 | init_dialog () | |
1202 | { | |
1203 | - if (ins_dialog == 0) | |
1204 | - { | |
1205 | - DWORD tid; | |
1206 | - HANDLE thread; | |
1207 | - init_event = CreateEvent (0, 0, 0, 0); | |
1208 | - thread = CreateThread (0, 0, dialog, 0, 0, &tid); | |
1209 | - WaitForSingleObject (init_event, 10000); | |
1210 | - CloseHandle (init_event); | |
1211 | - SendMessage (ins_pprogress, PBM_SETRANGE, 0, MAKELPARAM (0, 100)); | |
1212 | - SendMessage (ins_iprogress, PBM_SETRANGE, 0, MAKELPARAM (0, 100)); | |
1213 | - SendMessage (ins_diskfull, PBM_SETRANGE, 0, MAKELPARAM (0, 100)); | |
1214 | - } | |
1215 | - | |
1216 | - SetWindowText (ins_pkgname, ""); | |
1217 | - SetWindowText (ins_filename, ""); | |
1218 | - SendMessage (ins_pprogress, PBM_SETPOS, (WPARAM) 0, 0); | |
1219 | - SendMessage (ins_iprogress, PBM_SETPOS, (WPARAM) 0, 0); | |
1220 | - SendMessage (ins_diskfull, PBM_SETPOS, (WPARAM) 0, 0); | |
1221 | - ShowWindow (ins_dialog, SW_SHOWNORMAL); | |
1222 | + Progress.SetText2 (""); | |
1223 | + Progress.SetText3 (""); | |
1224 | } | |
1225 | ||
1226 | static void | |
1227 | progress (int bytes) | |
1228 | { | |
1229 | - int perc; | |
1230 | - | |
1231 | - if (package_bytes > 100) | |
1232 | + if (package_bytes > 0) | |
1233 | { | |
1234 | - perc = bytes / (package_bytes / 100); | |
1235 | - SendMessage (ins_pprogress, PBM_SETPOS, (WPARAM) perc, 0); | |
1236 | + Progress.SetBar1 (bytes, package_bytes); | |
1237 | } | |
1238 | ||
1239 | - if (total_bytes > 100) | |
1240 | + if (total_bytes > 0) | |
1241 | { | |
1242 | - perc = (total_bytes_sofar + bytes) / (total_bytes / 100); | |
1243 | - SendMessage (ins_iprogress, PBM_SETPOS, (WPARAM) perc, 0); | |
1244 | + Progress.SetBar2 (total_bytes_sofar + bytes, total_bytes); | |
1245 | } | |
1246 | } | |
1247 | ||
1248 | @@ -192,11 +116,11 @@ static int num_installs, num_uninstalls; | |
1249 | static void | |
1250 | uninstall_one (packagemeta & pkgm) | |
1251 | { | |
1252 | - SetWindowText (ins_pkgname, pkgm.name); | |
1253 | - SetWindowText (ins_action, "Uninstalling..."); | |
1254 | - log (0, "Uninstalling %s", pkgm.name); | |
1255 | - pkgm.uninstall (); | |
1256 | - num_uninstalls++; | |
1257 | + Progress.SetText1 ("Uninstalling..."); | |
1258 | + Progress.SetText2 (pkgm.name); | |
1259 | + log (0, "Uninstalling %s", pkgm.name); | |
1260 | + pkgm.uninstall (); | |
1261 | + num_uninstalls++; | |
1262 | } | |
1263 | ||
1264 | ||
1265 | @@ -207,10 +131,10 @@ install_one_source (packagemeta & pkgm, | |
1266 | char const *prefix, package_type_t type) | |
1267 | { | |
1268 | int errors = 0; | |
1269 | - SetWindowText (ins_pkgname, source.Base ()); | |
1270 | + Progress.SetText2 (source.Base ()); | |
1271 | if (!io_stream::exists (source.Cached ())) | |
1272 | { | |
1273 | - note (IDS_ERR_OPEN_READ, source.Cached (), "No such file"); | |
1274 | + note (NULL, IDS_ERR_OPEN_READ, source.Cached (), "No such file"); | |
1275 | return 1; | |
1276 | } | |
1277 | io_stream *lst = 0; | |
1278 | @@ -232,7 +156,7 @@ install_one_source (packagemeta & pkgm, | |
1279 | ||
1280 | char msg[64]; | |
1281 | strcpy (msg, "Installing"); | |
1282 | - SetWindowText (ins_action, msg); | |
1283 | + Progress.SetText1 (msg); | |
1284 | log (0, "%s%s", msg, source.Cached ()); | |
1285 | io_stream *tmp = io_stream::open (source.Cached (), "rb"); | |
1286 | archive *thefile = 0; | |
1287 | @@ -254,7 +178,7 @@ install_one_source (packagemeta & pkgm, | |
1288 | lst->write (concat (fn, "\n", 0), strlen (fn) + 1); | |
1289 | ||
1290 | /* FIXME: concat leaks memory */ | |
1291 | - SetWindowText (ins_filename, concat (prefix, fn, 0)); | |
1292 | + Progress.SetText3 (concat (prefix, fn, 0)); | |
1293 | log (LOG_BABBLE, "Installing file %s%s", prefix, fn); | |
1294 | if (archive::extract_file (thefile, prefix) != 0) | |
1295 | { | |
1296 | @@ -274,7 +198,7 @@ install_one_source (packagemeta & pkgm, | |
1297 | progress (0); | |
1298 | ||
1299 | int df = diskfull (get_root_dir ()); | |
1300 | - SendMessage (ins_diskfull, PBM_SETPOS, (WPARAM) df, 0); | |
1301 | + Progress.SetBar3 (df); | |
1302 | ||
1303 | if (lst) | |
1304 | delete lst; | |
1305 | @@ -289,17 +213,17 @@ install_one (packagemeta & pkg) | |
1306 | int errors = 0; | |
1307 | ||
1308 | if (pkg.desired->binpicked) | |
1309 | - { | |
1310 | - errors += | |
1311 | - install_one_source (pkg, pkg.desired->bin, "cygfile:///", | |
1312 | - package_binary); | |
1313 | - if (!errors) | |
1314 | - pkg.installed = pkg.desired; | |
1315 | - } | |
1316 | - if (pkg.desired->srcpicked) | |
1317 | + { | |
1318 | errors += | |
1319 | - install_one_source (pkg, pkg.desired->src, "cygfile:///usr/src", | |
1320 | - package_source); | |
1321 | + install_one_source (pkg, pkg.desired->bin, "cygfile:///", | |
1322 | + package_binary); | |
1323 | + if (!errors) | |
1324 | + pkg.installed = pkg.desired; | |
1325 | + } | |
1326 | + if (pkg.desired->srcpicked) | |
1327 | + errors += | |
1328 | + install_one_source (pkg, pkg.desired->src, "cygfile:///usr/src", | |
1329 | + package_source); | |
1330 | ||
1331 | /* FIXME: make a upgrade method and reinstate this */ | |
1332 | #if 0 | |
1333 | @@ -375,8 +299,8 @@ check_for_old_cygwin () | |
1334 | return; | |
1335 | } | |
1336 | ||
1337 | -void | |
1338 | -do_install (HINSTANCE h) | |
1339 | +static void | |
1340 | +do_install_thread (HINSTANCE h, HWND owner) | |
1341 | { | |
1342 | int i; | |
1343 | int errors = 0; | |
1344 | @@ -398,15 +322,13 @@ do_install (HINSTANCE h) | |
1345 | io_stream *utmp = io_stream::open ("cygfile:///var/run/utmp", "wb"); | |
1346 | delete utmp; | |
1347 | ||
1348 | - dismiss_url_status_dialog (); | |
1349 | - | |
1350 | init_dialog (); | |
1351 | ||
1352 | total_bytes = 0; | |
1353 | total_bytes_sofar = 0; | |
1354 | ||
1355 | int df = diskfull (get_root_dir ()); | |
1356 | - SendMessage (ins_diskfull, PBM_SETPOS, (WPARAM) df, 0); | |
1357 | + Progress.SetBar3 (df); | |
1358 | ||
1359 | int istext = (root_text == IDC_ROOT_TEXT) ? 1 : 0; | |
1360 | int issystem = (root_scope == IDC_ROOT_SYSTEM) ? 1 : 0; | |
1361 | @@ -419,27 +341,26 @@ do_install (HINSTANCE h) | |
1362 | packagedb db; | |
1363 | for (size_t n = 1; n < db.packages.number (); n++) | |
1364 | { | |
1365 | - packagemeta &pkg = * db.packages[n]; | |
1366 | + packagemeta & pkg = *db.packages[n]; | |
1367 | ||
1368 | - if (pkg.desired && (pkg.desired->srcpicked || pkg.desired->binpicked)) | |
1369 | - { | |
1370 | - if (pkg.desired->srcpicked) | |
1371 | - total_bytes += pkg.desired->src.size; | |
1372 | - if (pkg.desired->binpicked) | |
1373 | - total_bytes += pkg.desired->bin.size; | |
1374 | - } | |
1375 | + if (pkg.desired && (pkg.desired->srcpicked || pkg.desired->binpicked)) | |
1376 | + { | |
1377 | + if (pkg.desired->srcpicked) | |
1378 | + total_bytes += pkg.desired->src.size; | |
1379 | + if (pkg.desired->binpicked) | |
1380 | + total_bytes += pkg.desired->bin.size; | |
1381 | + } | |
1382 | } | |
1383 | ||
1384 | for (size_t n = 1; n < db.packages.number (); n++) | |
1385 | { | |
1386 | - packagemeta &pkg = * db.packages[n]; | |
1387 | + packagemeta & pkg = *db.packages[n]; | |
1388 | if (pkg.installed && (!pkg.desired || pkg.desired != pkg.installed)) | |
1389 | { | |
1390 | uninstall_one (pkg); | |
1391 | } | |
1392 | ||
1393 | - if (pkg.desired | |
1394 | - && (pkg.desired->srcpicked || pkg.desired->binpicked)) | |
1395 | + if (pkg.desired && (pkg.desired->srcpicked || pkg.desired->binpicked)) | |
1396 | { | |
1397 | int e = 0; | |
1398 | e += install_one (pkg); | |
1399 | @@ -450,15 +371,13 @@ do_install (HINSTANCE h) | |
1400 | } | |
1401 | } // end of big package loop | |
1402 | ||
1403 | - ShowWindow (ins_dialog, SW_HIDE); | |
1404 | - | |
1405 | int temperr; | |
1406 | if ((temperr = db.flush ())) | |
1407 | { | |
1408 | const char *err = strerror (temperr); | |
1409 | if (!err) | |
1410 | err = "(unknown error)"; | |
1411 | - fatal (IDS_ERR_OPEN_WRITE, err); | |
1412 | + fatal (owner, IDS_ERR_OPEN_WRITE, err); | |
1413 | } | |
1414 | ||
1415 | if (!errors) | |
1416 | @@ -478,4 +397,29 @@ do_install (HINSTANCE h) | |
1417 | exit_msg = IDS_INSTALL_INCOMPLETE; | |
1418 | else | |
1419 | exit_msg = IDS_INSTALL_COMPLETE; | |
1420 | +} | |
1421 | + | |
1422 | +static void | |
1423 | +do_install_reflector (void *p) | |
1424 | +{ | |
1425 | + HANDLE *context; | |
1426 | + context = (HANDLE *) p; | |
1427 | + | |
1428 | + do_install_thread ((HINSTANCE) context[0], (HWND) context[1]); | |
1429 | + | |
1430 | + // Tell the progress page that we're done downloading | |
1431 | + Progress.PostMessage (WM_APP_INSTALL_THREAD_COMPLETE, next_dialog); | |
1432 | + | |
1433 | + _endthread (); | |
1434 | +} | |
1435 | + | |
1436 | +static HANDLE context[2]; | |
1437 | + | |
1438 | +void | |
1439 | +do_install (HINSTANCE h, HWND owner) | |
1440 | +{ | |
1441 | + context[0] = h; | |
1442 | + context[1] = owner; | |
1443 | + | |
1444 | + _beginthread (do_install_reflector, 0, context); | |
1445 | } | |
1446 | Index: localdir.cc | |
1447 | =================================================================== | |
1448 | RCS file: /cvs/src/src/winsup/cinstall/localdir.cc,v | |
1449 | retrieving revision 2.5 | |
1450 | diff -u -p -r2.5 localdir.cc | |
1451 | --- localdir.cc 2001/11/14 00:11:35 2.5 | |
1452 | +++ localdir.cc 2001/12/20 12:36:00 | |
1453 | @@ -39,6 +39,8 @@ static const char *cvsid = | |
1454 | #include "mkdir.h" | |
1455 | #include "io_stream.h" | |
1456 | ||
1457 | +#include "localdir.h" | |
1458 | + | |
1459 | void | |
1460 | save_local_dir () | |
1461 | { | |
1462 | @@ -128,74 +130,20 @@ dialog_cmd (HWND h, int id, HWND hwndctl | |
1463 | case IDC_LOCAL_DIR_BROWSE: | |
1464 | browse (h); | |
1465 | break; | |
1466 | - | |
1467 | - case IDOK: | |
1468 | - save_dialog (h); | |
1469 | - save_local_dir (); | |
1470 | - if (SetCurrentDirectoryA (local_dir)) | |
1471 | - { | |
1472 | - switch (source) | |
1473 | - { | |
1474 | - case IDC_SOURCE_DOWNLOAD: | |
1475 | - case IDC_SOURCE_NETINST: | |
1476 | - NEXT (IDD_NET); | |
1477 | - break; | |
1478 | - case IDC_SOURCE_CWD: | |
1479 | - NEXT (IDD_S_FROM_CWD); | |
1480 | - break; | |
1481 | - default: | |
1482 | - msg ("source is default? %d\n", source); | |
1483 | - NEXT (0); | |
1484 | - break; | |
1485 | - } | |
1486 | - } | |
1487 | - else | |
1488 | - note (IDS_ERR_CHDIR, local_dir); | |
1489 | - | |
1490 | - break; | |
1491 | - | |
1492 | - case IDC_BACK: | |
1493 | - save_dialog (h); | |
1494 | - switch (source) | |
1495 | - { | |
1496 | - case IDC_SOURCE_DOWNLOAD: | |
1497 | - NEXT (IDD_SOURCE); | |
1498 | - break; | |
1499 | - case IDC_SOURCE_NETINST: | |
1500 | - case IDC_SOURCE_CWD: | |
1501 | - NEXT (IDD_ROOT); | |
1502 | - break; | |
1503 | - default: | |
1504 | - msg ("source is default? %d\n", source); | |
1505 | - NEXT (0); | |
1506 | - } | |
1507 | - break; | |
1508 | - | |
1509 | - case IDCANCEL: | |
1510 | - NEXT (0); | |
1511 | - break; | |
1512 | } | |
1513 | return 0; | |
1514 | } | |
1515 | + | |
1516 | +//extern char cwd[_MAX_PATH]; | |
1517 | ||
1518 | -static BOOL CALLBACK | |
1519 | -dialog_proc (HWND h, UINT message, WPARAM wParam, LPARAM lParam) | |
1520 | +bool | |
1521 | +LocalDirPage::Create () | |
1522 | { | |
1523 | - switch (message) | |
1524 | - { | |
1525 | - case WM_INITDIALOG: | |
1526 | - load_dialog (h); | |
1527 | - return FALSE; | |
1528 | - case WM_COMMAND: | |
1529 | - return HANDLE_WM_COMMAND (h, wParam, lParam, dialog_cmd); | |
1530 | - } | |
1531 | - return FALSE; | |
1532 | + return PropertyPage::Create (NULL, dialog_cmd, IDD_LOCAL_DIR); | |
1533 | } | |
1534 | ||
1535 | -extern char cwd[_MAX_PATH]; | |
1536 | - | |
1537 | void | |
1538 | -do_local_dir (HINSTANCE h) | |
1539 | +LocalDirPage::OnInit () | |
1540 | { | |
1541 | static int inited = 0; | |
1542 | if (!inited) | |
1543 | @@ -217,11 +165,43 @@ do_local_dir (HINSTANCE h) | |
1544 | } | |
1545 | inited = 1; | |
1546 | } | |
1547 | +} | |
1548 | + | |
1549 | +void | |
1550 | +LocalDirPage::OnActivate () | |
1551 | +{ | |
1552 | + load_dialog (GetHWND ()); | |
1553 | +} | |
1554 | ||
1555 | - int rv = 0; | |
1556 | - rv = DialogBox (h, MAKEINTRESOURCE (IDD_LOCAL_DIR), 0, dialog_proc); | |
1557 | - if (rv == -1) | |
1558 | - fatal (IDS_DIALOG_FAILED); | |
1559 | +long | |
1560 | +LocalDirPage::OnNext () | |
1561 | +{ | |
1562 | + HWND h = GetHWND (); | |
1563 | ||
1564 | + save_dialog (h); | |
1565 | + save_local_dir (); | |
1566 | log (0, "Selected local directory: %s", local_dir); | |
1567 | + if (SetCurrentDirectoryA (local_dir)) | |
1568 | + { | |
1569 | + if (source == IDC_SOURCE_CWD) | |
1570 | + { | |
1571 | + return IDD_S_FROM_CWD; | |
1572 | + } | |
1573 | + } | |
1574 | + else | |
1575 | + note (h, IDS_ERR_CHDIR, local_dir); | |
1576 | + | |
1577 | + return 0; | |
1578 | +} | |
1579 | + | |
1580 | +long | |
1581 | +LocalDirPage::OnBack () | |
1582 | +{ | |
1583 | + save_dialog (GetHWND ()); | |
1584 | + if (source == IDC_SOURCE_DOWNLOAD) | |
1585 | + { | |
1586 | + // Downloading only, skip the unix root page | |
1587 | + return IDD_SOURCE; | |
1588 | + } | |
1589 | + return 0; | |
1590 | } | |
1591 | Index: localdir.h | |
1592 | =================================================================== | |
1593 | RCS file: localdir.h | |
1594 | diff -N localdir.h | |
1595 | --- /dev/null Tue May 5 13:32:27 1998 | |
1596 | +++ localdir.h Thu Dec 20 04:36:00 2001 | |
1597 | @@ -0,0 +1,44 @@ | |
1598 | +#ifndef CINSTALL_LOCALDIR_H | |
1599 | +#define CINSTALL_LOCALDIR_H | |
1600 | + | |
1601 | +/* | |
1602 | + * Copyright (c) 2001, Gary R. Van Sickle. | |
1603 | + * | |
1604 | + * This program is free software; you can redistribute it and/or modify | |
1605 | + * it under the terms of the GNU General Public License as published by | |
1606 | + * the Free Software Foundation; either version 2 of the License, or | |
1607 | + * (at your option) any later version. | |
1608 | + * | |
1609 | + * A copy of the GNU General Public License can be found at | |
1610 | + * http://www.gnu.org/ | |
1611 | + * | |
1612 | + * Written by Gary R. Van Sickle <g.r.vansickle@worldnet.att.net> | |
1613 | + * | |
1614 | + */ | |
1615 | + | |
1616 | +// This is the header for the LocalDirPage class. Allows the user to select | |
1617 | +// the local package directory (i.e. where downloaded packages are stored). | |
1618 | + | |
1619 | + | |
1620 | +#include "proppage.h" | |
1621 | + | |
1622 | +class LocalDirPage:public PropertyPage | |
1623 | +{ | |
1624 | +public: | |
1625 | + LocalDirPage () | |
1626 | + { | |
1627 | + }; | |
1628 | + virtual ~ LocalDirPage () | |
1629 | + { | |
1630 | + }; | |
1631 | + | |
1632 | + bool Create (); | |
1633 | + | |
1634 | + void OnActivate (); | |
1635 | + void OnInit (); | |
1636 | + long OnNext (); | |
1637 | + long OnBack (); | |
1638 | +}; | |
1639 | + | |
1640 | + | |
1641 | +#endif | |
1642 | Index: log.cc | |
1643 | =================================================================== | |
1644 | RCS file: /cvs/src/src/winsup/cinstall/log.cc,v | |
1645 | retrieving revision 2.5 | |
1646 | diff -u -p -r2.5 log.cc | |
1647 | --- log.cc 2001/11/13 01:49:32 2.5 | |
1648 | +++ log.cc 2001/12/20 12:36:00 | |
1649 | @@ -86,7 +86,7 @@ log_save (int babble, const char *filena | |
1650 | FILE *f = fopen (filename, append ? "at" : "wt"); | |
1651 | if (!f) | |
1652 | { | |
1653 | - fatal (IDS_NOLOGFILE, filename); | |
1654 | + fatal (NULL, IDS_NOLOGFILE, filename); | |
1655 | return; | |
1656 | } | |
1657 | ||
1658 | @@ -115,7 +115,7 @@ exit_setup (int exit_code) | |
1659 | been_here = 1; | |
1660 | ||
1661 | if (exit_msg) | |
1662 | - note (exit_msg); | |
1663 | + note (NULL, exit_msg); | |
1664 | ||
1665 | log (LOG_TIMESTAMP, "Ending cygwin install"); | |
1666 | ||
1667 | Index: main.cc | |
1668 | =================================================================== | |
1669 | RCS file: /cvs/src/src/winsup/cinstall/main.cc,v | |
1670 | retrieving revision 2.9 | |
1671 | diff -u -p -r2.9 main.cc | |
1672 | --- main.cc 2001/11/13 01:49:32 2.9 | |
1673 | +++ main.cc 2001/12/20 12:36:00 | |
1674 | @@ -29,6 +29,7 @@ static const char *cvsid = | |
1675 | #endif | |
1676 | ||
1677 | #include "win32.h" | |
1678 | +#include <commctrl.h> | |
1679 | ||
1680 | #include <stdio.h> | |
1681 | #include <stdlib.h> | |
1682 | @@ -42,7 +43,20 @@ static const char *cvsid = | |
1683 | #include "version.h" | |
1684 | ||
1685 | #include "port.h" | |
1686 | +#include "proppage.h" | |
1687 | +#include "propsheet.h" | |
1688 | ||
1689 | +// Page class headers | |
1690 | +#include "splash.h" | |
1691 | +#include "source.h" | |
1692 | +#include "root.h" | |
1693 | +#include "localdir.h" | |
1694 | +#include "net.h" | |
1695 | +#include "site.h" | |
1696 | +#include "choose.h" | |
1697 | +#include "threebar.h" | |
1698 | +#include "desktop.h" | |
1699 | + | |
1700 | int next_dialog; | |
1701 | int exit_msg = 0; | |
1702 | ||
1703 | @@ -123,6 +137,12 @@ out: | |
1704 | FreeSid (sid); | |
1705 | } | |
1706 | ||
1707 | +extern BOOL CALLBACK | |
1708 | +root_dialog_proc (HWND h, UINT message, WPARAM wParam, LPARAM lParam); | |
1709 | + | |
1710 | +// Other threads talk to this page, so we need to have it externable. | |
1711 | +ThreeBarProgressPage Progress; | |
1712 | + | |
1713 | int WINAPI | |
1714 | WinMain (HINSTANCE h, | |
1715 | HINSTANCE hPrevInstance, LPSTR command_line, int cmd_show) | |
1716 | @@ -133,6 +153,16 @@ WinMain (HINSTANCE h, | |
1717 | ||
1718 | log (LOG_TIMESTAMP, "Starting cygwin install, version %s", version); | |
1719 | ||
1720 | + SplashPage Splash; | |
1721 | + SourcePage Source; | |
1722 | + RootPage Root; | |
1723 | + LocalDirPage LocalDir; | |
1724 | + NetPage Net; | |
1725 | + SitePage Site; | |
1726 | + ChooserPage Chooser; | |
1727 | + DesktopSetupPage Desktop; | |
1728 | + PropSheet MainWindow; | |
1729 | + | |
1730 | char cwd[_MAX_PATH]; | |
1731 | GetCurrentDirectory (sizeof (cwd), cwd); | |
1732 | local_dir = strdup (cwd); | |
1733 | @@ -150,58 +180,36 @@ WinMain (HINSTANCE h, | |
1734 | if (iswinnt) | |
1735 | set_default_dacl (); | |
1736 | ||
1737 | - while (next_dialog) | |
1738 | - { | |
1739 | - switch (next_dialog) | |
1740 | - { | |
1741 | - case IDD_SPLASH: | |
1742 | - do_splash (h); | |
1743 | - break; | |
1744 | - case IDD_SOURCE: | |
1745 | - do_source (h); | |
1746 | - break; | |
1747 | - case IDD_LOCAL_DIR: | |
1748 | - do_local_dir (h); | |
1749 | - break; | |
1750 | - case IDD_ROOT: | |
1751 | - do_root (h); | |
1752 | - break; | |
1753 | - case IDD_NET: | |
1754 | - do_net (h); | |
1755 | - break; | |
1756 | - case IDD_SITE: | |
1757 | - do_site (h); | |
1758 | - break; | |
1759 | - case IDD_OTHER_URL: | |
1760 | - do_other (h); | |
1761 | - break; | |
1762 | - case IDD_S_LOAD_INI: | |
1763 | - do_ini (h); | |
1764 | - break; | |
1765 | - case IDD_S_FROM_CWD: | |
1766 | - do_fromcwd (h); | |
1767 | - break; | |
1768 | - case IDD_CHOOSE: | |
1769 | - do_choose (h); | |
1770 | - break; | |
1771 | - case IDD_S_DOWNLOAD: | |
1772 | - do_download (h); | |
1773 | - break; | |
1774 | - case IDD_S_INSTALL: | |
1775 | - do_install (h); | |
1776 | - break; | |
1777 | - case IDD_DESKTOP: | |
1778 | - do_desktop (h); | |
1779 | - break; | |
1780 | - case IDD_S_POSTINSTALL: | |
1781 | - do_postinstall (h); | |
1782 | - break; | |
1783 | - | |
1784 | - default: | |
1785 | - next_dialog = 0; | |
1786 | - break; | |
1787 | - } | |
1788 | - } | |
1789 | + // Initialize common controls | |
1790 | + InitCommonControls (); | |
1791 | + | |
1792 | + // Init window class lib | |
1793 | + Window::SetAppInstance (h); | |
1794 | + | |
1795 | + // Create pages | |
1796 | + Splash.Create (); | |
1797 | + Source.Create (); | |
1798 | + Root.Create (); | |
1799 | + LocalDir.Create (); | |
1800 | + Net.Create (); | |
1801 | + Site.Create (); | |
1802 | + Chooser.Create (); | |
1803 | + Progress.Create (); | |
1804 | + Desktop.Create (); | |
1805 | + | |
1806 | + // Add pages to sheet | |
1807 | + MainWindow.AddPage (&Splash); | |
1808 | + MainWindow.AddPage (&Source); | |
1809 | + MainWindow.AddPage (&Root); | |
1810 | + MainWindow.AddPage (&LocalDir); | |
1811 | + MainWindow.AddPage (&Net); | |
1812 | + MainWindow.AddPage (&Site); | |
1813 | + MainWindow.AddPage (&Chooser); | |
1814 | + MainWindow.AddPage (&Progress); | |
1815 | + MainWindow.AddPage (&Desktop); | |
1816 | + | |
1817 | + // Create the PropSheet main window | |
1818 | + MainWindow.Create (); | |
1819 | ||
1820 | exit_setup (0); | |
1821 | /* Keep gcc happy :} */ | |
1822 | Index: msg.cc | |
1823 | =================================================================== | |
1824 | RCS file: /cvs/src/src/winsup/cinstall/msg.cc,v | |
1825 | retrieving revision 2.2 | |
1826 | diff -u -p -r2.2 msg.cc | |
1827 | --- msg.cc 2001/11/13 01:49:32 2.2 | |
1828 | +++ msg.cc 2001/12/20 12:36:00 | |
1829 | @@ -38,7 +38,7 @@ msg (const char *fmt, ...) | |
1830 | } | |
1831 | ||
1832 | static int | |
1833 | -mbox (const char *name, int type, int id, va_list args) | |
1834 | +mbox (HWND owner, const char *name, int type, int id, va_list args) | |
1835 | { | |
1836 | char buf[1000], fmt[1000]; | |
1837 | ||
1838 | @@ -47,30 +47,30 @@ mbox (const char *name, int type, int id | |
1839 | ||
1840 | vsprintf (buf, fmt, args); | |
1841 | log (0, "mbox %s: %s", name, buf); | |
1842 | - return MessageBox (0, buf, "Cygwin Setup", type | MB_TOPMOST); | |
1843 | + return MessageBox (owner, buf, "Cygwin Setup", type /*| MB_TOPMOST */ ); | |
1844 | } | |
1845 | ||
1846 | void | |
1847 | -note (int id, ...) | |
1848 | +note (HWND owner, int id, ...) | |
1849 | { | |
1850 | va_list args; | |
1851 | va_start (args, id); | |
1852 | - mbox ("note", 0, id, args); | |
1853 | + mbox (owner, "note", 0, id, args); | |
1854 | } | |
1855 | ||
1856 | void | |
1857 | -fatal (int id, ...) | |
1858 | +fatal (HWND owner, int id, ...) | |
1859 | { | |
1860 | va_list args; | |
1861 | va_start (args, id); | |
1862 | - mbox ("fatal", 0, id, args); | |
1863 | + mbox (owner, "fatal", 0, id, args); | |
1864 | exit_setup (1); | |
1865 | } | |
1866 | ||
1867 | int | |
1868 | -yesno (int id, ...) | |
1869 | +yesno (HWND owner, int id, ...) | |
1870 | { | |
1871 | va_list args; | |
1872 | va_start (args, id); | |
1873 | - return mbox ("yesno", MB_YESNO, id, args); | |
1874 | + return mbox (owner, "yesno", MB_YESNO, id, args); | |
1875 | } | |
1876 | Index: msg.h | |
1877 | =================================================================== | |
1878 | RCS file: /cvs/src/src/winsup/cinstall/msg.h,v | |
1879 | retrieving revision 2.1 | |
1880 | diff -u -p -r2.1 msg.h | |
1881 | --- msg.h 2001/11/13 01:49:32 2.1 | |
1882 | +++ msg.h 2001/12/20 12:36:00 | |
1883 | @@ -23,11 +23,11 @@ void msg (const char *fmt, ...); | |
1884 | is interpreted like printf. The program exits when the user | |
1885 | presses OK. */ | |
1886 | ||
1887 | -void fatal (int id, ...); | |
1888 | +void fatal (HWND owner, int id, ...); | |
1889 | ||
1890 | /* Similar, but the program continues when the user presses OK */ | |
1891 | ||
1892 | -void note (int id, ...); | |
1893 | +void note (HWND owner, int id, ...); | |
1894 | ||
1895 | /* returns IDYES or IDNO, otherwise same as note() */ | |
1896 | -int yesno (int id, ...); | |
1897 | +int yesno (HWND owner, int id, ...); | |
1898 | Index: net.cc | |
1899 | =================================================================== | |
1900 | RCS file: /cvs/src/src/winsup/cinstall/net.cc,v | |
1901 | retrieving revision 2.7 | |
1902 | diff -u -p -r2.7 net.cc | |
1903 | --- net.cc 2001/11/13 01:49:32 2.7 | |
1904 | +++ net.cc 2001/12/20 12:36:00 | |
1905 | @@ -30,6 +30,11 @@ static const char *cvsid = | |
1906 | #include "msg.h" | |
1907 | #include "log.h" | |
1908 | ||
1909 | +#include "net.h" | |
1910 | + | |
1911 | +#include "threebar.h" | |
1912 | +extern ThreeBarProgressPage Progress; | |
1913 | + | |
1914 | static int rb[] = { IDC_NET_IE5, IDC_NET_DIRECT, IDC_NET_PROXY, 0 }; | |
1915 | ||
1916 | static void | |
1917 | @@ -84,71 +89,50 @@ dialog_cmd (HWND h, int id, HWND hwndctl | |
1918 | save_dialog (h); | |
1919 | check_if_enable_next (h); | |
1920 | break; | |
1921 | - | |
1922 | - case IDOK: | |
1923 | - save_dialog (h); | |
1924 | - switch (source) | |
1925 | - { | |
1926 | - case IDC_SOURCE_NETINST: | |
1927 | - case IDC_SOURCE_DOWNLOAD: | |
1928 | - NEXT (IDD_SITE); | |
1929 | - break; | |
1930 | - case IDC_SOURCE_CWD: | |
1931 | - NEXT (0); | |
1932 | - break; | |
1933 | - default: | |
1934 | - msg ("source is default? %d\n", source); | |
1935 | - NEXT (0); | |
1936 | - } | |
1937 | - break; | |
1938 | - | |
1939 | - case IDC_BACK: | |
1940 | - save_dialog (h); | |
1941 | - NEXT (IDD_LOCAL_DIR); | |
1942 | - break; | |
1943 | - | |
1944 | - case IDCANCEL: | |
1945 | - NEXT (0); | |
1946 | - break; | |
1947 | } | |
1948 | return 0; | |
1949 | } | |
1950 | ||
1951 | -static BOOL CALLBACK | |
1952 | -dialog_proc (HWND h, UINT message, WPARAM wParam, LPARAM lParam) | |
1953 | +bool | |
1954 | +NetPage::Create () | |
1955 | { | |
1956 | - switch (message) | |
1957 | - { | |
1958 | - case WM_INITDIALOG: | |
1959 | - load_dialog (h); | |
1960 | - | |
1961 | - // Check to see if any radio buttons are selected. If not, select a default. | |
1962 | - if ( | |
1963 | - (!SendMessage (GetDlgItem (h, IDC_NET_IE5), BM_GETCHECK, 0, 0) == | |
1964 | - BST_CHECKED) | |
1965 | - && (!SendMessage (GetDlgItem (h, IDC_NET_PROXY), BM_GETCHECK, 0, 0) | |
1966 | - == BST_CHECKED)) | |
1967 | - { | |
1968 | - SendMessage (GetDlgItem (h, IDC_NET_DIRECT), BM_CLICK, 0, 0); | |
1969 | - } | |
1970 | - return FALSE; | |
1971 | - case WM_COMMAND: | |
1972 | - return HANDLE_WM_COMMAND (h, wParam, lParam, dialog_cmd); | |
1973 | - } | |
1974 | - return FALSE; | |
1975 | + return PropertyPage::Create (NULL, dialog_cmd, IDD_NET); | |
1976 | } | |
1977 | ||
1978 | void | |
1979 | -do_net (HINSTANCE h) | |
1980 | +NetPage::OnInit () | |
1981 | { | |
1982 | - int rv = 0; | |
1983 | + HWND h = GetHWND (); | |
1984 | ||
1985 | net_method = IDC_NET_DIRECT; | |
1986 | - rv = DialogBox (h, MAKEINTRESOURCE (IDD_NET), 0, dialog_proc); | |
1987 | - if (rv == -1) | |
1988 | - fatal (IDS_DIALOG_FAILED); | |
1989 | + load_dialog (h); | |
1990 | + | |
1991 | + // Check to see if any radio buttons are selected. If not, select a default. | |
1992 | + if ((!SendMessage (GetDlgItem (IDC_NET_IE5), BM_GETCHECK, 0, 0) == | |
1993 | + BST_CHECKED) | |
1994 | + && (!SendMessage (GetDlgItem (IDC_NET_PROXY), BM_GETCHECK, 0, 0) | |
1995 | + == BST_CHECKED)) | |
1996 | + { | |
1997 | + SendMessage (GetDlgItem (IDC_NET_DIRECT), BM_CLICK, 0, 0); | |
1998 | + } | |
1999 | +} | |
2000 | + | |
2001 | +long | |
2002 | +NetPage::OnNext () | |
2003 | +{ | |
2004 | + save_dialog (GetHWND ()); | |
2005 | ||
2006 | log (0, "net: %s", | |
2007 | (net_method == IDC_NET_IE5) ? "IE5" : | |
2008 | (net_method == IDC_NET_DIRECT) ? "Direct" : "Proxy"); | |
2009 | + | |
2010 | + Progress.SetActivateTask (WM_APP_START_SITE_INFO_DOWNLOAD); | |
2011 | + return IDD_INSTATUS; | |
2012 | +} | |
2013 | + | |
2014 | +long | |
2015 | +NetPage::OnBack () | |
2016 | +{ | |
2017 | + save_dialog (GetHWND ()); | |
2018 | + return 0; | |
2019 | } | |
2020 | Index: net.h | |
2021 | =================================================================== | |
2022 | RCS file: net.h | |
2023 | diff -N net.h | |
2024 | --- /dev/null Tue May 5 13:32:27 1998 | |
2025 | +++ net.h Thu Dec 20 04:36:00 2001 | |
2026 | @@ -0,0 +1,42 @@ | |
2027 | +#ifndef CINSTALL_NET_H | |
2028 | +#define CINSTALL_NET_H | |
2029 | + | |
2030 | +/* | |
2031 | + * Copyright (c) 2001, Gary R. Van Sickle. | |
2032 | + * | |
2033 | + * This program is free software; you can redistribute it and/or modify | |
2034 | + * it under the terms of the GNU General Public License as published by | |
2035 | + * the Free Software Foundation; either version 2 of the License, or | |
2036 | + * (at your option) any later version. | |
2037 | + * | |
2038 | + * A copy of the GNU General Public License can be found at | |
2039 | + * http://www.gnu.org/ | |
2040 | + * | |
2041 | + * Written by Gary R. Van Sickle <g.r.vansickle@worldnet.att.net> | |
2042 | + * | |
2043 | + */ | |
2044 | + | |
2045 | +// This is the header for the NetPage class. It allows the user to select | |
2046 | +// a proxy etc. | |
2047 | + | |
2048 | + | |
2049 | +#include "proppage.h" | |
2050 | + | |
2051 | +class NetPage:public PropertyPage | |
2052 | +{ | |
2053 | +public: | |
2054 | + NetPage () | |
2055 | + { | |
2056 | + }; | |
2057 | + virtual ~ NetPage () | |
2058 | + { | |
2059 | + }; | |
2060 | + | |
2061 | + bool Create (); | |
2062 | + | |
2063 | + virtual void OnInit (); | |
2064 | + virtual long OnNext (); | |
2065 | + virtual long OnBack (); | |
2066 | +}; | |
2067 | + | |
2068 | +#endif // CINSTALL_NET_H | |
2069 | Index: netio.cc | |
2070 | =================================================================== | |
2071 | RCS file: /cvs/src/src/winsup/cinstall/netio.cc,v | |
2072 | retrieving revision 2.5 | |
2073 | diff -u -p -r2.5 netio.cc | |
2074 | --- netio.cc 2001/12/02 03:25:11 2.5 | |
2075 | +++ netio.cc 2001/12/20 12:36:00 | |
2076 | @@ -229,29 +229,29 @@ auth_proc (HWND h, UINT message, WPARAM | |
2077 | } | |
2078 | ||
2079 | static int | |
2080 | -auth_common (HINSTANCE h, int id) | |
2081 | +auth_common (HINSTANCE h, int id, HWND owner) | |
2082 | { | |
2083 | - return DialogBox (h, MAKEINTRESOURCE (id), 0, auth_proc); | |
2084 | + return DialogBox (h, MAKEINTRESOURCE (id), owner, auth_proc); | |
2085 | } | |
2086 | ||
2087 | int | |
2088 | -NetIO::get_auth () | |
2089 | +NetIO::get_auth (HWND owner) | |
2090 | { | |
2091 | user = &net_user; | |
2092 | passwd = &net_passwd; | |
2093 | - return auth_common (hinstance, IDD_NET_AUTH); | |
2094 | + return auth_common (hinstance, IDD_NET_AUTH, owner); | |
2095 | } | |
2096 | ||
2097 | int | |
2098 | -NetIO::get_proxy_auth () | |
2099 | +NetIO::get_proxy_auth (HWND owner) | |
2100 | { | |
2101 | user = &net_proxy_user; | |
2102 | passwd = &net_proxy_passwd; | |
2103 | - return auth_common (hinstance, IDD_PROXY_AUTH); | |
2104 | + return auth_common (hinstance, IDD_PROXY_AUTH, owner); | |
2105 | } | |
2106 | ||
2107 | int | |
2108 | -NetIO::get_ftp_auth () | |
2109 | +NetIO::get_ftp_auth (HWND owner) | |
2110 | { | |
2111 | if (net_ftp_user) | |
2112 | { | |
2113 | @@ -267,5 +267,5 @@ NetIO::get_ftp_auth () | |
2114 | return IDCANCEL; | |
2115 | user = &net_ftp_user; | |
2116 | passwd = &net_ftp_passwd; | |
2117 | - return auth_common (hinstance, IDD_FTP_AUTH); | |
2118 | + return auth_common (hinstance, IDD_FTP_AUTH, owner); | |
2119 | } | |
2120 | Index: netio.h | |
2121 | =================================================================== | |
2122 | RCS file: /cvs/src/src/winsup/cinstall/netio.h,v | |
2123 | retrieving revision 2.4 | |
2124 | diff -u -p -r2.4 netio.h | |
2125 | --- netio.h 2001/12/02 03:25:11 2.4 | |
2126 | +++ netio.h 2001/12/20 12:36:00 | |
2127 | @@ -50,7 +50,7 @@ public: | |
2128 | /* Helper functions for http/ftp protocols. Both return nonzero for | |
2129 | "cancel", zero for "ok". They set net_proxy_user, etc, in | |
2130 | state.h */ | |
2131 | - int get_auth (); | |
2132 | - int get_proxy_auth (); | |
2133 | - int get_ftp_auth (); | |
2134 | + int get_auth (HWND owner); | |
2135 | + int get_proxy_auth (HWND owner); | |
2136 | + int get_ftp_auth (HWND owner); | |
2137 | }; | |
2138 | Index: nio-file.cc | |
2139 | =================================================================== | |
2140 | RCS file: /cvs/src/src/winsup/cinstall/nio-file.cc,v | |
2141 | retrieving revision 2.4 | |
2142 | diff -u -p -r2.4 nio-file.cc | |
2143 | --- nio-file.cc 2001/12/02 03:25:11 2.4 | |
2144 | +++ nio-file.cc 2001/12/20 12:36:00 | |
2145 | @@ -45,7 +45,7 @@ NetIO (Purl) | |
2146 | const char *err = strerror (errno); | |
2147 | if (!err) | |
2148 | err = "(unknown error)"; | |
2149 | - note (IDS_ERR_OPEN_READ, path, err); | |
2150 | + note (NULL, IDS_ERR_OPEN_READ, path, err); | |
2151 | } | |
2152 | } | |
2153 | ||
2154 | Index: nio-ftp.cc | |
2155 | =================================================================== | |
2156 | RCS file: /cvs/src/src/winsup/cinstall/nio-ftp.cc,v | |
2157 | retrieving revision 2.8 | |
2158 | diff -u -p -r2.8 nio-ftp.cc | |
2159 | --- nio-ftp.cc 2001/12/02 03:25:11 2.8 | |
2160 | +++ nio-ftp.cc 2001/12/20 12:36:02 | |
2161 | @@ -95,7 +95,7 @@ NetIO_FTP::NetIO_FTP (char const *Purl, | |
2162 | } | |
2163 | if (code == 530) /* Authentication failed, retry */ | |
2164 | { | |
2165 | - get_ftp_auth (); | |
2166 | + get_ftp_auth (NULL); | |
2167 | if (net_ftp_user && net_ftp_passwd) | |
2168 | goto auth_retry; | |
2169 | } | |
2170 | Index: nio-http.cc | |
2171 | =================================================================== | |
2172 | RCS file: /cvs/src/src/winsup/cinstall/nio-http.cc,v | |
2173 | retrieving revision 2.9 | |
2174 | diff -u -p -r2.9 nio-http.cc | |
2175 | --- nio-http.cc 2001/12/02 03:25:11 2.9 | |
2176 | +++ nio-http.cc 2001/12/20 12:36:02 | |
2177 | @@ -148,14 +148,14 @@ retry_get: | |
2178 | } | |
2179 | if (code == 401) /* authorization required */ | |
2180 | { | |
2181 | - get_auth (); | |
2182 | + get_auth (NULL); | |
2183 | delete | |
2184 | s; | |
2185 | goto retry_get; | |
2186 | } | |
2187 | if (code == 407) /* proxy authorization required */ | |
2188 | { | |
2189 | - get_proxy_auth (); | |
2190 | + get_proxy_auth (NULL); | |
2191 | delete | |
2192 | s; | |
2193 | goto retry_get; | |
2194 | @@ -163,7 +163,7 @@ retry_get: | |
2195 | if (code == 500 /* ftp authentication through proxy required */ | |
2196 | && net_method == IDC_NET_PROXY && !strncmp (url, "ftp://", 6)) | |
2197 | { | |
2198 | - get_ftp_auth (); | |
2199 | + get_ftp_auth (NULL); | |
2200 | if (net_ftp_user && net_ftp_passwd) | |
2201 | { | |
2202 | delete | |
2203 | Index: nio-ie5.cc | |
2204 | =================================================================== | |
2205 | RCS file: /cvs/src/src/winsup/cinstall/nio-ie5.cc,v | |
2206 | retrieving revision 2.4 | |
2207 | diff -u -p -r2.4 nio-ie5.cc | |
2208 | --- nio-ie5.cc 2001/12/02 03:25:11 2.4 | |
2209 | +++ nio-ie5.cc 2001/12/20 12:36:02 | |
2210 | @@ -44,7 +44,7 @@ NetIO (_url) | |
2211 | HINSTANCE h = LoadLibrary ("wininet.dll"); | |
2212 | if (!h) | |
2213 | { | |
2214 | - note (IDS_WININET); | |
2215 | + note (NULL, IDS_WININET); | |
2216 | connection = 0; | |
2217 | return; | |
2218 | } | |
2219 | @@ -112,14 +112,14 @@ try_again: | |
2220 | if (type == 401) /* authorization required */ | |
2221 | { | |
2222 | flush_io (); | |
2223 | - get_auth (); | |
2224 | + get_auth (NULL); | |
2225 | resend = 1; | |
2226 | goto try_again; | |
2227 | } | |
2228 | else if (type == 407) /* proxy authorization required */ | |
2229 | { | |
2230 | flush_io (); | |
2231 | - get_proxy_auth (); | |
2232 | + get_proxy_auth (NULL); | |
2233 | resend = 1; | |
2234 | goto try_again; | |
2235 | } | |
2236 | Index: other.cc | |
2237 | =================================================================== | |
2238 | RCS file: /cvs/src/src/winsup/cinstall/other.cc,v | |
2239 | retrieving revision 2.3 | |
2240 | diff -u -p -r2.3 other.cc | |
2241 | --- other.cc 2001/12/03 22:22:09 2.3 | |
2242 | +++ other.cc 2001/12/20 12:36:02 | |
2243 | @@ -103,12 +103,12 @@ dialog_proc (HWND h, UINT message, WPARA | |
2244 | } | |
2245 | ||
2246 | void | |
2247 | -do_other (HINSTANCE h) | |
2248 | +do_other (HINSTANCE h, HWND owner) | |
2249 | { | |
2250 | int rv = 0; | |
2251 | - rv = DialogBox (h, MAKEINTRESOURCE (IDD_OTHER_URL), 0, dialog_proc); | |
2252 | + rv = DialogBox (h, MAKEINTRESOURCE (IDD_OTHER_URL), owner, dialog_proc); | |
2253 | if (rv == -1) | |
2254 | - fatal (IDS_DIALOG_FAILED); | |
2255 | + fatal (owner, IDS_DIALOG_FAILED); | |
2256 | ||
2257 | log (0, "site: %s", other_url); | |
2258 | } | |
2259 | Index: postinstall.cc | |
2260 | =================================================================== | |
2261 | RCS file: /cvs/src/src/winsup/cinstall/postinstall.cc,v | |
2262 | retrieving revision 2.4 | |
2263 | diff -u -p -r2.4 postinstall.cc | |
2264 | --- postinstall.cc 2001/11/13 01:49:32 2.4 | |
2265 | +++ postinstall.cc 2001/12/20 12:36:02 | |
2266 | @@ -98,7 +98,7 @@ static const char *shells[] = { | |
2267 | }; | |
2268 | ||
2269 | void | |
2270 | -do_postinstall (HINSTANCE h) | |
2271 | +do_postinstall (HINSTANCE h, HWND owner) | |
2272 | { | |
2273 | next_dialog = 0; | |
2274 | int i; | |
2275 | Index: proppage.cc | |
2276 | =================================================================== | |
2277 | RCS file: proppage.cc | |
2278 | diff -N proppage.cc | |
2279 | --- /dev/null Tue May 5 13:32:27 1998 | |
2280 | +++ proppage.cc Thu Dec 20 04:36:02 2001 | |
2281 | @@ -0,0 +1,226 @@ | |
2282 | +/* | |
2283 | + * Copyright (c) 2001, Gary R. Van Sickle. | |
2284 | + * | |
2285 | + * This program is free software; you can redistribute it and/or modify | |
2286 | + * it under the terms of the GNU General Public License as published by | |
2287 | + * the Free Software Foundation; either version 2 of the License, or | |
2288 | + * (at your option) any later version. | |
2289 | + * | |
2290 | + * A copy of the GNU General Public License can be found at | |
2291 | + * http://www.gnu.org/ | |
2292 | + * | |
2293 | + * Written by Gary R. Van Sickle <g.r.vansickle@worldnet.att.net> | |
2294 | + * | |
2295 | + */ | |
2296 | + | |
2297 | +// This is the implementation of the PropertyPage class. It works closely with the | |
2298 | +// PropSheet class to implement a single page of the property sheet. | |
2299 | + | |
2300 | +#include "proppage.h" | |
2301 | +#include "propsheet.h" | |
2302 | +#include "win32.h" | |
2303 | + | |
2304 | +bool | |
2305 | + PropertyPage::DoOnceForSheet = | |
2306 | + true; | |
2307 | + | |
2308 | +PropertyPage::PropertyPage () | |
2309 | +{ | |
2310 | + proc = NULL; | |
2311 | + cmdproc = NULL; | |
2312 | + IsFirst = false; | |
2313 | + IsLast = false; | |
2314 | +} | |
2315 | + | |
2316 | +PropertyPage::~PropertyPage () | |
2317 | +{ | |
2318 | +} | |
2319 | + | |
2320 | +bool | |
2321 | +PropertyPage::Create (int TemplateID) | |
2322 | +{ | |
2323 | + return Create (NULL, NULL, TemplateID); | |
2324 | +} | |
2325 | + | |
2326 | +bool | |
2327 | +PropertyPage::Create (DLGPROC dlgproc, int TemplateID) | |
2328 | +{ | |
2329 | + return Create (dlgproc, NULL, TemplateID); | |
2330 | +} | |
2331 | + | |
2332 | +bool | |
2333 | +PropertyPage::Create (DLGPROC dlgproc, | |
2334 | + BOOL (*cproc) (HWND h, int id, HWND hwndctl, UINT code), | |
2335 | + int TemplateID) | |
2336 | +{ | |
2337 | + psp.dwSize = sizeof (PROPSHEETPAGE); | |
2338 | + psp.dwFlags = 0; | |
2339 | + psp.hInstance = GetInstance (); | |
2340 | + psp.pfnDlgProc = FirstDialogProcReflector; | |
2341 | + psp.pszTemplate = (LPCSTR) TemplateID; | |
2342 | + psp.lParam = (LPARAM) this; | |
2343 | + psp.pfnCallback = NULL; | |
2344 | + | |
2345 | + proc = dlgproc; | |
2346 | + cmdproc = cproc; | |
2347 | + | |
2348 | + return true; | |
2349 | +} | |
2350 | + | |
2351 | +BOOL CALLBACK | |
2352 | +PropertyPage::FirstDialogProcReflector (HWND hwnd, UINT message, | |
2353 | + WPARAM wParam, LPARAM lParam) | |
2354 | +{ | |
2355 | + PropertyPage *This; | |
2356 | + | |
2357 | + if (message != WM_INITDIALOG) | |
2358 | + { | |
2359 | + // Don't handle anything until we get a WM_INITDIALOG message, which | |
2360 | + // will have our this pointer with it. | |
2361 | + return FALSE; | |
2362 | + } | |
2363 | + | |
2364 | + This = (PropertyPage *) (((PROPSHEETPAGE *) lParam)->lParam); | |
2365 | + | |
2366 | + SetWindowLong (hwnd, DWL_USER, (DWORD) This); | |
2367 | + SetWindowLong (hwnd, DWL_DLGPROC, (DWORD) DialogProcReflector); | |
2368 | + | |
2369 | + This->SetHWND (hwnd); | |
2370 | + return This->DialogProc (message, wParam, lParam); | |
2371 | +} | |
2372 | + | |
2373 | +BOOL CALLBACK | |
2374 | +PropertyPage::DialogProcReflector (HWND hwnd, UINT message, WPARAM wParam, | |
2375 | + LPARAM lParam) | |
2376 | +{ | |
2377 | + PropertyPage *This; | |
2378 | + | |
2379 | + This = (PropertyPage *) GetWindowLong (hwnd, DWL_USER); | |
2380 | + | |
2381 | + return This->DialogProc (message, wParam, lParam); | |
2382 | +} | |
2383 | + | |
2384 | +BOOL CALLBACK | |
2385 | +PropertyPage::DialogProc (UINT message, WPARAM wParam, LPARAM lParam) | |
2386 | +{ | |
2387 | + if (proc != NULL) | |
2388 | + { | |
2389 | + proc (GetHWND (), message, wParam, lParam); | |
2390 | + } | |
2391 | + | |
2392 | + bool retval; | |
2393 | + | |
2394 | + switch (message) | |
2395 | + { | |
2396 | + case WM_INITDIALOG: | |
2397 | + { | |
2398 | + OnInit (); | |
2399 | + // TRUE = Set focus to default control (in wParam). | |
2400 | + return TRUE; | |
2401 | + break; | |
2402 | + } | |
2403 | + case WM_NOTIFY: | |
2404 | + switch (((NMHDR FAR *) lParam)->code) | |
2405 | + { | |
2406 | + case PSN_APPLY: | |
2407 | + SetWindowLong (GetHWND (), DWL_MSGRESULT, PSNRET_NOERROR); | |
2408 | + return TRUE; | |
2409 | + break; | |
2410 | + case PSN_SETACTIVE: | |
2411 | + { | |
2412 | + if (DoOnceForSheet) | |
2413 | + { | |
2414 | + // Tell our parent PropSheet what its own HWND is. | |
2415 | + GetOwner ()->SetHWNDFromPage (((NMHDR FAR *) lParam)-> | |
2416 | + hwndFrom); | |
2417 | + GetOwner ()->CenterWindow (); | |
2418 | + // Add a minimize box to the parent property sheet. We do this here | |
2419 | + // instead of in the sheet class mainly because it will work with either | |
2420 | + // modal or modeless sheets. | |
2421 | + LONG style =::GetWindowLong (((NMHDR FAR *) lParam)->hwndFrom, | |
2422 | + GWL_STYLE); | |
2423 | + ::SetWindowLong (((NMHDR FAR *) lParam)->hwndFrom, GWL_STYLE, | |
2424 | + style | WS_MINIMIZEBOX); | |
2425 | + DoOnceForSheet = false; | |
2426 | + } | |
2427 | + | |
2428 | + // Set the wizard buttons apropriately | |
2429 | + if (IsFirst) | |
2430 | + { | |
2431 | + // Disable "Back" on first page. | |
2432 | + GetOwner ()->SetButtons (PSWIZB_NEXT); | |
2433 | + //::PropSheet_SetWizButtons(((NMHDR FAR *) lParam)->hwndFrom, PSWIZB_NEXT); | |
2434 | + } | |
2435 | + else if (IsLast) | |
2436 | + { | |
2437 | + // Disable "Next", enable "Finish" on last page | |
2438 | + GetOwner ()->SetButtons (PSWIZB_BACK | PSWIZB_FINISH); | |
2439 | + //::PropSheet_SetWizButtons(((NMHDR FAR *) lParam)->hwndFrom, PSWIZB_BACK | PSWIZB_FINISH); | |
2440 | + } | |
2441 | + else | |
2442 | + { | |
2443 | + // Middle page, enable both "Next" and "Back" buttons | |
2444 | + GetOwner ()->SetButtons (PSWIZB_BACK | PSWIZB_NEXT); | |
2445 | + //::PropSheet_SetWizButtons(((NMHDR FAR *) lParam)->hwndFrom, PSWIZB_BACK | PSWIZB_NEXT); | |
2446 | + } | |
2447 | + | |
2448 | + OnActivate (); | |
2449 | + | |
2450 | + // 0 == Accept activation, -1 = Don't accept | |
2451 | + ::SetWindowLong (GetHWND (), DWL_MSGRESULT, 0); | |
2452 | + return TRUE; | |
2453 | + } | |
2454 | + break; | |
2455 | + case PSN_KILLACTIVE: | |
2456 | + OnDeactivate (); | |
2457 | + // FALSE = Allow deactivation | |
2458 | + SetWindowLong (GetHWND (), DWL_MSGRESULT, FALSE); | |
2459 | + return TRUE; | |
2460 | + break; | |
2461 | + case PSN_WIZNEXT: | |
2462 | + { | |
2463 | + LONG retval; | |
2464 | + retval = OnNext (); | |
2465 | + SetWindowLong (GetHWND (), DWL_MSGRESULT, retval); | |
2466 | + return TRUE; | |
2467 | + } | |
2468 | + break; | |
2469 | + case PSN_WIZBACK: | |
2470 | + { | |
2471 | + LONG retval; | |
2472 | + retval = OnBack (); | |
2473 | + SetWindowLong (GetHWND (), DWL_MSGRESULT, retval); | |
2474 | + return TRUE; | |
2475 | + } | |
2476 | + break; | |
2477 | + case PSN_WIZFINISH: | |
2478 | + retval = OnFinish (); | |
2479 | + // False = Allow the wizard to finish | |
2480 | + SetWindowLong (GetHWND (), DWL_MSGRESULT, FALSE); | |
2481 | + return TRUE; | |
2482 | + break; | |
2483 | + default: | |
2484 | + // Unrecognized notification | |
2485 | + return FALSE; | |
2486 | + break; | |
2487 | + } | |
2488 | + break; | |
2489 | + case WM_COMMAND: | |
2490 | + if (cmdproc != NULL) | |
2491 | + { | |
2492 | + return HANDLE_WM_COMMAND (GetHWND (), wParam, lParam, cmdproc); | |
2493 | + } | |
2494 | + break; | |
2495 | + default: | |
2496 | + break; | |
2497 | + } | |
2498 | + | |
2499 | + if ((message >= WM_APP) && (message < 0xC000)) | |
2500 | + { | |
2501 | + // It's a private app message | |
2502 | + return OnMessageApp (message, wParam, lParam); | |
2503 | + } | |
2504 | + | |
2505 | + // Wasn't handled | |
2506 | + return FALSE; | |
2507 | +} | |
2508 | Index: proppage.h | |
2509 | =================================================================== | |
2510 | RCS file: proppage.h | |
2511 | diff -N proppage.h | |
2512 | --- /dev/null Tue May 5 13:32:27 1998 | |
2513 | +++ proppage.h Thu Dec 20 04:36:02 2001 | |
2514 | @@ -0,0 +1,117 @@ | |
2515 | +#ifndef CINSTALL_PROPPAGE_H | |
2516 | +#define CINSTALL_PROPPAGE_H | |
2517 | + | |
2518 | +/* | |
2519 | + * Copyright (c) 2001, Gary R. Van Sickle. | |
2520 | + * | |
2521 | + * This program is free software; you can redistribute it and/or modify | |
2522 | + * it under the terms of the GNU General Public License as published by | |
2523 | + * the Free Software Foundation; either version 2 of the License, or | |
2524 | + * (at your option) any later version. | |
2525 | + * | |
2526 | + * A copy of the GNU General Public License can be found at | |
2527 | + * http://www.gnu.org/ | |
2528 | + * | |
2529 | + * Written by Gary R. Van Sickle <g.r.vansickle@worldnet.att.net> | |
2530 | + * | |
2531 | + */ | |
2532 | + | |
2533 | +// This is the header for the PropertyPage class. It works closely with the | |
2534 | +// PropSheet class to implement a single page of the property sheet. | |
2535 | + | |
2536 | + | |
2537 | +#include <windows.h> | |
2538 | +#include <prsht.h> | |
2539 | + | |
2540 | +#include "window.h" | |
2541 | + | |
2542 | +class PropSheet; | |
2543 | + | |
2544 | +class PropertyPage:public Window | |
2545 | +{ | |
2546 | + static bool DoOnceForSheet; | |
2547 | + PROPSHEETPAGE psp; | |
2548 | + DLGPROC proc; | |
2549 | + BOOL (*cmdproc) (HWND h, int id, HWND hwndctl, UINT code); | |
2550 | + | |
2551 | + // The sheet that owns this page. | |
2552 | + PropSheet *OurSheet; | |
2553 | + | |
2554 | + // For setting the back/finish buttons properly. | |
2555 | + bool IsFirst, IsLast; | |
2556 | + | |
2557 | + static BOOL CALLBACK FirstDialogProcReflector (HWND hwnd, UINT message, | |
2558 | + WPARAM wParam, | |
2559 | + LPARAM lParam); | |
2560 | + static BOOL CALLBACK DialogProcReflector (HWND hwnd, UINT message, | |
2561 | + WPARAM wParam, LPARAM lParam); | |
2562 | + | |
2563 | +protected: | |
2564 | + virtual BOOL CALLBACK DialogProc (UINT message, WPARAM wParam, | |
2565 | + LPARAM lParam); | |
2566 | + | |
2567 | +public: | |
2568 | + PropertyPage (); | |
2569 | + virtual ~ PropertyPage (); | |
2570 | + | |
2571 | + PROPSHEETPAGE *GetPROPSHEETPAGEPtr () | |
2572 | + { | |
2573 | + return &psp; | |
2574 | + }; | |
2575 | + | |
2576 | + // FIXME: These should be private and friended to PropSheet. | |
2577 | + void YouAreBeingAddedToASheet (PropSheet * ps) | |
2578 | + { | |
2579 | + OurSheet = ps; | |
2580 | + }; | |
2581 | + void YouAreFirst () | |
2582 | + { | |
2583 | + IsFirst = true; | |
2584 | + IsLast = false; | |
2585 | + }; | |
2586 | + void YouAreLast () | |
2587 | + { | |
2588 | + IsFirst = false; | |
2589 | + IsLast = true; | |
2590 | + }; | |
2591 | + void YouAreMiddle () | |
2592 | + { | |
2593 | + IsFirst = false; | |
2594 | + IsLast = false; | |
2595 | + }; | |
2596 | + | |
2597 | + virtual bool Create (int TemplateID); | |
2598 | + virtual bool Create (DLGPROC dlgproc, int TemplateID); | |
2599 | + virtual bool Create (DLGPROC dlgproc, | |
2600 | + BOOL (*cmdproc) (HWND h, int id, HWND hwndctl, | |
2601 | + UINT code), int TemplateID); | |
2602 | + | |
2603 | + virtual void OnInit () | |
2604 | + { | |
2605 | + }; | |
2606 | + virtual void OnActivate () | |
2607 | + { | |
2608 | + }; | |
2609 | + virtual void OnDeactivate () | |
2610 | + { | |
2611 | + }; | |
2612 | + virtual long OnNext () | |
2613 | + { | |
2614 | + return 0; | |
2615 | + }; | |
2616 | + virtual long OnBack () | |
2617 | + { | |
2618 | + return 0; | |
2619 | + }; | |
2620 | + virtual bool OnFinish () | |
2621 | + { | |
2622 | + return true; | |
2623 | + }; | |
2624 | + | |
2625 | + PropSheet *GetOwner () const | |
2626 | + { | |
2627 | + return OurSheet; | |
2628 | + }; | |
2629 | +}; | |
2630 | + | |
2631 | +#endif // CINSTALL_PROPPAGE_H | |
2632 | Index: propsheet.cc | |
2633 | =================================================================== | |
2634 | RCS file: propsheet.cc | |
2635 | diff -N propsheet.cc | |
2636 | --- /dev/null Tue May 5 13:32:27 1998 | |
2637 | +++ propsheet.cc Thu Dec 20 04:36:03 2001 | |
2638 | @@ -0,0 +1,217 @@ | |
2639 | +/* | |
2640 | + * Copyright (c) 2001, Gary R. Van Sickle. | |
2641 | + * | |
2642 | + * This program is free software; you can redistribute it and/or modify | |
2643 | + * it under the terms of the GNU General Public License as published by | |
2644 | + * the Free Software Foundation; either version 2 of the License, or | |
2645 | + * (at your option) any later version. | |
2646 | + * | |
2647 | + * A copy of the GNU General Public License can be found at | |
2648 | + * http://www.gnu.org/ | |
2649 | + * | |
2650 | + * Written by Gary R. Van Sickle <g.r.vansickle@worldnet.att.net> | |
2651 | + * | |
2652 | + */ | |
2653 | + | |
2654 | +// This is the implementation of the PropSheet class. This class encapsulates | |
2655 | +// a Windows property sheet / wizard and interfaces with the PropertyPage class. | |
2656 | +// It's named PropSheet instead of PropertySheet because the latter conflicts with | |
2657 | +// the Windows function of the same name. | |
2658 | + | |
2659 | +#include "propsheet.h" | |
2660 | +#include "proppage.h" | |
2661 | + | |
2662 | +//#include <shlwapi.h> | |
2663 | +// ...but since there is no shlwapi.h in mingw yet: | |
2664 | +typedef struct _DllVersionInfo | |
2665 | +{ | |
2666 | + DWORD cbSize; | |
2667 | + DWORD dwMajorVersion; | |
2668 | + DWORD dwMinorVersion; | |
2669 | + DWORD dwBuildNumber; | |
2670 | + DWORD dwPlatformID; | |
2671 | +} | |
2672 | +DLLVERSIONINFO; | |
2673 | +typedef HRESULT CALLBACK (*DLLGETVERSIONPROC) (DLLVERSIONINFO * pdvi); | |
2674 | +#define PROPSHEETHEADER_V1_SIZE 40 | |
2675 | + | |
2676 | + | |
2677 | + | |
2678 | +PropSheet::PropSheet () | |
2679 | +{ | |
2680 | + NumPropPages = 0; | |
2681 | +} | |
2682 | + | |
2683 | +PropSheet::~PropSheet () | |
2684 | +{ | |
2685 | +} | |
2686 | + | |
2687 | +HPROPSHEETPAGE * | |
2688 | +PropSheet::CreatePages () | |
2689 | +{ | |
2690 | + HPROPSHEETPAGE *retarray; | |
2691 | + | |
2692 | + // Create the return array | |
2693 | + retarray = new HPROPSHEETPAGE[NumPropPages]; | |
2694 | + | |
2695 | + // Create the pages with CreatePropertySheetPage(). | |
2696 | + // We do it here rather than in the PropertyPages themselves | |
2697 | + // because, for reasons known only to Microsoft, these handles will be | |
2698 | + // destroyed by the property sheet before the PropertySheet() call returns, | |
2699 | + // at least if it's modal (don't know about modeless). | |
2700 | + int i; | |
2701 | + for (i = 0; i < NumPropPages; i++) | |
2702 | + { | |
2703 | + retarray[i] = | |
2704 | + CreatePropertySheetPage (PropertyPages[i]->GetPROPSHEETPAGEPtr ()); | |
2705 | + | |
2706 | + // Set position info | |
2707 | + if (i == 0) | |
2708 | + { | |
2709 | + PropertyPages[i]->YouAreFirst (); | |
2710 | + } | |
2711 | + else if (i == NumPropPages - 1) | |
2712 | + { | |
2713 | + PropertyPages[i]->YouAreLast (); | |
2714 | + } | |
2715 | + else | |
2716 | + { | |
2717 | + PropertyPages[i]->YouAreMiddle (); | |
2718 | + } | |
2719 | + } | |
2720 | + | |
2721 | + return retarray; | |
2722 | +} | |
2723 | + | |
2724 | +static DWORD | |
2725 | +GetPROPSHEETHEADERSize () | |
2726 | +{ | |
2727 | + // For compatibility with all versions of comctl32.dll, we have to do this. | |
2728 | + | |
2729 | + DLLVERSIONINFO vi; | |
2730 | + HMODULE mod; | |
2731 | + DLLGETVERSIONPROC DllGetVersion; | |
2732 | + DWORD retval = 0; | |
2733 | + | |
2734 | + | |
2735 | + // This 'isn't safe' in a DLL, according to MSDN | |
2736 | + mod = LoadLibrary ("comctl32.dll"); | |
2737 | + | |
2738 | + DllGetVersion = (DLLGETVERSIONPROC) GetProcAddress (mod, "DllGetVersion"); | |
2739 | + if (DllGetVersion == NULL) | |
2740 | + { | |
2741 | + // Something's wildly broken, punt. | |
2742 | + retval = PROPSHEETHEADER_V1_SIZE; | |
2743 | + } | |
2744 | + else | |
2745 | + { | |
2746 | + vi.cbSize = sizeof (DLLVERSIONINFO); | |
2747 | + DllGetVersion (&vi); | |
2748 | + | |
2749 | + if ((vi.dwMajorVersion < 4) || | |
2750 | + ((vi.dwMajorVersion == 4) && (vi.dwMinorVersion < 71))) | |
2751 | + { | |
2752 | + // Recent. | |
2753 | + retval = sizeof (PROPSHEETHEADER); | |
2754 | + } | |
2755 | + else | |
2756 | + { | |
2757 | + // Old (== Win95/NT4 w/o IE 4 or better) | |
2758 | + retval = PROPSHEETHEADER_V1_SIZE; | |
2759 | + } | |
2760 | + } | |
2761 | + | |
2762 | + FreeLibrary (mod); | |
2763 | + | |
2764 | + return retval; | |
2765 | +} | |
2766 | + | |
2767 | +bool | |
2768 | +PropSheet::Create (const Window * Parent, DWORD Style) | |
2769 | +{ | |
2770 | + PROPSHEETHEADER p; | |
2771 | + | |
2772 | + PageHandles = CreatePages (); | |
2773 | + | |
2774 | + p.dwSize = GetPROPSHEETHEADERSize (); | |
2775 | + p.dwFlags = PSH_NOAPPLYNOW | PSH_WIZARD /*| PSH_MODELESS */ ; | |
2776 | + if (Parent != NULL) | |
2777 | + { | |
2778 | + p.hwndParent = Parent->GetHWND (); | |
2779 | + } | |
2780 | + else | |
2781 | + { | |
2782 | + p.hwndParent = NULL; | |
2783 | + } | |
2784 | + p.hInstance = GetInstance (); | |
2785 | + p.nPages = NumPropPages; | |
2786 | + p.nStartPage = 0; | |
2787 | + p.phpage = PageHandles; | |
2788 | + p.pfnCallback = NULL; | |
2789 | + | |
2790 | + | |
2791 | + PropertySheet (&p); | |
2792 | + | |
2793 | + // Do a modeless property sheet... | |
2794 | + //SetHWND((HWND)PropertySheet(&p)); | |
2795 | + /*Show(SW_SHOWNORMAL); | |
2796 | + | |
2797 | + // ...but pretend it's modal | |
2798 | + MessageLoop(); | |
2799 | + MessageBox(NULL, "DONE", NULL, MB_OK); | |
2800 | + | |
2801 | + // FIXME: Enable the parent before destroying this window to prevent another window | |
2802 | + // from becoming the foreground window | |
2803 | + // ala: EnableWindow(<parent_hwnd>, TRUE); | |
2804 | + //DestroyWindow(WindowHandle); | |
2805 | + */ | |
2806 | + SetHWND (NULL); | |
2807 | + | |
2808 | + | |
2809 | + return true; | |
2810 | +} | |
2811 | + | |
2812 | +void | |
2813 | +PropSheet::SetHWNDFromPage (HWND h) | |
2814 | +{ | |
2815 | + // If we're a modal dialog, there's no way for us to know our window handle unless | |
2816 | + // one of our pages tells us through this function. | |
2817 | + SetHWND (h); | |
2818 | +} | |
2819 | + | |
2820 | +void | |
2821 | +PropSheet::AddPage (PropertyPage * p) | |
2822 | +{ | |
2823 | + // Add a page to the property sheet. | |
2824 | + p->YouAreBeingAddedToASheet (this); | |
2825 | + PropertyPages[NumPropPages] = p; | |
2826 | + NumPropPages++; | |
2827 | +} | |
2828 | + | |
2829 | +bool | |
2830 | +PropSheet::SetActivePage (int i) | |
2831 | +{ | |
2832 | + // Posts a message to the message queue, so this won't block | |
2833 | + return static_cast < bool > (::PropSheet_SetCurSel (GetHWND (), NULL, i)); | |
2834 | +} | |
2835 | + | |
2836 | +bool | |
2837 | +PropSheet::SetActivePageByID (int resource_id) | |
2838 | +{ | |
2839 | + // Posts a message to the message queue, so this won't block | |
2840 | + return static_cast < bool > | |
2841 | + (::PropSheet_SetCurSelByID (GetHWND (), resource_id)); | |
2842 | +} | |
2843 | + | |
2844 | +void | |
2845 | +PropSheet::SetButtons (DWORD flags) | |
2846 | +{ | |
2847 | + // Posts a message to the message queue, so this won't block | |
2848 | + ::PropSheet_SetWizButtons (GetHWND (), flags); | |
2849 | +} | |
2850 | + | |
2851 | +void | |
2852 | +PropSheet::PressButton (int button) | |
2853 | +{ | |
2854 | + ::PropSheet_PressButton (GetHWND (), button); | |
2855 | +} | |
2856 | Index: propsheet.h | |
2857 | =================================================================== | |
2858 | RCS file: propsheet.h | |
2859 | diff -N propsheet.h | |
2860 | --- /dev/null Tue May 5 13:32:27 1998 | |
2861 | +++ propsheet.h Thu Dec 20 04:36:03 2001 | |
2862 | @@ -0,0 +1,59 @@ | |
2863 | +#ifndef CINSTALL_PROPSHEET_H | |
2864 | +#define CINSTALL_PROPSHEET_H | |
2865 | + | |
2866 | +/* | |
2867 | + * Copyright (c) 2001, Gary R. Van Sickle. | |
2868 | + * | |
2869 | + * This program is free software; you can redistribute it and/or modify | |
2870 | + * it under the terms of the GNU General Public License as published by | |
2871 | + * the Free Software Foundation; either version 2 of the License, or | |
2872 | + * (at your option) any later version. | |
2873 | + * | |
2874 | + * A copy of the GNU General Public License can be found at | |
2875 | + * http://www.gnu.org/ | |
2876 | + * | |
2877 | + * Written by Gary R. Van Sickle <g.r.vansickle@worldnet.att.net> | |
2878 | + * | |
2879 | + */ | |
2880 | + | |
2881 | +// This is the header for the PropSheet class. This class encapsulates | |
2882 | +// a Windows property sheet / wizard and interfaces with the PropertyPage class. | |
2883 | +// It's named PropSheet instead of PropertySheet because the latter conflicts with | |
2884 | +// the Windows function of the same name. | |
2885 | + | |
2886 | + | |
2887 | +#include <windows.h> | |
2888 | +#include <prsht.h> | |
2889 | + | |
2890 | +#include "window.h" | |
2891 | + | |
2892 | +class PropertyPage; | |
2893 | + | |
2894 | +class PropSheet:public Window | |
2895 | +{ | |
2896 | + PropertyPage *PropertyPages[MAXPROPPAGES]; | |
2897 | + int NumPropPages; | |
2898 | + | |
2899 | + HPROPSHEETPAGE *PageHandles; | |
2900 | + HPROPSHEETPAGE *CreatePages (); | |
2901 | + | |
2902 | +public: | |
2903 | + PropSheet (); | |
2904 | + virtual ~ PropSheet (); | |
2905 | + | |
2906 | + // Should be private and friended to PropertyPage | |
2907 | + void SetHWNDFromPage (HWND h); | |
2908 | + | |
2909 | + virtual bool Create (const Window * Parent = NULL, | |
2910 | + DWORD Style = | |
2911 | + WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CLIPCHILDREN); | |
2912 | + | |
2913 | + void AddPage (PropertyPage * p); | |
2914 | + | |
2915 | + bool SetActivePage (int i); | |
2916 | + bool SetActivePageByID (int resource_id); | |
2917 | + void SetButtons (DWORD flags); | |
2918 | + void PressButton (int button); | |
2919 | +}; | |
2920 | + | |
2921 | +#endif // CINSTALL_PROPSHEET_H | |
2922 | Index: res.rc | |
2923 | =================================================================== | |
2924 | RCS file: /cvs/src/src/winsup/cinstall/res.rc,v | |
2925 | retrieving revision 2.31 | |
2926 | diff -u -p -r2.31 res.rc | |
2927 | --- res.rc 2001/12/03 22:22:09 2.31 | |
2928 | +++ res.rc 2001/12/20 12:36:03 | |
2929 | @@ -29,7 +29,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_U | |
2930 | // | |
2931 | ||
2932 | IDD_SOURCE DIALOG DISCARDABLE 0, 0, 215, 95 | |
2933 | -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU | |
2934 | +STYLE DS_MODALFRAME | DS_CENTER | WS_CHILD | WS_CAPTION | WS_SYSMENU | |
2935 | CAPTION "Cygwin Setup" | |
2936 | FONT 8, "MS Sans Serif" | |
2937 | BEGIN | |
2938 | @@ -40,26 +40,21 @@ BEGIN | |
2939 | BS_AUTORADIOBUTTON,55,30,89,10 | |
2940 | CONTROL "Install from &Local Directory",IDC_SOURCE_CWD,"Button", | |
2941 | BS_AUTORADIOBUTTON,55,45,99,10 | |
2942 | - DEFPUSHBUTTON "&Next -->",IDOK,100,75,45,15 | |
2943 | - PUSHBUTTON "Cancel",IDCANCEL,165,75,45,15 | |
2944 | END | |
2945 | ||
2946 | -IDD_LOCAL_DIR DIALOG DISCARDABLE 0, 0, 215, 95 | |
2947 | -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU | |
2948 | +IDD_LOCAL_DIR DIALOG DISCARDABLE 0, 0, 227, 94 | |
2949 | +STYLE DS_MODALFRAME | DS_CENTER | WS_CHILD | WS_CAPTION | WS_SYSMENU | |
2950 | CAPTION "Cygwin Setup" | |
2951 | FONT 8, "MS Sans Serif" | |
2952 | BEGIN | |
2953 | ICON IDI_CYGWIN,IDC_STATIC,5,5,20,20 | |
2954 | - PUSHBUTTON "B&rowse...",IDC_LOCAL_DIR_BROWSE,150,10,34,14 | |
2955 | + PUSHBUTTON "B&rowse...",IDC_LOCAL_DIR_BROWSE,185,30,34,14 | |
2956 | LTEXT "Local Package &Directory",IDC_STATIC,55,15,85,11 | |
2957 | - EDITTEXT IDC_LOCAL_DIR,55,25,127,12,ES_AUTOHSCROLL | |
2958 | - DEFPUSHBUTTON "&Next -->",IDOK,100,75,45,15 | |
2959 | - PUSHBUTTON "Cancel",IDCANCEL,165,75,45,15 | |
2960 | - PUSHBUTTON "<-- &Back",IDC_BACK,55,75,45,15 | |
2961 | + EDITTEXT IDC_LOCAL_DIR,55,30,127,15,ES_AUTOHSCROLL | |
2962 | END | |
2963 | ||
2964 | IDD_ROOT DIALOG DISCARDABLE 0, 0, 215, 95 | |
2965 | -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU | |
2966 | +STYLE DS_MODALFRAME | DS_CENTER | WS_CHILD | WS_CAPTION | WS_SYSMENU | |
2967 | CAPTION "Cygwin Setup" | |
2968 | FONT 8, "MS Sans Serif" | |
2969 | BEGIN | |
2970 | @@ -77,23 +72,17 @@ BEGIN | |
2971 | WS_GROUP,125,60,25,8 | |
2972 | CONTROL "Just &Me",IDC_ROOT_USER,"Button",BS_AUTORADIOBUTTON,160, | |
2973 | 60,50,8 | |
2974 | - DEFPUSHBUTTON "&Next -->",IDOK,100,75,45,15 | |
2975 | - PUSHBUTTON "Cancel",IDCANCEL,165,75,45,15 | |
2976 | - PUSHBUTTON "<-- &Back",IDC_BACK,55,75,45,15 | |
2977 | END | |
2978 | ||
2979 | -IDD_SITE DIALOG DISCARDABLE 0, 0, 222, 206 | |
2980 | -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU | |
2981 | +IDD_SITE DIALOG DISCARDABLE 0, 0, 247, 94 | |
2982 | +STYLE DS_MODALFRAME | DS_CENTER | WS_CHILD | WS_CAPTION | WS_SYSMENU | |
2983 | CAPTION "Cygwin Setup" | |
2984 | FONT 8, "MS Sans Serif" | |
2985 | BEGIN | |
2986 | ICON IDI_CYGWIN,IDC_STATIC,5,5,20,20 | |
2987 | - LTEXT "Select Download &Sites",IDC_STATIC,55,5,135,11 | |
2988 | - LISTBOX IDC_URL_LIST,55,20,160,155,LBS_NOINTEGRALHEIGHT | | |
2989 | - LBS_EXTENDEDSEL | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP | |
2990 | - DEFPUSHBUTTON "&Next -->",IDOK,105,185,45,15 | |
2991 | - PUSHBUTTON "Cancel",IDCANCEL,170,185,45,15 | |
2992 | - PUSHBUTTON "<-- &Back",IDC_BACK,60,185,45,15 | |
2993 | + LTEXT "Select Download &Site",IDC_STATIC,55,5,135,11 | |
2994 | + LISTBOX IDC_URL_LIST,55,20,185,65,LBS_NOINTEGRALHEIGHT | | |
2995 | + LBS_EXTENDEDSEL | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP | |
2996 | END | |
2997 | ||
2998 | IDD_OTHER_URL DIALOG DISCARDABLE 0, 0, 215, 95 | |
2999 | @@ -109,32 +98,31 @@ BEGIN | |
3000 | PUSHBUTTON "<-- &Back",IDC_BACK,55,75,45,15 | |
3001 | END | |
3002 | ||
3003 | -IDD_NET DIALOGEX 0, 0, 215, 95 | |
3004 | -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU | |
3005 | +IDD_NET DIALOG DISCARDABLE 0, 0, 247, 106 | |
3006 | +STYLE DS_MODALFRAME | DS_CENTER | WS_CHILD | WS_CAPTION | WS_SYSMENU | |
3007 | CAPTION "Cygwin Setup" | |
3008 | FONT 8, "MS Sans Serif" | |
3009 | BEGIN | |
3010 | - ICON IDI_CYGWIN,IDC_STATIC,5,5,20,20 | |
3011 | CONTROL "&Direct Connection",IDC_NET_DIRECT,"Button", | |
3012 | - BS_AUTORADIOBUTTON,55,10,73,10 | |
3013 | + BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,55,10,73,10 | |
3014 | CONTROL "Use &IE5 Settings",IDC_NET_IE5,"Button", | |
3015 | - BS_AUTORADIOBUTTON,55,25,69,10 | |
3016 | + BS_AUTORADIOBUTTON | WS_TABSTOP,55,25,69,10 | |
3017 | CONTROL "Use HTTP/FTP &Proxy:",IDC_NET_PROXY,"Button", | |
3018 | - BS_AUTORADIOBUTTON,55,40,88,10 | |
3019 | - LTEXT "Proxy &Host",IDC_STATIC,10,55,50,15,SS_CENTERIMAGE, | |
3020 | - WS_EX_RIGHT | |
3021 | - EDITTEXT IDC_PROXY_HOST,65,55,80,12,ES_AUTOHSCROLL | WS_DISABLED | |
3022 | - LTEXT "Por&t",IDC_STATIC,155,55,20,15,SS_CENTERIMAGE, | |
3023 | - WS_EX_RIGHT | |
3024 | - EDITTEXT IDC_PROXY_PORT,180,55,30,12,ES_AUTOHSCROLL | WS_DISABLED | |
3025 | - DEFPUSHBUTTON "&Next -->",IDOK,100,75,45,15 | |
3026 | - PUSHBUTTON "Cancel",IDCANCEL,165,75,45,15 | |
3027 | - PUSHBUTTON "<-- &Back",IDC_BACK,55,75,45,15 | |
3028 | + BS_AUTORADIOBUTTON | WS_TABSTOP,55,40,88,10 | |
3029 | + EDITTEXT IDC_PROXY_HOST,115,60,120,12,ES_AUTOHSCROLL | | |
3030 | + WS_DISABLED | WS_GROUP | |
3031 | + EDITTEXT IDC_PROXY_PORT,115,80,30,12,ES_AUTOHSCROLL | WS_DISABLED | |
3032 | + GROUPBOX "",IDC_STATIC,55,50,185,50 | |
3033 | + ICON IDI_CYGWIN,IDC_STATIC,5,5,21,20 | |
3034 | + RTEXT "Proxy &Host",IDC_STATIC,60,60,50,12,SS_CENTERIMAGE | | |
3035 | + NOT WS_GROUP | |
3036 | + RTEXT "Por&t",IDC_STATIC,80,80,30,12,SS_CENTERIMAGE | NOT | |
3037 | + WS_GROUP | |
3038 | END | |
3039 | ||
3040 | IDD_DLSTATUS DIALOG DISCARDABLE 0, 0, 215, 95 | |
3041 | -STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | WS_VISIBLE | | |
3042 | - WS_CAPTION | WS_SYSMENU | |
3043 | +STYLE DS_MODALFRAME | DS_CENTER | WS_CHILD | WS_VISIBLE | WS_CAPTION | | |
3044 | + WS_SYSMENU | |
3045 | CAPTION "Cygwin Setup" | |
3046 | FONT 8, "MS Sans Serif" | |
3047 | BEGIN | |
3048 | @@ -154,26 +142,25 @@ BEGIN | |
3049 | RTEXT "Disk",IDC_DLS_IPROGRESS_TEXT,5,60,45,8 | |
3050 | END | |
3051 | ||
3052 | -IDD_INSTATUS DIALOG DISCARDABLE 0, 0, 215, 95 | |
3053 | -STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | WS_VISIBLE | | |
3054 | - WS_CAPTION | WS_SYSMENU | |
3055 | +IDD_INSTATUS DIALOG DISCARDABLE 0, 0, 252, 94 | |
3056 | +STYLE DS_MODALFRAME | DS_CENTER | WS_CHILD | WS_VISIBLE | WS_CAPTION | | |
3057 | + WS_SYSMENU | |
3058 | CAPTION "Cygwin Setup" | |
3059 | FONT 8, "MS Sans Serif" | |
3060 | BEGIN | |
3061 | - ICON IDI_CYGWIN,IDC_STATIC,5,5,20,20 | |
3062 | - PUSHBUTTON "Cancel",IDCANCEL,165,75,45,15 | |
3063 | + ICON IDI_CYGWIN,IDC_STATIC,5,5,21,20 | |
3064 | LTEXT "Installing...",IDC_INS_ACTION,55,5,135,8 | |
3065 | LTEXT "(PKG)",IDC_INS_PKG,55,15,150,8 | |
3066 | LTEXT "(FILE)",IDC_INS_FILE,55,25,155,8 | |
3067 | CONTROL "Progress1",IDC_INS_DISKFULL,"msctls_progress32", | |
3068 | - PBS_SMOOTH | WS_BORDER,55,60,155,10 | |
3069 | + PBS_SMOOTH | WS_BORDER,90,60,155,10 | |
3070 | CONTROL "Progress1",IDC_INS_IPROGRESS,"msctls_progress32", | |
3071 | - PBS_SMOOTH | WS_BORDER,55,50,155,10 | |
3072 | + PBS_SMOOTH | WS_BORDER,90,50,155,10 | |
3073 | CONTROL "Progress1",IDC_INS_PPROGRESS,"msctls_progress32", | |
3074 | - PBS_SMOOTH | WS_BORDER,55,40,155,10 | |
3075 | - RTEXT "Package",IDC_STATIC,5,40,45,8 | |
3076 | - RTEXT "Total",IDC_STATIC,10,50,40,8 | |
3077 | - RTEXT "Disk",IDC_STATIC,5,60,45,8 | |
3078 | + PBS_SMOOTH | WS_BORDER,90,40,155,10 | |
3079 | + RTEXT "Package",IDC_INS_BL_PACKAGE,40,40,45,8 | |
3080 | + RTEXT "Total",IDC_INS_BL_TOTAL,45,50,40,8 | |
3081 | + RTEXT "Disk",IDC_INS_BL_DISK,40,60,45,8 | |
3082 | END | |
3083 | ||
3084 | IDD_PROXY_AUTH DIALOG DISCARDABLE 0, 0, 215, 95 | |
3085 | @@ -210,8 +197,9 @@ BEGIN | |
3086 | PUSHBUTTON "Cancel",IDCANCEL,165,75,45,15 | |
3087 | END | |
3088 | ||
3089 | -IDD_SPLASH DIALOG DISCARDABLE 0, 0, 215, 95 | |
3090 | -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU | |
3091 | +IDD_SPLASH DIALOG DISCARDABLE 0, 0, 216, 94 | |
3092 | +STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_CHILD | WS_VISIBLE | | |
3093 | + WS_CAPTION | WS_SYSMENU | |
3094 | CAPTION "Cygwin Setup" | |
3095 | FONT 8, "MS Sans Serif" | |
3096 | BEGIN | |
3097 | @@ -223,17 +211,26 @@ BEGIN | |
3098 | 8 | |
3099 | LTEXT "http://sources.redhat.com/cygwin/",IDC_STATIC,55,50,112, | |
3100 | 8 | |
3101 | - DEFPUSHBUTTON "&Next -->",IDOK,100,75,45,15 | |
3102 | - PUSHBUTTON "Cancel",IDCANCEL,165,75,45,15 | |
3103 | END | |
3104 | ||
3105 | -IDD_CHOOSE DIALOG DISCARDABLE 0, 0, 429, 266 | |
3106 | -STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_POPUP | WS_CAPTION | | |
3107 | - WS_SYSMENU | |
3108 | +IDD_CHOOSE DIALOGEX 0, 0, 430, 266 | |
3109 | +STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_CHILD | WS_VISIBLE | | |
3110 | + WS_CAPTION | WS_SYSMENU | |
3111 | +EXSTYLE WS_EX_CONTROLPARENT | |
3112 | CAPTION "Cygwin Setup" | |
3113 | FONT 8, "MS Sans Serif" | |
3114 | BEGIN | |
3115 | - ICON IDI_CYGWIN,IDC_STATIC,0,2,21,20 | |
3116 | + DEFPUSHBUTTON "&Next -->",IDOK,311,242,45,15,WS_GROUP | |
3117 | + PUSHBUTTON "Cancel",IDCANCEL,375,242,45,15 | |
3118 | + PUSHBUTTON "<-- &Back",IDC_BACK,266,242,45,15 | |
3119 | + CONTROL "&Prev",IDC_CHOOSE_PREV,"Button",BS_AUTORADIOBUTTON | | |
3120 | + WS_GROUP | WS_TABSTOP,265,5,27,10 | |
3121 | + CONTROL "&Curr",IDC_CHOOSE_CURR,"Button",BS_AUTORADIOBUTTON,297, | |
3122 | + 5,25,10 | |
3123 | + CONTROL "E&xp",IDC_CHOOSE_EXP,"Button",BS_AUTORADIOBUTTON,323,5, | |
3124 | + 25,10 | |
3125 | + PUSHBUTTON "&View",IDC_CHOOSE_VIEW,353,5,20,10,WS_GROUP | |
3126 | + ICON IDI_CYGWIN,IDC_STATIC,0,2,20,20 | |
3127 | LTEXT "Select packages to install",IDC_CHOOSE_INST_TEXT,125,5, | |
3128 | 99,8 | |
3129 | CONTROL "",IDC_LISTVIEW_POS,"Static",SS_BLACKFRAME | NOT | |
3130 | @@ -241,21 +238,12 @@ BEGIN | |
3131 | CONTROL "SPIN",IDC_STATIC,"Static",SS_BITMAP,22,235,15,13 | |
3132 | LTEXT "= click to choose action, (p) = previous version, (x) = experimental", | |
3133 | IDC_STATIC,35,234,220,8 | |
3134 | - PUSHBUTTON "&View",IDC_CHOOSE_VIEW,353,5,20,10 | |
3135 | LTEXT "",IDC_CHOOSE_VIEWCAPTION,390,5,30,10 | |
3136 | - CONTROL "E&xp",IDC_CHOOSE_EXP,"Button",BS_AUTORADIOBUTTON | | |
3137 | - WS_GROUP,323,5,25,10 | |
3138 | - CONTROL "&Prev",IDC_CHOOSE_PREV,"Button",BS_AUTORADIOBUTTON,265, | |
3139 | - 5,27,10 | |
3140 | - CONTROL "&Curr",IDC_CHOOSE_CURR,"Button",BS_AUTORADIOBUTTON,297, | |
3141 | - 5,25,10 | |
3142 | - DEFPUSHBUTTON "&Next -->",IDOK,311,242,45,15 | |
3143 | - PUSHBUTTON "Cancel",IDCANCEL,375,242,45,15 | |
3144 | - PUSHBUTTON "<-- &Back",IDC_BACK,266,242,45,15 | |
3145 | END | |
3146 | ||
3147 | IDD_DESKTOP DIALOG DISCARDABLE 0, 0, 215, 95 | |
3148 | -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU | |
3149 | +STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_CHILD | WS_VISIBLE | | |
3150 | + WS_CAPTION | WS_SYSMENU | |
3151 | CAPTION "Cygwin Setup" | |
3152 | FONT 8, "MS Sans Serif" | |
3153 | BEGIN | |
3154 | @@ -264,12 +252,9 @@ BEGIN | |
3155 | BS_AUTOCHECKBOX,55,25,100,8 | |
3156 | CONTROL "Add to &Start Menu",IDC_ROOT_MENU,"Button", | |
3157 | BS_AUTOCHECKBOX,55,40,100,8 | |
3158 | - DEFPUSHBUTTON "&Next -->",IDOK,100,75,45,15 | |
3159 | - PUSHBUTTON "Cancel",IDCANCEL,165,75,45,15 | |
3160 | - PUSHBUTTON "<-- &Back",IDC_BACK,55,75,45,15 | |
3161 | END | |
3162 | ||
3163 | -IDD_FTP_AUTH DIALOGEX 0, 0, 215, 95 | |
3164 | +IDD_FTP_AUTH DIALOG DISCARDABLE 0, 0, 215, 95 | |
3165 | STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU | |
3166 | CAPTION "Cygwin Setup" | |
3167 | FONT 8, "MS Sans Serif" | |
3168 | @@ -286,7 +271,16 @@ BEGIN | |
3169 | PUSHBUTTON "Cancel",IDCANCEL,165,75,45,15 | |
3170 | END | |
3171 | ||
3172 | +IDD_CHOOSER DIALOG DISCARDABLE 0, 0, 186, 90 | |
3173 | +STYLE DS_MODALFRAME | DS_3DLOOK | WS_CHILD | WS_VISIBLE | WS_CAPTION | | |
3174 | + WS_SYSMENU | |
3175 | +CAPTION "Cygwin Setup" | |
3176 | +FONT 8, "MS Sans Serif" | |
3177 | +BEGIN | |
3178 | + LTEXT "Don't look here",IDC_STATIC,25,38,134,8 | |
3179 | +END | |
3180 | ||
3181 | + | |
3182 | #ifdef APSTUDIO_INVOKED | |
3183 | ///////////////////////////////////////////////////////////////////////////// | |
3184 | // | |
3185 | @@ -339,9 +333,21 @@ CYGWIN.ICON FILE DISCARDA | |
3186 | #ifdef APSTUDIO_INVOKED | |
3187 | GUIDELINES DESIGNINFO DISCARDABLE | |
3188 | BEGIN | |
3189 | + IDD_LOCAL_DIR, DIALOG | |
3190 | + BEGIN | |
3191 | + RIGHTMARGIN, 215 | |
3192 | + END | |
3193 | + | |
3194 | + IDD_SITE, DIALOG | |
3195 | + BEGIN | |
3196 | + RIGHTMARGIN, 215 | |
3197 | + BOTTOMMARGIN, 93 | |
3198 | + END | |
3199 | + | |
3200 | IDD_NET, DIALOG | |
3201 | BEGIN | |
3202 | - BOTTOMMARGIN, 49 | |
3203 | + RIGHTMARGIN, 215 | |
3204 | + BOTTOMMARGIN, 60 | |
3205 | END | |
3206 | ||
3207 | IDD_PROXY_AUTH, DIALOG | |
3208 | @@ -354,10 +360,23 @@ BEGIN | |
3209 | BOTTOMMARGIN, 49 | |
3210 | END | |
3211 | ||
3212 | + IDD_CHOOSE, DIALOG | |
3213 | + BEGIN | |
3214 | + RIGHTMARGIN, 429 | |
3215 | + END | |
3216 | + | |
3217 | IDD_FTP_AUTH, DIALOG | |
3218 | BEGIN | |
3219 | BOTTOMMARGIN, 49 | |
3220 | END | |
3221 | + | |
3222 | + IDD_CHOOSER, DIALOG | |
3223 | + BEGIN | |
3224 | + LEFTMARGIN, 7 | |
3225 | + RIGHTMARGIN, 179 | |
3226 | + TOPMARGIN, 7 | |
3227 | + BOTTOMMARGIN, 83 | |
3228 | + END | |
3229 | END | |
3230 | #endif // APSTUDIO_INVOKED | |
3231 | ||
3232 | @@ -409,6 +428,7 @@ BEGIN | |
3233 | IDS_DOWNLOAD_FAILED "Unable to download %s" | |
3234 | IDS_DOWNLOAD_INCOMPLETE "Download Incomplete. Try again?" | |
3235 | IDS_INSTALL_INCOMPLETE "Installation incomplete. Check /setup.log.full for details" | |
3236 | + IDS_VERSION_INFO "Setup.exe version %1" | |
3237 | END | |
3238 | ||
3239 | #endif // English (U.S.) resources | |
3240 | Index: resource.h | |
3241 | =================================================================== | |
3242 | RCS file: /cvs/src/src/winsup/cinstall/resource.h,v | |
3243 | retrieving revision 2.13 | |
3244 | diff -u -p -r2.13 resource.h | |
3245 | --- resource.h 2001/12/20 11:49:54 2.13 | |
3246 | +++ resource.h 2001/12/20 12:36:03 | |
3247 | @@ -27,6 +27,7 @@ | |
3248 | #define IDS_DOWNLOAD_FAILED 25 | |
3249 | #define IDS_DOWNLOAD_INCOMPLETE 26 | |
3250 | #define IDS_INSTALL_INCOMPLETE 27 | |
3251 | +#define IDS_VERSION_INFO 28 | |
3252 | #define IDD_ROOT 101 | |
3253 | #define IDD_SOURCE 102 | |
3254 | #define IDD_OTHER_URL 103 | |
3255 | @@ -53,6 +54,7 @@ | |
3256 | #define IDB_CHECK_NO 124 | |
3257 | #define IDB_CHECK_NA 125 | |
3258 | #define IDD_FTP_AUTH 126 | |
3259 | +#define IDD_CHOOSER 127 | |
3260 | #define IDC_SOURCE_DOWNLOAD 1000 | |
3261 | #define IDC_SOURCE_NETINST 1001 | |
3262 | #define IDC_SOURCE_CWD 1002 | |
3263 | @@ -99,9 +101,12 @@ | |
3264 | #define IDC_DLS_PROGRESS_TEXT 1047 | |
3265 | #define IDC_DLS_PPROGRESS_TEXT 1048 | |
3266 | #define IDC_DLS_IPROGRESS_TEXT 1049 | |
3267 | -#define IDC_CHOOSE_INST_TEXT 1050 | |
3268 | +#define IDC_CHOOSE_INST_TEXT 1050 | |
3269 | #define IDC_CHOOSE_VIEWCAPTION 1051 | |
3270 | #define IDC_CHOOSE_LISTHEADER 1052 | |
3271 | +#define IDC_INS_BL_PACKAGE 1053 | |
3272 | +#define IDC_INS_BL_TOTAL 1054 | |
3273 | +#define IDC_INS_BL_DISK 1055 | |
3274 | #define IDC_STATIC -1 | |
3275 | ||
3276 | // Next default values for new objects | |
3277 | @@ -110,9 +115,9 @@ | |
3278 | #ifndef APSTUDIO_READONLY_SYMBOLS | |
3279 | #define _APS_NO_MFC 1 | |
3280 | #define _APS_3D_CONTROLS 1 | |
3281 | -#define _APS_NEXT_RESOURCE_VALUE 127 | |
3282 | +#define _APS_NEXT_RESOURCE_VALUE 128 | |
3283 | #define _APS_NEXT_COMMAND_VALUE 40003 | |
3284 | -#define _APS_NEXT_CONTROL_VALUE 1053 | |
3285 | +#define _APS_NEXT_CONTROL_VALUE 1056 | |
3286 | #define _APS_NEXT_SYMED_VALUE 101 | |
3287 | #endif | |
3288 | #endif | |
3289 | Index: root.cc | |
3290 | =================================================================== | |
3291 | RCS file: /cvs/src/src/winsup/cinstall/root.cc,v | |
3292 | retrieving revision 2.7 | |
3293 | diff -u -p -r2.7 root.cc | |
3294 | --- root.cc 2001/11/13 01:49:32 2.7 | |
3295 | +++ root.cc 2001/12/20 12:36:03 | |
3296 | @@ -35,6 +35,7 @@ static const char *cvsid = | |
3297 | #include "mount.h" | |
3298 | #include "concat.h" | |
3299 | #include "log.h" | |
3300 | +#include "root.h" | |
3301 | ||
3302 | static int rb[] = { IDC_ROOT_TEXT, IDC_ROOT_BINARY, 0 }; | |
3303 | static int su[] = { IDC_ROOT_SYSTEM, IDC_ROOT_USER, 0 }; | |
3304 | @@ -143,64 +144,56 @@ dialog_cmd (HWND h, int id, HWND hwndctl | |
3305 | case IDC_ROOT_BROWSE: | |
3306 | browse (h); | |
3307 | break; | |
3308 | - | |
3309 | - case IDOK: | |
3310 | - save_dialog (h); | |
3311 | - | |
3312 | - if (!directory_is_absolute ()) | |
3313 | - { | |
3314 | - note (IDS_ROOT_ABSOLUTE); | |
3315 | - break; | |
3316 | - } | |
3317 | - | |
3318 | - if (directory_is_rootdir ()) | |
3319 | - if (IDNO == yesno (IDS_ROOT_SLASH)) | |
3320 | - break; | |
3321 | - | |
3322 | - if (directory_has_spaces ()) | |
3323 | - if (IDNO == yesno (IDS_ROOT_SPACE)) | |
3324 | - break; | |
3325 | - | |
3326 | - NEXT (IDD_LOCAL_DIR); | |
3327 | - break; | |
3328 | - | |
3329 | - case IDC_BACK: | |
3330 | - save_dialog (h); | |
3331 | - NEXT (IDD_SOURCE); | |
3332 | - break; | |
3333 | - | |
3334 | - case IDCANCEL: | |
3335 | - NEXT (0); | |
3336 | - break; | |
3337 | } | |
3338 | return 0; | |
3339 | } | |
3340 | ||
3341 | -static BOOL CALLBACK | |
3342 | -dialog_proc (HWND h, UINT message, WPARAM wParam, LPARAM lParam) | |
3343 | +bool | |
3344 | +RootPage::Create () | |
3345 | { | |
3346 | - switch (message) | |
3347 | - { | |
3348 | - case WM_INITDIALOG: | |
3349 | - load_dialog (h); | |
3350 | - return FALSE; | |
3351 | - case WM_COMMAND: | |
3352 | - return HANDLE_WM_COMMAND (h, wParam, lParam, dialog_cmd); | |
3353 | - } | |
3354 | - return FALSE; | |
3355 | + return PropertyPage::Create (NULL, dialog_cmd, IDD_ROOT); | |
3356 | } | |
3357 | ||
3358 | void | |
3359 | -do_root (HINSTANCE h) | |
3360 | +RootPage::OnInit () | |
3361 | { | |
3362 | - int rv = 0; | |
3363 | if (!get_root_dir ()) | |
3364 | read_mounts (); | |
3365 | - rv = DialogBox (h, MAKEINTRESOURCE (IDD_ROOT), 0, dialog_proc); | |
3366 | - if (rv == -1) | |
3367 | - fatal (IDS_DIALOG_FAILED); | |
3368 | + load_dialog (GetHWND ()); | |
3369 | +} | |
3370 | ||
3371 | +long | |
3372 | +RootPage::OnNext () | |
3373 | +{ | |
3374 | + HWND h = GetHWND (); | |
3375 | + | |
3376 | + save_dialog (h); | |
3377 | + | |
3378 | + if (!directory_is_absolute ()) | |
3379 | + { | |
3380 | + note (h, IDS_ROOT_ABSOLUTE); | |
3381 | + return -1; | |
3382 | + } | |
3383 | + else if (directory_is_rootdir () && (IDNO == yesno (h, IDS_ROOT_SLASH))) | |
3384 | + return -1; | |
3385 | + else if (directory_has_spaces () && (IDNO == yesno (h, IDS_ROOT_SPACE))) | |
3386 | + return -1; | |
3387 | + | |
3388 | + NEXT (IDD_LOCAL_DIR); | |
3389 | + | |
3390 | log (0, "root: %s %s %s", get_root_dir (), | |
3391 | (root_text == IDC_ROOT_TEXT) ? "text" : "binary", | |
3392 | (root_scope == IDC_ROOT_USER) ? "user" : "system"); | |
3393 | + | |
3394 | + return 0; | |
3395 | +} | |
3396 | + | |
3397 | +long | |
3398 | +RootPage::OnBack () | |
3399 | +{ | |
3400 | + HWND h = GetHWND (); | |
3401 | + | |
3402 | + save_dialog (h); | |
3403 | + NEXT (IDD_SOURCE); | |
3404 | + return 0; | |
3405 | } | |
3406 | Index: root.h | |
3407 | =================================================================== | |
3408 | RCS file: root.h | |
3409 | diff -N root.h | |
3410 | --- /dev/null Tue May 5 13:32:27 1998 | |
3411 | +++ root.h Thu Dec 20 04:36:03 2001 | |
3412 | @@ -0,0 +1,23 @@ | |
3413 | +#ifndef CINSTALL_ROOT_H | |
3414 | +#define CINSTALL_ROOT_H | |
3415 | + | |
3416 | +#include "proppage.h" | |
3417 | + | |
3418 | +class RootPage:public PropertyPage | |
3419 | +{ | |
3420 | +public: | |
3421 | + RootPage () | |
3422 | + { | |
3423 | + }; | |
3424 | + virtual ~ RootPage () | |
3425 | + { | |
3426 | + }; | |
3427 | + | |
3428 | + bool Create (); | |
3429 | + | |
3430 | + void OnInit (); | |
3431 | + virtual long OnNext (); | |
3432 | + virtual long OnBack (); | |
3433 | +}; | |
3434 | + | |
3435 | +#endif // CINSTALL_ROOT_H | |
3436 | Index: site.cc | |
3437 | =================================================================== | |
3438 | RCS file: /cvs/src/src/winsup/cinstall/site.cc,v | |
3439 | retrieving revision 2.10 | |
3440 | diff -u -p -r2.10 site.cc | |
3441 | --- site.cc 2001/12/03 22:22:09 2.10 | |
3442 | +++ site.cc 2001/12/20 12:36:03 | |
3443 | @@ -25,6 +25,7 @@ static const char *cvsid = | |
3444 | #include <stdio.h> | |
3445 | #include <stdlib.h> | |
3446 | #include <string.h> | |
3447 | +#include <process.h> | |
3448 | ||
3449 | #include "dialog.h" | |
3450 | #include "resource.h" | |
3451 | @@ -38,6 +39,12 @@ static const char *cvsid = | |
3452 | ||
3453 | #include "port.h" | |
3454 | ||
3455 | +#include "site.h" | |
3456 | +#include "propsheet.h" | |
3457 | + | |
3458 | +#include "threebar.h" | |
3459 | +extern ThreeBarProgressPage Progress; | |
3460 | + | |
3461 | #define NO_IDX (-1) | |
3462 | #define OTHER_IDX (-2) | |
3463 | ||
3464 | @@ -101,7 +108,12 @@ load_dialog (HWND h) | |
3465 | int index = SendMessage (listbox, LB_FINDSTRING, (WPARAM) - 1, | |
3466 | (LPARAM) site_list[n]->displayed_url); | |
3467 | if (index != LB_ERR) | |
3468 | - SendMessage (listbox, LB_SELITEMRANGE, TRUE, (index << 16) | index); | |
3469 | + { | |
3470 | + // Highlight the selected item | |
3471 | + SendMessage (listbox, LB_SELITEMRANGE, TRUE, (index << 16) | index); | |
3472 | + // Make sure it's fully visible | |
3473 | + SendMessage (listbox, LB_SETCARETINDEX, index, FALSE); | |
3474 | + } | |
3475 | } | |
3476 | check_if_enable_next (h); | |
3477 | } | |
3478 | @@ -167,63 +179,18 @@ dialog_cmd (HWND h, int id, HWND hwndctl | |
3479 | case IDC_URL_LIST: | |
3480 | check_if_enable_next (h); | |
3481 | break; | |
3482 | - | |
3483 | - case IDOK: | |
3484 | - save_dialog (h); | |
3485 | - if (mirror_idx == OTHER_IDX) | |
3486 | - NEXT (IDD_OTHER_URL); | |
3487 | - else | |
3488 | - { | |
3489 | - save_site_url (); | |
3490 | - NEXT (IDD_S_LOAD_INI); | |
3491 | - } | |
3492 | - break; | |
3493 | - | |
3494 | - case IDC_BACK: | |
3495 | - save_dialog (h); | |
3496 | - NEXT (IDD_NET); | |
3497 | - break; | |
3498 | - | |
3499 | - case IDCANCEL: | |
3500 | - NEXT (0); | |
3501 | - break; | |
3502 | } | |
3503 | return 0; | |
3504 | } | |
3505 | ||
3506 | -static BOOL CALLBACK | |
3507 | -dialog_proc (HWND h, UINT message, WPARAM wParam, LPARAM lParam) | |
3508 | -{ | |
3509 | - int j; | |
3510 | - HWND listbox; | |
3511 | - switch (message) | |
3512 | - { | |
3513 | - case WM_INITDIALOG: | |
3514 | - listbox = GetDlgItem (h, IDC_URL_LIST); | |
3515 | - for (size_t i = 1; i <= all_site_list.number (); i++) | |
3516 | - { | |
3517 | - j = | |
3518 | - SendMessage (listbox, LB_ADDSTRING, 0, | |
3519 | - (LPARAM) all_site_list[i]->displayed_url); | |
3520 | - SendMessage (listbox, LB_SETITEMDATA, j, i); | |
3521 | - } | |
3522 | - j = SendMessage (listbox, LB_ADDSTRING, 0, (LPARAM) "Other URL"); | |
3523 | - SendMessage (listbox, LB_SETITEMDATA, j, OTHER_IDX); | |
3524 | - load_dialog (h); | |
3525 | - return FALSE; | |
3526 | - case WM_COMMAND: | |
3527 | - return HANDLE_WM_COMMAND (h, wParam, lParam, dialog_cmd); | |
3528 | - } | |
3529 | - return FALSE; | |
3530 | -} | |
3531 | - | |
3532 | static int | |
3533 | -get_site_list (HINSTANCE h) | |
3534 | +get_site_list (HINSTANCE h, HWND owner) | |
3535 | { | |
3536 | char mirror_url[1000]; | |
3537 | + | |
3538 | if (LoadString (h, IDS_MIRROR_LST, mirror_url, sizeof (mirror_url)) <= 0) | |
3539 | return 1; | |
3540 | - char *mirrors = get_url_to_string (mirror_url); | |
3541 | + char *mirrors = get_url_to_string (mirror_url, owner); | |
3542 | dismiss_url_status_dialog (); | |
3543 | if (!mirrors) | |
3544 | return 1; | |
3545 | @@ -320,24 +287,106 @@ get_saved_sites () | |
3546 | ||
3547 | } | |
3548 | ||
3549 | -void | |
3550 | -do_site (HINSTANCE h) | |
3551 | +static void | |
3552 | +do_download_site_info_thread (void *p) | |
3553 | { | |
3554 | - int rv = 0; | |
3555 | + HANDLE *context; | |
3556 | + HINSTANCE hinst; | |
3557 | + HWND h; | |
3558 | + context = (HANDLE *) p; | |
3559 | + | |
3560 | + hinst = (HINSTANCE) (context[0]); | |
3561 | + h = (HWND) (context[1]); | |
3562 | ||
3563 | if (all_site_list.number () == 0) | |
3564 | - if (get_site_list (h)) | |
3565 | - { | |
3566 | - NEXT (IDD_NET); | |
3567 | - return; | |
3568 | - } | |
3569 | + { | |
3570 | + if (get_site_list (hinst, h)) | |
3571 | + { | |
3572 | + // Error: Couldn't download the site info. Go back to the Net setup page. | |
3573 | + NEXT (IDD_NET); | |
3574 | + return; | |
3575 | + } | |
3576 | + } | |
3577 | + | |
3578 | + // Everything worked, go to the site select page | |
3579 | + NEXT (IDD_SITE); | |
3580 | + | |
3581 | + // Tell the progress page that we're done downloading | |
3582 | + Progress.PostMessage (WM_APP_SITE_INFO_DOWNLOAD_COMPLETE, 0, next_dialog); | |
3583 | + | |
3584 | + _endthread (); | |
3585 | +} | |
3586 | ||
3587 | +static HANDLE context[2]; | |
3588 | + | |
3589 | +void | |
3590 | +do_download_site_info (HINSTANCE hinst, HWND owner) | |
3591 | +{ | |
3592 | + | |
3593 | + context[0] = hinst; | |
3594 | + context[1] = owner; | |
3595 | + | |
3596 | + _beginthread (do_download_site_info_thread, 0, context); | |
3597 | + | |
3598 | +} | |
3599 | + | |
3600 | +bool | |
3601 | +SitePage::Create () | |
3602 | +{ | |
3603 | + return PropertyPage::Create (NULL, dialog_cmd, IDD_SITE); | |
3604 | +} | |
3605 | + | |
3606 | +void | |
3607 | +SitePage::OnInit () | |
3608 | +{ | |
3609 | + HWND h = GetHWND (); | |
3610 | + int j; | |
3611 | + HWND listbox; | |
3612 | + | |
3613 | get_saved_sites (); | |
3614 | + | |
3615 | + listbox = GetDlgItem (IDC_URL_LIST); | |
3616 | + for (size_t i = 1; i <= all_site_list.number (); i++) | |
3617 | + { | |
3618 | + j = | |
3619 | + SendMessage (listbox, LB_ADDSTRING, 0, | |
3620 | + (LPARAM) all_site_list[i]->displayed_url); | |
3621 | + SendMessage (listbox, LB_SETITEMDATA, j, i); | |
3622 | + } | |
3623 | + j = SendMessage (listbox, LB_ADDSTRING, 0, (LPARAM) "Other URL"); | |
3624 | + SendMessage (listbox, LB_SETITEMDATA, j, OTHER_IDX); | |
3625 | + load_dialog (h); | |
3626 | +} | |
3627 | ||
3628 | - rv = DialogBox (h, MAKEINTRESOURCE (IDD_SITE), 0, dialog_proc); | |
3629 | - if (rv == -1) | |
3630 | - fatal (IDS_DIALOG_FAILED); | |
3631 | +long | |
3632 | +SitePage::OnNext () | |
3633 | +{ | |
3634 | + HWND h = GetHWND (); | |
3635 | ||
3636 | - for (size_t n = 1; n <= site_list.number (); n++) | |
3637 | - log (0, "site: %s", site_list[n]->url); | |
3638 | + save_dialog (h); | |
3639 | + if (mirror_idx == OTHER_IDX) | |
3640 | + NEXT (IDD_OTHER_URL); | |
3641 | + else | |
3642 | + { | |
3643 | + save_site_url (); | |
3644 | + NEXT (IDD_S_LOAD_INI); | |
3645 | + | |
3646 | + for (size_t n = 1; n <= site_list.number (); n++) | |
3647 | + log (0, "site: %s", site_list[n]->url); | |
3648 | + | |
3649 | + Progress.SetActivateTask (WM_APP_START_SETUP_INI_DOWNLOAD); | |
3650 | + return IDD_INSTATUS; | |
3651 | + } | |
3652 | + | |
3653 | + return 0; | |
3654 | +} | |
3655 | + | |
3656 | +long | |
3657 | +SitePage::OnBack () | |
3658 | +{ | |
3659 | + HWND h = GetHWND (); | |
3660 | + | |
3661 | + save_dialog (h); | |
3662 | + NEXT (IDD_NET); | |
3663 | + return 0; | |
3664 | } | |
3665 | Index: site.h | |
3666 | =================================================================== | |
3667 | RCS file: /cvs/src/src/winsup/cinstall/site.h,v | |
3668 | retrieving revision 2.1 | |
3669 | diff -u -p -r2.1 site.h | |
3670 | --- site.h 2001/12/03 22:22:09 2.1 | |
3671 | +++ site.h 2001/12/20 12:36:03 | |
3672 | @@ -17,17 +17,41 @@ | |
3673 | #define _SITE_H_ | |
3674 | ||
3675 | /* required to parse this file */ | |
3676 | -#include <strings.h> | |
3677 | +#include <string.h> | |
3678 | +#include <stdlib.h> | |
3679 | #include "list.h" | |
3680 | ||
3681 | +#include "proppage.h" | |
3682 | + | |
3683 | +class SitePage:public PropertyPage | |
3684 | +{ | |
3685 | +public: | |
3686 | + SitePage () | |
3687 | + { | |
3688 | + }; | |
3689 | + virtual ~ SitePage () | |
3690 | + { | |
3691 | + }; | |
3692 | + | |
3693 | + bool Create (); | |
3694 | + | |
3695 | + void OnInit (); | |
3696 | + long OnNext (); | |
3697 | + long OnBack (); | |
3698 | +}; | |
3699 | + | |
3700 | +void do_download_site_info (HINSTANCE h, HWND owner); | |
3701 | + | |
3702 | class site_list_type | |
3703 | { | |
3704 | public: | |
3705 | - site_list_type () : url(0), displayed_url (0), key (0) {}; | |
3706 | + site_list_type ():url (0), displayed_url (0), key (0) | |
3707 | + { | |
3708 | + }; | |
3709 | site_list_type (char const *); | |
3710 | /* workaround for missing placement new in gcc 2.95 */ | |
3711 | void init (char const *); | |
3712 | - ~site_list_type () | |
3713 | + ~site_list_type () | |
3714 | { | |
3715 | if (url) | |
3716 | free (url); | |
3717 | @@ -42,9 +66,9 @@ public: | |
3718 | }; | |
3719 | ||
3720 | /* user chosen sites */ | |
3721 | -extern list <site_list_type, const char *, strcasecmp> site_list; | |
3722 | +extern list < site_list_type, const char *, strcasecmp > site_list; | |
3723 | /* potential sites */ | |
3724 | -extern list <site_list_type, const char *, strcasecmp> all_site_list; | |
3725 | +extern list < site_list_type, const char *, strcasecmp > all_site_list; | |
3726 | ||
3727 | void save_site_url (); | |
3728 | ||
3729 | Index: source.cc | |
3730 | =================================================================== | |
3731 | RCS file: /cvs/src/src/winsup/cinstall/source.cc,v | |
3732 | retrieving revision 2.9 | |
3733 | diff -u -p -r2.9 source.cc | |
3734 | --- source.cc 2001/12/20 11:49:54 2.9 | |
3735 | +++ source.cc 2001/12/20 12:36:03 | |
3736 | @@ -31,6 +31,8 @@ static const char *cvsid = | |
3737 | #include "log.h" | |
3738 | #include "package_db.h" | |
3739 | ||
3740 | +#include "source.h" | |
3741 | + | |
3742 | static int rb[] = | |
3743 | { IDC_SOURCE_NETINST, IDC_SOURCE_DOWNLOAD, IDC_SOURCE_CWD, 0 }; | |
3744 | ||
3745 | @@ -45,7 +47,8 @@ save_dialog (HWND h) | |
3746 | { | |
3747 | source = rbget (h, rb); | |
3748 | packagedb db; | |
3749 | - db.task = source == IDC_SOURCE_DOWNLOAD ? PackageDB_Download : PackageDB_Install; | |
3750 | + db.task = | |
3751 | + source == IDC_SOURCE_DOWNLOAD ? PackageDB_Download : PackageDB_Install; | |
3752 | } | |
3753 | ||
3754 | static BOOL | |
3755 | @@ -60,65 +63,61 @@ dialog_cmd (HWND h, int id, HWND hwndctl | |
3756 | save_dialog (h); | |
3757 | break; | |
3758 | ||
3759 | - case IDOK: | |
3760 | - save_dialog (h); | |
3761 | - if (source == IDC_SOURCE_DOWNLOAD) | |
3762 | - NEXT (IDD_LOCAL_DIR); | |
3763 | - else | |
3764 | - NEXT (IDD_ROOT); | |
3765 | - break; | |
3766 | - | |
3767 | - case IDC_BACK: | |
3768 | - save_dialog (h); | |
3769 | - NEXT (0); | |
3770 | - break; | |
3771 | - | |
3772 | - case IDCANCEL: | |
3773 | - NEXT (0); | |
3774 | - break; | |
3775 | - | |
3776 | default: | |
3777 | break; | |
3778 | } | |
3779 | return 0; | |
3780 | } | |
3781 | ||
3782 | -static BOOL CALLBACK | |
3783 | -dialog_proc (HWND h, UINT message, WPARAM wParam, LPARAM lParam) | |
3784 | +bool | |
3785 | +SourcePage::Create () | |
3786 | { | |
3787 | - switch (message) | |
3788 | - { | |
3789 | - case WM_INITDIALOG: | |
3790 | - load_dialog (h); | |
3791 | - // Check to see if any radio buttons are selected. If not, select a default. | |
3792 | - if ( | |
3793 | - (!SendMessage | |
3794 | - (GetDlgItem (h, IDC_SOURCE_DOWNLOAD), BM_GETCHECK, 0, | |
3795 | - 0) == BST_CHECKED) | |
3796 | - && (!SendMessage (GetDlgItem (h, IDC_SOURCE_CWD), BM_GETCHECK, 0, 0) | |
3797 | - == BST_CHECKED)) | |
3798 | - { | |
3799 | - SendMessage (GetDlgItem (h, IDC_SOURCE_NETINST), BM_SETCHECK, | |
3800 | - BST_CHECKED, 0); | |
3801 | - } | |
3802 | - return FALSE; | |
3803 | - case WM_COMMAND: | |
3804 | - return HANDLE_WM_COMMAND (h, wParam, lParam, dialog_cmd); | |
3805 | - } | |
3806 | - return FALSE; | |
3807 | + return PropertyPage::Create (NULL, dialog_cmd, IDD_SOURCE); | |
3808 | } | |
3809 | ||
3810 | void | |
3811 | -do_source (HINSTANCE h) | |
3812 | +SourcePage::OnActivate () | |
3813 | { | |
3814 | - int rv = 0; | |
3815 | - /* source = IDC_SOURCE_CWD; */ | |
3816 | if (!source) | |
3817 | source = IDC_SOURCE_NETINST; | |
3818 | - rv = DialogBox (h, MAKEINTRESOURCE (IDD_SOURCE), 0, dialog_proc); | |
3819 | - if (rv == -1) | |
3820 | - fatal (IDS_DIALOG_FAILED); | |
3821 | + load_dialog (GetHWND ()); | |
3822 | + // Check to see if any radio buttons are selected. If not, select a default. | |
3823 | + if ((!SendMessage | |
3824 | + (GetDlgItem (IDC_SOURCE_DOWNLOAD), BM_GETCHECK, 0, | |
3825 | + 0) == BST_CHECKED) | |
3826 | + && (!SendMessage (GetDlgItem (IDC_SOURCE_CWD), BM_GETCHECK, 0, 0) | |
3827 | + == BST_CHECKED)) | |
3828 | + { | |
3829 | + SendMessage (GetDlgItem (IDC_SOURCE_NETINST), BM_SETCHECK, | |
3830 | + BST_CHECKED, 0); | |
3831 | + } | |
3832 | +} | |
3833 | ||
3834 | +long | |
3835 | +SourcePage::OnNext () | |
3836 | +{ | |
3837 | + HWND h = GetHWND (); | |
3838 | + | |
3839 | + save_dialog (h); | |
3840 | + if (source == IDC_SOURCE_DOWNLOAD) | |
3841 | + { | |
3842 | + // If all we're doing is downloading,skip the root directory page | |
3843 | + return IDD_LOCAL_DIR; | |
3844 | + } | |
3845 | + | |
3846 | + return 0; | |
3847 | +} | |
3848 | + | |
3849 | +long | |
3850 | +SourcePage::OnBack () | |
3851 | +{ | |
3852 | + save_dialog (GetHWND ()); | |
3853 | + return 0; | |
3854 | +} | |
3855 | + | |
3856 | +void | |
3857 | +SourcePage::OnDeactivate () | |
3858 | +{ | |
3859 | log (0, "source: %s", | |
3860 | (source == IDC_SOURCE_DOWNLOAD) ? "download" : | |
3861 | (source == IDC_SOURCE_NETINST) ? "network install" : "from cwd"); | |
3862 | Index: source.h | |
3863 | =================================================================== | |
3864 | RCS file: source.h | |
3865 | diff -N source.h | |
3866 | --- /dev/null Tue May 5 13:32:27 1998 | |
3867 | +++ source.h Thu Dec 20 04:36:03 2001 | |
3868 | @@ -0,0 +1,43 @@ | |
3869 | +#ifndef CINSTALL_SOURCE_H | |
3870 | +#define CINSTALL_SOURCE_H | |
3871 | + | |
3872 | +/* | |
3873 | + * Copyright (c) 2001, Gary R. Van Sickle. | |
3874 | + * | |
3875 | + * This program is free software; you can redistribute it and/or modify | |
3876 | + * it under the terms of the GNU General Public License as published by | |
3877 | + * the Free Software Foundation; either version 2 of the License, or | |
3878 | + * (at your option) any later version. | |
3879 | + * | |
3880 | + * A copy of the GNU General Public License can be found at | |
3881 | + * http://www.gnu.org/ | |
3882 | + * | |
3883 | + * Written by Gary R. Van Sickle <g.r.vansickle@worldnet.att.net> | |
3884 | + * | |
3885 | + */ | |
3886 | + | |
3887 | +// This is the header for the SourcePage class, which lets the user | |
3888 | +// select Download+Install, Download, or Install From Local Directory. | |
3889 | + | |
3890 | + | |
3891 | +#include "proppage.h" | |
3892 | + | |
3893 | +class SourcePage:public PropertyPage | |
3894 | +{ | |
3895 | +public: | |
3896 | + SourcePage () | |
3897 | + { | |
3898 | + }; | |
3899 | + virtual ~ SourcePage () | |
3900 | + { | |
3901 | + }; | |
3902 | + | |
3903 | + bool Create (); | |
3904 | + | |
3905 | + void OnActivate (); | |
3906 | + void OnDeactivate (); | |
3907 | + long OnNext (); | |
3908 | + long OnBack (); | |
3909 | +}; | |
3910 | + | |
3911 | +#endif | |
3912 | Index: splash.cc | |
3913 | =================================================================== | |
3914 | RCS file: /cvs/src/src/winsup/cinstall/splash.cc,v | |
3915 | retrieving revision 2.6 | |
3916 | diff -u -p -r2.6 splash.cc | |
3917 | --- splash.cc 2001/11/13 01:49:32 2.6 | |
3918 | +++ splash.cc 2001/12/20 12:36:03 | |
3919 | @@ -1,5 +1,5 @@ | |
3920 | /* | |
3921 | - * Copyright (c) 2000, Red Hat, Inc. | |
3922 | + * Copyright (c) 2001, Gary R. Van Sickle. | |
3923 | * | |
3924 | * This program is free software; you can redistribute it and/or modify | |
3925 | * it under the terms of the GNU General Public License as published by | |
3926 | @@ -9,71 +9,31 @@ | |
3927 | * A copy of the GNU General Public License can be found at | |
3928 | * http://www.gnu.org/ | |
3929 | * | |
3930 | - * Written by DJ Delorie <dj@cygnus.com> | |
3931 | + * Written by Gary R. Van Sickle <g.r.vansickle@worldnet.att.net> | |
3932 | * | |
3933 | */ | |
3934 | ||
3935 | -/* The purpose of this file is to display the program name, version, | |
3936 | - copyright notice, and project URL. */ | |
3937 | +// This is the implementation of the SplashPage class. Since the splash page | |
3938 | +// has little to do, there's not much here. | |
3939 | ||
3940 | -#if 0 | |
3941 | -static const char *cvsid = | |
3942 | - "\n%%% $Id$\n"; | |
3943 | -#endif | |
3944 | - | |
3945 | -#include "win32.h" | |
3946 | #include <stdio.h> | |
3947 | -#include "dialog.h" | |
3948 | -#include "resource.h" | |
3949 | -#include "msg.h" | |
3950 | #include "version.h" | |
3951 | +#include "resource.h" | |
3952 | +#include "cistring.h" | |
3953 | +#include "splash.h" | |
3954 | ||
3955 | -static void | |
3956 | -load_dialog (HWND h) | |
3957 | +bool | |
3958 | +SplashPage::Create () | |
3959 | { | |
3960 | - char buffer[100]; | |
3961 | - HWND v = GetDlgItem (h, IDC_VERSION); | |
3962 | - sprintf (buffer, "Setup.exe version %s", | |
3963 | - version[0] ? version : "[unknown]"); | |
3964 | - SetWindowText (v, buffer); | |
3965 | + return PropertyPage::Create (IDD_SPLASH); | |
3966 | } | |
3967 | ||
3968 | -static BOOL | |
3969 | -dialog_cmd (HWND h, int id, HWND hwndctl, UINT code) | |
3970 | +void | |
3971 | +SplashPage::OnInit () | |
3972 | { | |
3973 | - switch (id) | |
3974 | - { | |
3975 | - | |
3976 | - case IDOK: | |
3977 | - NEXT (IDD_SOURCE); | |
3978 | - break; | |
3979 | - | |
3980 | - case IDCANCEL: | |
3981 | - NEXT (0); | |
3982 | - break; | |
3983 | - } | |
3984 | - return 0; | |
3985 | -} | |
3986 | + cistring ver; | |
3987 | ||
3988 | -static BOOL CALLBACK | |
3989 | -dialog_proc (HWND h, UINT message, WPARAM wParam, LPARAM lParam) | |
3990 | -{ | |
3991 | - switch (message) | |
3992 | - { | |
3993 | - case WM_INITDIALOG: | |
3994 | - load_dialog (h); | |
3995 | - return TRUE; | |
3996 | - case WM_COMMAND: | |
3997 | - return HANDLE_WM_COMMAND (h, wParam, lParam, dialog_cmd); | |
3998 | - } | |
3999 | - return FALSE; | |
4000 | -} | |
4001 | + ver.Format (IDS_VERSION_INFO, version[0] ? version : "[unknown]"); | |
4002 | ||
4003 | -void | |
4004 | -do_splash (HINSTANCE h) | |
4005 | -{ | |
4006 | - int rv = 0; | |
4007 | - rv = DialogBox (h, MAKEINTRESOURCE (IDD_SPLASH), 0, dialog_proc); | |
4008 | - if (rv == -1) | |
4009 | - fatal (IDS_DIALOG_FAILED); | |
4010 | + SetWindowText (GetDlgItem (IDC_VERSION), ver.c_str ()); | |
4011 | } | |
4012 | Index: splash.h | |
4013 | =================================================================== | |
4014 | RCS file: splash.h | |
4015 | diff -N splash.h | |
4016 | --- /dev/null Tue May 5 13:32:27 1998 | |
4017 | +++ splash.h Thu Dec 20 04:36:03 2001 | |
4018 | @@ -0,0 +1,38 @@ | |
4019 | +#ifndef CINSTALL_SPLASH_H | |
4020 | +#define CINSTALL_SPLASH_H | |
4021 | + | |
4022 | +/* | |
4023 | + * Copyright (c) 2001, Gary R. Van Sickle. | |
4024 | + * | |
4025 | + * This program is free software; you can redistribute it and/or modify | |
4026 | + * it under the terms of the GNU General Public License as published by | |
4027 | + * the Free Software Foundation; either version 2 of the License, or | |
4028 | + * (at your option) any later version. | |
4029 | + * | |
4030 | + * A copy of the GNU General Public License can be found at | |
4031 | + * http://www.gnu.org/ | |
4032 | + * | |
4033 | + * Written by Gary R. Van Sickle <g.r.vansickle@worldnet.att.net> | |
4034 | + * | |
4035 | + */ | |
4036 | + | |
4037 | +// This is the header for the SplashPage class. Since the splash page | |
4038 | +// has little to do, there's not much here. | |
4039 | + | |
4040 | +#include "proppage.h" | |
4041 | + | |
4042 | +class SplashPage:public PropertyPage | |
4043 | +{ | |
4044 | +public: | |
4045 | + SplashPage () | |
4046 | + { | |
4047 | + }; | |
4048 | + virtual ~ SplashPage () | |
4049 | + { | |
4050 | + }; | |
4051 | + | |
4052 | + bool Create (); | |
4053 | + void OnInit (); | |
4054 | +}; | |
4055 | + | |
4056 | +#endif // CINSTALL_SPLASH_H | |
4057 | Index: threebar.cc | |
4058 | =================================================================== | |
4059 | RCS file: threebar.cc | |
4060 | diff -N threebar.cc | |
4061 | --- /dev/null Tue May 5 13:32:27 1998 | |
4062 | +++ threebar.cc Thu Dec 20 04:36:03 2001 | |
4063 | @@ -0,0 +1,199 @@ | |
4064 | +/* | |
4065 | + * Copyright (c) 2001, Gary R. Van Sickle. | |
4066 | + * | |
4067 | + * This program is free software; you can redistribute it and/or modify | |
4068 | + * it under the terms of the GNU General Public License as published by | |
4069 | + * the Free Software Foundation; either version 2 of the License, or | |
4070 | + * (at your option) any later version. | |
4071 | + * | |
4072 | + * A copy of the GNU General Public License can be found at | |
4073 | + * http://www.gnu.org/ | |
4074 | + * | |
4075 | + * Written by Gary R. Van Sickle <g.r.vansickle@worldnet.att.net> | |
4076 | + * | |
4077 | + */ | |
4078 | + | |
4079 | +// This is the implementation of the ThreeBarProgressPage class. It is a fairly generic | |
4080 | +// progress indicator property page with three progress bars. | |
4081 | + | |
4082 | +#include "win32.h" | |
4083 | +#include "commctrl.h" | |
4084 | +#include "resource.h" | |
4085 | + | |
4086 | +#include "dialog.h" | |
4087 | +#include "site.h" | |
4088 | + | |
4089 | +#include "propsheet.h" | |
4090 | +#include "threebar.h" | |
4091 | + | |
4092 | +bool | |
4093 | +ThreeBarProgressPage::Create () | |
4094 | +{ | |
4095 | + return PropertyPage::Create (IDD_INSTATUS); | |
4096 | +} | |
4097 | + | |
4098 | +void | |
4099 | +ThreeBarProgressPage::OnInit () | |
4100 | +{ | |
4101 | + // Get HWNDs to the dialog controls | |
4102 | + ins_action = GetDlgItem (IDC_INS_ACTION); | |
4103 | + ins_pkgname = GetDlgItem (IDC_INS_PKG); | |
4104 | + ins_filename = GetDlgItem (IDC_INS_FILE); | |
4105 | + // Bars | |
4106 | + ins_pprogress = GetDlgItem (IDC_INS_PPROGRESS); | |
4107 | + ins_iprogress = GetDlgItem (IDC_INS_IPROGRESS); | |
4108 | + ins_diskfull = GetDlgItem (IDC_INS_DISKFULL); | |
4109 | + // Bar labels | |
4110 | + ins_bl_package = GetDlgItem (IDC_INS_BL_PACKAGE); | |
4111 | + ins_bl_total = GetDlgItem (IDC_INS_BL_TOTAL); | |
4112 | + ins_bl_disk = GetDlgItem (IDC_INS_BL_DISK); | |
4113 | +} | |
4114 | + | |
4115 | +void | |
4116 | +ThreeBarProgressPage::SetText1 (const TCHAR * t) | |
4117 | +{ | |
4118 | + SetWindowText (ins_action, t); | |
4119 | +} | |
4120 | + | |
4121 | +void | |
4122 | +ThreeBarProgressPage::SetText2 (const TCHAR * t) | |
4123 | +{ | |
4124 | + SetWindowText (ins_pkgname, t); | |
4125 | +} | |
4126 | + | |
4127 | +void | |
4128 | +ThreeBarProgressPage::SetText3 (const TCHAR * t) | |
4129 | +{ | |
4130 | + SetWindowText (ins_filename, t); | |
4131 | +} | |
4132 | + | |
4133 | +void | |
4134 | +ThreeBarProgressPage::SetBar1 (long progress, long max) | |
4135 | +{ | |
4136 | + int percent = (int) (100.0 * ((double) progress) / (double) max); | |
4137 | + SendMessage (ins_pprogress, PBM_SETPOS, (WPARAM) percent, 0); | |
4138 | +} | |
4139 | + | |
4140 | +void | |
4141 | +ThreeBarProgressPage::SetBar2 (long progress, long max) | |
4142 | +{ | |
4143 | + int percent = (int) (100.0 * ((double) progress) / (double) max); | |
4144 | + SendMessage (ins_iprogress, PBM_SETPOS, (WPARAM) percent, 0); | |
4145 | +} | |
4146 | + | |
4147 | +void | |
4148 | +ThreeBarProgressPage::SetBar3 (long progress, long max) | |
4149 | +{ | |
4150 | + int percent = (int) (100.0 * ((double) progress) / (double) max); | |
4151 | + SendMessage (ins_diskfull, PBM_SETPOS, (WPARAM) percent, 0); | |
4152 | +} | |
4153 | + | |
4154 | +void | |
4155 | +ThreeBarProgressPage::EnableSingleBar (bool enable) | |
4156 | +{ | |
4157 | + // Switch to/from single bar mode | |
4158 | + ShowWindow (ins_bl_total, enable ? SW_HIDE : SW_SHOW); | |
4159 | + ShowWindow (ins_bl_disk, enable ? SW_HIDE : SW_SHOW); | |
4160 | + ShowWindow (ins_iprogress, enable ? SW_HIDE : SW_SHOW); | |
4161 | + ShowWindow (ins_diskfull, enable ? SW_HIDE : SW_SHOW); | |
4162 | +} | |
4163 | + | |
4164 | +void | |
4165 | +ThreeBarProgressPage::OnActivate () | |
4166 | +{ | |
4167 | + // Disable back and next buttons | |
4168 | + GetOwner ()->SetButtons (0); | |
4169 | + | |
4170 | + // Set all bars to 0 | |
4171 | + SetBar1 (0); | |
4172 | + SetBar2 (0); | |
4173 | + SetBar3 (0); | |
4174 | + | |
4175 | + switch (task) | |
4176 | + { | |
4177 | + case WM_APP_START_SITE_INFO_DOWNLOAD: | |
4178 | + case WM_APP_START_SETUP_INI_DOWNLOAD: | |
4179 | + // For these tasks, show only a single progress bar. | |
4180 | + EnableSingleBar (); | |
4181 | + break; | |
4182 | + default: | |
4183 | + // Show the normal 3-bar view by default | |
4184 | + EnableSingleBar (false); | |
4185 | + break; | |
4186 | + } | |
4187 | + | |
4188 | + Window::PostMessage (task); | |
4189 | +} | |
4190 | + | |
4191 | +bool | |
4192 | +ThreeBarProgressPage::OnMessageApp (UINT uMsg, WPARAM wParam, LPARAM lParam) | |
4193 | +{ | |
4194 | + switch (uMsg) | |
4195 | + { | |
4196 | + case WM_APP_START_DOWNLOAD: | |
4197 | + { | |
4198 | + // Start the package download thread. | |
4199 | + do_download (GetInstance (), GetHWND ()); | |
4200 | + break; | |
4201 | + } | |
4202 | + case WM_APP_DOWNLOAD_THREAD_COMPLETE: | |
4203 | + { | |
4204 | + if (lParam == IDD_S_INSTALL) | |
4205 | + { | |
4206 | + // Download is complete and we want to go on to the install. | |
4207 | + Window::PostMessage (WM_APP_START_INSTALL); | |
4208 | + } | |
4209 | + else if (lParam != 0) | |
4210 | + { | |
4211 | + // Download failed for some reason, go back to site selection page | |
4212 | + GetOwner ()->SetActivePageByID (lParam); | |
4213 | + } | |
4214 | + else | |
4215 | + { | |
4216 | + // Was a download-only, and is complete or failed. | |
4217 | + GetOwner ()->PressButton (PSBTN_CANCEL); | |
4218 | + } | |
4219 | + break; | |
4220 | + } | |
4221 | + case WM_APP_START_INSTALL: | |
4222 | + { | |
4223 | + // Start the install thread. | |
4224 | + do_install (GetInstance (), GetHWND ()); | |
4225 | + break; | |
4226 | + } | |
4227 | + case WM_APP_INSTALL_THREAD_COMPLETE: | |
4228 | + { | |
4229 | + // Re-enable and "Push" the Next button | |
4230 | + GetOwner ()->SetButtons (PSWIZB_NEXT); | |
4231 | + GetOwner ()->PressButton (PSBTN_NEXT); | |
4232 | + break; | |
4233 | + } | |
4234 | + case WM_APP_START_SITE_INFO_DOWNLOAD: | |
4235 | + { | |
4236 | + do_download_site_info (GetInstance (), GetHWND ()); | |
4237 | + break; | |
4238 | + } | |
4239 | + case WM_APP_SITE_INFO_DOWNLOAD_COMPLETE: | |
4240 | + { | |
4241 | + GetOwner ()->SetActivePageByID (lParam); | |
4242 | + break; | |
4243 | + } | |
4244 | + case WM_APP_START_SETUP_INI_DOWNLOAD: | |
4245 | + { | |
4246 | + do_ini (GetInstance (), GetHWND ()); | |
4247 | + break; | |
4248 | + } | |
4249 | + case WM_APP_SETUP_INI_DOWNLOAD_COMPLETE: | |
4250 | + { | |
4251 | + GetOwner ()->SetActivePageByID (lParam); | |
4252 | + break; | |
4253 | + } | |
4254 | + default: | |
4255 | + { | |
4256 | + // Not handled | |
4257 | + return false; | |
4258 | + } | |
4259 | + } | |
4260 | + | |
4261 | + return true; | |
4262 | +} | |
4263 | Index: threebar.h | |
4264 | =================================================================== | |
4265 | RCS file: threebar.h | |
4266 | diff -N threebar.h | |
4267 | --- /dev/null Tue May 5 13:32:27 1998 | |
4268 | +++ threebar.h Thu Dec 20 04:36:03 2001 | |
4269 | @@ -0,0 +1,81 @@ | |
4270 | +#ifndef CINSTALL_THREEBAR_H | |
4271 | +#define CINSTALL_THREEBAR_H | |
4272 | + | |
4273 | +/* | |
4274 | + * Copyright (c) 2001, Gary R. Van Sickle. | |
4275 | + * | |
4276 | + * This program is free software; you can redistribute it and/or modify | |
4277 | + * it under the terms of the GNU General Public License as published by | |
4278 | + * the Free Software Foundation; either version 2 of the License, or | |
4279 | + * (at your option) any later version. | |
4280 | + * | |
4281 | + * A copy of the GNU General Public License can be found at | |
4282 | + * http://www.gnu.org/ | |
4283 | + * | |
4284 | + * Written by Gary R. Van Sickle <g.r.vansickle@worldnet.att.net> | |
4285 | + * | |
4286 | + */ | |
4287 | + | |
4288 | +// This is the header for the ThreeBarProgressPage class. It is a fairly generic | |
4289 | +// progress indicator property page with three progress bars. | |
4290 | + | |
4291 | + | |
4292 | +#include "win32.h" | |
4293 | +#include "proppage.h" | |
4294 | + | |
4295 | +#define WM_APP_START_DOWNLOAD WM_APP+0 | |
4296 | +#define WM_APP_DOWNLOAD_THREAD_COMPLETE WM_APP+1 | |
4297 | +#define WM_APP_START_INSTALL WM_APP+2 | |
4298 | +#define WM_APP_INSTALL_THREAD_COMPLETE WM_APP+3 | |
4299 | +#define WM_APP_START_SITE_INFO_DOWNLOAD WM_APP+4 | |
4300 | +#define WM_APP_SITE_INFO_DOWNLOAD_COMPLETE WM_APP+5 | |
4301 | +#define WM_APP_START_SETUP_INI_DOWNLOAD WM_APP+6 | |
4302 | +#define WM_APP_SETUP_INI_DOWNLOAD_COMPLETE WM_APP+7 | |
4303 | + | |
4304 | +class ThreeBarProgressPage:public PropertyPage | |
4305 | +{ | |
4306 | + HWND ins_dialog; | |
4307 | + HWND ins_action; | |
4308 | + HWND ins_pkgname; | |
4309 | + HWND ins_filename; | |
4310 | + HWND ins_pprogress; | |
4311 | + HWND ins_iprogress; | |
4312 | + HWND ins_diskfull; | |
4313 | + HWND ins_bl_package; | |
4314 | + HWND ins_bl_total; | |
4315 | + HWND ins_bl_disk; | |
4316 | + | |
4317 | + int task; | |
4318 | + | |
4319 | + void EnableSingleBar (bool enable = true); | |
4320 | + | |
4321 | +public: | |
4322 | + ThreeBarProgressPage () | |
4323 | + { | |
4324 | + }; | |
4325 | + virtual ~ ThreeBarProgressPage () | |
4326 | + { | |
4327 | + }; | |
4328 | + | |
4329 | + bool Create (); | |
4330 | + | |
4331 | + virtual void OnInit (); | |
4332 | + virtual void OnActivate (); | |
4333 | + virtual bool OnMessageApp (UINT uMsg, WPARAM wParam, LPARAM lParam); | |
4334 | + | |
4335 | + void SetText1 (const TCHAR * t); | |
4336 | + void SetText2 (const TCHAR * t); | |
4337 | + void SetText3 (const TCHAR * t); | |
4338 | + | |
4339 | + void SetBar1 (long progress, long max = 100); | |
4340 | + void SetBar2 (long progress, long max = 100); | |
4341 | + void SetBar3 (long progress, long max = 100); | |
4342 | + | |
4343 | + void SetActivateTask (int t) | |
4344 | + { | |
4345 | + task = t; | |
4346 | + }; | |
4347 | +}; | |
4348 | + | |
4349 | + | |
4350 | +#endif // CINSTALL_THREEBAR_H | |
4351 | Index: window.cc | |
4352 | =================================================================== | |
4353 | RCS file: window.cc | |
4354 | diff -N window.cc | |
4355 | --- /dev/null Tue May 5 13:32:27 1998 | |
4356 | +++ window.cc Thu Dec 20 04:36:03 2001 | |
4357 | @@ -0,0 +1,269 @@ | |
4358 | +/* | |
4359 | + * Copyright (c) 2001, Gary R. Van Sickle. | |
4360 | + * | |
4361 | + * This program is free software; you can redistribute it and/or modify | |
4362 | + * it under the terms of the GNU General Public License as published by | |
4363 | + * the Free Software Foundation; either version 2 of the License, or | |
4364 | + * (at your option) any later version. | |
4365 | + * | |
4366 | + * A copy of the GNU General Public License can be found at | |
4367 | + * http://www.gnu.org/ | |
4368 | + * | |
4369 | + * Written by Gary R. Van Sickle <g.r.vansickle@worldnet.att.net> | |
4370 | + * | |
4371 | + */ | |
4372 | + | |
4373 | +// This is the implementation of the Window class. It serves both as a window class | |
4374 | +// in its own right and as a base class for other window-like classes (e.g. PropertyPage, | |
4375 | +// PropSheet). | |
4376 | + | |
4377 | +#include <windows.h> | |
4378 | +#include "window.h" | |
4379 | + | |
4380 | +ATOM | |
4381 | + Window::WindowClassAtom = | |
4382 | + 0; | |
4383 | +HINSTANCE | |
4384 | + Window::AppInstance = | |
4385 | + NULL; | |
4386 | + | |
4387 | +// FIXME: I know, this is brutal. Mutexing should at least make window creation threadsafe, | |
4388 | +// but if somebody has any ideas as to how to get rid of it entirely, please tell me / do so. | |
4389 | +struct REFLECTION_INFO | |
4390 | +{ | |
4391 | + Window * | |
4392 | + This; | |
4393 | + bool | |
4394 | + FirstCall; | |
4395 | +}; | |
4396 | +REFLECTION_INFO | |
4397 | + ReflectionInfo; | |
4398 | + | |
4399 | +Window::Window () | |
4400 | +{ | |
4401 | + WindowHandle = NULL; | |
4402 | + Parent = NULL; | |
4403 | +} | |
4404 | + | |
4405 | +Window::~Window () | |
4406 | +{ | |
4407 | + // FIXME: Maybe do some reference counting and do this Unregister | |
4408 | + // when there are no more of us left. Not real critical unless | |
4409 | + // we're in a DLL which we're not right now. | |
4410 | + //UnregisterClass(WindowClassAtom, InstanceHandle); | |
4411 | +} | |
4412 | + | |
4413 | +LRESULT CALLBACK | |
4414 | +Window::FirstWindowProcReflector (HWND hwnd, UINT uMsg, WPARAM wParam, | |
4415 | + LPARAM lParam) | |
4416 | +{ | |
4417 | + // Get our this pointer | |
4418 | + REFLECTION_INFO *rip = &ReflectionInfo; | |
4419 | + | |
4420 | + if (rip->FirstCall) | |
4421 | + { | |
4422 | + rip->FirstCall = false; | |
4423 | + | |
4424 | + // Set the Window handle so the real WindowProc has one to work with. | |
4425 | + rip->This->WindowHandle = hwnd; | |
4426 | + | |
4427 | + // Set a backreference to this class instance in the HWND. | |
4428 | + // FIXME: Should really be SetWindowLongPtr(), but it appears to | |
4429 | + // not be defined yet. | |
4430 | + SetWindowLong (hwnd, GWL_USERDATA, (LONG) rip->This); | |
4431 | + | |
4432 | + // Set a new WindowProc now that we have the peliminaries done. | |
4433 | + // Like subclassing, only not. | |
4434 | + SetWindowLong (hwnd, GWL_WNDPROC, (LONG) & Window::WindowProcReflector); | |
4435 | + } | |
4436 | + | |
4437 | + return rip->This->WindowProc (uMsg, wParam, lParam); | |
4438 | +} | |
4439 | + | |
4440 | +LRESULT CALLBACK | |
4441 | +Window::WindowProcReflector (HWND hwnd, UINT uMsg, WPARAM wParam, | |
4442 | + LPARAM lParam) | |
4443 | +{ | |
4444 | + Window *This; | |
4445 | + | |
4446 | + // Get our this pointer | |
4447 | + // FIXME: Should really be GetWindowLongPtr(), but it appears to | |
4448 | + // not be defined yet. | |
4449 | + This = (Window *) GetWindowLong (hwnd, GWL_USERDATA); | |
4450 | + | |
4451 | + return This->WindowProc (uMsg, wParam, lParam); | |
4452 | +} | |
4453 | + | |
4454 | +bool | |
4455 | +Window::Create (Window * parent, DWORD Style) | |
4456 | +{ | |
4457 | + // First register the window class, if we haven't already | |
4458 | + if (RegisterWindowClass () == false) | |
4459 | + { | |
4460 | + // Registration failed | |
4461 | + return false; | |
4462 | + } | |
4463 | + | |
4464 | + // Set up the reflection info, so that the Windows window can find us. | |
4465 | + ReflectionInfo.This = this; | |
4466 | + ReflectionInfo.FirstCall = true; | |
4467 | + | |
4468 | + Parent = parent; | |
4469 | + | |
4470 | + // Create the window instance | |
4471 | + WindowHandle = CreateWindow ("MainWindowClass", //MAKEINTATOM(WindowClassAtom), // window class atom (name) | |
4472 | + "Hello", // no title-bar string yet | |
4473 | + // Style bits | |
4474 | + Style, | |
4475 | + // Default positions and size | |
4476 | + CW_USEDEFAULT, | |
4477 | + CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, | |
4478 | + // Parent Window | |
4479 | + parent == | |
4480 | + NULL ? (HWND) NULL : parent->GetHWND (), | |
4481 | + // use class menu | |
4482 | + (HMENU) NULL, | |
4483 | + // The application instance | |
4484 | + GetInstance (), (LPVOID) NULL); | |
4485 | + | |
4486 | + if (WindowHandle == NULL) | |
4487 | + { | |
4488 | + // Failed | |
4489 | + return false; | |
4490 | + } | |
4491 | + | |
4492 | + return true; | |
4493 | +} | |
4494 | + | |
4495 | +bool | |
4496 | +Window::RegisterWindowClass () | |
4497 | +{ | |
4498 | + if (WindowClassAtom == 0) | |
4499 | + { | |
4500 | + // We're not registered yet | |
4501 | + WNDCLASSEX wc; | |
4502 | + | |
4503 | + wc.cbSize = sizeof (wc); | |
4504 | + // Some sensible style defaults | |
4505 | + wc.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW; | |
4506 | + // Our default window procedure. This replaces itself | |
4507 | + // on the first call with the simpler Window::WindowProcReflector(). | |
4508 | + wc.lpfnWndProc = Window::FirstWindowProcReflector; | |
4509 | + // No class bytes | |
4510 | + wc.cbClsExtra = 0; | |
4511 | + // One pointer to REFLECTION_INFO in the extra window instance bytes | |
4512 | + wc.cbWndExtra = 4; | |
4513 | + // The app instance | |
4514 | + wc.hInstance = GetInstance (); | |
4515 | + // Use a bunch of system defaults for the GUI elements | |
4516 | + wc.hIcon = NULL; | |
4517 | + wc.hIconSm = NULL; | |
4518 | + wc.hCursor = NULL; | |
4519 | + wc.hbrBackground = (HBRUSH) (COLOR_BACKGROUND + 1); | |
4520 | + // No menu | |
4521 | + wc.lpszMenuName = NULL; | |
4522 | + // We'll get a little crazy here with the class name | |
4523 | + wc.lpszClassName = "MainWindowClass"; | |
4524 | + | |
4525 | + // All set, try to register | |
4526 | + WindowClassAtom = RegisterClassEx (&wc); | |
4527 | + | |
4528 | + if (WindowClassAtom == 0) | |
4529 | + { | |
4530 | + // Failed | |
4531 | + return false; | |
4532 | + } | |
4533 | + } | |
4534 | + | |
4535 | + // We're registered, or already were before the call, | |
4536 | + // return success in either case. | |
4537 | + return true; | |
4538 | +} | |
4539 | + | |
4540 | +void | |
4541 | +Window::Show (int State) | |
4542 | +{ | |
4543 | + ::ShowWindow (WindowHandle, State); | |
4544 | +} | |
4545 | + | |
4546 | +void | |
4547 | +Window::CenterWindow () | |
4548 | +{ | |
4549 | + RECT WindowRect, ParentRect; | |
4550 | + int WindowWidth, WindowHeight; | |
4551 | + POINT p; | |
4552 | + | |
4553 | + // Get the window rectangle | |
4554 | + GetWindowRect (GetHWND (), &WindowRect); | |
4555 | + | |
4556 | + if (GetParent () == NULL) | |
4557 | + { | |
4558 | + // Center on desktop window | |
4559 | + GetWindowRect (GetDesktopWindow (), &ParentRect); | |
4560 | + } | |
4561 | + else | |
4562 | + { | |
4563 | + // Center on client area of parent | |
4564 | + GetClientRect (GetParent ()->GetHWND (), &ParentRect); | |
4565 | + } | |
4566 | + | |
4567 | + WindowWidth = WindowRect.right - WindowRect.left; | |
4568 | + WindowHeight = WindowRect.bottom - WindowRect.top; | |
4569 | + | |
4570 | + // Find center of area we're centering on | |
4571 | + p.x = (ParentRect.right - ParentRect.left) / 2; | |
4572 | + p.y = (ParentRect.bottom - ParentRect.top) / 2; | |
4573 | + | |
4574 | + // Convert that to screen coords | |
4575 | + if (GetParent () == NULL) | |
4576 | + { | |
4577 | + ClientToScreen (GetDesktopWindow (), &p); | |
4578 | + } | |
4579 | + else | |
4580 | + { | |
4581 | + ClientToScreen (GetParent ()->GetHWND (), &p); | |
4582 | + } | |
4583 | + | |
4584 | + // Calculate new top left corner for window | |
4585 | + p.x -= WindowWidth / 2; | |
4586 | + p.y -= WindowHeight / 2; | |
4587 | + | |
4588 | + // And finally move the window | |
4589 | + MoveWindow (GetHWND (), p.x, p.y, WindowWidth, WindowHeight, TRUE); | |
4590 | +} | |
4591 | + | |
4592 | +LRESULT | |
4593 | +Window::WindowProc (UINT uMsg, WPARAM wParam, LPARAM lParam) | |
4594 | +{ | |
4595 | + switch (uMsg) | |
4596 | + { | |
4597 | + default: | |
4598 | + return DefWindowProc (WindowHandle, uMsg, wParam, lParam); | |
4599 | + } | |
4600 | + | |
4601 | + return 0; | |
4602 | +} | |
4603 | + | |
4604 | +bool | |
4605 | +Window::MessageLoop () | |
4606 | +{ | |
4607 | + MSG msg; | |
4608 | + | |
4609 | + while (GetMessage (&msg, NULL, 0, 0) != 0 | |
4610 | + && GetMessage (&msg, (HWND) NULL, 0, 0) != -1) | |
4611 | + { | |
4612 | + if (!IsWindow (WindowHandle) || !IsDialogMessage (WindowHandle, &msg)) | |
4613 | + { | |
4614 | + TranslateMessage (&msg); | |
4615 | + DispatchMessage (&msg); | |
4616 | + } | |
4617 | + } | |
4618 | + | |
4619 | + return true; | |
4620 | +} | |
4621 | + | |
4622 | +void | |
4623 | +Window::PostMessage (UINT uMsg, WPARAM wParam, LPARAM lParam) | |
4624 | +{ | |
4625 | + ::PostMessage (GetHWND (), uMsg, wParam, lParam); | |
4626 | +} | |
4627 | Index: window.h | |
4628 | =================================================================== | |
4629 | RCS file: window.h | |
4630 | diff -N window.h | |
4631 | --- /dev/null Tue May 5 13:32:27 1998 | |
4632 | +++ window.h Thu Dec 20 04:36:03 2001 | |
4633 | @@ -0,0 +1,95 @@ | |
4634 | +#ifndef CINSTALL_WINDOW_H | |
4635 | +#define CINSTALL_WINDOW_H | |
4636 | + | |
4637 | +/* | |
4638 | + * Copyright (c) 2001, Gary R. Van Sickle. | |
4639 | + * | |
4640 | + * This program is free software; you can redistribute it and/or modify | |
4641 | + * it under the terms of the GNU General Public License as published by | |
4642 | + * the Free Software Foundation; either version 2 of the License, or | |
4643 | + * (at your option) any later version. | |
4644 | + * | |
4645 | + * A copy of the GNU General Public License can be found at | |
4646 | + * http://www.gnu.org/ | |
4647 | + * | |
4648 | + * Written by Gary R. Van Sickle <g.r.vansickle@worldnet.att.net> | |
4649 | + * | |
4650 | + */ | |
4651 | + | |
4652 | +// This is the header for the Window class. It serves both as a window class | |
4653 | +// in its own right and as a base class for other window-like classes (e.g. PropertyPage, | |
4654 | +// PropSheet). | |
4655 | + | |
4656 | +#include <windows.h> | |
4657 | + | |
4658 | +class Window | |
4659 | +{ | |
4660 | + static ATOM WindowClassAtom; | |
4661 | + static HINSTANCE AppInstance; | |
4662 | + | |
4663 | + | |
4664 | + bool RegisterWindowClass (); | |
4665 | + static LRESULT CALLBACK FirstWindowProcReflector (HWND hwnd, UINT uMsg, | |
4666 | + WPARAM wParam, | |
4667 | + LPARAM lParam); | |
4668 | + static LRESULT CALLBACK WindowProcReflector (HWND hwnd, UINT uMsg, | |
4669 | + WPARAM wParam, LPARAM lParam); | |
4670 | + | |
4671 | + HWND WindowHandle; | |
4672 | + | |
4673 | + Window *Parent; | |
4674 | + | |
4675 | +protected: | |
4676 | + void SetHWND (HWND h) | |
4677 | + { | |
4678 | + WindowHandle = h; | |
4679 | + }; | |
4680 | + | |
4681 | +public: | |
4682 | + Window (); | |
4683 | + virtual ~ Window (); | |
4684 | + | |
4685 | + static void SetAppInstance (HINSTANCE h) | |
4686 | + { | |
4687 | + AppInstance = h; | |
4688 | + }; | |
4689 | + | |
4690 | + virtual LRESULT WindowProc (UINT uMsg, WPARAM wParam, LPARAM lParam); | |
4691 | + virtual bool MessageLoop (); | |
4692 | + | |
4693 | + virtual bool Create (Window * Parent = NULL, | |
4694 | + DWORD Style = | |
4695 | + WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CLIPCHILDREN); | |
4696 | + void Show (int State); | |
4697 | + | |
4698 | + HWND GetHWND () const | |
4699 | + { | |
4700 | + return WindowHandle; | |
4701 | + }; | |
4702 | + HINSTANCE GetInstance () const | |
4703 | + { | |
4704 | + return AppInstance; | |
4705 | + }; | |
4706 | + | |
4707 | + Window *GetParent () const | |
4708 | + { | |
4709 | + return Parent; | |
4710 | + }; | |
4711 | + HWND GetDlgItem (int id) const | |
4712 | + { | |
4713 | + return::GetDlgItem (GetHWND (), id); | |
4714 | + }; | |
4715 | + | |
4716 | + void PostMessage (UINT uMsg, WPARAM wParam = 0, LPARAM lParam = 0); | |
4717 | + | |
4718 | + virtual bool OnMessageApp (UINT uMsg, WPARAM wParam, LPARAM lParam) | |
4719 | + { | |
4720 | + return false; | |
4721 | + }; | |
4722 | + | |
4723 | + // Center the window on the parent, or on screen if no parent. | |
4724 | + void CenterWindow (); | |
4725 | + | |
4726 | +}; | |
4727 | + | |
4728 | +#endif // CINSTALL_WINDOW_H |