public void AddGlobalItem(IEditorComponent component, MenuCommand command) { ToolStripButton button = new ToolStripButton(string.Empty, Factory.GUIController.ImageList.Images[command.IconKey], new EventHandler(ToolbarEventHandler), command.ID); button.Tag = component; button.ToolTipText = command.Name; _toolBar.Items.Add(button); }
public ContentDocument(EditorContentPanel control, string name, IEditorComponent owner, string iconKey, Dictionary<string, object> propertyGridObjectList) : this(control, name, owner, iconKey) { _propertyGridObjectList = propertyGridObjectList; }
public ContentDocument(EditorContentPanel control, string name, IEditorComponent owner) { _control = control; _name = name; _owner = owner; _toolbarCommands = null; }
public void AddGlobalItems(IEditorComponent component, List<MenuCommand> commands) { if (_toolBar.Items.Count > 0) { _toolBar.Items.Add(new ToolStripSeparator()); } foreach (MenuCommand command in commands) { AddGlobalItem(component, command); } }
private void RegisterTreeNode(string id, IEditorComponent plugin) { if (_treeNodes.ContainsKey(id)) { if (_treeNodes[id] != plugin) { throw new AGSEditorException("Tree node " + id + " is already registered to another component!"); } } else { _treeNodes.Add(id, plugin); } }
public ProjectTreeItem AddTreeBranch(IEditorComponent component, string id, string name, string iconKey) { RegisterTreeNode(id, component); iconKey = SetDefaultIconIfNoneProvided(iconKey); if (_lastAddedNode != null) { _lastAddedNode = _lastAddedNode.Nodes.Add(id, name, iconKey, iconKey); } else { _lastAddedNode = this._projectTree.Nodes.Add(id, name, iconKey, iconKey); } ProjectTreeItem newItem = new ProjectTreeItem(id, _lastAddedNode); _lastAddedNode.Tag = newItem; return newItem; }
private string RegisterMenuCommand(string id, IEditorComponent component) { id = GetMenuCommandID(id, component); if (!_menuItems.ContainsKey(id)) { _menuItems.Add(id, component); } return id; }
public void SetMenuItemEnabled(IEditorComponent plugin, string id, bool enabled) { string commandID = GetMenuCommandID(id, plugin); _menuManager.SetMenuItemEnabled(commandID, enabled); }
//Kept for plugins public ContentDocument(EditorContentPanel control, string name, IEditorComponent owner) : this(control, name, owner, (string)null) { }
public IProjectTreeItem AddTreeLeaf(IEditorComponent component, string id, string name, string iconKey, bool greyedOut) { RegisterTreeNode(id, component); TreeNode newNode; iconKey = SetDefaultIconIfNoneProvided(iconKey); if (_lastAddedNode != null) { newNode = _lastAddedNode.Nodes.Add(id, name, iconKey, iconKey); } else { newNode = this._projectTree.Nodes.Add(id, name, iconKey, iconKey); } if (greyedOut) { newNode.ForeColor = Color.Gray; } ProjectTreeItem newItem = new ProjectTreeItem(id, newNode); newNode.Tag = newItem; return newItem; }
public void StartFromNode(IEditorComponent plugin, string id) { TreeNode[] results = _projectTree.Nodes.Find(id, true); if (results.Length > 0) { _lastAddedNode = results[0]; } else { throw new AGSEditorException("Unable to select node " + id); } }
public void ChangeNodeIcon(IEditorComponent plugin, string id, string newIconKey) { TreeNode[] results = _projectTree.Nodes.Find(id, true); if (results.Length > 0) { results[0].ImageKey = newIconKey; results[0].SelectedImageKey = newIconKey; } }
public void RemoveAllChildNodes(IEditorComponent plugin, string parentID) { TreeNode[] results = _projectTree.Nodes.Find(parentID, true); if (results.Length > 0) { results[0].Nodes.Clear(); } }
public void AddTreeRoot(IEditorComponent plugin, string id, string name, string iconKey) { RegisterTreeNode(id, plugin); iconKey = SetDefaultIconIfNoneProvided(iconKey); _lastAddedNode = this._projectTree.Nodes.Add(id, name, iconKey, iconKey); ProjectTreeItem newItem = new ProjectTreeItem(id, _lastAddedNode); newItem.AllowLabelEdit = false; _lastAddedNode.Tag = newItem; }
private string GetMenuCommandID(string id, IEditorComponent component) { if (!id.Contains(CONTROL_ID_SPLIT)) { id = component.ComponentID + CONTROL_ID_SPLIT + id; } return id; }
internal void RegisterContextMenuCommands(IList<MenuCommand> commands, IEditorComponent plugin) { foreach (MenuCommand command in commands) { if (command.ID != null) { command.ID = RegisterMenuCommand(command.ID, plugin); } } }
public BeforeShowContextMenuEventArgs(string nodeId, IEditorComponent component, MenuCommands menuCommands) { _component = component; _menuCommands = menuCommands; _nodeId = nodeId; }
//Kept for plugins public ContentDocument(EditorContentPanel control, string name, IEditorComponent owner, Dictionary<string, object> propertyGridObjectList) : this(control, name, owner, null, propertyGridObjectList) { }
public void BeginLabelEdit(IEditorComponent plugin, string nodeID) { SelectNode(plugin, nodeID); TreeNode[] results = _projectTree.Nodes.Find(nodeID, true); if (results.Length > 0) { results[0].BeginEdit(); } }
public void AddMenu(IEditorComponent plugin, string id, string title) { _menuManager.AddMenu(id, title); }
public void ExpandNode(IEditorComponent plugin, string id) { TreeNode[] results = _projectTree.Nodes.Find(id, true); if (results.Length > 0) { results[0].Expand(); } }
public void AddMenu(IEditorComponent plugin, string id, string title, string insertAfterMenu) { _menuManager.AddMenu(id, title, insertAfterMenu); }
public void SelectNode(IEditorComponent plugin, string id) { TreeNode[] results = _projectTree.Nodes.Find(id, true); if (results.Length > 0) { _projectTree.SelectedNode = results[0]; } }
public void AddMenuItems(IEditorComponent plugin, MenuCommands commands) { if (commands.Commands.Count > 0) { foreach (MenuCommand command in commands.Commands) { if (command.ID != null) { RegisterMenuCommand(command.ID, plugin); } command.IDPrefix = plugin.ComponentID + CONTROL_ID_SPLIT; } _menuManager.AddMenuCommandGroup(commands); } }
private void AllowPluginsToModifyContextMenu(string nodeID, IList<MenuCommand> commands, IEditorComponent component) { if (BeforeShowContextMenu != null) { MenuCommands menuCommands = new MenuCommands(commands); BeforeShowContextMenu(new BeforeShowContextMenuEventArgs(nodeID, component, menuCommands)); foreach (MenuCommand command in commands) { if (!command.IsSeparator) { if (!Factory.GUIController.CanFindComponentFromMenuItemID(command.ID)) { throw new AGSEditorException("A plugin or event handler has not used GUIController.CreateMenuCommand to create its menu command (ID '" + command.ID + "')"); } } } } }
public MenuCommand CreateMenuCommand(IEditorComponent component, string commandID, string commandName) { MenuCommand newCommand = new MenuCommand(commandID, commandName); newCommand.ID = RegisterMenuCommand(commandID, component); return newCommand; }
public IProjectTreeItem AddTreeLeaf(IEditorComponent plugin, string id, string name, string iconKey) { return AddTreeLeaf(plugin, id, name, iconKey, false); }
public void RePopulateTreeView(IEditorComponent component, string selectedNode) { IRePopulatableComponent repopulatableComponent = component as IRePopulatableComponent; if (repopulatableComponent != null) { if (selectedNode == null) { repopulatableComponent.RePopulateTreeView(); } else { repopulatableComponent.RePopulateTreeView(selectedNode); } } }
void IAGSEditor.AddComponent(IEditorComponent component) { _componentController.AddComponent(component); }
public void RePopulateTreeView(IEditorComponent component) { RePopulateTreeView(component, null); }