Toolbar buttons now show their assigned shortcut key in their tool tip

This commit is contained in:
biwa 2022-05-28 16:19:01 +02:00
parent 57b796e87d
commit 4f526dc57f
14 changed files with 290 additions and 130 deletions

View file

@ -203,6 +203,9 @@
<Compile Include="Controls\SidedefPartLightControl.Designer.cs">
<DependentUpon>SidedefPartLightControl.cs</DependentUpon>
</Compile>
<Compile Include="Controls\ToolStripActionButton.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Controls\TransparentTrackBar.cs">
<SubType>Component</SubType>
</Compile>

View file

@ -200,6 +200,9 @@
<Compile Include="Controls\SidedefPartLightControl.Designer.cs">
<DependentUpon>SidedefPartLightControl.cs</DependentUpon>
</Compile>
<Compile Include="Controls\ToolStripActionButton.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Controls\TransparentTrackBar.cs">
<SubType>Component</SubType>
</Compile>

View file

@ -0,0 +1,134 @@
#region ================== Copyright (c) 2022 Boris Iwanski
/*
* This program is free software: you can redistribute it and/or modify
*
* it under the terms of the GNU General Public License as published by
*
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program.If not, see<http://www.gnu.org/licenses/>.
*/
#endregion
#region ================== Namespaces
using System;
using System.ComponentModel;
using System.Drawing;
using System.Reflection;
using System.Windows.Forms;
using System.Windows.Forms.Design;
using CodeImp.DoomBuilder.Editing;
using CodeImp.DoomBuilder.Plugins;
#endregion
namespace CodeImp.DoomBuilder.Controls
{
[ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.ToolStrip)]
public class ToolStripActionButton : ToolStripButton
{
#region ================== Variables
private string baseToolTipText;
private Assembly parentAssembly;
#endregion
#region ================== Constructors
public ToolStripActionButton() : base()
{
parentAssembly = Assembly.GetCallingAssembly();
}
public ToolStripActionButton(string text) : base(text)
{
parentAssembly = Assembly.GetCallingAssembly();
}
public ToolStripActionButton(string text, Image image) : base(text, image)
{
parentAssembly = Assembly.GetCallingAssembly();
}
public ToolStripActionButton(string text, Image image, EventHandler onClick) : base(text, image, onClick)
{
parentAssembly = Assembly.GetCallingAssembly();
}
public ToolStripActionButton(string text, Image image, EventHandler onClick, string name) : base(text, image, onClick, name)
{
parentAssembly = Assembly.GetCallingAssembly();
}
#endregion
#region ================== Methods
/// <summary>
/// Updates the tooltip of the button with its action shortcut key description. This has to be called after the button was added to the MainForm unless the tag contains the full action name (including the assembly).
/// </summary>
public void UpdateToolTip()
{
string actionName = string.Empty;
// The shotcut key can change at runtime, so we need to remember the original tooltip without the shotcut key
if (string.IsNullOrWhiteSpace(baseToolTipText))
baseToolTipText = ToolTipText;
// Try to figure out what's the real action name is. The action name can either be directly stored in the Tag, or
// (in case it's a button for edit modes) can be extracted from the EditModeInfo, which is also stored in the Tag.
if (Tag is string)
{
actionName = (string)Tag;
// If it's not a known action we might be missing the plugin name as a prefix, so try to add it. This only works
// if this method is called directly from the plugin!
if (!General.Actions.Exists(actionName))
{
Plugin plugin = General.Plugins.FindPluginByAssembly(parentAssembly);
if (plugin != null)
actionName = plugin.Name.ToLowerInvariant() + "_" + actionName;
}
}
else if (Tag is EditModeInfo modeInfo) // It's a mode button
{
actionName = modeInfo.SwitchAction.ActionName;
// If it's not a known action we might be missing the plugin name as a prefix, so add it from the mode's plugin
if (!General.Actions.Exists(actionName))
actionName = General.Plugins.FindPluginByAssembly(modeInfo.Plugin.Assembly).Name.ToLowerInvariant() + "_" + actionName;
}
// Only try to add the shortcut key if the action is valid
if (!string.IsNullOrWhiteSpace(actionName) && General.Actions.Exists(actionName))
{
Actions.Action action = General.Actions.GetActionByName(actionName);
string shortcutKey = Actions.Action.GetShortcutKeyDesc(action.ShortcutKey);
if (string.IsNullOrWhiteSpace(shortcutKey))
ToolTipText = baseToolTipText;
else
ToolTipText = $"{baseToolTipText} ({shortcutKey})";
}
else
ToolTipText = baseToolTipText;
}
#endregion
}
}

View file

@ -162,21 +162,21 @@ namespace CodeImp.DoomBuilder.Windows
this.toggleGeometry = new System.Windows.Forms.ToolStripMenuItem();
this.toggleTesting = new System.Windows.Forms.ToolStripMenuItem();
this.toggleRendering = new System.Windows.Forms.ToolStripMenuItem();
this.buttonnewmap = new System.Windows.Forms.ToolStripButton();
this.buttonopenmap = new System.Windows.Forms.ToolStripButton();
this.buttonsavemap = new System.Windows.Forms.ToolStripButton();
this.buttonscripteditor = new System.Windows.Forms.ToolStripButton();
this.buttonundo = new System.Windows.Forms.ToolStripButton();
this.buttonredo = new System.Windows.Forms.ToolStripButton();
this.buttoncut = new System.Windows.Forms.ToolStripButton();
this.buttoncopy = new System.Windows.Forms.ToolStripButton();
this.buttonpaste = new System.Windows.Forms.ToolStripButton();
this.buttoninsertprefabfile = new System.Windows.Forms.ToolStripButton();
this.buttoninsertpreviousprefab = new System.Windows.Forms.ToolStripButton();
this.buttonthingsfilter = new System.Windows.Forms.ToolStripButton();
this.buttonnewmap = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttonopenmap = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttonsavemap = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttonscripteditor = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttonundo = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttonredo = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttoncut = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttoncopy = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttonpaste = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttoninsertprefabfile = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttoninsertpreviousprefab = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttonthingsfilter = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.thingfilters = new System.Windows.Forms.ToolStripDropDownButton();
this.separatorlinecolors = new System.Windows.Forms.ToolStripSeparator();
this.buttonlinededfcolors = new System.Windows.Forms.ToolStripButton();
this.buttonlinededfcolors = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.linedefcolorpresets = new System.Windows.Forms.ToolStripDropDownButton();
this.separatorfilters = new System.Windows.Forms.ToolStripSeparator();
this.separatorrendering = new System.Windows.Forms.ToolStripSeparator();
@ -194,25 +194,25 @@ namespace CodeImp.DoomBuilder.Windows
this.itemtoggleclassicrendering = new System.Windows.Forms.ToolStripMenuItem();
this.itemtoggleeventlines = new System.Windows.Forms.ToolStripMenuItem();
this.itemtogglevisualverts = new System.Windows.Forms.ToolStripMenuItem();
this.buttonfullbrightness = new System.Windows.Forms.ToolStripButton();
this.buttontogglegrid = new System.Windows.Forms.ToolStripButton();
this.buttontoggledynamicgrid = new System.Windows.Forms.ToolStripButton();
this.buttonfullbrightness = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttontogglegrid = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttontoggledynamicgrid = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.separatorfullbrightness = new System.Windows.Forms.ToolStripSeparator();
this.buttonviewnormal = new System.Windows.Forms.ToolStripButton();
this.buttonviewbrightness = new System.Windows.Forms.ToolStripButton();
this.buttonviewfloors = new System.Windows.Forms.ToolStripButton();
this.buttonviewceilings = new System.Windows.Forms.ToolStripButton();
this.buttonviewnormal = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttonviewbrightness = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttonviewfloors = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttonviewceilings = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.separatorgeomergemodes = new System.Windows.Forms.ToolStripSeparator();
this.buttonmergegeoclassic = new System.Windows.Forms.ToolStripButton();
this.buttonmergegeo = new System.Windows.Forms.ToolStripButton();
this.buttonplacegeo = new System.Windows.Forms.ToolStripButton();
this.buttonmergegeoclassic = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttonmergegeo = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttonplacegeo = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.seperatorviews = new System.Windows.Forms.ToolStripSeparator();
this.buttontogglecomments = new System.Windows.Forms.ToolStripButton();
this.buttontogglefixedthingsscale = new System.Windows.Forms.ToolStripButton();
this.buttonsnaptogrid = new System.Windows.Forms.ToolStripButton();
this.buttonautomerge = new System.Windows.Forms.ToolStripButton();
this.buttonsplitjoinedsectors = new System.Windows.Forms.ToolStripButton();
this.buttonautoclearsidetextures = new System.Windows.Forms.ToolStripButton();
this.buttontogglecomments = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttontogglefixedthingsscale = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttonsnaptogrid = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttonautomerge = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttonsplitjoinedsectors = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttonautoclearsidetextures = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.seperatorgeometry = new System.Windows.Forms.ToolStripSeparator();
this.dynamiclightmode = new System.Windows.Forms.ToolStripSplitButton();
this.sightsdontshow = new System.Windows.Forms.ToolStripMenuItem();
@ -223,11 +223,11 @@ namespace CodeImp.DoomBuilder.Windows
this.modelsshowselection = new System.Windows.Forms.ToolStripMenuItem();
this.modelsshowfiltered = new System.Windows.Forms.ToolStripMenuItem();
this.modelsshowall = new System.Windows.Forms.ToolStripMenuItem();
this.buttontogglefog = new System.Windows.Forms.ToolStripButton();
this.buttontogglesky = new System.Windows.Forms.ToolStripButton();
this.buttontoggleclassicrendering = new System.Windows.Forms.ToolStripButton();
this.buttontoggleeventlines = new System.Windows.Forms.ToolStripButton();
this.buttontogglevisualvertices = new System.Windows.Forms.ToolStripButton();
this.buttontogglefog = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttontogglesky = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttontoggleclassicrendering = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttontoggleeventlines = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttontogglevisualvertices = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.separatorgzmodes = new System.Windows.Forms.ToolStripSeparator();
this.buttontest = new System.Windows.Forms.ToolStripSplitButton();
this.seperatortesting = new System.Windows.Forms.ToolStripSeparator();
@ -2920,9 +2920,9 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.ToolStripMenuItem itemnorecent;
private System.Windows.Forms.ToolStripStatusLabel xposlabel;
private System.Windows.Forms.ToolStripStatusLabel yposlabel;
private System.Windows.Forms.ToolStripButton buttonnewmap;
private System.Windows.Forms.ToolStripButton buttonopenmap;
private System.Windows.Forms.ToolStripButton buttonsavemap;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttonnewmap;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttonopenmap;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttonsavemap;
private System.Windows.Forms.ToolStripStatusLabel zoomlabel;
private System.Windows.Forms.ToolStripDropDownButton buttonzoom;
private System.Windows.Forms.ToolStripMenuItem itemzoomfittoscreen;
@ -2942,7 +2942,7 @@ namespace CodeImp.DoomBuilder.Windows
private CodeImp.DoomBuilder.Controls.VertexInfoPanel vertexinfo;
private CodeImp.DoomBuilder.Controls.SectorInfoPanel sectorinfo;
private CodeImp.DoomBuilder.Controls.ThingInfoPanel thinginfo;
private System.Windows.Forms.ToolStripButton buttonthingsfilter;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttonthingsfilter;
private System.Windows.Forms.ToolStripSeparator seperatorviews;
private System.Windows.Forms.ToolStripStatusLabel gridlabel;
private System.Windows.Forms.ToolStripDropDownButton buttongrid;
@ -2959,13 +2959,13 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.ToolStripStatusLabel poscommalabel;
private System.Windows.Forms.ToolStripMenuItem itemundo;
private System.Windows.Forms.ToolStripMenuItem itemredo;
private System.Windows.Forms.ToolStripButton buttonundo;
private System.Windows.Forms.ToolStripButton buttonredo;
private System.Windows.Forms.ToolStripButton buttonsnaptogrid;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttonundo;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttonredo;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttonsnaptogrid;
private System.Windows.Forms.ToolStripMenuItem itemsnaptogrid;
private System.Windows.Forms.ToolStripButton buttonautomerge;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttonautomerge;
private System.Windows.Forms.ToolStripMenuItem itemautomerge;
private System.Windows.Forms.ToolStripButton buttonsplitjoinedsectors;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttonsplitjoinedsectors;
private System.Windows.Forms.ToolStripMenuItem itemsplitjoinedsectors;
private System.Windows.Forms.Timer processor;
private System.Windows.Forms.ToolStripSeparator separatorgzmodes;
@ -2977,25 +2977,25 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.ToolStripMenuItem itemgridsetup;
private System.Windows.Forms.Timer statusflasher;
private System.Windows.Forms.ToolStripSplitButton buttontest;
private System.Windows.Forms.ToolStripButton buttoncut;
private System.Windows.Forms.ToolStripButton buttoncopy;
private System.Windows.Forms.ToolStripButton buttonpaste;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttoncut;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttoncopy;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttonpaste;
private System.Windows.Forms.ToolStripSeparator seperatoreditundo;
private System.Windows.Forms.ToolStripMenuItem itemcut;
private System.Windows.Forms.ToolStripMenuItem itemcopy;
private System.Windows.Forms.ToolStripMenuItem itempaste;
private System.Windows.Forms.ToolStripStatusLabel configlabel;
private System.Windows.Forms.ToolStripMenuItem menumode;
private System.Windows.Forms.ToolStripButton buttonviewnormal;
private System.Windows.Forms.ToolStripButton buttonviewbrightness;
private System.Windows.Forms.ToolStripButton buttonviewfloors;
private System.Windows.Forms.ToolStripButton buttonviewceilings;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttonviewnormal;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttonviewbrightness;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttonviewfloors;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttonviewceilings;
private System.Windows.Forms.ToolStripSeparator separatorgeomergemodes;
private System.Windows.Forms.ToolStripButton buttonmergegeoclassic;
private System.Windows.Forms.ToolStripButton buttonmergegeo;
private System.Windows.Forms.ToolStripButton buttonplacegeo;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttonmergegeoclassic;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttonmergegeo;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttonplacegeo;
private System.Windows.Forms.ToolStripSeparator seperatortoolsresources;
private System.Windows.Forms.ToolStripButton buttonscripteditor;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttonscripteditor;
private System.Windows.Forms.ToolStripMenuItem menuview;
private System.Windows.Forms.ToolStripMenuItem itemthingsfilter;
private System.Windows.Forms.ToolStripSeparator seperatorviewthings;
@ -3016,8 +3016,8 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.ToolStripSeparator seperatorprefabsinsert;
private System.Windows.Forms.ToolStripMenuItem iteminsertprefabfile;
private System.Windows.Forms.ToolStripMenuItem iteminsertpreviousprefab;
private System.Windows.Forms.ToolStripButton buttoninsertprefabfile;
private System.Windows.Forms.ToolStripButton buttoninsertpreviousprefab;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttoninsertprefabfile;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttoninsertpreviousprefab;
private System.Windows.Forms.Button buttontoggleinfo;
private System.Windows.Forms.Label labelcollapsedinfo;
private System.Windows.Forms.Timer statusresetter;
@ -3050,15 +3050,15 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.ToolStripSeparator seperatoreditgrid;
private System.Windows.Forms.ToolStripSeparator seperatoreditcopypaste;
private System.Windows.Forms.ToolStripSeparator seperatorgeometry;
private System.Windows.Forms.ToolStripButton buttontogglefog;
private System.Windows.Forms.ToolStripButton buttontogglesky;
private System.Windows.Forms.ToolStripButton buttontoggleclassicrendering;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttontogglefog;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttontogglesky;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttontoggleclassicrendering;
private System.Windows.Forms.ToolStripStatusLabel warnsLabel;
private System.Windows.Forms.ToolStripMenuItem itemReloadModedef;
private System.Windows.Forms.ToolStripMenuItem itemReloadGldefs;
private System.Windows.Forms.ToolStripSeparator separatorDrawModes;
private System.Windows.Forms.ToolStripButton buttontoggleeventlines;
private System.Windows.Forms.ToolStripButton buttontogglevisualvertices;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttontoggleeventlines;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttontogglevisualvertices;
private System.Windows.Forms.ToolStripMenuItem itemviewusedtags;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
private System.Windows.Forms.ToolStripMenuItem addToGroup;
@ -3088,7 +3088,7 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.ToolStripMenuItem itemzoom400;
private System.Windows.Forms.Label modename;
private System.Windows.Forms.ToolStripMenuItem itemautoclearsidetextures;
private System.Windows.Forms.ToolStripButton buttonautoclearsidetextures;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttonautoclearsidetextures;
private System.Windows.Forms.ToolStripMenuItem itemgotocoords;
private System.Windows.Forms.ToolStripSeparator separatorTransformModes;
private System.Windows.Forms.ToolStripMenuItem itemdosnaptogrid;
@ -3097,7 +3097,7 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.ToolStrip modecontrolsloolbar;
private System.Windows.Forms.ToolStripMenuItem itemfullbrightness;
private System.Windows.Forms.ToolStripSeparator separatorhelpers;
private System.Windows.Forms.ToolStripButton buttonfullbrightness;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttonfullbrightness;
private System.Windows.Forms.ToolStripSeparator separatorfullbrightness;
private System.Windows.Forms.ToolStripSeparator separatorfilters;
private System.Windows.Forms.ToolStripSeparator separatorrendering;

View file

@ -2006,6 +2006,8 @@ namespace CodeImp.DoomBuilder.Windows
// Bind visible changed event
if(!(button is ToolStripSeparator)) button.VisibleChanged += buttonvisiblechangedhandler;
if (button is ToolStripActionButton) ((ToolStripActionButton)button).UpdateToolTip();
// Insert the button in the right section
switch(section)
@ -2204,6 +2206,12 @@ namespace CodeImp.DoomBuilder.Windows
buttontogglevisualvertices.Visible = General.Settings.GZToolbarGZDoom && maploaded && General.Map.UDMF;
separatorgzmodes.Visible = General.Settings.GZToolbarGZDoom && maploaded;
foreach (ToolStripItem item in toolbar.Items)
{
if (item is ToolStripActionButton)
((ToolStripActionButton)item).UpdateToolTip();
}
//mxd. Show/hide additional panels
modestoolbar.Visible = maploaded;
panelinfo.Visible = maploaded;
@ -2235,6 +2243,10 @@ namespace CodeImp.DoomBuilder.Windows
case ToolbarSection.Geometry: p.button.Visible = General.Settings.ToolbarGeometry; break;
case ToolbarSection.Testing: p.button.Visible = General.Settings.ToolbarTesting; break;
}
// Update the tooltips of all buttons added by plugins
if (p.button is ToolStripActionButton)
((ToolStripActionButton)p.button).UpdateToolTip();
}
preventupdateseperators = false;
@ -2312,11 +2324,12 @@ namespace CodeImp.DoomBuilder.Windows
string controlname = modeinfo.ButtonDesc.Replace("&", "&&");
// Create a button
ToolStripItem item = new ToolStripButton(modeinfo.ButtonDesc, modeinfo.ButtonImage, EditModeButtonHandler);
ToolStripItem item = new ToolStripActionButton(modeinfo.ButtonDesc, modeinfo.ButtonImage, EditModeButtonHandler);
item.DisplayStyle = ToolStripItemDisplayStyle.Image;
item.Padding = new Padding(0, 2, 0, 2);
item.Margin = new Padding();
item.Tag = modeinfo;
((ToolStripActionButton)item).UpdateToolTip();
modestoolbar.Items.Add(item); //mxd
editmodeitems.Add(item);

View file

@ -35,13 +35,13 @@
this.ceilingslope = new System.Windows.Forms.ToolStripButton();
this.floorandceilingslope = new System.Windows.Forms.ToolStripButton();
this.updateslopes = new System.Windows.Forms.ToolStripButton();
this.relocatecontrolsectors = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.addsectorscontextmenu = new System.Windows.Forms.ContextMenuStrip(this.components);
this.addslopeceiling = new System.Windows.Forms.ToolStripMenuItem();
this.addslopefloor = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.removeslopeceiling = new System.Windows.Forms.ToolStripMenuItem();
this.removeslopefloor = new System.Windows.Forms.ToolStripMenuItem();
this.relocatecontrolsectors = new System.Windows.Forms.ToolStripButton();
this.toolStrip1.SuspendLayout();
this.addsectorscontextmenu.SuspendLayout();
this.SuspendLayout();
@ -103,6 +103,17 @@
this.updateslopes.Text = "Update slopes";
this.updateslopes.Click += new System.EventHandler(this.toolStripButton1_Click);
//
// relocatecontrolsectors
//
this.relocatecontrolsectors.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.relocatecontrolsectors.Image = ((System.Drawing.Image)(resources.GetObject("relocatecontrolsectors.Image")));
this.relocatecontrolsectors.ImageTransparentColor = System.Drawing.Color.Magenta;
this.relocatecontrolsectors.Name = "relocatecontrolsectors";
this.relocatecontrolsectors.Size = new System.Drawing.Size(137, 22);
this.relocatecontrolsectors.Tag = "relocate3dfloorcontrolsectors";
this.relocatecontrolsectors.Text = "Relocate control sectors";
this.relocatecontrolsectors.Click += new System.EventHandler(this.relocatecontrolsectors_Click);
//
// addsectorscontextmenu
//
this.addsectorscontextmenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -113,8 +124,8 @@
this.removeslopefloor});
this.addsectorscontextmenu.Name = "addsectorscontextmenu";
this.addsectorscontextmenu.Size = new System.Drawing.Size(216, 98);
this.addsectorscontextmenu.Opening += new System.ComponentModel.CancelEventHandler(this.addsectorscontextmenu_Opening);
this.addsectorscontextmenu.Closing += new System.Windows.Forms.ToolStripDropDownClosingEventHandler(this.addsectorscontextmenu_Closing);
this.addsectorscontextmenu.Opening += new System.ComponentModel.CancelEventHandler(this.addsectorscontextmenu_Opening);
//
// addslopeceiling
//
@ -149,17 +160,6 @@
this.removeslopefloor.Text = "Remove slope from floor";
this.removeslopefloor.Click += new System.EventHandler(this.removeSlopeFromFloorToolStripMenuItem_Click);
//
// relocatecontrolsectors
//
this.relocatecontrolsectors.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.relocatecontrolsectors.Image = ((System.Drawing.Image)(resources.GetObject("relocatecontrolsectors.Image")));
this.relocatecontrolsectors.ImageTransparentColor = System.Drawing.Color.Magenta;
this.relocatecontrolsectors.Name = "relocatecontrolsectors";
this.relocatecontrolsectors.Size = new System.Drawing.Size(137, 22);
this.relocatecontrolsectors.Tag = "relocate3dfloorcontrolsectors";
this.relocatecontrolsectors.Text = "Relocate control sectors";
this.relocatecontrolsectors.Click += new System.EventHandler(this.relocatecontrolsectors_Click);
//
// MenusForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -189,6 +189,6 @@
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripMenuItem removeslopeceiling;
private System.Windows.Forms.ToolStripMenuItem removeslopefloor;
private System.Windows.Forms.ToolStripButton relocatecontrolsectors;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton relocatecontrolsectors;
}
}

View file

@ -8,6 +8,7 @@ using System.Text;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Windows;
using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Controls;
namespace CodeImp.DoomBuilder.ThreeDFloorMode
{
@ -17,7 +18,7 @@ namespace CodeImp.DoomBuilder.ThreeDFloorMode
public ToolStripButton CeilingSlope { get { return ceilingslope; } }
public ToolStripButton FloorAndCeilingSlope { get { return floorandceilingslope; } }
public ToolStripButton UpdateSlopes { get { return updateslopes; } }
public ToolStripButton RelocateControlSectors { get { return relocatecontrolsectors; } }
public ToolStripActionButton RelocateControlSectors { get { return relocatecontrolsectors; } }
public ContextMenuStrip AddSectorsContextMenu { get { return addsectorscontextmenu; } }
public MenusForm()
@ -25,6 +26,11 @@ namespace CodeImp.DoomBuilder.ThreeDFloorMode
InitializeComponent();
}
public void UpdateToolTips()
{
relocatecontrolsectors.UpdateToolTip();
}
private void InvokeTaggedAction(object sender, EventArgs e)
{
General.Interface.InvokeTaggedAction(sender, e);

View file

@ -112,15 +112,15 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="updateslopes.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
@ -151,7 +151,7 @@
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
</value>
</data>
<metadata name="addsectorscontextmenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="addsectorscontextmenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>122, 17</value>
</metadata>
</root>

View file

@ -32,8 +32,8 @@
this.menujitter = new System.Windows.Forms.ToolStripMenuItem();
this.menusectorflatshading = new System.Windows.Forms.ToolStripMenuItem();
this.toolStrip = new System.Windows.Forms.ToolStrip();
this.buttonjitter = new System.Windows.Forms.ToolStripButton();
this.buttonsectorflatshading = new System.Windows.Forms.ToolStripButton();
this.buttonjitter = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttonsectorflatshading = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.menuStrip.SuspendLayout();
this.toolStrip.SuspendLayout();
this.SuspendLayout();
@ -151,10 +151,10 @@
private System.Windows.Forms.ToolStripMenuItem stripimport;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
private System.Windows.Forms.ToolStrip toolStrip;
private System.Windows.Forms.ToolStripButton buttonjitter;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttonjitter;
private System.Windows.Forms.ToolStripMenuItem stripmodes;
private System.Windows.Forms.ToolStripMenuItem menujitter;
private System.Windows.Forms.ToolStripMenuItem menusectorflatshading;
private System.Windows.Forms.ToolStripButton buttonsectorflatshading;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttonsectorflatshading;
}
}

View file

@ -79,27 +79,27 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.selectSimilarVertsItem = new System.Windows.Forms.ToolStripMenuItem();
this.globalstrip = new System.Windows.Forms.ToolStrip();
this.manualstrip = new System.Windows.Forms.ToolStrip();
this.buttoncopyproperties = new System.Windows.Forms.ToolStripButton();
this.buttonpasteproperties = new System.Windows.Forms.ToolStripButton();
this.buttonpastepropertiesoptions = new System.Windows.Forms.ToolStripButton();
this.buttoncopyproperties = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttonpasteproperties = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttonpastepropertiesoptions = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.seperatorcopypaste = new System.Windows.Forms.ToolStripSeparator();
this.buttonselectionnumbers = new System.Windows.Forms.ToolStripButton();
this.buttonselectioneffects = new System.Windows.Forms.ToolStripButton();
this.separatorsectors1 = new System.Windows.Forms.ToolStripSeparator();
this.buttonMakeDoor = new System.Windows.Forms.ToolStripButton();
this.buttonMakeDoor = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.separatorsectors2 = new System.Windows.Forms.ToolStripSeparator();
this.buttonbrightnessgradient = new System.Windows.Forms.ToolStripButton();
this.buttonfloorgradient = new System.Windows.Forms.ToolStripButton();
this.buttonceilinggradient = new System.Windows.Forms.ToolStripButton();
this.buttonflipselectionh = new System.Windows.Forms.ToolStripButton();
this.buttonflipselectionv = new System.Windows.Forms.ToolStripButton();
this.buttoncurvelinedefs = new System.Windows.Forms.ToolStripButton();
this.buttonbrightnessgradient = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttonfloorgradient = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttonceilinggradient = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttonflipselectionh = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttonflipselectionv = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttoncurvelinedefs = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.gradientModeMenu = new System.Windows.Forms.ToolStripComboBox();
this.gradientInterpolationMenu = new System.Windows.Forms.ToolStripComboBox();
this.separatorsectors3 = new System.Windows.Forms.ToolStripSeparator();
this.buttonMarqueSelectTouching = new System.Windows.Forms.ToolStripButton();
this.syncthingteditbutton = new System.Windows.Forms.ToolStripButton();
this.buttonAlignThingsToWall = new System.Windows.Forms.ToolStripButton();
this.syncthingteditbutton = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttonAlignThingsToWall = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.buttonTextureOffsetLock = new System.Windows.Forms.ToolStripButton();
this.buttonTextureOffset3DFloorLock = new System.Windows.Forms.ToolStripButton();
this.buttonlightradii = new System.Windows.Forms.ToolStripButton();
@ -993,25 +993,25 @@ namespace CodeImp.DoomBuilder.BuilderModes
private System.Windows.Forms.ToolStripMenuItem splitlinedefsitem;
private System.Windows.Forms.ToolStrip globalstrip;
private System.Windows.Forms.ToolStrip manualstrip;
private System.Windows.Forms.ToolStripButton buttonbrightnessgradient;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttonbrightnessgradient;
private System.Windows.Forms.ToolStripMenuItem selectsinglesideditem;
private System.Windows.Forms.ToolStripMenuItem selectdoublesideditem;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem4;
private System.Windows.Forms.ToolStripButton buttonflipselectionh;
private System.Windows.Forms.ToolStripButton buttonflipselectionv;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttonflipselectionh;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttonflipselectionv;
private System.Windows.Forms.ToolStripButton buttonselectionnumbers;
private System.Windows.Forms.ToolStripSeparator separatorsectors1;
private System.Windows.Forms.ToolStripButton buttonfloorgradient;
private System.Windows.Forms.ToolStripButton buttonceilinggradient;
private System.Windows.Forms.ToolStripButton buttoncurvelinedefs;
private System.Windows.Forms.ToolStripButton buttoncopyproperties;
private System.Windows.Forms.ToolStripButton buttonpasteproperties;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttonfloorgradient;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttonceilinggradient;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttoncurvelinedefs;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttoncopyproperties;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttonpasteproperties;
private System.Windows.Forms.ToolStripSeparator seperatorcopypaste;
private System.Windows.Forms.ToolStripComboBox gradientModeMenu;
private System.Windows.Forms.ToolStripButton buttonMarqueSelectTouching;
private System.Windows.Forms.ToolStripMenuItem thingsmenu;
private System.Windows.Forms.ToolStripMenuItem alignToWallItem;
private System.Windows.Forms.ToolStripButton buttonAlignThingsToWall;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttonAlignThingsToWall;
private System.Windows.Forms.ToolStripMenuItem pointAtCursorItem;
private System.Windows.Forms.ToolStripButton buttonTextureOffsetLock;
private System.Windows.Forms.ToolStripMenuItem selectInSectorsItem;
@ -1030,13 +1030,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
private System.Windows.Forms.ToolStripMenuItem syncthingeditlinedefsitem;
private System.Windows.Forms.ToolStripMenuItem syncthingeditsectorsitem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
private System.Windows.Forms.ToolStripButton buttonMakeDoor;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttonMakeDoor;
private System.Windows.Forms.ToolStripMenuItem makedooritem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
private System.Windows.Forms.MenuStrip fileMenuStrip;
private System.Windows.Forms.ToolStripMenuItem exportStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem5;
private System.Windows.Forms.ToolStripButton buttonpastepropertiesoptions;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton buttonpastepropertiesoptions;
private System.Windows.Forms.ToolStripMenuItem filterSelectionItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
private System.Windows.Forms.ToolStripMenuItem selectSimilarLinesItem;
@ -1047,7 +1047,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
private System.Windows.Forms.ToolStripMenuItem selectSimilarVertsItem;
private System.Windows.Forms.ToolStripMenuItem flipsectorlinedefsitem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator8;
private System.Windows.Forms.ToolStripButton syncthingteditbutton;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton syncthingteditbutton;
private System.Windows.Forms.ToolStripComboBox gradientInterpolationMenu;
private System.Windows.Forms.ToolStripSeparator separatorsectors2;
private System.Windows.Forms.ToolStripSeparator separatorsectors3;

View file

@ -18,6 +18,7 @@
using System;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Controls;
using CodeImp.DoomBuilder.Editing;
using CodeImp.DoomBuilder.Windows;
@ -70,26 +71,26 @@ namespace CodeImp.DoomBuilder.BuilderModes
public ToolStripSeparator SeparatorSectors1 { get { return separatorsectors1; } }
public ToolStripSeparator SeparatorSectors2 { get { return separatorsectors2; } } //mxd
public ToolStripSeparator SeparatorSectors3 { get { return separatorsectors3; } } //mxd
public ToolStripButton MakeGradientBrightness { get { return buttonbrightnessgradient; } }
public ToolStripButton MakeGradientFloors { get { return buttonfloorgradient; } }
public ToolStripButton MakeGradientCeilings { get { return buttonceilinggradient; } }
public ToolStripButton FlipSelectionV { get { return buttonflipselectionv; } }
public ToolStripButton FlipSelectionH { get { return buttonflipselectionh; } }
public ToolStripButton CurveLinedefs { get { return buttoncurvelinedefs; } }
public ToolStripButton CopyProperties { get { return buttoncopyproperties; } }
public ToolStripButton PasteProperties { get { return buttonpasteproperties; } }
public ToolStripButton PastePropertiesOptions { get { return buttonpastepropertiesoptions; } } //mxd
public ToolStripActionButton MakeGradientBrightness { get { return buttonbrightnessgradient; } }
public ToolStripActionButton MakeGradientFloors { get { return buttonfloorgradient; } }
public ToolStripActionButton MakeGradientCeilings { get { return buttonceilinggradient; } }
public ToolStripActionButton FlipSelectionV { get { return buttonflipselectionv; } }
public ToolStripActionButton FlipSelectionH { get { return buttonflipselectionh; } }
public ToolStripActionButton CurveLinedefs { get { return buttoncurvelinedefs; } }
public ToolStripActionButton CopyProperties { get { return buttoncopyproperties; } }
public ToolStripActionButton PasteProperties { get { return buttonpasteproperties; } }
public ToolStripActionButton PastePropertiesOptions { get { return buttonpastepropertiesoptions; } } //mxd
public ToolStripSeparator SeparatorCopyPaste { get { return seperatorcopypaste; } }
public ToolStripComboBox GradientModeMenu { get { return gradientModeMenu; } } //mxd
public ToolStripComboBox GradientInterpolationMenu { get { return gradientInterpolationMenu; } } //mxd
public ToolStripButton MarqueSelectTouching { get { return buttonMarqueSelectTouching; } } //mxd
public ToolStripButton AlignThingsToWall { get { return buttonAlignThingsToWall; } } //mxd
public ToolStripActionButton AlignThingsToWall { get { return buttonAlignThingsToWall; } } //mxd
public ToolStripButton TextureOffsetLock { get { return buttonTextureOffsetLock; } } //mxd
public ToolStripButton TextureOffset3DFloorLock { get { return buttonTextureOffset3DFloorLock; } }
public ToolStripButton SyncronizeThingEditButton { get { return syncthingteditbutton; } } //mxd
public ToolStripActionButton SyncronizeThingEditButton { get { return syncthingteditbutton; } } //mxd
public ToolStripMenuItem SyncronizeThingEditSectorsItem { get { return syncthingeditsectorsitem; } } //mxd
public ToolStripMenuItem SyncronizeThingEditLinedefsItem { get { return syncthingeditlinedefsitem; } } //mxd
public ToolStripButton MakeDoor { get { return buttonMakeDoor; } } //mxd
public ToolStripActionButton MakeDoor { get { return buttonMakeDoor; } } //mxd
//mxd. Thing mode radii buttons
public ToolStripMenuItem ItemLightRadii { get { return itemlightradii; } }

View file

@ -26,7 +26,7 @@
/// </summary>
private void InitializeComponent() {
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.cpButton = new System.Windows.Forms.ToolStripButton();
this.cpButton = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.modesmenu = new System.Windows.Forms.ToolStripMenuItem();
this.cpMenu = new System.Windows.Forms.ToolStripMenuItem();
@ -104,7 +104,7 @@
#endregion
private System.Windows.Forms.ToolStrip toolStrip1;
private System.Windows.Forms.ToolStripButton cpButton;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton cpButton;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem modesmenu;
private System.Windows.Forms.ToolStripMenuItem cpMenu;

View file

@ -29,7 +29,7 @@
private void InitializeComponent()
{
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.colorconfiguration = new System.Windows.Forms.ToolStripButton();
this.colorconfiguration = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.toolStrip1.SuspendLayout();
this.SuspendLayout();
//
@ -72,6 +72,6 @@
#endregion
private System.Windows.Forms.ToolStrip toolStrip1;
private System.Windows.Forms.ToolStripButton colorconfiguration;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton colorconfiguration;
}
}

View file

@ -30,7 +30,7 @@ namespace CodeImp.DoomBuilder.TagRange
{
this.toolstrip = new System.Windows.Forms.ToolStrip();
this.seperator1 = new System.Windows.Forms.ToolStripSeparator();
this.tagrangebutton = new System.Windows.Forms.ToolStripButton();
this.tagrangebutton = new CodeImp.DoomBuilder.Controls.ToolStripActionButton();
this.seperator2 = new System.Windows.Forms.ToolStripSeparator();
this.toolstrip.SuspendLayout();
this.SuspendLayout();
@ -91,7 +91,7 @@ namespace CodeImp.DoomBuilder.TagRange
#endregion
private System.Windows.Forms.ToolStrip toolstrip;
private System.Windows.Forms.ToolStripButton tagrangebutton;
private CodeImp.DoomBuilder.Controls.ToolStripActionButton tagrangebutton;
private System.Windows.Forms.ToolStripSeparator seperator2;
private System.Windows.Forms.ToolStripSeparator seperator1;
}