2009-07-19 20:30:15 +00:00
|
|
|
|
|
2009-07-17 15:06:15 +00:00
|
|
|
|
#region ================== Copyright (c) 2007 Pascal vd Heiden
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
|
|
|
|
|
* This program is released under GNU General Public License
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region ================== Namespaces
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
namespace CodeImp.DoomBuilder.Controls
|
|
|
|
|
{
|
2009-07-19 20:30:15 +00:00
|
|
|
|
internal partial class DockersControl : UserControl
|
2009-07-17 15:06:15 +00:00
|
|
|
|
{
|
|
|
|
|
#region ================== Constants
|
2009-07-20 15:16:40 +00:00
|
|
|
|
|
2009-07-17 15:06:15 +00:00
|
|
|
|
#endregion
|
2009-07-21 13:42:36 +00:00
|
|
|
|
|
|
|
|
|
#region ================== Delegates
|
2009-07-20 15:16:40 +00:00
|
|
|
|
|
2009-07-21 13:42:36 +00:00
|
|
|
|
public event EventHandler MouseContainerEnter;
|
|
|
|
|
public event EventHandler MouseContainerLeave;
|
|
|
|
|
public event EventHandler Collapsed;
|
|
|
|
|
public event EventHandler Expanded;
|
2009-07-21 15:15:38 +00:00
|
|
|
|
public event EventHandler UserResize;
|
2009-07-21 13:42:36 +00:00
|
|
|
|
|
|
|
|
|
#endregion
|
2009-07-20 15:16:40 +00:00
|
|
|
|
|
2009-07-21 13:42:36 +00:00
|
|
|
|
#region ================== Variables
|
2009-07-21 15:15:38 +00:00
|
|
|
|
|
|
|
|
|
// Behaviour
|
2009-07-20 15:16:40 +00:00
|
|
|
|
private bool rightalign;
|
2009-07-21 13:42:36 +00:00
|
|
|
|
private bool iscollapsed;
|
2009-07-20 15:16:40 +00:00
|
|
|
|
|
2009-07-21 15:15:38 +00:00
|
|
|
|
// Collapsing
|
2009-07-20 15:16:40 +00:00
|
|
|
|
private int expandedwidth; // width when expanded
|
|
|
|
|
private int expandedtab; // selected tab index when expanded
|
|
|
|
|
|
2009-07-21 15:15:38 +00:00
|
|
|
|
// Splitting
|
|
|
|
|
private int splitstartoffset;
|
|
|
|
|
|
2009-07-22 15:16:28 +00:00
|
|
|
|
// Selection
|
|
|
|
|
private string currentselected;
|
|
|
|
|
private string previousselected;
|
2010-01-02 20:22:05 +00:00
|
|
|
|
private bool controlledselection;
|
2009-07-22 15:16:28 +00:00
|
|
|
|
|
2009-07-17 15:06:15 +00:00
|
|
|
|
#endregion
|
2009-07-19 20:30:15 +00:00
|
|
|
|
|
2009-07-20 15:16:40 +00:00
|
|
|
|
#region ================== Properties
|
|
|
|
|
|
2009-07-21 13:42:36 +00:00
|
|
|
|
public bool IsCollpased { get { return iscollapsed; } }
|
2014-10-13 22:01:17 +00:00
|
|
|
|
public string SelectedTabName { get { return (tabs.SelectedTab == null ? "None" : tabs.SelectedTab.Text); } } //mxd
|
|
|
|
|
|
2009-07-23 08:53:52 +00:00
|
|
|
|
// This returns true when the focus is here, but not in some special cases
|
|
|
|
|
public bool IsFocused
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
Control ac = FindActiveControl();
|
|
|
|
|
|
|
|
|
|
// We have focus when we need the keyboard for input
|
|
|
|
|
// Otherwise we don't want the focus and the docker may collapse
|
2010-08-01 17:28:13 +00:00
|
|
|
|
return (ac is TextBox) || (ac is RichTextBox) || (ac is NumericUpDown) || (ac is ComboBox);
|
2009-07-23 08:53:52 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-20 15:16:40 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
2009-07-17 15:06:15 +00:00
|
|
|
|
#region ================== Constructor
|
|
|
|
|
|
|
|
|
|
// Constructor
|
|
|
|
|
public DockersControl()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2013-07-23 14:25:03 +00:00
|
|
|
|
expandedwidth = (int)(this.Width * (this.CurrentAutoScaleDimensions.Width / this.AutoScaleDimensions.Width));
|
2009-07-17 15:06:15 +00:00
|
|
|
|
}
|
2009-07-20 15:16:40 +00:00
|
|
|
|
|
2009-07-17 15:06:15 +00:00
|
|
|
|
#endregion
|
2009-07-20 15:16:40 +00:00
|
|
|
|
|
2009-07-17 15:06:15 +00:00
|
|
|
|
#region ================== Methods
|
2009-07-20 15:16:40 +00:00
|
|
|
|
|
2009-07-23 08:53:52 +00:00
|
|
|
|
// This returns the active child control
|
|
|
|
|
private Control FindActiveControl()
|
|
|
|
|
{
|
|
|
|
|
Control c = this.ActiveControl;
|
|
|
|
|
|
|
|
|
|
while(c is IContainerControl)
|
|
|
|
|
{
|
|
|
|
|
IContainerControl cc = (c as IContainerControl);
|
2015-01-09 08:11:42 +00:00
|
|
|
|
if(cc.ActiveControl != null) c = cc.ActiveControl;
|
|
|
|
|
else break;
|
2009-07-23 08:53:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return c;
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-20 15:16:40 +00:00
|
|
|
|
// This sets up the controls for left or right alignment
|
|
|
|
|
public void Setup(bool right)
|
|
|
|
|
{
|
2015-01-09 08:11:42 +00:00
|
|
|
|
int voffset = pinbutton.Bottom + pinbutton.Margin.Bottom; //mxd
|
2009-07-20 15:16:40 +00:00
|
|
|
|
rightalign = right;
|
|
|
|
|
if(rightalign)
|
|
|
|
|
{
|
|
|
|
|
splitter.Dock = DockStyle.Left;
|
|
|
|
|
tabs.Alignment = TabAlignment.Right;
|
2015-01-09 08:11:42 +00:00
|
|
|
|
tabs.Location = new Point(0, voffset);
|
2009-07-20 15:16:40 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
splitter.Dock = DockStyle.Right;
|
|
|
|
|
tabs.Alignment = TabAlignment.Left;
|
2015-01-09 08:11:42 +00:00
|
|
|
|
tabs.Location = new Point(-2, voffset);
|
2009-07-20 15:16:40 +00:00
|
|
|
|
}
|
2015-03-09 09:17:46 +00:00
|
|
|
|
|
|
|
|
|
tabs.Size = new Size(this.ClientRectangle.Width + 2, this.ClientRectangle.Height - voffset);
|
2009-07-20 15:16:40 +00:00
|
|
|
|
tabs.SendToBack();
|
2015-01-09 08:11:42 +00:00
|
|
|
|
UpdatePinIcon(); //mxd
|
2009-07-20 15:16:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This collapses the docker
|
|
|
|
|
public void Collapse()
|
|
|
|
|
{
|
2009-07-21 13:42:36 +00:00
|
|
|
|
if(iscollapsed) return;
|
2010-01-02 20:22:05 +00:00
|
|
|
|
|
|
|
|
|
controlledselection = true;
|
2009-07-21 18:48:00 +00:00
|
|
|
|
splitter.Enabled = false;
|
|
|
|
|
splitter.BackColor = SystemColors.Control;
|
|
|
|
|
splitter.Width = (int)(2.0f * (this.CurrentAutoScaleDimensions.Width / this.AutoScaleDimensions.Width));
|
2009-07-20 15:16:40 +00:00
|
|
|
|
expandedtab = tabs.SelectedIndex;
|
|
|
|
|
expandedwidth = this.Width;
|
|
|
|
|
tabs.SelectedIndex = -1;
|
2009-07-21 18:48:00 +00:00
|
|
|
|
General.MainWindow.LockUpdate();
|
2009-07-20 15:16:40 +00:00
|
|
|
|
if(rightalign) this.Left = this.Right - GetCollapsedWidth();
|
|
|
|
|
this.Width = GetCollapsedWidth();
|
2009-07-21 18:48:00 +00:00
|
|
|
|
General.MainWindow.UnlockUpdate();
|
|
|
|
|
this.Invalidate(true);
|
2010-01-02 20:22:05 +00:00
|
|
|
|
controlledselection = false;
|
2009-07-20 15:16:40 +00:00
|
|
|
|
|
2009-07-21 13:42:36 +00:00
|
|
|
|
iscollapsed = true;
|
|
|
|
|
|
|
|
|
|
if(Collapsed != null) Collapsed(this, EventArgs.Empty);
|
2009-07-20 15:16:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This expands the docker
|
|
|
|
|
public void Expand()
|
|
|
|
|
{
|
2009-07-21 13:42:36 +00:00
|
|
|
|
if(!iscollapsed) return;
|
2009-07-21 18:48:00 +00:00
|
|
|
|
|
2010-01-02 20:22:05 +00:00
|
|
|
|
controlledselection = true;
|
2009-07-21 18:48:00 +00:00
|
|
|
|
splitter.Enabled = true;
|
|
|
|
|
splitter.BackColor = Color.Transparent;
|
|
|
|
|
splitter.Width = (int)(4.0f * (this.CurrentAutoScaleDimensions.Width / this.AutoScaleDimensions.Width));
|
|
|
|
|
General.MainWindow.LockUpdate();
|
2009-07-20 15:16:40 +00:00
|
|
|
|
if(rightalign) this.Left = this.Right - expandedwidth;
|
|
|
|
|
this.Width = expandedwidth;
|
2009-07-21 18:48:00 +00:00
|
|
|
|
General.MainWindow.UnlockUpdate();
|
2009-07-20 15:16:40 +00:00
|
|
|
|
tabs.SelectedIndex = expandedtab;
|
2009-07-21 18:48:00 +00:00
|
|
|
|
tabs.Invalidate(true);
|
2010-01-02 20:22:05 +00:00
|
|
|
|
controlledselection = false;
|
2009-07-20 15:16:40 +00:00
|
|
|
|
|
2009-07-21 13:42:36 +00:00
|
|
|
|
iscollapsed = false;
|
|
|
|
|
|
|
|
|
|
if(Expanded != null) Expanded(this, EventArgs.Empty);
|
2009-07-20 15:16:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This calculates the collapsed width
|
|
|
|
|
public int GetCollapsedWidth()
|
|
|
|
|
{
|
2009-07-21 18:48:00 +00:00
|
|
|
|
Rectangle r;
|
|
|
|
|
if(tabs.TabPages.Count > 0)
|
|
|
|
|
r = tabs.GetTabRect(0);
|
|
|
|
|
else
|
|
|
|
|
r = new Rectangle(0, 0, 26, 26);
|
|
|
|
|
return r.Width + (int)(1.0f * (this.CurrentAutoScaleDimensions.Width / this.AutoScaleDimensions.Width));
|
2009-07-20 15:16:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This adds a docker
|
2016-04-15 14:24:18 +00:00
|
|
|
|
public void Add(Docker d, bool notify)
|
2009-07-20 15:16:40 +00:00
|
|
|
|
{
|
2009-07-22 21:15:14 +00:00
|
|
|
|
// Set up page
|
2009-07-20 15:16:40 +00:00
|
|
|
|
TabPage page = new TabPage(d.Title);
|
2009-07-22 15:16:28 +00:00
|
|
|
|
page.SuspendLayout();
|
2009-07-20 15:16:40 +00:00
|
|
|
|
page.Font = this.Font;
|
|
|
|
|
page.Tag = d;
|
2009-07-21 13:42:36 +00:00
|
|
|
|
page.UseVisualStyleBackColor = false;
|
2009-07-22 15:16:28 +00:00
|
|
|
|
page.Controls.Add(d.Control);
|
|
|
|
|
d.Control.Dock = DockStyle.Fill;
|
2009-07-20 15:16:40 +00:00
|
|
|
|
tabs.TabPages.Add(page);
|
2009-07-22 15:16:28 +00:00
|
|
|
|
page.ResumeLayout(true);
|
2016-04-15 14:24:18 +00:00
|
|
|
|
if(iscollapsed)
|
|
|
|
|
{
|
|
|
|
|
tabs.SelectedIndex = -1;
|
|
|
|
|
if(notify) tabs.PlayNotifyAnimation(tabs.TabPages.Count - 1); //mxd
|
|
|
|
|
}
|
2009-07-22 21:15:14 +00:00
|
|
|
|
|
|
|
|
|
// Go for all controls to add events
|
|
|
|
|
Queue<Control> todo = new Queue<Control>();
|
|
|
|
|
todo.Enqueue(d.Control);
|
|
|
|
|
while(todo.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
Control c = todo.Dequeue();
|
|
|
|
|
c.MouseEnter += RaiseMouseContainerEnter;
|
|
|
|
|
c.MouseLeave += RaiseMouseContainerLeave;
|
|
|
|
|
foreach(Control cc in c.Controls)
|
|
|
|
|
todo.Enqueue(cc);
|
|
|
|
|
}
|
2009-07-20 15:16:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This removes a docker
|
|
|
|
|
public bool Remove(Docker d)
|
|
|
|
|
{
|
|
|
|
|
foreach(TabPage page in tabs.TabPages)
|
|
|
|
|
{
|
|
|
|
|
if((page.Tag as Docker) == d)
|
|
|
|
|
{
|
2009-07-22 21:15:14 +00:00
|
|
|
|
// Go for all controls to remove events
|
|
|
|
|
Queue<Control> todo = new Queue<Control>();
|
|
|
|
|
todo.Enqueue(d.Control);
|
|
|
|
|
while(todo.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
Control c = todo.Dequeue();
|
|
|
|
|
c.MouseEnter -= RaiseMouseContainerEnter;
|
|
|
|
|
c.MouseLeave -= RaiseMouseContainerLeave;
|
|
|
|
|
foreach(Control cc in c.Controls)
|
|
|
|
|
todo.Enqueue(cc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Take down that page
|
2015-03-09 12:56:07 +00:00
|
|
|
|
if(page == tabs.SelectedTab || tabs.SelectedTab == null) SelectPrevious();
|
2009-07-20 15:16:40 +00:00
|
|
|
|
page.Controls.Clear();
|
|
|
|
|
tabs.TabPages.Remove(page);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2014-01-17 13:48:06 +00:00
|
|
|
|
|
|
|
|
|
//mxd. This checks if given docker exists in this control
|
2014-12-03 23:15:26 +00:00
|
|
|
|
public bool Contains(Docker d)
|
|
|
|
|
{
|
2015-12-28 15:01:53 +00:00
|
|
|
|
foreach(TabPage page in tabs.TabPages)
|
|
|
|
|
if((page.Tag as Docker) == d) return true;
|
2014-01-17 13:48:06 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
2009-07-20 15:16:40 +00:00
|
|
|
|
|
2009-07-22 15:16:28 +00:00
|
|
|
|
// This selects a docker
|
|
|
|
|
public bool SelectDocker(Docker d)
|
|
|
|
|
{
|
2010-01-02 20:22:05 +00:00
|
|
|
|
int index = 0;
|
2009-07-22 15:16:28 +00:00
|
|
|
|
foreach(TabPage page in tabs.TabPages)
|
|
|
|
|
{
|
|
|
|
|
if((page.Tag as Docker) == d)
|
|
|
|
|
{
|
2010-01-02 20:22:05 +00:00
|
|
|
|
if(iscollapsed)
|
|
|
|
|
{
|
2015-03-09 12:56:07 +00:00
|
|
|
|
if(!string.IsNullOrEmpty(currentselected)) previousselected = currentselected; //mxd
|
|
|
|
|
currentselected = d.FullName; //mxd
|
2010-01-02 20:22:05 +00:00
|
|
|
|
expandedtab = index;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
tabs.SelectedTab = page;
|
|
|
|
|
|
2009-07-22 15:16:28 +00:00
|
|
|
|
return true;
|
|
|
|
|
}
|
2010-01-02 20:22:05 +00:00
|
|
|
|
|
|
|
|
|
index++;
|
2009-07-22 15:16:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This selectes the previous docker
|
|
|
|
|
public void SelectPrevious()
|
|
|
|
|
{
|
2015-03-09 12:56:07 +00:00
|
|
|
|
//mxd. First one is better than nothing
|
|
|
|
|
if(string.IsNullOrEmpty(previousselected) && tabs.TabPages.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
previousselected = (tabs.TabPages[0].Tag as Docker).FullName;
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-22 15:16:28 +00:00
|
|
|
|
if(!string.IsNullOrEmpty(previousselected))
|
|
|
|
|
{
|
2010-01-02 20:22:05 +00:00
|
|
|
|
int index = 0;
|
2009-07-22 15:16:28 +00:00
|
|
|
|
foreach(TabPage page in tabs.TabPages)
|
|
|
|
|
{
|
|
|
|
|
if((page.Tag as Docker).FullName == previousselected)
|
|
|
|
|
{
|
2010-01-02 20:22:05 +00:00
|
|
|
|
if(iscollapsed)
|
|
|
|
|
{
|
2015-03-09 12:56:07 +00:00
|
|
|
|
currentselected = previousselected;
|
2010-01-02 20:22:05 +00:00
|
|
|
|
expandedtab = index;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
tabs.SelectedTab = page;
|
|
|
|
|
|
2009-07-22 15:16:28 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2010-01-02 20:22:05 +00:00
|
|
|
|
|
|
|
|
|
index++;
|
2009-07-22 15:16:28 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-20 15:16:40 +00:00
|
|
|
|
// This sorts tabs by their full name
|
|
|
|
|
public void SortTabs(IEnumerable<string> fullnames)
|
|
|
|
|
{
|
2014-02-26 14:11:06 +00:00
|
|
|
|
Dictionary<string, TabPage> pages = new Dictionary<string, TabPage>(tabs.TabPages.Count, StringComparer.Ordinal);
|
2009-07-20 15:16:40 +00:00
|
|
|
|
foreach(TabPage p in tabs.TabPages) pages.Add((p.Tag as Docker).FullName, p);
|
|
|
|
|
tabs.TabPages.Clear();
|
|
|
|
|
|
|
|
|
|
// Add tabs in order as in fullnames
|
|
|
|
|
foreach(string name in fullnames)
|
|
|
|
|
{
|
|
|
|
|
if(pages.ContainsKey(name))
|
|
|
|
|
{
|
|
|
|
|
tabs.TabPages.Add(pages[name]);
|
|
|
|
|
pages.Remove(name);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add remaining tabs
|
|
|
|
|
foreach(KeyValuePair<string, TabPage> p in pages)
|
|
|
|
|
tabs.TabPages.Add(p.Value);
|
|
|
|
|
}
|
2015-01-09 08:11:42 +00:00
|
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
|
private void UpdatePinIcon()
|
|
|
|
|
{
|
|
|
|
|
if(tabs.Alignment == TabAlignment.Left)
|
|
|
|
|
pinbutton.Image = (General.Settings.CollapseDockers ? Properties.Resources.DockerCollapse : Properties.Resources.DockerExpand);
|
|
|
|
|
else
|
|
|
|
|
pinbutton.Image = (General.Settings.CollapseDockers ? Properties.Resources.DockerExpand : Properties.Resources.DockerCollapse);
|
|
|
|
|
}
|
2009-07-20 15:16:40 +00:00
|
|
|
|
|
2009-07-17 15:06:15 +00:00
|
|
|
|
#endregion
|
2009-07-20 15:16:40 +00:00
|
|
|
|
|
2009-07-17 15:06:15 +00:00
|
|
|
|
#region ================== Events
|
2009-07-20 15:16:40 +00:00
|
|
|
|
|
2009-07-21 13:42:36 +00:00
|
|
|
|
// This raises the MouseContainerEnter event
|
|
|
|
|
private void RaiseMouseContainerEnter(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if(MouseContainerEnter != null)
|
|
|
|
|
MouseContainerEnter(sender, e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This raises the MouseContainerLeave event
|
|
|
|
|
private void RaiseMouseContainerLeave(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if(MouseContainerLeave != null)
|
|
|
|
|
MouseContainerLeave(sender, e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 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(); }
|
2009-07-21 15:15:38 +00:00
|
|
|
|
private void tabs_Selected(object sender, TabControlEventArgs e) { General.MainWindow.FocusDisplay(); }
|
2009-07-21 13:42:36 +00:00
|
|
|
|
|
2009-07-22 15:16:28 +00:00
|
|
|
|
// Tab selected
|
|
|
|
|
private void tabs_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2010-01-02 20:22:05 +00:00
|
|
|
|
if(!controlledselection)
|
2009-07-22 15:16:28 +00:00
|
|
|
|
{
|
2010-01-02 20:22:05 +00:00
|
|
|
|
// Keep track of previous selected tab
|
2015-03-09 12:56:07 +00:00
|
|
|
|
if(!string.IsNullOrEmpty(currentselected)) previousselected = currentselected;
|
|
|
|
|
|
2010-01-02 20:22:05 +00:00
|
|
|
|
if(tabs.SelectedTab != null)
|
|
|
|
|
{
|
|
|
|
|
Docker d = (tabs.SelectedTab.Tag as Docker);
|
|
|
|
|
currentselected = d.FullName;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
currentselected = null;
|
|
|
|
|
}
|
2009-07-22 15:16:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
General.MainWindow.FocusDisplay();
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-21 15:15:38 +00:00
|
|
|
|
// Splitting begins
|
|
|
|
|
private void splitter_MouseDown(object sender, MouseEventArgs e)
|
2009-07-21 13:42:36 +00:00
|
|
|
|
{
|
2009-07-21 15:15:38 +00:00
|
|
|
|
if(e.Button == MouseButtons.Left)
|
|
|
|
|
{
|
|
|
|
|
splitstartoffset = e.X;
|
2009-07-21 18:48:00 +00:00
|
|
|
|
splitter.BackColor = SystemColors.Highlight;
|
2009-07-21 15:15:38 +00:00
|
|
|
|
}
|
2009-07-21 13:42:36 +00:00
|
|
|
|
}
|
2009-07-21 15:15:38 +00:00
|
|
|
|
|
|
|
|
|
// Splitting ends
|
|
|
|
|
private void splitter_MouseUp(object sender, MouseEventArgs e)
|
2009-07-21 13:42:36 +00:00
|
|
|
|
{
|
2009-07-21 18:48:00 +00:00
|
|
|
|
splitter.BackColor = Color.Transparent;
|
|
|
|
|
tabs.Invalidate(true);
|
2009-07-21 15:15:38 +00:00
|
|
|
|
this.Update();
|
|
|
|
|
General.MainWindow.RedrawDisplay();
|
|
|
|
|
General.MainWindow.Update();
|
2009-07-21 13:42:36 +00:00
|
|
|
|
}
|
2009-07-21 15:15:38 +00:00
|
|
|
|
|
|
|
|
|
// Splitting dragged
|
|
|
|
|
private void splitter_MouseMove(object sender, MouseEventArgs e)
|
2009-07-21 13:42:36 +00:00
|
|
|
|
{
|
2009-07-21 15:15:38 +00:00
|
|
|
|
if(e.Button == MouseButtons.Left)
|
|
|
|
|
{
|
2009-07-21 18:48:00 +00:00
|
|
|
|
General.MainWindow.LockUpdate();
|
2009-07-21 15:15:38 +00:00
|
|
|
|
|
|
|
|
|
// Resize the control
|
|
|
|
|
int delta = e.X - splitstartoffset;
|
2009-07-21 18:48:00 +00:00
|
|
|
|
int collapsedwidth = GetCollapsedWidth();
|
2009-07-21 15:15:38 +00:00
|
|
|
|
if(rightalign)
|
|
|
|
|
{
|
2010-10-03 16:44:34 +00:00
|
|
|
|
if((this.Width > collapsedwidth) || (delta < 0))
|
2009-07-21 18:48:00 +00:00
|
|
|
|
{
|
2010-10-03 16:44:34 +00:00
|
|
|
|
this.Left += delta;
|
|
|
|
|
this.Width -= delta;
|
|
|
|
|
if(this.Width < collapsedwidth)
|
|
|
|
|
{
|
|
|
|
|
this.Left -= collapsedwidth - this.Width;
|
|
|
|
|
this.Width = collapsedwidth;
|
|
|
|
|
}
|
2009-07-21 18:48:00 +00:00
|
|
|
|
}
|
2009-07-21 15:15:38 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2010-10-03 16:44:34 +00:00
|
|
|
|
if((this.Width > collapsedwidth) || (delta > 0))
|
|
|
|
|
{
|
|
|
|
|
this.Width += delta;
|
|
|
|
|
if(this.Width < collapsedwidth)
|
|
|
|
|
this.Width = collapsedwidth;
|
|
|
|
|
}
|
2009-07-21 15:15:38 +00:00
|
|
|
|
}
|
2009-07-21 18:48:00 +00:00
|
|
|
|
|
|
|
|
|
General.MainWindow.UnlockUpdate();
|
2009-07-21 15:15:38 +00:00
|
|
|
|
this.Update();
|
|
|
|
|
General.MainWindow.RedrawDisplay();
|
|
|
|
|
General.MainWindow.Update();
|
|
|
|
|
|
|
|
|
|
// Raise event
|
2014-12-03 23:15:26 +00:00
|
|
|
|
if(UserResize != null) UserResize(this, EventArgs.Empty);
|
2009-07-21 15:15:38 +00:00
|
|
|
|
}
|
2009-07-21 13:42:36 +00:00
|
|
|
|
}
|
Visual mode, UDMF: added "Scale Texture Up (X)", "Scale Texture Down (X)", "Scale Texture Up (Y)", "Scale Texture Down (Y)" actions. Default keys are Num6, Num4, Num8, Num5.
Visual mode, UDMF: renamed "Rotate Thing Clockwise" and "Rotate Thing Counterclockwise" actions to "Rotate Clockwise" and "Rotate Counterclockwise". These actions can now be used to change rotation of floor/ceiling textures.
Visual mode, UDMF: "Reset Texture Offsets" action now also resets sidedef's scale and floor/ceiling's scale and rotation.
Visual mode, UDMF: control line's OffsetX and OffsetY were not taken into account when calculating texture offsets of 3d floors' sides.
Visual mode, UDMF: fixed a ton of bugs in Auto align functions.
Visual mode, UDMF: when using "Move Texture Left/Right/Up/Down by 1" actions texture offsets were not updated properly when texture's scale was < 1.0.
Visual mode, UDMF: OffsetX and OffsetY were not taken into account in "Fit Texture Width/Height" actions.
Dockers Panel: added Pin/Unpin button, which acts the same as "Preferences -> Interface -> Side panels -> Auto hide" checkbox.
Texture size labels can now be disabled by unchecking "Preferences -> Interface -> Show texture and flat sizes in browsers" checkbox.
Texture size labels now are not shown for unknown textures.
Most of texture size labels had incorrect bg color.
ZDoom_linedefs.cfg: action specials 223 and 224 had incorrect Arg0.
2013-06-24 14:21:13 +00:00
|
|
|
|
|
|
|
|
|
//mxd
|
2015-01-09 08:11:42 +00:00
|
|
|
|
private void pinbutton_Click(object sender, EventArgs e)
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
Visual mode, UDMF: added "Scale Texture Up (X)", "Scale Texture Down (X)", "Scale Texture Up (Y)", "Scale Texture Down (Y)" actions. Default keys are Num6, Num4, Num8, Num5.
Visual mode, UDMF: renamed "Rotate Thing Clockwise" and "Rotate Thing Counterclockwise" actions to "Rotate Clockwise" and "Rotate Counterclockwise". These actions can now be used to change rotation of floor/ceiling textures.
Visual mode, UDMF: "Reset Texture Offsets" action now also resets sidedef's scale and floor/ceiling's scale and rotation.
Visual mode, UDMF: control line's OffsetX and OffsetY were not taken into account when calculating texture offsets of 3d floors' sides.
Visual mode, UDMF: fixed a ton of bugs in Auto align functions.
Visual mode, UDMF: when using "Move Texture Left/Right/Up/Down by 1" actions texture offsets were not updated properly when texture's scale was < 1.0.
Visual mode, UDMF: OffsetX and OffsetY were not taken into account in "Fit Texture Width/Height" actions.
Dockers Panel: added Pin/Unpin button, which acts the same as "Preferences -> Interface -> Side panels -> Auto hide" checkbox.
Texture size labels can now be disabled by unchecking "Preferences -> Interface -> Show texture and flat sizes in browsers" checkbox.
Texture size labels now are not shown for unknown textures.
Most of texture size labels had incorrect bg color.
ZDoom_linedefs.cfg: action specials 223 and 224 had incorrect Arg0.
2013-06-24 14:21:13 +00:00
|
|
|
|
General.Settings.CollapseDockers = !General.Settings.CollapseDockers;
|
|
|
|
|
General.MainWindow.SetupInterface();
|
2015-01-09 08:11:42 +00:00
|
|
|
|
UpdatePinIcon();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
|
private void DockersControl_Resize(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
pinbutton.Width = this.Width - pinbutton.Margin.Left - pinbutton.Margin.Right;
|
Visual mode, UDMF: added "Scale Texture Up (X)", "Scale Texture Down (X)", "Scale Texture Up (Y)", "Scale Texture Down (Y)" actions. Default keys are Num6, Num4, Num8, Num5.
Visual mode, UDMF: renamed "Rotate Thing Clockwise" and "Rotate Thing Counterclockwise" actions to "Rotate Clockwise" and "Rotate Counterclockwise". These actions can now be used to change rotation of floor/ceiling textures.
Visual mode, UDMF: "Reset Texture Offsets" action now also resets sidedef's scale and floor/ceiling's scale and rotation.
Visual mode, UDMF: control line's OffsetX and OffsetY were not taken into account when calculating texture offsets of 3d floors' sides.
Visual mode, UDMF: fixed a ton of bugs in Auto align functions.
Visual mode, UDMF: when using "Move Texture Left/Right/Up/Down by 1" actions texture offsets were not updated properly when texture's scale was < 1.0.
Visual mode, UDMF: OffsetX and OffsetY were not taken into account in "Fit Texture Width/Height" actions.
Dockers Panel: added Pin/Unpin button, which acts the same as "Preferences -> Interface -> Side panels -> Auto hide" checkbox.
Texture size labels can now be disabled by unchecking "Preferences -> Interface -> Show texture and flat sizes in browsers" checkbox.
Texture size labels now are not shown for unknown textures.
Most of texture size labels had incorrect bg color.
ZDoom_linedefs.cfg: action specials 223 and 224 had incorrect Arg0.
2013-06-24 14:21:13 +00:00
|
|
|
|
}
|
2009-07-21 15:15:38 +00:00
|
|
|
|
|
|
|
|
|
#endregion
|
2009-07-17 15:06:15 +00:00
|
|
|
|
}
|
|
|
|
|
}
|