Changed, cosmetic: info panel, sidebar and most of the main toolbar buttons are now shown only when a map is loaded.

Fixed, cosmetic: fixed disappearing toolbars separators.
This commit is contained in:
MaxED 2015-03-05 23:19:10 +00:00
parent c3ba37404f
commit 0993c189ea
4 changed files with 63 additions and 70 deletions

View file

@ -80,7 +80,7 @@ namespace CodeImp.DoomBuilder.Controls
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.Opaque, false); this.SetStyle(ControlStyles.Opaque, false);
this.UpdateStyles(); this.UpdateStyles();
this.BackColor = SystemColors.AppWorkspace; this.BackColor = SystemColors.ControlDarkDark;
this.BackgroundImage = Properties.Resources.Splash3_trans; this.BackgroundImage = Properties.Resources.Splash3_trans;
this.BackgroundImageLayout = ImageLayout.Center; this.BackgroundImageLayout = ImageLayout.Center;
} }

View file

@ -1918,7 +1918,7 @@ namespace CodeImp.DoomBuilder
if (optionsform.ShowDialog(General.MainWindow) == DialogResult.OK) if (optionsform.ShowDialog(General.MainWindow) == DialogResult.OK)
{ {
// Update interface // Update interface
General.MainWindow.UpdateInterface(); //General.MainWindow.UpdateInterface();
// Stop data manager // Stop data manager
data.Dispose(); data.Dispose();

View file

@ -1389,7 +1389,6 @@ namespace CodeImp.DoomBuilder.Windows
// buttonthingsfilter // buttonthingsfilter
// //
this.buttonthingsfilter.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.buttonthingsfilter.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.buttonthingsfilter.Enabled = false;
this.buttonthingsfilter.Image = global::CodeImp.DoomBuilder.Properties.Resources.Filter; this.buttonthingsfilter.Image = global::CodeImp.DoomBuilder.Properties.Resources.Filter;
this.buttonthingsfilter.ImageTransparentColor = System.Drawing.Color.Magenta; this.buttonthingsfilter.ImageTransparentColor = System.Drawing.Color.Magenta;
this.buttonthingsfilter.Name = "buttonthingsfilter"; this.buttonthingsfilter.Name = "buttonthingsfilter";
@ -1401,7 +1400,6 @@ namespace CodeImp.DoomBuilder.Windows
// thingfilters // thingfilters
// //
this.thingfilters.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.thingfilters.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.thingfilters.Enabled = false;
this.thingfilters.Items.AddRange(new object[] { this.thingfilters.Items.AddRange(new object[] {
"(none)", "(none)",
"(custom)", "(custom)",
@ -2138,7 +2136,7 @@ namespace CodeImp.DoomBuilder.Windows
// //
// display // display
// //
this.display.BackColor = System.Drawing.SystemColors.AppWorkspace; this.display.BackColor = System.Drawing.SystemColors.ControlDarkDark;
this.display.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; this.display.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.display.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.display.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.display.CausesValidation = false; this.display.CausesValidation = false;
@ -2187,8 +2185,7 @@ namespace CodeImp.DoomBuilder.Windows
this.modestoolbar.Padding = new System.Windows.Forms.Padding(2, 0, 2, 0); this.modestoolbar.Padding = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.modestoolbar.Size = new System.Drawing.Size(30, 515); this.modestoolbar.Size = new System.Drawing.Size(30, 515);
this.modestoolbar.TabIndex = 8; this.modestoolbar.TabIndex = 8;
this.modestoolbar.Text = "toolStrip1"; this.modestoolbar.Text = "Editing Modes";
this.modestoolbar.Visible = false;
// //
// dockerspanel // dockerspanel
// //

View file

@ -309,7 +309,7 @@ namespace CodeImp.DoomBuilder.Windows
internal void SetupInterface() internal void SetupInterface()
{ {
// Setup docker // Setup docker
if(General.Settings.DockersPosition != 2) if(General.Settings.DockersPosition != 2 && General.Map != null)
{ {
LockUpdate(); LockUpdate();
dockerspanel.Visible = true; dockerspanel.Visible = true;
@ -329,10 +329,12 @@ namespace CodeImp.DoomBuilder.Windows
dockersspace.Width = General.Settings.DockersWidth; dockersspace.Width = General.Settings.DockersWidth;
// Setup docker // Setup docker
int targetindex = this.Controls.IndexOf(display) + 1; //mxd
if(General.Settings.DockersPosition == 0) if(General.Settings.DockersPosition == 0)
{ {
modestoolbar.Dock = DockStyle.Right; //mxd modestoolbar.Dock = DockStyle.Right; //mxd
dockersspace.Dock = DockStyle.Left; dockersspace.Dock = DockStyle.Left;
AdjustDockersSpace(targetindex); //mxd
dockerspanel.Setup(false); dockerspanel.Setup(false);
dockerspanel.Location = dockersspace.Location; dockerspanel.Location = dockersspace.Location;
dockerspanel.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Bottom; dockerspanel.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Bottom;
@ -341,6 +343,7 @@ namespace CodeImp.DoomBuilder.Windows
{ {
modestoolbar.Dock = DockStyle.Left; //mxd modestoolbar.Dock = DockStyle.Left; //mxd
dockersspace.Dock = DockStyle.Right; dockersspace.Dock = DockStyle.Right;
AdjustDockersSpace(targetindex); //mxd
dockerspanel.Setup(true); dockerspanel.Setup(true);
dockerspanel.Location = new Point(dockersspace.Right - General.Settings.DockersWidth, dockersspace.Top); dockerspanel.Location = new Point(dockersspace.Right - General.Settings.DockersWidth, dockersspace.Top);
dockerspanel.Anchor = AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom; dockerspanel.Anchor = AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom;
@ -350,8 +353,7 @@ namespace CodeImp.DoomBuilder.Windows
dockerspanel.Height = dockersspace.Height; dockerspanel.Height = dockersspace.Height;
dockerspanel.BringToFront(); dockerspanel.BringToFront();
if(General.Settings.CollapseDockers) if(General.Settings.CollapseDockers) dockerspanel.Collapse();
dockerspanel.Collapse();
UnlockUpdate(); UnlockUpdate();
} }
@ -359,6 +361,16 @@ namespace CodeImp.DoomBuilder.Windows
{ {
dockerspanel.Visible = false; dockerspanel.Visible = false;
dockersspace.Visible = false; dockersspace.Visible = false;
modestoolbar.Dock = DockStyle.Left; //mxd
}
}
//mxd. dockersspace display index gets messed up while re-docking. This fixes it...
private void AdjustDockersSpace(int targetindex)
{
while(this.Controls.IndexOf(dockersspace) != targetindex)
{
this.Controls.SetChildIndex(dockersspace, targetindex);
} }
} }
@ -559,7 +571,7 @@ namespace CodeImp.DoomBuilder.Windows
{ {
windowactive = true; windowactive = true;
UpdateInterface(); //UpdateInterface();
ResumeExclusiveMouseInput(); ResumeExclusiveMouseInput();
ReleaseAllKeys(); ReleaseAllKeys();
FocusDisplay(); FocusDisplay();
@ -1836,45 +1848,47 @@ namespace CodeImp.DoomBuilder.Windows
preventupdateseperators = true; preventupdateseperators = true;
// Show/hide items based on preferences // Show/hide items based on preferences
bool maploaded = General.Map != null; //mxd
buttonnewmap.Visible = General.Settings.ToolbarFile; buttonnewmap.Visible = General.Settings.ToolbarFile;
buttonopenmap.Visible = General.Settings.ToolbarFile; buttonopenmap.Visible = General.Settings.ToolbarFile;
buttonsavemap.Visible = General.Settings.ToolbarFile; buttonsavemap.Visible = General.Settings.ToolbarFile;
buttonscripteditor.Visible = General.Settings.ToolbarScript; buttonscripteditor.Visible = General.Settings.ToolbarScript && maploaded;
buttonundo.Visible = General.Settings.ToolbarUndo; buttonundo.Visible = General.Settings.ToolbarUndo && maploaded;
buttonredo.Visible = General.Settings.ToolbarUndo; buttonredo.Visible = General.Settings.ToolbarUndo && maploaded;
buttoncut.Visible = General.Settings.ToolbarCopy; buttoncut.Visible = General.Settings.ToolbarCopy && maploaded;
buttoncopy.Visible = General.Settings.ToolbarCopy; buttoncopy.Visible = General.Settings.ToolbarCopy && maploaded;
buttonpaste.Visible = General.Settings.ToolbarCopy; buttonpaste.Visible = General.Settings.ToolbarCopy && maploaded;
buttoninsertprefabfile.Visible = General.Settings.ToolbarPrefabs; buttoninsertprefabfile.Visible = General.Settings.ToolbarPrefabs && maploaded;
buttoninsertpreviousprefab.Visible = General.Settings.ToolbarPrefabs; buttoninsertpreviousprefab.Visible = General.Settings.ToolbarPrefabs && maploaded;
buttonthingsfilter.Visible = General.Settings.ToolbarFilter; buttonthingsfilter.Visible = General.Settings.ToolbarFilter && maploaded;
thingfilters.Visible = General.Settings.ToolbarFilter; thingfilters.Visible = General.Settings.ToolbarFilter && maploaded;
separatorfilters.Visible = General.Settings.ToolbarViewModes; //mxd separatorfilters.Visible = General.Settings.ToolbarViewModes && maploaded; //mxd
buttonfullbrightness.Visible = General.Settings.ToolbarViewModes; //mxd buttonfullbrightness.Visible = General.Settings.ToolbarViewModes && maploaded; //mxd
separatorfullbrightness.Visible = General.Settings.ToolbarViewModes; //mxd separatorfullbrightness.Visible = General.Settings.ToolbarViewModes && maploaded; //mxd
buttonviewbrightness.Visible = General.Settings.ToolbarViewModes; buttonviewbrightness.Visible = General.Settings.ToolbarViewModes && maploaded;
buttonviewceilings.Visible = General.Settings.ToolbarViewModes; buttonviewceilings.Visible = General.Settings.ToolbarViewModes && maploaded;
buttonviewfloors.Visible = General.Settings.ToolbarViewModes; buttonviewfloors.Visible = General.Settings.ToolbarViewModes && maploaded;
buttonviewnormal.Visible = General.Settings.ToolbarViewModes; buttonviewnormal.Visible = General.Settings.ToolbarViewModes && maploaded;
buttonsnaptogrid.Visible = General.Settings.ToolbarGeometry; buttonsnaptogrid.Visible = General.Settings.ToolbarGeometry && maploaded;
buttonautomerge.Visible = General.Settings.ToolbarGeometry; buttonautomerge.Visible = General.Settings.ToolbarGeometry && maploaded;
buttonautoclearsidetextures.Visible = General.Settings.ToolbarGeometry; //mxd buttonautoclearsidetextures.Visible = General.Settings.ToolbarGeometry && maploaded; //mxd
buttontest.Visible = General.Settings.ToolbarTesting; buttontest.Visible = General.Settings.ToolbarTesting && maploaded;
//mxd //mxd
modelrendermode.Visible = General.Settings.GZToolbarGZDoom; modelrendermode.Visible = General.Settings.GZToolbarGZDoom && maploaded;
dynamiclightmode.Visible = General.Settings.GZToolbarGZDoom; dynamiclightmode.Visible = General.Settings.GZToolbarGZDoom && maploaded;
buttontogglefx.Visible = General.Settings.GZToolbarGZDoom; buttontogglefx.Visible = General.Settings.GZToolbarGZDoom && maploaded;
buttontogglefog.Visible = General.Settings.GZToolbarGZDoom; buttontogglefog.Visible = General.Settings.GZToolbarGZDoom && maploaded;
buttontoggleeventlines.Visible = General.Settings.GZToolbarGZDoom; buttontoggleeventlines.Visible = General.Settings.GZToolbarGZDoom && maploaded;
buttontogglevisualvertices.Visible = General.Settings.GZToolbarGZDoom; buttontogglevisualvertices.Visible = General.Settings.GZToolbarGZDoom && maploaded;
separatorgzmodes.Visible = General.Settings.GZToolbarGZDoom; separatorgzmodes.Visible = General.Settings.GZToolbarGZDoom && maploaded;
// Enable/disable all edit mode items // Enable/disable all edit mode items
foreach(ToolStripItem i in editmodeitems) i.Enabled = (General.Map != null); //foreach(ToolStripItem i in editmodeitems) i.Enabled = (General.Map != null);
//mxd. Show/hide additional panels //mxd. Show/hide additional panels
modestoolbar.Visible = (General.Map != null); modestoolbar.Visible = (General.Map != null);
panelinfo.Visible = (General.Map != null);
modecontrolsloolbar.Visible = (General.Map != null && modecontrolsloolbar.Items.Count > 0); modecontrolsloolbar.Visible = (General.Map != null && modecontrolsloolbar.Items.Count > 0);
//mxd. modestoolbar index in Controls gets messed up when it's invisible. This fixes it. TODO: find why this happens in the first place //mxd. modestoolbar index in Controls gets messed up when it's invisible. This fixes it. TODO: find why this happens in the first place
@ -2049,6 +2063,12 @@ namespace CodeImp.DoomBuilder.Windows
private void toolbarContextMenu_Opening(object sender, CancelEventArgs e) private void toolbarContextMenu_Opening(object sender, CancelEventArgs e)
{ {
if(General.Map == null)
{
e.Cancel = true;
return;
}
toggleFile.Image = General.Settings.ToolbarFile ? Resources.Check : null; toggleFile.Image = General.Settings.ToolbarFile ? Resources.Check : null;
toggleScript.Image = General.Settings.ToolbarScript ? Resources.Check : null; toggleScript.Image = General.Settings.ToolbarScript ? Resources.Check : null;
toggleUndo.Image = General.Settings.ToolbarUndo ? Resources.Check : null; toggleUndo.Image = General.Settings.ToolbarUndo ? Resources.Check : null;
@ -2347,7 +2367,6 @@ namespace CodeImp.DoomBuilder.Windows
buttonnewmap.Enabled = itemnewmap.Enabled; buttonnewmap.Enabled = itemnewmap.Enabled;
buttonopenmap.Enabled = itemopenmap.Enabled; buttonopenmap.Enabled = itemopenmap.Enabled;
buttonsavemap.Enabled = itemsavemap.Enabled; buttonsavemap.Enabled = itemsavemap.Enabled;
buttontest.Enabled = itemtestmap.Enabled;
} }
// This sets the recent files from configuration // This sets the recent files from configuration
@ -2507,7 +2526,7 @@ namespace CodeImp.DoomBuilder.Windows
private void UpdateEditMenu() private void UpdateEditMenu()
{ {
// No edit menu when no map open // No edit menu when no map open
//menuedit.Visible = (General.Map != null); menuedit.Visible = (General.Map != null);
// Enable/disable items // Enable/disable items
itemundo.Enabled = (General.Map != null) && (General.Map.UndoRedo.NextUndo != null); itemundo.Enabled = (General.Map != null) && (General.Map.UndoRedo.NextUndo != null);
@ -2516,20 +2535,7 @@ namespace CodeImp.DoomBuilder.Windows
itemcopy.Enabled = (General.Map != null) && (General.Editing.Mode != null) && General.Editing.Mode.Attributes.AllowCopyPaste; itemcopy.Enabled = (General.Map != null) && (General.Editing.Mode != null) && General.Editing.Mode.Attributes.AllowCopyPaste;
itempaste.Enabled = (General.Map != null) && (General.Editing.Mode != null) && General.Editing.Mode.Attributes.AllowCopyPaste; itempaste.Enabled = (General.Map != null) && (General.Editing.Mode != null) && General.Editing.Mode.Attributes.AllowCopyPaste;
itempastespecial.Enabled = (General.Map != null) && (General.Editing.Mode != null) && General.Editing.Mode.Attributes.AllowCopyPaste; itempastespecial.Enabled = (General.Map != null) && (General.Editing.Mode != null) && General.Editing.Mode.Attributes.AllowCopyPaste;
itemmapoptions.Enabled = (General.Map != null);
itemsnaptogrid.Enabled = (General.Map != null);
itemautomerge.Enabled = (General.Map != null);
itemautoclearsidetextures.Enabled = (General.Map != null); //mxd
itemautoclearsidetextures.Checked = General.Settings.AutoClearSidedefTextures; //mxd itemautoclearsidetextures.Checked = General.Settings.AutoClearSidedefTextures; //mxd
itemdosnaptogrid.Enabled = (General.Map != null); //mxd
itemgridsetup.Enabled = (General.Map != null);
itemgridinc.Enabled = (General.Map != null);
itemgriddec.Enabled = (General.Map != null);
itemviewusedtags.Enabled = (General.Map != null); //mxd
itemviewthingtypes.Enabled = (General.Map != null); //mxd
addToGroup.Enabled = (General.Map != null); //mxd
selectGroup.Enabled = (General.Map != null); //mxd
clearGroup.Enabled = (General.Map != null); //mxd
// Determine undo description // Determine undo description
if(itemundo.Enabled) if(itemundo.Enabled)
@ -2548,9 +2554,6 @@ namespace CodeImp.DoomBuilder.Windows
buttonredo.Enabled = itemredo.Enabled; buttonredo.Enabled = itemredo.Enabled;
buttonundo.ToolTipText = itemundo.Text; buttonundo.ToolTipText = itemundo.Text;
buttonredo.ToolTipText = itemredo.Text; buttonredo.ToolTipText = itemredo.Text;
buttonsnaptogrid.Enabled = (General.Map != null);
buttonautomerge.Enabled = (General.Map != null);
buttonautoclearsidetextures.Enabled = (General.Map != null); //mxd
buttonautoclearsidetextures.Checked = itemautoclearsidetextures.Checked; //mxd buttonautoclearsidetextures.Checked = itemautoclearsidetextures.Checked; //mxd
buttoncut.Enabled = itemcut.Enabled; buttoncut.Enabled = itemcut.Enabled;
buttoncopy.Enabled = itemcopy.Enabled; buttoncopy.Enabled = itemcopy.Enabled;
@ -2678,6 +2681,7 @@ namespace CodeImp.DoomBuilder.Windows
menuzoom.Enabled = (General.Map != null); menuzoom.Enabled = (General.Map != null);
menugotocoords.Enabled = (General.Map != null); //mxd menugotocoords.Enabled = (General.Map != null); //mxd
menufullbrightness.Enabled = (General.Map != null); //mxd menufullbrightness.Enabled = (General.Map != null); //mxd
itemtoggleinfo.Enabled = (General.Map != null); //mxd
itemtoggleinfo.Checked = IsInfoPanelExpanded; itemtoggleinfo.Checked = IsInfoPanelExpanded;
// View mode items // View mode items
@ -2699,12 +2703,6 @@ namespace CodeImp.DoomBuilder.Windows
viewmodesitems[i].Checked = (i == (int)General.Map.CRenderer2D.ViewMode); viewmodesitems[i].Checked = (i == (int)General.Map.CRenderer2D.ViewMode);
} }
} }
// Toolbar icons
thingfilters.Enabled = (General.Map != null);
buttonthingsfilter.Enabled = (General.Map != null);
buttonscripteditor.Enabled = (General.Map != null);
buttonfullbrightness.Enabled = (General.Map != null); //mxd
} }
#endregion #endregion
@ -2730,10 +2728,8 @@ namespace CodeImp.DoomBuilder.Windows
// About clicked // About clicked
private void itemhelpabout_Click(object sender, EventArgs e) private void itemhelpabout_Click(object sender, EventArgs e)
{ {
AboutForm aboutform;
// Show about dialog // Show about dialog
aboutform = new AboutForm(); AboutForm aboutform = new AboutForm();
aboutform.ShowDialog(this); aboutform.ShowDialog(this);
} }