looks slightly better

This commit is contained in:
Miguel de Icaza
2018-01-25 23:24:47 -05:00
parent 06e8c5c540
commit 29d355660e
2 changed files with 102 additions and 16 deletions

View File

@@ -177,6 +177,46 @@ namespace Terminal.Gui {
/// </summary>
Diamond,
/// <summary>
/// Upper left corner
/// </summary>
ULCorner,
/// <summary>
/// Lower left corner
/// </summary>
LLCorner,
/// <summary>
/// Upper right corner
/// </summary>
URCorner,
/// <summary>
/// Lower right corner
/// </summary>
LRCorner,
/// <summary>
/// Left tee
/// </summary>
LeftTee,
/// <summary>
/// Right tee
/// </summary>
RightTee,
/// <summary>
/// Top tee
/// </summary>
TopTee,
/// <summary>
/// The bottom tee.
/// </summary>
BottomTee,
}
/// <summary>
@@ -312,16 +352,40 @@ namespace Terminal.Gui {
{
switch (ch) {
case SpecialChar.HLine:
AddRune (Curses.ACS_HLINE);
AddRune(Curses.ACS_HLINE);
break;
case SpecialChar.VLine:
AddRune (Curses.ACS_VLINE);
AddRune(Curses.ACS_VLINE);
break;
case SpecialChar.Stipple:
AddRune (Curses.ACS_CKBOARD);
AddRune(Curses.ACS_CKBOARD);
break;
case SpecialChar.Diamond:
AddRune (Curses.ACS_DIAMOND);
AddRune(Curses.ACS_DIAMOND);
break;
case SpecialChar.ULCorner:
AddRune (Curses.ACS_ULCORNER);
break;
case SpecialChar.LLCorner:
AddRune (Curses.ACS_LLCORNER);
break;
case SpecialChar.URCorner:
AddRune (Curses.ACS_URCORNER);
break;
case SpecialChar.LRCorner:
AddRune (Curses.ACS_LRCORNER);
break;
case SpecialChar.LeftTee:
AddRune (Curses.ACS_LTEE);
break;
case SpecialChar.RightTee:
AddRune (Curses.ACS_RTEE);
break;
case SpecialChar.TopTee:
AddRune (Curses.ACS_TTEE);
break;
case SpecialChar.BottomTee:
AddRune (Curses.ACS_BTEE);
break;
}
}

View File

@@ -112,32 +112,54 @@ namespace Terminal.Gui {
if (true || ShowVerticalScrollIndicator) {
var bh = Bounds.Height;
var by1 = contentOffset.Y * bh/ contentSize.Height;
var by2 = (contentOffset.Y+bh) * bh/ contentSize.Height;
var by1 = -contentOffset.Y * bh/ contentSize.Height;
var by2 = (-contentOffset.Y+bh) * bh/ contentSize.Height;
for (int y = 0; y < bh; y++) {
Move (Bounds.Width - 1, y);
SpecialChar special;
if (y < by1 || y > by2)
Driver.AddSpecial (SpecialChar.Stipple);
else
Driver.AddSpecial (SpecialChar.Diamond);
special = SpecialChar.Stipple;
else {
if (by2 - by1 == 0)
special = SpecialChar.Diamond;
else {
if (y == by1)
special = SpecialChar.TopTee;
else if (y == by2)
special = SpecialChar.BottomTee;
else
special = SpecialChar.VLine;
}
}
Driver.AddSpecial (special);
}
}
if (true || ShowHorizontalScrollIndicator){
var bw = Bounds.Width;
var bx1 = contentOffset.X * bw / contentSize.Width;
var bx2 = (contentOffset.X + bw) * bw / contentSize.Width;
var bx1 = -contentOffset.X * bw / contentSize.Width;
var bx2 = (-contentOffset.X + bw) * bw / contentSize.Width;
Move (0, Bounds.Height - 1);
for (int x = 0; x < bw; x++) {
SpecialChar special;
if (x < bx1 || x > bx2){
SetColor (ColorScheme.Normal);
Driver.AddSpecial (SpecialChar.Stipple);
special = SpecialChar.Stipple;
} else {
// Driver.AddSpecial (SpecialChar.Diamond);
SetColor (ColorScheme.Focus);
Driver.AddSpecial (SpecialChar.Stipple);
if (bx2 - bx1 == 0)
special = SpecialChar.Diamond;
else {
if (x == bx1)
special = SpecialChar.LeftTee;
else if (x == bx2)
special = SpecialChar.RightTee;
else
special = SpecialChar.HLine;
}
}
Driver.AddSpecial (special);
}
}
}