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));
     }
 }
Example #2
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);
        }
    protected override void FillContextMenu(ContextMenu contextMenu)
    {
        int beat     = (int)noteArea.GetHorizontalMousePositionInBeats();
        int midiNote = noteArea.GetVerticalMousePositionInMidiNote();

        contextMenu.AddItem("Fit vertical", () => noteArea.FitViewportVerticalToNotes());
        contextMenu.AddItem("Add note", () => addNoteAction.ExecuteAndNotify(songMeta, beat, midiNote));
    }
 private void FillContextMenuToSplitAndMergeNotes(ContextMenu contextMenu, List <Note> selectedNotes)
 {
     if (splitNotesAction.CanExecute(selectedNotes))
     {
         contextMenu.AddItem("Split Notes", () => splitNotesAction.ExecuteAndNotify(selectedNotes));
     }
     if (mergeNotesAction.CanExecute(selectedNotes))
     {
         contextMenu.AddItem("Merge Notes", () => mergeNotesAction.ExecuteAndNotify(selectedNotes, uiNote.Note));
     }
 }
 protected override void FillContextMenu(ContextMenu contextMenu)
 {
     contextMenu.AddItem(I18NManager.GetTranslation(R.String.action_togglePause),
                         () => singSceneController.TogglePlayPause());
     contextMenu.AddItem(I18NManager.GetTranslation(R.String.action_restart),
                         () => singSceneController.Restart());
     contextMenu.AddItem(I18NManager.GetTranslation(R.String.action_skipToNextLyrics),
                         () => singSceneController.SkipToNextSingableNote());
     contextMenu.AddItem(I18NManager.GetTranslation(R.String.action_exitSong),
                         () => singSceneController.FinishScene(false));
     contextMenu.AddItem(I18NManager.GetTranslation(R.String.action_openSongEditor),
                         () => singSceneController.OpenSongInEditor());
 }
Example #6
0
 private void AddPlaylistContextMenuItems(ContextMenu contextMenu)
 {
     foreach (UltraStarPlaylist playlist in playlistManager.Playlists)
     {
         string playlistName = playlistManager.GetPlaylistName(playlist);
         if (playlist.HasSongEntry(SongMeta.Artist, SongMeta.Title))
         {
             contextMenu.AddItem($"Remove from '{playlistName}'", () => playlistManager.RemoveSongFromPlaylist(playlist, SongMeta));
         }
         else
         {
             contextMenu.AddItem($"Add to '{playlistName}'", () => playlistManager.AddSongToPlaylist(playlist, SongMeta));
         }
     }
 }
    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));
    }
Example #8
0
    private void Start()
    {
        drawer.Init();

        GrapEventListener.GraphMouseEvent += OnGraphMouseClick;
        SignalSystem.RequestStartedEvent  += OnRequestStarted;
        SignalSystem.RequestSuccesEvent   += OnRequestSuccess;
        SignalSystem.RequestFailEvent     += OnRequestFailed;

        _contextMenu = CreatePrefab <ContextMenu>("Prefabs/ContextMenu", contextMenuContainer);

        _contextMenu.Init();
        _contextMenu.Hide();
        _contextMenu.AddItem("float node", OnNodeItemClicked <FloatNode>("Prefabs/Nodes/FloatNode"));
        _contextMenu.AddItem("sum node", OnNodeItemClicked <SumNode>("Prefabs/Nodes/SumNode"));
    }
Example #9
0
 protected override void FillContextMenu(ContextMenu contextMenu)
 {
     if (PlatformUtils.IsStandalone)
     {
         contextMenu.AddItem("Open song folder", () => SongMetaUtils.OpenDirectory(SongMeta));
     }
 }
Example #10
0
        public void PopupMenu(object obj, ClickEventArgs e)
        {
            var hamburger = new ContextMenu(e.Position);

            hamburger.AddItem(Content.Load <Texture2D>(@"icons\save"), "Save", Ok);
            hamburger.AddItem(Content.Load <Texture2D>(@"icons\undo"), "Undo", Ok);
            hamburger.AddItem(Content.Load <Texture2D>(@"icons\redo"), "Redo", Ok);
            hamburger.AddItem(Content.Load <Texture2D>(@"icons\copy"), "Copy", Ok);
            hamburger.AddItem(Content.Load <Texture2D>(@"icons\paste"), "Paste", Ok);
            hamburger.AddItem(null, "catpants", Ok);
            hamburger.AddItem(null, "buttnuts", Ok);
            hamburger.AddItem(Content.Load <Texture2D>(@"icons\pasteSpecial"), "PasteSpecial", Ok);
            hamburger.AddItem(Content.Load <Texture2D>(@"icons\leftright"), "Mirror", Ok);
            hamburger.AddItem(Content.Load <Texture2D>(@"icons\unkey"), "UnKey", Ok);
            ScreenManager.AddScreen(hamburger);
        }
    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));
    }
    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();
    }
Example #13
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);
        }
 private void FillContextMenuToMergeSentences(ContextMenu contextMenu, List <Note> selectedNotes)
 {
     if (mergeSentencesAction.CanExecute(selectedNotes))
     {
         contextMenu.AddSeparator();
         contextMenu.AddItem("Merge sentences",
                             () => mergeSentencesAction.ExecuteAndNotify(selectedNotes, uiNote.Note));
     }
 }
Example #15
0
 public static ContextMenu AddItem([NotNull] this ContextMenu menu, string header, Action action, string shortcut = null, object icon = null,
                                   Geometry iconData = null, bool isEnabled = true)
 {
     if (menu == null)
     {
         throw new ArgumentNullException(nameof(menu));
     }
     return(menu.AddItem(header, new DelegateCommand(action), shortcut, icon, iconData, isEnabled));
 }
Example #16
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)));
        }
 private void AddPlaylistContextMenuItems(ContextMenu contextMenu)
 {
     foreach (UltraStarPlaylist playlist in playlistManager.Playlists)
     {
         string playlistName = playlistManager.GetPlaylistName(playlist);
         Dictionary <string, string> placeholders = new Dictionary <string, string> {
             ["playlist"] = playlistName
         };
         if (playlist.HasSongEntry(SongMeta.Artist, SongMeta.Title))
         {
             contextMenu.AddItem(I18NManager.GetTranslation(R.String.action_removeFromPlaylist, placeholders),
                                 () => playlistManager.RemoveSongFromPlaylist(playlist, SongMeta));
         }
         else
         {
             contextMenu.AddItem(I18NManager.GetTranslation(R.String.action_addToPlaylist, placeholders),
                                 () => playlistManager.AddSongToPlaylist(playlist, SongMeta));
         }
     }
 }
    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));
        }
    }
    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));
        }
    }
Example #20
0
        /// <summary>
        /// Creates a new inspectable object GUI for the specified property.
        /// </summary>
        /// <param name="context">Context shared by all inspectable fields created by the same parent.</param>
        /// <param name="title">Name of the property, or some other value to set as the title.</param>
        /// <param name="path">Full path to this property (includes name of this property and all parent properties).</param>
        /// <param name="depth">Determines how deep within the inspector nesting hierarchy is this field. Some fields may
        ///                     contain other fields, in which case you should increase this value by one.</param>
        /// <param name="layout">Parent layout that all the field elements will be added to.</param>
        /// <param name="property">Serializable property referencing the object whose contents to display.</param>
        /// <param name="style">Information that can be used for customizing field rendering and behaviour.</param>
        public InspectableObject(InspectableContext context, string title, string path, int depth, InspectableFieldLayout layout,
                                 SerializableProperty property, InspectableFieldStyleInfo style)
            : base(context, title, path, SerializableProperty.FieldType.Object, depth, layout, property)
        {
            this.style = style;
            isExpanded = context.Persistent.GetBool(path + "_Expanded");
            isInline   = style != null && style.StyleFlags.HasFlag(InspectableFieldStyleFlags.Inline);

            // Builds a context menu that lets the user create objects to assign to this field.
            bool hasCreateButton = !property.IsValueType && !isInline;

            if (hasCreateButton)
            {
                instantiableTypes = GetInstantiableTypes(property.InternalType);
                if (instantiableTypes.Length > 1)
                {
                    createContextMenu = new ContextMenu();

                    Array.Sort(instantiableTypes, (x, y) => string.Compare(x.Name, y.Name, StringComparison.Ordinal));

                    bool   showNamespace = false;
                    string ns            = instantiableTypes[0].Namespace;
                    for (int i = 1; i < instantiableTypes.Length; i++)
                    {
                        if (instantiableTypes[i].Namespace != ns)
                        {
                            showNamespace = true;
                            break;
                        }
                    }

                    foreach (var type in instantiableTypes)
                    {
                        string prefix = "";
                        if (showNamespace)
                        {
                            prefix = type.Namespace + ".";
                        }

                        createContextMenu.AddItem(prefix + type.Name,
                                                  () =>
                        {
                            StartUndo();
                            property.SetValue(Activator.CreateInstance(type));
                            EndUndo();
                        });
                    }
                }
            }
        }
Example #21
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);
        }
 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 AddContextMenuItems(ContextMenu menu)
 {
     menu.AddItem("Delete", () =>
     {
         var index = Parent.Children.IndexOf(this);
         UndoRedo.ApplyDoUndo(
             delegate
         {
             Parent.Children.Remove(this);
         },
             delegate
         {
             Parent.Children.Insert(index, this);
         }, "Delete Comment");
     });
 }
Example #24
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());
        }
    }
Example #25
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);
    }
        /// <summary>
        /// Creates a new inspectable array GUI for the specified property.
        /// </summary>
        /// <param name="parent">Parent Inspector this field belongs to.</param>
        /// <param name="title">Name of the property, or some other value to set as the title.</param>
        /// <param name="path">Full path to this property (includes name of this property and all parent properties).</param>
        /// <param name="depth">Determines how deep within the inspector nesting hierarchy is this field. Some fields may
        ///                     contain other fields, in which case you should increase this value by one.</param>
        /// <param name="layout">Parent layout that all the field elements will be added to.</param>
        /// <param name="property">Serializable property referencing the object whose contents to display.</param>
        public InspectableObject(Inspector parent, string title, string path, int depth, InspectableFieldLayout layout,
                                 SerializableProperty property)
            : base(parent, title, path, SerializableProperty.FieldType.Object, depth, layout, property)
        {
            isExpanded = parent.Persistent.GetBool(path + "_Expanded");

            // Builds a context menu that lets the user create objects to assign to this field.
            Type[] types = GetInstantiableTypes(property.InternalType);
            if (types.Length > 0)
            {
                createContextMenu = new ContextMenu();

                Array.Sort(types, (x, y) => string.Compare(x.Name, y.Name, StringComparison.Ordinal));
                foreach (var type in types)
                {
                    createContextMenu.AddItem(type.Namespace + "." + type.Name,
                                              () => property.SetValue(Activator.CreateInstance(type)));
                }
            }
        }
Example #27
0
        public static ContextMenu AddTextBoxItems([NotNull] this ContextMenu menu)
        {
            if (menu == null)
            {
                throw new ArgumentNullException(nameof(menu));
            }
            if (!menu.Items.IsEmpty)
            {
                menu.AddSeparator();
            }

            return(menu
                   .AddItem(ApplicationCommands.Undo)
                   .AddSeparator()
                   .AddItem(ApplicationCommands.Cut)
                   .AddItem(ApplicationCommands.Copy)
                   .AddItem(ApplicationCommands.Paste)
                   .AddItem(ApplicationCommands.Delete)
                   .AddSeparator()
                   .AddItem(ApplicationCommands.SelectAll));
        }
Example #28
0
        //-----------------------------------------------------------------------
        protected override void AddContextMenuItems(ContextMenu menu)
        {
            base.AddContextMenuItems(menu);

            MenuItem pasteItem = new MenuItem();

            pasteItem.Header  = "Paste new";
            pasteItem.Command = PasteNewCMD;

            menu.Items.Add(pasteItem);

            if (Children.Count > 1)
            {
                menu.AddSeperator();

                menu.AddItem("Multiedit Children", () =>
                {
                    DataModel.Selected = new List <DataItem>(Children);
                });
            }
        }
        void receiveContextMenu(PacketReader reader)
        {
            reader.ReadByte();                   // unknown (0x00)
            int iSubCommand = reader.ReadByte(); // 0x01 for 2D, 0x02 for KR

            m_contextmenu = new ContextMenu(reader.ReadInt32());
            int iNumEntriesInContext = reader.ReadByte();

            for (int i = 0; i < iNumEntriesInContext; i++)
            {
                int iUniqueID = reader.ReadUInt16();
                int iClilocID = reader.ReadUInt16() + 3000000;
                int iFlags    = reader.ReadUInt16(); // 0x00=enabled, 0x01=disabled, 0x02=arrow, 0x20 = color
                int iColor    = 0;
                if ((iFlags & 0x20) == 0x20)
                {
                    iColor = reader.ReadUInt16();
                }
                m_contextmenu.AddItem(iUniqueID, iClilocID, iFlags, iColor);
            }
            m_contextmenu.FinalizeMenu();
        }
Example #30
0
    protected override void FillContextMenu(ContextMenu contextMenu)
    {
        if (uiNote == null)
        {
            uiNote = GetComponent <EditorUiNote>();
        }
        if (!selectionController.IsSelected(uiNote.Note))
        {
            selectionController.SetSelection(new List <EditorUiNote> {
                uiNote
            });
        }

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

        contextMenu.AddItem("Edit lyrics", () => songEditorSceneController.StartEditingNoteText());
        FillContextMenuToSplitAndMergeNotes(contextMenu, selectedNotes);
        FillContextMenuToAddSpaceBetweenNotes(contextMenu, selectedNotes);
        FillContextMenuToSetNoteType(contextMenu, selectedNotes);
        FillContextMenuToMergeSentences(contextMenu, selectedNotes);
        FillContextMenuToMoveToOtherSentence(contextMenu, selectedNotes);
        FillContextMenuToMoveToOtherVoice(contextMenu, selectedNotes);
        FillContextMenuToDeleteNotes(contextMenu, selectedNotes);
    }
Example #31
0
        void receiveContextMenu(PacketReader reader)
        {
            reader.ReadByte(); // unknown (0x00)
            int iSubCommand = reader.ReadByte(); // 0x01 for 2D, 0x02 for KR
            _contextmenu = new ContextMenu(reader.ReadInt32());
            int iNumEntriesInContext = reader.ReadByte();

            for (int i = 0; i < iNumEntriesInContext; i++)
            {
                int iUniqueID = reader.ReadUInt16();
                int iClilocID = reader.ReadUInt16() + 3000000;
                int iFlags = reader.ReadUInt16(); // 0x00=enabled, 0x01=disabled, 0x02=arrow, 0x20 = color
                int iColor = 0;
                if ((iFlags & 0x20) == 0x20)
                {
                    iColor = reader.ReadUInt16();
                }
                _contextmenu.AddItem(iUniqueID, iClilocID, iFlags, iColor);
            }
            _contextmenu.FinalizeMenu();
        }