Exemplo n.º 1
0
 public void ApplyParameters(MulticaretTextBox textBox, SettingsMode settingsMode, Buffer buffer)
 {
     textBox.WordWrap             = settingsMode != SettingsMode.FileTree && settingsMode != SettingsMode.Help && wordWrap.Value;
     textBox.ShowLineNumbers      = showLineNumbers.Value && settingsMode != SettingsMode.FileTree;
     textBox.ShowLineBreaks       = showLineBreaks.Value;
     textBox.ShowSpaceCharacters  = showSpaceCharacters.Value;
     textBox.HighlightCurrentLine = highlightCurrentLine.Value;
     textBox.TabSize           = tabSize.GetValue(buffer);
     textBox.SpacesInsteadTabs = spacesInsteadTabs.GetValue(buffer);
     textBox.Autoindent        = autoindent.GetValue(buffer);
     textBox.LineBreak         = lineBreak.Value;
     textBox.FontFamily        = font.Value;
     textBox.SetFontSize(fontSize.Value, lineNumberFontSize.Value);
     textBox.ScrollingIndent   = scrollingIndent.Value;
     textBox.ScrollingStep     = scrollingStep.Value;
     textBox.ShowColorAtCursor = showColorAtCursor.Value;
     textBox.KeyMap.main.SetAltChars(altCharsSource.Value, altCharsResult.Value);
     textBox.SetViMap(viMapSource.Value, viMapResult.Value);
     textBox.Map             = settingsMode != SettingsMode.FileTree && miniMap.Value;
     textBox.MapScale        = miniMapScale.Value;
     textBox.PrintMargin     = settingsMode == SettingsMode.Normal && printMargin.Value;
     textBox.PrintMarginSize = printMarginSize.Value;
     textBox.MarkWord        = markWord.Value;
     textBox.MarkBracket     = markBracket.Value;
 }
Exemplo n.º 2
0
 public void ApplySimpleParameters(MulticaretTextBox textBox, Buffer buffer, bool changeFont)
 {
     textBox.WordWrap             = wordWrap.Value;
     textBox.ShowLineNumbers      = false;
     textBox.ShowLineBreaks       = showLineBreaks.Value;
     textBox.ShowSpaceCharacters  = showSpaceCharacters.Value;
     textBox.HighlightCurrentLine = false;
     textBox.TabSize           = tabSize.GetValue(buffer);
     textBox.SpacesInsteadTabs = spacesInsteadTabs.GetValue(buffer);
     textBox.Autoindent        = autoindent.GetValue(buffer);
     textBox.LineBreak         = lineBreak.Value;
     if (changeFont)
     {
         textBox.FontFamily = font.Value;
         textBox.SetFontSize(fontSize.Value, lineNumberFontSize.Value);
     }
     textBox.ScrollingIndent   = scrollingIndent.Value;
     textBox.ScrollingStep     = scrollingStep.Value;
     textBox.ShowColorAtCursor = showColorAtCursor.Value;
     textBox.KeyMap.main.SetAltChars(altCharsSource.Value, altCharsResult.Value);
 }
    override protected void DoCreate()
    {
        {
            KeyMap frameKeyMap = new KeyMap();
            frameKeyMap.AddItem(new KeyItem(Keys.Escape, null,
                                            new KeyAction("F&ind\\Cancel find", DoCancel, null, false)));
            frameKeyMap.AddItem(new KeyItem(Keys.Enter, null,
                                            new KeyAction("F&ind\\Find text", DoFindText, null, false)));
            frameKeyMap.AddItem(new KeyItem(Keys.Control | Keys.E, null,
                                            new KeyAction("F&ind\\Switch to input field", DoSwitchToInputField, null, false)));
            if (data.filterHistory != null)
            {
                KeyAction prevAction = new KeyAction("F&ind\\Previous filter", DoFilterPrevPattern, null, false);
                KeyAction nextAction = new KeyAction("F&ind\\Next filter", DoFilterNextPattern, null, false);
                frameKeyMap.AddItem(new KeyItem(Keys.Up, null, prevAction));
                frameKeyMap.AddItem(new KeyItem(Keys.Down, null, nextAction));
                frameKeyMap.AddItem(new KeyItem(Keys.Control | Keys.P, null, prevAction));
                frameKeyMap.AddItem(new KeyItem(Keys.Control | Keys.N, null, nextAction));
            }
            frameKeyMap.AddItem(new KeyItem(Keys.Control | Keys.F, null,
                                            new KeyAction("F&ind\\Vi normal mode", DoNormalMode, null, true)));

            filterTextBox            = new MulticaretTextBox(true);
            filterTextBox.FontFamily = FontFamily.GenericMonospace;
            filterTextBox.SetFontSize(10.25f, 0);
            filterTextBox.ShowLineNumbers      = false;
            filterTextBox.HighlightCurrentLine = false;
            filterTextBox.KeyMap.AddAfter(KeyMap);
            filterTextBox.KeyMap.AddAfter(frameKeyMap, 1);
            filterTextBox.KeyMap.AddAfter(DoNothingKeyMap, -1);
            filterTextBox.FocusedChange += OnTextBoxFocusedChange;
            filterTextBox.Visible        = false;
            filterTextBox.Text           = data.currentFilter.value;
            filterTextBox.TextChange    += OnFilterTextChange;
            Controls.Add(filterTextBox);
        }

        tabBar             = new TabBar <string>(new SwitchList <string>(), TabBar <string> .DefaultStringOf);
        tabBar.CloseClick += OnCloseClick;
        Controls.Add(tabBar);

        {
            KeyMap frameKeyMap = new KeyMap();
            frameKeyMap.AddItem(new KeyItem(Keys.Escape, null,
                                            new KeyAction("F&ind\\Cancel find", DoCancel, null, false)));
            frameKeyMap.AddItem(new KeyItem(Keys.Enter, null,
                                            new KeyAction("F&ind\\Find text", DoFindText, null, false)));
            frameKeyMap.AddItem(new KeyItem(Keys.Control | Keys.E, null,
                                            new KeyAction("F&ind\\Temp filter", DoSwitchToTempFilter, null, false)));
            frameKeyMap.AddItem(new KeyItem(Keys.Control | Keys.F, null,
                                            new KeyAction("&View\\Vi normal mode", DoNormalMode, null, false)));
            if (data.history != null)
            {
                KeyAction prevAction = new KeyAction("F&ind\\Previous pattern", DoPrevPattern, null, false);
                KeyAction nextAction = new KeyAction("F&ind\\Next pattern", DoNextPattern, null, false);
                frameKeyMap.AddItem(new KeyItem(Keys.Up, null, prevAction));
                frameKeyMap.AddItem(new KeyItem(Keys.Down, null, nextAction));
                frameKeyMap.AddItem(new KeyItem(Keys.Control | Keys.P, null, prevAction));
                frameKeyMap.AddItem(new KeyItem(Keys.Control | Keys.N, null, nextAction));
            }

            textBox = new MulticaretTextBox(true);
            textBox.KeyMap.AddAfter(KeyMap);
            textBox.KeyMap.AddAfter(frameKeyMap, 1);
            textBox.KeyMap.AddAfter(DoNothingKeyMap, -1);
            textBox.FocusedChange += OnFiltersTextBoxFocusedChange;
            Controls.Add(textBox);
        }

        tabBar.RightHint = "Ctrl+E(enter/exit custom filter)" +
                           (findParams != null ? "/" + findParams.GetIndicationHint() : "");
        tabBar.MouseDown += OnTabBarMouseDown;
        InitResizing(tabBar, null);
        Height = MinSize.Height;
        UpdateFindParams();
    }
Exemplo n.º 4
0
    override protected void DoCreate()
    {
        list               = new SwitchList <string>();
        tabBar             = new TabBar <string>(list, TabBar <string> .DefaultStringOf);
        tabBar.Text        = name;
        tabBar.CloseClick += OnCloseClick;
        Controls.Add(tabBar);

        KeyMap textKeyMap     = new KeyMap();
        KeyMap variantsKeyMap = new KeyMap();
        KeyMap beforeKeyMap   = new KeyMap();

        {
            KeyAction action = new KeyAction("F&ind\\" + submenu + "\\Close", DoClose, null, false);
            textKeyMap.AddItem(new KeyItem(Keys.Escape, null, action));
            variantsKeyMap.AddItem(new KeyItem(Keys.Escape, null, action));
        }
        {
            KeyAction actionUp   = new KeyAction("F&ind\\" + submenu + "\\Select up", DoUp, null, false);
            KeyAction actionDown = new KeyAction("F&ind\\" + submenu + "\\Select down", DoDown, null, false);
            textKeyMap.AddItem(new KeyItem(Keys.Up, null, actionUp));
            textKeyMap.AddItem(new KeyItem(Keys.Down, null, actionDown));
            textKeyMap.AddItem(new KeyItem(Keys.Control | Keys.K, null, actionUp));
            textKeyMap.AddItem(new KeyItem(Keys.Control | Keys.J, null, actionDown));
            textKeyMap.AddItem(new KeyItem(Keys.Control | Keys.F, null,
                                           new KeyAction("&View\\Vi normal mode", DoNormalMode, null, false)));
            if (findInFilesData != null)
            {
                textKeyMap.AddItem(new KeyItem(Keys.Control | Keys.E, null,
                                               new KeyAction("F&ind\\Temp filter", DoSwitchToTempFilter, null, false)));
            }
        }
        {
            beforeKeyMap.AddItem(new KeyItem(Keys.Control | Keys.Home, null,
                                             new KeyAction("F&ind\\" + submenu + "\\Select document start", DoDocumentStart, null, false)));
            beforeKeyMap.AddItem(new KeyItem(Keys.Control | Keys.End, null,
                                             new KeyAction("F&ind\\" + submenu + "\\Select document end", DoDocumentEnd, null, false)));
            beforeKeyMap.AddItem(new KeyItem(Keys.PageUp, null,
                                             new KeyAction("F&ind\\" + submenu + "\\Select page up", DoPageUp, null, false)));
            beforeKeyMap.AddItem(new KeyItem(Keys.PageDown, null,
                                             new KeyAction("F&ind\\" + submenu + "\\Select page down", DoPageDown, null, false)));
        }
        {
            KeyAction action = new KeyAction("F&ind\\" + submenu + "\\Next field", DoNextField, null, false);
            textKeyMap.AddItem(new KeyItem(Keys.Tab, null, action));
            variantsKeyMap.AddItem(new KeyItem(Keys.Tab, null, action));
        }
        {
            KeyAction action = new KeyAction("F&ind\\" + submenu + "\\Open", DoExecute, null, false);
            textKeyMap.AddItem(new KeyItem(Keys.Enter, null, action));
            textKeyMap.AddItem(new KeyItem(Keys.None, null, action).SetDoubleClick(true));
            variantsKeyMap.AddItem(new KeyItem(Keys.Enter, null, action));
            variantsKeyMap.AddItem(new KeyItem(Keys.None, null, action).SetDoubleClick(true));
        }

        variantsTextBox = new MulticaretTextBox();
        variantsTextBox.KeyMap.AddAfter(KeyMap);
        variantsTextBox.KeyMap.AddAfter(variantsKeyMap, 1);
        variantsTextBox.KeyMap.AddAfter(DoNothingKeyMap, -1);
        variantsTextBox.FocusedChange        += OnTextBoxFocusedChange;
        variantsTextBox.Controller.isReadonly = true;
        variantsTextBox.AfterClick           += OnVariantsTextBoxClick;
        variantsTextBox.AfterKeyPress        += OnVariantsTextBoxClick;
        Controls.Add(variantsTextBox);

        textBox = new MulticaretTextBox(true);
        textBox.KeyMap.AddBefore(beforeKeyMap);
        textBox.KeyMap.AddAfter(KeyMap);
        textBox.KeyMap.AddAfter(textKeyMap, 1);
        textBox.KeyMap.AddAfter(DoNothingKeyMap, -1);
        textBox.FocusedChange += OnTextBoxFocusedChange;
        textBox.TextChange    += OnTextBoxTextChange;
        Controls.Add(textBox);

        SetTextBoxParameters();

        tabBar.RightHint = tempSettings.FindParams != null?
                           tempSettings.FindParams.GetIgnoreCaseIndicationHint() : "";

        tabBar.MouseDown += OnTabBarMouseDown;

        if (findInFilesData != null)
        {
            KeyMap filterKeyMap = new KeyMap();
            {
                KeyAction action = new KeyAction("F&ind\\Switch to input field", DoSwitchToInputField, null, false);
                filterKeyMap.AddItem(new KeyItem(Keys.Control | Keys.E, null, action));
                filterKeyMap.AddItem(new KeyItem(Keys.Enter, null, action));
            }
            filterKeyMap.AddItem(new KeyItem(Keys.Control | Keys.F, null,
                                             new KeyAction("&View\\Vi normal mode", DoNormalMode, null, false)));
            if (findInFilesData.filterHistory != null)
            {
                KeyAction prevAction = new KeyAction("F&ind\\Previous filter", DoFilterPrevPattern, null, false);
                KeyAction nextAction = new KeyAction("F&ind\\Next filter", DoFilterNextPattern, null, false);
                filterKeyMap.AddItem(new KeyItem(Keys.Up, null, prevAction));
                filterKeyMap.AddItem(new KeyItem(Keys.Down, null, nextAction));
                filterKeyMap.AddItem(new KeyItem(Keys.Control | Keys.P, null, prevAction));
                filterKeyMap.AddItem(new KeyItem(Keys.Control | Keys.N, null, nextAction));
            }
            filterTextBox            = new MulticaretTextBox(true);
            filterTextBox.FontFamily = FontFamily.GenericMonospace;
            filterTextBox.SetFontSize(10.25f, 0);
            filterTextBox.ShowLineNumbers      = false;
            filterTextBox.HighlightCurrentLine = false;
            filterTextBox.KeyMap.AddAfter(KeyMap);
            filterTextBox.KeyMap.AddAfter(filterKeyMap, 1);
            filterTextBox.KeyMap.AddAfter(DoNothingKeyMap, -1);
            filterTextBox.FocusedChange += OnTextBoxFocusedChange;
            filterTextBox.Visible        = false;
            filterTextBox.Text           = findInFilesData.currentFilter.value;
            filterTextBox.TextChange    += OnFilterTextChange;
            tabBar.Controls.Add(filterTextBox);
        }

        InitResizing(tabBar, null);
        Height = MinSize.Height;

        Name = GetSubname();
        if (findInFilesData != null)
        {
            lastFilter = GetFilterText();
        }
        if (!Prebuild())
        {
            preventOpen = true;
            return;
        }
        UpdateVariantsText();
        UpdateFindParams();
    }