コード例 #1
0
ファイル: GlossyTextBlock.cs プロジェクト: StHillmann/disfr
        private static void InitializeGlossMap()
        {
            var map = new GlossEntry[Enum.GetValues(typeof(Gloss)).Cast <int>().Aggregate((x, y) => x | y) + 1];

            // This is primarity for debugging.
            for (var i = 0; i < map.Length; i++)
            {
                map[i] = GlossEntry.ERROR;
            }

            Brush NOR = Brushes.Black;
            Brush TAG = Brushes.Purple;
            Brush SYM = Brushes.Gray;

            Brush COMBG = Brushes.Transparent;
            Brush INSBG = Brushes.LightBlue;
            Brush DELBG = Brushes.LightPink;

            map[(int)(Gloss.NOR | Gloss.COM)] = new GlossEntry(NOR, COMBG, null);
            map[(int)(Gloss.NOR | Gloss.INS)] = new GlossEntry(NOR, INSBG, null);
            map[(int)(Gloss.NOR | Gloss.DEL)] = new GlossEntry(NOR, DELBG, null);
            map[(int)(Gloss.TAG | Gloss.COM)] = new GlossEntry(TAG, COMBG, null);
            map[(int)(Gloss.TAG | Gloss.INS)] = new GlossEntry(TAG, INSBG, null);
            map[(int)(Gloss.TAG | Gloss.DEL)] = new GlossEntry(TAG, DELBG, null);
            map[(int)(Gloss.SYM | Gloss.COM)] = GlossEntry.IGNORE;
            map[(int)(Gloss.SYM | Gloss.INS)] = GlossEntry.IGNORE;
            map[(int)(Gloss.SYM | Gloss.DEL)] = GlossEntry.IGNORE;
            map[(int)(Gloss.ALT | Gloss.COM)] = new GlossEntry(SYM, COMBG, null);
            map[(int)(Gloss.ALT | Gloss.INS)] = new GlossEntry(SYM, INSBG, null);
            map[(int)(Gloss.ALT | Gloss.DEL)] = new GlossEntry(SYM, DELBG, null);

            GlossMap = map;
        }
コード例 #2
0
        private static void InitializeGlossMap()
        {
            var map = new GlossEntry[Enum.GetValues(typeof(Gloss)).Cast <int>().Aggregate((x, y) => x | y) + 1];

            // This is primarity for debugging.
            for (var i = 0; i < map.Length; i++)
            {
                map[i] = GlossEntry.ERROR;
            }

            Brush NOR = Brushes.Black;
            Brush TAG = Brushes.Purple;
            Brush SYM = Brushes.Gray;

            Brush COMBG = Brushes.Transparent;
            Brush INSBG = Brushes.LightGreen;
            Brush DELBG = Brushes.LightPink;
            Brush EMPBG = Brushes.Yellow;

            var STRIKE = new TextDecorationCollection()
            {
                TextDecorations.Strikethrough
            };

            STRIKE.Freeze();

            map[(int)(Gloss.NOR | Gloss.COM)] = new GlossEntry(NOR, COMBG, null);
            map[(int)(Gloss.NOR | Gloss.INS)] = new GlossEntry(NOR, INSBG, null);
            map[(int)(Gloss.NOR | Gloss.DEL)] = new GlossEntry(NOR, DELBG, STRIKE);
            map[(int)(Gloss.NOR | Gloss.EMP)] = new GlossEntry(NOR, EMPBG, null);
            map[(int)(Gloss.TAG | Gloss.COM)] = new GlossEntry(TAG, COMBG, null);
            map[(int)(Gloss.TAG | Gloss.INS)] = new GlossEntry(TAG, INSBG, null);
            map[(int)(Gloss.TAG | Gloss.DEL)] = new GlossEntry(TAG, DELBG, STRIKE);
            map[(int)(Gloss.TAG | Gloss.EMP)] = new GlossEntry(TAG, EMPBG, null);
            map[(int)(Gloss.SYM | Gloss.COM)] = GlossEntry.IGNORE;
            map[(int)(Gloss.SYM | Gloss.INS)] = GlossEntry.IGNORE;
            map[(int)(Gloss.SYM | Gloss.DEL)] = GlossEntry.IGNORE;
            map[(int)(Gloss.SYM | Gloss.EMP)] = GlossEntry.IGNORE;
            map[(int)(Gloss.ALT | Gloss.COM)] = new GlossEntry(SYM, COMBG, null);
            map[(int)(Gloss.ALT | Gloss.INS)] = new GlossEntry(SYM, INSBG, null);
            map[(int)(Gloss.ALT | Gloss.DEL)] = new GlossEntry(SYM, DELBG, STRIKE);
            map[(int)(Gloss.ALT | Gloss.EMP)] = new GlossEntry(SYM, EMPBG, null);

            GlossMap = map;
        }