Beispiel #1
0
 public void AddGlobalItem(IEditorComponent component, MenuCommand command)
 {
     ToolStripButton button = new ToolStripButton(string.Empty, Factory.GUIController.ImageList.Images[command.IconKey], new EventHandler(ToolbarEventHandler), command.ID);
     button.Tag = component;
     button.ToolTipText = command.Name;
     _toolBar.Items.Add(button);
 }
        public BuildCommandsComponent(GUIController guiController, AGSEditor agsEditor)
            : base(guiController, agsEditor)
        {
            ScriptEditor.AttemptToEditScript += new ScriptEditor.AttemptToEditScriptHandler(ScriptEditor_AttemptToEditScript);
            _guiController.QueryEditorShutdown += new GUIController.QueryEditorShutdownHandler(guiController_QueryEditorShutdown);
            _guiController.InteractiveTasks.TestGameStarting += new InteractiveTasks.TestGameStartingHandler(AGSEditor_TestGameStarting);
            _guiController.InteractiveTasks.TestGameFinished += new InteractiveTasks.TestGameFinishedHandler(AGSEditor_TestGameFinished);
            _guiController.RegisterIcon("BuildIcon", Resources.ResourceManager.GetIcon("build.ico"));
            _guiController.RegisterIcon("RunIcon", Resources.ResourceManager.GetIcon("run.ico"));
            _guiController.RegisterIcon("StepIcon", Resources.ResourceManager.GetIcon("step.ico"));
            _guiController.RegisterIcon("StopIcon", Resources.ResourceManager.GetIcon("stop.ico"));
            _guiController.RegisterIcon("PauseIcon", Resources.ResourceManager.GetIcon("pause.ico"));
            _guiController.RegisterIcon("RunMenuIcon", Resources.ResourceManager.GetIcon("menu_build_run.ico"));
            _guiController.RegisterIcon("StepMenuIcon", Resources.ResourceManager.GetIcon("menu_build_step-into.ico"));
            _guiController.RegisterIcon("StopMenuIcon", Resources.ResourceManager.GetIcon("menu_build_stop.ico"));
            _guiController.RegisterIcon("PauseMenuIcon", Resources.ResourceManager.GetIcon("menu_build_pause.ico"));
            _guiController.RegisterIcon("RebuildAllMenuIcon", Resources.ResourceManager.GetIcon("menu_build_rebuild-files.ico"));
            _guiController.RegisterIcon("SetupGameMenuIcon", Resources.ResourceManager.GetIcon("menu_build_gamesetup.ico"));

            _guiController.RegisterIcon("MenuIconBuildEXE", Resources.ResourceManager.GetIcon("menu_file_built-exe.ico"));
            _guiController.RegisterIcon("MenuIconTest", Resources.ResourceManager.GetIcon("menu_build_runwithout.ico"));

            _guiController.AddMenu(this, DEBUG_MENU_ID, "&Build");
            MenuCommands debugCommands = new MenuCommands(DEBUG_MENU_ID, GUIController.FILE_MENU_ID);
            debugCommands.Commands.Add(new MenuCommand(RUN_COMMAND, "&Run", Keys.F5, "RunMenuIcon"));
            debugCommands.Commands.Add(new MenuCommand(TEST_GAME_COMMAND, "Run without &debugger", Keys.Control | Keys.F5, "MenuIconTest"));
            debugCommands.Commands.Add(new MenuCommand(STEP_INTO_COMMAND, "S&tep into", Keys.F11, "StepMenuIcon"));
            debugCommands.Commands.Add(new MenuCommand(PAUSE_COMMAND, "&Pause", "PauseMenuIcon"));
            debugCommands.Commands.Add(new MenuCommand(STOP_COMMAND, "&Stop", "StopMenuIcon"));
            debugCommands.Commands.Add(MenuCommand.Separator);
            debugCommands.Commands.Add(new MenuCommand(COMPILE_GAME_COMMAND, "&Build EXE", Keys.F7, "MenuIconBuildEXE"));
            debugCommands.Commands.Add(new MenuCommand(REBUILD_GAME_COMMAND, "Rebuild &all files", "RebuildAllMenuIcon"));
            debugCommands.Commands.Add(new MenuCommand(SETUP_GAME_COMMAND, "Run game setu&p...", "SetupGameMenuIcon"));
            _guiController.AddMenuItems(this, debugCommands);

            _guiController.SetMenuItemEnabled(this, STEP_INTO_COMMAND, false);
            _guiController.SetMenuItemEnabled(this, PAUSE_COMMAND, false);
            _guiController.SetMenuItemEnabled(this, STOP_COMMAND, false);

            MenuCommand buildIcon = new MenuCommand(COMPILE_GAME_COMMAND, "Build game EXE (F7)", "BuildIcon");
            MenuCommand runIcon = new MenuCommand(RUN_COMMAND, "Run (F5)", "RunIcon");
            MenuCommand stopIcon = new MenuCommand(STOP_COMMAND, "Stop", "StopIcon");
            MenuCommand stepIcon = new MenuCommand(STEP_INTO_COMMAND, "Step into (F11)", "StepIcon");
            MenuCommand pauseIcon = new MenuCommand(PAUSE_COMMAND, "Pause", "PauseIcon");
            stepIcon.Enabled = false;
            stopIcon.Enabled = false;
            pauseIcon.Enabled = false;
            _debugToolbarCommands.Add(buildIcon);
            _debugToolbarCommands.Add(runIcon);
            _debugToolbarCommands.Add(pauseIcon);
            _debugToolbarCommands.Add(stepIcon);
            _debugToolbarCommands.Add(stopIcon);
            Factory.ToolBarManager.AddGlobalItems(this, _debugToolbarCommands);
            Factory.ToolBarManager.UpdateItemEnabledStates(_debugToolbarCommands);

            _agsEditor.Debugger.DebugStateChanged += new DebugController.DebugStateChangedHandler(Debugger_DebugStateChanged);
            _agsEditor.AttemptToSaveGame += new AGSEditor.AttemptToSaveGameHandler(_agsEditor_AttemptToSaveGame);
        }
        public FileCommandsComponent(GUIController guiController, AGSEditor agsEditor)
            : base(guiController, agsEditor)
        {
            _guiController.InteractiveTasks.TestGameStarting += new InteractiveTasks.TestGameStartingHandler(AGSEditor_TestGameStarting);
            _guiController.InteractiveTasks.TestGameFinished += new InteractiveTasks.TestGameFinishedHandler(AGSEditor_TestGameFinished);

            _guiController.RegisterIcon("OpenIcon", Resources.ResourceManager.GetIcon("open.ico"));
            _guiController.RegisterIcon("SaveIcon", Resources.ResourceManager.GetIcon("save.ico"));

            _guiController.RegisterIcon("MenuIconAutoNumber", Resources.ResourceManager.GetIcon("menu_file_auto-number.ico"));
            _guiController.RegisterIcon("MenuIconExit", Resources.ResourceManager.GetIcon("menu_file_exit.ico"));
            _guiController.RegisterIcon("MenuIconMakeTemplate", Resources.ResourceManager.GetIcon("menu_file_make-template.ico"));
            _guiController.RegisterIcon("MenuIconOpen", Resources.ResourceManager.GetIcon("menu_file_open.ico"));
            _guiController.RegisterIcon("MenuIconPreferences", Resources.ResourceManager.GetIcon("menu_file_preferences.ico"));
            _guiController.RegisterIcon("MenuIconSave", Resources.ResourceManager.GetIcon("menu_file_save.ico"));
            _guiController.RegisterIcon("MenuIconStatistics", Resources.ResourceManager.GetIcon("menu_file_stats.ico"));
            _guiController.RegisterIcon("MenuIconVoiceActingScript", Resources.ResourceManager.GetIcon("menu_file_voicescript.ico"));
            _guiController.RegisterIcon("MenuIconGoToEventsGrid", Resources.ResourceManager.GetIcon("menu_file_eventsgrid.ico"));

            MenuCommands commands = new MenuCommands(GUIController.FILE_MENU_ID, 0);
            commands.Commands.Add(new MenuCommand(OPEN_GAME_COMMAND, "&Open...", Keys.Control | Keys.L, "MenuIconOpen"));
            commands.Commands.Add(new MenuCommand(SAVE_GAME_COMMAND, "&Save", Keys.Control | Keys.S, "MenuIconSave"));
            commands.Commands.Add(new MenuCommand(GAME_STATS_COMMAND, "&Game statistics", Keys.F2, "MenuIconStatistics"));
            commands.Commands.Add(new MenuCommand(JUMP_TO_EVENTS_TAB_COMMAND, "&Go to Events grid", Keys.F4, "MenuIconGoToEventsGrid"));
            _guiController.AddMenuItems(this, commands);

            commands = new MenuCommands(GUIController.FILE_MENU_ID, 100);
            commands.Commands.Add(new MenuCommand(MAKE_TEMPLATE_COMMAND, "&Make template from this game...", "MenuIconMakeTemplate"));
            commands.Commands.Add(new MenuCommand(AUTO_NUMBER_SPEECH_COMMAND, "&Auto-number speech lines...", "MenuIconAutoNumber"));
            commands.Commands.Add(new MenuCommand(CREATE_VOICE_ACTING_SCRIPT_COMMAND, "Create &voice acting script...", "MenuIconVoiceActingScript"));
            commands.Commands.Add(new MenuCommand(REMOVE_GLOBAL_MESSAGES_COMMAND, "&Remove Global Messages"));
            _guiController.AddMenuItems(this, commands);

            commands = new MenuCommands(GUIController.FILE_MENU_ID, 400);
            commands.Commands.Add(new MenuCommand(SHOW_PREFERENCES_COMMAND, "&Preferences...", "MenuIconPreferences"));
            _guiController.AddMenuItems(this, commands);

            commands = new MenuCommands(GUIController.FILE_MENU_ID, 9999);
            commands.Commands.Add(new MenuCommand(EXIT_COMMAND, "E&xit", Keys.Control | Keys.Q, "MenuIconExit"));
            _guiController.AddMenuItems(this, commands);

            MenuCommand openIcon = new MenuCommand(OPEN_GAME_COMMAND, "Open game (Ctrl+L)", "OpenIcon");
            MenuCommand saveIcon = new MenuCommand(SAVE_GAME_COMMAND, "Save game (Ctrl+S)", "SaveIcon");
            _toolbarCommands.Add(openIcon);
            _toolbarCommands.Add(saveIcon);
            Factory.ToolBarManager.AddGlobalItems(this, _toolbarCommands);
        }
Beispiel #4
0
 public MenuCommand CreateMenuCommand(IEditorComponent component, string commandID, string commandName)
 {
     MenuCommand newCommand = new MenuCommand(commandID, commandName);
     newCommand.ID = RegisterMenuCommand(commandID, component);
     return newCommand;
 }
Beispiel #5
0
 public virtual void GetContextMenu(IList<MenuCommand> menu)
 {
     MenuCommand editCommand = new MenuCommand(Namespace + FullName + "::Edit", "Edit");
     editCommand.Enabled = Editable;
     menu.Add(editCommand);
     MenuCommand delCommand = new MenuCommand(Namespace + FullName + "::Delete", "Delete");
     if (ParentTable == null)
     {
         delCommand.Enabled = false;
     }
     menu.Add(delCommand);
 }
Beispiel #6
0
        public override IList<MenuCommand> GetContextMenu(string controlID)
        {
            if (controlID == TOP_LEVEL_COMMAND_ID)
            {
                return null;
            }
            IList<MenuCommand> contextMenu = new List<MenuCommand>();
            _rightClickedPlugin = GetPluginByFileName(controlID.Substring(3));

            MenuCommand useThisPluginCmd = new MenuCommand(MENU_ITEM_ENABLED, "Use this plugin", null);
            useThisPluginCmd.Checked = _rightClickedPlugin.Enabled;
            contextMenu.Add(useThisPluginCmd);

            MenuCommand propertiesCmd = new MenuCommand(MENU_ITEM_PROPERTIES, "Plugin properties...", null);
            propertiesCmd.Enabled = (_rightClickedPlugin.HasProperties && _rightClickedPlugin.Enabled);
            contextMenu.Add(propertiesCmd);

            return contextMenu;
        }
 // hack...
 /*
 private LuaScriptEditPane CurrentEditor
 {
     get
     {
         PropertyInfo prop = _editor.GUIController.GetType().GetProperty("ActivePane");
         ContentDocument cdoc = prop.GetValue(_editor.GUIController, null) as ContentDocument;
         return (cdoc == null) ? null : cdoc.Control as LuaScriptEditPane;
     }
 }
 */
 IList<MenuCommand> IEditorComponent.GetContextMenu(string controlID)
 {
     List<MenuCommand> contextMenu = new List<MenuCommand>();
     if (controlID == CONTROL_ID_LUA)
     {
         MenuCommand enabled = new MenuCommand(CONTROL_ID_ENABLE, "Enable Lua features?");
         enabled.Checked = IsPluginEnabled;
         contextMenu.Add(enabled);
     }
     else if (controlID.StartsWith(COMPILETIMEENTRY_PREFIX))
     {
         int index = int.Parse(controlID.Substring(COMPILETIMEENTRY_PREFIX.Length));
         contextMenu.Add(new MenuCommand(controlID, "Go to Script"));
         contextMenu.Add(new MenuCommand("-", "-"));
         if (index > 0)
         {
             contextMenu.Add(new MenuCommand(CTSCRIPT_MOVEUP_PREFIX + index, "Move Up (Run Earlier)"));
         }
         if (index < compileTimeScripts.Count-1)
         {
             contextMenu.Add(new MenuCommand(CTSCRIPT_MOVEDOWN_PREFIX + index, "Move Down (Run Later)"));
         }
         contextMenu.Add(new MenuCommand(CTSCRIPT_REMOVE_PREFIX + index, "Remove Action"));
     }
     else if (controlID.StartsWith(SCRIPTS_ROOT))
     {
         if (controlID.EndsWith("/"))
         {
             contextMenu.Add(new MenuCommand(NEWSCRIPT_PREFIX + controlID, "New Lua Script"));
             if (controlID == SCRIPTS_ROOT)
             {
                 contextMenu.Add(new MenuCommand(NEWFOLDER_PREFIX + controlID, "New Folder"));
             }
             else
             {
                 contextMenu.Add(new MenuCommand(NEWFOLDER_PREFIX + controlID, "New Subfolder"));
                 contextMenu.Add(new MenuCommand(DELETEFOLDER_PREFIX + controlID, "Delete Folder"));
                 contextMenu.Add(new MenuCommand(RENAMEFOLDER_PREFIX + controlID, "Rename Folder"));
             }
         }
         else
         {
             LuaScriptFileInfo script = scripts[controlID];
             contextMenu.Add(new MenuCommand(DELETESCRIPT_PREFIX + controlID, "Delete"));
             contextMenu.Add(new MenuCommand(RENAMESCRIPT_PREFIX + controlID, "Rename"));
             contextMenu.Add(new MenuCommand("-", "-"));
             MenuCommand includeCommand = new MenuCommand(INCLUDESCRIPT_PREFIX + controlID, "Include in Run-Time Scripts Store?");
             includeCommand.Checked = script.IncludeAtRunTime;
             contextMenu.Add(includeCommand);
     #if USE_EVENT_ACTIONS
             contextMenu.Add(new MenuCommand("-", "-"));
             contextMenu.Add(new MenuCommand(COMPILETIME_PREFIX + controlID, "Add Compile-Time Action: Run Script"));
     #endif
         }
     }
     else if (controlID.StartsWith(VISUAL_ROOT))
     {
         VisualLuaValue val;
         if (!visualValues.TryGetValue(controlID, out val))
         {
             MessageBox.Show("Cannot find Visual Value " + controlID + "!");
         }
         else
         {
             val.GetContextMenu(contextMenu);
         }
     }
     return contextMenu;
 }