@ work in progress on dockers

This commit is contained in:
codeimp 2009-07-21 15:15:38 +00:00
parent 77230eee5b
commit f2e1561093
7 changed files with 78 additions and 20 deletions

View file

@ -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

View file

@ -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();
}
}
}

View file

@ -227,7 +227,7 @@ namespace CodeImp.DoomBuilder.Controls
if(left < 0) left = 0;
p = new Point(left, 0);
}
e.Graphics.DrawImage(tabsimage, p);
}
else

View file

@ -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

View file

@ -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);

View file

@ -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
}
}

View file

@ -165,12 +165,12 @@
<metadata name="menumain.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="toolbar.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>127, 17</value>
</metadata>
<metadata name="toolbar.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="toolbar.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>127, 17</value>
</metadata>
<metadata name="statusbar.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>