diff --git a/Source/Core/Controls/DockersControl.Designer.cs b/Source/Core/Controls/DockersControl.Designer.cs index ea7128f0..eab06571 100644 --- a/Source/Core/Controls/DockersControl.Designer.cs +++ b/Source/Core/Controls/DockersControl.Designer.cs @@ -45,6 +45,9 @@ this.splitter.Size = new System.Drawing.Size(4, 541); this.splitter.TabIndex = 1; this.splitter.MouseLeave += new System.EventHandler(this.RaiseMouseContainerLeave); + this.splitter.MouseMove += new System.Windows.Forms.MouseEventHandler(this.splitter_MouseMove); + this.splitter.MouseDown += new System.Windows.Forms.MouseEventHandler(this.splitter_MouseDown); + this.splitter.MouseUp += new System.Windows.Forms.MouseEventHandler(this.splitter_MouseUp); this.splitter.MouseEnter += new System.EventHandler(this.RaiseMouseContainerEnter); // // tabs diff --git a/Source/Core/Controls/DockersControl.cs b/Source/Core/Controls/DockersControl.cs index c2697cd1..a65d2390 100644 --- a/Source/Core/Controls/DockersControl.cs +++ b/Source/Core/Controls/DockersControl.cs @@ -50,17 +50,23 @@ namespace CodeImp.DoomBuilder.Controls public event EventHandler MouseContainerLeave; public event EventHandler Collapsed; public event EventHandler Expanded; + public event EventHandler UserResize; #endregion #region ================== Variables - + + // Behaviour private bool rightalign; private bool iscollapsed; + // Collapsing private int expandedwidth; // width when expanded private int expandedtab; // selected tab index when expanded + // Splitting + private int splitstartoffset; + #endregion #region ================== Properties @@ -219,22 +225,59 @@ namespace CodeImp.DoomBuilder.Controls // We don't want the focus private void tabs_Enter(object sender, EventArgs e) { General.MainWindow.FocusDisplay(); } private void tabs_MouseUp(object sender, MouseEventArgs e) { General.MainWindow.FocusDisplay(); } + private void tabs_SelectedIndexChanged(object sender, EventArgs e) { General.MainWindow.FocusDisplay(); } + private void tabs_Selected(object sender, TabControlEventArgs e) { General.MainWindow.FocusDisplay(); } + protected override void OnEnter(EventArgs e) { General.MainWindow.FocusDisplay(); } + + // Splitting begins + private void splitter_MouseDown(object sender, MouseEventArgs e) + { + if(e.Button == MouseButtons.Left) + { + splitstartoffset = e.X; + splitter.BackColor = SystemColors.ControlDark; + } + } + + // Splitting ends + private void splitter_MouseUp(object sender, MouseEventArgs e) + { + splitter.BackColor = SystemColors.Control; + this.Update(); + General.MainWindow.RedrawDisplay(); + General.MainWindow.Update(); + } + + // Splitting dragged + private void splitter_MouseMove(object sender, MouseEventArgs e) + { + if(e.Button == MouseButtons.Left) + { + General.LockWindowUpdate(Parent.Handle); + + // Resize the control + int delta = e.X - splitstartoffset; + if(rightalign) + { + this.Left += delta; + this.Width -= delta; + } + else + { + this.Width += delta; + } + + General.LockWindowUpdate(IntPtr.Zero); + this.Update(); + General.MainWindow.RedrawDisplay(); + General.MainWindow.Update(); + + // Raise event + if(UserResize != null) + UserResize(this, EventArgs.Empty); + } + } #endregion - - private void tabs_SelectedIndexChanged(object sender, EventArgs e) - { - General.MainWindow.FocusDisplay(); - } - - private void tabs_Selected(object sender, TabControlEventArgs e) - { - General.MainWindow.FocusDisplay(); - } - - protected override void OnEnter(EventArgs e) - { - General.MainWindow.FocusDisplay(); - } } } diff --git a/Source/Core/Controls/DockersTabsControl.cs b/Source/Core/Controls/DockersTabsControl.cs index 2faf4531..98274727 100644 --- a/Source/Core/Controls/DockersTabsControl.cs +++ b/Source/Core/Controls/DockersTabsControl.cs @@ -227,7 +227,7 @@ namespace CodeImp.DoomBuilder.Controls if(left < 0) left = 0; p = new Point(left, 0); } - + e.Graphics.DrawImage(tabsimage, p); } else diff --git a/Source/Core/Controls/TransparentPanel.cs b/Source/Core/Controls/TransparentPanel.cs index 980ac7f5..1543f02e 100644 --- a/Source/Core/Controls/TransparentPanel.cs +++ b/Source/Core/Controls/TransparentPanel.cs @@ -59,6 +59,8 @@ namespace CodeImp.DoomBuilder.Controls // Disable background drawing by overriding this protected override void OnPaintBackground(PaintEventArgs e) { + if(BackColor != Color.Transparent) + e.Graphics.Clear(BackColor); } #endregion diff --git a/Source/Core/Windows/MainForm.Designer.cs b/Source/Core/Windows/MainForm.Designer.cs index 2fa31b60..cdac7062 100644 --- a/Source/Core/Windows/MainForm.Designer.cs +++ b/Source/Core/Windows/MainForm.Designer.cs @@ -1599,6 +1599,7 @@ namespace CodeImp.DoomBuilder.Windows this.dockerspanel.Size = new System.Drawing.Size(236, 467); this.dockerspanel.TabIndex = 7; this.dockerspanel.TabStop = false; + this.dockerspanel.UserResize += new System.EventHandler(this.dockerspanel_UserResize); this.dockerspanel.Collapsed += new System.EventHandler(this.LoseFocus); this.dockerspanel.MouseContainerEnter += new System.EventHandler(this.dockerspanel_MouseContainerEnter); this.dockerspanel.MouseContainerLeave += new System.EventHandler(this.dockerspanel_MouseContainerLeave); diff --git a/Source/Core/Windows/MainForm.cs b/Source/Core/Windows/MainForm.cs index 63bf033b..6e593371 100644 --- a/Source/Core/Windows/MainForm.cs +++ b/Source/Core/Windows/MainForm.cs @@ -2524,6 +2524,15 @@ namespace CodeImp.DoomBuilder.Windows dockerspanel.Collapse(); } + // User resizes the docker + private void dockerspanel_UserResize(object sender, EventArgs e) + { + General.Settings.DockersWidth = dockerspanel.Width; + + if(!General.Settings.CollapseDockers) + dockersspace.Width = dockerspanel.Width; + } + #endregion } } \ No newline at end of file diff --git a/Source/Core/Windows/MainForm.resx b/Source/Core/Windows/MainForm.resx index 67ec598a..5dd5ae97 100644 --- a/Source/Core/Windows/MainForm.resx +++ b/Source/Core/Windows/MainForm.resx @@ -165,12 +165,12 @@ 17, 17 - - 127, 17 - True + + 127, 17 + True