Beispiel #1
0
        public static int[] GetMeasure(Sgry.Azuki.Document doc)
        {
            var listLine     = doc.Text.Replace(",", ",\n").Split('\n');
            var listMeasure  = new List <string>();
            var indexMeasure = "";

            foreach (var item in listLine)
            {
                var nowLine = Regex.Replace(item, @" *//.*", "");
                if (nowLine.StartsWith("#") || nowLine.IndexOf(':') >= 0)
                {
                    // コマンド行、ヘッダ行である
                    indexMeasure += nowLine + "\n";
                }
                else if (nowLine.IndexOf(',') >= 0)
                {
                    // カンマのある行である
                    indexMeasure += nowLine;
                    listMeasure.Add(indexMeasure);
                    indexMeasure = "";
                }
                else
                {
                    indexMeasure += nowLine + "\n";
                }
            }
            var totalMeasure = listMeasure.Count; // 総小節数
            var nowCaret     = new int[] { 0, 0 };

            doc.GetCaretIndex(out nowCaret[0], out nowCaret[1]);
            var caret           = doc.GetCharIndexFromLineColumnIndex(nowCaret[0], nowCaret[1]);
            var listNowLine     = doc.GetTextInRange(0, caret).Replace(",", ",\n").Split('\n');
            var listNowMeasure  = new List <string>();
            var nowIndexMeasure = "";

            foreach (var item in listNowLine)
            {
                var nowLine = Regex.Replace(item, @" *//.*", "");
                if (nowLine.StartsWith("#") || nowLine.IndexOf(':') >= 0)
                {
                    // コマンド行、ヘッダ行である
                    nowIndexMeasure += nowLine;
                }
                else if (nowLine.IndexOf(',') >= 0)
                {
                    // カンマのある行である
                    nowIndexMeasure += nowLine;
                    listNowMeasure.Add(nowIndexMeasure);
                    nowIndexMeasure = "";
                }
                else
                {
                    indexMeasure += nowLine + "\n";
                }
            }
            return(new int[] { listMeasure.Count, listNowMeasure.Count });
        }
Beispiel #2
0
 public Editor(Sgry.Azuki.Document doc, Course course)
 {
     InitializeComponent();
     TextEditor.Document = doc;
     Text = Properties.Common.Editor + course.Name;
     TextEditor.Highlighter = null;
     TextEditor.Highlighter = Highlighter.InitHighlighter();
     ColorScheme.SetColorScheme(TextEditor.ColorScheme, Program.Setting);
     TextEditor.ForeColor = Program.Setting.Editor_ForeColor;
     TextEditor.BackColor = Program.Setting.Editor_BackColor;
     TextEditor.Font      = new Font(Program.Setting.FontName, Program.Setting.FontSize);
     TextEditor.SetKeyBind(Keys.Back | Keys.Shift, Sgry.Azuki.Actions.BackSpace);
     TextEditor.ShowsLineNumber      = Program.Setting.Show_Line_Number;
     TextEditor.ShowsHRuler          = Program.Setting.Show_Horizontal_Ruler;
     TextEditor.HRulerStartsFromZero = Program.Setting.Show_Horizontal_Ruler_Zero;
     TextEditor.DrawsEofMark         = Program.Setting.Show_EoF_Mark;
     TextEditor.DrawsEolCode         = Program.Setting.Show_EoL_Mark;
     TextEditor.DrawsFullWidthSpace  = Program.Setting.Show_Space_Mark;
     TextEditor.DrawsSpace           = Program.Setting.Show_Space_Mark;
     TextEditor.DrawsTab             = Program.Setting.Show_Tab_Mark;
 }