Changeset 864

Show
Ignore:
Timestamp:
06/04/07 06:18:32 (2 years ago)
Author:
ok_computer
Message:

More sensible size hints for opengl store widget.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/jahwidgets/src/qt3/widgets/opengl_store.cpp

    r771 r864  
    9898        void resizeGL( int w, int h ) 
    9999        { 
    100                 prop_width_.set( w ); 
    101                 prop_height_.set( h ); 
    102100                glViewport( 0, 0, w, h ); 
    103101        } 
     
    159157                int orig_phy_h = media_->phy_h( ); 
    160158 
     159                prop_width_.set( orig_phy_w ); 
     160                prop_height_.set( orig_phy_h ); 
     161 
    161162                // Size the media 
    162163                int phy_w, phy_h, req_w, req_h; 
     
    179180 
    180181                // Check for edge cases and abort if possible 
    181                 if ( off_x + req_w < 0 || off_y + req_h < 0 || off_x > width( ) || off_y > height( ) ) 
     182                if ( off_x + req_w < 0 || off_y + req_h < 0 || off_x > owner_->width( ) || off_y > owner_->height( ) ) 
    182183                        return; 
    183184 
     
    355356                        glPushMatrix( ); 
    356357                        glLoadIdentity( ); 
    357                         gluOrtho2D( 0.0f, width( ), 0.0f, height( ) ); 
     358                        gluOrtho2D( 0.0f, owner_->width( ), 0.0f, owner_->height( ) ); 
    358359 
    359360                        glMatrixMode( GL_MODELVIEW ); 
     
    361362                        glLoadIdentity( ); 
    362363 
    363                         glTranslatef( off_x, height( ) - off_y - req_h, 0.0f ); 
     364                        glTranslatef( off_x, owner_->height( ) - off_y - req_h, 0.0f ); 
    364365 
    365366                        glTranslatef( req_w * media_->rotate_x( ), req_h * media_->rotate_y( ), 0.0f ); 
     
    443444 
    444445                        // Display the image at the correct aspect ratio and scaled to fill as much as possible 
    445                         glWindowPos2f( off_x, height( ) - off_y - req_h ); 
     446                        glWindowPos2f( off_x, owner_->height( ) - off_y - req_h ); 
    446447                        glPixelZoom( ( ( float )req_w / phy_w ), ( ( float )req_h / phy_h ) ); 
    447448                        glDrawPixels( phy_w, phy_h, glformat.second, type, new_im->data( ) ); 
     
    450451                        glPushMatrix( ); 
    451452                        glLoadIdentity( ); 
    452                         gluOrtho2D( 0.0f, width( ), 0.0f, height( ) ); 
     453                        gluOrtho2D( 0.0f, owner_->width( ), 0.0f, owner_->height( ) ); 
    453454 
    454455                        glMatrixMode( GL_MODELVIEW ); 
     
    456457                        glLoadIdentity( ); 
    457458 
    458                         glTranslatef( off_x, height( ) - off_y - req_h, 0.0f ); 
     459                        glTranslatef( off_x, owner_->height( ) - off_y - req_h, 0.0f ); 
    459460 
    460461                        glTranslatef( req_w * media_->rotate_x( ), req_h * media_->rotate_y( ), 0.0f ); 
     
    486487 
    487488                // This is the absolute WxH we have 
    488                 int abs_w = width(); 
    489                 int abs_h = height(); 
     489                int abs_w = owner_->width(); 
     490                int abs_h = owner_->height(); 
    490491 
    491492                // Should get the ar from the frame or the previous value 
     
    568569        void media_geometry( MediaPtr media, int req_w, int req_h ) 
    569570        { 
    570                 float off_x = ( media->x( ) * width( ) ) + ( ( width( ) * media->w( ) ) - req_w ) * media->align_h( ) / 2; 
    571                 float off_y = ( media->y( ) * height( ) ) + ( ( height( ) * media->h( ) ) - req_h ) * media->align_v( ) / 2; 
     571                float off_x = ( media->x( ) * owner_->width( ) ) + ( ( owner_->width( ) * media->w( ) ) - req_w ) * media->align_h( ) / 2; 
     572                float off_y = ( media->y( ) * owner_->height( ) ) + ( ( owner_->height( ) * media->h( ) ) - req_h ) * media->align_v( ) / 2; 
    572573                media->set_geometry( int( off_x ), int( off_y ), req_w, req_h ); 
    573574        } 
     
    693694QSize opengl_store::minimumSizeHint() const 
    694695{ 
     696    return QSize( 200, 100 ); 
     697} 
     698 
     699QSize opengl_store::sizeHint() const 
     700{ 
    695701    return QSize( impl_->width(), impl_->height() ); 
    696702} 
    697703 
    698 QSize opengl_store::sizeHint() const 
    699 { 
    700     return minimumSizeHint(); 
    701 } 
    702  
    703704void opengl_store::initializeGL( ) 
    704705{