Fullscreen mode refactored.

Click through mode removed from standard form and added to fullscreen.
This commit is contained in:
Lorenz Cuno Klopfenstein 2010-01-21 00:14:30 +00:00
parent 51d1f05e1c
commit 880b6154af
7 changed files with 249 additions and 172 deletions

View file

@ -29,9 +29,17 @@
this.windowsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuWindows = new System.Windows.Forms.ContextMenuStrip(this.components);
this.noneToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.modeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuModeStandard = new System.Windows.Forms.ToolStripMenuItem();
this.menuModeOnTop = new System.Windows.Forms.ToolStripMenuItem();
this.menuModeClickThrough = new System.Windows.Forms.ToolStripMenuItem();
this.opacityToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuOpacity100 = new System.Windows.Forms.ToolStripMenuItem();
this.menuOpacity75 = new System.Windows.Forms.ToolStripMenuItem();
this.menuOpacity50 = new System.Windows.Forms.ToolStripMenuItem();
this.menuOpacity25 = new System.Windows.Forms.ToolStripMenuItem();
this.quitFullscreenModeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this._thumbnail = new OnTopReplica.ThumbnailPanel();
this.alwaysOnTopToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuContext.SuspendLayout();
this.menuWindows.SuspendLayout();
this.SuspendLayout();
@ -40,11 +48,11 @@
//
this.menuContext.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.windowsToolStripMenuItem,
this.alwaysOnTopToolStripMenuItem,
this.modeToolStripMenuItem,
this.opacityToolStripMenuItem,
this.quitFullscreenModeToolStripMenuItem});
this.menuContext.Name = "contextMenuStrip1";
this.menuContext.Size = new System.Drawing.Size(186, 92);
this.menuContext.Opening += new System.ComponentModel.CancelEventHandler(this.Menu_opening);
this.menuContext.Size = new System.Drawing.Size(186, 114);
//
// windowsToolStripMenuItem
//
@ -70,6 +78,79 @@
this.noneToolStripMenuItem.Size = new System.Drawing.Size(117, 22);
this.noneToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuWindowsNone;
//
// modeToolStripMenuItem
//
this.modeToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.menuModeStandard,
this.menuModeOnTop,
this.menuModeClickThrough});
this.modeToolStripMenuItem.Name = "modeToolStripMenuItem";
this.modeToolStripMenuItem.Size = new System.Drawing.Size(185, 22);
this.modeToolStripMenuItem.Text = "Mode";
this.modeToolStripMenuItem.DropDownOpening += new System.EventHandler(this.Menu_Mode_opening);
//
// menuModeStandard
//
this.menuModeStandard.Name = "menuModeStandard";
this.menuModeStandard.Size = new System.Drawing.Size(152, 22);
this.menuModeStandard.Text = "Standard";
this.menuModeStandard.Click += new System.EventHandler(this.Menu_Mode_standard);
//
// menuModeOnTop
//
this.menuModeOnTop.Name = "menuModeOnTop";
this.menuModeOnTop.Size = new System.Drawing.Size(152, 22);
this.menuModeOnTop.Text = "Always on top";
this.menuModeOnTop.Click += new System.EventHandler(this.Menu_Mode_ontop);
//
// menuModeClickThrough
//
this.menuModeClickThrough.Name = "menuModeClickThrough";
this.menuModeClickThrough.Size = new System.Drawing.Size(152, 22);
this.menuModeClickThrough.Text = "Click through";
this.menuModeClickThrough.Click += new System.EventHandler(this.Menu_Mode_clickthrough);
//
// opacityToolStripMenuItem
//
this.opacityToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.menuOpacity100,
this.menuOpacity75,
this.menuOpacity50,
this.menuOpacity25});
this.opacityToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.window_opacity16;
this.opacityToolStripMenuItem.Name = "opacityToolStripMenuItem";
this.opacityToolStripMenuItem.Size = new System.Drawing.Size(185, 22);
this.opacityToolStripMenuItem.Text = "Opacity";
this.opacityToolStripMenuItem.DropDownOpening += new System.EventHandler(this.Menu_Opacity_opening);
//
// menuOpacity100
//
this.menuOpacity100.Name = "menuOpacity100";
this.menuOpacity100.Size = new System.Drawing.Size(153, 22);
this.menuOpacity100.Text = "100% (opaque)";
this.menuOpacity100.Click += new System.EventHandler(this.Menu_Opacity_100);
//
// menuOpacity75
//
this.menuOpacity75.Name = "menuOpacity75";
this.menuOpacity75.Size = new System.Drawing.Size(153, 22);
this.menuOpacity75.Text = "75%";
this.menuOpacity75.Click += new System.EventHandler(this.Menu_Opacity_75);
//
// menuOpacity50
//
this.menuOpacity50.Name = "menuOpacity50";
this.menuOpacity50.Size = new System.Drawing.Size(153, 22);
this.menuOpacity50.Text = "50%";
this.menuOpacity50.Click += new System.EventHandler(this.Menu_Opacity_50);
//
// menuOpacity25
//
this.menuOpacity25.Name = "menuOpacity25";
this.menuOpacity25.Size = new System.Drawing.Size(153, 22);
this.menuOpacity25.Text = "25%";
this.menuOpacity25.Click += new System.EventHandler(this.Menu_Opacity_25);
//
// quitFullscreenModeToolStripMenuItem
//
this.quitFullscreenModeToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.close_new;
@ -94,13 +175,6 @@
this._thumbnail.Size = new System.Drawing.Size(284, 264);
this._thumbnail.TabIndex = 0;
//
// alwaysOnTopToolStripMenuItem
//
this.alwaysOnTopToolStripMenuItem.Name = "alwaysOnTopToolStripMenuItem";
this.alwaysOnTopToolStripMenuItem.Size = new System.Drawing.Size(185, 22);
this.alwaysOnTopToolStripMenuItem.Text = Strings.FullscreenAlwaysOnTop;
this.alwaysOnTopToolStripMenuItem.Click += new System.EventHandler(this.Menu_AlwaysOnTop_click);
//
// FullscreenForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -112,8 +186,7 @@
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "FullscreenForm";
this.Text = Strings.FullscreenTitle;
this.TransparencyKey = System.Drawing.Color.Black;
this.Text = "OnTopReplica fullscreen";
this.menuContext.ResumeLayout(false);
this.menuWindows.ResumeLayout(false);
this.ResumeLayout(false);
@ -127,7 +200,15 @@
private System.Windows.Forms.ToolStripMenuItem windowsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem quitFullscreenModeToolStripMenuItem;
private System.Windows.Forms.ContextMenuStrip menuWindows;
private System.Windows.Forms.ToolStripMenuItem noneToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem alwaysOnTopToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem noneToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem modeToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem menuModeStandard;
private System.Windows.Forms.ToolStripMenuItem menuModeOnTop;
private System.Windows.Forms.ToolStripMenuItem menuModeClickThrough;
private System.Windows.Forms.ToolStripMenuItem opacityToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem menuOpacity100;
private System.Windows.Forms.ToolStripMenuItem menuOpacity75;
private System.Windows.Forms.ToolStripMenuItem menuOpacity50;
private System.Windows.Forms.ToolStripMenuItem menuOpacity25;
}
}

View file

@ -10,26 +10,22 @@ using OnTopReplica.Properties;
namespace OnTopReplica {
public partial class FullscreenForm : Form {
partial class FullscreenForm : Form {
public FullscreenForm() {
InitializeComponent();
_thumbnail.GlassMode = true;
this.TopMost = Settings.Default.FullscreenAlwaysOnTop;
//Set mode
Mode = (Settings.Default.FullscreenAlwaysOnTop) ? FullscreenMode.AlwaysOnTop : FullscreenMode.Normal;
//Set native renderer on context menu
Asztal.Szótár.NativeToolStripRenderer.SetToolStripRenderer(new Control[] {
menuContext, menuWindows
});
/*_cursorTimer = new Timer();
_cursorTimer.Interval = 1000;
_cursorTimer.Tick += new EventHandler(_cursorTimer_Tick);*/
}
//Timer _cursorTimer;
WindowHandle _lastHandle;
WindowManager _manager = new WindowManager(WindowManager.EnumerationMode.TaskWindows);
@ -68,6 +64,12 @@ namespace OnTopReplica {
}
}
public WindowHandle LastWindowHandle {
get {
return _lastHandle;
}
}
#region Event handling
public event EventHandler<CloseRequestEventArgs> CloseRequest;
@ -80,43 +82,6 @@ namespace OnTopReplica {
});
}
/*protected override void OnActivated(EventArgs e) {
_cursorTimer.Start();
base.OnActivated(e);
}
protected override void OnDeactivate(EventArgs e) {
Cursor.Show();
_cursorTimer.Stop();
base.OnDeactivate(e);
}
Point? _lastPos = null;
protected override void OnMouseMove(MouseEventArgs e) {
if (_lastPos.HasValue) {
int distance = 0;
distance += Math.Abs(_lastPos.Value.X - e.X);
distance += Math.Abs(_lastPos.Value.Y - e.Y);
if (distance > 8) {
Cursor.Show();
_cursorTimer.Start();
}
}
_lastPos = e.Location;
base.OnMouseMove(e);
}
void _cursorTimer_Tick(object sender, EventArgs e) {
Cursor.Hide();
_cursorTimer.Stop();
}*/
protected override void OnDoubleClick(EventArgs e) {
OnCloseRequest();
@ -136,44 +101,49 @@ namespace OnTopReplica {
base.OnKeyUp(e);
}
#endregion
protected override void OnClosing(CancelEventArgs e) {
base.OnClosing(e);
#region Click through
bool _clickThrough = false;
public bool ClickThrough {
get {
return _clickThrough;
}
set {
_clickThrough = value;
this.TransparencyKey = (value) ? Color.Black : Color.White;
this.Invalidate();
}
//Never close
OnCloseRequest();
e.Cancel = true;
}
const int WM_NCHITTEST = 0x0084;
const int HTTRANSPARENT = -1;
protected override void OnActivated(EventArgs e) {
base.OnActivated(e);
protected override void WndProc(ref Message m) {
if (_clickThrough && m.Msg == WM_NCHITTEST) {
m.Result = new IntPtr(HTTRANSPARENT);
return;
//Disable "click through" on show: this prevents case in which the user
//cannot return to standard mode closing and re-opening the fullscreen mode
if (Mode == FullscreenMode.ClickThrough)
Mode = (Settings.Default.FullscreenAlwaysOnTop) ? FullscreenMode.AlwaysOnTop : FullscreenMode.Normal;
}
#endregion
#region Mode
FullscreenMode _mode;
public FullscreenMode Mode {
get {
return _mode;
}
set {
_mode = value;
Settings.Default.FullscreenAlwaysOnTop = (value != FullscreenMode.Normal);
base.WndProc(ref m);
//Top most if always on top or click through
this.TopMost = (value != FullscreenMode.Normal);
this.TransparencyKey = (value == FullscreenMode.ClickThrough) ? Color.Black : Color.White;
this.Invalidate();
}
}
#endregion
#region Menus
private void Menu_opening(object sender, CancelEventArgs e) {
alwaysOnTopToolStripMenuItem.Checked = Settings.Default.FullscreenAlwaysOnTop;
}
private void Menu_Windows_opening(object sender, EventArgs e) {
_manager.Refresh(WindowManager.EnumerationMode.TaskWindows);
@ -211,10 +181,48 @@ namespace OnTopReplica {
}
}
private void Menu_AlwaysOnTop_click(object sender, EventArgs e) {
//Switch topmost behavior and store
this.TopMost = Settings.Default.FullscreenAlwaysOnTop
= !Settings.Default.FullscreenAlwaysOnTop;
private void Menu_Mode_opening(object sender, EventArgs e) {
menuModeStandard.Checked = (Mode == FullscreenMode.Normal);
menuModeOnTop.Checked = (Mode == FullscreenMode.AlwaysOnTop);
menuModeClickThrough.Checked = (Mode == FullscreenMode.ClickThrough);
}
private void Menu_Mode_standard(object sender, EventArgs e) {
Mode = FullscreenMode.Normal;
}
private void Menu_Mode_ontop(object sender, EventArgs e) {
Mode = FullscreenMode.AlwaysOnTop;
}
private void Menu_Mode_clickthrough(object sender, EventArgs e) {
if (!CheckFirstTimeClickThrough())
return;
Mode = FullscreenMode.ClickThrough;
}
private void Menu_Opacity_100(object sender, EventArgs e) {
this.Opacity = 1.0;
}
private void Menu_Opacity_75(object sender, EventArgs e) {
this.Opacity = 0.75;
}
private void Menu_Opacity_50(object sender, EventArgs e) {
this.Opacity = 0.5;
}
private void Menu_Opacity_25(object sender, EventArgs e) {
this.Opacity = 0.25;
}
private void Menu_Opacity_opening(object sender, EventArgs e) {
menuOpacity100.Checked = (Opacity == 1.0);
menuOpacity75.Checked = (Opacity == 0.75);
menuOpacity50.Checked = (Opacity == 0.5);
menuOpacity25.Checked = (Opacity == 0.25);
}
private void Menu_Quit_click(object sender, EventArgs e) {
@ -223,6 +231,31 @@ namespace OnTopReplica {
#endregion
/// <summary>Check if the user uses click-through for the first time and asks confirmation.</summary>
/// <returns>Returns whether to switch to click through mode or not.</returns>
private bool CheckFirstTimeClickThrough() {
if (Settings.Default.FirstTimeClickThrough) {
//Alert the user about click through
TaskDialog dlg = new TaskDialog(Strings.InfoClickThrough, Strings.InfoClickThroughTitle, Strings.InfoClickThroughInformation);
dlg.CommonIcon = TaskDialogIcon.Information;
dlg.ExpandedControlText = Strings.ErrorDetailButton;
dlg.ExpandedInformation = Strings.InfoClickThroughDetails;
dlg.UseCommandLinks = true;
dlg.CustomButtons = new CustomButton[] {
new CustomButton(Result.Yes, Strings.InfoClickThroughOk),
new CustomButton(Result.No, Strings.InfoClickThroughNo)
};
var result = dlg.Show(this);
return result.CommonButton == Result.Yes;
//Settings.Default.ClickThrough = (dlg.Show(this).CommonButton == Result.Yes);
}
Settings.Default.FirstTimeClickThrough = false;
return true;
}
}
}

View file

@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OnTopReplica {
enum FullscreenMode {
Normal,
AlwaysOnTop,
ClickThrough
}
}

View file

@ -50,7 +50,6 @@
this.quarterToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.fullscreenToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.clickThroughToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.dockToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.topLeftToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.topRightToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -171,7 +170,7 @@
this.menuOpacity.OwnerItem = this.menuContextOpacity;
this.menuOpacity.ShowCheckMargin = true;
this.menuOpacity.ShowImageMargin = false;
this.menuOpacity.Size = new System.Drawing.Size(154, 120);
this.menuOpacity.Size = new System.Drawing.Size(154, 142);
this.menuOpacity.Opening += new System.ComponentModel.CancelEventHandler(this.Menu_Opacity_opening);
//
// toolStripMenuItem1
@ -180,7 +179,7 @@
this.toolStripMenuItem1.CheckState = System.Windows.Forms.CheckState.Checked;
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(153, 22);
this.toolStripMenuItem1.Tag = 255;
this.toolStripMenuItem1.Tag = 1.0;
this.toolStripMenuItem1.Text = global::OnTopReplica.Strings.MenuOp100;
this.toolStripMenuItem1.ToolTipText = global::OnTopReplica.Strings.MenuOp100TT;
this.toolStripMenuItem1.Click += new System.EventHandler(this.Menu_Opacity_click);
@ -189,7 +188,7 @@
//
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(153, 22);
this.toolStripMenuItem2.Tag = 190;
this.toolStripMenuItem2.Tag = 0.75;
this.toolStripMenuItem2.Text = global::OnTopReplica.Strings.MenuOp75;
this.toolStripMenuItem2.ToolTipText = global::OnTopReplica.Strings.MenuOp75TT;
this.toolStripMenuItem2.Click += new System.EventHandler(this.Menu_Opacity_click);
@ -198,7 +197,7 @@
//
this.toolStripMenuItem3.Name = "toolStripMenuItem3";
this.toolStripMenuItem3.Size = new System.Drawing.Size(153, 22);
this.toolStripMenuItem3.Tag = 128;
this.toolStripMenuItem3.Tag = 0.5;
this.toolStripMenuItem3.Text = global::OnTopReplica.Strings.MenuOp50;
this.toolStripMenuItem3.ToolTipText = global::OnTopReplica.Strings.MenuOp50TT;
this.toolStripMenuItem3.Click += new System.EventHandler(this.Menu_Opacity_click);
@ -207,7 +206,7 @@
//
this.toolStripMenuItem4.Name = "toolStripMenuItem4";
this.toolStripMenuItem4.Size = new System.Drawing.Size(153, 22);
this.toolStripMenuItem4.Tag = 64;
this.toolStripMenuItem4.Tag = 0.25;
this.toolStripMenuItem4.Text = global::OnTopReplica.Strings.MenuOp25;
this.toolStripMenuItem4.ToolTipText = global::OnTopReplica.Strings.MenuOp25TT;
this.toolStripMenuItem4.Click += new System.EventHandler(this.Menu_Opacity_click);
@ -243,11 +242,9 @@
this.halfToolStripMenuItem1,
this.quarterToolStripMenuItem1,
this.toolStripSeparator3,
this.fullscreenToolStripMenuItem1,
this.clickThroughToolStripMenuItem});
this.fullscreenToolStripMenuItem1});
this.menuResize.Name = "menuResize";
this.menuResize.OwnerItem = this.resizeToolStripMenuItem;
this.menuResize.Size = new System.Drawing.Size(165, 164);
this.menuResize.Size = new System.Drawing.Size(165, 120);
this.menuResize.Opening += new System.ComponentModel.CancelEventHandler(this.Menu_Resize_opening);
//
// doubleToolStripMenuItem1
@ -290,16 +287,6 @@
this.fullscreenToolStripMenuItem1.Text = global::OnTopReplica.Strings.MenuFitFullscreen;
this.fullscreenToolStripMenuItem1.Click += new System.EventHandler(this.Menu_Resize_Fullscreen);
//
// clickThroughToolStripMenuItem
//
this.clickThroughToolStripMenuItem.Checked = true;
this.clickThroughToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.clickThroughToolStripMenuItem.Name = "clickThroughToolStripMenuItem";
this.clickThroughToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
this.clickThroughToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuResizeClickThrough;
this.clickThroughToolStripMenuItem.ToolTipText = global::OnTopReplica.Strings.MenuResizeClickThroughTT;
this.clickThroughToolStripMenuItem.Click += new System.EventHandler(this.Menu_Resize_ClickThrough);
//
// dockToolStripMenuItem
//
this.dockToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -530,8 +517,7 @@
private System.Windows.Forms.ToolStripMenuItem halfToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem quarterToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem fullscreenToolStripMenuItem1;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
private System.Windows.Forms.ToolStripMenuItem clickThroughToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
private System.Windows.Forms.ToolStripMenuItem forwardClicksToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem languageToolStripMenuItem;
private System.Windows.Forms.ContextMenuStrip menuLanguages;

View file

@ -11,7 +11,6 @@ namespace OnTopReplica
public partial class MainForm : AspectRatioForm
{
//Visualization status
byte _lastOpacity = 255;
bool _clickForwarding = false;
//GUI
@ -80,13 +79,7 @@ namespace OnTopReplica
void FullscreenForm_CloseRequest(object sender, CloseRequestEventArgs e) {
if (_isFullscreen) {
var regionContainer = (e.LastRegion != null) ?
new StoredRegion { Rect = e.LastRegion.Value } : null;
//Update handle to match the one selected in fullscreen mode
ThumbnailSet(e.LastWindowHandle, regionContainer);
ToggleFullscreen();
ToggleFullscreen();
}
}
@ -320,6 +313,7 @@ namespace OnTopReplica
Size = MinimumSize;
Show();
_fullscreenForm.Hide();
}
}
@ -458,7 +452,7 @@ namespace OnTopReplica
};
foreach (ToolStripMenuItem i in items) {
if ((int)i.Tag == _lastOpacity)
if ((double)i.Tag == this.Opacity)
i.Checked = true;
else
i.Checked = false;
@ -474,13 +468,7 @@ namespace OnTopReplica
if (tsi != null) {
//Get opacity from the tag
int op = (int)tsi.Tag;
//Store new opacity
_lastOpacity = (byte)op;
//Set the window's opacity
this.Opacity = (double)op / 255.0;
this.Opacity = (double)tsi.Tag;
}
}
@ -496,9 +484,7 @@ namespace OnTopReplica
if (!_thumbnailPanel.IsShowingThumbnail)
e.Cancel = true;
//autofitOnResizeToolStripMenuItem.Checked = Settings.Default.AutoFitOnResize;
recallLastPositionAndSizeToolStripMenuItem.Checked = Settings.Default.StoreWindowPosition;
clickThroughToolStripMenuItem.Checked = Settings.Default.ClickThrough;
}
private void Menu_Resize_Double(object sender, EventArgs e) {
@ -521,14 +507,6 @@ namespace OnTopReplica
ToggleFullscreen();
}
private void Menu_Resize_ClickThrough(object sender, EventArgs e) {
Settings.Default.ClickThrough = !Settings.Default.ClickThrough;
}
/*private void Menu_Resize_Autofit_click(object sender, EventArgs e) {
Settings.Default.AutoFitOnResize = !Settings.Default.AutoFitOnResize;
}*/
private void Menu_Position_Recall_click(object sender, EventArgs e) {
Settings.Default.StoreWindowPosition = !Settings.Default.StoreWindowPosition;
}
@ -660,9 +638,22 @@ namespace OnTopReplica
private void ToggleFullscreen() {
if (_isFullscreen) {
_fullscreenForm.Visible = false;
//Update thumbnail
if (_fullscreenForm.LastWindowHandle != null) {
StoredRegion region = null;
if(_fullscreenForm.ShowRegion)
region = new StoredRegion { Rect = _fullscreenForm.ShownRegion };
this.Visible = true;
ThumbnailSet(_fullscreenForm.LastWindowHandle, region);
}
else
ThumbnailUnset();
//Update properties
this.Opacity = _fullscreenForm.Opacity;
_fullscreenForm.Hide();
this.Show();
}
else {
if (_lastWindowHandle == null) {
@ -670,44 +661,18 @@ namespace OnTopReplica
return;
}
CheckFirstTimeClickThrough();
_fullscreenForm.DisplayFullscreen(Screen.FromControl(this), _lastWindowHandle);
_fullscreenForm.ShownRegion = _thumbnailPanel.ShownRegion;
_fullscreenForm.ShowRegion = _thumbnailPanel.ShowRegion;
_fullscreenForm.Opacity = this.Opacity;
//Enable click through if it is enabled and opacity is less than 255 (opaque)
_fullscreenForm.ClickThrough = (Settings.Default.ClickThrough && _lastOpacity < 255);
_fullscreenForm.Visible = true;
this.Visible = false;
_fullscreenForm.Show();
this.Hide();
}
_isFullscreen = !_isFullscreen;
}
/// <summary>Check if the user uses click-through for the first time and asks confirmation.</summary>
private void CheckFirstTimeClickThrough() {
if (Settings.Default.FirstTimeClickThrough && _lastOpacity < 255) {
//Alert the user about click through
TaskDialog dlg = new TaskDialog(Strings.InfoClickThrough, Strings.InfoClickThroughTitle, Strings.InfoClickThroughInformation);
dlg.CommonIcon = TaskDialogIcon.Information;
dlg.ExpandedControlText = Strings.ErrorDetailButton;
dlg.ExpandedInformation = Strings.InfoClickThroughDetails;
dlg.UseCommandLinks = true;
dlg.CustomButtons = new CustomButton[] {
new CustomButton(Result.Yes, Strings.InfoClickThroughOk),
new CustomButton(Result.No, Strings.InfoClickThroughNo)
};
Settings.Default.ClickThrough = (dlg.Show(this).CommonButton == Result.Yes);
}
Settings.Default.FirstTimeClickThrough = false;
}
#endregion
#region Thumbnail operation

View file

@ -49,8 +49,8 @@
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.htm</WebPage>
<OpenBrowserOnPublish>false</OpenBrowserOnPublish>
<ApplicationRevision>2</ApplicationRevision>
<ApplicationVersion>2.8.2.%2a</ApplicationVersion>
<ApplicationRevision>1</ApplicationRevision>
<ApplicationVersion>2.9.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
@ -106,6 +106,7 @@
</Compile>
<Compile Include="CloneClickEventArgs.cs" />
<Compile Include="CloseRequestEventArgs.cs" />
<Compile Include="FullscreenMode.cs" />
<Compile Include="Strings.it.Designer.cs">
<DependentUpon>Strings.it.resx</DependentUpon>
<AutoGen>True</AutoGen>

View file

@ -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.8.2.0")]
[assembly: AssemblyFileVersion("2.8.2.0")]
[assembly: AssemblyVersion("2.9.0.0")]
[assembly: AssemblyFileVersion("2.9.0.0")]