示例#1
0
 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);
 }
示例#2
0
		public ContentDocument(EditorContentPanel control, string name, 
            IEditorComponent owner, string iconKey,
            Dictionary<string, object> propertyGridObjectList)
			: this(control, name, owner, iconKey)
		{
			_propertyGridObjectList = propertyGridObjectList;
		}
示例#3
0
 public ContentDocument(EditorContentPanel control, string name, IEditorComponent owner)
 {
     _control = control;
     _name = name;
     _owner = owner;
     _toolbarCommands = null;
 }
示例#4
0
        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);
            }
        }
示例#5
0
 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);
     }
 }
示例#6
0
        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;
        }
示例#7
0
        private string RegisterMenuCommand(string id, IEditorComponent component)
        {
            id = GetMenuCommandID(id, component);

            if (!_menuItems.ContainsKey(id))
            {
                _menuItems.Add(id, component);
            }

            return id;
        }
示例#8
0
 public void SetMenuItemEnabled(IEditorComponent plugin, string id, bool enabled)
 {
     string commandID = GetMenuCommandID(id, plugin);
     _menuManager.SetMenuItemEnabled(commandID, enabled);
 }
示例#9
0
 //Kept for plugins
 public ContentDocument(EditorContentPanel control, string name,
     IEditorComponent owner) : this(control, name, owner, (string)null)
 { }
示例#10
0
        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;
        }
示例#11
0
 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);
     }
 }
示例#12
0
 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;
     }
 }
示例#13
0
 public void RemoveAllChildNodes(IEditorComponent plugin, string parentID)
 {
     TreeNode[] results = _projectTree.Nodes.Find(parentID, true);
     if (results.Length > 0)
     {
         results[0].Nodes.Clear();
     }
 }
示例#14
0
        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;
        }
示例#15
0
 private string GetMenuCommandID(string id, IEditorComponent component)
 {
     if (!id.Contains(CONTROL_ID_SPLIT))
     {
         id = component.ComponentID + CONTROL_ID_SPLIT + id;
     }
     return id;
 }
示例#16
0
 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;
 }
示例#18
0
 //Kept for plugins
 public ContentDocument(EditorContentPanel control, string name,
     IEditorComponent owner, Dictionary<string, object> propertyGridObjectList)
     : this(control, name, owner, null, propertyGridObjectList)
 { }
示例#19
0
 public void BeginLabelEdit(IEditorComponent plugin, string nodeID)
 {
     SelectNode(plugin, nodeID);
     TreeNode[] results = _projectTree.Nodes.Find(nodeID, true);
     if (results.Length > 0)
     {
         results[0].BeginEdit();
     }
 }
示例#20
0
 public void AddMenu(IEditorComponent plugin, string id, string title)
 {
     _menuManager.AddMenu(id, title);
 }
示例#21
0
 public void ExpandNode(IEditorComponent plugin, string id)
 {
     TreeNode[] results = _projectTree.Nodes.Find(id, true);
     if (results.Length > 0)
     {
         results[0].Expand();
     }
 }
示例#22
0
 public void AddMenu(IEditorComponent plugin, string id, string title, string insertAfterMenu)
 {
     _menuManager.AddMenu(id, title, insertAfterMenu);
 }
示例#23
0
 public void SelectNode(IEditorComponent plugin, string id)
 {
     TreeNode[] results = _projectTree.Nodes.Find(id, true);
     if (results.Length > 0)
     {
         _projectTree.SelectedNode = results[0];
     }
 }
示例#24
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);
     }
 }
示例#25
0
 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 + "')");
                 }
             }
         }
     }
 }
示例#26
0
 public MenuCommand CreateMenuCommand(IEditorComponent component, string commandID, string commandName)
 {
     MenuCommand newCommand = new MenuCommand(commandID, commandName);
     newCommand.ID = RegisterMenuCommand(commandID, component);
     return newCommand;
 }
示例#27
0
 public IProjectTreeItem AddTreeLeaf(IEditorComponent plugin, string id, string name, string iconKey)
 {
     return AddTreeLeaf(plugin, id, name, iconKey, false);
 }
示例#28
0
 public void RePopulateTreeView(IEditorComponent component, string selectedNode)
 {
     IRePopulatableComponent repopulatableComponent = component as IRePopulatableComponent;
     if (repopulatableComponent != null)
     {
         if (selectedNode == null)
         {
             repopulatableComponent.RePopulateTreeView();
         }
         else
         {
             repopulatableComponent.RePopulateTreeView(selectedNode);
         }
     }
 }
示例#29
0
 void IAGSEditor.AddComponent(IEditorComponent component)
 {
     _componentController.AddComponent(component);
 }
示例#30
0
 public void RePopulateTreeView(IEditorComponent component)
 {
     RePopulateTreeView(component, null);
 }