public SchemeIncrementalSearch(TempSettings tempSettings, Settings settings) : base(
         tempSettings,
         "Preview color scheme" + (settings.scheme.initedByConfig ? " - need configure to save" : ""),
         "Preview color scheme",
         null)
 {
 }
Beispiel #2
0
        private void BuildRecentItems(MenuItem root)
        {
            TempSettings tempSettings = menu.mainForm.TempSettings;

            if (tempSettings == null)
            {
                MenuItem item = new MenuItem("[Not loaded yet]");
                item.Enabled = false;
                MenuItems.Add(item);
                return;
            }
            string        currendDir = Directory.GetCurrentDirectory().ToLowerInvariant() + "\\";
            List <string> files      = tempSettings.GetRecentlyFiles();
            int           count      = 0;

            for (int i = files.Count; i-- > 0;)
            {
                string file = files[i];
                ++count;
                if (count > 20)
                {
                    break;
                }
                MenuItem item = new MenuItem(
                    file.ToLowerInvariant().StartsWith(currendDir) ? file.Substring(currendDir.Length) : file,
                    new MenuItemRecentFileDelegate(menu.mainForm, file).OnClick);
                root.MenuItems.Add(item);
            }
        }
Beispiel #3
0
    public void Execute(MainForm mainForm, TempSettings tempSettings, Buffer lastBuffer)
    {
        this.mainForm     = mainForm;
        this.lastBuffer   = lastBuffer;
        this.tempSettings = tempSettings;

        editorText = lastBuffer.Controller.Lines.GetText();
        place      = lastBuffer.Controller.Lines.PlaceOf(lastBuffer.Controller.LastSelection.Left);
        name       = lastBuffer.Controller.GetWord(place);
        if (!CommonHelper.IsIdentifier(name) && place.iChar > 0)
        {
            Place place2 = place;
            --place2.iChar;
            string name2 = lastBuffer.Controller.GetWord(place2);
            if (!CommonHelper.IsIdentifier(name2))
            {
                mainForm.Dialogs.ShowInfo("Error", "Incorrect name: " + name);
                return;
            }
            place = place2;
            name  = name2;
        }

        mainForm.Dialogs.OpenInput("Rename identificator", name, DoInputNewName);
    }
Beispiel #4
0
 public IncrementalSearchBase(TempSettings tempSettings, string name, string submenu, FindInFilesDialog.Data findInFilesData)
 {
     this.tempSettings    = tempSettings;
     this.name            = name;
     this.submenu         = submenu;
     this.findInFilesData = findInFilesData;
 }
 public EncodingIncrementalSearch(TempSettings tempSettings, bool isSave) : base(
         tempSettings,
         isSave ? "Save encoding" : "Reload with encoding",
         isSave ? "Save encoding" : "Reload with encoding",
         null
         )
 {
     this.isSave = isSave;
 }
        /// <summary>
        /// The operation to close the application by unloading extra resources
        /// and saving memory data.
        /// </summary>
        /// <param name="options">The options object which contains extra information
        /// which helps during the exeuction of this modus.</param>
        public static void Start(BaseOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }
            // Write out the settings file.
            string       settingsFile = Settings.SettingsFile;
            TempSettings settings     = new TempSettings();

            settings.Initialise();
            Settings.FileManager.Write(settingsFile, settings);
        }
    public DialogManager(MainForm mainForm, TempSettings tempSettings)
    {
        this.mainForm     = mainForm;
        this.tempSettings = tempSettings;
        frames            = mainForm.frames;
        closeMethods      = new List <Getter <bool, bool> >();

        KeyMap keyMap = mainForm.KeyMap;

        keyMap.AddItem(new KeyItem(Keys.Control | Keys.OemSemicolon, null,
                                   new KeyAction("&View\\Open/close command dialog", DoInputCommand, null, false)));
        keyMap.AddItem(new KeyItem(Keys.Control | Keys.Shift | Keys.OemSemicolon, null,
                                   new KeyAction("&View\\Open/close command dialog (no history)", DoInputCommandNoHistory, null, false)));
        keyMap.AddItem(new KeyItem(Keys.Control | Keys.OemMinus, null,
                                   new KeyAction("&View\\Set syntax…", DoSetSyntax, null, false)));
        keyMap.AddItem(new KeyItem(Keys.Control | Keys.Shift | Keys.OemMinus, null,
                                   new KeyAction("&View\\Reset syntax", DoResetSyntax, null, false)));
        keyMap.AddItem(new KeyItem(Keys.Control | Keys.Oemplus, null,
                                   new KeyAction("&View\\Set save encoding…", DoSetSaveEncoding, null, false)));
        keyMap.AddItem(new KeyItem(Keys.Control | Keys.OemPipe, null,
                                   new KeyAction("&View\\Reload with encoding…", DoReloadWithEncoding, null, false)));
        keyMap.AddItem(new KeyItem(Keys.Control | Keys.Shift | Keys.C, null,
                                   new KeyAction("&View\\Preview color scheme…", DoSchemeIncrementalSearch, null, false)));
        keyMap.AddItem(new KeyItem(Keys.Control | Keys.F, null,
                                   new KeyAction("F&ind\\Find…", DoFind, null, false)));
        keyMap.AddItem(new KeyItem(Keys.Control | Keys.Shift | Keys.F, null,
                                   new KeyAction("F&ind\\Find in files…", DoFindInFiles, null, false)));
        keyMap.AddItem(new KeyItem(Keys.Control | Keys.H, null,
                                   new KeyAction("F&ind\\Replace…", DoReplace, null, false)));
        keyMap.AddItem(new KeyItem(Keys.Control | Keys.G, null,
                                   new KeyAction("F&ind\\Go to line…", DoGoToLine, null, false)));
        keyMap.AddItem(new KeyItem(Keys.None, null, new KeyAction("F&ind\\-", null, null, false)));
        keyMap.AddItem(new KeyItem(Keys.Control | Keys.P, null,
                                   new KeyAction("F&ind\\File incremental search…", DoFileIncrementalSearch, null, false)));
        keyMap.AddItem(new KeyItem(Keys.Control | Keys.Shift | Keys.O, null,
                                   new KeyAction("F&ind\\Recently incremental search…", DoRecentlyIncrementalSearch, null, false)));
        keyMap.AddItem(new KeyItem(Keys.Control | Keys.Shift | Keys.G, null,
                                   new KeyAction("F&ind\\Recently dirs incremental search…", DoRecentlyDirsIncrementalSearch, null, false)));
        keyMap.AddItem(new KeyItem(Keys.Control | Keys.Shift | Keys.P, null,
                                   new KeyAction("F&ind\\Menu item incremental search…", DoMenuItemIncrementalSearch, null, false)));
        KeyAction escape = new KeyAction("F&ind\\Close dialogs", DoCloseDialogs, null, false);

        keyMap.AddItem(new KeyItem(Keys.Escape, null, escape));
        keyMap.AddItem(new KeyItem(Keys.Control | Keys.OemOpenBrackets, null, escape));

        info = new DialogOwner <InfoDialog>(this);
        fileIncrementalSearch         = new DialogOwner <FileIncrementalSearch>(this);
        recentlyIncrementalSearch     = new DialogOwner <RecentlyIncrementalSearch>(this);
        recentlyDirsIncrementalSearch = new DialogOwner <RecentlyDirsIncrementalSearch>(this);
        menuItemIncrementalSearch     = new DialogOwner <MenuItemIncrementalSearch>(this);
        syntaxIncrementalSearch       = new DialogOwner <SyntaxIncrementalSearch>(this);
        snippetIncrementalSearch      = new DialogOwner <SnippetIncrementalSearch>(this);
        saveEncodingIncrementalSearch = new DialogOwner <EncodingIncrementalSearch>(this);
        loadEncodingIncrementalSearch = new DialogOwner <EncodingIncrementalSearch>(this);
        schemeIncrementalSearch       = new DialogOwner <SchemeIncrementalSearch>(this);
        command         = new DialogOwner <CommandDialog>(this);
        find            = new DialogOwner <FindDialog>(this);
        viFind          = new DialogOwner <ViFindDialog>(this);
        findData        = new FindDialog.Data(tempSettings.FindHistory);
        findInFiles     = new DialogOwner <FindInFilesDialog>(this);
        findInFilesData = new FindInFilesDialog.Data(tempSettings.FindInFilesHistory, tempSettings.FindInFilesTempFilter, tempSettings.FindInFilesTempCurrentFilter);
        replace         = new DialogOwner <ReplaceDialog>(this);
        replaceData     = new ReplaceDialog.Data(tempSettings.ReplacePatternHistory, tempSettings.ReplaceHistory);
        goToLine        = new DialogOwner <FindDialog>(this);
        goToLineData    = new FindDialog.Data(tempSettings.GoToLineHistory);
        input           = new DialogOwner <FindDialog>(this);
        inputData       = new FindDialog.Data(null);
        rename          = new DialogOwner <RenameDialog>(this);
        moveData        = new MoveDialog.Data(tempSettings.MoveHistory);
        move            = new DialogOwner <MoveDialog>(this);
    }
Beispiel #8
0
 public RecentlyDirsIncrementalSearch(TempSettings tempSettings)
     : base(tempSettings, "Recently search", "Incremental recently search", null)
 {
 }
Beispiel #9
0
 public SyntaxIncrementalSearch(TempSettings tempSettings)
     : base(tempSettings, "Syntax selection", "Syntax selection", null)
 {
 }
 public FileIncrementalSearch(TempSettings tempSettings, FindInFilesDialog.Data data)
     : base(tempSettings, "File search", "Incremental file search", data)
 {
 }
 public SnippetIncrementalSearch(TempSettings tempSettings)
     : base(tempSettings, "Snippet selection", "Snippet selection", null)
 {
 }
Beispiel #12
0
 public MenuItemIncrementalSearch(TempSettings tempSettings, MulticaretTextBox textBox)
     : base(tempSettings, "Search in menu", "Menu item incremental search", null)
 {
     this.textBox = textBox;
 }
Beispiel #13
0
        public void Save(int splitterDistance)
        {
            Logger.Debug("(Settings - Save) Saving settings.");

            SplitterDistance = splitterDistance;

            var serializer = new JsonSerializer();
            StreamWriter sw = null;

            try
            {
                sw = new StreamWriter(FullFilePath);

                using (var jwriter = new JsonTextWriter(sw))
                {
                    sw = null;
                    var tempSettings = new TempSettings(Windows, SplitterDistance, EnableLogger, Extensions.GetVersion(), Filters);
                    serializer.Serialize(jwriter, tempSettings);
                }
            }
            finally
            {
                if (sw != null)
                {
                    sw.Dispose();
                }
            }
        }
Beispiel #14
0
        private static bool DeserializeTempSettings(out TempSettings tempSettings)
        {
            var serializer = new JsonSerializer();
            StreamReader sr = null;

            try
            {
                sr = new StreamReader(FullFilePath);
                using (var jreader = new JsonTextReader(sr))
                {
                    sr = null;
                    try
                    {
                        tempSettings = (TempSettings)serializer.Deserialize(jreader, typeof(TempSettings));
                    }
                    catch (JsonSerializationException)
                    {
                        tempSettings = null;
                        return false;
                    }
                }
            }
            finally
            {
                if (sr != null)
                {
                    sr.Dispose();
                }
            }

            return true;
        }