Beispiel #1
0
 private Color DetermineNormalForeColor(GAttr attr, GColor24 color24)
 {
     if (attr.Has(GAttrFlags.Use8bitForeColor))
     {
         return(GetESForeColor(attr.ForeColor));
     }
     if (attr.Has(GAttrFlags.Use24bitForeColor))
     {
         return(color24.ForeColor);
     }
     return(this.ForeColor);
 }
Beispiel #2
0
 private Color DetermineNormalBackColor(GAttr attr, GColor24 color24)
 {
     if (attr.Has(GAttrFlags.Use8bitBackColor))
     {
         return(GetESBackColor(attr.BackColor));
     }
     if (attr.Has(GAttrFlags.Use24bitBackColor))
     {
         return(color24.BackColor);
     }
     return(this.BackColor);
 }
Beispiel #3
0
 internal IntPtr CalcHFONT_NoUnderline(GAttr attr)
 {
     return(CalcFontInternal(
                attr.Has(GAttrFlags.UseCjkFont),
                DetermineBold(attr),
                false).HFONT);
 }
Beispiel #4
0
        internal void DetermineColors(GAttr attr, GColor24 color24, Caret caret, Color baseBackColor, out Color backColor, out Color foreColor)
        {
            if (_brush == null)
            {
                CreateBrushes();
            }

            bool inverted = attr.Has(GAttrFlags.Inverted) ^ attr.Has(GAttrFlags.Selected);

            bool blinkStatus = caret.IsActiveTick;

            if (attr.Has(GAttrFlags.Cursor) && (!caret.Blink || blinkStatus))
            {
                if (inverted)
                {
                    // paint as normal
                    backColor = DetermineActualBackColor(caret.Color.IsEmpty ? DetermineNormalBackColor(attr, color24) : caret.Color, baseBackColor);
                    foreColor = DetermineNormalForeColor(attr, color24);
                }
                else
                {
                    // paint as inverted
                    backColor = DetermineActualBackColor(caret.Color.IsEmpty ? DetermineNormalForeColor(attr, color24) : caret.Color, baseBackColor);
                    foreColor = DetermineNormalBackColor(attr, color24);
                }
            }
            else
            {
                bool isHidden = attr.Has(GAttrFlags.Hidden) || (attr.Has(GAttrFlags.Blink) && !blinkStatus);

                if (inverted)
                {
                    backColor = DetermineActualBackColor(DetermineNormalForeColor(attr, color24), baseBackColor);
                    foreColor = isHidden ? Color.Transparent : DetermineNormalBackColor(attr, color24);
                }
                else
                {
                    backColor = DetermineActualBackColor(DetermineNormalBackColor(attr, color24), baseBackColor);
                    foreColor = isHidden ? Color.Transparent : DetermineNormalForeColor(attr, color24);
                }
            }
        }
Beispiel #5
0
        internal bool DetermineBold(GAttr attr)
        {
            if (_forceBoldStyle)
            {
                return(true);
            }

            if (_enableBoldStyle)
            {
                return(attr.Has(GAttrFlags.Bold));
            }

            return(false);
        }
Beispiel #6
0
 /// <summary>
 /// Gets <see cref="ColorSpec"/> of the fore color.
 /// </summary>
 /// <returns><see cref="ColorSpec"/> of the fore color</returns>
 public ColorSpec GetForeColorSpec()
 {
     if (_attr.Has(GAttrFlags.Use8bitForeColor))
     {
         return(new ColorSpec(_attr.ForeColor));
     }
     if (_attr.Has(GAttrFlags.Use24bitForeColor))
     {
         return(new ColorSpec(_color24.ForeColor));
     }
     return(ColorSpec.Default);
 }