List:Commits« Previous MessageNext Message »
From:Reggie Burnett Date:February 3 2011 4:01am
Subject:bzr commit into wex-installer-1.0 branch (reggie.burnett:291)
View as plain text  
#At file:///C:/Users/Reggie/work/wex/installer-updated/ based on revid:reggie.burnett@stripped

  291 Reggie Burnett	2011-02-02
      added product images and made other gui changes

    modified:
      WexInstaller/Core/ListViewWex.cs
      WexInstaller/InstallWizard/AllConfigOverview.Designer.cs
      WexInstaller/InstallWizard/AllConfigOverview.cs
      WexInstaller/InstallWizard/AllConfigOverview.resx
=== modified file 'WexInstaller/Core/ListViewWex.cs'
=== modified file 'WexInstaller/Core/ListViewWex.cs'
--- a/WexInstaller/Core/ListViewWex.cs	2011-01-31 05:03:43 +0000
+++ b/WexInstaller/Core/ListViewWex.cs	2011-02-03 04:01:58 +0000
@@ -11,6 +11,20 @@
     {
         private int progressbarrow = 0;
         private int progressbarcol = 0;
+        private ImageList dummyList;
+
+        public ListViewWex()
+        {
+            OwnerDraw = true;
+            DoubleBuffered = true;
+
+            // we do this so our rows have the right height.  
+            // we really should be querying the size of the product images instead
+            // of using 32 but this will do for now.
+            dummyList = new ImageList();
+            dummyList.ImageSize = new Size(32, 32);
+            SmallImageList = dummyList;
+        }
 
         private void PositionProgressBar()
         {
@@ -28,10 +42,10 @@
                 progressBarColLeft += col.Width;
             }
 
-            ProgressBar.Height = rowRect.Height - 2;
+            ProgressBar.Height = 17;
             ProgressBar.Width = progressBarColWidth - 4;
             ProgressBar.Location = new Point(rowRect.Left + progressBarColLeft + 2,
-                                             rowRect.Top + 1);
+                                             rowRect.Top + (rowRect.Height - ProgressBar.Height)/2);
 
             return;
         }
@@ -101,5 +115,63 @@
             PositionProgressBar();
             ProgressBar.Refresh();
         }
+
+        protected override void OnDrawColumnHeader(DrawListViewColumnHeaderEventArgs e)
+        {
+            e.DrawDefault = true;
+            base.OnDrawColumnHeader(e);
+        }
+
+        protected override void OnDrawItem(DrawListViewItemEventArgs e)
+        {
+
+            e.DrawDefault = false;
+            e.DrawBackground();
+
+            base.OnDrawItem(e);
+        }
+
+        protected override void OnDrawSubItem(DrawListViewSubItemEventArgs e)
+        {
+            if (e.SubItem == e.Item.SubItems[1])
+            {
+                e.DrawDefault = false;
+                e.DrawBackground();
+                Product product = e.Item.Tag as Product;
+
+                Image icon = product.Icon;
+                if (e.Item.StateImageIndex != 0)
+                    icon = GhostIcon(product.Icon);
+                e.Graphics.DrawImage(icon, e.Bounds.Location);
+                Point pt = e.Bounds.Location;
+
+                Size stringSize = e.Graphics.MeasureString(e.SubItem.Text, e.SubItem.Font).ToSize();
+                pt.Y += (e.Bounds.Height - stringSize.Height) / 2;
+
+                e.Graphics.DrawString(e.SubItem.Text, e.SubItem.Font,
+                    new SolidBrush(e.SubItem.ForeColor),
+                    pt.X + product.Icon.Width + 5, pt.Y);
+            }
+            else
+            {
+                e.DrawDefault = true;
+            }
+            base.OnDrawSubItem(e);
+        }
+
+        private Image GhostIcon(Image image)
+        {
+            Bitmap b = new Bitmap(image);
+            for (int y = 0; y < b.Height; y++)
+                for (int x = 0; x < b.Width; x++)
+                {
+                    Color c = b.GetPixel(x, y);
+                    int red = c.R + (255 - c.R)*3/4;
+                    int green = c.G + (255 - c.G)*3/4;
+                    int blue = c.B + (255 - c.B)*3/4;
+                    b.SetPixel(x, y, Color.FromArgb(red, green, blue));
+                }
+            return b;
+        }
     }
 }

=== modified file 'WexInstaller/InstallWizard/AllConfigOverview.Designer.cs'
--- a/WexInstaller/InstallWizard/AllConfigOverview.Designer.cs	2011-01-31 05:03:43 +0000
+++ b/WexInstaller/InstallWizard/AllConfigOverview.Designer.cs	2011-02-03 04:01:58 +0000
@@ -59,6 +59,7 @@
             this.columnHeader4});
             this.productList.Location = new System.Drawing.Point(17, 113);
             this.productList.Name = "productList";
+            this.productList.OwnerDraw = true;
             this.productList.ProgressBar = null;
             this.productList.ProgressBarCol = 0;
             this.productList.ProgressBarRow = 0;

=== modified file 'WexInstaller/InstallWizard/AllConfigOverview.cs'
--- a/WexInstaller/InstallWizard/AllConfigOverview.cs	2011-02-02 21:50:03 +0000
+++ b/WexInstaller/InstallWizard/AllConfigOverview.cs	2011-02-03 04:01:58 +0000
@@ -25,7 +25,6 @@
             InitializeComponent();
             backOk = false;
             nextOk = true;
-            ListViewHelper.EnableDoubleBuffer(productList);
         }
 
         public override bool NextOk()
@@ -53,6 +52,7 @@
                             item.Tag = p;
                             item.SubItems.Add(p.TitleWithVersion);
                             item.SubItems.Add(GetProductStateString(p.Controller.CurrentState));
+                            SetLineColor(item, Color.LightGray);
                             productList.Items.Add(item);
                         }
                     }
@@ -65,6 +65,7 @@
                 {
                     configuringItem = productList.Items[0];
                     configuringItem.StateImageIndex = 0;
+                    SetLineColor(configuringItem, Color.Black);
                     (ParentControl as InstallWizardControl).AddConfigPages(configuringItem.Tag as Product);
                 }
             }
@@ -122,18 +123,26 @@
                                        );
                 productList.ProgressBar.Value = e.PercentComplete;
                 configuringItem.SubItems[2].Text = GetProductStateString((configuringItem.Tag as Product).Controller.CurrentState);
-                if (e.Type == ConfigurationEventType.Error || e.Type == ConfigurationEventType.Finished)
-                {
-                    int currentIndex = productList.Items.IndexOf(configuringItem);
-
-                    configuringItem.StateImageIndex += (e.Type == ConfigurationEventType.Error) ? 2 : 1;
-                    if (e.Type == ConfigurationEventType.Error)
-                        configuringItem.ForeColor = Color.Red;
+                if (e.Type == ConfigurationEventType.Error)
+                {
+                    int currentIndex = productList.Items.IndexOf(configuringItem);
+                    configuringItem.StateImageIndex = 2;
+                    SetLineColor(configuringItem, Color.Red);
+                }
+                else if (e.Type == ConfigurationEventType.Finished)
+                {
+                    int currentIndex = productList.Items.IndexOf(configuringItem);
+                    if (configuringItem.StateImageIndex == 0)
+                    {
+                        configuringItem.StateImageIndex = 1;
+                        SetLineColor(configuringItem, Color.LightGray);
+                    }
                     productList.ShowProgressBar(false);
-                    if ((currentIndex > 0) && ((currentIndex + 1) < productList.Items.Count))
+                    if ((currentIndex + 1) < productList.Items.Count)
                     {
                         configuringItem = productList.Items[currentIndex + 1];
                         configuringItem.StateImageIndex = 0;
+                        SetLineColor(configuringItem, Color.Black);
                         (ParentControl as InstallWizardControl).AddConfigPages(configuringItem.Tag as Product);
                     }
                     else
@@ -145,11 +154,19 @@
             SignalChange();
         }
 
+        private void SetLineColor(ListViewItem item, Color color)
+        {
+            item.ForeColor = color;
+            foreach (ListViewItem.ListViewSubItem subItem in item.SubItems)
+                subItem.ForeColor = color;
+        }
+
         private void enableDetails_Click(object sender, EventArgs e)
         {
             enableDetails.Visible = false;
             detailsText.Visible = true;
             detailsText.BringToFront();
         }
+
     }
 }

=== modified file 'WexInstaller/InstallWizard/AllConfigOverview.resx'
--- a/WexInstaller/InstallWizard/AllConfigOverview.resx	2011-01-31 05:03:43 +0000
+++ b/WexInstaller/InstallWizard/AllConfigOverview.resx	2011-02-03 04:01:58 +0000
@@ -125,7 +125,7 @@
         AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
         LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
         ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADU
-        CgAAAk1TRnQBSQFMAgEBAwEAAQQBAAEEAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
+        CgAAAk1TRnQBSQFMAgEBAwEAASwBAAEsAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
         AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
         AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
         AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA


Attachment: [text/bzr-bundle] bzr/reggie.burnett@oracle.com-20110203040158-snp053exdupg7155.bundle
Thread
bzr commit into wex-installer-1.0 branch (reggie.burnett:291) Reggie Burnett3 Feb