scrollOffset for FilmstripView (1 Viewer)

Sambal

Portal Pro
February 4, 2008
144
144
Home Country
Netherlands Netherlands
I've made a couple of alterations to GUIFilmstripControl.cs to allow for control over scrollOffset through skin files. This was already implemented for list and thumb control.

I didn't know where to put the validation code to check if the supplied property through the skin file is valid. Valid should be something like no more than half the number if items on screen. So i've put it on both left and right functions.

Code:
    [COLOR="Red"][XMLSkinElement("scrollOffset")]     protected int _scrollStartOffset = 0;  // this is the offset from the first or last element on screen when scrolling should start[/COLOR]
...
    void OnLeft()
    {
      Action action = new Action();
      action.wID = Action.ActionType.ACTION_MOVE_LEFT;
      if (_listType == GUIListControl.ListType.CONTROL_LIST)
      {
        [COLOR="Red"]//If scrolloffset larger than half the nr of items make scrolloffset that nr
        int maxScrollOffset = _columns / 2;
        if (_scrollStartOffset > maxScrollOffset)
            _scrollStartOffset = maxScrollOffset;[/COLOR]

        if (_scrollingLeft)
        {
          _scrollCounter = 0;
          _scrollingLeft = false;
          _offset--;
          int iPage = _offset / (_columns);
          if ((_offset % (_columns)) != 0) iPage++;
          if (_upDownControl != null) _upDownControl.Value = iPage + 1;
        }

       [COLOR="Red"] if (_cursorX > 0 && (_cursorX > _scrollStartOffset || _offset == 0))[/COLOR]
        {
          _cursorX--;
        }
       [COLOR="Red"] else if (_cursorX <= _scrollStartOffset && _offset != 0)[/COLOR]
        {
          _scrollCounter = _itemWidth;
          _scrollingLeft = true;
        }
        else
        {
          base.OnAction(action);
        }
        OnSelectionChanged();
      }
      else if (_upDownControl != null)
      {
        if (_upDownControl.SelectedButton == GUISpinControl.SpinSelect.SPIN_BUTTON_DOWN)
        {
          _upDownControl.Focus = false;
          _listType = GUIListControl.ListType.CONTROL_LIST;
          this.Focus = true;
        }
        else
        {
          _upDownControl.OnAction(action);
        }
        if (!_upDownControl.Focus)
        {
          _listType = GUIListControl.ListType.CONTROL_LIST;
        }
        OnSelectionChanged();
      }
    }

...

    void OnRight()
    {
      Action action = new Action();
      action.wID = Action.ActionType.ACTION_MOVE_RIGHT;
      if (_listType == GUIListControl.ListType.CONTROL_LIST)
      {
[COLOR="Red"]        //If scrolloffset larger than half the nr of items make scrolloffset that nr
        int maxScrollOffset = _columns / 2;
        if (_scrollStartOffset > maxScrollOffset)
          _scrollStartOffset = maxScrollOffset;
[/COLOR]
        if (_scrollingRight)
        {
          _scrollingRight = false;
          _offset++;
          int iPage = _offset / (_columns);
          if ((_offset % (_columns)) != 0) iPage++;
          if (_upDownControl != null) _upDownControl.Value = iPage + 1;
        }

[COLOR="Red"]        // If cursor offset from edge or if left space smaller than scrollStartOffset
        if (_cursorX + 1 == _columns - _scrollStartOffset && _listItems.Count - (_offset + _cursorX + 1) > _scrollStartOffset)
[/COLOR]        {
          _offset++;
          if (!ValidItem(_cursorX))
          {
            _offset--;
          }
          else
          {
            _offset--;
            _scrollCounter = _itemWidth;
            _scrollingRight = true;
          }
          OnSelectionChanged();
          return;
        }
        else
        {
          if (ValidItem(_cursorX + 1))
          {
            _cursorX++;
          }
          OnSelectionChanged();
        }
      }
      else if (_upDownControl != null)
      {
        if (_upDownControl.SelectedButton == GUISpinControl.SpinSelect.SPIN_BUTTON_UP)
        {
          _upDownControl.Focus = false;
          _listType = GUIListControl.ListType.CONTROL_LIST;
          this.Focus = true;
        }
        else
        {
          _upDownControl.OnAction(action);
          if (!_upDownControl.Focus)
          {
            base.OnAction(action);
          }
        }
        OnSelectionChanged();
      }
    }

Please let me know what you thing about this feature.

Sambal.
 

Attachments

  • GUIFilmstripControl.cs.txt
    30.7 KB

mattsk88

Community Skin Designer
March 27, 2008
363
216
Would you be able to suppy the core.dll for a quick test? I'm keen to test it on my skin.
 

antony

Portal Pro
January 16, 2007
78
18
Home Country
United Kingdom United Kingdom
wow sambal this is really good work...

Antony
 

Attachments

  • 13-49-31.jpg
    13-49-31.jpg
    238.6 KB

2BitSculptor

Super Moderator
  • Team MediaPortal
  • January 23, 2008
    1,951
    498
    South Central Wisconsin
    Home Country
    United States of America United States of America
    this is very cool..... :)

    one more thing? can you set a padding value to allow the first and last items to scroll to the center... instead of scrolling the zoomed cover? Maybe adding a (-) to the value to trigger an offset end?

    Seems the better something becomes, the more people demand.... :oops: (sorry)

    Chuck
     

    Sambal

    Portal Pro
    February 4, 2008
    144
    144
    Home Country
    Netherlands Netherlands
    You can use the scrollOffset to center the cover but this is not necessarily the case. So i don't think using scrollOffset should be used to achieve the effect you're after. Maybe use <align>center</align> to accomplish something like this. I don't have time to implement it at the moment. But it can be done.
     

    2BitSculptor

    Super Moderator
  • Team MediaPortal
  • January 23, 2008
    1,951
    498
    South Central Wisconsin
    Home Country
    United States of America United States of America
    You can use the scrollOffset to center the cover but this is not necessarily the case. So i don't think using scrollOffset should be used to achieve the effect you're after. Maybe use <align>center</align> to accomplish something like this. I don't have time to implement it at the moment. But it can be done.

    :D

    I can wait for any great feature... until I can't anymore. :D

    Chuck
     

    joz

    Portal Pro
    March 17, 2008
    1,353
    306
    Home Country
    Netherlands Netherlands
    This is looking awesome. I thought it kinda sucked that the center image wasn't always selected, makes sense...
    Do You guys already have some skin files for this? Wanna look into using it with Aeon Wide somehow.
    I like the clean look that antony posted.
     

    mattsk88

    Community Skin Designer
    March 27, 2008
    363
    216
    Any progress in getting this into the code?
     

    Users who are viewing this thread

    Top Bottom