model_server/gala/src/view.cxx
// FindLargestYElt - Finds the top-most item in this pane.
//    It also sets the ratio and removes the item from the container.
// Note - The largest Y value is needed because Galaxy coordinate system
//    has 0 at the bottom.
Finds the top-most item in this pane.
It also sets the ratio and removes the item from the container.
Note - The largest Y value is needed because Galaxy coordinate system
has 0 at the bottom.
Finds the top - most item in this pane . It also sets the ratio and removes the item from the container . Note - The largest Y value is needed because Galaxy coordinate system has 0 at the bottom .
Pane* Pane::FindLargestYElt(int* ratio)
{
    vrect newRect;
    vdialogItem * nextItem;
    vdialogItem * largestItem = GetItemAt(0);
    vrect largestRect = *(largestItem->GetRect());
    for (int x = 1; x < GetItemCount(); x++) {
        nextItem = GetItemAt(x);
        newRect = *(nextItem->GetRect());
        if (newRect.GetY() > largestRect.GetY()) {
            largestItem = nextItem;
            largestRect = newRect;
        }
    }
    newRect = *(GetRect());
    *ratio = (int)(100 * (float)(largestRect.GetHeight())/
             ((float)(largestRect.GetHeight() + largestRect.GetY())) + 0.5);
    return (Pane*) largestItem;
}
Pane * Pane :: FindLargestYElt ( int * ratio ) { vrect newRect ; vdialogItem * nextItem ; vdialogItem * largestItem = GetItemAt ( 0 ) ; vrect largestRect = * ( largestItem -> GetRect ( ) ) ; for ( int x = 1 ; x < GetItemCount ( ) ; x ++ ) { nextItem = GetItemAt ( x ) ; newRect = * ( nextItem -> GetRect ( ) ) ; if ( newRect . GetY ( ) > largestRect . GetY ( ) ) { largestItem = nextItem ; largestRect = newRect ; } } newRect = * ( GetRect ( ) ) ; * ratio = ( int ) ( 100 * ( float ) ( largestRect . GetHeight ( ) ) / ( ( float ) ( largestRect . GetHeight ( ) + largestRect . GetY ( ) ) ) + 0.5 ) ; return ( Pane * ) largestItem ; }
FindLargestYElt - Finds the top-most item in this pane.
FindLargestYElt - Finds the top - most item in this pane .
// Get the size of the first element. // Loop through all items to find the top one. // Compute the ratio of the top rect to the entire pane. // Return the top-most item.