Fixed: window is now visible in ALT+TAB when in fullscreen mode (on Windows 7).

This commit is contained in:
Lorenz Cuno Klopfenstein 2010-09-23 23:23:20 +02:00
commit b45066f0d5
145 changed files with 13066 additions and 0 deletions

7
.hgignore Normal file
View file

@ -0,0 +1,7 @@
glob:OnTopReplica.suo
glob:bin/*
glob:obj/*
glob:publish/*
glob:OnTopReplica/Assets/Thumbs.db
glob:*.psd
glob:Installer/OnTopReplica-Setup.exe

BIN
Installer/header.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

112
Installer/script.nsi Normal file
View file

@ -0,0 +1,112 @@
# INCLUDES
!include MUI2.nsh ;Modern interface
!include LogicLib.nsh ;nsDialogs
# INIT
Name "OnTopReplica"
InstallDir "$LOCALAPPDATA\OnTopReplica"
OutFile "OnTopReplica-Setup.exe"
RequestExecutionLevel user
# REFS
!define REG_UNINSTALL "Software\Microsoft\Windows\CurrentVersion\Uninstall\OnTopReplica"
!define START_LINK_DIR "$STARTMENU\Programs\OnTopReplica"
!define START_LINK_RUN "$STARTMENU\Programs\OnTopReplica\OnTopReplica.lnk"
!define START_LINK_UNINSTALLER "$STARTMENU\Programs\OnTopReplica\Uninstall OnTopReplica.lnk"
!define UNINSTALLER_NAME "OnTopReplica-Uninstall.exe"
!define WEBSITE_LINK "http://www.klopfenstein.net/lorenz.aspx/ontopreplica"
# GRAPHICS
!define MUI_ICON "..\OnTopReplica\Assets\icon-new.ico"
!define MUI_UNICON "..\OnTopReplica\Assets\icon-new-red.ico"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_RIGHT
!define MUI_HEADERIMAGE_BITMAP "header.bmp"
!define MUI_HEADERIMAGE_UNBITMAP "header.bmp"
#!define MUI_WELCOMEFINISHPAGE_BITMAP "banner.bmp"
#!define MUI_UNWELCOMEFINISHPAGE_BITMAP "banner.bmp"
# TEXT AND SETTINGS
!define MUI_PAGE_HEADER_TEXT "OnTopReplica"
!define MUI_FINISHPAGE_RUN "$INSTDIR\OnTopReplica.exe"
;!define MUI_FINISHPAGE_RUN_TEXT "Run OnTopReplica now."
;Do not skip to finish automatially
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_UNFINISHPAGE_NOAUTOCLOSE
# PAGE DEFINITIONS
!insertmacro MUI_PAGE_WELCOME
;!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
# LANGUAGES
!insertmacro MUI_LANGUAGE "English"
# CALLBACKS
Function RegisterApplication
;Register uninstaller into Add/Remove panel (for local user only)
WriteRegStr HKCU "${REG_UNINSTALL}" "DisplayName" "OnTopReplica"
WriteRegStr HKCU "${REG_UNINSTALL}" "DisplayIcon" "$\"$INSTDIR\OnTopReplica.exe$\""
WriteRegStr HKCU "${REG_UNINSTALL}" "Publisher" "Lorenz Cuno Klopfenstein"
WriteRegStr HKCU "${REG_UNINSTALL}" "DisplayVersion" "3.1.0.0"
WriteRegDWord HKCU "${REG_UNINSTALL}" "EstimatedSize" 800 ;KB
WriteRegStr HKCU "${REG_UNINSTALL}" "HelpLink" "${WEBSITE_LINK}"
WriteRegStr HKCU "${REG_UNINSTALL}" "URLInfoAbout" "${WEBSITE_LINK}"
WriteRegStr HKCU "${REG_UNINSTALL}" "InstallLocation" "$\"$INSTDIR$\""
WriteRegStr HKCU "${REG_UNINSTALL}" "InstallSource" "$\"$EXEDIR$\""
WriteRegDWord HKCU "${REG_UNINSTALL}" "NoModify" 1
WriteRegDWord HKCU "${REG_UNINSTALL}" "NoRepair" 1
WriteRegStr HKCU "${REG_UNINSTALL}" "UninstallString" "$\"$INSTDIR\${UNINSTALLER_NAME}$\""
WriteRegStr HKCU "${REG_UNINSTALL}" "Comments" "Uninstalls OnTopReplica."
;Links
SetShellVarContext current
CreateDirectory "${START_LINK_DIR}"
CreateShortCut "${START_LINK_RUN}" "$INSTDIR\OnTopReplica.exe"
CreateShortCut "${START_LINK_UNINSTALLER}" "$INSTDIR\${UNINSTALLER_NAME}"
FunctionEnd
Function un.DeregisterApplication
;Deregister uninstaller from Add/Remove panel
DeleteRegKey HKCU "${REG_UNINSTALL}"
;Start menu links
SetShellVarContext current
RMDir /r "${START_LINK_DIR}"
FunctionEnd
# INSTALL SECTIONS
Section "!OnTopReplica" OnTopReplica
SectionIn RO
SetOutPath $INSTDIR
SetOverwrite on
File "..\OnTopReplica\bin\Release\OnTopReplica.exe"
File "..\OnTopReplica\bin\Release\VistaControls.dll"
;Install localization files
SetOutPath "$INSTDIR\it"
File "..\OnTopReplica\bin\Release\it\OnTopReplica.resources.dll"
SetOutPath "$INSTDIR\cs"
File "..\OnTopReplica\bin\Release\cs\OnTopReplica.resources.dll"
SetOutPath "$INSTDIR\da"
File "..\OnTopReplica\bin\Release\da\OnTopReplica.resources.dll"
;Uninstaller
WriteUninstaller "$INSTDIR\${UNINSTALLER_NAME}"
Call RegisterApplication
SectionEnd
Section "Uninstall"
;Remove whole directory (no data is stored there anyway)
RMDir /r "$INSTDIR"
;Remove uninstaller
Call un.DeregisterApplication
SectionEnd

6
Installer/update.xml Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<UpdateInformation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<latestVersion>3.1.0.0</latestVersion>
<latestVersionRelease>2010-09-09T00:00:00Z</latestVersionRelease>
<downloadPage>http://www.klopfenstein.net/lorenz.aspx/ontopreplica</downloadPage>
</UpdateInformation>

BIN
Lib/VistaControls.dll Normal file

Binary file not shown.

BIN
Lib/VistaControls.pdb Normal file

Binary file not shown.

1022
Lib/VistaControls.xml Normal file

File diff suppressed because it is too large Load diff

20
OnTopReplica.sln Normal file
View file

@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual C# Express 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OnTopReplica", "OnTopReplica\OnTopReplica.csproj", "{E626BD6E-BF38-4EB7-A128-5CA6F40EF557}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E626BD6E-BF38-4EB7-A128-5CA6F40EF557}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E626BD6E-BF38-4EB7-A128-5CA6F40EF557}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E626BD6E-BF38-4EB7-A128-5CA6F40EF557}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E626BD6E-BF38-4EB7-A128-5CA6F40EF557}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

236
OnTopReplica/AboutForm.Designer.cs generated Normal file
View file

@ -0,0 +1,236 @@
namespace OnTopReplica {
partial class AboutForm {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AboutForm));
this.themedLabel1 = new VistaControls.ThemeText.ThemedLabel();
this.themedLabel2 = new VistaControls.ThemeText.ThemedLabel();
this.panel1 = new System.Windows.Forms.Panel();
this.buttonReset = new System.Windows.Forms.Button();
this.progressBar1 = new VistaControls.ProgressBar();
this.buttonUpdate = new System.Windows.Forms.Button();
this.buttonExpander = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.linkLabel2 = new System.Windows.Forms.LinkLabel();
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
this.label2 = new System.Windows.Forms.Label();
this.webBrowser = new System.Windows.Forms.WebBrowser();
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// themedLabel1
//
this.themedLabel1.Font = new System.Drawing.Font("Segoe UI", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.themedLabel1.Location = new System.Drawing.Point(0, 0);
this.themedLabel1.Name = "themedLabel1";
this.themedLabel1.Padding = new System.Windows.Forms.Padding(10, 0, 0, 0);
this.themedLabel1.Size = new System.Drawing.Size(200, 40);
this.themedLabel1.TabIndex = 0;
this.themedLabel1.Text = "OnTopReplica";
//
// themedLabel2
//
this.themedLabel2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.themedLabel2.Font = new System.Drawing.Font("Segoe UI", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.themedLabel2.GlowSize = 11;
this.themedLabel2.Location = new System.Drawing.Point(200, 0);
this.themedLabel2.Name = "themedLabel2";
this.themedLabel2.Padding = new System.Windows.Forms.Padding(6, 0, 0, 0);
this.themedLabel2.Size = new System.Drawing.Size(189, 40);
this.themedLabel2.TabIndex = 1;
this.themedLabel2.Text = "v2";
//
// panel1
//
this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panel1.BackgroundImage = global::OnTopReplica.Properties.Resources.back;
this.panel1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.panel1.Controls.Add(this.buttonReset);
this.panel1.Controls.Add(this.progressBar1);
this.panel1.Controls.Add(this.buttonUpdate);
this.panel1.Controls.Add(this.buttonExpander);
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.Add(this.linkLabel2);
this.panel1.Controls.Add(this.linkLabel1);
this.panel1.Controls.Add(this.label2);
this.panel1.Location = new System.Drawing.Point(0, 40);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(388, 105);
this.panel1.TabIndex = 10;
//
// buttonReset
//
this.buttonReset.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonReset.Image = global::OnTopReplica.Properties.Resources.refresh;
this.buttonReset.Location = new System.Drawing.Point(338, 79);
this.buttonReset.Name = "buttonReset";
this.buttonReset.Size = new System.Drawing.Size(23, 23);
this.buttonReset.TabIndex = 14;
this.buttonReset.UseVisualStyleBackColor = true;
this.buttonReset.Click += new System.EventHandler(this.ResetClick);
//
// progressBar1
//
this.progressBar1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.progressBar1.Location = new System.Drawing.Point(235, 79);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(102, 23);
this.progressBar1.Style = System.Windows.Forms.ProgressBarStyle.Marquee;
this.progressBar1.TabIndex = 3;
this.progressBar1.Visible = false;
//
// buttonUpdate
//
this.buttonUpdate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonUpdate.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.buttonUpdate.Image = global::OnTopReplica.Properties.Resources.xiao_component;
this.buttonUpdate.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.buttonUpdate.Location = new System.Drawing.Point(235, 79);
this.buttonUpdate.Name = "buttonUpdate";
this.buttonUpdate.Size = new System.Drawing.Size(102, 23);
this.buttonUpdate.TabIndex = 2;
this.buttonUpdate.Text = global::OnTopReplica.Strings.UpdateNow;
this.buttonUpdate.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
this.buttonUpdate.UseVisualStyleBackColor = true;
this.buttonUpdate.Click += new System.EventHandler(this.Update_click);
//
// buttonExpander
//
this.buttonExpander.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonExpander.Image = global::OnTopReplica.Properties.Resources.xiao_down;
this.buttonExpander.Location = new System.Drawing.Point(362, 79);
this.buttonExpander.Name = "buttonExpander";
this.buttonExpander.Size = new System.Drawing.Size(23, 23);
this.buttonExpander.TabIndex = 4;
this.buttonExpander.UseVisualStyleBackColor = true;
this.buttonExpander.Click += new System.EventHandler(this.Toggle_click);
//
// label1
//
this.label1.BackColor = System.Drawing.Color.Transparent;
this.label1.Font = new System.Drawing.Font("Segoe UI", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(6, 75);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(199, 31);
this.label1.TabIndex = 13;
this.label1.Text = "OnTopReplica automatically checks for updates. No information is logged at any po" +
"int.";
//
// linkLabel2
//
this.linkLabel2.AutoSize = true;
this.linkLabel2.BackColor = System.Drawing.Color.Transparent;
this.linkLabel2.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.linkLabel2.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline;
this.linkLabel2.Location = new System.Drawing.Point(7, 58);
this.linkLabel2.Name = "linkLabel2";
this.linkLabel2.Size = new System.Drawing.Size(252, 21);
this.linkLabel2.TabIndex = 1;
this.linkLabel2.TabStop = true;
this.linkLabel2.Text = "Homepage: www.codeplex.com/ontopreplica.";
this.linkLabel2.UseCompatibleTextRendering = true;
this.linkLabel2.VisitedLinkColor = System.Drawing.Color.Blue;
//
// linkLabel1
//
this.linkLabel1.AutoSize = true;
this.linkLabel1.BackColor = System.Drawing.Color.Transparent;
this.linkLabel1.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.linkLabel1.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline;
this.linkLabel1.LinkColor = System.Drawing.Color.Blue;
this.linkLabel1.Location = new System.Drawing.Point(7, 37);
this.linkLabel1.Name = "linkLabel1";
this.linkLabel1.Size = new System.Drawing.Size(212, 21);
this.linkLabel1.TabIndex = 0;
this.linkLabel1.TabStop = true;
this.linkLabel1.Text = "Created by: Lorenz Cuno Klopfenstein.";
this.linkLabel1.UseCompatibleTextRendering = true;
this.linkLabel1.VisitedLinkColor = System.Drawing.Color.Blue;
//
// label2
//
this.label2.BackColor = System.Drawing.Color.Transparent;
this.label2.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(7, 4);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(287, 33);
this.label2.TabIndex = 10;
this.label2.Text = "A lightweight, real-time, always on top thumbnail of a window of your choice.";
//
// webBrowser
//
this.webBrowser.AllowWebBrowserDrop = false;
this.webBrowser.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.webBrowser.Location = new System.Drawing.Point(0, 146);
this.webBrowser.MinimumSize = new System.Drawing.Size(20, 20);
this.webBrowser.Name = "webBrowser";
this.webBrowser.ScriptErrorsSuppressed = true;
this.webBrowser.Size = new System.Drawing.Size(389, 200);
this.webBrowser.TabIndex = 14;
//
// AboutForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.ClientSize = new System.Drawing.Size(389, 145);
this.Controls.Add(this.webBrowser);
this.Controls.Add(this.themedLabel2);
this.Controls.Add(this.themedLabel1);
this.Controls.Add(this.panel1);
this.DoubleBuffered = true;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
this.HideTitle = true;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.Name = "AboutForm";
this.Text = "OnTopReplica";
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private VistaControls.ThemeText.ThemedLabel themedLabel1;
private VistaControls.ThemeText.ThemedLabel themedLabel2;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button buttonExpander;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.LinkLabel linkLabel2;
private System.Windows.Forms.LinkLabel linkLabel1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button buttonUpdate;
private System.Windows.Forms.WebBrowser webBrowser;
private System.Windows.Forms.Button buttonReset;
private VistaControls.ProgressBar progressBar1;
private System.Windows.Forms.ToolTip toolTip;
}
}

153
OnTopReplica/AboutForm.cs Normal file
View file

@ -0,0 +1,153 @@
using System.Diagnostics;
using System.Windows.Forms;
using VistaControls.Dwm.Helpers;
using System.Drawing;
using System.Runtime.InteropServices;
using OnTopReplica.Properties;
using System.Deployment.Application;
using System;
using VistaControls.TaskDialog;
using System.ComponentModel;
using OnTopReplica.Update;
namespace OnTopReplica {
public partial class AboutForm : GlassForm {
public AboutForm() {
InitializeComponent();
//Tooltips
toolTip.SetToolTip(buttonExpander, Strings.AboutButtonExpanderTT);
toolTip.SetToolTip(buttonReset, Strings.AboutButtonResetTT);
toolTip.SetToolTip(buttonUpdate, Strings.AboutButtonUpdateTT);
//Add link areas (localized text)
linkLabel1.LinkArea = new LinkArea(linkLabel1.Text.IndexOf("Lorenz Cuno Klopfenstein"), "Lorenz Cuno Klopfenstein".Length);
int linkStart = linkLabel2.Text.IndexOf("www");
linkLabel2.LinkArea = new LinkArea(linkStart, linkLabel2.Text.Length - linkStart - 1);
//Glassify
GlassEnabled = true;
GlassMargins = new VistaControls.Dwm.Margins(0, 0, themedLabel1.Size.Height, 0);
//Update title
themedLabel2.Text = "v" + Application.ProductVersion.Substring(0, 3);
//Add update event handling
_updateManager.UpdateCheckCompleted += new EventHandler<UpdateCheckCompletedEventArgs>(UpdateManager_UpdateCheckCompleted);
}
protected override void OnKeyUp(KeyEventArgs e) {
if (e.KeyCode == Keys.Escape)
this.Close();
base.OnKeyUp(e);
}
private void Lck_click(object sender, LinkLabelLinkClickedEventArgs e) {
Process.Start("http://lorenz.klopfenstein.net");
}
private void Homepage_click(object sender, LinkLabelLinkClickedEventArgs e) {
Process.Start("http://www.codeplex.com/ontopreplica");
}
private void ShowGenericError(string title, string mainContent, Exception ex) {
TaskDialog.Show(mainContent, title, ex.Message, TaskDialogButton.Close, TaskDialogIcon.Stop);
}
#region Bottom toggler
private void Toggle_click(object sender, System.EventArgs e) {
IsExpanded = !IsExpanded;
//Update icon
buttonExpander.Image = IsExpanded ? Resources.xiao_up : Resources.xiao_down;
}
bool _isExpanded = false;
bool _isFirstExpansion = true;
public bool IsExpanded {
get { return _isExpanded; }
set {
if(_isExpanded != value)
Size = new Size(Size.Width, Size.Height + ((value) ? webBrowser.Size.Height : -webBrowser.Size.Height));
_isExpanded = value;
if (value && _isFirstExpansion) {
//Load text from resources
webBrowser.DocumentText = Strings.AboutDetails;
//Register navigation events
webBrowser.Navigating += new WebBrowserNavigatingEventHandler(webBrowser1_Navigating);
_isFirstExpansion = false;
}
}
}
void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e) {
if (e.Url != null && e.Url.IsAbsoluteUri) {
Process.Start(e.Url.ToString());
e.Cancel = true;
}
}
#endregion
#region Updating
UpdateManager _updateManager = new UpdateManager();
private void Update_click(object sender, System.EventArgs e) {
CheckForUpdate();
}
delegate void GuiAction();
void UpdateManager_UpdateCheckCompleted(object sender, UpdateCheckCompletedEventArgs e) {
Invoke(new GuiAction(() => {
if (e.Success) {
_updateManager.HandleUpdateCheck(this, e.Information, true);
}
else {
var dlg = new TaskDialog(Strings.ErrorUpdate, Strings.ErrorUpdate, Strings.ErrorUpdateContentGeneric) {
CommonIcon = TaskDialogIcon.Stop,
CommonButtons = TaskDialogButton.OK
};
dlg.Show(this);
}
UpdateStopped();
}));
}
public void CheckForUpdate() {
//Update GUI
buttonUpdate.Visible = false;
progressBar1.Visible = true;
_updateManager.CheckForUpdate();
}
void UpdateStopped() {
//Reset UI
progressBar1.Visible = false;
buttonUpdate.Visible = true;
}
#endregion
private void ResetClick(object sender, EventArgs e) {
var dlg = new TaskDialog(Strings.AskSettingReset, Strings.AskSettingResetTitle,
Strings.AskSettingResetContent);
dlg.CommonButtons = TaskDialogButton.OK | TaskDialogButton.Cancel;
if (dlg.Show(this).CommonButton == Result.OK) {
Settings.Default.Reset();
}
}
}
}

309
OnTopReplica/AboutForm.resx Normal file
View file

@ -0,0 +1,309 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAIAMDAAAAEAIACoJQAAJgAAABAQAAABACAAaAQAAM4lAAAoAAAAMAAAAGAAAAABACAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAYAAAAOAAAAFwAAACAAAAAnAAAAKwAAACwAAAAsAAAALAAA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Ff9idRD/eoQK/4qM
C/+CggT/mJYF/5iVBv+WkAX/jIQF/4J4BP92bgP/h4AR/6ajjcYGBgljGRYcUJaif9ZYgA//YHAM/3d/
CP+Ghwv/gIAE/5mVBv+UjQb/kogG/4h9BP99cwT/cGsB/4B+D/+joYzGBgYKYxoXHVCWoH7XU3cG/1tq
Bf9yeAL/fX4I/317AP+TjgH/ioIB/4p+Af+AdQD/dWwA/21pAP90cgn/oJ2MyAcHCmQaGB1RoaiK1maC
HP9teh3/gYYb/4mKIf+Nixr/m5Yb/5KKG/+Uihv/i4Eb/4F7Gv9+exf/fHoi/6WilMcHBwpjBgYHMXp5
dKCcnZG2mZiNtJqZjbWZl4yzmJaIsJiWiLCYlYiwmZaJsZmVirGYlYqylpSJs5mXjbRqaGadAQEBPQAA
AAUAAAAeAAAAKgAAACkAAAApAAAAKQAAACkAAAApAAAAKQAAACkAAAApAAAAKQAAACkAAAArAAAAIwAA
AAoAAKxBAACsQQAArEEAAKxBAACsQQAArEEAAKxBAACsQQAArEEAAKxBAACsQQAArEEAAKxBAACsQQAA
rEEAAKxB
</value>
</data>
</root>

View file

@ -0,0 +1,214 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using VistaControls.Dwm.Helpers;
using System.ComponentModel;
using OnTopReplica.Native;
using System.Drawing;
namespace OnTopReplica {
/// <summary>
/// Form that automatically keeps a certain aspect ratio and resizes without flickering.
/// </summary>
public class AspectRatioForm : GlassForm {
bool _keepAspectRatio = true;
/// <summary>
/// Gets or sets whether the form should keep its aspect ratio.
/// </summary>
[Description("Enables fixed aspect ratio for this form."), Category("Appearance"), DefaultValue(true)]
public bool KeepAspectRatio {
get {
return _keepAspectRatio;
}
set {
_keepAspectRatio = value;
if (value)
RefreshAspectRatio();
}
}
double _aspectRatio = 1.0;
/// <summary>
/// Gets or sets the form's aspect ratio that will be kept automatically when resizing.
/// </summary>
[Description("Determines this form's fixed aspect ratio."), Category("Appearance"), DefaultValue(1.0)]
public double AspectRatio {
get {
return _aspectRatio;
}
set {
if (value <= 0.0 || Double.IsInfinity(value))
return;
_aspectRatio = value;
}
}
Padding _extraPadding;
/// <summary>
/// Gets or sets some additional internal padding of the form that is ignored when keeping the aspect ratio.
/// </summary>
[Description("Sets some padding inside the form's client area that is ignored when keeping the aspect ratio."),
Category("Appearance")]
public Padding ExtraPadding {
get {
return _extraPadding;
}
set {
_extraPadding = value;
if(KeepAspectRatio)
RefreshAspectRatio();
}
}
/// <summary>
/// Forces the form to update its height based on the current aspect ratio setting.
/// </summary>
public void RefreshAspectRatio() {
int newWidth = ClientSize.Width;
int newHeight = (int)((ClientSize.Width - ExtraPadding.Horizontal) / AspectRatio) + ExtraPadding.Vertical;
if (newHeight < FromSizeToClientSize(MinimumSize).Height) {
newHeight = FromSizeToClientSize(MinimumSize).Height;
newWidth = (int)((newHeight - ExtraPadding.Vertical) * AspectRatio) + ExtraPadding.Horizontal;
}
ClientSize = new Size(newWidth, newHeight);
}
/// <summary>
/// Adjusts the size of the form by a pixel increment while keeping its aspect ratio.
/// </summary>
/// <param name="pixelIncrement">Change of size in pixels.</param>
public void AdjustSize(int pixelOffset) {
Size origSize = Size;
//Resize to new width (clamped to max allowed size and minimum form size)
int newWidth = Math.Max(Math.Min(origSize.Width + pixelOffset,
SystemInformation.MaxWindowTrackSize.Width),
MinimumSize.Width);
//Determine new height while keeping aspect ratio
int newHeight = (int)((newWidth - ExtraPadding.Horizontal - clientSizeConversionWidth) / AspectRatio) + ExtraPadding.Vertical + clientSizeConversionHeight;
//Apply and move form to recenter
Size = new Size(newWidth, newHeight);
int deltaX = Size.Width - origSize.Width;
int deltaY = Size.Height - origSize.Height;
Location = new System.Drawing.Point(Location.X - (deltaX / 2), Location.Y - (deltaY / 2));
}
/// <summary>
/// Updates the aspect ratio of the form and optionally forces a refresh.
/// </summary>
/// <param name="aspectRatioSource">Size from which aspect ratio should be computed.</param>
/// <param name="forceRefresh">True if the size of the form should be refreshed to match the new aspect ratio.</param>
public void SetAspectRatio(Size aspectRatioSource, bool forceRefresh) {
AspectRatio = ((double)aspectRatioSource.Width / (double)aspectRatioSource.Height);
if (forceRefresh) {
KeepAspectRatio = true;
}
}
#region Event overriding
protected override void OnResizeEnd(EventArgs e) {
base.OnResizeEnd(e);
//Ensure that the ClientSize of the form is always respected
//(not ensured by the WM_SIZING message alone because of rounding errors and the chrome space)
if (KeepAspectRatio) {
var newHeight = (int)Math.Round(((ClientSize.Width - ExtraPadding.Horizontal) / AspectRatio) + ExtraPadding.Vertical);
ClientSize = new Size(ClientSize.Width, newHeight);
}
}
/// <summary>
/// Override WM_SIZING message to restrict resizing.
/// Taken from: http://www.vcskicks.com/maintain-aspect-ratio.php
/// Improved with code from: http://stoyanoff.info/blog/2010/06/27/resizing-forms-while-keeping-aspect-ratio/
/// </summary>
protected override void WndProc(ref Message m) {
if (KeepAspectRatio && m.Msg == WM.SIZING) {
var rc = (Native.NRectangle)Marshal.PtrToStructure(m.LParam, typeof(Native.NRectangle));
int res = m.WParam.ToInt32();
int width = (rc.Right - rc.Left) - clientSizeConversionWidth - ExtraPadding.Horizontal;
int height = (rc.Bottom - rc.Top) - clientSizeConversionHeight - ExtraPadding.Vertical;
if (res == WMSZ.LEFT || res == WMSZ.RIGHT) {
//Left or right resize, adjust top and bottom
int targetHeight = (int)(width / AspectRatio);
int diffHeight = height - targetHeight;
rc.Top += (int)(diffHeight / 2.0);
rc.Bottom = rc.Top + targetHeight + ExtraPadding.Vertical + clientSizeConversionHeight;
}
else if (res == WMSZ.TOP || res == WMSZ.BOTTOM) {
//Up or down resize, adjust left and right
int targetWidth = (int)(height * AspectRatio);
int diffWidth = width - targetWidth;
rc.Left += (int)(diffWidth / 2.0);
rc.Right = rc.Left + targetWidth + ExtraPadding.Horizontal + clientSizeConversionWidth;
}
else if (res == WMSZ.RIGHT + WMSZ.BOTTOM || res == WMSZ.LEFT + WMSZ.BOTTOM) {
//Lower corner resize, adjust bottom
rc.Bottom = rc.Top + (int)(width / AspectRatio) + ExtraPadding.Vertical + clientSizeConversionHeight;
}
else if (res == WMSZ.LEFT + WMSZ.TOP || res == WMSZ.RIGHT + WMSZ.TOP) {
//Upper corner resize, adjust top
rc.Top = rc.Bottom - (int)(width / AspectRatio) - ExtraPadding.Vertical - clientSizeConversionHeight;
}
Marshal.StructureToPtr(rc, m.LParam, false);
}
base.WndProc(ref m);
}
#endregion
#region ClientSize/Size conversion helpers
int clientSizeConversionWidth, clientSizeConversionHeight;
/// <summary>
/// Converts a client size measurement to a window size measurement.
/// </summary>
/// <param name="clientSize">Size of the window's client area.</param>
/// <returns>Size of the whole window.</returns>
public Size FromClientSizeToSize(Size clientSize) {
return new Size(clientSize.Width + clientSizeConversionWidth, clientSize.Height + clientSizeConversionHeight);
}
/// <summary>
/// Converts a window size measurement to a client size measurement.
/// </summary>
/// <param name="size">Size of the whole window.</param>
/// <returns>Size of the window's client area.</returns>
public Size FromSizeToClientSize(Size size) {
return new Size(size.Width - clientSizeConversionWidth, size.Height - clientSizeConversionHeight);
}
protected override void OnShown(EventArgs e) {
base.OnShown(e);
clientSizeConversionWidth = Size.Width - ClientSize.Width;
clientSizeConversionHeight = Size.Height - ClientSize.Height;
}
#endregion
}
}

BIN
OnTopReplica/Assets/25.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 639 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 951 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 731 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 794 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 347 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 396 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 837 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 681 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 770 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 862 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 683 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 894 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,012 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 894 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 810 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 456 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 753 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 437 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 715 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 761 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 752 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 752 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 744 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 459 B

View file

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
namespace OnTopReplica {
public class CloneClickEventArgs : EventArgs {
public Point ClientClickLocation { get; set; }
public bool IsDoubleClick { get; set; }
public MouseButtons Buttons { get; set; }
public CloneClickEventArgs(Point location, MouseButtons buttons) {
ClientClickLocation = location;
Buttons = buttons;
IsDoubleClick = false;
}
public CloneClickEventArgs(Point location, MouseButtons buttons, bool doubleClick) {
ClientClickLocation = location;
Buttons = buttons;
IsDoubleClick = doubleClick;
}
}
}

View file

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
namespace OnTopReplica {
public class CloseRequestEventArgs : EventArgs {
public WindowHandle LastWindowHandle { get; set; }
public Rectangle? LastRegion { get; set; }
}
}

View file

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OnTopReplica {
/// <summary>
/// Poor man's LINQ.
/// </summary>
static class EnumerationExtensions {
public static bool Contains<T>(IEnumerable<T> collection, T value){
foreach (var v in collection)
if (v.Equals(value))
return true;
return false;
}
}
}

View file

@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.Text;
using VistaControls;
using System.Windows.Forms;
namespace OnTopReplica {
class FocusedTextBox : System.Windows.Forms.TextBox {
protected override bool IsInputChar(char charCode) {
if (charCode == '\n' || charCode == '\r')
return true;
return base.IsInputChar(charCode);
}
protected override void OnKeyUp(KeyEventArgs e) {
if (e.KeyCode == Keys.Return) {
if(!string.IsNullOrEmpty(Text))
OnConfirmInput();
e.Handled = true;
e.SuppressKeyPress = true;
}
else if (e.KeyCode == Keys.Escape) {
OnAbortInput();
e.Handled = true;
e.SuppressKeyPress = true;
}
//Console.WriteLine("{0} ({1})", e.KeyCode, e.KeyValue);
base.OnKeyUp(e);
}
//List of characters to ignore on KeyPress events (because they generate bell rings)
char[] _ignoreChars = new char[] {
(char)27, (char)13
};
protected override void OnKeyPress(KeyPressEventArgs e) {
if (EnumerationExtensions.Contains(_ignoreChars, e.KeyChar)) {
e.Handled = true;
}
base.OnKeyPress(e);
}
public event EventHandler ConfirmInput;
protected virtual void OnConfirmInput() {
var evt = ConfirmInput;
if (evt != null)
evt(this, EventArgs.Empty);
}
public event EventHandler AbortInput;
protected virtual void OnAbortInput() {
var evt = AbortInput;
if (evt != null)
evt(this, EventArgs.Empty);
}
}
}

View file

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
namespace OnTopReplica {
interface IMessagePumpProcessor : IDisposable {
void Initialize(MainForm form);
bool Process(ref Message msg);
}
}

573
OnTopReplica/MainForm.Designer.cs generated Normal file
View file

@ -0,0 +1,573 @@
namespace OnTopReplica
{
partial class MainForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
this.menuContext = new System.Windows.Forms.ContextMenuStrip(this.components);
this.menuContextWindows = new System.Windows.Forms.ToolStripMenuItem();
this.menuWindows = new System.Windows.Forms.ContextMenuStrip(this.components);
this.noneToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.fullSelectWindowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.switchToWindowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.selectRegionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.advancedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.clickForwardingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.clickThroughToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.groupSwitchModeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuContextOpacity = new System.Windows.Forms.ToolStripMenuItem();
this.menuOpacity = new System.Windows.Forms.ContextMenuStrip(this.components);
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripMenuItem();
this.resizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuResize = new System.Windows.Forms.ContextMenuStrip(this.components);
this.doubleToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.fitToWindowToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.halfToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.quarterToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.fullscreenToolStripMenuItem1 = 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();
this.bottomLeftToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.bottomRightToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.chromeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.reduceToIconToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.languageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuLanguages = new System.Windows.Forms.ContextMenuStrip(this.components);
this.englishToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.cestinaToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.danskToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.italianoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuContextClose = new System.Windows.Forms.ToolStripMenuItem();
this.fullOpacityToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.danskToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuFullscreenContext = new System.Windows.Forms.ContextMenuStrip(this.components);
this.enableClickthroughToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.fullExitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuContext.SuspendLayout();
this.menuWindows.SuspendLayout();
this.menuOpacity.SuspendLayout();
this.menuResize.SuspendLayout();
this.menuLanguages.SuspendLayout();
this.menuFullscreenContext.SuspendLayout();
this.SuspendLayout();
//
// menuContext
//
this.menuContext.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.menuContextWindows,
this.switchToWindowToolStripMenuItem,
this.selectRegionToolStripMenuItem,
this.advancedToolStripMenuItem,
this.menuContextOpacity,
this.resizeToolStripMenuItem,
this.dockToolStripMenuItem,
this.chromeToolStripMenuItem,
this.reduceToIconToolStripMenuItem,
this.toolStripSeparator1,
this.languageToolStripMenuItem,
this.aboutToolStripMenuItem,
this.menuContextClose});
this.menuContext.Name = "menuContext";
this.menuContext.Size = new System.Drawing.Size(169, 296);
this.menuContext.Opening += new System.ComponentModel.CancelEventHandler(this.Menu_opening);
//
// menuContextWindows
//
this.menuContextWindows.DropDown = this.menuWindows;
this.menuContextWindows.Image = global::OnTopReplica.Properties.Resources.list;
this.menuContextWindows.Name = "menuContextWindows";
this.menuContextWindows.Size = new System.Drawing.Size(168, 22);
this.menuContextWindows.Text = global::OnTopReplica.Strings.MenuWindows;
this.menuContextWindows.ToolTipText = global::OnTopReplica.Strings.MenuWindowsTT;
//
// menuWindows
//
this.menuWindows.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.noneToolStripMenuItem});
this.menuWindows.Name = "menuWindows";
this.menuWindows.Size = new System.Drawing.Size(118, 26);
this.menuWindows.Opening += new System.ComponentModel.CancelEventHandler(this.Menu_Windows_opening);
//
// noneToolStripMenuItem
//
this.noneToolStripMenuItem.Name = "noneToolStripMenuItem";
this.noneToolStripMenuItem.Size = new System.Drawing.Size(117, 22);
this.noneToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuWindowsNone;
//
// fullSelectWindowToolStripMenuItem
//
this.fullSelectWindowToolStripMenuItem.DropDown = this.menuWindows;
this.fullSelectWindowToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.list;
this.fullSelectWindowToolStripMenuItem.Name = "fullSelectWindowToolStripMenuItem";
this.fullSelectWindowToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
this.fullSelectWindowToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuWindows;
this.fullSelectWindowToolStripMenuItem.ToolTipText = global::OnTopReplica.Strings.MenuWindowsTT;
//
// switchToWindowToolStripMenuItem
//
this.switchToWindowToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.xiao_arrow;
this.switchToWindowToolStripMenuItem.Name = "switchToWindowToolStripMenuItem";
this.switchToWindowToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
this.switchToWindowToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuSwitch;
this.switchToWindowToolStripMenuItem.ToolTipText = global::OnTopReplica.Strings.MenuSwitchTT;
this.switchToWindowToolStripMenuItem.Click += new System.EventHandler(this.Menu_Switch_click);
//
// selectRegionToolStripMenuItem
//
this.selectRegionToolStripMenuItem.Enabled = false;
this.selectRegionToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.regions;
this.selectRegionToolStripMenuItem.Name = "selectRegionToolStripMenuItem";
this.selectRegionToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
this.selectRegionToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuRegion;
this.selectRegionToolStripMenuItem.ToolTipText = global::OnTopReplica.Strings.MenuRegionTT;
this.selectRegionToolStripMenuItem.Click += new System.EventHandler(this.Menu_Region_click);
//
// advancedToolStripMenuItem
//
this.advancedToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.clickForwardingToolStripMenuItem,
this.clickThroughToolStripMenuItem,
this.groupSwitchModeToolStripMenuItem});
this.advancedToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.xiao_wrench;
this.advancedToolStripMenuItem.Name = "advancedToolStripMenuItem";
this.advancedToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
this.advancedToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuAdvanced;
//
// clickForwardingToolStripMenuItem
//
this.clickForwardingToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.clickforwarding;
this.clickForwardingToolStripMenuItem.Name = "clickForwardingToolStripMenuItem";
this.clickForwardingToolStripMenuItem.Size = new System.Drawing.Size(199, 22);
this.clickForwardingToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuClickForwarding;
this.clickForwardingToolStripMenuItem.ToolTipText = global::OnTopReplica.Strings.MenuClickForwardingTT;
this.clickForwardingToolStripMenuItem.Click += new System.EventHandler(this.Menu_ClickForwarding_click);
//
// clickThroughToolStripMenuItem
//
this.clickThroughToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.window_opacity;
this.clickThroughToolStripMenuItem.Name = "clickThroughToolStripMenuItem";
this.clickThroughToolStripMenuItem.Size = new System.Drawing.Size(199, 22);
this.clickThroughToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuClickThrough;
this.clickThroughToolStripMenuItem.ToolTipText = global::OnTopReplica.Strings.MenuClickThroughTT;
this.clickThroughToolStripMenuItem.Click += new System.EventHandler(this.Menu_ClickThrough_click);
//
// groupSwitchModeToolStripMenuItem
//
this.groupSwitchModeToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.groupmode;
this.groupSwitchModeToolStripMenuItem.Name = "groupSwitchModeToolStripMenuItem";
this.groupSwitchModeToolStripMenuItem.Size = new System.Drawing.Size(199, 22);
this.groupSwitchModeToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuGroupSwitch;
this.groupSwitchModeToolStripMenuItem.ToolTipText = global::OnTopReplica.Strings.MenuGroupSwitchTT;
this.groupSwitchModeToolStripMenuItem.Click += new System.EventHandler(this.Menu_GroupSwitchMode_click);
//
// menuContextOpacity
//
this.menuContextOpacity.DropDown = this.menuOpacity;
this.menuContextOpacity.Image = global::OnTopReplica.Properties.Resources.window_opacity;
this.menuContextOpacity.Name = "menuContextOpacity";
this.menuContextOpacity.Size = new System.Drawing.Size(168, 22);
this.menuContextOpacity.Text = global::OnTopReplica.Strings.MenuOpacity;
//
// menuOpacity
//
this.menuOpacity.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItem1,
this.toolStripMenuItem2,
this.toolStripMenuItem3,
this.toolStripMenuItem4});
this.menuOpacity.Name = "menuOpacity";
this.menuOpacity.ShowCheckMargin = true;
this.menuOpacity.ShowImageMargin = false;
this.menuOpacity.Size = new System.Drawing.Size(154, 92);
this.menuOpacity.Opening += new System.ComponentModel.CancelEventHandler(this.Menu_Opacity_opening);
//
// toolStripMenuItem1
//
this.toolStripMenuItem1.Checked = true;
this.toolStripMenuItem1.CheckState = System.Windows.Forms.CheckState.Checked;
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(153, 22);
this.toolStripMenuItem1.Tag = 1D;
this.toolStripMenuItem1.Text = global::OnTopReplica.Strings.MenuOp100;
this.toolStripMenuItem1.ToolTipText = global::OnTopReplica.Strings.MenuOp100TT;
this.toolStripMenuItem1.Click += new System.EventHandler(this.Menu_Opacity_click);
//
// toolStripMenuItem2
//
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(153, 22);
this.toolStripMenuItem2.Tag = 0.75D;
this.toolStripMenuItem2.Text = global::OnTopReplica.Strings.MenuOp75;
this.toolStripMenuItem2.ToolTipText = global::OnTopReplica.Strings.MenuOp75TT;
this.toolStripMenuItem2.Click += new System.EventHandler(this.Menu_Opacity_click);
//
// toolStripMenuItem3
//
this.toolStripMenuItem3.Name = "toolStripMenuItem3";
this.toolStripMenuItem3.Size = new System.Drawing.Size(153, 22);
this.toolStripMenuItem3.Tag = 0.5D;
this.toolStripMenuItem3.Text = global::OnTopReplica.Strings.MenuOp50;
this.toolStripMenuItem3.ToolTipText = global::OnTopReplica.Strings.MenuOp50TT;
this.toolStripMenuItem3.Click += new System.EventHandler(this.Menu_Opacity_click);
//
// toolStripMenuItem4
//
this.toolStripMenuItem4.Name = "toolStripMenuItem4";
this.toolStripMenuItem4.Size = new System.Drawing.Size(153, 22);
this.toolStripMenuItem4.Tag = 0.25D;
this.toolStripMenuItem4.Text = global::OnTopReplica.Strings.MenuOp25;
this.toolStripMenuItem4.ToolTipText = global::OnTopReplica.Strings.MenuOp25TT;
this.toolStripMenuItem4.Click += new System.EventHandler(this.Menu_Opacity_click);
//
// resizeToolStripMenuItem
//
this.resizeToolStripMenuItem.DropDown = this.menuResize;
this.resizeToolStripMenuItem.Enabled = false;
this.resizeToolStripMenuItem.Name = "resizeToolStripMenuItem";
this.resizeToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
this.resizeToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuResize;
//
// menuResize
//
this.menuResize.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.doubleToolStripMenuItem1,
this.fitToWindowToolStripMenuItem1,
this.halfToolStripMenuItem1,
this.quarterToolStripMenuItem1,
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);
//
// doubleToolStripMenuItem1
//
this.doubleToolStripMenuItem1.Name = "doubleToolStripMenuItem1";
this.doubleToolStripMenuItem1.Size = new System.Drawing.Size(164, 22);
this.doubleToolStripMenuItem1.Text = global::OnTopReplica.Strings.MenuFitDouble;
this.doubleToolStripMenuItem1.Click += new System.EventHandler(this.Menu_Resize_Double);
//
// fitToWindowToolStripMenuItem1
//
this.fitToWindowToolStripMenuItem1.Name = "fitToWindowToolStripMenuItem1";
this.fitToWindowToolStripMenuItem1.Size = new System.Drawing.Size(164, 22);
this.fitToWindowToolStripMenuItem1.Text = global::OnTopReplica.Strings.MenuFitOriginal;
this.fitToWindowToolStripMenuItem1.Click += new System.EventHandler(this.Menu_Resize_FitToWindow);
//
// halfToolStripMenuItem1
//
this.halfToolStripMenuItem1.Name = "halfToolStripMenuItem1";
this.halfToolStripMenuItem1.Size = new System.Drawing.Size(164, 22);
this.halfToolStripMenuItem1.Text = global::OnTopReplica.Strings.MenuFitHalf;
this.halfToolStripMenuItem1.Click += new System.EventHandler(this.Menu_Resize_Half);
//
// quarterToolStripMenuItem1
//
this.quarterToolStripMenuItem1.Name = "quarterToolStripMenuItem1";
this.quarterToolStripMenuItem1.Size = new System.Drawing.Size(164, 22);
this.quarterToolStripMenuItem1.Text = global::OnTopReplica.Strings.MenuFitQuarter;
this.quarterToolStripMenuItem1.Click += new System.EventHandler(this.Menu_Resize_Quarter);
//
// toolStripSeparator3
//
this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(161, 6);
//
// fullscreenToolStripMenuItem1
//
this.fullscreenToolStripMenuItem1.Image = global::OnTopReplica.Properties.Resources.fullscreen;
this.fullscreenToolStripMenuItem1.Name = "fullscreenToolStripMenuItem1";
this.fullscreenToolStripMenuItem1.Size = new System.Drawing.Size(164, 22);
this.fullscreenToolStripMenuItem1.Text = global::OnTopReplica.Strings.MenuFitFullscreen;
this.fullscreenToolStripMenuItem1.Click += new System.EventHandler(this.Menu_Resize_Fullscreen);
//
// dockToolStripMenuItem
//
this.dockToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.topLeftToolStripMenuItem,
this.topRightToolStripMenuItem,
this.bottomLeftToolStripMenuItem,
this.bottomRightToolStripMenuItem});
this.dockToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.pos_null;
this.dockToolStripMenuItem.Name = "dockToolStripMenuItem";
this.dockToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
this.dockToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuPosition;
this.dockToolStripMenuItem.ToolTipText = global::OnTopReplica.Strings.MenuPositionTT;
//
// topLeftToolStripMenuItem
//
this.topLeftToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.pos_topleft;
this.topLeftToolStripMenuItem.Name = "topLeftToolStripMenuItem";
this.topLeftToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
this.topLeftToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuPosTopLeft;
this.topLeftToolStripMenuItem.Click += new System.EventHandler(this.Menu_Position_TopLeft);
//
// topRightToolStripMenuItem
//
this.topRightToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.pos_topright;
this.topRightToolStripMenuItem.Name = "topRightToolStripMenuItem";
this.topRightToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
this.topRightToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuPosTopRight;
this.topRightToolStripMenuItem.Click += new System.EventHandler(this.Menu_Position_TopRight);
//
// bottomLeftToolStripMenuItem
//
this.bottomLeftToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.pos_bottomleft;
this.bottomLeftToolStripMenuItem.Name = "bottomLeftToolStripMenuItem";
this.bottomLeftToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
this.bottomLeftToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuPosBottomLeft;
this.bottomLeftToolStripMenuItem.Click += new System.EventHandler(this.Menu_Position_BottomLeft);
//
// bottomRightToolStripMenuItem
//
this.bottomRightToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.pos_bottomright;
this.bottomRightToolStripMenuItem.Name = "bottomRightToolStripMenuItem";
this.bottomRightToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
this.bottomRightToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuPosBottomRight;
this.bottomRightToolStripMenuItem.Click += new System.EventHandler(this.Menu_Position_BottomRight);
//
// chromeToolStripMenuItem
//
this.chromeToolStripMenuItem.Name = "chromeToolStripMenuItem";
this.chromeToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
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
//
this.reduceToIconToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.reduce;
this.reduceToIconToolStripMenuItem.Name = "reduceToIconToolStripMenuItem";
this.reduceToIconToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
this.reduceToIconToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuReduce;
this.reduceToIconToolStripMenuItem.ToolTipText = global::OnTopReplica.Strings.MenuReduceTT;
this.reduceToIconToolStripMenuItem.Click += new System.EventHandler(this.Menu_Reduce_click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(165, 6);
//
// languageToolStripMenuItem
//
this.languageToolStripMenuItem.DropDown = this.menuLanguages;
this.languageToolStripMenuItem.Name = "languageToolStripMenuItem";
this.languageToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
this.languageToolStripMenuItem.Text = global::OnTopReplica.Strings.Language;
//
// menuLanguages
//
this.menuLanguages.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.englishToolStripMenuItem,
this.cestinaToolStripMenuItem,
this.danskToolStripMenuItem1,
this.italianoToolStripMenuItem});
this.menuLanguages.Name = "menuLanguages";
this.menuLanguages.OwnerItem = this.languageToolStripMenuItem;
this.menuLanguages.Size = new System.Drawing.Size(114, 92);
this.menuLanguages.Text = "Dansk";
//
// englishToolStripMenuItem
//
this.englishToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.flag_usa;
this.englishToolStripMenuItem.Name = "englishToolStripMenuItem";
this.englishToolStripMenuItem.Size = new System.Drawing.Size(113, 22);
this.englishToolStripMenuItem.Tag = "en-US";
this.englishToolStripMenuItem.Text = "English";
this.englishToolStripMenuItem.Click += new System.EventHandler(this.Menu_Language_click);
//
// cestinaToolStripMenuItem
//
this.cestinaToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.flag_czech;
this.cestinaToolStripMenuItem.Name = "cestinaToolStripMenuItem";
this.cestinaToolStripMenuItem.Size = new System.Drawing.Size(113, 22);
this.cestinaToolStripMenuItem.Tag = "cs-CZ";
this.cestinaToolStripMenuItem.Text = "Čeština";
this.cestinaToolStripMenuItem.Click += new System.EventHandler(this.Menu_Language_click);
//
// danskToolStripMenuItem1
//
this.danskToolStripMenuItem1.Image = global::OnTopReplica.Properties.Resources.flag_danish;
this.danskToolStripMenuItem1.Name = "danskToolStripMenuItem1";
this.danskToolStripMenuItem1.Size = new System.Drawing.Size(113, 22);
this.danskToolStripMenuItem1.Tag = "da-DK";
this.danskToolStripMenuItem1.Text = "Dansk";
this.danskToolStripMenuItem1.Click += new System.EventHandler(this.Menu_Language_click);
//
// italianoToolStripMenuItem
//
this.italianoToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.flag_ita;
this.italianoToolStripMenuItem.Name = "italianoToolStripMenuItem";
this.italianoToolStripMenuItem.Size = new System.Drawing.Size(113, 22);
this.italianoToolStripMenuItem.Tag = "it-IT";
this.italianoToolStripMenuItem.Text = "Italiano";
this.italianoToolStripMenuItem.Click += new System.EventHandler(this.Menu_Language_click);
//
// aboutToolStripMenuItem
//
this.aboutToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.xiao_help;
this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
this.aboutToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
this.aboutToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuAbout;
this.aboutToolStripMenuItem.ToolTipText = global::OnTopReplica.Strings.MenuAboutTT;
this.aboutToolStripMenuItem.Click += new System.EventHandler(this.Menu_About_click);
//
// menuContextClose
//
this.menuContextClose.Image = global::OnTopReplica.Properties.Resources.close_new;
this.menuContextClose.Name = "menuContextClose";
this.menuContextClose.Size = new System.Drawing.Size(168, 22);
this.menuContextClose.Text = global::OnTopReplica.Strings.MenuClose;
this.menuContextClose.Click += new System.EventHandler(this.Menu_Close_click);
//
// fullOpacityToolStripMenuItem
//
this.fullOpacityToolStripMenuItem.DropDown = this.menuOpacity;
this.fullOpacityToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.window_opacity;
this.fullOpacityToolStripMenuItem.Name = "fullOpacityToolStripMenuItem";
this.fullOpacityToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
this.fullOpacityToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuOpacity;
//
// danskToolStripMenuItem
//
this.danskToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.flag_danish;
this.danskToolStripMenuItem.Name = "danskToolStripMenuItem";
this.danskToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.danskToolStripMenuItem.Tag = "da-DA";
this.danskToolStripMenuItem.Text = "Dansk";
this.danskToolStripMenuItem.Click += new System.EventHandler(this.Menu_Language_click);
//
// menuFullscreenContext
//
this.menuFullscreenContext.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fullSelectWindowToolStripMenuItem,
this.fullOpacityToolStripMenuItem,
this.enableClickthroughToolStripMenuItem,
this.fullExitToolStripMenuItem});
this.menuFullscreenContext.Name = "menuFullscreenContext";
this.menuFullscreenContext.Size = new System.Drawing.Size(190, 92);
//
// enableClickthroughToolStripMenuItem
//
this.enableClickthroughToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.clickforwarding;
this.enableClickthroughToolStripMenuItem.Name = "enableClickthroughToolStripMenuItem";
this.enableClickthroughToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
this.enableClickthroughToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuClickThrough;
this.enableClickthroughToolStripMenuItem.ToolTipText = global::OnTopReplica.Strings.MenuClickThroughTT;
this.enableClickthroughToolStripMenuItem.Click += new System.EventHandler(this.Menu_ClickThrough_click);
//
// fullExitToolStripMenuItem
//
this.fullExitToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.close_new;
this.fullExitToolStripMenuItem.Name = "fullExitToolStripMenuItem";
this.fullExitToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
this.fullExitToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuQuitFullscreen;
this.fullExitToolStripMenuItem.Click += new System.EventHandler(this.Menu_Fullscreen_ExitFullscreen_click);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.Control;
this.ClientSize = new System.Drawing.Size(264, 204);
this.ControlBox = false;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(20, 34);
this.Name = "MainForm";
this.Text = "OnTopReplica";
this.TopMost = true;
this.menuContext.ResumeLayout(false);
this.menuWindows.ResumeLayout(false);
this.menuOpacity.ResumeLayout(false);
this.menuResize.ResumeLayout(false);
this.menuLanguages.ResumeLayout(false);
this.menuFullscreenContext.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.ContextMenuStrip menuContext;
private System.Windows.Forms.ToolStripMenuItem menuContextWindows;
private System.Windows.Forms.ToolStripMenuItem menuContextClose;
private System.Windows.Forms.ContextMenuStrip menuWindows;
private System.Windows.Forms.ToolStripMenuItem menuContextOpacity;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ContextMenuStrip menuOpacity;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem3;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem4;
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem reduceToIconToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem selectRegionToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem resizeToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem noneToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem switchToWindowToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem dockToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem topLeftToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem topRightToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem bottomLeftToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem bottomRightToolStripMenuItem;
private System.Windows.Forms.ContextMenuStrip menuResize;
private System.Windows.Forms.ToolStripMenuItem doubleToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem fitToWindowToolStripMenuItem1;
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 languageToolStripMenuItem;
private System.Windows.Forms.ContextMenuStrip menuLanguages;
private System.Windows.Forms.ToolStripMenuItem englishToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem italianoToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem cestinaToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem danskToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem chromeToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem danskToolStripMenuItem1;
private System.Windows.Forms.ContextMenuStrip menuFullscreenContext;
private System.Windows.Forms.ToolStripMenuItem fullSelectWindowToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem fullOpacityToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem fullExitToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem advancedToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem clickForwardingToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem clickThroughToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem groupSwitchModeToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem enableClickthroughToolStripMenuItem;
}
}

537
OnTopReplica/MainForm.cs Normal file
View file

@ -0,0 +1,537 @@
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using OnTopReplica.Properties;
using VistaControls.Dwm;
using VistaControls.TaskDialog;
using System.Collections.Generic;
using OnTopReplica.Native;
using OnTopReplica.Update;
namespace OnTopReplica {
partial class MainForm : AspectRatioForm {
//GUI elements
ThumbnailPanel _thumbnailPanel;
SidePanel _currentSidePanel = null;
Panel _sidePanelContainer;
//Managers
WindowManager _windowManager = new WindowManager();
MessagePumpManager _msgPumpManager = new MessagePumpManager();
UpdateManager _updateManager = new UpdateManager();
FormBorderStyle _defaultBorderStyle;
public MainForm() {
InitializeComponent();
KeepAspectRatio = false;
//Store default values
_defaultBorderStyle = FormBorderStyle;
_nonClickThroughKey = TransparencyKey;
//Thumbnail panel
_thumbnailPanel = new ThumbnailPanel {
Location = Point.Empty,
Anchor = AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right,
Size = ClientSize
};
_thumbnailPanel.CloneClick += new EventHandler<CloneClickEventArgs>(Thumbnail_CloneClick);
Controls.Add(_thumbnailPanel);
//Side panel
_sidePanelContainer = new Panel {
Location = new Point(ClientSize.Width, 0),
Anchor = AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom,
Enabled = false,
Visible = false,
Size = new Size(100, ClientSize.Height),
Padding = new Padding(4)
};
Controls.Add(_sidePanelContainer);
//Set native renderer on context menus
Asztal.Szótár.NativeToolStripRenderer.SetToolStripRenderer(
menuContext, menuWindows, menuOpacity, menuResize, menuLanguages, menuFullscreenContext
);
//Init message pump extensions
_msgPumpManager.Initialize(this);
//Add hotkeys
var hotKeyMgr = _msgPumpManager.Get<MessagePumpProcessors.HotKeyManager>();
hotKeyMgr.RegisterHotKey(Native.HotKeyModifiers.Control | Native.HotKeyModifiers.Shift,
Keys.O, new Native.HotKeyMethods.HotKeyHandler(HotKeyOpenHandler));
hotKeyMgr.RegisterHotKey(Native.HotKeyModifiers.Control | Native.HotKeyModifiers.Shift,
Keys.C, new Native.HotKeyMethods.HotKeyHandler(HotKeyCloneHandler));
//Hook keyboard handler
this.KeyUp += new KeyEventHandler(Form_KeyUp);
this.KeyPreview = true;
}
delegate void GuiAction();
void UpdateManager_CheckCompleted(object sender, UpdateCheckCompletedEventArgs e) {
this.Invoke(new GuiAction(() => {
if (e.Success) {
_updateManager.HandleUpdateCheck(this, e.Information, false);
}
else {
Console.WriteLine("Failed to check for updates: {0}", e.Error);
}
}));
}
#region Event override
protected override CreateParams CreateParams {
get {
//Needed to hide caption, while keeping window title in task bar
var parms = base.CreateParams;
parms.Style &= ~0x00C00000; //WS_CAPTION
parms.Style &= 0x00040000; //WS_SIZEBOX
return parms;
}
}
protected override void OnShown(EventArgs e) {
base.OnShown(e);
//Platform specific form initialization
Program.Platform.InitForm(this);
//Glassify window
GlassEnabled = true;
}
protected override void OnHandleCreated(EventArgs e) {
base.OnHandleCreated(e);
//Check for updates
_updateManager.UpdateCheckCompleted += new EventHandler<UpdateCheckCompletedEventArgs>(UpdateManager_CheckCompleted);
_updateManager.CheckForUpdate();
}
protected override void OnClosing(CancelEventArgs e) {
_msgPumpManager.Dispose();
base.OnClosing(e);
}
protected override void OnResize(EventArgs e) {
base.OnResize(e);
this.GlassMargins = (_currentSidePanel != null) ?
new Margins(ClientSize.Width - _sidePanelContainer.Width, 0, 0, 0) :
new Margins(-1);
}
protected override void OnActivated(EventArgs e) {
base.OnActivated(e);
//Deactivate click-through if reactivated
if (ClickThroughEnabled) {
ClickThroughEnabled = false;
}
Program.Platform.RestoreForm(this);
}
protected override void OnDeactivate(EventArgs e) {
base.OnDeactivate(e);
//HACK: sometimes, even if TopMost is true, the window loses its "always on top" status.
// This is an attempt of a fix that probably won't work...
if (!IsFullscreen) { //fullscreen mode doesn't use TopMost
TopMost = false;
TopMost = true;
}
}
protected override void OnMouseWheel(MouseEventArgs e) {
base.OnMouseWheel(e);
if (!IsFullscreen) {
int change = (int)(e.Delta / 6.0); //assumes a mouse wheel "tick" is in the 80-120 range
AdjustSize(change);
}
}
protected override void OnMouseDoubleClick(MouseEventArgs e) {
base.OnMouseDoubleClick(e);
//This is handled by the WM_NCLBUTTONDBLCLK msg handler usually (because the GlassForm translates
//clicks on client to clicks on caption). But if fullscreen mode disables GlassForm dragging, we need
//this auxiliary handler to switch mode.
IsFullscreen = !IsFullscreen;
}
protected override void OnMouseClick(MouseEventArgs e) {
base.OnMouseClick(e);
//Same story as above (OnMouseDoubleClick)
if (e.Button == System.Windows.Forms.MouseButtons.Right) {
OpenContextMenu();
}
}
protected override void WndProc(ref Message m) {
if (_msgPumpManager != null) {
if (_msgPumpManager.PumpMessage(ref m)) {
return;
}
}
switch (m.Msg) {
case WM.NCRBUTTONUP:
//Open context menu if right button clicked on caption (i.e. all of the window area because of glass)
if (m.WParam.ToInt32() == HT.CAPTION) {
OpenContextMenu();
m.Result = IntPtr.Zero;
return;
}
break;
case WM.NCLBUTTONDBLCLK:
//Toggle fullscreen mode if double click on caption (whole glass area)
if (m.WParam.ToInt32() == HT.CAPTION) {
IsFullscreen = !IsFullscreen;
m.Result = IntPtr.Zero;
return;
}
break;
case WM.NCHITTEST:
//Make transparent to hit-testing if in click through mode
if (ClickThroughEnabled) {
m.Result = (IntPtr)HT.TRANSPARENT;
return;
}
break;
}
base.WndProc(ref m);
}
#endregion
const string Title = "OnTopReplica";
#region Keyboard event handling
void Form_KeyUp(object sender, KeyEventArgs e) {
//ALT
if (e.Modifiers == Keys.Alt) {
if (e.KeyCode == Keys.Enter) {
e.Handled = true;
IsFullscreen = !IsFullscreen;
}
else if (e.KeyCode == Keys.D1 || e.KeyCode == Keys.NumPad1) {
FitToThumbnail(0.25);
}
else if (e.KeyCode == Keys.D2 || e.KeyCode == Keys.NumPad2) {
FitToThumbnail(0.5);
}
else if (e.KeyCode == Keys.D3 || e.KeyCode == Keys.NumPad3 || e.KeyCode == Keys.D0 || e.KeyCode == Keys.NumPad0) {
FitToThumbnail(1.0);
}
else if (e.KeyCode == Keys.D4 || e.KeyCode == Keys.NumPad4) {
FitToThumbnail(2.0);
}
}
//ESCAPE
else if (e.KeyCode == Keys.Escape) {
#if DEBUG
Console.WriteLine("Received ESCAPE");
#endif
//Disable click-through
if (ClickThroughEnabled) {
ClickThroughEnabled = false;
}
//Toggle fullscreen
else if (IsFullscreen) {
IsFullscreen = false;
}
//Disable click forwarding
else if (_thumbnailPanel.ReportThumbnailClicks) {
_thumbnailPanel.ReportThumbnailClicks = false;
}
}
}
void HotKeyOpenHandler() {
if (IsFullscreen)
IsFullscreen = false;
if (!Program.Platform.IsHidden(this)) {
Program.Platform.HideForm(this);
}
else {
EnsureMainFormVisible();
}
}
void HotKeyCloneHandler() {
var handle = Win32Helper.GetCurrentForegroundWindow();
if (handle.Handle == this.Handle)
return;
SetThumbnail(handle, null);
}
#endregion
#region Fullscreen
bool _isFullscreen = false;
Point _preFullscreenLocation;
Size _preFullscreenSize;
public bool IsFullscreen {
get {
return _isFullscreen;
}
set {
if (IsFullscreen == value)
return;
if (value && !_thumbnailPanel.IsShowingThumbnail)
return;
CloseSidePanel(); //on switch, always hide side panels
GlassEnabled = !value;
FormBorderStyle = (value) ? FormBorderStyle.None : _defaultBorderStyle;
TopMost = !value;
HandleMouseMove = !value;
//Location and size
if (value) {
_preFullscreenLocation = Location;
_preFullscreenSize = Size;
var currentScreen = Screen.FromControl(this);
Size = currentScreen.WorkingArea.Size;
Location = currentScreen.WorkingArea.Location;
}
else {
Location = _preFullscreenLocation;
Size = _preFullscreenSize;
RefreshAspectRatio();
}
_isFullscreen = value;
Program.Platform.OnFormStateChange(this);
}
}
#endregion
#region Thumbnail operation
/// <summary>
/// Sets a new thumbnail.
/// </summary>
/// <param name="handle">Handle to the window to clone.</param>
/// <param name="region">Region of the window to clone.</param>
public void SetThumbnail(WindowHandle handle, StoredRegion region) {
try {
CurrentThumbnailWindowHandle = handle;
_thumbnailPanel.SetThumbnailHandle(handle);
if (region != null)
_thumbnailPanel.SelectedRegion = region.Rect;
else
_thumbnailPanel.ConstrainToRegion = false;
//Set aspect ratio (this will resize the form), do not refresh if in fullscreen
SetAspectRatio(_thumbnailPanel.ThumbnailOriginalSize, !IsFullscreen);
}
catch (Exception ex) {
ThumbnailError(ex, false, Strings.ErrorUnableToCreateThumbnail);
}
}
/// <summary>
/// Enables group mode on a list of window handles.
/// </summary>
/// <param name="handles">List of window handles.</param>
public void SetThumbnailGroup(IList<WindowHandle> handles) {
if (handles.Count == 0)
return;
//At last one thumbnail
SetThumbnail(handles[0], null);
//Handle if no real group
if (handles.Count == 1)
return;
CurrentThumbnailWindowHandle = null;
_msgPumpManager.Get<MessagePumpProcessors.GroupSwitchManager>().EnableGroupMode(handles);
}
/// <summary>
/// Disables the cloned thumbnail.
/// </summary>
public void UnsetThumbnail() {
//Unset handle
CurrentThumbnailWindowHandle = null;
_thumbnailPanel.UnsetThumbnail();
//Disable aspect ratio
KeepAspectRatio = false;
}
/// <summary>
/// Gets or sets the region displayed of the current thumbnail.
/// </summary>
public Rectangle? SelectedThumbnailRegion {
get {
if (!_thumbnailPanel.IsShowingThumbnail || !_thumbnailPanel.ConstrainToRegion)
return null;
return _thumbnailPanel.SelectedRegion;
}
set {
if (!_thumbnailPanel.IsShowingThumbnail)
return;
if (value.HasValue) {
_thumbnailPanel.SelectedRegion = value.Value;
SetAspectRatio(value.Value.Size, true);
}
else {
_thumbnailPanel.ConstrainToRegion = false;
SetAspectRatio(_thumbnailPanel.ThumbnailOriginalSize, true);
}
FixPositionAndSize();
}
}
const int FixMargin = 10;
/// <summary>
/// Fixes the form's position and size, ensuring it is fully displayed in the current screen.
/// </summary>
private void FixPositionAndSize() {
var screen = Screen.FromControl(this);
if (Width > screen.WorkingArea.Width) {
Width = screen.WorkingArea.Width - FixMargin;
}
if (Height > screen.WorkingArea.Height) {
Height = screen.WorkingArea.Height - FixMargin;
}
if (Location.X + Width > screen.WorkingArea.Right) {
Location = new Point(screen.WorkingArea.Right - Width - FixMargin, Location.Y);
}
if (Location.Y + Height > screen.WorkingArea.Bottom) {
Location = new Point(Location.X, screen.WorkingArea.Bottom - Height - FixMargin);
}
}
private void ThumbnailError(Exception ex, bool suppress, string title) {
if (!suppress) {
ShowErrorDialog(title, Strings.ErrorGenericThumbnailHandleError, ex.Message);
}
UnsetThumbnail();
}
/// <summary>Automatically sizes the window in order to accomodate the thumbnail p times.</summary>
/// <param name="p">Scale of the thumbnail to consider.</param>
private void FitToThumbnail(double p) {
try {
Size originalSize = _thumbnailPanel.ThumbnailOriginalSize;
Size fittedSize = new Size((int)(originalSize.Width * p), (int)(originalSize.Height * p));
ClientSize = fittedSize;
}
catch (Exception ex) {
ThumbnailError(ex, false, Strings.ErrorUnableToFit);
}
}
#endregion
#region Click-through
bool _clickThrough = false;
Color _nonClickThroughKey;
public bool ClickThroughEnabled {
get {
return _clickThrough;
}
set {
//Adjust opacity if fully opaque
if (value && Opacity == 1.0)
Opacity = 0.75;
if (!value)
Opacity = 1.0;
//Enable transparency and force as top-most
TransparencyKey = (value) ? Color.Black : _nonClickThroughKey;
if (value)
TopMost = true;
_clickThrough = value;
}
}
#endregion
#region Accessors
/// <summary>
/// Gets the form's thumbnail panel.
/// </summary>
public ThumbnailPanel ThumbnailPanel {
get {
return _thumbnailPanel;
}
}
/// <summary>
/// Gets the form's message pump manager.
/// </summary>
public MessagePumpManager MessagePumpManager {
get {
return _msgPumpManager;
}
}
/// <summary>
/// Gets the form's window list drop down menu.
/// </summary>
public ContextMenuStrip MenuWindows {
get {
return menuWindows;
}
}
/// <summary>
/// Retrieves the window handle of the currently cloned thumbnail.
/// </summary>
public WindowHandle CurrentThumbnailWindowHandle {
get;
private set;
}
#endregion
}
}

324
OnTopReplica/MainForm.resx Normal file
View file

@ -0,0 +1,324 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuContext.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="menuWindows.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>142, 17</value>
</metadata>
<metadata name="menuOpacity.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>275, 17</value>
</metadata>
<metadata name="menuResize.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>578, 17</value>
</metadata>
<metadata name="menuLanguages.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>695, 17</value>
</metadata>
<metadata name="menuFullscreenContext.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>399, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAIAMDAAAAEAIACoJQAAJgAAABAQAAABACAAaAQAAM4lAAAoAAAAMAAAAGAAAAABACAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAYAAAAOAAAAFwAAACAAAAAnAAAAKwAAACwAAAAsAAAALAAA
ACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAA
ACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAA
ACwAAAAsAAAAKwAAACcAAAAfAAAAFwAAAA0AAAAGAAAABgAAAA4AAAAdAAAALQAAAD0AAABIAAAATgAA
AE8AAABPAAAATwAAAE8AAABPAAAATwAAAE8AAABPAAAATwAAAE8AAABPAAAATwAAAE8AAABPAAAATwAA
AE8AAABPAAAATwAAAE8AAABPAAAATwAAAE8AAABPAAAATwAAAE8AAABPAAAATwAAAE8AAABPAAAATwAA
AE8AAABPAAAATwAAAE8AAABPAAAATgAAAEgAAAA9AAAALQAAABwAAAANAAAACwAAABkAAAAwAAAARwAA
AFsAAABpAAAAcAAAAHEAAABxAAAAcQAAAHEAAABxAAAAcQAAAHEAAABxAAAAcQAAAHEAAABxAAAAcQAA
AHEAAABxAAAAcQAAAHEAAABxAAAAcQAAAHEAAABxAAAAcQAAAHEAAABxAAAAcQAAAHEAAABxAAAAcQAA
AHEAAABxAAAAcQAAAHEAA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ic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
namespace OnTopReplica {
partial class MainForm {
EventHandler RequestClosingHandler;
const int SidePanelMargin = 1;
/// <summary>
/// Opens a new side panel.
/// </summary>
/// <param name="panel">The side panel to embed.</param>
public void SetSidePanel(SidePanel panel) {
if (_currentSidePanel != null) {
CloseSidePanel();
}
_currentSidePanel = panel;
_currentSidePanel.OnFirstShown(this);
//Add and show
_sidePanelContainer.Controls.Add(panel);
_sidePanelContainer.Visible = _sidePanelContainer.Enabled = true;
panel.Show();
int intHorzMargin = panel.Margin.Horizontal + _sidePanelContainer.Padding.Horizontal; //internal margins for sidepanel
int intVertMargin = panel.Margin.Vertical + _sidePanelContainer.Padding.Vertical;
//Resize container
_sidePanelContainer.ClientSize = new Size(
panel.MinimumSize.Width + intHorzMargin,
ClientSize.Height
);
int rightHorzMargin = _sidePanelContainer.Width + SidePanelMargin; //horz margin between the two controls
//Resize rest
MinimumSize = new Size(
20 + panel.MinimumSize.Width + SidePanelMargin + intHorzMargin,
panel.MinimumSize.Height + intVertMargin
);
ClientSize = new Size(
ClientSize.Width + rightHorzMargin,
ClientSize.Height
);
ExtraPadding = new Padding(0, 0, rightHorzMargin, 0);
_thumbnailPanel.Size = new Size(
ClientSize.Width - rightHorzMargin,
ClientSize.Height
);
_sidePanelContainer.Location = new Point(
ClientSize.Width - rightHorzMargin,
0
);
//Move window if needed
FixPositionAndSize();
//Hook event listener
if (RequestClosingHandler == null)
RequestClosingHandler = new EventHandler(SidePanel_RequestClosing);
panel.RequestClosing += RequestClosingHandler;
}
/// <summary>
/// Closes the current side panel.
/// </summary>
public void CloseSidePanel() {
if (_currentSidePanel == null)
return;
//Unhook listener
_currentSidePanel.RequestClosing -= RequestClosingHandler;
//Remove side panel
_currentSidePanel.OnClosing(this);
_sidePanelContainer.Controls.Clear();
_sidePanelContainer.Visible = _sidePanelContainer.Enabled = false;
_currentSidePanel = null;
//Resize
MinimumSize = new Size(20, 20);
ClientSize = new Size(
ClientSize.Width - _sidePanelContainer.Width - SidePanelMargin,
ClientSize.Height
);
ExtraPadding = new Padding(0);
_thumbnailPanel.Size = ClientSize;
}
void SidePanel_RequestClosing(object sender, EventArgs e) {
CloseSidePanel();
}
void Thumbnail_CloneClick(object sender, CloneClickEventArgs e) {
Win32Helper.InjectFakeMouseClick(CurrentThumbnailWindowHandle.Handle, e);
}
}
}

View file

@ -0,0 +1,128 @@
using System.Drawing;
using System.Windows.Forms;
using VistaControls.TaskDialog;
namespace OnTopReplica {
partial class MainForm {
/// <summary>
/// Opens the context menu.
/// </summary>
public void OpenContextMenu() {
if (IsFullscreen) {
menuFullscreenContext.Show(MousePosition);
}
else {
menuContext.Show(MousePosition);
}
}
private Point RecenterLocation(Control original, Control final) {
int origX = original.Location.X + original.Size.Width / 2;
int origY = original.Location.Y + original.Size.Height / 2;
int finX = origX - final.Size.Width / 2;
int finY = origY - final.Size.Height / 2;
//Check boundaries
var screen = Screen.FromControl(final);
if (finX < screen.WorkingArea.X)
finX = screen.WorkingArea.X;
if (finX + final.Size.Width > screen.WorkingArea.Width)
finX = screen.WorkingArea.Width - final.Size.Width;
if (finY < screen.WorkingArea.Y)
finY = screen.WorkingArea.Y;
if (finY + final.Size.Height > screen.WorkingArea.Height)
finY = screen.WorkingArea.Height - final.Size.Height;
return new Point(finX, finY);
}
private int ChromeBorderVertical {
get {
if (FormBorderStyle == _defaultBorderStyle)
return SystemInformation.FrameBorderSize.Height;
else
return 0;
}
}
private int ChromeBorderHorizontal {
get {
if (FormBorderStyle == _defaultBorderStyle)
return SystemInformation.FrameBorderSize.Width;
else
return 0;
}
}
/// <summary>
/// Displays an error task dialog.
/// </summary>
/// <param name="mainInstruction">Main instruction of the error dialog.</param>
/// <param name="explanation">Detailed informations about the error.</param>
/// <param name="errorMessage">Expanded error codes/messages.</param>
private void ShowErrorDialog(string mainInstruction, string explanation, string errorMessage) {
TaskDialog dlg = new TaskDialog(mainInstruction, Strings.ErrorGenericTitle, explanation) {
CommonIcon = TaskDialogIcon.Stop,
IsExpanded = false
};
if (!string.IsNullOrEmpty(errorMessage)) {
dlg.ExpandedInformation = Strings.ErrorGenericInfoText + errorMessage;
dlg.ExpandedControlText = Strings.ErrorGenericInfoButton;
}
dlg.Show(this);
}
/// <summary>
/// Ensures that the main form is visible (either closing the fullscreen mode or reactivating from task icon).
/// </summary>
public void EnsureMainFormVisible() {
//Reset special modes
IsFullscreen = false;
ClickThroughEnabled = false;
Opacity = 1.0;
//Restore main form in platform with dependent method
Program.Platform.RestoreForm(this);
}
/// <summary>
/// Opens a confirmation dialog to confirm whether to reset the main form or not.
/// </summary>
public void ResetMainFormWithConfirmation() {
var dlg = new TaskDialog(Strings.AskReset, Strings.AskResetTitle, Strings.AskResetContent);
dlg.UseCommandLinks = true;
dlg.CustomButtons = new CustomButton[] {
new CustomButton(Result.OK, Strings.AskResetButtonOk),
new CustomButton(Result.Cancel, Strings.ButtonCancel)
};
dlg.CommonIcon = TaskDialogIcon.Information;
if (dlg.Show(this).CommonButton == Result.OK) {
ResetMainForm();
}
}
/// <summary>
/// Resets the main form to its initial state.
/// </summary>
public void ResetMainForm() {
//Reset form settings
UnsetThumbnail();
CloseSidePanel();
//Reset location and size (edge of the screen, min size)
Point nuLoc = Screen.PrimaryScreen.WorkingArea.Location;
nuLoc.Offset(40, 40);
Location = nuLoc;
Size = new Size(240, 220);
this.Show();
this.Activate();
}
}
}

View file

@ -0,0 +1,234 @@
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using OnTopReplica.Properties;
using VistaControls.TaskDialog;
namespace OnTopReplica {
partial class MainForm {
private void Menu_opening(object sender, CancelEventArgs e) {
//Cancel if currently in "fullscreen" mode or a side panel is open
if (IsFullscreen || _currentSidePanel != null) {
e.Cancel = true;
return;
}
bool showing = _thumbnailPanel.IsShowingThumbnail;
selectRegionToolStripMenuItem.Enabled = showing;
switchToWindowToolStripMenuItem.Enabled = showing;
resizeToolStripMenuItem.Enabled = showing;
chromeToolStripMenuItem.Checked = (FormBorderStyle == _defaultBorderStyle);
clickForwardingToolStripMenuItem.Checked = _thumbnailPanel.ReportThumbnailClicks;
chromeToolStripMenuItem.Enabled = showing;
clickThroughToolStripMenuItem.Enabled = showing;
clickForwardingToolStripMenuItem.Enabled = showing;
}
private void Menu_Windows_opening(object sender, CancelEventArgs e) {
_windowManager.Refresh(WindowManager.EnumerationMode.TaskWindows);
WindowListHelper.PopulateMenu(this, _windowManager, (ToolStrip)sender,
CurrentThumbnailWindowHandle, new EventHandler(Menu_Windows_itemclick));
}
void Menu_Windows_itemclick(object sender, EventArgs e) {
//Ensure the menu is closed
menuContext.Close();
menuFullscreenContext.Close();
menuWindows.Close();
//Get clicked item and window index from tag
ToolStripItem tsi = (ToolStripItem)sender;
//Handle special "none" window
if (tsi.Tag == null) {
UnsetThumbnail();
return;
}
var selectionData = (WindowListHelper.WindowSelectionData)tsi.Tag;
SetThumbnail(selectionData.Handle, selectionData.Region);
}
private void Menu_Switch_click(object sender, EventArgs e) {
if (CurrentThumbnailWindowHandle == null)
return;
Program.Platform.HideForm(this);
Native.WindowManagerMethods.SetForegroundWindow(CurrentThumbnailWindowHandle.Handle);
}
private void Menu_GroupSwitchMode_click(object sender, EventArgs e) {
SetSidePanel(new SidePanels.GroupSwitchPanel());
}
private void Menu_ClickForwarding_click(object sender, EventArgs e) {
if (Settings.Default.FirstTimeClickForwarding && !_thumbnailPanel.ReportThumbnailClicks) {
TaskDialog dlg = new TaskDialog(Strings.InfoClickForwarding, Strings.InfoClickForwardingTitle, Strings.InfoClickForwardingContent) {
CommonButtons = TaskDialogButton.Yes | TaskDialogButton.No
};
if (dlg.Show(this).CommonButton == Result.No)
return;
Settings.Default.FirstTimeClickForwarding = false;
}
_thumbnailPanel.ReportThumbnailClicks = !_thumbnailPanel.ReportThumbnailClicks;
}
private void Menu_ClickThrough_click(object sender, EventArgs e) {
ClickThroughEnabled = true;
}
private void Menu_Opacity_opening(object sender, CancelEventArgs e) {
ToolStripMenuItem[] items = {
toolStripMenuItem1,
toolStripMenuItem2,
toolStripMenuItem3,
toolStripMenuItem4
};
foreach (ToolStripMenuItem i in items) {
if ((double)i.Tag == this.Opacity)
i.Checked = true;
else
i.Checked = false;
}
}
private void Menu_Opacity_click(object sender, EventArgs e) {
//Get clicked menu item
ToolStripMenuItem tsi = sender as ToolStripMenuItem;
if (tsi != null) {
//Get opacity from the tag
this.Opacity = (double)tsi.Tag;
}
}
private void Menu_Region_click(object sender, EventArgs e) {
SetSidePanel(new OnTopReplica.SidePanels.RegionPanel());
}
private void Menu_Resize_opening(object sender, CancelEventArgs e) {
if (!_thumbnailPanel.IsShowingThumbnail)
e.Cancel = true;
}
private void Menu_Resize_Double(object sender, EventArgs e) {
FitToThumbnail(2.0);
}
private void Menu_Resize_FitToWindow(object sender, EventArgs e) {
FitToThumbnail(1.0);
}
private void Menu_Resize_Half(object sender, EventArgs e) {
FitToThumbnail(0.5);
}
private void Menu_Resize_Quarter(object sender, EventArgs e) {
FitToThumbnail(0.25);
}
private void Menu_Resize_Fullscreen(object sender, EventArgs e) {
IsFullscreen = true;
}
private void Menu_Position_TopLeft(object sender, EventArgs e) {
var screen = Screen.FromControl(this);
Location = new Point(
screen.WorkingArea.Left - ChromeBorderHorizontal,
screen.WorkingArea.Top - ChromeBorderVertical
);
}
private void Menu_Position_TopRight(object sender, EventArgs e) {
var screen = Screen.FromControl(this);
Location = new Point(
screen.WorkingArea.Width - Size.Width + ChromeBorderHorizontal,
screen.WorkingArea.Top - ChromeBorderVertical
);
}
private void Menu_Position_BottomLeft(object sender, EventArgs e) {
var screen = Screen.FromControl(this);
Location = new Point(
screen.WorkingArea.Left - ChromeBorderHorizontal,
screen.WorkingArea.Height - Size.Height + ChromeBorderVertical
);
}
private void Menu_Position_BottomRight(object sender, EventArgs e) {
var screen = Screen.FromControl(this);
Location = new Point(
screen.WorkingArea.Width - Size.Width + ChromeBorderHorizontal,
screen.WorkingArea.Height - Size.Height + ChromeBorderVertical
);
}
private void Menu_Reduce_click(object sender, EventArgs e) {
//Hide form in a platform specific way
Program.Platform.HideForm(this);
}
private void Menu_Chrome_click(object sender, EventArgs e) {
if (FormBorderStyle == _defaultBorderStyle) {
FormBorderStyle = FormBorderStyle.None;
Location = new Point {
X = Location.X + SystemInformation.FrameBorderSize.Width,
Y = Location.Y + SystemInformation.FrameBorderSize.Height
};
}
else {
FormBorderStyle = _defaultBorderStyle;
Location = new Point {
X = Location.X - SystemInformation.FrameBorderSize.Width,
Y = Location.Y - SystemInformation.FrameBorderSize.Height
};
}
Program.Platform.OnFormStateChange(this);
Invalidate();
}
private void Menu_Language_click(object sender, EventArgs e) {
ToolStripItem tsi = (ToolStripItem)sender;
string langCode = tsi.Tag as string;
if (Program.ForceGlobalLanguageChange(langCode))
this.Close();
else
MessageBox.Show("Error");
}
private void Menu_About_click(object sender, EventArgs e) {
this.Hide();
using (var box = new AboutForm()) {
box.Location = RecenterLocation(this, box);
box.ShowDialog();
Location = RecenterLocation(box, this);
}
this.Show();
}
private void Menu_Close_click(object sender, EventArgs e) {
this.Close();
}
private void Menu_Fullscreen_ExitFullscreen_click(object sender, EventArgs e) {
IsFullscreen = false;
}
}
}

View file

@ -0,0 +1,85 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.Windows.Forms;
using OnTopReplica.Native;
namespace OnTopReplica {
class MessagePumpManager : IDisposable {
Dictionary<Type, IMessagePumpProcessor> _processors = new Dictionary<Type, IMessagePumpProcessor>();
public MainForm Form { get; private set; }
/// <summary>
/// Instantiates all message pump processors and registers them on the main form.
/// </summary>
/// <param name="form"></param>
public void Initialize(MainForm form) {
Form = form;
//Register window shell hook
if (!HookMethods.RegisterShellHookWindow(form.Handle)) {
Console.Error.WriteLine("Failed to register shell hook window.");
}
else {
#if DEBUG
Console.WriteLine("Shell hook window registered successfully.");
#endif
}
foreach (var t in Assembly.GetExecutingAssembly().GetTypes()) {
if (typeof(IMessagePumpProcessor).IsAssignableFrom(t) && !t.IsAbstract) {
var instance = (IMessagePumpProcessor)Activator.CreateInstance(t);
instance.Initialize(form);
_processors[t] = instance;
#if DEBUG
Console.WriteLine("Registered message pump processor: {0}", t);
#endif
}
}
}
/// <summary>
/// Run the registered message pump processors.
/// </summary>
/// <param name="msg">Message to process.</param>
/// <returns>True if the message has been handled internally.</returns>
public bool PumpMessage(ref Message msg) {
foreach (var processor in _processors.Values) {
if (processor.Process(ref msg))
return true;
}
return false;
}
/// <summary>
/// Get the instance of a registered message pump processor.
/// Throws if instance not found.
/// </summary>
public T Get<T>() {
return (T)_processors[typeof(T)];
}
#region IDisposable Members
public void Dispose() {
if (!HookMethods.DeregisterShellHookWindow(Form.Handle)) {
Console.Error.WriteLine("Failed to deregister shell hook window.");
}
foreach (var processor in _processors.Values) {
processor.Dispose();
}
_processors.Clear();
}
#endregion
}
}

View file

@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
namespace OnTopReplica.MessagePumpProcessors {
abstract class BaseMessagePumpProcessor : IMessagePumpProcessor {
protected MainForm Form { get; private set; }
#region IMessagePumpProcessor Members
public void Initialize(MainForm form) {
Form = form;
}
public abstract bool Process(ref Message msg);
#endregion
bool _isDisposed = false;
protected abstract void Shutdown();
#region IDisposable Members
public void Dispose() {
if (_isDisposed)
return;
Shutdown();
_isDisposed = true;
}
#endregion
}
}

View file

@ -0,0 +1,143 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Reflection;
using System.IO;
using System.Windows.Forms;
using OnTopReplica.Native;
namespace OnTopReplica.MessagePumpProcessors {
class GroupSwitchManager : BaseMessagePumpProcessor {
bool _active = false;
List<WindowHandleWrapper> _lruHandles;
/// <summary>
/// Enables group switch mode.
/// </summary>
/// <param name="handles">List of window handles to track.</param>
public void EnableGroupMode(IList<WindowHandle> handles) {
if (handles == null || handles.Count == 0)
return;
//Okey dokey, will now track handles
TrackHandles(handles);
_active = true;
}
/// <summary>
/// Initializes the LRU sorted list of window handles.
/// </summary>
private void TrackHandles(IList<WindowHandle> handles) {
_lruHandles = new List<WindowHandleWrapper>(handles.Count);
var now = DateTime.Now;
foreach(var h in handles){
_lruHandles.Add(new WindowHandleWrapper {
WindowHandle = h,
LastTimeUsed = now
});
}
}
/// <summary>
/// Disables group switch mode.
/// </summary>
public void Disable() {
if (!_active)
return;
_lruHandles = null;
_active = false;
}
/// <summary>
/// Processes the message pump.
/// </summary>
public override bool Process(ref Message msg) {
if (_active && msg.Msg == HookMethods.WM_SHELLHOOKMESSAGE) {
int hookCode = msg.WParam.ToInt32();
if (hookCode == HookMethods.HSHELL_WINDOWACTIVATED ||
hookCode == HookMethods.HSHELL_RUDEAPPACTIVATED) {
IntPtr activeHandle = msg.LParam;
HandleForegroundWindowChange(activeHandle);
}
}
return false;
}
private void HandleForegroundWindowChange(IntPtr activeWindow) {
#if DEBUG
Console.Write("New active window (h {0}). ", activeWindow);
#endif
//Seek window in tracked handles
WindowHandleWrapper activated = null;
foreach (var i in _lruHandles) {
if (i.WindowHandle.Handle == activeWindow)
activated = i;
}
if (activated == null) {
#if DEBUG
//new foreground window is not tracked
Console.WriteLine("Active window is not tracked.");
#endif
return;
}
//Update tracked handle
activated.LastTimeUsed = DateTime.Now;
_lruHandles.Sort(new LruDateTimeComparer());
//Get least recently used
var next = _lruHandles[0];
#if DEBUG
Console.WriteLine("Tracked. Switching to {0} (last use: {1}).", next.WindowHandle.Title, next.LastTimeUsed);
#endif
Form.SetThumbnail(next.WindowHandle, null);
}
protected override void Shutdown() {
Disable();
}
/// <summary>
/// Gets whether the group switch manager ia active.
/// </summary>
public bool IsActive {
get {
return _active;
}
}
#region List sorting stuff
class WindowHandleWrapper {
public WindowHandle WindowHandle { get; set; }
public DateTime LastTimeUsed { get; set; }
}
class LruDateTimeComparer : IComparer<WindowHandleWrapper> {
#region IComparer<WindowHandleWrapper> Members
public int Compare(WindowHandleWrapper x, WindowHandleWrapper y) {
return x.LastTimeUsed.CompareTo(y.LastTimeUsed);
}
#endregion
}
#endregion
}
}

View file

@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using OnTopReplica.Native;
namespace OnTopReplica.MessagePumpProcessors {
/// <summary>
/// HotKey registration helper.
/// </summary>
class HotKeyManager : BaseMessagePumpProcessor {
int _lastUsedKey = 0;
Dictionary<int, HotKeyMethods.HotKeyHandler> _handlers = new Dictionary<int, HotKeyMethods.HotKeyHandler>();
public void RegisterHotKey(HotKeyModifiers mod, Keys keys, HotKeyMethods.HotKeyHandler handler) {
var newKey = ++_lastUsedKey;
if (!HotKeyMethods.RegisterHotKey(Form.Handle, newKey, (int)mod, (int)keys)) {
Console.Error.WriteLine("Failed to register {0} hot key.", newKey);
return;
}
_handlers[newKey] = handler;
}
public override bool Process(ref Message msg) {
if (msg.Msg == HotKeyMethods.WM_HOTKEY) {
int keyId = msg.WParam.ToInt32();
if (!_handlers.ContainsKey(keyId))
return false;
_handlers[keyId].Invoke();
}
return false;
}
protected override void Shutdown() {
foreach (var key in _handlers.Keys) {
if (!HotKeyMethods.UnregisterHotKey(Form.Handle, key)) {
Console.Error.WriteLine("Failed to unregister {0} hot key.", key);
}
}
}
}
}

View file

@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using OnTopReplica.Native;
using System.Runtime.InteropServices;
namespace OnTopReplica.MessagePumpProcessors {
class TitleSetter : BaseMessagePumpProcessor {
const string Title = "OnTopReplica";
public override bool Process(ref Message msg) {
switch (msg.Msg) {
case WM.GETTEXT: {
Console.WriteLine("GetText");
int maxLen = msg.WParam.ToInt32();
byte[] strBytes = Encoding.UTF8.GetBytes(Title);
byte[] termBytes = new byte[strBytes.Length + 1];
strBytes.CopyTo(termBytes, 0);
termBytes[strBytes.Length] = 0;
Marshal.Copy(termBytes, 0, msg.LParam, Math.Min(maxLen, Title.Length + 1));
}
goto case WM.GETTEXTLENGTH;
case WM.GETTEXTLENGTH:
Console.WriteLine("GetTextLength");
msg.Result = (IntPtr)Title.Length;
return true;
}
return false;
}
protected override void Shutdown() {
}
}
}

View file

@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using OnTopReplica.Native;
namespace OnTopReplica.MessagePumpProcessors {
/// <summary>
/// Listens for shell events and closes the thumbnail if a cloned window is destroyed.
/// </summary>
class WindowKeeper : BaseMessagePumpProcessor {
public override bool Process(ref Message msg) {
if (Form.CurrentThumbnailWindowHandle != null &&
msg.Msg == HookMethods.WM_SHELLHOOKMESSAGE) {
int hookCode = msg.WParam.ToInt32();
if (hookCode == HookMethods.HSHELL_WINDOWDESTROYED) {
//Check whether the destroyed window is the one we were cloning
IntPtr destroyedHandle = msg.LParam;
if (destroyedHandle == Form.CurrentThumbnailWindowHandle.Handle) {
//Disable group switch mode, since a window of the group has been destroyed
Form.MessagePumpManager.Get<GroupSwitchManager>().Disable();
//Disable cloning
Form.UnsetThumbnail();
}
}
}
return false;
}
protected override void Shutdown() {
}
}
}

View file

@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace OnTopReplica.Native {
public static class CommonControls {
[DllImport("comctl32.dll", EntryPoint = "InitCommonControlsEx", CallingConvention = CallingConvention.StdCall)]
static extern bool InitCommonControlsEx(ref INITCOMMONCONTROLSEX iccex);
const int ICC_STANDARD_CLASSES = 0x00004000;
const int ICC_WIN95_CLASSES = 0x000000FF;
public static bool InitStandard() {
INITCOMMONCONTROLSEX ex = new INITCOMMONCONTROLSEX();
ex.dwSize = 8;
ex.dwICC = ICC_STANDARD_CLASSES | ICC_WIN95_CLASSES;
return InitCommonControlsEx(ref ex);
}
}
struct INITCOMMONCONTROLSEX {
public int dwSize;
public int dwICC;
}
}

View file

@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace OnTopReplica.Native {
/// <summary>
/// Common Win32 error handling methods.
/// </summary>
static class ErrorMethods {
[DllImport("kernel32.dll")]
static extern uint FormatMessage(uint dwFlags, IntPtr lpSource,
int dwMessageId, uint dwLanguageId, [Out] StringBuilder lpBuffer,
uint nSize, IntPtr Arguments);
/// <summary>
/// Gets a string representation of a Win32 error code.
/// </summary>
/// <param name="msgCode">ID of the Win32 error code.</param>
/// <returns>String representation of the error.</returns>
public static string GetErrorMessage(int msgCode) {
var sb = new StringBuilder(300);
FormatMessage((uint)(0x00001000), IntPtr.Zero, msgCode, 0, sb, 299, IntPtr.Zero);
return sb.ToString();
}
/// <summary>
/// Gets a string representation of the last Win32 error on this thread.
/// </summary>
public static string GetLastErrorMessage() {
int errorCode = Marshal.GetLastWin32Error();
return GetErrorMessage(errorCode);
}
}
}

14
OnTopReplica/Native/HT.cs Normal file
View file

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OnTopReplica.Native {
/// <summary>
/// Native Win32 Hit Testing codes.
/// </summary>
static class HT {
public const int TRANSPARENT = -1;
public const int CLIENT = 1;
public const int CAPTION = 2;
}
}

View file

@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace OnTopReplica.Native {
/// <summary>
/// Helpers for interop with native Windows hooks.
/// </summary>
static class HookMethods {
static HookMethods() {
WM_SHELLHOOKMESSAGE = RegisterWindowMessage("SHELLHOOK");
if (WM_SHELLHOOKMESSAGE == 0)
Console.Error.WriteLine("Failed to register SHELLHOOK Windows message.");
}
public static int WM_SHELLHOOKMESSAGE {
get;
private set;
}
public const int HSHELL_WINDOWACTIVATED = 4;
public const int HSHELL_RUDEAPPACTIVATED = HSHELL_WINDOWACTIVATED | HSHELL_HIGHBIT;
const int HSHELL_HIGHBIT = 0x8000;
public const int HSHELL_WINDOWDESTROYED = 2;
public const int HSHELL_WINDOWCREATED = 1;
/// <summary>
/// Registers the WM_ID for a window message.
/// </summary>
/// <param name="wndMessageName">Name of the window message.</param>
[DllImport("User32.dll")]
public static extern int RegisterWindowMessage(string wndMessageName);
/// <summary>
/// Registers a window as a shell hook window.
/// </summary>
[DllImport("User32.dll")]
public static extern bool RegisterShellHookWindow(IntPtr hwnd);
/// <summary>
/// Deregisters a window as a shell hook window.
/// </summary>
[DllImport("User32.dll")]
public static extern bool DeregisterShellHookWindow(IntPtr hwnd);
}
}

View file

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace OnTopReplica.Native {
[Flags]
public enum HotKeyModifiers : int {
Alt = 0x1,
Control = 0x2,
Shift = 0x4,
Windows = 0x8
}
static class HotKeyMethods {
public delegate void HotKeyHandler();
public const int WM_HOTKEY = 0x312;
[DllImport("user32.dll")]
public static extern bool RegisterHotKey(IntPtr hWnd, int id, int fsModifiers, int vlc);
[DllImport("user32.dll")]
public static extern bool UnregisterHotKey(IntPtr hWnd, int id);
public delegate void FormDelegate(HotKeyModifiers mod, Keys key, HotKeyHandler handler);
}
}

View file

@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace OnTopReplica.Native {
[ComImport,
Guid("56fdf342-fd6d-11d0-958a-006097c9a090"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface ITaskbarList {
/// <summary>
/// Initializes the taskbar list object. This method must be called before any other ITaskbarList methods can be called.
/// </summary>
void HrInit();
/// <summary>
/// Adds an item to the taskbar.
/// </summary>
/// <param name="hWnd">A handle to the window to be added to the taskbar.</param>
void AddTab([In] IntPtr hWnd);
/// <summary>
/// Deletes an item from the taskbar.
/// </summary>
/// <param name="hWnd">A handle to the window to be deleted from the taskbar.</param>
void DeleteTab([In] IntPtr hWnd);
/// <summary>
/// Activates an item on the taskbar. The window is not actually activated; the window's item on the taskbar is merely displayed as active.
/// </summary>
/// <param name="hWnd">A handle to the window on the taskbar to be displayed as active.</param>
void ActivateTab([In] IntPtr hWnd);
/// <summary>
/// Marks a taskbar item as active but does not visually activate it.
/// </summary>
/// <param name="hWnd">A handle to the window to be marked as active.</param>
void SetActiveAlt([In] IntPtr hWnd);
}
[ComImport]
[Guid("56fdf344-fd6d-11d0-958a-006097c9a090")]
public class CoTaskbarList {
}
}

14
OnTopReplica/Native/MK.cs Normal file
View file

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OnTopReplica.Native {
/// <summary>
/// Native Mouse click codes.
/// </summary>
static class MK {
public const int LBUTTON = 0x0001;
public const int RBUTTON = 0x0002;
public const int MBUTTON = 0x0010;
}
}

View file

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace OnTopReplica.Native {
/// <summary>
/// Common methods for Win32 messaging.
/// </summary>
static class MessagingMethods {
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)]
public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
[Flags]
public enum SendMessageTimeoutFlags : uint {
AbortIfHung = 2,
Block = 1,
Normal = 0
}
[DllImport("user32.dll")]
public static extern IntPtr SendMessageTimeout(IntPtr hwnd, uint message, IntPtr wparam, IntPtr lparam, SendMessageTimeoutFlags flags, uint timeout, out IntPtr result);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("user32.dll", SetLastError = false)]
public static extern bool PostMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
public static IntPtr MakeLParam(int LoWord, int HiWord) {
return new IntPtr((HiWord << 16) | (LoWord & 0xffff));
}
}
}

View file

@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace OnTopReplica.Native {
/// <summary>
/// Native Point structure.
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct NPoint {
public int X, Y;
public NPoint(int x, int y) {
X = x;
Y = y;
}
public NPoint(NPoint copy) {
X = copy.X;
Y = copy.Y;
}
public static NPoint FromPoint(System.Drawing.Point point) {
return new NPoint(point.X, point.Y);
}
public System.Drawing.Point ToPoint() {
return new System.Drawing.Point(X, Y);
}
public override string ToString() {
return "{" + X + "," + Y + "}";
}
}
}

View file

@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace OnTopReplica.Native {
/// <summary>A native Rectangle Structure.</summary>
[StructLayout(LayoutKind.Sequential)]
struct NRectangle {
public NRectangle(int left, int top, int right, int bottom) {
Left = left;
Top = top;
Right = right;
Bottom = bottom;
}
public NRectangle(System.Drawing.Rectangle rect) {
Left = rect.X;
Top = rect.Y;
Right = rect.Right;
Bottom = rect.Bottom;
}
public int Left;
public int Top;
public int Right;
public int Bottom;
public int Width {
get {
return Right - Left;
}
}
public int Height {
get {
return Bottom - Top;
}
}
public System.Drawing.Rectangle ToRectangle() {
return new System.Drawing.Rectangle(Left, Top, Right - Left, Bottom - Top);
}
public System.Drawing.Size Size {
get {
return new System.Drawing.Size(Width, Height);
}
}
}
}

28
OnTopReplica/Native/WM.cs Normal file
View file

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OnTopReplica.Native {
/// <summary>
/// Native Windows Message codes.
/// </summary>
static class WM {
public const int GETICON = 0x7f;
public const int SIZING = 0x214;
public const int NCHITTEST = 0x84;
public const int NCPAINT = 0x0085;
public const int LBUTTONDOWN = 0x0201;
public const int LBUTTONUP = 0x0202;
public const int LBUTTONDBLCLK = 0x0203;
public const int RBUTTONDOWN = 0x0204;
public const int RBUTTONUP = 0x0205;
public const int RBUTTONDBLCLK = 0x0206;
public const int NCLBUTTONUP = 0x00A2;
public const int NCLBUTTONDOWN = 0x00A1;
public const int NCLBUTTONDBLCLK = 0x00A3;
public const int NCRBUTTONUP = 0x00A5;
public const int SYSCOMMAND = 0x0112;
public const int GETTEXT = 0x000D;
public const int GETTEXTLENGTH = 0x000E;
}
}

View file

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OnTopReplica.Native {
/// <summary>
/// Native Win32 sizing codes (used by WM_SIZING message).
/// </summary>
static class WMSZ {
public const int LEFT = 1;
public const int RIGHT = 2;
public const int TOP = 3;
public const int BOTTOM = 6;
}
}

View file

@ -0,0 +1,88 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace OnTopReplica.Native {
/// <summary>
/// Common Win32 Window Manager native methods.
/// </summary>
static class WindowManagerMethods {
[DllImport("user32.dll")]
public static extern IntPtr GetForegroundWindow();
[DllImport("user32.dll")]
public static extern IntPtr RealChildWindowFromPoint(IntPtr parent, NPoint point);
[return: MarshalAs(UnmanagedType.Bool)]
public delegate bool EnumWindowsProc(IntPtr hWnd, IntPtr lParam);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool EnumWindows(EnumWindowsProc lpEnumFunc, IntPtr lParam);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool IsWindowVisible(IntPtr hWnd);
[DllImport("user32.dll")]
public static extern IntPtr GetDesktopWindow();
[DllImport("user32.dll")]
static extern bool ClientToScreen(IntPtr hwnd, ref NPoint point);
/// <summary>
/// Converts a point in client coordinates of a window to screen coordinates.
/// </summary>
/// <param name="hwnd">Handle to the window of the original point.</param>
/// <param name="clientPoint">Point expressed in client coordinates.</param>
/// <returns>Point expressed in screen coordinates.</returns>
public static NPoint ClientToScreen(IntPtr hwnd, NPoint clientPoint) {
NPoint localCopy = new NPoint(clientPoint);
if (ClientToScreen(hwnd, ref localCopy))
return localCopy;
else
return new NPoint();
}
[DllImport("user32.dll")]
static extern bool ScreenToClient(IntPtr hwnd, ref NPoint point);
/// <summary>
/// Converts a point in screen coordinates in client coordinates relative to a window.
/// </summary>
/// <param name="hwnd">Handle of the window whose client coordinate system should be used.</param>
/// <param name="screenPoint">Point expressed in screen coordinates.</param>
/// <returns>Point expressed in client coordinates.</returns>
public static NPoint ScreenToClient(IntPtr hwnd, NPoint screenPoint) {
NPoint localCopy = new NPoint(screenPoint);
if (ScreenToClient(hwnd, ref localCopy))
return localCopy;
else
return new NPoint();
}
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr GetParent(IntPtr hWnd);
[DllImport("user32.dll", SetLastError = false)]
public static extern bool SetForegroundWindow(IntPtr hwnd);
public enum GetWindowMode : uint {
GW_HWNDFIRST = 0,
GW_HWNDLAST = 1,
GW_HWNDNEXT = 2,
GW_HWNDPREV = 3,
GW_OWNER = 4,
GW_CHILD = 5,
GW_ENABLEDPOPUP = 6
}
[DllImport("user32.dll")]
public static extern IntPtr GetWindow(IntPtr hwnd, GetWindowMode mode);
}
}

View file

@ -0,0 +1,127 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace OnTopReplica.Native {
/// <summary>
/// Common Win32 methods for operating on windows.
/// </summary>
static class WindowMethods {
[DllImport("user32.dll", SetLastError = true)]
public static extern bool GetClientRect(IntPtr handle, out NRectangle rect);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
static extern int GetWindowText(IntPtr hWnd, [Out] StringBuilder lpString, int nMaxCount);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
static extern int GetWindowTextLength(IntPtr hWnd);
/// <summary>
/// Gets a window's text via API call.
/// </summary>
/// <param name="hwnd">Window handle.</param>
/// <returns>Title of the window.</returns>
public static string GetWindowText(IntPtr hwnd) {
int length = GetWindowTextLength(hwnd);
if (length > 0) {
StringBuilder sb = new StringBuilder(length + 1);
if (WindowMethods.GetWindowText(hwnd, sb, sb.Capacity) > 0)
return sb.ToString();
else
return String.Empty;
}
else
return String.Empty;
}
public enum WindowLong {
WndProc = (-4),
HInstance = (-6),
HwndParent = (-8),
Style = (-16),
ExStyle = (-20),
UserData = (-21),
Id = (-12)
}
public enum ClassLong {
Icon = -14,
IconSmall = -34
}
[Flags]
public enum WindowStyles : long {
None = 0,
Disabled = 0x8000000L,
Minimize = 0x20000000L,
MinimizeBox = 0x20000L,
Visible = 0x10000000L
}
[Flags]
public enum WindowExStyles : long {
AppWindow = 0x40000,
Layered = 0x80000,
NoActivate = 0x8000000L,
ToolWindow = 0x80,
TopMost = 8,
Transparent = 0x20
}
public static IntPtr GetWindowLong(IntPtr hWnd, WindowLong i) {
if (IntPtr.Size == 8) {
return GetWindowLongPtr64(hWnd, i);
}
else {
return new IntPtr(GetWindowLong32(hWnd, i));
}
}
[DllImport("user32.dll", EntryPoint = "GetWindowLong")]
static extern int GetWindowLong32(IntPtr hWnd, WindowLong nIndex);
[DllImport("user32.dll", EntryPoint = "GetWindowLongPtr")]
static extern IntPtr GetWindowLongPtr64(IntPtr hWnd, WindowLong nIndex);
public static IntPtr SetWindowLong(IntPtr hWnd, WindowLong i, IntPtr dwNewLong) {
if (IntPtr.Size == 8) {
return SetWindowLongPtr64(hWnd, i, dwNewLong);
}
else {
return new IntPtr(SetWindowLong32(hWnd, i, dwNewLong.ToInt32()));
}
}
[DllImport("user32.dll", EntryPoint = "SetWindowLong")]
static extern int SetWindowLong32(IntPtr hWnd, WindowLong nIndex, int dwNewLong);
[DllImport("user32.dll", EntryPoint = "SetWindowLongPtr")]
static extern IntPtr SetWindowLongPtr64(IntPtr hWnd, WindowLong nIndex, IntPtr dwNewLong);
#region Class styles
[DllImport("user32.dll", EntryPoint = "GetClassLongPtrW")]
static extern IntPtr GetClassLong64(IntPtr hWnd, int nIndex);
[DllImport("user32.dll", EntryPoint = "GetClassLongW")]
static extern int GetClassLong32(IntPtr hWnd, int nIndex);
public static IntPtr GetClassLong(IntPtr hWnd, ClassLong i) {
if (IntPtr.Size == 8) {
return GetClassLong64(hWnd, (int)i);
}
else {
return new IntPtr(GetClassLong32(hWnd, (int)i));
}
}
#endregion
[DllImport("user32.dll")]
public static extern IntPtr GetMenu(IntPtr hwnd);
}
}

View file

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace OnTopReplica.Native {
static class WindowsSevenMethods {
[DllImport("shell32.dll")]
internal static extern void SetCurrentProcessExplicitAppUserModelID(
[MarshalAs(UnmanagedType.LPWStr)] string AppID);
[DllImport("shell32.dll")]
internal static extern void GetCurrentProcessExplicitAppUserModelID(
[Out(), MarshalAs(UnmanagedType.LPWStr)] out string AppID);
}
}

View file

@ -0,0 +1,587 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Diagnostics.CodeAnalysis;
using System.Windows.Forms;
using System.Windows.Forms.VisualStyles;
using System.Runtime.InteropServices;
namespace Asztal.Szótár {
public enum ToolbarTheme {
Toolbar,
MediaToolbar,
CommunicationsToolbar,
BrowserTabBar
}
/// <summary>
/// Renders a toolstrip using the UxTheme API via VisualStyleRenderer. Visual styles must be supported for this to work; if you need to support other operating systems use
/// </summary>
class UXThemeToolStripRenderer : ToolStripSystemRenderer {
/// <summary>
/// It shouldn't be necessary to P/Invoke like this, however a bug in VisualStyleRenderer.GetMargins forces my hand.
/// </summary>
static internal class NativeMethods {
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct MARGINS {
public int cxLeftWidth;
public int cxRightWidth;
public int cyTopHeight;
public int cyBottomHeight;
}
[DllImport("uxtheme", ExactSpelling = true)]
public extern static Int32 GetThemeMargins(IntPtr hTheme, IntPtr hdc, int iPartId, int iStateId, int iPropId, IntPtr rect, out MARGINS pMargins);
}
//See http://msdn2.microsoft.com/en-us/library/bb773210.aspx - "Parts and States"
#region Parts and States
enum MenuParts : int {
MENU_MENUITEM_TMSCHEMA = 1,
MENU_MENUDROPDOWN_TMSCHEMA = 2,
MENU_MENUBARITEM_TMSCHEMA = 3,
MENU_MENUBARDROPDOWN_TMSCHEMA = 4,
MENU_CHEVRON_TMSCHEMA = 5,
MENU_SEPARATOR_TMSCHEMA = 6,
MENU_BARBACKGROUND = 7,
MENU_BARITEM = 8,
MENU_POPUPBACKGROUND = 9,
MENU_POPUPBORDERS = 10,
MENU_POPUPCHECK = 11,
MENU_POPUPCHECKBACKGROUND = 12,
MENU_POPUPGUTTER = 13,
MENU_POPUPITEM = 14,
MENU_POPUPSEPARATOR = 15,
MENU_POPUPSUBMENU = 16,
MENU_SYSTEMCLOSE = 17,
MENU_SYSTEMMAXIMIZE = 18,
MENU_SYSTEMMINIMIZE = 19,
MENU_SYSTEMRESTORE = 20
}
enum MenuBarStates : int {
MB_ACTIVE = 1,
MB_INACTIVE = 2
}
enum MenuBarItemStates : int {
MBI_NORMAL = 1,
MBI_HOT = 2,
MBI_PUSHED = 3,
MBI_DISABLED = 4,
MBI_DISABLEDHOT = 5,
MBI_DISABLEDPUSHED = 6
}
enum MenuPopupItemStates : int {
MPI_NORMAL = 1,
MPI_HOT = 2,
MPI_DISABLED = 3,
MPI_DISABLEDHOT = 4
}
enum MenuPopupCheckStates : int {
MC_CHECKMARKNORMAL = 1,
MC_CHECKMARKDISABLED = 2,
MC_BULLETNORMAL = 3,
MC_BULLETDISABLED = 4
}
enum MenuPopupCheckBackgroundStates : int {
MCB_DISABLED = 1,
MCB_NORMAL = 2,
MCB_BITMAP = 3
}
enum MenuPopupSubMenuStates : int {
MSM_NORMAL = 1,
MSM_DISABLED = 2
}
enum MarginTypes : int {
TMT_SIZINGMARGINS = 3601,
TMT_CONTENTMARGINS = 3602,
TMT_CAPTIONMARGINS = 3603
}
const int RP_BACKGROUND = 6;
#endregion
#region Theme helpers
Padding GetThemeMargins(IDeviceContext dc, MarginTypes marginType) {
NativeMethods.MARGINS margins;
try {
IntPtr hDC = dc.GetHdc();
if (0 == NativeMethods.GetThemeMargins(renderer.Handle, hDC, renderer.Part, renderer.State, (int)marginType, IntPtr.Zero, out margins))
return new Padding(margins.cxLeftWidth, margins.cyTopHeight, margins.cxRightWidth, margins.cyBottomHeight);
return new Padding(-1);
} finally {
dc.ReleaseHdc();
}
}
private static int GetItemState(ToolStripItem item) {
bool pressed = item.Pressed;
bool hot = item.Selected;
if (item.Owner.IsDropDown) {
if (item.Enabled)
return hot ? (int)MenuPopupItemStates.MPI_HOT : (int)MenuPopupItemStates.MPI_NORMAL;
return hot ? (int)MenuPopupItemStates.MPI_DISABLEDHOT : (int)MenuPopupItemStates.MPI_DISABLED;
} else {
if (pressed)
return item.Enabled ? (int)MenuBarItemStates.MBI_PUSHED : (int)MenuBarItemStates.MBI_DISABLEDPUSHED;
if (item.Enabled)
return hot ? (int)MenuBarItemStates.MBI_HOT : (int)MenuBarItemStates.MBI_NORMAL;
return hot ? (int)MenuBarItemStates.MBI_DISABLEDHOT : (int)MenuBarItemStates.MBI_DISABLED;
}
}
#endregion
#region Theme subclasses
public ToolbarTheme Theme {
get; set;
}
private string RebarClass {
get {
return SubclassPrefix + "Rebar";
}
}
private string ToolbarClass {
get {
return SubclassPrefix + "ToolBar";
}
}
private string MenuClass {
get {
return SubclassPrefix + "Menu";
}
}
private string SubclassPrefix {
get {
switch (Theme) {
case ToolbarTheme.MediaToolbar: return "Media::";
case ToolbarTheme.CommunicationsToolbar: return "Communications::";
case ToolbarTheme.BrowserTabBar: return "BrowserTabBar::";
default: return string.Empty;
}
}
}
private VisualStyleElement Subclass(VisualStyleElement element) {
return VisualStyleElement.CreateElement(SubclassPrefix + element.ClassName,
element.Part, element.State);
}
#endregion
VisualStyleRenderer renderer;
public UXThemeToolStripRenderer(ToolbarTheme theme) {
Theme = theme;
renderer = new VisualStyleRenderer(VisualStyleElement.Button.PushButton.Normal);
}
#region Borders
protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) {
renderer.SetParameters(MenuClass, (int)MenuParts.MENU_POPUPBORDERS, 0);
if (e.ToolStrip.IsDropDown) {
Region oldClip = e.Graphics.Clip;
//Tool strip borders are rendered *after* the content, for some reason.
//So we have to exclude the inside of the popup otherwise we'll draw over it.
Rectangle insideRect = e.ToolStrip.ClientRectangle;
insideRect.Inflate(-1, -1);
e.Graphics.ExcludeClip(insideRect);
renderer.DrawBackground(e.Graphics, e.ToolStrip.ClientRectangle, e.AffectedBounds);
//Restore the old clip in case the Graphics is used again (does that ever happen?)
e.Graphics.Clip = oldClip;
}
}
#endregion
#region Backgrounds
protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e) {
int partId = e.Item.Owner.IsDropDown ? (int)MenuParts.MENU_POPUPITEM : (int)MenuParts.MENU_BARITEM;
renderer.SetParameters(MenuClass, partId, GetItemState(e.Item));
Rectangle bgRect = e.Item.ContentRectangle;
Padding content = GetThemeMargins(e.Graphics, MarginTypes.TMT_CONTENTMARGINS),
sizing = GetThemeMargins(e.Graphics, MarginTypes.TMT_SIZINGMARGINS),
caption = GetThemeMargins(e.Graphics, MarginTypes.TMT_CAPTIONMARGINS);
if (!e.Item.Owner.IsDropDown) {
bgRect.Y = 0;
bgRect.Height = e.ToolStrip.Height;
bgRect.Inflate(-1, -1); //GetMargins here perhaps?
}
renderer.DrawBackground(e.Graphics, bgRect, bgRect);
}
protected override void OnRenderToolStripPanelBackground(ToolStripPanelRenderEventArgs e) {
//Draw the background using Rebar & RP_BACKGROUND (or, if that is not available, fall back to
//Rebar.Band.Normal)
if (VisualStyleRenderer.IsElementDefined(VisualStyleElement.CreateElement(RebarClass, RP_BACKGROUND, 0))) {
renderer.SetParameters(RebarClass, RP_BACKGROUND, 0);
} else {
renderer.SetParameters(RebarClass, 0, 0);
//renderer.SetParameters(VisualStyleElement.Taskbar.BackgroundBottom.Normal);
//renderer.SetParameters(Subclass(VisualStyleElement.Rebar.Band.Normal));
}
if (renderer.IsBackgroundPartiallyTransparent())
renderer.DrawParentBackground(e.Graphics, e.ToolStripPanel.ClientRectangle, e.ToolStripPanel);
renderer.DrawBackground(e.Graphics, e.ToolStripPanel.ClientRectangle);
//Draw the etched edges of each row.
//renderer.SetParameters(Subclass(VisualStyleElement.Rebar.Band.Normal));
//foreach (ToolStripPanelRow row in e.ToolStripPanel.Rows) {
// Rectangle rowBounds = row.Bounds;
// rowBounds.Offset(0, -1);
// renderer.DrawEdge(e.Graphics, rowBounds, Edges.Top, EdgeStyle.Etched, EdgeEffects.None);
//}
e.Handled = true;
}
//Render the background of an actual menu bar, dropdown menu or toolbar.
protected override void OnRenderToolStripBackground(System.Windows.Forms.ToolStripRenderEventArgs e) {
if (e.ToolStrip.IsDropDown) {
renderer.SetParameters(MenuClass, (int)MenuParts.MENU_POPUPBACKGROUND, 0);
} else {
//It's a MenuStrip or a ToolStrip. If it's contained inside a larger panel, it should have a
//transparent background, showing the panel's background.
if (e.ToolStrip.Parent is ToolStripPanel) {
//The background should be transparent, because the ToolStripPanel's background will be visible.
//(Of course, we assume the ToolStripPanel is drawn using the same theme, but it's not my fault
//if someone does that.)
return;
} else {
//A lone toolbar/menubar should act like it's inside a toolbox, I guess.
//Maybe I should use the MenuClass in the case of a MenuStrip, although that would break
//the other themes...
if(VisualStyleRenderer.IsElementDefined(VisualStyleElement.CreateElement(RebarClass, RP_BACKGROUND, 0)))
renderer.SetParameters(RebarClass, RP_BACKGROUND, 0);
else
renderer.SetParameters(RebarClass, 0, 0);
}
}
if (renderer.IsBackgroundPartiallyTransparent())
renderer.DrawParentBackground(e.Graphics, e.ToolStrip.ClientRectangle, e.ToolStrip);
renderer.DrawBackground(e.Graphics, e.ToolStrip.ClientRectangle, e.AffectedBounds);
}
protected override void OnRenderToolStripContentPanelBackground(ToolStripContentPanelRenderEventArgs e) {
//e.Graphics.FillRectangle(Brushes.RosyBrown, e.ToolStripContentPanel.ClientRectangle);
//base.OnRenderToolStripContentPanelBackground(e);
}
//Some sort of chevron thing?
//protected override void OnRenderOverflowButtonBackground(ToolStripItemRenderEventArgs e) {
// base.OnRenderOverflowButtonBackground(e);
//}
#endregion
#region Text
protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e) {
int partId = e.Item.Owner.IsDropDown ? (int)MenuParts.MENU_POPUPITEM : (int)MenuParts.MENU_BARITEM;
renderer.SetParameters(MenuClass, partId, GetItemState(e.Item));
Color color = renderer.GetColor(ColorProperty.TextColor);
if(e.Item.Owner.IsDropDown || e.Item.Owner is MenuStrip)
e.TextColor = color;
base.OnRenderItemText(e);
}
#endregion
#region Glyphs
//protected override void OnRenderGrip(ToolStripGripRenderEventArgs e) {
// if (e.GripStyle == ToolStripGripStyle.Visible) {
// renderer.SetParameters(VisualStyleElement.Rebar.Gripper.Normal);
// renderer.DrawBackground(e.Graphics, e.GripBounds, e.AffectedBounds);
// }
//}
protected override void OnRenderImageMargin(ToolStripRenderEventArgs e) {
if (e.ToolStrip.IsDropDown) {
renderer.SetParameters(MenuClass, (int)MenuParts.MENU_POPUPGUTTER, 0);
Rectangle displayRect = e.ToolStrip.DisplayRectangle,
marginRect = new Rectangle(0, displayRect.Top, displayRect.Left, displayRect.Height);
//e.Graphics.DrawRectangle(Pens.Black, marginRect);
renderer.DrawBackground(e.Graphics, marginRect, marginRect);
}
}
protected override void OnRenderSeparator(ToolStripSeparatorRenderEventArgs e) {
if (e.ToolStrip.IsDropDown) {
renderer.SetParameters(MenuClass, (int)MenuParts.MENU_POPUPSEPARATOR, 0);
Rectangle rect = new Rectangle(e.ToolStrip.DisplayRectangle.Left, 0, e.ToolStrip.DisplayRectangle.Width, e.Item.Height);
renderer.DrawBackground(e.Graphics, rect, rect);
} else {
base.OnRenderSeparator(e);
}
}
protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e) {
ToolStripMenuItem item = e.Item as ToolStripMenuItem;
if (item != null) {
if (item.Checked) {
Rectangle rect = e.Item.ContentRectangle;
rect.Width = rect.Height;
//Center the checkmark horizontally in the gutter (looks ugly, though)
//rect.X = (e.ToolStrip.DisplayRectangle.Left - rect.Width) / 2;
renderer.SetParameters(MenuClass, (int)MenuParts.MENU_POPUPCHECKBACKGROUND, e.Item.Enabled ? (int)MenuPopupCheckBackgroundStates.MCB_NORMAL : (int)MenuPopupCheckBackgroundStates.MCB_DISABLED);
renderer.DrawBackground(e.Graphics, rect);
Padding margins = GetThemeMargins(e.Graphics, MarginTypes.TMT_SIZINGMARGINS);
rect = new Rectangle(rect.X + margins.Left, rect.Y + margins.Top,
rect.Width - margins.Horizontal,
rect.Height - margins.Vertical);
//I don't think ToolStrip even supports radio box items. So no need to render them.
renderer.SetParameters(MenuClass, (int)MenuParts.MENU_POPUPCHECK, e.Item.Enabled ? (int)MenuPopupCheckStates.MC_CHECKMARKNORMAL : (int)MenuPopupCheckStates.MC_CHECKMARKDISABLED);
renderer.DrawBackground(e.Graphics, rect);
}
} else {
base.OnRenderItemCheck(e);
}
}
//This is broken for RTL
protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e) {
int stateId = e.Item.Enabled ? (int)MenuPopupSubMenuStates.MSM_NORMAL : (int)MenuPopupSubMenuStates.MSM_DISABLED;
renderer.SetParameters(MenuClass, (int)MenuParts.MENU_POPUPSUBMENU, stateId);
renderer.DrawBackground(e.Graphics, e.ArrowRectangle);
}
protected override void OnRenderOverflowButtonBackground(ToolStripItemRenderEventArgs e) {
renderer.SetParameters(RebarClass, VisualStyleElement.Rebar.Chevron.Normal.Part, VisualStyleElement.Rebar.Chevron.Normal.State);
renderer.DrawBackground(e.Graphics, e.Item.ContentRectangle);
//base.OnRenderOverflowButtonBackground(e);
}
#endregion
public static bool IsSupported {
get {
if (!VisualStyleRenderer.IsSupported)
return false;
return VisualStyleRenderer.IsElementDefined(VisualStyleElement.CreateElement("MENU", (int)MenuParts.MENU_BARBACKGROUND, (int)MenuBarStates.MB_ACTIVE));
}
}
}
/// <summary>
/// Renders a toolstrip using UXTheme if possible, and switches back to the default
/// ToolStripRenderer when UXTheme-based rendering is not available.
/// Designed for menu bars and context menus - it is not guaranteed to work with anything else.
/// </summary>
/// <example>
/// NativeToolStripRenderer.SetToolStripRenderer(toolStrip1, toolStrip2, contextMenuStrip1);
/// </example>
/// <example>
/// toolStrip1.Renderer = new NativeToolStripRenderer();
/// </example>
public class NativeToolStripRenderer : ToolStripRenderer {
UXThemeToolStripRenderer nativeRenderer;
ToolStripRenderer defaultRenderer;
ToolStrip toolStrip;
//NativeToolStripRenderer looks best with no padding - but keep the old padding in case the
//visual styles become unsupported again (e.g. user changes to windows classic skin)
Padding defaultPadding;
#region Constructors
/// <summary>
/// Creates a NativeToolStripRenderer for a particular ToolStrip. NativeToolStripRenderer will subscribe to some events
/// of this ToolStrip.
/// </summary>
/// <param name="toolStrip">The toolstrip for this NativeToolStripRenderer. NativeToolStripRenderer will subscribe to some events
/// of this ToolStrip.</param>
public NativeToolStripRenderer(ToolStrip toolStrip, ToolbarTheme theme) {
if (toolStrip == null)
throw new ArgumentNullException("toolStrip", "ToolStrip cannot be null.");
Theme = theme;
this.toolStrip = toolStrip;
defaultRenderer = toolStrip.Renderer;
defaultPadding = toolStrip.Padding;
toolStrip.SystemColorsChanged += new EventHandler(toolStrip_SystemColorsChanged);
//Can't initialize here - constructor throws if visual styles not enabled
//nativeRenderer = new NativeToolStripRenderer();
}
public NativeToolStripRenderer(ToolStripPanel panel, ToolbarTheme theme) {
if (panel == null)
throw new ArgumentNullException("panel", "Panel cannot be null.");
Theme = theme;
this.toolStrip = null;
defaultRenderer = panel.Renderer;
}
#endregion
public ToolbarTheme Theme { get; set; }
void toolStrip_SystemColorsChanged(object sender, EventArgs e) {
if (toolStrip == null)
return;
if (UXThemeToolStripRenderer.IsSupported)
toolStrip.Padding = Padding.Empty;
else
toolStrip.Padding = defaultPadding;
}
//This is indeed called every time a menu part is rendered, but I can't
//find a way of caching it that I can be sure has no race conditions.
//The check is no longer very costly, anyway.
protected ToolStripRenderer ActualRenderer {
get {
bool nativeSupported = UXThemeToolStripRenderer.IsSupported;
if (nativeSupported) {
if (nativeRenderer == null)
nativeRenderer = new UXThemeToolStripRenderer(Theme);
return nativeRenderer;
}
return defaultRenderer;
}
}
#region InitializeXXX
protected override void Initialize(ToolStrip toolStrip) {
base.Initialize(toolStrip);
toolStrip.Padding = Padding.Empty;
if (/*!(toolStrip is MenuStrip) &&*/ toolStrip.Parent is ToolStripPanel) {
toolStrip.BackColor = Color.Transparent;
}
}
protected override void InitializePanel(ToolStripPanel toolStripPanel) {
base.InitializePanel(toolStripPanel);
}
protected override void InitializeItem(ToolStripItem item) {
base.InitializeItem(item);
}
#endregion
#region SetToolStripRenderer
/// <summary>
/// Sets the renderer of each ToolStrip to a NativeToolStripRenderer. A convenience method.
/// </summary>
/// <param name="toolStrips">A parameter list of ToolStrips.</param>
[SuppressMessage("Microsoft.Design", "CA1062")] //The parameter array is actually checked.
public static void SetToolStripRenderer(ToolbarTheme theme, params Control[] toolStrips) {
foreach (Control ts in toolStrips) {
if (ts == null)
throw new ArgumentNullException("toolStrips", "ToolStrips cannot contain a null reference.");
}
foreach (Control ts in toolStrips) {
if (ts is ToolStrip) {
ToolStrip t = (ToolStrip)ts;
t.Renderer = new NativeToolStripRenderer(t, theme);
} else if (ts is ToolStripPanel) {
ToolStripPanel t = (ToolStripPanel)ts;
t.Renderer = new NativeToolStripRenderer(t, theme);
} else
throw new ArgumentException("Can't set the renderer for a " + ts.GetType().Name);
}
}
public static void SetToolStripRenderer(params Control[] toolStrips) {
SetToolStripRenderer(ToolbarTheme.Toolbar, toolStrips);
}
#endregion
#region Overridden Methods - Deferred to actual renderer
protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e) {
ActualRenderer.DrawArrow(e);
}
protected override void OnRenderButtonBackground(ToolStripItemRenderEventArgs e) {
ActualRenderer.DrawButtonBackground(e);
}
protected override void OnRenderDropDownButtonBackground(ToolStripItemRenderEventArgs e) {
ActualRenderer.DrawDropDownButtonBackground(e);
}
protected override void OnRenderGrip(ToolStripGripRenderEventArgs e) {
ActualRenderer.DrawGrip(e);
}
protected override void OnRenderImageMargin(ToolStripRenderEventArgs e) {
ActualRenderer.DrawImageMargin(e);
}
protected override void OnRenderItemBackground(ToolStripItemRenderEventArgs e) {
ActualRenderer.DrawItemBackground(e);
}
protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e) {
ActualRenderer.DrawItemCheck(e);
}
protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e) {
ActualRenderer.DrawItemImage(e);
}
protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e) {
ActualRenderer.DrawItemText(e);
}
protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e) {
ActualRenderer.DrawMenuItemBackground(e);
}
protected override void OnRenderSeparator(ToolStripSeparatorRenderEventArgs e) {
ActualRenderer.DrawSeparator(e);
}
protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e) {
ActualRenderer.DrawToolStripBackground(e);
}
protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) {
ActualRenderer.DrawToolStripBorder(e);
}
protected override void OnRenderToolStripContentPanelBackground(ToolStripContentPanelRenderEventArgs e) {
ActualRenderer.DrawToolStripContentPanelBackground(e);
}
protected override void OnRenderToolStripPanelBackground(ToolStripPanelRenderEventArgs e) {
ActualRenderer.DrawToolStripPanelBackground(e);
}
#endregion
}
}

View file

@ -0,0 +1,84 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using OnTopReplica.Properties;
namespace OnTopReplica {
/// <summary>
/// Notification icon that installs itself in the "tray" and manipulates the OnTopReplica main form.
/// </summary>
class NotificationIcon : IDisposable {
public NotificationIcon(MainForm form) {
Form = form;
Install();
}
public MainForm Form { get; private set; }
NotifyIcon _taskIcon;
ContextMenuStrip _contextMenu;
private void Install() {
_contextMenu = new ContextMenuStrip();
_contextMenu.Items.AddRange(new ToolStripItem[] {
new ToolStripMenuItem(Strings.MenuOpen, Resources.icon, TaskIconOpen_click) {
ToolTipText = Strings.MenuOpenTT,
},
new ToolStripMenuItem(Strings.MenuWindows, Resources.list){
DropDown = Form.MenuWindows,
ToolTipText = Strings.MenuWindowsTT
},
new ToolStripMenuItem(Strings.MenuReset, null, TaskIconReset_click){
ToolTipText = Strings.MenuResetTT
},
new ToolStripMenuItem(Strings.MenuClose, Resources.close_new, TaskIconExit_click){
ToolTipText = Strings.MenuCloseTT
}
});
Asztal.Szótár.NativeToolStripRenderer.SetToolStripRenderer(_contextMenu);
_taskIcon = new NotifyIcon {
Text = Strings.ApplicationName,
Icon = Resources.icon_new,
Visible = true,
ContextMenuStrip = _contextMenu
};
_taskIcon.DoubleClick += new EventHandler(TaskIcon_doubleclick);
}
#region IDisposable Members
public void Dispose() {
//Destroy NotifyIcon
if (_taskIcon != null) {
_taskIcon.Visible = false;
_taskIcon.Dispose();
_taskIcon = null;
}
}
#endregion
#region Task Icon events
void TaskIcon_doubleclick(object sender, EventArgs e) {
Form.EnsureMainFormVisible();
}
private void TaskIconOpen_click(object sender, EventArgs e) {
Form.EnsureMainFormVisible();
}
private void TaskIconReset_click(object sender, EventArgs e) {
Form.ResetMainFormWithConfirmation();
}
private void TaskIconExit_click(object sender, EventArgs e) {
Form.Close();
}
#endregion
}
}

View file

@ -0,0 +1,424 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{E626BD6E-BF38-4EB7-A128-5CA6F40EF557}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OnTopReplica</RootNamespace>
<AssemblyName>OnTopReplica</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ApplicationIcon>Assets\icon-new.ico</ApplicationIcon>
<IsWebBootstrapper>false</IsWebBootstrapper>
<GenerateManifests>false</GenerateManifests>
<TargetZone>Internet</TargetZone>
<StartupObject>OnTopReplica.Program</StartupObject>
<ExcludedPermissions>
</ExcludedPermissions>
<SignAssembly>false</SignAssembly>
<ManifestCertificateThumbprint>A305A505E19CF40E069521C80C13AB3C900EDB7C</ManifestCertificateThumbprint>
<ManifestKeyFile>OnTopReplica_1_TemporaryKey.pfx</ManifestKeyFile>
<SignManifests>false</SignManifests>
<TargetFrameworkSubset>
</TargetFrameworkSubset>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>true</UpdateEnabled>
<UpdateMode>Background</UpdateMode>
<UpdateInterval>1</UpdateInterval>
<UpdateIntervalUnits>Weeks</UpdateIntervalUnits>
<UpdatePeriodically>true</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<UpdateUrl>http://www.klopfenstein.net/public/Uploads/ontopreplica/</UpdateUrl>
<SupportUrl>http://www.klopfenstein.net/lorenz.aspx/ontopreplica</SupportUrl>
<TargetCulture>en</TargetCulture>
<ProductName>OnTopReplica</ProductName>
<PublisherName>Lorenz Cuno Klopfenstein</PublisherName>
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.htm</WebPage>
<OpenBrowserOnPublish>false</OpenBrowserOnPublish>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>3.0.2.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>
</DocumentationFile>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<UseVSHostingProcess>true</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>true</DebugSymbols>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup />
<PropertyGroup />
<PropertyGroup />
<PropertyGroup />
<PropertyGroup />
<PropertyGroup />
<PropertyGroup>
<ApplicationManifest>OnTopReplica.exe.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="VistaControls, Version=1.3.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Lib\VistaControls.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AboutForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="AboutForm.Designer.cs">
<DependentUpon>AboutForm.cs</DependentUpon>
</Compile>
<Compile Include="AspectRatioForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="CloneClickEventArgs.cs" />
<Compile Include="CloseRequestEventArgs.cs" />
<Compile Include="MainForm_Gui.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainForm_MenuEvents.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainForm_ChildForms.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MessagePumpManager.cs" />
<Compile Include="MessagePumpProcessors\GroupSwitchManager.cs" />
<Compile Include="IMessagePumpProcessor.cs" />
<Compile Include="MessagePumpProcessors\BaseMessagePumpProcessor.cs" />
<None Include="MessagePumpProcessors\TitleSetter.cs" />
<Compile Include="MessagePumpProcessors\WindowKeeper.cs" />
<Compile Include="Native\ErrorMethods.cs" />
<Compile Include="Native\HookMethods.cs" />
<Compile Include="Native\HotKeyMethods.cs" />
<Compile Include="Native\HT.cs" />
<None Include="Native\ITaskBarList.cs" />
<Compile Include="Native\MessagingMethods.cs" />
<Compile Include="Native\MK.cs" />
<Compile Include="Native\Point.cs" />
<Compile Include="Native\Rectangle.cs" />
<Compile Include="Native\WindowManagerMethods.cs" />
<Compile Include="Native\WindowMethods.cs" />
<Compile Include="Native\WM.cs" />
<Compile Include="Native\WMSZ.cs" />
<Compile Include="NotificationIcon.cs" />
<Compile Include="SidePanel.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="SidePanels\GroupSwitchPanel.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="SidePanels\GroupSwitchPanel.Designer.cs">
<DependentUpon>GroupSwitchPanel.cs</DependentUpon>
</Compile>
<Compile Include="StoredRegionComparer.cs" />
<Compile Include="Native\WindowsSevenMethods.cs" />
<None Include="Native\CommonControls.cs" />
<Compile Include="EnumerationExtensions.cs" />
<Compile Include="MessagePumpProcessors\HotKeyManager.cs" />
<Compile Include="PlatformSupport.cs" />
<Compile Include="Platforms\Other.cs" />
<Compile Include="Platforms\WindowsSeven.cs" />
<Compile Include="Platforms\WindowsVista.cs" />
<Compile Include="Platforms\WindowsXp.cs" />
<Compile Include="Strings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Strings.resx</DependentUpon>
</Compile>
<Compile Include="FocusedTextBox.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="NativeToolStripRenderer.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="AboutForm.resx">
<DependentUpon>AboutForm.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="SidePanels\GroupSwitchPanel.resx">
<DependentUpon>GroupSwitchPanel.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Strings.cs.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Strings.cs.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Strings.da.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Strings.da.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Strings.it.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Strings.it.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="SidePanels\RegionPanel.resx">
<DependentUpon>RegionPanel.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Strings.resx">
<LastGenOutput>Strings.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
<Generator>ResXFileCodeGenerator</Generator>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="OnTopReplica.exe.manifest" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="SidePanels\RegionPanel.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="SidePanels\RegionPanel.Designer.cs">
<DependentUpon>RegionPanel.cs</DependentUpon>
</Compile>
<Compile Include="StoredRegion.cs" />
<Compile Include="StoredRegionArray.cs" />
<Compile Include="ThumbnailPanel.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Update\UpdateCheckCompletedEventArgs.cs" />
<Compile Include="Update\UpdateInformation.cs" />
<Compile Include="Update\UpdateManager.cs" />
<Compile Include="Win32Helper.cs" />
<Compile Include="WindowHandle.cs" />
<Compile Include="WindowListHelper.cs" />
<Compile Include="WindowManager.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Assets\windows.png" />
</ItemGroup>
<ItemGroup>
<None Include="Assets\window16.png" />
</ItemGroup>
<ItemGroup>
<None Include="Assets\window_border16.png" />
</ItemGroup>
<ItemGroup>
<None Include="Assets\window_opacity16.png" />
</ItemGroup>
<ItemGroup>
<None Include="Assets\window_multiple16.png" />
</ItemGroup>
<ItemGroup>
<None Include="Assets\reduce.png" />
</ItemGroup>
<ItemGroup>
<None Include="Assets\fullscreen.png" />
<None Include="Assets\clickforwarding.png" />
<None Include="Assets\groupmode.png" />
<Content Include="Assets\xiao_arrow.png" />
<None Include="Assets\xiao_help.png" />
<None Include="Assets\window_opacity_new.png" />
<None Include="Assets\xiao_wrench.png" />
<None Include="Assets\xiao_delete.png" />
<None Include="Assets\xiao_add.png" />
<None Include="Assets\xiao_ok.png" />
<None Include="Assets\flag_danish.png" />
<None Include="Assets\newicon.png" />
<None Include="Assets\regions_new.png" />
<None Include="Assets\desktop.png" />
<None Include="Assets\list.png" />
<Content Include="Assets\icon-new.ico" />
<Content Include="Assets\screenshot-icon.ico" />
<Content Include="Assets\window_multiple16.ico" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
<Visible>False</Visible>
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
<Visible>False</Visible>
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="Assets\back.png" />
<None Include="Assets\arrow_down.png" />
<None Include="Assets\arrow_up.png" />
<None Include="Assets\component.png" />
<None Include="Assets\flag_usa.png" />
<None Include="Assets\flag_ita.png" />
<None Include="Assets\flag_czech.png" />
<Content Include="Assets\icon.ico" />
<None Include="Assets\regions.png" />
<None Include="Assets\x-oblique.png" />
<None Include="Assets\xiao_up.png" />
<None Include="Assets\xiao_down.png" />
<None Include="Assets\thumbs_up.png" />
<None Include="Assets\pos_null.png" />
<None Include="Assets\pos_topright.png" />
<None Include="Assets\pos_topleft.png" />
<None Include="Assets\pos_bottomright.png" />
<None Include="Assets\pos_bottomleft.png" />
<None Include="Assets\window_switch.png" />
<None Include="Assets\icon.png" />
</ItemGroup>
<ItemGroup>
<PublishFile Include="Assets\icon.ico">
<Visible>False</Visible>
<Group>
</Group>
<TargetPath>
</TargetPath>
<PublishState>Exclude</PublishState>
<IncludeHash>True</IncludeHash>
<FileType>File</FileType>
</PublishFile>
<PublishFile Include="Assets\screenshot-icon.ico">
<Visible>False</Visible>
<Group>
</Group>
<TargetPath>
</TargetPath>
<PublishState>Exclude</PublishState>
<IncludeHash>True</IncludeHash>
<FileType>File</FileType>
</PublishFile>
<PublishFile Include="Assets\window_multiple16.ico">
<Visible>False</Visible>
<Group>
</Group>
<TargetPath>
</TargetPath>
<PublishState>Exclude</PublishState>
<IncludeHash>True</IncludeHash>
<FileType>File</FileType>
</PublishFile>
<PublishFile Include="Assets\xiao_arrow.png">
<Visible>False</Visible>
<Group>
</Group>
<TargetPath>
</TargetPath>
<PublishState>Exclude</PublishState>
<IncludeHash>True</IncludeHash>
<FileType>File</FileType>
</PublishFile>
<PublishFile Include="cs\OnTopReplica.resources">
<Visible>False</Visible>
<Group>
</Group>
<TargetPath>
</TargetPath>
<PublishState>Include</PublishState>
<IncludeHash>True</IncludeHash>
<FileType>Satellite</FileType>
</PublishFile>
<PublishFile Include="da\OnTopReplica.resources">
<Visible>False</Visible>
<Group>
</Group>
<TargetPath>
</TargetPath>
<PublishState>Include</PublishState>
<IncludeHash>True</IncludeHash>
<FileType>Satellite</FileType>
</PublishFile>
<PublishFile Include="it\OnTopReplica.resources">
<Visible>False</Visible>
<Group>
</Group>
<TargetPath>
</TargetPath>
<PublishState>Include</PublishState>
<IncludeHash>True</IncludeHash>
<FileType>Satellite</FileType>
</PublishFile>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishUrlHistory>publish\</PublishUrlHistory>
<InstallUrlHistory>http://www.klopfenstein.net/public/Uploads/ontopreplica/|http://www.klopfenstein.net/download.aspx%3ffile=ontopreplica%252fsetup.exe/|http://www.klopfenstein.net/lorenz/programming/ontopreplica/|http://www.klopfenstein.net/lorenz/programming/|http://lorenz.klopfenstein.net/</InstallUrlHistory>
<SupportUrlHistory>http://www.klopfenstein.net/lorenz.aspx/ontopreplica|http://www.klopfenstein.net/loader.php%3fsection=lorenz&amp;page=on_top_replica|http://www.klopfenstein.net/loader.php%3fsection=lorenz&amp;page=programming_on_top_replica</SupportUrlHistory>
<UpdateUrlHistory>http://www.klopfenstein.net/public/Uploads/ontopreplica/|http://www.klopfenstein.net/lorenz/programming/ontopreplica/</UpdateUrlHistory>
<BootstrapperUrlHistory>
</BootstrapperUrlHistory>
<FallbackCulture>en-US</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
<ErrorReportUrlHistory>
</ErrorReportUrlHistory>
</PropertyGroup>
<PropertyGroup>
<EnableSecurityDebugging>false</EnableSecurityDebugging>
</PropertyGroup>
</Project>

Some files were not shown because too many files have changed in this diff Show more