Improved the moving and resizing of the gadget on multi-monitor systems. Fixed one problem where the underlying gadget window size would be reduced unrequested. Fine tuned the progress bar size in the gadget.
authormoel.mich
Tue, 16 Nov 2010 21:48:26 +0000
changeset 24307a9329cd87c
parent 242 881aedb94bc6
child 244 99f16e21cdc8
Improved the moving and resizing of the gadget on multi-monitor systems. Fixed one problem where the underlying gadget window size would be reduced unrequested. Fine tuned the progress bar size in the gadget.
GUI/GadgetWindow.cs
GUI/SensorGadget.cs
Properties/AssemblyVersion.cs
     1.1 --- a/GUI/GadgetWindow.cs	Sat Nov 13 20:20:03 2010 +0000
     1.2 +++ b/GUI/GadgetWindow.cs	Tue Nov 16 21:48:26 2010 +0000
     1.3 @@ -152,7 +152,8 @@
     1.4              if (!lockPositionAndSize) {
     1.5                // prevent the window from leaving the screen
     1.6                if ((wp.flags & SWP_NOMOVE) == 0) {
     1.7 -                Rectangle rect = Screen.GetWorkingArea(new Point(wp.x, wp.y));
     1.8 +                Rectangle rect = Screen.GetWorkingArea(
     1.9 +                  new Rectangle(wp.x, wp.y, wp.cx, wp.cy));
    1.10                  const int margin = 16;
    1.11                  wp.x = Math.Max(wp.x, rect.Left - wp.cx + margin);
    1.12                  wp.x = Math.Min(wp.x, rect.Right - margin);
    1.13 @@ -194,7 +195,11 @@
    1.14              }
    1.15              
    1.16              // do not forward any move or size messages
    1.17 -            wp.flags |= SWP_NOSIZE | SWP_NOMOVE;            
    1.18 +            wp.flags |= SWP_NOSIZE | SWP_NOMOVE;
    1.19 +
    1.20 +            // suppress any frame changed events
    1.21 +            wp.flags &= ~SWP_FRAMECHANGED;
    1.22 +
    1.23              Marshal.StructureToPtr(wp, message.LParam, false);                      
    1.24              message.Result = IntPtr.Zero;
    1.25            } break;
    1.26 @@ -383,6 +388,7 @@
    1.27      public const uint SWP_NOSIZE = 0x0001;
    1.28      public const uint SWP_NOMOVE = 0x0002;
    1.29      public const uint SWP_NOACTIVATE = 0x0010;
    1.30 +    public const uint SWP_FRAMECHANGED = 0x0020;
    1.31      public const uint SWP_HIDEWINDOW = 0x0080;
    1.32      public const uint SWP_SHOWWINDOW = 0x0040;
    1.33      public const uint SWP_NOZORDER = 0x0004;
     2.1 --- a/GUI/SensorGadget.cs	Sat Nov 13 20:20:03 2010 +0000
     2.2 +++ b/GUI/SensorGadget.cs	Tue Nov 16 21:48:26 2010 +0000
     2.3 @@ -379,8 +379,8 @@
     2.4          new Rectangle(back.Width - r, back.Height - b, r, b), u);
     2.5      }
     2.6  
     2.7 -    private void DrawProgress(Graphics g, int x, int y, int width, int height,
     2.8 -      float progress) 
     2.9 +    private void DrawProgress(Graphics g, float x, float y, 
    2.10 +      float width, float height, float progress) 
    2.11      {
    2.12        g.DrawImage(barBack, 
    2.13          new RectangleF(x + width * progress, y, width * (1 - progress), height), 
    2.14 @@ -474,7 +474,8 @@
    2.15                rightMargin;
    2.16            } else {
    2.17              DrawProgress(g, w - progressWidth - rightMargin,
    2.18 -              y + 4, progressWidth, 6, 0.01f * sensor.Value.Value);
    2.19 +              y + 0.35f * sensorLineHeight, progressWidth,
    2.20 +              0.6f * sensorLineHeight, 0.01f * sensor.Value.Value);
    2.21  
    2.22              remainingWidth = w - progressWidth - rightMargin;
    2.23            }
     3.1 --- a/Properties/AssemblyVersion.cs	Sat Nov 13 20:20:03 2010 +0000
     3.2 +++ b/Properties/AssemblyVersion.cs	Tue Nov 16 21:48:26 2010 +0000
     3.3 @@ -37,5 +37,5 @@
     3.4  
     3.5  using System.Reflection;
     3.6  
     3.7 -[assembly: AssemblyVersion("0.2.1.6")]
     3.8 -[assembly: AssemblyInformationalVersion("0.2.1.6 Alpha")]
     3.9 \ No newline at end of file
    3.10 +[assembly: AssemblyVersion("0.2.1.7")]
    3.11 +[assembly: AssemblyInformationalVersion("0.2.1.7 Alpha")]
    3.12 \ No newline at end of file