model_server/gala/src/view.cxx
// RemoveParentView - Removes the Parent view from the view tree.
Removes the Parent view from the view tree.
Removes the Parent view from the view tree .
View* View::RemoveParentView()
{
    View* newParent = this;
    if (LeftView || RightView || (ParentView->ChildView != this) ) {
        printf("@RemoveParentView: Attempt to delete a non-orphan view!!!\n");
        newParent = ParentView;
    } else {
        DeleteItem(myPane);
        RemoveSash();
        ParentView->RemovePane();
        if (ParentView->mySash) {
            mySash = ParentView->mySash;
            mySash->SetOwner(this);
            ParentView->mySash = NULL;
        }
        if ( (myRect.w != ParentView->myRect.w) ||
             (myRect.h != ParentView->myRect.h) ) {
            fprintf(stderr, "@RemoveParentView: Internal Error!!!\n");
            fprintf(stderr, "\t\tmy (%d,%d) != Parent's (%d,%d)\n",
                            myRect.w, myRect.h,
                            ParentView->myRect.w, ParentView->myRect.h);
        }
        myRect.x = ParentView->myRect.x;
        myRect.y = ParentView->myRect.y;
        if (ParentView->ParentView &&
            (ParentView->ParentView->ChildView == ParentView) )
                ParentView->ParentView->ChildView = this;
        if (ParentView->myOwnerPane) {
            myOwnerPane = ParentView->myOwnerPane;
            myOwnerPane->childViewTree_ = this;
            ParentView->myOwnerPane = NULL;
        }
        if (myViewer->layerViews == ParentView)
            myViewer->layerViews = this;
        if (ParentView->LeftView) { 
            LeftView = ParentView->LeftView;
            LeftView->RightView = this;
            ParentView->LeftView = NULL;
        }
        if (ParentView->RightView) {
            RightView = ParentView->RightView;
            RightView->LeftView = this;
            ParentView->RightView = NULL;
        }
        View * oldParent = ParentView;
        ParentView = oldParent->ParentView;
        oldParent->ChildView = NULL;         
        oldParent->ParentView = NULL;
        delete oldParent;
        AppendItem(myPane);
        UpdatePane();
    }
    return (newParent);
}
View * View :: RemoveParentView ( ) { View * newParent = this ; if ( LeftView || RightView || ( ParentView -> ChildView != this ) ) { printf ( " \n " ) ; newParent = ParentView ; } else { DeleteItem ( myPane ) ; RemoveSash ( ) ; ParentView -> RemovePane ( ) ; if ( ParentView -> mySash ) { mySash = ParentView -> mySash ; mySash -> SetOwner ( this ) ; ParentView -> mySash = NULL ; } if ( ( myRect . w != ParentView -> myRect . w ) || ( myRect . h != ParentView -> myRect . h ) ) { fprintf ( stderr , " \n " ) ; fprintf ( stderr , " \t \t \n " , myRect . w , myRect . h , ParentView -> myRect . w , ParentView -> myRect . h ) ; } myRect . x = ParentView -> myRect . x ; myRect . y = ParentView -> myRect . y ; if ( ParentView -> ParentView && ( ParentView -> ParentView -> ChildView == ParentView ) ) ParentView -> ParentView -> ChildView = this ; if ( ParentView -> myOwnerPane ) { myOwnerPane = ParentView -> myOwnerPane ; myOwnerPane -> childViewTree_ = this ; ParentView -> myOwnerPane = NULL ; } if ( myViewer -> layerViews == ParentView ) myViewer -> layerViews = this ; if ( ParentView -> LeftView ) { LeftView = ParentView -> LeftView ; LeftView -> RightView = this ; ParentView -> LeftView = NULL ; } if ( ParentView -> RightView ) { RightView = ParentView -> RightView ; RightView -> LeftView = this ; ParentView -> RightView = NULL ; } View * oldParent = ParentView ; ParentView = oldParent -> ParentView ; oldParent -> ChildView = NULL ; oldParent -> ParentView = NULL ; delete oldParent ; AppendItem ( myPane ) ; UpdatePane ( ) ; } return ( newParent ) ; }
RemoveParentView - Removes the Parent view from the view tree.
RemoveParentView - Removes the Parent view from the view tree .
// Make sure that I have no neighbors. // I am an orphan, I will replace my parent. // Remove my Pane from whoever owns it. // Delete my Sash. // Remove my Parent's Pane and my Sash. // Get my parent's Sash. // Internal Check - Our height and width should be the same. // Get my parent's x,y location. // Update the parent's parent. // Update the parent's owner Pane. // Update the Viewer's list of Views. // Update any new neighbors. // Save a pointer to the parent. // We will need to to delete the parent when we are done. // Make my old parent's parent my parent. // Delete the parent view.  // But make sure we don't delete stuff we want. (Or us!) // Add my pane back to the proper place. // Update my Pane.