コード例 #1
0
ファイル: gtbase.cpp プロジェクト: ArmstrongJ/open-watcom-v2
void TreeNode::paint( OutputDevice *dev, TreeRect *r )
//----------------------------------------------------
{
    /* first make sure that this node needs to be drawn:
     * it must be visible, and it must be inside the
     * invalid rectangle
     */

    if( _flags.enabled == Hidden )  return;

    if( ( r->x() + r->w() < _bounding.x() ) ||
         (r->x() > _bounding.x() + _bounding.w() ) )  return;

    if( ( r->y() + r->h() < _bounding.y() ) ||
        ( r->y() > _bounding.y() + _bounding.h() ) )  return;


    WPoint      start;
    WRect       virtBnd;
    TreeCoord   xOff = _parent->getXOff();
    TreeCoord   yOff = _parent->getYOff();
    Color       back;
    Color       fore;
    PaintInfo * pinf;
    PaintInfo * oldPinf;

    //---------- border ---------//

    virtBnd.x( (int) _bounding.x() - xOff );
    virtBnd.y( (int) _bounding.y() - yOff );
    virtBnd.w( (int) _bounding.w() );
    virtBnd.h( (int) _bounding.h() );

    pinf = getPaintInfo();
    oldPinf = dev->getPaintInfo();
    dev->setPaintInfo( pinf );

    dev->rectangle( virtBnd );

    delete pinf;
    dev->setPaintInfo( oldPinf );

    //---------- text -----------//

    if( _flags.selected ) {
        back = CUSTOM_RGB(0,0,128);
        fore = ColorWhite;
    } else {
        back = ColorLiteGray;
        fore = ColorBlack;
    }

    start.x( virtBnd.x() + NodeBuffer );
    start.y( virtBnd.y() + NodeBuffer );

    dev->drawText( start, name(), fore, back );
}
コード例 #2
0
ファイル: screendv.cpp プロジェクト: ABratovic/open-watcom-v2
static bool ClipToRect( long & x1, long & y1, long & x2, long & y2,
                        const WRect & clip )
//-----------------------------------------------------------------
// Cohen-Sutherland Clipping Algorithm from _Fundamentals of Interactive
// Computer Graphics_, page 148.
{
    PointCode   point1( x1, y1, CL_Inside );
    PointCode   point2( x2, y2, CL_Inside );
    PointCode * p1;
    PointCode * p2;
    PointCode * tmp;
    long        top = clip.y();
    long        left = clip.x();
    long        bottom = clip.y() + clip.h();
    long        right = clip.x() + clip.w();

    p1 = & point1;
    p2 = & point2;

    while( 1 ) {
        CalcOut( *p1, top, left, bottom, right );
        CalcOut( *p2, top, left, bottom, right );

        if( p1->code == CL_Inside && p2->code == CL_Inside ) {
            return TRUE;                                // trivial acceptance
        }
        if( (p1->code & p2->code) != 0 ) {
            return FALSE;                               // trivial rejection
        }

        if( p1->code == 0 ) {   // p1 inside -- swap so p1 outside
            tmp = p1;
            p1 = p2;
            p2 = tmp;
        }

        // perform a subdivision; move p1 to the intersection point.
        // use the formula y = y1 + slope * (x - x1),
        //                 x = x1 + (y - y1) / slope.

        if( p1->code & CL_Above ) {                 // divide at top
            p1->x += ((p2->x - p1->x) * (top - p1->y)) / (p2->y - p1->y);
            p1->y = top;
        } else if( p1->code & CL_Below ) {          // divide at bottom of
            p1->x += ((p2->x - p1->x) * (bottom - p1->y)) / (p2->y - p1->y);
            p1->y = bottom;
        } else if( p1->code & CL_Right ) {          // divide at right
            p1->y += ((p2->y - p1->y) * (right - p1->x)) / (p2->x - p1->x);
            p1->x = right;
        } else if( p1->code & CL_Left ) {           // divide at left
            p1->y += ((p2->y - p1->y) * (left - p1->x)) / (p2->x - p1->x);
            p1->x = left;
        }
    }
}
コード例 #3
0
void WDialog::doDialog( WWindow *parent ) {
/*****************************************/

    WRect               r;
    gui_create_info     create_info;

    autoPosition( r );
    gui_window *hparent = NULL;
    if( parent != NULL ) {
        hparent = parent->handle();
    }
    const char *ctext = _text;
    create_info.text = (char *)ctext;
    create_info.rect.x = r.x();
    create_info.rect.y = r.y();
    create_info.rect.width = r.w();
    create_info.rect.height = r.h();
    create_info.scroll = GUI_NOSCROLL;
    create_info.style = GUI_NONE;
    create_info.parent = hparent;
    create_info.num_menus = 0;
    create_info.menu = NULL;
    create_info.num_attrs = 0;
    create_info.colours = NULL;
    create_info.call_back = DlgProc;
    create_info.extra = this;
    create_info.icon = NULL;
    GUICreateDialog( &create_info, 0, NULL );
}
コード例 #4
0
ファイル: wmetrics.cpp プロジェクト: ABratovic/open-watcom-v2
void WEXPORT WSystemMetrics::screenSize( WRect& r ) {
/***************************************************/

    r.x( 0 );
    r.y( 0 );
    r.w( _screen.width );
    r.h( _screen.height );
}
コード例 #5
0
void WEXPORT WStatDialog::getCtrlRect( WControlId id, WRect & r ) {
    /*****************************************************************/

    gui_rect    rr;

    GUIGetControlRect( handle(), id, &rr );
    r.x( rr.x );
    r.y( rr.y );
    r.w( rr.width );
    r.h( rr.height );
}
コード例 #6
0
ファイル: vpemain2.cpp プロジェクト: Azarien/open-watcom-v2
bool VpeMain::reallyClose()
{
    WRect rect;
    show( WWinStateShowNormal );
    if( _quitAnyways || okToQuit() ) {
        startWait();
        clearProject();
        stopWait();
        // write out .INI file stuff
        char buff[_MAX_PATH];
        _ini.write( IDE_INI_IDENTIFIER, IDE_INI_EDITOR, (char*)_editor.gets() );
        _ini.write( IDE_INI_IDENTIFIER, IDE_INI_EDITOR_ISDLL, _editorIsDll ? "1" : "0" );
        _ini.write( IDE_INI_IDENTIFIER, IDE_INI_EDITOR_PARMS, _editorParms.gets() );
        for( int i=0; i<_oldProjects.count(); i++ ) {
            itoa( i+1, buff, 10 );
            _ini.write( IDE_INI_IDENTIFIER, buff, (const char*)*((WFileName*)_oldProjects[i]) );
        }
        _ini.write( IDE_INI_IDENTIFIER, IDE_INI_TOOLBAR, _toolBarActive ? "1" : "0" );
        _ini.write( IDE_INI_IDENTIFIER, IDE_INI_STATWND, (_statusBar != NULL) ? "1" : "0" );
        _ini.write( IDE_INI_IDENTIFIER, IDE_INI_AUTOREFRESH, _autoRefresh ? "1" : "0" );
        getRectangle( rect );
        itoa( rect.w(), buff, 10 );
        _ini.write( IDE_INI_IDENTIFIER, IDE_INI_WIDTH, buff );
        itoa( rect.h(), buff, 10 );
        _ini.write( IDE_INI_IDENTIFIER, IDE_INI_HEIGHT, buff );
        itoa( rect.x(), buff, 10 );
        _ini.write( IDE_INI_IDENTIFIER, IDE_INI_X, buff );
        itoa( rect.y(), buff, 10 );
        _ini.write( IDE_INI_IDENTIFIER, IDE_INI_Y, buff );
        if( _otherhelp != NULL ) {
            delete _otherhelp;
            _otherhelp = NULL;
        }
        delete _help;
        _help = NULL;
        return( true );
    }
    return( false );
}
コード例 #7
0
ファイル: descpnt.cpp プロジェクト: ArmstrongJ/open-watcom-v2
DescriptionPaint::DescriptionPaint( WBRWindow * prnt, const WRect & r,
                                    Symbol * sym )
                    : _parent( prnt )
                    , _rect( r )
                    , _current( -1 )
//--------------------------------------------------------------------
{
    int             i;
    WVList          desc;
    Description *   entry;
    WString         buf;
    const char *    uDefSymName;
    int             x = r.x();
    int             w;
    int             h;

    _parts = new WCPtrOrderedVector<DescriptionPart>;

    sym->description( desc );

    for( i = 0; i < desc.count(); i += 1 ) {
        entry = (Description *) desc[i];
        if( entry->symbol() ) {
            if( sym->isEqual( entry->symbol() ) ) {

                // don't hilight the symbol we're describing
                buf.concat( entry->name() );
                delete entry->symbol();

            } else {

                if( buf != "" ) { // flush buf
                    w = prnt->getTextExtentX( buf );
                    h = prnt->getTextExtentY( buf );
                    _parts->append( new DescriptionPart( buf.gets(), NULL,
                                        WRect(x,r.y(),w, h ) ) );

                    buf="";
                    x+=w;
                }

                uDefSymName = entry->name();
                w = prnt->getTextExtentX( uDefSymName );
                h = prnt->getTextExtentY( uDefSymName );
                _parts->append( new DescriptionPart( uDefSymName,
                                                     entry->symbol(),
                                                     WRect(x,r.y(),w, h ) ) );
                x+=w;
            }
        } else {
            buf.concat( entry->name() );
        }
    }

    desc.deleteContents();


    if( buf != "" ) { // flush buf
        w = prnt->getTextExtentX( buf );
        h = prnt->getTextExtentY( buf );
        _parts->append( new DescriptionPart( buf, NULL,
                                WRect(x,r.y(),w, h ) ) );

        buf="";
        x+=w;
    }

    _rect.w( x - abs( _rect.x() ) );
}
コード例 #8
0
ファイル: vpemain2.cpp プロジェクト: Azarien/open-watcom-v2
void VpeMain::readIdeInit()
{
    char buff[FILENAME_MAX];
    int width, height, x, y;

    _ini.read( IDE_INI_IDENTIFIER, IDE_INI_TOOLBAR, "1", buff, sizeof( buff ) );
    if( buff[0] == '0' ) {
        delete clearToolBar();
        _toolBarActive = false;
    }

    _ini.read( IDE_INI_IDENTIFIER, IDE_INI_STATWND, "1", buff, sizeof( buff ) );
    if( buff[0] == '0' ) {
        deleteStatusBar();
    }

    _ini.read( IDE_INI_IDENTIFIER,IDE_INI_AUTOREFRESH, "1", buff, sizeof( buff ) );
    if( buff[0] == '0' ) {
        _autoRefresh = false;
    } else {
        _autoRefresh = true;
    }
    _ini.read( IDE_INI_IDENTIFIER, IDE_INI_EDITOR, (const char*)_config->editor(),
               buff, sizeof( buff ) );
    _editor = buff;

    _ini.read( IDE_INI_IDENTIFIER, IDE_INI_EDITOR_ISDLL,
               _config->editorIsDLL() ? "1" : "0", buff, sizeof( buff ) );
    if( buff[0] == '0' ) {
        _editorIsDll = false;
    } else {
        _editorIsDll = true;
    }

    _ini.read( IDE_INI_IDENTIFIER, IDE_INI_EDITOR_PARMS, "%f", buff, sizeof( buff ) );
    _editorParms = buff;

    for( int i=0; i < MAXOLDPROJECTS; i++ ) {
        itoa( i+1, buff, 10 );
        _ini.read( IDE_INI_IDENTIFIER, buff, "*", buff, sizeof( buff ) ); // if we get "*", doesn't exist
        if( buff[0] != '*' ) {
            _oldProjects.add( new WFileName( buff ) );
        }
    }
    _ini.read( IDE_INI_IDENTIFIER, IDE_INI_HEIGHT, "0", buff, sizeof( buff ) );
    height = atoi( buff );

    _ini.read( IDE_INI_IDENTIFIER, IDE_INI_WIDTH, "0", buff, sizeof( buff ) );
    width = atoi( buff );

    _ini.read( IDE_INI_IDENTIFIER, IDE_INI_X, "0", buff, sizeof( buff ) );
    x = atoi( buff );

    _ini.read( IDE_INI_IDENTIFIER, IDE_INI_Y, "0", buff, sizeof( buff ) );
    y = atoi( buff );

    WRect sc;
    WSystemMetrics::screenCoordinates( sc );
    if( width == 0 ) width = sc.w() * 3/4;
    if( height == 0 ) height = sc.h() * 9/10;

    sc.w( width );
    sc.h( height );
    sc.x( x );
    sc.y( y );
    move( sc );
}