Skip to content

Commit

Permalink
fixed mantis #0002135 (reduce horizontal and vertical text scroll-spe…
Browse files Browse the repository at this point in the history
…eds)

- added divider (3 for speed = 1, 2 for speed = 2) for horizontal scrolling
- adjusted scrolling range (speed = 3 is now mapped to what previously had been speed 1: move 1 pixel right on every frame update)
- made speed = 3 default (does not affect existing installations)

Now at speed 1 / 1 @ 50 FPS the scrolling is fairly slow. At 25 @ FPS you might even go and fetch a beer from the fridge and still be able to read the complete text. Okay - you maybe can't in Austria ;)
  • Loading branch information
terveer committed Apr 27, 2009
1 parent 78a9e2e commit df31123
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 16 deletions.
17 changes: 14 additions & 3 deletions mediaportal/Core/guilib/GUIFadeLabel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,20 @@ private bool RenderText(float timePassed, float fPosX, float fPosY, float fMaxWi
// doscroll (after having waited some frames)
string wTmp = "";

//_scrollPosititionX = _currentFrame - (12 + 25);
//if (_frameLimiter % (2) == 0)
_scrollPosititionX = _scrollPosititionX + GUIGraphicsContext.ScrollSpeedHorizontal;
// Add an especially slow setting for far distance + small display + bad eyes + foreign language combination
if (GUIGraphicsContext.ScrollSpeedHorizontal < 3)
{
// Advance one pixel every 3 or 2 frames
if (_frameLimiter % (4 - GUIGraphicsContext.ScrollSpeedHorizontal) == 0)
{
_scrollPosititionX++;
}
}
else
{
// advance 1 - 3 pixels every frame
_scrollPosititionX = _scrollPosititionX + (GUIGraphicsContext.ScrollSpeedHorizontal - 2);
}

if (_scrollPosition >= wszOrgText.Length)
{
Expand Down
26 changes: 23 additions & 3 deletions mediaportal/Core/guilib/GUIFilmstripControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public enum SearchType
private DateTime _idleTimer = DateTime.Now;
private bool _infoChanged = false;
private string _newInfoImageName = "";

private int _frameLimiter = 1;
protected double _scrollOffset = 0.0f;
protected double _timeElapsed = 0.0f;
protected bool _scrollContinuosly = false;
Expand Down Expand Up @@ -682,12 +682,12 @@ private void RenderItem(int itemNumber, float timePassed, bool bFocus, int dwPos
public override void Render(float timePassed)
{
_timeElapsed += timePassed;

if (null == _font)
{
base.Render(timePassed);
return;
}

if (GUIGraphicsContext.EditMode == false)
{
if (!IsVisible)
Expand All @@ -709,6 +709,11 @@ public override void Render(float timePassed)
_sleeper--;
}

if (_frameLimiter < GUIGraphicsContext.MaxFPS)
_frameLimiter++;
else
_frameLimiter = 1;

UpdateInfoImage();
if (_imageBackground != null && _showBackGround)
{
Expand Down Expand Up @@ -2172,7 +2177,21 @@ private void RenderText(float fPosX, float fPosY, long dwTextColor, string wszTe
//{
// _scrollPosititionX = _currentFrame - (25 + 12);
//}
_scrollPosititionX = _scrollPosititionX + GUIGraphicsContext.ScrollSpeedHorizontal;

// Add an especially slow setting for far distance + small display + bad eyes + foreign language combination
if (GUIGraphicsContext.ScrollSpeedHorizontal < 3)
{
// Advance one pixel every 3 or 2 frames
if (_frameLimiter % (4 - GUIGraphicsContext.ScrollSpeedHorizontal) == 0)
{
_scrollPosititionX++;
}
}
else
{
// advance 1 - 3 pixels every frame
_scrollPosititionX = _scrollPosititionX + (GUIGraphicsContext.ScrollSpeedHorizontal - 2);
}

char wTmp;
if (_scrollPosition >= _brackedText.Length)
Expand Down Expand Up @@ -3381,6 +3400,7 @@ public void Clear()
_upDownControl.SetRange(1, 1);
_upDownControl.Value = 1;
_cursorX = _offset = 0;
_frameLimiter = 1;
_refresh = true;
OnSelectionChanged();
}
Expand Down
2 changes: 1 addition & 1 deletion mediaportal/Core/guilib/GUIFont.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ public void InitializeDeviceObjects()
Log.Debug(" Loaded font:{0} height:{1} texture:{2}x{3} chars:[{4}-{5}] miplevels:{6}", _fontName, _fontHeight,
_textureWidth, _textureHeight, _StartCharacter, _EndCharacter, _textureFont.LevelCount);
}
catch (Exception exload)
catch (Exception)
{
// Deserialisation failed. Maybe the language changed or the font cache got manipulated.
Log.Error("GUIFont: Failed to load font {0} from cache. Trying to recreate it...", _fontName);
Expand Down
27 changes: 23 additions & 4 deletions mediaportal/Core/guilib/GUIListControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public enum SearchType
[XMLSkinElement("spinCanFocus")] protected bool _spinCanFocus = true;

private bool _wordWrapping = false;

private int _frameLimiter = 1;
// Search
private DateTime _timerKey = DateTime.Now;
private char _currentKey = (char) 0;
Expand Down Expand Up @@ -786,13 +786,13 @@ protected virtual void RenderLabel(float timePassed, int buttonNr, int dwPosX, i
public override void Render(float timePassed)
{
_timeElapsed += timePassed;

// If there is no font do not render.
if (null == _font)
{
base.Render(timePassed);
return;
}

// If the control is not visible do not render.
if (GUIGraphicsContext.EditMode == false)
{
Expand All @@ -803,6 +803,11 @@ public override void Render(float timePassed)
}
}

if (_frameLimiter < GUIGraphicsContext.MaxFPS)
_frameLimiter++;
else
_frameLimiter = 1;

int dwPosY = _positionY;

// Render the buttons first.
Expand Down Expand Up @@ -1074,8 +1079,21 @@ protected void RenderText(float timePassed, int Item, GUILabelControl label, boo
}
if ((int)_timeElapsed > _scrollStartDelay || _scrollContinuosly)
{
_scrollPosititionX = _scrollPosititionX + GUIGraphicsContext.ScrollSpeedHorizontal;
//Log.Debug("*** Listcontrol _scrollPosititionX = {0}", _scrollPosititionX);
// Add an especially slow setting for far distance + small display + bad eyes + foreign language combination
if (GUIGraphicsContext.ScrollSpeedHorizontal < 3)
{
// Advance one pixel every 3 or 2 frames
if (_frameLimiter % (4 - GUIGraphicsContext.ScrollSpeedHorizontal) == 0)
{
_scrollPosititionX++;
}
}
else
{
// advance 1 - 3 pixels every frame
_scrollPosititionX = _scrollPosititionX + (GUIGraphicsContext.ScrollSpeedHorizontal - 2);
}

char wTmp;
if (_scrollPosition >= _brackedText.Length)
{
Expand Down Expand Up @@ -3368,6 +3386,7 @@ public void Clear()
//GUITextureManager.CleanupThumbs();
_upDownControl.SetRange(1, 1);
_upDownControl.Value = 1;
_frameLimiter = 1;
_refresh = true;
OnSelectionChanged();
}
Expand Down
27 changes: 24 additions & 3 deletions mediaportal/Core/guilib/GUIThumbnailPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public enum SearchType
protected double _scrollOffset = 0.0f;
protected double _timeElapsed = 0.0f;
protected bool _scrollContinuosly = false;

private int _frameLimiter = 1;
// Search
private DateTime _keyTimer = DateTime.Now;
private char _currentKey = (char)0;
Expand Down Expand Up @@ -657,6 +657,7 @@ public override void Render(float timePassed)
base.Render(timePassed);
return;
}

if (GUIGraphicsContext.EditMode == false)
{
if (!IsVisible)
Expand All @@ -666,6 +667,11 @@ public override void Render(float timePassed)
}
}

if (_frameLimiter < GUIGraphicsContext.MaxFPS)
_frameLimiter++;
else
_frameLimiter = 1;

int dwPosY = 0;
if ((_cursorX > 0 || _cursorY > 0) && !ValidItem(_cursorX, _cursorY))
{
Expand Down Expand Up @@ -2243,8 +2249,22 @@ private void RenderText(float fPosX, float fPosY, long dwTextColor, string wszTe
//{
// _scrollPosititionX = _currentFrame - (25 + 12);
//}
_scrollPosititionX = _scrollPosititionX + GUIGraphicsContext.ScrollSpeedHorizontal;
//Log.Debug("*** Thumbpanel _scrollPosititionX = {0}", _scrollPosititionX);

// Add an especially slow setting for far distance + small display + bad eyes + foreign language combination
if (GUIGraphicsContext.ScrollSpeedHorizontal < 3)
{
// Advance one pixel every 3 or 2 frames
if (_frameLimiter % (4 - GUIGraphicsContext.ScrollSpeedHorizontal) == 0)
{
_scrollPosititionX++;
}
}
else
{
// advance 1 - 3 pixels every frame
_scrollPosititionX = _scrollPosititionX + (GUIGraphicsContext.ScrollSpeedHorizontal - 2);
}

char wTmp;
if (_scrollPosition >= _brackedText.Length)
{
Expand Down Expand Up @@ -2968,6 +2988,7 @@ public void Clear()
_controlUpDown.SetRange(1, 1);
_controlUpDown.Value = 1;
_cursorX = _cursorY = _offset = 0;
_frameLimiter = 1;
_refresh = true;
OnSelectionChanged();
}
Expand Down
4 changes: 2 additions & 2 deletions mediaportal/Core/guilib/GraphicContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public enum State

private static bool m_bPlayingVideo = false; //boolean indicating if we are playing a movie
private static int m_iScrollSpeedVertical = 4; //scroll speed for controls which scroll
private static int m_iScrollSpeedHorizontal = 1; //scroll speed for controls which scroll
private static int m_iScrollSpeedHorizontal = 3; //scroll speed for controls which scroll
private static int m_iCharsInCharacterSet = 255; //number of characters for current fonts
private static bool m_bEditMode = false; //boolean indicating if we are in skin edit mode
private static bool m_bAnimations = true; //boolean indicating animiations are turned on or off
Expand Down Expand Up @@ -494,7 +494,7 @@ public static void Load()
m_iMaxFPS = xmlReader.GetValueAsInt("screen", "GuiRenderFps", 50);
SyncFrameTime();
m_iScrollSpeedVertical = xmlReader.GetValueAsInt("general", "ScrollSpeedDown", 4);
m_iScrollSpeedHorizontal = xmlReader.GetValueAsInt("general", "ScrollSpeedRight", 1);
m_iScrollSpeedHorizontal = xmlReader.GetValueAsInt("general", "ScrollSpeedRight", 3);
m_bAnimations = xmlReader.GetValueAsBool("general", "animations", true);
turnOffMonitor = xmlReader.GetValueAsBool("general", "turnoffmonitor", false);

Expand Down

0 comments on commit df31123

Please sign in to comment.