[Approved] Fixed vertical and horizontal scrollbars (1 Viewer)

pilehave

Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    As mentioned in https://forum.team-mediaportal.com/...-proper-horizontal-scrollbar-filmstrip-92861/ I have now also fixed the vertical scrollbar.

    There were several fixes:


    • scrollbars now scales to screen resolution
    • when selecteditem was the first one, the percentage was not always zero, but sometimes an obscure value like 0.019281 (really close to zero, but not quite).
    • there was a mismatch between the itemcount of the list and the max percentage, which meant that 100% could never be reached. It would always be missing the percentage of the last listitem.
     

    Attachments

    • scrollbar_top.jpg
      scrollbar_top.jpg
      197.4 KB
    • scrollbar_bottom.jpg
      scrollbar_bottom.jpg
      232.6 KB
    • Collected fixes scrollbar.patch
      7.1 KB

    SilentException

    Retired Team Member
  • Premium Supporter
  • October 27, 2008
    2,617
    1,130
    Rijeka, Croatia
    Home Country
    Croatia Croatia
    Patch was missing a line fix in GUIPlayListItemListControl.cs (RenderScrollbar(timePassed, dwPosX) -> RenderScrollbar(timePassed)) and you had some comments left. I fixed that.

    Some things I'm wondering tho:

    Vertical Scrollbar:

    Code:
          _imageBackground.Height = iHeight;
          _imageBackground.Render(timePassed);
    
          float fPercent = (float)_percentage;
          float fPosYOff = (fPercent / 100.0f);
    
          // Scale handle-parts for resolution
    
          int backgroundWidth = _imageBackground.TextureWidth;
          GUIGraphicsContext.ScaleVertical(ref backgroundWidth);
          _imageBackground.Width = backgroundWidth;

    Isn't it more logical to set width and stuff first, then do render on _imageBackground?


    Same thing is in Horizontal Scrollbar, you don't even do ScaleVertical there.
     

    pilehave

    Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    • Thread starter
    • Moderator
    • #3
    Patch was missing a line fix in GUIPlayListItemListControl.cs (RenderScrollbar(timePassed, dwPosX) -> RenderScrollbar(timePassed)) and you had some comments left. I fixed that.

    Some things I'm wondering tho:

    Vertical Scrollbar:

    Code:
          _imageBackground.Height = iHeight;
          _imageBackground.Render(timePassed);
    
          float fPercent = (float)_percentage;
          float fPosYOff = (fPercent / 100.0f);
    
          // Scale handle-parts for resolution
    
          int backgroundWidth = _imageBackground.TextureWidth;
          GUIGraphicsContext.ScaleVertical(ref backgroundWidth);
          _imageBackground.Width = backgroundWidth;

    Isn't it more logical to set width and stuff first, then do render on _imageBackground?


    Same thing is in Horizontal Scrollbar, you don't even do ScaleVertical there.

    Ah, must have missed that one, sorry :(

    I'm sure it will be just fine to put the render part in after resizing the handle (knob). If it makes the code easier to read, we should do that.

    About the ScaleVertical, I'm not sure what you mean, but I do scale the handle-parts:

    Code:
          // Scale handle-parts for resolution. Background is already scaled in parent control
          int handleHeight = _imageLeft.TextureHeight;
          GUIGraphicsContext.ScaleVertical(ref handleHeight);
          _imageLeft.Height = handleHeight;
          _imageRight.Height = handleHeight;
    
          int handleWidth = _imageLeft.TextureWidth;
          GUIGraphicsContext.ScaleVertical(ref handleWidth);
          _imageLeft.Width = handleWidth;
          _imageRight.Width = handleWidth;

    The background is already scaled by the buddy-control
     

    elliottmc

    Retired Team Member
  • Premium Supporter
  • August 7, 2005
    14,927
    6,061
    Cardiff, UK
    Home Country
    United Kingdom United Kingdom
    Hi,

    I see this is now in mantis, but the patch is not submitted.

    I was wondering where we are with this. Are we waiting for an updated patch from pilehave?

    Thanks,

    Mark
     

    pilehave

    Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    • Thread starter
    • Moderator
    • #5
    If you are waiting for me, I have attached a reworked patch which includes the change to GUIPlayListItemListControl.cs that SilentException noted here:
    https://forum.team-mediaportal.com/...tical-horizontal-scrollbars-93059/#post715627

    Code:
    -      RenderScrollbar(timePassed, dwPosY);
    +      RenderScrollbar(timePassed);

    and where I have moved the rendering of the scrollbar-background to after all the size-calculation and resizing is done. Improves readability a bit.

    :D
     

    Attachments

    • Collected fixes scrollbar v2 SVN 27520.patch
      6.9 KB

    Users who are viewing this thread

    Top Bottom