Ejemplo n.º 1
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.º 2
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: copt script reference
                cm.AddSeparator();
                cm.AddButton("Edit script", OnClickEditScript);
                cm.AddButton("Show in content window", OnClickShowScript);
                cm.Show(image, image.Size);
            }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates the context menu used by project library window. New context menu must be created when a new instance
        /// of the project library window is created.
        /// </summary>
        /// <param name="win">Instance of the project library window.</param>
        /// <returns>Context menu bound to the specified instance of the project library window.</returns>
        internal static ContextMenu CreateContextMenu(LibraryWindow win)
        {
            ContextMenu entryContextMenu = new ContextMenu();

            entryContextMenu.AddItem("Create", null);
            entryContextMenu.AddItem("Create/Folder", CreateFolder);
            entryContextMenu.AddItem("Create/Material", CreateEmptyMaterial);
            entryContextMenu.AddItem("Create/Physics material", CreateEmptyPhysicsMaterial);
            entryContextMenu.AddItem("Create/Shader", CreateEmptyShader);
            entryContextMenu.AddItem("Create/C# script", CreateEmptyCSScript);
            entryContextMenu.AddItem("Create/Sprite texture", CreateEmptySpriteTexture);
            entryContextMenu.AddItem("Create/GUI skin", CreateEmptyGUISkin);
            entryContextMenu.AddItem("Create/String table", CreateEmptyStringTable);
            entryContextMenu.AddSeparator("");
            entryContextMenu.AddItem("Rename", win.RenameSelection, new ShortcutKey(ButtonModifier.None, ButtonCode.F2));
            entryContextMenu.AddSeparator("");
            entryContextMenu.AddItem("Cut", win.CutSelection, new ShortcutKey(ButtonModifier.Ctrl, ButtonCode.X));
            entryContextMenu.AddItem("Copy", win.CopySelection, new ShortcutKey(ButtonModifier.Ctrl, ButtonCode.C));
            entryContextMenu.AddItem("Duplicate", win.DuplicateSelection, new ShortcutKey(ButtonModifier.Ctrl, ButtonCode.D));
            entryContextMenu.AddItem("Paste", win.PasteToSelection, new ShortcutKey(ButtonModifier.Ctrl, ButtonCode.V));
            entryContextMenu.AddSeparator("");
            entryContextMenu.AddItem("Delete", win.DeleteSelection, new ShortcutKey(ButtonModifier.None, ButtonCode.Delete));
            entryContextMenu.AddSeparator("");
            entryContextMenu.AddItem("Open externally", OpenExternally);
            entryContextMenu.AddItem("Explore location", ExploreLocation);

            entryContextMenu.SetLocalizedName("Rename", new LocEdString("Rename"));
            entryContextMenu.SetLocalizedName("Cut", new LocEdString("Cut"));
            entryContextMenu.SetLocalizedName("Copy", new LocEdString("Copy"));
            entryContextMenu.SetLocalizedName("Duplicate", new LocEdString("Duplicate"));
            entryContextMenu.SetLocalizedName("Paste", new LocEdString("Paste"));
            entryContextMenu.SetLocalizedName("Delete", new LocEdString("Delete"));

            return(entryContextMenu);
        }
 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.º 5
0
        public void SetCarObjectMenu(ContextMenu menu, CarObject car, CarSkinObject skin)
        {
            menu.AddItem("Manage setups", () => CarSetupsListPage.Open(car))
            .AddItem("Manage skins", () => CarSkinsListPage.Open(car))
            .AddSeparator();
            CarBlock.OnShowroomContextMenu(menu, car, skin);

            menu.AddSeparator();

            var ratingBar = new RatingBar {
                Rating = car.Rating ?? 0
            };

            ratingBar.SetBinding(RatingBar.RatingProperty, new Binding("Rating")
            {
                Source = car
            });
            menu.AddItem(new MenuItem {
                StaysOpenOnClick = true,
                Header           = new DockPanel {
                    Margin   = new Thickness(0d, 0d, -40d, 0d),
                    Children =
                    {
                        new TextBlock       {
                            Text = "Rating:", Width = 80
                        },
                        ratingBar,
                        new FavouriteButton {
                            IsChecked = car.IsFavourite
                        }
                    }
                }
            });
            menu.AddItem(new MenuItem {
                StaysOpenOnClick = true,
                Header           = new DockPanel {
                    Margin   = new Thickness(0d, 0d, -40d, 0d),
                    Children =
                    {
                        new TextBlock  {
                            Text = "Notes:", Width = 80
                        },
                        new NotesBlock {
                            AcObject = car
                        }
                    }
                }
            });

            menu.AddSeparator();

            if (!QuickDrive.IsActive())
            {
                menu.AddItem("Open car in Quick Drive", () => QuickDrive.Show(car, skin?.Id));
            }

            menu.AddItem("Open car in Content tab", () => CarsListPage.Show(car, skin?.Id))
            .AddItem(AppStrings.Toolbar_Folder, car.ViewInExplorer);
        }
Ejemplo n.º 6
0
    protected override void FillContextMenu(ContextMenu contextMenu)
    {
        int beat     = (int)noteArea.GetHorizontalMousePositionInBeats();
        int midiNote = noteArea.GetVerticalMousePositionInMidiNote();

        contextMenu.AddItem("Fit vertical", () => noteArea.FitViewportVerticalToNotes());

        Sentence sentenceAtBeat = SongMetaUtils.GetSentencesAtBeat(songMeta, beat).FirstOrDefault();

        if (sentenceAtBeat != null)
        {
            int minBeat = sentenceAtBeat.MinBeat - 1;
            int maxBeat = sentenceAtBeat.ExtendedMaxBeat + 1;
            contextMenu.AddItem("Fit horizontal to sentence ", () => noteArea.FitViewportHorizontal(minBeat, maxBeat));
        }

        List <Note> selectedNotes = selectionController.GetSelectedNotes();

        if (selectedNotes.Count > 0)
        {
            int minBeat = selectedNotes.Select(it => it.StartBeat).Min() - 1;
            int maxBeat = selectedNotes.Select(it => it.EndBeat).Max() + 1;
            contextMenu.AddItem("Fit horizontal to selection", () => noteArea.FitViewportHorizontal(minBeat, maxBeat));
        }

        if (selectedNotes.Count > 0 ||
            songEditorCopyPasteManager.CopiedNotes.Count > 0)
        {
            contextMenu.AddSeparator();
            if (selectedNotes.Count > 0)
            {
                contextMenu.AddItem("Copy notes", () => songEditorCopyPasteManager.CopySelectedNotes());
            }

            if (songEditorCopyPasteManager.CopiedNotes.Count > 0)
            {
                contextMenu.AddItem("Paste notes", () => songEditorCopyPasteManager.PasteCopiedNotes());
            }
        }

        contextMenu.AddSeparator();
        contextMenu.AddItem("Add note", () => addNoteAction.ExecuteAndNotify(songMeta, beat, midiNote));

        if (selectedNotes.Count == 0)
        {
            contextMenu.AddSeparator();
            contextMenu.AddItem("Set Gap to playback position", () => setMusicGapAction.ExecuteAndNotify());
        }
    }
 private void FillContextMenuToSetNoteType(ContextMenu contextMenu, List <Note> selectedNotes)
 {
     contextMenu.AddSeparator();
     if (setNoteTypeAction.CanExecute(selectedNotes, ENoteType.Golden))
     {
         contextMenu.AddItem("Make golden",
                             () => setNoteTypeAction.ExecuteAndNotify(selectedNotes, ENoteType.Golden));
     }
     if (setNoteTypeAction.CanExecute(selectedNotes, ENoteType.Freestyle))
     {
         contextMenu.AddItem("Make freestyle",
                             () => setNoteTypeAction.ExecuteAndNotify(selectedNotes, ENoteType.Freestyle));
     }
     if (setNoteTypeAction.CanExecute(selectedNotes, ENoteType.Rap))
     {
         contextMenu.AddItem("Make rap",
                             () => setNoteTypeAction.ExecuteAndNotify(selectedNotes, ENoteType.Rap));
     }
     if (setNoteTypeAction.CanExecute(selectedNotes, ENoteType.RapGolden))
     {
         contextMenu.AddItem("Make rap-golden",
                             () => setNoteTypeAction.ExecuteAndNotify(selectedNotes, ENoteType.RapGolden));
     }
     if (setNoteTypeAction.CanExecute(selectedNotes, ENoteType.Normal))
     {
         contextMenu.AddItem("Make normal",
                             () => setNoteTypeAction.ExecuteAndNotify(selectedNotes, ENoteType.Normal));
     }
 }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
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.º 10
0
        private void Driver_OnContextMenuButtonClick(object sender, ContextMenuButtonEventArgs e)
        {
            var driver = ((FrameworkElement)sender).DataContext as ServerEntry.CurrentDriver;

            if (driver == null)
            {
                return;
            }

            var menu = new ContextMenu();

            foreach (var tag in ServerEntry.DriverTag.GetTags().OrderBy(x => x.DisplayName))
            {
                var icon = TryFindResource(@"PlayerTagIcon") as Shape;
                icon?.SetBinding(Shape.FillProperty, new Binding {
                    Source    = tag,
                    Path      = new PropertyPath(nameof(tag.Color)),
                    Converter = ColorPicker.ColorToBrushConverter
                });

                var header = new BbCodeBlock();
                header.SetBinding(BbCodeBlock.BbCodeProperty, new Binding {
                    Source = tag,
                    Path   = new PropertyPath(nameof(tag.DisplayName))
                });

                var item = new MenuItem {
                    Header = icon == null ? (FrameworkElement)header : new DockPanel {
                        Children = { icon, header }
                    },
                    IsChecked        = driver.Tags.GetByIdOrDefault(tag.Id) != null,
                    StaysOpenOnClick = true,
                    IsCheckable      = true
                };

                item.Click += (o, args) => {
                    (((MenuItem)o).IsChecked ? driver.AddTagCommand : driver.RemoveTagCommand).Execute(tag.Id);
                };

                menu.Items.Add(item);
            }

            menu.AddSeparator();

            menu.Items.Add(new MenuItem {
                Header  = "New Tag…",
                Command = new DelegateCommand(() => {
                    new OnlineNewDriverTag(driver).ShowDialog();
                })
            });

            menu.Items.Add(new MenuItem {
                Header  = "Edit Tags…",
                Command = new DelegateCommand(() => {
                    new OnlineDriverTags().ShowDialog();
                })
            });

            e.Menu = menu;
        }
Ejemplo n.º 11
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.º 12
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.º 13
0
 protected override void FillContextMenu(ContextMenu contextMenu)
 {
     if (PlatformUtils.IsStandalone)
     {
         contextMenu.AddItem("Open song folder", () => SongMetaUtils.OpenDirectory(SongMeta));
         contextMenu.AddSeparator();
         AddPlaylistContextMenuItems(contextMenu);
     }
 }
Ejemplo n.º 14
0
 private void FillContextMenuToMergeSentences(ContextMenu contextMenu, List <Note> selectedNotes)
 {
     if (mergeSentencesAction.CanExecute(selectedNotes))
     {
         contextMenu.AddSeparator();
         contextMenu.AddItem("Merge sentences",
                             () => mergeSentencesAction.ExecuteAndNotify(selectedNotes, uiNote.Note));
     }
 }
Ejemplo n.º 15
0
        public void SetCupUpdateMenu(ContextMenu menu, ICupSupportedObject obj)
        {
            var client      = CupClient.Instance;
            var information = obj.CupUpdateInformation;

            if (client == null || information == null)
            {
                return;
            }

            if (information.IsToUpdateManually)
            {
                menu.AddItem("Download and install update", new AsyncCommand(() =>
                                                                             client.InstallUpdateAsync(obj.CupContentType, obj.Id)),
                             iconData: (Geometry)Icons["UpdateIconData"]);
                menu.AddItem("Download update", new AsyncCommand(async() => {
                    WindowsHelper.ViewInBrowser(await client.GetUpdateUrlAsync(obj.CupContentType, obj.Id));
                }));
                menu.AddSeparator();
            }
            else
            {
                menu.AddItem("Get update", new AsyncCommand(async() => {
                    WindowsHelper.ViewInBrowser(await client.GetUpdateUrlAsync(obj.CupContentType, obj.Id)
                                                ?? obj.CupUpdateInformation?.InformationUrl);
                }));
                menu.AddSeparator();
            }

            menu.AddItem("View information", () => new CupInformationDialog(obj).ShowDialog());

            if (!string.IsNullOrWhiteSpace(information.InformationUrl))
            {
                menu.AddItem("Open information page", () => {
                    WindowsHelper.ViewInBrowser(information.InformationUrl);
                });
            }

            menu.AddSeparator()
            .AddItem("Ignore update", () => client.IgnoreUpdate(obj.CupContentType, obj.Id))
            .AddItem("Ignore all updates", () => client.IgnoreAllUpdates(obj.CupContentType, obj.Id))
            .AddItem("Report update as broken", new AsyncCommand(() => client.ReportUpdateAsync(obj.CupContentType, obj.Id)));
        }
 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.º 17
0
    private void FillContextMenuToMoveToOtherVoice(ContextMenu contextMenu, List <Note> selectedNotes)
    {
        bool canMoveToVoice1 = moveNotesToOtherVoiceAction.CanMoveNotesToVoice(selectedNotes, Voice.soloVoiceName, Voice.firstVoiceName);
        bool canMoveToVoice2 = moveNotesToOtherVoiceAction.CanMoveNotesToVoice(selectedNotes, Voice.secondVoiceName);

        if (canMoveToVoice1)
        {
            contextMenu.AddSeparator();
            contextMenu.AddItem("Move to player 1",
                                () => moveNotesToOtherVoiceAction.MoveNotesToVoiceAndNotify(songMeta, selectedNotes, Voice.firstVoiceName));
        }
        if (!canMoveToVoice1 && canMoveToVoice2)
        {
            contextMenu.AddSeparator();
        }
        if (canMoveToVoice2)
        {
            contextMenu.AddItem("Move to player 2",
                                () => moveNotesToOtherVoiceAction.MoveNotesToVoiceAndNotify(songMeta, selectedNotes, Voice.secondVoiceName));
        }
    }
Ejemplo n.º 18
0
    private void FillContextMenuToMoveToOtherSentence(ContextMenu contextMenu, List <Note> selectedNotes)
    {
        bool canMoveToPreviousSentence = moveNoteToAjacentSentenceAction.CanMoveToPreviousSentence(selectedNotes, uiNote.Note);
        bool canMoveToNextSentence     = moveNoteToAjacentSentenceAction.CanMoveToNextSentence(selectedNotes, uiNote.Note);

        if (canMoveToPreviousSentence)
        {
            contextMenu.AddSeparator();
            contextMenu.AddItem("Move to previous sentence",
                                () => moveNoteToAjacentSentenceAction.MoveToPreviousSentenceAndNotify(uiNote.Note));
        }
        if (!canMoveToPreviousSentence && canMoveToNextSentence)
        {
            contextMenu.AddSeparator();
        }
        if (canMoveToNextSentence)
        {
            contextMenu.AddItem("Move to next sentence",
                                () => moveNoteToAjacentSentenceAction.MoveToNextSentenceAndNotify(uiNote.Note));
        }
    }
Ejemplo n.º 19
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.º 20
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.º 21
0
    protected override void FillContextMenu(ContextMenu contextMenu)
    {
        int beat     = (int)noteArea.GetHorizontalMousePositionInBeats();
        int midiNote = noteArea.GetVerticalMousePositionInMidiNote();

        contextMenu.AddItem("Fit vertical", () => noteArea.FitViewportVerticalToNotes());

        List <Note> selectedNotes = selectionController.GetSelectedNotes();

        if (selectedNotes.Count > 0)
        {
            contextMenu.AddItem("Fit horizontal to selection", () => noteArea.FitViewportHorizontalToNotes(selectedNotes));
        }

        contextMenu.AddSeparator();
        contextMenu.AddItem("Add note", () => addNoteAction.ExecuteAndNotify(songMeta, beat, midiNote));

        if (selectedNotes.Count == 0)
        {
            contextMenu.AddSeparator();
            contextMenu.AddItem("Set Gap to playback position", () => setMusicGapAction.ExecuteAndNotify());
        }
    }
Ejemplo n.º 22
0
        public void SetTrackObjectMenu(ContextMenu menu, TrackObjectBase track)
        {
            var mainTrack = track.MainTrackObject;

            mainTrack.SkinsManager.EnsureLoaded();
            if (mainTrack.EnabledOnlySkins.Count > 0)
            {
                foreach (var skinObject in mainTrack.EnabledOnlySkins)
                {
                    var item = new MenuItem {
                        Header           = skinObject.DisplayName.ToTitle(),
                        IsCheckable      = true,
                        StaysOpenOnClick = true,
                        ToolTip          = skinObject.Description
                    };

                    item.SetBinding(MenuItem.IsCheckedProperty, new Binding {
                        Path   = new PropertyPath(nameof(skinObject.IsActive)),
                        Source = skinObject
                    });

                    menu.Items.Add(item);
                }
                menu.AddSeparator();
            }

            menu.AddItem("Manage skins", () => TrackSkinsListPage.Open(track.MainTrackObject));
            menu.AddSeparator();

            if (!QuickDrive.IsActive())
            {
                menu.AddItem("Open track in Quick Drive", () => QuickDrive.Show(track: track));
            }

            menu.AddItem("Open track in Content tab", () => TracksListPage.Show(track), isEnabled: InternalUtils.IsAllRight)
            .AddItem(AppStrings.Toolbar_Folder, track.ViewInExplorer);
        }
Ejemplo n.º 23
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);
        }
    protected override void FillContextMenu(ContextMenu contextMenu)
    {
        if (uiSentence == null)
        {
            uiSentence = GetComponent <EditorUiSentence>();
        }

        List <Sentence> selectedSentences = new List <Sentence> {
            uiSentence.Sentence
        };

        contextMenu.AddItem("Fit to notes", () => sentenceFitToNoteAction.ExecuteAndNotify(selectedSentences));
        contextMenu.AddSeparator();
        contextMenu.AddItem("Delete", () => deleteSentencesAction.ExecuteAndNotify(selectedSentences));
    }
Ejemplo n.º 25
0
 private void FillContextMenuToAddSpaceBetweenNotes(ContextMenu contextMenu, List <Note> selectedNotes)
 {
     contextMenu.AddSeparator();
     if (spaceBetweenNotesAction.CanExecute(selectedNotes))
     {
         contextMenu.AddItem("Add space between notes", () =>
         {
             SpaceBetweenNotesButton spaceBetweenNotesButton = FindObjectOfType <SpaceBetweenNotesButton>(true);
             if (int.TryParse(spaceBetweenNotesButton.numberOfBeatsInputField.text, out int spaceInBeats))
             {
                 spaceBetweenNotesAction.ExecuteAndNotify(selectedNotes, spaceInBeats);
             }
         });
     }
 }
    protected override void FillContextMenu(ContextMenu contextMenu)
    {
        contextMenu.AddItem(I18NManager.GetTranslation(R.String.action_reloadSong),
                            () => SongMeta.Reload());

        contextMenu.AddItem(I18NManager.GetTranslation(R.String.action_openSongEditor),
                            () => songSelectSceneController.StartSongEditorScene());

        if (PlatformUtils.IsStandalone)
        {
            contextMenu.AddItem(I18NManager.GetTranslation(R.String.action_openSongFolder),
                                () => SongMetaUtils.OpenDirectory(SongMeta));
            AddPlaylistContextMenuItems(contextMenu);
        }

        contextMenu.AddSeparator();
    }
Ejemplo n.º 27
0
    private void GenericMenu()
    {
        ContextMenu.AddItem(new GUIContent("Path Tool/Align Local/X"), false, AlignGenericMenuCallback, 0);
        ContextMenu.AddItem(new GUIContent("Path Tool/Align Local/Y"), false, AlignGenericMenuCallback, 1);
        ContextMenu.AddItem(new GUIContent("Path Tool/Align Local/Z"), false, AlignGenericMenuCallback, 2);
        ContextMenu.AddSeparator("Path Tool/");

        ContextMenu.AddItem(new GUIContent("Path Tool/Backup"), false, GenericMenuCallback, 0);

        // Revert
        ContextMenu.AddItem(new GUIContent("Path Tool/Revert/Path"), false, RevertGenericMenuCallback, 1);
        ContextMenu.AddItem(new GUIContent("Path Tool/Revert/Position"), false, RevertGenericMenuCallback, 2);
        ContextMenu.AddItem(new GUIContent("Path Tool/Revert/Rotation"), false, RevertGenericMenuCallback, 3);
        ContextMenu.AddItem(new GUIContent("Path Tool/Revert/Scale"), false, RevertGenericMenuCallback, 4);
        ContextMenu.AddSeparator("Path Tool/Revert/");
        ContextMenu.AddItem(new GUIContent("Path Tool/Revert/All"), false, RevertGenericMenuCallback, 0);
    }
Ejemplo n.º 28
0
        public void SetCarObjectMenu(ContextMenu menu, CarObject car, CarSkinObject skin)
        {
            menu.AddItem("Manage setups", () => CarSetupsListPage.Open(car))
            .AddItem("Manage skins", () => CarSkinsListPage.Open(car))
            .AddSeparator();
            CarBlock.OnShowroomContextMenu(menu, car, skin);

            menu.AddSeparator();

            if (!QuickDrive.IsActive())
            {
                menu.AddItem("Open car in Quick Drive", () => QuickDrive.Show(car, skin?.Id));
            }

            menu.AddItem("Open car in Content tab", () => CarsListPage.Show(car, skin?.Id))
            .AddItem(AppStrings.Toolbar_Folder, car.ViewInExplorer);
        }
Ejemplo n.º 29
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.º 30
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);
        }