Пример #1
0
        /// <summary>
        /// Called when the current document is saved,
        /// no matter if the document is a Progress file or not
        /// </summary>
        public static void DoNppDocumentSaved()
        {
            // the user can open a .txt and save it as a .p
            DoNppDocumentSwitched();

            // update function prototypes
            if (IsCurrentFileProgress)
            {
                ProGenerateCode.UpdateFunctionPrototypesIfNeeded(true);
            }

            // if it's a conf file, import it
            ShareExportConf.TryToImportFile(CurrentFilePath);
        }
Пример #2
0
        private AppliMenu()
        {
            // List of item that can be assigned to a shortcut
            ShortcutableItemList = new List <MenuItem> {
                // add the main menu here, so it can appear in the list of shortcut to set
                new MenuItem(null, "Open main menu", ImageResources.logo20x20, ShowMainMenuAtCursor, "Show_main_menu", "F6")
                {
                    Generic = true
                }
            };

            #region Environments

            // subscribe to env change event so the Env menu is always up to date
            ProEnvironment.OnEnvironmentChange += RebuildSwitchEnvMenu;
            _envMenu = new MenuItem(this, "Switch environment", ImageResources.Env, ShowEnvMenuAtCursor, "Switch_env", "Ctrl+E")
            {
                Generic = true
            };
            RebuildSwitchEnvMenu();

            #endregion

            #region Generate code

            _generateCodeMenuList = new List <MenuItem> {
                new MenuItem(this, "Insert new internal procedure", ImageResources.Procedure, ProGenerateCode.InsertCode <ParsedProcedure>, "Insert_new_procedure", "Alt+P"),
                new MenuItem(this, "Insert new function", ImageResources.Function, ProGenerateCode.InsertCode <ParsedImplementation>, "Insert_new_function", "Alt+F"),
                new MenuItem(true), // --------------------------
                new MenuItem(this, "Delete existing internal procedure", ImageResources.DeleteProcedure, ProGenerateCode.DeleteCode <ParsedProcedure>, "Delete_procedure", ""),
                new MenuItem(this, "Delete existing function", ImageResources.DeleteFunction, ProGenerateCode.DeleteCode <ParsedImplementation>, "Delete_function", ""),
                new MenuItem(true), // --------------------------
                new MenuItem(this, "Synchronize fonction prototypes", ImageResources.Synchronize, () => ProGenerateCode.UpdateFunctionPrototypesIfNeeded(), "Synchronize_prototypes", "Alt+S"),
            };

            #endregion

            #region Edit code

            _editCodeList = new List <MenuItem> {
                new MenuItem(this, "Toggle comment line", ImageResources.ToggleComment, ProGenerateCode.ToggleComment, "Toggle_Comment", "Ctrl+Q"),
                //new MenuItem(this, "Format document", ImageResources.FormatCode, CodeBeautifier.CorrectCodeIndentation, "Format_document", "Ctrl+I"),
            };

            #endregion

            #region Misc

            _miscMenuList = new List <MenuItem> {
                new MenuItem(this, "Edit current file info", ImageResources.FileInfo, () => Appli.Appli.GoToPage(PageNames.FileInfo), "Edit_file_info", "Ctrl+Shift+M"),
                new MenuItem(this, "Insert title block", ImageResources.TitleBlock, ProGenerateCode.AddTitleBlockAtCaret, "Insert_title_block", "Ctrl+Alt+M"),
                new MenuItem(this, "Surround with modification tags", ImageResources.ModificationTag, ProGenerateCode.SurroundSelectionWithTag, "Modif_tags", "Ctrl+M"),
                //new MenuItem(this, "Insert mark", ImageResources.InsertMark, null, "Insert_mark", "Ctrl+T"),
            };

            #endregion

            #region database tools

            _databaseTools = new List <MenuItem> {
                new MenuItem(this, "Open data administration", ImageResources.DataAdmin, ProMisc.OpenDbAdmin, "Data_admin", "")
                {
                    Generic = true
                },
                new MenuItem(this, "Open progress dictionary", ImageResources.Dictionary, ProMisc.OpenDictionary, "Data_dictionary", "")
                {
                    Generic = true
                },
                new MenuItem(true), // --------------------------
                new MenuItem(this, "Explore and modify your data", ImageResources.DataDigger, ProMisc.OpenDataDigger, "Data_digger", "")
                {
                    Generic = true
                },
                new MenuItem(this, "Explore (read-only) your data", ImageResources.DataReader, ProMisc.OpenDataReader, "Data_reader", "")
                {
                    Generic = true
                },
            };

            #endregion

            #region Main menu

            var goToDefItem = new MenuItem(this, "Go to definition", ImageResources.GoToDefinition, ProMisc.GoToDefinition, "Go_To_Definition", "Ctrl+B");
            goToDefItem.SubText = "Middle click  /  " + goToDefItem.SubText;
            var goToPreviousJump = new MenuItem(this, "Go to previous jump point", ImageResources.GoBackward, Npp.GoBackFromDefinition, "Go_Backwards", "Ctrl+Shift+B")
            {
                Generic = true
            };
            goToPreviousJump.SubText = "Ctrl + Middle click  /  " + goToPreviousJump.SubText;

            _mainMenuList = new List <MenuItem> {
                new MenuItem(this, "Show main window", ImageResources.MainWindow, Appli.Appli.ToggleView, "Open_main_window", "Alt+Space")
                {
                    Generic = true
                },
                new MenuItem(this, "Show auto-completion at caret", ImageResources.Autocompletion, AutoComplete.OnShowCompleteSuggestionList, "Show_Suggestion_List", "Ctrl+Space"),
                new MenuItem(true), // --------------------------
                new MenuItem(this, "Open 4GL help", ImageResources.ProgressHelp, ProMisc.Open4GlHelp, "Open_4GL_help", "F1")
                {
                    Generic = true
                },
                new MenuItem(this, "Check syntax", ImageResources.CheckCode, () => ProMisc.StartProgressExec(ExecutionType.CheckSyntax), "Check_syntax", "Shift+F1"),
                new MenuItem(this, "Compile", ImageResources.CompileCode, () => ProMisc.StartProgressExec(ExecutionType.Compile), "Compile", "Alt+F1"),
                new MenuItem(this, "Run program", ImageResources.RunCode, () => ProMisc.StartProgressExec(ExecutionType.Run), "Run_program", "Ctrl+F1"),
                new MenuItem(this, "Prolint code", ImageResources.ProlintCode, () => ProMisc.StartProgressExec(ExecutionType.Prolint), "Prolint", "F12"),
                new MenuItem(this, "Deploy current file", ImageResources.Deploy, ProMisc.DeployCurrentFile, "Deploy", "Ctrl+Alt+Prior")
                {
                    Generic = true
                },
                new MenuItem(true), // --------------------------
                new MenuItem(this, "Progress desktop", ImageResources.ProDesktop, ProMisc.OpenProDesktop, "Pro_desktop", "")
                {
                    Generic = true
                },
                new MenuItem(this, "Open in the AppBuilder", ImageResources.SendToAppbuilder, ProMisc.OpenCurrentInAppbuilder, "Send_appbuilder", "Alt+O"),
                new MenuItem(true), // --------------------------
                new MenuItem(this, "Start searching files", ImageResources.Search, FileExplorer.FileExplorer.StartSearch, "Search_file", "Alt+Q")
                {
                    Generic = true
                },
                goToDefItem,
                goToPreviousJump,
                //new MenuItem(this, "New 4GL file", ImageResources.GenerateCode, ShowNewFileAtCursor, "New_file", "Ctrl+Shift+N") {
                //    Children = GenerateCodeMenuList.Select(item => (YamuiMenuItem)item).ToList(),
                //},
                new MenuItem(true), // --------------------------
                _envMenu,
                new MenuItem(this, "Database tools", ImageResources.DatabaseTools, ShowDatabaseToolsMenuAtCursor, "DatabaseTools", "Alt+D")
                {
                    Generic  = true,
                    Children = _databaseTools.Select(item => (YamuiMenuItem)item).ToList(),
                },
                new MenuItem(this, "Generate and revise code", ImageResources.GenerateCode, ShowGenerateCodeMenuAtCursor, "Generate_code", "Alt+Insert")
                {
                    Children = _generateCodeMenuList.Select(item => (YamuiMenuItem)item).ToList(),
                },
                new MenuItem(this, "Edit code", ImageResources.EditCode, ShowEditCodeMenuAtCursor, "Edit_code", "Alt+E")
                {
                    Children = _editCodeList.Select(item => (YamuiMenuItem)item).ToList(),
                },
                new MenuItem(this, "Miscellaneous", ImageResources.Miscellaneous, ShowMiscMenuAtCursor, "Miscellaneous", "Alt+M")
                {
                    Children = _miscMenuList.Select(item => (YamuiMenuItem)item).ToList(),
                },
                new MenuItem(true), // --------------------------
                new MenuItem(this, "Options", ImageResources.ShowOptions, () => Appli.Appli.GoToPage(PageNames.OptionsGeneral), "Go_to_options", null)
                {
                    Generic = true
                }
            };

            #endregion

            #region special dev

            if (Config.IsDevelopper)
            {
                _mainMenuList.Add(
                    new MenuItem(this, "Tests", ImageResources.Tests, null, null, null, new List <MenuItem> {
                    new MenuItem(this, "DebugTest1", ImageResources.TestTube, PlugDebug.DebugTest1, "DebugTest1", "Ctrl+OemQuotes")
                    {
                        Generic = true
                    },
                    new MenuItem(this, "DebugTest2", ImageResources.TestTube, PlugDebug.DebugTest2, "DebugTest2", "Alt+OemQuotes")
                    {
                        Generic = true
                    },
                    new MenuItem(this, "DebugTest3", ImageResources.TestTube, PlugDebug.DebugTest3, "DebugTest3", "Shift+OemQuotes")
                    {
                        Generic = true
                    },
                })
                {
                    Generic = true
                });
            }

            #endregion
        }