Esempio n. 1
0
        private void FrmMIDIKbd_KeyDown(object sender, KeyEventArgs e)
        {
            for (int i = 0; i < kbdTbl.Length; i++)
            {
                if (kbdTbl[i] == e.KeyCode && !keyPress[i])
                {
                    keyPress[i] = true;
                    if (i >= 2)
                    {
                        int n = Math.Min(Math.Max((i - 6) + (setting.midiKbd.Octave - 1 + 1) * 12, 0), 127);
                        NoteOn(n, 127);
                    }
                }
            }

            if (e.KeyCode == Keys.Space)
            {
                if (recMode == 0)
                {
                    StartRecording();
                }
                else
                {
                    recMode = 0;
                    recAC   = null;
                }
            }
        }
Esempio n. 2
0
        private void setHighlighterMUC()
        {
            Sgry.Azuki.Highlighter.KeywordHighlighter keywordHighlighter = new Sgry.Azuki.Highlighter.KeywordHighlighter();
            //keywordHighlighter.AddRegex("^.*", false, CharClass.DocComment);
            keywordHighlighter.AddRegex("^[A-Z]+ ", CharClass.Keyword);
            keywordHighlighter.AddRegex("^#[A-Za-z0-9]* ", CharClass.Keyword);
            keywordHighlighter.AddRegex("^#\\S*\\*", CharClass.Keyword);
            keywordHighlighter.AddRegex("^'@", CharClass.Keyword);
            keywordHighlighter.AddRegex("^'%\\S+ ", CharClass.Keyword);
            keywordHighlighter.AddRegex("^\\{ .*", CharClass.DocComment);
            keywordHighlighter.AddRegex("^\\}.*", CharClass.DocComment);
            keywordHighlighter.AddRegex("\\;.*", CharClass.Comment);
            //keywordHighlighter.AddEnclosure("{", "}", CharClass.Comment, true);
            azukiControl                  = new AzukiControl();
            azukiControl.Font             = new Font(setting.other.TextFontName, setting.other.TextFontSize, setting.other.TextFontStyle);
            azukiControl.Dock             = DockStyle.Fill;
            azukiControl.ShowsIconBar     = true;
            azukiControl.Highlighter      = keywordHighlighter;
            azukiControl.IconBarImageList = imglstIconBar;
            azukiControl.IconBarClicked  += AzukiControl_IconBarClicked;
            azukiControl.TextChanged     += AzukiControl_TextChanged;
            azukiControl.KeyDown         += AzukiControl_KeyDown;
            azukiControl.HScroll         += AzukiControl_CancelSien;
            azukiControl.VScroll         += AzukiControl_CancelSien;
            azukiControl.LocationChanged += AzukiControl_CancelSien;
            azukiControl.SizeChanged     += AzukiControl_CancelSien;
            azukiControl.CaretMoved      += AzukiControl_CaretMoved;
            azukiControl.AllowDrop        = true;
            azukiControl.DragOver        += AzukiControl_DragOver;
            azukiControl.DragDrop        += AzukiControl_DragDrop;
            azukiControl.Silence          = true;

            azukiControl.ColorScheme.ForeColor          = Color.FromArgb(setting.ColorScheme.Azuki_ForeColor);
            azukiControl.ColorScheme.BackColor          = Color.FromArgb(setting.ColorScheme.Azuki_BackColor);
            azukiControl.ColorScheme.IconBarBack        = Color.FromArgb(setting.ColorScheme.Azuki_IconBarBack);
            azukiControl.ColorScheme.LineNumberBack     = Color.FromArgb(setting.ColorScheme.Azuki_LineNumberBack_Normal);
            azukiControl.ColorScheme.LineNumberFore     = Color.FromArgb(setting.ColorScheme.Azuki_LineNumberFore_Normal);
            azukiControl.ColorScheme.SelectionBack      = Color.FromArgb(setting.ColorScheme.Azuki_SelectionBack_Normal);
            azukiControl.ColorScheme.SelectionFore      = Color.FromArgb(setting.ColorScheme.Azuki_SelectionFore_Normal);
            azukiControl.ColorScheme.MatchedBracketBack = Color.FromArgb(setting.ColorScheme.Azuki_MatchedBracketBack_Normal);
            azukiControl.ColorScheme.MatchedBracketFore = Color.FromArgb(setting.ColorScheme.Azuki_MatchedBracketFore_Normal);
            azukiControl.ColorScheme.SetColor(CharClass.Keyword, Color.FromArgb(setting.ColorScheme.Azuki_Keyword), Color.Transparent);
            azukiControl.ColorScheme.SetColor(CharClass.Comment, Color.FromArgb(setting.ColorScheme.Azuki_Comment), Color.Transparent);
            azukiControl.ColorScheme.SetColor(CharClass.DocComment, Color.FromArgb(setting.ColorScheme.Azuki_DocComment), Color.Transparent);
            azukiControl.ColorScheme.SetColor(CharClass.Number, Color.FromArgb(setting.ColorScheme.Azuki_Number), Color.Transparent);
            azukiControl.ColorScheme.SetColor(CharClass.Delimiter, Color.FromArgb(setting.ColorScheme.Azuki_Number), Color.Transparent);

            MarkingInfo info = new MarkingInfo(1, "TraceInfo");

            Marking.Register(info);
            TextDecoration dec = new BgColorTextDecoration(Color.DarkGoldenrod);

            azukiControl.ColorScheme.SetMarkingDecoration(1, dec);

            this.Controls.Add(azukiControl);

            frmSien        = new FrmSien(setting);
            frmSien.parent = main;
            frmSien.Show();
        }
Esempio n. 3
0
 public azukiFindDialog(azukiDialogMode mode, AzukiControl txtBox)
 {
     this.InitializeComponent();
     this._textBox         = txtBox;
     this.Mode             = mode;
     this.findTextBox.Text = this._textBox.Document.GetTextInRange(ref this.begin, ref this.end);
 }
Esempio n. 4
0
        /// <summary>
        /// コンストラクター
        /// </summary>
        public dlgLocalSearchReplace(AzukiControl ctl)
        {
            this.InitializeComponent();
            this.txtFind.Focus();
            this.ctl = ctl;
            this.ResetFindText();

            //設定を復元
            this.chkCase.Checked  = Settings.Default.Last_TextSearchCase;
            this.chkRegux.Checked = Settings.Default.Last_TextSearchRegux;
        }
Esempio n. 5
0
        public void Forum28741()
        {
            StringBuilder textChanged_IsDirty = new StringBuilder();
            StringBuilder textChanged_CanUndo = new StringBuilder();
            StringBuilder textChanged_CanRedo = new StringBuilder();
            StringBuilder doc_CC_IsDirty      = new StringBuilder();
            StringBuilder doc_CC_CanUndo      = new StringBuilder();
            StringBuilder doc_CC_CanRedo      = new StringBuilder();
            StringBuilder doc_DSC_IsDirty     = new StringBuilder();
            StringBuilder doc_DSC_CanUndo     = new StringBuilder();
            StringBuilder doc_DSC_CanRedo     = new StringBuilder();

            using (AzukiControl azuki = new AzukiControl())
            {
                azuki.TextChanged += delegate(object sender, EventArgs e) {
                    textChanged_IsDirty.Append(azuki.Document.IsDirty ? '1' : '0');
                    textChanged_CanUndo.Append(azuki.Document.CanUndo ? '1' : '0');
                    textChanged_CanRedo.Append(azuki.Document.CanRedo ? '1' : '0');
                };
                azuki.Document.ContentChanged += delegate(object sender, ContentChangedEventArgs e) {
                    doc_CC_IsDirty.Append(azuki.Document.IsDirty ? '1' : '0');
                    doc_CC_CanUndo.Append(azuki.Document.CanUndo ? '1' : '0');
                    doc_CC_CanRedo.Append(azuki.Document.CanRedo ? '1' : '0');
                };
                azuki.Document.DirtyStateChanged += delegate(object sender, EventArgs e) {
                    doc_DSC_IsDirty.Append(azuki.Document.IsDirty ? '1' : '0');
                    doc_DSC_CanUndo.Append(azuki.Document.CanUndo ? '1' : '0');
                    doc_DSC_CanRedo.Append(azuki.Document.CanRedo ? '1' : '0');
                };

                // input a character
                azuki.HandleTextInput("a");
                azuki.HandleTextInput("b");
                azuki.Undo();
                azuki.Undo();

                // check
                Assert.AreEqual("1110", textChanged_IsDirty.ToString());
                Assert.AreEqual("1110", textChanged_CanUndo.ToString());
                Assert.AreEqual("0011", textChanged_CanRedo.ToString());
                Assert.AreEqual("1110", doc_CC_IsDirty.ToString());
                Assert.AreEqual("1110", doc_CC_CanUndo.ToString());
                Assert.AreEqual("0011", doc_CC_CanRedo.ToString());
                Assert.AreEqual("10", doc_DSC_IsDirty.ToString());
                Assert.AreEqual("10", doc_DSC_CanUndo.ToString());
                Assert.AreEqual("01", doc_DSC_CanRedo.ToString());
            }
        }
Esempio n. 6
0
        public static AzukiControl RemakeText(this AzukiControl azuki, bool isUseNewline = false)
        {
            FreeView.Sql.SqlRule rule = new FreeView.Sql.SqlRule();
            rule.IndentString = isUseNewline ? "    " : "";

            FreeView.Sql.SqlFormatter formatter = new FreeView.Sql.SqlFormatter(rule);
            azuki.Text = formatter.Format(azuki.Text);

            if (!isUseNewline)
            {
                azuki.Text = azuki.Text.Replace(System.Environment.NewLine, " ");
            }
            ;

            return(azuki);
        }
Esempio n. 7
0
        public FrmCSM(Action <Form> removeForm, FrmEditor dc)
        {
            InitializeComponent();
            this.removeForm = removeForm;

            if (dc == null)
            {
                return;
            }
            if (!(dc is FrmEditor))
            {
                return;
            }
            targetDocument = (FrmEditor)dc;
            ac             = ((FrmEditor)dc).azukiControl;
        }
Esempio n. 8
0
        public FrmReplaceBox(Setting setting, FrmEditor frmEditor)
        {
            InitializeComponent();
            DialogResult               = DialogResult.Cancel;
            this.BackColor             = Color.FromArgb(setting.ColorScheme.SearchBox_BackColor);
            this.ForeColor             = Color.FromArgb(setting.ColorScheme.SearchBox_ForeColor);
            this.cmbFrom.BackColor     = Color.FromArgb(setting.ColorScheme.SearchBox_BackColor);
            this.cmbFrom.ForeColor     = Color.FromArgb(setting.ColorScheme.SearchBox_ForeColor);
            this.cmbTo.BackColor       = Color.FromArgb(setting.ColorScheme.SearchBox_BackColor);
            this.cmbTo.ForeColor       = Color.FromArgb(setting.ColorScheme.SearchBox_ForeColor);
            this.btnPrevious.BackColor = Color.FromArgb(setting.ColorScheme.SearchBox_BackColor);
            this.btnPrevious.ForeColor = Color.FromArgb(setting.ColorScheme.SearchBox_ForeColor);
            this.btnNext.BackColor     = Color.FromArgb(setting.ColorScheme.SearchBox_BackColor);
            this.btnNext.ForeColor     = Color.FromArgb(setting.ColorScheme.SearchBox_ForeColor);
            this.groupBox2.BackColor   = Color.FromArgb(setting.ColorScheme.SearchBox_BackColor);
            this.groupBox2.ForeColor   = Color.FromArgb(setting.ColorScheme.SearchBox_ForeColor);

            this.cmbFrom.Items.AddRange(setting.other.SearchWordHistory.ToArray());
            this.cmbTo.Items.AddRange(setting.other.ReplaceToWordHistory.ToArray());
            ac           = frmEditor.azukiControl;
            fmt          = frmEditor.fmt;
            this.setting = setting;
        }
        public static void Test()
        {
            using (_Azuki = new AzukiControl())
            {
                int test_num = 0;
                Console.WriteLine("[Test for CaretMoveLogic]");

                Console.WriteLine("test {0} - Right", ++test_num);
                TestUtl.Do(Test_Right);

                Console.WriteLine("test {0} - Left", ++test_num);
                TestUtl.Do(Test_Left);

                Console.WriteLine("test {0} - NextWord", ++test_num);
                TestUtl.Do(Test_NextWord);

                Console.WriteLine("test {0} - PrevWord", ++test_num);
                TestUtl.Do(Test_PrevWord);

                Console.WriteLine("done.");
                Console.WriteLine();
            }
        }
Esempio n. 10
0
        private void StartRecording()
        {
            DockContent dc = (DockContent)parent.GetActiveDockContent();
            Document    d  = null;

            if (dc != null)
            {
                if (dc.Tag is Document)
                {
                    d = (Document)dc.Tag;
                }
            }

            if (d == null)
            {
                return;
            }

            recAC             = d.editor.azukiControl;
            recMode           = 1;
            rec_oldNote       = -1;
            rec_startCounter  = 0;
            rec_currentOctave = -1;
        }
Esempio n. 11
0
        public FrmSearch(AzukiControl azuki)
        {
            InitializeComponent();

            this.azuki = azuki;
        }
Esempio n. 12
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="azuki">AzukiControl</param>
 public Editor(AzukiControl azuki)
 {
     this.azuki = azuki;
     this.SetKeywordHighlighter();
 }
Esempio n. 13
0
        public static AzukiControl ClearText(this AzukiControl azuki)
        {
            azuki.Text = string.Empty;

            return(azuki);
        }
Esempio n. 14
0
        public FrmEditor(Setting setting)
        {
            InitializeComponent();
            this.setting = setting;

            Sgry.Azuki.Highlighter.KeywordHighlighter keywordHighlighter = new Sgry.Azuki.Highlighter.KeywordHighlighter();
            keywordHighlighter.AddRegex("^[^'].*", false, CharClass.DocComment);
            keywordHighlighter.AddRegex("^'[A-Za-z0-9\\-\\,]+ ", CharClass.Keyword);
            keywordHighlighter.AddRegex("^'@ ", CharClass.Keyword);
            keywordHighlighter.AddRegex("^'%\\S+ ", CharClass.Keyword);
            keywordHighlighter.AddEnclosure("'{", "}", CharClass.Comment, true);
            azukiControl                  = new AzukiControl();
            azukiControl.Font             = new Font(setting.other.TextFontName, setting.other.TextFontSize, setting.other.TextFontStyle);
            azukiControl.Dock             = DockStyle.Fill;
            azukiControl.ShowsIconBar     = true;
            azukiControl.Highlighter      = keywordHighlighter;
            azukiControl.IconBarImageList = imglstIconBar;
            azukiControl.IconBarClicked  += AzukiControl_IconBarClicked;
            azukiControl.TextChanged     += AzukiControl_TextChanged;
            azukiControl.KeyDown         += AzukiControl_KeyDown;
            azukiControl.HScroll         += AzukiControl_CancelSien;
            azukiControl.VScroll         += AzukiControl_CancelSien;
            azukiControl.LocationChanged += AzukiControl_CancelSien;
            azukiControl.SizeChanged     += AzukiControl_CancelSien;
            azukiControl.CaretMoved      += AzukiControl_CaretMoved;
            azukiControl.AllowDrop        = true;
            azukiControl.DragOver        += AzukiControl_DragOver;
            azukiControl.DragDrop        += AzukiControl_DragDrop;
            azukiControl.Silence          = true;

            azukiControl.ColorScheme.ForeColor          = Color.FromArgb(setting.ColorScheme.Azuki_ForeColor);
            azukiControl.ColorScheme.BackColor          = Color.FromArgb(setting.ColorScheme.Azuki_BackColor);
            azukiControl.ColorScheme.IconBarBack        = Color.FromArgb(setting.ColorScheme.Azuki_IconBarBack);
            azukiControl.ColorScheme.LineNumberBack     = Color.FromArgb(setting.ColorScheme.Azuki_LineNumberBack_Normal);
            azukiControl.ColorScheme.LineNumberFore     = Color.FromArgb(setting.ColorScheme.Azuki_LineNumberFore_Normal);
            azukiControl.ColorScheme.SelectionBack      = Color.FromArgb(setting.ColorScheme.Azuki_SelectionBack_Normal);
            azukiControl.ColorScheme.SelectionFore      = Color.FromArgb(setting.ColorScheme.Azuki_SelectionFore_Normal);
            azukiControl.ColorScheme.MatchedBracketBack = Color.FromArgb(setting.ColorScheme.Azuki_MatchedBracketBack_Normal);
            azukiControl.ColorScheme.MatchedBracketFore = Color.FromArgb(setting.ColorScheme.Azuki_MatchedBracketFore_Normal);
            azukiControl.ColorScheme.SetColor(CharClass.Keyword, Color.FromArgb(setting.ColorScheme.Azuki_Keyword), Color.Transparent);
            azukiControl.ColorScheme.SetColor(CharClass.Comment, Color.FromArgb(setting.ColorScheme.Azuki_Comment), Color.Transparent);
            azukiControl.ColorScheme.SetColor(CharClass.DocComment, Color.FromArgb(setting.ColorScheme.Azuki_DocComment), Color.Transparent);
            azukiControl.ColorScheme.SetColor(CharClass.Number, Color.FromArgb(setting.ColorScheme.Azuki_Number), Color.Transparent);
            azukiControl.ColorScheme.SetColor(CharClass.Delimiter, Color.FromArgb(setting.ColorScheme.Azuki_Number), Color.Transparent);

            MarkingInfo info = new MarkingInfo(1, "TraceInfo");

            Marking.Register(info);
            TextDecoration dec = new BgColorTextDecoration(Color.DarkGoldenrod);

            azukiControl.ColorScheme.SetMarkingDecoration(1, dec);

            azukiControl.SetKeyBind(Keys.Home, ActionHome);
            azukiControl.SetKeyBind((uint)(Keys.Shift | Keys.Enter), ActionShiftEnter);
            azukiControl.SetKeyBind((uint)(Keys.Control | Keys.Divide), ActionComment);
            azukiControl.SetKeyBind((uint)(Keys.Control | Keys.OemQuestion), ActionComment);
            azukiControl.SetKeyBind((uint)(Keys.Control | Keys.F), ActionFind);
            azukiControl.SetKeyBind((uint)(Keys.Control | Keys.PageDown), ActionJumpAnchorNext);
            azukiControl.SetKeyBind((uint)(Keys.Control | Keys.PageUp), ActionJumpAnchorPrevious);
            azukiControl.SetKeyBind((uint)(Keys.F3), ActionFindNext);
            azukiControl.SetKeyBind((uint)(Keys.Shift | Keys.F3), ActionFindPrevious);

            this.Controls.Add(azukiControl);

            frmSien        = new FrmSien(setting);
            frmSien.parent = main;
            frmSien.Show();
        }
Esempio n. 15
0
        public EditorConfig(Config config)
        {
            IsFontChanged  = false;
            IsColorChanged = false;
            IsViewChanged  = false;

            this.config = config;

            InitializeComponent();
            editor = new AzukiControl();
            editor.ShowsHScrollBar = false;
            editor.Dock            = DockStyle.Fill;
            editor.Text            = Resources.EditorPreviewText;
            panel.Controls.Add(editor);

            FontSelectButton.Text   = this.config.EditorFont.Name + "(" + this.config.EditorFont.Size + ")";
            FontSelectButton.Click += (sender, e) => {
                var res = EditorFontDialog.ShowDialog();
                if (res == DialogResult.OK)
                {
                    var EditorFont = EditorFontDialog.Font;
                    FontSelectButton.Text = EditorFont.Name + "(" + EditorFont.Size + ")";
                    editor.Font           = EditorFont;

                    IsFontChanged = true;
                }
            };

            FontColorButton.Click += (sender, e) => {
                var res = EditorColorDialog.ShowDialog();
                if (res == DialogResult.OK)
                {
                    editor.ForeColor = EditorColorDialog.Color;
                    IsColorChanged   = true;
                }
            };

            BackColorButton.Click += (sender, e) => {
                var res = EditorColorDialog.ShowDialog();
                if (res == DialogResult.OK)
                {
                    editor.BackColor = EditorColorDialog.Color;
                    IsColorChanged   = true;
                }
            };

            ShowTabCheckBox.CheckedChanged += (s, e) => {
                editor.View.DrawsTab = ShowTabCheckBox.Checked;
                IsViewChanged        = true;
            };
            ShowEolCheckBox.CheckedChanged += (s, e) => {
                editor.View.DrawsEolCode = ShowEolCheckBox.Checked;
                IsViewChanged            = true;
            };
            ShowSpaceCheckBox.CheckedChanged += (s, e) => {
                editor.View.DrawsSpace = ShowSpaceCheckBox.Checked;
                IsViewChanged          = true;
            };
            ShowZenSpaceCheckBox.CheckedChanged += (s, e) => {
                editor.View.DrawsFullWidthSpace = ShowZenSpaceCheckBox.Checked;
                IsViewChanged = true;
            };

            //
            foreach (var item in this.config.SnippetList)
            {
                SnippetListBox.Items.Add(item);
            }

            NewButton.Click += (s, e) => {
                var edit = new SnippetEditForm();
                edit.StartPosition = FormStartPosition.CenterParent;
                var res = edit.ShowDialog(this);
                if (res == DialogResult.OK)
                {
                    SnippetListBox.Items.Add(edit.Code);
                }
                edit.Close();
            };
            EditButton.Click += (s, e) => {
                var edit = new SnippetEditForm();
                edit.Code = SnippetListBox.SelectedItem.ToString();
                var res = edit.ShowDialog(this);
                if (res == DialogResult.OK)
                {
                    SnippetListBox.SelectedItem = edit.Code;
                }
            };
            DeleteButton.Click += (s, e) => {
                SnippetListBox.Items.RemoveAt(SnippetListBox.SelectedIndex);
            };

            this.Load += (s, e) => {
                editor.Font      = config.EditorFont;
                editor.ForeColor = config.EditorFontColor;
                editor.BackColor = config.EditorBackColor;

                editor.DrawsTab            = config.ShowTab;
                editor.DrawsEolCode        = config.ShowEol;
                editor.DrawsSpace          = config.ShowSpace;
                editor.DrawsFullWidthSpace = config.ShowZenSpace;

                ShowTabCheckBox.Checked      = editor.DrawsTab;
                ShowEolCheckBox.Checked      = editor.DrawsEolCode;
                ShowSpaceCheckBox.Checked    = editor.DrawsSpace;
                ShowZenSpaceCheckBox.Checked = editor.DrawsFullWidthSpace;
            };
            this.Disposed += (s, e) => {
                if (editor != null)
                {
                    editor.Dispose();
                }
            };
        }
Esempio n. 16
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="azuki">AzukiControl</param>
        public FrmRepeat(AzukiControl azuki)
        {
            InitializeComponent();

            this.azuki = azuki;
        }
Esempio n. 17
0
 public azukiJumpDialog(AzukiControl txtBox)
 {
     this.InitializeComponent();
     this._textBox = txtBox;
 }
Esempio n. 18
0
 public CaretMoveLogicTest()
 {
     _Azuki = new AzukiControl();
 }
Esempio n. 19
0
 void InitUIComponent()
 {
     _Azuki = new AzukiControl();
     SuspendLayout();
     //
     // _Azuki
     //
     _Azuki.Dock        = DockStyle.Fill;
     _Azuki.TabWidth    = 8;
     _Azuki.BorderStyle = BorderStyle.None;
     _Azuki.KeyDown    += HandleKeyAction;
     _Azuki.GotFocus   += delegate {
         DeactivateSearchPanel();
     };
     _Azuki.OverwriteModeChanged += _Azuki_OverwriteModeChanged;
     //
     // _TabPanel
     //
     _TabPanel.Dock = DockStyle.Top;
     //
     // _SearchPanel
     //
     _SearchPanel.Dock    = DockStyle.Bottom;
     _SearchPanel.Enabled = false;
     //
     // _StatusBar
     //
     _StatusBar.Dock = DockStyle.Bottom;
     _StatusBar.Panels.AddRange(new StatusBarPanel[] {
         _Status_Message, _Status_CaretPos,
         _Status_SelectionMode, _Status_InsertionMode
     });
     _StatusBar.ShowPanels = true;
     _StatusBar.SizingGrip = true;
     //
     // _Status_CaretPos
     //
     _Status_CaretPos.Alignment = HorizontalAlignment.Right;
     //
     // _Status_Message
     //
     _Status_Message.AutoSize = StatusBarPanelAutoSize.Spring;
     //
     // _MI_File
     //
     _MI_File.Popup += _MI_File_Popup;
     //
     // _MI_Edit
     //
     _MI_Edit.Popup += _MI_Edit_Popup;
     //
     // _MI_Window
     //
     _MI_Window.Popup += _MI_Window_Popup;
     //
     // AnnForm
     //
     ClientSize = new Size(360, 400);
     Controls.Add(_Azuki);
     Controls.Add(_TabPanel);
     Controls.Add(_SearchPanel);
     Controls.Add(_StatusBar);
     Text = "Ann";
     ResumeLayout(false);
 }
Esempio n. 20
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="azuki">AzukiControl</param>
        public FrmMoveLine(AzukiControl azuki)
        {
            InitializeComponent();

            this.azuki = azuki;
        }
Esempio n. 21
0
        public EditorConfig(Config config)
        {
            IsFontChanged = false;
            IsColorChanged = false;
            IsViewChanged = false;

            this.config = config;

            InitializeComponent();
            editor = new AzukiControl();
            editor.ShowsHScrollBar = false;
            editor.Dock = DockStyle.Fill;
            editor.Text = Resources.EditorPreviewText;
            panel.Controls.Add(editor);

            FontSelectButton.Text = this.config.EditorFont.Name + "(" + this.config.EditorFont.Size + ")";
            FontSelectButton.Click += (sender, e) => {
                var res = EditorFontDialog.ShowDialog();
                if (res == DialogResult.OK) {
                    var EditorFont = EditorFontDialog.Font;
                    FontSelectButton.Text = EditorFont.Name + "(" + EditorFont.Size + ")";
                    editor.Font = EditorFont;

                    IsFontChanged = true;
                }
            };

            FontColorButton.Click += (sender, e) => {
                var res = EditorColorDialog.ShowDialog();
                if (res == DialogResult.OK) {
                    editor.ForeColor = EditorColorDialog.Color;
                    IsColorChanged = true;
                }
            };

            BackColorButton.Click += (sender, e) => {
                var res = EditorColorDialog.ShowDialog();
                if (res == DialogResult.OK) {
                    editor.BackColor = EditorColorDialog.Color;
                    IsColorChanged = true;
                }
            };

            ShowTabCheckBox.CheckedChanged += (s, e) => {
                editor.View.DrawsTab = ShowTabCheckBox.Checked;
                IsViewChanged = true;
            };
            ShowEolCheckBox.CheckedChanged += (s, e) => {
                editor.View.DrawsEolCode = ShowEolCheckBox.Checked;
                IsViewChanged = true;
            };
            ShowSpaceCheckBox.CheckedChanged += (s, e) => {
                editor.View.DrawsSpace = ShowSpaceCheckBox.Checked;
                IsViewChanged = true;
            };
            ShowZenSpaceCheckBox.CheckedChanged += (s, e) => {
                editor.View.DrawsFullWidthSpace = ShowZenSpaceCheckBox.Checked;
                IsViewChanged = true;
            };

            //
            foreach (var item in this.config.SnippetList){
                SnippetListBox.Items.Add(item);
            }

            NewButton.Click += (s, e) => {
                var edit = new SnippetEditForm();
                edit.StartPosition = FormStartPosition.CenterParent;
                var res = edit.ShowDialog(this);
                if (res == DialogResult.OK) {
                    SnippetListBox.Items.Add(edit.Code);
                }
                edit.Close();
            };
            EditButton.Click += (s, e) => {
                var edit = new SnippetEditForm();
                edit.Code = SnippetListBox.SelectedItem.ToString();
                var res = edit.ShowDialog(this);
                if (res == DialogResult.OK) {
                    SnippetListBox.SelectedItem = edit.Code;
                }
            };
            DeleteButton.Click += (s, e) => {
                SnippetListBox.Items.RemoveAt(SnippetListBox.SelectedIndex);
            };

            this.Load += (s, e) => {
                editor.Font = config.EditorFont;
                editor.ForeColor = config.EditorFontColor;
                editor.BackColor = config.EditorBackColor;

                editor.DrawsTab = config.ShowTab;
                editor.DrawsEolCode = config.ShowEol;
                editor.DrawsSpace = config.ShowSpace;
                editor.DrawsFullWidthSpace = config.ShowZenSpace;

                ShowTabCheckBox.Checked = editor.DrawsTab;
                ShowEolCheckBox.Checked = editor.DrawsEolCode;
                ShowSpaceCheckBox.Checked = editor.DrawsSpace;
                ShowZenSpaceCheckBox.Checked = editor.DrawsFullWidthSpace;
            };
            this.Disposed += (s, e) => {
                if (editor != null) {
                    editor.Dispose();
                }
            };
        }