diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..699750fb --- /dev/null +++ b/.editorconfig @@ -0,0 +1,4 @@ +[*.cs] + +# IDE0058: Expression value is never used +csharp_style_unused_value_expression_statement_preference = unused_local_variable diff --git a/ppInk.sln b/ppInk.sln index 86f9915e..82500f8c 100644 --- a/ppInk.sln +++ b/ppInk.sln @@ -1,10 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28307.757 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31313.381 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ppInk", "src\ppInk.csproj", "{82AD51F9-56A9-4698-A993-CC9E62F56812}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4F495ECC-0B2E-477C-89F3-8752EFAF6F16}" + ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x86 = Debug|x86 diff --git a/ppInk/config.ini b/ppInk/config.ini index ef3b1c2f..b91ef448 100644 --- a/ppInk/config.ini +++ b/ppInk/config.ini @@ -10,7 +10,7 @@ White_Tray_Icon = False Hide_In_AltTab = False -Fading_Time=.1 +Fading_Time= 5 # The folder that snapshots are saved to Snapshot_Path = %USERPROFILE%/Pictures/gInk/ @@ -65,9 +65,9 @@ Default_Arrow = START # 1.04 % should be about 20 pix ; will also change size of circles in tags and selection Size Text = Comic Sans MS,False,True,1.30208333333333 -Numbers = Comic Sans MS,False,True,.7 +Numbers = Comic Sans MS,False,True,0.651041666666667 # is MagneticEffect active when opening the Window -Magnet = 0.625 +Magnet = 0.5859375 # Which mouse cursor to use on canvas Canvas_Cursor = 1 @@ -85,11 +85,11 @@ Alt_As_Temporary_Command = True Allow_Hotkey_In_Pointer_Mode = False # Toolbar location (only applicable when allowing dragging toolbar) -Toolbar_Left = 600 -Toolbar_Top = 1000 +Toolbar_Left = 494 +Toolbar_Top = 757 # Toolbar deployement direction Left(Original),Right,Up,Down -Toolbar_Direction=Left +Toolbar_Direction= Left # inking area : Top,Left,Width,Height ; all set to -1 for full screen Inking_Area = -1,-1,-1,-1 @@ -116,10 +116,10 @@ ImageStamp_Size = 128 #Image Background when stamped : -1 = no Frame ; 0 = empty ; 1 = ColorFilled ; 2 = White Filled ; 3 = Black Filled ImageStamp_Filling = -1 # can work in multiple lines ; names / path are separated by semi-colons -ImageStamp_FileNames = happy.png;neutral.png;sad.png -ImageStamp_FileNames = Star.png -ImageStamp_FileNames = thumb_up.png;thumb_dn.png -ImageStamp_FileNames = tick.png;cross.png +ImageStamp_FileNames = happy.png;neutral.png;sad.png;Star.png;thumb_up.png;thumb_dn.png;tick.png;cross.png +ImageStamp_FileNames = +ImageStamp_FileNames = +ImageStamp_FileNames = ImageStamp1 = happy.png ImageStamp2 = neutral.png ImageStamp3 = sad.png diff --git a/ppInk/ppInk.exe b/ppInk/ppInk.exe new file mode 100644 index 00000000..87f9434c Binary files /dev/null and b/ppInk/ppInk.exe differ diff --git a/readme.md b/readme.md index c2483dfe..0c468f02 100644 --- a/readme.md +++ b/readme.md @@ -1,3 +1,12 @@ +# Changes of this fork (https://github.com/jorgecc/ppInk-1) + +* 2021-05-22 +* It adds a feature to clean the canvas every time we hide our pencil. By default, this +feature is off. +* In the options windows, it adds a new tab to configure this value. +* Root.cs lots of cleanups (Microsoft suggesting of style of code) + + #### Introduction ppInk is an on-screen annotation software under Windows, forked from gInk. @@ -238,3 +247,7 @@ https://github.com/pubpub-zz/ppInk Pubpub-ZZ \@ 2020 + + + + diff --git a/src/BuildTimestamp.cs b/src/BuildTimestamp.cs index 9b4a1749..6597a8c3 100644 --- a/src/BuildTimestamp.cs +++ b/src/BuildTimestamp.cs @@ -1 +1 @@ -namespace gInk { public static class Build { public static string Timestamp = "24/03/2021 13:19:34.68".Substring(0,16);}} +namespace gInk { public static class Build { public static string Timestamp = "22/05/2021 18:45:21,22".Substring(0,16);}} diff --git a/src/CallForm.cs b/src/CallForm.cs index 79468740..06bda9ab 100644 --- a/src/CallForm.cs +++ b/src/CallForm.cs @@ -33,12 +33,12 @@ private void timer1_Tick(object sender, EventArgs e) AltTabPressed = 10; } else - AltTabPressed = AltTabPressed>0? AltTabPressed-1:0; + AltTabPressed = AltTabPressed > 0 ? AltTabPressed - 1 : 0; } private void CallForm_KeyPress(object sender, KeyPressEventArgs e) { - if(e.KeyChar=='\n' || e.KeyChar==' ') + if (e.KeyChar == '\n' || e.KeyChar == ' ') Root.callshortcut(); } @@ -50,7 +50,7 @@ private void CallForm_Activated(object sender, EventArgs e) return; } Console.WriteLine(AltTabPressed); - if (AltTabPressed>0) + if (AltTabPressed > 0) Root.callshortcut(); } diff --git a/src/FormAbout.cs b/src/FormAbout.cs index c584e406..c0b12801 100644 --- a/src/FormAbout.cs +++ b/src/FormAbout.cs @@ -8,27 +8,27 @@ namespace gInk { - public partial class FormAbout : Form - { - public FormAbout() - { - InitializeComponent(); - } + public partial class FormAbout : Form + { + public FormAbout() + { + InitializeComponent(); + } - private void FormAbout_Load(object sender, EventArgs e) - { - this.Icon = gInk.Properties.Resources.icon_red; - string version = Application.ProductVersion.Substring(0, Application.ProductVersion.Length-2)+" built on " +Build.Timestamp; - string about = "ppInk v" + version + "\r\n"; + private void FormAbout_Load(object sender, EventArgs e) + { + this.Icon = gInk.Properties.Resources.icon_red; + string version = Application.ProductVersion.Substring(0, Application.ProductVersion.Length - 2) + " built on " + Build.Timestamp; + string about = "ppInk v" + version + "\r\n"; about += "Forked from gInk (c) 2016-2020 Weizhi Nai\r\n"; about += "changes (c) 2002-2020 Pubpub-ZZ\r\n"; about += "Licensed under MIT\r\n"; - about += "https://github.com/pubpub-zz/ppInk\r\n"; - about += "\r\n"; - about += "Credits:\r\n"; - about += "Some button icons are designed by Freepik.com.\r\n"; - textBox1.Text = about; - textBox1.Select(textBox1.Text.Length, 0); - } - } + about += "https://github.com/pubpub-zz/ppInk\r\n"; + about += "\r\n"; + about += "Credits:\r\n"; + about += "Some button icons are designed by Freepik.com.\r\n"; + textBox1.Text = about; + textBox1.Select(textBox1.Text.Length, 0); + } + } } diff --git a/src/FormButtonHitter.cs b/src/FormButtonHitter.cs index ea084497..71e9773f 100644 --- a/src/FormButtonHitter.cs +++ b/src/FormButtonHitter.cs @@ -10,34 +10,34 @@ namespace gInk { - public partial class FormButtonHitter : Form - { - Root Root; - FormCollection FC; + public partial class FormButtonHitter : Form + { + Root Root; + FormCollection FC; // DateTime MouseTimeDown; - // http://www.csharp411.com/hide-form-from-alttab/ - protected override CreateParams CreateParams - { - get - { - CreateParams cp = base.CreateParams; - // turn on WS_EX_TOOLWINDOW style bit - cp.ExStyle |= 0x80; - return cp; - } - } + // http://www.csharp411.com/hide-form-from-alttab/ + protected override CreateParams CreateParams + { + get + { + CreateParams cp = base.CreateParams; + // turn on WS_EX_TOOLWINDOW style bit + cp.ExStyle |= 0x80; + return cp; + } + } - public FormButtonHitter(Root root) - { - Root = root; - FC = Root.FormCollection; - InitializeComponent(); + public FormButtonHitter(Root root) + { + Root = root; + FC = Root.FormCollection; + InitializeComponent(); - this.Left = FC.gpButtons.Left + FC.Left; - this.Top = FC.gpButtons.Top + FC.Top; - this.Width = FC.gpButtons.Width; - this.Height = FC.gpButtons.Height; - } + this.Left = FC.gpButtons.Left + FC.Left; + this.Top = FC.gpButtons.Top + FC.Top; + this.Width = FC.gpButtons.Width; + this.Height = FC.gpButtons.Height; + } protected override void WndProc(ref Message msg) { @@ -60,50 +60,50 @@ protected override void WndProc(ref Message msg) } private void FormButtonHitter_Click(object sender, EventArgs e) - { - MouseEventArgs m = (MouseEventArgs)e; - TimeSpan tsp= DateTime.Now - Root.FormCollection.MouseTimeDown; + { + MouseEventArgs m = (MouseEventArgs)e; + TimeSpan tsp = DateTime.Now - Root.FormCollection.MouseTimeDown; //MessageBox.Show(string.Format("t = {0:N3}",tsp.TotalSeconds)); - foreach (Control control in FC.gpButtons.Controls) - { - if (control.GetType() == typeof(Button)) - { - if (m.X >= control.Left && m.X <= control.Right && m.Y >= control.Top && m.Y <= control.Bottom) - ((Button)control).PerformClick(); - } - } - } + foreach (Control control in FC.gpButtons.Controls) + { + if (control.GetType() == typeof(Button)) + { + if (m.X >= control.Left && m.X <= control.Right && m.Y >= control.Top && m.Y <= control.Bottom) + ((Button)control).PerformClick(); + } + } + } - public void ToTopMost() - { + public void ToTopMost() + { TopMost = true; - UInt32 dwExStyle = GetWindowLong(this.Handle, -20); - SetWindowLong(this.Handle, -20, dwExStyle | 0x00080000); - //SetLayeredWindowAttributes(this.Handle, 0x00FFFFFF, 200, 0x2); - SetWindowPos(this.Handle, (IntPtr)(-1), 0, 0, 0, 0, 0x0002 | 0x0001 | 0x0020); - } + uint dwExStyle = GetWindowLong(this.Handle, -20); + SetWindowLong(this.Handle, -20, dwExStyle | 0x00080000); + //SetLayeredWindowAttributes(this.Handle, 0x00FFFFFF, 200, 0x2); + SetWindowPos(this.Handle, (IntPtr)(-1), 0, 0, 0, 0, 0x0002 | 0x0001 | 0x0020); + } - public void timer1_Tick(object sender, EventArgs e) - { - if (true||this.Visible) // we force resizing weither visible or not in order to have the good size during alt+tab - { - this.Left = FC.gpButtons.Left + FC.Left; - this.Top = FC.gpButtons.Top + FC.Top; + public void timer1_Tick(object sender, EventArgs e) + { + if (true || this.Visible) // we force resizing weither visible or not in order to have the good size during alt+tab + { + this.Left = FC.gpButtons.Left + FC.Left; + this.Top = FC.gpButtons.Top + FC.Top; Size s = FC.VisibleToolbar; this.Width = s.Width; - this.Height = s.Height; - } - } + this.Height = s.Height; + } + } - [DllImport("user32.dll")] - static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags); - [DllImport("user32.dll", SetLastError = true)] - static extern UInt32 GetWindowLong(IntPtr hWnd, int nIndex); - [DllImport("user32.dll")] - static extern int SetWindowLong(IntPtr hWnd, int nIndex, UInt32 dwNewLong); - [DllImport("user32.dll")] - public extern static bool SetLayeredWindowAttributes(IntPtr hwnd, uint crKey, byte bAlpha, uint dwFlags); + [DllImport("user32.dll")] + static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags); + [DllImport("user32.dll", SetLastError = true)] + static extern uint GetWindowLong(IntPtr hWnd, int nIndex); + [DllImport("user32.dll")] + static extern int SetWindowLong(IntPtr hWnd, int nIndex, uint dwNewLong); + [DllImport("user32.dll")] + public extern static bool SetLayeredWindowAttributes(IntPtr hwnd, uint crKey, byte bAlpha, uint dwFlags); private void FormButtonHitter_MouseDown(object sender, MouseEventArgs e) { diff --git a/src/FormCollection.cs b/src/FormCollection.cs index c3bf7b82..d8be19f6 100644 --- a/src/FormCollection.cs +++ b/src/FormCollection.cs @@ -19,7 +19,7 @@ namespace gInk { public partial class FormCollection : Form - { + { [Flags, Serializable] public enum RegisterTouchFlags { @@ -51,8 +51,8 @@ public static System.Windows.Forms.Cursor LoadCustomCursor(string path) const double NormSizePercent = 0.85; const double SmallSizePercent = 0.44; const double TopPercent = 0.06; - const double SmallButtonNext =0.44; - const double InterButtonGap = NormSizePercent*.05; + const double SmallButtonNext = 0.44; + const double InterButtonGap = NormSizePercent * .05; // hotkeys const int VK_SHIFT = 0x10; @@ -68,14 +68,14 @@ public static System.Windows.Forms.Cursor LoadCustomCursor(string path) const int VK_RWIN = 0x5C; private PenModifyDlg PenModifyDlg; public Root Root; - public InkOverlay IC; - - public Button[] btPen; - public Bitmap image_exit, image_clear, image_undo, image_snap, image_penwidth; - public Bitmap image_dock, image_dockback; - public Bitmap image_pencil, image_highlighter, image_pencil_act, image_highlighter_act; - public Bitmap image_pointer, image_pointer_act; - public Bitmap[] image_pen; + public InkOverlay IC; + + public Button[] btPen; + public Bitmap image_exit, image_clear, image_undo, image_snap, image_penwidth; + public Bitmap image_dock, image_dockback; + public Bitmap image_pencil, image_highlighter, image_pencil_act, image_highlighter_act; + public Bitmap image_pointer, image_pointer_act; + public Bitmap[] image_pen; public Bitmap[] image_pen_act; public Bitmap image_eraser_act, image_eraser; public Bitmap image_visible_not, image_visible; @@ -98,8 +98,8 @@ public static System.Windows.Forms.Cursor LoadCustomCursor(string path) private int SavedTool = -1; private int SavedFilled = -1; private int SavedPen = -1; - private int PolyLineLastX = Int32.MinValue; - private int PolyLineLastY = Int32.MinValue; + private int PolyLineLastX = int.MinValue; + private int PolyLineLastY = int.MinValue; private Stroke PolyLineInProgress = null; public bool SnapWithoutClosing = false; @@ -117,29 +117,29 @@ public static System.Windows.Forms.Cursor LoadCustomCursor(string path) private bool SetWindowInputRectFlag = false; public ImageLister ClipartsDlg; - private Object btClipSel; + private object btClipSel; private ZoomForm ZoomForm = new ZoomForm(); - private Bitmap ZoomImage,ZoomImage2; + private Bitmap ZoomImage, ZoomImage2; int ZoomFormRePosX; int ZoomFormRePosY; string ZoomSaveStroke; - public MouseButtons CurrentMouseButton=MouseButtons.None; + public MouseButtons CurrentMouseButton = MouseButtons.None; - public string SaveStrokeFile=""; + public string SaveStrokeFile = ""; public List PointerModeSnaps = new List(); // http://www.csharp411.com/hide-form-from-alttab/ protected override CreateParams CreateParams { - get - { - CreateParams cp = base.CreateParams; - // turn on WS_EX_TOOLWINDOW style bit - cp.ExStyle |= 0x80; - return cp; - } - } + get + { + CreateParams cp = base.CreateParams; + // turn on WS_EX_TOOLWINDOW style bit + cp.ExStyle |= 0x80; + return cp; + } + } void PreparePenImages(int Transparency, ref Bitmap img_pen, ref Bitmap img_pen_act) { if (Transparency >= 100) @@ -170,7 +170,7 @@ static class NativeMethods public static extern uint ResumeThread(IntPtr hThread); } - public static System.Windows.Forms.Cursor getCursFromDiskOrRes(string name,System.Windows.Forms.Cursor nocurs) + public static System.Windows.Forms.Cursor getCursFromDiskOrRes(string name, System.Windows.Forms.Cursor nocurs) { string filename; string[] exts = { ".cur", ".ani", ".ico" }; @@ -219,9 +219,9 @@ public static Bitmap getImgFromDiskOrRes(string name, string[] exts = null) { return new Bitmap(filename); } - catch(Exception e) + catch (Exception e) { - Program.WriteErrorLog(string.Format("File {0} found but can not be loaded:{1} \n",filename,e)); + Program.WriteErrorLog(string.Format("File {0} found but can not be loaded:{1} \n", filename, e)); } } return new Bitmap((Bitmap)Properties.Resources.ResourceManager.GetObject(name)); @@ -242,7 +242,7 @@ private void SetButtonPosition(Button previous, Button current, int spacing) else if (Root.ToolbarOrientation == Orientation.toDown) { current.Left = previous.Left; - current.Top = previous.Top - spacing - current.Height; + current.Top = previous.Top - spacing - current.Height; } else if (Root.ToolbarOrientation == Orientation.toUp) { @@ -258,14 +258,14 @@ private void SetSmallButtonNext(Button previous, Button current, int incr) current.Left = previous.Left; current.Top = previous.Top + incr; } - else + else { current.Left = previous.Left + incr; current.Top = previous.Top; } } - public Bitmap buildPenIcon(Color col, int transparency, Boolean Sel) + public Bitmap buildPenIcon(Color col, int transparency, bool Sel) { Bitmap fg, img; ImageAttributes imageAttributes = new ImageAttributes(); @@ -324,12 +324,12 @@ public FormCollection(Root root) ZoomForm.pictureBox2.BackgroundImage = ZoomImage2; ZoomFormRePosX = ZoomImage.Width / 2; ZoomFormRePosY = ZoomImage.Height / 2; - ZoomForm.Width = (int)(Root.ZoomWidth*Root.ZoomScale); - ZoomForm.Height = (int)(Root.ZoomHeight*Root.ZoomScale); - ZoomSaveStroke = Path.GetFullPath(Environment.ExpandEnvironmentVariables("%temp%/ZoomSave.strokes.txt")).Replace('\\','/'); + ZoomForm.Width = (int)(Root.ZoomWidth * Root.ZoomScale); + ZoomForm.Height = (int)(Root.ZoomHeight * Root.ZoomScale); + ZoomSaveStroke = Path.GetFullPath(Environment.ExpandEnvironmentVariables("%temp%/ZoomSave.strokes.txt")).Replace('\\', '/'); //Console.WriteLine("B=" + (DateTime.Now.Ticks/1e7).ToString()); - ClipartsDlg = new ImageLister(Root); + ClipartsDlg = new ImageLister(Root); Initializing = true; //loading default params TextFont = Root.TextFont; @@ -368,14 +368,14 @@ public FormCollection(Root root) const double SmallButtonNext = 0.44; const double InterButtonGap = NormSizePercent * .05; */ - if (Root.ToolbarOrientation<=Orientation.Horizontal) + if (Root.ToolbarOrientation <= Orientation.Horizontal) { gpButtons.Height = dim; - gpButtons.Width = (int)((dim1 *.5 + dim3) +(nbPen * dim4 + (Root.ToolsEnabled ? (6*dim4s +dim4s) : 0) + (Root.EraserEnabled ? dim4 : 0) + (Root.PanEnabled ? dim4 : 0) + (Root.PointerEnabled ? dim4 : 0) + gpButtons.Width = (int)((dim1 * .5 + dim3) + (nbPen * dim4 + (Root.ToolsEnabled ? (6 * dim4s + dim4s) : 0) + (Root.EraserEnabled ? dim4 : 0) + (Root.PanEnabled ? dim4 : 0) + (Root.PointerEnabled ? dim4 : 0) + (Root.PenWidthEnabled ? dim4 : 0) + (Root.InkVisibleEnabled ? dim4 : 0) + (Root.SnapEnabled ? dim4 : 0) - + (Root.UndoEnabled ? dim4 : 0) + (Root.ClearEnabled ? dim4 : 0) + (Root.LoadSaveEnabled ? dim4s : 0) - + ((Root.VideoRecordMode!=VideoRecordMode.NoVideo) ? dim4 : 0) - + dim1 )); + + (Root.UndoEnabled ? dim4 : 0) + (Root.ClearEnabled ? dim4 : 0) + (Root.LoadSaveEnabled ? dim4s : 0) + + ((Root.VideoRecordMode != VideoRecordMode.NoVideo) ? dim4 : 0) + + dim1)); } else //Vertical { @@ -393,7 +393,7 @@ public FormCollection(Root root) { btDock.Height = dim1; btDock.Width = dim1 / 2; - btDock.BackgroundImage = getImgFromDiskOrRes(Root.Docked?"dockback":"dock"); + btDock.BackgroundImage = getImgFromDiskOrRes(Root.Docked ? "dockback" : "dock"); btDock.Top = dim2; btDock.Left = 0; } @@ -403,7 +403,7 @@ public FormCollection(Root root) btDock.Width = dim1 / 2; btDock.BackgroundImage = getImgFromDiskOrRes(!Root.Docked ? "dockback" : "dock"); btDock.Top = dim2; - btDock.Left = gpButtons.Width-btDock.Width; + btDock.Left = gpButtons.Width - btDock.Width; } else if (Root.ToolbarOrientation == Orientation.toDown) { @@ -466,7 +466,7 @@ public FormCollection(Root root) btPen[b].Visible = false; } - if(root.ToolsEnabled) + if (root.ToolsEnabled) { // background images loaded/applied in SelectTool btHand.Height = dim1s; @@ -569,7 +569,7 @@ public FormCollection(Root root) else btMagn.Visible = false; - if (root.ZoomEnabled>0) + if (root.ZoomEnabled > 0) { btZoom.Height = dim1s; btZoom.Width = dim1s; @@ -577,7 +577,7 @@ public FormCollection(Root root) SetSmallButtonNext(btMagn, btZoom, dim2s); } else - btZoom.Visible=false; + btZoom.Visible = false; if (root.PointerEnabled) { @@ -716,31 +716,31 @@ public FormCollection(Root root) switch (Root.ToolbarOrientation) { case Orientation.toLeft: - gpButtonsLeft = Screen.PrimaryScreen.WorkingArea.Right - gpButtons.Width + PrimaryLeft; - gpButtonsTop = Screen.PrimaryScreen.WorkingArea.Bottom - gpButtons.Height - 15 + PrimaryTop; - gpButtons.Left = gpButtonsLeft + gpButtons.Width; - gpButtons.Top = gpButtonsTop; - VisibleToolbar.Width = 0; - break; - case Orientation.toRight: - gpButtonsLeft = Screen.PrimaryScreen.WorkingArea.Left + PrimaryLeft; - gpButtonsTop = Screen.PrimaryScreen.WorkingArea.Bottom - gpButtons.Height - 15 + PrimaryTop; - gpButtons.Left = gpButtonsLeft; - gpButtons.Top = gpButtonsTop; - VisibleToolbar.Width = 0; - break; - case Orientation.toUp: - gpButtonsLeft = Screen.PrimaryScreen.WorkingArea.Right - gpButtons.Width - 15 + PrimaryLeft; - gpButtonsTop = Screen.PrimaryScreen.WorkingArea.Bottom - gpButtons.Height + PrimaryTop; - gpButtons.Left = gpButtonsLeft; - gpButtons.Top = gpButtonsTop + gpButtons.Height; - VisibleToolbar.Height = 0; - break; - case Orientation.toDown: - gpButtonsLeft = Screen.PrimaryScreen.WorkingArea.Right - gpButtons.Width - 15 + PrimaryLeft; - gpButtonsTop = Screen.PrimaryScreen.WorkingArea.Top + PrimaryTop; - gpButtons.Left = gpButtonsLeft; - gpButtons.Top = gpButtonsTop; + gpButtonsLeft = Screen.PrimaryScreen.WorkingArea.Right - gpButtons.Width + PrimaryLeft; + gpButtonsTop = Screen.PrimaryScreen.WorkingArea.Bottom - gpButtons.Height - 15 + PrimaryTop; + gpButtons.Left = gpButtonsLeft + gpButtons.Width; + gpButtons.Top = gpButtonsTop; + VisibleToolbar.Width = 0; + break; + case Orientation.toRight: + gpButtonsLeft = Screen.PrimaryScreen.WorkingArea.Left + PrimaryLeft; + gpButtonsTop = Screen.PrimaryScreen.WorkingArea.Bottom - gpButtons.Height - 15 + PrimaryTop; + gpButtons.Left = gpButtonsLeft; + gpButtons.Top = gpButtonsTop; + VisibleToolbar.Width = 0; + break; + case Orientation.toUp: + gpButtonsLeft = Screen.PrimaryScreen.WorkingArea.Right - gpButtons.Width - 15 + PrimaryLeft; + gpButtonsTop = Screen.PrimaryScreen.WorkingArea.Bottom - gpButtons.Height + PrimaryTop; + gpButtons.Left = gpButtonsLeft; + gpButtons.Top = gpButtonsTop + gpButtons.Height; + VisibleToolbar.Height = 0; + break; + case Orientation.toDown: + gpButtonsLeft = Screen.PrimaryScreen.WorkingArea.Right - gpButtons.Width - 15 + PrimaryLeft; + gpButtonsTop = Screen.PrimaryScreen.WorkingArea.Top + PrimaryTop; + gpButtons.Left = gpButtonsLeft; + gpButtons.Top = gpButtonsTop; VisibleToolbar.Height = 0; break; } @@ -758,7 +758,7 @@ public FormCollection(Root root) else { gpButtonsLeft = this.ClientRectangle.Right - gpButtons.Width; - gpButtonsTop = this.ClientRectangle.Top ; + gpButtonsTop = this.ClientRectangle.Top; gpButtons.Left = gpButtonsLeft; gpButtons.Top = gpButtonsTop; VisibleToolbar.Height = 0; @@ -853,8 +853,8 @@ public FormCollection(Root root) this.toolTip.SetToolTip(this.btClip1, Root.Local.ButtonNameClipArt + "-1 (" + Root.Hotkey_ClipArt1.ToString() + ")"); this.toolTip.SetToolTip(this.btClip2, Root.Local.ButtonNameClipArt + "-2 (" + Root.Hotkey_ClipArt2.ToString() + ")"); this.toolTip.SetToolTip(this.btClip3, Root.Local.ButtonNameClipArt + "-3 (" + Root.Hotkey_ClipArt3.ToString() + ")"); - this.toolTip.SetToolTip(this.btSave, String.Format(Root.Local.SaveStroke,"")); - this.toolTip.SetToolTip(this.btLoad, String.Format(Root.Local.LoadStroke,"")); + this.toolTip.SetToolTip(this.btSave, string.Format(Root.Local.SaveStroke, "")); + this.toolTip.SetToolTip(this.btLoad, string.Format(Root.Local.LoadStroke, "")); foreach (Control ct in gpButtons.Controls) { @@ -878,11 +878,11 @@ public FormCollection(Root root) private void setPenWidthBarPosition() { - if(Root.ToolbarOrientation <= Orientation.Horizontal) + if (Root.ToolbarOrientation <= Orientation.Horizontal) { gpPenWidth.Left = gpButtonsLeft + btPenWidth.Left; // gpButtonsLeft + btPenWidth.Left - gpPenWidth.Width / 2 + btPenWidth.Width / 2; gpPenWidth.Top = gpButtonsTop - gpPenWidth.Height - 10; - if ( !(IsInsideVisibleScreen(gpPenWidth.Left, gpPenWidth.Top) && IsInsideVisibleScreen(gpPenWidth.Right, gpPenWidth.Bottom))) + if (!(IsInsideVisibleScreen(gpPenWidth.Left, gpPenWidth.Top) && IsInsideVisibleScreen(gpPenWidth.Right, gpPenWidth.Bottom))) gpPenWidth.Top = gpButtonsTop + gpButtonsHeight + 10; } else @@ -890,7 +890,7 @@ private void setPenWidthBarPosition() gpPenWidth.Top = gpButtonsTop + btPenWidth.Top; gpPenWidth.Left = gpButtonsLeft - gpPenWidth.Width - 10; // gpButtonsLeft + btPenWidth.Left - gpPenWidth.Width / 2 + btPenWidth.Width / 2; if (!(IsInsideVisibleScreen(gpPenWidth.Left, gpPenWidth.Top) && IsInsideVisibleScreen(gpPenWidth.Right, gpPenWidth.Bottom))) - gpPenWidth.Left = gpButtonsLeft +gpButtonsWidth + 10; + gpPenWidth.Left = gpButtonsLeft + gpButtonsWidth + 10; } } @@ -934,7 +934,7 @@ public void AltTabActivate() return; } //Console.WriteLine("activating " + (Root.PointerMode ? "pointer" : "not") + (Root.FormButtonHitter.Visible ? "visible" : "not")+ Root.FormButtonHitter.Width.ToString()); - if (Root.FormButtonHitter.Visible && (Math.Min(Root.FormButtonHitter.Width, Root.FormButtonHitter.Height)<=Math.Min(Root.FormCollection.btDock.Width, Root.FormCollection.btDock.Height)*1.5)) + if (Root.FormButtonHitter.Visible && (Math.Min(Root.FormButtonHitter.Width, Root.FormButtonHitter.Height) <= Math.Min(Root.FormCollection.btDock.Width, Root.FormCollection.btDock.Height) * 1.5)) { //Console.WriteLine("process "); SelectPen(LastPenSelected); @@ -996,7 +996,7 @@ private void SetVidBgImage() { btVideo.BackgroundImage = getImgFromDiskOrRes("VidUnk", ImageExts); //Console.WriteLine("VideoRecInProgress " + Root.VideoRecInProgress.ToString()); - } + } Root.UponButtonsUpdate |= 0x2; } @@ -1004,16 +1004,16 @@ private void IC_MouseWheel(object sender, CancelMouseEventArgs e) { if (Root.PointerMode) // Wheel shall not be taken into account in edit mode return; - if(ZoomForm.Visible && ((GetKeyState(VK_CONTROL)) & 0x8000)!=0) + if (ZoomForm.Visible && ((GetKeyState(VK_CONTROL)) & 0x8000) != 0) { int t = Math.Sign(e.Delta); - ZoomForm.Height += t*(int)(10.0F* Root.ZoomHeight/Root.ZoomWidth); - ZoomForm.Width += t*10; + ZoomForm.Height += t * (int)(10.0F * Root.ZoomHeight / Root.ZoomWidth); + ZoomForm.Width += t * 10; return; } - if (Root.InverseMousewheel ^ (GetKeyState(VK_SHIFT ) & 0x8000)!= 0) + if (Root.InverseMousewheel ^ (GetKeyState(VK_SHIFT) & 0x8000) != 0) { - int p = LastPenSelected + (e.Delta>0?1:-1); + int p = LastPenSelected + (e.Delta > 0 ? 1 : -1); if (p >= Root.MaxPenCount) p = 0; if (p < 0) @@ -1034,10 +1034,10 @@ private void IC_MouseWheel(object sender, CancelMouseEventArgs e) Root.GlobalPenWidth += Root.PixelToHiMetric(e.Delta > 0 ? 2 : -2); if (Root.GlobalPenWidth < 1) Root.GlobalPenWidth = 1; - /*if (Root.GlobalPenWidth > 120) - Root.GlobalPenWidth = 120; - */ - //Console.WriteLine(Root.GlobalPenWidth); + /*if (Root.GlobalPenWidth > 120) + Root.GlobalPenWidth = 120; + */ + //Console.WriteLine(Root.GlobalPenWidth); IC.DefaultDrawingAttributes.Width = Root.GlobalPenWidth; if (Root.CanvasCursor == 1) SetPenTipCursor(); @@ -1053,7 +1053,7 @@ private bool AltKeyPressed() private void btAllButtons_MouseDown(object sender, MouseEventArgs e) { MouseTimeDown = DateTime.Now; - MouseDownButtonObject = sender; + MouseDownButtonObject = sender; longClickTimer.Start(); longClickTimer.Tag = sender; //Console.WriteLine(string.Format("MD {0} {1}", DateTime.Now.Second, DateTime.Now.Millisecond)); @@ -1089,7 +1089,7 @@ private void longClickTimer_Tick(object sender, EventArgs e) //Console.WriteLine(string.Format("!LC {0}", bt.Name)); bt.RightToLeft = RightToLeft.Yes; bt.PerformClick(); - if(IsMovingToolbar<2) + if (IsMovingToolbar < 2) IsMovingToolbar = 0; } @@ -1145,7 +1145,7 @@ private Stroke AddRectStroke(int CursorX0, int CursorY0, int CursorX, int Cursor IC.Renderer.PixelToInkSpace(Root.FormDisplay.gOneStrokeCanvus, ref pts); Stroke st = Root.FormCollection.IC.Ink.CreateStroke(pts); st.DrawingAttributes = Root.FormCollection.IC.DefaultDrawingAttributes.Clone(); - if(FilledSelected==Filling.NoFrame) + if (FilledSelected == Filling.NoFrame) st.DrawingAttributes.Transparency = 255; st.DrawingAttributes.AntiAliased = true; st.DrawingAttributes.FitToCurve = false; @@ -1154,7 +1154,7 @@ private Stroke AddRectStroke(int CursorX0, int CursorY0, int CursorX, int Cursor return st; } - private Stroke AddImageStroke(int CursorX0, int CursorY0, int CursorX, int CursorY, string fn,int Filling=-10) + private Stroke AddImageStroke(int CursorX0, int CursorY0, int CursorX, int CursorY, string fn, int Filling = -10) { if (Filling == -10) Filling = Root.ImageStamp.Filling; @@ -1252,7 +1252,7 @@ private Stroke AddTextStroke(int CursorX0, int CursorY0, int CursorX, int Cursor Point pt = new Point(CursorX0, CursorY0); //IC.Renderer.PixelToInkSpace(Root.FormDisplay.gOneStrokeCanvus, ref pt); IC.Renderer.PixelToInkSpace(Root.FormDisplay.gOneStrokeCanvus, ref pt); - Point[] pts = new Point[9] { pt, pt, pt, pt, pt, pt, pt, pt,pt }; + Point[] pts = new Point[9] { pt, pt, pt, pt, pt, pt, pt, pt, pt }; Stroke st = Root.FormCollection.IC.Ink.CreateStroke(pts); st.DrawingAttributes = Root.FormCollection.IC.DefaultDrawingAttributes.Clone(); @@ -1315,7 +1315,7 @@ private float NearestStroke(Point pt, bool ptInPixel, out Stroke minStroke, out minStroke = null; //foreach (Stroke st in IC.Ink.Strokes) //reverse the order to select to most ontop : - for (int i = IC.Ink.Strokes.Count - (butLast ? 2 : 1); i>=0 ; i--) + for (int i = IC.Ink.Strokes.Count - (butLast ? 2 : 1); i >= 0; i--) { Stroke st = IC.Ink.Strokes[i]; if (st.ExtendedProperties.Contains(Root.ISDELETION_GUID)) @@ -1495,7 +1495,7 @@ private void IC_Stroke(object sender, InkCollectorStrokeEventArgs e) Root.FormDisplay.timer1_Tick(null, null); Root.FormDisplay.Update(); */ - if (Root.CursorX0 != Int32.MinValue) + if (Root.CursorX0 != int.MinValue) { ZoomCapturing = false; ZoomCaptured = true; @@ -1503,19 +1503,19 @@ private void IC_Stroke(object sender, InkCollectorStrokeEventArgs e) else return; SaveStrokes(ZoomSaveStroke); - Bitmap capt = new Bitmap(Math.Abs(Root.CursorX0- Root.CursorX), Math.Abs(Root.CursorY0 - Root.CursorY)); + Bitmap capt = new Bitmap(Math.Abs(Root.CursorX0 - Root.CursorX), Math.Abs(Root.CursorY0 - Root.CursorY)); using (Graphics g = Graphics.FromImage(capt)) { - Point p = PointToScreen(new Point(Math.Min(Root.CursorX0,Root.CursorX), Math.Min(Root.CursorY0, Root.CursorY))); + Point p = PointToScreen(new Point(Math.Min(Root.CursorX0, Root.CursorX), Math.Min(Root.CursorY0, Root.CursorY))); Size sz = new Size(capt.Width, capt.Height); g.CopyFromScreen(p, Point.Empty, sz); try { ClipartsDlg.Originals.Remove("_ZoomClip"); } catch { } ClipartsDlg.Originals.Add("_ZoomClip", capt); IC.Ink.Strokes.Clear(); Stroke st; - if(Root.WindowRect.Width>0) + if (Root.WindowRect.Width > 0) { - st = AddImageStroke(0,0,Width,Height, "_ZoomClip", Filling.NoFrame); + st = AddImageStroke(0, 0, Width, Height, "_ZoomClip", Filling.NoFrame); } else { @@ -1536,7 +1536,7 @@ private void IC_Stroke(object sender, InkCollectorStrokeEventArgs e) } else { - if (Root.CursorX0 == Int32.MinValue) // process when clicking touchscreen with just a short press; + if (Root.CursorX0 == int.MinValue) // process when clicking touchscreen with just a short press; { Point p = System.Windows.Forms.Cursor.Position; p = Root.FormDisplay.PointToClient(p); @@ -1545,11 +1545,11 @@ private void IC_Stroke(object sender, InkCollectorStrokeEventArgs e) } IC.Ink.DeleteStroke(e.Stroke); // the stroke that was just inserted has to be replaced. - if ((Root.ToolSelected == Tools.Line) && (Root.CursorX0 != Int32.MinValue)) + if ((Root.ToolSelected == Tools.Line) && (Root.CursorX0 != int.MinValue)) AddLineStroke(Root.CursorX0, Root.CursorY0, Root.CursorX, Root.CursorY); - else if ((Root.ToolSelected == Tools.Rect) && (Root.CursorX0 != Int32.MinValue)) - if ((CurrentMouseButton == MouseButtons.Right)||((int)CurrentMouseButton == 2)) - AddRectStroke(2*Root.CursorX0-Root.CursorX, 2*Root.CursorY0- Root.CursorY, Root.CursorX, Root.CursorY, Root.FilledSelected); + else if ((Root.ToolSelected == Tools.Rect) && (Root.CursorX0 != int.MinValue)) + if ((CurrentMouseButton == MouseButtons.Right) || ((int)CurrentMouseButton == 2)) + AddRectStroke(2 * Root.CursorX0 - Root.CursorX, 2 * Root.CursorY0 - Root.CursorY, Root.CursorX, Root.CursorY, Root.FilledSelected); else AddRectStroke(Root.CursorX0, Root.CursorY0, Root.CursorX, Root.CursorY, Root.FilledSelected); else if (Root.ToolSelected == Tools.ClipArt) @@ -1557,7 +1557,7 @@ private void IC_Stroke(object sender, InkCollectorStrokeEventArgs e) //int idx = ClipartsDlg.Images.Images.IndexOfKey(Root.ImageStamp.ImageStamp); int w = Root.ImageStamp.X; int h = Root.ImageStamp.Y; - if ((Root.CursorX0 == Int32.MinValue) || ((Root.CursorX0 == Root.CursorX) && (Root.CursorY0 == Root.CursorY))) + if ((Root.CursorX0 == int.MinValue) || ((Root.CursorX0 == Root.CursorX) && (Root.CursorY0 == Root.CursorY))) { Root.CursorX0 = Root.CursorX; Root.CursorY0 = Root.CursorY; @@ -1576,12 +1576,12 @@ private void IC_Stroke(object sender, InkCollectorStrokeEventArgs e) } AddImageStroke(Root.CursorX0, Root.CursorY0, Root.CursorX, Root.CursorY, Root.ImageStamp.ImageStamp); } - else if ((Root.ToolSelected == Tools.Oval) && (Root.CursorX0 != Int32.MinValue)) + else if ((Root.ToolSelected == Tools.Oval) && (Root.CursorX0 != int.MinValue)) if ((CurrentMouseButton == MouseButtons.Right) || ((int)CurrentMouseButton == 2)) AddEllipseStroke(Root.CursorX0, Root.CursorY0, Root.CursorX, Root.CursorY, Root.FilledSelected); else - AddEllipseStroke((Root.CursorX0+Root.CursorX)/2, (Root.CursorY0+Root.CursorY)/2, Root.CursorX, Root.CursorY, Root.FilledSelected); - else if (((Root.ToolSelected == Tools.StartArrow)||(Root.ToolSelected == Tools.EndArrow)) && (Root.CursorX0 != Int32.MinValue)) + AddEllipseStroke((Root.CursorX0 + Root.CursorX) / 2, (Root.CursorY0 + Root.CursorY) / 2, Root.CursorX, Root.CursorY, Root.FilledSelected); + else if (((Root.ToolSelected == Tools.StartArrow) || (Root.ToolSelected == Tools.EndArrow)) && (Root.CursorX0 != int.MinValue)) if (((CurrentMouseButton == MouseButtons.Right) || ((int)CurrentMouseButton == 2)) ^ (Root.ToolSelected == Tools.StartArrow)) AddArrowStroke(Root.CursorX0, Root.CursorY0, Root.CursorX, Root.CursorY); else @@ -1630,9 +1630,9 @@ private void IC_Stroke(object sender, InkCollectorStrokeEventArgs e) } else if ((Root.ToolSelected == Tools.Move) || (Root.ToolSelected == Tools.Copy))// Move : do Nothing movedStroke = null; - else if ((Root.ToolSelected == Tools.Poly) && ((Root.CursorX0 != Int32.MinValue) || (Math.Abs(Root.CursorY - PolyLineLastY) + Math.Abs(Root.CursorX - PolyLineLastX) < Root.MinMagneticRadius()))) + else if ((Root.ToolSelected == Tools.Poly) && ((Root.CursorX0 != int.MinValue) || (Math.Abs(Root.CursorY - PolyLineLastY) + Math.Abs(Root.CursorX - PolyLineLastX) < Root.MinMagneticRadius()))) { - if (PolyLineLastX == Int32.MinValue) + if (PolyLineLastX == int.MinValue) { PolyLineInProgress = AddLineStroke(Root.CursorX0, Root.CursorY0, Root.CursorX, Root.CursorY); PolyLineLastX = Root.CursorX; PolyLineLastY = Root.CursorY; @@ -1641,7 +1641,7 @@ private void IC_Stroke(object sender, InkCollectorStrokeEventArgs e) { if (Math.Abs(Root.CursorY - PolyLineLastY) + Math.Abs(Root.CursorX - PolyLineLastX) < Root.MinMagneticRadius()) { - PolyLineLastX = Int32.MinValue; PolyLineLastY = Int32.MinValue; PolyLineInProgress = null; + PolyLineLastX = int.MinValue; PolyLineLastY = int.MinValue; PolyLineInProgress = null; } else { @@ -1660,8 +1660,8 @@ private void IC_Stroke(object sender, InkCollectorStrokeEventArgs e) // reset the CursorX0/Y0 : this seems to introduce a wrong interim drawing CurrentMouseButton = MouseButtons.None; - Root.CursorX0 = Int32.MinValue; - Root.CursorY0 = Int32.MinValue; + Root.CursorX0 = int.MinValue; + Root.CursorY0 = int.MinValue; } public void ComputeTextBoxSize(ref Stroke st) @@ -1679,9 +1679,9 @@ public void ComputeTextBoxSize(ref Stroke st) { Point pt = new Point((int)(st.ExtendedProperties[Root.TEXTX_GUID].Data), (int)(st.ExtendedProperties[Root.TEXTY_GUID].Data)); //IC.Renderer.PixelToInkSpace(IC.Handle, ref pt); - Point pt2 = new Point((int)layoutSize.Width,(int)layoutSize.Height); + Point pt2 = new Point((int)layoutSize.Width, (int)layoutSize.Height); IC.Renderer.PixelToInkSpace(Root.FormDisplay.gOneStrokeCanvus, ref pt2); - if (stf.Alignment==StringAlignment.Near) //align Left + if (stf.Alignment == StringAlignment.Near) //align Left st.SetPoints(new Point[] { pt, new Point((int)(pt.X+pt2.X / 2),pt.Y+0), new Point((int)(pt.X+pt2.X),pt.Y+0), new Point((int)(pt.X+pt2.X),(int)(pt.Y+pt2.Y/2)),new Point((int)(pt.X+pt2.X),(int)(pt.Y+pt2.Y)), new Point((int)(pt.X+pt2.X/2),(int)(pt.Y+pt2.Y)),new Point((int)(pt.X+0),(int)(pt.Y+pt2.Y)), @@ -1695,18 +1695,18 @@ public void ComputeTextBoxSize(ref Stroke st) } private void SaveUndoStrokes() - { - Root.RedoDepth = 0; - if (Root.UndoDepth < Root.UndoStrokes.GetLength(0) - 1) - Root.UndoDepth++; - - Root.UndoP++; - if (Root.UndoP >= Root.UndoStrokes.GetLength(0)) - Root.UndoP = 0; - - if (Root.UndoStrokes[Root.UndoP] == null) - Root.UndoStrokes[Root.UndoP] = new Ink(); - Root.UndoStrokes[Root.UndoP].DeleteStrokes(); + { + Root.RedoDepth = 0; + if (Root.UndoDepth < Root.UndoStrokes.GetLength(0) - 1) + Root.UndoDepth++; + + Root.UndoP++; + if (Root.UndoP >= Root.UndoStrokes.GetLength(0)) + Root.UndoP = 0; + + if (Root.UndoStrokes[Root.UndoP] == null) + Root.UndoStrokes[Root.UndoP] = new Ink(); + Root.UndoStrokes[Root.UndoP].DeleteStrokes(); if (IC.Ink.Strokes.Count > 0) { Rectangle r = IC.Ink.Strokes.GetBoundingBox(); @@ -1720,27 +1720,27 @@ private void SaveUndoStrokes() private void IC_CursorDown(object sender, InkCollectorCursorDownEventArgs e) { if (ZoomCapturing) - { + { Screen scr = Screen.FromPoint(MousePosition); ZoomScreenRatio = (float)(scr.Bounds.Width) / scr.Bounds.Height; e.Stroke.ExtendedProperties.Add(Root.ISHIDDEN_GUID, true); // we set the ISTROKE_GUID in order to draw the inprogress as a line e.Stroke.DrawingAttributes.Color = Color.Purple; - e.Stroke.DrawingAttributes.Transparency = 0; + e.Stroke.DrawingAttributes.Transparency = 0; e.Stroke.DrawingAttributes.Width = Root.PixelToHiMetric(1); } - else if (Root.ToolSelected == Tools.Hand) + else if (Root.ToolSelected == Tools.Hand) e.Stroke.ExtendedProperties.Add(Root.ISSTROKE_GUID, true); // we set the ISTROKE_GUID in order to draw the inprogress as a line else e.Stroke.ExtendedProperties.Add(Root.ISHIDDEN_GUID, true); // we set the ISTROKE_GUID in order to draw the inprogress as a line if (!Root.InkVisible && Root.Snapping <= 0) - { - Root.SetInkVisible(true); - } + { + Root.SetInkVisible(true); + } - Root.FormDisplay.ClearCanvus(Root.FormDisplay.gOneStrokeCanvus); + Root.FormDisplay.ClearCanvus(Root.FormDisplay.gOneStrokeCanvus); Root.FormDisplay.DrawStrokes(Root.FormDisplay.gOneStrokeCanvus); - Root.FormDisplay.DrawButtons(Root.FormDisplay.gOneStrokeCanvus, false); + Root.FormDisplay.DrawButtons(Root.FormDisplay.gOneStrokeCanvus, false); Point p; try { @@ -1773,31 +1773,31 @@ private void IC_CursorDown(object sender, InkCollectorCursorDownEventArgs e) private void IC_MouseDown(object sender, CancelMouseEventArgs e) { - CurrentMouseButton = e.Button; + CurrentMouseButton = e.Button; if (Root.gpPenWidthVisible) { Root.gpPenWidthVisible = false; - Root.UponSubPanelUpdate = true; - } - - Root.FingerInAction = true; - if (Root.Snapping == 1) - { - Root.SnappingX = e.X; - Root.SnappingY = e.Y; - Root.SnappingRect = new Rectangle(e.X, e.Y, 0, 0); - Root.Snapping = 2; - } - - if (!Root.InkVisible && Root.Snapping <= 0) - { - Root.SetInkVisible(true); - } + Root.UponSubPanelUpdate = true; + } + + Root.FingerInAction = true; + if (Root.Snapping == 1) + { + Root.SnappingX = e.X; + Root.SnappingY = e.Y; + Root.SnappingRect = new Rectangle(e.X, e.Y, 0, 0); + Root.Snapping = 2; + } + + if (!Root.InkVisible && Root.Snapping <= 0) + { + Root.SetInkVisible(true); + } LasteXY.X = e.X; LasteXY.Y = e.Y; IC.Renderer.PixelToInkSpace(Root.FormDisplay.gOneStrokeCanvus, ref LasteXY); - if ((Root.ToolSelected == Tools.Poly) && (PolyLineLastX != Int32.MinValue)) + if ((Root.ToolSelected == Tools.Poly) && (PolyLineLastX != int.MinValue)) { Root.CursorX0 = PolyLineLastX; Root.CursorY0 = PolyLineLastY; @@ -1843,7 +1843,7 @@ private void IC_MouseMove(object sender, CancelMouseEventArgs e) if (e.Button == MouseButtons.None) if (Root.EraserMode || Root.ToolSelected == Tools.Edit || Root.ToolSelected == Tools.Move || Root.ToolSelected == Tools.Copy) { - if (NearestStroke(new Point(e.X, e.Y), true, out Root.StrokeHovered, out pos,false) > Root.PixelToHiMetric(Root.MinMagneticRadius())) + if (NearestStroke(new Point(e.X, e.Y), true, out Root.StrokeHovered, out pos, false) > Root.PixelToHiMetric(Root.MinMagneticRadius())) { Root.StrokeHovered = null; return; @@ -1860,35 +1860,35 @@ private void IC_MouseMove(object sender, CancelMouseEventArgs e) Root.CursorY = e.Y; if (ZoomCapturing) { - if(Root.WindowRect.Width > 0) - Root.CursorY = (int)(Root.CursorY0 + (Root.CursorX - Root.CursorX0) / (1.0*Width/Height) * Math.Sign(Root.CursorY - Root.CursorY0) * Math.Sign(Root.CursorX - Root.CursorX0)); + if (Root.WindowRect.Width > 0) + Root.CursorY = (int)(Root.CursorY0 + (Root.CursorX - Root.CursorX0) / (1.0 * Width / Height) * Math.Sign(Root.CursorY - Root.CursorY0) * Math.Sign(Root.CursorX - Root.CursorX0)); else - Root.CursorY = (int)(Root.CursorY0 + (Root.CursorX - Root.CursorX0) / ZoomScreenRatio*Math.Sign(Root.CursorY-Root.CursorY0)*Math.Sign(Root.CursorX - Root.CursorX0)); + Root.CursorY = (int)(Root.CursorY0 + (Root.CursorX - Root.CursorX0) / ZoomScreenRatio * Math.Sign(Root.CursorY - Root.CursorY0) * Math.Sign(Root.CursorX - Root.CursorX0)); } else MagneticEffect(Root.CursorX0, Root.CursorY0, ref Root.CursorX, ref Root.CursorY, Root.ToolSelected > Tools.Hand && Root.MagneticRadius > 0); if (LasteXY.X == 0 && LasteXY.Y == 0) { - LasteXY.X = e.X; - LasteXY.Y = e.Y; - IC.Renderer.PixelToInkSpace(Root.FormDisplay.gOneStrokeCanvus, ref LasteXY); - } - Point currentxy = new Point(e.X, e.Y); - IC.Renderer.PixelToInkSpace(Root.FormDisplay.gOneStrokeCanvus, ref currentxy); - - if (Root.Snapping == 2) - { - int left = Math.Min(Root.SnappingX, e.X); - int top = Math.Min(Root.SnappingY, e.Y); - int width = Math.Abs(Root.SnappingX - e.X); - int height = Math.Abs(Root.SnappingY - e.Y); - Root.SnappingRect = new Rectangle(left, top, width, height); - - if (LasteXY != currentxy) - Root.MouseMovedUnderSnapshotDragging = true; - } - else if (Root.PanMode && Root.FingerInAction) + LasteXY.X = e.X; + LasteXY.Y = e.Y; + IC.Renderer.PixelToInkSpace(Root.FormDisplay.gOneStrokeCanvus, ref LasteXY); + } + Point currentxy = new Point(e.X, e.Y); + IC.Renderer.PixelToInkSpace(Root.FormDisplay.gOneStrokeCanvus, ref currentxy); + + if (Root.Snapping == 2) + { + int left = Math.Min(Root.SnappingX, e.X); + int top = Math.Min(Root.SnappingY, e.Y); + int width = Math.Abs(Root.SnappingX - e.X); + int height = Math.Abs(Root.SnappingY - e.Y); + Root.SnappingRect = new Rectangle(left, top, width, height); + + if (LasteXY != currentxy) + Root.MouseMovedUnderSnapshotDragging = true; + } + else if (Root.PanMode && Root.FingerInAction) { Root.Pan(currentxy.X - LasteXY.X, currentxy.Y - LasteXY.Y); } @@ -1922,16 +1922,16 @@ private void IC_MouseMove(object sender, CancelMouseEventArgs e) } LasteXY = currentxy; - } + } private void IC_MouseUp(object sender, CancelMouseEventArgs e) { Root.FingerInAction = false; - if (Root.Snapping == 2) - { - int left = Math.Min(Root.SnappingX, e.X); - int top = Math.Min(Root.SnappingY, e.Y); - int width = Math.Abs(Root.SnappingX - e.X); + if (Root.Snapping == 2) + { + int left = Math.Min(Root.SnappingX, e.X); + int top = Math.Min(Root.SnappingY, e.Y); + int width = Math.Abs(Root.SnappingX - e.X); int height = Math.Abs(Root.SnappingY - e.Y); if (width < 5 || height < 5) { @@ -1957,22 +1957,22 @@ private void IC_MouseUp(object sender, CancelMouseEventArgs e) } else if (Root.PanMode) { - SaveUndoStrokes(); - } - else - { - Root.UponAllDrawingUpdate = true; - } + SaveUndoStrokes(); + } + else + { + Root.UponAllDrawingUpdate = true; + } Root.CursorX0 = int.MinValue; Root.CursorY0 = int.MinValue; } private void IC_CursorInRange(object sender, InkCollectorCursorInRangeEventArgs e) - { - if (e.Cursor.Inverted && Root.CurrentPen != -1) - { - EnterEraserMode(true); - /* + { + if (e.Cursor.Inverted && Root.CurrentPen != -1) + { + EnterEraserMode(true); + /* // temperary eraser icon light if (btEraser.Image == image_eraser) { @@ -1981,11 +1981,11 @@ private void IC_CursorInRange(object sender, InkCollectorCursorInRangeEventArgs Root.FormDisplay.UpdateFormDisplay(); } */ - } - else if (!e.Cursor.Inverted && Root.CurrentPen != -1) - { - EnterEraserMode(false); - /* + } + else if (!e.Cursor.Inverted && Root.CurrentPen != -1) + { + EnterEraserMode(false); + /* if (btEraser.Image == image_eraser_act) { btEraser.Image = image_eraser; @@ -1993,15 +1993,15 @@ private void IC_CursorInRange(object sender, InkCollectorCursorInRangeEventArgs Root.FormDisplay.UpdateFormDisplay(); } */ - } - } + } + } - public void ToTransparent() - { - UInt32 dwExStyle = GetWindowLong(this.Handle, -20); - SetWindowLong(this.Handle, -20, dwExStyle | 0x00080000); - SetLayeredWindowAttributes(this.Handle, 0x00FFFFFF, 1, 0x2); - } + public void ToTransparent() + { + uint dwExStyle = GetWindowLong(this.Handle, -20); + SetWindowLong(this.Handle, -20, dwExStyle | 0x00080000); + SetLayeredWindowAttributes(this.Handle, 0x00FFFFFF, 1, 0x2); + } public void ToTopMost() { @@ -2009,58 +2009,58 @@ public void ToTopMost() SetWindowPos(this.Handle, (IntPtr)(-1), 0, 0, 0, 0, 0x0002 | 0x0001 | 0x0020); } - public void ToThrough() - { - UInt32 dwExStyle = GetWindowLong(this.Handle, -20); - //SetWindowLong(this.Handle, -20, dwExStyle | 0x00080000); - //SetWindowPos(this.Handle, (IntPtr)0, 0, 0, 0, 0, 0x0002 | 0x0001 | 0x0004 | 0x0010 | 0x0020); - //SetLayeredWindowAttributes(this.Handle, 0x00FFFFFF, 1, 0x2); - SetWindowLong(this.Handle, -20, dwExStyle | 0x00080000 | 0x00000020); - //SetWindowPos(this.Handle, (IntPtr)(1), 0, 0, 0, 0, 0x0002 | 0x0001 | 0x0010 | 0x0020); - } - - public void ToUnThrough() - { - UInt32 dwExStyle = GetWindowLong(this.Handle, -20); - //SetWindowLong(this.Handle, -20, (uint)(dwExStyle & ~0x00080000 & ~0x0020)); - SetWindowLong(this.Handle, -20, (uint)(dwExStyle & ~0x0020)); - //SetWindowPos(this.Handle, (IntPtr)(-2), 0, 0, 0, 0, 0x0002 | 0x0001 | 0x0010 | 0x0020); - - //dwExStyle = GetWindowLong(this.Handle, -20); - //SetWindowLong(this.Handle, -20, dwExStyle | 0x00080000); - //SetLayeredWindowAttributes(this.Handle, 0x00FFFFFF, 1, 0x2); - //SetWindowPos(this.Handle, (IntPtr)(-1), 0, 0, 0, 0, 0x0002 | 0x0001 | 0x0020); - } - - public void EnterEraserMode(bool enter) - { - int exceptiontick = 0; - bool exc; - do - { - exceptiontick++; - exc = false; - try - { + public void ToThrough() + { + uint dwExStyle = GetWindowLong(this.Handle, -20); + //SetWindowLong(this.Handle, -20, dwExStyle | 0x00080000); + //SetWindowPos(this.Handle, (IntPtr)0, 0, 0, 0, 0, 0x0002 | 0x0001 | 0x0004 | 0x0010 | 0x0020); + //SetLayeredWindowAttributes(this.Handle, 0x00FFFFFF, 1, 0x2); + SetWindowLong(this.Handle, -20, dwExStyle | 0x00080000 | 0x00000020); + //SetWindowPos(this.Handle, (IntPtr)(1), 0, 0, 0, 0, 0x0002 | 0x0001 | 0x0010 | 0x0020); + } + + public void ToUnThrough() + { + uint dwExStyle = GetWindowLong(this.Handle, -20); + //SetWindowLong(this.Handle, -20, (uint)(dwExStyle & ~0x00080000 & ~0x0020)); + SetWindowLong(this.Handle, -20, (uint)(dwExStyle & ~0x0020)); + //SetWindowPos(this.Handle, (IntPtr)(-2), 0, 0, 0, 0, 0x0002 | 0x0001 | 0x0010 | 0x0020); + + //dwExStyle = GetWindowLong(this.Handle, -20); + //SetWindowLong(this.Handle, -20, dwExStyle | 0x00080000); + //SetLayeredWindowAttributes(this.Handle, 0x00FFFFFF, 1, 0x2); + //SetWindowPos(this.Handle, (IntPtr)(-1), 0, 0, 0, 0, 0x0002 | 0x0001 | 0x0020); + } + + public void EnterEraserMode(bool enter) + { + int exceptiontick = 0; + bool exc; + do + { + exceptiontick++; + exc = false; + try + { if (enter) - { - IC.EditingMode = InkOverlayEditingMode.Delete; - Root.EraserMode = true; - } - else - { - IC.EditingMode = InkOverlayEditingMode.Ink; - Root.EraserMode = false; - } - } - catch - { - Thread.Sleep(50); - exc = true; - } - } - while (exc && exceptiontick < 3); - } + { + IC.EditingMode = InkOverlayEditingMode.Delete; + Root.EraserMode = true; + } + else + { + IC.EditingMode = InkOverlayEditingMode.Ink; + Root.EraserMode = false; + } + } + catch + { + Thread.Sleep(50); + exc = true; + } + } + while (exc && exceptiontick < 3); + } private readonly int[] applicableTool = { Tools.Hand, Tools.Line, Tools.Poly, Tools.Rect, Tools.Oval, Tools.NumberTag }; public void SelectTool(int tool, int filled = -1) @@ -2132,9 +2132,9 @@ public void SelectTool(int tool, int filled = -1) Root.FilledSelected = 0; btLine.BackgroundImage = getImgFromDiskOrRes("tool_mlines", ImageExts); filled = 0; - PolyLineLastX = Int32.MinValue; PolyLineLastY = Int32.MinValue; + PolyLineLastX = int.MinValue; PolyLineLastY = int.MinValue; } - else if ((Root.ToolSelected == Tools.Poly && (Root.FilledSelected ==Filling.Empty || Root.FilledSelected > Filling.BlackFilled)) || (Root.ToolSelected != Tools.Poly)) + else if ((Root.ToolSelected == Tools.Poly && (Root.FilledSelected == Filling.Empty || Root.FilledSelected > Filling.BlackFilled)) || (Root.ToolSelected != Tools.Poly)) { tool = Tools.Line; Root.FilledSelected = 0; @@ -2143,7 +2143,7 @@ public void SelectTool(int tool, int filled = -1) else // Root.ToolSelected == Tools.Poly && Root.FilledSelected != 4 { tool = Tools.Poly; - PolyLineLastX = Int32.MinValue; PolyLineLastY = Int32.MinValue; + PolyLineLastX = int.MinValue; PolyLineLastY = int.MinValue; if (Root.FilledSelected == Filling.PenColorFilled) btLine.BackgroundImage = getImgFromDiskOrRes("tool_mlines_filledC", ImageExts); else if (Root.FilledSelected == Filling.WhiteFilled) @@ -2208,7 +2208,7 @@ public void SelectTool(int tool, int filled = -1) btNumb.BackgroundImage = getImgFromDiskOrRes("tool_numb_fillB", ImageExts); try { - IC.Cursor = cursorred; + IC.Cursor = cursorred; } catch { @@ -2279,13 +2279,13 @@ public void SelectTool(int tool, int filled = -1) public void SelectPen(int pen) // -3 = pan, -2 = pointer, -1 = erasor, >=0 = pens - { + { btPan.BackgroundImage = getImgFromDiskOrRes("pan", ImageExts); //Console.WriteLine("SelectPen : " + pen.ToString()); //System.Diagnostics.StackTrace t = new System.Diagnostics.StackTrace(); //Console.WriteLine(t.ToString()); if (pen == -3) - { + { if (AltKeyPressed() && SavedPen < 0) { SavedPen = LastPenSelected; @@ -2295,24 +2295,24 @@ public void SelectPen(int pen) //btPen[b].Image = image_pen[b]; btPen[b].BackgroundImage = buildPenIcon(Root.PenAttr[b].Color, Root.PenAttr[b].Transparency, false);// image_pen[b]; btEraser.BackgroundImage = image_eraser; - btPointer.BackgroundImage = image_pointer; + btPointer.BackgroundImage = image_pointer; btPan.BackgroundImage = getImgFromDiskOrRes("pan_act", ImageExts); EnterEraserMode(false); - Root.UnPointer(); - Root.PanMode = true; + Root.UnPointer(); + Root.PanMode = true; - try - { - IC.SetWindowInputRectangle(new Rectangle(0, 0, 1, 1)); - } - catch - { - Thread.Sleep(1); - IC.SetWindowInputRectangle(new Rectangle(0, 0, 1, 1)); - } - } - else if (pen == -2) - { + try + { + IC.SetWindowInputRectangle(new Rectangle(0, 0, 1, 1)); + } + catch + { + Thread.Sleep(1); + IC.SetWindowInputRectangle(new Rectangle(0, 0, 1, 1)); + } + } + else if (pen == -2) + { if (AltKeyPressed() && SavedPen < 0) { SavedPen = LastPenSelected; @@ -2322,13 +2322,13 @@ public void SelectPen(int pen) //btPen[b].Image = image_pen[b]; btPen[b].BackgroundImage = buildPenIcon(Root.PenAttr[b].Color, Root.PenAttr[b].Transparency, false);// image_pen[b]; btEraser.BackgroundImage = image_eraser; - btPointer.BackgroundImage = image_pointer_act; - EnterEraserMode(false); - Root.Pointer(); - Root.PanMode = false; - } - else if (pen == -1) - { + btPointer.BackgroundImage = image_pointer_act; + EnterEraserMode(false); + Root.Pointer(); + Root.PanMode = false; + } + else if (pen == -1) + { if (AltKeyPressed() && SavedPen < 0) { SavedPen = LastPenSelected; @@ -2338,12 +2338,12 @@ public void SelectPen(int pen) // this.Cursor = System.Windows.Forms.Cursors.Default; for (int b = 0; b < Root.MaxPenCount; b++) - //btPen[b].Image = image_pen[b]; + //btPen[b].Image = image_pen[b]; btPen[b].BackgroundImage = buildPenIcon(Root.PenAttr[b].Color, Root.PenAttr[b].Transparency, false);// image_pen[b]; btEraser.BackgroundImage = image_eraser_act; - btPointer.BackgroundImage = image_pointer; - EnterEraserMode(true); + btPointer.BackgroundImage = image_pointer; + EnterEraserMode(true); Root.UnPointer(); Root.PanMode = false; // !!!!!!!!!!!!!!! random exception @@ -2362,18 +2362,18 @@ public void SelectPen(int pen) break; } - try - { - IC.SetWindowInputRectangle(new Rectangle(0, 0, this.Width, this.Height)); - } - catch - { - Thread.Sleep(1); - IC.SetWindowInputRectangle(new Rectangle(0, 0, this.Width, this.Height)); - } - } - else if (pen >= 0) - { + try + { + IC.SetWindowInputRectangle(new Rectangle(0, 0, this.Width, this.Height)); + } + catch + { + Thread.Sleep(1); + IC.SetWindowInputRectangle(new Rectangle(0, 0, this.Width, this.Height)); + } + } + else if (pen >= 0) + { if (AltKeyPressed() && pen != LastPenSelected && SavedPen < 0) { SavedPen = LastPenSelected; @@ -2393,12 +2393,12 @@ public void SelectPen(int pen) for (int b = 0; b < Root.MaxPenCount; b++) //btPen[b].Image = image_pen[b]; btPen[b].BackgroundImage = buildPenIcon(Root.PenAttr[b].Color, Root.PenAttr[b].Transparency, b == pen); - //btPen[pen].Image = image_pen_act[pen]; - btEraser.BackgroundImage = image_eraser; - btPointer.BackgroundImage = image_pointer; - EnterEraserMode(false); - Root.UnPointer(); - Root.PanMode = false; + //btPen[pen].Image = image_pen_act[pen]; + btEraser.BackgroundImage = image_eraser; + btPointer.BackgroundImage = image_pointer; + EnterEraserMode(false); + Root.UnPointer(); + Root.PanMode = false; if (Root.CanvasCursor == 0) { @@ -2425,18 +2425,18 @@ public void SelectPen(int pen) SetWindowInputRectFlag = true; } } - Root.CurrentPen = pen; - if (Root.gpPenWidthVisible) - { - Root.gpPenWidthVisible = false; - Root.UponSubPanelUpdate = true; - } - else - Root.UponButtonsUpdate |= 0x2; + Root.CurrentPen = pen; + if (Root.gpPenWidthVisible) + { + Root.gpPenWidthVisible = false; + Root.UponSubPanelUpdate = true; + } + else + Root.UponButtonsUpdate |= 0x2; - if (pen != -2) - Root.LastPen = pen; - } + if (pen != -2) + Root.LastPen = pen; + } public void RetreatAndExit() { @@ -2448,35 +2448,35 @@ public void RetreatAndExit() string st = Path.GetFullPath(Environment.ExpandEnvironmentVariables(Root.SnapshotBasePath)); if (!System.IO.Directory.Exists(st)) System.IO.Directory.CreateDirectory(st); - SaveStrokes(st+ "AutoSave.strokes.txt"); + SaveStrokes(st + "AutoSave.strokes.txt"); } - catch(Exception ex) + catch (Exception ex) { MessageBox.Show(string.Format(Root.Local.FileCanNotWrite, Environment.ExpandEnvironmentVariables(Root.SnapshotBasePath + "AutoSave.strokes.txt"))); - string errorMsg = "Silent exception logged \r\n:"+ex.Message + "\r\n\r\nStack Trace:\r\n" + ex.StackTrace + "\r\n\r\n"; + string errorMsg = "Silent exception logged \r\n:" + ex.Message + "\r\n\r\nStack Trace:\r\n" + ex.StackTrace + "\r\n\r\n"; Program.WriteErrorLog(errorMsg); } Root.ClearInk(); SaveUndoStrokes(); //Root.SaveOptions("config.ini"); - Root.gpPenWidthVisible = false; + Root.gpPenWidthVisible = false; - LastTickTime = DateTime.Now; - ButtonsEntering = -9; - } + LastTickTime = DateTime.Now; + ButtonsEntering = -9; + } - public void btDock_Click(object sender, EventArgs e) - { - if (ToolbarMoved) - { - ToolbarMoved = false; - return; - } + public void btDock_Click(object sender, EventArgs e) + { + if (ToolbarMoved) + { + ToolbarMoved = false; + return; + } - LastTickTime = DateTime.Now; - if (!Root.Docked) - { - Root.Dock(); + LastTickTime = DateTime.Now; + if (!Root.Docked) + { + Root.Dock(); } else { @@ -2497,7 +2497,7 @@ public void btWindowMode_Click2(object sender, EventArgs e) return; } - PolyLineLastX = Int32.MinValue; PolyLineLastY = Int32.MinValue; PolyLineInProgress = null; + PolyLineLastX = int.MinValue; PolyLineLastY = int.MinValue; PolyLineInProgress = null; Root.gpPenWidthVisible = false; try { @@ -2531,7 +2531,7 @@ public void btPointer_Click(object sender, EventArgs e) return; } - PolyLineLastX = Int32.MinValue; PolyLineLastY = Int32.MinValue; PolyLineInProgress = null; + PolyLineLastX = int.MinValue; PolyLineLastY = int.MinValue; PolyLineInProgress = null; Root.gpPenWidthVisible = false; TimeSpan tsp = DateTime.Now - MouseTimeDown; @@ -2572,7 +2572,7 @@ public void AddPointerSnaps() //Stroke st = AddImageStroke(SystemInformation.VirtualScreen.Left, SystemInformation.VirtualScreen.Top, SystemInformation.VirtualScreen.Right, SystemInformation.VirtualScreen.Bottom, Path.GetFileNameWithoutExtension(PointerModeSnaps[i]), Filling.NoFrame); Rectangle r = RectangleToClient(new Rectangle(Left, Top, Width, Height)); //Stroke st = AddImageStroke(Left,Top,Right,Bottom, Path.GetFileNameWithoutExtension(PointerModeSnaps[i]), Filling.NoFrame); - Stroke st = AddImageStroke(r.Left,r.Top,r.Right,r.Bottom, Path.GetFileNameWithoutExtension(PointerModeSnaps[i]), Filling.NoFrame); + Stroke st = AddImageStroke(r.Left, r.Top, r.Right, r.Bottom, Path.GetFileNameWithoutExtension(PointerModeSnaps[i]), Filling.NoFrame); try { st.ExtendedProperties.Remove(Root.FADING_PEN); } catch { }; // if the pen was fading we need to remove that } SaveUndoStrokes(); @@ -2585,23 +2585,23 @@ public void AddPointerSnaps() private void btPenWidth_Click(object sender, EventArgs e) { if (ToolbarMoved) - { - ToolbarMoved = false; - return; - } + { + ToolbarMoved = false; + return; + } - if (Root.PointerMode) - return; + if (Root.PointerMode) + return; - Root.gpPenWidthVisible = !Root.gpPenWidthVisible; - if (Root.gpPenWidthVisible) + Root.gpPenWidthVisible = !Root.gpPenWidthVisible; + if (Root.gpPenWidthVisible) { pboxPenWidthIndicator.Left = (int)Math.Sqrt(IC.DefaultDrawingAttributes.Width * 30); - Root.UponButtonsUpdate |= 0x2; + Root.UponButtonsUpdate |= 0x2; } else Root.UponSubPanelUpdate = true; - } + } public void btSnap_Click(object sender, EventArgs e) { @@ -2624,18 +2624,18 @@ public void btSnap_Click(object sender, EventArgs e) if (Root.Snapping > 0) return; - PolyLineLastX = Int32.MinValue; PolyLineLastY = Int32.MinValue; PolyLineInProgress = null; + PolyLineLastX = int.MinValue; PolyLineLastY = int.MinValue; PolyLineInProgress = null; cursorsnap = new System.Windows.Forms.Cursor(gInk.Properties.Resources.cursorsnap.Handle); - this.Cursor = cursorsnap; + this.Cursor = cursorsnap; - Root.gpPenWidthVisible = false; + Root.gpPenWidthVisible = false; - try - { - IC.SetWindowInputRectangle(new Rectangle(0, 0, 1, 1)); - } - catch - { + try + { + IC.SetWindowInputRectangle(new Rectangle(0, 0, 1, 1)); + } + catch + { Thread.Sleep(1); IC.SetWindowInputRectangle(new Rectangle(0, 0, 1, 1)); } @@ -2651,52 +2651,52 @@ public void btSnap_Click(object sender, EventArgs e) Root.SnappingX = -1; Root.SnappingY = -1; Root.SnappingRect = new Rectangle(0, 0, 0, 0); - Root.Snapping = 1; - ButtonsEntering = -2; - Root.UnPointer(); - } - - public void ExitSnapping() - { - try - { - IC.SetWindowInputRectangle(new Rectangle(0, 0, this.Width, this.Height)); - } - catch - { - Thread.Sleep(1); - IC.SetWindowInputRectangle(new Rectangle(0, 0, this.Width, this.Height)); - } - Root.SnappingX = -1; - Root.SnappingY = -1; - Root.Snapping = -60; - ButtonsEntering = 1; - Root.SelectPen(Root.CurrentPen); - - this.Cursor = System.Windows.Forms.Cursors.Default; - } - - public void btStop_Click(object sender, EventArgs e) - { - if (ToolbarMoved) - { - ToolbarMoved = false; - return; - } - - RetreatAndExit(); - } - - DateTime LastTickTime; - bool[] LastPenStatus = new bool[10]; - bool LastEraserStatus = false; - bool LastVisibleStatus = false; - bool LastPointerStatus = false; - bool LastPanStatus = false; - bool LastUndoStatus = false; - bool LastRedoStatus = false; - bool LastSnapStatus = false; - bool LastClearStatus = false; + Root.Snapping = 1; + ButtonsEntering = -2; + Root.UnPointer(); + } + + public void ExitSnapping() + { + try + { + IC.SetWindowInputRectangle(new Rectangle(0, 0, this.Width, this.Height)); + } + catch + { + Thread.Sleep(1); + IC.SetWindowInputRectangle(new Rectangle(0, 0, this.Width, this.Height)); + } + Root.SnappingX = -1; + Root.SnappingY = -1; + Root.Snapping = -60; + ButtonsEntering = 1; + Root.SelectPen(Root.CurrentPen); + + this.Cursor = System.Windows.Forms.Cursors.Default; + } + + public void btStop_Click(object sender, EventArgs e) + { + if (ToolbarMoved) + { + ToolbarMoved = false; + return; + } + + RetreatAndExit(); + } + + DateTime LastTickTime; + bool[] LastPenStatus = new bool[10]; + bool LastEraserStatus = false; + bool LastVisibleStatus = false; + bool LastPointerStatus = false; + bool LastPanStatus = false; + bool LastUndoStatus = false; + bool LastRedoStatus = false; + bool LastSnapStatus = false; + bool LastClearStatus = false; bool LastVideoStatus = false; bool LastDockStatus = false; bool LastHandStatus = false; @@ -2714,133 +2714,137 @@ public void btStop_Click(object sender, EventArgs e) bool LastClipArt1Status = false; bool LastClipArt2Status = false; bool LastClipArt3Status = false; - int SnappingPointerStep=0; + int SnappingPointerStep = 0; DateTime SnappingPointerReset; private void gpPenWidth_MouseDown(object sender, MouseEventArgs e) { - gpPenWidth_MouseOn = true; - } - - private void gpPenWidth_MouseMove(object sender, MouseEventArgs e) - { - if (gpPenWidth_MouseOn) - { - if (e.X < 10 || gpPenWidth.Width - e.X < 10) - return; - - Root.GlobalPenWidth = e.X * e.X / 30; - pboxPenWidthIndicator.Left = e.X - pboxPenWidthIndicator.Width / 2; - IC.DefaultDrawingAttributes.Width = Root.GlobalPenWidth; - Root.UponButtonsUpdate |= 0x2; - } - } - - private void gpPenWidth_MouseUp(object sender, MouseEventArgs e) - { - if (e.X >= 10 && gpPenWidth.Width - e.X >= 10) - { - Root.GlobalPenWidth = e.X * e.X / 30; - pboxPenWidthIndicator.Left = e.X - pboxPenWidthIndicator.Width / 2; - IC.DefaultDrawingAttributes.Width = Root.GlobalPenWidth; - } - - if (Root.CanvasCursor == 1) - SetPenTipCursor(); - - Root.gpPenWidthVisible = false; - Root.UponSubPanelUpdate = true; - gpPenWidth_MouseOn = false; - } - - private void pboxPenWidthIndicator_MouseDown(object sender, MouseEventArgs e) - { - gpPenWidth_MouseOn = true; - } - - private void pboxPenWidthIndicator_MouseMove(object sender, MouseEventArgs e) - { - if (gpPenWidth_MouseOn) - { - int x = e.X + pboxPenWidthIndicator.Left; - if (x < 10 || gpPenWidth.Width - x < 10) - return; - - Root.GlobalPenWidth = x * x / 30; - pboxPenWidthIndicator.Left = x - pboxPenWidthIndicator.Width / 2; - IC.DefaultDrawingAttributes.Width = Root.GlobalPenWidth; - Root.UponButtonsUpdate |= 0x2; - } - } - - private void pboxPenWidthIndicator_MouseUp(object sender, MouseEventArgs e) - { - if (Root.CanvasCursor == 1) - SetPenTipCursor(); - - Root.gpPenWidthVisible = false; - Root.UponSubPanelUpdate = true; - gpPenWidth_MouseOn = false; - } - - private void SetPenTipCursor() - { - Bitmap bitmaptip = (Bitmap)(gInk.Properties.Resources._null).Clone(); - Graphics g = Graphics.FromImage(bitmaptip); - DrawingAttributes dda = IC.DefaultDrawingAttributes; - Brush cbrush; - Point widt; - if (!Root.EraserMode) - { - cbrush = new SolidBrush(IC.DefaultDrawingAttributes.Color); - //Brush cbrush = new SolidBrush(Color.FromArgb(255 - dda.Transparency, dda.Color.R, dda.Color.G, dda.Color.B)); - widt = new Point((int)IC.DefaultDrawingAttributes.Width, 0); - } - else - { - cbrush = new SolidBrush(Color.Black); - widt = new Point(60, 0); + gpPenWidth_MouseOn = true; + } + + private void gpPenWidth_MouseMove(object sender, MouseEventArgs e) + { + if (gpPenWidth_MouseOn) + { + if (e.X < 10 || gpPenWidth.Width - e.X < 10) + return; + + Root.GlobalPenWidth = e.X * e.X / 30; + pboxPenWidthIndicator.Left = e.X - pboxPenWidthIndicator.Width / 2; + IC.DefaultDrawingAttributes.Width = Root.GlobalPenWidth; + Root.UponButtonsUpdate |= 0x2; + } + } + + private void gpPenWidth_MouseUp(object sender, MouseEventArgs e) + { + if (e.X >= 10 && gpPenWidth.Width - e.X >= 10) + { + Root.GlobalPenWidth = e.X * e.X / 30; + pboxPenWidthIndicator.Left = e.X - pboxPenWidthIndicator.Width / 2; + IC.DefaultDrawingAttributes.Width = Root.GlobalPenWidth; + } + + if (Root.CanvasCursor == 1) + SetPenTipCursor(); + + Root.gpPenWidthVisible = false; + Root.UponSubPanelUpdate = true; + gpPenWidth_MouseOn = false; + } + + private void pboxPenWidthIndicator_MouseDown(object sender, MouseEventArgs e) + { + gpPenWidth_MouseOn = true; + } + + private void pboxPenWidthIndicator_MouseMove(object sender, MouseEventArgs e) + { + if (gpPenWidth_MouseOn) + { + int x = e.X + pboxPenWidthIndicator.Left; + if (x < 10 || gpPenWidth.Width - x < 10) + return; + + Root.GlobalPenWidth = x * x / 30; + pboxPenWidthIndicator.Left = x - pboxPenWidthIndicator.Width / 2; + IC.DefaultDrawingAttributes.Width = Root.GlobalPenWidth; + Root.UponButtonsUpdate |= 0x2; + } + } + + private void pboxPenWidthIndicator_MouseUp(object sender, MouseEventArgs e) + { + if (Root.CanvasCursor == 1) + SetPenTipCursor(); + + Root.gpPenWidthVisible = false; + Root.UponSubPanelUpdate = true; + gpPenWidth_MouseOn = false; + } + + private void SetPenTipCursor() + { + Bitmap bitmaptip = (Bitmap)(gInk.Properties.Resources._null).Clone(); + Graphics g = Graphics.FromImage(bitmaptip); + DrawingAttributes dda = IC.DefaultDrawingAttributes; + Brush cbrush; + Point widt; + if (!Root.EraserMode) + { + cbrush = new SolidBrush(IC.DefaultDrawingAttributes.Color); + //Brush cbrush = new SolidBrush(Color.FromArgb(255 - dda.Transparency, dda.Color.R, dda.Color.G, dda.Color.B)); + widt = new Point((int)IC.DefaultDrawingAttributes.Width, 0); + } + else + { + cbrush = new SolidBrush(Color.Black); + widt = new Point(60, 0); } try { - IC.Renderer.InkSpaceToPixel(Root.FormDisplay.gOneStrokeCanvus, ref widt); + if (Root.FormDisplay != null) + { + IC.Renderer.InkSpaceToPixel(Root.FormDisplay.gOneStrokeCanvus, ref widt); + } } catch // not in good context. considered to be able to stop processing at that time { return; } - IntPtr screenDc = GetDC(IntPtr.Zero); - const int VERTRES = 10; - const int DESKTOPVERTRES = 117; - int LogicalScreenHeight = GetDeviceCaps(screenDc, VERTRES); - int PhysicalScreenHeight = GetDeviceCaps(screenDc, DESKTOPVERTRES); - float ScreenScalingFactor = (float)PhysicalScreenHeight / (float)LogicalScreenHeight; - ReleaseDC(IntPtr.Zero, screenDc); - - int dia = Math.Max((int)(widt.X * ScreenScalingFactor), 2); - g.FillEllipse(cbrush, 64 - dia / 2, 64 - dia / 2, dia, dia); - if (dia <= 5) - { - Pen cpen = new Pen(Color.FromArgb(50, 128, 128, 128), 2); - dia += 6; + IntPtr screenDc = GetDC(IntPtr.Zero); + const int VERTRES = 10; + const int DESKTOPVERTRES = 117; + int LogicalScreenHeight = GetDeviceCaps(screenDc, VERTRES); + int PhysicalScreenHeight = GetDeviceCaps(screenDc, DESKTOPVERTRES); + float ScreenScalingFactor = (float)PhysicalScreenHeight / (float)LogicalScreenHeight; + ReleaseDC(IntPtr.Zero, screenDc); + + int dia = Math.Max((int)(widt.X * ScreenScalingFactor), 2); + g.FillEllipse(cbrush, 64 - dia / 2, 64 - dia / 2, dia, dia); + if (dia <= 5) + { + Pen cpen = new Pen(Color.FromArgb(50, 128, 128, 128), 2); + dia += 6; g.DrawEllipse(cpen, 64 - dia / 2, 64 - dia / 2, dia, dia); - } + } IC.Cursor = new System.Windows.Forms.Cursor(bitmaptip.GetHicon()); System.Windows.Forms.Cursor.Position = new Point(System.Windows.Forms.Cursor.Position.X, System.Windows.Forms.Cursor.Position.Y); } short LastESCStatus = 0; int ZoomX = -1; - int ZoomY = -1; + int ZoomY = -1; void RecomputeZoomPos(int ZoomX, int ZoomY, ref int ZoomFormRePosX, ref int ZoomFormRePosY) - { int d0, d1; + { + int d0, d1; Point p = new Point(ZoomX, ZoomY); Screen scr = Screen.FromPoint(p); - if(ZoomX < (scr.Bounds.Left + scr.Bounds.Right) / 2) + if (ZoomX < (scr.Bounds.Left + scr.Bounds.Right) / 2) { - d0 = ZoomX + ZoomFormRePosX-scr.Bounds.Left; + d0 = ZoomX + ZoomFormRePosX - scr.Bounds.Left; d1 = d0 + ZoomForm.Width; } else @@ -2848,10 +2852,10 @@ void RecomputeZoomPos(int ZoomX, int ZoomY, ref int ZoomFormRePosX, ref int Zoom d0 = ZoomX + ZoomFormRePosX - scr.Bounds.Right; d1 = d0 + ZoomForm.Width; } - if(Math.Sign(d0*d1)<0) + if (Math.Sign(d0 * d1) < 0) { if (ZoomFormRePosX > 0) - ZoomFormRePosX = - ZoomImage.Width / 2 - ZoomForm.Width; + ZoomFormRePosX = -ZoomImage.Width / 2 - ZoomForm.Width; else ZoomFormRePosX = ZoomImage.Width / 2; } @@ -2882,19 +2886,19 @@ private bool KeyCodeState(SnapInPointerKeys k) return true; else if (k == SnapInPointerKeys.Shift) return (GetAsyncKeyState(VK_SHIFT) & 0x8000) != 0; - else if (k == SnapInPointerKeys.Control) + else if (k == SnapInPointerKeys.Control) return (GetAsyncKeyState(VK_CONTROL) & 0x8000) != 0; - else if (k == SnapInPointerKeys.Alt) + else if (k == SnapInPointerKeys.Alt) return (GetAsyncKeyState(VK_MENU) & 0x8000) != 0; - else - return false; + else + return false; } private void tiSlide_Tick(object sender, EventArgs e) { Initializing = false; - if (ZoomForm.Visible && (Root.ZoomContinous||MousePosition.X != ZoomX || MousePosition.Y != ZoomY)) + if (ZoomForm.Visible && (Root.ZoomContinous || MousePosition.X != ZoomX || MousePosition.Y != ZoomY)) { ZoomX = MousePosition.X; ZoomY = MousePosition.Y; @@ -2902,7 +2906,7 @@ private void tiSlide_Tick(object sender, EventArgs e) ZoomForm.Top = MousePosition.Y + ZoomFormRePosY; ZoomForm.Left = MousePosition.X + ZoomFormRePosX; - Bitmap img; + Bitmap img; img = (ZoomForm.pictureBox1.Visible) ? ZoomImage2 : ZoomImage; using (Graphics g = Graphics.FromImage(img)) @@ -2910,7 +2914,7 @@ private void tiSlide_Tick(object sender, EventArgs e) Point p = new Point(MousePosition.X - ZoomImage.Width / 2, MousePosition.Y - ZoomImage.Height / 2); Size sz = new Size(ZoomImage.Width, ZoomImage.Height); g.CopyFromScreen(p, Point.Empty, sz); - if(ZoomForm.pictureBox1.Visible) + if (ZoomForm.pictureBox1.Visible) { ZoomForm.pictureBox1.Visible = false; ZoomForm.pictureBox2.Visible = true; @@ -2925,7 +2929,7 @@ private void tiSlide_Tick(object sender, EventArgs e) //ZoomForm.Refresh(); } } - if (Root.FFmpegProcess!=null && Root.FFmpegProcess.HasExited) + if (Root.FFmpegProcess != null && Root.FFmpegProcess.HasExited) { Root.VideoRecInProgress = VideoRecInProgress.Stopped; btVideo.BackgroundImage = getImgFromDiskOrRes("VidStop", ImageExts); @@ -2943,15 +2947,15 @@ private void tiSlide_Tick(object sender, EventArgs e) return; } - for(int i=IC.Ink.Strokes.Count-1; i>=0;i--) + for (int i = IC.Ink.Strokes.Count - 1; i >= 0; i--) { Stroke st = IC.Ink.Strokes[i]; if (st.ExtendedProperties.Contains(Root.FADING_PEN)) { - Int64 j = (Int64)(st.ExtendedProperties[Root.FADING_PEN].Data); - if(DateTime.Now.Ticks>j) + long j = (long)(st.ExtendedProperties[Root.FADING_PEN].Data); + if (DateTime.Now.Ticks > j) { - if(st.DrawingAttributes.Transparency == 255) + if (st.DrawingAttributes.Transparency == 255) { //IC.Ink.Strokes.RemoveAt(i); IC.Ink.DeleteStroke(IC.Ink.Strokes[i]); @@ -2965,19 +2969,19 @@ private void tiSlide_Tick(object sender, EventArgs e) } } - Size AimedSize = new Size(gpButtonsWidth,gpButtonsHeight); + Size AimedSize = new Size(gpButtonsWidth, gpButtonsHeight); Point AimedPos = new Point(gpButtonsLeft, gpButtonsTop); if (ButtonsEntering == 0) // do nothing { AimedPos.X = gpButtons.Left; // stay at current location AimedPos.Y = gpButtons.Top; // stay at current location - AimedSize.Width = VisibleToolbar.Width; + AimedSize.Width = VisibleToolbar.Width; AimedSize.Height = VisibleToolbar.Height; } else if (ButtonsEntering == -9) // Full Folding is requested { - switch(Root.ToolbarOrientation) - { + switch (Root.ToolbarOrientation) + { case Orientation.toLeft: AimedPos.X = gpButtonsLeft + gpButtonsWidth; AimedSize.Width = 0; @@ -2987,7 +2991,7 @@ private void tiSlide_Tick(object sender, EventArgs e) AimedSize.Width = 0; break; case Orientation.toUp: - AimedPos.Y = gpButtonsTop+gpButtonsHeight ; + AimedPos.Y = gpButtonsTop + gpButtonsHeight; AimedSize.Height = 0; break; case Orientation.toDown: @@ -3002,7 +3006,7 @@ private void tiSlide_Tick(object sender, EventArgs e) if (Root.Snapping > 0) // if folding for snapping, final should be fully closed d = Math.Max(gpButtonsWidth, gpButtonsHeight) - 0; else if (Root.Docked) // else final position should show only dock button - d = Math.Max(gpButtonsWidth,gpButtonsHeight) - Math.Min(btDock.Width, btDock.Height); + d = Math.Max(gpButtonsWidth, gpButtonsHeight) - Math.Min(btDock.Width, btDock.Height); else // folding with undock is meaningless as security we consider unfolded position for security d = 0; switch (Root.ToolbarOrientation) @@ -3036,7 +3040,7 @@ private void tiSlide_Tick(object sender, EventArgs e) { case Orientation.toLeft: AimedPos.X = gpButtonsLeft + d; - AimedSize.Width = Root.Docked? btDock.Width: gpButtonsWidth; + AimedSize.Width = Root.Docked ? btDock.Width : gpButtonsWidth; break; case Orientation.toRight: AimedPos.X = gpButtonsLeft; @@ -3062,7 +3066,7 @@ private void tiSlide_Tick(object sender, EventArgs e) { int d; d = (int)(.5 * (AimedPos.X - gpButtons.Left)); - if (Math.Abs(d) < (5*.5)) + if (Math.Abs(d) < (5 * .5)) gpButtons.Left = AimedPos.X; else gpButtons.Left += d; @@ -3094,7 +3098,7 @@ private void tiSlide_Tick(object sender, EventArgs e) Root.UponButtonsUpdate |= 0x1; Root.UponButtonsUpdate |= 0x4; } - else if (ButtonsEntering == -9 ) // and Left=X&&Top==Y + else if (ButtonsEntering == -9) // and Left=X&&Top==Y { tiSlide.Enabled = false; Root.StopInk(); @@ -3109,11 +3113,11 @@ private void tiSlide_Tick(object sender, EventArgs e) else if (ButtonsEntering != 0) { // add a background if required at opening but not when snapping is in progress - if ((Root.Snapping == 0)&&(IC.Ink.Strokes.Count == 0)) + if ((Root.Snapping == 0) && (IC.Ink.Strokes.Count == 0)) { if ((Root.BoardAtOpening == 1) || (Root.BoardAtOpening == 4 && Root.BoardSelected == 1)) // White AddBackGround(255, 255, 255, 255); - else if ((Root.BoardAtOpening == 2) || (Root.BoardAtOpening == 4 && Root.BoardSelected == 2)) // Customed + else if ((Root.BoardAtOpening == 2) || (Root.BoardAtOpening == 4 && Root.BoardSelected == 2)) // Customed AddBackGround(Root.Gray1[0], Root.Gray1[1], Root.Gray1[2], Root.Gray1[3]); else if ((Root.BoardAtOpening == 3) || (Root.BoardAtOpening == 4 && Root.BoardSelected == 3)) // Black AddBackGround(255, 0, 0, 0); @@ -3130,19 +3134,19 @@ private void tiSlide_Tick(object sender, EventArgs e) if (!Root.PointerMode && !this.TopMost) - ToTopMost(); + ToTopMost(); - // gpPenWidth status + // gpPenWidth status - if (Root.gpPenWidthVisible != gpPenWidth.Visible) - gpPenWidth.Visible = Root.gpPenWidthVisible; + if (Root.gpPenWidthVisible != gpPenWidth.Visible) + gpPenWidth.Visible = Root.gpPenWidthVisible; - bool pressed; + bool pressed; - if (!Root.PointerMode) - { - // ESC key : Exit - short retVal; + if (!Root.PointerMode) + { + // ESC key : Exit + short retVal; if (Root.Hotkey_Close.Key != 0) { retVal = GetKeyState(Root.Hotkey_Close.Key); @@ -3151,15 +3155,15 @@ private void tiSlide_Tick(object sender, EventArgs e) if (Root.Snapping > 0) { ExitSnapping(); - } - else if (Root.gpPenWidthVisible) - { - Root.gpPenWidthVisible = false; - Root.UponSubPanelUpdate = true; - } - else if (Root.Snapping == 0) - RetreatAndExit(); - } + } + else if (Root.gpPenWidthVisible) + { + Root.gpPenWidthVisible = false; + Root.UponSubPanelUpdate = true; + } + else if (Root.Snapping == 0) + RetreatAndExit(); + } LastESCStatus = retVal; TextEdited = false; } @@ -3190,7 +3194,7 @@ private void tiSlide_Tick(object sender, EventArgs e) switch (SnappingPointerStep) { case 0: - if(KeyCodeState(Root.SnapInPointerHoldKey)) + if (KeyCodeState(Root.SnapInPointerHoldKey)) SnappingPointerStep += 1; break; case 1: // awaiting first press @@ -3199,7 +3203,7 @@ private void tiSlide_Tick(object sender, EventArgs e) if (KeyCodeState(Root.SnapInPointerPressTwiceKey)) SnappingPointerStep += 1; // else wait for next key or should check for other keys - } + } else SnappingPointerStep = 0; break; @@ -3253,18 +3257,18 @@ private void tiSlide_Tick(object sender, EventArgs e) } } else - SnappingPointerStep=0; + SnappingPointerStep = 0; - if ((Root.PointerMode||(!Root.FormDisplay.HasFocus() && !Root.AllowHotkeyInPointerMode)) || Root.Snapping > 0) + if ((Root.PointerMode || (!Root.FormDisplay.HasFocus() && !Root.AllowHotkeyInPointerMode)) || Root.Snapping > 0) { return; } //Console.WriteLine("process Keys"); //if (!AltKeyPressed() && !Root.PointerMode)//&& (SavedPen>=0 || SavedTool>=0)) - if (!AltKeyPressed()) + if (!AltKeyPressed()) { if (SavedPen >= 0) { @@ -3316,19 +3320,19 @@ private void tiSlide_Tick(object sender, EventArgs e) bool shift = ((short)(GetKeyState(VK_LSHIFT) | GetKeyState(VK_RSHIFT)) & 0x8000) == 0x8000; bool win = ((short)(GetKeyState(VK_LWIN) | GetKeyState(VK_RWIN)) & 0x8000) == 0x8000; - if(Root.Hotkey_Pens[0].ConflictWith(Root.Hotkey_Pens[1] )) + if (Root.Hotkey_Pens[0].ConflictWith(Root.Hotkey_Pens[1])) { // same hotkey for pen 0 and pen 1 : we have to rotate through pens pressed = (GetKeyState(Root.Hotkey_Pens[0].Key) & 0x8000) == 0x8000; if (pressed && !LastPenStatus[0] && Root.Hotkey_Pens[0].ModifierMatch(control, alt, shift, win)) { - int p = LastPenSelected+1; + int p = LastPenSelected + 1; if (p >= Root.MaxPenCount) p = 0; while (!Root.PenEnabled[p]) { p += 1; if (p >= Root.MaxPenCount) - p= 0; + p = 0; } SelectPen(p); } @@ -3339,9 +3343,9 @@ private void tiSlide_Tick(object sender, EventArgs e) for (int p = 0; p < Root.MaxPenCount; p++) { pressed = (GetKeyState(Root.Hotkey_Pens[p].Key) & 0x8000) == 0x8000; - if (pressed && !LastPenStatus[p] && Root.Hotkey_Pens[p].ModifierMatch(control, alt, shift, win)) - { - SelectPen(p); + if (pressed && !LastPenStatus[p] && Root.Hotkey_Pens[p].ModifierMatch(control, alt, shift, win)) + { + SelectPen(p); } LastPenStatus[p] = pressed; } @@ -3349,36 +3353,36 @@ private void tiSlide_Tick(object sender, EventArgs e) pressed = (GetKeyState(Root.Hotkey_Eraser.Key) & 0x8000) == 0x8000; if (pressed && !LastEraserStatus && Root.Hotkey_Eraser.ModifierMatch(control, alt, shift, win)) - { - SelectPen(-1); - } - LastEraserStatus = pressed; + { + SelectPen(-1); + } + LastEraserStatus = pressed; - pressed = (GetKeyState(Root.Hotkey_InkVisible.Key) & 0x8000) == 0x8000; - if (pressed && !LastVisibleStatus && Root.Hotkey_InkVisible.ModifierMatch(control, alt, shift, win)) - { - btInkVisible_Click(null, null); - } - LastVisibleStatus = pressed; + pressed = (GetKeyState(Root.Hotkey_InkVisible.Key) & 0x8000) == 0x8000; + if (pressed && !LastVisibleStatus && Root.Hotkey_InkVisible.ModifierMatch(control, alt, shift, win)) + { + btInkVisible_Click(null, null); + } + LastVisibleStatus = pressed; - pressed = (GetKeyState(Root.Hotkey_Undo.Key) & 0x8000) == 0x8000; - if (pressed && !LastUndoStatus && Root.Hotkey_Undo.ModifierMatch(control, alt, shift, win)) - { - if (!Root.InkVisible) - Root.SetInkVisible(true); + pressed = (GetKeyState(Root.Hotkey_Undo.Key) & 0x8000) == 0x8000; + if (pressed && !LastUndoStatus && Root.Hotkey_Undo.ModifierMatch(control, alt, shift, win)) + { + if (!Root.InkVisible) + Root.SetInkVisible(true); - Root.UndoInk(); - } - LastUndoStatus = pressed; + Root.UndoInk(); + } + LastUndoStatus = pressed; - pressed = (GetKeyState(Root.Hotkey_Redo.Key) & 0x8000) == 0x8000; - if (pressed && !LastRedoStatus && Root.Hotkey_Redo.ModifierMatch(control, alt, shift, win)) - { - Root.RedoInk(); - } - LastRedoStatus = pressed; + pressed = (GetKeyState(Root.Hotkey_Redo.Key) & 0x8000) == 0x8000; + if (pressed && !LastRedoStatus && Root.Hotkey_Redo.ModifierMatch(control, alt, shift, win)) + { + Root.RedoInk(); + } + LastRedoStatus = pressed; - pressed = (GetKeyState(Root.Hotkey_Pointer.Key) & 0x8000) == 0x8000; + pressed = (GetKeyState(Root.Hotkey_Pointer.Key) & 0x8000) == 0x8000; if (pressed && !LastPointerStatus && Root.Hotkey_Pointer.ModifierMatch(control, alt, shift, win)) { //SelectPen(-2); @@ -3390,12 +3394,12 @@ private void tiSlide_Tick(object sender, EventArgs e) } LastPointerStatus = pressed; - pressed = (GetKeyState(Root.Hotkey_Pan.Key) & 0x8000) == 0x8000; - if (pressed && !LastPanStatus && Root.Hotkey_Pan.ModifierMatch(control, alt, shift, win)) - { + pressed = (GetKeyState(Root.Hotkey_Pan.Key) & 0x8000) == 0x8000; + if (pressed && !LastPanStatus && Root.Hotkey_Pan.ModifierMatch(control, alt, shift, win)) + { btPan_Click(null, null);//SelectPen(-3); } - LastPanStatus = pressed; + LastPanStatus = pressed; pressed = (GetKeyState(Root.Hotkey_Clear.Key) & 0x8000) == 0x8000; if (pressed && !LastClearStatus && Root.Hotkey_Clear.ModifierMatch(control, alt, shift, win)) @@ -3554,47 +3558,47 @@ private bool IsInsideVisibleScreen(int x, int y) if (Root.WindowRect.Width > 0 && Root.WindowRect.Height > 0) { return ClientRectangle.Contains(x, y); - } + } x -= PrimaryLeft; y -= PrimaryTop; //foreach (Screen s in Screen.AllScreens) - // Console.WriteLine(s.Bounds); - //Console.WriteLine(x.ToString() + ", " + y.ToString()); - - foreach (Screen s in Screen.AllScreens) - if (s.Bounds.Contains(x, y)) - return true; - return false; - } - - int IsMovingToolbar = 0; - Point HitMovingToolbareXY = new Point(); - bool ToolbarMoved = false; - private void gpButtons_MouseDown(object sender, MouseEventArgs e) - { - if (!Root.AllowDraggingToolbar) - return; - if (ButtonsEntering != 0) - return; - - ToolbarMoved = false; - IsMovingToolbar = 1; - HitMovingToolbareXY.X = e.X; - HitMovingToolbareXY.Y = e.Y; - } - - private void gpButtons_MouseMove(object sender, MouseEventArgs e) - { - if (IsMovingToolbar == 1) - { - if (Math.Abs(e.X - HitMovingToolbareXY.X) > 20 || Math.Abs(e.Y - HitMovingToolbareXY.Y) > 20) - IsMovingToolbar = 2; - } - if (IsMovingToolbar == 2) - { - if (e.X != HitMovingToolbareXY.X || e.Y != HitMovingToolbareXY.Y) - { - /* + // Console.WriteLine(s.Bounds); + //Console.WriteLine(x.ToString() + ", " + y.ToString()); + + foreach (Screen s in Screen.AllScreens) + if (s.Bounds.Contains(x, y)) + return true; + return false; + } + + int IsMovingToolbar = 0; + Point HitMovingToolbareXY = new Point(); + bool ToolbarMoved = false; + private void gpButtons_MouseDown(object sender, MouseEventArgs e) + { + if (!Root.AllowDraggingToolbar) + return; + if (ButtonsEntering != 0) + return; + + ToolbarMoved = false; + IsMovingToolbar = 1; + HitMovingToolbareXY.X = e.X; + HitMovingToolbareXY.Y = e.Y; + } + + private void gpButtons_MouseMove(object sender, MouseEventArgs e) + { + if (IsMovingToolbar == 1) + { + if (Math.Abs(e.X - HitMovingToolbareXY.X) > 20 || Math.Abs(e.Y - HitMovingToolbareXY.Y) > 20) + IsMovingToolbar = 2; + } + if (IsMovingToolbar == 2) + { + if (e.X != HitMovingToolbareXY.X || e.Y != HitMovingToolbareXY.Y) + { + /* gpButtonsLeft += e.X - HitMovingToolbareXY.X; gpButtonsTop += e.Y - HitMovingToolbareXY.Y; @@ -3607,87 +3611,87 @@ private void gpButtons_MouseMove(object sender, MouseEventArgs e) if (gpButtonsTop < SystemInformation.VirtualScreen.Top) gpButtonsTop = SystemInformation.VirtualScreen.Top; */ - int newleft = gpButtonsLeft + e.X - HitMovingToolbareXY.X; - int newtop = gpButtonsTop + e.Y - HitMovingToolbareXY.Y; - - bool continuemoving; - bool toolbarmovedthisframe = false; - int dleft = 0, dtop = 0; - if - ( - IsInsideVisibleScreen(newleft, newtop) && - IsInsideVisibleScreen(newleft + gpButtonsWidth, newtop) && - IsInsideVisibleScreen(newleft, newtop + gpButtonsHeight) && - IsInsideVisibleScreen(newleft + gpButtonsWidth, newtop + gpButtonsHeight) - ) - { - continuemoving = true; - ToolbarMoved = true; - toolbarmovedthisframe = true; - dleft = newleft - gpButtonsLeft; - dtop = newtop - gpButtonsTop; - } - else - { - do - { - if (dleft != newleft - gpButtonsLeft) - dleft += Math.Sign(newleft - gpButtonsLeft); - else - break; - if - ( - IsInsideVisibleScreen(gpButtonsLeft + dleft, gpButtonsTop + dtop) && - IsInsideVisibleScreen(gpButtonsLeft + gpButtonsWidth + dleft, gpButtonsTop + dtop) && - IsInsideVisibleScreen(gpButtonsLeft + dleft, gpButtonsTop + gpButtonsHeight + dtop) && - IsInsideVisibleScreen(gpButtonsLeft + gpButtonsWidth + dleft, gpButtonsTop + gpButtonsHeight + dtop) - ) - { - continuemoving = true; - ToolbarMoved = true; - toolbarmovedthisframe = true; - } - else - { - continuemoving = false; - dleft -= Math.Sign(newleft - gpButtonsLeft); - } - } - while (continuemoving); - do - { - if (dtop != newtop - gpButtonsTop) - dtop += Math.Sign(newtop - gpButtonsTop); - else - break; - if - ( - IsInsideVisibleScreen(gpButtonsLeft + dleft, gpButtonsTop + dtop) && - IsInsideVisibleScreen(gpButtonsLeft + gpButtonsWidth + dleft, gpButtonsTop + dtop) && - IsInsideVisibleScreen(gpButtonsLeft + dleft, gpButtonsTop + gpButtonsHeight + dtop) && - IsInsideVisibleScreen(gpButtonsLeft + gpButtonsWidth + dleft, gpButtonsTop + gpButtonsHeight + dtop) - ) - { - continuemoving = true; - ToolbarMoved = true; - toolbarmovedthisframe = true; - } - else - { - continuemoving = false; - dtop -= Math.Sign(newtop - gpButtonsTop); - } - } - while (continuemoving); - } - - if (toolbarmovedthisframe) - { - gpButtonsLeft += dleft; - gpButtonsTop += dtop; - Root.gpButtonsLeft = gpButtonsLeft; - Root.gpButtonsTop = gpButtonsTop; - if (Root.Docked) + int newleft = gpButtonsLeft + e.X - HitMovingToolbareXY.X; + int newtop = gpButtonsTop + e.Y - HitMovingToolbareXY.Y; + + bool continuemoving; + bool toolbarmovedthisframe = false; + int dleft = 0, dtop = 0; + if + ( + IsInsideVisibleScreen(newleft, newtop) && + IsInsideVisibleScreen(newleft + gpButtonsWidth, newtop) && + IsInsideVisibleScreen(newleft, newtop + gpButtonsHeight) && + IsInsideVisibleScreen(newleft + gpButtonsWidth, newtop + gpButtonsHeight) + ) + { + continuemoving = true; + ToolbarMoved = true; + toolbarmovedthisframe = true; + dleft = newleft - gpButtonsLeft; + dtop = newtop - gpButtonsTop; + } + else + { + do + { + if (dleft != newleft - gpButtonsLeft) + dleft += Math.Sign(newleft - gpButtonsLeft); + else + break; + if + ( + IsInsideVisibleScreen(gpButtonsLeft + dleft, gpButtonsTop + dtop) && + IsInsideVisibleScreen(gpButtonsLeft + gpButtonsWidth + dleft, gpButtonsTop + dtop) && + IsInsideVisibleScreen(gpButtonsLeft + dleft, gpButtonsTop + gpButtonsHeight + dtop) && + IsInsideVisibleScreen(gpButtonsLeft + gpButtonsWidth + dleft, gpButtonsTop + gpButtonsHeight + dtop) + ) + { + continuemoving = true; + ToolbarMoved = true; + toolbarmovedthisframe = true; + } + else + { + continuemoving = false; + dleft -= Math.Sign(newleft - gpButtonsLeft); + } + } + while (continuemoving); + do + { + if (dtop != newtop - gpButtonsTop) + dtop += Math.Sign(newtop - gpButtonsTop); + else + break; + if + ( + IsInsideVisibleScreen(gpButtonsLeft + dleft, gpButtonsTop + dtop) && + IsInsideVisibleScreen(gpButtonsLeft + gpButtonsWidth + dleft, gpButtonsTop + dtop) && + IsInsideVisibleScreen(gpButtonsLeft + dleft, gpButtonsTop + gpButtonsHeight + dtop) && + IsInsideVisibleScreen(gpButtonsLeft + gpButtonsWidth + dleft, gpButtonsTop + gpButtonsHeight + dtop) + ) + { + continuemoving = true; + ToolbarMoved = true; + toolbarmovedthisframe = true; + } + else + { + continuemoving = false; + dtop -= Math.Sign(newtop - gpButtonsTop); + } + } + while (continuemoving); + } + + if (toolbarmovedthisframe) + { + gpButtonsLeft += dleft; + gpButtonsTop += dtop; + Root.gpButtonsLeft = gpButtonsLeft; + Root.gpButtonsTop = gpButtonsTop; + if (Root.Docked) gpButtons.Left = gpButtonsLeft + gpButtonsWidth - btDock.Right; else gpButtons.Left = gpButtonsLeft; @@ -3695,29 +3699,29 @@ private void gpButtons_MouseMove(object sender, MouseEventArgs e) gpButtons.Top = gpButtonsTop; Root.UponAllDrawingUpdate = true; } - } - } - } - - private void gpButtons_MouseUp(object sender, MouseEventArgs e) - { - IsMovingToolbar = 0; - } - - private void btInkVisible_Click(object sender, EventArgs e) - { - if (ToolbarMoved) - { - ToolbarMoved = false; - return; - } - PolyLineLastX = Int32.MinValue; PolyLineLastY = Int32.MinValue; PolyLineInProgress = null; + } + } + } + + private void gpButtons_MouseUp(object sender, MouseEventArgs e) + { + IsMovingToolbar = 0; + } + + private void btInkVisible_Click(object sender, EventArgs e) + { + if (ToolbarMoved) + { + ToolbarMoved = false; + return; + } + PolyLineLastX = int.MinValue; PolyLineLastY = int.MinValue; PolyLineInProgress = null; Root.SetInkVisible(!Root.InkVisible); - } + } private Stroke AddBackGround(int A, int B, int C, int D) { - Stroke stk = AddRectStroke(0,0,Width ,Height , Filling.PenColorFilled); + Stroke stk = AddRectStroke(0, 0, Width, Height, Filling.PenColorFilled); stk.DrawingAttributes.Transparency = (byte)(255 - A); stk.DrawingAttributes.Color = Color.FromArgb(A, B, C, D); SaveUndoStrokes(); @@ -3772,7 +3776,7 @@ void CleanBackGround_click(object sender, EventArgs e) AllowInteractions(false); if (rst == DialogResult.Yes) - return Int32.Parse((prompt.Tag as Control).Name); + return int.Parse((prompt.Tag as Control).Name); else return -1; } @@ -3783,21 +3787,21 @@ public void btClear_Click(object sender, EventArgs e) // (sender as Button).RightToLeft = RightToLeft.No; btClear.RightToLeft = RightToLeft.No; longClickTimer.Stop(); // for an unkown reason the mouse arrives later - if (sender is ContextMenu) + if (sender is ContextMenu) { sender = (sender as ContextMenu).SourceControl; MouseTimeDown = DateTime.FromBinary(0); } if (ToolbarMoved) - { - ToolbarMoved = false; - return; - } + { + ToolbarMoved = false; + return; + } TimeSpan tsp = DateTime.Now - MouseTimeDown; - PolyLineLastX = Int32.MinValue; PolyLineLastY = Int32.MinValue; PolyLineInProgress = null; + PolyLineLastX = int.MinValue; PolyLineLastY = int.MinValue; PolyLineInProgress = null; if (sender != null && tsp.TotalSeconds > Root.LongClickTime) - { + { int rst = SelectCleanBackground(); if (rst >= 0) { @@ -3806,7 +3810,7 @@ public void btClear_Click(object sender, EventArgs e) else return; } - //Root.ClearInk(false); <-- code exploded inhere removing clearcanvus + //Root.ClearInk(false); <-- code exploded inhere removing clearcanvus Root.FormCollection.IC.Ink.DeleteStrokes(); if (Root.BoardSelected == 1) // White AddBackGround(255, 255, 255, 255); @@ -3825,18 +3829,18 @@ public void btClear_Click(object sender, EventArgs e) } private void btUndo_Click(object sender, EventArgs e) - { - if (ToolbarMoved) - { - ToolbarMoved = false; - return; - } + { + if (ToolbarMoved) + { + ToolbarMoved = false; + return; + } - if (!Root.InkVisible) - Root.SetInkVisible(true); + if (!Root.InkVisible) + Root.SetInkVisible(true); - Root.UndoInk(); - } + Root.UndoInk(); + } public void btColor_LongClick(object sender) { @@ -3869,7 +3873,7 @@ public void btColor_LongClick(object sender) } public void btColor_Click(object sender, EventArgs e) - { + { longClickTimer.Stop(); if (sender is ContextMenu) { @@ -3877,11 +3881,11 @@ public void btColor_Click(object sender, EventArgs e) MouseTimeDown = DateTime.FromBinary(0); } if (ToolbarMoved) - { - ToolbarMoved = false; - return; - } - PolyLineLastX = Int32.MinValue; PolyLineLastY = Int32.MinValue; PolyLineInProgress = null; + { + ToolbarMoved = false; + return; + } + PolyLineLastX = int.MinValue; PolyLineLastY = int.MinValue; PolyLineInProgress = null; TimeSpan tsp = DateTime.Now - MouseTimeDown; //Console.WriteLine(string.Format("{1},t = {0:N3}", tsp.TotalSeconds,e.ToString())); if (sender != null && tsp.TotalSeconds > Root.LongClickTime) @@ -3896,7 +3900,7 @@ public void btColor_Click(object sender, EventArgs e) SelectTool(0); SelectPen(b); } - } + } private void btVideo_Click(object sender, EventArgs e) { @@ -3912,7 +3916,7 @@ private void btVideo_Click(object sender, EventArgs e) ToolbarMoved = false; return; } - PolyLineLastX = Int32.MinValue; PolyLineLastY = Int32.MinValue; PolyLineInProgress = null; + PolyLineLastX = int.MinValue; PolyLineLastY = int.MinValue; PolyLineInProgress = null; TimeSpan tsp = DateTime.Now - MouseTimeDown; if (Root.VideoRecordMode == VideoRecordMode.NoVideo) // button should be hidden but as security we do the check return; @@ -3980,14 +3984,14 @@ public void VideoRecordStartFFmpeg(Rectangle rect) Root.FFmpegProcess = new Process(); string[] cmdArgs = Root.ExpandVarCmd(Root.FFMpegCmd, rect.X, rect.Y, rect.Width, rect.Height).Split(new char[] { ' ' }, 2); - Console.WriteLine(cmdArgs[0]+" "+cmdArgs[1]); + Console.WriteLine(cmdArgs[0] + " " + cmdArgs[1]); Root.FFmpegProcess.StartInfo.FileName = cmdArgs[0]; Root.FFmpegProcess.StartInfo.Arguments = cmdArgs[1]; Root.FFmpegProcess.StartInfo.UseShellExecute = false; Root.FFmpegProcess.StartInfo.CreateNoWindow = true; - Root.FFmpegProcess.StartInfo.RedirectStandardInput = true; + Root.FFmpegProcess.StartInfo.RedirectStandardInput = true; Root.FFmpegProcess.StartInfo.RedirectStandardOutput = true; Root.FFmpegProcess.StartInfo.WindowStyle = ProcessWindowStyle.Minimized; Root.FFmpegProcess.Start(); @@ -4014,7 +4018,7 @@ string HashEncode(string input) CancellationToken ct = frm.Root.ObsCancel.Token; frm.Root.VideoRecordWindowInProgress = true; if (ct.IsCancellationRequested) - return; + return; if (frm.Root.ObsWs == null) { frm.Root.ObsWs = new ClientWebSocket(); @@ -4186,7 +4190,7 @@ public void SetTagNumber() int k = -1; FormInput inp = new FormInput(Root.Local.DlgTagCaption, Root.Local.DlgTagLabel, "", false, Root, null); - while (!Int32.TryParse(inp.TextOut(), out k)) + while (!int.TryParse(inp.TextOut(), out k)) { inp.TextIn(Root.TagNumbering.ToString()); if (inp.ShowDialog() == DialogResult.Cancel) @@ -4244,7 +4248,7 @@ public void btTool_Click(object sender, EventArgs e) } TimeSpan tsp = DateTime.Now - MouseTimeDown; - if(ClipartsDlg.Visible) + if (ClipartsDlg.Visible) { Console.WriteLine("Close ClipArtDlg"); ClipartsDlg.Close(); @@ -4343,24 +4347,24 @@ public void btTool_Click(object sender, EventArgs e) } public void btEraser_Click(object sender, EventArgs e) - { - if (ToolbarMoved) - { - ToolbarMoved = false; - return; - } - - SelectPen(-1); - } - - - private void btPan_Click(object sender, EventArgs e) - { - if (ToolbarMoved) - { - ToolbarMoved = false; - return; - } + { + if (ToolbarMoved) + { + ToolbarMoved = false; + return; + } + + SelectPen(-1); + } + + + private void btPan_Click(object sender, EventArgs e) + { + if (ToolbarMoved) + { + ToolbarMoved = false; + return; + } if (Root.ToolSelected == Tools.Move) { SelectPen(LastPenSelected); @@ -4375,7 +4379,7 @@ private void btPan_Click(object sender, EventArgs e) SelectPen(LastPenSelected); SelectTool(Tools.Move); } - } + } private void btMagn_Click(object sender, EventArgs e) { @@ -4394,8 +4398,8 @@ private void btMagn_Click(object sender, EventArgs e) short LastF4Status = 0; - public bool ZoomCapturing=false; - public bool ZoomCaptured=false; + public bool ZoomCapturing = false; + public bool ZoomCaptured = false; private void ZoomBtn_Click(object sender, EventArgs e) { if (ToolbarMoved) @@ -4426,7 +4430,7 @@ private void ZoomBtn_Click(object sender, EventArgs e) btZoom.BackgroundImage = getImgFromDiskOrRes("Zoom"); } } - else if ( ZoomCapturing || ZoomCaptured) + else if (ZoomCapturing || ZoomCaptured) { if (ZoomCaptured) { @@ -4441,7 +4445,7 @@ private void ZoomBtn_Click(object sender, EventArgs e) } else { - if((Root.ZoomEnabled & 1)!=0) + if ((Root.ZoomEnabled & 1) != 0) { ZoomForm.Width = (int)(Root.ZoomWidth * Root.ZoomScale); ZoomForm.Height = (int)(Root.ZoomHeight * Root.ZoomScale); @@ -4460,32 +4464,32 @@ private void ZoomBtn_Click(object sender, EventArgs e) private void FormCollection_FormClosing(object sender, FormClosingEventArgs e) { // check if F4 key is pressed and we assume it's Alt+F4 - short retVal = GetKeyState(0x73); - if ((retVal & 0x8000) == 0x8000 && (LastF4Status & 0x8000) == 0x0000) - { - e.Cancel = true; + short retVal = GetKeyState(0x73); + if ((retVal & 0x8000) == 0x8000 && (LastF4Status & 0x8000) == 0x0000) + { + e.Cancel = true; - // the following block is copyed from tiSlide_Tick() where we check whether ESC is pressed - if (Root.Snapping > 0) - { - ExitSnapping(); - Root.VideoRecordWindowInProgress = false; - } - else if (Root.gpPenWidthVisible) - { - Root.gpPenWidthVisible = false; - Root.UponSubPanelUpdate = true; - } - else if (Root.Snapping == 0) - RetreatAndExit(); - } + // the following block is copyed from tiSlide_Tick() where we check whether ESC is pressed + if (Root.Snapping > 0) + { + ExitSnapping(); + Root.VideoRecordWindowInProgress = false; + } + else if (Root.gpPenWidthVisible) + { + Root.gpPenWidthVisible = false; + Root.UponSubPanelUpdate = true; + } + else if (Root.Snapping == 0) + RetreatAndExit(); + } - LastF4Status = retVal; - } + LastF4Status = retVal; + } public void RestorePolylineData(Stroke st) { - if (PolyLineLastX == Int32.MinValue) + if (PolyLineLastX == int.MinValue) return; Point pt = st.GetPoint(st.GetPoints().Length - 1); IC.Renderer.InkSpaceToPixel(Root.FormDisplay.gOneStrokeCanvus, ref pt); @@ -4515,7 +4519,7 @@ public void AllowInteractions(bool enter) } } - public void SaveStrokes(string fn= "ppinkSav.txt") + public void SaveStrokes(string fn = "ppinkSav.txt") { string outp = ""; int l; @@ -4530,18 +4534,18 @@ void writeUtf(string st) } writeUtf("# ppInk Stroke restoration\n"); writeUtf("# gOneStrokeCanvus : "); - writeUtf("# "+Root.FormDisplay.gOneStrokeCanvus.DpiX.ToString()+"; "+ Root.FormDisplay.gOneStrokeCanvus.DpiY.ToString()+"/"+ - Root.FormDisplay.gOneStrokeCanvus.PageScale.ToString()+"-"+ Root.FormDisplay.gOneStrokeCanvus.PageUnit.ToString()+"/"+ - Root.FormDisplay.gOneStrokeCanvus.RenderingOrigin.ToString()+"\n"); + writeUtf("# " + Root.FormDisplay.gOneStrokeCanvus.DpiX.ToString() + "; " + Root.FormDisplay.gOneStrokeCanvus.DpiY.ToString() + "/" + + Root.FormDisplay.gOneStrokeCanvus.PageScale.ToString() + "-" + Root.FormDisplay.gOneStrokeCanvus.PageUnit.ToString() + "/" + + Root.FormDisplay.gOneStrokeCanvus.RenderingOrigin.ToString() + "\n"); Point pt; pt = new Point(0, 0); - IC.Renderer.PixelToInkSpace(Root.FormDisplay.gOneStrokeCanvus,ref pt); + IC.Renderer.PixelToInkSpace(Root.FormDisplay.gOneStrokeCanvus, ref pt); writeUtf("#P2IS 0,0 -> " + pt.ToString() + "\n"); pt = new Point(1920, 1080); IC.Renderer.PixelToInkSpace(Root.FormDisplay.gOneStrokeCanvus, ref pt); writeUtf("#P2IS 1920,1080 -> " + pt.ToString() + "\n"); - + pt = new Point(0, 0); IC.Renderer.InkSpaceToPixel(Root.FormDisplay.gOneStrokeCanvus, ref pt); writeUtf("#IS2P 0,0 -> " + pt.ToString() + "\n"); @@ -4588,8 +4592,8 @@ void writeUtf(string st) outp += p.X + "," + p.Y + ";"; } writeUtf(outp + "\n"); - Rectangle r=st.GetBoundingBox(); - outp = "# boxed in " + r.Location.ToString() + " - " + r.Size.ToString()+"\n"; + Rectangle r = st.GetBoundingBox(); + outp = "# boxed in " + r.Location.ToString() + " - " + r.Size.ToString() + "\n"; writeUtf(outp); da = st.DrawingAttributes; writeUtf("DA = Color [A=255, R=" + da.Color.R.ToString() + ", G=" + da.Color.G.ToString() + ", B=" + da.Color.B.ToString() + "] T=" + da.Transparency + (da.FitToCurve ? ", Fit, W=" : ", NotFit, W=") + da.Width.ToString() + "\n"); @@ -4610,9 +4614,9 @@ public void LoadStrokes(string fn = "ppinkSav.txt") using (StreamReader fileout = new StreamReader(fn, System.Text.Encoding.UTF8)) { int j, l; - Stroke stk=null; + Stroke stk = null; string st; - + st = fileout.ReadLine(); if (!st.StartsWith("# ppInk")) return; @@ -4620,8 +4624,8 @@ public void LoadStrokes(string fn = "ppinkSav.txt") { st = fileout.ReadLine(); } - while (st !=null && st.StartsWith("#")); - while (st !=null && st.StartsWith("ID")) + while (st != null && st.StartsWith("#")); + while (st != null && st.StartsWith("ID")) { do { @@ -4633,9 +4637,9 @@ public void LoadStrokes(string fn = "ppinkSav.txt") j = st.IndexOf("="); l = int.Parse(st.Substring(3, j - 3).Trim()); Point[] pts = new Point[l]; - string[] sts = st.Substring(j+1).TrimStart().Split(';'); + string[] sts = st.Substring(j + 1).TrimStart().Split(';'); - for(int i = 0; i < l; i++) + for (int i = 0; i < l; i++) { string[] st3 = sts[i].Split(','); pts[i].X = int.Parse(st3[0]); @@ -4649,7 +4653,7 @@ public void LoadStrokes(string fn = "ppinkSav.txt") while (st.StartsWith("#")); if (!st.StartsWith("DA")) return; - j = st.IndexOf("R=")+2; + j = st.IndexOf("R=") + 2; l = st.IndexOf(",", j); int R = int.Parse(st.Substring(j, l - j)); j = st.IndexOf("G=") + 2; @@ -4665,30 +4669,30 @@ public void LoadStrokes(string fn = "ppinkSav.txt") stk.DrawingAttributes.FitToCurve = !st.Contains("NotFit"); j = st.IndexOf("W=") + 2; l = st.Length; - stk.DrawingAttributes.Width = Int32.Parse(st.Substring(j, l - j)); + stk.DrawingAttributes.Width = int.Parse(st.Substring(j, l - j)); do { st = fileout.ReadLine(); } while (st.StartsWith("#")); Guid guid; - while(st != "}") + while (st != "}") { j = st.IndexOf('%'); guid = new Guid(st.Substring(0, j)); j++; l = st.IndexOf(':', j); - string st1 = st.Substring(j, l-j); + string st1 = st.Substring(j, l - j); string st2 = st.Substring(l + 1); - object obj=null; - if(st.Contains("Int")) + object obj = null; + if (st.Contains("Int")) obj = int.Parse(st2); else if (st.Contains("Bool")) obj = bool.Parse(st2); else if (st.Contains("Single")) obj = float.Parse(st2); else if (st.Contains("String")) - obj = st2.Replace('\a','\n'); + obj = st2.Replace('\a', '\n'); stk.ExtendedProperties.Add(guid, obj); do { @@ -4701,7 +4705,7 @@ public void LoadStrokes(string fn = "ppinkSav.txt") { st = fileout.ReadLine(); } - while (st!=null && st.StartsWith("#")); + while (st != null && st.StartsWith("#")); } } } @@ -4731,11 +4735,11 @@ private void btLoad_Click(object sender, EventArgs e) AllowInteractions(true); DialogResult rst = openFileDialog.ShowDialog(); AllowInteractions(false); - if ( rst == DialogResult.OK) + if (rst == DialogResult.OK) { SaveStrokeFile = openFileDialog.FileName; - toolTip.SetToolTip(this.btLoad, String.Format(Root.Local.LoadStroke, Path.GetFileName(SaveStrokeFile).Replace(".stroke.txt",""))); - toolTip.SetToolTip(this.btSave, String.Format(Root.Local.SaveStroke, Path.GetFileName(SaveStrokeFile).Replace(".stroke.txt", ""))); + toolTip.SetToolTip(this.btLoad, string.Format(Root.Local.LoadStroke, Path.GetFileName(SaveStrokeFile).Replace(".stroke.txt", ""))); + toolTip.SetToolTip(this.btSave, string.Format(Root.Local.SaveStroke, Path.GetFileName(SaveStrokeFile).Replace(".stroke.txt", ""))); } else return; @@ -4763,7 +4767,7 @@ private void btSave_Click(object sender, EventArgs e) } do { - if ((sender != null && (DateTime.Now - MouseTimeDown).TotalSeconds > Root.LongClickTime)|| SaveStrokeFile == "") + if ((sender != null && (DateTime.Now - MouseTimeDown).TotalSeconds > Root.LongClickTime) || SaveStrokeFile == "") { string sav = SaveStrokeFile; if (SaveStrokeFile == "") @@ -4779,8 +4783,8 @@ private void btSave_Click(object sender, EventArgs e) if (rst == DialogResult.OK) { SaveStrokeFile = FileDialog.FileName; - toolTip.SetToolTip(this.btLoad, String.Format(Root.Local.LoadStroke, Path.GetFileName(SaveStrokeFile).Replace(".stroke.txt", ""))); - toolTip.SetToolTip(this.btSave, String.Format(Root.Local.SaveStroke, Path.GetFileName(SaveStrokeFile).Replace(".stroke.txt", ""))); + toolTip.SetToolTip(this.btLoad, string.Format(Root.Local.LoadStroke, Path.GetFileName(SaveStrokeFile).Replace(".stroke.txt", ""))); + toolTip.SetToolTip(this.btSave, string.Format(Root.Local.SaveStroke, Path.GetFileName(SaveStrokeFile).Replace(".stroke.txt", ""))); } else { @@ -4795,10 +4799,10 @@ private void btSave_Click(object sender, EventArgs e) { SaveStrokes(SaveStrokeFile); } - catch(Exception ex) + catch (Exception ex) { MessageBox.Show(SaveStrokeFile); - string errorMsg = "Silent exception logged \r\n:"+ex.Message + "\r\n\r\nStack Trace:\r\n" + ex.StackTrace + "\r\n\r\n"; + string errorMsg = "Silent exception logged \r\n:" + ex.Message + "\r\n\r\nStack Trace:\r\n" + ex.StackTrace + "\r\n\r\n"; Program.WriteErrorLog(errorMsg); }; } @@ -4807,24 +4811,24 @@ private void btSave_Click(object sender, EventArgs e) [DllImport("user32.dll")] - static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags); - [DllImport("user32.dll", SetLastError = true)] - static extern UInt32 GetWindowLong(IntPtr hWnd, int nIndex); - [DllImport("user32.dll")] - static extern int SetWindowLong(IntPtr hWnd, int nIndex, UInt32 dwNewLong); - [DllImport("user32.dll")] - public extern static bool SetLayeredWindowAttributes(IntPtr hwnd, uint crKey, byte bAlpha, uint dwFlags); - [DllImport("user32.dll", SetLastError = false)] - static extern IntPtr GetDesktopWindow(); - [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)] - private static extern short GetKeyState(int keyCode); - - [DllImport("gdi32.dll")] - static extern int GetDeviceCaps(IntPtr hdc, int nIndex); - [DllImport("user32.dll")] - static extern IntPtr GetDC(IntPtr hWnd); - [DllImport("user32.dll")] - static extern bool ReleaseDC(IntPtr hWnd, IntPtr hDC); + static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags); + [DllImport("user32.dll", SetLastError = true)] + static extern uint GetWindowLong(IntPtr hWnd, int nIndex); + [DllImport("user32.dll")] + static extern int SetWindowLong(IntPtr hWnd, int nIndex, uint dwNewLong); + [DllImport("user32.dll")] + public extern static bool SetLayeredWindowAttributes(IntPtr hwnd, uint crKey, byte bAlpha, uint dwFlags); + [DllImport("user32.dll", SetLastError = false)] + static extern IntPtr GetDesktopWindow(); + [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)] + private static extern short GetKeyState(int keyCode); + + [DllImport("gdi32.dll")] + static extern int GetDeviceCaps(IntPtr hdc, int nIndex); + [DllImport("user32.dll")] + static extern IntPtr GetDC(IntPtr hWnd); + [DllImport("user32.dll")] + static extern bool ReleaseDC(IntPtr hWnd, IntPtr hDC); [DllImport("user32.dll")] static extern bool ShowWindow(int hWnd, int nCmdShow); diff --git a/src/FormDisplay.cs b/src/FormDisplay.cs index 5998ef7d..04c471a3 100644 --- a/src/FormDisplay.cs +++ b/src/FormDisplay.cs @@ -11,58 +11,58 @@ namespace gInk { - public partial class FormDisplay : Form - { - public Root Root; - IntPtr Canvus; - IntPtr canvusDc; - IntPtr OneStrokeCanvus; - IntPtr onestrokeDc; - //IntPtr BlankCanvus; - //IntPtr blankcanvusDc; + public partial class FormDisplay : Form + { + public Root Root; + IntPtr Canvus; + IntPtr canvusDc; + IntPtr OneStrokeCanvus; + IntPtr onestrokeDc; + //IntPtr BlankCanvus; + //IntPtr blankcanvusDc; IntPtr OutCanvus; IntPtr OutcanvusDc; Graphics gCanvus; - public Graphics gOneStrokeCanvus; + public Graphics gOneStrokeCanvus; public Graphics gOutCanvus; //Bitmap ScreenBitmap; IntPtr hScreenBitmap; - IntPtr memscreenDc; + IntPtr memscreenDc; ImageAttributes iaToolBarTransparency = new ImageAttributes(); - Bitmap gpButtonsImage; + Bitmap gpButtonsImage; Bitmap gpPenWidthImage; - SolidBrush TransparentBrush; - SolidBrush SemiTransparentBrush; + SolidBrush TransparentBrush; + SolidBrush SemiTransparentBrush; - byte[] screenbits; - byte[] lastscreenbits; + byte[] screenbits; + byte[] lastscreenbits; - // http://www.csharp411.com/hide-form-from-alttab/ - protected override CreateParams CreateParams - { - get - { - CreateParams cp = base.CreateParams; - // turn on WS_EX_TOOLWINDOW style bit - if (globalRoot.HideInAltTab) + // http://www.csharp411.com/hide-form-from-alttab/ + protected override CreateParams CreateParams + { + get + { + CreateParams cp = base.CreateParams; + // turn on WS_EX_TOOLWINDOW style bit + if (globalRoot.HideInAltTab) cp.ExStyle |= 0x80; - return cp; - } - } + return cp; + } + } - public FormDisplay(Root root) - { + public FormDisplay(Root root) + { Root = root; ColorMatrix cm = new ColorMatrix(); cm.Matrix00 = 1f; cm.Matrix11 = 1f; cm.Matrix22 = 1f; - cm.Matrix33 = Root.ToolbarBGColor[0]/255f; + cm.Matrix33 = Root.ToolbarBGColor[0] / 255f; iaToolBarTransparency.SetColorMatrix(cm); - InitializeComponent(); + InitializeComponent(); - if(Root.WindowRect.Width <= 0 || Root.WindowRect.Height <= 0) + if (Root.WindowRect.Width <= 0 || Root.WindowRect.Height <= 0) { this.Left = SystemInformation.VirtualScreen.Left; this.Top = SystemInformation.VirtualScreen.Top; @@ -79,33 +79,33 @@ public FormDisplay(Root root) Bitmap InitCanvus = new Bitmap(this.Width, this.Height); Bitmap Init2Canvus = new Bitmap(this.Width, this.Height); - Canvus = InitCanvus.GetHbitmap(Color.FromArgb(0)); - OneStrokeCanvus = InitCanvus.GetHbitmap(Color.FromArgb(0)); + Canvus = InitCanvus.GetHbitmap(Color.FromArgb(0)); + OneStrokeCanvus = InitCanvus.GetHbitmap(Color.FromArgb(0)); OutCanvus = Init2Canvus.GetHbitmap(Color.FromArgb(0)); IntPtr screenDc = GetDC(IntPtr.Zero); canvusDc = CreateCompatibleDC(screenDc); - SelectObject(canvusDc, Canvus); - onestrokeDc = CreateCompatibleDC(screenDc); - SelectObject(onestrokeDc, OneStrokeCanvus); + SelectObject(canvusDc, Canvus); + onestrokeDc = CreateCompatibleDC(screenDc); + SelectObject(onestrokeDc, OneStrokeCanvus); OutcanvusDc = CreateCompatibleDC(screenDc); SelectObject(OutcanvusDc, OutCanvus); gCanvus = Graphics.FromHdc(canvusDc); - gCanvus.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver; // source Over else we get some issues displaying text + gCanvus.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver; // source Over else we get some issues displaying text gCanvus.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit; - gOneStrokeCanvus = Graphics.FromHdc(onestrokeDc); - gOneStrokeCanvus.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceCopy; + gOneStrokeCanvus = Graphics.FromHdc(onestrokeDc); + gOneStrokeCanvus.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceCopy; gOutCanvus = Graphics.FromHdc(OutcanvusDc); gOutCanvus.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver; if (Root.AutoScroll) - { - hScreenBitmap = InitCanvus.GetHbitmap(Color.FromArgb(0)); - memscreenDc = CreateCompatibleDC(screenDc); - SelectObject(memscreenDc, hScreenBitmap); - screenbits = new byte[50000000]; - lastscreenbits = new byte[50000000]; - } - ReleaseDC(IntPtr.Zero, screenDc); + { + hScreenBitmap = InitCanvus.GetHbitmap(Color.FromArgb(0)); + memscreenDc = CreateCompatibleDC(screenDc); + SelectObject(memscreenDc, hScreenBitmap); + screenbits = new byte[50000000]; + lastscreenbits = new byte[50000000]; + } + ReleaseDC(IntPtr.Zero, screenDc); /* PPzz : * this is my understandarding about drawing: * gCanvus is the graphics where in standard the strokes are drawn, I've introduced there also the drawing @@ -113,52 +113,52 @@ public FormDisplay(Root root) * I've introduced gOutCanvus in order to have a graphics where I can draw in the inprogress shapes (Line,Ellipsis,Rectangular,Arrow) the previous ones, being strokes, are drawn on gCanvus * the timer1 refresh the window regularly */ - - + + InitCanvus.Dispose(); Init2Canvus.Dispose(); //this.DoubleBuffered = true; int gpheight = (int)(Screen.PrimaryScreen.Bounds.Height * Root.ToolbarHeight); - gpButtonsImage = new Bitmap(2000, 2000, System.Drawing.Imaging.PixelFormat.Format32bppArgb); - gpPenWidthImage = new Bitmap(200, 200, System.Drawing.Imaging.PixelFormat.Format32bppArgb); - TransparentBrush = new SolidBrush(Color.Transparent); - SemiTransparentBrush = new SolidBrush(Color.FromArgb(120, 255, 255, 255)); - - - ToTopMostThrough(); - } - - public void ToTopMostThrough() - { - UInt32 dwExStyle = GetWindowLong(this.Handle, -20); - SetWindowLong(this.Handle, -20, dwExStyle | 0x00080000); - SetWindowPos(this.Handle, (IntPtr)0, 0, 0, 0, 0, 0x0002 | 0x0001 | 0x0004 | 0x0010 | 0x0020); - //SetLayeredWindowAttributes(this.Handle, 0x00FFFFFF, 1, 0x2); - SetWindowLong(this.Handle, -20, dwExStyle | 0x00080000 | 0x00000020); - SetWindowPos(this.Handle, (IntPtr)(-1), 0, 0, 0, 0, 0x0002 | 0x0001 | 0x0010 | 0x0020); - } - - public void ClearCanvus() - { + gpButtonsImage = new Bitmap(2000, 2000, System.Drawing.Imaging.PixelFormat.Format32bppArgb); + gpPenWidthImage = new Bitmap(200, 200, System.Drawing.Imaging.PixelFormat.Format32bppArgb); + TransparentBrush = new SolidBrush(Color.Transparent); + SemiTransparentBrush = new SolidBrush(Color.FromArgb(120, 255, 255, 255)); + + + ToTopMostThrough(); + } + + public void ToTopMostThrough() + { + uint dwExStyle = GetWindowLong(this.Handle, -20); + SetWindowLong(this.Handle, -20, dwExStyle | 0x00080000); + SetWindowPos(this.Handle, (IntPtr)0, 0, 0, 0, 0, 0x0002 | 0x0001 | 0x0004 | 0x0010 | 0x0020); + //SetLayeredWindowAttributes(this.Handle, 0x00FFFFFF, 1, 0x2); + SetWindowLong(this.Handle, -20, dwExStyle | 0x00080000 | 0x00000020); + SetWindowPos(this.Handle, (IntPtr)(-1), 0, 0, 0, 0, 0x0002 | 0x0001 | 0x0010 | 0x0020); + } + + public void ClearCanvus() + { //gCanvus.Clear(Color.Transparent); ClearCanvus(gCanvus); - } + } public void ClearCanvus(Graphics g) - { - g.Clear(Color.Transparent); + { + g.Clear(Color.Transparent); // to draw a border to the area. Only really visible in window mode DrawBorder(HasFocus(), g); } - public void DrawBorder(bool Focus,Graphics g=null) + public void DrawBorder(bool Focus, Graphics g = null) { if (g == null) g = gCanvus; - if((Root.WindowRect.Width> 0)&&(Root.WindowRect.Width > 0)) + if ((Root.WindowRect.Width > 0) && (Root.WindowRect.Width > 0)) { g.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver; g.DrawRectangle(new Pen(Focus ? Color.Red : Color.Black, 1), new Rectangle(0, 0, this.ClientSize.Width - 1, this.ClientSize.Height - 1)); @@ -167,58 +167,58 @@ public void DrawBorder(bool Focus,Graphics g=null) public void DrawSnapping(Rectangle rect) - { - gCanvus.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver; - if (rect.Width > 0 && rect.Height > 0) - { - gCanvus.FillRectangle(SemiTransparentBrush, new Rectangle(0, 0, rect.Left, this.Height)); - gCanvus.FillRectangle(SemiTransparentBrush, new Rectangle(rect.Right, 0, this.Width - rect.Right, this.Height)); - gCanvus.FillRectangle(SemiTransparentBrush, new Rectangle(rect.Left, 0, rect.Width, rect.Top)); - gCanvus.FillRectangle(SemiTransparentBrush, new Rectangle(rect.Left, rect.Bottom, rect.Width, this.Height - rect.Bottom)); - Pen pen = new Pen(Root.ResizeDrawingWindow? Color.FromArgb(200, 255, 0, 0):Color.FromArgb(200, 80, 80, 80)); - pen.Width = 3; - gCanvus.DrawRectangle(pen, rect); - } - else - { - gCanvus.FillRectangle(SemiTransparentBrush, new Rectangle(0, 0, this.Width, this.Height)); - } - gCanvus.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceCopy; - } + { + gCanvus.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver; + if (rect.Width > 0 && rect.Height > 0) + { + gCanvus.FillRectangle(SemiTransparentBrush, new Rectangle(0, 0, rect.Left, this.Height)); + gCanvus.FillRectangle(SemiTransparentBrush, new Rectangle(rect.Right, 0, this.Width - rect.Right, this.Height)); + gCanvus.FillRectangle(SemiTransparentBrush, new Rectangle(rect.Left, 0, rect.Width, rect.Top)); + gCanvus.FillRectangle(SemiTransparentBrush, new Rectangle(rect.Left, rect.Bottom, rect.Width, this.Height - rect.Bottom)); + Pen pen = new Pen(Root.ResizeDrawingWindow ? Color.FromArgb(200, 255, 0, 0) : Color.FromArgb(200, 80, 80, 80)); + pen.Width = 3; + gCanvus.DrawRectangle(pen, rect); + } + else + { + gCanvus.FillRectangle(SemiTransparentBrush, new Rectangle(0, 0, this.Width, this.Height)); + } + gCanvus.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceCopy; + } public void DrawButtons(bool redrawbuttons = true, bool exiting = false) { DrawButtons(gCanvus, redrawbuttons, exiting); } - public void DrawButtons(Graphics g, bool redrawbuttons=true, bool exiting = false) - { - if (Root.AlwaysHideToolbar) - return; - - int top, height, left, width; - int fullwidth; - int gpbl; - int drawwidth; - - top = Root.FormCollection.gpButtons.Top; - height = Root.FormCollection.gpButtons.Height; - left = Root.FormCollection.gpButtons.Left; - width = Root.FormCollection.gpButtons.Width; - fullwidth = Root.FormCollection.gpButtonsWidth; - drawwidth = width; - gpbl = Root.FormCollection.gpButtonsLeft; - if (left + width > gpbl + fullwidth) - drawwidth = gpbl + fullwidth - left; + public void DrawButtons(Graphics g, bool redrawbuttons = true, bool exiting = false) + { + if (Root.AlwaysHideToolbar) + return; + + int top, height, left, width; + int fullwidth; + int gpbl; + int drawwidth; + + top = Root.FormCollection.gpButtons.Top; + height = Root.FormCollection.gpButtons.Height; + left = Root.FormCollection.gpButtons.Left; + width = Root.FormCollection.gpButtons.Width; + fullwidth = Root.FormCollection.gpButtonsWidth; + drawwidth = width; + gpbl = Root.FormCollection.gpButtonsLeft; + if (left + width > gpbl + fullwidth) + drawwidth = gpbl + fullwidth - left; if (redrawbuttons) Root.FormCollection.gpButtons.DrawToBitmap(gpButtonsImage, new Rectangle(0, 0, Root.FormCollection.gpButtonsWidth, Root.FormCollection.gpButtonsHeight)); if (exiting) - { - int clearleft = Math.Max(left - 120, gpbl); - //gCanvus.FillRectangle(TransparentBrush, clearleft, top, fullwidth * 2, height); - g.FillRectangle(TransparentBrush, clearleft, top, drawwidth, height); - } + { + int clearleft = Math.Max(left - 120, gpbl); + //gCanvus.FillRectangle(TransparentBrush, clearleft, top, fullwidth * 2, height); + g.FillRectangle(TransparentBrush, clearleft, top, drawwidth, height); + } g.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceCopy; g.FillRectangle(TransparentBrush, left, top, drawwidth, height); g.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver; @@ -228,37 +228,37 @@ public void DrawButtons(Graphics g, bool redrawbuttons=true, bool exiting = fals g.DrawImage(gpButtonsImage, new Rectangle(left, top, drawwidth, height), 0, 0, drawwidth, height, GraphicsUnit.Pixel, iaToolBarTransparency); else g.DrawImage(gpButtonsImage, new Rectangle(left, top, s.Width, s.Height), - Root.FormCollection.gpButtonsWidth- s.Width, Root.FormCollection.gpButtonsHeight - s.Height, + Root.FormCollection.gpButtonsWidth - s.Width, Root.FormCollection.gpButtonsHeight - s.Height, s.Width, s.Height, GraphicsUnit.Pixel, iaToolBarTransparency); if (Root.gpPenWidthVisible) - { - top = Root.FormCollection.gpPenWidth.Top; - height = Root.FormCollection.gpPenWidth.Height; - left = Root.FormCollection.gpPenWidth.Left; - width = Root.FormCollection.gpPenWidth.Width; - if (redrawbuttons) - Root.FormCollection.gpPenWidth.DrawToBitmap(gpPenWidthImage, new Rectangle(0, 0, width, height)); + { + top = Root.FormCollection.gpPenWidth.Top; + height = Root.FormCollection.gpPenWidth.Height; + left = Root.FormCollection.gpPenWidth.Left; + width = Root.FormCollection.gpPenWidth.Width; + if (redrawbuttons) + Root.FormCollection.gpPenWidth.DrawToBitmap(gpPenWidthImage, new Rectangle(0, 0, width, height)); g.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceCopy; g.FillRectangle(TransparentBrush, left, top, width, height); g.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver; g.DrawImage(gpPenWidthImage, new Rectangle(left, top, width, height), 0, 0, width, height, GraphicsUnit.Pixel, iaToolBarTransparency); - } - } + } + } - public void DrawStrokes() - { + public void DrawStrokes() + { DrawStrokes(gCanvus); - } + } - public void DrawStrokes(Graphics g) - { - if (Root.InkVisible) + public void DrawStrokes(Graphics g) + { + if (Root.InkVisible) { foreach (Stroke st in Root.FormCollection.IC.Ink.Strokes) { - if ((Root.StrokeHovered != null)&&(st.Id == Root.StrokeHovered.Id)) + if ((Root.StrokeHovered != null) && (st.Id == Root.StrokeHovered.Id)) { Rectangle rect = st.GetBoundingBox(); Point pt = rect.Location; @@ -274,7 +274,7 @@ public void DrawStrokes(Graphics g) if (st.ExtendedProperties.Contains(Root.ISHIDDEN_GUID)) continue; //else //Should not be drawn as a stroke : for the moment only filled values. - if(st.ExtendedProperties.Contains(Root.ISFILLEDCOLOR_GUID) || st.ExtendedProperties.Contains(Root.ISFILLEDWHITE_GUID) || st.ExtendedProperties.Contains(Root.ISFILLEDBLACK_GUID) ) + if (st.ExtendedProperties.Contains(Root.ISFILLEDCOLOR_GUID) || st.ExtendedProperties.Contains(Root.ISFILLEDWHITE_GUID) || st.ExtendedProperties.Contains(Root.ISFILLEDBLACK_GUID)) { SolidBrush bru; if (st.ExtendedProperties.Contains(Root.ISFILLEDCOLOR_GUID)) @@ -285,7 +285,7 @@ public void DrawStrokes(Graphics g) bru = new SolidBrush(Color.Black); else continue; - //bru = new SolidBrush(Color.Purple); + //bru = new SolidBrush(Color.Purple); if (st.DrawingAttributes.FitToCurve) { try @@ -348,116 +348,116 @@ public void DrawStrokes(Graphics g) stf.LineAlignment = (System.Drawing.StringAlignment)(st.ExtendedProperties[Root.TEXTVALIGN_GUID].Data); g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit; g.DrawString((string)(st.ExtendedProperties[Root.TEXT_GUID].Data), - new Font((string)st.ExtendedProperties[Root.TEXTFONT_GUID].Data,(float)st.ExtendedProperties[Root.TEXTFONTSIZE_GUID].Data, + new Font((string)st.ExtendedProperties[Root.TEXTFONT_GUID].Data, (float)st.ExtendedProperties[Root.TEXTFONTSIZE_GUID].Data, (System.Drawing.FontStyle)(int)st.ExtendedProperties[Root.TEXTFONTSTYLE_GUID].Data), - new SolidBrush(Color.FromArgb(255-st.DrawingAttributes.Transparency, st.DrawingAttributes.Color)), pt.X, pt.Y, stf); + new SolidBrush(Color.FromArgb(255 - st.DrawingAttributes.Transparency, st.DrawingAttributes.Color)), pt.X, pt.Y, stf); } } } } - public void MoveStrokes(int dy) - { - Point pt1 = new Point(0, 0); - Point pt2 = new Point(0, 100); - Root.FormCollection.IC.Renderer.PixelToInkSpace(gOneStrokeCanvus, ref pt1); - Root.FormCollection.IC.Renderer.PixelToInkSpace(gOneStrokeCanvus, ref pt2); - float unitperpixel = (pt2.Y - pt1.Y) / 100.0f; - float shouldmove = dy * unitperpixel; - foreach (Stroke stroke in Root.FormCollection.IC.Ink.Strokes) - if (!stroke.Deleted) - stroke.Move(0, shouldmove); - } - - protected override void OnPaint(PaintEventArgs e) - { - UpdateFormDisplay(true); - } - - - public uint N1(int i, int j) - { - //return BitConverter.ToUInt32(screenbits, (this.Width * j + i) * 4); - Nlastp1 = (this.Width * j + i) * 4 + 1; - return screenbits[Nlastp1]; - } - public uint N2(int i, int j) - { - //return BitConverter.ToUInt32(screenbits, (this.Width * j + i) * 4); - Nlastp2 = (this.Width * j + i) * 4 + 1; - return screenbits[Nlastp2]; - } - public uint L(int i, int j) - { - //return BitConverter.ToUInt32(lastscreenbits, (this.Width * j + i) * 4); - Llastp = (this.Width * j + i) * 4 + 1; - return lastscreenbits[Llastp]; - } - int Nlastp1, Nlastp2, Llastp; - public uint Nnext1() - { - Nlastp1 += 40; - return screenbits[Nlastp1]; - } - public uint Nnext2() - { - Nlastp2 += 40; - return screenbits[Nlastp2]; - } - public uint Lnext() - { - Llastp += 40; - return lastscreenbits[Llastp]; - } - - public void SnapShot(Rectangle rect,string dest="") - { - string snapbasepath = Root.SnapshotBasePath; - snapbasepath = Environment.ExpandEnvironmentVariables(snapbasepath); - if (Root.SnapshotBasePath == "%USERPROFILE%/Pictures/gInk/") - if (!System.IO.Directory.Exists(snapbasepath)) - System.IO.Directory.CreateDirectory(snapbasepath); - - if (System.IO.Directory.Exists(snapbasepath)) - { - IntPtr screenDc = GetDC(IntPtr.Zero); + public void MoveStrokes(int dy) + { + Point pt1 = new Point(0, 0); + Point pt2 = new Point(0, 100); + Root.FormCollection.IC.Renderer.PixelToInkSpace(gOneStrokeCanvus, ref pt1); + Root.FormCollection.IC.Renderer.PixelToInkSpace(gOneStrokeCanvus, ref pt2); + float unitperpixel = (pt2.Y - pt1.Y) / 100.0f; + float shouldmove = dy * unitperpixel; + foreach (Stroke stroke in Root.FormCollection.IC.Ink.Strokes) + if (!stroke.Deleted) + stroke.Move(0, shouldmove); + } - const int VERTRES = 10; - const int DESKTOPVERTRES = 117; - int LogicalScreenHeight = GetDeviceCaps(screenDc, VERTRES); - int PhysicalScreenHeight = GetDeviceCaps(screenDc, DESKTOPVERTRES); - float ScreenScalingFactor = (float)PhysicalScreenHeight / (float)LogicalScreenHeight; + protected override void OnPaint(PaintEventArgs e) + { + UpdateFormDisplay(true); + } - rect.X = (int)(rect.X * ScreenScalingFactor); - rect.Y = (int)(rect.Y * ScreenScalingFactor); - rect.Width = (int)(rect.Width * ScreenScalingFactor); - rect.Height = (int)(rect.Height * ScreenScalingFactor); + public uint N1(int i, int j) + { + //return BitConverter.ToUInt32(screenbits, (this.Width * j + i) * 4); + Nlastp1 = (this.Width * j + i) * 4 + 1; + return screenbits[Nlastp1]; + } + public uint N2(int i, int j) + { + //return BitConverter.ToUInt32(screenbits, (this.Width * j + i) * 4); + Nlastp2 = (this.Width * j + i) * 4 + 1; + return screenbits[Nlastp2]; + } + public uint L(int i, int j) + { + //return BitConverter.ToUInt32(lastscreenbits, (this.Width * j + i) * 4); + Llastp = (this.Width * j + i) * 4 + 1; + return lastscreenbits[Llastp]; + } + int Nlastp1, Nlastp2, Llastp; + public uint Nnext1() + { + Nlastp1 += 40; + return screenbits[Nlastp1]; + } + public uint Nnext2() + { + Nlastp2 += 40; + return screenbits[Nlastp2]; + } + public uint Lnext() + { + Llastp += 40; + return lastscreenbits[Llastp]; + } - Bitmap tempbmp = new Bitmap(rect.Width, rect.Height); - Graphics g = Graphics.FromImage(tempbmp); - g.Clear(Color.Red); + public void SnapShot(Rectangle rect, string dest = "") + { + string snapbasepath = Root.SnapshotBasePath; + snapbasepath = Environment.ExpandEnvironmentVariables(snapbasepath); + if (Root.SnapshotBasePath == "%USERPROFILE%/Pictures/gInk/") + if (!System.IO.Directory.Exists(snapbasepath)) + System.IO.Directory.CreateDirectory(snapbasepath); - IntPtr hDest = CreateCompatibleDC(screenDc); - IntPtr hBmp = tempbmp.GetHbitmap(); - SelectObject(hDest, hBmp); - bool b = BitBlt(hDest, 0, 0, rect.Width, rect.Height, screenDc, rect.Left, rect.Top, (uint)(CopyPixelOperation.SourceCopy | CopyPixelOperation.CaptureBlt)); - tempbmp = Bitmap.FromHbitmap(hBmp); + if (System.IO.Directory.Exists(snapbasepath)) + { + IntPtr screenDc = GetDC(IntPtr.Zero); - if (!b) - { - g = Graphics.FromImage(tempbmp); - g.Clear(Color.Blue); - g.CopyFromScreen(rect.Left, rect.Top, 0, 0, new Size(rect.Width, rect.Height)); - } + const int VERTRES = 10; + const int DESKTOPVERTRES = 117; + int LogicalScreenHeight = GetDeviceCaps(screenDc, VERTRES); + int PhysicalScreenHeight = GetDeviceCaps(screenDc, DESKTOPVERTRES); + float ScreenScalingFactor = (float)PhysicalScreenHeight / (float)LogicalScreenHeight; + + rect.X = (int)(rect.X * ScreenScalingFactor); + rect.Y = (int)(rect.Y * ScreenScalingFactor); + rect.Width = (int)(rect.Width * ScreenScalingFactor); + rect.Height = (int)(rect.Height * ScreenScalingFactor); + + + Bitmap tempbmp = new Bitmap(rect.Width, rect.Height); + Graphics g = Graphics.FromImage(tempbmp); + g.Clear(Color.Red); + + IntPtr hDest = CreateCompatibleDC(screenDc); + IntPtr hBmp = tempbmp.GetHbitmap(); + SelectObject(hDest, hBmp); + bool b = BitBlt(hDest, 0, 0, rect.Width, rect.Height, screenDc, rect.Left, rect.Top, (uint)(CopyPixelOperation.SourceCopy | CopyPixelOperation.CaptureBlt)); + tempbmp = Bitmap.FromHbitmap(hBmp); + + if (!b) + { + g = Graphics.FromImage(tempbmp); + g.Clear(Color.Blue); + g.CopyFromScreen(rect.Left, rect.Top, 0, 0, new Size(rect.Width, rect.Height)); + } if (dest == "") Clipboard.SetImage(tempbmp); //DateTime now = DateTime.Now; //string nowstr = now.Year.ToString() + "-" + now.Month.ToString("D2") + "-" + now.Day.ToString("D2") + " " + now.Hour.ToString("D2") + "-" + now.Minute.ToString("D2") + "-" + now.Second.ToString("D2"); string savefilename = DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss'.png'"); - Root.SnapshotFileFullPath = snapbasepath + savefilename; + Root.SnapshotFileFullPath = snapbasepath + savefilename; if (dest == "") dest = Root.SnapshotFileFullPath; @@ -465,24 +465,24 @@ public void SnapShot(Rectangle rect,string dest="") dest = Environment.ExpandEnvironmentVariables(dest); tempbmp.Save(dest, System.Drawing.Imaging.ImageFormat.Png); - tempbmp.Dispose(); - DeleteObject(hBmp); - ReleaseDC(IntPtr.Zero, screenDc); - DeleteDC(hDest); + tempbmp.Dispose(); + DeleteObject(hBmp); + ReleaseDC(IntPtr.Zero, screenDc); + DeleteDC(hDest); - // transfered out :Root.UponBalloonSnap = true; - } - } + // transfered out :Root.UponBalloonSnap = true; + } + } public void DrawLineOnGraphic(Graphics g, int CursorX0, int CursorY0, int CursorX, int CursorY) { //gOutCanvus.DrawLine(new Pen(Root.PenAttr[Root.CurrentPen].Color, Root.PenAttr[Root.CurrentPen].Width/ (float)26.45834), // CursorX0, CursorY0 , CursorX, CursorY); - gOutCanvus.DrawLine(new Pen(Color.FromArgb (255- Root.FormCollection.IC.DefaultDrawingAttributes.Transparency,Root.FormCollection.IC.DefaultDrawingAttributes.Color), + gOutCanvus.DrawLine(new Pen(Color.FromArgb(255 - Root.FormCollection.IC.DefaultDrawingAttributes.Transparency, Root.FormCollection.IC.DefaultDrawingAttributes.Color), Root.HiMetricToPixel(Root.FormCollection.IC.DefaultDrawingAttributes.Width)), - CursorX0, CursorY0 , CursorX, CursorY); + CursorX0, CursorY0, CursorX, CursorY); } - public void DrawRectOnGraphic(Graphics g, int CursorX0, int CursorY0, int CursorX, int CursorY,DrawingAttributes dr=null) + public void DrawRectOnGraphic(Graphics g, int CursorX0, int CursorY0, int CursorX, int CursorY, DrawingAttributes dr = null) { int dX = Math.Abs(CursorX - CursorX0); int dY = Math.Abs(CursorY - CursorY0); @@ -490,7 +490,7 @@ public void DrawRectOnGraphic(Graphics g, int CursorX0, int CursorY0, int Cursor dr = Root.FormCollection.IC.DefaultDrawingAttributes; gOutCanvus.DrawRectangle(new Pen(Color.FromArgb(255 - dr.Transparency, dr.Color), Root.HiMetricToPixel(dr.Width)), - Math.Min(CursorX0,CursorX), Math.Min(CursorY0, CursorY), dX, dY); + Math.Min(CursorX0, CursorX), Math.Min(CursorY0, CursorY), dX, dY); } public void DrawEllipseOnGraphic(Graphics g, int CursorX0, int CursorY0, int CursorX, int CursorY) { @@ -509,9 +509,9 @@ public void DrawArrowOnGraphic(Graphics g, int CursorX0, int CursorY0, int Curso Pen p = new Pen(Color.FromArgb(255 - Root.FormCollection.IC.DefaultDrawingAttributes.Transparency, Root.FormCollection.IC.DefaultDrawingAttributes.Color), Root.HiMetricToPixel(Root.FormCollection.IC.DefaultDrawingAttributes.Width)); - gOutCanvus.DrawLine(p,CursorX0, CursorY0, (int)(CursorX0 + Math.Cos(theta + Root.ArrowAngle) * Root.ArrowLen), (int)(CursorY0 + Math.Sin(theta + Root.ArrowAngle) * Root.ArrowLen)); + gOutCanvus.DrawLine(p, CursorX0, CursorY0, (int)(CursorX0 + Math.Cos(theta + Root.ArrowAngle) * Root.ArrowLen), (int)(CursorY0 + Math.Sin(theta + Root.ArrowAngle) * Root.ArrowLen)); gOutCanvus.DrawLine(p, CursorX0, CursorY0, (int)(CursorX0 + Math.Cos(theta - Root.ArrowAngle) * Root.ArrowLen), (int)(CursorY0 + Math.Sin(theta - Root.ArrowAngle) * Root.ArrowLen)); - gOutCanvus.DrawLine(p, CursorX0, CursorY0, CursorX,CursorY); + gOutCanvus.DrawLine(p, CursorX0, CursorY0, CursorX, CursorY); } public void DrawCustomOnGraphic(Graphics g, int CursorX0, int CursorY0, int CursorX, int CursorY) @@ -519,20 +519,20 @@ public void DrawCustomOnGraphic(Graphics g, int CursorX0, int CursorY0, int Curs if ((CursorX0 != int.MinValue) || (CursorY0 != int.MinValue)) { if (Root.FormCollection.ZoomCapturing) - DrawRectOnGraphic(g, CursorX0, CursorY0, CursorX, CursorY,Root.FormCollection.IC.Ink.Strokes[Root.FormCollection.IC.Ink.Strokes.Count-1].DrawingAttributes); - else if((Root.ToolSelected == Tools.Line)|| (Root.ToolSelected == Tools.Poly)) + DrawRectOnGraphic(g, CursorX0, CursorY0, CursorX, CursorY, Root.FormCollection.IC.Ink.Strokes[Root.FormCollection.IC.Ink.Strokes.Count - 1].DrawingAttributes); + else if ((Root.ToolSelected == Tools.Line) || (Root.ToolSelected == Tools.Poly)) DrawLineOnGraphic(g, CursorX0, CursorY0, CursorX, CursorY); - else if ((Root.ToolSelected == Tools.Rect)|| (Root.ToolSelected == Tools.ClipArt)) + else if ((Root.ToolSelected == Tools.Rect) || (Root.ToolSelected == Tools.ClipArt)) if ((Root.FormCollection.CurrentMouseButton == MouseButtons.Right) || ((int)(Root.FormCollection.CurrentMouseButton) == 2)) - DrawRectOnGraphic(g, 2*CursorX0-CursorX, 2*CursorY0-CursorY, CursorX, CursorY); + DrawRectOnGraphic(g, 2 * CursorX0 - CursorX, 2 * CursorY0 - CursorY, CursorX, CursorY); else DrawRectOnGraphic(g, CursorX0, CursorY0, CursorX, CursorY); else if (Root.ToolSelected == Tools.Oval) if ((Root.FormCollection.CurrentMouseButton == MouseButtons.Right) || ((int)(Root.FormCollection.CurrentMouseButton) == 2)) DrawEllipseOnGraphic(g, CursorX0, CursorY0, CursorX, CursorY); else - DrawEllipseOnGraphic(g,(CursorX0+ CursorX)/2,(CursorY0+ CursorY)/2, CursorX, CursorY); - else if ((Root.ToolSelected == Tools.StartArrow)|| (Root.ToolSelected == Tools.EndArrow)) + DrawEllipseOnGraphic(g, (CursorX0 + CursorX) / 2, (CursorY0 + CursorY) / 2, CursorX, CursorY); + else if ((Root.ToolSelected == Tools.StartArrow) || (Root.ToolSelected == Tools.EndArrow)) if ((Root.ToolSelected == Tools.StartArrow) ^ ((Root.FormCollection.CurrentMouseButton == MouseButtons.Right) || ((int)(Root.FormCollection.CurrentMouseButton) == 2))) DrawArrowOnGraphic(g, CursorX0, CursorY0, CursorX, CursorY); else @@ -540,96 +540,96 @@ public void DrawCustomOnGraphic(Graphics g, int CursorX0, int CursorY0, int Curs } } - public int Test() - { - IntPtr screenDc = GetDC(IntPtr.Zero); + public int Test() + { + IntPtr screenDc = GetDC(IntPtr.Zero); - // big time consuming, but not CPU consuming - BitBlt(memscreenDc, Width / 4, 0, Width / 2, this.Height, screenDc, Width / 4, 0, 0x00CC0020); - // <1% CPU - GetBitmapBits(hScreenBitmap, this.Width * this.Height * 4, screenbits); + // big time consuming, but not CPU consuming + BitBlt(memscreenDc, Width / 4, 0, Width / 2, this.Height, screenDc, Width / 4, 0, 0x00CC0020); + // <1% CPU + GetBitmapBits(hScreenBitmap, this.Width * this.Height * 4, screenbits); - int dj; - int maxidpixels = 0; - //float maxidchdrio = 0; - int maxdj = 0; + int dj; + int maxidpixels = 0; + //float maxidchdrio = 0; + int maxdj = 0; - // 25% CPU with 1x10x10 sample rate? - int istart = Width / 2 - Width / 4; - int iend = Width / 2 + Width / 4; - for (dj = -Height * 3 / 8 + 1; dj < Height * 3 / 8 - 1; dj++) - { + // 25% CPU with 1x10x10 sample rate? + int istart = Width / 2 - Width / 4; + int iend = Width / 2 + Width / 4; + for (dj = -Height * 3 / 8 + 1; dj < Height * 3 / 8 - 1; dj++) + { //int chdpixels = 0; int idpixels = 0; - for (int j = Height / 2 - Height / 8; j < Height / 2 + Height / 8; j += 10) - { - L(istart - 10, j); - N1(istart - 10, j); - N2(istart - 10, j + dj); - for (int i = istart; i < iend; i += 10) - { - //uint l = Lnext(); - //uint n1 = Nnext1(); - //uint n2 = Nnext2(); - //if (l != n1) - //{ - // chdpixels++; - // if (l == n2) - // idpixels++; - //} - - - if (Lnext() == Nnext2()) - idpixels++; - } - } + for (int j = Height / 2 - Height / 8; j < Height / 2 + Height / 8; j += 10) + { + L(istart - 10, j); + N1(istart - 10, j); + N2(istart - 10, j + dj); + for (int i = istart; i < iend; i += 10) + { + //uint l = Lnext(); + //uint n1 = Nnext1(); + //uint n2 = Nnext2(); + //if (l != n1) + //{ + // chdpixels++; + // if (l == n2) + // idpixels++; + //} + + + if (Lnext() == Nnext2()) + idpixels++; + } + } - //float idchdrio = (float)idpixels / chdpixels; - if (idpixels > maxidpixels) - //if (idchdrio > maxidchdrio) - { - //maxidchdrio = idchdrio; - maxidpixels = idpixels; - maxdj = dj; - } - } + //float idchdrio = (float)idpixels / chdpixels; + if (idpixels > maxidpixels) + //if (idchdrio > maxidchdrio) + { + //maxidchdrio = idchdrio; + maxidpixels = idpixels; + maxdj = dj; + } + } - //if (maxidchdrio < 0.1 || maxidpixels < 30) - if (maxidpixels < 100) - maxdj = 0; + //if (maxidchdrio < 0.1 || maxidpixels < 30) + if (maxidpixels < 100) + maxdj = 0; - // 2% CPU - IntPtr pscreenbits = Marshal.UnsafeAddrOfPinnedArrayElement(screenbits, (int)(this.Width * this.Height * 4 * 0.375)); - IntPtr plastscreenbits = Marshal.UnsafeAddrOfPinnedArrayElement(lastscreenbits, (int)(this.Width * this.Height * 4 * 0.375)); - memcpy(plastscreenbits, pscreenbits, this.Width * this.Height * 4 / 4); + // 2% CPU + IntPtr pscreenbits = Marshal.UnsafeAddrOfPinnedArrayElement(screenbits, (int)(this.Width * this.Height * 4 * 0.375)); + IntPtr plastscreenbits = Marshal.UnsafeAddrOfPinnedArrayElement(lastscreenbits, (int)(this.Width * this.Height * 4 * 0.375)); + memcpy(plastscreenbits, pscreenbits, this.Width * this.Height * 4 / 4); - ReleaseDC(IntPtr.Zero, screenDc); - return maxdj; - } + ReleaseDC(IntPtr.Zero, screenDc); + return maxdj; + } - public void UpdateFormDisplay(bool draw,bool prepared=false) - { - IntPtr screenDc = GetDC(IntPtr.Zero); - IntPtr blankcanvusDc = new IntPtr(0) ; + public void UpdateFormDisplay(bool draw, bool prepared = false) + { + IntPtr screenDc = GetDC(IntPtr.Zero); + IntPtr blankcanvusDc = new IntPtr(0); //Display-rectangle Size size = new Size(this.Width, this.Height); - Point pointSource = new Point(0, 0); - Point topPos = new Point(this.Left, this.Top); + Point pointSource = new Point(0, 0); + Point topPos = new Point(this.Left, this.Top); - //Set up blending options - BLENDFUNCTION blend = new BLENDFUNCTION(); - blend.BlendOp = AC_SRC_OVER; - blend.BlendFlags = 0; - blend.SourceConstantAlpha = 255; // additional alpha multiplier to the whole image. value 255 means multiply with 1. - blend.AlphaFormat = AC_SRC_ALPHA; + //Set up blending options + BLENDFUNCTION blend = new BLENDFUNCTION(); + blend.BlendOp = AC_SRC_OVER; + blend.BlendFlags = 0; + blend.SourceConstantAlpha = 255; // additional alpha multiplier to the whole image. value 255 means multiply with 1. + blend.AlphaFormat = AC_SRC_ALPHA; //#define SRCCOPY (DWORD)0x00CC0020 /* dest = source */ if (!prepared) { BitBlt(OutcanvusDc, 0, 0, this.Width, this.Height, canvusDc, 0, 0, 0x00CC0020); - if(Root.Snapping<=0) + if (Root.Snapping <= 0) DrawCustomOnGraphic(gOutCanvus, Root.CursorX0, Root.CursorY0, Root.CursorX, Root.CursorY); } @@ -638,20 +638,20 @@ public void UpdateFormDisplay(bool draw,bool prepared=false) else UpdateLayeredWindow(this.Handle, screenDc, ref topPos, ref size, blankcanvusDc, ref pointSource, 0, ref blend, ULW_ALPHA); - //Clean-up - ReleaseDC(IntPtr.Zero, screenDc); + //Clean-up + ReleaseDC(IntPtr.Zero, screenDc); } - int stackmove = 0; - int Tick = 0; + int stackmove = 0; + int Tick = 0; //DateTime TickStartTime; - bool SelectionDrawnPreviously=false; + bool SelectionDrawnPreviously = false; - public void timer1_Tick(object sender, EventArgs e) - { + public void timer1_Tick(object sender, EventArgs e) + { if (Root.FormCollection is null) return; // the initialisation is not yet completed. we wait for - Tick++; + Tick++; /* if (Tick == 1) @@ -663,23 +663,23 @@ public void timer1_Tick(object sender, EventArgs e) } */ - if (Root.UponAllDrawingUpdate) - { + if (Root.UponAllDrawingUpdate) + { ClearCanvus(); - DrawStrokes(); - DrawButtons(true); - if (Root.Snapping > 0) - DrawSnapping(Root.SnappingRect); - UpdateFormDisplay(true); - Root.UponAllDrawingUpdate = false; - } + DrawStrokes(); + DrawButtons(true); + if (Root.Snapping > 0) + DrawSnapping(Root.SnappingRect); + UpdateFormDisplay(true); + Root.UponAllDrawingUpdate = false; + } - else if (Root.UponTakingSnap) + else if (Root.UponTakingSnap) { if (Root.ResizeDrawingWindow) { if ((Root.SnappingRect.Width == SystemInformation.VirtualScreen.Width) && (Root.SnappingRect.Height == SystemInformation.VirtualScreen.Height)) - Root.WindowRect = new Rectangle(Int32.MinValue, Int32.MinValue, -1, -1); + Root.WindowRect = new Rectangle(int.MinValue, int.MinValue, -1, -1); else Root.WindowRect = new Rectangle(Root.SnappingRect.Left, Root.SnappingRect.Top, Root.SnappingRect.Width, Root.SnappingRect.Height); Root.StopInk(); @@ -687,11 +687,11 @@ public void timer1_Tick(object sender, EventArgs e) return; } if (Root.SnappingRect.Width == this.Width && Root.SnappingRect.Height == this.Height) - System.Threading.Thread.Sleep(200); - ClearCanvus(); - DrawStrokes(); - //DrawButtons(false); - UpdateFormDisplay(true); + System.Threading.Thread.Sleep(200); + ClearCanvus(); + DrawStrokes(); + //DrawButtons(false); + UpdateFormDisplay(true); if (Root.VideoRecordWindowInProgress) { Root.FormCollection.VideoRecordStartFFmpeg(Root.SnappingRect); @@ -714,29 +714,29 @@ public void timer1_Tick(object sender, EventArgs e) if ((Root.FormCollection.IC.Ink.Strokes.Count == 0)) Root.FormCollection.RetreatAndExit(); }*/ - } + } - else if (Root.Snapping == 2) - { - if (Root.MouseMovedUnderSnapshotDragging) - { - ClearCanvus(); - DrawStrokes(); - DrawButtons(false); - DrawSnapping(Root.SnappingRect); - UpdateFormDisplay(true); - Root.MouseMovedUnderSnapshotDragging = false; - } - } + else if (Root.Snapping == 2) + { + if (Root.MouseMovedUnderSnapshotDragging) + { + ClearCanvus(); + DrawStrokes(); + DrawButtons(false); + DrawSnapping(Root.SnappingRect); + UpdateFormDisplay(true); + Root.MouseMovedUnderSnapshotDragging = false; + } + } - else if (!(Root.FormCollection is null) && !(Root.FormCollection.IC is null) && Root.FormCollection.IC.CollectingInk && Root.EraserMode == false && Root.InkVisible) - { // Drawing in progress : we get the last stroke in the list, if we have to draw because not deleted and not a shape in progress + else if (!(Root.FormCollection is null) && !(Root.FormCollection.IC is null) && Root.FormCollection.IC.CollectingInk && Root.EraserMode == false && Root.InkVisible) + { // Drawing in progress : we get the last stroke in the list, if we have to draw because not deleted and not a shape in progress //we replace the rectangle containing the stroke by the saved one and - if (Root.FormCollection.IC.Ink.Strokes.Count > 0) - { - Stroke stroke = Root.FormCollection.IC.Ink.Strokes[Root.FormCollection.IC.Ink.Strokes.Count - 1]; - if ((!stroke.Deleted) && (!Root.FormCollection.ZoomCapturing)&&(Root.ToolSelected == Tools.Hand)) + if (Root.FormCollection.IC.Ink.Strokes.Count > 0) + { + Stroke stroke = Root.FormCollection.IC.Ink.Strokes[Root.FormCollection.IC.Ink.Strokes.Count - 1]; + if ((!stroke.Deleted) && (!Root.FormCollection.ZoomCapturing) && (Root.ToolSelected == Tools.Hand)) { BitBlt(OutcanvusDc, 0, 0, this.Width, this.Height, canvusDc, 0, 0, 0x00CC0020); Root.FormCollection.IC.Renderer.Draw(gOutCanvus, stroke, Root.FormCollection.IC.DefaultDrawingAttributes); @@ -745,112 +745,112 @@ public void timer1_Tick(object sender, EventArgs e) } } - else if ((Root.FormCollection.IC.CollectingInk && Root.EraserMode == true) || Root.StrokeHovered != null || SelectionDrawnPreviously) + else if ((Root.FormCollection.IC.CollectingInk && Root.EraserMode == true) || Root.StrokeHovered != null || SelectionDrawnPreviously) { SelectionDrawnPreviously = Root.StrokeHovered != null; // to erase selection at the end ClearCanvus(); - DrawStrokes(); - DrawButtons(false); - UpdateFormDisplay(true); - } + DrawStrokes(); + DrawButtons(false); + UpdateFormDisplay(true); + } - else if (Root.Snapping < -58) - { - ClearCanvus(); - DrawStrokes(); - DrawButtons(false); - UpdateFormDisplay(true); - } + else if (Root.Snapping < -58) + { + ClearCanvus(); + DrawStrokes(); + DrawButtons(false); + UpdateFormDisplay(true); + } - else if (Root.UponButtonsUpdate > 0) - { - if ((Root.UponButtonsUpdate & 0x2) > 0) - DrawButtons(true, (Root.UponButtonsUpdate & 0x4) > 0); - else if ((Root.UponButtonsUpdate & 0x1) > 0) - DrawButtons(false, (Root.UponButtonsUpdate & 0x4) > 0); - UpdateFormDisplay(true); - Root.UponButtonsUpdate = 0; - } + else if (Root.UponButtonsUpdate > 0) + { + if ((Root.UponButtonsUpdate & 0x2) > 0) + DrawButtons(true, (Root.UponButtonsUpdate & 0x4) > 0); + else if ((Root.UponButtonsUpdate & 0x1) > 0) + DrawButtons(false, (Root.UponButtonsUpdate & 0x4) > 0); + UpdateFormDisplay(true); + Root.UponButtonsUpdate = 0; + } - else if (Root.UponSubPanelUpdate) - { - ClearCanvus(); - DrawStrokes(); - DrawButtons(false); - UpdateFormDisplay(true); - Root.UponSubPanelUpdate = false; - } + else if (Root.UponSubPanelUpdate) + { + ClearCanvus(); + DrawStrokes(); + DrawButtons(false); + UpdateFormDisplay(true); + Root.UponSubPanelUpdate = false; + } - if (Root.AutoScroll && Root.PointerMode) - { - int moved = Test(); - stackmove += moved; + if (Root.AutoScroll && Root.PointerMode) + { + int moved = Test(); + stackmove += moved; - if (stackmove != 0 && Tick % 10 == 1) - { - MoveStrokes(stackmove); - ClearCanvus(); - DrawStrokes(); - DrawButtons(false); - UpdateFormDisplay(true); - stackmove = 0; - } - } - } - - private void FormDisplay_FormClosed(object sender, FormClosedEventArgs e) - { - DeleteObject(Canvus); - //DeleteObject(BlankCanvus); - DeleteDC(canvusDc); - if (Root.AutoScroll) - { - DeleteObject(hScreenBitmap); - DeleteDC(memscreenDc); - } - } - - [DllImport("user32.dll")] - static extern IntPtr GetDC(IntPtr hWnd); - [DllImport("user32.dll")] - static extern bool ReleaseDC(IntPtr hWnd, IntPtr hDC); - [DllImport("gdi32.dll", EntryPoint = "DeleteDC")] - public static extern bool DeleteDC([In] IntPtr hdc); - [DllImport("gdi32.dll", EntryPoint = "CreateCompatibleDC", SetLastError = true)] - static extern IntPtr CreateCompatibleDC([In] IntPtr hdc); - [DllImport("gdi32.dll", EntryPoint = "SelectObject")] - public static extern IntPtr SelectObject([In] IntPtr hdc, [In] IntPtr hgdiobj); - [DllImport("gdi32.dll", EntryPoint = "DeleteObject")] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool DeleteObject([In] IntPtr hObject); - [DllImport("user32.dll", ExactSpelling = true, SetLastError = true)] - static extern bool UpdateLayeredWindow(IntPtr hwnd, IntPtr hdcDst, ref Point pptDst, ref Size psize, IntPtr hdcSrc, ref Point pptSrc, uint crKey, [In] ref BLENDFUNCTION pblend, uint dwFlags); - [DllImport("gdi32.dll")] - public static extern bool BitBlt(IntPtr hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hdcSrc, int nXSrc, int nYSrc, uint dwRop); - [DllImport("gdi32.dll")] - public static extern bool StretchBlt(IntPtr hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hdcSrc, int nXSrc, int nYSrc, int nWidthSrc, int nHeightSrc, long dwRop); - - - [StructLayout(LayoutKind.Sequential)] - public struct BLENDFUNCTION - { - public byte BlendOp; - public byte BlendFlags; - public byte SourceConstantAlpha; - public byte AlphaFormat; - - public BLENDFUNCTION(byte op, byte flags, byte alpha, byte format) - { - BlendOp = op; - BlendFlags = flags; - SourceConstantAlpha = alpha; - AlphaFormat = format; - } - } + if (stackmove != 0 && Tick % 10 == 1) + { + MoveStrokes(stackmove); + ClearCanvus(); + DrawStrokes(); + DrawButtons(false); + UpdateFormDisplay(true); + stackmove = 0; + } + } + } + + private void FormDisplay_FormClosed(object sender, FormClosedEventArgs e) + { + DeleteObject(Canvus); + //DeleteObject(BlankCanvus); + DeleteDC(canvusDc); + if (Root.AutoScroll) + { + DeleteObject(hScreenBitmap); + DeleteDC(memscreenDc); + } + } + + [DllImport("user32.dll")] + static extern IntPtr GetDC(IntPtr hWnd); + [DllImport("user32.dll")] + static extern bool ReleaseDC(IntPtr hWnd, IntPtr hDC); + [DllImport("gdi32.dll", EntryPoint = "DeleteDC")] + public static extern bool DeleteDC([In] IntPtr hdc); + [DllImport("gdi32.dll", EntryPoint = "CreateCompatibleDC", SetLastError = true)] + static extern IntPtr CreateCompatibleDC([In] IntPtr hdc); + [DllImport("gdi32.dll", EntryPoint = "SelectObject")] + public static extern IntPtr SelectObject([In] IntPtr hdc, [In] IntPtr hgdiobj); + [DllImport("gdi32.dll", EntryPoint = "DeleteObject")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool DeleteObject([In] IntPtr hObject); + [DllImport("user32.dll", ExactSpelling = true, SetLastError = true)] + static extern bool UpdateLayeredWindow(IntPtr hwnd, IntPtr hdcDst, ref Point pptDst, ref Size psize, IntPtr hdcSrc, ref Point pptSrc, uint crKey, [In] ref BLENDFUNCTION pblend, uint dwFlags); + [DllImport("gdi32.dll")] + public static extern bool BitBlt(IntPtr hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hdcSrc, int nXSrc, int nYSrc, uint dwRop); + [DllImport("gdi32.dll")] + public static extern bool StretchBlt(IntPtr hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hdcSrc, int nXSrc, int nYSrc, int nWidthSrc, int nHeightSrc, long dwRop); + + + [StructLayout(LayoutKind.Sequential)] + public struct BLENDFUNCTION + { + public byte BlendOp; + public byte BlendFlags; + public byte SourceConstantAlpha; + public byte AlphaFormat; + + public BLENDFUNCTION(byte op, byte flags, byte alpha, byte format) + { + BlendOp = op; + BlendFlags = flags; + SourceConstantAlpha = alpha; + AlphaFormat = format; + } + } - const int ULW_ALPHA = 2; - const int AC_SRC_OVER = 0x00; - const int AC_SRC_ALPHA = 0x01; + const int ULW_ALPHA = 2; + const int AC_SRC_OVER = 0x00; + const int AC_SRC_ALPHA = 0x01; @@ -869,25 +869,25 @@ public bool HasFocus() return activeProcId == procId; } - [DllImport("user32.dll")] - static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags); - [DllImport("user32.dll", SetLastError = true)] - static extern UInt32 GetWindowLong(IntPtr hWnd, int nIndex); - [DllImport("user32.dll")] - static extern int SetWindowLong(IntPtr hWnd, int nIndex, UInt32 dwNewLong); - [DllImport("user32.dll")] - public extern static bool SetLayeredWindowAttributes(IntPtr hwnd, uint crKey, byte bAlpha, uint dwFlags); - - [DllImport("gdi32.dll")] - static extern int GetBitmapBits(IntPtr hbmp, int cbBuffer, [Out] byte[] lpvBits); - [DllImport("gdi32.dll")] - static extern uint GetPixel(IntPtr hdc, int nXPos, int nYPos); - - [DllImport("gdi32.dll")] - static extern int GetDeviceCaps(IntPtr hdc, int nIndex); - - [DllImport("msvcrt.dll", EntryPoint = "memcpy", CallingConvention = CallingConvention.Cdecl, SetLastError = false)] - public static extern IntPtr memcpy(IntPtr dest, IntPtr src, int count); + [DllImport("user32.dll")] + static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags); + [DllImport("user32.dll", SetLastError = true)] + static extern uint GetWindowLong(IntPtr hWnd, int nIndex); + [DllImport("user32.dll")] + static extern int SetWindowLong(IntPtr hWnd, int nIndex, uint dwNewLong); + [DllImport("user32.dll")] + public extern static bool SetLayeredWindowAttributes(IntPtr hwnd, uint crKey, byte bAlpha, uint dwFlags); + + [DllImport("gdi32.dll")] + static extern int GetBitmapBits(IntPtr hbmp, int cbBuffer, [Out] byte[] lpvBits); + [DllImport("gdi32.dll")] + static extern uint GetPixel(IntPtr hdc, int nXPos, int nYPos); + + [DllImport("gdi32.dll")] + static extern int GetDeviceCaps(IntPtr hdc, int nIndex); + + [DllImport("msvcrt.dll", EntryPoint = "memcpy", CallingConvention = CallingConvention.Cdecl, SetLastError = false)] + public static extern IntPtr memcpy(IntPtr dest, IntPtr src, int count); [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)] private static extern IntPtr GetForegroundWindow(); diff --git a/src/FormInput.cs b/src/FormInput.cs index 179630b8..dc9d5ff6 100644 --- a/src/FormInput.cs +++ b/src/FormInput.cs @@ -22,10 +22,10 @@ public partial class FormInput : Form bool Saved_Black; - public FormInput(string caption,string label, string txt, bool ML, gInk.Root rt = null, Microsoft.Ink.Stroke stk = null) + public FormInput(string caption, string label, string txt, bool ML, gInk.Root rt = null, Microsoft.Ink.Stroke stk = null) { InitializeComponent(); - + // local this.btOK.Text = rt.Local.ButtonOkText; this.btCancel.Text = rt.Local.ButtonCancelText; @@ -83,9 +83,9 @@ public FormInput(string caption,string label, string txt, bool ML, gInk.Root rt public void TextIn(string txt) { if (InputML.Visible) - InputML.Text=txt; + InputML.Text = txt; else - InputSL.Text=txt; + InputSL.Text = txt; } public string TextOut() @@ -103,9 +103,9 @@ private void FontBtn_Click(object sender, EventArgs e) stroke.ExtendedProperties.Add(Root.TEXTFONT_GUID, FontDlg.Font.Name); stroke.ExtendedProperties.Add(Root.TEXTFONTSIZE_GUID, (float)FontDlg.Font.Size); stroke.ExtendedProperties.Add(Root.TEXTFONTSTYLE_GUID, FontDlg.Font.Style); - string st=InputML.Text; + string st = InputML.Text; // to run event for refresh - InputML.Text = "";InputML.Text = st; + InputML.Text = ""; InputML.Text = st; } } @@ -129,7 +129,7 @@ private void InputML_TextChanged(object sender, EventArgs e) if (t.Length == 0) t = " "; stroke.ExtendedProperties.Remove(Root.TEXT_GUID); stroke.ExtendedProperties.Add(Root.TEXT_GUID, t); - if(!stroke.ExtendedProperties.Contains(Root.ISTAG_GUID)) + if (!stroke.ExtendedProperties.Contains(Root.ISTAG_GUID)) Root.FormCollection.ComputeTextBoxSize(ref stroke); Root.FormDisplay.ClearCanvus(); Root.FormDisplay.DrawStrokes(); @@ -148,7 +148,7 @@ private void TB_CtrlAPressed(object sender, KeyPressEventArgs e) private void btCancel_Click(object sender, EventArgs e) { - if(stroke != null ) + if (stroke != null) { InputML.Text = Saved_Txt; stroke.ExtendedProperties.Add(Root.TEXTFONT_GUID, Saved_Font.Name); @@ -169,7 +169,7 @@ private void btCancel_Click(object sender, EventArgs e) else if (Saved_White) { try { stroke.ExtendedProperties.Remove(Root.ISFILLEDBLACK_GUID); } catch { } - stroke.ExtendedProperties.Add(Root.ISFILLEDWHITE_GUID, true); + stroke.ExtendedProperties.Add(Root.ISFILLEDWHITE_GUID, true); } else { @@ -182,7 +182,7 @@ private void btCancel_Click(object sender, EventArgs e) private void boxingCb_TextChanged(object sender, EventArgs e) { int i = boxingCb.Items.IndexOf(boxingCb.Text); - if ((i&1)!=0) + if ((i & 1) != 0) stroke.ExtendedProperties.Add(Root.ISSTROKE_GUID, true); else try { stroke.ExtendedProperties.Remove(Root.ISSTROKE_GUID); } catch { } @@ -209,10 +209,10 @@ private void boxingCb_TextChanged(object sender, EventArgs e) private void FormInput_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) { - if (e.Control && (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Return )) + if (e.Control && (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Return)) { this.DialogResult = DialogResult.OK; - this.Close(); + this.Close(); } } } diff --git a/src/FormOptions.Designer.cs b/src/FormOptions.Designer.cs index ca6b782f..a9a0a67c 100644 --- a/src/FormOptions.Designer.cs +++ b/src/FormOptions.Designer.cs @@ -216,6 +216,9 @@ private void InitializeComponent() this.lbcbPens = new System.Windows.Forms.Label(); this.FadingTimeEd = new System.Windows.Forms.TextBox(); this.WidthAtPenSelCb = new System.Windows.Forms.CheckBox(); + this.tabPageExtra = new System.Windows.Forms.TabPage(); + this.panel3 = new System.Windows.Forms.Panel(); + this.checkBoxCleanCanvas = new System.Windows.Forms.CheckBox(); this.tabPage3.SuspendLayout(); this.SnapInPointerGrp.SuspendLayout(); this.VideoTab.SuspendLayout(); @@ -227,86 +230,97 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.ToolbarDwg)).BeginInit(); this.VideoTabCtrl.SuspendLayout(); this.tabPage2.SuspendLayout(); + this.tabPageExtra.SuspendLayout(); + this.panel3.SuspendLayout(); this.SuspendLayout(); // // lbPens4 // this.lbPens4.AutoSize = true; - this.lbPens4.Location = new System.Drawing.Point(127, 187); + this.lbPens4.Location = new System.Drawing.Point(169, 230); + this.lbPens4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbPens4.Name = "lbPens4"; - this.lbPens4.Size = new System.Drawing.Size(35, 13); + this.lbPens4.Size = new System.Drawing.Size(45, 17); this.lbPens4.TabIndex = 11; this.lbPens4.Text = "Pen 4"; // // lbHkZoom // this.lbHkZoom.AutoSize = true; - this.lbHkZoom.Location = new System.Drawing.Point(236, 414); + this.lbHkZoom.Location = new System.Drawing.Point(315, 510); + this.lbHkZoom.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbHkZoom.Name = "lbHkZoom"; - this.lbHkZoom.Size = new System.Drawing.Size(34, 13); + this.lbHkZoom.Size = new System.Drawing.Size(44, 17); this.lbHkZoom.TabIndex = 52; this.lbHkZoom.Text = "Zoom"; // // lbHkClipart3 // this.lbHkClipart3.AutoSize = true; - this.lbHkClipart3.Location = new System.Drawing.Point(497, 443); + this.lbHkClipart3.Location = new System.Drawing.Point(663, 545); + this.lbHkClipart3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbHkClipart3.Name = "lbHkClipart3"; - this.lbHkClipart3.Size = new System.Drawing.Size(73, 13); + this.lbHkClipart3.Size = new System.Drawing.Size(97, 17); this.lbHkClipart3.TabIndex = 50; this.lbHkClipart3.Text = "Tool: ClipArt 3"; // // lbHkClipart2 // this.lbHkClipart2.AutoSize = true; - this.lbHkClipart2.Location = new System.Drawing.Point(497, 417); + this.lbHkClipart2.Location = new System.Drawing.Point(663, 513); + this.lbHkClipart2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbHkClipart2.Name = "lbHkClipart2"; - this.lbHkClipart2.Size = new System.Drawing.Size(73, 13); + this.lbHkClipart2.Size = new System.Drawing.Size(97, 17); this.lbHkClipart2.TabIndex = 48; this.lbHkClipart2.Text = "Tool: ClipArt 2"; // // lbHkClipart1 // this.lbHkClipart1.AutoSize = true; - this.lbHkClipart1.Location = new System.Drawing.Point(497, 391); + this.lbHkClipart1.Location = new System.Drawing.Point(663, 481); + this.lbHkClipart1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbHkClipart1.Name = "lbHkClipart1"; - this.lbHkClipart1.Size = new System.Drawing.Size(73, 13); + this.lbHkClipart1.Size = new System.Drawing.Size(97, 17); this.lbHkClipart1.TabIndex = 46; this.lbHkClipart1.Text = "Tool: ClipArt 1"; // // lbHkClipart // this.lbHkClipart.AutoSize = true; - this.lbHkClipart.Location = new System.Drawing.Point(497, 365); + this.lbHkClipart.Location = new System.Drawing.Point(663, 449); + this.lbHkClipart.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbHkClipart.Name = "lbHkClipart"; - this.lbHkClipart.Size = new System.Drawing.Size(64, 13); + this.lbHkClipart.Size = new System.Drawing.Size(85, 17); this.lbHkClipart.TabIndex = 44; this.lbHkClipart.Text = "Tool: ClipArt"; // // lbHkDockUndock // this.lbHkDockUndock.AutoSize = true; - this.lbHkDockUndock.Location = new System.Drawing.Point(236, 362); + this.lbHkDockUndock.Location = new System.Drawing.Point(315, 446); + this.lbHkDockUndock.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbHkDockUndock.Name = "lbHkDockUndock"; - this.lbHkDockUndock.Size = new System.Drawing.Size(33, 13); + this.lbHkDockUndock.Size = new System.Drawing.Size(40, 17); this.lbHkDockUndock.TabIndex = 40; this.lbHkDockUndock.Text = "Dock"; // // lbHkVideo // this.lbHkVideo.AutoSize = true; - this.lbHkVideo.Location = new System.Drawing.Point(236, 336); + this.lbHkVideo.Location = new System.Drawing.Point(315, 414); + this.lbHkVideo.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbHkVideo.Name = "lbHkVideo"; - this.lbHkVideo.Size = new System.Drawing.Size(72, 13); + this.lbHkVideo.Size = new System.Drawing.Size(94, 17); this.lbHkVideo.TabIndex = 38; this.lbHkVideo.Text = "Video Record"; // // AltAsOneCommandCb // this.AltAsOneCommandCb.AutoSize = true; - this.AltAsOneCommandCb.Location = new System.Drawing.Point(19, 65); + this.AltAsOneCommandCb.Location = new System.Drawing.Point(25, 80); + this.AltAsOneCommandCb.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.AltAsOneCommandCb.Name = "AltAsOneCommandCb"; - this.AltAsOneCommandCb.Size = new System.Drawing.Size(338, 17); + this.AltAsOneCommandCb.Size = new System.Drawing.Size(452, 21); this.AltAsOneCommandCb.TabIndex = 37; this.AltAsOneCommandCb.Text = "Process Alt as Temporary Command (Alt will be ignored in hotkeys)"; this.AltAsOneCommandCb.UseVisualStyleBackColor = true; @@ -315,27 +329,30 @@ private void InitializeComponent() // lbHkMagn // this.lbHkMagn.AutoSize = true; - this.lbHkMagn.Location = new System.Drawing.Point(497, 339); + this.lbHkMagn.Location = new System.Drawing.Point(663, 417); + this.lbHkMagn.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbHkMagn.Name = "lbHkMagn"; - this.lbHkMagn.Size = new System.Drawing.Size(78, 13); + this.lbHkMagn.Size = new System.Drawing.Size(101, 17); this.lbHkMagn.TabIndex = 35; this.lbHkMagn.Text = "Tool: Magnetic"; // // lbHkEdit // this.lbHkEdit.AutoSize = true; - this.lbHkEdit.Location = new System.Drawing.Point(497, 313); + this.lbHkEdit.Location = new System.Drawing.Point(663, 385); + this.lbHkEdit.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbHkEdit.Name = "lbHkEdit"; - this.lbHkEdit.Size = new System.Drawing.Size(52, 13); + this.lbHkEdit.Size = new System.Drawing.Size(68, 17); this.lbHkEdit.TabIndex = 33; this.lbHkEdit.Text = "Tool: Edit"; // // lbPens3 // this.lbPens3.AutoSize = true; - this.lbPens3.Location = new System.Drawing.Point(127, 152); + this.lbPens3.Location = new System.Drawing.Point(169, 187); + this.lbPens3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbPens3.Name = "lbPens3"; - this.lbPens3.Size = new System.Drawing.Size(35, 13); + this.lbPens3.Size = new System.Drawing.Size(45, 17); this.lbPens3.TabIndex = 10; this.lbPens3.Text = "Pen 3"; // @@ -397,9 +414,10 @@ private void InitializeComponent() this.tabPage3.Controls.Add(this.hiUndo); this.tabPage3.Controls.Add(this.hiEraser); this.tabPage3.Controls.Add(this.hiGlobal); - this.tabPage3.Location = new System.Drawing.Point(4, 22); + this.tabPage3.Location = new System.Drawing.Point(4, 25); + this.tabPage3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.tabPage3.Name = "tabPage3"; - this.tabPage3.Size = new System.Drawing.Size(756, 473); + this.tabPage3.Size = new System.Drawing.Size(1011, 585); this.tabPage3.TabIndex = 2; this.tabPage3.Text = "Hotkeys"; // @@ -408,9 +426,11 @@ private void InitializeComponent() this.SnapInPointerGrp.Controls.Add(this.SnapInPointerTwiceCb); this.SnapInPointerGrp.Controls.Add(this.SnapInPointerHoldCb); this.SnapInPointerGrp.Controls.Add(this.SnapInPointerLbl); - this.SnapInPointerGrp.Location = new System.Drawing.Point(444, 14); + this.SnapInPointerGrp.Location = new System.Drawing.Point(592, 17); + this.SnapInPointerGrp.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.SnapInPointerGrp.Name = "SnapInPointerGrp"; - this.SnapInPointerGrp.Size = new System.Drawing.Size(286, 76); + this.SnapInPointerGrp.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.SnapInPointerGrp.Size = new System.Drawing.Size(381, 94); this.SnapInPointerGrp.TabIndex = 9; this.SnapInPointerGrp.TabStop = false; this.SnapInPointerGrp.Text = "snapshot in pointer mode"; @@ -424,9 +444,10 @@ private void InitializeComponent() "Shift", "Control", "Alt"}); - this.SnapInPointerTwiceCb.Location = new System.Drawing.Point(152, 32); + this.SnapInPointerTwiceCb.Location = new System.Drawing.Point(203, 39); + this.SnapInPointerTwiceCb.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.SnapInPointerTwiceCb.Name = "SnapInPointerTwiceCb"; - this.SnapInPointerTwiceCb.Size = new System.Drawing.Size(96, 21); + this.SnapInPointerTwiceCb.Size = new System.Drawing.Size(127, 24); this.SnapInPointerTwiceCb.TabIndex = 1; this.SnapInPointerTwiceCb.SelectedIndexChanged += new System.EventHandler(this.SnapInPointerKeysChanged); // @@ -439,90 +460,100 @@ private void InitializeComponent() "Shift", "Control", "Alt"}); - this.SnapInPointerHoldCb.Location = new System.Drawing.Point(22, 32); + this.SnapInPointerHoldCb.Location = new System.Drawing.Point(29, 39); + this.SnapInPointerHoldCb.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.SnapInPointerHoldCb.Name = "SnapInPointerHoldCb"; - this.SnapInPointerHoldCb.Size = new System.Drawing.Size(96, 21); + this.SnapInPointerHoldCb.Size = new System.Drawing.Size(127, 24); this.SnapInPointerHoldCb.TabIndex = 1; this.SnapInPointerHoldCb.SelectedIndexChanged += new System.EventHandler(this.SnapInPointerKeysChanged); // // SnapInPointerLbl // this.SnapInPointerLbl.AutoSize = true; - this.SnapInPointerLbl.Location = new System.Drawing.Point(22, 16); + this.SnapInPointerLbl.Location = new System.Drawing.Point(29, 20); + this.SnapInPointerLbl.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.SnapInPointerLbl.Name = "SnapInPointerLbl"; - this.SnapInPointerLbl.Size = new System.Drawing.Size(225, 52); + this.SnapInPointerLbl.Size = new System.Drawing.Size(300, 68); this.SnapInPointerLbl.TabIndex = 0; this.SnapInPointerLbl.Text = "press and hold.... .... and press twice\r\n\r\n\r\nBoth None = Disabled"; // // lbHkText // this.lbHkText.AutoSize = true; - this.lbHkText.Location = new System.Drawing.Point(497, 286); + this.lbHkText.Location = new System.Drawing.Point(663, 352); + this.lbHkText.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbHkText.Name = "lbHkText"; - this.lbHkText.Size = new System.Drawing.Size(55, 13); + this.lbHkText.Size = new System.Drawing.Size(71, 17); this.lbHkText.TabIndex = 31; this.lbHkText.Text = "Tool: Text"; // // lbHkNumb // this.lbHkNumb.AutoSize = true; - this.lbHkNumb.Location = new System.Drawing.Point(497, 256); + this.lbHkNumb.Location = new System.Drawing.Point(663, 315); + this.lbHkNumb.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbHkNumb.Name = "lbHkNumb"; - this.lbHkNumb.Size = new System.Drawing.Size(88, 13); + this.lbHkNumb.Size = new System.Drawing.Size(115, 17); this.lbHkNumb.TabIndex = 29; this.lbHkNumb.Text = "Tool: Numb. chip"; // // lbHkArrow // this.lbHkArrow.AutoSize = true; - this.lbHkArrow.Location = new System.Drawing.Point(497, 232); + this.lbHkArrow.Location = new System.Drawing.Point(663, 286); + this.lbHkArrow.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbHkArrow.Name = "lbHkArrow"; - this.lbHkArrow.Size = new System.Drawing.Size(61, 13); + this.lbHkArrow.Size = new System.Drawing.Size(80, 17); this.lbHkArrow.TabIndex = 27; this.lbHkArrow.Text = "Tool: Arrow"; // // lbHkOval // this.lbHkOval.AutoSize = true; - this.lbHkOval.Location = new System.Drawing.Point(497, 205); + this.lbHkOval.Location = new System.Drawing.Point(663, 252); + this.lbHkOval.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbHkOval.Name = "lbHkOval"; - this.lbHkOval.Size = new System.Drawing.Size(65, 13); + this.lbHkOval.Size = new System.Drawing.Size(87, 17); this.lbHkOval.TabIndex = 25; this.lbHkOval.Text = "Tool: Ellipsis"; // // lbHkRect // this.lbHkRect.AutoSize = true; - this.lbHkRect.Location = new System.Drawing.Point(497, 178); + this.lbHkRect.Location = new System.Drawing.Point(663, 219); + this.lbHkRect.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbHkRect.Name = "lbHkRect"; - this.lbHkRect.Size = new System.Drawing.Size(83, 13); + this.lbHkRect.Size = new System.Drawing.Size(108, 17); this.lbHkRect.TabIndex = 23; this.lbHkRect.Text = "Tool: Rectangle"; // // lbHkLine // this.lbHkLine.AutoSize = true; - this.lbHkLine.Location = new System.Drawing.Point(497, 150); + this.lbHkLine.Location = new System.Drawing.Point(663, 185); + this.lbHkLine.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbHkLine.Name = "lbHkLine"; - this.lbHkLine.Size = new System.Drawing.Size(54, 13); + this.lbHkLine.Size = new System.Drawing.Size(71, 17); this.lbHkLine.TabIndex = 21; this.lbHkLine.Text = "Tool: Line"; // // lbHkHand // this.lbHkHand.AutoSize = true; - this.lbHkHand.Location = new System.Drawing.Point(497, 123); + this.lbHkHand.Location = new System.Drawing.Point(663, 151); + this.lbHkHand.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbHkHand.Name = "lbHkHand"; - this.lbHkHand.Size = new System.Drawing.Size(81, 13); + this.lbHkHand.Size = new System.Drawing.Size(107, 17); this.lbHkHand.TabIndex = 19; this.lbHkHand.Text = "Tool: FreeHand"; // // cbAllowHotkeyInPointer // this.cbAllowHotkeyInPointer.AutoSize = true; - this.cbAllowHotkeyInPointer.Location = new System.Drawing.Point(19, 87); + this.cbAllowHotkeyInPointer.Location = new System.Drawing.Point(25, 107); + this.cbAllowHotkeyInPointer.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.cbAllowHotkeyInPointer.Name = "cbAllowHotkeyInPointer"; - this.cbAllowHotkeyInPointer.Size = new System.Drawing.Size(356, 17); + this.cbAllowHotkeyInPointer.Size = new System.Drawing.Size(474, 21); this.cbAllowHotkeyInPointer.TabIndex = 18; this.cbAllowHotkeyInPointer.Text = "Allow all following hotkeys in mouse pointer mode (may cause a mess):"; this.cbAllowHotkeyInPointer.UseVisualStyleBackColor = true; @@ -530,45 +561,50 @@ private void InitializeComponent() // lbHkInkVisible // this.lbHkInkVisible.AutoSize = true; - this.lbHkInkVisible.Location = new System.Drawing.Point(236, 202); + this.lbHkInkVisible.Location = new System.Drawing.Point(315, 249); + this.lbHkInkVisible.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbHkInkVisible.Name = "lbHkInkVisible"; - this.lbHkInkVisible.Size = new System.Drawing.Size(57, 13); + this.lbHkInkVisible.Size = new System.Drawing.Size(70, 17); this.lbHkInkVisible.TabIndex = 16; this.lbHkInkVisible.Text = "View/Hide"; // // lbHkSnapshot // this.lbHkSnapshot.AutoSize = true; - this.lbHkSnapshot.Location = new System.Drawing.Point(236, 229); + this.lbHkSnapshot.Location = new System.Drawing.Point(315, 282); + this.lbHkSnapshot.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbHkSnapshot.Name = "lbHkSnapshot"; - this.lbHkSnapshot.Size = new System.Drawing.Size(52, 13); + this.lbHkSnapshot.Size = new System.Drawing.Size(68, 17); this.lbHkSnapshot.TabIndex = 12; this.lbHkSnapshot.Text = "Snapshot"; // // lbHkClear // this.lbHkClear.AutoSize = true; - this.lbHkClear.Location = new System.Drawing.Point(236, 310); + this.lbHkClear.Location = new System.Drawing.Point(315, 382); + this.lbHkClear.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbHkClear.Name = "lbHkClear"; - this.lbHkClear.Size = new System.Drawing.Size(31, 13); + this.lbHkClear.Size = new System.Drawing.Size(41, 17); this.lbHkClear.TabIndex = 13; this.lbHkClear.Text = "Clear"; // // lbHkPan // this.lbHkPan.AutoSize = true; - this.lbHkPan.Location = new System.Drawing.Point(236, 147); + this.lbHkPan.Location = new System.Drawing.Point(315, 181); + this.lbHkPan.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbHkPan.Name = "lbHkPan"; - this.lbHkPan.Size = new System.Drawing.Size(46, 13); + this.lbHkPan.Size = new System.Drawing.Size(56, 17); this.lbHkPan.TabIndex = 10; this.lbHkPan.Text = "Pan / M"; // // lbHkPointer // this.lbHkPointer.AutoSize = true; - this.lbHkPointer.Location = new System.Drawing.Point(236, 175); + this.lbHkPointer.Location = new System.Drawing.Point(315, 215); + this.lbHkPointer.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbHkPointer.Name = "lbHkPointer"; - this.lbHkPointer.Size = new System.Drawing.Size(74, 13); + this.lbHkPointer.Size = new System.Drawing.Size(98, 17); this.lbHkPointer.TabIndex = 6; this.lbHkPointer.Text = "Mouse pointer"; this.lbHkPointer.Visible = false; @@ -576,45 +612,50 @@ private void InitializeComponent() // lbHkRedo // this.lbHkRedo.AutoSize = true; - this.lbHkRedo.Location = new System.Drawing.Point(236, 283); + this.lbHkRedo.Location = new System.Drawing.Point(315, 348); + this.lbHkRedo.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbHkRedo.Name = "lbHkRedo"; - this.lbHkRedo.Size = new System.Drawing.Size(33, 13); + this.lbHkRedo.Size = new System.Drawing.Size(42, 17); this.lbHkRedo.TabIndex = 7; this.lbHkRedo.Text = "Redo"; // // lbHkUndo // this.lbHkUndo.AutoSize = true; - this.lbHkUndo.Location = new System.Drawing.Point(236, 256); + this.lbHkUndo.Location = new System.Drawing.Point(315, 315); + this.lbHkUndo.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbHkUndo.Name = "lbHkUndo"; - this.lbHkUndo.Size = new System.Drawing.Size(33, 13); + this.lbHkUndo.Size = new System.Drawing.Size(42, 17); this.lbHkUndo.TabIndex = 4; this.lbHkUndo.Text = "Undo"; // // lbHkEraser // this.lbHkEraser.AutoSize = true; - this.lbHkEraser.Location = new System.Drawing.Point(236, 120); + this.lbHkEraser.Location = new System.Drawing.Point(315, 148); + this.lbHkEraser.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbHkEraser.Name = "lbHkEraser"; - this.lbHkEraser.Size = new System.Drawing.Size(37, 13); + this.lbHkEraser.Size = new System.Drawing.Size(50, 17); this.lbHkEraser.TabIndex = 4; this.lbHkEraser.Text = "Eraser"; // // lbGlobalHotkey // this.lbGlobalHotkey.AutoSize = true; - this.lbGlobalHotkey.Location = new System.Drawing.Point(17, 18); + this.lbGlobalHotkey.Location = new System.Drawing.Point(23, 22); + this.lbGlobalHotkey.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbGlobalHotkey.Name = "lbGlobalHotkey"; - this.lbGlobalHotkey.Size = new System.Drawing.Size(351, 13); + this.lbGlobalHotkey.Size = new System.Drawing.Size(468, 17); this.lbGlobalHotkey.TabIndex = 4; this.lbGlobalHotkey.Text = "Global hotkey (start drawing, switch between mouse pointer and drawing)"; // // lbHkClose // this.lbHkClose.AutoSize = true; - this.lbHkClose.Location = new System.Drawing.Point(236, 382); + this.lbHkClose.Location = new System.Drawing.Point(315, 470); + this.lbHkClose.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbHkClose.Name = "lbHkClose"; - this.lbHkClose.Size = new System.Drawing.Size(106, 26); + this.lbHkClose.Size = new System.Drawing.Size(143, 34); this.lbHkClose.TabIndex = 42; this.lbHkClose.Text = "Close\r\n(in addition to Alt+F4)"; // @@ -624,10 +665,11 @@ private void InitializeComponent() this.hiZoom.ExternalConflictFlag = false; this.hiZoom.Hotkey = hotkey1; this.hiZoom.ImeMode = System.Windows.Forms.ImeMode.Disable; - this.hiZoom.Location = new System.Drawing.Point(340, 414); + this.hiZoom.Location = new System.Drawing.Point(453, 510); + this.hiZoom.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.hiZoom.Name = "hiZoom"; this.hiZoom.RequireModifier = false; - this.hiZoom.Size = new System.Drawing.Size(120, 20); + this.hiZoom.Size = new System.Drawing.Size(159, 22); this.hiZoom.TabIndex = 53; this.hiZoom.Text = "None"; this.hiZoom.OnHotkeyChanged += new System.EventHandler(this.hi_OnHotkeyChanged); @@ -638,10 +680,11 @@ private void InitializeComponent() this.hiToolClipArt3.ExternalConflictFlag = false; this.hiToolClipArt3.Hotkey = hotkey2; this.hiToolClipArt3.ImeMode = System.Windows.Forms.ImeMode.Disable; - this.hiToolClipArt3.Location = new System.Drawing.Point(601, 440); + this.hiToolClipArt3.Location = new System.Drawing.Point(801, 542); + this.hiToolClipArt3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.hiToolClipArt3.Name = "hiToolClipArt3"; this.hiToolClipArt3.RequireModifier = false; - this.hiToolClipArt3.Size = new System.Drawing.Size(120, 20); + this.hiToolClipArt3.Size = new System.Drawing.Size(159, 22); this.hiToolClipArt3.TabIndex = 51; this.hiToolClipArt3.Text = "None"; this.hiToolClipArt3.OnHotkeyChanged += new System.EventHandler(this.hi_OnHotkeyChanged); @@ -652,10 +695,11 @@ private void InitializeComponent() this.hiToolClipArt2.ExternalConflictFlag = false; this.hiToolClipArt2.Hotkey = hotkey3; this.hiToolClipArt2.ImeMode = System.Windows.Forms.ImeMode.Disable; - this.hiToolClipArt2.Location = new System.Drawing.Point(601, 414); + this.hiToolClipArt2.Location = new System.Drawing.Point(801, 510); + this.hiToolClipArt2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.hiToolClipArt2.Name = "hiToolClipArt2"; this.hiToolClipArt2.RequireModifier = false; - this.hiToolClipArt2.Size = new System.Drawing.Size(120, 20); + this.hiToolClipArt2.Size = new System.Drawing.Size(159, 22); this.hiToolClipArt2.TabIndex = 49; this.hiToolClipArt2.Text = "None"; this.hiToolClipArt2.OnHotkeyChanged += new System.EventHandler(this.hi_OnHotkeyChanged); @@ -666,10 +710,11 @@ private void InitializeComponent() this.hiToolClipArt1.ExternalConflictFlag = false; this.hiToolClipArt1.Hotkey = hotkey4; this.hiToolClipArt1.ImeMode = System.Windows.Forms.ImeMode.Disable; - this.hiToolClipArt1.Location = new System.Drawing.Point(601, 388); + this.hiToolClipArt1.Location = new System.Drawing.Point(801, 478); + this.hiToolClipArt1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.hiToolClipArt1.Name = "hiToolClipArt1"; this.hiToolClipArt1.RequireModifier = false; - this.hiToolClipArt1.Size = new System.Drawing.Size(120, 20); + this.hiToolClipArt1.Size = new System.Drawing.Size(159, 22); this.hiToolClipArt1.TabIndex = 47; this.hiToolClipArt1.Text = "None"; this.hiToolClipArt1.OnHotkeyChanged += new System.EventHandler(this.hi_OnHotkeyChanged); @@ -680,10 +725,11 @@ private void InitializeComponent() this.hiToolClipArt.ExternalConflictFlag = false; this.hiToolClipArt.Hotkey = hotkey5; this.hiToolClipArt.ImeMode = System.Windows.Forms.ImeMode.Disable; - this.hiToolClipArt.Location = new System.Drawing.Point(601, 362); + this.hiToolClipArt.Location = new System.Drawing.Point(801, 446); + this.hiToolClipArt.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.hiToolClipArt.Name = "hiToolClipArt"; this.hiToolClipArt.RequireModifier = false; - this.hiToolClipArt.Size = new System.Drawing.Size(120, 20); + this.hiToolClipArt.Size = new System.Drawing.Size(159, 22); this.hiToolClipArt.TabIndex = 45; this.hiToolClipArt.Text = "None"; this.hiToolClipArt.OnHotkeyChanged += new System.EventHandler(this.hi_OnHotkeyChanged); @@ -694,10 +740,11 @@ private void InitializeComponent() this.hiClose.ExternalConflictFlag = false; this.hiClose.Hotkey = hotkey6; this.hiClose.ImeMode = System.Windows.Forms.ImeMode.Disable; - this.hiClose.Location = new System.Drawing.Point(340, 388); + this.hiClose.Location = new System.Drawing.Point(453, 478); + this.hiClose.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.hiClose.Name = "hiClose"; this.hiClose.RequireModifier = false; - this.hiClose.Size = new System.Drawing.Size(120, 20); + this.hiClose.Size = new System.Drawing.Size(159, 22); this.hiClose.TabIndex = 43; this.hiClose.Text = "None"; this.hiClose.OnHotkeyChanged += new System.EventHandler(this.hi_OnHotkeyChanged); @@ -708,10 +755,11 @@ private void InitializeComponent() this.hiDockUndock.ExternalConflictFlag = false; this.hiDockUndock.Hotkey = hotkey7; this.hiDockUndock.ImeMode = System.Windows.Forms.ImeMode.Disable; - this.hiDockUndock.Location = new System.Drawing.Point(340, 362); + this.hiDockUndock.Location = new System.Drawing.Point(453, 446); + this.hiDockUndock.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.hiDockUndock.Name = "hiDockUndock"; this.hiDockUndock.RequireModifier = false; - this.hiDockUndock.Size = new System.Drawing.Size(120, 20); + this.hiDockUndock.Size = new System.Drawing.Size(159, 22); this.hiDockUndock.TabIndex = 41; this.hiDockUndock.Text = "None"; this.hiDockUndock.OnHotkeyChanged += new System.EventHandler(this.hi_OnHotkeyChanged); @@ -722,10 +770,11 @@ private void InitializeComponent() this.hiVideo.ExternalConflictFlag = false; this.hiVideo.Hotkey = hotkey8; this.hiVideo.ImeMode = System.Windows.Forms.ImeMode.Disable; - this.hiVideo.Location = new System.Drawing.Point(340, 336); + this.hiVideo.Location = new System.Drawing.Point(453, 414); + this.hiVideo.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.hiVideo.Name = "hiVideo"; this.hiVideo.RequireModifier = false; - this.hiVideo.Size = new System.Drawing.Size(120, 20); + this.hiVideo.Size = new System.Drawing.Size(159, 22); this.hiVideo.TabIndex = 39; this.hiVideo.Text = "None"; this.hiVideo.OnHotkeyChanged += new System.EventHandler(this.hi_OnHotkeyChanged); @@ -736,10 +785,11 @@ private void InitializeComponent() this.hiToolMagnet.ExternalConflictFlag = false; this.hiToolMagnet.Hotkey = hotkey9; this.hiToolMagnet.ImeMode = System.Windows.Forms.ImeMode.Disable; - this.hiToolMagnet.Location = new System.Drawing.Point(601, 336); + this.hiToolMagnet.Location = new System.Drawing.Point(801, 414); + this.hiToolMagnet.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.hiToolMagnet.Name = "hiToolMagnet"; this.hiToolMagnet.RequireModifier = false; - this.hiToolMagnet.Size = new System.Drawing.Size(120, 20); + this.hiToolMagnet.Size = new System.Drawing.Size(159, 22); this.hiToolMagnet.TabIndex = 36; this.hiToolMagnet.Text = "None"; this.hiToolMagnet.OnHotkeyChanged += new System.EventHandler(this.hi_OnHotkeyChanged); @@ -750,10 +800,11 @@ private void InitializeComponent() this.hiToolEdit.ExternalConflictFlag = false; this.hiToolEdit.Hotkey = hotkey10; this.hiToolEdit.ImeMode = System.Windows.Forms.ImeMode.Disable; - this.hiToolEdit.Location = new System.Drawing.Point(601, 310); + this.hiToolEdit.Location = new System.Drawing.Point(801, 382); + this.hiToolEdit.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.hiToolEdit.Name = "hiToolEdit"; this.hiToolEdit.RequireModifier = false; - this.hiToolEdit.Size = new System.Drawing.Size(120, 20); + this.hiToolEdit.Size = new System.Drawing.Size(159, 22); this.hiToolEdit.TabIndex = 34; this.hiToolEdit.Text = "None"; this.hiToolEdit.OnHotkeyChanged += new System.EventHandler(this.hi_OnHotkeyChanged); @@ -764,10 +815,11 @@ private void InitializeComponent() this.HiToolText.ExternalConflictFlag = false; this.HiToolText.Hotkey = hotkey11; this.HiToolText.ImeMode = System.Windows.Forms.ImeMode.Disable; - this.HiToolText.Location = new System.Drawing.Point(601, 283); + this.HiToolText.Location = new System.Drawing.Point(801, 348); + this.HiToolText.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.HiToolText.Name = "HiToolText"; this.HiToolText.RequireModifier = false; - this.HiToolText.Size = new System.Drawing.Size(120, 20); + this.HiToolText.Size = new System.Drawing.Size(159, 22); this.HiToolText.TabIndex = 32; this.HiToolText.Text = "None"; this.HiToolText.OnHotkeyChanged += new System.EventHandler(this.hi_OnHotkeyChanged); @@ -778,10 +830,11 @@ private void InitializeComponent() this.hiToolNumb.ExternalConflictFlag = false; this.hiToolNumb.Hotkey = hotkey12; this.hiToolNumb.ImeMode = System.Windows.Forms.ImeMode.Disable; - this.hiToolNumb.Location = new System.Drawing.Point(601, 256); + this.hiToolNumb.Location = new System.Drawing.Point(801, 315); + this.hiToolNumb.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.hiToolNumb.Name = "hiToolNumb"; this.hiToolNumb.RequireModifier = false; - this.hiToolNumb.Size = new System.Drawing.Size(120, 20); + this.hiToolNumb.Size = new System.Drawing.Size(159, 22); this.hiToolNumb.TabIndex = 30; this.hiToolNumb.Text = "None"; this.hiToolNumb.OnHotkeyChanged += new System.EventHandler(this.hi_OnHotkeyChanged); @@ -792,10 +845,11 @@ private void InitializeComponent() this.hiToolArrow.ExternalConflictFlag = false; this.hiToolArrow.Hotkey = hotkey13; this.hiToolArrow.ImeMode = System.Windows.Forms.ImeMode.Disable; - this.hiToolArrow.Location = new System.Drawing.Point(601, 229); + this.hiToolArrow.Location = new System.Drawing.Point(801, 282); + this.hiToolArrow.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.hiToolArrow.Name = "hiToolArrow"; this.hiToolArrow.RequireModifier = false; - this.hiToolArrow.Size = new System.Drawing.Size(120, 20); + this.hiToolArrow.Size = new System.Drawing.Size(159, 22); this.hiToolArrow.TabIndex = 28; this.hiToolArrow.Text = "None"; this.hiToolArrow.OnHotkeyChanged += new System.EventHandler(this.hi_OnHotkeyChanged); @@ -806,10 +860,11 @@ private void InitializeComponent() this.hiToolOval.ExternalConflictFlag = false; this.hiToolOval.Hotkey = hotkey14; this.hiToolOval.ImeMode = System.Windows.Forms.ImeMode.Disable; - this.hiToolOval.Location = new System.Drawing.Point(601, 202); + this.hiToolOval.Location = new System.Drawing.Point(801, 249); + this.hiToolOval.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.hiToolOval.Name = "hiToolOval"; this.hiToolOval.RequireModifier = false; - this.hiToolOval.Size = new System.Drawing.Size(120, 20); + this.hiToolOval.Size = new System.Drawing.Size(159, 22); this.hiToolOval.TabIndex = 26; this.hiToolOval.Text = "None"; this.hiToolOval.OnHotkeyChanged += new System.EventHandler(this.hi_OnHotkeyChanged); @@ -820,10 +875,11 @@ private void InitializeComponent() this.hiToolRect.ExternalConflictFlag = false; this.hiToolRect.Hotkey = hotkey15; this.hiToolRect.ImeMode = System.Windows.Forms.ImeMode.Disable; - this.hiToolRect.Location = new System.Drawing.Point(601, 175); + this.hiToolRect.Location = new System.Drawing.Point(801, 215); + this.hiToolRect.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.hiToolRect.Name = "hiToolRect"; this.hiToolRect.RequireModifier = false; - this.hiToolRect.Size = new System.Drawing.Size(120, 20); + this.hiToolRect.Size = new System.Drawing.Size(159, 22); this.hiToolRect.TabIndex = 24; this.hiToolRect.Text = "None"; this.hiToolRect.OnHotkeyChanged += new System.EventHandler(this.hi_OnHotkeyChanged); @@ -834,10 +890,11 @@ private void InitializeComponent() this.hiToolLine.ExternalConflictFlag = false; this.hiToolLine.Hotkey = hotkey16; this.hiToolLine.ImeMode = System.Windows.Forms.ImeMode.Disable; - this.hiToolLine.Location = new System.Drawing.Point(601, 147); + this.hiToolLine.Location = new System.Drawing.Point(801, 181); + this.hiToolLine.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.hiToolLine.Name = "hiToolLine"; this.hiToolLine.RequireModifier = false; - this.hiToolLine.Size = new System.Drawing.Size(120, 20); + this.hiToolLine.Size = new System.Drawing.Size(159, 22); this.hiToolLine.TabIndex = 22; this.hiToolLine.Text = "None"; this.hiToolLine.OnHotkeyChanged += new System.EventHandler(this.hi_OnHotkeyChanged); @@ -848,10 +905,11 @@ private void InitializeComponent() this.hiToolHand.ExternalConflictFlag = false; this.hiToolHand.Hotkey = hotkey17; this.hiToolHand.ImeMode = System.Windows.Forms.ImeMode.Disable; - this.hiToolHand.Location = new System.Drawing.Point(601, 120); + this.hiToolHand.Location = new System.Drawing.Point(801, 148); + this.hiToolHand.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.hiToolHand.Name = "hiToolHand"; this.hiToolHand.RequireModifier = false; - this.hiToolHand.Size = new System.Drawing.Size(120, 20); + this.hiToolHand.Size = new System.Drawing.Size(159, 22); this.hiToolHand.TabIndex = 20; this.hiToolHand.Text = "None"; this.hiToolHand.OnHotkeyChanged += new System.EventHandler(this.hi_OnHotkeyChanged); @@ -862,10 +920,11 @@ private void InitializeComponent() this.hiInkVisible.ExternalConflictFlag = false; this.hiInkVisible.Hotkey = hotkey18; this.hiInkVisible.ImeMode = System.Windows.Forms.ImeMode.Disable; - this.hiInkVisible.Location = new System.Drawing.Point(340, 202); + this.hiInkVisible.Location = new System.Drawing.Point(453, 249); + this.hiInkVisible.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.hiInkVisible.Name = "hiInkVisible"; this.hiInkVisible.RequireModifier = false; - this.hiInkVisible.Size = new System.Drawing.Size(120, 20); + this.hiInkVisible.Size = new System.Drawing.Size(159, 22); this.hiInkVisible.TabIndex = 17; this.hiInkVisible.Text = "None"; this.hiInkVisible.OnHotkeyChanged += new System.EventHandler(this.hi_OnHotkeyChanged); @@ -876,10 +935,11 @@ private void InitializeComponent() this.hiSnapshot.ExternalConflictFlag = false; this.hiSnapshot.Hotkey = hotkey19; this.hiSnapshot.ImeMode = System.Windows.Forms.ImeMode.Disable; - this.hiSnapshot.Location = new System.Drawing.Point(340, 229); + this.hiSnapshot.Location = new System.Drawing.Point(453, 282); + this.hiSnapshot.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.hiSnapshot.Name = "hiSnapshot"; this.hiSnapshot.RequireModifier = false; - this.hiSnapshot.Size = new System.Drawing.Size(120, 20); + this.hiSnapshot.Size = new System.Drawing.Size(159, 22); this.hiSnapshot.TabIndex = 14; this.hiSnapshot.Text = "None"; this.hiSnapshot.OnHotkeyChanged += new System.EventHandler(this.hi_OnHotkeyChanged); @@ -890,10 +950,11 @@ private void InitializeComponent() this.hiClear.ExternalConflictFlag = false; this.hiClear.Hotkey = hotkey20; this.hiClear.ImeMode = System.Windows.Forms.ImeMode.Disable; - this.hiClear.Location = new System.Drawing.Point(340, 310); + this.hiClear.Location = new System.Drawing.Point(453, 382); + this.hiClear.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.hiClear.Name = "hiClear"; this.hiClear.RequireModifier = false; - this.hiClear.Size = new System.Drawing.Size(120, 20); + this.hiClear.Size = new System.Drawing.Size(159, 22); this.hiClear.TabIndex = 15; this.hiClear.Text = "None"; this.hiClear.OnHotkeyChanged += new System.EventHandler(this.hi_OnHotkeyChanged); @@ -904,10 +965,11 @@ private void InitializeComponent() this.hiPan.ExternalConflictFlag = false; this.hiPan.Hotkey = hotkey21; this.hiPan.ImeMode = System.Windows.Forms.ImeMode.Disable; - this.hiPan.Location = new System.Drawing.Point(340, 147); + this.hiPan.Location = new System.Drawing.Point(453, 181); + this.hiPan.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.hiPan.Name = "hiPan"; this.hiPan.RequireModifier = false; - this.hiPan.Size = new System.Drawing.Size(120, 20); + this.hiPan.Size = new System.Drawing.Size(159, 22); this.hiPan.TabIndex = 11; this.hiPan.Text = "None"; this.hiPan.OnHotkeyChanged += new System.EventHandler(this.hi_OnHotkeyChanged); @@ -918,10 +980,11 @@ private void InitializeComponent() this.hiPointer.ExternalConflictFlag = false; this.hiPointer.Hotkey = hotkey22; this.hiPointer.ImeMode = System.Windows.Forms.ImeMode.Disable; - this.hiPointer.Location = new System.Drawing.Point(340, 175); + this.hiPointer.Location = new System.Drawing.Point(453, 215); + this.hiPointer.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.hiPointer.Name = "hiPointer"; this.hiPointer.RequireModifier = false; - this.hiPointer.Size = new System.Drawing.Size(120, 20); + this.hiPointer.Size = new System.Drawing.Size(159, 22); this.hiPointer.TabIndex = 8; this.hiPointer.Text = "None"; this.hiPointer.Visible = false; @@ -933,10 +996,11 @@ private void InitializeComponent() this.hiRedo.ExternalConflictFlag = false; this.hiRedo.Hotkey = hotkey23; this.hiRedo.ImeMode = System.Windows.Forms.ImeMode.Disable; - this.hiRedo.Location = new System.Drawing.Point(340, 283); + this.hiRedo.Location = new System.Drawing.Point(453, 348); + this.hiRedo.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.hiRedo.Name = "hiRedo"; this.hiRedo.RequireModifier = false; - this.hiRedo.Size = new System.Drawing.Size(120, 20); + this.hiRedo.Size = new System.Drawing.Size(159, 22); this.hiRedo.TabIndex = 9; this.hiRedo.Text = "None"; this.hiRedo.OnHotkeyChanged += new System.EventHandler(this.hi_OnHotkeyChanged); @@ -947,10 +1011,11 @@ private void InitializeComponent() this.hiUndo.ExternalConflictFlag = false; this.hiUndo.Hotkey = hotkey24; this.hiUndo.ImeMode = System.Windows.Forms.ImeMode.Disable; - this.hiUndo.Location = new System.Drawing.Point(340, 256); + this.hiUndo.Location = new System.Drawing.Point(453, 315); + this.hiUndo.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.hiUndo.Name = "hiUndo"; this.hiUndo.RequireModifier = false; - this.hiUndo.Size = new System.Drawing.Size(120, 20); + this.hiUndo.Size = new System.Drawing.Size(159, 22); this.hiUndo.TabIndex = 5; this.hiUndo.Text = "None"; this.hiUndo.OnHotkeyChanged += new System.EventHandler(this.hi_OnHotkeyChanged); @@ -961,10 +1026,11 @@ private void InitializeComponent() this.hiEraser.ExternalConflictFlag = false; this.hiEraser.Hotkey = hotkey25; this.hiEraser.ImeMode = System.Windows.Forms.ImeMode.Disable; - this.hiEraser.Location = new System.Drawing.Point(340, 120); + this.hiEraser.Location = new System.Drawing.Point(453, 148); + this.hiEraser.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.hiEraser.Name = "hiEraser"; this.hiEraser.RequireModifier = false; - this.hiEraser.Size = new System.Drawing.Size(120, 20); + this.hiEraser.Size = new System.Drawing.Size(159, 22); this.hiEraser.TabIndex = 5; this.hiEraser.Text = "None"; this.hiEraser.OnHotkeyChanged += new System.EventHandler(this.hi_OnHotkeyChanged); @@ -975,10 +1041,11 @@ private void InitializeComponent() this.hiGlobal.ExternalConflictFlag = false; this.hiGlobal.Hotkey = hotkey26; this.hiGlobal.ImeMode = System.Windows.Forms.ImeMode.Disable; - this.hiGlobal.Location = new System.Drawing.Point(19, 39); + this.hiGlobal.Location = new System.Drawing.Point(25, 48); + this.hiGlobal.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.hiGlobal.Name = "hiGlobal"; this.hiGlobal.RequireModifier = true; - this.hiGlobal.Size = new System.Drawing.Size(120, 20); + this.hiGlobal.Size = new System.Drawing.Size(159, 22); this.hiGlobal.TabIndex = 5; this.hiGlobal.Text = "None"; this.hiGlobal.OnHotkeyChanged += new System.EventHandler(this.hi_OnHotkeyChanged); @@ -989,9 +1056,10 @@ private void InitializeComponent() // this.OptObsRecord.AutoSize = true; this.OptObsRecord.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.OptObsRecord.Location = new System.Drawing.Point(61, 53); + this.OptObsRecord.Location = new System.Drawing.Point(81, 65); + this.OptObsRecord.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.OptObsRecord.Name = "OptObsRecord"; - this.OptObsRecord.Size = new System.Drawing.Size(112, 17); + this.OptObsRecord.Size = new System.Drawing.Size(140, 21); this.OptObsRecord.TabIndex = 0; this.OptObsRecord.Tag = "1"; this.OptObsRecord.Text = "OBS Recording"; @@ -1001,9 +1069,10 @@ private void InitializeComponent() // InverseWheelCb // this.InverseWheelCb.AutoSize = true; - this.InverseWheelCb.Location = new System.Drawing.Point(43, 392); + this.InverseWheelCb.Location = new System.Drawing.Point(57, 482); + this.InverseWheelCb.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.InverseWheelCb.Name = "InverseWheelCb"; - this.InverseWheelCb.Size = new System.Drawing.Size(162, 43); + this.InverseWheelCb.Size = new System.Drawing.Size(209, 55); this.InverseWheelCb.TabIndex = 17; this.InverseWheelCb.Text = "Inverse MouseWheel control\r\nWheel = PenWidth\r\nShift+Wheel = Pen Selection"; this.InverseWheelCb.UseVisualStyleBackColor = true; @@ -1012,45 +1081,50 @@ private void InitializeComponent() // lbPens8 // this.lbPens8.AutoSize = true; - this.lbPens8.Location = new System.Drawing.Point(127, 327); + this.lbPens8.Location = new System.Drawing.Point(169, 402); + this.lbPens8.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbPens8.Name = "lbPens8"; - this.lbPens8.Size = new System.Drawing.Size(35, 13); + this.lbPens8.Size = new System.Drawing.Size(45, 17); this.lbPens8.TabIndex = 15; this.lbPens8.Text = "Pen 8"; // // lbPens7 // this.lbPens7.AutoSize = true; - this.lbPens7.Location = new System.Drawing.Point(127, 292); + this.lbPens7.Location = new System.Drawing.Point(169, 359); + this.lbPens7.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbPens7.Name = "lbPens7"; - this.lbPens7.Size = new System.Drawing.Size(35, 13); + this.lbPens7.Size = new System.Drawing.Size(45, 17); this.lbPens7.TabIndex = 14; this.lbPens7.Text = "Pen 7"; // // lbPens6 // this.lbPens6.AutoSize = true; - this.lbPens6.Location = new System.Drawing.Point(127, 257); + this.lbPens6.Location = new System.Drawing.Point(169, 316); + this.lbPens6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbPens6.Name = "lbPens6"; - this.lbPens6.Size = new System.Drawing.Size(35, 13); + this.lbPens6.Size = new System.Drawing.Size(45, 17); this.lbPens6.TabIndex = 13; this.lbPens6.Text = "Pen 6"; // // lbPens9 // this.lbPens9.AutoSize = true; - this.lbPens9.Location = new System.Drawing.Point(127, 362); + this.lbPens9.Location = new System.Drawing.Point(169, 446); + this.lbPens9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbPens9.Name = "lbPens9"; - this.lbPens9.Size = new System.Drawing.Size(35, 13); + this.lbPens9.Size = new System.Drawing.Size(45, 17); this.lbPens9.TabIndex = 16; this.lbPens9.Text = "Pen 9"; // // lbPens5 // this.lbPens5.AutoSize = true; - this.lbPens5.Location = new System.Drawing.Point(127, 222); + this.lbPens5.Location = new System.Drawing.Point(169, 273); + this.lbPens5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbPens5.Name = "lbPens5"; - this.lbPens5.Size = new System.Drawing.Size(35, 13); + this.lbPens5.Size = new System.Drawing.Size(45, 17); this.lbPens5.TabIndex = 12; this.lbPens5.Text = "Pen 5"; // @@ -1061,43 +1135,48 @@ private void InitializeComponent() // LblFfmpegNote // this.LblFfmpegNote.AutoSize = true; - this.LblFfmpegNote.Location = new System.Drawing.Point(87, 322); + this.LblFfmpegNote.Location = new System.Drawing.Point(116, 396); + this.LblFfmpegNote.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.LblFfmpegNote.Name = "LblFfmpegNote"; - this.LblFfmpegNote.Size = new System.Drawing.Size(416, 117); + this.LblFfmpegNote.Size = new System.Drawing.Size(558, 153); this.LblFfmpegNote.TabIndex = 12; this.LblFfmpegNote.Text = resources.GetString("LblFfmpegNote.Text"); // // FfmpegCmdTxt // - this.FfmpegCmdTxt.Location = new System.Drawing.Point(193, 278); + this.FfmpegCmdTxt.Location = new System.Drawing.Point(257, 342); + this.FfmpegCmdTxt.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.FfmpegCmdTxt.Name = "FfmpegCmdTxt"; - this.FfmpegCmdTxt.Size = new System.Drawing.Size(514, 20); + this.FfmpegCmdTxt.Size = new System.Drawing.Size(684, 22); this.FfmpegCmdTxt.TabIndex = 11; this.FfmpegCmdTxt.TextChanged += new System.EventHandler(this.FfmpegCmdTxt_TextChanged); // // LblFfmpegCmd // this.LblFfmpegCmd.AutoSize = true; - this.LblFfmpegCmd.Location = new System.Drawing.Point(87, 281); + this.LblFfmpegCmd.Location = new System.Drawing.Point(116, 346); + this.LblFfmpegCmd.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.LblFfmpegCmd.Name = "LblFfmpegCmd"; - this.LblFfmpegCmd.Size = new System.Drawing.Size(77, 13); + this.LblFfmpegCmd.Size = new System.Drawing.Size(102, 17); this.LblFfmpegCmd.TabIndex = 10; this.LblFfmpegCmd.Text = "Command Line"; // // WsPwdTxt // - this.WsPwdTxt.Location = new System.Drawing.Point(193, 138); + this.WsPwdTxt.Location = new System.Drawing.Point(257, 170); + this.WsPwdTxt.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.WsPwdTxt.Name = "WsPwdTxt"; - this.WsPwdTxt.Size = new System.Drawing.Size(100, 20); + this.WsPwdTxt.Size = new System.Drawing.Size(132, 22); this.WsPwdTxt.TabIndex = 9; this.WsPwdTxt.TextChanged += new System.EventHandler(this.WsPwdTxt_TextChanged); // // LblWsPwd // this.LblWsPwd.AutoSize = true; - this.LblWsPwd.Location = new System.Drawing.Point(87, 141); + this.LblWsPwd.Location = new System.Drawing.Point(116, 174); + this.LblWsPwd.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.LblWsPwd.Name = "LblWsPwd"; - this.LblWsPwd.Size = new System.Drawing.Size(53, 13); + this.LblWsPwd.Size = new System.Drawing.Size(69, 17); this.LblWsPwd.TabIndex = 8; this.LblWsPwd.Text = "Password"; // @@ -1106,9 +1185,10 @@ private void InitializeComponent() this.OptNoVideo.AutoSize = true; this.OptNoVideo.Checked = true; this.OptNoVideo.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.OptNoVideo.Location = new System.Drawing.Point(61, 17); + this.OptNoVideo.Location = new System.Drawing.Point(81, 21); + this.OptNoVideo.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.OptNoVideo.Name = "OptNoVideo"; - this.OptNoVideo.Size = new System.Drawing.Size(139, 17); + this.OptNoVideo.Size = new System.Drawing.Size(174, 21); this.OptNoVideo.TabIndex = 7; this.OptNoVideo.TabStop = true; this.OptNoVideo.Tag = "0"; @@ -1119,26 +1199,29 @@ private void InitializeComponent() // LblObsNote // this.LblObsNote.AutoSize = true; - this.LblObsNote.Location = new System.Drawing.Point(58, 173); + this.LblObsNote.Location = new System.Drawing.Point(77, 213); + this.LblObsNote.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.LblObsNote.Name = "LblObsNote"; - this.LblObsNote.Size = new System.Drawing.Size(431, 26); + this.LblObsNote.Size = new System.Drawing.Size(571, 34); this.LblObsNote.TabIndex = 6; this.LblObsNote.Text = "Note : OBS should be started before starting record\r\n OBS should be in" + "stalled with Websocket plugin,with port and password configured"; // // WsUrlTxt // - this.WsUrlTxt.Location = new System.Drawing.Point(193, 112); + this.WsUrlTxt.Location = new System.Drawing.Point(257, 138); + this.WsUrlTxt.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.WsUrlTxt.Name = "WsUrlTxt"; - this.WsUrlTxt.Size = new System.Drawing.Size(70, 20); + this.WsUrlTxt.Size = new System.Drawing.Size(92, 22); this.WsUrlTxt.TabIndex = 5; // // LblWsUrl // this.LblWsUrl.AutoSize = true; - this.LblWsUrl.Location = new System.Drawing.Point(87, 115); + this.LblWsUrl.Location = new System.Drawing.Point(116, 142); + this.LblWsUrl.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.LblWsUrl.Name = "LblWsUrl"; - this.LblWsUrl.Size = new System.Drawing.Size(89, 13); + this.LblWsUrl.Size = new System.Drawing.Size(112, 17); this.LblWsUrl.TabIndex = 3; this.LblWsUrl.Text = "WebSocket URL"; // @@ -1146,9 +1229,10 @@ private void InitializeComponent() // this.OptFfmpeg.AutoSize = true; this.OptFfmpeg.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.OptFfmpeg.Location = new System.Drawing.Point(61, 241); + this.OptFfmpeg.Location = new System.Drawing.Point(81, 297); + this.OptFfmpeg.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.OptFfmpeg.Name = "OptFfmpeg"; - this.OptFfmpeg.Size = new System.Drawing.Size(131, 17); + this.OptFfmpeg.Size = new System.Drawing.Size(165, 21); this.OptFfmpeg.TabIndex = 2; this.OptFfmpeg.Tag = "3"; this.OptFfmpeg.Text = "FFmpeg Recording"; @@ -1159,9 +1243,10 @@ private void InitializeComponent() // this.OptObsBcast.AutoSize = true; this.OptObsBcast.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.OptObsBcast.Location = new System.Drawing.Point(61, 76); + this.OptObsBcast.Location = new System.Drawing.Point(81, 94); + this.OptObsBcast.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.OptObsBcast.Name = "OptObsBcast"; - this.OptObsBcast.Size = new System.Drawing.Size(128, 17); + this.OptObsBcast.Size = new System.Drawing.Size(161, 21); this.OptObsBcast.TabIndex = 1; this.OptObsBcast.Tag = "2"; this.OptObsBcast.Text = "OBS Broadcasting"; @@ -1182,10 +1267,11 @@ private void InitializeComponent() this.VideoTab.Controls.Add(this.OptFfmpeg); this.VideoTab.Controls.Add(this.OptObsBcast); this.VideoTab.Controls.Add(this.OptObsRecord); - this.VideoTab.Location = new System.Drawing.Point(4, 22); + this.VideoTab.Location = new System.Drawing.Point(4, 25); + this.VideoTab.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.VideoTab.Name = "VideoTab"; - this.VideoTab.Padding = new System.Windows.Forms.Padding(3); - this.VideoTab.Size = new System.Drawing.Size(756, 473); + this.VideoTab.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.VideoTab.Size = new System.Drawing.Size(1011, 585); this.VideoTab.TabIndex = 3; this.VideoTab.Text = "Video"; this.VideoTab.UseVisualStyleBackColor = true; @@ -1193,9 +1279,10 @@ private void InitializeComponent() // lbPens2 // this.lbPens2.AutoSize = true; - this.lbPens2.Location = new System.Drawing.Point(127, 117); + this.lbPens2.Location = new System.Drawing.Point(169, 144); + this.lbPens2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbPens2.Name = "lbPens2"; - this.lbPens2.Size = new System.Drawing.Size(35, 13); + this.lbPens2.Size = new System.Drawing.Size(45, 17); this.lbPens2.TabIndex = 9; this.lbPens2.Text = "Pen 2"; // @@ -1209,36 +1296,40 @@ private void InitializeComponent() "1 - Magnifier", "2 - Frozen Area", "3 - Both"}); - this.ZoomEnabledCb.Location = new System.Drawing.Point(221, 78); + this.ZoomEnabledCb.Location = new System.Drawing.Point(295, 96); + this.ZoomEnabledCb.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.ZoomEnabledCb.Name = "ZoomEnabledCb"; - this.ZoomEnabledCb.Size = new System.Drawing.Size(33, 21); + this.ZoomEnabledCb.Size = new System.Drawing.Size(43, 24); this.ZoomEnabledCb.TabIndex = 48; this.ZoomEnabledCb.SelectedIndexChanged += new System.EventHandler(this.ZoomEnabledCb_SelectedIndexChanged); // // ZoomScaleLbl // this.ZoomScaleLbl.AutoSize = true; - this.ZoomScaleLbl.Location = new System.Drawing.Point(6, 42); + this.ZoomScaleLbl.Location = new System.Drawing.Point(8, 52); + this.ZoomScaleLbl.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.ZoomScaleLbl.Name = "ZoomScaleLbl"; - this.ZoomScaleLbl.Size = new System.Drawing.Size(34, 13); + this.ZoomScaleLbl.Size = new System.Drawing.Size(43, 17); this.ZoomScaleLbl.TabIndex = 6; this.ZoomScaleLbl.Text = "Scale"; // // ZoomDimLbl // this.ZoomDimLbl.AutoSize = true; - this.ZoomDimLbl.Location = new System.Drawing.Point(6, 16); + this.ZoomDimLbl.Location = new System.Drawing.Point(8, 20); + this.ZoomDimLbl.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.ZoomDimLbl.Name = "ZoomDimLbl"; - this.ZoomDimLbl.Size = new System.Drawing.Size(28, 13); + this.ZoomDimLbl.Size = new System.Drawing.Size(36, 17); this.ZoomDimLbl.TabIndex = 5; this.ZoomDimLbl.Text = "Dim."; // // ZoomContinousCb // this.ZoomContinousCb.AutoSize = true; - this.ZoomContinousCb.Location = new System.Drawing.Point(107, 42); + this.ZoomContinousCb.Location = new System.Drawing.Point(143, 52); + this.ZoomContinousCb.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.ZoomContinousCb.Name = "ZoomContinousCb"; - this.ZoomContinousCb.Size = new System.Drawing.Size(73, 17); + this.ZoomContinousCb.Size = new System.Drawing.Size(93, 21); this.ZoomContinousCb.TabIndex = 4; this.ZoomContinousCb.Text = "Continous"; this.ZoomContinousCb.UseVisualStyleBackColor = true; @@ -1247,34 +1338,38 @@ private void InitializeComponent() // // ZoomScaleEd // - this.ZoomScaleEd.Location = new System.Drawing.Point(64, 39); + this.ZoomScaleEd.Location = new System.Drawing.Point(85, 48); + this.ZoomScaleEd.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.ZoomScaleEd.Name = "ZoomScaleEd"; - this.ZoomScaleEd.Size = new System.Drawing.Size(34, 20); + this.ZoomScaleEd.Size = new System.Drawing.Size(44, 22); this.ZoomScaleEd.TabIndex = 3; this.ZoomScaleEd.Validating += new System.ComponentModel.CancelEventHandler(this.ZoomScaleEd_Validating); // // ZoomHeightEd // - this.ZoomHeightEd.Location = new System.Drawing.Point(122, 14); + this.ZoomHeightEd.Location = new System.Drawing.Point(163, 17); + this.ZoomHeightEd.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.ZoomHeightEd.Name = "ZoomHeightEd"; - this.ZoomHeightEd.Size = new System.Drawing.Size(52, 20); + this.ZoomHeightEd.Size = new System.Drawing.Size(68, 22); this.ZoomHeightEd.TabIndex = 2; this.ZoomHeightEd.Validating += new System.ComponentModel.CancelEventHandler(this.ZoomHeightEd_Validating); // // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(104, 21); + this.label1.Location = new System.Drawing.Point(139, 26); + this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(12, 13); + this.label1.Size = new System.Drawing.Size(14, 17); this.label1.TabIndex = 1; this.label1.Text = "x"; // // ZoomWidthEd // - this.ZoomWidthEd.Location = new System.Drawing.Point(46, 14); + this.ZoomWidthEd.Location = new System.Drawing.Point(61, 17); + this.ZoomWidthEd.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.ZoomWidthEd.Name = "ZoomWidthEd"; - this.ZoomWidthEd.Size = new System.Drawing.Size(52, 20); + this.ZoomWidthEd.Size = new System.Drawing.Size(68, 22); this.ZoomWidthEd.TabIndex = 0; this.ZoomWidthEd.Validating += new System.ComponentModel.CancelEventHandler(this.ZoomWidthEd_Validating); // @@ -1287,9 +1382,11 @@ private void InitializeComponent() this.ZoomBox.Controls.Add(this.ZoomHeightEd); this.ZoomBox.Controls.Add(this.label1); this.ZoomBox.Controls.Add(this.ZoomWidthEd); - this.ZoomBox.Location = new System.Drawing.Point(458, 352); + this.ZoomBox.Location = new System.Drawing.Point(611, 433); + this.ZoomBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.ZoomBox.Name = "ZoomBox"; - this.ZoomBox.Size = new System.Drawing.Size(195, 62); + this.ZoomBox.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.ZoomBox.Size = new System.Drawing.Size(260, 76); this.ZoomBox.TabIndex = 46; this.ZoomBox.TabStop = false; this.ZoomBox.Text = "Zoom"; @@ -1298,9 +1395,10 @@ private void InitializeComponent() // this.ToolbarOrientationBtn.BackgroundImage = global::gInk.Properties.Resources.toolbar2Left; this.ToolbarOrientationBtn.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.ToolbarOrientationBtn.Location = new System.Drawing.Point(8, 77); + this.ToolbarOrientationBtn.Location = new System.Drawing.Point(11, 95); + this.ToolbarOrientationBtn.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.ToolbarOrientationBtn.Name = "ToolbarOrientationBtn"; - this.ToolbarOrientationBtn.Size = new System.Drawing.Size(52, 52); + this.ToolbarOrientationBtn.Size = new System.Drawing.Size(69, 64); this.ToolbarOrientationBtn.TabIndex = 45; this.ToolbarOrientationBtn.UseVisualStyleBackColor = true; this.ToolbarOrientationBtn.Click += new System.EventHandler(this.ToolbarOrientationBtn_Click); @@ -1308,9 +1406,10 @@ private void InitializeComponent() // cbLoadSaveEnabled // this.cbLoadSaveEnabled.AutoSize = true; - this.cbLoadSaveEnabled.Location = new System.Drawing.Point(495, 81); + this.cbLoadSaveEnabled.Location = new System.Drawing.Point(660, 100); + this.cbLoadSaveEnabled.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.cbLoadSaveEnabled.Name = "cbLoadSaveEnabled"; - this.cbLoadSaveEnabled.Size = new System.Drawing.Size(15, 14); + this.cbLoadSaveEnabled.Size = new System.Drawing.Size(18, 17); this.cbLoadSaveEnabled.TabIndex = 44; this.cbLoadSaveEnabled.UseVisualStyleBackColor = true; this.cbLoadSaveEnabled.CheckedChanged += new System.EventHandler(this.cbLoadSaveEnabled_CheckedChanged); @@ -1318,17 +1417,19 @@ private void InitializeComponent() // DefTagLbl // this.DefTagLbl.AutoSize = true; - this.DefTagLbl.Location = new System.Drawing.Point(455, 276); + this.DefTagLbl.Location = new System.Drawing.Point(607, 340); + this.DefTagLbl.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.DefTagLbl.Name = "DefTagLbl"; - this.DefTagLbl.Size = new System.Drawing.Size(65, 13); + this.DefTagLbl.Size = new System.Drawing.Size(84, 17); this.DefTagLbl.TabIndex = 43; this.DefTagLbl.Text = "Default Text"; // // TagFontBtn // - this.TagFontBtn.Location = new System.Drawing.Point(646, 271); + this.TagFontBtn.Location = new System.Drawing.Point(861, 334); + this.TagFontBtn.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.TagFontBtn.Name = "TagFontBtn"; - this.TagFontBtn.Size = new System.Drawing.Size(111, 23); + this.TagFontBtn.Size = new System.Drawing.Size(148, 28); this.TagFontBtn.TabIndex = 42; this.TagFontBtn.Text = "Select &Font && Size"; this.TagFontBtn.UseVisualStyleBackColor = true; @@ -1340,9 +1441,10 @@ private void InitializeComponent() this.Clip3Btn.BackgroundImage = global::gInk.Properties.Resources.tool_mlines; this.Clip3Btn.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.Clip3Btn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.Clip3Btn.Location = new System.Drawing.Point(118, 48); + this.Clip3Btn.Location = new System.Drawing.Point(157, 59); + this.Clip3Btn.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.Clip3Btn.Name = "Clip3Btn"; - this.Clip3Btn.Size = new System.Drawing.Size(26, 26); + this.Clip3Btn.Size = new System.Drawing.Size(35, 32); this.Clip3Btn.TabIndex = 41; this.Clip3Btn.Tag = "3"; this.Clip3Btn.UseVisualStyleBackColor = false; @@ -1356,9 +1458,10 @@ private void InitializeComponent() this.Clip2Btn.FlatAppearance.BorderColor = System.Drawing.Color.Black; this.Clip2Btn.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Aqua; this.Clip2Btn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.Clip2Btn.Location = new System.Drawing.Point(118, 22); + this.Clip2Btn.Location = new System.Drawing.Point(157, 27); + this.Clip2Btn.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.Clip2Btn.Name = "Clip2Btn"; - this.Clip2Btn.Size = new System.Drawing.Size(26, 26); + this.Clip2Btn.Size = new System.Drawing.Size(35, 32); this.Clip2Btn.TabIndex = 40; this.Clip2Btn.Tag = "2"; this.Clip2Btn.UseVisualStyleBackColor = false; @@ -1370,9 +1473,10 @@ private void InitializeComponent() this.Clip1Btn.BackgroundImage = global::gInk.Properties.Resources.tool_mlines; this.Clip1Btn.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.Clip1Btn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.Clip1Btn.Location = new System.Drawing.Point(93, 48); + this.Clip1Btn.Location = new System.Drawing.Point(124, 59); + this.Clip1Btn.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.Clip1Btn.Name = "Clip1Btn"; - this.Clip1Btn.Size = new System.Drawing.Size(26, 26); + this.Clip1Btn.Size = new System.Drawing.Size(35, 32); this.Clip1Btn.TabIndex = 39; this.Clip1Btn.Tag = "1"; this.Clip1Btn.UseVisualStyleBackColor = false; @@ -1380,9 +1484,10 @@ private void InitializeComponent() // // ClipartsSelBtn // - this.ClipartsSelBtn.Location = new System.Drawing.Point(96, 77); + this.ClipartsSelBtn.Location = new System.Drawing.Point(128, 95); + this.ClipartsSelBtn.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.ClipartsSelBtn.Name = "ClipartsSelBtn"; - this.ClipartsSelBtn.Size = new System.Drawing.Size(48, 23); + this.ClipartsSelBtn.Size = new System.Drawing.Size(64, 28); this.ClipartsSelBtn.TabIndex = 38; this.ClipartsSelBtn.Text = "cliparts"; this.ClipartsSelBtn.UseVisualStyleBackColor = true; @@ -1391,9 +1496,10 @@ private void InitializeComponent() // AltTabActivateCb // this.AltTabActivateCb.AutoSize = true; - this.AltTabActivateCb.Location = new System.Drawing.Point(458, 328); + this.AltTabActivateCb.Location = new System.Drawing.Point(611, 404); + this.AltTabActivateCb.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.AltTabActivateCb.Name = "AltTabActivateCb"; - this.AltTabActivateCb.Size = new System.Drawing.Size(230, 17); + this.AltTabActivateCb.Size = new System.Drawing.Size(302, 21); this.AltTabActivateCb.TabIndex = 37; this.AltTabActivateCb.Text = "Engage Pointer and Auto-Fold with Alt+Tab"; this.AltTabActivateCb.UseVisualStyleBackColor = true; @@ -1402,9 +1508,10 @@ private void InitializeComponent() // ToolBarColorLbl // this.ToolBarColorLbl.AutoSize = true; - this.ToolBarColorLbl.Location = new System.Drawing.Point(8, 6); + this.ToolBarColorLbl.Location = new System.Drawing.Point(11, 7); + this.ToolBarColorLbl.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.ToolBarColorLbl.Name = "ToolBarColorLbl"; - this.ToolBarColorLbl.Size = new System.Drawing.Size(209, 13); + this.ToolBarColorLbl.Size = new System.Drawing.Size(276, 17); this.ToolBarColorLbl.TabIndex = 36; this.ToolBarColorLbl.Text = "Click on toolbar to select background color"; // @@ -1415,9 +1522,11 @@ private void InitializeComponent() this.BoardBx.Controls.Add(this.BoardCustColorLbl); this.BoardBx.Controls.Add(this.panel2); this.BoardBx.Controls.Add(this.BoardAtOpenLbl); - this.BoardBx.Location = new System.Drawing.Point(49, 312); + this.BoardBx.Location = new System.Drawing.Point(65, 384); + this.BoardBx.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.BoardBx.Name = "BoardBx"; - this.BoardBx.Size = new System.Drawing.Size(361, 74); + this.BoardBx.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.BoardBx.Size = new System.Drawing.Size(481, 91); this.BoardBx.TabIndex = 35; this.BoardBx.TabStop = false; this.BoardBx.Text = "Board background"; @@ -1432,18 +1541,20 @@ private void InitializeComponent() "Customed", "Black", "Last Selected"}); - this.BoardAtOpenCombo.Location = new System.Drawing.Point(214, 14); + this.BoardAtOpenCombo.Location = new System.Drawing.Point(285, 17); + this.BoardAtOpenCombo.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.BoardAtOpenCombo.Name = "BoardAtOpenCombo"; - this.BoardAtOpenCombo.Size = new System.Drawing.Size(132, 21); + this.BoardAtOpenCombo.Size = new System.Drawing.Size(175, 24); this.BoardAtOpenCombo.TabIndex = 38; this.BoardAtOpenCombo.SelectedIndexChanged += new System.EventHandler(this.BoardAtOpenCombo_SelectedIndexChanged); // // BoardCustColorLbl // this.BoardCustColorLbl.AutoSize = true; - this.BoardCustColorLbl.Location = new System.Drawing.Point(7, 50); + this.BoardCustColorLbl.Location = new System.Drawing.Point(9, 62); + this.BoardCustColorLbl.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.BoardCustColorLbl.Name = "BoardCustColorLbl"; - this.BoardCustColorLbl.Size = new System.Drawing.Size(35, 13); + this.BoardCustColorLbl.Size = new System.Drawing.Size(46, 17); this.BoardCustColorLbl.TabIndex = 37; this.BoardCustColorLbl.Text = "label1"; // @@ -1451,26 +1562,29 @@ private void InitializeComponent() // this.panel2.BackgroundImage = global::gInk.Properties.Resources.cellbackground; this.panel2.Controls.Add(this.BoardCustColorPnl); - this.panel2.Location = new System.Drawing.Point(214, 45); + this.panel2.Location = new System.Drawing.Point(285, 55); + this.panel2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(132, 26); + this.panel2.Size = new System.Drawing.Size(176, 32); this.panel2.TabIndex = 36; // // BoardCustColorPnl // this.BoardCustColorPnl.BackColor = System.Drawing.SystemColors.Highlight; this.BoardCustColorPnl.Location = new System.Drawing.Point(0, 0); + this.BoardCustColorPnl.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.BoardCustColorPnl.Name = "BoardCustColorPnl"; - this.BoardCustColorPnl.Size = new System.Drawing.Size(132, 26); + this.BoardCustColorPnl.Size = new System.Drawing.Size(176, 32); this.BoardCustColorPnl.TabIndex = 0; this.BoardCustColorPnl.Click += new System.EventHandler(this.BoardCustColorPnl_Click); // // BoardAtOpenLbl // this.BoardAtOpenLbl.AutoSize = true; - this.BoardAtOpenLbl.Location = new System.Drawing.Point(7, 22); + this.BoardAtOpenLbl.Location = new System.Drawing.Point(9, 27); + this.BoardAtOpenLbl.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.BoardAtOpenLbl.Name = "BoardAtOpenLbl"; - this.BoardAtOpenLbl.Size = new System.Drawing.Size(46, 13); + this.BoardAtOpenLbl.Size = new System.Drawing.Size(60, 17); this.BoardAtOpenLbl.TabIndex = 34; this.BoardAtOpenLbl.Text = "At Open"; // @@ -1481,18 +1595,20 @@ private void InitializeComponent() this.comboCanvasCursor.Items.AddRange(new object[] { "Arrow", "Pen tip"}); - this.comboCanvasCursor.Location = new System.Drawing.Point(559, 126); + this.comboCanvasCursor.Location = new System.Drawing.Point(745, 155); + this.comboCanvasCursor.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.comboCanvasCursor.Name = "comboCanvasCursor"; - this.comboCanvasCursor.Size = new System.Drawing.Size(198, 21); + this.comboCanvasCursor.Size = new System.Drawing.Size(263, 24); this.comboCanvasCursor.TabIndex = 6; this.comboCanvasCursor.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged); // // cbEraserEnabled // this.cbEraserEnabled.AutoSize = true; - this.cbEraserEnabled.Location = new System.Drawing.Point(160, 81); + this.cbEraserEnabled.Location = new System.Drawing.Point(213, 100); + this.cbEraserEnabled.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.cbEraserEnabled.Name = "cbEraserEnabled"; - this.cbEraserEnabled.Size = new System.Drawing.Size(15, 14); + this.cbEraserEnabled.Size = new System.Drawing.Size(18, 17); this.cbEraserEnabled.TabIndex = 0; this.cbEraserEnabled.UseVisualStyleBackColor = true; this.cbEraserEnabled.CheckedChanged += new System.EventHandler(this.cbEraserEnabled_CheckedChanged); @@ -1500,18 +1616,20 @@ private void InitializeComponent() // lbCanvascursor // this.lbCanvascursor.AutoSize = true; - this.lbCanvascursor.Location = new System.Drawing.Point(455, 129); + this.lbCanvascursor.Location = new System.Drawing.Point(607, 159); + this.lbCanvascursor.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbCanvascursor.Name = "lbCanvascursor"; - this.lbCanvascursor.Size = new System.Drawing.Size(75, 13); + this.lbCanvascursor.Size = new System.Drawing.Size(99, 17); this.lbCanvascursor.TabIndex = 5; this.lbCanvascursor.Text = "Canvas cursor"; // // cbWidthEnabled // this.cbWidthEnabled.AutoSize = true; - this.cbWidthEnabled.Location = new System.Drawing.Point(298, 81); + this.cbWidthEnabled.Location = new System.Drawing.Point(397, 100); + this.cbWidthEnabled.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.cbWidthEnabled.Name = "cbWidthEnabled"; - this.cbWidthEnabled.Size = new System.Drawing.Size(15, 14); + this.cbWidthEnabled.Size = new System.Drawing.Size(18, 17); this.cbWidthEnabled.TabIndex = 0; this.cbWidthEnabled.UseVisualStyleBackColor = true; this.cbWidthEnabled.CheckedChanged += new System.EventHandler(this.cbWidthEnabled_CheckedChanged); @@ -1519,28 +1637,30 @@ private void InitializeComponent() // lbNote // this.lbNote.AutoSize = true; - this.lbNote.Location = new System.Drawing.Point(46, 410); + this.lbNote.Location = new System.Drawing.Point(61, 505); + this.lbNote.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbNote.Name = "lbNote"; - this.lbNote.Size = new System.Drawing.Size(316, 13); + this.lbNote.Size = new System.Drawing.Size(418, 17); this.lbNote.TabIndex = 4; this.lbNote.Text = "Note: pen width panel overides each individual pen width settings"; // // cbPointerEnabled // this.cbPointerEnabled.AutoSize = true; - this.cbPointerEnabled.Location = new System.Drawing.Point(263, 81); + this.cbPointerEnabled.Location = new System.Drawing.Point(351, 100); + this.cbPointerEnabled.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.cbPointerEnabled.Name = "cbPointerEnabled"; - this.cbPointerEnabled.Size = new System.Drawing.Size(15, 14); + this.cbPointerEnabled.Size = new System.Drawing.Size(18, 17); this.cbPointerEnabled.TabIndex = 0; this.cbPointerEnabled.UseVisualStyleBackColor = true; this.cbPointerEnabled.CheckedChanged += new System.EventHandler(this.cbPointerEnabled_CheckedChanged); // // btSnapPath // - this.btSnapPath.Location = new System.Drawing.Point(387, 169); - this.btSnapPath.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); + this.btSnapPath.Location = new System.Drawing.Point(516, 208); + this.btSnapPath.Margin = new System.Windows.Forms.Padding(0, 4, 0, 4); this.btSnapPath.Name = "btSnapPath"; - this.btSnapPath.Size = new System.Drawing.Size(23, 23); + this.btSnapPath.Size = new System.Drawing.Size(31, 28); this.btSnapPath.TabIndex = 3; this.btSnapPath.Text = "..."; this.btSnapPath.UseVisualStyleBackColor = true; @@ -1549,9 +1669,10 @@ private void InitializeComponent() // cbSnapEnabled // this.cbSnapEnabled.AutoSize = true; - this.cbSnapEnabled.Location = new System.Drawing.Point(380, 81); + this.cbSnapEnabled.Location = new System.Drawing.Point(507, 100); + this.cbSnapEnabled.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.cbSnapEnabled.Name = "cbSnapEnabled"; - this.cbSnapEnabled.Size = new System.Drawing.Size(15, 14); + this.cbSnapEnabled.Size = new System.Drawing.Size(18, 17); this.cbSnapEnabled.TabIndex = 0; this.cbSnapEnabled.UseVisualStyleBackColor = true; this.cbSnapEnabled.CheckedChanged += new System.EventHandler(this.cbSnapEnabled_CheckedChanged); @@ -1559,9 +1680,10 @@ private void InitializeComponent() // cbUndoEnabled // this.cbUndoEnabled.AutoSize = true; - this.cbUndoEnabled.Location = new System.Drawing.Point(424, 81); + this.cbUndoEnabled.Location = new System.Drawing.Point(565, 100); + this.cbUndoEnabled.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.cbUndoEnabled.Name = "cbUndoEnabled"; - this.cbUndoEnabled.Size = new System.Drawing.Size(15, 14); + this.cbUndoEnabled.Size = new System.Drawing.Size(18, 17); this.cbUndoEnabled.TabIndex = 0; this.cbUndoEnabled.UseVisualStyleBackColor = true; this.cbUndoEnabled.CheckedChanged += new System.EventHandler(this.cbUndoEnabled_CheckedChanged); @@ -1569,9 +1691,10 @@ private void InitializeComponent() // cbClearEnabled // this.cbClearEnabled.AutoSize = true; - this.cbClearEnabled.Location = new System.Drawing.Point(463, 81); + this.cbClearEnabled.Location = new System.Drawing.Point(617, 100); + this.cbClearEnabled.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.cbClearEnabled.Name = "cbClearEnabled"; - this.cbClearEnabled.Size = new System.Drawing.Size(15, 14); + this.cbClearEnabled.Size = new System.Drawing.Size(18, 17); this.cbClearEnabled.TabIndex = 0; this.cbClearEnabled.UseVisualStyleBackColor = true; this.cbClearEnabled.CheckedChanged += new System.EventHandler(this.cbClearEnabled_CheckedChanged); @@ -1579,18 +1702,20 @@ private void InitializeComponent() // lbSnapshotsavepath // this.lbSnapshotsavepath.AutoSize = true; - this.lbSnapshotsavepath.Location = new System.Drawing.Point(46, 174); + this.lbSnapshotsavepath.Location = new System.Drawing.Point(61, 214); + this.lbSnapshotsavepath.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbSnapshotsavepath.Name = "lbSnapshotsavepath"; - this.lbSnapshotsavepath.Size = new System.Drawing.Size(102, 13); + this.lbSnapshotsavepath.Size = new System.Drawing.Size(134, 17); this.lbSnapshotsavepath.TabIndex = 2; this.lbSnapshotsavepath.Text = "Snapshot save path"; // // cbWhiteIcon // this.cbWhiteIcon.AutoSize = true; - this.cbWhiteIcon.Location = new System.Drawing.Point(458, 214); + this.cbWhiteIcon.Location = new System.Drawing.Point(611, 263); + this.cbWhiteIcon.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.cbWhiteIcon.Name = "cbWhiteIcon"; - this.cbWhiteIcon.Size = new System.Drawing.Size(116, 17); + this.cbWhiteIcon.Size = new System.Drawing.Size(149, 21); this.cbWhiteIcon.TabIndex = 0; this.cbWhiteIcon.Text = "Use white tray icon"; this.cbWhiteIcon.UseVisualStyleBackColor = true; @@ -1598,9 +1723,10 @@ private void InitializeComponent() // // tbSnapPath // - this.tbSnapPath.Location = new System.Drawing.Point(178, 170); + this.tbSnapPath.Location = new System.Drawing.Point(237, 209); + this.tbSnapPath.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.tbSnapPath.Name = "tbSnapPath"; - this.tbSnapPath.Size = new System.Drawing.Size(205, 20); + this.tbSnapPath.Size = new System.Drawing.Size(272, 22); this.tbSnapPath.TabIndex = 1; this.tbSnapPath.ModifiedChanged += new System.EventHandler(this.tbSnapPath_ModifiedChanged); // @@ -1653,10 +1779,10 @@ private void InitializeComponent() this.tabPage1.Controls.Add(this.cbWhiteIcon); this.tabPage1.Controls.Add(this.tbSnapPath); this.tabPage1.Controls.Add(this.lblToolbarHeight); - this.tabPage1.Location = new System.Drawing.Point(4, 22); + this.tabPage1.Location = new System.Drawing.Point(4, 25); this.tabPage1.Margin = new System.Windows.Forms.Padding(0); this.tabPage1.Name = "tabPage1"; - this.tabPage1.Size = new System.Drawing.Size(756, 473); + this.tabPage1.Size = new System.Drawing.Size(1011, 585); this.tabPage1.TabIndex = 0; this.tabPage1.Text = "General"; // @@ -1667,18 +1793,21 @@ private void InitializeComponent() this.ArrwGrp.Controls.Add(this.ArrHdLength); this.ArrwGrp.Controls.Add(this.ArrHdLenLbl); this.ArrwGrp.Controls.Add(this.DefArrStartCb); - this.ArrwGrp.Location = new System.Drawing.Point(47, 235); + this.ArrwGrp.Location = new System.Drawing.Point(63, 289); + this.ArrwGrp.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.ArrwGrp.Name = "ArrwGrp"; - this.ArrwGrp.Size = new System.Drawing.Size(363, 71); + this.ArrwGrp.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.ArrwGrp.Size = new System.Drawing.Size(484, 87); this.ArrwGrp.TabIndex = 30; this.ArrwGrp.TabStop = false; this.ArrwGrp.Text = "Arrow Head"; // // ArrHdAperture // - this.ArrHdAperture.Location = new System.Drawing.Point(72, 19); + this.ArrHdAperture.Location = new System.Drawing.Point(96, 23); + this.ArrHdAperture.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.ArrHdAperture.Name = "ArrHdAperture"; - this.ArrHdAperture.Size = new System.Drawing.Size(37, 20); + this.ArrHdAperture.Size = new System.Drawing.Size(48, 22); this.ArrHdAperture.TabIndex = 13; this.ArrHdAperture.Text = "12.1"; this.ArrHdAperture.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ValidateOnEnter); @@ -1688,17 +1817,19 @@ private void InitializeComponent() // ArrHdAptLbl // this.ArrHdAptLbl.AutoSize = true; - this.ArrHdAptLbl.Location = new System.Drawing.Point(9, 22); + this.ArrHdAptLbl.Location = new System.Drawing.Point(12, 27); + this.ArrHdAptLbl.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.ArrHdAptLbl.Name = "ArrHdAptLbl"; - this.ArrHdAptLbl.Size = new System.Drawing.Size(57, 13); + this.ArrHdAptLbl.Size = new System.Drawing.Size(79, 17); this.ArrHdAptLbl.TabIndex = 12; this.ArrHdAptLbl.Text = "Aperture(°)"; // // ArrHdLength // - this.ArrHdLength.Location = new System.Drawing.Point(289, 19); + this.ArrHdLength.Location = new System.Drawing.Point(385, 23); + this.ArrHdLength.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.ArrHdLength.Name = "ArrHdLength"; - this.ArrHdLength.Size = new System.Drawing.Size(52, 20); + this.ArrHdLength.Size = new System.Drawing.Size(68, 22); this.ArrHdLength.TabIndex = 15; this.ArrHdLength.Text = "0.123456"; this.ArrHdLength.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ValidateOnEnter); @@ -1708,18 +1839,20 @@ private void InitializeComponent() // ArrHdLenLbl // this.ArrHdLenLbl.AutoSize = true; - this.ArrHdLenLbl.Location = new System.Drawing.Point(203, 22); + this.ArrHdLenLbl.Location = new System.Drawing.Point(271, 27); + this.ArrHdLenLbl.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.ArrHdLenLbl.Name = "ArrHdLenLbl"; - this.ArrHdLenLbl.Size = new System.Drawing.Size(70, 13); + this.ArrHdLenLbl.Size = new System.Drawing.Size(95, 17); this.ArrHdLenLbl.TabIndex = 14; this.ArrHdLenLbl.Text = "Length(%Scr)"; // // DefArrStartCb // this.DefArrStartCb.AutoSize = true; - this.DefArrStartCb.Location = new System.Drawing.Point(6, 46); + this.DefArrStartCb.Location = new System.Drawing.Point(8, 57); + this.DefArrStartCb.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.DefArrStartCb.Name = "DefArrStartCb"; - this.DefArrStartCb.Size = new System.Drawing.Size(156, 17); + this.DefArrStartCb.Size = new System.Drawing.Size(203, 21); this.DefArrStartCb.TabIndex = 22; this.DefArrStartCb.Text = "Default Arrow Head at Start"; this.DefArrStartCb.UseVisualStyleBackColor = true; @@ -1729,9 +1862,10 @@ private void InitializeComponent() // this.MoveToolBarCb.AutoSize = true; this.MoveToolBarCb.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; - this.MoveToolBarCb.Location = new System.Drawing.Point(742, 6); + this.MoveToolBarCb.Location = new System.Drawing.Point(989, 7); + this.MoveToolBarCb.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.MoveToolBarCb.Name = "MoveToolBarCb"; - this.MoveToolBarCb.Size = new System.Drawing.Size(15, 14); + this.MoveToolBarCb.Size = new System.Drawing.Size(18, 17); this.MoveToolBarCb.TabIndex = 29; this.MoveToolBarCb.UseVisualStyleBackColor = true; this.MoveToolBarCb.Visible = false; @@ -1740,9 +1874,10 @@ private void InitializeComponent() // ToolBarHeight // this.ToolBarHeight.AcceptsReturn = true; - this.ToolBarHeight.Location = new System.Drawing.Point(580, 36); + this.ToolBarHeight.Location = new System.Drawing.Point(773, 44); + this.ToolBarHeight.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.ToolBarHeight.Name = "ToolBarHeight"; - this.ToolBarHeight.Size = new System.Drawing.Size(52, 20); + this.ToolBarHeight.Size = new System.Drawing.Size(68, 22); this.ToolBarHeight.TabIndex = 27; this.ToolBarHeight.Text = "0.123456"; this.ToolBarHeight.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ValidateOnEnter); @@ -1753,17 +1888,19 @@ private void InitializeComponent() // this.panel1.BackgroundImage = global::gInk.Properties.Resources.DblHeadArrowVert; this.panel1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.panel1.Location = new System.Drawing.Point(555, 22); + this.panel1.Location = new System.Drawing.Point(740, 27); + this.panel1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(19, 53); + this.panel1.Size = new System.Drawing.Size(25, 65); this.panel1.TabIndex = 26; // // OpenIntoSnapCb // this.OpenIntoSnapCb.AutoSize = true; - this.OpenIntoSnapCb.Location = new System.Drawing.Point(458, 175); + this.OpenIntoSnapCb.Location = new System.Drawing.Point(611, 215); + this.OpenIntoSnapCb.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.OpenIntoSnapCb.Name = "OpenIntoSnapCb"; - this.OpenIntoSnapCb.Size = new System.Drawing.Size(299, 17); + this.OpenIntoSnapCb.Size = new System.Drawing.Size(400, 21); this.OpenIntoSnapCb.TabIndex = 25; this.OpenIntoSnapCb.Text = "Start Snapshot Capture immediately after Opening Toolbar"; this.OpenIntoSnapCb.UseVisualStyleBackColor = true; @@ -1771,9 +1908,10 @@ private void InitializeComponent() // // Magnet_TB // - this.Magnet_TB.Location = new System.Drawing.Point(690, 303); + this.Magnet_TB.Location = new System.Drawing.Point(920, 373); + this.Magnet_TB.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.Magnet_TB.Name = "Magnet_TB"; - this.Magnet_TB.Size = new System.Drawing.Size(67, 20); + this.Magnet_TB.Size = new System.Drawing.Size(88, 22); this.Magnet_TB.TabIndex = 21; this.Magnet_TB.Text = "0.123456"; this.Magnet_TB.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ValidateOnEnter); @@ -1783,18 +1921,20 @@ private void InitializeComponent() // MagnetLbl // this.MagnetLbl.AutoSize = true; - this.MagnetLbl.Location = new System.Drawing.Point(455, 305); + this.MagnetLbl.Location = new System.Drawing.Point(607, 375); + this.MagnetLbl.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.MagnetLbl.Name = "MagnetLbl"; - this.MagnetLbl.Size = new System.Drawing.Size(190, 13); + this.MagnetLbl.Size = new System.Drawing.Size(258, 17); this.MagnetLbl.TabIndex = 20; this.MagnetLbl.Text = "Magnetic radius(%Scr) (<=0 = disabled)"; // // ShowFloatingWinCb // this.ShowFloatingWinCb.AutoSize = true; - this.ShowFloatingWinCb.Location = new System.Drawing.Point(49, 212); + this.ShowFloatingWinCb.Location = new System.Drawing.Point(65, 261); + this.ShowFloatingWinCb.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.ShowFloatingWinCb.Name = "ShowFloatingWinCb"; - this.ShowFloatingWinCb.Size = new System.Drawing.Size(208, 17); + this.ShowFloatingWinCb.Size = new System.Drawing.Size(272, 21); this.ShowFloatingWinCb.TabIndex = 19; this.ShowFloatingWinCb.Text = "Show Floating Window (at next restart)"; this.ShowFloatingWinCb.UseVisualStyleBackColor = true; @@ -1803,17 +1943,19 @@ private void InitializeComponent() // DefTxtLbl // this.DefTxtLbl.AutoSize = true; - this.DefTxtLbl.Location = new System.Drawing.Point(455, 247); + this.DefTxtLbl.Location = new System.Drawing.Point(607, 304); + this.DefTxtLbl.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.DefTxtLbl.Name = "DefTxtLbl"; - this.DefTxtLbl.Size = new System.Drawing.Size(65, 13); + this.DefTxtLbl.Size = new System.Drawing.Size(84, 17); this.DefTxtLbl.TabIndex = 18; this.DefTxtLbl.Text = "Default Text"; // // SaveConfigBtn // - this.SaveConfigBtn.Location = new System.Drawing.Point(659, 377); + this.SaveConfigBtn.Location = new System.Drawing.Point(879, 464); + this.SaveConfigBtn.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.SaveConfigBtn.Name = "SaveConfigBtn"; - this.SaveConfigBtn.Size = new System.Drawing.Size(98, 46); + this.SaveConfigBtn.Size = new System.Drawing.Size(131, 57); this.SaveConfigBtn.TabIndex = 17; this.SaveConfigBtn.Text = "Save Config To Files"; this.SaveConfigBtn.UseVisualStyleBackColor = true; @@ -1821,9 +1963,10 @@ private void InitializeComponent() // // DefaultFontBtn // - this.DefaultFontBtn.Location = new System.Drawing.Point(646, 242); + this.DefaultFontBtn.Location = new System.Drawing.Point(861, 298); + this.DefaultFontBtn.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.DefaultFontBtn.Name = "DefaultFontBtn"; - this.DefaultFontBtn.Size = new System.Drawing.Size(111, 23); + this.DefaultFontBtn.Size = new System.Drawing.Size(148, 28); this.DefaultFontBtn.TabIndex = 16; this.DefaultFontBtn.Text = "Select &Font && Size"; this.DefaultFontBtn.UseVisualStyleBackColor = true; @@ -1831,9 +1974,10 @@ private void InitializeComponent() // // SaveWindowPosBtn // - this.SaveWindowPosBtn.Location = new System.Drawing.Point(263, 207); + this.SaveWindowPosBtn.Location = new System.Drawing.Point(351, 255); + this.SaveWindowPosBtn.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.SaveWindowPosBtn.Name = "SaveWindowPosBtn"; - this.SaveWindowPosBtn.Size = new System.Drawing.Size(147, 24); + this.SaveWindowPosBtn.Size = new System.Drawing.Size(196, 30); this.SaveWindowPosBtn.TabIndex = 10; this.SaveWindowPosBtn.Text = "Save Floating &window Pos"; this.SaveWindowPosBtn.UseVisualStyleBackColor = true; @@ -1842,9 +1986,10 @@ private void InitializeComponent() // cbToolsEnabled // this.cbToolsEnabled.AutoSize = true; - this.cbToolsEnabled.Location = new System.Drawing.Point(76, 81); + this.cbToolsEnabled.Location = new System.Drawing.Point(101, 100); + this.cbToolsEnabled.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.cbToolsEnabled.Name = "cbToolsEnabled"; - this.cbToolsEnabled.Size = new System.Drawing.Size(15, 14); + this.cbToolsEnabled.Size = new System.Drawing.Size(18, 17); this.cbToolsEnabled.TabIndex = 9; this.cbToolsEnabled.UseVisualStyleBackColor = true; this.cbToolsEnabled.CheckedChanged += new System.EventHandler(this.cbToolsEnabled_CheckedChanged); @@ -1852,9 +1997,10 @@ private void InitializeComponent() // lbLanguage // this.lbLanguage.AutoSize = true; - this.lbLanguage.Location = new System.Drawing.Point(73, 129); + this.lbLanguage.Location = new System.Drawing.Point(97, 159); + this.lbLanguage.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbLanguage.Name = "lbLanguage"; - this.lbLanguage.Size = new System.Drawing.Size(55, 13); + this.lbLanguage.Size = new System.Drawing.Size(72, 17); this.lbLanguage.TabIndex = 8; this.lbLanguage.Text = "Language"; // @@ -1863,9 +2009,10 @@ private void InitializeComponent() this.ToolbarDwg.BackColor = System.Drawing.SystemColors.Highlight; this.ToolbarDwg.BackgroundImage = global::gInk.Properties.Resources.paneloption; this.ToolbarDwg.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.ToolbarDwg.Location = new System.Drawing.Point(8, 22); + this.ToolbarDwg.Location = new System.Drawing.Point(11, 27); + this.ToolbarDwg.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.ToolbarDwg.Name = "ToolbarDwg"; - this.ToolbarDwg.Size = new System.Drawing.Size(541, 53); + this.ToolbarDwg.Size = new System.Drawing.Size(721, 65); this.ToolbarDwg.TabIndex = 7; this.ToolbarDwg.TabStop = false; this.ToolbarDwg.Click += new System.EventHandler(this.ToolbarDwg_Click); @@ -1874,18 +2021,20 @@ private void InitializeComponent() // this.comboLanguage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboLanguage.FormattingEnabled = true; - this.comboLanguage.Location = new System.Drawing.Point(178, 129); + this.comboLanguage.Location = new System.Drawing.Point(237, 159); + this.comboLanguage.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.comboLanguage.Name = "comboLanguage"; - this.comboLanguage.Size = new System.Drawing.Size(232, 21); + this.comboLanguage.Size = new System.Drawing.Size(308, 24); this.comboLanguage.TabIndex = 6; this.comboLanguage.SelectedIndexChanged += new System.EventHandler(this.comboLanguage_SelectedIndexChanged); // // cbInkVisibleEnabled // this.cbInkVisibleEnabled.AutoSize = true; - this.cbInkVisibleEnabled.Location = new System.Drawing.Point(338, 81); + this.cbInkVisibleEnabled.Location = new System.Drawing.Point(451, 100); + this.cbInkVisibleEnabled.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.cbInkVisibleEnabled.Name = "cbInkVisibleEnabled"; - this.cbInkVisibleEnabled.Size = new System.Drawing.Size(15, 14); + this.cbInkVisibleEnabled.Size = new System.Drawing.Size(18, 17); this.cbInkVisibleEnabled.TabIndex = 0; this.cbInkVisibleEnabled.UseVisualStyleBackColor = true; this.cbInkVisibleEnabled.CheckedChanged += new System.EventHandler(this.cbInkVisibleEnabled_CheckedChanged); @@ -1893,9 +2042,10 @@ private void InitializeComponent() // cbPanEnabled // this.cbPanEnabled.AutoSize = true; - this.cbPanEnabled.Location = new System.Drawing.Point(194, 81); + this.cbPanEnabled.Location = new System.Drawing.Point(259, 100); + this.cbPanEnabled.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.cbPanEnabled.Name = "cbPanEnabled"; - this.cbPanEnabled.Size = new System.Drawing.Size(15, 14); + this.cbPanEnabled.Size = new System.Drawing.Size(18, 17); this.cbPanEnabled.TabIndex = 0; this.cbPanEnabled.UseVisualStyleBackColor = true; this.cbPanEnabled.CheckedChanged += new System.EventHandler(this.cbPanEnabled_CheckedChanged); @@ -1903,9 +2053,10 @@ private void InitializeComponent() // cbAllowDragging // this.cbAllowDragging.AutoSize = true; - this.cbAllowDragging.Location = new System.Drawing.Point(557, 83); + this.cbAllowDragging.Location = new System.Drawing.Point(743, 102); + this.cbAllowDragging.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.cbAllowDragging.Name = "cbAllowDragging"; - this.cbAllowDragging.Size = new System.Drawing.Size(198, 17); + this.cbAllowDragging.Size = new System.Drawing.Size(264, 21); this.cbAllowDragging.TabIndex = 0; this.cbAllowDragging.Text = "Allow dragging toolbar (experimental)"; this.cbAllowDragging.UseVisualStyleBackColor = true; @@ -1914,9 +2065,10 @@ private void InitializeComponent() // lblToolbarHeight // this.lblToolbarHeight.AutoSize = true; - this.lblToolbarHeight.Location = new System.Drawing.Point(577, 22); + this.lblToolbarHeight.Location = new System.Drawing.Point(769, 27); + this.lblToolbarHeight.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lblToolbarHeight.Name = "lblToolbarHeight"; - this.lblToolbarHeight.Size = new System.Drawing.Size(159, 52); + this.lblToolbarHeight.Size = new System.Drawing.Size(213, 68); this.lblToolbarHeight.TabIndex = 28; this.lblToolbarHeight.Text = "height(%scr) Movable\r\n\r\n\r\nchanges after closing toolbar"; // @@ -1932,12 +2084,13 @@ private void InitializeComponent() this.VideoTabCtrl.Controls.Add(this.tabPage2); this.VideoTabCtrl.Controls.Add(this.tabPage3); this.VideoTabCtrl.Controls.Add(this.VideoTab); - this.VideoTabCtrl.Location = new System.Drawing.Point(9, 9); + this.VideoTabCtrl.Controls.Add(this.tabPageExtra); + this.VideoTabCtrl.Location = new System.Drawing.Point(12, 11); this.VideoTabCtrl.Margin = new System.Windows.Forms.Padding(0); this.VideoTabCtrl.Name = "VideoTabCtrl"; this.VideoTabCtrl.Padding = new System.Drawing.Point(0, 0); this.VideoTabCtrl.SelectedIndex = 0; - this.VideoTabCtrl.Size = new System.Drawing.Size(764, 499); + this.VideoTabCtrl.Size = new System.Drawing.Size(1019, 614); this.VideoTabCtrl.TabIndex = 8; // // tabPage2 @@ -1961,103 +2114,145 @@ private void InitializeComponent() this.tabPage2.Controls.Add(this.lbcbPens); this.tabPage2.Controls.Add(this.FadingTimeEd); this.tabPage2.Controls.Add(this.WidthAtPenSelCb); - this.tabPage2.Location = new System.Drawing.Point(4, 22); + this.tabPage2.Location = new System.Drawing.Point(4, 25); + this.tabPage2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.tabPage2.Name = "tabPage2"; - this.tabPage2.Padding = new System.Windows.Forms.Padding(3); - this.tabPage2.Size = new System.Drawing.Size(756, 473); + this.tabPage2.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.tabPage2.Size = new System.Drawing.Size(1011, 585); this.tabPage2.TabIndex = 1; this.tabPage2.Text = "Pens"; // // lbPens1 // this.lbPens1.AutoSize = true; - this.lbPens1.Location = new System.Drawing.Point(127, 82); + this.lbPens1.Location = new System.Drawing.Point(169, 101); + this.lbPens1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbPens1.Name = "lbPens1"; - this.lbPens1.Size = new System.Drawing.Size(35, 13); + this.lbPens1.Size = new System.Drawing.Size(45, 17); this.lbPens1.TabIndex = 8; this.lbPens1.Text = "Pen 1"; // // lbPens0 // this.lbPens0.AutoSize = true; - this.lbPens0.Location = new System.Drawing.Point(127, 47); + this.lbPens0.Location = new System.Drawing.Point(169, 58); + this.lbPens0.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbPens0.Name = "lbPens0"; - this.lbPens0.Size = new System.Drawing.Size(35, 13); + this.lbPens0.Size = new System.Drawing.Size(45, 17); this.lbPens0.TabIndex = 7; this.lbPens0.Text = "Pen 0"; // // lbcomboPensFading // this.lbcomboPensFading.AutoSize = true; - this.lbcomboPensFading.Location = new System.Drawing.Point(596, 18); + this.lbcomboPensFading.Location = new System.Drawing.Point(795, 22); + this.lbcomboPensFading.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbcomboPensFading.Name = "lbcomboPensFading"; - this.lbcomboPensFading.Size = new System.Drawing.Size(92, 13); + this.lbcomboPensFading.Size = new System.Drawing.Size(124, 17); this.lbcomboPensFading.TabIndex = 6; this.lbcomboPensFading.Text = "Fading(after...sec)"; // // lbcomboPensWidth // this.lbcomboPensWidth.AutoSize = true; - this.lbcomboPensWidth.Location = new System.Drawing.Point(441, 18); + this.lbcomboPensWidth.Location = new System.Drawing.Point(588, 22); + this.lbcomboPensWidth.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbcomboPensWidth.Name = "lbcomboPensWidth"; - this.lbcomboPensWidth.Size = new System.Drawing.Size(35, 13); + this.lbcomboPensWidth.Size = new System.Drawing.Size(44, 17); this.lbcomboPensWidth.TabIndex = 5; this.lbcomboPensWidth.Text = "Width"; // // lbcomboPensAlpha // this.lbcomboPensAlpha.AutoSize = true; - this.lbcomboPensAlpha.Location = new System.Drawing.Point(300, 18); + this.lbcomboPensAlpha.Location = new System.Drawing.Point(400, 22); + this.lbcomboPensAlpha.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbcomboPensAlpha.Name = "lbcomboPensAlpha"; - this.lbcomboPensAlpha.Size = new System.Drawing.Size(34, 13); + this.lbcomboPensAlpha.Size = new System.Drawing.Size(44, 17); this.lbcomboPensAlpha.TabIndex = 4; this.lbcomboPensAlpha.Text = "Alpha"; // // lbpboxPens // this.lbpboxPens.AutoSize = true; - this.lbpboxPens.Location = new System.Drawing.Point(219, 18); + this.lbpboxPens.Location = new System.Drawing.Point(292, 22); + this.lbpboxPens.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbpboxPens.Name = "lbpboxPens"; - this.lbpboxPens.Size = new System.Drawing.Size(31, 13); + this.lbpboxPens.Size = new System.Drawing.Size(41, 17); this.lbpboxPens.TabIndex = 3; this.lbpboxPens.Text = "Color"; // // lbcbPens // this.lbcbPens.AutoSize = true; - this.lbcbPens.Location = new System.Drawing.Point(40, 18); + this.lbcbPens.Location = new System.Drawing.Point(53, 22); + this.lbcbPens.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbcbPens.Name = "lbcbPens"; - this.lbcbPens.Size = new System.Drawing.Size(34, 13); + this.lbcbPens.Size = new System.Drawing.Size(42, 17); this.lbcbPens.TabIndex = 2; this.lbcbPens.Text = "Show"; // // FadingTimeEd // - this.FadingTimeEd.Location = new System.Drawing.Point(694, 15); + this.FadingTimeEd.Location = new System.Drawing.Point(925, 18); + this.FadingTimeEd.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.FadingTimeEd.Name = "FadingTimeEd"; - this.FadingTimeEd.Size = new System.Drawing.Size(37, 20); + this.FadingTimeEd.Size = new System.Drawing.Size(48, 22); this.FadingTimeEd.TabIndex = 1; this.FadingTimeEd.Validating += new System.ComponentModel.CancelEventHandler(this.FadingTimeEd_Validating); // // WidthAtPenSelCb // this.WidthAtPenSelCb.AutoSize = true; - this.WidthAtPenSelCb.Location = new System.Drawing.Point(392, 398); + this.WidthAtPenSelCb.Location = new System.Drawing.Point(523, 490); + this.WidthAtPenSelCb.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.WidthAtPenSelCb.Name = "WidthAtPenSelCb"; - this.WidthAtPenSelCb.Size = new System.Drawing.Size(167, 30); + this.WidthAtPenSelCb.Size = new System.Drawing.Size(216, 38); this.WidthAtPenSelCb.TabIndex = 0; this.WidthAtPenSelCb.Text = "Apply Width on Pen Selection\r\n(even with width selector)"; this.WidthAtPenSelCb.UseVisualStyleBackColor = true; this.WidthAtPenSelCb.CheckedChanged += new System.EventHandler(this.WidthAtPenSelCb_CheckedChanged); // + // tabPageExtra + // + this.tabPageExtra.Controls.Add(this.panel3); + this.tabPageExtra.Location = new System.Drawing.Point(4, 25); + this.tabPageExtra.Name = "tabPageExtra"; + this.tabPageExtra.Size = new System.Drawing.Size(1011, 585); + this.tabPageExtra.TabIndex = 4; + this.tabPageExtra.Text = "Extra Configuration"; + this.tabPageExtra.UseVisualStyleBackColor = true; + // + // panel3 + // + this.panel3.Controls.Add(this.checkBoxCleanCanvas); + this.panel3.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel3.Location = new System.Drawing.Point(0, 0); + this.panel3.Name = "panel3"; + this.panel3.Size = new System.Drawing.Size(1011, 585); + this.panel3.TabIndex = 0; + // + // checkBoxCleanCanvas + // + this.checkBoxCleanCanvas.AutoSize = true; + this.checkBoxCleanCanvas.Location = new System.Drawing.Point(25, 22); + this.checkBoxCleanCanvas.Margin = new System.Windows.Forms.Padding(4); + this.checkBoxCleanCanvas.Name = "checkBoxCleanCanvas"; + this.checkBoxCleanCanvas.Size = new System.Drawing.Size(241, 21); + this.checkBoxCleanCanvas.TabIndex = 1; + this.checkBoxCleanCanvas.Text = "Clean Canvas After Hiding Cursor"; + this.checkBoxCleanCanvas.UseVisualStyleBackColor = true; + this.checkBoxCleanCanvas.CheckedChanged += new System.EventHandler(this.checkBoxCleanCanvas_CheckedChanged); + // // FormOptions // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.ControlLightLight; - this.ClientSize = new System.Drawing.Size(773, 508); + this.ClientSize = new System.Drawing.Size(1031, 625); this.Controls.Add(this.VideoTabCtrl); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.MaximizeBox = false; this.Name = "FormOptions"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; @@ -2084,6 +2279,9 @@ private void InitializeComponent() this.VideoTabCtrl.ResumeLayout(false); this.tabPage2.ResumeLayout(false); this.tabPage2.PerformLayout(); + this.tabPageExtra.ResumeLayout(false); + this.panel3.ResumeLayout(false); + this.panel3.PerformLayout(); this.ResumeLayout(false); } @@ -2250,5 +2448,8 @@ private void InitializeComponent() private System.Windows.Forms.ComboBox SnapInPointerTwiceCb; private System.Windows.Forms.ComboBox SnapInPointerHoldCb; private System.Windows.Forms.Label SnapInPointerLbl; + private System.Windows.Forms.TabPage tabPageExtra; + private System.Windows.Forms.Panel panel3; + private System.Windows.Forms.CheckBox checkBoxCleanCanvas; } } diff --git a/src/FormOptions.cs b/src/FormOptions.cs index c1dc7cca..cb66b93a 100644 --- a/src/FormOptions.cs +++ b/src/FormOptions.cs @@ -9,33 +9,33 @@ using System.Windows.Forms; namespace gInk -{ - public partial class FormOptions : Form - { - public Root Root; - - Label[] lbPens = new Label[10]; - CheckBox[] cbPens = new CheckBox[10]; - PictureBox[] pboxPens = new PictureBox[10]; - ComboBox[] comboPensAlpha = new ComboBox[10]; - ComboBox[] comboPensWidth = new ComboBox[10]; - CheckBox[] comboPensFading = new CheckBox[10]; - //Label lbcbPens, lbpboxPens, lbcomboPensAlpha, lbcomboPensWidth, lbcomboPensFading; - - Label[] lbHotkeyPens = new Label[10]; - HotkeyInputBox[] hiPens = new HotkeyInputBox[10]; +{ + public partial class FormOptions : Form + { + public Root Root; + + Label[] lbPens = new Label[10]; + CheckBox[] cbPens = new CheckBox[10]; + PictureBox[] pboxPens = new PictureBox[10]; + ComboBox[] comboPensAlpha = new ComboBox[10]; + ComboBox[] comboPensWidth = new ComboBox[10]; + CheckBox[] comboPensFading = new CheckBox[10]; + //Label lbcbPens, lbpboxPens, lbcomboPensAlpha, lbcomboPensWidth, lbcomboPensFading; + + Label[] lbHotkeyPens = new Label[10]; + HotkeyInputBox[] hiPens = new HotkeyInputBox[10]; Bitmap[] ToolBarOrientationIcons = { gInk.Properties.Resources.toolbar2Left, gInk.Properties.Resources.toolbar2Right, gInk.Properties.Resources.toolbar2Up, gInk.Properties.Resources.toolbar2Down }; - public FormOptions(Root root) - { - Root = root; - InitializeComponent(); - } - - private void FormOptions_Load(object sender, EventArgs e) - { + public FormOptions(Root root) + { + Root = root; + InitializeComponent(); + } + + private void FormOptions_Load(object sender, EventArgs e) + { //Root.UnsetHotkey(); ToolbarDwg.BackColor = Color.FromArgb(Root.ToolbarBGColor[0], Root.ToolbarBGColor[1], Root.ToolbarBGColor[2], Root.ToolbarBGColor[3]); ToolbarOrientationBtn.BackgroundImage = ToolBarOrientationIcons[Root.ToolbarOrientation]; @@ -46,39 +46,39 @@ private void FormOptions_Load(object sender, EventArgs e) Clip3Btn.BackColor = ToolbarDwg.BackColor; Clip3Btn.BackgroundImage = FormCollection.getImgFromDiskOrRes(Root.ImageStamp3); - if (Root.EraserEnabled) - cbEraserEnabled.Checked = true; - if (Root.PointerEnabled) - cbPointerEnabled.Checked = true; - if (Root.SnapEnabled) - cbSnapEnabled.Checked = true; - if (Root.UndoEnabled) - cbUndoEnabled.Checked = true; - if (Root.ClearEnabled) - cbClearEnabled.Checked = true; + if (Root.EraserEnabled) + cbEraserEnabled.Checked = true; + if (Root.PointerEnabled) + cbPointerEnabled.Checked = true; + if (Root.SnapEnabled) + cbSnapEnabled.Checked = true; + if (Root.UndoEnabled) + cbUndoEnabled.Checked = true; + if (Root.ClearEnabled) + cbClearEnabled.Checked = true; WidthAtPenSelCb.Checked = Root.WidthAtPenSel; cbWidthEnabled.Checked = Root.PenWidthEnabled; - if (Root.PanEnabled) - cbPanEnabled.Checked = true; - if (Root.InkVisibleEnabled) - cbInkVisibleEnabled.Checked = true; + if (Root.PanEnabled) + cbPanEnabled.Checked = true; + if (Root.InkVisibleEnabled) + cbInkVisibleEnabled.Checked = true; if (Root.ToolsEnabled) cbToolsEnabled.Checked = true; - if (Root.WhiteTrayIcon) - cbWhiteIcon.Checked = true; - if (Root.AllowDraggingToolbar) - cbAllowDragging.Checked = true; - if (Root.AllowHotkeyInPointerMode) - cbAllowHotkeyInPointer.Checked = true; + if (Root.WhiteTrayIcon) + cbWhiteIcon.Checked = true; + if (Root.AllowDraggingToolbar) + cbAllowDragging.Checked = true; + if (Root.AllowHotkeyInPointerMode) + cbAllowHotkeyInPointer.Checked = true; cbLoadSaveEnabled.Checked = Root.LoadSaveEnabled; AltTabActivateCb.Checked = Root.AltTabPointer; - ToolBarHeight.Text = string.Format("{0:F1}", Root.ToolbarHeight * 100); - //MoveToolBarCb.Checked = Root.AllowDraggingToolbar; - - comboCanvasCursor.SelectedIndex = Root.CanvasCursor; + ToolBarHeight.Text = string.Format("{0:F1}", Root.ToolbarHeight * 100); + //MoveToolBarCb.Checked = Root.AllowDraggingToolbar; + + comboCanvasCursor.SelectedIndex = Root.CanvasCursor; BoardAtOpenCombo.SelectedIndex = Root.BoardAtOpening; BoardCustColorPnl.BackColor = Color.FromArgb(Root.Gray1[0], Root.Gray1[1], Root.Gray1[2], Root.Gray1[3]); @@ -87,8 +87,8 @@ private void FormOptions_Load(object sender, EventArgs e) tbSnapPath.Text = Root.SnapshotBasePath; this.OpenIntoSnapCb.Checked = Root.OpenIntoSnapMode; ShowFloatingWinCb.Checked = Root.FormOpacity > 0; - ArrHdAperture.Text = (Root.ArrowAngle * 180.0 / Math.PI).ToString("#0",CultureInfo.InvariantCulture); - ArrHdLength.Text = (Root.ArrowLen / System.Windows.SystemParameters.PrimaryScreenWidth *100.0).ToString("#0.0000",CultureInfo.InvariantCulture); + ArrHdAperture.Text = (Root.ArrowAngle * 180.0 / Math.PI).ToString("#0", CultureInfo.InvariantCulture); + ArrHdLength.Text = (Root.ArrowLen / System.Windows.SystemParameters.PrimaryScreenWidth * 100.0).ToString("#0.0000", CultureInfo.InvariantCulture); Magnet_TB.Text = (Root.MagneticRadius / System.Windows.SystemParameters.PrimaryScreenWidth * 100.0).ToString("#0.0000", CultureInfo.InvariantCulture); DefArrStartCb.Checked = Root.DefaultArrow_start; @@ -135,46 +135,46 @@ private void FormOptions_Load(object sender, EventArgs e) lbPens[0] = lbPens0; lbPens[1] = lbPens1; lbPens[2] = lbPens2; lbPens[3] = lbPens3; lbPens[4] = lbPens4; lbPens[5] = lbPens5; lbPens[6] = lbPens6; lbPens[7] = lbPens7; lbPens[8] = lbPens8; lbPens[9] = lbPens9; - for (int p = 0; p < Root.MaxPenCount; p++) - { - //int top = p * (int)(this.Height * 0.075) + (int)(this.Height * 0.09); - int top = lbPens0.Top + p * (lbPens1.Top-lbPens0.Top); + for (int p = 0; p < Root.MaxPenCount; p++) + { + //int top = p * (int)(this.Height * 0.075) + (int)(this.Height * 0.09); + int top = lbPens0.Top + p * (lbPens1.Top - lbPens0.Top); /*lbPens[p] = new Label(); lbPens[p].Left = (int)(this.Width / 500.0 * 60); lbPens[p].Width = 80; - lbPens[p].Top = top;*/ - - cbPens[p] = new CheckBox(); - cbPens[p].Left = (int)(this.Width / 500.0 * 30); - cbPens[p].Width = 25; - cbPens[p].Top = top - 5; - cbPens[p].Text = ""; - cbPens[p].Checked = Root.PenEnabled[p]; - cbPens[p].CheckedChanged += cbPens_CheckedChanged; - - pboxPens[p] = new PictureBox(); - pboxPens[p].Left = (int)(this.Width / 500.0 * 130); - pboxPens[p].Top = top; - pboxPens[p].Width = 15; - pboxPens[p].Height = 15; - pboxPens[p].BackColor = Root.PenAttr[p].Color; - pboxPens[p].Click += pboxPens_Click; - - comboPensAlpha[p] = new ComboBox(); - - comboPensAlpha[p].Left = (int)(this.Width / 500.0 * 180); - comboPensAlpha[p].Top = top - 2; - comboPensAlpha[p].Width = 80; - comboPensAlpha[p].Text = (255 - Root.PenAttr[p].Transparency).ToString(); - comboPensAlpha[p].TextChanged += comboPensAlpha_TextChanged; - - comboPensWidth[p] = new ComboBox(); - - comboPensWidth[p].Left = (int)(this.Width / 500.0 * 270); - comboPensWidth[p].Top = top - 2; - comboPensWidth[p].Width = 80; - comboPensWidth[p].Text = ((int)Root.PenAttr[p].Width).ToString(); - comboPensWidth[p].TextChanged += comboPensWidth_TextChanged; + lbPens[p].Top = top;*/ + + cbPens[p] = new CheckBox(); + cbPens[p].Left = (int)(this.Width / 500.0 * 30); + cbPens[p].Width = 25; + cbPens[p].Top = top - 5; + cbPens[p].Text = ""; + cbPens[p].Checked = Root.PenEnabled[p]; + cbPens[p].CheckedChanged += cbPens_CheckedChanged; + + pboxPens[p] = new PictureBox(); + pboxPens[p].Left = (int)(this.Width / 500.0 * 130); + pboxPens[p].Top = top; + pboxPens[p].Width = 15; + pboxPens[p].Height = 15; + pboxPens[p].BackColor = Root.PenAttr[p].Color; + pboxPens[p].Click += pboxPens_Click; + + comboPensAlpha[p] = new ComboBox(); + + comboPensAlpha[p].Left = (int)(this.Width / 500.0 * 180); + comboPensAlpha[p].Top = top - 2; + comboPensAlpha[p].Width = 80; + comboPensAlpha[p].Text = (255 - Root.PenAttr[p].Transparency).ToString(); + comboPensAlpha[p].TextChanged += comboPensAlpha_TextChanged; + + comboPensWidth[p] = new ComboBox(); + + comboPensWidth[p].Left = (int)(this.Width / 500.0 * 270); + comboPensWidth[p].Top = top - 2; + comboPensWidth[p].Width = 80; + comboPensWidth[p].Text = ((int)Root.PenAttr[p].Width).ToString(); + comboPensWidth[p].TextChanged += comboPensWidth_TextChanged; comboPensFading[p] = new CheckBox(); @@ -184,52 +184,52 @@ private void FormOptions_Load(object sender, EventArgs e) comboPensFading[p].Checked = Root.PenAttr[p].ExtendedProperties.Contains(Root.FADING_PEN); comboPensFading[p].CheckedChanged += comboPensFading_Changed; - tabPage2.Controls.Add(lbPens[p]); - tabPage2.Controls.Add(cbPens[p]); - tabPage2.Controls.Add(pboxPens[p]); - tabPage2.Controls.Add(comboPensAlpha[p]); - tabPage2.Controls.Add(comboPensWidth[p]); + tabPage2.Controls.Add(lbPens[p]); + tabPage2.Controls.Add(cbPens[p]); + tabPage2.Controls.Add(pboxPens[p]); + tabPage2.Controls.Add(comboPensAlpha[p]); + tabPage2.Controls.Add(comboPensWidth[p]); tabPage2.Controls.Add(comboPensFading[p]); } FadingTimeEd.Text = Root.TimeBeforeFading.ToString(); InverseWheelCb.Checked = Root.InverseMousewheel; - cbAllowHotkeyInPointer.Top = (int)(this.Height * 0.18); - - for (int p = 0; p < Root.MaxPenCount; p++) - { - int top = p * (int)(this.Height * 0.055) + (int)(this.Height * 0.24); - lbHotkeyPens[p] = new Label(); - lbHotkeyPens[p].Left = 20; - lbHotkeyPens[p].Width = 80; - lbHotkeyPens[p].Top = top; - - hiPens[p] = new HotkeyInputBox(); - hiPens[p].Hotkey = Root.Hotkey_Pens[p]; - hiPens[p].Left = 100; - hiPens[p].Width = 120; - hiPens[p].Top = top; - hiPens[p].OnHotkeyChanged += hi_OnHotkeyChanged; - - tabPage3.Controls.Add(lbHotkeyPens[p]); - tabPage3.Controls.Add(hiPens[p]); - } + cbAllowHotkeyInPointer.Top = (int)(this.Height * 0.18); + + for (int p = 0; p < Root.MaxPenCount; p++) + { + int top = p * (int)(this.Height * 0.055) + (int)(this.Height * 0.24); + lbHotkeyPens[p] = new Label(); + lbHotkeyPens[p].Left = 20; + lbHotkeyPens[p].Width = 80; + lbHotkeyPens[p].Top = top; + + hiPens[p] = new HotkeyInputBox(); + hiPens[p].Hotkey = Root.Hotkey_Pens[p]; + hiPens[p].Left = 100; + hiPens[p].Width = 120; + hiPens[p].Top = top; + hiPens[p].OnHotkeyChanged += hi_OnHotkeyChanged; + + tabPage3.Controls.Add(lbHotkeyPens[p]); + tabPage3.Controls.Add(hiPens[p]); + } AltAsOneCommandCb.Checked = Root.AltAsOneCommand; SnapInPointerHoldCb.SelectedIndex = (int)(Root.SnapInPointerHoldKey); SnapInPointerTwiceCb.SelectedIndex = (int)(Root.SnapInPointerPressTwiceKey); - hiGlobal.Hotkey = Root.Hotkey_Global; - hiEraser.Hotkey = Root.Hotkey_Eraser; - hiPan.Hotkey = Root.Hotkey_Pan; - hiInkVisible.Hotkey = Root.Hotkey_InkVisible; - hiPointer.Hotkey = Root.Hotkey_Pointer; - hiSnapshot.Hotkey = Root.Hotkey_Snap; - hiUndo.Hotkey = Root.Hotkey_Undo; - hiRedo.Hotkey = Root.Hotkey_Redo; - hiClear.Hotkey = Root.Hotkey_Clear; + hiGlobal.Hotkey = Root.Hotkey_Global; + hiEraser.Hotkey = Root.Hotkey_Eraser; + hiPan.Hotkey = Root.Hotkey_Pan; + hiInkVisible.Hotkey = Root.Hotkey_InkVisible; + hiPointer.Hotkey = Root.Hotkey_Pointer; + hiSnapshot.Hotkey = Root.Hotkey_Snap; + hiUndo.Hotkey = Root.Hotkey_Undo; + hiRedo.Hotkey = Root.Hotkey_Redo; + hiClear.Hotkey = Root.Hotkey_Clear; hiVideo.Hotkey = Root.Hotkey_Video; hiDockUndock.Hotkey = Root.Hotkey_DockUndock; hiClose.Hotkey = Root.Hotkey_Close; @@ -252,9 +252,9 @@ private void FormOptions_Load(object sender, EventArgs e) WsUrlTxt.Text = Root.ObsUrl; WsPwdTxt.Text = Root.ObsPwd; FfmpegCmdTxt.Text = Root.FFMpegCmd; - switch(Root.VideoRecordMode) + switch (Root.VideoRecordMode) { - case VideoRecordMode.NoVideo : + case VideoRecordMode.NoVideo: OptNoVideo.Checked = true; break; case VideoRecordMode.OBSRec: @@ -267,33 +267,34 @@ private void FormOptions_Load(object sender, EventArgs e) OptFfmpeg.Checked = true; break; default: - throw new System.Exception(String.Format("unk video recording mode", Root.VideoRecordMode)); + throw new System.Exception(string.Format("unk video recording mode", Root.VideoRecordMode)); } - FormOptions_LocalReload(); - } - - private void FormOptions_LocalReload() - { string shortTxt(string sin) + FormOptions_LocalReload(); + } + + private void FormOptions_LocalReload() + { + string shortTxt(string sin) { int i = sin.IndexOf("("); if (i < 0) i = sin.Length; return sin.Substring(0, i); - } - this.Text = Root.Local.MenuEntryOptions + " - ppInk"; - VideoTabCtrl.TabPages[0].Text = Root.Local.OptionsTabGeneral; - VideoTabCtrl.TabPages[1].Text = Root.Local.OptionsTabPens; - VideoTabCtrl.TabPages[2].Text = Root.Local.OptionsTabHotkeys; + } + this.Text = Root.Local.MenuEntryOptions + " - ppInk"; + VideoTabCtrl.TabPages[0].Text = Root.Local.OptionsTabGeneral; + VideoTabCtrl.TabPages[1].Text = Root.Local.OptionsTabPens; + VideoTabCtrl.TabPages[2].Text = Root.Local.OptionsTabHotkeys; this.ToolBarColorLbl.Text = Root.Local.OptionsGeneralToolBarColorText; this.ClipartsSelBtn.Text = shortTxt(Root.Local.ButtonNameClipArt); this.AltTabActivateCb.Text = Root.Local.OptionsGeneralAltTabActivateText; - this.lblToolbarHeight.Text = Root.Local.OptionsGeneralToolbarHeight; - this.lbLanguage.Text = Root.Local.OptionsGeneralLanguage; - this.lbCanvascursor.Text = Root.Local.OptionsGeneralCanvascursor; - this.lbSnapshotsavepath.Text = Root.Local.OptionsGeneralSnapshotsavepath; + this.lblToolbarHeight.Text = Root.Local.OptionsGeneralToolbarHeight; + this.lbLanguage.Text = Root.Local.OptionsGeneralLanguage; + this.lbCanvascursor.Text = Root.Local.OptionsGeneralCanvascursor; + this.lbSnapshotsavepath.Text = Root.Local.OptionsGeneralSnapshotsavepath; this.OpenIntoSnapCb.Text = Root.Local.OptionsGeneralOpenIntoSnapMode; - this.cbWhiteIcon.Text = Root.Local.OptionsGeneralWhitetrayicon; - this.cbAllowDragging.Text = Root.Local.OptionsGeneralAllowdragging; + this.cbWhiteIcon.Text = Root.Local.OptionsGeneralWhitetrayicon; + this.cbAllowDragging.Text = Root.Local.OptionsGeneralAllowdragging; this.ShowFloatingWinCb.Text = Root.Local.OptionsGeneralShowFloatingWindow; this.SaveWindowPosBtn.Text = Root.Local.OptionsGeneralSaveFloatingWindowPos; this.ArrwGrp.Text = Root.Local.OptionsGeneralArrowHead; @@ -301,17 +302,17 @@ private void FormOptions_LocalReload() this.ArrHdLenLbl.Text = Root.Local.OptionsGeneralArrowHeadLen; this.DefTxtLbl.Text = shortTxt(Root.Local.ButtonNameText) + " - " + Root.Local.OptionsGeneralDefaultTextLbl; this.DefaultFontBtn.Text = Root.Local.OptionsGeneralDefaultTextBtn; - this.DefTagLbl.Text = shortTxt(Root.Local.ButtonNameNumb)+" - "+Root.Local.OptionsGeneralDefaultTextLbl; + this.DefTagLbl.Text = shortTxt(Root.Local.ButtonNameNumb) + " - " + Root.Local.OptionsGeneralDefaultTextLbl; this.TagFontBtn.Text = Root.Local.OptionsGeneralDefaultTextBtn; this.DefArrStartCb.Text = Root.Local.OptionsGeneralDefaultArrHdBtn; this.MagnetLbl.Text = Root.Local.OptionsGeneralMagnetLbl; - this.SaveConfigBtn.Text = Root.Local.OptionsGeneralSaveConfigToFile; - this.lbNote.Text = Root.Local.OptionsGeneralNotePenwidth; + this.SaveConfigBtn.Text = Root.Local.OptionsGeneralSaveConfigToFile; + this.lbNote.Text = Root.Local.OptionsGeneralNotePenwidth; { int i = 0; - foreach(string st in Root.Local.OptionsZoomEnabled.Split('\n')) - this.ZoomEnabledCb.Items[i++]=st; + foreach (string st in Root.Local.OptionsZoomEnabled.Split('\n')) + this.ZoomEnabledCb.Items[i++] = st; } this.ZoomBox.Text = Root.Local.ButtonNameZoom; this.ZoomDimLbl.Text = Root.Local.OptionsZoomDim; @@ -323,22 +324,22 @@ private void FormOptions_LocalReload() { int i = 0; - foreach(string st in Root.Local.OptionsHotKeySnapInPointerKeys.Split('\n')) + foreach (string st in Root.Local.OptionsHotKeySnapInPointerKeys.Split('\n')) { this.SnapInPointerHoldCb.Items[i] = st; this.SnapInPointerTwiceCb.Items[i++] = st; } } - this.AltAsOneCommandCb.Text = Root.Local.OptionsHotKeyAltAsOneCommand; - this.lbHkClear.Text = shortTxt(Root.Local.ButtonNameClear); - this.lbHkVideo.Text = shortTxt(Root.Local.ButtonNameVideo); - this.lbHkEraser.Text = shortTxt(Root.Local.ButtonNameErasor); - this.lbHkInkVisible.Text = shortTxt(Root.Local.ButtonNameInkVisible); - this.lbHkPan.Text = shortTxt(Root.Local.ButtonNamePan); - this.lbHkPointer.Text = shortTxt(Root.Local.ButtonNameMousePointer); - this.lbHkRedo.Text = shortTxt(Root.Local.ButtonNameRedo); - this.lbHkSnapshot.Text = shortTxt(Root.Local.ButtonNameSnapshot); + this.AltAsOneCommandCb.Text = Root.Local.OptionsHotKeyAltAsOneCommand; + this.lbHkClear.Text = shortTxt(Root.Local.ButtonNameClear); + this.lbHkVideo.Text = shortTxt(Root.Local.ButtonNameVideo); + this.lbHkEraser.Text = shortTxt(Root.Local.ButtonNameErasor); + this.lbHkInkVisible.Text = shortTxt(Root.Local.ButtonNameInkVisible); + this.lbHkPan.Text = shortTxt(Root.Local.ButtonNamePan); + this.lbHkPointer.Text = shortTxt(Root.Local.ButtonNameMousePointer); + this.lbHkRedo.Text = shortTxt(Root.Local.ButtonNameRedo); + this.lbHkSnapshot.Text = shortTxt(Root.Local.ButtonNameSnapshot); this.lbHkUndo.Text = shortTxt(Root.Local.ButtonNameUndo); this.lbHkDockUndock.Text = shortTxt(Root.Local.ButtonNameDock); this.lbHkClose.Text = Root.Local.ButtonNameClose; @@ -362,14 +363,14 @@ private void FormOptions_LocalReload() this.lbGlobalHotkey.Text = Root.Local.OptionsHotkeysglobal; this.cbAllowHotkeyInPointer.Text = Root.Local.OptionsHotkeysEnableinpointer; - foreach(Control ct in this.tabPage3.Controls) + foreach (Control ct in this.tabPage3.Controls) { if (ct.GetType() == typeof(HotkeyInputBox)) ((HotkeyInputBox)ct).UpdateText(); - } - - this.comboCanvasCursor.Items[0] = Root.Local.OptionsGeneralCanvascursorArrow; - this.comboCanvasCursor.Items[1] = Root.Local.OptionsGeneralCanvascursorPentip; + } + + this.comboCanvasCursor.Items[0] = Root.Local.OptionsGeneralCanvascursorArrow; + this.comboCanvasCursor.Items[1] = Root.Local.OptionsGeneralCanvascursorPentip; this.BoardBx.Text = Root.Local.OptionsGeneralBoardBox; this.BoardAtOpenLbl.Text = Root.Local.OptionsGeneralBoardAtOpenLbl; @@ -393,72 +394,72 @@ private void FormOptions_LocalReload() this.LblFfmpegNote.Text = Root.Local.LblFfmpegNote; - for (int p = 0; p < Root.MaxPenCount; p++) - { - comboPensAlpha[p].Items.Clear(); - comboPensWidth[p].Items.Clear(); - comboPensAlpha[p].Items.AddRange(new object[] { Root.Local.OptionsPensPencil, Root.Local.OptionsPensHighlighter }); - comboPensWidth[p].Items.AddRange(new object[] { Root.Local.OptionsPensThin, Root.Local.OptionsPensNormal, Root.Local.OptionsPensThick }); - - lbPens[p].Text = Root.Local.ButtonNamePen[p]; - lbHotkeyPens[p].Text = Root.Local.ButtonNamePen[p]; - - lbcbPens.Text = Root.Local.OptionsPensShow; - lbpboxPens.Text = Root.Local.OptionsPensColor; - lbcomboPensAlpha.Text = Root.Local.OptionsPensAlpha; - lbcomboPensWidth.Text = Root.Local.OptionsPensWidth; - lbcomboPensFading.Text = Root.Local.OptionsPensFading; - } + for (int p = 0; p < Root.MaxPenCount; p++) + { + comboPensAlpha[p].Items.Clear(); + comboPensWidth[p].Items.Clear(); + comboPensAlpha[p].Items.AddRange(new object[] { Root.Local.OptionsPensPencil, Root.Local.OptionsPensHighlighter }); + comboPensWidth[p].Items.AddRange(new object[] { Root.Local.OptionsPensThin, Root.Local.OptionsPensNormal, Root.Local.OptionsPensThick }); + + lbPens[p].Text = Root.Local.ButtonNamePen[p]; + lbHotkeyPens[p].Text = Root.Local.ButtonNamePen[p]; + + lbcbPens.Text = Root.Local.OptionsPensShow; + lbpboxPens.Text = Root.Local.OptionsPensColor; + lbcomboPensAlpha.Text = Root.Local.OptionsPensAlpha; + lbcomboPensWidth.Text = Root.Local.OptionsPensWidth; + lbcomboPensFading.Text = Root.Local.OptionsPensFading; + } WidthAtPenSelCb.Text = Root.Local.OptionsPensWidthAtSelection; InverseWheelCb.Text = Root.InverseMousewheel ? Root.Local.OptionsInverseMouseWheelChecked : Root.Local.OptionsInverseMouseWheel; - comboLanguage.Items.Clear(); - List langs = Root.Local.GetLanguagenames(); - foreach (string languagename in langs) - { - comboLanguage.Items.Add(languagename); - } - - string ln = Root.Local.GetLanguagenameByFilename(Root.Local.CurrentLanguageFile); - if (comboLanguage.Items.Contains(ln)) - comboLanguage.SelectedIndex = comboLanguage.Items.IndexOf(ln); - } - - private void comboPensAlpha_TextChanged(object sender, EventArgs e) - { - for (int p = 0; p < Root.MaxPenCount; p++) - if ((ComboBox)sender == comboPensAlpha[p]) - { - byte o; - if (byte.TryParse(comboPensAlpha[p].Text, out o) && o >= 0 && o <= 255) - { - Root.PenAttr[p].Transparency = (byte)(255 - o); - comboPensAlpha[p].BackColor = Color.White; - } - else - { - comboPensAlpha[p].BackColor = Color.IndianRed; - } - } - } - - private void comboPensWidth_TextChanged(object sender, EventArgs e) - { - for (int p = 0; p < Root.MaxPenCount; p++) - if ((ComboBox)sender == comboPensWidth[p]) - { - int o; - if (int.TryParse(comboPensWidth[p].Text, out o) && o >= 30 && o <= 3000) - { - Root.PenAttr[p].Width = o; - comboPensWidth[p].BackColor = Color.White; - } - else - { - comboPensWidth[p].BackColor = Color.IndianRed; - } - } - } + comboLanguage.Items.Clear(); + List langs = Root.Local.GetLanguagenames(); + foreach (string languagename in langs) + { + comboLanguage.Items.Add(languagename); + } + + string ln = Root.Local.GetLanguagenameByFilename(Root.Local.CurrentLanguageFile); + if (comboLanguage.Items.Contains(ln)) + comboLanguage.SelectedIndex = comboLanguage.Items.IndexOf(ln); + } + + private void comboPensAlpha_TextChanged(object sender, EventArgs e) + { + for (int p = 0; p < Root.MaxPenCount; p++) + if ((ComboBox)sender == comboPensAlpha[p]) + { + byte o; + if (byte.TryParse(comboPensAlpha[p].Text, out o) && o >= 0 && o <= 255) + { + Root.PenAttr[p].Transparency = (byte)(255 - o); + comboPensAlpha[p].BackColor = Color.White; + } + else + { + comboPensAlpha[p].BackColor = Color.IndianRed; + } + } + } + + private void comboPensWidth_TextChanged(object sender, EventArgs e) + { + for (int p = 0; p < Root.MaxPenCount; p++) + if ((ComboBox)sender == comboPensWidth[p]) + { + int o; + if (int.TryParse(comboPensWidth[p].Text, out o) && o >= 30 && o <= 3000) + { + Root.PenAttr[p].Width = o; + comboPensWidth[p].BackColor = Color.White; + } + else + { + comboPensWidth[p].BackColor = Color.IndianRed; + } + } + } private void comboPensFading_Changed(object sender, EventArgs e) { @@ -471,17 +472,17 @@ private void comboPensFading_Changed(object sender, EventArgs e) } else { - try{ Root.PenAttr[p].ExtendedProperties.Remove(Root.FADING_PEN); }catch { }; + try { Root.PenAttr[p].ExtendedProperties.Remove(Root.FADING_PEN); } catch { }; } } } - private void pboxPens_Click(object sender, EventArgs e) - { - for (int p = 0; p < Root.MaxPenCount; p++) - if ((PictureBox)sender == pboxPens[p]) - { + private void pboxPens_Click(object sender, EventArgs e) + { + for (int p = 0; p < Root.MaxPenCount; p++) + if ((PictureBox)sender == pboxPens[p]) + { PenModifyDlg dlg = new PenModifyDlg(Root); if (dlg.ModifyPen(ref Root.PenAttr[p])) { @@ -489,19 +490,19 @@ private void pboxPens_Click(object sender, EventArgs e) comboPensAlpha[p].Text = string.Format("{0}", Root.PenAttr[p].Transparency); comboPensWidth[p].Text = string.Format("{0}", Root.PenAttr[p].Width); comboPensFading[p].Checked = Root.PenAttr[p].ExtendedProperties.Contains(Root.FADING_PEN); - } - } - } - - private void cbPens_CheckedChanged(object sender, EventArgs e) - { - for (int p = 0; p < Root.MaxPenCount; p++) - if ((CheckBox)sender == cbPens[p]) - Root.PenEnabled[p] = cbPens[p].Checked; - } - - private void FormOptions_FormClosing(object sender, FormClosingEventArgs e) - { + } + } + } + + private void cbPens_CheckedChanged(object sender, EventArgs e) + { + for (int p = 0; p < Root.MaxPenCount; p++) + if ((CheckBox)sender == cbPens[p]) + Root.PenEnabled[p] = cbPens[p].Checked; + } + + private void FormOptions_FormClosing(object sender, FormClosingEventArgs e) + { try { Root.SetHotkey(); @@ -517,109 +518,109 @@ private void FormOptions_FormClosing(object sender, FormClosingEventArgs e) } - private void cbWidthEnabled_CheckedChanged(object sender, EventArgs e) - { - Root.PenWidthEnabled = cbWidthEnabled.Checked; - lbNote.ForeColor = Color.Red; - } - - private void cbEraserEnabled_CheckedChanged(object sender, EventArgs e) - { - Root.EraserEnabled = cbEraserEnabled.Checked; - } - - private void cbPointerEnabled_CheckedChanged(object sender, EventArgs e) - { - Root.PointerEnabled = cbPointerEnabled.Checked; - } - - private void cbSnapEnabled_CheckedChanged(object sender, EventArgs e) - { - Root.SnapEnabled = cbSnapEnabled.Checked; - } - - private void cbUndoEnabled_CheckedChanged(object sender, EventArgs e) - { - Root.UndoEnabled = cbUndoEnabled.Checked; - } - - private void cbClearEnabled_CheckedChanged(object sender, EventArgs e) - { - Root.ClearEnabled = cbClearEnabled.Checked; - } - - private void cbPanEnabled_CheckedChanged(object sender, EventArgs e) - { - Root.PanEnabled = cbPanEnabled.Checked; - } - - private void cbInkVisibleEnabled_CheckedChanged(object sender, EventArgs e) - { - Root.InkVisibleEnabled = cbInkVisibleEnabled.Checked; - } - - private void cbWhiteIcon_CheckedChanged(object sender, EventArgs e) - { - Root.WhiteTrayIcon = cbWhiteIcon.Checked; - Root.SetTrayIconColor(); - } - - private void btSnapPath_Click(object sender, EventArgs e) - { - folderBrowserDialog1 = new FolderBrowserDialog(); - folderBrowserDialog1.SelectedPath = Root.SnapshotBasePath; - - DialogResult result = folderBrowserDialog1.ShowDialog(); - - if (result == DialogResult.OK && !string.IsNullOrEmpty(folderBrowserDialog1.SelectedPath)) - { - tbSnapPath.Text = folderBrowserDialog1.SelectedPath; - Root.SnapshotBasePath = folderBrowserDialog1.SelectedPath; - } - } - - private void tbSnapPath_ModifiedChanged(object sender, EventArgs e) - { - Root.SnapshotBasePath = tbSnapPath.Text; - } - - private void timer1_Tick(object sender, EventArgs e) - { - for (int p = 0; p < Root.MaxPenCount; p++) - { - if (comboPensWidth[p].Text == Root.Local.OptionsPensThin) - { - comboPensWidth[p].Text = "30"; - } - else if (comboPensWidth[p].Text == Root.Local.OptionsPensNormal) - { - comboPensWidth[p].Text = "80"; - } - else if (comboPensWidth[p].Text == Root.Local.OptionsPensThick) - { - comboPensWidth[p].Text = "500"; - } - - if (comboPensAlpha[p].Text == Root.Local.OptionsPensPencil) - { - comboPensAlpha[p].Text = "255"; - } - else if (comboPensAlpha[p].Text == Root.Local.OptionsPensHighlighter) - { - comboPensAlpha[p].Text = "80"; - } - } - } - - private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) - { - Root.CanvasCursor = comboCanvasCursor.SelectedIndex; - } - - private void cbAllowDragging_CheckedChanged(object sender, EventArgs e) - { - Root.AllowDraggingToolbar = cbAllowDragging.Checked; - } + private void cbWidthEnabled_CheckedChanged(object sender, EventArgs e) + { + Root.PenWidthEnabled = cbWidthEnabled.Checked; + lbNote.ForeColor = Color.Red; + } + + private void cbEraserEnabled_CheckedChanged(object sender, EventArgs e) + { + Root.EraserEnabled = cbEraserEnabled.Checked; + } + + private void cbPointerEnabled_CheckedChanged(object sender, EventArgs e) + { + Root.PointerEnabled = cbPointerEnabled.Checked; + } + + private void cbSnapEnabled_CheckedChanged(object sender, EventArgs e) + { + Root.SnapEnabled = cbSnapEnabled.Checked; + } + + private void cbUndoEnabled_CheckedChanged(object sender, EventArgs e) + { + Root.UndoEnabled = cbUndoEnabled.Checked; + } + + private void cbClearEnabled_CheckedChanged(object sender, EventArgs e) + { + Root.ClearEnabled = cbClearEnabled.Checked; + } + + private void cbPanEnabled_CheckedChanged(object sender, EventArgs e) + { + Root.PanEnabled = cbPanEnabled.Checked; + } + + private void cbInkVisibleEnabled_CheckedChanged(object sender, EventArgs e) + { + Root.InkVisibleEnabled = cbInkVisibleEnabled.Checked; + } + + private void cbWhiteIcon_CheckedChanged(object sender, EventArgs e) + { + Root.WhiteTrayIcon = cbWhiteIcon.Checked; + Root.SetTrayIconColor(); + } + + private void btSnapPath_Click(object sender, EventArgs e) + { + folderBrowserDialog1 = new FolderBrowserDialog(); + folderBrowserDialog1.SelectedPath = Root.SnapshotBasePath; + + DialogResult result = folderBrowserDialog1.ShowDialog(); + + if (result == DialogResult.OK && !string.IsNullOrEmpty(folderBrowserDialog1.SelectedPath)) + { + tbSnapPath.Text = folderBrowserDialog1.SelectedPath; + Root.SnapshotBasePath = folderBrowserDialog1.SelectedPath; + } + } + + private void tbSnapPath_ModifiedChanged(object sender, EventArgs e) + { + Root.SnapshotBasePath = tbSnapPath.Text; + } + + private void timer1_Tick(object sender, EventArgs e) + { + for (int p = 0; p < Root.MaxPenCount; p++) + { + if (comboPensWidth[p].Text == Root.Local.OptionsPensThin) + { + comboPensWidth[p].Text = "30"; + } + else if (comboPensWidth[p].Text == Root.Local.OptionsPensNormal) + { + comboPensWidth[p].Text = "80"; + } + else if (comboPensWidth[p].Text == Root.Local.OptionsPensThick) + { + comboPensWidth[p].Text = "500"; + } + + if (comboPensAlpha[p].Text == Root.Local.OptionsPensPencil) + { + comboPensAlpha[p].Text = "255"; + } + else if (comboPensAlpha[p].Text == Root.Local.OptionsPensHighlighter) + { + comboPensAlpha[p].Text = "80"; + } + } + } + + private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) + { + Root.CanvasCursor = comboCanvasCursor.SelectedIndex; + } + + private void cbAllowDragging_CheckedChanged(object sender, EventArgs e) + { + Root.AllowDraggingToolbar = cbAllowDragging.Checked; + } private void cbToolsEnabled_CheckedChanged(object sender, EventArgs e) { @@ -642,7 +643,7 @@ private void SaveConfigBtn_Click(object sender, EventArgs e) private void ArrHdFloat_Validating(object sender, CancelEventArgs e) { float tempf; - if (!float.TryParse(((TextBox)sender).Text.Replace(",","."), NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out tempf)) + if (!float.TryParse(((TextBox)sender).Text.Replace(",", "."), NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out tempf)) { e.Cancel = true; ((TextBox)sender).Select(); @@ -678,7 +679,7 @@ private void TagFontBtn_Click(object sender, EventArgs e) private void ArrHdAperture_Validated(object sender, EventArgs e) { - Root.ArrowAngle = float.Parse(ArrHdAperture.Text.Replace(",","."), CultureInfo.InvariantCulture) /180.0*Math.PI; + Root.ArrowAngle = float.Parse(ArrHdAperture.Text.Replace(",", "."), CultureInfo.InvariantCulture) / 180.0 * Math.PI; } private void ArrHdLength_Validated(object sender, EventArgs e) @@ -688,8 +689,8 @@ private void ArrHdLength_Validated(object sender, EventArgs e) private void ShowFloatingWinCb_Click(object sender, EventArgs e) { - Root.FormOpacity = ((((CheckBox)sender).Checked)?1:-1) * Math.Abs(Root.FormOpacity); - if (((CheckBox)sender).Checked && (Root.FormTop <= Screen.PrimaryScreen.WorkingArea.Top || Root.FormTop >= Screen.PrimaryScreen.WorkingArea.Bottom || + Root.FormOpacity = ((((CheckBox)sender).Checked) ? 1 : -1) * Math.Abs(Root.FormOpacity); + if (((CheckBox)sender).Checked && (Root.FormTop <= Screen.PrimaryScreen.WorkingArea.Top || Root.FormTop >= Screen.PrimaryScreen.WorkingArea.Bottom || Root.FormLeft <= Screen.PrimaryScreen.WorkingArea.Left || Root.FormLeft >= Screen.PrimaryScreen.WorkingArea.Right)) { Root.FormTop = Screen.PrimaryScreen.WorkingArea.Top + 100; @@ -747,7 +748,7 @@ private void ToolBarHeight_Validated(object sender, EventArgs e) private void ValidateOnEnter(object sender, KeyPressEventArgs e) { - if(e.KeyChar=='\r') + if (e.KeyChar == '\r') { this.SelectNextControl(this.ActiveControl, true, true, true, true); (sender as TextBox).Select(); @@ -803,7 +804,7 @@ private void FfmpegCmdTxt_TextChanged(object sender, EventArgs e) private void VideoOption_Changed(object sender, EventArgs e) { if ((sender as RadioButton).Checked) - Root.VideoRecordMode = (VideoRecordMode)Int32.Parse((string)(sender as Control).Tag); + Root.VideoRecordMode = (VideoRecordMode)int.Parse((string)(sender as Control).Tag); } private void ToolbarDwg_Click(object sender, EventArgs e) @@ -841,12 +842,12 @@ private void ClipartsSelBtn_Click(object sender, EventArgs e) dlg.InsertBtn.Text = Root.Local.ButtonOkText; dlg.AutoCloseCb.Visible = false; - if(dlg.ShowDialog() == DialogResult.OK) + if (dlg.ShowDialog() == DialogResult.OK) { Root.ImageStampFilling = dlg.ImageStampFilling; Root.StampFileNames.Clear(); -// for(int i=0;i=0) + if (SnapInPointerHoldCb.SelectedIndex >= 0) Root.SnapInPointerHoldKey = (SnapInPointerKeys)(SnapInPointerHoldCb.SelectedIndex); - if(SnapInPointerTwiceCb.SelectedIndex>=0) + if (SnapInPointerTwiceCb.SelectedIndex >= 0) Root.SnapInPointerPressTwiceKey = (SnapInPointerKeys)(SnapInPointerTwiceCb.SelectedIndex); } + + private void checkBoxCleanCanvas_CheckedChanged(object sender, EventArgs e) + { + Root.CleanOnHide=checkBoxCleanCanvas.Checked; + } } -} - \ No newline at end of file +} diff --git a/src/GlobalSuppressions.cs b/src/GlobalSuppressions.cs new file mode 100644 index 00000000..055b9de7 --- /dev/null +++ b/src/GlobalSuppressions.cs @@ -0,0 +1,8 @@ +// This file is used by Code Analysis to maintain SuppressMessage +// attributes that are applied to this project. +// Project-level suppressions either have no target or are given +// a specific target and scoped to a namespace, type, member, etc. + +using System.Diagnostics.CodeAnalysis; + +[assembly: SuppressMessage("Usage", "RCS1155:Use StringComparison when comparing strings.", Justification = "", Scope = "member", Target = "~M:gInk.Root.ReadOptions(System.String)")] diff --git a/src/Hotkey.cs b/src/Hotkey.cs index f7f6cf14..27539e16 100644 --- a/src/Hotkey.cs +++ b/src/Hotkey.cs @@ -5,17 +5,17 @@ using System.Windows.Forms; namespace gInk -{ - public class Hotkey - { - public int Key; - public bool Control; - public bool Alt; - public bool Shift; - public bool Win; - - public static bool IsValidKey(Keys key) - { +{ + public class Hotkey + { + public int Key; + public bool Control; + public bool Alt; + public bool Shift; + public bool Win; + + public static bool IsValidKey(Keys key) + { // we ignore ctrl,alt,shift as unique keys : they must be part of a global key if (key != Keys.ControlKey && key != Keys.LControlKey && key != Keys.RControlKey && key != Keys.Menu && key != Keys.LMenu && key != Keys.RMenu @@ -23,7 +23,7 @@ public static bool IsValidKey(Keys key) return true; else return false; - } + } public override string ToString() { @@ -33,7 +33,7 @@ public override string ToString() if (Control) str += LocalSt.KeyNames[0x00020000] + " + "; if (Alt) str += LocalSt.KeyNames[0x00040000] + " + "; if (Shift) str += LocalSt.KeyNames[0x00010000] + " + "; - if (Win) str += LocalSt.KeyNames[0x5B] +" + "; + if (Win) str += LocalSt.KeyNames[0x5B] + " + "; str += LocalSt.KeyNames[Key]; return str; } @@ -42,38 +42,38 @@ public override string ToString() return LocalSt.KeyNames[0]; } } - public string ToStringInvariant() - { - if (Key > 0) - { - string str = ""; - if (Control) str += "Ctrl + "; - if (Alt) str += "Alt + "; - if (Shift) str += "Shift + "; - if (Win) str += "Win + "; - str += ((Keys)Key).ToString(); - return str; - } - else - { - return "None"; - } - } - - public bool Parse(string para) - { + public string ToStringInvariant() + { + if (Key > 0) + { + string str = ""; + if (Control) str += "Ctrl + "; + if (Alt) str += "Alt + "; + if (Shift) str += "Shift + "; + if (Win) str += "Win + "; + str += ((Keys)Key).ToString(); + return str; + } + else + { + return "None"; + } + } + + public bool Parse(string para) + { Keys kk; - if (para == "None") - { - Key = 0; - Control = false; - Alt = false; - Shift = false; - Win = false; - return true; - } - else if (para.Length >= 1) - { + if (para == "None") + { + Key = 0; + Control = false; + Alt = false; + Shift = false; + Win = false; + return true; + } + else if (para.Length >= 1) + { try { Control = para.Contains("Control") || para.Contains("Ctrl"); @@ -91,37 +91,37 @@ public bool Parse(string para) return false; } } - else - { - return false; - } - } - - public bool ModifierMatch(bool control, bool alt, bool shift, bool win) - { - return Control == control && Alt == alt && Shift == shift && Win == win; - } + else + { + return false; + } + } + + public bool ModifierMatch(bool control, bool alt, bool shift, bool win) + { + return Control == control && Alt == alt && Shift == shift && Win == win; + } public bool ModifierMatch(bool control, int alt, bool shift, bool win) { - if(alt==-1) + if (alt == -1) return Control == control /*&& Alt == alt */ && Shift == shift && Win == win; else - return Control == control && Alt == (alt==1) && Shift == shift && Win == win; + return Control == control && Alt == (alt == 1) && Shift == shift && Win == win; } - public bool ConflictWith(Hotkey hotkey) - { - if (Key == 0 || hotkey.Key == 0) - return false; - else if (Control == hotkey.Control && Alt == hotkey.Alt && Shift == hotkey.Shift && Win == hotkey.Win && Key == hotkey.Key) - { - return true; - } - else - { - return false; - } - } - } + public bool ConflictWith(Hotkey hotkey) + { + if (Key == 0 || hotkey.Key == 0) + return false; + else if (Control == hotkey.Control && Alt == hotkey.Alt && Shift == hotkey.Shift && Win == hotkey.Win && Key == hotkey.Key) + { + return true; + } + else + { + return false; + } + } + } } diff --git a/src/HotkeyInputBox.cs b/src/HotkeyInputBox.cs index 326ebd05..6250308f 100644 --- a/src/HotkeyInputBox.cs +++ b/src/HotkeyInputBox.cs @@ -8,139 +8,139 @@ using System.Windows.Forms; namespace gInk -{ - public partial class HotkeyInputBox : TextBox - { - - private Hotkey _Hotkey = new Hotkey(); - private bool _ExternalConflictFlag; - private bool _InWaitingKey; - - public event EventHandler OnHotkeyChanged; - - public Hotkey Hotkey - { - get - { - return _Hotkey; - } - set - { - _Hotkey = value; - UpdateText(); - if (OnHotkeyChanged != null) - OnHotkeyChanged(this, null); - } - } - - public bool RequireModifier { get; set; } - - public bool ExternalConflictFlag - { - get - { - return _ExternalConflictFlag; - } - set - { - _ExternalConflictFlag = value; - SetBackColor(); - } - } - - private bool HotkeyJustSet = false; - - public HotkeyInputBox() - { - InitializeComponent(); - - Width = 150; - } - - public void UpdateText() - { +{ + public partial class HotkeyInputBox : TextBox + { + + private Hotkey _Hotkey = new Hotkey(); + private bool _ExternalConflictFlag; + private bool _InWaitingKey; + + public event EventHandler OnHotkeyChanged; + + public Hotkey Hotkey + { + get + { + return _Hotkey; + } + set + { + _Hotkey = value; + UpdateText(); + if (OnHotkeyChanged != null) + OnHotkeyChanged(this, null); + } + } + + public bool RequireModifier { get; set; } + + public bool ExternalConflictFlag + { + get + { + return _ExternalConflictFlag; + } + set + { + _ExternalConflictFlag = value; + SetBackColor(); + } + } + + private bool HotkeyJustSet = false; + + public HotkeyInputBox() + { + InitializeComponent(); + + Width = 150; + } + + public void UpdateText() + { Text = Hotkey.ToString(); - } - - protected void SetBackColor() - { - if (_InWaitingKey) - BackColor = Color.LimeGreen; - else if (_ExternalConflictFlag) - BackColor = Color.IndianRed; - else - BackColor = Color.White; - } - - - protected override void OnKeyDown(KeyEventArgs e) - { - e.SuppressKeyPress = true; - - Keys modifierKeys = e.Modifiers; - Keys pressedKey = e.KeyData ^ modifierKeys; + } + + protected void SetBackColor() + { + if (_InWaitingKey) + BackColor = Color.LimeGreen; + else if (_ExternalConflictFlag) + BackColor = Color.IndianRed; + else + BackColor = Color.White; + } + + + protected override void OnKeyDown(KeyEventArgs e) + { + e.SuppressKeyPress = true; + + Keys modifierKeys = e.Modifiers; + Keys pressedKey = e.KeyData ^ modifierKeys; //bool deleting = pressedKey == Keys.Escape || pressedKey == Keys.Delete || pressedKey == Keys.Back; bool deleting = pressedKey == Keys.Delete || pressedKey == Keys.Back; - if (deleting) - { - Text = LocalSt.KeyNames[0]; - } - else - { - Text = ""; - if ((modifierKeys & Keys.Control) > 0) - Text += LocalSt.KeyNames[0x00020000] + " + "; - if ((modifierKeys & Keys.Alt) > 0) - Text += LocalSt.KeyNames[0x00040000] + " + "; - if ((modifierKeys & Keys.Shift) > 0) - Text += LocalSt.KeyNames[0x00010000] + " + "; - if ((modifierKeys & Keys.LWin) > 0 || (modifierKeys & Keys.RWin) > 0) - Text += LocalSt.KeyNames[0x5B] + " + "; + if (deleting) + { + Text = LocalSt.KeyNames[0]; + } + else + { + Text = ""; + if ((modifierKeys & Keys.Control) > 0) + Text += LocalSt.KeyNames[0x00020000] + " + "; + if ((modifierKeys & Keys.Alt) > 0) + Text += LocalSt.KeyNames[0x00040000] + " + "; + if ((modifierKeys & Keys.Shift) > 0) + Text += LocalSt.KeyNames[0x00010000] + " + "; + if ((modifierKeys & Keys.LWin) > 0 || (modifierKeys & Keys.RWin) > 0) + Text += LocalSt.KeyNames[0x5B] + " + "; if (Hotkey.IsValidKey(pressedKey)) { - Text += LocalSt.KeyNames[(int)pressedKey]; - } - } - - if (deleting) - { - Hotkey.Key = 0; - Hotkey.Control = false; - Hotkey.Alt = false; - Hotkey.Shift = false; - Hotkey.Win = false; - HotkeyJustSet = true; - _InWaitingKey = false; - SetBackColor(); - if (OnHotkeyChanged != null) - OnHotkeyChanged(this, null); - } - else if ((!RequireModifier || modifierKeys != Keys.None) && Hotkey.IsValidKey(pressedKey)) - { - Hotkey.Key = (int)pressedKey; - Hotkey.Control = (modifierKeys & Keys.Control) > 0; - Hotkey.Alt = (modifierKeys & Keys.Alt) > 0; - Hotkey.Shift = (modifierKeys & Keys.Shift) > 0; - Hotkey.Win = (modifierKeys & Keys.LWin) > 0 || (modifierKeys & Keys.RWin) > 0; - HotkeyJustSet = true; - _InWaitingKey = false; - SetBackColor(); - if (OnHotkeyChanged != null) - OnHotkeyChanged(this, null); - } - else - { - _InWaitingKey = true; - SetBackColor(); - } - } - - protected override void OnKeyUp(KeyEventArgs e) - { - Keys modifierKeys = e.Modifiers; - Keys pressedKey = e.KeyData ^ modifierKeys; + Text += LocalSt.KeyNames[(int)pressedKey]; + } + } + + if (deleting) + { + Hotkey.Key = 0; + Hotkey.Control = false; + Hotkey.Alt = false; + Hotkey.Shift = false; + Hotkey.Win = false; + HotkeyJustSet = true; + _InWaitingKey = false; + SetBackColor(); + if (OnHotkeyChanged != null) + OnHotkeyChanged(this, null); + } + else if ((!RequireModifier || modifierKeys != Keys.None) && Hotkey.IsValidKey(pressedKey)) + { + Hotkey.Key = (int)pressedKey; + Hotkey.Control = (modifierKeys & Keys.Control) > 0; + Hotkey.Alt = (modifierKeys & Keys.Alt) > 0; + Hotkey.Shift = (modifierKeys & Keys.Shift) > 0; + Hotkey.Win = (modifierKeys & Keys.LWin) > 0 || (modifierKeys & Keys.RWin) > 0; + HotkeyJustSet = true; + _InWaitingKey = false; + SetBackColor(); + if (OnHotkeyChanged != null) + OnHotkeyChanged(this, null); + } + else + { + _InWaitingKey = true; + SetBackColor(); + } + } + + protected override void OnKeyUp(KeyEventArgs e) + { + Keys modifierKeys = e.Modifiers; + Keys pressedKey = e.KeyData ^ modifierKeys; if (modifierKeys != Keys.None && !HotkeyJustSet) { @@ -159,15 +159,15 @@ protected override void OnKeyUp(KeyEventArgs e) Text += LocalSt.KeyNames[(int)pressedKey]; } } - - if (modifierKeys == Keys.None) - { - UpdateText(); - _InWaitingKey = false; - SetBackColor(); - HotkeyJustSet = false; - } - } - - } + + if (modifierKeys == Keys.None) + { + UpdateText(); + _InWaitingKey = false; + SetBackColor(); + HotkeyJustSet = false; + } + } + + } } diff --git a/src/ImageLister.cs b/src/ImageLister.cs index 9a82da33..1b813e10 100644 --- a/src/ImageLister.cs +++ b/src/ImageLister.cs @@ -17,11 +17,11 @@ public partial class ImageLister : Form { Root Root; public Point[] ImgSizes = new Point[100]; // I wanted to use the tag, but for an unknown reason it affects image display in dialogbox.... - public int ImageStampFilling=-1; + public int ImageStampFilling = -1; public string ImageStamp; public int ImgSizeX = -1; public int ImgSizeY = -1; - public Dictionary Originals = new Dictionary(); + public Dictionary Originals = new Dictionary(); public ImageLister(Root rt) { @@ -34,12 +34,12 @@ public ImageLister(Root rt) CancelBtn.Text = Root.Local.ButtonCancelText; FromClpBtn.Text = Root.Local.ButtonFromClipBText; LoadImageBtn.Text = Root.Local.ButtonLoadImageText; - DelBtn.Text = Root.Local.ButtonDeleteText; + DelBtn.Text = Root.Local.ButtonDeleteText; FillingCombo.Items.Clear(); FillingCombo.Items.AddRange(Root.Local.ListFillingsText.Split(';')); FillingCombo.Text = (string)FillingCombo.Items[Root.ImageStampFilling + 1]; AutoCloseCb.Text = Root.Local.CheckBoxAutoCloseText; - for (int i=0;i KeyNames; } - public class Local - { - Dictionary Languages = new Dictionary(); - - public string CurrentLanguageFile; - - public string[] ButtonNamePen = new string[10]; - - public string ButtonNamePenwidth = "Pen width"; - public string ButtonNameErasor = "Eraser"; - public string ButtonNamePan = "move one drawing | Pan all drawings"; - public string ButtonNameMousePointer = "Mouse pointer"; - public string ButtonNameInkVisible = "Ink visible"; - public string ButtonNameSnapshot = "Snapshot"; - public string ButtonNameUndo = "Undo"; - public string ButtonNameRedo = "Redo"; - public string ButtonNameClear = "Clear"; - public string ButtonNameExit = "Exit drawing"; - public string ButtonNameDock = "Dock/Undock"; + public class Local + { + Dictionary Languages = new Dictionary(); + + public string CurrentLanguageFile; + + public string[] ButtonNamePen = new string[10]; + + public string ButtonNamePenwidth = "Pen width"; + public string ButtonNameErasor = "Eraser"; + public string ButtonNamePan = "move one drawing | Pan all drawings"; + public string ButtonNameMousePointer = "Mouse pointer"; + public string ButtonNameInkVisible = "Ink visible"; + public string ButtonNameSnapshot = "Snapshot"; + public string ButtonNameUndo = "Undo"; + public string ButtonNameRedo = "Redo"; + public string ButtonNameClear = "Clear"; + public string ButtonNameExit = "Exit drawing"; + public string ButtonNameDock = "Dock/Undock"; public string ButtonNameClose = "Close\n(in addition to Alt+F4)"; public string ButtonNameHand = "Handfree drawing (standard | color filled | White filled | Black filled)"; public string ButtonNameLine = "Line Shape"; @@ -52,15 +52,15 @@ public class Local public string BoardTitle = "Clean Desktop"; public string BoardText = "Erase all drawings and fill it with..."; public string BoardTransparent = "Transparent"; - public string BoardWhite= "White"; - public string BoardGray= "Customed "; + public string BoardWhite = "White"; + public string BoardGray = "Customed "; public string BoardBlack = "Black"; public string BoardLast = "Last selected"; public string OptionsGeneralBoardBox = "Background Board"; - public string BoardCustColorModifyTitle="Board Customed color"; - public string OptionsGeneralBoardAtOpenLbl="Background at toolbar opening"; - public string OptionsGeneralBoardCustColorLbl="Customed Background color"; + public string BoardCustColorModifyTitle = "Board Customed color"; + public string OptionsGeneralBoardAtOpenLbl = "Background at toolbar opening"; + public string OptionsGeneralBoardCustColorLbl = "Customed Background color"; public string OptionsZoomEnabled = "0 - No Zoom\n1 - Magnifier\n2 - Frozen Area\n3 - Both"; @@ -82,30 +82,30 @@ public class Local public string ButtonFromClipBText = "&From Clipboard"; public string ButtonLoadImageText = "&Load Image"; public string ButtonDeleteText = "&Delete entry"; - public string CheckBoxAutoCloseText = "Auto\nClose"; + public string CheckBoxAutoCloseText = "Auto\nClose"; public string ListFillingsText = "No Frame;Empty;Color filled;White filled;Black filled"; - public string MenuEntryExit = "Exit"; - public string MenuEntryOptions = "Options"; - public string MenuEntryAbout = "About"; - - public string OptionsTabGeneral = "General"; - public string OptionsTabPens = "Pens"; - public string OptionsTabHotkeys = "Hotkeys"; - - public string OptionsGeneralLanguage = "Language"; + public string MenuEntryExit = "Exit"; + public string MenuEntryOptions = "Options"; + public string MenuEntryAbout = "About"; + + public string OptionsTabGeneral = "General"; + public string OptionsTabPens = "Pens"; + public string OptionsTabHotkeys = "Hotkeys"; + + public string OptionsGeneralLanguage = "Language"; public string OptionsGeneralToolBarColorText = "Click on toolbar to select background color"; public string OptionsGeneralAltTabActivateText = "Engage Pointer and Auto-Fold with Alt+Tab"; public string OptionsGeneralToolbarHeight = "height(%scr)\n\n\nchanges after closing toolbar"; - public string OptionsGeneralCanvascursor = "Canvus cursor"; - public string OptionsGeneralCanvascursorArrow = "Arrow"; - public string OptionsGeneralCanvascursorPentip = "Pen tip"; - public string OptionsGeneralSnapshotsavepath = "Snapshot save path"; + public string OptionsGeneralCanvascursor = "Canvus cursor"; + public string OptionsGeneralCanvascursorArrow = "Arrow"; + public string OptionsGeneralCanvascursorPentip = "Pen tip"; + public string OptionsGeneralSnapshotsavepath = "Snapshot save path"; public string OptionsGeneralOpenIntoSnapMode = "Start Snapshot Capture immediately after Opening Toolbar"; - public string OptionsGeneralWhitetrayicon = "Use white tray icon"; - public string OptionsGeneralAllowdragging = "Allow dragging toolbar"; + public string OptionsGeneralWhitetrayicon = "Use white tray icon"; + public string OptionsGeneralAllowdragging = "Allow dragging toolbar"; public string OptionsGeneralShowFloatingWindow = "Show Floating Window (at next restart)"; public string OptionsGeneralSaveFloatingWindowPos = "Save Floating &window Pos"; public string OptionsGeneralArrowHead = "ArrowHead"; @@ -116,197 +116,197 @@ public class Local public string OptionsGeneralDefaultArrHdBtn = "Default Arrow Head At Start"; public string OptionsGeneralMagnetLbl = "Magnetic radius(%Scr) (<=0 = disabled)"; public string OptionsGeneralSaveConfigToFile = "Save to Files"; - public string OptionsGeneralNotePenwidth = "Notes: (1)pen width panel overides each individual pen width settings\n (2) Transparency and size of floating window to be modified directly in config.ini"; - - public string OptionsPensShow = "Show"; - public string OptionsPensColor = "Color"; - public string OptionsPensAlpha = "Alpha"; - public string OptionsPensWidth = "Width"; - public string OptionsPensPencil = "Pencil"; - public string OptionsPensHighlighter = "Highlighter"; + public string OptionsGeneralNotePenwidth = "Notes: (1)pen width panel overides each individual pen width settings\n (2) Transparency and size of floating window to be modified directly in config.ini"; + + public string OptionsPensShow = "Show"; + public string OptionsPensColor = "Color"; + public string OptionsPensAlpha = "Alpha"; + public string OptionsPensWidth = "Width"; + public string OptionsPensPencil = "Pencil"; + public string OptionsPensHighlighter = "Highlighter"; public string OptionsPensFading = "Fading (after...sec)"; public string OptionsPensWidthAtSelection = "Apply Width on Pen Selection\n(even with width selector)"; public string OptionsInverseMouseWheel = "Inverse MouseWheel control\nWheel = Pen Width\nShift+Wheel = Pen Selection"; public string OptionsInverseMouseWheelChecked = "Inverse MouseWheel control\nWheel = Pen Selection\nShift+Wheel = Pen Width"; - public string OptionsPensThin = "Thin"; - public string OptionsPensNormal = "Normal"; - public string OptionsPensThick = "Thick"; + public string OptionsPensThin = "Thin"; + public string OptionsPensNormal = "Normal"; + public string OptionsPensThick = "Thick"; public string OptionsHotKeySnapInPointerGrp = "Snaphsot in Pointer Mode"; public string OptionsHotKeySnapInPointerLbl = "press and hold.... .... and press twice\n\n\nBoth None = Disabled"; public string OptionsHotKeySnapInPointerKeys = "None\nShift\nCtrl\nAlt"; // Order to be respected!!! public string OptionsHotKeyAltAsOneCommand = "Process Alt as Temporary Command (Alt will be ignored in hotkeys)"; - public string OptionsHotkeysglobal = "Global hotkey (start drawing, switch between mouse pointer and drawing)"; - public string OptionsHotkeysEnableinpointer = "Enable all following hotkeys in mouse pointer mode (may cause a mess)"; - - public string VideoTab="Video"; - public string OptNoVideo="No video recording"; - public string OptObsRecord="OBS recording"; - public string OptObsBcast="OBS broadcasting"; - public string LblWsUrl="WebSocket URL"; - public string LblWsPwd="Password"; + public string OptionsHotkeysglobal = "Global hotkey (start drawing, switch between mouse pointer and drawing)"; + public string OptionsHotkeysEnableinpointer = "Enable all following hotkeys in mouse pointer mode (may cause a mess)"; + + public string VideoTab = "Video"; + public string OptNoVideo = "No video recording"; + public string OptObsRecord = "OBS recording"; + public string OptObsBcast = "OBS broadcasting"; + public string LblWsUrl = "WebSocket URL"; + public string LblWsPwd = "Password"; public string LblObsNote = "Note : OBS should be started before starting record\nOBS should be installed with Websocket plugin,with port and password configured"; - public string OptFfmpeg="FFmpeg recording"; - public string LblFfmpegCmd="Command Line"; + public string OptFfmpeg = "FFmpeg recording"; + public string LblFfmpegCmd = "Command Line"; public string LblFfmpegNote = "Note :substitution in command line\n" + " $xx$ $yy$ : upper left corner\n" + " $ww$ $hh$ : width and height of capture\n" + - " $DD$ $MM$ $YY$ $YYYY$ : date\n"+ - " $H$ $M$ $S$ : time\n"+ - " %DD% %MM% %YY% %YYYY% : date at ppInk startup\n"+ - " %H% %M% %S% : time at ppInk startup\n"+ - " $nn$ : counter(restarted at 1 at ppInk restart)\n"+ - " %VAR% : use of environment variable VAR"; - public string NotificationSnapshot = "Snapshot saved. Click here to browse snapshots."; + " $DD$ $MM$ $YY$ $YYYY$ : date\n" + + " $H$ $M$ $S$ : time\n" + + " %DD% %MM% %YY% %YYYY% : date at ppInk startup\n" + + " %H% %M% %S% : time at ppInk startup\n" + + " $nn$ : counter(restarted at 1 at ppInk restart)\n" + + " %VAR% : use of environment variable VAR"; + public string NotificationSnapshot = "Snapshot saved. Click here to browse snapshots."; public string KeyNamesStr = "0x00=None \n0x01=LButton \n0x02=RButton \n0x03=Cancel \n0x04=MButton \n0x05=XButton1 \n0x06=XButton2 \n0x08=Back \n0x09=Tab \n0x0A=LineFeed \n0x0C=Clear \n0x0D=Enter \n0x10=Shift \n0x11=Control \n0x12=Menu \n0x13=Pause \n0x14=CapsLock \n0x15=KanaMode \n0x17=JunjaMode \n0x18=FinalMode \n0x19=KanjiMode \n0x1B=Escape \n0x1C=IMEConvert \n0x1D=IMENonconvert \n0x1E=IMEAccept \n0x1F=IMEModeChange \n0x20=Space \n0x21=PageUp \n0x22=PageDown \n0x23=End \n0x24=Home \n0x25=Left \n0x26=Up \n0x27=Right \n0x28=Down \n0x29=Select \n0x2A=Print \n0x2B=Execute \n0x2C=PrintScreen \n0x2D=Insert \n0x2E=Delete \n0x2F=Help \n0x30=0 \n0x31=1 \n0x32=2 \n0x33=3 \n0x34=4 \n0x35=5 \n0x36=6 \n0x37=7 \n0x38=8 \n0x39=9 \n0x41=A \n0x42=B \n0x43=C \n0x44=D \n0x45=E \n0x46=F \n0x47=G \n0x48=H \n0x49=I \n0x4A=J \n0x4B=K \n0x4C=L \n0x4D=M \n0x4E=N \n0x4F=O \n0x50=P \n0x51=Q \n0x52=R \n0x53=S \n0x54=T \n0x55=U \n0x56=V \n0x57=W \n0x58=X \n0x59=Y \n0x5A=Z \n0x5B=LWin \n0x5C=RWin \n0x5D=Apps \n0x5F=Sleep \n0x60=NumPad0 \n0x61=NumPad1 \n0x62=NumPad2 \n0x63=NumPad3 \n0x64=NumPad4 \n0x65=NumPad5 \n0x66=NumPad6 \n0x67=NumPad7 \n0x68=NumPad8 \n0x69=NumPad9 \n0x6A=Multiply \n0x6B=Add \n0x6C=Separator \n0x6D=Subtract \n0x6E=Decimal \n0x6F=Divide \n0x70=F1 \n0x71=F2 \n0x72=F3 \n0x73=F4 \n0x74=F5 \n0x75=F6 \n0x76=F7 \n0x77=F8 \n0x78=F9 \n0x79=F10 \n0x7A=F11 \n0x7B=F12 \n0x7C=F13 \n0x7D=F14 \n0x7E=F15 \n0x7F=F16 \n0x80=F17 \n0x81=F18 \n0x82=F19 \n0x83=F20 \n0x84=F21 \n0x85=F22 \n0x86=F23 \n0x87=F24 \n0x90=NumLock \n0x91=Scroll \n0xA0=LShiftKey \n0xA1=RShiftKey \n0xA2=LControlKey \n0xA3=RControlKey \n0xA4=LMenu \n0xA5=RMenu \n0xA6=BrowserBack \n0xA7=BrowserForward \n0xA8=BrowserRefresh \n0xA9=BrowserStop \n0xAA=BrowserSearch \n0xAB=BrowserFavorites \n0xAC=BrowserHome \n0xAD=VolumeMute \n0xAE=VolumeDown \n0xAF=VolumeUp \n0xB0=MediaNextTrack \n0xB1=MediaPreviousTrack \n0xB2=MediaStop \n0xB3=MediaPlayPause \n0xB4=LaunchMail \n0xB5=SelectMedia \n0xB6=LaunchApplication1 \n0xB7=LaunchApplication2 \n0xBA=OemSemicolon \n0xBB=Oemplus \n0xBC=Oemcomma \n0xBD=OemMinus \n0xBE=OemPeriod \n0xBF=OemQuestion \n0xC0=Oemtilde \n0xDB=OemOpenBrackets \n0xDC=OemPipe \n0xDD=OemCloseBrackets \n0xDE=OemQuotes \n0xDF=Oem8 \n0xE2=OemBackslash \n0xE5=ProcessKey \n0xE7=Packet \n0xF6=Attn \n0xF7=Crsel \n0xF8=Exsel \n0xF9=EraseEof \n0xFA=Play \n0xFB=Zoom \n0xFC=NoName \n0xFD=Pa1 \n0xFE=OemClear \n0x00010000=Shift \n0x00020000=Control \n0x00040000=Alt"; public Dictionary KeyNames = new Dictionary(); - public Local() - { - ButtonNamePen[0] = "Pen 0"; - ButtonNamePen[1] = "Pen 1"; - ButtonNamePen[2] = "Pen 2"; - ButtonNamePen[3] = "Pen 3"; - ButtonNamePen[4] = "Pen 4"; - ButtonNamePen[5] = "Pen 5"; - ButtonNamePen[6] = "Pen 6"; - ButtonNamePen[7] = "Pen 7"; - ButtonNamePen[8] = "Pen 8"; - ButtonNamePen[9] = "Pen 9"; - - LoadKeyNames(); - - LoadLocalList(); - } + public Local() + { + ButtonNamePen[0] = "Pen 0"; + ButtonNamePen[1] = "Pen 1"; + ButtonNamePen[2] = "Pen 2"; + ButtonNamePen[3] = "Pen 3"; + ButtonNamePen[4] = "Pen 4"; + ButtonNamePen[5] = "Pen 5"; + ButtonNamePen[6] = "Pen 6"; + ButtonNamePen[7] = "Pen 7"; + ButtonNamePen[8] = "Pen 8"; + ButtonNamePen[9] = "Pen 9"; + + LoadKeyNames(); + + LoadLocalList(); + } private void LoadKeyNames() { System.ComponentModel.Int32Converter conv = new System.ComponentModel.Int32Converter(); foreach (string st1 in KeyNamesStr.Split('\n')) { - string[] st = st1.Trim().Split(new char[] { '=' },2); - KeyNames[(int)(conv.ConvertFromString(st[0]))]=st[1]; + string[] st = st1.Trim().Split(new char[] { '=' }, 2); + KeyNames[(int)(conv.ConvertFromString(st[0]))] = st[1]; } LocalSt.KeyNames = KeyNames; - } - - public void LoadLocalList() - { - DirectoryInfo d = new DirectoryInfo("./lang/"); - if (!d.Exists) - d = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + "lang"); - if (!d.Exists) - return; - - FileInfo[] Files = d.GetFiles("*.txt"); - foreach (FileInfo file in Files) - { - FileStream fini = new FileStream(file.FullName, FileMode.Open); - StreamReader srini = new StreamReader(fini); - string sLine; - do - { - sLine = srini.ReadLine(); - } - while (sLine != null && !sLine.StartsWith("LanguageName")); - if (sLine == null) - continue; - string sPara = sLine.Substring(sLine.IndexOf("=") + 1); - sPara = sPara.Trim(); - sPara = sPara.Trim('\"'); - string languagename = sPara; - - Languages.Add(file.Name.Substring(0, file.Name.Length - 4), sPara); - - fini.Close(); - } - } - - public List GetLanguagenames() - { - List names = new List(); - foreach (KeyValuePair pair in Languages) - names.Add(pair.Value); - - return names; - } - - public string GetFilenameByLanguagename(string languagename) - { - foreach (KeyValuePair pair in Languages) - if (pair.Value == languagename) - return pair.Key; - - return ""; - } - - public string GetLanguagenameByFilename(string filename) - { - foreach (KeyValuePair pair in Languages) - if (pair.Key == filename) - return pair.Value; - - return ""; - } - - public void LoadLocalFile(string loname) - { - string filename = "./lang/" + loname + ".txt"; - - if (!File.Exists(filename)) - filename = AppDomain.CurrentDomain.BaseDirectory + "lang/" + loname + ".txt"; - if (!File.Exists(filename)) - return; - - FileStream fini = new FileStream(filename, FileMode.Open); - StreamReader srini = new StreamReader(fini); - string sLine = ""; - string sName = "", sPara = ""; - while (sLine != null) - { - sLine = srini.ReadLine(); - if - ( - sLine != null && - sLine != "" && - sLine.Substring(0, 1) != "-" && - sLine.Substring(0, 1) != "%" && - sLine.Substring(0, 1) != "'" && - sLine.Substring(0, 1) != "/" && - sLine.Substring(0, 1) != "!" && - sLine.Substring(0, 1) != "[" && - sLine.Substring(0, 1) != "#" && - sLine.Contains("=") - //sLine.Contains("=") && - //!sLine.Substring(sLine.IndexOf("=") + 1).Contains("=") - ) - { - sName = sLine.Substring(0, sLine.IndexOf("=")); - sName = sName.Trim(); - sPara = sLine.Substring(sLine.IndexOf("=") + 1).Replace("\\n","\n"); - sPara = sPara.Trim(); - sPara = sPara.Trim('\"'); - - if (sName.StartsWith("ButtonNamePen")) - { - int penid = 0; - if (int.TryParse(sName.Substring(13, 1), out penid)) - { - ButtonNamePen[penid] = sPara; - } - } - - System.Reflection.FieldInfo fi = typeof(Local).GetField(sName); - if (fi != null) - fi.SetValue(this, sPara); - } - } - fini.Close(); - LoadKeyNames(); - CurrentLanguageFile = loname; - } - } + } + + public void LoadLocalList() + { + DirectoryInfo d = new DirectoryInfo("./lang/"); + if (!d.Exists) + d = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + "lang"); + if (!d.Exists) + return; + + FileInfo[] Files = d.GetFiles("*.txt"); + foreach (FileInfo file in Files) + { + FileStream fini = new FileStream(file.FullName, FileMode.Open); + StreamReader srini = new StreamReader(fini); + string sLine; + do + { + sLine = srini.ReadLine(); + } + while (sLine != null && !sLine.StartsWith("LanguageName")); + if (sLine == null) + continue; + string sPara = sLine.Substring(sLine.IndexOf("=") + 1); + sPara = sPara.Trim(); + sPara = sPara.Trim('\"'); + string languagename = sPara; + + Languages.Add(file.Name.Substring(0, file.Name.Length - 4), sPara); + + fini.Close(); + } + } + + public List GetLanguagenames() + { + List names = new List(); + foreach (KeyValuePair pair in Languages) + names.Add(pair.Value); + + return names; + } + + public string GetFilenameByLanguagename(string languagename) + { + foreach (KeyValuePair pair in Languages) + if (pair.Value == languagename) + return pair.Key; + + return ""; + } + + public string GetLanguagenameByFilename(string filename) + { + foreach (KeyValuePair pair in Languages) + if (pair.Key == filename) + return pair.Value; + + return ""; + } + + public void LoadLocalFile(string loname) + { + string filename = "./lang/" + loname + ".txt"; + + if (!File.Exists(filename)) + filename = AppDomain.CurrentDomain.BaseDirectory + "lang/" + loname + ".txt"; + if (!File.Exists(filename)) + return; + + FileStream fini = new FileStream(filename, FileMode.Open); + StreamReader srini = new StreamReader(fini); + string sLine = ""; + string sName = "", sPara = ""; + while (sLine != null) + { + sLine = srini.ReadLine(); + if + ( + sLine != null && + sLine != "" && + sLine.Substring(0, 1) != "-" && + sLine.Substring(0, 1) != "%" && + sLine.Substring(0, 1) != "'" && + sLine.Substring(0, 1) != "/" && + sLine.Substring(0, 1) != "!" && + sLine.Substring(0, 1) != "[" && + sLine.Substring(0, 1) != "#" && + sLine.Contains("=") + //sLine.Contains("=") && + //!sLine.Substring(sLine.IndexOf("=") + 1).Contains("=") + ) + { + sName = sLine.Substring(0, sLine.IndexOf("=")); + sName = sName.Trim(); + sPara = sLine.Substring(sLine.IndexOf("=") + 1).Replace("\\n", "\n"); + sPara = sPara.Trim(); + sPara = sPara.Trim('\"'); + + if (sName.StartsWith("ButtonNamePen")) + { + int penid = 0; + if (int.TryParse(sName.Substring(13, 1), out penid)) + { + ButtonNamePen[penid] = sPara; + } + } + + System.Reflection.FieldInfo fi = typeof(Local).GetField(sName); + if (fi != null) + fi.SetValue(this, sPara); + } + } + fini.Close(); + LoadKeyNames(); + CurrentLanguageFile = loname; + } + } } diff --git a/src/PenModifyDlg.cs b/src/PenModifyDlg.cs index fcfa8247..1b97bfe2 100644 --- a/src/PenModifyDlg.cs +++ b/src/PenModifyDlg.cs @@ -20,14 +20,14 @@ public PenModifyDlg(Root root) CancelBtn.Text = Root.Local.ButtonCancelText; } - public void setColor(int alpha,Color c) + public void setColor(int alpha, Color c) { - colorEditorManager.Color = Color.FromArgb(255-alpha, c); + colorEditorManager.Color = Color.FromArgb(255 - alpha, c); } public int getAlpha() { - return 255-colorEditorManager.Color.A; + return 255 - colorEditorManager.Color.A; } public Color getColor() @@ -37,12 +37,12 @@ public Color getColor() public void setWidth(float w) { - pboxPenWidthIndicator.Left = (int)(Math.Sqrt(w / 1250)* 200); + pboxPenWidthIndicator.Left = (int)(Math.Sqrt(w / 1250) * 200); } public float getWidth() { - double f = (pboxPenWidthIndicator.Left/ 200.0); + double f = (pboxPenWidthIndicator.Left / 200.0); return (float)(f * f * 1250); } @@ -86,10 +86,10 @@ private void gpPenWidth_MouseMove(object sender, MouseEventArgs e) { if (!gpPenWidth_MouseOn) return; - if (e.X < pboxPenWidthIndicator.Width/2) + if (e.X < pboxPenWidthIndicator.Width / 2) pboxPenWidthIndicator.Left = 0; - else if (e.X > (gpPenWidth.Width - pboxPenWidthIndicator.Width/2)) - pboxPenWidthIndicator.Left = (gpPenWidth.Width - pboxPenWidthIndicator.Width/2); + else if (e.X > (gpPenWidth.Width - pboxPenWidthIndicator.Width / 2)) + pboxPenWidthIndicator.Left = (gpPenWidth.Width - pboxPenWidthIndicator.Width / 2); else pboxPenWidthIndicator.Left = e.X - pboxPenWidthIndicator.Width / 2; } @@ -118,7 +118,7 @@ private void pboxPenWidthIndicator_MouseUp(object sender, MouseEventArgs e) private void colorEditorManager_ColorChanged(object sender, EventArgs e) { - gpPenWidth.BackColor = colorEditorManager.Color; + gpPenWidth.BackColor = colorEditorManager.Color; } } } diff --git a/src/Program.cs b/src/Program.cs index 496bb217..7957f1c0 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -9,9 +9,9 @@ using System.Reflection; namespace gInk -{ - static class Program - { +{ + static class Program + { #region Dll Imports private const int HWND_BROADCAST = 0xFFFF; @@ -24,22 +24,22 @@ static class Program #endregion Dll Imports public static int StartInkingMsg = RegisterWindowMessage("START_INKING"); - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main() - { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { CallForm frm; if (!EnsureSingleInstance()) return; - Application.ThreadException += new ThreadExceptionEventHandler(UIThreadException); - Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); - AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnhandledException); - - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); + Application.ThreadException += new ThreadExceptionEventHandler(UIThreadException); + Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); + AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnhandledException); + + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); DateTime n = DateTime.Now; Environment.SetEnvironmentVariable("YYYY", n.Year.ToString("0000")); @@ -61,80 +61,80 @@ static void Main() frm.Width = frm.Root.FormWidth; frm.Height = frm.Root.FormWidth; frm.Opacity = frm.Root.FormOpacity / 100.0; - if (Environment.CommandLine.IndexOf("--StartInking", StringComparison.OrdinalIgnoreCase) >= 0 ) + if (Environment.CommandLine.IndexOf("--StartInking", StringComparison.OrdinalIgnoreCase) >= 0) PostMessage((IntPtr)HWND_BROADCAST, StartInkingMsg, (IntPtr)null, (IntPtr)null); // to Myself - Application.Run(); - } - - private static void UIThreadException(object sender, ThreadExceptionEventArgs t) - { - DialogResult result = DialogResult.Cancel; - try - { - Exception ex = (Exception)t.Exception; + Application.Run(); + } + + private static void UIThreadException(object sender, ThreadExceptionEventArgs t) + { + DialogResult result = DialogResult.Cancel; + try + { + Exception ex = (Exception)t.Exception; DateTime lastModified = System.IO.File.GetLastWriteTime(Environment.GetCommandLineArgs()[0]); string errorMsg = "UIThreadException\r\n\r\n"; - errorMsg += "version "+Assembly.GetExecutingAssembly().GetName().Version.ToString() + " built on " + Build.Timestamp + "\r\n"; - errorMsg += "Oops, ppInk crashed! Please include the following information if you plan to contact the developers (a copy of the following information is stored in crash.txt in the application folder):\r\n\r\n"; - errorMsg += ex.Message + "\r\n\r\n"; - errorMsg += "Stack Trace:\r\n" + ex.StackTrace + "\r\n\r\n"; - WriteErrorLog(errorMsg); - - errorMsg += "!!! PLEASE PRESS ESC KEY TO EXIT IF YOU FEEL YOUR MOUSE CLICK IS BLOCKED BY SOMETHING"; - ShowErrorDialog("UIThreadException", errorMsg); - } - catch - { - try - { - MessageBox.Show("Fatal Windows Forms Error", "Fatal Windows Forms Error", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Stop); - } - finally - { - Application.Exit(); - } - } - - // Exits the program when the user clicks Abort. - if (result == DialogResult.Abort) - Application.Exit(); - } - - private static void UnhandledException(object sender, UnhandledExceptionEventArgs e) - { - try - { - Exception ex = (Exception)e.ExceptionObject; + errorMsg += "version " + Assembly.GetExecutingAssembly().GetName().Version.ToString() + " built on " + Build.Timestamp + "\r\n"; + errorMsg += "Oops, ppInk crashed! Please include the following information if you plan to contact the developers (a copy of the following information is stored in crash.txt in the application folder):\r\n\r\n"; + errorMsg += ex.Message + "\r\n\r\n"; + errorMsg += "Stack Trace:\r\n" + ex.StackTrace + "\r\n\r\n"; + WriteErrorLog(errorMsg); + + errorMsg += "!!! PLEASE PRESS ESC KEY TO EXIT IF YOU FEEL YOUR MOUSE CLICK IS BLOCKED BY SOMETHING"; + ShowErrorDialog("UIThreadException", errorMsg); + } + catch + { + try + { + MessageBox.Show("Fatal Windows Forms Error", "Fatal Windows Forms Error", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Stop); + } + finally + { + Application.Exit(); + } + } + + // Exits the program when the user clicks Abort. + if (result == DialogResult.Abort) + Application.Exit(); + } + + private static void UnhandledException(object sender, UnhandledExceptionEventArgs e) + { + try + { + Exception ex = (Exception)e.ExceptionObject; DateTime lastModified = System.IO.File.GetLastWriteTime(Environment.GetCommandLineArgs()[0]); string errorMsg = "UnhandledException\r\n\r\n"; - errorMsg += "version "+Assembly.GetExecutingAssembly().GetName().Version.ToString() + " built on " + Build.Timestamp + "\r\n"; - errorMsg += "Oops, ppInk crashed! Please include the following information if you plan to contact the developers:\r\n\r\n"; - errorMsg += ex.Message + "\r\n\r\n"; - errorMsg += "Stack Trace:\r\n" + ex.StackTrace + "\r\n\r\n"; - WriteErrorLog(errorMsg); - - ShowErrorDialog("UnhandledException", errorMsg); - - if (!EventLog.SourceExists("UnhandledException")) - { - EventLog.CreateEventSource("UnhandledException", "Application"); - } - EventLog myLog = new EventLog(); - myLog.Source = "UnhandledException"; - myLog.WriteEntry(errorMsg); - } - catch (Exception exc) - { - try - { - MessageBox.Show("Fatal Non-UI Error", "Fatal Non-UI Error. Could not write the error to the event log. Reason: " + exc.Message, MessageBoxButtons.OK, MessageBoxIcon.Stop); - } - finally - { - Application.Exit(); - } - } - } + errorMsg += "version " + Assembly.GetExecutingAssembly().GetName().Version.ToString() + " built on " + Build.Timestamp + "\r\n"; + errorMsg += "Oops, ppInk crashed! Please include the following information if you plan to contact the developers:\r\n\r\n"; + errorMsg += ex.Message + "\r\n\r\n"; + errorMsg += "Stack Trace:\r\n" + ex.StackTrace + "\r\n\r\n"; + WriteErrorLog(errorMsg); + + ShowErrorDialog("UnhandledException", errorMsg); + + if (!EventLog.SourceExists("UnhandledException")) + { + EventLog.CreateEventSource("UnhandledException", "Application"); + } + EventLog myLog = new EventLog(); + myLog.Source = "UnhandledException"; + myLog.WriteEntry(errorMsg); + } + catch (Exception exc) + { + try + { + MessageBox.Show("Fatal Non-UI Error", "Fatal Non-UI Error. Could not write the error to the event log. Reason: " + exc.Message, MessageBoxButtons.OK, MessageBoxIcon.Stop); + } + finally + { + Application.Exit(); + } + } + } private static bool EnsureSingleInstance() { @@ -159,31 +159,31 @@ private static bool EnsureSingleInstance() } - private static DialogResult ShowErrorDialog(string title, string errormsg) - { - return MessageBox.Show(errormsg, title, MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Stop); - } - - public static void WriteErrorLog(string errormsg) - { - try - { - FileStream fs = new FileStream("crash.txt", FileMode.Append); - StreamWriter sw = new StreamWriter(fs); - sw.Write(System.DateTime.Now.ToString("MM / dd / yyyy HH:mm")); - sw.Write(errormsg); - sw.Close(); - fs.Close(); - } - catch - { - FileStream fs = new FileStream(AppDomain.CurrentDomain.BaseDirectory + "crash.txt", FileMode.Append); - StreamWriter sw = new StreamWriter(fs); + private static DialogResult ShowErrorDialog(string title, string errormsg) + { + return MessageBox.Show(errormsg, title, MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Stop); + } + + public static void WriteErrorLog(string errormsg) + { + try + { + FileStream fs = new FileStream("crash.txt", FileMode.Append); + StreamWriter sw = new StreamWriter(fs); sw.Write(System.DateTime.Now.ToString("MM / dd / yyyy HH:mm")); - sw.Write(errormsg); - sw.Close(); - fs.Close(); - } - } - } + sw.Write(errormsg); + sw.Close(); + fs.Close(); + } + catch + { + FileStream fs = new FileStream(AppDomain.CurrentDomain.BaseDirectory + "crash.txt", FileMode.Append); + StreamWriter sw = new StreamWriter(fs); + sw.Write(System.DateTime.Now.ToString("MM / dd / yyyy HH:mm")); + sw.Write(errormsg); + sw.Close(); + fs.Close(); + } + } + } } diff --git a/src/Root.cs b/src/Root.cs index cec174d8..0303d938 100644 --- a/src/Root.cs +++ b/src/Root.cs @@ -29,7 +29,8 @@ public class Tools public const int Edit = 7; public const int txtLeftAligned = 8; public const int txtRightAligned = 9; public const int Move = 10; public const int Copy = 11; public const int Poly = 21; public const int ClipArt = 22; } - public class Filling { + public class Filling + { public const int NoFrame = -1; // for Stamps public const int Empty = 0; public const int PenColorFilled = 1; @@ -37,7 +38,8 @@ public class Filling { public const int BlackFilled = 3; } // applicable to Hand,Rect,Oval - public class Orientation{ + public class Orientation + { public const int min = 0; public const int toLeft = 0; // original public const int toRight = 1; @@ -56,32 +58,32 @@ public class ClipArtData public int Filling; }; - public enum VideoRecordMode {NoVideo=0 , OBSRec=1 , OBSBcst=2 , FfmpegRec=3 }; - public enum VideoRecInProgress { Stopped=0, Starting=1, Recording=2, Stopping = 3, Pausing=4, Paused=5, Resuming=6, Streaming = 7 }; + public enum VideoRecordMode { NoVideo = 0, OBSRec = 1, OBSBcst = 2, FfmpegRec = 3 }; + public enum VideoRecInProgress { Stopped = 0, Starting = 1, Recording = 2, Stopping = 3, Pausing = 4, Paused = 5, Resuming = 6, Streaming = 7 }; - public enum SnapInPointerKeys { None=0, Shift=1, Control=2, Alt=3 }; + public enum SnapInPointerKeys { None = 0, Shift = 1, Control = 2, Alt = 3 }; public class TestMessageFilter : IMessageFilter - { - public Root Root; + { + public Root Root; - public TestMessageFilter(Root root) - { - Root = root; - } + public TestMessageFilter(Root root) + { + Root = root; + } - public bool PreFilterMessage(ref Message m) - { - if (m.Msg == 0x0312 || m.Msg == Program.StartInkingMsg) // 0x0312 is the global hotkey + public bool PreFilterMessage(ref Message m) + { + if (m.Msg == 0x0312 || m.Msg == Program.StartInkingMsg) // 0x0312 is the global hotkey { //Keys key = (Keys)(((int)m.LParam >> 16) & 0xFFFF); // The key of the hotkey that was pressed. //int modifier = (int)m.LParam & 0xFFFF; // The modifier of the hotkey that was pressed. //int id = m.WParam.ToInt32(); // The id of the hotkey that was pressed. - bool activePointer = (m.Msg == 0x0312 && Root.FormCollection != null); + bool activePointer = m.Msg == 0x0312 && Root.FormCollection != null; Root.callshortcut(); if (activePointer) // StartInkingMsg is received twice, therefore we have to froce pointerMode at that time... { - Root.FormCollection.btPointer_Click(null,null); + Root.FormCollection.btPointer_Click(null, null); if (Root.AltTabPointer && !Root.PointerMode && !Root.FormCollection.Initializing) // to unfold the bar if AltTabPointer option has been set { Root.UnDock(); @@ -89,13 +91,14 @@ public bool PreFilterMessage(ref Message m) } return true; - } - return false; - } - } + } + return false; + } + } - public static class globalRoot { - public static bool HideInAltTab=true; + public static class globalRoot + { + public static bool HideInAltTab = true; }; public class Root @@ -136,13 +139,13 @@ public class Root public static int MIN_MAGNETIC = 25; // options - public int ToolbarOrientation = Orientation.toLeft; + public int ToolbarOrientation; public bool[] PenEnabled = new bool[MaxPenCount]; public bool ToolsEnabled = true; public bool EraserEnabled = true; public bool PointerEnabled = true; - public bool AltTabPointer = false; - public bool PenWidthEnabled = false; + public bool AltTabPointer; + public bool PenWidthEnabled; public bool WidthAtPenSel = true; public bool SnapEnabled = true; public bool UndoEnabled = true; @@ -154,14 +157,14 @@ public class Root public bool AutoScroll; public bool WhiteTrayIcon; public string SnapshotBasePath; - public int CanvasCursor = 0; + public int CanvasCursor; public bool AllowDraggingToolbar = true; public bool AllowHotkeyInPointerMode = true; public int gpButtonsLeft, gpButtonsTop; // advanced options public string CloseOnSnap = "blankonly"; - public bool AlwaysHideToolbar = false; + public bool AlwaysHideToolbar; public float ToolbarHeight = 0.06f; public bool AltAsOneCommand = true; @@ -172,22 +175,22 @@ public class Root // the two grays for "white board" effect public int[] Gray1 = new int[] { 80, 150, 150, 150 }; - public int[] Gray2 = new int[] {100, 100, 100, 100}; + public int[] Gray2 = new int[] { 100, 100, 100, 100 }; public int[] ToolbarBGColor = new int[] { 245, 245, 245, 0 }; - public int BoardAtOpening = 0; // 0:Transparent/1:White/2:Customed/3:Black/4:AtSelection - public int BoardSelected = 0; // by default transparent + public int BoardAtOpening; // 0:Transparent/1:White/2:Customed/3:Black/4:AtSelection + public int BoardSelected; // by default transparent // hotkey options public Hotkey Hotkey_Global = new Hotkey(); - public Hotkey[] Hotkey_Pens = new Hotkey[10]; - public Hotkey Hotkey_Eraser = new Hotkey(); - public Hotkey Hotkey_InkVisible = new Hotkey(); - public Hotkey Hotkey_Pointer = new Hotkey(); - public Hotkey Hotkey_Pan = new Hotkey(); - public Hotkey Hotkey_Undo = new Hotkey(); - public Hotkey Hotkey_Redo = new Hotkey(); - public Hotkey Hotkey_Snap = new Hotkey(); - public Hotkey Hotkey_Clear = new Hotkey(); + public Hotkey[] Hotkey_Pens = new Hotkey[10]; + public Hotkey Hotkey_Eraser = new Hotkey(); + public Hotkey Hotkey_InkVisible = new Hotkey(); + public Hotkey Hotkey_Pointer = new Hotkey(); + public Hotkey Hotkey_Pan = new Hotkey(); + public Hotkey Hotkey_Undo = new Hotkey(); + public Hotkey Hotkey_Redo = new Hotkey(); + public Hotkey Hotkey_Snap = new Hotkey(); + public Hotkey Hotkey_Clear = new Hotkey(); public Hotkey Hotkey_Video = new Hotkey(); public Hotkey Hotkey_DockUndock = new Hotkey(); public Hotkey Hotkey_Close = new Hotkey(); @@ -208,25 +211,25 @@ public class Root public Hotkey Hotkey_ClipArt3 = new Hotkey(); public Hotkey Hotkey_Zoom = new Hotkey(); - public int ToolSelected = Tools.Hand; // indicates which tool (Hand,Line,...) is currently selected - public int FilledSelected = 0; // indicates which filling (None, Selected color, ...) is currently select - public bool EraserMode = false; - public bool Docked = false; - public bool PointerMode = false; - public bool FingerInAction = false; // true when mouse down, either drawing or snapping or whatever - public int Snapping = 0; // <=0: not snapping, 1: waiting finger, 2:dragging - public int SnappingX = -1, SnappingY = -1; - public Rectangle SnappingRect; - public int UponButtonsUpdate = 0; - public bool UponTakingSnap = false; - public bool UponBalloonSnap = false; - public bool UponSubPanelUpdate = false; - public bool UponAllDrawingUpdate = false; - public bool MouseMovedUnderSnapshotDragging = false; // used to pause re-drawing when mouse is not moving during dragging to take a screenshot - - public bool PanMode = false; - public bool InkVisible = true; - public int MagneticRadius= MIN_MAGNETIC; // Magnet Radius; <=0 means off; + public int ToolSelected; // indicates which tool (Hand,Line,...) is currently selected + public int FilledSelected; // indicates which filling (None, Selected color, ...) is currently select + public bool EraserMode; + public bool Docked; + public bool PointerMode; + public bool FingerInAction; // true when mouse down, either drawing or snapping or whatever + public int Snapping; // <=0: not snapping, 1: waiting finger, 2:dragging + public int SnappingX = -1, SnappingY = -1; + public Rectangle SnappingRect; + public int UponButtonsUpdate; + public bool UponTakingSnap; + public bool UponBalloonSnap; + public bool UponSubPanelUpdate; + public bool UponAllDrawingUpdate; + public bool MouseMovedUnderSnapshotDragging; // used to pause re-drawing when mouse is not moving during dragging to take a screenshot + + public bool PanMode; + public bool InkVisible = true; + public int MagneticRadius = MIN_MAGNETIC; // Magnet Radius; <=0 means off; public int MinMagneticRadius() { return Math.Max(Math.Abs(MagneticRadius), MIN_MAGNETIC); } public Stroke StrokeHovered; // contains the "selection" for edit/move/copy/erase else is null public Pen SelectionFramePen = new Pen(Color.Red, 1); @@ -235,76 +238,76 @@ public class Root public bool DefaultArrow_start = true; public Ink[] UndoStrokes; - //public Ink UponUndoStrokes; - public int UndoP; - public int UndoDepth, RedoDepth; - - public NotifyIcon trayIcon; - public ContextMenu trayMenu; - public FormCollection FormCollection; - public FormDisplay FormDisplay; - public FormButtonHitter FormButtonHitter; - public FormOptions FormOptions; - - public int CurrentPen = 1; // defaut pen - public int LastPen = 1; - public int GlobalPenWidth = 80; - public bool gpPenWidthVisible = false; - public string SnapshotFileFullPath = ""; // used to record the last snapshot file name, to select it when the balloon is clicked + //public Ink UponUndoStrokes; + public int UndoP; + public int UndoDepth, RedoDepth; + + public NotifyIcon trayIcon; + public ContextMenu trayMenu; + public FormCollection FormCollection; + public FormDisplay FormDisplay; + public FormButtonHitter FormButtonHitter; + public FormOptions FormOptions; + + public int CurrentPen = 1; // defaut pen + public int LastPen = 1; + public int GlobalPenWidth = 80; + public bool gpPenWidthVisible; + public string SnapshotFileFullPath = ""; // used to record the last snapshot file name, to select it when the balloon is clicked public int FormTop = 100, FormLeft = 100, FormWidth = 48, FormOpacity = -50; // negative opacity means that the window is not displayed - public CallForm callForm = null; - public bool OpenIntoSnapMode = false; + public CallForm callForm; + public bool OpenIntoSnapMode; - public double ArrowAngle = 15 * Math.PI /180; // 15° + public double ArrowAngle = 15 * Math.PI / 180; // 15° public double ArrowLen = 0.0185 * System.Windows.SystemParameters.PrimaryScreenWidth; // == 1.85% of screen width public int TagNumbering = 1; public int TagSize = 25; public string TagFont = ""; - public bool TagItalic = false; - public bool TagBold = false; + public bool TagItalic; + public bool TagBold; public int TextSize = 25; public string TextFont = "Arial"; - public bool TextItalic = false; - public bool TextBold = false; + public bool TextItalic; + public bool TextBold; - public VideoRecordMode VideoRecordMode = VideoRecordMode.NoVideo; + public VideoRecordMode VideoRecordMode; public string ObsUrl = "ws://localhost:4444"; public string ObsPwd = "obs"; public string FFMpegCmd = "ffmpeg.exe -f gdigrab -framerate 15 -offset_x $xx$ -offset_y $yy$ -video_size $ww$x$hh$ -show_region 1 -i desktop -vcodec libx264 %USERPROFILE%/CAPT_%DD%%MM%%YY%_%H%%M%%S%_$nn$.mkv"; - public int VideoRecordCounter = 0; - public VideoRecInProgress VideoRecInProgress = VideoRecInProgress.Stopped; - public Process FFmpegProcess = null; - public bool VideoRecordWindowInProgress = false; + public int VideoRecordCounter; + public VideoRecInProgress VideoRecInProgress; + public Process FFmpegProcess; + public bool VideoRecordWindowInProgress; public ClientWebSocket ObsWs; public Task ObsRecvTask; public CancellationTokenSource ObsCancel = new CancellationTokenSource(); public int StampSize = 128; public StringCollection StampFileNames = new StringCollection(); - public ClipArtData ImageStamp = new ClipArtData { ImageStamp = "", X = -1, Y = -1, Filling = (int)(Filling.NoFrame) }; + public ClipArtData ImageStamp = new ClipArtData { ImageStamp = "", X = -1, Y = -1, Filling = (int)Filling.NoFrame }; public float StampScaleRatio = .1F; - public int ImageStampFilling = 0; + public int ImageStampFilling; public string ImageStamp1 = ""; public string ImageStamp2 = ""; public string ImageStamp3 = ""; - + public bool CleanOnHide; public float TimeBeforeFading = 5.0F; //5s default public int ZoomWidth = 100; public int ZoomHeight = 100; public float ZoomScale = 3.0F; - public bool ZoomContinous = false; + public bool ZoomContinous; public int ZoomEnabled = 3; - public Rectangle WindowRect = new Rectangle(Int32.MinValue, Int32.MinValue, -1, -1); - public bool ResizeDrawingWindow = false; + public Rectangle WindowRect = new Rectangle(int.MinValue, int.MinValue, -1, -1); + public bool ResizeDrawingWindow; - public SnapInPointerKeys SnapInPointerHoldKey = SnapInPointerKeys.Shift; + public SnapInPointerKeys SnapInPointerHoldKey = SnapInPointerKeys.Shift; public SnapInPointerKeys SnapInPointerPressTwiceKey = SnapInPointerKeys.Control; - - public bool InverseMousewheel=false; + + public bool InverseMousewheel; //public string ProgramFolder; @@ -329,51 +332,58 @@ public string ExpandVarCmd(string cmd, int x, int y, int w, int h) public Root() - { - Global.ProgramFolder = Path.GetDirectoryName(Path.GetFullPath(Environment.GetCommandLineArgs()[0])).Replace('\\','/'); - SelectionFramePen.DashPattern = new float[]{4,4}; // dashed red line for selection drawing + { + Global.ProgramFolder = Path.GetDirectoryName(Path.GetFullPath(Environment.GetCommandLineArgs()[0])).Replace('\\', '/'); + SelectionFramePen.DashPattern = new float[] { 4, 4 }; // dashed red line for selection drawing if (Global.ProgramFolder[Global.ProgramFolder.Length - 1] != '/') + { Global.ProgramFolder += '/'; - for (int p = 0; p < MaxPenCount; p++) - Hotkey_Pens[p] = new Hotkey(); + } - trayMenu = new ContextMenu(); - trayMenu.MenuItems.Add(Local.MenuEntryAbout + "...", OnAbout); - trayMenu.MenuItems.Add(Local.MenuEntryOptions + "...", OnOptions); - trayMenu.MenuItems.Add("-"); - trayMenu.MenuItems.Add(Local.MenuEntryExit, OnExit); + for (int p = 0; p < MaxPenCount; p++) + { + Hotkey_Pens[p] = new Hotkey(); + } - SetDefaultPens(); - SetDefaultConfig(); - ReadOptions("config.ini"); - ReadOptions("pens.ini"); - ReadOptions("hotkeys.ini"); + trayMenu = new ContextMenu(); + trayMenu.MenuItems.Add(Local.MenuEntryAbout + "...", OnAbout); + trayMenu.MenuItems.Add(Local.MenuEntryOptions + "...", OnOptions); + trayMenu.MenuItems.Add("-"); + trayMenu.MenuItems.Add(Local.MenuEntryExit, OnExit); - if(TagFont=="") // if no options, we apply text parameters + SetDefaultPens(); + SetDefaultConfig(); + ReadOptions("config.ini"); + ReadOptions("pens.ini"); + ReadOptions("hotkeys.ini"); + + if (TagFont == "") // if no options, we apply text parameters { TagFont = TextFont; TagBold = TextBold; TagItalic = TextItalic; TagSize = TextSize; } - + Size size = SystemInformation.SmallIconSize; - trayIcon = new NotifyIcon(); - trayIcon.Text = "ppInk"; - trayIcon.ContextMenu = trayMenu; - trayIcon.Visible = true; - trayIcon.MouseClick += TrayIcon_Click; - trayIcon.BalloonTipText = Local.NotificationSnapshot; - trayIcon.BalloonTipClicked += TrayIcon_BalloonTipClicked; - SetTrayIconColor(); + trayIcon = new NotifyIcon + { + Text = "ppInk", + ContextMenu = trayMenu, + Visible = true + }; + trayIcon.MouseClick += TrayIcon_Click; + trayIcon.BalloonTipText = Local.NotificationSnapshot; + trayIcon.BalloonTipClicked += TrayIcon_BalloonTipClicked; + SetTrayIconColor(); - SetHotkey(); + SetHotkey(); - TestMessageFilter mf = new TestMessageFilter(this); - Application.AddMessageFilter(mf); + TestMessageFilter mf = new TestMessageFilter(this); + Application.AddMessageFilter(mf); - FormCollection = null; - FormDisplay = null; + FormCollection = null; + FormDisplay = null; // to be done once only //ReadOptions("pens.ini"); @@ -388,10 +398,16 @@ public void callshortcut() if (FormCollection == null && FormDisplay == null) { //if (FormOpacity > 0) callForm.Hide(); - if (FormOpacity > 0) callForm.Close(); + if (FormOpacity > 0) + { + callForm.Close(); + } + StartInk(); if (OpenIntoSnapMode) - FormCollection.btSnap_Click(null,null); + { + FormCollection.btSnap_Click(null, null); + } } /* else if (PointerMode) @@ -408,36 +424,40 @@ public void callshortcut() } private void TrayIcon_BalloonTipClicked(object sender, EventArgs e) - { - //string snapbasepath = SnapshotBasePath; - //snapbasepath = Environment.ExpandEnvironmentVariables(snapbasepath); - //System.Diagnostics.Process.Start(snapbasepath); - string fullpath = System.IO.Path.GetFullPath(SnapshotFileFullPath); - System.Diagnostics.Process.Start("explorer.exe", string.Format("/select,\"{0}\"", fullpath)); - } + { + //string snapbasepath = SnapshotBasePath; + //snapbasepath = Environment.ExpandEnvironmentVariables(snapbasepath); + //System.Diagnostics.Process.Start(snapbasepath); + string fullpath = System.IO.Path.GetFullPath(SnapshotFileFullPath); + System.Diagnostics.Process.Start("explorer.exe", string.Format("/select,\"{0}\"", fullpath)); + } - private void TrayIcon_Click(object sender, MouseEventArgs e) - { - if (e.Button == MouseButtons.Left) - { + private void TrayIcon_Click(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Left) + { if (FormDisplay == null && FormCollection == null) - { + { callshortcut(); //ReadOptions("pens.ini"); //ReadOptions("config.ini"); //ReadOptions("hotkeys.ini"); //StartInk(); - } - else if (Docked) - UnDock(); - } - } + } + else if (Docked) + { + UnDock(); + } + } + } - public void StartInk() - { - if (FormDisplay != null || FormCollection != null) - return; + public void StartInk() + { + if (FormDisplay != null || FormCollection != null) + { + return; + } Docked = false; PointerMode = false; // we have to reset pointer mode when starting drawing; @@ -445,40 +465,48 @@ public void StartInk() UponTakingSnap = false; FormCollection = new FormCollection(this); - FormButtonHitter = new FormButtonHitter(this); - FormDisplay = new FormDisplay(this); // FormDisplay is created at the end to ensure other objects are created. - if (CurrentPen < 0) - CurrentPen = 0; - if (!PenEnabled[CurrentPen]) - { - CurrentPen = 0; - while (CurrentPen < MaxPenCount && !PenEnabled[CurrentPen]) - CurrentPen++; - if (CurrentPen == MaxPenCount) - CurrentPen = -2; - } - SelectPen(CurrentPen); - SetInkVisible(true); - FormCollection.ButtonsEntering = 1; - FormDisplay.Show(); - FormCollection.Show(); - FormDisplay.DrawButtons(true); - - if (UndoStrokes == null) - { - UndoStrokes = new Ink[8]; - UndoStrokes[0] = FormCollection.IC.Ink.Clone(); - UndoDepth = 0; - UndoP = 0; - } - - //UponUndoStrokes = FormCollection.IC.Ink.Clone(); - } - public void StopInk() - { - try { FormCollection.Close(); } catch { } + FormButtonHitter = new FormButtonHitter(this); + FormDisplay = new FormDisplay(this); // FormDisplay is created at the end to ensure other objects are created. + if (CurrentPen < 0) + { + CurrentPen = 0; + } + + if (!PenEnabled[CurrentPen]) + { + CurrentPen = 0; + while (CurrentPen < MaxPenCount && !PenEnabled[CurrentPen]) + { + CurrentPen++; + } + + if (CurrentPen == MaxPenCount) + { + CurrentPen = -2; + } + } + SelectPen(CurrentPen); + SetInkVisible(true); + FormCollection.ButtonsEntering = 1; + FormDisplay.Show(); + FormCollection.Show(); + FormDisplay.DrawButtons(true); + + if (UndoStrokes == null) + { + UndoStrokes = new Ink[8]; + UndoStrokes[0] = FormCollection.IC.Ink.Clone(); + UndoDepth = 0; + UndoP = 0; + } + + //UponUndoStrokes = FormCollection.IC.Ink.Clone(); + } + public void StopInk() + { + try { FormCollection.Close(); } catch { } try { FormDisplay.Close(); } catch { } - try { FormButtonHitter.Close(); } catch { } + try { FormButtonHitter.Close(); } catch { } GC.Collect(); @@ -493,10 +521,10 @@ public void StopInk() FormButtonHitter = null; if (UponBalloonSnap) - { - ShowBalloonSnapshot(); - UponBalloonSnap = false; - } + { + ShowBalloonSnapshot(); + UponBalloonSnap = false; + } //if (FormOpacity > 0) callForm.Show(); if (FormOpacity > 0 && !ResizeDrawingWindow) { @@ -510,125 +538,143 @@ public void StopInk() } } - public void ClearInk() - { - FormCollection.IC.Ink.DeleteStrokes(); + public void ClearInk() + { + FormCollection.IC.Ink.DeleteStrokes(); FormDisplay.ClearCanvus(); FormDisplay.DrawButtons(true); FormDisplay.UpdateFormDisplay(true); } public void ShowBalloonSnapshot() - { - trayIcon.ShowBalloonTip(3000); - } + { + trayIcon.ShowBalloonTip(3000); + } - public void UndoInk() - { - if (UndoDepth <= 0) - return; - if(FormCollection.IC.Ink.Strokes.Count>0 && FormCollection.IC.Ink.Strokes[FormCollection.IC.Ink.Strokes.Count - 1].ExtendedProperties.Contains(ISTAG_GUID)) + public void UndoInk() + { + if (UndoDepth <= 0) + { + return; + } + + if (FormCollection.IC.Ink.Strokes.Count > 0 && FormCollection.IC.Ink.Strokes[FormCollection.IC.Ink.Strokes.Count - 1].ExtendedProperties.Contains(ISTAG_GUID)) { TagNumbering--; } - UndoP--; - if (UndoP < 0) - UndoP = UndoStrokes.GetLength(0) - 1; - UndoDepth--; - RedoDepth++; - FormCollection.IC.Ink.DeleteStrokes(); - if (UndoStrokes[UndoP].Strokes.Count > 0) + UndoP--; + if (UndoP < 0) + { + UndoP = UndoStrokes.GetLength(0) - 1; + } + + UndoDepth--; + RedoDepth++; + FormCollection.IC.Ink.DeleteStrokes(); + if (UndoStrokes[UndoP].Strokes.Count > 0) { - FormCollection.IC.Ink.AddStrokesAtRectangle(UndoStrokes[UndoP].Strokes, UndoStrokes[UndoP].Strokes.GetBoundingBox()); + FormCollection.IC.Ink.AddStrokesAtRectangle(UndoStrokes[UndoP].Strokes, UndoStrokes[UndoP].Strokes.GetBoundingBox()); if (ToolSelected == Tools.Poly) - FormCollection.RestorePolylineData(FormCollection.IC.Ink.Strokes[FormCollection.IC.Ink.Strokes.Count-1]); + { + FormCollection.RestorePolylineData(FormCollection.IC.Ink.Strokes[FormCollection.IC.Ink.Strokes.Count - 1]); + } } - FormDisplay.ClearCanvus(); - FormDisplay.DrawStrokes(); - FormDisplay.DrawButtons(true); - FormDisplay.UpdateFormDisplay(true); - } + FormDisplay.ClearCanvus(); + FormDisplay.DrawStrokes(); + FormDisplay.DrawButtons(true); + FormDisplay.UpdateFormDisplay(true); + } - public void Pan(int x, int y) - { - if (x == 0 && y == 0) - return; + public void Pan(int x, int y) + { + if (x == 0 && y == 0) + { + return; + } - FormCollection.IC.Ink.Strokes.Move(x, y); + FormCollection.IC.Ink.Strokes.Move(x, y); // for texts - foreach(Stroke st in FormCollection.IC.Ink.Strokes) + foreach (Stroke st in FormCollection.IC.Ink.Strokes) { if (st.ExtendedProperties.Contains(TEXTX_GUID)) { - st.ExtendedProperties.Add(TEXTX_GUID, (int)(st.ExtendedProperties[TEXTX_GUID].Data) + x); - st.ExtendedProperties.Add(TEXTY_GUID, (int)(st.ExtendedProperties[TEXTY_GUID].Data) + y); + st.ExtendedProperties.Add(TEXTX_GUID, (int)st.ExtendedProperties[TEXTX_GUID].Data + x); + st.ExtendedProperties.Add(TEXTY_GUID, (int)st.ExtendedProperties[TEXTY_GUID].Data + y); } } - FormDisplay.ClearCanvus(); - FormDisplay.DrawStrokes(); - FormDisplay.DrawButtons(true); - FormDisplay.UpdateFormDisplay(true); - } + FormDisplay.ClearCanvus(); + FormDisplay.DrawStrokes(); + FormDisplay.DrawButtons(true); + FormDisplay.UpdateFormDisplay(true); + } - public void SetInkVisible(bool visible) - { - InkVisible = visible; - if (visible) - FormCollection.btInkVisible.BackgroundImage = FormCollection.image_visible; - else - FormCollection.btInkVisible.BackgroundImage = FormCollection.image_visible_not; - - FormDisplay.ClearCanvus(); - FormDisplay.DrawStrokes(); - FormDisplay.DrawButtons(true); - FormDisplay.UpdateFormDisplay(true); - } + public void SetInkVisible(bool visible) + { + InkVisible = visible; + FormCollection.btInkVisible.BackgroundImage = visible ? FormCollection.image_visible : FormCollection.image_visible_not; - public void RedoInk() - { - if (RedoDepth <= 0) - return; - - UndoDepth++; - RedoDepth--; - UndoP++; - if (UndoP >= UndoStrokes.GetLength(0)) - UndoP = 0; - FormCollection.IC.Ink.DeleteStrokes(); - if (UndoStrokes[UndoP].Strokes.Count > 0) - FormCollection.IC.Ink.AddStrokesAtRectangle(UndoStrokes[UndoP].Strokes, UndoStrokes[UndoP].Strokes.GetBoundingBox()); - - FormDisplay.ClearCanvus(); - FormDisplay.DrawStrokes(); - FormDisplay.DrawButtons(true); - FormDisplay.UpdateFormDisplay(true); - } + FormDisplay.ClearCanvus(); + FormDisplay.DrawStrokes(); + FormDisplay.DrawButtons(true); + FormDisplay.UpdateFormDisplay(true); + } - public void Dock() - { - if (FormDisplay == null || FormCollection == null) - return; + public void RedoInk() + { + if (RedoDepth <= 0) + { + return; + } + + UndoDepth++; + RedoDepth--; + UndoP++; + if (UndoP >= UndoStrokes.GetLength(0)) + { + UndoP = 0; + } + + FormCollection.IC.Ink.DeleteStrokes(); + if (UndoStrokes[UndoP].Strokes.Count > 0) + { + FormCollection.IC.Ink.AddStrokesAtRectangle(UndoStrokes[UndoP].Strokes, UndoStrokes[UndoP].Strokes.GetBoundingBox()); + } + + FormDisplay.ClearCanvus(); + FormDisplay.DrawStrokes(); + FormDisplay.DrawButtons(true); + FormDisplay.UpdateFormDisplay(true); + } + + public void Dock() + { + if (FormDisplay == null || FormCollection == null) + { + return; + } - Docked = true; - gpPenWidthVisible = false; - switch(ToolbarOrientation) + Docked = true; + gpPenWidthVisible = false; + switch (ToolbarOrientation) { case Orientation.toLeft: FormCollection.btDock.BackgroundImage = gInk.Properties.Resources.dockback; break; case Orientation.toRight: FormCollection.btDock.BackgroundImage = gInk.Properties.Resources.dock; break; - case Orientation.toUp: FormCollection.btDock.BackgroundImage = gInk.Properties.Resources.dockbackV ; break; + case Orientation.toUp: FormCollection.btDock.BackgroundImage = gInk.Properties.Resources.dockbackV; break; case Orientation.toDown: FormCollection.btDock.BackgroundImage = gInk.Properties.Resources.dockV; break; } FormCollection.ButtonsEntering = -1; - UponButtonsUpdate |= 0x2; - } + UponButtonsUpdate |= 0x2; + } - public void UnDock() - { - if (FormDisplay == null || FormCollection == null) - return; + public void UnDock() + { + if (FormDisplay == null || FormCollection == null) + { + return; + } - Docked = false; + Docked = false; switch (ToolbarOrientation) { case Orientation.toLeft: FormCollection.btDock.BackgroundImage = gInk.Properties.Resources.dock; break; @@ -636,228 +682,274 @@ public void UnDock() case Orientation.toUp: FormCollection.btDock.BackgroundImage = gInk.Properties.Resources.dockV; break; case Orientation.toDown: FormCollection.btDock.BackgroundImage = gInk.Properties.Resources.dockbackV; break; } - FormCollection.ButtonsEntering = 1; - UponButtonsUpdate |= 0x2; - } + FormCollection.ButtonsEntering = 1; + UponButtonsUpdate |= 0x2; + } - public void Pointer() - { - if (PointerMode == true) - return; + public void Pointer() + { + if (PointerMode == true) + { + return; + } - PointerMode = true; + if (CleanOnHide) { + ClearInk(); + Dock(); + } + PointerMode = true; FormDisplay.DrawBorder(false); - FormCollection.ToThrough(); - FormButtonHitter.Show(); - FormButtonHitter.timer1_Tick(null,null); // Force Size recomputation for alt+tab processing + FormCollection.ToThrough(); + FormButtonHitter.Show(); + FormButtonHitter.timer1_Tick(null, null); // Force Size recomputation for alt+tab processing } - public void UnPointer() - { - if (PointerMode == false) - return; - - FormCollection.AddPointerSnaps(); - FormButtonHitter.Hide(); - FormCollection.ToUnThrough(); - FormCollection.ToTopMost(); - FormCollection.Activate(); - PointerMode = false; - } + public void UnPointer() + { + if (PointerMode == false) + { + return; + } - public void SelectPen(int pen) - { - FormCollection.SelectPen(pen); - } + if (CleanOnHide) { + ClearInk(); + } - public void SetDefaultPens() - { - PenEnabled[0] = false; - PenAttr[0] = new DrawingAttributes(); - PenAttr[0].Color = Color.FromArgb(80, 80, 80); - PenAttr[0].Width = 80; - PenAttr[0].Transparency = 0; - - PenEnabled[1] = true; - PenAttr[1] = new DrawingAttributes(); - PenAttr[1].Color = Color.FromArgb(225, 60, 60); - PenAttr[1].Width = 80; - PenAttr[1].Transparency = 0; - - PenEnabled[2] = true; - PenAttr[2] = new DrawingAttributes(); - PenAttr[2].Color = Color.FromArgb(30, 110, 200); - PenAttr[2].Width = 80; - PenAttr[2].Transparency = 0; - - PenEnabled[3] = true; - PenAttr[3] = new DrawingAttributes(); - PenAttr[3].Color = Color.FromArgb(235, 180, 55); - PenAttr[3].Width = 80; - PenAttr[3].Transparency = 0; - - PenEnabled[4] = true; - PenAttr[4] = new DrawingAttributes(); - PenAttr[4].Color = Color.FromArgb(120, 175, 70); - PenAttr[4].Width = 80; - PenAttr[4].Transparency = 0; - - PenEnabled[5] = true; - PenAttr[5] = new DrawingAttributes(); - PenAttr[5].Color = Color.FromArgb(235, 125, 15); - PenAttr[5].Width = 500; - PenAttr[5].Transparency = 175; - - PenAttr[6] = new DrawingAttributes(); - PenAttr[6].Color = Color.FromArgb(230, 230, 230); - PenAttr[6].Width = 80; - PenAttr[6].Transparency = 0; - - PenAttr[7] = new DrawingAttributes(); - PenAttr[7].Color = Color.FromArgb(250, 140, 200); - PenAttr[7].Width = 80; - PenAttr[7].Transparency = 0; - - PenAttr[8] = new DrawingAttributes(); - PenAttr[8].Color = Color.FromArgb(25, 180, 175); - PenAttr[8].Width = 80; - PenAttr[8].Transparency = 0; - - PenAttr[9] = new DrawingAttributes(); - PenAttr[9].Color = Color.FromArgb(145, 70, 160); - PenAttr[9].Width = 500; - PenAttr[9].Transparency = 175; - } + PointerMode = false; + FormCollection.ToUnThrough(); + FormCollection.ToTopMost(); + FormCollection.Activate(); + PointerMode = false; + if(CleanOnHide) { + FormButtonHitter.Hide(); + } + } - public void SetDefaultConfig() - { - Hotkey_Global.Control = true; - Hotkey_Global.Alt = true; - Hotkey_Global.Shift = false; - Hotkey_Global.Win = false; - Hotkey_Global.Key = 'G'; - - AutoScroll = false; - WhiteTrayIcon = false; - SnapshotBasePath = "%USERPROFILE%/Pictures/gInk/"; - } + public void SelectPen(int pen) + { + FormCollection.SelectPen(pen); + } - public void SetTrayIconColor() - { - if (WhiteTrayIcon) - { - if (File.Exists("icon_white.ico")) - trayIcon.Icon = new Icon("icon_white.ico"); - else - trayIcon.Icon = global::gInk.Properties.Resources.icon_white; - } - else - { - if (File.Exists("icon_red.ico")) - trayIcon.Icon = new Icon("icon_red.ico"); - else - trayIcon.Icon = global::gInk.Properties.Resources.icon_red; - } + public void SetDefaultPens() + { + PenEnabled[0] = false; + PenAttr[0] = new DrawingAttributes + { + Color = Color.FromArgb(80, 80, 80), + Width = 80, + Transparency = 0 + }; + PenEnabled[1] = true; + PenAttr[1] = new DrawingAttributes + { + Color = Color.FromArgb(225, 60, 60), + Width = 80, + Transparency = 0 + }; - } + PenEnabled[2] = true; + PenAttr[2] = new DrawingAttributes + { + Color = Color.FromArgb(30, 110, 200), + Width = 80, + Transparency = 0 + }; - public void ReadOptions(string file) - { - if (!File.Exists(file)) - file = AppDomain.CurrentDomain.BaseDirectory + file; - if (!File.Exists(file)) - return; - - - FileStream fini = new FileStream(file, FileMode.Open); - StreamReader srini = new StreamReader(fini); - string sLine = ""; - string sName = "", sPara = ""; - while (sLine != null) - { - sLine = srini.ReadLine(); - if - ( - sLine != null && - sLine != "" && - sLine.Substring(0, 1) != "-" && - sLine.Substring(0, 1) != "%" && - sLine.Substring(0, 1) != "'" && - sLine.Substring(0, 1) != "/" && - sLine.Substring(0, 1) != "!" && - sLine.Substring(0, 1) != "[" && - sLine.Substring(0, 1) != "#" && - sLine.Contains("=") && - !sLine.Substring(sLine.IndexOf("=") + 1).Contains("=") - ) - { - sName = sLine.Substring(0, sLine.IndexOf("=")); - sName = sName.Trim(); - sName = sName.ToUpper(); - sPara = sLine.Substring(sLine.IndexOf("=") + 1); - sPara = sPara.Trim(); - - if (sName.StartsWith("PEN")) - { - int penid = 0; - if (int.TryParse(sName.Substring(3, 1), out penid)) - { - if (sName.EndsWith("_ENABLED")) - { - if (sPara.ToUpper() == "TRUE" || sPara == "1" || sPara.ToUpper() == "ON") - PenEnabled[penid] = true; - else if (sPara.ToUpper() == "FALSE" || sPara == "0" || sPara.ToUpper() == "OFF") - PenEnabled[penid] = false; - } - - int penc = 0; - if (int.TryParse(sPara, out penc)) - { - if (sName.EndsWith("_RED") && penc >= 0 && penc <= 255) - { - PenAttr[penid].Color = Color.FromArgb(penc, PenAttr[penid].Color.G, PenAttr[penid].Color.B); - } - else if (sName.EndsWith("_GREEN") && penc >= 0 && penc <= 255) - { - PenAttr[penid].Color = Color.FromArgb(PenAttr[penid].Color.R, penc, PenAttr[penid].Color.B); - } - else if (sName.EndsWith("_BLUE") && penc >= 0 && penc <= 255) - { - PenAttr[penid].Color = Color.FromArgb(PenAttr[penid].Color.R, PenAttr[penid].Color.G, penc); - } - else if (sName.EndsWith("_ALPHA") && penc >= 0 && penc <= 255) - { - PenAttr[penid].Transparency = (byte)(255 - penc); - } - else if (sName.EndsWith("_WIDTH") && penc >= 30 && penc <= 3000) - { - PenAttr[penid].Width = penc; - } + PenEnabled[3] = true; + PenAttr[3] = new DrawingAttributes + { + Color = Color.FromArgb(235, 180, 55), + Width = 80, + Transparency = 0 + }; + + PenEnabled[4] = true; + PenAttr[4] = new DrawingAttributes + { + Color = Color.FromArgb(120, 175, 70), + Width = 80, + Transparency = 0 + }; + + PenEnabled[5] = true; + PenAttr[5] = new DrawingAttributes + { + Color = Color.FromArgb(235, 125, 15), + Width = 500, + Transparency = 175 + }; + + PenAttr[6] = new DrawingAttributes + { + Color = Color.FromArgb(230, 230, 230), + Width = 80, + Transparency = 0 + }; + + PenAttr[7] = new DrawingAttributes + { + Color = Color.FromArgb(250, 140, 200), + Width = 80, + Transparency = 0 + }; + + PenAttr[8] = new DrawingAttributes + { + Color = Color.FromArgb(25, 180, 175), + Width = 80, + Transparency = 0 + }; + + PenAttr[9] = new DrawingAttributes + { + Color = Color.FromArgb(145, 70, 160), + Width = 500, + Transparency = 175 + }; + } + + public void SetDefaultConfig() + { + Hotkey_Global.Control = true; + Hotkey_Global.Alt = true; + Hotkey_Global.Shift = false; + Hotkey_Global.Win = false; + Hotkey_Global.Key = 'G'; + + AutoScroll = false; + WhiteTrayIcon = false; + SnapshotBasePath = "%USERPROFILE%/Pictures/gInk/"; + } + + public void SetTrayIconColor() + { + if (WhiteTrayIcon) + { + trayIcon.Icon = File.Exists("icon_white.ico") ? new Icon("icon_white.ico") : global::gInk.Properties.Resources.icon_white; + } + else + { + trayIcon.Icon = File.Exists("icon_red.ico") ? new Icon("icon_red.ico") : global::gInk.Properties.Resources.icon_red; + } + + + } + + public void ReadOptions(string file) + { + if (!File.Exists(file)) + { + file = AppDomain.CurrentDomain.BaseDirectory + file; + } + + if (!File.Exists(file)) + { + return; + } + + FileStream fini = new FileStream(file, FileMode.Open); + StreamReader srini = new StreamReader(fini); + string sLine = ""; + string sName = "", sPara = ""; + while (sLine != null) + { + sLine = srini.ReadLine(); + if + ( + sLine != null && + sLine != "" && + sLine.Substring(0, 1) != "-" && + sLine.Substring(0, 1) != "%" && + sLine.Substring(0, 1) != "'" && + sLine.Substring(0, 1) != "/" && + sLine.Substring(0, 1) != "!" && + sLine.Substring(0, 1) != "[" && + sLine.Substring(0, 1) != "#" && + sLine.Contains("=") && + !sLine.Substring(sLine.IndexOf("=") + 1).Contains("=") + ) + { + sName = sLine.Substring(0, sLine.IndexOf("=")); + sName = sName.Trim(); + sName = sName.ToUpper(); + sPara = sLine.Substring(sLine.IndexOf("=") + 1); + sPara = sPara.Trim(); + + if (sName.StartsWith("PEN")) + { + int penid = 0; + if (int.TryParse(sName.Substring(3, 1), out penid)) + { + if (sName.EndsWith("_ENABLED")) + { + if (sPara.ToUpper() == "TRUE" || sPara == "1" || sPara.ToUpper() == "ON") + { + PenEnabled[penid] = true; + } + else if (sPara.ToUpper() == "FALSE" || sPara == "0" || sPara.ToUpper() == "OFF") + { + PenEnabled[penid] = false; + } + } + + int penc = 0; + if (int.TryParse(sPara, out penc)) + { + if (sName.EndsWith("_RED") && penc >= 0 && penc <= 255) + { + PenAttr[penid].Color = Color.FromArgb(penc, PenAttr[penid].Color.G, PenAttr[penid].Color.B); + } + else if (sName.EndsWith("_GREEN") && penc >= 0 && penc <= 255) + { + PenAttr[penid].Color = Color.FromArgb(PenAttr[penid].Color.R, penc, PenAttr[penid].Color.B); + } + else if (sName.EndsWith("_BLUE") && penc >= 0 && penc <= 255) + { + PenAttr[penid].Color = Color.FromArgb(PenAttr[penid].Color.R, PenAttr[penid].Color.G, penc); + } + else if (sName.EndsWith("_ALPHA") && penc >= 0 && penc <= 255) + { + PenAttr[penid].Transparency = (byte)(255 - penc); + } + else if (sName.EndsWith("_WIDTH") && penc >= 30 && penc <= 3000) + { + PenAttr[penid].Width = penc; + } } if (sName.EndsWith("_FADING")) { float k; - if (sPara.ToUpper() == "Y") - k = TimeBeforeFading; + if (sPara.ToUpper() == "Y") + { + k = TimeBeforeFading; + } + if (sPara.ToUpper() == "N") + { k = -1; + } else if (!float.TryParse(sPara, out k)) + { k = TimeBeforeFading; - if(k>0) + } + + if (k > 0) + { PenAttr[penid].ExtendedProperties.Add(FADING_PEN, k); + } } if (sName.EndsWith("_HOTKEY")) - { - Hotkey_Pens[penid].Parse(sPara); - } - } + { + Hotkey_Pens[penid].Parse(sPara); + } + } - } + } - int tempi = 0; - float tempf = 0; + int tempi = 0; + float tempf = 0; string[] tab; switch (sName) { @@ -865,10 +957,7 @@ public void ReadOptions(string file) ChangeLanguage(sPara); break; case "ALT_AS_TEMPORARY_COMMAND": - if (sPara.ToUpper() == "TRUE" || sPara == "1" || sPara.ToUpper() == "ON") - AltAsOneCommand = true; - else - AltAsOneCommand = false; + AltAsOneCommand = sPara.ToUpper() == "TRUE" || sPara == "1" || sPara.ToUpper() == "ON"; break; case "HOTKEY_GLOBAL": Hotkey_Global.Parse(sPara); @@ -953,201 +1042,320 @@ public void ReadOptions(string file) break; case "WHITE_TRAY_ICON": - if (sPara.ToUpper() == "TRUE" || sPara == "1" || sPara.ToUpper() == "ON") - WhiteTrayIcon = true; - else - WhiteTrayIcon = false; + WhiteTrayIcon = sPara.ToUpper() == "TRUE" || sPara == "1" || sPara.ToUpper() == "ON"; break; case "HIDE_IN_ALTTAB": - if (sPara.ToUpper() == "TRUE" || sPara == "1" || sPara.ToUpper() == "ON") - globalRoot.HideInAltTab = true; - else - globalRoot.HideInAltTab = false; + globalRoot.HideInAltTab = sPara.ToUpper() == "TRUE" || sPara == "1" || sPara.ToUpper() == "ON"; break; case "SNAPSHOT_PATH": SnapshotBasePath = sPara; if (!SnapshotBasePath.EndsWith("/") && !SnapshotBasePath.EndsWith("\\")) + { SnapshotBasePath += "/"; - break; + } + + break; case "OPEN_INTO_SNAP": - if (sPara.ToUpper() == "TRUE" || sPara == "1" || sPara.ToUpper() == "OFF") - OpenIntoSnapMode = true; - else - OpenIntoSnapMode = false; + OpenIntoSnapMode = sPara.ToUpper() == "TRUE" || sPara == "1" || sPara.ToUpper() == "OFF"; + break; + case "CLEAN_ON_HIDE": + CleanOnHide = sPara.ToUpper() == "TRUE" || sPara == "1" || sPara.ToUpper() == "OFF"; break; case "DRAWING_ICON": if (sPara.ToUpper() == "FALSE" || sPara == "0" || sPara.ToUpper() == "OFF") + { ToolsEnabled = false; + } + break; case "ARROW": // angle in degrees, len in % of the screen width tab = sPara.Split(','); - if (tab.Length != 2) break; + if (tab.Length != 2) + { + break; + } + if (float.TryParse(tab[0], NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out tempf)) + { ArrowAngle = tempf * Math.PI / 180; + } + if (float.TryParse(tab[1], NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out tempf)) + { ArrowLen = tempf / 100.0 * System.Windows.SystemParameters.PrimaryScreenWidth; + } + break; case "DEFAULT_ARROW": if (sPara.ToUpper() == "START") + { DefaultArrow_start = true; + } + if (sPara.ToUpper() == "END") + { DefaultArrow_start = false; + } + break; case "TEXT": // Font(string),italique(boolean),Bold(boolean),size(float) of the text in % of the screen, also defines the size of the { tab = sPara.Split(','); - if (tab.Length != 4) break; + if (tab.Length != 4) + { + break; + } + TextFont = tab[0]; string s = tab[1]; if (s.ToUpper() == "FALSE" || s == "0" || s.ToUpper() == "OFF") + { TextItalic = false; + } else if (s.ToUpper() == "TRUE" || s == "1" || s.ToUpper() == "ON") + { TextItalic = true; + } + s = tab[2]; if (s.ToUpper() == "FALSE" || s == "0" || s.ToUpper() == "OFF") + { TextBold = false; + } else if (s.ToUpper() == "TRUE" || s == "1" || s.ToUpper() == "ON") + { TextBold = true; + } + if (float.TryParse(tab[3], NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out tempf)) + { TextSize = (int)(tempf / 100.0 * System.Windows.SystemParameters.PrimaryScreenWidth); + } } break; case "NUMBERS": // Font(string),italique(boolean),Bold(boolean),size(float) of the text in % of the screen, also defines the size of the { tab = sPara.Split(','); - if (tab.Length != 4) break; + if (tab.Length != 4) + { + break; + } + TagFont = tab[0]; string s = tab[1]; if (s.ToUpper() == "FALSE" || s == "0" || s.ToUpper() == "OFF") + { TagItalic = false; + } else if (s.ToUpper() == "TRUE" || s == "1" || s.ToUpper() == "ON") + { TagItalic = true; + } + s = tab[2]; if (s.ToUpper() == "FALSE" || s == "0" || s.ToUpper() == "OFF") + { TagBold = false; + } else if (s.ToUpper() == "TRUE" || s == "1" || s.ToUpper() == "ON") + { TagBold = true; + } + if (float.TryParse(tab[3], NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out tempf)) + { TagSize = (int)(tempf / 100.0 * System.Windows.SystemParameters.PrimaryScreenWidth); + } } break; case "MAGNET": if (sPara.ToUpper() == "FALSE" || sPara == "0" || sPara.ToUpper() == "OFF") + { MagneticRadius = -MIN_MAGNETIC; + } else if (sPara.ToUpper() == "TRUE" || sPara == "1" || sPara.ToUpper() == "ON") + { MagneticRadius = MIN_MAGNETIC; + } else if (float.TryParse(sPara, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out tempf)) + { MagneticRadius = (int)(tempf / 100.0 * System.Windows.SystemParameters.PrimaryScreenWidth); + } + break; case "ERASER_ICON": - if (sPara.ToUpper() == "FALSE" || sPara == "0" || sPara.ToUpper() == "OFF") - EraserEnabled = false; - break; - case "POINTER_ICON": - if (sPara.ToUpper() == "FALSE" || sPara == "0" || sPara.ToUpper() == "OFF") - PointerEnabled = false; + if (sPara.ToUpper() == "FALSE" || sPara == "0" || sPara.ToUpper() == "OFF") + { + EraserEnabled = false; + } + + break; + case "POINTER_ICON": + if (sPara.ToUpper() == "FALSE" || sPara == "0" || sPara.ToUpper() == "OFF") + { + PointerEnabled = false; + } + break; case "ALTTAB_POINTER": - if (sPara.ToUpper() == "TRUE" || sPara == "1" || sPara.ToUpper() == "ON") - AltTabPointer = true; - else - AltTabPointer = false; + AltTabPointer = sPara.ToUpper() == "TRUE" || sPara == "1" || sPara.ToUpper() == "ON"; break; case "PEN_WIDTH_AT_SELECTION": if (sPara.ToUpper() == "FALSE" || sPara == "0" || sPara.ToUpper() == "OFF") + { WidthAtPenSel = false; + } else if (sPara.ToUpper() == "TRUE" || sPara == "1" || sPara.ToUpper() == "ON") + { WidthAtPenSel = true; + } + break; case "PEN_WIDTH_ICON": - if (sPara.ToUpper() == "FALSE" || sPara == "0" || sPara.ToUpper() == "OFF") - PenWidthEnabled = false; - else if (sPara.ToUpper() == "TRUE" || sPara == "1" || sPara.ToUpper() == "ON") - PenWidthEnabled = true; - break; - case "SNAPSHOT_ICON": - if (sPara.ToUpper() == "FALSE" || sPara == "0" || sPara.ToUpper() == "OFF") - SnapEnabled = false; - break; - case "CLOSE_ON_SNAP": - if (sPara.ToUpper() == "FALSE" || sPara == "0" || sPara.ToUpper() == "OFF") - CloseOnSnap = "false"; - else if (sPara.ToUpper() == "TRUE" || sPara == "1" || sPara.ToUpper() == "ON") - CloseOnSnap = "true"; - else if (sPara.ToUpper() == "BLANKONLY") - CloseOnSnap = "blankonly"; - break; - case "ALWAYS_HIDE_TOOLBAR": - if (sPara.ToUpper() == "TRUE" || sPara == "1" || sPara.ToUpper() == "ON") - AlwaysHideToolbar = true; - break; - case "UNDO_ICON": - if (sPara.ToUpper() == "FALSE" || sPara == "0" || sPara.ToUpper() == "OFF") - UndoEnabled = false; - break; - case "CLEAR_ICON": - if (sPara.ToUpper() == "FALSE" || sPara == "0" || sPara.ToUpper() == "OFF") - ClearEnabled = false; - break; - case "PAN_ICON": - if (sPara.ToUpper() == "FALSE" || sPara == "0" || sPara.ToUpper() == "OFF") - PanEnabled = false; - break; + if (sPara.ToUpper() == "FALSE" || sPara == "0" || sPara.ToUpper() == "OFF") + { + PenWidthEnabled = false; + } + else if (sPara.ToUpper() == "TRUE" || sPara == "1" || sPara.ToUpper() == "ON") + { + PenWidthEnabled = true; + } + + break; + case "SNAPSHOT_ICON": + if (sPara.ToUpper() == "FALSE" || sPara == "0" || sPara.ToUpper() == "OFF") + { + SnapEnabled = false; + } + + break; + case "CLOSE_ON_SNAP": + if (sPara.ToUpper() == "FALSE" || sPara == "0" || sPara.ToUpper() == "OFF") + { + CloseOnSnap = "false"; + } + else if (sPara.ToUpper() == "TRUE" || sPara == "1" || sPara.ToUpper() == "ON") + { + CloseOnSnap = "true"; + } + else if (sPara.ToUpper() == "BLANKONLY") + { + CloseOnSnap = "blankonly"; + } + + break; + case "ALWAYS_HIDE_TOOLBAR": + if (sPara.ToUpper() == "TRUE" || sPara == "1" || sPara.ToUpper() == "ON") + { + AlwaysHideToolbar = true; + } + + break; + case "UNDO_ICON": + if (sPara.ToUpper() == "FALSE" || sPara == "0" || sPara.ToUpper() == "OFF") + { + UndoEnabled = false; + } + + break; + case "CLEAR_ICON": + if (sPara.ToUpper() == "FALSE" || sPara == "0" || sPara.ToUpper() == "OFF") + { + ClearEnabled = false; + } + + break; + case "PAN_ICON": + if (sPara.ToUpper() == "FALSE" || sPara == "0" || sPara.ToUpper() == "OFF") + { + PanEnabled = false; + } + + break; case "LOADSAVE_ICON": if (sPara.ToUpper() == "FALSE" || sPara == "0" || sPara.ToUpper() == "OFF") + { LoadSaveEnabled = false; + } + break; case "INKVISIBLE_ICON": - if (sPara.ToUpper() == "FALSE" || sPara == "0" || sPara.ToUpper() == "OFF") - InkVisibleEnabled = false; - break; - case "ALLOW_DRAGGING_TOOLBAR": - if (sPara.ToUpper() == "FALSE" || sPara == "0" || sPara.ToUpper() == "OFF") - AllowDraggingToolbar = false; - break; - case "ALLOW_HOTKEY_IN_POINTER_MODE": - if (sPara.ToUpper() == "FALSE" || sPara == "0" || sPara.ToUpper() == "OFF") - AllowHotkeyInPointerMode = false; - break; + if (sPara.ToUpper() == "FALSE" || sPara == "0" || sPara.ToUpper() == "OFF") + { + InkVisibleEnabled = false; + } + + break; + case "ALLOW_DRAGGING_TOOLBAR": + if (sPara.ToUpper() == "FALSE" || sPara == "0" || sPara.ToUpper() == "OFF") + { + AllowDraggingToolbar = false; + } + + break; + case "ALLOW_HOTKEY_IN_POINTER_MODE": + if (sPara.ToUpper() == "FALSE" || sPara == "0" || sPara.ToUpper() == "OFF") + { + AllowHotkeyInPointerMode = false; + } + + break; case "ZOOM_ICON": - if (int.TryParse(sPara, out tempi)&& tempi>=0 && tempi<=3) - ZoomEnabled = tempi; + if (int.TryParse(sPara, out tempi) && tempi >= 0 && tempi <= 3) + { + ZoomEnabled = tempi; + } + break; case "TOOLBAR_LEFT": - if (int.TryParse(sPara, out tempi)) - gpButtonsLeft = tempi; - break; - case "TOOLBAR_TOP": - if (int.TryParse(sPara, out tempi)) - gpButtonsTop = tempi; - break; + if (int.TryParse(sPara, out tempi)) + { + gpButtonsLeft = tempi; + } + + break; + case "TOOLBAR_TOP": + if (int.TryParse(sPara, out tempi)) + { + gpButtonsTop = tempi; + } + + break; case "TOOLBAR_HEIGHT": - if (float.TryParse(sPara, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out tempf)) - ToolbarHeight = tempf; - break; - case "CANVAS_CURSOR": - if (sPara == "0") - CanvasCursor = 0; - else if (sPara == "1") - CanvasCursor = 1; - break; - case "WINDOW_POS": // if not defined, no window else 2 to 4 integers Top,Left,[Width/Height,[Opacity]] - tab = sPara.Split(','); - if (tab.Length >= 2) { FormTop = Int32.Parse(tab[0]);FormLeft = Int32.Parse(tab[1]); }; - if (tab.Length >= 3 ) { FormWidth = Int32.Parse(tab[2]); } - if (tab.Length >= 4) { FormOpacity = Int32.Parse(tab[3]); } - break; + if (float.TryParse(sPara, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out tempf)) + { + ToolbarHeight = tempf; + } + + break; + case "CANVAS_CURSOR": + if (sPara == "0") + { + CanvasCursor = 0; + } + else if (sPara == "1") + { + CanvasCursor = 1; + } + + break; + case "WINDOW_POS": // if not defined, no window else 2 to 4 integers Top,Left,[Width/Height,[Opacity]] + tab = sPara.Split(','); + if (tab.Length >= 2) { FormTop = int.Parse(tab[0]); FormLeft = int.Parse(tab[1]); }; + if (tab.Length >= 3) { FormWidth = int.Parse(tab[2]); } + if (tab.Length >= 4) { FormOpacity = int.Parse(tab[3]); } + break; case "INKING_AREA": // 4 integers tab = sPara.Split(','); if (tab.Length <= 4) { int a, b, c, d; - if (Int32.TryParse(tab[0], out a) && Int32.TryParse(tab[1], out b) && Int32.TryParse(tab[2], out c) && Int32.TryParse(tab[3], out d)) + if (int.TryParse(tab[0], out a) && int.TryParse(tab[1], out b) && int.TryParse(tab[2], out c) && int.TryParse(tab[3], out d)) { if (c > 0 && d > 0) // else default value ie full screen; { - a = a < 0 ? -1 : (Math.Min(Math.Max(SystemInformation.VirtualScreen.Left, a), SystemInformation.VirtualScreen.Right - c)); - b = b < 0 ? -1 : (Math.Min(Math.Max(SystemInformation.VirtualScreen.Top, b), SystemInformation.VirtualScreen.Bottom - d)); + a = a < 0 ? -1 : Math.Min(Math.Max(SystemInformation.VirtualScreen.Left, a), SystemInformation.VirtualScreen.Right - c); + b = b < 0 ? -1 : Math.Min(Math.Max(SystemInformation.VirtualScreen.Top, b), SystemInformation.VirtualScreen.Bottom - d); WindowRect = new Rectangle(a, b, c, d); } } @@ -1157,8 +1365,10 @@ public void ReadOptions(string file) tab = sPara.Split(','); if (tab.Length == 4) { - for(int i=0; i<4; i++) - Gray1[i] = Int32.Parse(tab[i]); + for (int i = 0; i < 4; i++) + { + Gray1[i] = int.Parse(tab[i]); + } }; break; case "GRAY_BOARD2": // if not defined, no window else 2 to 4 integers Top,Left,[Width/Height,[Opacity]] @@ -1166,7 +1376,9 @@ public void ReadOptions(string file) if (tab.Length == 4) { for (int i = 0; i < 4; i++) - Gray2[i] = Int32.Parse(tab[i]); + { + Gray2[i] = int.Parse(tab[i]); + } }; break; case "TOOLBAR_COLOR": // if not defined, no window else 2 to 4 integers Top,Left,[Width/Height,[Opacity]] @@ -1174,20 +1386,28 @@ public void ReadOptions(string file) if (tab.Length == 4) { for (int i = 0; i < 4; i++) - ToolbarBGColor[i] = Int32.Parse(tab[i]); + { + ToolbarBGColor[i] = int.Parse(tab[i]); + } }; break; case "BOARDATOPENING": - if (Int32.TryParse(sPara, out tempi)) - BoardAtOpening = tempi; + if (int.TryParse(sPara, out tempi)) + { + BoardAtOpening = tempi; + } + if (BoardAtOpening != 4) + { BoardSelected = BoardAtOpening; + } + break; case "VIDEO_RECORD_MODE": try { - this.VideoRecordMode = (VideoRecordMode)Enum.Parse(typeof(VideoRecordMode), sPara, false); + VideoRecordMode = (VideoRecordMode)Enum.Parse(typeof(VideoRecordMode), sPara, false); } catch { @@ -1207,228 +1427,287 @@ public void ReadOptions(string file) break; case "IMAGESTAMP_SIZE": if (int.TryParse(sPara, out tempi)) + { StampSize = tempi; + } + break; case "IMAGESTAMP_FILLING": if (int.TryParse(sPara, out tempi)) + { ImageStampFilling = tempi; + } + break; case "IMAGESTAMP_FILENAMES": - if (sPara.Length == 0) break; + if (sPara.Length == 0) + { + break; + } + string[] st = sPara.Replace('\\', '/').Trim(';').Split(';'); - foreach(string st1 in st) + foreach (string st1 in st) { - string st2; + string st2 = !Path.IsPathRooted(st1) ? Global.ProgramFolder + st1 : st1; //if (!Path.IsPathFullyQualified(st1)) - if (!Path.IsPathRooted(st1)) - st2 = Global.ProgramFolder + st1; - else - st2 = st1; if (!StampFileNames.Contains(st2)) - StampFileNames.Insert(StampFileNames.Count,st2); + { + StampFileNames.Insert(StampFileNames.Count, st2); + } } break; case "IMAGESTAMP1": if (sPara.Length == 0) - sPara=""; + { + sPara = ""; + } else if (!Path.IsPathRooted(sPara)) - sPara = Global.ProgramFolder + sPara; + { + sPara = Global.ProgramFolder + sPara; + } + if (!StampFileNames.Contains(sPara)) // to ensure the files are within the stamfiles; + { StampFileNames.Insert(StampFileNames.Count, sPara); + } + ImageStamp1 = sPara; break; case "IMAGESTAMP2": if (sPara.Length == 0) + { sPara = ""; + } else if (!Path.IsPathRooted(sPara)) + { sPara = Global.ProgramFolder + sPara; + } + if (!StampFileNames.Contains(sPara)) + { StampFileNames.Insert(StampFileNames.Count, sPara); + } + ImageStamp2 = sPara; break; case "IMAGESTAMP3": if (sPara.Length == 0) + { sPara = ""; + } else if (!Path.IsPathRooted(sPara)) + { sPara = Global.ProgramFolder + sPara; + } + if (!StampFileNames.Contains(sPara)) + { StampFileNames.Insert(StampFileNames.Count, sPara); + } + ImageStamp3 = sPara; break; case "TOOLBAR_DIRECTION": if (sPara.ToUpper() == "LEFT") + { ToolbarOrientation = Orientation.toLeft; + } + if (sPara.ToUpper() == "RIGHT") + { ToolbarOrientation = Orientation.toRight; + } + if (sPara.ToUpper() == "UP") + { ToolbarOrientation = Orientation.toUp; + } + if (sPara.ToUpper() == "DOWN") + { ToolbarOrientation = Orientation.toDown; + } + break; + + case "FADING_TIME": if (float.TryParse(sPara, out tempf)) + { TimeBeforeFading = tempf; + } + break; case "ZOOM": // Width;Height;scale(f);Continuous(Y/N) - if (sPara.Length == 0) break; + if (sPara.Length == 0) + { + break; + } + try { string[] stt = sPara.Split(';'); - Int32.TryParse(stt[0], out ZoomWidth); - Int32.TryParse(stt[1], out ZoomHeight); + int.TryParse(stt[0], out ZoomWidth); + int.TryParse(stt[1], out ZoomHeight); float.TryParse(stt[2], NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out ZoomScale); if (stt[3].ToUpper() == "TRUE" || stt[3] == "1" || stt[3].ToUpper() == "ON" || stt[3].ToUpper() == "Y") + { ZoomContinous = true; + } } catch { } break; case "INVERSE_MOUSEWHEEL_CONTROL": - InverseMousewheel = (sPara.ToUpper() == "TRUE" || sPara == "1" || sPara.ToUpper() == "ON"); + InverseMousewheel = sPara.ToUpper() == "TRUE" || sPara == "1" || sPara.ToUpper() == "ON"; break; case "SNAP_IN_POINTER_HOLD_KEY": //directly the int value; expected to be in hotkey.ini - if (Int32.TryParse(sPara, out tempi)) - SnapInPointerHoldKey=(SnapInPointerKeys)tempi; - break; + if (int.TryParse(sPara, out tempi)) + { + SnapInPointerHoldKey = (SnapInPointerKeys)tempi; + } + + break; case "SNAP_IN_POINTER_PRESSTWICE_KEY": //directly the int value; expected to be in hotkey.ini - if (Int32.TryParse(sPara, out tempi)) - SnapInPointerPressTwiceKey = (SnapInPointerKeys)tempi; + if (int.TryParse(sPara, out tempi)) + { + SnapInPointerPressTwiceKey = (SnapInPointerKeys)tempi; + } + break; } } - } - fini.Close(); - } + } + fini.Close(); + } - public void SaveOptions(string file) - { + public void SaveOptions(string file) + { bool StampFileNamesAlreadyFilled = false; - if (!File.Exists(file)) - file = AppDomain.CurrentDomain.BaseDirectory + file; - if (!File.Exists(file)) - return; - - FileStream fini = new FileStream(file, FileMode.Open); - StreamReader srini = new StreamReader(fini); - string sLine = ""; - string sNameO = ""; - string sName = "", sPara = ""; - - List writelines = new List(); - - while (sLine != null) - { - sPara = ""; - sLine = srini.ReadLine(); - if - ( - sLine != null && - sLine != "" && - sLine.Substring(0, 1) != "-" && - sLine.Substring(0, 1) != "%" && - sLine.Substring(0, 1) != "'" && - sLine.Substring(0, 1) != "/" && - sLine.Substring(0, 1) != "!" && - sLine.Substring(0, 1) != "[" && - sLine.Substring(0, 1) != "#" && - sLine.Contains("=") && - !sLine.Substring(sLine.IndexOf("=") + 1).Contains("=") - ) - { - sNameO = sLine.Substring(0, sLine.IndexOf("=")); - sName = sNameO.Trim().ToUpper(); - - if (sName.StartsWith("PEN")) - { - int penid = 0; - if (int.TryParse(sName.Substring(3, 1), out penid) && penid >= 0 && penid < MaxPenCount) - { - if (sName.EndsWith("_ENABLED")) - { - if (PenEnabled[penid]) - sPara = "True"; - else - sPara = "False"; - } - else if (sName.EndsWith("_RED")) - { - sPara = PenAttr[penid].Color.R.ToString(); - } - else if (sName.EndsWith("_GREEN")) - { - sPara = PenAttr[penid].Color.G.ToString(); - } - else if (sName.EndsWith("_BLUE")) - { - sPara = PenAttr[penid].Color.B.ToString(); - } - else if (sName.EndsWith("_ALPHA")) - { - sPara = (255 - PenAttr[penid].Transparency).ToString(); - } - else if (sName.EndsWith("_WIDTH")) - { - sPara = ((int)PenAttr[penid].Width).ToString(); - } + if (!File.Exists(file)) + { + file = AppDomain.CurrentDomain.BaseDirectory + file; + } + + if (!File.Exists(file)) + { + return; + } + + FileStream fini = new FileStream(file, FileMode.Open); + StreamReader srini = new StreamReader(fini); + string sLine = ""; + string sNameO = ""; + string sName = "", sPara = ""; + + List writelines = new List(); + + while (sLine != null) + { + sPara = ""; + sLine = srini.ReadLine(); + if + ( + sLine != null && + sLine != "" && + sLine.Substring(0, 1) != "-" && + sLine.Substring(0, 1) != "%" && + sLine.Substring(0, 1) != "'" && + sLine.Substring(0, 1) != "/" && + sLine.Substring(0, 1) != "!" && + sLine.Substring(0, 1) != "[" && + sLine.Substring(0, 1) != "#" && + sLine.Contains("=") && + !sLine.Substring(sLine.IndexOf("=") + 1).Contains("=") + ) + { + sNameO = sLine.Substring(0, sLine.IndexOf("=")); + sName = sNameO.Trim().ToUpper(); + + if (sName.StartsWith("PEN")) + { + int penid = 0; + if (int.TryParse(sName.Substring(3, 1), out penid) && penid >= 0 && penid < MaxPenCount) + { + if (sName.EndsWith("_ENABLED")) + { + sPara = PenEnabled[penid] ? "True" : "False"; + } + else if (sName.EndsWith("_RED")) + { + sPara = PenAttr[penid].Color.R.ToString(); + } + else if (sName.EndsWith("_GREEN")) + { + sPara = PenAttr[penid].Color.G.ToString(); + } + else if (sName.EndsWith("_BLUE")) + { + sPara = PenAttr[penid].Color.B.ToString(); + } + else if (sName.EndsWith("_ALPHA")) + { + sPara = (255 - PenAttr[penid].Transparency).ToString(); + } + else if (sName.EndsWith("_WIDTH")) + { + sPara = ((int)PenAttr[penid].Width).ToString(); + } else if (sName.EndsWith("_FADING")) { if (PenAttr[penid].ExtendedProperties.Contains(FADING_PEN)) { - float f = (float)(PenAttr[penid].ExtendedProperties[FADING_PEN].Data); - if (f == TimeBeforeFading) - sPara = "Y"; - else - sPara = f.ToString(); + float f = (float)PenAttr[penid].ExtendedProperties[FADING_PEN].Data; + sPara = f == TimeBeforeFading ? "Y" : f.ToString(); } else + { sPara = "N"; + } } else if (sName.EndsWith("_HOTKEY")) - { - sPara = Hotkey_Pens[penid].ToStringInvariant(); - } - } + { + sPara = Hotkey_Pens[penid].ToStringInvariant(); + } + } - } + } - switch (sName) - { + switch (sName) + { case "ALT_AS_TEMPORARY_COMMAND": - if (AltAsOneCommand) - sPara = "True"; - else - sPara = "False"; + sPara = AltAsOneCommand ? "True" : "False"; break; case "LANGUAGE_FILE": - sPara = Local.CurrentLanguageFile; - break; - case "HOTKEY_GLOBAL": - sPara = Hotkey_Global.ToStringInvariant(); - break; - case "HOTKEY_ERASER": - sPara = Hotkey_Eraser.ToStringInvariant(); - break; - case "HOTKEY_INKVISIBLE": - sPara = Hotkey_InkVisible.ToStringInvariant(); - break; - case "HOTKEY_POINTER": - sPara = Hotkey_Pointer.ToStringInvariant(); - break; - case "HOTKEY_PAN": - sPara = Hotkey_Pan.ToStringInvariant(); - break; - case "HOTKEY_UNDO": - sPara = Hotkey_Undo.ToStringInvariant(); - break; - case "HOTKEY_REDO": - sPara = Hotkey_Redo.ToStringInvariant(); - break; - case "HOTKEY_SNAPSHOT": - sPara = Hotkey_Snap.ToStringInvariant(); - break; - case "HOTKEY_CLEAR": - sPara = Hotkey_Clear.ToStringInvariant(); - break; + sPara = Local.CurrentLanguageFile; + break; + case "HOTKEY_GLOBAL": + sPara = Hotkey_Global.ToStringInvariant(); + break; + case "HOTKEY_ERASER": + sPara = Hotkey_Eraser.ToStringInvariant(); + break; + case "HOTKEY_INKVISIBLE": + sPara = Hotkey_InkVisible.ToStringInvariant(); + break; + case "HOTKEY_POINTER": + sPara = Hotkey_Pointer.ToStringInvariant(); + break; + case "HOTKEY_PAN": + sPara = Hotkey_Pan.ToStringInvariant(); + break; + case "HOTKEY_UNDO": + sPara = Hotkey_Undo.ToStringInvariant(); + break; + case "HOTKEY_REDO": + sPara = Hotkey_Redo.ToStringInvariant(); + break; + case "HOTKEY_SNAPSHOT": + sPara = Hotkey_Snap.ToStringInvariant(); + break; + case "HOTKEY_CLEAR": + sPara = Hotkey_Clear.ToStringInvariant(); + break; case "HOTKEY_VIDEOREC": sPara = Hotkey_Video.ToStringInvariant(); break; @@ -1485,37 +1764,32 @@ public void SaveOptions(string file) break; case "WHITE_TRAY_ICON": - if (WhiteTrayIcon) - sPara = "True"; - else - sPara = "False"; - break; + sPara = WhiteTrayIcon ? "True" : "False"; + break; case "HIDE_IN_ALTTAB": - if (WhiteTrayIcon) - sPara = "True"; - else - sPara = "False"; + sPara = WhiteTrayIcon ? "True" : "False"; break; case "SNAPSHOT_PATH": - sPara = SnapshotBasePath; - break; + sPara = SnapshotBasePath; + break; case "OPEN_INTO_SNAP": - sPara = OpenIntoSnapMode?"True":"False"; + sPara = OpenIntoSnapMode ? "True" : "False"; + break; + case "CLEAN_ON_HIDE": + sPara = CleanOnHide ? "True" : "False"; break; + case "DRAWING_ICON": - if (ToolsEnabled) - sPara = "True"; - else - sPara = "False"; + sPara = ToolsEnabled ? "True" : "False"; break; case "ARROW": // angle in degrees, len in % of the screen width - sPara = (ArrowAngle / Math.PI * 180.0).ToString(CultureInfo.InvariantCulture) +","+ (ArrowLen / System.Windows.SystemParameters.PrimaryScreenWidth * 100.0).ToString(CultureInfo.InvariantCulture); + sPara = (ArrowAngle / Math.PI * 180.0).ToString(CultureInfo.InvariantCulture) + "," + (ArrowLen / System.Windows.SystemParameters.PrimaryScreenWidth * 100.0).ToString(CultureInfo.InvariantCulture); break; case "DEFAULT_ARROW": sPara = DefaultArrow_start ? "START" : "END"; break; case "TEXT": // size of the tag in % of the screen - sPara = TextFont+","+(TextItalic?"True":"False")+","+ (TextBold ? "True" : "False")+","+(TextSize / System.Windows.SystemParameters.PrimaryScreenWidth *100.0).ToString(CultureInfo.InvariantCulture); + sPara = TextFont + "," + (TextItalic ? "True" : "False") + "," + (TextBold ? "True" : "False") + "," + (TextSize / System.Windows.SystemParameters.PrimaryScreenWidth * 100.0).ToString(CultureInfo.InvariantCulture); break; case "NUMBERS": // size of the tag in % of the screen sPara = TagFont + "," + (TagItalic ? "True" : "False") + "," + (TagBold ? "True" : "False") + "," + (TagSize / System.Windows.SystemParameters.PrimaryScreenWidth * 100.0).ToString(CultureInfo.InvariantCulture); @@ -1524,117 +1798,83 @@ public void SaveOptions(string file) sPara = (MagneticRadius / System.Windows.SystemParameters.PrimaryScreenWidth * 100.0).ToString(CultureInfo.InvariantCulture); break; case "ERASER_ICON": - if (EraserEnabled) - sPara = "True"; - else - sPara = "False"; - break; - case "POINTER_ICON": - if (PointerEnabled) - sPara = "True"; - else - sPara = "False"; - break; + sPara = EraserEnabled ? "True" : "False"; + break; + case "POINTER_ICON": + sPara = PointerEnabled ? "True" : "False"; + break; case "ALTTAB_POINTER": - sPara = AltTabPointer?"True":"False"; + sPara = AltTabPointer ? "True" : "False"; break; case "PEN_WIDTH_AT_SELECTION": sPara = WidthAtPenSel ? "True" : "False"; break; case "PEN_WIDTH_ICON": - if (PenWidthEnabled) - sPara = "True"; - else - sPara = "False"; - break; - case "SNAPSHOT_ICON": - if (SnapEnabled) - sPara = "True"; - else - sPara = "False"; - break; - case "CLOSE_ON_SNAP": - if (CloseOnSnap == "true") - sPara = "True"; - else if (CloseOnSnap == "false") - sPara = "False"; - else - sPara = "BlankOnly"; - break; - case "ALWAYS_HIDE_TOOLBAR": - if (AlwaysHideToolbar) - sPara = "True"; - else - sPara = "False"; - break; - case "UNDO_ICON": - if (UndoEnabled) - sPara = "True"; - else - sPara = "False"; - break; - case "CLEAR_ICON": - if (ClearEnabled) - sPara = "True"; - else - sPara = "False"; - break; - case "PAN_ICON": - if (PanEnabled) + sPara = PenWidthEnabled ? "True" : "False"; + break; + case "SNAPSHOT_ICON": + sPara = SnapEnabled ? "True" : "False"; + break; + case "CLOSE_ON_SNAP": + if (CloseOnSnap == "true") + { sPara = "True"; + } else - sPara = "False"; + { + sPara = CloseOnSnap == "false" ? "False" : "BlankOnly"; + } + + break; + case "ALWAYS_HIDE_TOOLBAR": + sPara = AlwaysHideToolbar ? "True" : "False"; + break; + case "UNDO_ICON": + sPara = UndoEnabled ? "True" : "False"; + break; + case "CLEAR_ICON": + sPara = ClearEnabled ? "True" : "False"; + break; + case "PAN_ICON": + sPara = PanEnabled ? "True" : "False"; break; case "LOADSAVE_ICON": - if (LoadSaveEnabled) - sPara = "True"; - else - sPara = "False"; + sPara = LoadSaveEnabled ? "True" : "False"; break; case "ZOOM_ICON": sPara = ZoomEnabled.ToString(); break; case "INKVISIBLE_ICON": - if (PanEnabled) - sPara = "True"; - else - sPara = "False"; - break; - case "ALLOW_DRAGGING_TOOLBAR": - if (AllowDraggingToolbar) - sPara = "True"; - else - sPara = "False"; - break; - case "ALLOW_HOTKEY_IN_POINTER_MODE": - if (AllowHotkeyInPointerMode) - sPara = "True"; - else - sPara = "False"; - break; - case "TOOLBAR_LEFT": - sPara = gpButtonsLeft.ToString(); - break; - case "TOOLBAR_TOP": - sPara = gpButtonsTop.ToString(); - break; - case "TOOLBAR_HEIGHT": - sPara = ToolbarHeight.ToString(CultureInfo.InvariantCulture); - break; - case "CANVAS_CURSOR": - sPara = CanvasCursor.ToString(); - break; + sPara = PanEnabled ? "True" : "False"; + break; + case "ALLOW_DRAGGING_TOOLBAR": + sPara = AllowDraggingToolbar ? "True" : "False"; + break; + case "ALLOW_HOTKEY_IN_POINTER_MODE": + sPara = AllowHotkeyInPointerMode ? "True" : "False"; + break; + case "TOOLBAR_LEFT": + sPara = gpButtonsLeft.ToString(); + break; + case "TOOLBAR_TOP": + sPara = gpButtonsTop.ToString(); + break; + case "TOOLBAR_HEIGHT": + sPara = ToolbarHeight.ToString(CultureInfo.InvariantCulture); + break; + case "CANVAS_CURSOR": + sPara = CanvasCursor.ToString(); + break; case "WINDOW_POS": // if not defined, no window else 2 to 4 integers Top,Left,[Width/Height,[Opacity]] sPara = FormTop.ToString() + "," + FormLeft.ToString() + "," + FormWidth.ToString() + "," + FormOpacity.ToString(); break; - case "GRAYBOARD1": + case "GRAYBOARD1": sPara = Gray1[0].ToString() + "," + Gray1[1].ToString() + "," + Gray1[2].ToString() + "," + Gray1[3].ToString(); break; case "INKING_AREA": // 4 integers - if (WindowRect.Width <= 0 || WindowRect.Height <= 0) - sPara = "-1,-1,-1,-1"; - else - sPara = WindowRect.Left.ToString() + "," + WindowRect.Top.ToString() + "," + WindowRect.Width.ToString() + "," + WindowRect.Height.ToString(); + sPara = WindowRect.Width <= 0 || WindowRect.Height <= 0 + ? "-1,-1,-1,-1" + : WindowRect.Left.ToString() + "," + WindowRect.Top.ToString() + "," + WindowRect.Width.ToString() + "," + WindowRect.Height.ToString(); break; case "GRAYBOARD2": sPara = Gray2[0].ToString() + "," + Gray2[1].ToString() + "," + Gray2[2].ToString() + "," + Gray2[3].ToString(); @@ -1668,15 +1908,26 @@ public void SaveOptions(string file) { sPara = ""; foreach (string st1 in StampFileNames) - sPara += MakeRelativePath(Global.ProgramFolder, st1).Replace('\\','/') + ";"; - if (sPara.Length>1) + { + sPara += MakeRelativePath(Global.ProgramFolder, st1).Replace('\\', '/') + ";"; + } + + if (sPara.Length > 1) + { sPara = sPara.Remove(sPara.Length - 1, 1); // to suppress last ; + } else //if(sPara.Length <=1) + { sPara = " "; + } + StampFileNamesAlreadyFilled = true; } else + { sPara = " "; + } + break; case "IMAGESTAMP1": sPara = MakeRelativePath(Global.ProgramFolder, ImageStamp1); @@ -1689,13 +1940,25 @@ public void SaveOptions(string file) break; case "TOOLBAR_DIRECTION": if (ToolbarOrientation == Orientation.toLeft) + { sPara = "Left"; + } + if (ToolbarOrientation == Orientation.toRight) + { sPara = "Right"; + } + if (ToolbarOrientation == Orientation.toUp) + { sPara = "Up"; + } + if (ToolbarOrientation == Orientation.toDown) + { sPara = "Down"; + } + break; case "FADING_TIME": sPara = TimeBeforeFading.ToString(); @@ -1707,93 +1970,144 @@ public void SaveOptions(string file) sPara = InverseMousewheel ? "True" : "False"; break; case "SNAP_IN_POINTER_HOLD_KEY": //directly the int value; expected to be in hotkey.ini - sPara = ((int)SnapInPointerHoldKey).ToString(); - break; + sPara = ((int)SnapInPointerHoldKey).ToString(); + break; case "SNAP_IN_POINTER_PRESSTWICE_KEY": //directly the int value; expected to be in hotkey.ini - sPara = ((int)SnapInPointerPressTwiceKey).ToString(); + sPara = ((int)SnapInPointerPressTwiceKey).ToString(); break; } } - if (sPara != "") - writelines.Add(sNameO + "= " + sPara); - else if (sLine != null) - writelines.Add(sLine); - } - fini.Close(); - - FileStream frini = new FileStream(file, FileMode.Create); - StreamWriter swini = new StreamWriter(frini); - swini.AutoFlush = true; - foreach (string line in writelines) - swini.WriteLine(line); - frini.Close(); - } + if (sPara != "") + { + writelines.Add(sNameO + "= " + sPara); + } + else if (sLine != null) + { + writelines.Add(sLine); + } + } + fini.Close(); - private void OnAbout(object sender, EventArgs e) - { - FormAbout FormAbout = new FormAbout(); - FormAbout.Show(); - } - /* + FileStream frini = new FileStream(file, FileMode.Create); + StreamWriter swini = new StreamWriter(frini) + { + AutoFlush = true + }; + foreach (string line in writelines) + { + swini.WriteLine(line); + } + + frini.Close(); + } + + private void OnAbout(object sender, EventArgs e) + { + FormAbout FormAbout = new FormAbout(); + FormAbout.Show(); + } + /* private void OnPenSetting(object sender, EventArgs e) { System.Diagnostics.Process.Start("notepad.exe", "pens.ini"); } */ - private void OnOptions(object sender, EventArgs e) - { + private void OnOptions(object sender, EventArgs e) + { //ReadOptions("pens.ini"); //ReadOptions("config.ini"); //ReadOptions("hotkeys.ini"); if (FormOptions != null) + { return; + } + if (FormDisplay != null || FormCollection != null) + { return; + } + FormOptions = new FormOptions(this); - FormOptions.Show(); - } + FormOptions.Show(); + } - public void SetHotkey() - { - int modifier = 0; - if (Hotkey_Global.Control) modifier |= 0x2; - if (Hotkey_Global.Alt) modifier |= 0x1; - if (Hotkey_Global.Shift) modifier |= 0x4; - if (Hotkey_Global.Win) modifier |= 0x8; - if (modifier != 0) - RegisterHotKey(IntPtr.Zero, 0, modifier, Hotkey_Global.Key); - } + public void SetHotkey() + { + int modifier = 0; + if (Hotkey_Global.Control) + { + modifier |= 0x2; + } - public void UnsetHotkey() - { - int modifier = 0; - if (Hotkey_Global.Control) modifier |= 0x2; - if (Hotkey_Global.Alt) modifier |= 0x1; - if (Hotkey_Global.Shift) modifier |= 0x4; - if (Hotkey_Global.Win) modifier |= 0x8; - if (modifier != 0) - UnregisterHotKey(IntPtr.Zero, 0); - } + if (Hotkey_Global.Alt) + { + modifier |= 0x1; + } - public void ChangeLanguage(string filename) - { - Local.LoadLocalFile(filename); + if (Hotkey_Global.Shift) + { + modifier |= 0x4; + } - trayMenu.MenuItems.Clear(); - trayMenu.MenuItems.Add(Local.MenuEntryAbout + "...", OnAbout); - trayMenu.MenuItems.Add(Local.MenuEntryOptions + "...", OnOptions); - trayMenu.MenuItems.Add("-"); - trayMenu.MenuItems.Add(Local.MenuEntryExit, OnExit); - } + if (Hotkey_Global.Win) + { + modifier |= 0x8; + } - private void OnExit(object sender, EventArgs e) - { - UnsetHotkey(); + if (modifier != 0) + { + RegisterHotKey(IntPtr.Zero, 0, modifier, Hotkey_Global.Key); + } + } - trayIcon.Dispose(); - Application.Exit(); - } + public void UnsetHotkey() + { + int modifier = 0; + if (Hotkey_Global.Control) + { + modifier |= 0x2; + } + + if (Hotkey_Global.Alt) + { + modifier |= 0x1; + } + + if (Hotkey_Global.Shift) + { + modifier |= 0x4; + } + + if (Hotkey_Global.Win) + { + modifier |= 0x8; + } + + if (modifier != 0) + { + UnregisterHotKey(IntPtr.Zero, 0); + } + } + + public void ChangeLanguage(string filename) + { + Local.LoadLocalFile(filename); + + trayMenu.MenuItems.Clear(); + trayMenu.MenuItems.Add(Local.MenuEntryAbout + "...", OnAbout); + trayMenu.MenuItems.Add(Local.MenuEntryOptions + "...", OnOptions); + trayMenu.MenuItems.Add("-"); + trayMenu.MenuItems.Add(Local.MenuEntryExit, OnExit); + } + + private void OnExit(object sender, EventArgs e) + { + UnsetHotkey(); + + trayIcon.Dispose(); + Application.Exit(); + } public int HiMetricToPixel(double hi) { @@ -1805,10 +2119,17 @@ public int PixelToHiMetric(double pi) return Convert.ToInt32(pi / 0.037795280352161); } - public static String MakeRelativePath(String fromPath, String toPath) + public static string MakeRelativePath(string fromPath, string toPath) { - if (String.IsNullOrEmpty(fromPath)) throw new ArgumentNullException("fromPath"); - if (String.IsNullOrEmpty(toPath)) throw new ArgumentNullException("toPath"); + if (string.IsNullOrEmpty(fromPath)) + { + throw new ArgumentNullException("fromPath"); + } + + if (string.IsNullOrEmpty(toPath)) + { + throw new ArgumentNullException("toPath"); + } Uri fromUri = new Uri(fromPath); Uri toUri = new Uri(toPath); @@ -1816,7 +2137,7 @@ public static String MakeRelativePath(String fromPath, String toPath) if (fromUri.Scheme != toUri.Scheme) { return toPath; } // path can't be made relative. Uri relativeUri = fromUri.MakeRelativeUri(toUri); - String relativePath = Uri.UnescapeDataString(relativeUri.ToString()); + string relativePath = Uri.UnescapeDataString(relativeUri.ToString()); if (toUri.Scheme.Equals("file", StringComparison.InvariantCultureIgnoreCase)) { @@ -1827,9 +2148,9 @@ public static String MakeRelativePath(String fromPath, String toPath) } [DllImport("user32.dll")] - private static extern int RegisterHotKey(IntPtr hwnd, int id, int fsModifiers, int vk); - [DllImport("user32.dll")] - private static extern int UnregisterHotKey(IntPtr hwnd, int id); - } + private static extern int RegisterHotKey(IntPtr hwnd, int id, int fsModifiers, int vk); + [DllImport("user32.dll")] + private static extern int UnregisterHotKey(IntPtr hwnd, int id); + } } diff --git a/src/ppInk.csproj b/src/ppInk.csproj index 25fa390f..a1134dd9 100644 --- a/src/ppInk.csproj +++ b/src/ppInk.csproj @@ -78,6 +78,7 @@ CallForm.cs + Form @@ -192,6 +193,9 @@ Root.cs Designer + + .editorconfig + SettingsSingleFileGenerator