diff --git a/Graphics/Raster/help.png b/Graphics/Raster/help.png new file mode 100644 index 0000000..e69de29 diff --git a/Graphics/Raster/minimize.png b/Graphics/Raster/minimize.png new file mode 100644 index 0000000..e69de29 diff --git a/Graphics/Vector/help.psd b/Graphics/Vector/help.psd new file mode 100644 index 0000000..e69de29 diff --git a/Graphics/Vector/minimize.psd b/Graphics/Vector/minimize.psd new file mode 100644 index 0000000..e69de29 diff --git a/OnTopReplica/FullscreenFormManager.cs b/OnTopReplica/FullscreenFormManager.cs new file mode 100644 index 0000000..e69de29 diff --git a/OnTopReplica/FullscreenMode.cs b/OnTopReplica/FullscreenMode.cs new file mode 100644 index 0000000..e69de29 diff --git a/OnTopReplica/MainForm.Designer.cs b/OnTopReplica/MainForm.Designer.cs index 1c0ec00..e69de29 100644 --- a/OnTopReplica/MainForm.Designer.cs +++ b/OnTopReplica/MainForm.Designer.cs @@ -1,560 +0,0 @@ -namespace OnTopReplica -{ - partial class MainForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) { - if (disposing && (components != null)) { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - 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.restoreLastClonedWindowToolStripMenuItem = 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.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); - this.restorePositionAndSizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.dockToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.disabledToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.topLeftToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.topRightToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.centerToolStripMenuItem = 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.settingsToolStripMenuItem = 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.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.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.settingsToolStripMenuItem, - this.aboutToolStripMenuItem, - this.menuContextClose}); - this.menuContext.Name = "menuContext"; - this.menuContext.Size = new System.Drawing.Size(187, 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(186, 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.OwnerItem = this.menuContextWindows; - this.menuWindows.Size = new System.Drawing.Size(118, 26); - // - // 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(186, 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(186, 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.restoreLastClonedWindowToolStripMenuItem}); - this.advancedToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.xiao_wrench; - this.advancedToolStripMenuItem.Name = "advancedToolStripMenuItem"; - this.advancedToolStripMenuItem.Size = new System.Drawing.Size(186, 22); - this.advancedToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuAdvanced; - this.advancedToolStripMenuItem.DropDownOpening += new System.EventHandler(this.Menu_Advanced_opening); - // - // clickForwardingToolStripMenuItem - // - this.clickForwardingToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.clickforwarding; - this.clickForwardingToolStripMenuItem.Name = "clickForwardingToolStripMenuItem"; - this.clickForwardingToolStripMenuItem.Size = new System.Drawing.Size(218, 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(218, 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(218, 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); - // - // restoreLastClonedWindowToolStripMenuItem - // - this.restoreLastClonedWindowToolStripMenuItem.Name = "restoreLastClonedWindowToolStripMenuItem"; - this.restoreLastClonedWindowToolStripMenuItem.Size = new System.Drawing.Size(218, 22); - this.restoreLastClonedWindowToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuRestoreLast; - this.restoreLastClonedWindowToolStripMenuItem.ToolTipText = global::OnTopReplica.Strings.MenuRestoreLastTT; - this.restoreLastClonedWindowToolStripMenuItem.Click += new System.EventHandler(this.Menu_RestoreLastWindow_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(186, 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.OwnerItem = this.fullOpacityToolStripMenuItem; - 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(186, 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.toolStripSeparator2, - this.restorePositionAndSizeToolStripMenuItem}); - this.menuResize.Name = "menuResize"; - this.menuResize.OwnerItem = this.resizeToolStripMenuItem; - this.menuResize.Size = new System.Drawing.Size(218, 170); - this.menuResize.Opening += new System.ComponentModel.CancelEventHandler(this.Menu_Resize_opening); - // - // doubleToolStripMenuItem1 - // - this.doubleToolStripMenuItem1.Name = "doubleToolStripMenuItem1"; - this.doubleToolStripMenuItem1.Size = new System.Drawing.Size(217, 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(217, 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(217, 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(217, 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(214, 6); - // - // fullscreenToolStripMenuItem1 - // - this.fullscreenToolStripMenuItem1.Image = global::OnTopReplica.Properties.Resources.fullscreen; - this.fullscreenToolStripMenuItem1.Name = "fullscreenToolStripMenuItem1"; - this.fullscreenToolStripMenuItem1.Size = new System.Drawing.Size(217, 22); - this.fullscreenToolStripMenuItem1.Text = global::OnTopReplica.Strings.MenuFitFullscreen; - this.fullscreenToolStripMenuItem1.Click += new System.EventHandler(this.Menu_Resize_Fullscreen); - // - // toolStripSeparator2 - // - this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(214, 6); - // - // restorePositionAndSizeToolStripMenuItem - // - this.restorePositionAndSizeToolStripMenuItem.Name = "restorePositionAndSizeToolStripMenuItem"; - this.restorePositionAndSizeToolStripMenuItem.Size = new System.Drawing.Size(217, 22); - this.restorePositionAndSizeToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuRecall; - this.restorePositionAndSizeToolStripMenuItem.ToolTipText = global::OnTopReplica.Strings.MenuRecallTT; - this.restorePositionAndSizeToolStripMenuItem.Click += new System.EventHandler(this.Menu_Resize_RecallPosition_click); - // - // dockToolStripMenuItem - // - this.dockToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.disabledToolStripMenuItem, - this.topLeftToolStripMenuItem, - this.topRightToolStripMenuItem, - this.centerToolStripMenuItem, - this.bottomLeftToolStripMenuItem, - this.bottomRightToolStripMenuItem}); - this.dockToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.pos_null; - this.dockToolStripMenuItem.Name = "dockToolStripMenuItem"; - this.dockToolStripMenuItem.Size = new System.Drawing.Size(186, 22); - this.dockToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuPosition; - this.dockToolStripMenuItem.ToolTipText = global::OnTopReplica.Strings.MenuPositionTT; - this.dockToolStripMenuItem.DropDownOpening += new System.EventHandler(this.Menu_Position_Opening); - // - // disabledToolStripMenuItem - // - this.disabledToolStripMenuItem.Checked = true; - this.disabledToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; - this.disabledToolStripMenuItem.Name = "disabledToolStripMenuItem"; - this.disabledToolStripMenuItem.Size = new System.Drawing.Size(145, 22); - this.disabledToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuPosDisabled; - this.disabledToolStripMenuItem.Click += new System.EventHandler(this.Menu_Position_Disable); - // - // 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); - // - // centerToolStripMenuItem - // - this.centerToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.pos_center; - this.centerToolStripMenuItem.Name = "centerToolStripMenuItem"; - this.centerToolStripMenuItem.Size = new System.Drawing.Size(145, 22); - this.centerToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuPosCenter; - this.centerToolStripMenuItem.Click += new System.EventHandler(this.Menu_Position_Center); - // - // 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(186, 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(186, 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(183, 6); - // - // settingsToolStripMenuItem - // - this.settingsToolStripMenuItem.Name = "settingsToolStripMenuItem"; - this.settingsToolStripMenuItem.Size = new System.Drawing.Size(186, 22); - this.settingsToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuSettings; - this.settingsToolStripMenuItem.ToolTipText = global::OnTopReplica.Strings.MenuSettingsTT; - this.settingsToolStripMenuItem.Click += new System.EventHandler(this.Menu_Settings_click); - // - // aboutToolStripMenuItem - // - this.aboutToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.xiao_help; - this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; - this.aboutToolStripMenuItem.Size = new System.Drawing.Size(186, 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(186, 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; - // - // 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(7F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.SystemColors.Control; - this.ClientSize = new System.Drawing.Size(318, 226); - this.ControlBox = false; - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; - this.HideCaption = true; - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.MinimumSize = new System.Drawing.Size(44, 44); - 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.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 chromeToolStripMenuItem; - 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; - private System.Windows.Forms.ToolStripMenuItem centerToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem disabledToolStripMenuItem; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; - private System.Windows.Forms.ToolStripMenuItem restorePositionAndSizeToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem restoreLastClonedWindowToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem settingsToolStripMenuItem; - } -} - diff --git a/OnTopReplica/MainForm.cs b/OnTopReplica/MainForm.cs index 45b6a24..e69de29 100644 --- a/OnTopReplica/MainForm.cs +++ b/OnTopReplica/MainForm.cs @@ -1,474 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Windows.Forms; -using OnTopReplica.Native; -using OnTopReplica.Properties; -using OnTopReplica.StartupOptions; -using OnTopReplica.Update; -using OnTopReplica.WindowSeekers; -using WindowsFormsAero.Dwm; -using WindowsFormsAero.TaskDialog; - -namespace OnTopReplica { - - partial class MainForm : AspectRatioForm { - - //GUI elements - ThumbnailPanel _thumbnailPanel; - - //Managers - MessagePumpManager _msgPumpManager = new MessagePumpManager(); - WindowListMenuManager _windowListManager; - - Options _startupOptions; - - public MainForm(Options startupOptions) { - _startupOptions = startupOptions; - - //WinForms init pass - InitializeComponent(); - - //Store default values - DefaultNonClickTransparencyKey = this.TransparencyKey; - DefaultBorderStyle = this.FormBorderStyle; - - //Thumbnail panel - _thumbnailPanel = new ThumbnailPanel { - Location = Point.Empty, - Dock = DockStyle.Fill - }; - _thumbnailPanel.CloneClick += new EventHandler(Thumbnail_CloneClick); - Controls.Add(_thumbnailPanel); - - //Set native renderer on context menus - Asztal.Szótár.NativeToolStripRenderer.SetToolStripRenderer( - menuContext, menuWindows, menuOpacity, menuResize, menuFullscreenContext - ); - - //Set to Key event preview - this.KeyPreview = true; - } - - #region Event override - - protected override void OnHandleCreated(EventArgs e){ - base.OnHandleCreated(e); - - //Window init - KeepAspectRatio = false; - GlassEnabled = true; - GlassMargins = new Margins(-1); - - //Managers - _msgPumpManager.Initialize(this); - _windowListManager = new WindowListMenuManager(this, menuWindows); - _windowListManager.ParentMenus = new System.Windows.Forms.ContextMenuStrip[] { - menuContext, menuFullscreenContext - }; - - //Platform specific form initialization - Program.Platform.PostHandleFormInit(this); - } - - protected override void OnShown(EventArgs e) { - base.OnShown(e); - - //Apply startup options - _startupOptions.Apply(this); - } - - protected override void OnClosing(CancelEventArgs e) { - //Store last thumbnail, if any - if (_thumbnailPanel.IsShowingThumbnail && CurrentThumbnailWindowHandle != null) { - Settings.Default.RestoreLastWindowTitle = CurrentThumbnailWindowHandle.Title; - Settings.Default.RestoreLastWindowHwnd = CurrentThumbnailWindowHandle.Handle.ToInt64(); - Settings.Default.RestoreLastWindowClass = CurrentThumbnailWindowHandle.Class; - } - else { - Settings.Default.RestoreLastWindowTitle = string.Empty; - Settings.Default.RestoreLastWindowHwnd = 0; - Settings.Default.RestoreLastWindowClass = string.Empty; - } - - _msgPumpManager.Dispose(); - Program.Platform.CloseForm(this); - - base.OnClosing(e); - } - - protected override void OnMove(EventArgs e) { - base.OnMove(e); - - AdjustSidePanelLocation(); - } - - protected override void OnResizeEnd(EventArgs e) { - base.OnResizeEnd(e); - - RefreshScreenLock(); - } - - protected override void OnActivated(EventArgs e) { - base.OnActivated(e); - - //Deactivate click-through if form is 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 a fix attempt 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); - RefreshScreenLock(); - } - } - - 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(null); - } - } - - 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(null); - - 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 && (ModifierKeys & Keys.Alt) != Keys.Alt) { - m.Result = (IntPtr)HT.TRANSPARENT; - return; - } - break; - } - - base.WndProc(ref m); - } - - #endregion - - #region Keyboard event handling - - protected override void OnKeyUp(KeyEventArgs e) { - base.OnKeyUp(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); - } - } - - //F11 Fullscreen switch - else if (e.KeyCode == Keys.F11) { - e.Handled = true; - IsFullscreen = !IsFullscreen; - } - - //ESCAPE - else if (e.KeyCode == Keys.Escape) { - //Disable click-through - if (ClickThroughEnabled) { - ClickThroughEnabled = false; - } - //Toggle fullscreen - else if (IsFullscreen) { - IsFullscreen = false; - } - //Disable click forwarding - else if (ClickForwardingEnabled) { - ClickForwardingEnabled = false; - } - } - } - - #endregion - - #region Fullscreen - - bool _isFullscreen = false; - Point _preFullscreenLocation; - Size _preFullscreenSize; - FormBorderStyle _preFullscreenBorderStyle; - - public bool IsFullscreen { - get { - return _isFullscreen; - } - set { - if (IsFullscreen == value) - return; - if (value && !_thumbnailPanel.IsShowingThumbnail) - return; - - CloseSidePanel(); //on switch, always hide side panels - - //Location and size - if (value) { - _preFullscreenLocation = Location; - _preFullscreenSize = ClientSize; - _preFullscreenBorderStyle = FormBorderStyle; - - FormBorderStyle = FormBorderStyle.None; - var currentScreen = Screen.FromControl(this); - Size = currentScreen.WorkingArea.Size; - Location = currentScreen.WorkingArea.Location; - } - else { - FormBorderStyle = _preFullscreenBorderStyle; - Location = _preFullscreenLocation; - ClientSize = _preFullscreenSize; - RefreshAspectRatio(); - } - - //Common - GlassEnabled = !value; - TopMost = !value; - HandleMouseMove = !value; - - _isFullscreen = value; - - Program.Platform.OnFormStateChange(this); - } - } - - #endregion - - #region Thumbnail operation - - /// - /// Sets a new thumbnail. - /// - /// Handle to the window to clone. - /// Region of the window to clone or null. - public void SetThumbnail(WindowHandle handle, ThumbnailRegion region) { - try { - System.Diagnostics.Trace.WriteLine(string.Format("Cloning window HWND {0} of class {1}.", handle.Handle, handle.Class)); - - CurrentThumbnailWindowHandle = handle; - _thumbnailPanel.SetThumbnailHandle(handle, region); - - //Set aspect ratio (this will resize the form), do not refresh if in fullscreen - SetAspectRatio(_thumbnailPanel.ThumbnailPixelSize, !IsFullscreen); - } - catch (Exception ex) { - System.Diagnostics.Trace.Fail("Unable to set thumbnail.", ex.ToString()); - - ThumbnailError(ex, false, Strings.ErrorUnableToCreateThumbnail); - _thumbnailPanel.UnsetThumbnail(); - } - } - - /// - /// Enables group mode on a list of window handles. - /// - /// List of window handles. - public void SetThumbnailGroup(IList 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().EnableGroupMode(handles); - } - - /// - /// Disables the cloned thumbnail. - /// - public void UnsetThumbnail() { - //Unset handle - CurrentThumbnailWindowHandle = null; - _thumbnailPanel.UnsetThumbnail(); - - //Disable aspect ratio - KeepAspectRatio = false; - } - - /// - /// Gets or sets the region displayed of the current thumbnail. - /// - public ThumbnailRegion SelectedThumbnailRegion { - get { - if (!_thumbnailPanel.IsShowingThumbnail || !_thumbnailPanel.ConstrainToRegion) - return null; - - return _thumbnailPanel.SelectedRegion; - } - set { - if (!_thumbnailPanel.IsShowingThumbnail) - return; - - _thumbnailPanel.SelectedRegion = value; - - SetAspectRatio(_thumbnailPanel.ThumbnailPixelSize, true); - - FixPositionAndSize(); - } - } - - const int FixMargin = 10; - - /// - /// Fixes the form's position and size, ensuring it is fully displayed in the current screen. - /// - 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(); - } - - /// Automatically sizes the window in order to accomodate the thumbnail p times. - /// Scale of the thumbnail to consider. - private void FitToThumbnail(double p) { - try { - Size originalSize = _thumbnailPanel.ThumbnailPixelSize; - Size fittedSize = new Size((int)(originalSize.Width * p), (int)(originalSize.Height * p)); - ClientSize = fittedSize; - RefreshScreenLock(); - } - catch (Exception ex) { - ThumbnailError(ex, false, Strings.ErrorUnableToFit); - } - } - - #endregion - - #region Accessors - - /// - /// Gets the form's thumbnail panel. - /// - public ThumbnailPanel ThumbnailPanel { - get { - return _thumbnailPanel; - } - } - - /// - /// Gets the form's message pump manager. - /// - public MessagePumpManager MessagePumpManager { - get { - return _msgPumpManager; - } - } - - /// - /// Gets the form's window list drop down menu. - /// - public ContextMenuStrip MenuWindows { - get { - return menuWindows; - } - } - - /// - /// Retrieves the window handle of the currently cloned thumbnail. - /// - public WindowHandle CurrentThumbnailWindowHandle { - get; - private set; - } - - #endregion - - } -} diff --git a/OnTopReplica/MainForm_Gui.cs b/OnTopReplica/MainForm_Gui.cs index 39141fb..e69de29 100644 --- a/OnTopReplica/MainForm_Gui.cs +++ b/OnTopReplica/MainForm_Gui.cs @@ -1,118 +0,0 @@ -using System.Drawing; -using System.Windows.Forms; -using WindowsFormsAero.TaskDialog; - -namespace OnTopReplica { - partial class MainForm { - - /// - /// Opens the context menu. - /// - /// Optional position of the mouse, relative to which the menu is shown. - public void OpenContextMenu(Point? position) { - Point menuPosition = MousePosition; - if (position.HasValue) - menuPosition = position.Value; - - if (IsFullscreen) { - menuFullscreenContext.Show(menuPosition); - } - else { - menuContext.Show(menuPosition); - } - } - - /// - /// Gets the window's vertical chrome size. - /// - public int ChromeBorderVertical { - get { - if (IsChromeVisible) - return SystemInformation.FrameBorderSize.Height; - else - return 0; - } - } - - /// - /// Gets the window's horizontal chrome size. - /// - public int ChromeBorderHorizontal { - get { - if (IsChromeVisible) - return SystemInformation.FrameBorderSize.Width; - else - return 0; - } - } - - /// - /// Displays an error task dialog. - /// - /// Main instruction of the error dialog. - /// Detailed informations about the error. - /// Expanded error codes/messages. - 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); - } - - /// - /// Ensures that the main form is visible (either closing the fullscreen mode or reactivating from task icon). - /// - public void EnsureMainFormVisible() { - //Reset special modes - IsFullscreen = false; - ClickThroughEnabled = false; - Opacity = 1.0; - - //Restore main form in a platform-dependent method - Program.Platform.RestoreForm(this); - } - - /// - /// Opens a confirmation dialog to confirm whether to reset the main form or not. - /// - 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(); - } - } - - /// - /// Resets the main form to its initial state. - /// - 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(); - } - - } -} diff --git a/OnTopReplica/MainForm_MenuEvents.cs b/OnTopReplica/MainForm_MenuEvents.cs index fbf6d99..e69de29 100644 --- a/OnTopReplica/MainForm_MenuEvents.cs +++ b/OnTopReplica/MainForm_MenuEvents.cs @@ -1,180 +0,0 @@ -using System; -using System.ComponentModel; -using System.Drawing; -using System.Windows.Forms; -using OnTopReplica.Properties; -using WindowsFormsAero.TaskDialog; -using OnTopReplica.SidePanels; - -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 || IsSidePanelOpen) { - e.Cancel = true; - return; - } - - bool showing = _thumbnailPanel.IsShowingThumbnail; - - selectRegionToolStripMenuItem.Enabled = showing; - switchToWindowToolStripMenuItem.Enabled = showing; - resizeToolStripMenuItem.Enabled = showing; - chromeToolStripMenuItem.Checked = IsChromeVisible; - clickForwardingToolStripMenuItem.Checked = ClickForwardingEnabled; - chromeToolStripMenuItem.Enabled = showing; - clickThroughToolStripMenuItem.Enabled = showing; - clickForwardingToolStripMenuItem.Enabled = showing; - } - - 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_Advanced_opening(object sender, EventArgs e) { - restoreLastClonedWindowToolStripMenuItem.Checked = Settings.Default.RestoreLastWindow; - } - - private void Menu_GroupSwitchMode_click(object sender, EventArgs e) { - SetSidePanel(new SidePanels.GroupSwitchPanel()); - } - - private void Menu_RestoreLastWindow_click(object sender, EventArgs e) { - Settings.Default.RestoreLastWindow = !Settings.Default.RestoreLastWindow; - } - - private void Menu_ClickForwarding_click(object sender, EventArgs e) { - ClickForwardingEnabled = !ClickForwardingEnabled; - } - - 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 && this.Visible) { - //Get opacity from the tag - this.Opacity = (double)tsi.Tag; - Program.Platform.OnFormStateChange(this); - } - } - - 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; - - restorePositionAndSizeToolStripMenuItem.Checked = Settings.Default.RestoreSizeAndPosition; - } - - 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_Resize_RecallPosition_click(object sender, EventArgs e) { - Settings.Default.RestoreSizeAndPosition = !Settings.Default.RestoreSizeAndPosition; - } - - private void Menu_Position_Opening(object sender, EventArgs e) { - disabledToolStripMenuItem.Checked = (PositionLock == null); - topLeftToolStripMenuItem.Checked = (PositionLock == ScreenPosition.TopLeft); - topRightToolStripMenuItem.Checked = (PositionLock == ScreenPosition.TopRight); - centerToolStripMenuItem.Checked = (PositionLock == ScreenPosition.Center); - bottomLeftToolStripMenuItem.Checked = (PositionLock == ScreenPosition.BottomLeft); - bottomRightToolStripMenuItem.Checked = (PositionLock == ScreenPosition.BottomRight); - } - - private void Menu_Position_Disable(object sender, EventArgs e) { - PositionLock = null; - } - - private void Menu_Position_TopLeft(object sender, EventArgs e) { - PositionLock = ScreenPosition.TopLeft; - } - - private void Menu_Position_TopRight(object sender, EventArgs e) { - PositionLock = ScreenPosition.TopRight; - } - - private void Menu_Position_Center(object sender, EventArgs e) { - PositionLock = ScreenPosition.Center; - } - - private void Menu_Position_BottomLeft(object sender, EventArgs e) { - PositionLock = ScreenPosition.BottomLeft; - } - - private void Menu_Position_BottomRight(object sender, EventArgs e) { - PositionLock = ScreenPosition.BottomRight; - } - - 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) { - IsChromeVisible = !IsChromeVisible; - } - - private void Menu_Settings_click(object sender, EventArgs e) { - this.SetSidePanel(new OptionsPanel()); - } - - private void Menu_About_click(object sender, EventArgs e) { - this.SetSidePanel(new AboutPanel()); - } - - private void Menu_Close_click(object sender, EventArgs e) { - this.Close(); - } - - private void Menu_Fullscreen_ExitFullscreen_click(object sender, EventArgs e) { - IsFullscreen = false; - } - - } -} diff --git a/OnTopReplica/MessagePumpProcessors/HotKeyManager.cs b/OnTopReplica/MessagePumpProcessors/HotKeyManager.cs index 7b1b93e..e69de29 100644 --- a/OnTopReplica/MessagePumpProcessors/HotKeyManager.cs +++ b/OnTopReplica/MessagePumpProcessors/HotKeyManager.cs @@ -1,168 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Windows.Forms; -using OnTopReplica.Native; -using OnTopReplica.Properties; - -namespace OnTopReplica.MessagePumpProcessors { - - /// - /// HotKey registration helper. - /// - class HotKeyManager : BaseMessagePumpProcessor { - - public HotKeyManager() { - Enabled = true; - } - - delegate void HotKeyHandler(); - - /// - /// Wraps hot key handler registration data. - /// - private class HotKeyHandlerRegistration : IDisposable { - private HotKeyHandlerRegistration() { - } - - private HotKeyHandlerRegistration(IntPtr hwnd, int key, HotKeyHandler handler) { - if (hwnd == IntPtr.Zero) - throw new ArgumentException(); - if (handler == null) - throw new ArgumentNullException(); - - _hwnd = hwnd; - RegistrationKey = key; - Handler = handler; - } - - static int _lastUsedKey = 0; - - /// - /// Registers a new hotkey and returns a handle to the registration. - /// - /// Returns null on failure. - public static HotKeyHandlerRegistration Register(Form owner, int keyCode, int modifiers, HotKeyHandler handler) { - var key = ++_lastUsedKey; - - if (!HotKeyMethods.RegisterHotKey(owner.Handle, key, modifiers, keyCode)) { - Console.Error.WriteLine("Failed to create hotkey on keys {0}.", keyCode); - return null; - } - - return new HotKeyHandlerRegistration(owner.Handle, key, handler); - } - - IntPtr _hwnd; - public int RegistrationKey { get; private set; } - public HotKeyHandler Handler { get; private set; } - - public void Dispose() { - if (!HotKeyMethods.UnregisterHotKey(_hwnd, RegistrationKey)) { - Console.Error.WriteLine("Failed to unregister hotkey #{0}.", RegistrationKey); - } - } - } - - Dictionary _handlers = new Dictionary(); - - public override void Initialize(MainForm form) { - base.Initialize(form); - - RefreshHotkeys(); - } - - public override bool Process(ref Message msg) { - if (Enabled && msg.Msg == HotKeyMethods.WM_HOTKEY) { - int keyId = msg.WParam.ToInt32(); - if (!_handlers.ContainsKey(keyId)) - return false; - - _handlers[keyId].Handler.Invoke(); - } - - return false; - } - - public bool Enabled { get; set; } - - /// - /// Refreshes registered hotkeys from Settings. - /// - /// - /// Application settings contain hotkey registration strings that are used - /// automatically by this registration process. - /// - public void RefreshHotkeys() { - ClearHandlers(); - - RegisterHandler(Settings.Default.HotKeyCloneCurrent, HotKeyCloneHandler); - RegisterHandler(Settings.Default.HotKeyShowHide, HotKeyShowHideHandler); - } - - private void RegisterHandler(string spec, HotKeyHandler handler) { - if (string.IsNullOrEmpty(spec)) - return; //this can happen and is allowed => simply don't register - if (handler == null) - throw new ArgumentNullException(); - - int modifiers = 0, keyCode = 0; - - try { - HotKeyMethods.TranslateStringToKeyValues(spec, out modifiers, out keyCode); - } - catch (ArgumentException) { - //TODO: swallowed exception - return; - } - - var reg = HotKeyHandlerRegistration.Register(Form, keyCode, modifiers, handler); - if(reg != null) - _handlers.Add(reg.RegistrationKey, reg); - } - - private void ClearHandlers() { - foreach (var hotkey in _handlers) { - hotkey.Value.Dispose(); - } - _handlers.Clear(); - } - - protected override void Shutdown() { - ClearHandlers(); - } - - #region Hotkey callbacks - - /// - /// Handles "show/hide" hotkey. Ensures the form is in restored state and switches - /// between shown and hidden states. - /// - void HotKeyShowHideHandler() { - if (Form.IsFullscreen) - Form.IsFullscreen = false; - - if (!Program.Platform.IsHidden(Form)) { - Program.Platform.HideForm(Form); - } - else { - Form.EnsureMainFormVisible(); - } - } - - /// - /// Handles the "clone current" hotkey. - /// - void HotKeyCloneHandler() { - var handle = Win32Helper.GetCurrentForegroundWindow(); - if (handle.Handle == Form.Handle) - return; - - Form.SetThumbnail(handle, null); - } - - #endregion - - } - -} diff --git a/OnTopReplica/OnTopReplica.csproj b/OnTopReplica/OnTopReplica.csproj index 0a59067..e69de29 100644 --- a/OnTopReplica/OnTopReplica.csproj +++ b/OnTopReplica/OnTopReplica.csproj @@ -1,532 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {E626BD6E-BF38-4EB7-A128-5CA6F40EF557} - WinExe - Properties - OnTopReplica - OnTopReplica - v4.0 - 512 - Assets\icon-new.ico - false - false - Internet - OnTopReplica.Program - - - false - A305A505E19CF40E069521C80C13AB3C900EDB7C - OnTopReplica_1_TemporaryKey.pfx - false - - - - - 3.5 - - - - publish\ - true - Disk - true - Background - 1 - Weeks - true - false - true - http://www.klopfenstein.net/public/Uploads/ontopreplica/ - http://www.klopfenstein.net/lorenz.aspx/ontopreplica - en - OnTopReplica - Lorenz Cuno Klopfenstein - true - publish.htm - false - 0 - 3.4.0.%2a - false - true - true - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - false - true - - - pdbonly - true - bin\Release\ - - - prompt - 4 - - - true - false - - - - - - - - - OnTopReplica.exe.manifest - - - - - - - - - ..\Lib\WindowsFormsAero.dll - - - - - Form - - - - - - Component - - - Component - - - Form - - - Form - - - Form - - - Form - - - - - - - - - - - - - - - - - True - True - Resources.resx - - - True - True - Settings.settings - - - Form - - - SidePanelContainer.cs - - - UserControl - - - AboutPanel.cs - - - UserControl - - - AboutPanelContents.cs - - - UserControl - - - OptionsPanel.cs - - - UserControl - - - GroupSwitchPanel.cs - - - - - True - True - Strings.resx - - - - - - - - - - - - - SidePanelContainer.cs - - - AboutPanel.cs - - - AboutPanelContents.cs - - - ResXFileCodeGenerator - Strings.pl.Designer.cs - - - ResXFileCodeGenerator - Strings.Designer.cs - - - ResXFileCodeGenerator - Strings.ru.Designer.cs - - - - - - - - - - - - - - - - - UserControl - - - - Form - - - CommandLineReportForm.cs - - - - - - - - - - - - - - - - - Component - - - Form - - - MainForm.cs - - - - - - GroupSwitchPanel.cs - - - OptionsPanel.cs - - - CommandLineReportForm.cs - - - ResXFileCodeGenerator - Strings.cs.Designer.cs - - - ResXFileCodeGenerator - Strings.da.Designer.cs - - - ResXFileCodeGenerator - Strings.de.Designer.cs - - - ResXFileCodeGenerator - Strings.es.Designer.cs - - - ResXFileCodeGenerator - Strings.fi.Designer.cs - - - ResXFileCodeGenerator - Strings.it.Designer.cs - Designer - - - MainForm.cs - Designer - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - RegionPanel.cs - Designer - - - ResXFileCodeGenerator - Strings.no.Designer.cs - - - ResXFileCodeGenerator - Strings.pt-BR.Designer.cs - - - ResXFileCodeGenerator - Strings.pt.Designer.cs - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - UserControl - - - RegionPanel.cs - - - - - Component - - - - - - - - - - - - - - - - - - - - - - - - - - - - Always - - - Always - - - - - - - - - - - - - - - - - - - - - - - - - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 2.0 %28x86%29 - true - - - False - .NET Framework 3.0 %28x86%29 - false - - - False - .NET Framework 3.5 - false - - - False - .NET Framework 3.5 SP1 - false - - - - - - - - - - - - - - - - - - - - - - - - - - - False - - - - - Exclude - True - File - - - False - - - - - Exclude - True - File - - - False - - - - - Exclude - True - File - - - False - - - - - Exclude - True - File - - - False - - - - - Include - True - Satellite - - - False - - - - - Include - True - Satellite - - - False - - - - - Include - True - Satellite - - - - - - - - - \ No newline at end of file diff --git a/OnTopReplica/Platforms/WindowsSeven.cs b/OnTopReplica/Platforms/WindowsSeven.cs index 9d768a9..e69de29 100644 --- a/OnTopReplica/Platforms/WindowsSeven.cs +++ b/OnTopReplica/Platforms/WindowsSeven.cs @@ -1,61 +0,0 @@ -using System; -using System.Windows.Forms; -using OnTopReplica.Native; -using WindowsFormsAero.Dwm; - -namespace OnTopReplica.Platforms { - - class WindowsSeven : WindowsVista { - - public override void PreHandleFormInit() { - //Set Application ID - WindowsSevenMethods.SetCurrentProcessExplicitAppUserModelID("LorenzCunoKlopfenstein.OnTopReplica.MainForm"); - } - - public override void PostHandleFormInit(MainForm form) { - DwmManager.SetWindowFlip3dPolicy(form, Flip3DPolicy.ExcludeAbove); - DwmManager.SetExcludeFromPeek(form, true); - DwmManager.SetDisallowPeek(form, true); - } - - public override void HideForm(MainForm form) { - form.Opacity = 0; - } - - public override bool IsHidden(MainForm form) { - return (form.Opacity == 0.0); - } - - public override void RestoreForm(MainForm form) { - if (form.Opacity == 0.0) - form.Opacity = 1.0; - - form.Show(); - } - - /*public override void OnFormStateChange(MainForm form) { - //SetWindowStyle(form); - }*/ - - /// - /// Used to alter the window style. Not used anymore. - /// - private void SetWindowStyle(MainForm form) { - if (!form.IsFullscreen) { - //This hides the app from ALT+TAB - //Note that when minimized, it will be shown as an (ugly) minimized tool window - //thus we do not minimize, but set to transparent when hiding - long exStyle = WindowMethods.GetWindowLong(form.Handle, WindowMethods.WindowLong.ExStyle).ToInt64(); - - exStyle |= (long)(WindowMethods.WindowExStyles.ToolWindow); - //exStyle &= ~(long)(WindowMethods.WindowExStyles.AppWindow); - - WindowMethods.SetWindowLong(form.Handle, WindowMethods.WindowLong.ExStyle, new IntPtr(exStyle)); - - //WindowMethods.SetWindowLong(form.Handle, WindowMethods.WindowLong.HwndParent, WindowManagerMethods.GetDesktopWindow()); - } - } - - } - -} diff --git a/OnTopReplica/Properties/Resources.resx b/OnTopReplica/Properties/Resources.resx index b097806..e69de29 100644 --- a/OnTopReplica/Properties/Resources.resx +++ b/OnTopReplica/Properties/Resources.resx @@ -1,239 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - ..\Assets\flag_ita.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\xiao_add.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\x-oblique.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\component.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\25.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\window_multiple16.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\xiao_delete.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\regions_new.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\pos_null.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\window_opacity_new.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\pos_topleft.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\pos_bottomleft.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\pos_topright.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\clickforwarding.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\newicon.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\xiao_help.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\back.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\xiao_up.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\window16.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\flag_czech.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\pos_bottomright.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\window_switch.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\desktop.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\flag_danish.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\reduce.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\xiao_ok.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\xiao_wrench.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\list.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\icon-new.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\fullscreen.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\xiao_down.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\xiao_arrow.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\window_border16.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\flag_usa.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\groupmode.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\pos_center.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\flag_spanish.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\flag_poland.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - - ..\Assets\flag_germany.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - \ No newline at end of file diff --git a/OnTopReplica/Properties/Settings.settings b/OnTopReplica/Properties/Settings.settings index fb6e917..e69de29 100644 --- a/OnTopReplica/Properties/Settings.settings +++ b/OnTopReplica/Properties/Settings.settings @@ -1,57 +0,0 @@ - - - - - - - - - 255 - - - (Default) - - - True - - - True - - - True - - - True - - - False - - - False - - - 0, 0 - - - 0, 0 - - - False - - - - - - - - - 0 - - - [CTRL]+[SHIFT]+C - - - [CTRL]+[SHIFT]+O - - - \ No newline at end of file diff --git a/OnTopReplica/Resources/help.png b/OnTopReplica/Resources/help.png new file mode 100644 index 0000000..e69de29 diff --git a/OnTopReplica/Resources/minimize.png b/OnTopReplica/Resources/minimize.png new file mode 100644 index 0000000..e69de29 diff --git a/OnTopReplica/SidePanelContainer.Designer.cs b/OnTopReplica/SidePanelContainer.Designer.cs index 56103f0..e69de29 100644 --- a/OnTopReplica/SidePanelContainer.Designer.cs +++ b/OnTopReplica/SidePanelContainer.Designer.cs @@ -1,46 +0,0 @@ -namespace OnTopReplica { - partial class SidePanelContainer { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) { - if (disposing && (components != null)) { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() { - this.SuspendLayout(); - // - // SidePanelContainer - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(246, 300); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; - this.MinimizeBox = false; - this.Name = "SidePanelContainer"; - this.ShowInTaskbar = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; - this.Text = "Side Panel container"; - this.TopMost = true; - this.ResumeLayout(false); - - } - - #endregion - } -} \ No newline at end of file diff --git a/OnTopReplica/SidePanelContainer.resx b/OnTopReplica/SidePanelContainer.resx index 5ea0895..e69de29 100644 --- a/OnTopReplica/SidePanelContainer.resx +++ b/OnTopReplica/SidePanelContainer.resx @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/OnTopReplica/SidePanels/AboutPanel.cs b/OnTopReplica/SidePanels/AboutPanel.cs index 87da71a..e69de29 100644 --- a/OnTopReplica/SidePanels/AboutPanel.cs +++ b/OnTopReplica/SidePanels/AboutPanel.cs @@ -1,32 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Text; -using System.Windows.Forms; -using WindowsFormsAero.Dwm; - -namespace OnTopReplica.SidePanels { - partial class AboutPanel : SidePanel { - - public AboutPanel() { - InitializeComponent(); - - //Display version number - labelVersion.Text = string.Format(Strings.AboutVersion, Application.ProductVersion); - } - - public override string Title { - get { - return Strings.AboutTitle; - } - } - - public override Margins? GlassMargins { - get { - return new Margins(0, 0, 0, labelVersion.Height); - } - } - - } -} diff --git a/OnTopReplica/StartupOptions/Options.cs b/OnTopReplica/StartupOptions/Options.cs index d36e2bb..e69de29 100644 --- a/OnTopReplica/StartupOptions/Options.cs +++ b/OnTopReplica/StartupOptions/Options.cs @@ -1,163 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Drawing; -using System.IO; -using OnTopReplica.WindowSeekers; - -namespace OnTopReplica.StartupOptions { - - /// - /// Represents startup options that can be set via CLI scripting (or other stuff). - /// - class Options { - - public Options() { - Status = CliStatus.Ok; - Opacity = 255; - DisableChrome = false; - MustBeVisible = false; - Fullscreen = false; - } - - #region Position and size - - public Point? StartLocation { get; set; } - - public ScreenPosition? StartPositionLock { get; set; } - - public Size? StartSize { get; set; } - - #endregion - - #region Window cloning - - public IntPtr? WindowId { get; set; } - - public string WindowTitle { get; set; } - - public string WindowClass { get; set; } - - public ThumbnailRegion Region { get; set; } - - public bool MustBeVisible { get; set; } - - #endregion - - #region Options - - public bool EnableClickForwarding { get; set; } - - public byte Opacity { get; set; } - - public bool DisableChrome { get; set; } - - public bool Fullscreen { get; set; } - - #endregion - - #region Debug info - - StringBuilder _sb = new StringBuilder(); - TextWriter _sbWriter; - - public CliStatus Status { get; set; } - - /// - /// Gets a debug message writer. - /// - public TextWriter DebugMessageWriter { - get { - if (_sbWriter == null) { - _sbWriter = new StringWriter(_sb); - } - return _sbWriter; - } - } - - /// - /// Gets the debug message. - /// - public string DebugMessage { - get { - if(_sbWriter != null) - _sbWriter.Flush(); - return _sb.ToString(); - } - } - - #endregion - - #region Application - - public void Apply(MainForm form) { - //GUI - form.IsChromeVisible = !DisableChrome; - form.Opacity = (double)Opacity / 255.0; - - //Seek handle for thumbnail cloning - WindowHandle handle = null; - if (WindowId.HasValue) { - handle = WindowHandle.FromHandle(WindowId.Value); - } - else if (WindowTitle != null) { - var seeker = new ByTitleWindowSeeker(WindowTitle) { - OwnerHandle = form.Handle, - SkipNotVisibleWindows = MustBeVisible - }; - seeker.Refresh(); - - handle = seeker.Windows.FirstOrDefault(); - } - else if (WindowClass != null) { - var seeker = new ByClassWindowSeeker(WindowClass) { - OwnerHandle = form.Handle, - SkipNotVisibleWindows = MustBeVisible - }; - seeker.Refresh(); - - handle = seeker.Windows.FirstOrDefault(); - } - - //Position lock - if (StartPositionLock.HasValue) { - form.PositionLock = StartPositionLock.Value; - } - - //Size and location start values - if (StartLocation.HasValue && StartSize.HasValue) { - form.StartPosition = System.Windows.Forms.FormStartPosition.Manual; - form.Location = StartLocation.Value; - form.ClientSize = StartSize.Value; - } - else if (StartLocation.HasValue) { - form.StartPosition = System.Windows.Forms.FormStartPosition.WindowsDefaultBounds; - form.Location = StartLocation.Value; - } - else if (StartSize.HasValue) { - form.StartPosition = System.Windows.Forms.FormStartPosition.WindowsDefaultLocation; - form.ClientSize = StartSize.Value; - } - - //Clone any found handle - if (handle != null) { - form.SetThumbnail(handle, Region); - } - - //Other features - if (EnableClickForwarding) { - form.ClickForwardingEnabled = true; - } - - //Fullscreen - if (Fullscreen) { - form.IsFullscreen = true; - } - } - - #endregion - - } - -} diff --git a/OnTopReplica/app.config b/OnTopReplica/app.config index d5be21d..e69de29 100644 --- a/OnTopReplica/app.config +++ b/OnTopReplica/app.config @@ -1,60 +0,0 @@ - - - - -
- - - - - - 255 - - - (Default) - - - True - - - True - - - True - - - True - - - False - - - False - - - 0, 0 - - - 0, 0 - - - False - - - - - - - - - 0 - - - [CTRL]+[SHIFT]+C - - - [CTRL]+[SHIFT]+O - - - -