Ejemplo n.º 1
0
/*
 * ChooseBkColor - choose the color to represent the background
 */
void ChooseBkColor( void )
{
    WPI_DLGPROC         dlgproc;
    WPI_DLGRESULT       button_type;

    screenColor.color = GetViewBkColor();
    dlgproc = _wpi_makedlgprocinstance( SelColorDlgProc, Instance );
    button_type = _wpi_dialogbox( HMainWindow, dlgproc, Instance, SELBKCOLOR, 0L );
    _wpi_freedlgprocinstance( dlgproc );

    if( button_type == IDCANCEL ) {
        return;
    }

    SetViewBkColor( screenColor.color );
    SetScreenClr( screenColor.color );
    PrintHintTextByID( WIE_NEWBKCOLORSELECTED, NULL );

} /* ChooseBkColor */
Ejemplo n.º 2
0
/*
 * SaveImgedConfig - write configuration to a profile file
 */
void SaveImgedConfig( void )
{
    settings_info       info;
    char                buf[10];
    HINI                handle_inifile;

    GetSettings( &info );
    sprintf( info.color, "%ld", GetViewBkColor() );
    strcpy( info.opendir, GetInitOpenDir() );
    strcpy( info.savedir, GetInitSaveDir() );

    handle_inifile = _wpi_openinifile( Instance, iniPath );
    itoa( info.settings, buf, 10 );
    _wpi_writeprivateprofilestring( handle_inifile, imgedSection, "profile", buf, iniPath );
    if( info.settings & SET_SAVE_POS ) {
        savePositionValues( handle_inifile );
    }

    if( info.settings & SET_SAVE_SET ) {
        saveSettings( &info, handle_inifile );
    }
    _wpi_closeinifile( handle_inifile );

} /* SaveImgedConfig */
Ejemplo n.º 3
0
/*
 * CreateViewBitmap - create the bitmap on the screen (with the background
 *                    color as it should be, etc.)
 *                  - the caller is responsible for deleting the bitmap
 */
HBITMAP CreateViewBitmap( img_node *mdi_node )
{
    WPI_PRES    pres;
    WPI_PRES    xorandpres;
    WPI_PRES    mempres;
    WPI_PRES    freehandpres;
    HDC         xoranddc;
    HDC         memdc;
    HBITMAP     newbitmap;
    HBITMAP     oldxorandbitmap;
    HBITMAP     oldbitmap;
    HBRUSH      brush;
    HBRUSH      oldbrush;
    img_node    *node;
    COLORREF    bkcolor;

    if( mdi_node != NULL ) {
        node = mdi_node;
    } else {
        node = GetCurrentNode();
        if( node == NULL ) {
            return( NULL );
        }
    }

    pres = _wpi_getpres( HWND_DESKTOP );
    xorandpres = _wpi_createcompatiblepres( pres, Instance, &xoranddc );
    mempres = _wpi_createcompatiblepres( pres, Instance, &memdc );
    newbitmap = _wpi_createcompatiblebitmap( pres, node->width, node->height );
    _wpi_releasepres( HWND_DESKTOP, pres );

    _wpi_torgbmode( mempres );
    _wpi_torgbmode( xorandpres );
    bkcolor = GetViewBkColor();

#ifdef __OS2_PM__
    _wpi_preparemono( mempres, BLACK, bkcolor );
#endif
    oldbitmap = _wpi_selectobject( mempres, newbitmap );

    brush = _wpi_createsolidbrush( bkcolor );
    oldbrush = _wpi_selectobject( mempres, brush );

    _wpi_patblt( mempres, 0, 0, node->width, node->height, PATCOPY );
    _wpi_selectobject( mempres, oldbrush );
    _wpi_deletebrush( brush );

    GetFreeHandPresentationSpaces( NULL, &freehandpres, NULL );
    if( freehandpres == (WPI_PRES)NULL ) {
        oldxorandbitmap = _wpi_selectobject( xorandpres, node->handbitmap );
        _wpi_bitblt( mempres, 0, 0, node->width, node->height,
                     xorandpres, 0, 0, SRCAND );
        _wpi_selectobject( xorandpres, oldxorandbitmap );
    } else {
        _wpi_bitblt( mempres, 0, 0, node->width, node->height,
                     freehandpres, 0, 0, SRCAND );
    }

    GetFreeHandPresentationSpaces( NULL, NULL, &freehandpres );
    if( freehandpres == (WPI_PRES)NULL ) {
        oldxorandbitmap = _wpi_selectobject( xorandpres, node->hxorbitmap );
        _wpi_bitblt( mempres, 0, 0, node->width, node->height,
                     xorandpres, 0, 0, SRCINVERT );
        _wpi_selectobject( xorandpres, oldxorandbitmap );
    } else {
        _wpi_bitblt( mempres, 0, 0, node->width, node->height,
                     freehandpres, 0, 0, SRCINVERT );
    }

    _wpi_deletecompatiblepres( xorandpres, xoranddc );
    _wpi_selectobject( mempres, oldbitmap );
    _wpi_deletecompatiblepres( mempres, memdc );

    return( newbitmap );

} /* CreateViewBitmap */