예제 #1
0
    override protected void DoCreate()
    {
        SwitchList <NamedAction> list        = new SwitchList <NamedAction>();
        KeyMapBuilder            frameKeyMap = new KeyMapBuilder(new KeyMap(), list);

        frameKeyMap.Add(Keys.Escape, null, new KeyAction("F&ind\\Cancel find", DoCancel, null, false));
        frameKeyMap.AddInList(Keys.Enter, null, new KeyAction("F&ind\\Find next", DoFindNext, 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.Add(Keys.Up, null, prevAction);
            frameKeyMap.Add(Keys.Down, null, nextAction);
            frameKeyMap.Add(Keys.Control | Keys.P, null, prevAction);
            frameKeyMap.Add(Keys.Control | Keys.N, null, nextAction);
        }
        frameKeyMap.Add(Keys.None, null, new KeyAction("F&ind\\-", null, null, false));
        if (allowNormalMode)
        {
            frameKeyMap.Add(Keys.Control | Keys.F, null,
                            new KeyAction("&View\\Vi normal mode", DoNormalMode, null, false));
        }

        KeyMapBuilder beforeKeyMap = new KeyMapBuilder(new KeyMap(), list);

        if (doSelectAllFound != null)
        {
            beforeKeyMap.AddInList(Keys.Control | Keys.D, null,
                                   new KeyAction("F&ind\\Select next found", DoSelectNextFound, null, false));
            beforeKeyMap.AddInList(Keys.Control | Keys.Shift | Keys.D, null,
                                   new KeyAction("F&ind\\Select all found", DoSelectAllFound, null, false));
            beforeKeyMap.Add(Keys.Control | Keys.K, null,
                             new KeyAction("F&ind\\Unselect prev text", DoUnselectPrevText, null, false));
        }

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

        tabBar            = new TabBar <NamedAction>(list, TabBar <NamedAction> .DefaultStringOf, NamedAction.HintOf);
        tabBar.Text       = Name;
        tabBar.ButtonMode = true;
        tabBar.RightHint  = findParams != null?findParams.GetIndicationHint() : null;

        tabBar.TabClick   += OnTabClick;
        tabBar.CloseClick += OnCloseClick;
        tabBar.MouseDown  += OnTabBarMouseDown;
        Controls.Add(tabBar);

        InitResizing(tabBar, null);
        Height = MinSize.Height;
        UpdateFindParams();
    }
예제 #2
0
    override protected void DoCreate()
    {
        SwitchList <NamedAction> list = new SwitchList <NamedAction>();

        KeyMapBuilder frameKeyMap = new KeyMapBuilder(new KeyMap(), list);

        frameKeyMap.Add(Keys.Escape, null, new KeyAction("F&ind\\Cancel find", DoCancel, null, false));
        frameKeyMap.Add(Keys.Tab, null, new KeyAction("F&ind\\Next field", DoNextField, null, false));
        frameKeyMap.Add(Keys.Control | Keys.Tab, null, new KeyAction("F&ind\\Prev field", DoPrevField, null, false));
        frameKeyMap.AddInList(Keys.Enter, null, new KeyAction("F&ind\\Find next", DoFind, null, false));
        frameKeyMap.AddInList(Keys.Control | Keys.Shift | Keys.H, null, new KeyAction("F&ind\\Replace", DoReplace, null, false));
        frameKeyMap.AddInList(Keys.Control | Keys.Alt | Keys.Enter, null, new KeyAction("F&ind\\Replace all", DoReplaceAll, null, false));
        {
            KeyAction prevAction = new KeyAction("F&ind\\Previous pattern", DoPrevPattern, null, false);
            KeyAction nextAction = new KeyAction("F&ind\\Next pattern", DoNextPattern, null, false);
            frameKeyMap.Add(Keys.Up, null, prevAction);
            frameKeyMap.Add(Keys.Down, null, nextAction);
            frameKeyMap.Add(Keys.Control | Keys.P, null, prevAction);
            frameKeyMap.Add(Keys.Control | Keys.N, null, nextAction);
        }
        frameKeyMap.Add(Keys.Control | Keys.F, null,
                        new KeyAction("&View\\Vi normal mode", DoNormalMode, null, false));

        KeyMapBuilder beforeKeyMap = new KeyMapBuilder(new KeyMap(), list);

        beforeKeyMap.AddInList(Keys.Control | Keys.Shift | Keys.D, null,
                               new KeyAction("F&ind\\Select all found", DoSelectAllFound, null, false));
        beforeKeyMap.AddInList(Keys.Control | Keys.D, null,
                               new KeyAction("F&ind\\Select next found", DoSelectNextFound, null, false));
        beforeKeyMap.Add(Keys.Control | Keys.K, null,
                         new KeyAction("F&ind\\Unselect prev text", DoUnselectPrevText, null, false));

        tabBar             = new TabBar <NamedAction>(list, TabBar <NamedAction> .DefaultStringOf, NamedAction.HintOf);
        tabBar.Text        = Name;
        tabBar.ButtonMode  = true;
        tabBar.RightHint   = findParams.GetIndicationWithEscapeHint();
        tabBar.TabClick   += OnTabClick;
        tabBar.CloseClick += OnCloseClick;
        Controls.Add(tabBar);

        textBox = new MulticaretTextBox(true);
        textBox.ShowLineNumbers      = false;
        textBox.HighlightCurrentLine = false;
        textBox.KeyMap.AddAfter(KeyMap);
        textBox.KeyMap.AddBefore(beforeKeyMap.map);
        textBox.KeyMap.AddAfter(frameKeyMap.map, 1);
        textBox.KeyMap.AddAfter(DoNothingKeyMap, -1);
        textBox.FocusedChange += OnTextBoxFocusedChange;
        Controls.Add(textBox);

        replaceTextBox = new MulticaretTextBox(true);
        replaceTextBox.ShowLineNumbers      = false;
        replaceTextBox.HighlightCurrentLine = false;
        replaceTextBox.KeyMap.AddAfter(KeyMap);
        replaceTextBox.KeyMap.AddBefore(beforeKeyMap.map);
        replaceTextBox.KeyMap.AddAfter(frameKeyMap.map, 1);
        replaceTextBox.KeyMap.AddAfter(DoNothingKeyMap, -1);
        replaceTextBox.FocusedChange += OnTextBoxFocusedChange;
        Controls.Add(replaceTextBox);

        textLabel      = new MonospaceLabel();
        textLabel.Text = "Text";
        Controls.Add(textLabel);

        replaceTextLabel      = new MonospaceLabel();
        replaceTextLabel.Text = "Replace";
        Controls.Add(replaceTextLabel);

        tabBar.MouseDown += OnTabBarMouseDown;
        InitResizing(tabBar, null);
        Height = MinSize.Height;
        UpdateFindParams();
    }