Index: Makefile.in =================================================================== RCS file: /cvs/src/src/winsup/cinstall/Makefile.in,v retrieving revision 2.41 diff -p -u -r2.41 Makefile.in --- Makefile.in 2001/12/28 19:03:52 2.41 +++ Makefile.in 2002/01/01 14:02:08 @@ -124,7 +124,6 @@ OBJS = \ nio-file.o \ nio-ftp.o \ nio-http.o \ - other.o \ package_db.o \ package_meta.o \ package_source.o \ @@ -250,7 +249,7 @@ endif iniparse.cc iniparse.h : iniparse.y bison -d -o iniparse.cc $(srcdir)/iniparse.y - @mv iniparse.cc.h iniparse.h 2>/dev/null || mv iniparse.hh iniparse.h + @mv iniparse.cc.h iniparse.h inilex.cc : inilex.l iniparse.h flex -8 $(srcdir)/inilex.l Index: choose.cc =================================================================== RCS file: /cvs/src/src/winsup/cinstall/choose.cc,v retrieving revision 2.82 diff -p -u -r2.82 choose.cc --- choose.cc 2002/01/01 12:32:36 2.82 +++ choose.cc 2002/01/01 14:02:13 @@ -27,7 +27,7 @@ #if 0 static const char *cvsid = - "\n%%% $Id: choose.cc,v 2.82 2002/01/01 12:32:36 rbcollins Exp $\n"; + "\n%%% $Id: choose.cc,v 2.81 2001/12/23 12:13:28 rbcollins Exp $\n"; #endif #include "win32.h" @@ -469,37 +469,19 @@ note_width (struct _header *hdrs, HDC dc static void set_existence () { - packagedb db; - /* Remove packages that are in the db, not installed, and have no - mirror info. */ - size_t n = 1; - while (n <= db.packages.number ()) - { - packagemeta & pkg = *db.packages[n]; - bool mirrors = false; - size_t o = 1; - while (o <= pkg.versions.number () && !mirrors) - { - packageversion & ver = *pkg.versions[o]; - if (ver.bin.sites.number () || ver.src.sites.number ()) - mirrors = true; - ++o; - } - if (!pkg.installed && !mirrors) - { - packagemeta * pkgm = db.packages.removebyindex (n); - delete pkgm; - } - else - ++n; - } + /* FIXME: + iterate through the package list, and delete packages that are + * Not installed + * have no mirror site + and then do the same for categories with no packages. + */ } static void fill_missing_category () { packagedb db; - for (size_t n = 1; n <= db.packages.number (); n++) + for (size_t n = 1; n < db.packages.number (); n++) { packagemeta & pkg = *db.packages[n]; if (!pkg.Categories.number ()) @@ -512,7 +494,7 @@ default_trust (HWND h, trusts trust) { deftrust = trust; packagedb db; - for (size_t n = 1; n <= db.packages.number (); n++) + for (size_t n = 1; n < db.packages.number (); n++) { packagemeta & pkg = *db.packages[n]; if (pkg.installed @@ -534,18 +516,6 @@ default_trust (HWND h, trusts trust) InvalidateRect (h, &r, TRUE); if (nextbutton) SetFocus (nextbutton); - // and then do the same for categories with no packages. - size_t n = 1; - while (n <= db.categories.number ()) - { - if (!db.categories[n]->packages) - { - Category * cat = db.categories.removebyindex (n); - delete cat; - } - else - ++n; - } } void @@ -879,7 +849,7 @@ view::init_headers (HDC dc) /* src checkbox */ note_width (headers, dc, 0, HMARGIN + 11, src_col); packagedb db; - for (size_t n = 1; n <= db.packages.number (); n++) + for (size_t n = 1; n < db.packages.number (); n++) { packagemeta & pkg = *db.packages[n]; if (pkg.installed) @@ -987,7 +957,7 @@ set_view_mode (HWND h, views mode) switch (chooser->get_view_mode ()) { case VIEW_PACKAGE: - for (size_t n = 1; n <= db.packages.number (); n++) + for (size_t n = 1; n < db.packages.number (); n++) { packagemeta & pkg = *db.packages[n]; if ((!pkg.desired && pkg.installed) @@ -997,7 +967,7 @@ set_view_mode (HWND h, views mode) } break; case VIEW_PACKAGE_FULL: - for (size_t n = 1; n <= db.packages.number (); n++) + for (size_t n = 1; n < db.packages.number (); n++) { packagemeta & pkg = *db.packages[n]; chooser->insert_pkg (pkg); @@ -1082,7 +1052,7 @@ create_listview (HWND dlg, RECT * r) log (LOG_BABBLE, "Failed to set View button caption %ld", GetLastError ()); packagedb db; - for (size_t n = 1; n <= db.packages.number (); n++) + for (size_t n = 1; n < db.packages.number (); n++) { packagemeta & pkg = *db.packages[n]; add_required (pkg); @@ -1101,7 +1071,7 @@ dialog_cmd (HWND h, int id, HWND hwndctl { case IDC_CHOOSE_PREV: default_trust (lv, TRUST_PREV); - for (size_t n = 1; n <= db.packages.number (); n++) + for (size_t n = 1; n < db.packages.number (); n++) { packagemeta & pkg = *db.packages[n]; add_required (pkg); @@ -1110,7 +1080,7 @@ dialog_cmd (HWND h, int id, HWND hwndctl break; case IDC_CHOOSE_CURR: default_trust (lv, TRUST_CURR); - for (size_t n = 1; n <= db.packages.number (); n++) + for (size_t n = 1; n < db.packages.number (); n++) { packagemeta & pkg = *db.packages[n]; add_required (pkg); @@ -1119,7 +1089,7 @@ dialog_cmd (HWND h, int id, HWND hwndctl break; case IDC_CHOOSE_EXP: default_trust (lv, TRUST_TEST); - for (size_t n = 1; n <= db.packages.number (); n++) + for (size_t n = 1; n < db.packages.number (); n++) { packagemeta & pkg = *db.packages[n]; add_required (pkg); @@ -1327,7 +1297,7 @@ do_choose (HINSTANCE h, HWND owner) log (LOG_BABBLE, "Chooser results..."); packagedb db; - for (size_t n = 1; n <= db.packages.number (); n++) + for (size_t n = 1; n < db.packages.number (); n++) { packagemeta & pkg = *db.packages[n]; // static const char *infos[] = { "nada", "prev", "curr", "test" }; Index: cistring.cc =================================================================== RCS file: /cvs/src/src/winsup/cinstall/cistring.cc,v retrieving revision 2.1 diff -p -u -r2.1 cistring.cc --- cistring.cc 2001/12/23 12:13:28 2.1 +++ cistring.cc 2002/01/01 14:02:14 @@ -1,52 +1,52 @@ -/* - * Copyright (c) 2001, Gary R. Van Sickle. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * A copy of the GNU General Public License can be found at - * http://www.gnu.org/ - * - * Written by Gary R. Van Sickle - * - */ - -// Yep, another string class - -#include "cistring.h" -#include - -DWORD -cistring::Format (UINT i, ...) -{ - TCHAR FormatStringBuffer[256]; - TCHAR *Buff; - va_list arglist; - DWORD numchars; - - // Get the string from the stringtable (FormatMessage() can only work with - // literal strings or *message*table entries, which are different for some - // inexplicable reason). - LoadString (GetModuleHandle (NULL), i, FormatStringBuffer, 256); - - va_start (arglist, i); - numchars =:: - FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_STRING, FormatStringBuffer, i, 0, - (LPTSTR) & Buff, 0, &arglist); - va_end (arglist); - - if (numchars == 0) - { - // Something went wrong. - return 0; - } - - buffer = new TCHAR[(numchars + 1) * sizeof (TCHAR)]; - memcpy (buffer, Buff, (numchars + 1) * sizeof (TCHAR)); - LocalFree (Buff); - - return numchars; -} +/* + * Copyright (c) 2001, Gary R. Van Sickle. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * A copy of the GNU General Public License can be found at + * http://www.gnu.org/ + * + * Written by Gary R. Van Sickle + * + */ + +// Yep, another string class + +#include "cistring.h" +#include + +DWORD +cistring::Format (UINT i, ...) +{ + TCHAR FormatStringBuffer[256]; + TCHAR *Buff; + va_list arglist; + DWORD numchars; + + // Get the string from the stringtable (FormatMessage() can only work with + // literal strings or *message*table entries, which are different for some + // inexplicable reason). + LoadString (GetModuleHandle (NULL), i, FormatStringBuffer, 256); + + va_start (arglist, i); + numchars =:: + FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_STRING, FormatStringBuffer, i, 0, + (LPTSTR) & Buff, 0, &arglist); + va_end (arglist); + + if (numchars == 0) + { + // Something went wrong. + return 0; + } + + buffer = new TCHAR[(numchars + 1) * sizeof (TCHAR)]; + memcpy (buffer, Buff, (numchars + 1) * sizeof (TCHAR)); + LocalFree (Buff); + + return numchars; +} Index: cistring.h =================================================================== RCS file: /cvs/src/src/winsup/cinstall/cistring.h,v retrieving revision 2.1 diff -p -u -r2.1 cistring.h --- cistring.h 2001/12/23 12:13:28 2.1 +++ cistring.h 2002/01/01 14:02:14 @@ -1,41 +1,41 @@ -/* - * Copyright (c) 2001, Gary R. Van Sickle. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * A copy of the GNU General Public License can be found at - * http://www.gnu.org/ - * - * Written by Gary R. Van Sickle - * - */ - -// Yep, another string class - -#include - -class cistring -{ - TCHAR *buffer; -public: - cistring () - { - buffer = NULL; - }; - cistring (const TCHAR * s); - ~cistring () - { - if (buffer != NULL) - delete[]buffer; - }; - - const TCHAR *c_str () - { - return buffer; - }; - - DWORD Format (UINT i, ...); -}; +/* + * Copyright (c) 2001, Gary R. Van Sickle. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * A copy of the GNU General Public License can be found at + * http://www.gnu.org/ + * + * Written by Gary R. Van Sickle + * + */ + +// Yep, another string class + +#include + +class cistring +{ + TCHAR *buffer; +public: + cistring () + { + buffer = NULL; + }; + cistring (const TCHAR * s); + ~cistring () + { + if (buffer != NULL) + delete[]buffer; + }; + + const TCHAR *c_str () + { + return buffer; + }; + + DWORD Format (UINT i, ...); +}; Index: desktop.cc =================================================================== RCS file: /cvs/src/src/winsup/cinstall/desktop.cc,v retrieving revision 2.20 diff -p -u -r2.20 desktop.cc --- desktop.cc 2001/12/23 12:13:28 2.20 +++ desktop.cc 2002/01/01 14:02:18 @@ -88,8 +88,6 @@ static const char *etc_profile[] = { "$ '", "", "cd \"$HOME\"", - "", - "test -f ./.bashrc && . ./.bashrc", 0 }; Index: desktop.h =================================================================== RCS file: /cvs/src/src/winsup/cinstall/desktop.h,v retrieving revision 2.1 diff -p -u -r2.1 desktop.h --- desktop.h 2001/12/23 12:13:28 2.1 +++ desktop.h 2002/01/01 14:02:18 @@ -1,41 +1,41 @@ -#ifndef CINSTALL_DESKTOP_H -#define CINSTALL_DESKTOP_H - -/* - * Copyright (c) 2001, Gary R. Van Sickle. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * A copy of the GNU General Public License can be found at - * http://www.gnu.org/ - * - * Written by Gary R. Van Sickle - * - */ - -// This is the header for the DesktopSetupPage class. Allows selection -// of "create desktop icon" and "add to start menu". - -#include "proppage.h" - -class DesktopSetupPage:public PropertyPage -{ -public: - DesktopSetupPage () - { - }; - virtual ~ DesktopSetupPage () - { - }; - - bool Create (); - - virtual void OnInit (); - virtual bool OnFinish (); - virtual long OnBack (); -}; - -#endif // CINSTALL_DESKTOP_H +#ifndef CINSTALL_DESKTOP_H +#define CINSTALL_DESKTOP_H + +/* + * Copyright (c) 2001, Gary R. Van Sickle. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * A copy of the GNU General Public License can be found at + * http://www.gnu.org/ + * + * Written by Gary R. Van Sickle + * + */ + +// This is the header for the DesktopSetupPage class. Allows selection +// of "create desktop icon" and "add to start menu". + +#include "proppage.h" + +class DesktopSetupPage:public PropertyPage +{ +public: + DesktopSetupPage () + { + }; + virtual ~ DesktopSetupPage () + { + }; + + bool Create (); + + virtual void OnInit (); + virtual bool OnFinish (); + virtual long OnBack (); +}; + +#endif // CINSTALL_DESKTOP_H Index: geturl.cc =================================================================== RCS file: /cvs/src/src/winsup/cinstall/geturl.cc,v retrieving revision 2.16 diff -p -u -r2.16 geturl.cc --- geturl.cc 2001/12/23 12:13:28 2.16 +++ geturl.cc 2002/01/01 14:02:20 @@ -94,7 +94,7 @@ progress (int bytes) { int perc = (int)(100.0 * ((double)bytes) / (double)max_bytes); Progress.SetBar1(bytes, max_bytes); - sprintf (buf, "%3d %% (%dk/%dk) %2.1f kb/s\n", + sprintf (buf, "%d %% (%dk/%dk) %03.1f kb/s\n", perc, bytes / 1000, max_bytes / 1000, kbps); if (total_download_bytes > 0) { Index: io_stream.cc =================================================================== RCS file: /cvs/src/src/winsup/cinstall/io_stream.cc,v retrieving revision 2.6 diff -p -u -r2.6 io_stream.cc --- io_stream.cc 2002/01/01 12:32:36 2.6 +++ io_stream.cc 2002/01/01 14:02:22 @@ -21,7 +21,7 @@ #if 0 static const char *cvsid = - "\n%%% $Id: io_stream.cc,v 2.6 2002/01/01 12:32:36 rbcollins Exp $\n"; + "\n%%% $Id: io_stream.cc,v 2.5 2001/12/20 11:49:54 rbcollins Exp $\n"; #endif #include "win32.h" @@ -170,24 +170,21 @@ io_stream::move_copy (const char *from, return 0; } -ssize_t io_stream::copy (io_stream * in, io_stream * out) +ssize_t +io_stream::copy (io_stream *in, io_stream *out) { if (!in || !out) return -1; - char - buffer[16384]; - ssize_t - countin, - countout; + char buffer[16384]; + ssize_t countin, countout; while ((countin = in->read (buffer, 16384)) > 0) { countout = out->write (buffer, countin); if (countout != countin) - { - log (LOG_TIMESTAMP, "io_stream::copy failed to write %ld bytes", - countin); - return countout ? countout : -1; - } + { + log (LOG_TIMESTAMP, "io_stream::copy failed to write %ld bytes", countin); + return countout ? countout : -1; + } } /* TODO: @@ -275,3 +272,5 @@ io_stream::~io_stream () log (LOG_TIMESTAMP, "io_stream::~io_stream called"); return; } + + Index: io_stream.h =================================================================== RCS file: /cvs/src/src/winsup/cinstall/io_stream.h,v retrieving revision 2.6 diff -p -u -r2.6 io_stream.h --- io_stream.h 2002/01/01 12:32:36 2.6 +++ io_stream.h 2002/01/01 14:02:23 @@ -152,11 +152,9 @@ public: /* if you are still needing these hints... give up now! */ virtual ~ io_stream () = 0; protected: - void operator= (const io_stream &); - io_stream () - { - }; - io_stream (const io_stream &); + void operator= (const io_stream &); + io_stream () {}; + io_stream (const io_stream &); private: static int move_copy (char const *, char const *); }; Index: localdir.h =================================================================== RCS file: /cvs/src/src/winsup/cinstall/localdir.h,v retrieving revision 2.1 diff -p -u -r2.1 localdir.h --- localdir.h 2001/12/23 12:13:29 2.1 +++ localdir.h 2002/01/01 14:02:24 @@ -1,44 +1,44 @@ -#ifndef CINSTALL_LOCALDIR_H -#define CINSTALL_LOCALDIR_H - -/* - * Copyright (c) 2001, Gary R. Van Sickle. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * A copy of the GNU General Public License can be found at - * http://www.gnu.org/ - * - * Written by Gary R. Van Sickle - * - */ - -// This is the header for the LocalDirPage class. Allows the user to select -// the local package directory (i.e. where downloaded packages are stored). - - -#include "proppage.h" - -class LocalDirPage:public PropertyPage -{ -public: - LocalDirPage () - { - }; - virtual ~ LocalDirPage () - { - }; - - bool Create (); - - virtual void OnActivate (); - virtual void OnInit (); - virtual long OnNext (); - virtual long OnBack (); -}; - - -#endif +#ifndef CINSTALL_LOCALDIR_H +#define CINSTALL_LOCALDIR_H + +/* + * Copyright (c) 2001, Gary R. Van Sickle. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * A copy of the GNU General Public License can be found at + * http://www.gnu.org/ + * + * Written by Gary R. Van Sickle + * + */ + +// This is the header for the LocalDirPage class. Allows the user to select +// the local package directory (i.e. where downloaded packages are stored). + + +#include "proppage.h" + +class LocalDirPage:public PropertyPage +{ +public: + LocalDirPage () + { + }; + virtual ~ LocalDirPage () + { + }; + + bool Create (); + + virtual void OnActivate (); + virtual void OnInit (); + virtual long OnNext (); + virtual long OnBack (); +}; + + +#endif Index: net.cc =================================================================== RCS file: /cvs/src/src/winsup/cinstall/net.cc,v retrieving revision 2.8 diff -p -u -r2.8 net.cc --- net.cc 2001/12/23 12:13:29 2.8 +++ net.cc 2002/01/01 14:02:27 @@ -31,16 +31,18 @@ static const char *cvsid = #include "log.h" #include "net.h" - +#include "propsheet.h" #include "threebar.h" extern ThreeBarProgressPage Progress; static int rb[] = { IDC_NET_IE5, IDC_NET_DIRECT, IDC_NET_PROXY, 0 }; -static void -check_if_enable_next (HWND h) +void +NetPage::CheckIfEnableNext () { int e = 0, p = 0, pu = 0; + DWORD ButtonFlags = PSWIZB_BACK; + if (net_method == IDC_NET_IE5) pu = 1; if (net_method == IDC_NET_IE5 || net_method == IDC_NET_DIRECT) @@ -51,9 +53,16 @@ check_if_enable_next (HWND h) if (net_proxy_host && net_proxy_port) e = 1; } - EnableWindow (GetDlgItem (h, IDOK), e); - EnableWindow (GetDlgItem (h, IDC_PROXY_HOST), p); - EnableWindow (GetDlgItem (h, IDC_PROXY_PORT), p); + if (e) + { + // There's something in the proxy and port boxes, enable "Next". + ButtonFlags |= PSWIZB_NEXT; + } + + GetOwner ()->SetButtons (ButtonFlags); + + EnableWindow (GetDlgItem (IDC_PROXY_HOST), p); + EnableWindow (GetDlgItem (IDC_PROXY_PORT), p); } static void @@ -64,7 +73,6 @@ load_dialog (HWND h) if (net_proxy_port == 0) net_proxy_port = 80; eset (h, IDC_PROXY_PORT, net_proxy_port); - check_if_enable_next (h); } static void @@ -75,28 +83,10 @@ save_dialog (HWND h) net_proxy_port = eget (h, IDC_PROXY_PORT); } -static BOOL -dialog_cmd (HWND h, int id, HWND hwndctl, UINT code) -{ - switch (id) - { - - case IDC_NET_IE5: - case IDC_NET_DIRECT: - case IDC_NET_PROXY: - case IDC_PROXY_HOST: - case IDC_PROXY_PORT: - save_dialog (h); - check_if_enable_next (h); - break; - } - return 0; -} - bool NetPage::Create () { - return PropertyPage::Create (NULL, dialog_cmd, IDD_NET); + return PropertyPage::Create (IDD_NET); } void @@ -106,6 +96,7 @@ NetPage::OnInit () net_method = IDC_NET_DIRECT; load_dialog (h); + CheckIfEnableNext(); // Check to see if any radio buttons are selected. If not, select a default. if ((!SendMessage (GetDlgItem (IDC_NET_IE5), BM_GETCHECK, 0, 0) == @@ -135,4 +126,27 @@ NetPage::OnBack () { save_dialog (GetHWND ()); return 0; +} + +bool +NetPage::OnMessageCmd (int id, HWND hwndctl, UINT code) +{ + switch (id) + { + case IDC_NET_IE5: + case IDC_NET_DIRECT: + case IDC_NET_PROXY: + case IDC_PROXY_HOST: + case IDC_PROXY_PORT: + save_dialog (GetHWND()); + CheckIfEnableNext (); + break; + + default: + // Wasn't recognized or handled. + return false; + } + + // Was handled since we never got to default above. + return true; } Index: net.h =================================================================== RCS file: /cvs/src/src/winsup/cinstall/net.h,v retrieving revision 2.1 diff -p -u -r2.1 net.h --- net.h 2001/12/23 12:13:29 2.1 +++ net.h 2002/01/01 14:02:27 @@ -1,42 +1,46 @@ -#ifndef CINSTALL_NET_H -#define CINSTALL_NET_H - -/* - * Copyright (c) 2001, Gary R. Van Sickle. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * A copy of the GNU General Public License can be found at - * http://www.gnu.org/ - * - * Written by Gary R. Van Sickle - * - */ - -// This is the header for the NetPage class. It allows the user to select -// a proxy etc. - - -#include "proppage.h" - -class NetPage:public PropertyPage -{ -public: - NetPage () - { - }; - virtual ~ NetPage () - { - }; - - bool Create (); - - virtual void OnInit (); - virtual long OnNext (); - virtual long OnBack (); -}; - -#endif // CINSTALL_NET_H +#ifndef CINSTALL_NET_H +#define CINSTALL_NET_H + +/* + * Copyright (c) 2001, Gary R. Van Sickle. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * A copy of the GNU General Public License can be found at + * http://www.gnu.org/ + * + * Written by Gary R. Van Sickle + * + */ + +// This is the header for the NetPage class. It allows the user to select +// a proxy etc. + + +#include "proppage.h" + +class NetPage:public PropertyPage +{ + void CheckIfEnableNext (); + +public: + NetPage () + { + }; + virtual ~ NetPage () + { + }; + + bool Create (); + + virtual void OnInit (); + virtual long OnNext (); + virtual long OnBack (); + + virtual bool OnMessageCmd (int id, HWND hwndctl, UINT code); +}; + +#endif // CINSTALL_NET_H Index: package_db.cc =================================================================== RCS file: /cvs/src/src/winsup/cinstall/package_db.cc,v retrieving revision 2.14 diff -p -u -r2.14 package_db.cc --- package_db.cc 2002/01/01 12:32:36 2.14 +++ package_db.cc 2002/01/01 14:02:29 @@ -20,7 +20,7 @@ #if 0 static const char *cvsid = - "\n%%% $Id: package_db.cc,v 2.14 2002/01/01 12:32:36 rbcollins Exp $\n"; + "\n%%% $Id: package_db.cc,v 2.13 2001/12/23 12:13:29 rbcollins Exp $\n"; #endif #include #include @@ -42,7 +42,7 @@ static const char *cvsid = packagedb::packagedb () { - io_stream *db = 0; + io_stream * db = 0; if (!installeddbread) { /* no parameters. Read in the local installation database. */ @@ -131,22 +131,22 @@ packagedb::flush () ndb->write ("INSTALLED.DB 2\n", strlen ("INSTALLED.DB 2\n")); for (size_t n = 1; n < packages.number (); n++) { - packagemeta & pkgm = *packages[n]; - if (pkgm.installed) - { - char line[2048]; + packagemeta &pkgm = * packages[n]; + if (pkgm.installed) + { + char line[2048]; - /* size here is irrelevant - as we can assume that this install source - * no longer exists, and it does not correlate to used disk space - * also note that we are writing a fictional install source - * to keep cygcheck happy. - */ - sprintf (line, "%s %s %d\n", pkgm.name, - concat (pkgm.name, "-", - pkgm.installed->Canonical_version (), - ".tar.bz2", 0), 0); - ndb->write (line, strlen (line)); - } + /* size here is irrelevant - as we can assume that this install source + * no longer exists, and it does not correlate to used disk space + * also note that we are writing a fictional install source + * to keep cygcheck happy. + */ + sprintf (line, "%s %s %d\n", pkgm.name, + concat (pkgm.name, "-", + pkgm.installed->Canonical_version (), + ".tar.bz2", 0), 0); + ndb->write (line, strlen (line)); + } } delete ndb; @@ -158,15 +158,9 @@ packagedb::flush () return 0; } -int - packagedb::installeddbread = - 0; -list < packagemeta, char const *, - strcasecmp > - packagedb::packages; +int packagedb::installeddbread = 0; +list < packagemeta, char const *, strcasecmp > packagedb::packages; list < Category, char const *, strcasecmp > packagedb::categories; -PackageDBActions - packagedb::task = - PackageDB_Install; +PackageDBActions packagedb::task = PackageDB_Install; Index: package_meta.cc =================================================================== RCS file: /cvs/src/src/winsup/cinstall/package_meta.cc,v retrieving revision 2.9 diff -p -u -r2.9 package_meta.cc --- package_meta.cc 2002/01/01 12:32:36 2.9 +++ package_meta.cc 2002/01/01 14:02:30 @@ -15,7 +15,7 @@ #if 0 static const char *cvsid = - "\n%%% $Id: package_meta.cc,v 2.9 2002/01/01 12:32:36 rbcollins Exp $\n"; + "\n%%% $Id: package_meta.cc,v 2.8 2001/12/20 11:49:54 rbcollins Exp $\n"; #endif #include @@ -150,7 +150,7 @@ packagemeta::add_category (Category & ca } char const * -packagemeta::SDesc () const +packagemeta::SDesc () { return versions[1]->SDesc (); }; Index: package_meta.h =================================================================== RCS file: /cvs/src/src/winsup/cinstall/package_meta.h,v retrieving revision 2.9 diff -p -u -r2.9 package_meta.h --- package_meta.h 2002/01/01 12:32:36 2.9 +++ package_meta.h 2002/01/01 14:02:30 @@ -70,6 +70,7 @@ public: strcpy (installed_from, installedfrom); }; + ~packagemeta () { delete[] name; @@ -90,7 +91,7 @@ public: char *installed_from; /* SDesc is global in theory, across all package versions. LDesc is not: it can be different per version */ - char const *SDesc () const; + char const *SDesc (); /* what categories does this package belong in. Note that if multiple versions * of a package disagree.... the first one read in will take precedence. */ Index: proppage.cc =================================================================== RCS file: /cvs/src/src/winsup/cinstall/proppage.cc,v retrieving revision 2.2 diff -p -u -r2.2 proppage.cc --- proppage.cc 2002/01/01 12:32:36 2.2 +++ proppage.cc 2002/01/01 14:02:32 @@ -19,6 +19,7 @@ #include "proppage.h" #include "propsheet.h" #include "win32.h" +#include "resource.h" bool PropertyPage::DoOnceForSheet = true; @@ -111,6 +112,11 @@ PropertyPage::DialogProc (UINT message, case WM_INITDIALOG: { OnInit (); + + // Set header title font of each internal page to MS Sans Serif, Bold, 8 Pt. + // This will just silently fail on the first and last pages. + SetDlgItemFont(IDC_STATIC_HEADER_TITLE, "MS Sans Serif", 8, FW_BOLD); + // TRUE = Set focus to default control (in wParam). return TRUE; break; @@ -130,13 +136,6 @@ PropertyPage::DialogProc (UINT message, GetOwner ()->SetHWNDFromPage (((NMHDR FAR *) lParam)-> hwndFrom); GetOwner ()->CenterWindow (); - // Add a minimize box to the parent property sheet. We do this here - // instead of in the sheet class mainly because it will work with either - // modal or modeless sheets. - LONG style =::GetWindowLong (((NMHDR FAR *) lParam)->hwndFrom, - GWL_STYLE); - ::SetWindowLong (((NMHDR FAR *) lParam)->hwndFrom, GWL_STYLE, - style | WS_MINIMIZEBOX); DoOnceForSheet = false; } @@ -145,19 +144,16 @@ PropertyPage::DialogProc (UINT message, { // Disable "Back" on first page. GetOwner ()->SetButtons (PSWIZB_NEXT); - //::PropSheet_SetWizButtons(((NMHDR FAR *) lParam)->hwndFrom, PSWIZB_NEXT); } else if (IsLast) { // Disable "Next", enable "Finish" on last page GetOwner ()->SetButtons (PSWIZB_BACK | PSWIZB_FINISH); - //::PropSheet_SetWizButtons(((NMHDR FAR *) lParam)->hwndFrom, PSWIZB_BACK | PSWIZB_FINISH); } else { // Middle page, enable both "Next" and "Back" buttons GetOwner ()->SetButtons (PSWIZB_BACK | PSWIZB_NEXT); - //::PropSheet_SetWizButtons(((NMHDR FAR *) lParam)->hwndFrom, PSWIZB_BACK | PSWIZB_NEXT); } OnActivate (); @@ -202,11 +198,23 @@ PropertyPage::DialogProc (UINT message, } break; case WM_COMMAND: - if (cmdproc != NULL) - { - return HANDLE_WM_COMMAND (GetHWND (), wParam, lParam, cmdproc); - } - break; + { + bool retval; + + retval = + OnMessageCmd (LOWORD (wParam), (HWND) lParam, HIWORD (wParam)); + if (retval == true) + { + // Handled, return 0 + SetWindowLong (GetHWND (), DWL_MSGRESULT, 0); + return TRUE; + } + else if (cmdproc != NULL) + { + return HANDLE_WM_COMMAND (GetHWND (), wParam, lParam, cmdproc); + } + break; + } default: break; } Index: proppage.h =================================================================== RCS file: /cvs/src/src/winsup/cinstall/proppage.h,v retrieving revision 2.1 diff -p -u -r2.1 proppage.h --- proppage.h 2001/12/23 12:13:29 2.1 +++ proppage.h 2002/01/01 14:02:32 @@ -1,117 +1,117 @@ -#ifndef CINSTALL_PROPPAGE_H -#define CINSTALL_PROPPAGE_H - -/* - * Copyright (c) 2001, Gary R. Van Sickle. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * A copy of the GNU General Public License can be found at - * http://www.gnu.org/ - * - * Written by Gary R. Van Sickle - * - */ - -// This is the header for the PropertyPage class. It works closely with the -// PropSheet class to implement a single page of the property sheet. - - -#include -#include - -#include "window.h" - -class PropSheet; - -class PropertyPage:public Window -{ - static bool DoOnceForSheet; - PROPSHEETPAGE psp; - DLGPROC proc; - BOOL (*cmdproc) (HWND h, int id, HWND hwndctl, UINT code); - - // The sheet that owns this page. - PropSheet *OurSheet; - - // For setting the back/finish buttons properly. - bool IsFirst, IsLast; - - static BOOL CALLBACK FirstDialogProcReflector (HWND hwnd, UINT message, - WPARAM wParam, - LPARAM lParam); - static BOOL CALLBACK DialogProcReflector (HWND hwnd, UINT message, - WPARAM wParam, LPARAM lParam); - -protected: - virtual BOOL CALLBACK DialogProc (UINT message, WPARAM wParam, - LPARAM lParam); - -public: - PropertyPage (); - virtual ~ PropertyPage (); - - PROPSHEETPAGE *GetPROPSHEETPAGEPtr () - { - return &psp; - }; - - // FIXME: These should be private and friended to PropSheet. - void YouAreBeingAddedToASheet (PropSheet * ps) - { - OurSheet = ps; - }; - void YouAreFirst () - { - IsFirst = true; - IsLast = false; - }; - void YouAreLast () - { - IsFirst = false; - IsLast = true; - }; - void YouAreMiddle () - { - IsFirst = false; - IsLast = false; - }; - - virtual bool Create (int TemplateID); - virtual bool Create (DLGPROC dlgproc, int TemplateID); - virtual bool Create (DLGPROC dlgproc, - BOOL (*cmdproc) (HWND h, int id, HWND hwndctl, - UINT code), int TemplateID); - - virtual void OnInit () - { - }; - virtual void OnActivate () - { - }; - virtual void OnDeactivate () - { - }; - virtual long OnNext () - { - return 0; - }; - virtual long OnBack () - { - return 0; - }; - virtual bool OnFinish () - { - return true; - }; - - PropSheet *GetOwner () const - { - return OurSheet; - }; -}; - -#endif // CINSTALL_PROPPAGE_H +#ifndef CINSTALL_PROPPAGE_H +#define CINSTALL_PROPPAGE_H + +/* + * Copyright (c) 2001, Gary R. Van Sickle. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * A copy of the GNU General Public License can be found at + * http://www.gnu.org/ + * + * Written by Gary R. Van Sickle + * + */ + +// This is the header for the PropertyPage class. It works closely with the +// PropSheet class to implement a single page of the property sheet. + + +#include +#include + +#include "window.h" + +class PropSheet; + +class PropertyPage:public Window +{ + static bool DoOnceForSheet; + PROPSHEETPAGE psp; + DLGPROC proc; + BOOL (*cmdproc) (HWND h, int id, HWND hwndctl, UINT code); + + // The sheet that owns this page. + PropSheet *OurSheet; + + // For setting the back/finish buttons properly. + bool IsFirst, IsLast; + + static BOOL CALLBACK FirstDialogProcReflector (HWND hwnd, UINT message, + WPARAM wParam, + LPARAM lParam); + static BOOL CALLBACK DialogProcReflector (HWND hwnd, UINT message, + WPARAM wParam, LPARAM lParam); + +protected: + virtual BOOL CALLBACK DialogProc (UINT message, WPARAM wParam, + LPARAM lParam); + +public: + PropertyPage (); + virtual ~ PropertyPage (); + + PROPSHEETPAGE *GetPROPSHEETPAGEPtr () + { + return &psp; + }; + + // FIXME: These should be private and friended to PropSheet. + void YouAreBeingAddedToASheet (PropSheet * ps) + { + OurSheet = ps; + }; + void YouAreFirst () + { + IsFirst = true; + IsLast = false; + }; + void YouAreLast () + { + IsFirst = false; + IsLast = true; + }; + void YouAreMiddle () + { + IsFirst = false; + IsLast = false; + }; + + virtual bool Create (int TemplateID); + virtual bool Create (DLGPROC dlgproc, int TemplateID); + virtual bool Create (DLGPROC dlgproc, + BOOL (*cmdproc) (HWND h, int id, HWND hwndctl, + UINT code), int TemplateID); + + virtual void OnInit () + { + }; + virtual void OnActivate () + { + }; + virtual void OnDeactivate () + { + }; + virtual long OnNext () + { + return 0; + }; + virtual long OnBack () + { + return 0; + }; + virtual bool OnFinish () + { + return true; + }; + + PropSheet *GetOwner () const + { + return OurSheet; + }; +}; + +#endif // CINSTALL_PROPPAGE_H Index: propsheet.cc =================================================================== RCS file: /cvs/src/src/winsup/cinstall/propsheet.cc,v retrieving revision 2.2 diff -p -u -r2.2 propsheet.cc --- propsheet.cc 2002/01/01 12:32:36 2.2 +++ propsheet.cc 2002/01/01 14:02:33 @@ -35,7 +35,23 @@ DLLVERSIONINFO; typedef HRESULT CALLBACK (*DLLGETVERSIONPROC) (DLLVERSIONINFO * pdvi); #define PROPSHEETHEADER_V1_SIZE 40 - +// Sort of a "hidden" Windows structure. Used in the PropSheetCallback. +#include +typedef struct DLGTEMPLATEEX +{ + WORD dlgVer; + WORD signature; + DWORD helpID; + DWORD exStyle; + DWORD style; + WORD cDlgItems; + short x; + short y; + short cx; + short cy; +} +DLGTEMPLATEEX, *LPDLGTEMPLATEEX; +#include PropSheet::PropSheet () { @@ -83,6 +99,28 @@ PropSheet::CreatePages () return retarray; } +static int CALLBACK +PropSheetProc (HWND hwndDlg, UINT uMsg, LPARAM lParam) +{ + switch (uMsg) + { + case PSCB_PRECREATE: + { + // Add a minimize box to the sheet/wizard. + if (((LPDLGTEMPLATEEX) lParam)->signature == 0xFFFF) + { + ((LPDLGTEMPLATEEX) lParam)->style |= WS_MINIMIZEBOX; + } + else + { + ((LPDLGTEMPLATE) lParam)->style |= WS_MINIMIZEBOX; + } + } + return TRUE; + } + return TRUE; +} + static DWORD GetPROPSHEETHEADERSize () { @@ -126,15 +164,16 @@ GetPROPSHEETHEADERSize () return retval; } -bool PropSheet::Create (const Window * Parent, DWORD Style) +bool +PropSheet::Create (const Window * Parent, DWORD Style) { - PROPSHEETHEADER - p; + PROPSHEETHEADER p; PageHandles = CreatePages (); p.dwSize = GetPROPSHEETHEADERSize (); - p.dwFlags = PSH_NOAPPLYNOW | PSH_WIZARD /*| PSH_MODELESS */ ; + p.dwFlags = + PSH_NOAPPLYNOW | PSH_WIZARD | PSH_USECALLBACK /*| PSH_MODELESS */ ; if (Parent != NULL) { p.hwndParent = Parent->GetHWND (); @@ -147,7 +186,7 @@ bool PropSheet::Create (const Window * P p.nPages = NumPropPages; p.nStartPage = 0; p.phpage = PageHandles; - p.pfnCallback = NULL; + p.pfnCallback = PropSheetProc; PropertySheet (&p); @@ -188,13 +227,15 @@ PropSheet::AddPage (PropertyPage * p) NumPropPages++; } -bool PropSheet::SetActivePage (int i) +bool +PropSheet::SetActivePage (int i) { // Posts a message to the message queue, so this won't block return static_cast < bool > (::PropSheet_SetCurSel (GetHWND (), NULL, i)); } -bool PropSheet::SetActivePageByID (int resource_id) +bool +PropSheet::SetActivePageByID (int resource_id) { // Posts a message to the message queue, so this won't block return static_cast < bool > Index: propsheet.h =================================================================== RCS file: /cvs/src/src/winsup/cinstall/propsheet.h,v retrieving revision 2.1 diff -p -u -r2.1 propsheet.h --- propsheet.h 2001/12/23 12:13:29 2.1 +++ propsheet.h 2002/01/01 14:02:33 @@ -1,59 +1,59 @@ -#ifndef CINSTALL_PROPSHEET_H -#define CINSTALL_PROPSHEET_H - -/* - * Copyright (c) 2001, Gary R. Van Sickle. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * A copy of the GNU General Public License can be found at - * http://www.gnu.org/ - * - * Written by Gary R. Van Sickle - * - */ - -// This is the header for the PropSheet class. This class encapsulates -// a Windows property sheet / wizard and interfaces with the PropertyPage class. -// It's named PropSheet instead of PropertySheet because the latter conflicts with -// the Windows function of the same name. - - -#include -#include - -#include "window.h" - -class PropertyPage; - -class PropSheet:public Window -{ - PropertyPage *PropertyPages[MAXPROPPAGES]; - int NumPropPages; - - HPROPSHEETPAGE *PageHandles; - HPROPSHEETPAGE *CreatePages (); - -public: - PropSheet (); - virtual ~ PropSheet (); - - // Should be private and friended to PropertyPage - void SetHWNDFromPage (HWND h); - - virtual bool Create (const Window * Parent = NULL, - DWORD Style = - WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CLIPCHILDREN); - - void AddPage (PropertyPage * p); - - bool SetActivePage (int i); - bool SetActivePageByID (int resource_id); - void SetButtons (DWORD flags); - void PressButton (int button); -}; - -#endif // CINSTALL_PROPSHEET_H +#ifndef CINSTALL_PROPSHEET_H +#define CINSTALL_PROPSHEET_H + +/* + * Copyright (c) 2001, Gary R. Van Sickle. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * A copy of the GNU General Public License can be found at + * http://www.gnu.org/ + * + * Written by Gary R. Van Sickle + * + */ + +// This is the header for the PropSheet class. This class encapsulates +// a Windows property sheet / wizard and interfaces with the PropertyPage class. +// It's named PropSheet instead of PropertySheet because the latter conflicts with +// the Windows function of the same name. + + +#include +#include + +#include "window.h" + +class PropertyPage; + +class PropSheet:public Window +{ + PropertyPage *PropertyPages[MAXPROPPAGES]; + int NumPropPages; + + HPROPSHEETPAGE *PageHandles; + HPROPSHEETPAGE *CreatePages (); + +public: + PropSheet (); + virtual ~ PropSheet (); + + // Should be private and friended to PropertyPage + void SetHWNDFromPage (HWND h); + + virtual bool Create (const Window * Parent = NULL, + DWORD Style = + WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CLIPCHILDREN); + + void AddPage (PropertyPage * p); + + bool SetActivePage (int i); + bool SetActivePageByID (int resource_id); + void SetButtons (DWORD flags); + void PressButton (int button); +}; + +#endif // CINSTALL_PROPSHEET_H Index: res.rc =================================================================== RCS file: /cvs/src/src/winsup/cinstall/res.rc,v retrieving revision 2.32 diff -p -u -r2.32 res.rc --- res.rc 2001/12/23 12:13:29 2.32 +++ res.rc 2002/01/01 14:02:34 @@ -28,139 +28,149 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_U // Dialog // -IDD_SOURCE DIALOG DISCARDABLE 0, 0, 215, 95 +IDD_SOURCE DIALOG DISCARDABLE 0, 0, 317, 179 STYLE DS_MODALFRAME | DS_CENTER | WS_CHILD | WS_CAPTION | WS_SYSMENU CAPTION "Cygwin Setup" FONT 8, "MS Sans Serif" BEGIN - ICON IDI_CYGWIN,-1,5,5,20,20 CONTROL "&Install from Internet",IDC_SOURCE_NETINST,"Button", - BS_AUTORADIOBUTTON,55,15,75,10 + BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,101,69,115,10 CONTROL "&Download from Internet",IDC_SOURCE_DOWNLOAD,"Button", - BS_AUTORADIOBUTTON,55,30,89,10 + BS_AUTORADIOBUTTON | WS_TABSTOP,101,84,115,10 CONTROL "Install from &Local Directory",IDC_SOURCE_CWD,"Button", - BS_AUTORADIOBUTTON,55,45,99,10 + BS_AUTORADIOBUTTON | WS_TABSTOP,101,99,115,10 + ICON IDI_CYGWIN,IDC_STATIC,290,0,21,20 + CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,0,28, + 317,1 + LTEXT "Choose A Download Source",IDC_STATIC_HEADER_TITLE,7,0, + 131,8,NOT WS_GROUP + LTEXT "Choose whether to install or download from the internet, or install from files in a local directory.", + IDC_STATIC,21,9,239,16,NOT WS_GROUP END -IDD_LOCAL_DIR DIALOG DISCARDABLE 0, 0, 227, 94 +IDD_LOCAL_DIR DIALOG DISCARDABLE 0, 0, 317, 179 STYLE DS_MODALFRAME | DS_CENTER | WS_CHILD | WS_CAPTION | WS_SYSMENU CAPTION "Cygwin Setup" FONT 8, "MS Sans Serif" BEGIN - ICON IDI_CYGWIN,IDC_STATIC,5,5,20,20 - PUSHBUTTON "B&rowse...",IDC_LOCAL_DIR_BROWSE,185,30,34,14 - LTEXT "Local Package &Directory",IDC_STATIC,55,15,85,11 - EDITTEXT IDC_LOCAL_DIR,55,30,127,15,ES_AUTOHSCROLL -END - -IDD_ROOT DIALOG DISCARDABLE 0, 0, 215, 95 -STYLE DS_MODALFRAME | DS_CENTER | WS_CHILD | WS_CAPTION | WS_SYSMENU -CAPTION "Cygwin Setup" -FONT 8, "MS Sans Serif" -BEGIN - ICON IDI_CYGWIN,IDC_STATIC,5,5,20,20 - PUSHBUTTON "B&rowse...",IDC_ROOT_BROWSE,150,10,34,14 - LTEXT "Select install root &directory",IDC_STATIC,55,15,85,11 - EDITTEXT IDC_ROOT_DIR,55,25,127,12,ES_AUTOHSCROLL - RTEXT "Default &Text File Type :",IDC_STATIC,20,45,100,8 - CONTROL "D&OS",IDC_ROOT_TEXT,"Button",BS_AUTORADIOBUTTON,125,45, - 31,8 - CONTROL "&Unix",IDC_ROOT_BINARY,"Button",BS_AUTORADIOBUTTON,160, - 45,30,8 - RTEXT "&Install For :",IDC_STATIC,55,60,65,8 - CONTROL "&All",IDC_ROOT_SYSTEM,"Button",BS_AUTORADIOBUTTON | - WS_GROUP,125,60,25,8 - CONTROL "Just &Me",IDC_ROOT_USER,"Button",BS_AUTORADIOBUTTON,160, - 60,50,8 + EDITTEXT IDC_LOCAL_DIR,58,83,165,15,ES_AUTOHSCROLL | WS_GROUP + PUSHBUTTON "B&rowse...",IDC_LOCAL_DIR_BROWSE,223,83,34,14 + GROUPBOX "Local Package Directory",IDC_STATIC,53,67,210,45 + ICON IDI_CYGWIN,IDC_STATIC,290,0,21,20 + CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,0,28, + 317,1 + LTEXT "Select a directory where you want Setup to store the installation files it dowloads. The directory will be created if it does not already exist.", + IDC_STATIC,21,9,248,16,NOT WS_GROUP + LTEXT "Select Local Package Directory",IDC_STATIC_HEADER_TITLE, + 7,0,258,8,NOT WS_GROUP END -IDD_SITE DIALOG DISCARDABLE 0, 0, 247, 94 +IDD_ROOT DIALOG DISCARDABLE 0, 0, 317, 179 STYLE DS_MODALFRAME | DS_CENTER | WS_CHILD | WS_CAPTION | WS_SYSMENU CAPTION "Cygwin Setup" FONT 8, "MS Sans Serif" BEGIN - ICON IDI_CYGWIN,IDC_STATIC,5,5,20,20 - LTEXT "Select Download &Site",IDC_STATIC,55,5,135,11 - LISTBOX IDC_URL_LIST,55,20,185,65,LBS_NOINTEGRALHEIGHT | - LBS_EXTENDEDSEL | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP + GROUPBOX "Root Directory",IDC_STATIC,5,50,305,40,WS_TABSTOP + GROUPBOX "Install For",IDC_STATIC,5,105,150,50,WS_TABSTOP + GROUPBOX "Default Text File Type",IDC_STATIC,160,105,150,50 + EDITTEXT IDC_ROOT_DIR,15,65,245,15,ES_AUTOHSCROLL | WS_GROUP + PUSHBUTTON "B&rowse...",IDC_ROOT_BROWSE,260,65,44,14 + CONTROL "&All Users",IDC_ROOT_SYSTEM,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,15,120,85,8 + CONTROL "Just &Me",IDC_ROOT_USER,"Button",BS_AUTORADIOBUTTON | + WS_TABSTOP,15,135,85,8 + CONTROL "D&OS",IDC_ROOT_TEXT,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,170,120,90,8 + CONTROL "&Unix",IDC_ROOT_BINARY,"Button",BS_AUTORADIOBUTTON | + WS_TABSTOP,170,135,90,8 + ICON IDI_CYGWIN,IDC_STATIC,290,0,20,20 + CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,0,28, + 317,1 + LTEXT "Select the directory where you want to install Cygwin. Also choose a few installation parameters.", + IDC_STATIC,21,9,239,16,NOT WS_GROUP + LTEXT "Select Root Install Directory",IDC_STATIC_HEADER_TITLE, + 7,0,258,8,NOT WS_GROUP END -IDD_OTHER_URL DIALOG DISCARDABLE 0, 0, 215, 95 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_SITE DIALOG DISCARDABLE 0, 0, 317, 179 +STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_CHILD | WS_VISIBLE | + WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_CONTROLPARENT CAPTION "Cygwin Setup" FONT 8, "MS Sans Serif" BEGIN - ICON IDI_CYGWIN,IDC_STATIC,5,5,20,20 - LTEXT "Select &URL to download from",IDC_STATIC,55,15,135,11 - EDITTEXT IDC_OTHER_URL,55,25,127,12,ES_AUTOHSCROLL - DEFPUSHBUTTON "&Next -->",IDOK,100,75,45,15 - PUSHBUTTON "Cancel",IDCANCEL,165,75,45,15 - PUSHBUTTON "<-- &Back",IDC_BACK,55,75,45,15 + ICON IDI_CYGWIN,IDC_STATIC,290,0,20,20 + LISTBOX IDC_URL_LIST,66,45,185,110,LBS_NOINTEGRALHEIGHT | + LBS_EXTENDEDSEL | WS_VSCROLL | WS_HSCROLL | WS_GROUP | + WS_TABSTOP + LTEXT "Available Download Sites:",IDC_STATIC,66,34,183,8,NOT + WS_GROUP + CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,0,28, + 317,1 + LTEXT "Choose a site from this list, or add your own sites to the list", + IDC_STATIC,21,9,239,16,NOT WS_GROUP + LTEXT "Choose A Download Site",IDC_STATIC_HEADER_TITLE,7,0,258, + 8,NOT WS_GROUP + EDITTEXT IDC_EDIT_USER_URL,65,160,185,14,ES_AUTOHSCROLL | + WS_GROUP + LTEXT "User URL:",IDC_STATIC,15,162,45,8,NOT WS_GROUP + PUSHBUTTON "Add",IDC_BUTTON_ADD_URL,250,160,50,14 END -IDD_NET DIALOG DISCARDABLE 0, 0, 247, 106 +IDD_NET DIALOG DISCARDABLE 0, 0, 317, 179 STYLE DS_MODALFRAME | DS_CENTER | WS_CHILD | WS_CAPTION | WS_SYSMENU CAPTION "Cygwin Setup" FONT 8, "MS Sans Serif" BEGIN CONTROL "&Direct Connection",IDC_NET_DIRECT,"Button", - BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,55,10,73,10 + BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,60,55,73,10 CONTROL "Use &IE5 Settings",IDC_NET_IE5,"Button", - BS_AUTORADIOBUTTON | WS_TABSTOP,55,25,69,10 + BS_AUTORADIOBUTTON | WS_TABSTOP,60,70,69,10 CONTROL "Use HTTP/FTP &Proxy:",IDC_NET_PROXY,"Button", - BS_AUTORADIOBUTTON | WS_TABSTOP,55,40,88,10 - EDITTEXT IDC_PROXY_HOST,115,60,120,12,ES_AUTOHSCROLL | + BS_AUTORADIOBUTTON | WS_TABSTOP,60,85,88,10 + EDITTEXT IDC_PROXY_HOST,120,105,120,12,ES_AUTOHSCROLL | WS_DISABLED | WS_GROUP - EDITTEXT IDC_PROXY_PORT,115,80,30,12,ES_AUTOHSCROLL | WS_DISABLED - GROUPBOX "",IDC_STATIC,55,50,185,50 - ICON IDI_CYGWIN,IDC_STATIC,5,5,21,20 - RTEXT "Proxy &Host",IDC_STATIC,60,60,50,12,SS_CENTERIMAGE | + EDITTEXT IDC_PROXY_PORT,120,125,30,12,ES_AUTOHSCROLL | + WS_DISABLED + GROUPBOX "",IDC_STATIC,60,95,185,50 + RTEXT "Proxy &Host",IDC_STATIC,65,105,50,12,SS_CENTERIMAGE | NOT WS_GROUP - RTEXT "Por&t",IDC_STATIC,80,80,30,12,SS_CENTERIMAGE | NOT + RTEXT "Por&t",IDC_STATIC,85,125,30,12,SS_CENTERIMAGE | NOT WS_GROUP + ICON IDI_CYGWIN,IDC_STATIC,290,0,21,20 + CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,0,28, + 317,1 + LTEXT "Setup needs to know how you want it to connect to the internet. Choose the appropriate settings below.", + IDC_STATIC,21,9,239,16,NOT WS_GROUP + LTEXT "Select Your Internet Connection", + IDC_STATIC_HEADER_TITLE,7,0,258,8,NOT WS_GROUP END -IDD_DLSTATUS DIALOG DISCARDABLE 0, 0, 215, 95 +IDD_INSTATUS DIALOG DISCARDABLE 0, 0, 317, 179 STYLE DS_MODALFRAME | DS_CENTER | WS_CHILD | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Cygwin Setup" FONT 8, "MS Sans Serif" BEGIN - ICON IDI_CYGWIN,IDC_STATIC,5,5,20,20 - PUSHBUTTON "Cancel",IDCANCEL,165,75,45,15 - LTEXT "Downloading...",IDC_STATIC,55,5,135,8 - LTEXT "(URL)",IDC_DLS_URL,55,15,150,8 - LTEXT "(RATE)",IDC_DLS_RATE,55,25,155,8 - CONTROL "Progress1",IDC_DLS_PROGRESS,"msctls_progress32", - PBS_SMOOTH | WS_BORDER,55,40,155,10 - CONTROL "Progress1",IDC_DLS_PPROGRESS,"msctls_progress32", - PBS_SMOOTH | WS_BORDER,55,50,155,10 - CONTROL "Progress1",IDC_DLS_IPROGRESS,"msctls_progress32", - PBS_SMOOTH | WS_BORDER,55,60,155,10 - RTEXT "Package",IDC_DLS_PROGRESS_TEXT,5,40,45,8 - RTEXT "Total",IDC_DLS_PPROGRESS_TEXT,10,50,40,8 - RTEXT "Disk",IDC_DLS_IPROGRESS_TEXT,5,60,45,8 -END - -IDD_INSTATUS DIALOG DISCARDABLE 0, 0, 252, 94 -STYLE DS_MODALFRAME | DS_CENTER | WS_CHILD | WS_VISIBLE | WS_CAPTION | - WS_SYSMENU -CAPTION "Cygwin Setup" -FONT 8, "MS Sans Serif" -BEGIN - ICON IDI_CYGWIN,IDC_STATIC,5,5,21,20 - LTEXT "Installing...",IDC_INS_ACTION,55,5,135,8 - LTEXT "(PKG)",IDC_INS_PKG,55,15,150,8 - LTEXT "(FILE)",IDC_INS_FILE,55,25,155,8 + LTEXT "Installing...",IDC_INS_ACTION,45,55,205,8,NOT WS_GROUP + LTEXT "(PKG)",IDC_INS_PKG,45,70,205,8,NOT WS_GROUP + LTEXT "(FILE)",IDC_INS_FILE,45,85,205,8,NOT WS_GROUP CONTROL "Progress1",IDC_INS_DISKFULL,"msctls_progress32", - PBS_SMOOTH | WS_BORDER,90,60,155,10 + PBS_SMOOTH | WS_BORDER,95,130,155,10 CONTROL "Progress1",IDC_INS_IPROGRESS,"msctls_progress32", - PBS_SMOOTH | WS_BORDER,90,50,155,10 + PBS_SMOOTH | WS_BORDER,95,115,155,10 CONTROL "Progress1",IDC_INS_PPROGRESS,"msctls_progress32", - PBS_SMOOTH | WS_BORDER,90,40,155,10 - RTEXT "Package",IDC_INS_BL_PACKAGE,40,40,45,8 - RTEXT "Total",IDC_INS_BL_TOTAL,45,50,40,8 - RTEXT "Disk",IDC_INS_BL_DISK,40,60,45,8 + PBS_SMOOTH | WS_BORDER,95,100,155,10 + LTEXT "Package:",IDC_INS_BL_PACKAGE,45,100,47,8,NOT WS_GROUP + LTEXT "Total:",IDC_INS_BL_TOTAL,45,115,48,8,NOT WS_GROUP + LTEXT "Disk:",IDC_INS_BL_DISK,45,130,47,8,NOT WS_GROUP + ICON IDI_CYGWIN,IDC_STATIC,290,0,20,20 + CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,0,28, + 317,1 + LTEXT "This page displays the progress of the download or installation.", + IDC_STATIC,21,9,239,16,NOT WS_GROUP + LTEXT "Progress",IDC_STATIC_HEADER_TITLE,7,0,253,8,NOT + WS_GROUP END IDD_PROXY_AUTH DIALOG DISCARDABLE 0, 0, 215, 95 @@ -197,23 +207,26 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,165,75,45,15 END -IDD_SPLASH DIALOG DISCARDABLE 0, 0, 216, 94 +IDD_SPLASH DIALOG DISCARDABLE 0, 0, 317, 179 STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_CHILD | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Cygwin Setup" FONT 8, "MS Sans Serif" BEGIN - ICON IDI_CYGWIN,IDC_STATIC,5,5,20,20 - LTEXT "Cygwin Net Release Setup Program",IDC_STATIC,55,10,114, - 8 - LTEXT "Version (unknown)",IDC_VERSION,55,25,120,10 - LTEXT "Copyright 2000, 2001 Red Hat Inc.",IDC_STATIC,55,35,120, - 8 - LTEXT "http://sources.redhat.com/cygwin/",IDC_STATIC,55,50,112, - 8 + ICON IDI_CYGWIN,IDC_STATIC,113,112,21,20,WS_GROUP + CONTROL "",IDC_STATIC,"Static",SS_WHITERECT,0,0,95,178 + LTEXT "Version (unknown)",IDC_VERSION,115,137,195,10 + LTEXT "Cygwin Net Release Setup Program", + IDC_STATIC_WELCOME_TITLE,115,1,195,24 + LTEXT "Copyright 2000, 2001 Red Hat Inc.",IDC_STATIC,115,150, + 195,8 + LTEXT "http://sources.redhat.com/cygwin/",IDC_STATIC,115,162, + 195,8 + LTEXT "This wizard will guide you through the installation and updating of the Cygwin environment and a plethora of GNU packages.", + IDC_STATIC,115,33,195,54 END -IDD_CHOOSE DIALOGEX 0, 0, 430, 266 +IDD_CHOOSE DIALOG DISCARDABLE 0, 0, 430, 266 STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_CHILD | WS_VISIBLE | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_CONTROLPARENT @@ -241,17 +254,23 @@ BEGIN LTEXT "",IDC_CHOOSE_VIEWCAPTION,390,5,30,10 END -IDD_DESKTOP DIALOG DISCARDABLE 0, 0, 215, 95 +IDD_DESKTOP DIALOG DISCARDABLE 0, 0, 317, 179 STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_CHILD | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Cygwin Setup" FONT 8, "MS Sans Serif" BEGIN - ICON IDI_CYGWIN,IDC_STATIC,5,5,20,20 - CONTROL "Create Desktop &Icon",IDC_ROOT_DESKTOP,"Button", - BS_AUTOCHECKBOX,55,25,100,8 - CONTROL "Add to &Start Menu",IDC_ROOT_MENU,"Button", - BS_AUTOCHECKBOX,55,40,100,8 + CONTROL "Create icon on &Desktop",IDC_ROOT_DESKTOP,"Button", + BS_AUTOCHECKBOX,108,78,100,8 + CONTROL "Add icon to &Start Menu",IDC_ROOT_MENU,"Button", + BS_AUTOCHECKBOX,108,93,100,8 + ICON IDI_CYGWIN,IDC_STATIC,290,0,21,20 + CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,0,28, + 317,1 + LTEXT "Tell setup if you want it to create a few icons for convenient access to the Cygwin environment.", + IDC_STATIC,21,9,239,16,NOT WS_GROUP + LTEXT "Create Icons",IDC_STATIC_HEADER_TITLE,7,0,258,8,NOT + WS_GROUP END IDD_FTP_AUTH DIALOG DISCARDABLE 0, 0, 215, 95 @@ -271,13 +290,14 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,165,75,45,15 END -IDD_CHOOSER DIALOG DISCARDABLE 0, 0, 186, 90 +IDD_CHOOSER DIALOG DISCARDABLE 0, 0, 247, 116 STYLE DS_MODALFRAME | DS_3DLOOK | WS_CHILD | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Cygwin Setup" FONT 8, "MS Sans Serif" BEGIN - LTEXT "Don't look here",IDC_STATIC,25,38,134,8 + CTEXT "This space intentionally left blank",IDC_STATIC,57,45, + 134,8 END @@ -333,21 +353,39 @@ CYGWIN.ICON FILE DISCARDA #ifdef APSTUDIO_INVOKED GUIDELINES DESIGNINFO DISCARDABLE BEGIN + IDD_SOURCE, DIALOG + BEGIN + RIGHTMARGIN, 285 + BOTTOMMARGIN, 158 + END + IDD_LOCAL_DIR, DIALOG + BEGIN + RIGHTMARGIN, 305 + BOTTOMMARGIN, 157 + END + + IDD_ROOT, DIALOG BEGIN - RIGHTMARGIN, 215 + RIGHTMARGIN, 285 + BOTTOMMARGIN, 158 END IDD_SITE, DIALOG BEGIN - RIGHTMARGIN, 215 - BOTTOMMARGIN, 93 + BOTTOMMARGIN, 178 END IDD_NET, DIALOG + BEGIN + RIGHTMARGIN, 285 + BOTTOMMARGIN, 133 + END + + IDD_INSTATUS, DIALOG BEGIN - RIGHTMARGIN, 215 - BOTTOMMARGIN, 60 + RIGHTMARGIN, 252 + BOTTOMMARGIN, 157 END IDD_PROXY_AUTH, DIALOG @@ -360,11 +398,23 @@ BEGIN BOTTOMMARGIN, 49 END + IDD_SPLASH, DIALOG + BEGIN + RIGHTMARGIN, 247 + BOTTOMMARGIN, 116 + END + IDD_CHOOSE, DIALOG BEGIN RIGHTMARGIN, 429 END + IDD_DESKTOP, DIALOG + BEGIN + RIGHTMARGIN, 285 + BOTTOMMARGIN, 158 + END + IDD_FTP_AUTH, DIALOG BEGIN BOTTOMMARGIN, 49 @@ -373,9 +423,9 @@ BEGIN IDD_CHOOSER, DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 179 + RIGHTMARGIN, 240 TOPMARGIN, 7 - BOTTOMMARGIN, 83 + BOTTOMMARGIN, 109 END END #endif // APSTUDIO_INVOKED Index: resource.h =================================================================== RCS file: /cvs/src/src/winsup/cinstall/resource.h,v retrieving revision 2.14 diff -p -u -r2.14 resource.h --- resource.h 2001/12/23 12:13:29 2.14 +++ resource.h 2002/01/01 14:02:35 @@ -107,6 +107,10 @@ #define IDC_INS_BL_PACKAGE 1053 #define IDC_INS_BL_TOTAL 1054 #define IDC_INS_BL_DISK 1055 +#define IDC_STATIC_HEADER_TITLE 1060 +#define IDC_STATIC_WELCOME_TITLE 1061 +#define IDC_EDIT_USER_URL 1062 +#define IDC_BUTTON_ADD_URL 1063 #define IDC_STATIC -1 // Next default values for new objects @@ -115,9 +119,9 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NO_MFC 1 #define _APS_3D_CONTROLS 1 -#define _APS_NEXT_RESOURCE_VALUE 128 +#define _APS_NEXT_RESOURCE_VALUE 129 #define _APS_NEXT_COMMAND_VALUE 40003 -#define _APS_NEXT_CONTROL_VALUE 1056 +#define _APS_NEXT_CONTROL_VALUE 1064 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif Index: root.h =================================================================== RCS file: /cvs/src/src/winsup/cinstall/root.h,v retrieving revision 2.1 diff -p -u -r2.1 root.h --- root.h 2001/12/23 12:13:29 2.1 +++ root.h 2002/01/01 14:02:35 @@ -1,23 +1,23 @@ -#ifndef CINSTALL_ROOT_H -#define CINSTALL_ROOT_H - -#include "proppage.h" - -class RootPage:public PropertyPage -{ -public: - RootPage () - { - }; - virtual ~ RootPage () - { - }; - - bool Create (); - - virtual void OnInit (); - virtual long OnNext (); - virtual long OnBack (); -}; - -#endif // CINSTALL_ROOT_H +#ifndef CINSTALL_ROOT_H +#define CINSTALL_ROOT_H + +#include "proppage.h" + +class RootPage:public PropertyPage +{ +public: + RootPage () + { + }; + virtual ~ RootPage () + { + }; + + bool Create (); + + virtual void OnInit (); + virtual long OnNext (); + virtual long OnBack (); +}; + +#endif // CINSTALL_ROOT_H Index: site.cc =================================================================== RCS file: /cvs/src/src/winsup/cinstall/site.cc,v retrieving revision 2.11 diff -p -u -r2.11 site.cc --- site.cc 2001/12/23 12:13:29 2.11 +++ site.cc 2002/01/01 14:02:37 @@ -45,12 +45,10 @@ static const char *cvsid = #include "threebar.h" extern ThreeBarProgressPage Progress; -#define NO_IDX (-1) -#define OTHER_IDX (-2) - list < site_list_type, const char *, strcasecmp > site_list; list < site_list_type, const char *, strcasecmp > all_site_list; -static int mirror_idx = NO_IDX; + +static char *other_url = 0; void site_list_type::init (char const *newurl) @@ -91,41 +89,17 @@ site_list_type::site_list_type (char con init (newurl); } -static void -check_if_enable_next (HWND h) -{ - EnableWindow (GetDlgItem (h, IDOK), - SendMessage (GetDlgItem (h, IDC_URL_LIST), LB_GETSELCOUNT, 0, - 0) > 0 ? 1 : 0); -} - static void -load_dialog (HWND h) +save_dialog (HWND h) { - HWND listbox = GetDlgItem (h, IDC_URL_LIST); - for (size_t n = 1; n <= site_list.number (); n++) + // Remove anything that was previously in the selected site list. + while (site_list.number () > 0) { - int index = SendMessage (listbox, LB_FINDSTRING, (WPARAM) - 1, - (LPARAM) site_list[n]->displayed_url); - if (index != LB_ERR) - { - // Highlight the selected item - SendMessage (listbox, LB_SELITEMRANGE, TRUE, (index << 16) | index); - // Make sure it's fully visible - SendMessage (listbox, LB_SETCARETINDEX, index, FALSE); - } + // we don't delete the object because it's stored in the all_site_list. + site_list.removebyindex (1); } - check_if_enable_next (h); -} -static void -save_dialog (HWND h) -{ HWND listbox = GetDlgItem (h, IDC_URL_LIST); - mirror_idx = 0; - while (site_list.number () > 0) - /* we don't delete the object because it's stored in the all_site_list. */ - site_list.removebyindex (1); int sel_count = SendMessage (listbox, LB_GETSELCOUNT, 0, 0); if (sel_count > 0) { @@ -140,16 +114,9 @@ save_dialog (HWND h) { int mirror = SendMessage (listbox, LB_GETITEMDATA, sel_buffer[n], 0); - if (mirror == OTHER_IDX) - mirror_idx = OTHER_IDX; - else - site_list.registerbyobject (*all_site_list[mirror]); + site_list.registerbyobject (*all_site_list[mirror]); } } - else - { - NEXT (IDD_SITE); - } } void @@ -160,29 +127,17 @@ save_site_url () { if (f) { - char temp[_MAX_PATH]; - /* TODO: potential buffer overflow. we need snprintf asap. */ // FIXME: write all selected sites + TCHAR *temp; + temp = new TCHAR[sizeof (TCHAR) * (strlen (site_list[n]->url) + 2)]; sprintf (temp, "%s\n", site_list[n]->url); f->write (temp, strlen (temp)); + delete[]temp; } } delete f; } -static BOOL -dialog_cmd (HWND h, int id, HWND hwndctl, UINT code) -{ - switch (id) - { - - case IDC_URL_LIST: - check_if_enable_next (h); - break; - } - return 0; -} - static int get_site_list (HINSTANCE h, HWND owner) { @@ -302,7 +257,8 @@ do_download_site_info_thread (void *p) if (get_site_list (hinst, h)) { // Error: Couldn't download the site info. Go back to the Net setup page. - NEXT (IDD_NET); + MessageBox (h, TEXT ("Can't get list of download sites.\n\ +Make sure your network settings are corect and try again."), NULL, MB_OK); // Tell the progress page that we're done downloading Progress.PostMessage (WM_APP_SITE_INFO_DOWNLOAD_COMPLETE, 0, @@ -313,7 +269,6 @@ do_download_site_info_thread (void *p) } // Everything worked, go to the site select page - NEXT (IDD_SITE); // Tell the progress page that we're done downloading Progress.PostMessage (WM_APP_SITE_INFO_DOWNLOAD_COMPLETE, 0, IDD_SITE); @@ -334,32 +289,15 @@ do_download_site_info (HINSTANCE hinst, } -bool -SitePage::Create () +bool SitePage::Create () { - return PropertyPage::Create (NULL, dialog_cmd, IDD_SITE); + return PropertyPage::Create (IDD_SITE); } void SitePage::OnInit () { - HWND h = GetHWND (); - int j; - HWND listbox; - get_saved_sites (); - - listbox = GetDlgItem (IDC_URL_LIST); - for (size_t i = 1; i <= all_site_list.number (); i++) - { - j = - SendMessage (listbox, LB_ADDSTRING, 0, - (LPARAM) all_site_list[i]->displayed_url); - SendMessage (listbox, LB_SETITEMDATA, j, i); - } - j = SendMessage (listbox, LB_ADDSTRING, 0, (LPARAM) "Other URL"); - SendMessage (listbox, LB_SETITEMDATA, j, OTHER_IDX); - load_dialog (h); } long @@ -368,19 +306,14 @@ SitePage::OnNext () HWND h = GetHWND (); save_dialog (h); - if (mirror_idx == OTHER_IDX) - NEXT (IDD_OTHER_URL); - else - { - save_site_url (); - NEXT (IDD_S_LOAD_INI); + save_site_url (); - for (size_t n = 1; n <= site_list.number (); n++) - log (0, "site: %s", site_list[n]->url); + // Log all the selected URLs from the list. + for (size_t n = 1; n <= site_list.number (); n++) + log (0, "site: %s", site_list[n]->url); - Progress.SetActivateTask (WM_APP_START_SETUP_INI_DOWNLOAD); - return IDD_INSTATUS; - } + Progress.SetActivateTask (WM_APP_START_SETUP_INI_DOWNLOAD); + return IDD_INSTATUS; return 0; } @@ -391,6 +324,126 @@ SitePage::OnBack () HWND h = GetHWND (); save_dialog (h); - NEXT (IDD_NET); + + // Go back to the net connection type page return 0; +} + +void +SitePage::OnActivate () +{ + // Fill the list box with all known sites. + PopulateListBox (); + + // Load the user URL box with whatever it was last time. + eset (GetHWND (), IDC_EDIT_USER_URL, other_url); + + // Get the enabled/disabled states of the controls set accordingly. + CheckControlsAndDisableAccordingly (); +} + +void +SitePage::CheckControlsAndDisableAccordingly () const +{ + DWORD ButtonFlags = PSWIZB_BACK; + + // Check that at least one download site is selected. + if (SendMessage (GetDlgItem (IDC_URL_LIST), LB_GETSELCOUNT, 0, 0) > 0) + { + // At least one official site selected, enable "Next". + ButtonFlags |= PSWIZB_NEXT; + } + GetOwner ()->SetButtons (ButtonFlags); +} + +void +SitePage::PopulateListBox () +{ + int j; + HWND listbox = GetDlgItem (IDC_URL_LIST); + + // Populate the list box with the URLs. + SendMessage (listbox, LB_RESETCONTENT, 0, 0); + for (size_t i = 1; i <= all_site_list.number (); i++) + { + j = SendMessage (listbox, LB_ADDSTRING, 0, + (LPARAM) all_site_list[i]->displayed_url); + SendMessage (listbox, LB_SETITEMDATA, j, i); + } + + // Select the selected ones. + for (size_t n = 1; n <= site_list.number (); n++) + { + int index = SendMessage (listbox, LB_FINDSTRING, (WPARAM) - 1, + (LPARAM) site_list[n]->displayed_url); + if (index != LB_ERR) + { + // Highlight the selected item + SendMessage (listbox, LB_SELITEMRANGE, TRUE, (index << 16) | index); + // Make sure it's fully visible + SendMessage (listbox, LB_SETCARETINDEX, index, FALSE); + } + } +} + +bool SitePage::OnMessageCmd (int id, HWND hwndctl, UINT code) +{ + switch (id) + { + case IDC_EDIT_USER_URL: + { + if (code == EN_CHANGE) + { + // Text in edit box may have changed. + other_url = eget (GetHWND (), IDC_EDIT_USER_URL, other_url); + } + break; + } + case IDC_URL_LIST: + { + if (code == LBN_SELCHANGE) + { + CheckControlsAndDisableAccordingly (); + } + break; + } + case IDC_BUTTON_ADD_URL: + { + if (code == BN_CLICKED) + { + // User pushed the Add button. + other_url = eget (GetHWND (), IDC_EDIT_USER_URL, other_url); + site_list_type * + newsite = + new + site_list_type (other_url); + site_list_type & listobj = + all_site_list.registerbyobject (*newsite); + if (&listobj != newsite) + { + // That site was already registered + delete + newsite; + } + else + { + // Log the adding of this new URL. + log (0, "Adding site: %s", other_url); + } + + // Assume the user wants to use it and select it for him. + site_list.registerbyobject (listobj); + + // Update the list box. + PopulateListBox (); + } + break; + } + default: + // Wasn't recognized or handled. + return false; + } + + // Was handled since we never got to default above. + return true; } Index: site.h =================================================================== RCS file: /cvs/src/src/winsup/cinstall/site.h,v retrieving revision 2.2 diff -p -u -r2.2 site.h --- site.h 2001/12/23 12:13:29 2.2 +++ site.h 2002/01/01 14:02:37 @@ -36,8 +36,14 @@ public: bool Create (); virtual void OnInit (); + virtual void OnActivate (); virtual long OnNext (); virtual long OnBack (); + + virtual bool OnMessageCmd (int id, HWND hwndctl, UINT code); + + void PopulateListBox(); + void CheckControlsAndDisableAccordingly () const; }; void do_download_site_info (HINSTANCE h, HWND owner); Index: source.h =================================================================== RCS file: /cvs/src/src/winsup/cinstall/source.h,v retrieving revision 2.1 diff -p -u -r2.1 source.h --- source.h 2001/12/23 12:13:29 2.1 +++ source.h 2002/01/01 14:02:37 @@ -1,43 +1,43 @@ -#ifndef CINSTALL_SOURCE_H -#define CINSTALL_SOURCE_H - -/* - * Copyright (c) 2001, Gary R. Van Sickle. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * A copy of the GNU General Public License can be found at - * http://www.gnu.org/ - * - * Written by Gary R. Van Sickle - * - */ - -// This is the header for the SourcePage class, which lets the user -// select Download+Install, Download, or Install From Local Directory. - - -#include "proppage.h" - -class SourcePage:public PropertyPage -{ -public: - SourcePage () - { - }; - virtual ~ SourcePage () - { - }; - - bool Create (); - - virtual void OnActivate (); - virtual void OnDeactivate (); - virtual long OnNext (); - virtual long OnBack (); -}; - -#endif +#ifndef CINSTALL_SOURCE_H +#define CINSTALL_SOURCE_H + +/* + * Copyright (c) 2001, Gary R. Van Sickle. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * A copy of the GNU General Public License can be found at + * http://www.gnu.org/ + * + * Written by Gary R. Van Sickle + * + */ + +// This is the header for the SourcePage class, which lets the user +// select Download+Install, Download, or Install From Local Directory. + + +#include "proppage.h" + +class SourcePage:public PropertyPage +{ +public: + SourcePage () + { + }; + virtual ~ SourcePage () + { + }; + + bool Create (); + + virtual void OnActivate (); + virtual void OnDeactivate (); + virtual long OnNext (); + virtual long OnBack (); +}; + +#endif Index: splash.cc =================================================================== RCS file: /cvs/src/src/winsup/cinstall/splash.cc,v retrieving revision 2.7 diff -p -u -r2.7 splash.cc --- splash.cc 2001/12/23 12:13:29 2.7 +++ splash.cc 2002/01/01 14:02:37 @@ -36,4 +36,7 @@ SplashPage::OnInit () ver.Format (IDS_VERSION_INFO, version[0] ? version : "[unknown]"); SetWindowText (GetDlgItem (IDC_VERSION), ver.c_str ()); + + // Set the font for the IDC_STATIC_WELCOME_TITLE + SetDlgItemFont(IDC_STATIC_WELCOME_TITLE, "Ariel", 12, FW_BOLD); } Index: splash.h =================================================================== RCS file: /cvs/src/src/winsup/cinstall/splash.h,v retrieving revision 2.1 diff -p -u -r2.1 splash.h --- splash.h 2001/12/23 12:13:29 2.1 +++ splash.h 2002/01/01 14:02:37 @@ -1,38 +1,38 @@ -#ifndef CINSTALL_SPLASH_H -#define CINSTALL_SPLASH_H - -/* - * Copyright (c) 2001, Gary R. Van Sickle. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * A copy of the GNU General Public License can be found at - * http://www.gnu.org/ - * - * Written by Gary R. Van Sickle - * - */ - -// This is the header for the SplashPage class. Since the splash page -// has little to do, there's not much here. - -#include "proppage.h" - -class SplashPage:public PropertyPage -{ -public: - SplashPage () - { - }; - virtual ~ SplashPage () - { - }; - - bool Create (); - virtual void OnInit (); -}; - -#endif // CINSTALL_SPLASH_H +#ifndef CINSTALL_SPLASH_H +#define CINSTALL_SPLASH_H + +/* + * Copyright (c) 2001, Gary R. Van Sickle. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * A copy of the GNU General Public License can be found at + * http://www.gnu.org/ + * + * Written by Gary R. Van Sickle + * + */ + +// This is the header for the SplashPage class. Since the splash page +// has little to do, there's not much here. + +#include "proppage.h" + +class SplashPage:public PropertyPage +{ +public: + SplashPage () + { + }; + virtual ~ SplashPage () + { + }; + + bool Create (); + virtual void OnInit (); +}; + +#endif // CINSTALL_SPLASH_H Index: threebar.cc =================================================================== RCS file: /cvs/src/src/winsup/cinstall/threebar.cc,v retrieving revision 2.1 diff -p -u -r2.1 threebar.cc --- threebar.cc 2001/12/23 12:13:29 2.1 +++ threebar.cc 2002/01/01 14:02:38 @@ -1,207 +1,207 @@ -/* - * Copyright (c) 2001, Gary R. Van Sickle. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * A copy of the GNU General Public License can be found at - * http://www.gnu.org/ - * - * Written by Gary R. Van Sickle - * - */ - -// This is the implementation of the ThreeBarProgressPage class. It is a fairly generic -// progress indicator property page with three progress bars. - -#include "win32.h" -#include "commctrl.h" -#include "resource.h" - -#include "dialog.h" -#include "site.h" - -#include "propsheet.h" -#include "threebar.h" - -bool -ThreeBarProgressPage::Create () -{ - return PropertyPage::Create (IDD_INSTATUS); -} - -void -ThreeBarProgressPage::OnInit () -{ - // Get HWNDs to the dialog controls - ins_action = GetDlgItem (IDC_INS_ACTION); - ins_pkgname = GetDlgItem (IDC_INS_PKG); - ins_filename = GetDlgItem (IDC_INS_FILE); - // Bars - ins_pprogress = GetDlgItem (IDC_INS_PPROGRESS); - ins_iprogress = GetDlgItem (IDC_INS_IPROGRESS); - ins_diskfull = GetDlgItem (IDC_INS_DISKFULL); - // Bar labels - ins_bl_package = GetDlgItem (IDC_INS_BL_PACKAGE); - ins_bl_total = GetDlgItem (IDC_INS_BL_TOTAL); - ins_bl_disk = GetDlgItem (IDC_INS_BL_DISK); -} - -void -ThreeBarProgressPage::SetText1 (const TCHAR * t) -{ - SetWindowText (ins_action, t); -} - -void -ThreeBarProgressPage::SetText2 (const TCHAR * t) -{ - SetWindowText (ins_pkgname, t); -} - -void -ThreeBarProgressPage::SetText3 (const TCHAR * t) -{ - SetWindowText (ins_filename, t); -} - -void -ThreeBarProgressPage::SetBar1 (long progress, long max) -{ - int percent = (int) (100.0 * ((double) progress) / (double) max); - SendMessage (ins_pprogress, PBM_SETPOS, (WPARAM) percent, 0); -} - -void -ThreeBarProgressPage::SetBar2 (long progress, long max) -{ - int percent = (int) (100.0 * ((double) progress) / (double) max); - SendMessage (ins_iprogress, PBM_SETPOS, (WPARAM) percent, 0); -} - -void -ThreeBarProgressPage::SetBar3 (long progress, long max) -{ - int percent = (int) (100.0 * ((double) progress) / (double) max); - SendMessage (ins_diskfull, PBM_SETPOS, (WPARAM) percent, 0); -} - -void -ThreeBarProgressPage::EnableSingleBar (bool enable) -{ - // Switch to/from single bar mode - ShowWindow (ins_bl_total, enable ? SW_HIDE : SW_SHOW); - ShowWindow (ins_bl_disk, enable ? SW_HIDE : SW_SHOW); - ShowWindow (ins_iprogress, enable ? SW_HIDE : SW_SHOW); - ShowWindow (ins_diskfull, enable ? SW_HIDE : SW_SHOW); -} - -void -ThreeBarProgressPage::OnActivate () -{ - // Disable back and next buttons - GetOwner ()->SetButtons (0); - - // Set all bars to 0 - SetBar1 (0); - SetBar2 (0); - SetBar3 (0); - - switch (task) - { - case WM_APP_START_SITE_INFO_DOWNLOAD: - case WM_APP_START_SETUP_INI_DOWNLOAD: - // For these tasks, show only a single progress bar. - EnableSingleBar (); - break; - default: - // Show the normal 3-bar view by default - EnableSingleBar (false); - break; - } - - Window::PostMessage (task); -} - -bool -ThreeBarProgressPage::OnMessageApp (UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - switch (uMsg) - { - case WM_APP_START_DOWNLOAD: - { - // Start the package download thread. - do_download (GetInstance (), GetHWND ()); - break; - } - case WM_APP_DOWNLOAD_THREAD_COMPLETE: - { - if (lParam == IDD_S_INSTALL) - { - // Download is complete and we want to go on to the install. - Window::PostMessage (WM_APP_START_INSTALL); - } - else if (lParam != 0) - { - // Download failed for some reason, go back to site selection page - GetOwner ()->SetActivePageByID (lParam); - } - else - { - // Was a download-only, and is complete or failed. - GetOwner ()->PressButton (PSBTN_CANCEL); - } - break; - } - case WM_APP_START_INSTALL: - { - // Start the install thread. - do_install (GetInstance (), GetHWND ()); - break; - } - case WM_APP_INSTALL_THREAD_COMPLETE: - { - // Re-enable and "Push" the Next button - GetOwner ()->SetButtons (PSWIZB_NEXT); - GetOwner ()->PressButton (PSBTN_NEXT); - break; - } - case WM_APP_START_SITE_INFO_DOWNLOAD: - { - do_download_site_info (GetInstance (), GetHWND ()); - break; - } - case WM_APP_SITE_INFO_DOWNLOAD_COMPLETE: - { - GetOwner ()->SetActivePageByID (lParam); - break; - } - case WM_APP_START_SETUP_INI_DOWNLOAD: - { - do_ini (GetInstance (), GetHWND ()); - break; - } - case WM_APP_SETUP_INI_DOWNLOAD_COMPLETE: - { - if (lParam == IDD_S_FROM_CWD) - { - // There isn't actually a dialog template named this - do_fromcwd (GetInstance (), GetHWND ()); - } - else - { - GetOwner ()->SetActivePageByID (lParam); - } - break; - } - default: - { - // Not handled - return false; - } - } - - return true; -} +/* + * Copyright (c) 2001, Gary R. Van Sickle. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * A copy of the GNU General Public License can be found at + * http://www.gnu.org/ + * + * Written by Gary R. Van Sickle + * + */ + +// This is the implementation of the ThreeBarProgressPage class. It is a fairly generic +// progress indicator property page with three progress bars. + +#include "win32.h" +#include "commctrl.h" +#include "resource.h" + +#include "dialog.h" +#include "site.h" + +#include "propsheet.h" +#include "threebar.h" + +bool +ThreeBarProgressPage::Create () +{ + return PropertyPage::Create (IDD_INSTATUS); +} + +void +ThreeBarProgressPage::OnInit () +{ + // Get HWNDs to the dialog controls + ins_action = GetDlgItem (IDC_INS_ACTION); + ins_pkgname = GetDlgItem (IDC_INS_PKG); + ins_filename = GetDlgItem (IDC_INS_FILE); + // Bars + ins_pprogress = GetDlgItem (IDC_INS_PPROGRESS); + ins_iprogress = GetDlgItem (IDC_INS_IPROGRESS); + ins_diskfull = GetDlgItem (IDC_INS_DISKFULL); + // Bar labels + ins_bl_package = GetDlgItem (IDC_INS_BL_PACKAGE); + ins_bl_total = GetDlgItem (IDC_INS_BL_TOTAL); + ins_bl_disk = GetDlgItem (IDC_INS_BL_DISK); +} + +void +ThreeBarProgressPage::SetText1 (const TCHAR * t) +{ + SetWindowText (ins_action, t); +} + +void +ThreeBarProgressPage::SetText2 (const TCHAR * t) +{ + SetWindowText (ins_pkgname, t); +} + +void +ThreeBarProgressPage::SetText3 (const TCHAR * t) +{ + SetWindowText (ins_filename, t); +} + +void +ThreeBarProgressPage::SetBar1 (long progress, long max) +{ + int percent = (int) (100.0 * ((double) progress) / (double) max); + SendMessage (ins_pprogress, PBM_SETPOS, (WPARAM) percent, 0); +} + +void +ThreeBarProgressPage::SetBar2 (long progress, long max) +{ + int percent = (int) (100.0 * ((double) progress) / (double) max); + SendMessage (ins_iprogress, PBM_SETPOS, (WPARAM) percent, 0); +} + +void +ThreeBarProgressPage::SetBar3 (long progress, long max) +{ + int percent = (int) (100.0 * ((double) progress) / (double) max); + SendMessage (ins_diskfull, PBM_SETPOS, (WPARAM) percent, 0); +} + +void +ThreeBarProgressPage::EnableSingleBar (bool enable) +{ + // Switch to/from single bar mode + ShowWindow (ins_bl_total, enable ? SW_HIDE : SW_SHOW); + ShowWindow (ins_bl_disk, enable ? SW_HIDE : SW_SHOW); + ShowWindow (ins_iprogress, enable ? SW_HIDE : SW_SHOW); + ShowWindow (ins_diskfull, enable ? SW_HIDE : SW_SHOW); +} + +void +ThreeBarProgressPage::OnActivate () +{ + // Disable back and next buttons + GetOwner ()->SetButtons (0); + + // Set all bars to 0 + SetBar1 (0); + SetBar2 (0); + SetBar3 (0); + + switch (task) + { + case WM_APP_START_SITE_INFO_DOWNLOAD: + case WM_APP_START_SETUP_INI_DOWNLOAD: + // For these tasks, show only a single progress bar. + EnableSingleBar (); + break; + default: + // Show the normal 3-bar view by default + EnableSingleBar (false); + break; + } + + Window::PostMessage (task); +} + +bool +ThreeBarProgressPage::OnMessageApp (UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + switch (uMsg) + { + case WM_APP_START_DOWNLOAD: + { + // Start the package download thread. + do_download (GetInstance (), GetHWND ()); + break; + } + case WM_APP_DOWNLOAD_THREAD_COMPLETE: + { + if (lParam == IDD_S_INSTALL) + { + // Download is complete and we want to go on to the install. + Window::PostMessage (WM_APP_START_INSTALL); + } + else if (lParam != 0) + { + // Download failed for some reason, go back to site selection page + GetOwner ()->SetActivePageByID (lParam); + } + else + { + // Was a download-only, and is complete or failed. + GetOwner ()->PressButton (PSBTN_CANCEL); + } + break; + } + case WM_APP_START_INSTALL: + { + // Start the install thread. + do_install (GetInstance (), GetHWND ()); + break; + } + case WM_APP_INSTALL_THREAD_COMPLETE: + { + // Re-enable and "Push" the Next button + GetOwner ()->SetButtons (PSWIZB_NEXT); + GetOwner ()->PressButton (PSBTN_NEXT); + break; + } + case WM_APP_START_SITE_INFO_DOWNLOAD: + { + do_download_site_info (GetInstance (), GetHWND ()); + break; + } + case WM_APP_SITE_INFO_DOWNLOAD_COMPLETE: + { + GetOwner ()->SetActivePageByID (lParam); + break; + } + case WM_APP_START_SETUP_INI_DOWNLOAD: + { + do_ini (GetInstance (), GetHWND ()); + break; + } + case WM_APP_SETUP_INI_DOWNLOAD_COMPLETE: + { + if (lParam == IDD_S_FROM_CWD) + { + // There isn't actually a dialog template named this + do_fromcwd (GetInstance (), GetHWND ()); + } + else + { + GetOwner ()->SetActivePageByID (lParam); + } + break; + } + default: + { + // Not handled + return false; + } + } + + return true; +} Index: threebar.h =================================================================== RCS file: /cvs/src/src/winsup/cinstall/threebar.h,v retrieving revision 2.1 diff -p -u -r2.1 threebar.h --- threebar.h 2001/12/23 12:13:29 2.1 +++ threebar.h 2002/01/01 14:02:38 @@ -1,81 +1,81 @@ -#ifndef CINSTALL_THREEBAR_H -#define CINSTALL_THREEBAR_H - -/* - * Copyright (c) 2001, Gary R. Van Sickle. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * A copy of the GNU General Public License can be found at - * http://www.gnu.org/ - * - * Written by Gary R. Van Sickle - * - */ - -// This is the header for the ThreeBarProgressPage class. It is a fairly generic -// progress indicator property page with three progress bars. - - -#include "win32.h" -#include "proppage.h" - -#define WM_APP_START_DOWNLOAD WM_APP+0 -#define WM_APP_DOWNLOAD_THREAD_COMPLETE WM_APP+1 -#define WM_APP_START_INSTALL WM_APP+2 -#define WM_APP_INSTALL_THREAD_COMPLETE WM_APP+3 -#define WM_APP_START_SITE_INFO_DOWNLOAD WM_APP+4 -#define WM_APP_SITE_INFO_DOWNLOAD_COMPLETE WM_APP+5 -#define WM_APP_START_SETUP_INI_DOWNLOAD WM_APP+6 -#define WM_APP_SETUP_INI_DOWNLOAD_COMPLETE WM_APP+7 - -class ThreeBarProgressPage:public PropertyPage -{ - HWND ins_dialog; - HWND ins_action; - HWND ins_pkgname; - HWND ins_filename; - HWND ins_pprogress; - HWND ins_iprogress; - HWND ins_diskfull; - HWND ins_bl_package; - HWND ins_bl_total; - HWND ins_bl_disk; - - int task; - - void EnableSingleBar (bool enable = true); - -public: - ThreeBarProgressPage () - { - }; - virtual ~ ThreeBarProgressPage () - { - }; - - bool Create (); - - virtual void OnInit (); - virtual void OnActivate (); - virtual bool OnMessageApp (UINT uMsg, WPARAM wParam, LPARAM lParam); - - void SetText1 (const TCHAR * t); - void SetText2 (const TCHAR * t); - void SetText3 (const TCHAR * t); - - void SetBar1 (long progress, long max = 100); - void SetBar2 (long progress, long max = 100); - void SetBar3 (long progress, long max = 100); - - void SetActivateTask (int t) - { - task = t; - }; -}; - - -#endif // CINSTALL_THREEBAR_H +#ifndef CINSTALL_THREEBAR_H +#define CINSTALL_THREEBAR_H + +/* + * Copyright (c) 2001, Gary R. Van Sickle. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * A copy of the GNU General Public License can be found at + * http://www.gnu.org/ + * + * Written by Gary R. Van Sickle + * + */ + +// This is the header for the ThreeBarProgressPage class. It is a fairly generic +// progress indicator property page with three progress bars. + + +#include "win32.h" +#include "proppage.h" + +#define WM_APP_START_DOWNLOAD WM_APP+0 +#define WM_APP_DOWNLOAD_THREAD_COMPLETE WM_APP+1 +#define WM_APP_START_INSTALL WM_APP+2 +#define WM_APP_INSTALL_THREAD_COMPLETE WM_APP+3 +#define WM_APP_START_SITE_INFO_DOWNLOAD WM_APP+4 +#define WM_APP_SITE_INFO_DOWNLOAD_COMPLETE WM_APP+5 +#define WM_APP_START_SETUP_INI_DOWNLOAD WM_APP+6 +#define WM_APP_SETUP_INI_DOWNLOAD_COMPLETE WM_APP+7 + +class ThreeBarProgressPage:public PropertyPage +{ + HWND ins_dialog; + HWND ins_action; + HWND ins_pkgname; + HWND ins_filename; + HWND ins_pprogress; + HWND ins_iprogress; + HWND ins_diskfull; + HWND ins_bl_package; + HWND ins_bl_total; + HWND ins_bl_disk; + + int task; + + void EnableSingleBar (bool enable = true); + +public: + ThreeBarProgressPage () + { + }; + virtual ~ ThreeBarProgressPage () + { + }; + + bool Create (); + + virtual void OnInit (); + virtual void OnActivate (); + virtual bool OnMessageApp (UINT uMsg, WPARAM wParam, LPARAM lParam); + + void SetText1 (const TCHAR * t); + void SetText2 (const TCHAR * t); + void SetText3 (const TCHAR * t); + + void SetBar1 (long progress, long max = 100); + void SetBar2 (long progress, long max = 100); + void SetBar3 (long progress, long max = 100); + + void SetActivateTask (int t) + { + task = t; + }; +}; + + +#endif // CINSTALL_THREEBAR_H Index: window.cc =================================================================== RCS file: /cvs/src/src/winsup/cinstall/window.cc,v retrieving revision 2.2 diff -p -u -r2.2 window.cc --- window.cc 2002/01/01 12:32:37 2.2 +++ window.cc 2002/01/01 14:02:39 @@ -38,10 +38,19 @@ Window::Window () { WindowHandle = NULL; Parent = NULL; + FontCounter = 0; } Window::~Window () { + // Delete any fonts we created. + int i; + for (i = 0; i < FontCounter; i++) + { + DeleteObject (Fonts[i]); + } + FontCounter = 0; + // FIXME: Maybe do some reference counting and do this Unregister // when there are no more of us left. Not real critical unless // we're in a DLL which we're not right now. @@ -259,4 +268,50 @@ void Window::PostMessage (UINT uMsg, WPARAM wParam, LPARAM lParam) { ::PostMessage (GetHWND (), uMsg, wParam, lParam); +} + +UINT Window::IsButtonChecked (int nIDButton) const +{ + return::IsDlgButtonChecked (GetHWND (), nIDButton); +} + +bool + Window::SetDlgItemFont (int id, const TCHAR * fontname, int Pointsize, + int Weight, bool Italic, bool Underline, + bool Strikeout) +{ + HWND ctrl; + ctrl = GetDlgItem (id); + if (ctrl == NULL) + { + // Couldn't get that ID + return false; + } + + // We need the DC for the point size calculation. + HDC hdc = GetDC (ctrl); + + // Create the font. We have to keep it around until the dialog item + // goes away - basically until we're destroyed. + HFONT hfnt; + hfnt = + CreateFont (-MulDiv (Pointsize, GetDeviceCaps (hdc, LOGPIXELSY), 72), 0, + 0, 0, Weight, Italic ? TRUE : FALSE, + Underline ? TRUE : FALSE, Strikeout ? TRUE : FALSE, + ANSI_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, + PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, fontname); + if (hfnt == NULL) + { + // Font creation failed + return false; + } + + // Set the new fint, and redraw any text which was already in the item. + SendMessage (ctrl, WM_SETFONT, (WPARAM) hfnt, TRUE); + + // Save it for later. + Fonts[FontCounter] = hfnt; + FontCounter++; + + return true; } Index: window.h =================================================================== RCS file: /cvs/src/src/winsup/cinstall/window.h,v retrieving revision 2.2 diff -p -u -r2.2 window.h --- window.h 2002/01/01 12:32:37 2.2 +++ window.h 2002/01/01 14:02:39 @@ -39,6 +39,11 @@ class Window Window *Parent; + // FIXME: replace with when we get a chance. + static const int MAXFONTS = 5; + HFONT Fonts[MAXFONTS]; + int FontCounter; + protected: void SetHWND (HWND h) { @@ -79,11 +84,21 @@ public: { return::GetDlgItem (GetHWND (), id); }; + bool SetDlgItemFont(int id, const TCHAR *fontname, int Pointsize, + int Weight = FW_NORMAL, bool Italic = false, bool Underline = false, bool Strikeout = false); + + UINT IsButtonChecked (int nIDButton) const; void PostMessage (UINT uMsg, WPARAM wParam = 0, LPARAM lParam = 0); virtual bool OnMessageApp (UINT uMsg, WPARAM wParam, LPARAM lParam) { + return false; + }; + + virtual bool OnMessageCmd (int id, HWND hwndctl, UINT code) + { + // Not processed. return false; };