aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.Frontend/Apps
diff options
context:
space:
mode:
authorRogueAI42 <[email protected]>2017-08-01 17:48:12 +1000
committerRogueAI42 <[email protected]>2017-08-01 17:48:12 +1000
commit9cad19bf1a099cf2ca166f1151d406d7ebef4d2a (patch)
tree171832029be05404a87bc428c21b612e9193b820 /ShiftOS.Frontend/Apps
parentaa3de1b749800a6f82f4b04d559af33e0f450610 (diff)
parent6fd95f912823efc2901e7735df63e1aefa2ebb73 (diff)
downloadshiftos_thereturn-9cad19bf1a099cf2ca166f1151d406d7ebef4d2a.tar.gz
shiftos_thereturn-9cad19bf1a099cf2ca166f1151d406d7ebef4d2a.tar.bz2
shiftos_thereturn-9cad19bf1a099cf2ca166f1151d406d7ebef4d2a.zip
Merge remote-tracking branch 'upstream/monogame' into monogame
Diffstat (limited to 'ShiftOS.Frontend/Apps')
-rw-r--r--ShiftOS.Frontend/Apps/Terminal.cs24
1 files changed, 22 insertions, 2 deletions
diff --git a/ShiftOS.Frontend/Apps/Terminal.cs b/ShiftOS.Frontend/Apps/Terminal.cs
index 0f8ddde..9fe71de 100644
--- a/ShiftOS.Frontend/Apps/Terminal.cs
+++ b/ShiftOS.Frontend/Apps/Terminal.cs
@@ -23,6 +23,13 @@ namespace ShiftOS.Frontend.Apps
{
private TerminalControl _terminal = null;
+ public TerminalControl TerminalControl
+ {
+ get
+ {
+ return _terminal;
+ }
+ }
public Terminal()
{
@@ -133,6 +140,19 @@ namespace ShiftOS.Frontend.Apps
protected void RecalculateLayout()
{
+ using(var gfx = Graphics.FromImage(new Bitmap(1, 1)))
+ {
+ var cloc = GetPointAtIndex(gfx);
+ var csize = gfx.MeasureString("#", new Font(LoadedSkin.TerminalFont.Name, LoadedSkin.TerminalFont.Size * _zoomFactor, LoadedSkin.TerminalFont.Style));
+ if(cloc.Y - _vertOffset < 0)
+ {
+ _vertOffset += cloc.Y - _vertOffset;
+ }
+ while((cloc.Y + csize.Height) - _vertOffset > Height)
+ {
+ _vertOffset += csize.Height;
+ }
+ }
}
private bool blinkStatus = false;
@@ -370,12 +390,12 @@ namespace ShiftOS.Frontend.Apps
cursorPos.X = lineMeasure.X;
}
- gfx.DrawRectangle((int)cursorPos.X, (int)cursorPos.Y, (int)cursorSize.X, (int)cursorSize.Y, LoadedSkin.TerminalForeColorCC.ToColor().ToMonoColor());
+ gfx.DrawRectangle((int)cursorPos.X, (int)(cursorPos.Y - _vertOffset), (int)cursorSize.X, (int)cursorSize.Y, LoadedSkin.TerminalForeColorCC.ToColor().ToMonoColor());
}
//Draw the text
- gfx.DrawString(Text, 2, 2, LoadedSkin.TerminalForeColorCC.ToColor().ToMonoColor(), font, Width - 4);
+ gfx.DrawString(Text, 0, (int)(0 - _vertOffset), LoadedSkin.TerminalForeColorCC.ToColor().ToMonoColor(), font, Width - 4);
}
}