コード例 #1
0
        private void initBrowser()
        {
            BrowserSearchToolStripButton.CheckedChanged += (sender, e) => {
                string pat = string.Empty;
                if (BrowserSearchToolStripButton.Checked) {
                    if (_browserSearchControl == null) {
                        _browserSearchControl = new SearchControl();
                        _browserSearchControl.Dock = DockStyle.Bottom;
                        _browserSearchControl.SearchComboBox.TextChanged += (ss, se) => {
                            var cmbbox = ss as ComboBox;
                            pat = cmbbox.Text;
                            if (_browserSearchControl.MigemoCheckBox.Checked) {
                                pat = getMigemo().Query(cmbbox.Text);
                            }
                            if (pat.Length > 0) {
                                InvokeScript("js_incrementalSearch", pat, _browserSearchControl.MigemoCheckBox.Checked.ToString());
                            }
                        };
                        _browserSearchControl.NextButton.Click += (ss, se) => {
                            InvokeScript("js_searchNext", pat, _browserSearchControl.MigemoCheckBox.Checked.ToString());
                        };
                        _browserSearchControl.PrevButton.Click += (ss, se) => {
                            InvokeScript("js_searchPrev", pat, _browserSearchControl.MigemoCheckBox.Checked.ToString());
                        };

                        _browserSearchControl.CloseButton.Click += (ss, se) => {
                            BrowserSearchToolStripButton.Checked = false;
                        };
                    }
                    ViewEditorSplitContainer.Panel1.Controls.Add(_browserSearchControl);
                }
                else {
                    if (_browserSearchControl != null) {
                        ViewEditorSplitContainer.Panel1.Controls.Remove(_browserSearchControl);
                    }
                }
            };
        }
コード例 #2
0
        private void initEditor()
        {
            _editor = new AzukiControlEx();
            _editor.Dock = DockStyle.Fill;
            EditorPanel.Controls.Add(_editor);
            _editor.Font = config.EditorFont;
            _editor.ForeColor = config.EditorFontColor;
            _editor.BackColor = config.EditorBackColor;
            _editor.DrawsTab = config.ShowTab;
            _editor.DrawsSpace = config.ShowSpace;
            _editor.DrawsFullWidthSpace = config.ShowZenSpace;
            _editor.DrawsEolCode = config.ShowEol;
            _editor.ShowsLineNumber = true;

            _editor.ColorScheme.SetColor(Sgry.Azuki.CharClass.Heading6 + 1, Color.Red, _editor.BackColor);
            _editor.Highlighter = new EditorHighlighter();

            EditorWrapToolStripButton.Checked = config.EdiorWrap;
            CloseEditor();

            _editor.ImeOnOffEvent += (sender, e) => {
                if (_editor.Document.AnchorIndex > 0) {
                    _editor.SetSelection(_editor.Document.AnchorIndex, _editor.Document.AnchorIndex - 1);
                    _editor.Delete();
                }
            };

            _editor.KeyDown += (sender, e) => {
                if (_editor.IsReadOnly) {
                    _editor.IsReadOnly = false;
                }
                if(_EditorKeyMap.ContainsKey(e.KeyData)){
                    _EditorKeyMap[e.KeyData](this);
                    e.Handled = true;
                    e.SuppressKeyPress = true;
                }
            };

            _editor.TextChanged += (s, e) => {
                initEditorToolStripButton();
            };

            _editor.Document.SelectionChanged += (s, e) => {
                initEditorToolStripButton();
            };

            //_editor.DragDrop

            CloseEditorToolStripButton.Click += (sender, e) => {
                //ViewEditorSplitContainer.Panel2Collapsed = true;
                CloseEditor();
            };

            EditorSearchToolStripButton.CheckedChanged += (sender, e) => {
                if (EditorSearchToolStripButton.Checked) {
                    if (_editorSearchControl == null) {
                        _editorSearchControl = new SearchControl();
                        _editorSearchControl.Dock = DockStyle.Bottom;
                        _editorSearchControl.CloseButton.Click += (ss, ee) => {
                            EditorSearchToolStripButton.Checked = false;
                        };
                        _editorSearchControl.SearchComboBox.TextChanged += new System.EventHandler(SearchComboBox_TextChanged);
                        _editorSearchControl.NextButton.Click += (ss, se) => {
                            FindNext();
                        };
                        _editorSearchControl.PrevButton.Click += (ss, se) => {
                            FindPrev();
                        };
                    }
                    EditorPanel.Controls.Add(_editorSearchControl);
                }
                else {
                    if (_editorSearchControl != null) {
                        EditorPanel.Controls.Remove(_editorSearchControl);
                    }
                }
            };

            EditorWrapToolStripButton.CheckedChanged += (sender, e) => {
                if (EditorWrapToolStripButton.Checked) {
                    Editor.ViewType = Sgry.Azuki.ViewType.WrappedProportional;
                    Editor.ViewWidth = Editor.ClientSize.Width - Editor.View.HRulerUnitWidth * 2;
                }
                else {
                    Editor.ViewType = Sgry.Azuki.ViewType.Proportional;
                }
            };

            EditorDateToolStripButton.Click += (s, e) => {
                EditDateTime();
            };

            EditorPinToolStripButton.CheckedChanged += (s, e) => {

            };
        }