diff --git a/.hgignore b/.hgignore
index 616576d..b4fa552 100644
--- a/.hgignore
+++ b/.hgignore
@@ -1,3 +1,4 @@
glob:OnTopReplica.suo
glob:bin/*
glob:obj/*
+glob:publish/*
diff --git a/OnTopReplica/AspectRatioForm.cs b/OnTopReplica/AspectRatioForm.cs
index b5c0801..66bf5b1 100644
--- a/OnTopReplica/AspectRatioForm.cs
+++ b/OnTopReplica/AspectRatioForm.cs
@@ -47,7 +47,7 @@ namespace OnTopReplica {
/// Forces the form to update its height based on the current aspect ratio setting.
///
public void RefreshAspectRatio() {
- this.Height = (int)(this.Width / AspectRatio);
+ ClientSize = new Size(ClientSize.Width, (int)(ClientSize.Width / AspectRatio));
}
///
@@ -55,7 +55,7 @@ namespace OnTopReplica {
///
public void SetAspectRatio(Size aspectRatioSource) {
_keepAspectRatio = true; //set without updating
- AspectRatio = (aspectRatioSource.Width / (double)aspectRatioSource.Height);
+ AspectRatio = ((double)aspectRatioSource.Width / (double)aspectRatioSource.Height);
RefreshAspectRatio();
}
@@ -70,7 +70,7 @@ namespace OnTopReplica {
if (res == NativeMethods.WMSZ_LEFT || res == NativeMethods.WMSZ_RIGHT) {
//Left or right resize -> adjust height (bottom)
- int targetHeight = (int)(this.Width / AspectRatio);
+ int targetHeight = (int)Math.Ceiling(this.Width / AspectRatio);
int originalHeight = rc.Bottom - rc.Top;
int diffHeight = originalHeight - targetHeight;
@@ -79,7 +79,7 @@ namespace OnTopReplica {
}
else if (res == NativeMethods.WMSZ_TOP || res == NativeMethods.WMSZ_BOTTOM) {
//Up or down resize -> adjust width (right)
- int targetWidth = (int)(this.Height * AspectRatio);
+ int targetWidth = (int)Math.Ceiling(this.Height * AspectRatio);
int originalWidth = rc.Right - rc.Left;
int diffWidth = originalWidth - targetWidth;
@@ -88,19 +88,19 @@ namespace OnTopReplica {
}
else if (res == NativeMethods.WMSZ_RIGHT + NativeMethods.WMSZ_BOTTOM) {
//Lower-right corner resize -> adjust height (could have been width)
- rc.Bottom = rc.Top + (int)(this.Width / AspectRatio);
+ rc.Bottom = rc.Top + (int)Math.Ceiling(this.Width / AspectRatio);
}
else if (res == NativeMethods.WMSZ_LEFT + NativeMethods.WMSZ_BOTTOM) {
//Lower-left corner resize -> adjust height (could have been width)
- rc.Bottom = rc.Top + (int)(this.Width / AspectRatio);
+ rc.Bottom = rc.Top + (int)Math.Ceiling(this.Width / AspectRatio);
}
else if (res == NativeMethods.WMSZ_LEFT + NativeMethods.WMSZ_TOP) {
//Upper-left corner -> adjust width (could have been height)
- rc.Left = rc.Right - (int)(this.Height * AspectRatio);
+ rc.Left = rc.Right - (int)Math.Ceiling(this.Height * AspectRatio);
}
else if (res == NativeMethods.WMSZ_RIGHT + NativeMethods.WMSZ_TOP) {
//Upper-right corner -> adjust width (could have been height)
- rc.Right = rc.Left + (int)(this.Height * AspectRatio);
+ rc.Right = rc.Left + (int)Math.Ceiling(this.Height * AspectRatio);
}
Marshal.StructureToPtr(rc, m.LParam, true);
diff --git a/OnTopReplica/MainForm.Designer.cs b/OnTopReplica/MainForm.Designer.cs
index 96952e0..67dfd5e 100644
--- a/OnTopReplica/MainForm.Designer.cs
+++ b/OnTopReplica/MainForm.Designer.cs
@@ -95,7 +95,7 @@
this.aboutToolStripMenuItem,
this.menuContextClose});
this.menuContext.Name = "menuContext";
- this.menuContext.Size = new System.Drawing.Size(169, 296);
+ this.menuContext.Size = new System.Drawing.Size(169, 274);
this.menuContext.Opening += new System.ComponentModel.CancelEventHandler(this.Menu_opening);
//
// menuContextWindows
@@ -170,7 +170,7 @@
this.menuOpacity.OwnerItem = this.menuContextOpacity;
this.menuOpacity.ShowCheckMargin = true;
this.menuOpacity.ShowImageMargin = false;
- this.menuOpacity.Size = new System.Drawing.Size(154, 142);
+ this.menuOpacity.Size = new System.Drawing.Size(154, 120);
this.menuOpacity.Opening += new System.ComponentModel.CancelEventHandler(this.Menu_Opacity_opening);
//
// toolStripMenuItem1
@@ -244,6 +244,7 @@
this.toolStripSeparator3,
this.fullscreenToolStripMenuItem1});
this.menuResize.Name = "menuResize";
+ this.menuResize.OwnerItem = this.resizeToolStripMenuItem;
this.menuResize.Size = new System.Drawing.Size(165, 120);
this.menuResize.Opening += new System.ComponentModel.CancelEventHandler(this.Menu_Resize_opening);
//
@@ -351,8 +352,8 @@
//
this.chromeToolStripMenuItem.Name = "chromeToolStripMenuItem";
this.chromeToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
- this.chromeToolStripMenuItem.Text = Strings.MenuChrome;
- this.chromeToolStripMenuItem.ToolTipText = Strings.MenuChromeTT;
+ this.chromeToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuChrome;
+ this.chromeToolStripMenuItem.ToolTipText = global::OnTopReplica.Strings.MenuChromeTT;
this.chromeToolStripMenuItem.Click += new System.EventHandler(this.Menu_Chrome_click);
//
// reduceToIconToolStripMenuItem
@@ -524,7 +525,7 @@
private System.Windows.Forms.ContextMenuStrip menuLanguages;
private System.Windows.Forms.ToolStripMenuItem englishToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem italianoToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem chromeToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem chromeToolStripMenuItem;
}
}
diff --git a/OnTopReplica/MainForm.cs b/OnTopReplica/MainForm.cs
index 44b4584..8d6df36 100644
--- a/OnTopReplica/MainForm.cs
+++ b/OnTopReplica/MainForm.cs
@@ -105,10 +105,6 @@ namespace OnTopReplica
RegionBoxShowing = false;
}
- void Thumbnail_IdealSizeChange(object sender, Size e) {
- ClientSize = e;
- }
-
#endregion
#region Side "Region box" events
@@ -225,7 +221,6 @@ namespace OnTopReplica
//Do some checks in order to verify the presence of desktop composition
if (!VistaControls.OsSupport.IsVistaOrBetter) {
MessageBox.Show(Strings.ErrorNoDwm, Strings.ErrorNoDwmTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
-
this.Close();
return;
@@ -325,6 +320,10 @@ namespace OnTopReplica
#region Menu Event Handling
+ private void Close_click(object sender, EventArgs e) {
+ this.Close();
+ }
+
private void Menu_opening(object sender, CancelEventArgs e) {
//Cancel if currently "fullscreen" mode
if (_isFullscreen) {
diff --git a/OnTopReplica/OnTopReplica.csproj b/OnTopReplica/OnTopReplica.csproj
index ac443cb..c222060 100644
--- a/OnTopReplica/OnTopReplica.csproj
+++ b/OnTopReplica/OnTopReplica.csproj
@@ -49,8 +49,8 @@
true
publish.htm
false
- 1
- 2.9.0.%2a
+ 2
+ 2.9.1.%2a
false
true
true
diff --git a/OnTopReplica/Properties/AssemblyInfo.cs b/OnTopReplica/Properties/AssemblyInfo.cs
index 574aa9b..6886f8d 100644
--- a/OnTopReplica/Properties/AssemblyInfo.cs
+++ b/OnTopReplica/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("2.9.0.0")]
-[assembly: AssemblyFileVersion("2.9.0.0")]
+[assembly: AssemblyVersion("2.9.1.0")]
+[assembly: AssemblyFileVersion("2.9.1.0")]
diff --git a/OnTopReplica/ThumbnailPanel.cs b/OnTopReplica/ThumbnailPanel.cs
index 2f0b2f4..70160e5 100644
--- a/OnTopReplica/ThumbnailPanel.cs
+++ b/OnTopReplica/ThumbnailPanel.cs
@@ -71,7 +71,7 @@ namespace OnTopReplica {
_glassMode = value;
//Set correct backcolor: black if glass is on
- BackColor = (value || _fullscreenMode) ? Color.Black : SystemColors.Control;
+ BackColor = (value || _fullscreenMode) ? Color.Black : SystemColors.Control;
UpdateRightClickLabels();
}
@@ -136,7 +136,7 @@ namespace OnTopReplica {
private byte ThumbnailOpacity {
get {
- return (_drawMouseRegions) ? (byte)130 : (byte)255;
+ return (_drawMouseRegions) ? (byte)130 : (byte)255;
}
}
@@ -204,15 +204,17 @@ namespace OnTopReplica {
if (_thumbnail != null && !_thumbnail.IsInvalid){
try {
Size sourceSize = (_regionEnabled) ? _regionCurrent.Size : _thumbnail.SourceSize;
+ thumbnailSize = new Size(Size.Width, Size.Height * 2); //ComputeIdealSize(sourceSize, Size);
- thumbnailSize = ComputeIdealSize(sourceSize, Size);
-
- padWidth = (Size.Width - thumbnailSize.Width) / 2;
+ /*padWidth = (Size.Width - thumbnailSize.Width) / 2;
padHeight = (Size.Height - thumbnailSize.Height) / 2;
- Rectangle target = new Rectangle(padWidth, padHeight, thumbnailSize.Width, thumbnailSize.Height);
+ Rectangle target = new Rectangle(padWidth, padHeight, thumbnailSize.Width, thumbnailSize.Height);*/
+ var target = new Rectangle(0, 0, thumbnailSize.Width, thumbnailSize.Height);
Rectangle source = (_regionEnabled) ? _regionCurrent : new Rectangle(Point.Empty, _thumbnail.SourceSize);
+ //Console.WriteLine("Source " + sourceSize.ToString() + ", Target " + Size.ToString() + ", Fit " + thumbnailSize.ToString() + ", Padding " + padWidth + "," + padHeight);
+
_thumbnail.Update(target, source, ThumbnailOpacity, true, true);
}
catch {
@@ -225,7 +227,7 @@ namespace OnTopReplica {
UpdateRightClickLabels();
}
- /// Computes ideal size given an original size and a target to fit.
+ /// Computes ideal thumbnail size given an original size and a target to fit.
/// Size of the original thumbnail.
/// Size of the client area to fit.
private Size ComputeIdealSize(Size sourceSize, Size clientSize) {