Ejemplo n.º 1
0
        private void OnViewButtonClicked()
        {
            var menu = new ContextMenu();

            var infoLogButton = menu.AddButton("Info");

            infoLogButton.AutoCheck = true;
            infoLogButton.Checked   = (_logTypeShowMask & (int)LogType.Info) != 0;
            infoLogButton.Clicked  += () => ToggleLogTypeShow(LogType.Info);

            var warningLogButton = menu.AddButton("Warning");

            warningLogButton.AutoCheck = true;
            warningLogButton.Checked   = (_logTypeShowMask & (int)LogType.Warning) != 0;
            warningLogButton.Clicked  += () => ToggleLogTypeShow(LogType.Warning);

            var errorLogButton = menu.AddButton("Error");

            errorLogButton.AutoCheck = true;
            errorLogButton.Checked   = (_logTypeShowMask & (int)LogType.Error) != 0;
            errorLogButton.Clicked  += () => ToggleLogTypeShow(LogType.Error);

            menu.AddSeparator();

            menu.AddButton("Load log file...", LoadLogFile);

            menu.Show(_viewDropdown.Parent, _viewDropdown.BottomLeft);
        }
 protected override void OnTreeNodeRightClick(ContextMenu menu)
 {
     menu.AddSeparator();
     menu.AddButton("Remove breakpoint", button =>
     {
         var node                = (SurfaceNode)button.ParentContextMenu.Tag;
         node.Breakpoint.Set     = !node.Breakpoint.Set;
         node.Breakpoint.Enabled = true;
         node.Surface.OnNodeBreakpointEdited(node);
     }).Icon = Editor.Instance.Icons.Cross12;
     menu.AddButton("Toggle breakpoint", button =>
     {
         var node = (SurfaceNode)button.ParentContextMenu.Tag;
         node.Breakpoint.Enabled = !node.Breakpoint.Enabled;
         node.Surface.OnNodeBreakpointEdited(node);
     });
     menu.AddSeparator();
     menu.AddButton("Delete all breakpoints", () =>
     {
         foreach (var child in _rootNode.Children.ToArray())
         {
             if (child is TreeNode n && n.Tag is SurfaceNode node)
             {
                 node.Breakpoint.Set = false;
                 node.Surface.OnNodeBreakpointEdited(node);
             }
         }
Ejemplo n.º 3
0
            private void OnSetupContextMenu(PropertyNameLabel label, ContextMenu menu, CustomEditor linkedEditor)
            {
                menu.AddSeparator();

                menu.AddButton("Remove", OnRemoveClicked).Enabled = !_editor._readOnly;
                menu.AddButton("Edit", OnEditClicked).Enabled     = _editor._canEditKeys;
            }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DebugLogWindow"/> class.
        /// </summary>
        /// <param name="editor">The editor.</param>
        public OutputLogWindow(Editor editor)
            : base(editor, true, ScrollBars.None)
        {
            Title        = "Output Log";
            ClipChildren = false;

            // Setup UI
            _viewDropdown = new Button(2, 2, 40.0f, TextBoxBase.DefaultHeight)
            {
                TooltipText = "Change output log view options",
                Text        = "View",
                Parent      = this,
            };
            _viewDropdown.Clicked += OnViewButtonClicked;
            _searchBox             = new TextBox(false, _viewDropdown.Right + 2, 2, Width - _viewDropdown.Right - 2 - ScrollBar.DefaultSize)
            {
                WatermarkText = "Search...",
                Parent        = this,
            };
            _searchBox.TextChanged += OnSearchBoxTextChanged;
            _hScroll = new HScrollBar(Height - ScrollBar.DefaultSize, Width)
            {
                AnchorStyle = AnchorStyle.Bottom,
                Maximum     = 0,
                Parent      = this,
            };
            _hScroll.ValueChanged += OnHScrollValueChanged;
            _vScroll = new VScrollBar(Width - ScrollBar.DefaultSize, Height)
            {
                AnchorStyle = AnchorStyle.Right,
                Maximum     = 0,
                Parent      = this,
            };
            _vScroll.ValueChanged += OnVScrollValueChanged;
            _output = new OutputTextBox
            {
                Window      = this,
                IsReadOnly  = true,
                IsMultiline = true,
                BackgroundSelectedFlashSpeed = 0.0f,
                Location = new Vector2(2, _viewDropdown.Bottom + 2),
                Parent   = this,
            };
            _output.TargetViewOffsetChanged += OnOutputTargetViewOffsetChanged;
            _output.TextChanged             += OnOutputTextChanged;

            // Setup context menu
            _contextMenu = new ContextMenu();
            _contextMenu.AddButton("Clear log", Clear);
            _contextMenu.AddButton("Copy selection", _output.Copy);
            _contextMenu.AddButton("Select All", _output.SelectAll);
            _contextMenu.AddButton("Scroll to bottom", () => { _vScroll.TargetValue = _vScroll.Maximum; });

            // Setup editor options
            Editor.Options.OptionsChanged += OnEditorOptionsChanged;
            OnEditorOptionsChanged(Editor.Options.Options);

            GameCooker.Event += OnGameCookerEvent;
        }
Ejemplo n.º 5
0
        private ContextMenu OnViewDropdownPopupCreate(ComboBox comboBox)
        {
            var menu = new ContextMenu();

            var showFileExtensionsButton = menu.AddButton("Show file extensions", () => View.ShowFileExtensions = !View.ShowFileExtensions);

            showFileExtensionsButton.Checked   = View.ShowFileExtensions;
            showFileExtensionsButton.AutoCheck = true;

            var viewScale  = menu.AddButton("View Scale");
            var scaleValue = new FloatValueBox(1, 75, 2, 50.0f, 0.3f, 3.0f, 0.01f);

            scaleValue.Parent        = viewScale;
            scaleValue.ValueChanged += () => View.ViewScale = scaleValue.Value;
            menu.VisibleChanged     += control => { scaleValue.Value = View.ViewScale; };

            var viewType = menu.AddChildMenu("View Type");

            viewType.ContextMenu.AddButton("Tiles", OnViewTypeButtonClicked).Tag = ContentViewType.Tiles;
            viewType.ContextMenu.AddButton("List", OnViewTypeButtonClicked).Tag  = ContentViewType.List;
            viewType.ContextMenu.VisibleChanged += control =>
            {
                if (!control.Visible)
                {
                    return;
                }
                foreach (var item in ((ContextMenu)control).Items)
                {
                    if (item is ContextMenuButton button)
                    {
                        button.Checked = View.ViewType == (ContentViewType)button.Tag;
                    }
                }
            };

            var filters = menu.AddChildMenu("Filters");

            for (int i = 0; i < _viewDropdown.Items.Count; i++)
            {
                var filterButton = filters.ContextMenu.AddButton(_viewDropdown.Items[i], OnFilterClicked);
                filterButton.Tag = i;
            }
            filters.ContextMenu.VisibleChanged += control =>
            {
                if (!control.Visible)
                {
                    return;
                }
                foreach (var item in ((ContextMenu)control).Items)
                {
                    if (item is ContextMenuButton filterButton)
                    {
                        filterButton.Checked = _viewDropdown.IsSelected(filterButton.Text);
                    }
                }
            };

            return(menu);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DebugLogWindow"/> class.
        /// </summary>
        /// <param name="editor">The editor.</param>
        public OutputLogWindow(Editor editor)
            : base(editor, true, ScrollBars.None)
        {
            Title        = "Output Log";
            ClipChildren = false;

            // Setup UI
            _viewDropdown = new Button(2, 2, 40.0f, TextBoxBase.DefaultHeight)
            {
                TooltipText = "Change output log view options",
                Text        = "View",
                Parent      = this,
            };
            _viewDropdown.Clicked += OnViewButtonClicked;
            _searchBox             = new TextBox(false, _viewDropdown.Right + 2, 2, Width - _viewDropdown.Right - 2 - _scrollSize)
            {
                WatermarkText = "Search...",
                Parent        = this,
            };
            _searchBox.TextChanged += Refresh;
            _hScroll = new HScrollBar(this, Height - _scrollSize, Width - _scrollSize, _scrollSize)
            {
                ThumbThickness = 10,
                Maximum        = 0,
            };
            _hScroll.ValueChanged += OnHScrollValueChanged;
            _vScroll = new VScrollBar(this, Width - _scrollSize, Height, _scrollSize)
            {
                ThumbThickness = 10,
                Maximum        = 0,
            };
            _vScroll.ValueChanged += OnVScrollValueChanged;
            _output = new OutputTextBox
            {
                Window      = this,
                IsReadOnly  = true,
                IsMultiline = true,
                BackgroundSelectedFlashSpeed = 0.0f,
                Location = new Float2(2, _viewDropdown.Bottom + 2),
                Parent   = this,
            };
            _output.TargetViewOffsetChanged += OnOutputTargetViewOffsetChanged;
            _output.TextChanged             += OnOutputTextChanged;

            // Setup context menu
            _contextMenu = new ContextMenu();
            _contextMenu.AddButton("Clear log", Clear);
            _contextMenu.AddButton("Copy selection", _output.Copy);
            _contextMenu.AddButton("Select All", _output.SelectAll);
            _contextMenu.AddButton("Show in explorer", () => FileSystem.ShowFileExplorer(Path.Combine(Globals.ProjectFolder, "Logs")));
            _contextMenu.AddButton("Scroll to bottom", () => { _vScroll.TargetValue = _vScroll.Maximum; }).Icon = Editor.Icons.ArrowDown12;

            // Setup editor options
            Editor.Options.OptionsChanged += OnEditorOptionsChanged;
            OnEditorOptionsChanged(Editor.Options.Options);

            GameCooker.Event += OnGameCookerEvent;
            ScriptsBuilder.CompilationFailed += OnScriptsCompilationFailed;
        }
Ejemplo n.º 7
0
            /// <summary>
            /// Shows the parameter context menu.
            /// </summary>
            /// <param name="index">The index.</param>
            /// <param name="label">The label control.</param>
            /// <param name="targetLocation">The target location.</param>
            private void ShowParameterMenu(int index, Control label, ref Vector2 targetLocation)
            {
                var contextMenu = new ContextMenu();

                contextMenu.AddButton("Rename", () => StartParameterRenaming(index, label));
                contextMenu.AddButton("Delete", () => DeleteParameter(index));
                contextMenu.Show(label, targetLocation);
            }
Ejemplo n.º 8
0
            private void OnPropertyLabelSetupContextMenu(PropertyNameLabel label, ContextMenu menu, CustomEditor linkedEditor)
            {
                var name = (string)label.Tag;

                menu.AddSeparator();
                menu.AddButton("Rename", () => StartParameterRenaming(name, label));
                menu.AddButton("Delete", () => DeleteParameter(name));
            }
Ejemplo n.º 9
0
 private void OnTreeRightClick(TreeNode node, Vector2 location)
 {
     var menu = new ContextMenu();
     menu.AddButton("Rename", OnRenameClicked);
     menu.AddButton("Don't import", OnDontImportClicked);
     menu.AddButton("Show in Explorer", OnShowInExplorerClicked);
     menu.Tag = node;
     menu.Show(node, location);
 }
Ejemplo n.º 10
0
        private void OnDiffNodeRightClick(TreeNode node, Vector2 location)
        {
            var diffMenu = (PrefabDiffContextMenu)node.ParentTree.Tag;

            var menu = new ContextMenu();

            menu.AddButton("Revert", () => OnDiffRevert((CustomEditor)node.Tag));
            menu.AddSeparator();
            menu.AddButton("Revert All", OnDiffRevertAll);
            menu.AddButton("Apply All", OnDiffApplyAll);

            diffMenu.ShowChild(menu, node.PointToParent(diffMenu, new Vector2(location.X, node.HeaderHeight)));
        }
Ejemplo n.º 11
0
            private void OnOptionsButtonClicked(Image image, MouseButton button)
            {
                if (button != MouseButton.Left)
                {
                    return;
                }

                var cm = new ContextMenu();

                cm.AddButton("Copy typename", () => Clipboard.Text = ((VisualScriptWindow)Values[0]).Asset.ScriptTypeName);
                cm.AddButton("Edit attributes...", OnEditAttributes);
                cm.Show(image, new Vector2(0, image.Height));
            }
Ejemplo n.º 12
0
            private void OnSetupContextMenu(PropertyNameLabel label, ContextMenu menu, CustomEditor linkedEditor)
            {
                menu.AddSeparator();

                var moveUpButton = menu.AddButton("Move up", OnMoveUpClicked);

                moveUpButton.Enabled = Index > 0;

                var moveDownButton = menu.AddButton("Move down", OnMoveDownClicked);

                moveDownButton.Enabled = Index + 1 < Editor.Count;

                menu.AddButton("Remove", OnRemoveClicked);
            }
Ejemplo n.º 13
0
        /// <inheritdoc />
        public override bool OnMouseUp(Vector2 location, MouseButton button)
        {
            if (base.OnMouseUp(location, button))
            {
                return(true);
            }

            if (_mouseDown && button == MouseButton.Right)
            {
                _mouseDown = false;

                // Skip if is not extended
                var linkedEditor = LinkedEditor;
                if (linkedEditor == null && SetupContextMenu == null)
                {
                    return(false);
                }

                var menu = new ContextMenu();

                if (linkedEditor != null)
                {
                    var features = linkedEditor.Presenter.Features;
                    if ((features & (FeatureFlags.UseDefault | FeatureFlags.UsePrefab)) != 0)
                    {
                        if ((features & FeatureFlags.UsePrefab) != 0)
                        {
                            menu.AddButton("Revert to Prefab", linkedEditor.RevertToReferenceValue).Enabled = linkedEditor.CanRevertReferenceValue;
                        }
                        if ((features & FeatureFlags.UseDefault) != 0)
                        {
                            menu.AddButton("Reset to default", linkedEditor.RevertToDefaultValue).Enabled = linkedEditor.CanRevertDefaultValue;
                        }
                        menu.AddSeparator();
                    }
                    menu.AddButton("Copy", linkedEditor.Copy);
                    var paste = menu.AddButton("Paste", linkedEditor.Paste);
                    paste.Enabled = linkedEditor.CanPaste;
                }

                SetupContextMenu?.Invoke(this, menu, linkedEditor);

                menu.Show(this, location);

                return(true);
            }

            return(false);
        }
Ejemplo n.º 14
0
        private void AddScriptButtonOnClicked(Button button)
        {
            var scripts = Editor.Instance.CodeEditing.GetScripts();

            if (scripts.Count == 0)
            {
                // No scripts
                var cm1 = new ContextMenu();
                cm1.AddButton("No scripts in project");
                cm1.Show(this, button.BottomLeft);
                return;
            }

            // Show context menu with list of scripts to add
            var cm = new ItemsListContextMenu(180);

            for (int i = 0; i < scripts.Count; i++)
            {
                var script = scripts[i];
                cm.ItemsPanel.AddChild(new ItemsListContextMenu.Item(script.ScriptName, script));
            }

            cm.ItemClicked += script => AddScript((ScriptItem)script.Tag);
            cm.SortChildren();
            cm.Show(this, button.BottomLeft);
        }
Ejemplo n.º 15
0
        /// <inheritdoc />
        public override bool OnMouseUp(Vector2 location, MouseButton buttons)
        {
            if (base.OnMouseUp(location, buttons))
            {
                return(true);
            }

            if (_mouseDown && buttons == MouseButton.Right)
            {
                _mouseDown = false;

                if (LinkedEditor == null && SetupContextMenu == null)
                {
                    return(false);
                }

                var menu = new ContextMenu();
                if (LinkedEditor != null)
                {
                    var revertToPrefab = menu.AddButton("Revert to Prefab", LinkedEditor.RevertToReferenceValue);
                    revertToPrefab.Enabled = LinkedEditor.CanRevertReferenceValue;
                }
                SetupContextMenu?.Invoke(this, menu);
                menu.Show(this, location);

                return(true);
            }

            return(false);
        }
Ejemplo n.º 16
0
        private void OnRightClick()
        {
            var menu = new ContextMenu();

            menu.AddButton("Copy text").Clicked += OnCopyText;
            _customContextualOptions?.Invoke(menu);
            menu.Show(Label, Label.PointFromScreen(Input.MouseScreenPosition));
        }
Ejemplo n.º 17
0
        private void ShowContextMenuForItem(ContentItem item, ref Vector2 location, bool isTreeNode)
        {
            Assert.IsNull(_newElement);

            // Cache data
            bool          isValidElement = item != null;
            var           proxy          = Editor.ContentDatabase.GetProxy(item);
            ContentFolder folder         = null;
            bool          isFolder       = false;

            if (isValidElement)
            {
                isFolder = item.IsFolder;
                folder   = isFolder ? (ContentFolder)item : item.ParentFolder;
            }
            else
            {
                folder = CurrentViewFolder;
            }
            Assert.IsNotNull(folder);
            bool isRootFolder = CurrentViewFolder == _root.Folder;

            // Create context menu
            ContextMenuButton    b;
            ContextMenuChildMenu c;
            ContextMenu          cm = new ContextMenu
            {
                Tag = item
            };

            if (isTreeNode)
            {
                b         = cm.AddButton("Expand All", OnExpandAllClicked);
                b.Enabled = CurrentViewFolder.Node.ChildrenCount != 0;

                b         = cm.AddButton("Collapse All", OnCollapseAllClicked);
                b.Enabled = CurrentViewFolder.Node.ChildrenCount != 0;

                cm.AddSeparator();
            }

            if (item is ContentFolder contentFolder && contentFolder.Node is ProjectTreeNode)
            {
                cm.AddButton("Show in explorer", () => FileSystem.ShowFileExplorer(CurrentViewFolder.Path));
            }
Ejemplo n.º 18
0
        /// <inheritdoc />
        public override void OnContentWindowContextMenu(ContextMenu menu, ContentItem item)
        {
            base.OnContentWindowContextMenu(menu, item);

            if (item is BinaryAssetItem binaryAssetItem)
            {
                var button = menu.AddButton("Create Material Instance", CreateMaterialInstanceClicked);
                button.Tag = binaryAssetItem;
            }
        }
Ejemplo n.º 19
0
                /// <summary>
                /// Shows the parameter context menu.
                /// </summary>
                /// <param name="index">The index.</param>
                /// <param name="label">The label control.</param>
                /// <param name="targetLocation">The target location.</param>
                private void ShowParameterMenu(int index, Control label, ref Vector2 targetLocation)
                {
                    var contextMenu = new ContextMenu();

                    contextMenu.OnButtonClicked += (id, menu) =>
                    {
                        if (id == 1)
                        {
                            StartParameterRenaming(index, label);
                        }
                        else if (id == 2)
                        {
                            DeleteParameter(index);
                        }
                    };
                    contextMenu.AddButton(1, "Rename");
                    contextMenu.AddButton(2, "Delete");
                    contextMenu.Show(label, targetLocation);
                }
Ejemplo n.º 20
0
        private void OnGroupPanelMouseButtonRightClicked(DropPanel groupPanel, Vector2 location)
        {
            var linkedEditor = (CustomEditor)groupPanel.Tag;
            var menu         = new ContextMenu();

            var revertToPrefab = menu.AddButton("Revert to Prefab", linkedEditor.RevertToReferenceValue);

            revertToPrefab.Enabled = linkedEditor.CanRevertReferenceValue;
            var resetToDefault = menu.AddButton("Reset to default", linkedEditor.RevertToDefaultValue);

            resetToDefault.Enabled = linkedEditor.CanRevertDefaultValue;
            menu.AddSeparator();
            menu.AddButton("Copy", linkedEditor.Copy);
            var paste = menu.AddButton("Paste", linkedEditor.Paste);

            paste.Enabled = linkedEditor.CanPaste;

            menu.Show(groupPanel, location);
        }
Ejemplo n.º 21
0
            /// <inheritdoc />
            public override bool OnMouseUp(Float2 location, MouseButton button)
            {
                if (base.OnMouseUp(location, button))
                {
                    return(true);
                }

                if (_isRightMouseDown && button == MouseButton.Right)
                {
                    Focus();

                    var menu = new ContextMenu();
                    menu.AddButton("Copy", Copy);
                    menu.AddButton("Open", Open).Enabled = !string.IsNullOrEmpty(Desc.LocationFile) && File.Exists(Desc.LocationFile);
                    menu.Show(this, location);
                }

                return(false);
            }
Ejemplo n.º 22
0
        private void OnSettingsButtonClicked(Image image, MouseButton mouseButton)
        {
            if (mouseButton != MouseButton.Left)
            {
                return;
            }

            var cm         = new ContextMenu();
            var actor      = (Actor)Values[0];
            var scriptType = TypeUtils.GetType(actor.TypeName);
            var item       = scriptType.ContentItem;

            cm.AddButton("Copy ID", OnClickCopyId);
            cm.AddButton("Edit actor type", OnClickEditActorType).Enabled = item != null;
            var showButton = cm.AddButton("Show in content window", OnClickShowActorType);

            showButton.Enabled = item != null;
            showButton.Icon    = Editor.Instance.Icons.Search12;
            cm.Show(image, image.Size);
        }
Ejemplo n.º 23
0
        /// <inheritdoc />
        public override void OnContentWindowContextMenu(ContextMenu menu, ContentItem item)
        {
            base.OnContentWindowContextMenu(menu, item);

            menu.AddButton("Generate collision data", () =>
            {
                var model   = FlaxEngine.Content.LoadAsync <Model>(((ModelAssetItem)item).ID);
                var cdProxy = (CollisionDataProxy)Editor.Instance.ContentDatabase.GetProxy <CollisionData>();
                cdProxy.CreateCollisionDataFromModel(model);
            });
        }
Ejemplo n.º 24
0
                private void OnGroupPanelMouseButtonRightClicked(DropPanel groupPanel, Vector2 location)
                {
                    var menu = new ContextMenu();

                    var deleteSprite = menu.AddButton("Delete sprite");

                    deleteSprite.Tag            = groupPanel.Tag;
                    deleteSprite.ButtonClicked += OnDeleteSpriteClicked;

                    menu.Show(groupPanel, location);
                }
Ejemplo n.º 25
0
        private void ShowContextMenu(DockWindow tab, ref Vector2 location)
        {
            var menu = new ContextMenu();

            menu.Tag = tab;
            tab.OnShowContextMenu(menu);
            menu.AddButton("Close", OnTabMenuCloseClicked);
            menu.AddButton("Close All", OnTabMenuCloseAllClicked);
            menu.AddButton("Close All But This", OnTabMenuCloseAllButThisClicked);
            if (_panel.Tabs.IndexOf(tab) + 1 < _panel.TabsCount)
            {
                menu.AddButton("Close All To the Right", OnTabMenuCloseAllToTheRightClicked);
            }
            if (!_panel.IsFloating)
            {
                menu.AddSeparator();
                menu.AddButton("Float", OnTabMenuFloatClicked);
            }
            menu.Show(this, location);
        }
 protected override void OnTreeNodeRightClick(ContextMenu menu)
 {
     menu.AddSeparator();
     menu.AddButton("Copy value", button =>
     {
         var node       = (SurfaceNode)button.ParentContextMenu.Tag;
         var state      = VisualScriptWindow.GetLocals();
         var local      = state.Locals.First(x => x.NodeId == node.ID);
         Clipboard.Text = local.Value ?? string.Empty;
     });
 }
Ejemplo n.º 27
0
        /// <inheritdoc />
        public override void OnContextMenu(ContextMenu contextMenu)
        {
            base.OnContextMenu(contextMenu);

            var actor = (AnimatedModel)Actor;

            if (actor && actor.SkinnedModel)
            {
                var b = contextMenu.AddButton("Create ragdoll", OnCreateRagdoll);
                b.TooltipText = "Adds ragdoll actor and setups the ragdoll physical structure based on skeleton bones hierarchy.";
            }
        }
Ejemplo n.º 28
0
        private void OnSettingsButtonClicked(Image image, MouseButton mouseButton)
        {
            if (mouseButton != MouseButton.Left)
            {
                return;
            }

            var script     = (Script)image.Tag;
            var scriptType = TypeUtils.GetType(script.TypeName);
            var item       = scriptType.ContentItem;

            var cm = new ContextMenu
            {
                Tag = script
            };

            cm.AddButton("Remove", OnClickRemove).Icon         = Editor.Instance.Icons.Cross12;
            cm.AddButton("Move up", OnClickMoveUp).Enabled     = script.OrderInParent > 0;
            cm.AddButton("Move down", OnClickMoveDown).Enabled = script.OrderInParent < script.Actor.Scripts.Length - 1;
            // TODO: copy script
            // TODO: paste script values
            // TODO: paste script as new
            // TODO: copy script reference
            cm.AddSeparator();
            cm.AddButton("Copy type name", OnClickCopyTypeName);
            cm.AddButton("Edit script", OnClickEditScript).Enabled = item != null;
            var showButton = cm.AddButton("Show in content window", OnClickShowScript);

            showButton.Enabled = item != null;
            showButton.Icon    = Editor.Instance.Icons.Search12;
            cm.Show(image, image.Size);
        }
Ejemplo n.º 29
0
            private void SettingsButtonOnClicked(Image image, MouseButton MouseButton)
            {
                if (MouseButton != MouseButton.Left)
                {
                    return;
                }

                var script = (Script)image.Tag;

                var cm = new ContextMenu();

                cm.Tag              = script;
                cm.OnButtonClicked += SettingsMenuOnButtonClicked;
                cm.AddButton(0, "Reset").Enabled = false;// TODO: finish this
                cm.AddSeparator();
                cm.AddButton(1, "Remove");
                cm.AddButton(2, "Move up").Enabled   = script.OrderInParent > 0;
                cm.AddButton(3, "Move down").Enabled = script.OrderInParent < script.Actor.Scripts.Length - 1;
                // TODO: copy script
                // TODO: paste script values
                // TODO: paste script as new
                // TODO: copt script reference
                cm.AddSeparator();
                cm.AddButton(4, "Edit script");
                cm.AddButton(5, "Show in content window");
                cm.Show(image, image.Size);
            }
Ejemplo n.º 30
0
        private void SettingsButtonOnClicked(Image image, MouseButton mouseButton)
        {
            if (mouseButton != MouseButton.Left)
            {
                return;
            }

            var script = (Script)image.Tag;

            var cm = new ContextMenu();

            cm.Tag = script;
            //cm.AddButton("Reset").Enabled = false;// TODO: finish this
            //cm.AddSeparator();
            cm.AddButton("Remove", OnClickRemove);
            cm.AddButton("Move up", OnClickMoveUp).Enabled     = script.OrderInParent > 0;
            cm.AddButton("Move down", OnClickMoveDown).Enabled = script.OrderInParent < script.Actor.Scripts.Length - 1;
            // TODO: copy script
            // TODO: paste script values
            // TODO: paste script as new
            // TODO: copy script reference
            cm.AddSeparator();
            cm.AddButton("Copy name", OnClickCopyName);
            cm.AddButton("Edit script", OnClickEditScript);
            cm.AddButton("Show in content window", OnClickShowScript);
            cm.Show(image, image.Size);
        }