Ticket #7965: MythUI-negative.patch

File MythUI-negative.patch, 786 bytes (added by jppoet@…, 14 years ago)

Allow negative width/height to indicate offset from right/bottom.

  • libs/libmythui/mythrect.cpp

    old new void MythRect::CalculateArea(MythRect pa 
    6161        X = (int) (m_percentX * (float)m_parentArea.width());
    6262    if (m_percentY > 0.0)
    6363        Y = (int) (m_percentY * (float)m_parentArea.height());
    6464    if (m_percentWidth > 0.0)
    6565        w = (int) (m_percentWidth * (float)(m_parentArea.width() - X));
     66    else if (w < 0)
     67        w += m_parentArea.width() + 1;
    6668    if (m_percentHeight > 0.0)
    6769        h = (int) (m_percentHeight * (float)(m_parentArea.height() - Y));
     70    else if (h < 0)
     71        h += m_parentArea.height() + 1;
    6872
    6973    QRect::setRect(X,Y,w,h);
    7074
    7175    m_needsUpdate = false;
    7276}