Ejemplo n.º 1
0
        HelpInfo IHelpProvider.ProvideHoverHelp(Point localPos, ref bool captured)
        {
            if (this.pixmapView.ClientRectangle.Contains(localPos))
            {
                return(this.state.ProvideHoverHelp(localPos, ref captured));
            }

            return(HelpInfo.FromText(
                       EditorBaseRes.Help_PixmapSlicer_Topic,
                       EditorBaseRes.Help_PixmapSlicer_Desc));
        }
Ejemplo n.º 2
0
        HelpInfo IHelpProvider.ProvideHoverHelp(System.Drawing.Point localPos, ref bool captured)
        {
            PropertyEditor pickedEditor = this.PickEditorAt(this.Location.X + localPos.X, this.Location.Y + localPos.Y, true);

            if (this.showWorldSpace)
            {
                if (pickedEditor == this.editorPos)
                {
                    return(HelpInfo.FromMember(ReflectionInfo.Property_Transform_LocalPos));
                }
                else if (pickedEditor == this.editorScale)
                {
                    return(HelpInfo.FromMember(ReflectionInfo.Property_Transform_LocalScale));
                }
                else if (pickedEditor == this.editorAngle)
                {
                    return(HelpInfo.FromMember(ReflectionInfo.Property_Transform_LocalAngle));
                }
            }
            else
            {
                if (pickedEditor == this.editorPos)
                {
                    return(HelpInfo.FromMember(ReflectionInfo.Property_Transform_Pos));
                }
                else if (pickedEditor == this.editorScale)
                {
                    return(HelpInfo.FromMember(ReflectionInfo.Property_Transform_Scale));
                }
                else if (pickedEditor == this.editorAngle)
                {
                    return(HelpInfo.FromMember(ReflectionInfo.Property_Transform_Angle));
                }
            }

            if (pickedEditor == this.editorShowWorldSpace)
            {
                return(HelpInfo.FromText("World Space Mode",
                                         "If true, Transform values will be displayed and edited in world space, " +
                                         "instead of the parent objects local space. This is an editor property " +
                                         "that does not affect object behaviour in any way."));
            }
            else if (pickedEditor.EditedMember != null)
            {
                return(HelpInfo.FromMember(pickedEditor.EditedMember));
            }
            else if (pickedEditor.EditedType != null)
            {
                return(HelpInfo.FromMember(pickedEditor.EditedType));
            }

            return(null);
        }
Ejemplo n.º 3
0
        HelpInfo IHelpProvider.ProvideHoverHelp(Point localPos, ref bool captured)
        {
            Point globalPos = this.TilesetEditor.PointToScreen(localPos);
            Point viewPos   = this.TilesetView.PointToClient(globalPos);

            if (this.TilesetView.ClientRectangle.Contains(viewPos))
            {
                return(HelpInfo.FromText(
                           TilemapsRes.TilesetEditorMode_AutoTile_Name,
                           TilemapsRes.TilesetEditorMode_AutoTile_ViewDesc));
            }

            return(null);
        }
Ejemplo n.º 4
0
 public virtual HelpInfo ProvideHoverHelp(Point localPos, ref bool captured)
 {
     if (this.camActionAllowed)
     {
         return(HelpInfo.FromText(CamViewRes.CamView_Help_CamActions,
                                  CamViewRes.CamView_Help_CamActions_Move + "\n" +
                                  CamViewRes.CamView_Help_CamActions_MoveAlternate + "\n" +
                                  CamViewRes.CamView_Help_CamActions_MoveStep + "\n" +
                                  CamViewRes.CamView_Help_CamActions_Focus));
     }
     else
     {
         return(null);
     }
 }
Ejemplo n.º 5
0
        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);

            // Initialize the available editor modes and generate their toolbuttons
            TilesetEditorMode[] modeInstances = DualityEditorApp.GetAvailDualityEditorTypes(typeof(TilesetEditorMode))
                                                .Where(t => !t.IsAbstract)
                                                .Select(t => t.CreateInstanceOf() as TilesetEditorMode)
                                                .NotNull()
                                                .OrderBy(t => t.SortOrder)
                                                .ToArray();
            this.availableModes = new EditorModeInfo[modeInstances.Length];
            for (int i = 0; i < this.availableModes.Length; i++)
            {
                TilesetEditorMode mode = modeInstances[i];
                mode.Init(this);

                ToolStripButton modeItem = new ToolStripButton(mode.Name, mode.Icon);
                modeItem.AutoToolTip = false;
                modeItem.ToolTipText = null;
                modeItem.Tag         = HelpInfo.FromText(mode.Name, mode.Description);
                modeItem.Click      += this.modeToolButton_Click;

                this.toolStripModeSelect.Items.Add(modeItem);
                this.availableModes[i] = new EditorModeInfo
                {
                    Mode       = mode,
                    ToolButton = modeItem
                };
            }

            // If we have at least one mode available, activate it
            if (this.availableModes.Length > 0)
            {
                this.SetActiveEditorMode(this.availableModes[0].Mode);
            }

            // Subscribe for global editor events
            DualityEditorApp.ObjectPropertyChanged += this.DualityEditorApp_ObjectPropertyChanged;
            DualityEditorApp.SelectionChanged      += this.DualityEditorApp_SelectionChanged;

            // Apply editor-global tileset selection
            this.ApplyGlobalTilesetSelection(SelectionChangeReason.Unknown);

            // Start recording tileset changes for Apply / Revert support
            this.StartRecordTilesetChanges();
        }
 public override HelpInfo ProvideHoverHelp(Point localPos, ref bool captured)
 {
     if (this.actionAllowed && this.allObjSel.Any())
     {
         return(HelpInfo.FromText(CamViewRes.CamView_Help_ObjActions,
                                  CamViewRes.CamView_Help_ObjActions_Delete + "\n" +
                                  CamViewRes.CamView_Help_ObjActions_Clone + "\n" +
                                  CamViewRes.CamView_Help_ObjActions_EditClone + "\n" +
                                  CamViewRes.CamView_Help_ObjActions_MoveStep + "\n" +
                                  CamViewRes.CamView_Help_ObjActions_Focus + "\n" +
                                  CamViewRes.CamView_Help_ObjActions_AxisLock));
     }
     else
     {
         return(base.ProvideHoverHelp(localPos, ref captured));
     }
 }
        /// <summary>
        /// Provides custom <see cref="HelpInfo"/> tooltips for the action buttons.
        /// </summary>
        /// <param name="localPos"></param>
        /// <param name="captured"></param>
        /// <returns></returns>
        HelpInfo IHelpProvider.ProvideHoverHelp(Point localPos, ref bool captured)
        {
            HelpInfo result = null;

            localPos.X += this.Location.X;
            localPos.Y += this.Location.Y;

            if (this.rectButtonShow.Contains(localPos))
            {
                result = HelpInfo.FromText(EditorBaseRes.ActionName_ShowResourceSources, EditorBaseRes.ActionDesc_ShowResourceSources);
            }
            else if (this.rectButtonExport.Contains(localPos))
            {
                result = HelpInfo.FromText(EditorBaseRes.ActionName_ExportResource, EditorBaseRes.ActionDesc_ExportResource);
            }
            else if (this.rectButtonReImport.Contains(localPos))
            {
                result = HelpInfo.FromText(EditorBaseRes.ActionName_ReImportResource, EditorBaseRes.ActionDesc_ReImportResource);
            }

            return(result);
        }
Ejemplo n.º 8
0
 public override HelpInfo ProvideHoverHelp(Point localPos, ref bool captured)
 {
     return(HelpInfo.FromText(EditorBaseRes.Help_PixmapSlicerRectOrdering_Topic,
                              EditorBaseRes.Help_PixmapSlicerRectOrdering_Desc));
 }
Ejemplo n.º 9
0
        HelpInfo IHelpProvider.ProvideHoverHelp(System.Drawing.Point localPos, ref bool captured)
        {
            PropertyEditor pickedEditor = this.PickEditorAt(localPos.X, localPos.Y, true);

            if (this.showRelative)
            {
                if (pickedEditor == this.editorPos)
                {
                    return(HelpInfo.FromMember(ReflectionInfo.Property_Transform_RelativePos));
                }
                else if (pickedEditor == this.editorVel)
                {
                    return(HelpInfo.FromMember(ReflectionInfo.Property_Transform_RelativeVel));
                }
                else if (pickedEditor == this.editorScale)
                {
                    return(HelpInfo.FromMember(ReflectionInfo.Property_Transform_RelativeScale));
                }
                else if (pickedEditor == this.editorAngle)
                {
                    return(HelpInfo.FromMember(ReflectionInfo.Property_Transform_RelativeAngle));
                }
                else if (pickedEditor == this.editorAngleVel)
                {
                    return(HelpInfo.FromMember(ReflectionInfo.Property_Transform_RelativeAngleVel));
                }
            }
            else
            {
                if (pickedEditor == this.editorPos)
                {
                    return(HelpInfo.FromMember(ReflectionInfo.Property_Transform_Pos));
                }
                else if (pickedEditor == this.editorVel)
                {
                    return(HelpInfo.FromMember(ReflectionInfo.Property_Transform_Vel));
                }
                else if (pickedEditor == this.editorScale)
                {
                    return(HelpInfo.FromMember(ReflectionInfo.Property_Transform_Scale));
                }
                else if (pickedEditor == this.editorAngle)
                {
                    return(HelpInfo.FromMember(ReflectionInfo.Property_Transform_Angle));
                }
                else if (pickedEditor == this.editorAngleVel)
                {
                    return(HelpInfo.FromMember(ReflectionInfo.Property_Transform_AngleVel));
                }
            }

            if (pickedEditor == this.editorShowRelative)
            {
                return(HelpInfo.FromText("Show relative values?", "If true, the relative Transform values are displayed for editing. This is an editor property that does not affect object behaviour in any way."));
            }
            else if (pickedEditor.EditedMember != null)
            {
                return(HelpInfo.FromMember(pickedEditor.EditedMember));
            }
            else if (pickedEditor.EditedType != null)
            {
                return(HelpInfo.FromMember(pickedEditor.EditedType));
            }

            return(null);
        }
Ejemplo n.º 10
0
        public void InitMenus()
        {
            this.mainMenuView = new MenuStripMenuView(this.mainMenuStrip.Items);
            this.mainMenuView.ItemInserted += this.mainMenuView_ItemInserted;
            this.mainMenuView.ItemRemoved  += this.mainMenuView_ItemRemoved;
            this.mainMenuView.Model         = this.mainMenuModel;

            MenuModelItem helpItem;

            this.mainMenuModel.AddItems(new[]
            {
                new MenuModelItem {
                    Name = GeneralRes.MenuName_File, SortValue = MenuModelItem.SortValue_Top, Items = new[]
                    {
                        new MenuModelItem
                        {
                            Name          = GeneralRes.MenuItemName_NewProject,
                            SortValue     = MenuModelItem.SortValue_Top,
                            Icon          = Properties.GeneralResCache.ImageAppCreate,
                            Tag           = HelpInfo.FromText(GeneralRes.MenuItemName_NewProject, GeneralRes.MenuItemInfo_NewProject),
                            ActionHandler = this.newProjectItem_Click
                        },
                        new MenuModelItem
                        {
                            Name          = GeneralRes.MenuItemName_PublishGame,
                            SortValue     = MenuModelItem.SortValue_Top,
                            Tag           = HelpInfo.FromText(GeneralRes.MenuItemName_PublishGame, GeneralRes.MenuItemInfo_PublishGame),
                            ActionHandler = this.actionPublishGame_Click
                        },
                        new MenuModelItem
                        {
                            Name      = "TopSeparator",
                            SortValue = MenuModelItem.SortValue_Top,
                            TypeHint  = MenuItemTypeHint.Separator
                        },
                        new MenuModelItem
                        {
                            Name          = this.actionSaveAll.Text,
                            Icon          = this.actionSaveAll.Image,
                            ShortcutKeys  = Keys.Control | Keys.S,
                            Tag           = HelpInfo.FromText(this.actionSaveAll.Text, GeneralRes.MenuItemInfo_SaveAll),
                            ActionHandler = this.actionSaveAll_Click
                        },
                        new MenuModelItem
                        {
                            Name     = "CodeSeparator",
                            TypeHint = MenuItemTypeHint.Separator
                        },
                        new MenuModelItem
                        {
                            Name          = this.actionOpenCode.Text,
                            Icon          = this.actionOpenCode.Image,
                            Tag           = HelpInfo.FromText(this.actionOpenCode.Text, GeneralRes.MenuItemInfo_OpenProjectSource),
                            ActionHandler = this.actionOpenCode_Click
                        },
                        new MenuModelItem
                        {
                            Name      = "BottomSeparator",
                            SortValue = MenuModelItem.SortValue_Bottom,
                            TypeHint  = MenuItemTypeHint.Separator
                        },
                        new MenuModelItem
                        {
                            Name          = GeneralRes.MenuItemName_Quit,
                            SortValue     = MenuModelItem.SortValue_Bottom,
                            ShortcutKeys  = Keys.Alt | Keys.F4,
                            ActionHandler = this.quitItem_Click
                        }
                    }
                },
                new MenuModelItem {
                    Name = GeneralRes.MenuName_Edit, SortValue = MenuModelItem.SortValue_Top, Items = new[]
                    {
                        this.menuEditUndo = new MenuModelItem
                        {
                            Name          = GeneralRes.MenuItemName_Undo,
                            SortValue     = MenuModelItem.SortValue_Top,
                            Icon          = GeneralResCache.arrow_undo,
                            ShortcutKeys  = Keys.Z | Keys.Control,
                            ActionHandler = this.menuEditUndo_Click
                        },
                        this.menuEditRedo = new MenuModelItem
                        {
                            Name          = GeneralRes.MenuItemName_Redo,
                            SortValue     = MenuModelItem.SortValue_Top,
                            Icon          = GeneralResCache.arrow_redo,
                            ShortcutKeys  = Keys.Y | Keys.Control,
                            ActionHandler = this.menuEditRedo_Click
                        }
                    }
                },
                new MenuModelItem {
                    Name = GeneralRes.MenuName_Run, SortValue = MenuModelItem.SortValue_OverBottom, Items = new[]
                    {
                        this.menuRunApp = new MenuModelItem
                        {
                            Name          = this.actionRunApp.Text,
                            SortValue     = MenuModelItem.SortValue_Top,
                            Icon          = this.actionRunApp.Image,
                            ShortcutKeys  = Keys.Alt | Keys.F5,
                            Tag           = HelpInfo.FromText(this.actionRunApp.Text, GeneralRes.MenuItemInfo_RunGame),
                            ActionHandler = this.actionRunApp_Click
                        },
                        this.menuDebugApp = new MenuModelItem
                        {
                            Name          = this.actionDebugApp.Text,
                            SortValue     = MenuModelItem.SortValue_Top,
                            Icon          = this.actionDebugApp.Image,
                            ShortcutKeys  = Keys.Alt | Keys.F6,
                            Tag           = HelpInfo.FromText(this.actionDebugApp.Text, GeneralRes.MenuItemInfo_DebugGame),
                            ActionHandler = this.actionDebugApp_Click
                        },
                        this.menuProfileApp = new MenuModelItem
                        {
                            Name          = GeneralRes.MenuItemName_ProfileGame,
                            SortValue     = MenuModelItem.SortValue_Top,
                            Icon          = Properties.Resources.application_stopwatch,
                            Tag           = HelpInfo.FromText(GeneralRes.MenuItemName_ProfileGame, GeneralRes.MenuItemInfo_ProfileGame),
                            ActionHandler = this.actionProfileApp_Click
                        },
                        new MenuModelItem
                        {
                            Name          = GeneralRes.MenuItemName_ConfigureLauncher,
                            SortValue     = MenuModelItem.SortValue_Top,
                            Tag           = HelpInfo.FromText(GeneralRes.MenuItemName_ConfigureLauncher, GeneralRes.MenuItemInfo_ConfigureLauncher),
                            ActionHandler = this.actionConfigureLauncher_Click
                        },
                        new MenuModelItem
                        {
                            Name      = "TopSeparator",
                            SortValue = MenuModelItem.SortValue_Top,
                            TypeHint  = MenuItemTypeHint.Separator
                        },
                        this.menuRunSandboxPlay = new MenuModelItem
                        {
                            Name          = this.actionRunSandbox.Text,
                            Icon          = this.actionRunSandbox.Image,
                            ShortcutKeys  = Keys.F5,
                            Tag           = HelpInfo.FromText(this.actionRunSandbox.Text, GeneralRes.MenuItemInfo_SandboxPlay),
                            ActionHandler = this.actionRunSandbox_Click
                        },
                        this.menuRunSandboxStep = new MenuModelItem
                        {
                            Name          = this.actionStepSandbox.Text,
                            Icon          = this.actionStepSandbox.Image,
                            ShortcutKeys  = Keys.F6,
                            Tag           = HelpInfo.FromText(this.actionStepSandbox.Text, GeneralRes.MenuItemInfo_SandboxStep),
                            ActionHandler = this.actionStepSandbox_Click
                        },
                        this.menuRunSandboxPause = new MenuModelItem
                        {
                            Name          = this.actionPauseSandbox.Text,
                            Icon          = this.actionPauseSandbox.Image,
                            ShortcutKeys  = Keys.F7,
                            Tag           = HelpInfo.FromText(this.actionPauseSandbox.Text, GeneralRes.MenuItemInfo_SandboxPause),
                            ActionHandler = this.actionPauseSandbox_Click
                        },
                        this.menuRunSandboxStop = new MenuModelItem
                        {
                            Name          = this.actionStopSandbox.Text,
                            Icon          = this.actionStopSandbox.Image,
                            ShortcutKeys  = Keys.F8,
                            Tag           = HelpInfo.FromText(this.actionStopSandbox.Text, GeneralRes.MenuItemInfo_SandboxStop),
                            ActionHandler = this.actionStopSandbox_Click
                        },
                        new MenuModelItem
                        {
                            Name      = "BottomSeparator",
                            SortValue = MenuModelItem.SortValue_Bottom,
                            TypeHint  = MenuItemTypeHint.Separator
                        },
                        this.menuRunSandboxSlower = new MenuModelItem
                        {
                            Name          = GeneralRes.MenuItemName_SandboxSlower,
                            ShortcutKeys  = Keys.F9,
                            Tag           = HelpInfo.FromText(GeneralRes.MenuItemName_SandboxSlower, GeneralRes.MenuItemInfo_SandboxSlower),
                            ActionHandler = this.menuRunSandboxSlower_Click
                        },
                        this.menuRunSandboxFaster = new MenuModelItem
                        {
                            Name          = GeneralRes.MenuItemName_SandboxFaster,
                            ShortcutKeys  = Keys.F10,
                            Tag           = HelpInfo.FromText(GeneralRes.MenuItemName_SandboxFaster, GeneralRes.MenuItemInfo_SandboxFaster),
                            ActionHandler = this.menuRunSandboxFaster_Click
                        }
                    }
                },
                helpItem = new MenuModelItem {
                    Name = GeneralRes.MenuName_Help, SortValue = MenuModelItem.SortValue_Bottom, Items = new[]
                    {
                        new MenuModelItem
                        {
                            Name          = GeneralRes.MenuItemName_About,
                            SortValue     = MenuModelItem.SortValue_Top,
                            ActionHandler = this.aboutItem_Click
                        }
                    }
                }
            });

            // Set some view-specific properties
            ToolStripItem helpViewItem = this.mainMenuView.GetViewItem(helpItem);

            helpViewItem.Alignment = ToolStripItemAlignment.Right;

            // Attach help data to toolstrip actions
            this.actionOpenCode.Tag     = HelpInfo.FromText(this.actionOpenCode.Text, GeneralRes.MenuItemInfo_OpenProjectSource);
            this.actionSaveAll.Tag      = HelpInfo.FromText(this.actionSaveAll.Text, GeneralRes.MenuItemInfo_SaveAll);
            this.actionRunApp.Tag       = HelpInfo.FromText(this.actionRunApp.Text, GeneralRes.MenuItemInfo_RunGame);
            this.actionDebugApp.Tag     = HelpInfo.FromText(this.actionDebugApp.Text, GeneralRes.MenuItemInfo_DebugGame);
            this.actionRunSandbox.Tag   = HelpInfo.FromText(this.actionRunSandbox.Text, GeneralRes.MenuItemInfo_SandboxPlay);
            this.actionStepSandbox.Tag  = HelpInfo.FromText(this.actionStepSandbox.Text, GeneralRes.MenuItemInfo_SandboxStep);
            this.actionPauseSandbox.Tag = HelpInfo.FromText(this.actionPauseSandbox.Text, GeneralRes.MenuItemInfo_SandboxPause);
            this.actionStopSandbox.Tag  = HelpInfo.FromText(this.actionStopSandbox.Text, GeneralRes.MenuItemInfo_SandboxStop);
            this.formatUpdateAll.Tag    = HelpInfo.FromText(this.formatUpdateAll.Text, GeneralRes.MenuItemInfo_FormatUpdateAll);
        }
Ejemplo n.º 11
0
        HelpInfo IHelpProvider.ProvideHoverHelp(Point localPos, ref bool captured)
        {
            // A dropdown is opened. Provide dropdown help.
            IPopupControlHost dropdownEdit = this.FocusEditor as IPopupControlHost;

            if (dropdownEdit != null && dropdownEdit.IsDropDownOpened)
            {
                EnumPropertyEditor           enumEdit           = dropdownEdit as EnumPropertyEditor;
                FlaggedEnumPropertyEditor    enumFlagEdit       = dropdownEdit as FlaggedEnumPropertyEditor;
                ObjectSelectorPropertyEditor objectSelectorEdit = dropdownEdit as ObjectSelectorPropertyEditor;

                // Its able to provide help. Redirect.
                if (dropdownEdit is IHelpProvider)
                {
                    captured = true;
                    Point dropdownEditorPos = this.GetEditorLocation(dropdownEdit as PropertyEditor, true);
                    return((dropdownEdit as IHelpProvider).ProvideHoverHelp(new Point(localPos.X - dropdownEditorPos.X, localPos.Y - dropdownEditorPos.Y), ref captured));
                }
                // Special case: Its a known basic dropdown.
                else if (enumEdit != null)
                {
                    captured = true;
                    if (enumEdit.DropDownHoveredName != null)
                    {
                        return(HelpInfo.FromMember(enumEdit.EditedType.GetField(enumEdit.DropDownHoveredName, ReflectionHelper.BindAll)));
                    }
                    else
                    {
                        FieldInfo field = enumEdit.EditedType.GetField(enumEdit.DisplayedValue.ToString(), ReflectionHelper.BindAll);
                        if (field != null)
                        {
                            return(HelpInfo.FromMember(field));
                        }
                    }
                }
                else if (enumFlagEdit != null)
                {
                    captured = true;
                    if (enumFlagEdit.DropDownHoveredItem != null)
                    {
                        return(HelpInfo.FromMember(enumFlagEdit.EditedType.GetField(enumFlagEdit.DropDownHoveredItem.Caption, ReflectionHelper.BindAll)));
                    }
                    else
                    {
                        FieldInfo field = enumFlagEdit.EditedType.GetField(enumFlagEdit.DisplayedValue.ToString(), ReflectionHelper.BindAll);
                        if (field != null)
                        {
                            return(HelpInfo.FromMember(field));
                        }
                    }
                }
                else if (objectSelectorEdit != null)
                {
                    captured = true;
                    if (objectSelectorEdit.DropDownHoveredObject != null)
                    {
                        return(HelpInfo.FromObject(objectSelectorEdit.DropDownHoveredObject.Value));
                    }
                    else
                    {
                        return(HelpInfo.FromObject(objectSelectorEdit.DisplayedValue));
                    }
                }

                // No help available.
                return(null);
            }
            captured = false;

            // Pick an editor and see if it has access to an actual IHelpProvider
            PropertyEditor pickedEditor = this.PickEditorAt(localPos.X, localPos.Y, true);
            PropertyEditor helpEditor   = pickedEditor;

            while (helpEditor != null)
            {
                Point helpEditorPos = this.GetEditorLocation(helpEditor, true);
                if (helpEditor is IHelpProvider)
                {
                    IHelpProvider localProvider = helpEditor as IHelpProvider;
                    HelpInfo      localHelp     = localProvider.ProvideHoverHelp(new Point(localPos.X - helpEditorPos.X, localPos.Y - helpEditorPos.Y), ref captured);
                    if (localHelp != null)
                    {
                        return(localHelp);
                    }
                }
                helpEditor = helpEditor.ParentEditor;
            }

            // If not, default to member or type information
            if (pickedEditor != null)
            {
                if (!string.IsNullOrEmpty(pickedEditor.PropertyDesc))
                {
                    return(HelpInfo.FromText(pickedEditor.PropertyName, pickedEditor.PropertyDesc));
                }
                else if (pickedEditor.EditedMember != null)
                {
                    return(HelpInfo.FromMember(pickedEditor.EditedMember));
                }
                else if (pickedEditor.EditedType != null)
                {
                    return(HelpInfo.FromMember(pickedEditor.EditedType));
                }
            }

            return(null);
        }
Ejemplo n.º 12
0
        public void InitMenus()
        {
            ToolStripMenuItem fileItem       = this.RequestMenu(GeneralRes.MenuName_File);
            ToolStripMenuItem newProjectItem = this.RequestMenu(GeneralRes.MenuName_File, GeneralRes.MenuItemName_NewProject);

            this.RequestSeparator(GeneralRes.MenuName_File, "SaveSeparator");
            ToolStripMenuItem saveAllItem = this.RequestMenu(GeneralRes.MenuName_File, this.actionSaveAll.Text);

            this.RequestSeparator(GeneralRes.MenuName_File, "CodeSeparator");
            ToolStripMenuItem openCodeItem = this.RequestMenu(GeneralRes.MenuName_File, this.actionOpenCode.Text);

            this.RequestSeparator(GeneralRes.MenuName_File, "EndSeparator");
            ToolStripMenuItem quitItem = this.RequestMenu(GeneralRes.MenuName_File, GeneralRes.MenuItemName_Quit);
            ToolStripMenuItem editItem = this.RequestMenu(GeneralRes.MenuName_Edit);

            this.menuEditUndo = this.RequestMenu(GeneralRes.MenuName_Edit, GeneralRes.MenuItemName_Undo);
            this.menuEditRedo = this.RequestMenu(GeneralRes.MenuName_Edit, GeneralRes.MenuItemName_Redo);
            ToolStripMenuItem viewItem           = this.RequestMenu(GeneralRes.MenuName_View);
            ToolStripMenuItem runItem            = this.RequestMenu(GeneralRes.MenuName_Run);
            ToolStripMenuItem runGameItem        = this.RequestMenu(GeneralRes.MenuName_Run, this.actionRunApp.Text);
            ToolStripMenuItem debugGameItem      = this.RequestMenu(GeneralRes.MenuName_Run, this.actionDebugApp.Text);
            ToolStripMenuItem profileGameItem    = this.RequestMenu(GeneralRes.MenuName_Run, GeneralRes.MenuItemName_ProfileGame);
            ToolStripMenuItem configLauncherItem = this.RequestMenu(GeneralRes.MenuName_Run, GeneralRes.MenuItemName_ConfigureLauncher);

            this.RequestSeparator(GeneralRes.MenuName_Run, "SandboxSeparator");
            this.menuRunSandboxPlay  = this.RequestMenu(GeneralRes.MenuName_Run, this.actionRunSandbox.Text);
            this.menuRunSandboxStep  = this.RequestMenu(GeneralRes.MenuName_Run, this.actionStepSandbox.Text);
            this.menuRunSandboxPause = this.RequestMenu(GeneralRes.MenuName_Run, this.actionPauseSandbox.Text);
            this.menuRunSandboxStop  = this.RequestMenu(GeneralRes.MenuName_Run, this.actionStopSandbox.Text);
            this.RequestSeparator(GeneralRes.MenuName_Run, "SandboxDebugSeparator");
            this.menuRunSandboxSlower = this.RequestMenu(GeneralRes.MenuName_Run, GeneralRes.MenuItemName_SandboxSlower);
            this.menuRunSandboxFaster = this.RequestMenu(GeneralRes.MenuName_Run, GeneralRes.MenuItemName_SandboxFaster);
            ToolStripMenuItem helpItem  = this.RequestMenu(GeneralRes.MenuName_Help);
            ToolStripMenuItem aboutItem = this.RequestMenu(GeneralRes.MenuName_Help, GeneralRes.MenuItemName_About);

            // ---------- File ----------
            newProjectItem.Image  = EditorRes.GeneralResCache.ImageAppCreate;
            newProjectItem.Click += this.newProjectItem_Click;
            newProjectItem.Tag    = HelpInfo.FromText(newProjectItem.Text, GeneralRes.MenuItemInfo_NewProject);

            saveAllItem.Image        = this.actionSaveAll.Image;
            saveAllItem.ShortcutKeys = Keys.Control | Keys.S;
            saveAllItem.Click       += this.actionSaveAll_Click;
            saveAllItem.Tag          = HelpInfo.FromText(saveAllItem.Text, GeneralRes.MenuItemInfo_SaveAll);

            openCodeItem.Image  = this.actionOpenCode.Image;
            openCodeItem.Click += this.actionOpenCode_Click;
            openCodeItem.Tag    = HelpInfo.FromText(openCodeItem.Text, GeneralRes.MenuItemInfo_OpenProjectSource);

            quitItem.Click       += this.quitItem_Click;
            quitItem.ShortcutKeys = Keys.Alt | Keys.F4;

            // ---------- Edit ----------
            this.menuEditUndo.ShortcutKeys = Keys.Z | Keys.Control;
            this.menuEditUndo.Click       += this.menuEditUndo_Click;
            this.menuEditUndo.Image        = GeneralResCache.arrow_undo;

            this.menuEditRedo.ShortcutKeys = Keys.Y | Keys.Control;
            this.menuEditRedo.Click       += this.menuEditRedo_Click;
            this.menuEditRedo.Image        = GeneralResCache.arrow_redo;

            // ---------- Run ----------
            runGameItem.Image        = this.actionRunApp.Image;
            runGameItem.Click       += this.actionRunApp_Click;
            runGameItem.ShortcutKeys = Keys.Alt | Keys.F5;
            runGameItem.Tag          = HelpInfo.FromText(runGameItem.Text, GeneralRes.MenuItemInfo_RunGame);

            debugGameItem.Image        = this.actionDebugApp.Image;
            debugGameItem.Click       += this.actionDebugApp_Click;
            debugGameItem.Enabled      = this.actionDebugApp.Enabled;
            debugGameItem.ShortcutKeys = Keys.Alt | Keys.F6;
            debugGameItem.Tag          = HelpInfo.FromText(debugGameItem.Text, GeneralRes.MenuItemInfo_DebugGame);

            profileGameItem.Image  = Properties.Resources.application_stopwatch;
            profileGameItem.Click += this.actionProfileApp_Click;
            profileGameItem.Tag    = HelpInfo.FromText(profileGameItem.Text, GeneralRes.MenuItemInfo_ProfileGame);

            configLauncherItem.Click += this.actionConfigureLauncher_Click;
            configLauncherItem.Tag    = HelpInfo.FromText(configLauncherItem.Text, GeneralRes.MenuItemInfo_ConfigureLauncher);

            this.menuRunSandboxPlay.Image        = this.actionRunSandbox.Image;
            this.menuRunSandboxPlay.Click       += this.actionRunSandbox_Click;
            this.menuRunSandboxPlay.ShortcutKeys = Keys.F5;
            this.menuRunSandboxPlay.Tag          = HelpInfo.FromText(this.menuRunSandboxPlay.Text, GeneralRes.MenuItemInfo_SandboxPlay);

            this.menuRunSandboxStep.Image        = this.actionStepSandbox.Image;
            this.menuRunSandboxStep.Click       += this.actionStepSandbox_Click;
            this.menuRunSandboxStep.ShortcutKeys = Keys.F6;
            this.menuRunSandboxStep.Tag          = HelpInfo.FromText(this.menuRunSandboxStep.Text, GeneralRes.MenuItemInfo_SandboxStep);

            this.menuRunSandboxPause.Image        = this.actionPauseSandbox.Image;
            this.menuRunSandboxPause.Click       += this.actionPauseSandbox_Click;
            this.menuRunSandboxPause.ShortcutKeys = Keys.F7;
            this.menuRunSandboxPause.Tag          = HelpInfo.FromText(this.menuRunSandboxPause.Text, GeneralRes.MenuItemInfo_SandboxPause);

            this.menuRunSandboxStop.Image        = this.actionStopSandbox.Image;
            this.menuRunSandboxStop.Click       += this.actionStopSandbox_Click;
            this.menuRunSandboxStop.ShortcutKeys = Keys.F8;
            this.menuRunSandboxStop.Tag          = HelpInfo.FromText(this.menuRunSandboxStop.Text, GeneralRes.MenuItemInfo_SandboxStop);

            this.menuRunSandboxSlower.Click       += this.menuRunSandboxSlower_Click;
            this.menuRunSandboxSlower.ShortcutKeys = Keys.F9;
            this.menuRunSandboxSlower.Tag          = HelpInfo.FromText(this.menuRunSandboxSlower.Text, GeneralRes.MenuItemInfo_SandboxSlower);

            this.menuRunSandboxFaster.Click       += this.menuRunSandboxFaster_Click;
            this.menuRunSandboxFaster.ShortcutKeys = Keys.F10;
            this.menuRunSandboxFaster.Tag          = HelpInfo.FromText(this.menuRunSandboxFaster.Text, GeneralRes.MenuItemInfo_SandboxFaster);

            // ---------- Help ----------
            helpItem.Alignment = ToolStripItemAlignment.Right;
            aboutItem.Click   += this.aboutItem_Click;

            // Attach help data to toolstrip actions
            this.actionOpenCode.Tag     = HelpInfo.FromText(this.actionOpenCode.Text, GeneralRes.MenuItemInfo_OpenProjectSource);
            this.actionSaveAll.Tag      = HelpInfo.FromText(this.actionSaveAll.Text, GeneralRes.MenuItemInfo_SaveAll);
            this.actionRunApp.Tag       = HelpInfo.FromText(this.actionRunApp.Text, GeneralRes.MenuItemInfo_RunGame);
            this.actionDebugApp.Tag     = HelpInfo.FromText(this.actionDebugApp.Text, GeneralRes.MenuItemInfo_DebugGame);
            this.actionRunSandbox.Tag   = HelpInfo.FromText(this.actionRunSandbox.Text, GeneralRes.MenuItemInfo_SandboxPlay);
            this.actionStepSandbox.Tag  = HelpInfo.FromText(this.actionStepSandbox.Text, GeneralRes.MenuItemInfo_SandboxStep);
            this.actionPauseSandbox.Tag = HelpInfo.FromText(this.actionPauseSandbox.Text, GeneralRes.MenuItemInfo_SandboxPause);
            this.actionStopSandbox.Tag  = HelpInfo.FromText(this.actionStopSandbox.Text, GeneralRes.MenuItemInfo_SandboxStop);
            this.formatUpdateAll.Tag    = HelpInfo.FromText(this.formatUpdateAll.Text, GeneralRes.MenuItemInfo_FormatUpdateAll);
        }