]> cygwin.com Git - cygwin-apps/setup.git/commitdiff
2001-01-04 Gary R. Van Sickle <g.r.vansickle@worldnet.att.net>
authorRobert Collins <rbtcollins@hotmail.com>
Thu, 3 Jan 2002 11:27:11 +0000 (11:27 +0000)
committerRobert Collins <rbtcollins@hotmail.com>
Thu, 3 Jan 2002 11:27:11 +0000 (11:27 +0000)
        * cistring.cc: Run d2u.
        * cistring.h: Run d2u.

        * desktop.cc (etc_profile): Remove "test -f ./.bashrc && . ./.bashrc"
        from the generated /etc/profile.  Bash will source this file
        automatically, and having this here merely results in .bashrc being
        executed twice. Run d2u.
        * desktop.h: Run d2u.

        * propsheet.cc: Run d2u.
        (PropSheetProc): New function.  Add minimize box here instead of in
        PropertyPage::DialogProc.
        (PropSheet::Create): Change to use creation callback PropSheetProc.
        (DLGTEMPLATEEX): Add 'hidden' Windows struct definition.

        * propsheet.h: Run indent, d2u.
        * proppage.h: Run indent, d2u.

        * proppage.cc: Run d2u.
        (PropertyPage::DialogProc): Remove minimize-box-adding
        functionality.  Remove commented-out "PropSheet_SetWizButtons" calls.
        Add support for calling virtual OnMessageCmd.  Add setting of fonts in
        WM_INITDIALOG handler.
        (resource.h): New include for resource IDs.

        * res.rc: Resize and rearrange property page dialog templates
        to bring them in line with "Microsoft's Backward Compatible Wizard 97"
        specification.  Run d2u.
        (IDD_SITE): Add an edit control and an "Add" button in order to
        combine the IDD_SITE and IDD_OTHER_URL functionality onto one page.
        (IDD_OTHER_URL): Remove dialog template.
        (IDD_DLSTATUS): Remove dialog template.

        * site.cc: Run d2u.
        (SitePage::OnBack): Remove NEXT() macro invocation.
        (SitePage::OnActivate): New member function.
        (load_dialog): Remove.  Functionality subsumed into
        SitePage::OnActivate.
        (save_dialog): Change to support both list and user URLs.  Remove
        OTHER_IDX and mirror_idx logic.
        (SitePage::PopulateListBox): New member function.
        (SitePage::CheckControlsAndDisableAccordingly): New member function.
        (SitePage::OnMessageCmd): New override.
        (check_if_enable_next): Remove.
        (dialog_cmd): Remove.
        (do_download_site_info_thread): Remove calls to NEXT() macro.
        (SitePage::Create): Call the single-param PropertyPage::Create
        overload.
        (other_url): New static taken from other.cc.
        (SitePage::OnNext): Remove mirror_idx logic.
        (SitePage::OnInit): Remove "Other URL" entry from list box.  Remove
        list box populating code, now handled in SitePage::PopulateListBox.
        (mirror_idx, NO_IDX, OTHER_IDX): Remove.
        (save_site_url): Fix potential buffer overflow problem.  Switched to
        TCHAR in grossly premature preparation for multilingual support.
        * site.h: Run d2u.
        (SitePage::OnActivate): New member function.
        (SitePage::CheckControlsAndDisableAccordingly) New member.
        (SitePage::OnMessageCmd): New override.
        (do_download_site_info_thread): Add MessageBox call on failure to
        download site list.

        * splash.cc: Run d2u.
        (SplashPage::OnInit): Set the font for the title.
        * splash.h: Run d2u.

        * threebar.cc: Run d2u.
        * threebar.h: Run d2u.

        * window.h: Run d2u.
        (Window::IsButtonChecked): New member function declaration.
        (Window::OnMessageCmd): New member function.
        (Window::SetDlgItemFont): New member function declaration.
        (Window::MAXFONTS, Window::Fonts, Window::FontCounter): New data
        members.
        * window.cc: Run d2u.
        (Window::IsButtonChecked): New member function definition.
        (Window::SetDlgItemFont): New member function definition.
        (Window::Window): Add initialization for FontCounter.
        (Window::~Window): Delete any fonts we created.

        * geturl.cc: Run d2u.
        (progress): Remove the "3" field width from the "%3d"
        percent-complete format indicator.  Causes line to not start at
        beginning of text box, and does little to help with "jumping", since
        the "bytes downloaded so far" field is variable-width anyway.  Change
        kb/s format field to "%03.1" to 0-pad the kb/s number in the event of
        painfully slow connections, or temporary slowdowns in faster
        connections should such more-instantaneous functionality become
        available.

        * net.h: Run d2u.
        (NetPage::OnMessageCmd): New member function declaration.
        (NetPage::CheckIfEnableNext): New member function declaration.
        * net.cc: Run d2u.
        (NetPage::OnMessageCmd): New member function definition.
        (dialog_cmd): Remove, subsumed into NetPage::OnMessageCmd.
        (check_if_enable_next): Remove.
        (NetPage::CheckIfEnableNext): New member function, subsumes
        check_if_enable_next.
        (propsheet.h): Add include.
        (NetPage::Init): Add call to CheckIfEnableNext.
        (load_dialog): Remove call to check_if_enable_next.
        (NetPage::Create): Call single-template-ID-parameter overload of
        PropertyPage::Create instead of three-parameter one.

        * Makefile.in (OBJS): Remove other.o.
        * other.cc: Remove file.

26 files changed:
ChangeLog
cistring.cc
cistring.h
desktop.cc
desktop.h
geturl.cc
localdir.h
net.cc
net.h
other.cc [deleted file]
proppage.cc
proppage.h
propsheet.cc
propsheet.h
res.rc
resource.h
root.h
site.cc
site.h
source.h
splash.cc
splash.h
threebar.cc
threebar.h
window.cc
window.h

index bbd608b60f89c2eb176aa7579a7965c7ba4092c9..5945c9eda077ecd1d422a1d00bcf8b2e02eca0d1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,114 @@
+2001-01-04  Gary R. Van Sickle  <g.r.vansickle@worldnet.att.net>
+
+       * cistring.cc: Run d2u.
+       * cistring.h: Run d2u.
+
+       * desktop.cc (etc_profile): Remove "test -f ./.bashrc && . ./.bashrc"
+       from the generated /etc/profile.  Bash will source this file
+       automatically, and having this here merely results in .bashrc being
+       executed twice. Run d2u.
+       * desktop.h: Run d2u.
+
+       * propsheet.cc: Run d2u.
+       (PropSheetProc): New function.  Add minimize box here instead of in
+       PropertyPage::DialogProc.
+       (PropSheet::Create): Change to use creation callback PropSheetProc.
+       (DLGTEMPLATEEX): Add 'hidden' Windows struct definition.
+
+       * propsheet.h: Run indent, d2u.
+       * proppage.h: Run indent, d2u.
+
+       * proppage.cc: Run d2u.
+       (PropertyPage::DialogProc): Remove minimize-box-adding
+       functionality.  Remove commented-out "PropSheet_SetWizButtons" calls.
+       Add support for calling virtual OnMessageCmd.  Add setting of fonts in
+       WM_INITDIALOG handler.
+       (resource.h): New include for resource IDs.
+
+       * res.rc: Resize and rearrange property page dialog templates
+       to bring them in line with "Microsoft's Backward Compatible Wizard 97"
+       specification.  Run d2u.
+       (IDD_SITE): Add an edit control and an "Add" button in order to
+       combine the IDD_SITE and IDD_OTHER_URL functionality onto one page.
+       (IDD_OTHER_URL): Remove dialog template.
+       (IDD_DLSTATUS): Remove dialog template.
+
+       * site.cc: Run d2u.
+       (SitePage::OnBack): Remove NEXT() macro invocation.
+       (SitePage::OnActivate): New member function.
+       (load_dialog): Remove.  Functionality subsumed into
+       SitePage::OnActivate.
+       (save_dialog): Change to support both list and user URLs.  Remove
+       OTHER_IDX and mirror_idx logic.
+       (SitePage::PopulateListBox): New member function.
+       (SitePage::CheckControlsAndDisableAccordingly): New member function.
+       (SitePage::OnMessageCmd): New override.
+       (check_if_enable_next): Remove.
+       (dialog_cmd): Remove.
+       (do_download_site_info_thread): Remove calls to NEXT() macro.
+       (SitePage::Create): Call the single-param PropertyPage::Create
+       overload.
+       (other_url): New static taken from other.cc.
+       (SitePage::OnNext): Remove mirror_idx logic.
+       (SitePage::OnInit): Remove "Other URL" entry from list box.  Remove
+       list box populating code, now handled in SitePage::PopulateListBox.
+       (mirror_idx, NO_IDX, OTHER_IDX): Remove.
+       (save_site_url): Fix potential buffer overflow problem.  Switched to
+       TCHAR in grossly premature preparation for multilingual support.
+       * site.h: Run d2u.
+       (SitePage::OnActivate): New member function.
+       (SitePage::CheckControlsAndDisableAccordingly) New member.
+       (SitePage::OnMessageCmd): New override.
+       (do_download_site_info_thread): Add MessageBox call on failure to
+       download site list.
+
+       * splash.cc: Run d2u.
+       (SplashPage::OnInit): Set the font for the title.
+       * splash.h: Run d2u.
+
+       * threebar.cc: Run d2u.
+       * threebar.h: Run d2u.
+
+       * window.h: Run d2u.
+       (Window::IsButtonChecked): New member function declaration.
+       (Window::OnMessageCmd): New member function.
+       (Window::SetDlgItemFont): New member function declaration.
+       (Window::MAXFONTS, Window::Fonts, Window::FontCounter): New data
+       members.
+       * window.cc: Run d2u.
+       (Window::IsButtonChecked): New member function definition.
+       (Window::SetDlgItemFont): New member function definition.
+       (Window::Window): Add initialization for FontCounter.
+       (Window::~Window): Delete any fonts we created.
+
+       * geturl.cc: Run d2u.
+       (progress): Remove the "3" field width from the "%3d"
+       percent-complete format indicator.  Causes line to not start at
+       beginning of text box, and does little to help with "jumping", since
+       the "bytes downloaded so far" field is variable-width anyway.  Change
+       kb/s format field to "%03.1" to 0-pad the kb/s number in the event of
+       painfully slow connections, or temporary slowdowns in faster
+       connections should such more-instantaneous functionality become
+       available.
+
+       * net.h: Run d2u.
+       (NetPage::OnMessageCmd): New member function declaration.
+       (NetPage::CheckIfEnableNext): New member function declaration.
+       * net.cc: Run d2u.
+       (NetPage::OnMessageCmd): New member function definition.
+       (dialog_cmd): Remove, subsumed into NetPage::OnMessageCmd.
+       (check_if_enable_next): Remove.
+       (NetPage::CheckIfEnableNext): New member function, subsumes
+       check_if_enable_next.
+       (propsheet.h): Add include.
+       (NetPage::Init): Add call to CheckIfEnableNext.
+       (load_dialog): Remove call to check_if_enable_next.
+       (NetPage::Create): Call single-template-ID-parameter overload of
+       PropertyPage::Create instead of three-parameter one.
+
+       * Makefile.in (OBJS): Remove other.o.
+       * other.cc: Remove file.
+
 2002-01-01  Robert Collins  <rbtcollins@hotmail.com>
 
        * README: Update TODO's.
index de824782d9d2949113bc096bdf7a18f3ffb41b62..0ce785831916b30eae2c7a7ff5b354cb8fb28fb0 100644 (file)
@@ -1,52 +1,52 @@
-/*\r
- * Copyright (c) 2001, Gary R. Van Sickle.\r
- *\r
- *     This program is free software; you can redistribute it and/or modify\r
- *     it under the terms of the GNU General Public License as published by\r
- *     the Free Software Foundation; either version 2 of the License, or\r
- *     (at your option) any later version.\r
- *\r
- *     A copy of the GNU General Public License can be found at\r
- *     http://www.gnu.org/\r
- *\r
- * Written by Gary R. Van Sickle <g.r.vansickle@worldnet.att.net>\r
- *\r
- */\r
-\r
-// Yep, another string class\r
-\r
-#include "cistring.h"\r
-#include <stdlib.h>\r
-\r
-DWORD\r
-cistring::Format (UINT i, ...)\r
-{\r
-  TCHAR FormatStringBuffer[256];\r
-  TCHAR *Buff;\r
-  va_list arglist;\r
-  DWORD numchars;\r
-\r
-  // Get the string from the stringtable (FormatMessage() can only work with\r
-  // literal strings or *message*table entries, which are different for some\r
-  // inexplicable reason).\r
-  LoadString (GetModuleHandle (NULL), i, FormatStringBuffer, 256);\r
-\r
-  va_start (arglist, i);\r
-  numchars =::\r
-    FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER |\r
-                  FORMAT_MESSAGE_FROM_STRING, FormatStringBuffer, i, 0,\r
-                  (LPTSTR) & Buff, 0, &arglist);\r
-  va_end (arglist);\r
-\r
-  if (numchars == 0)\r
-    {\r
-      // Something went wrong.\r
-      return 0;\r
-    }\r
-\r
-  buffer = new TCHAR[(numchars + 1) * sizeof (TCHAR)];\r
-  memcpy (buffer, Buff, (numchars + 1) * sizeof (TCHAR));\r
-  LocalFree (Buff);\r
-\r
-  return numchars;\r
-}\r
+/*
+ * 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 <g.r.vansickle@worldnet.att.net>
+ *
+ */
+
+// Yep, another string class
+
+#include "cistring.h"
+#include <stdlib.h>
+
+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 2873e28dd4b369376b917f8343c59b443a881602..72ca49b57eb4ca806e3a6e5c2daec6a9fa36a69f 100644 (file)
@@ -1,41 +1,41 @@
-/*\r
- * Copyright (c) 2001, Gary R. Van Sickle.\r
- *\r
- *     This program is free software; you can redistribute it and/or modify\r
- *     it under the terms of the GNU General Public License as published by\r
- *     the Free Software Foundation; either version 2 of the License, or\r
- *     (at your option) any later version.\r
- *\r
- *     A copy of the GNU General Public License can be found at\r
- *     http://www.gnu.org/\r
- *\r
- * Written by Gary R. Van Sickle <g.r.vansickle@worldnet.att.net>\r
- *\r
- */\r
-\r
-// Yep, another string class\r
-\r
-#include <windows.h>\r
-\r
-class cistring\r
-{\r
-  TCHAR *buffer;\r
-public:\r
-    cistring ()\r
-  {\r
-    buffer = NULL;\r
-  };\r
-  cistring (const TCHAR * s);\r
-  ~cistring ()\r
-  {\r
-    if (buffer != NULL)\r
-      delete[]buffer;\r
-  };\r
-\r
-  const TCHAR *c_str ()\r
-  {\r
-    return buffer;\r
-  };\r
-\r
-  DWORD Format (UINT i, ...);\r
-};\r
+/*
+ * 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 <g.r.vansickle@worldnet.att.net>
+ *
+ */
+
+// Yep, another string class
+
+#include <windows.h>
+
+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 37d95a3b3019188e951cb7980274881e62515121..89051267ca6b5a01e0f81e099f90b68c5d4a52e4 100644 (file)
@@ -88,8 +88,6 @@ static const char *etc_profile[] = {
   "$ '",
   "",
   "cd \"$HOME\"",
-  "",
-  "test -f ./.bashrc && . ./.bashrc",
   0
 };
 
index 8c14a1d6b5387a8562cd7d5b4e745f1e89baf0b0..b6dda19c42361c80290dd7ebb5a630d4976f806a 100644 (file)
--- a/desktop.h
+++ b/desktop.h
@@ -1,41 +1,41 @@
-#ifndef CINSTALL_DESKTOP_H\r
-#define CINSTALL_DESKTOP_H\r
-\r
-/*\r
- * Copyright (c) 2001, Gary R. Van Sickle.\r
- *\r
- *     This program is free software; you can redistribute it and/or modify\r
- *     it under the terms of the GNU General Public License as published by\r
- *     the Free Software Foundation; either version 2 of the License, or\r
- *     (at your option) any later version.\r
- *\r
- *     A copy of the GNU General Public License can be found at\r
- *     http://www.gnu.org/\r
- *\r
- * Written by Gary R. Van Sickle <g.r.vansickle@worldnet.att.net>\r
- *\r
- */\r
-\r
-// This is the header for the DesktopSetupPage class.  Allows selection\r
-// of "create desktop icon" and "add to start menu".\r
-\r
-#include "proppage.h"\r
-\r
-class DesktopSetupPage:public PropertyPage\r
-{\r
-public:\r
-  DesktopSetupPage ()\r
-  {\r
-  };\r
-  virtual ~ DesktopSetupPage ()\r
-  {\r
-  };\r
-\r
-  bool Create ();\r
-\r
-  virtual void OnInit ();\r
-  virtual bool OnFinish ();\r
-  virtual long OnBack ();\r
-};\r
-\r
-#endif // CINSTALL_DESKTOP_H\r
+#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 <g.r.vansickle@worldnet.att.net>
+ *
+ */
+
+// 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 4fd44c2555edc8e6f76a9732fc1b398194eae367..d6ef257e8c2720981845ae096f5d6db44ba6908f 100644 (file)
--- a/geturl.cc
+++ b/geturl.cc
@@ -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 af0adccd0ea419d6a0cd3a8576caf6219206cdec..5795f20191834651d67115f69a144928efc4384f 100644 (file)
@@ -1,44 +1,44 @@
-#ifndef CINSTALL_LOCALDIR_H\r
-#define CINSTALL_LOCALDIR_H\r
-\r
-/*\r
- * Copyright (c) 2001, Gary R. Van Sickle.\r
- *\r
- *     This program is free software; you can redistribute it and/or modify\r
- *     it under the terms of the GNU General Public License as published by\r
- *     the Free Software Foundation; either version 2 of the License, or\r
- *     (at your option) any later version.\r
- *\r
- *     A copy of the GNU General Public License can be found at\r
- *     http://www.gnu.org/\r
- *\r
- * Written by Gary R. Van Sickle <g.r.vansickle@worldnet.att.net>\r
- *\r
- */\r
-\r
-// This is the header for the LocalDirPage class.  Allows the user to select\r
-// the local package directory (i.e. where downloaded packages are stored).\r
-\r
-\r
-#include "proppage.h"\r
-\r
-class LocalDirPage:public PropertyPage\r
-{\r
-public:\r
-  LocalDirPage ()\r
-  {\r
-  };\r
-  virtual ~ LocalDirPage ()\r
-  {\r
-  };\r
-\r
-  bool Create ();\r
-\r
-  virtual void OnActivate ();\r
-  virtual void OnInit ();\r
-  virtual long OnNext ();\r
-  virtual long OnBack ();\r
-};\r
-\r
-\r
-#endif\r
+#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 <g.r.vansickle@worldnet.att.net>
+ *
+ */
+
+// 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
diff --git a/net.cc b/net.cc
index a47d438dc407bcf73192f82c0d21ad73c7c60dd2..96aaa877134224e5f8a123c9e451fb46fb1dbb2d 100644 (file)
--- a/net.cc
+++ b/net.cc
@@ -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) ==
@@ -136,3 +127,26 @@ 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;
+}
diff --git a/net.h b/net.h
index c08c785596648a9cff43c785de3bae52e17f2f09..2928330abdb5421aa11f3d786364fb437058b12b 100644 (file)
--- a/net.h
+++ b/net.h
@@ -1,42 +1,46 @@
-#ifndef CINSTALL_NET_H\r
-#define CINSTALL_NET_H\r
-\r
-/*\r
- * Copyright (c) 2001, Gary R. Van Sickle.\r
- *\r
- *     This program is free software; you can redistribute it and/or modify\r
- *     it under the terms of the GNU General Public License as published by\r
- *     the Free Software Foundation; either version 2 of the License, or\r
- *     (at your option) any later version.\r
- *\r
- *     A copy of the GNU General Public License can be found at\r
- *     http://www.gnu.org/\r
- *\r
- * Written by Gary R. Van Sickle <g.r.vansickle@worldnet.att.net>\r
- *\r
- */\r
-\r
-// This is the header for the NetPage class.  It allows the user to select\r
-// a proxy etc.\r
-\r
-\r
-#include "proppage.h"\r
-\r
-class NetPage:public PropertyPage\r
-{\r
-public:\r
-  NetPage ()\r
-  {\r
-  };\r
-  virtual ~ NetPage ()\r
-  {\r
-  };\r
-\r
-  bool Create ();\r
-\r
-  virtual void OnInit ();\r
-  virtual long OnNext ();\r
-  virtual long OnBack ();\r
-};\r
-\r
-#endif // CINSTALL_NET_H\r
+#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 <g.r.vansickle@worldnet.att.net>
+ *
+ */
+
+// 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
diff --git a/other.cc b/other.cc
deleted file mode 100644 (file)
index 686a3df..0000000
--- a/other.cc
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (c) 2000, Red Hat, Inc.
- *
- *     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 DJ Delorie <dj@cygnus.com>
- *
- */
-
-/* This handles the "other URL" option from the mirror site
-   selection. */
-
-#if 0
-static const char *cvsid =
-  "\n%%% $Id$\n";
-#endif
-
-#include "win32.h"
-#include <shlobj.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "dialog.h"
-#include "resource.h"
-#include "state.h"
-#include "msg.h"
-#include "log.h"
-#include "site.h"
-
-static char * other_url = 0;
-  
-static void
-check_if_enable_next (HWND h)
-{
-  EnableWindow (GetDlgItem (h, IDOK), other_url ? 1 : 0);
-}
-
-static void
-load_dialog (HWND h)
-{
-  eset (h, IDC_OTHER_URL, other_url);
-  check_if_enable_next (h);
-}
-
-static void
-save_dialog (HWND h)
-{
-  other_url = eget (h, IDC_OTHER_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;
-  site_list.registerbyobject (listobj);
-}
-
-static BOOL
-dialog_cmd (HWND h, int id, HWND hwndctl, UINT code)
-{
-  switch (id)
-    {
-
-    case IDC_OTHER_URL:
-      other_url = eget (h, IDC_OTHER_URL, other_url);
-      check_if_enable_next (h);
-      break;
-
-    case IDOK:
-      save_dialog (h);
-      save_site_url ();
-      NEXT (IDD_S_LOAD_INI);
-      break;
-
-    case IDC_BACK:
-      save_dialog (h);
-      NEXT (IDD_SITE);
-      break;
-
-    case IDCANCEL:
-      NEXT (0);
-      break;
-    }
-  return 0;
-}
-
-static BOOL CALLBACK
-dialog_proc (HWND h, UINT message, WPARAM wParam, LPARAM lParam)
-{
-  switch (message)
-    {
-    case WM_INITDIALOG:
-      load_dialog (h);
-      return FALSE;
-    case WM_COMMAND:
-      return HANDLE_WM_COMMAND (h, wParam, lParam, dialog_cmd);
-    }
-  return FALSE;
-}
-
-void
-do_other (HINSTANCE h, HWND owner)
-{
-  int rv = 0;
-  rv = DialogBox (h, MAKEINTRESOURCE (IDD_OTHER_URL), owner, dialog_proc);
-  if (rv == -1)
-    fatal (owner, IDS_DIALOG_FAILED);
-
-  log (0, "site: %s", other_url);
-}
index db18137d694577cd77e147cd7e47e01c1bcb15a3..c9d98433f9d342da969f74137a5590ebd71d5071 100644 (file)
@@ -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, WPARAM wParam, LPARAM lParam)
     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, WPARAM wParam, LPARAM lParam)
                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, WPARAM wParam, LPARAM lParam)
              {
                // 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, WPARAM wParam, LPARAM lParam)
        }
       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 ce94ce11ef530d02ddcc21d460a16f2c8327cc56..29f3b15127d810268a93e78e70eb005110f976bc 100644 (file)
-#ifndef CINSTALL_PROPPAGE_H\r
-#define CINSTALL_PROPPAGE_H\r
-\r
-/*\r
- * Copyright (c) 2001, Gary R. Van Sickle.\r
- *\r
- *     This program is free software; you can redistribute it and/or modify\r
- *     it under the terms of the GNU General Public License as published by\r
- *     the Free Software Foundation; either version 2 of the License, or\r
- *     (at your option) any later version.\r
- *\r
- *     A copy of the GNU General Public License can be found at\r
- *     http://www.gnu.org/\r
- *\r
- * Written by Gary R. Van Sickle <g.r.vansickle@worldnet.att.net>\r
- *\r
- */\r
-\r
-// This is the header for the PropertyPage class.  It works closely with the\r
-// PropSheet class to implement a single page of the property sheet.\r
-\r
-\r
-#include <windows.h>\r
-#include <prsht.h>\r
-\r
-#include "window.h"\r
-\r
-class PropSheet;\r
-\r
-class PropertyPage:public Window\r
-{\r
-  static bool DoOnceForSheet;\r
-  PROPSHEETPAGE psp;\r
-  DLGPROC proc;\r
-    BOOL (*cmdproc) (HWND h, int id, HWND hwndctl, UINT code);\r
-\r
-  // The sheet that owns this page.\r
-  PropSheet *OurSheet;\r
-\r
-  // For setting the back/finish buttons properly.\r
-  bool IsFirst, IsLast;\r
-\r
-  static BOOL CALLBACK FirstDialogProcReflector (HWND hwnd, UINT message,\r
-                                                WPARAM wParam,\r
-                                                LPARAM lParam);\r
-  static BOOL CALLBACK DialogProcReflector (HWND hwnd, UINT message,\r
-                                           WPARAM wParam, LPARAM lParam);\r
-\r
-protected:\r
-    virtual BOOL CALLBACK DialogProc (UINT message, WPARAM wParam,\r
-                                     LPARAM lParam);\r
-\r
-public:\r
-  PropertyPage ();\r
-  virtual ~ PropertyPage ();\r
-\r
-  PROPSHEETPAGE *GetPROPSHEETPAGEPtr ()\r
-  {\r
-    return &psp;\r
-  };\r
-\r
-  // FIXME: These should be private and friended to PropSheet.\r
-  void YouAreBeingAddedToASheet (PropSheet * ps)\r
-  {\r
-    OurSheet = ps;\r
-  };\r
-  void YouAreFirst ()\r
-  {\r
-    IsFirst = true;\r
-    IsLast = false;\r
-  };\r
-  void YouAreLast ()\r
-  {\r
-    IsFirst = false;\r
-    IsLast = true;\r
-  };\r
-  void YouAreMiddle ()\r
-  {\r
-    IsFirst = false;\r
-    IsLast = false;\r
-  };\r
-\r
-  virtual bool Create (int TemplateID);\r
-  virtual bool Create (DLGPROC dlgproc, int TemplateID);\r
-  virtual bool Create (DLGPROC dlgproc,\r
-                      BOOL (*cmdproc) (HWND h, int id, HWND hwndctl,\r
-                                       UINT code), int TemplateID);\r
-\r
-  virtual void OnInit ()\r
-  {\r
-  };\r
-  virtual void OnActivate ()\r
-  {\r
-  };\r
-  virtual void OnDeactivate ()\r
-  {\r
-  };\r
-  virtual long OnNext ()\r
-  {\r
-    return 0;\r
-  };\r
-  virtual long OnBack ()\r
-  {\r
-    return 0;\r
-  };\r
-  virtual bool OnFinish ()\r
-  {\r
-    return true;\r
-  };\r
-\r
-  PropSheet *GetOwner () const\r
-  {\r
-    return OurSheet;\r
-  };\r
-};\r
-\r
-#endif // CINSTALL_PROPPAGE_H\r
+#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 <g.r.vansickle@worldnet.att.net>
+ *
+ */
+
+// 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 <windows.h>
+#include <prsht.h>
+
+#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 ca5da9587bdb78607e0f22d924c9fcd9f64ee5d9..91b58c0d77265eda1468e663fa0ce1ba64e1ee47 100644 (file)
@@ -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 <pshpack1.h>
+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 <poppack.h>
 
 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 * Parent, DWORD Style)
   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 044a5cc89532be766129acfc18ba12f746ef9c56..d97ba053d170bd710af5fd8c0174ccc3ed33b9f3 100644 (file)
@@ -1,59 +1,59 @@
-#ifndef CINSTALL_PROPSHEET_H\r
-#define CINSTALL_PROPSHEET_H\r
-\r
-/*\r
- * Copyright (c) 2001, Gary R. Van Sickle.\r
- *\r
- *     This program is free software; you can redistribute it and/or modify\r
- *     it under the terms of the GNU General Public License as published by\r
- *     the Free Software Foundation; either version 2 of the License, or\r
- *     (at your option) any later version.\r
- *\r
- *     A copy of the GNU General Public License can be found at\r
- *     http://www.gnu.org/\r
- *\r
- * Written by Gary R. Van Sickle <g.r.vansickle@worldnet.att.net>\r
- *\r
- */\r
-\r
-// This is the header for the PropSheet class.  This class encapsulates\r
-// a Windows property sheet / wizard and interfaces with the PropertyPage class.\r
-// It's named PropSheet instead of PropertySheet because the latter conflicts with\r
-// the Windows function of the same name.\r
-\r
-\r
-#include <windows.h>\r
-#include <prsht.h>\r
-\r
-#include "window.h"\r
-\r
-class PropertyPage;\r
-\r
-class PropSheet:public Window\r
-{\r
-  PropertyPage *PropertyPages[MAXPROPPAGES];\r
-  int NumPropPages;\r
-\r
-  HPROPSHEETPAGE *PageHandles;\r
-  HPROPSHEETPAGE *CreatePages ();\r
-\r
-public:\r
-  PropSheet ();\r
-  virtual ~ PropSheet ();\r
-\r
-  // Should be private and friended to PropertyPage\r
-  void SetHWNDFromPage (HWND h);\r
-\r
-  virtual bool Create (const Window * Parent = NULL,\r
-                      DWORD Style =\r
-                      WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CLIPCHILDREN);\r
-\r
-  void AddPage (PropertyPage * p);\r
-\r
-  bool SetActivePage (int i);\r
-  bool SetActivePageByID (int resource_id);\r
-  void SetButtons (DWORD flags);\r
-  void PressButton (int button);\r
-};\r
-\r
-#endif // CINSTALL_PROPSHEET_H\r
+#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 <g.r.vansickle@worldnet.att.net>
+ *
+ */
+
+// 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 <windows.h>
+#include <prsht.h>
+
+#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
diff --git a/res.rc b/res.rc
index 8ce141e234ecf48b82b4d3d116f905ec228bb480..5844c28a8b10758cde983fdef25f86ee31907ba3 100644 (file)
--- a/res.rc
+++ b/res.rc
@@ -28,139 +28,149 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 // 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    DISCARDABLE     "cygwin.ico"
 #ifdef APSTUDIO_INVOKED
 GUIDELINES DESIGNINFO DISCARDABLE 
 BEGIN
+    IDD_SOURCE, DIALOG
+    BEGIN
+        RIGHTMARGIN, 285
+        BOTTOMMARGIN, 158
+    END
+
     IDD_LOCAL_DIR, DIALOG
     BEGIN
-        RIGHTMARGIN, 215
+        RIGHTMARGIN, 305
+        BOTTOMMARGIN, 157
+    END
+
+    IDD_ROOT, DIALOG
+    BEGIN
+        RIGHTMARGIN, 285
+        BOTTOMMARGIN, 158
     END
 
     IDD_SITE, DIALOG
     BEGIN
-        RIGHTMARGIN, 215
-        BOTTOMMARGIN, 93
+        BOTTOMMARGIN, 178
     END
 
     IDD_NET, DIALOG
     BEGIN
-        RIGHTMARGIN, 215
-        BOTTOMMARGIN, 60
+        RIGHTMARGIN, 285
+        BOTTOMMARGIN, 133
+    END
+
+    IDD_INSTATUS, DIALOG
+    BEGIN
+        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 fbf17b42d7baa2625d395925358bc10a80d2bd5e..926ef9348f757bb00b9a543cab8fdcb8a1ab876b 100644 (file)
 #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
 #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
diff --git a/root.h b/root.h
index 3c47c7b4e892fb091e459bee41f86db0f90b6a84..bf0839748a0e8e6c3bc67cc8b4ddd2e2f1d4ffc2 100644 (file)
--- a/root.h
+++ b/root.h
@@ -1,23 +1,23 @@
-#ifndef CINSTALL_ROOT_H\r
-#define CINSTALL_ROOT_H\r
-\r
-#include "proppage.h"\r
-\r
-class RootPage:public PropertyPage\r
-{\r
-public:\r
-  RootPage ()\r
-  {\r
-  };\r
-  virtual ~ RootPage ()\r
-  {\r
-  };\r
-\r
-  bool Create ();\r
-\r
-  virtual void OnInit ();\r
-  virtual long OnNext ();\r
-  virtual long OnBack ();\r
-};\r
-\r
-#endif // CINSTALL_ROOT_H\r
+#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
diff --git a/site.cc b/site.cc
index ef052ceb7e99642546c03b68cec534ec5683eece..56b497974fd223c533f75b6eb4c7fd704f7c863a 100644 (file)
--- a/site.cc
+++ b/site.cc
@@ -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)
@@ -92,40 +90,16 @@ site_list_type::site_list_type (char const *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, HWND owner)
 
 }
 
-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;
+}
diff --git a/site.h b/site.h
index 1c08c6e0ae697575cfad3b13ea9568ee58f8b7b1..ff90a4997bc6612eab3f7c001190605ed009747a 100644 (file)
--- a/site.h
+++ b/site.h
@@ -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 1859a6e393779f486cad6ec9e2438e9bc3477691..2cf86270163fd334ee3209cfb9e2c08bcebf01fa 100644 (file)
--- a/source.h
+++ b/source.h
@@ -1,43 +1,43 @@
-#ifndef CINSTALL_SOURCE_H\r
-#define CINSTALL_SOURCE_H\r
-\r
-/*\r
- * Copyright (c) 2001, Gary R. Van Sickle.\r
- *\r
- *     This program is free software; you can redistribute it and/or modify\r
- *     it under the terms of the GNU General Public License as published by\r
- *     the Free Software Foundation; either version 2 of the License, or\r
- *     (at your option) any later version.\r
- *\r
- *     A copy of the GNU General Public License can be found at\r
- *     http://www.gnu.org/\r
- *\r
- * Written by Gary R. Van Sickle <g.r.vansickle@worldnet.att.net>\r
- *\r
- */\r
-\r
-// This is the header for the SourcePage class, which lets the user\r
-// select Download+Install, Download, or Install From Local Directory.\r
-\r
-\r
-#include "proppage.h"\r
-\r
-class SourcePage:public PropertyPage\r
-{\r
-public:\r
-  SourcePage ()\r
-  {\r
-  };\r
-  virtual ~ SourcePage ()\r
-  {\r
-  };\r
-\r
-  bool Create ();\r
-\r
-  virtual void OnActivate ();\r
-  virtual void OnDeactivate ();\r
-  virtual long OnNext ();\r
-  virtual long OnBack ();\r
-};\r
-\r
-#endif\r
+#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 <g.r.vansickle@worldnet.att.net>
+ *
+ */
+
+// 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 b53ec203a3dddce1c639fb074c81a3cd4ca5afef..1e0c8603ffcf0895b800f68d936e6fda894d6aa8 100644 (file)
--- a/splash.cc
+++ b/splash.cc
@@ -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 27a3ccaa5c058d9d54ad009d56d74a4c4d61e62a..f6a9597fd848c4cee00fdffd20866456a8760c19 100644 (file)
--- a/splash.h
+++ b/splash.h
@@ -1,38 +1,38 @@
-#ifndef CINSTALL_SPLASH_H\r
-#define CINSTALL_SPLASH_H\r
-\r
-/*\r
- * Copyright (c) 2001, Gary R. Van Sickle.\r
- *\r
- *     This program is free software; you can redistribute it and/or modify\r
- *     it under the terms of the GNU General Public License as published by\r
- *     the Free Software Foundation; either version 2 of the License, or\r
- *     (at your option) any later version.\r
- *\r
- *     A copy of the GNU General Public License can be found at\r
- *     http://www.gnu.org/\r
- *\r
- * Written by Gary R. Van Sickle <g.r.vansickle@worldnet.att.net>\r
- *\r
- */\r
-\r
-// This is the header for the SplashPage class.  Since the splash page\r
-// has little to do, there's not much here.\r
-\r
-#include "proppage.h"\r
-\r
-class SplashPage:public PropertyPage\r
-{\r
-public:\r
-  SplashPage ()\r
-  {\r
-  };\r
-  virtual ~ SplashPage ()\r
-  {\r
-  };\r
-\r
-  bool Create ();\r
-  virtual void OnInit ();\r
-};\r
-\r
-#endif // CINSTALL_SPLASH_H\r
+#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 <g.r.vansickle@worldnet.att.net>
+ *
+ */
+
+// 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 d2403d309c7e90fec74de713932c241b73986c7b..62ba57f3508de3bdab489d2ee34c2c94588afc0d 100644 (file)
-/*\r
- * Copyright (c) 2001, Gary R. Van Sickle.\r
- *\r
- *     This program is free software; you can redistribute it and/or modify\r
- *     it under the terms of the GNU General Public License as published by\r
- *     the Free Software Foundation; either version 2 of the License, or\r
- *     (at your option) any later version.\r
- *\r
- *     A copy of the GNU General Public License can be found at\r
- *     http://www.gnu.org/\r
- *\r
- * Written by Gary R. Van Sickle <g.r.vansickle@worldnet.att.net>\r
- *\r
- */\r
-\r
-// This is the implementation of the ThreeBarProgressPage class.  It is a fairly generic\r
-// progress indicator property page with three progress bars.\r
-\r
-#include "win32.h"\r
-#include "commctrl.h"\r
-#include "resource.h"\r
-\r
-#include "dialog.h"\r
-#include "site.h"\r
-\r
-#include "propsheet.h"\r
-#include "threebar.h"\r
-\r
-bool\r
-ThreeBarProgressPage::Create ()\r
-{\r
-  return PropertyPage::Create (IDD_INSTATUS);\r
-}\r
-\r
-void\r
-ThreeBarProgressPage::OnInit ()\r
-{\r
-  // Get HWNDs to the dialog controls\r
-  ins_action = GetDlgItem (IDC_INS_ACTION);\r
-  ins_pkgname = GetDlgItem (IDC_INS_PKG);\r
-  ins_filename = GetDlgItem (IDC_INS_FILE);\r
-  // Bars\r
-  ins_pprogress = GetDlgItem (IDC_INS_PPROGRESS);\r
-  ins_iprogress = GetDlgItem (IDC_INS_IPROGRESS);\r
-  ins_diskfull = GetDlgItem (IDC_INS_DISKFULL);\r
-  // Bar labels\r
-  ins_bl_package = GetDlgItem (IDC_INS_BL_PACKAGE);\r
-  ins_bl_total = GetDlgItem (IDC_INS_BL_TOTAL);\r
-  ins_bl_disk = GetDlgItem (IDC_INS_BL_DISK);\r
-}\r
-\r
-void\r
-ThreeBarProgressPage::SetText1 (const TCHAR * t)\r
-{\r
-  SetWindowText (ins_action, t);\r
-}\r
-\r
-void\r
-ThreeBarProgressPage::SetText2 (const TCHAR * t)\r
-{\r
-  SetWindowText (ins_pkgname, t);\r
-}\r
-\r
-void\r
-ThreeBarProgressPage::SetText3 (const TCHAR * t)\r
-{\r
-  SetWindowText (ins_filename, t);\r
-}\r
-\r
-void\r
-ThreeBarProgressPage::SetBar1 (long progress, long max)\r
-{\r
-  int percent = (int) (100.0 * ((double) progress) / (double) max);\r
-  SendMessage (ins_pprogress, PBM_SETPOS, (WPARAM) percent, 0);\r
-}\r
-\r
-void\r
-ThreeBarProgressPage::SetBar2 (long progress, long max)\r
-{\r
-  int percent = (int) (100.0 * ((double) progress) / (double) max);\r
-  SendMessage (ins_iprogress, PBM_SETPOS, (WPARAM) percent, 0);\r
-}\r
-\r
-void\r
-ThreeBarProgressPage::SetBar3 (long progress, long max)\r
-{\r
-  int percent = (int) (100.0 * ((double) progress) / (double) max);\r
-  SendMessage (ins_diskfull, PBM_SETPOS, (WPARAM) percent, 0);\r
-}\r
-\r
-void\r
-ThreeBarProgressPage::EnableSingleBar (bool enable)\r
-{\r
-  // Switch to/from single bar mode\r
-  ShowWindow (ins_bl_total, enable ? SW_HIDE : SW_SHOW);\r
-  ShowWindow (ins_bl_disk, enable ? SW_HIDE : SW_SHOW);\r
-  ShowWindow (ins_iprogress, enable ? SW_HIDE : SW_SHOW);\r
-  ShowWindow (ins_diskfull, enable ? SW_HIDE : SW_SHOW);\r
-}\r
-\r
-void\r
-ThreeBarProgressPage::OnActivate ()\r
-{\r
-  // Disable back and next buttons\r
-  GetOwner ()->SetButtons (0);\r
-\r
-  // Set all bars to 0\r
-  SetBar1 (0);\r
-  SetBar2 (0);\r
-  SetBar3 (0);\r
-\r
-  switch (task)\r
-    {\r
-    case WM_APP_START_SITE_INFO_DOWNLOAD:\r
-    case WM_APP_START_SETUP_INI_DOWNLOAD:\r
-      // For these tasks, show only a single progress bar.\r
-      EnableSingleBar ();\r
-      break;\r
-    default:\r
-      // Show the normal 3-bar view by default\r
-      EnableSingleBar (false);\r
-      break;\r
-    }\r
-\r
-  Window::PostMessage (task);\r
-}\r
-\r
-bool\r
-ThreeBarProgressPage::OnMessageApp (UINT uMsg, WPARAM wParam, LPARAM lParam)\r
-{\r
-  switch (uMsg)\r
-    {\r
-    case WM_APP_START_DOWNLOAD:\r
-      {\r
-       // Start the package download thread.\r
-       do_download (GetInstance (), GetHWND ());\r
-       break;\r
-      }\r
-    case WM_APP_DOWNLOAD_THREAD_COMPLETE:\r
-      {\r
-       if (lParam == IDD_S_INSTALL)\r
-         {\r
-           // Download is complete and we want to go on to the install.\r
-           Window::PostMessage (WM_APP_START_INSTALL);\r
-         }\r
-       else if (lParam != 0)\r
-         {\r
-           // Download failed for some reason, go back to site selection page\r
-           GetOwner ()->SetActivePageByID (lParam);\r
-         }\r
-       else\r
-         {\r
-           // Was a download-only, and is complete or failed.\r
-           GetOwner ()->PressButton (PSBTN_CANCEL);\r
-         }\r
-       break;\r
-      }\r
-    case WM_APP_START_INSTALL:\r
-      {\r
-       // Start the install thread.\r
-       do_install (GetInstance (), GetHWND ());\r
-       break;\r
-      }\r
-    case WM_APP_INSTALL_THREAD_COMPLETE:\r
-      {\r
-       // Re-enable and "Push" the Next button\r
-       GetOwner ()->SetButtons (PSWIZB_NEXT);\r
-       GetOwner ()->PressButton (PSBTN_NEXT);\r
-       break;\r
-      }\r
-    case WM_APP_START_SITE_INFO_DOWNLOAD:\r
-      {\r
-       do_download_site_info (GetInstance (), GetHWND ());\r
-       break;\r
-      }\r
-    case WM_APP_SITE_INFO_DOWNLOAD_COMPLETE:\r
-      {\r
-       GetOwner ()->SetActivePageByID (lParam);\r
-       break;\r
-      }\r
-    case WM_APP_START_SETUP_INI_DOWNLOAD:\r
-      {\r
-       do_ini (GetInstance (), GetHWND ());\r
-       break;\r
-      }\r
-    case WM_APP_SETUP_INI_DOWNLOAD_COMPLETE:\r
-      {\r
-       if (lParam == IDD_S_FROM_CWD)\r
-         {\r
-           // There isn't actually a dialog template named this\r
-           do_fromcwd (GetInstance (), GetHWND ());\r
-         }\r
-       else\r
-         {\r
-           GetOwner ()->SetActivePageByID (lParam);\r
-         }\r
-       break;\r
-      }\r
-    default:\r
-      {\r
-       // Not handled\r
-       return false;\r
-      }\r
-    }\r
-\r
-  return true;\r
-}\r
+/*
+ * 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 <g.r.vansickle@worldnet.att.net>
+ *
+ */
+
+// 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 186bb949b05f2e820534f36fc1a1f219552ac97d..84212485664626f59cce7329ec0ced64585accec 100644 (file)
@@ -1,81 +1,81 @@
-#ifndef CINSTALL_THREEBAR_H\r
-#define CINSTALL_THREEBAR_H\r
-\r
-/*\r
- * Copyright (c) 2001, Gary R. Van Sickle.\r
- *\r
- *     This program is free software; you can redistribute it and/or modify\r
- *     it under the terms of the GNU General Public License as published by\r
- *     the Free Software Foundation; either version 2 of the License, or\r
- *     (at your option) any later version.\r
- *\r
- *     A copy of the GNU General Public License can be found at\r
- *     http://www.gnu.org/\r
- *\r
- * Written by Gary R. Van Sickle <g.r.vansickle@worldnet.att.net>\r
- *\r
- */\r
-\r
-// This is the header for the ThreeBarProgressPage class.  It is a fairly generic\r
-// progress indicator property page with three progress bars.\r
-\r
-\r
-#include "win32.h"\r
-#include "proppage.h"\r
-\r
-#define WM_APP_START_DOWNLOAD              WM_APP+0\r
-#define WM_APP_DOWNLOAD_THREAD_COMPLETE    WM_APP+1\r
-#define WM_APP_START_INSTALL               WM_APP+2\r
-#define WM_APP_INSTALL_THREAD_COMPLETE     WM_APP+3\r
-#define WM_APP_START_SITE_INFO_DOWNLOAD    WM_APP+4\r
-#define WM_APP_SITE_INFO_DOWNLOAD_COMPLETE WM_APP+5\r
-#define WM_APP_START_SETUP_INI_DOWNLOAD    WM_APP+6\r
-#define WM_APP_SETUP_INI_DOWNLOAD_COMPLETE WM_APP+7\r
-\r
-class ThreeBarProgressPage:public PropertyPage\r
-{\r
-  HWND ins_dialog;\r
-  HWND ins_action;\r
-  HWND ins_pkgname;\r
-  HWND ins_filename;\r
-  HWND ins_pprogress;\r
-  HWND ins_iprogress;\r
-  HWND ins_diskfull;\r
-  HWND ins_bl_package;\r
-  HWND ins_bl_total;\r
-  HWND ins_bl_disk;\r
-\r
-  int task;\r
-\r
-  void EnableSingleBar (bool enable = true);\r
-\r
-public:\r
-    ThreeBarProgressPage ()\r
-  {\r
-  };\r
-  virtual ~ ThreeBarProgressPage ()\r
-  {\r
-  };\r
-\r
-  bool Create ();\r
-\r
-  virtual void OnInit ();\r
-  virtual void OnActivate ();\r
-  virtual bool OnMessageApp (UINT uMsg, WPARAM wParam, LPARAM lParam);\r
-\r
-  void SetText1 (const TCHAR * t);\r
-  void SetText2 (const TCHAR * t);\r
-  void SetText3 (const TCHAR * t);\r
-\r
-  void SetBar1 (long progress, long max = 100);\r
-  void SetBar2 (long progress, long max = 100);\r
-  void SetBar3 (long progress, long max = 100);\r
-\r
-  void SetActivateTask (int t)\r
-  {\r
-    task = t;\r
-  };\r
-};\r
-\r
-\r
-#endif // CINSTALL_THREEBAR_H\r
+#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 <g.r.vansickle@worldnet.att.net>
+ *
+ */
+
+// 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 8eccbd1fe25c75406c18f361c56c428e1c5ecd32..d7325d8c90a0913508a97b2e8cff6fcb7e6c0962 100644 (file)
--- a/window.cc
+++ b/window.cc
@@ -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.
@@ -260,3 +269,49 @@ 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 2cb405b01119d960e731374740713e335709e668..03702490dca41f776b80cc1f7c65258fa7a4a475 100644 (file)
--- a/window.h
+++ b/window.h
@@ -39,6 +39,11 @@ class Window
 
   Window *Parent;
 
+  // FIXME: replace with <vector> when we get a chance.
+  static const int MAXFONTS = 5;
+  HFONT Fonts[MAXFONTS];
+  int FontCounter;
+
 protected:
   void SetHWND (HWND h)
   {
@@ -79,6 +84,10 @@ 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);
 
@@ -87,6 +96,12 @@ public:
     return false;
   };
 
+  virtual bool OnMessageCmd (int id, HWND hwndctl, UINT code)
+  {
+    // Not processed.
+    return false;
+  };
+
   // Center the window on the parent, or on screen if no parent.
   void CenterWindow ();
 
This page took 0.140927 seconds and 5 git commands to generate.