Beispiel #1
0
/*
 * SetViewWindow - set whether there is a single view window or multiple ones
 */
void SetViewWindow( BOOL justone )
{
    WPI_ENUMPROC        fp_enum;
    int                 prev_show_state;

    fOneViewWindow = justone;

    if( !justone ) {
        if( _wpi_iswindow( Instance, ClientWindow ) ) {
            fp_enum = _wpi_makeenumprocinstance( ViewEnumProc, Instance );
            _wpi_enumchildwindows( ClientWindow, fp_enum, 0L );
            _wpi_freeprocinstance( fp_enum );
        }
    } else {
        prev_show_state = showState;
        showState = SW_HIDE;
        if( _wpi_iswindow( Instance, ClientWindow ) ) {
            fp_enum = _wpi_makeenumprocinstance( ViewEnumProc, Instance );
            _wpi_enumchildwindows( ClientWindow, fp_enum, 0L );
            _wpi_freeprocinstance( fp_enum );
        }
        showState = prev_show_state;
        if( _wpi_iswindow( Instance, hViewWindow ) ) {
            ShowWindow( hViewWindow, showState );
        }
    }

} /* SetViewWindow */
Beispiel #2
0
/*
 * CheckViewItem - handle when the view window option is selected from the menu
 */
void CheckViewItem( HMENU hmenu )
{
    WPI_ENUMPROC        fp_enum;

    if( _wpi_isitemchecked( hmenu, IMGED_VIEW ) ) {
        _wpi_checkmenuitem( hmenu, IMGED_VIEW, MF_UNCHECKED, FALSE );
        showState = SW_HIDE;
        ImgedConfigInfo.show_state &= ~SET_SHOW_VIEW;
    } else {
        _wpi_checkmenuitem( hmenu, IMGED_VIEW, MF_CHECKED, FALSE );
        showState = SW_SHOWNORMAL;
        ImgedConfigInfo.show_state |= SET_SHOW_VIEW;
    }

    if( hViewWindow == NULL ) {
        return;
    }

    ShowWindow( _wpi_getframe( hViewWindow ), showState );
    if( _wpi_iswindow( Instance, ClientWindow ) ) {
        fp_enum = _wpi_makeenumprocinstance( ViewEnumProc, Instance );
        _wpi_enumchildwindows( ClientWindow, fp_enum, 0L );
        _wpi_freeprocinstance( fp_enum );
    }

} /* CheckViewItem */
Beispiel #3
0
/*
 * CheckGridItem - Check the grid item and display the grid if necessary.
 *                 First we check if an item has been created or not, if not
 *                 we just check some flags so that when it is created, a
 *                 grid will (not) be displayed.
 */
void CheckGridItem( HMENU hmenu )
{
    WPI_ENUMPROC        fp_enum;
    HCURSOR             prevcursor;

    prevcursor = _wpi_setcursor( _wpi_getsyscursor(IDC_WAIT) );
    if ( _wpi_isitemchecked(hmenu, IMGED_GRID) ) {
        _wpi_checkmenuitem( hmenu, IMGED_GRID, MF_UNCHECKED, FALSE );
        ImgedConfigInfo.grid_on = FALSE;
        BlowupImage( NULL, NULL );
        PrintHintTextByID( WIE_GRIDTURNEDOFF, NULL );
    } else {
        _wpi_checkmenuitem( hmenu, IMGED_GRID, MF_CHECKED, FALSE );
        ImgedConfigInfo.grid_on = TRUE;
        BlowupImage( NULL, NULL );
        PrintHintTextByID( WIE_GRIDTURNEDON, NULL );
    }
    PressGridButton();

    if( DoImagesExist() ) {
        fp_enum = _wpi_makeenumprocinstance( GridEnumProc, Instance );
        _wpi_enumchildwindows( ClientWindow, fp_enum, 0L );
        _wpi_freeprocinstance( fp_enum );
    }
    _wpi_setcursor( prevcursor );
} /* CheckGridItem */
Beispiel #4
0
bool GUIInsertResDialogControls( gui_window *wnd )
{
    WPI_ENUMPROC        enum_func;

    enum_func = _wpi_makeenumprocinstance( (WPI_PROC)InsertResDlgCntlFunc, GUIMainHInst );
    _wpi_enumchildwindows( wnd->hwnd, enum_func, (LPARAM)wnd );
    _wpi_freeprocinstance( (WPI_PROC)enum_func );

    return( TRUE );
}
Beispiel #5
0
bool GUIInsertResDialogControls( gui_window *wnd )
{
    WPI_ENUMPROC        enumproc;

    enumproc = _wpi_makeenumprocinstance( InsertResDlgCntlFunc, GUIMainHInst );
    _wpi_enumchildwindows( wnd->hwnd, enumproc, (LPARAM)wnd );
    _wpi_freeenumprocinstance( enumproc );

    return( true );
}
Beispiel #6
0
extern void GUIEnumChildWindows( gui_window *wnd, ENUMCALLBACK *func, void *param )
{
    WPI_ENUMPROC    fp;
    enum_info       info;

    fp = _wpi_makeenumprocinstance( GUIEnumChildWindowsEnumFunc, GUIMainHInst );
    info.parent = wnd;
    info.func = func;
    info.param = param;
    _wpi_enumchildwindows( wnd->hwnd, fp, (LPARAM)&info );
    _wpi_freeprocinstance( (WPI_PROC)fp );
}
Beispiel #7
0
/*
 * SetViewBkColor - set the background color (and appropriate inverse)
 */
void SetViewBkColor( COLORREF color )
{
    WPI_ENUMPROC        fp_enum;

    if( color == bkgroundColor ) {
        return;
    }

    bkgroundColor = color;
    if( !_wpi_iswindow( Instance, hViewWindow ) ) {
        return;
    }
    InvalidateRect( hViewWindow, NULL, TRUE );

    fp_enum = _wpi_makeenumprocinstance( BkColorEnumProc, Instance );
    _wpi_enumchildwindows( ClientWindow, fp_enum, 0L );
    _wpi_freeprocinstance( fp_enum );

} /* SetViewBkColor */
Beispiel #8
0
/*
 * FindOrigin - "cascade" the windows to find the placement of the new MDI child
 *            - origin is expected to come in as (0, 0) or the equivalent for PM
 */
void FindOrigin( WPI_POINT *new_origin )
{
    WPI_ENUMPROC    fp;
    int             image_count;
    int             i, j;
    WPI_POINT       temp;
    WPI_RECT        proposed;
    WPI_RECTDIM     width;
    int             base;

    image_count = DoImagesExist();

    if( image_count == 0 ) {
        return;
    }

#ifdef __OS2_PM__
    imageMax = image_count;
#endif
    windowCoords = MemAlloc( image_count * sizeof( WPI_POINT ) );
    windowIndex = 0;

    fp = _wpi_makeenumprocinstance( GetPosProc, Instance );
    _wpi_enumchildwindows( ClientWindow, fp, 0L );
    _wpi_freeprocinstance( fp );

    /*
     * I'm just using a simple bubble sort ... we're using small amounts of data
     */
    for( i = 0; i < image_count; i++ ) {
        for( j = 0; j < image_count - i - 1; j++ ) {
            if( windowCoords[j].x > windowCoords[j + 1].x ) {
                temp = windowCoords[j];
                windowCoords[j] = windowCoords[j + 1];
                windowCoords[j + 1] = temp;
            }
        }
    }

    /*
     * Minimized windows will have coordinates set to negative, and we only
     * want non-minimized windows.
     */
    for( base = 0; base < image_count; base++ ) {
        if( windowCoords[base].x >= 0 ) {
            break;
        }
    }
    if( base >= image_count ) {
        MemFree( windowCoords );
        return;
    }

    width = _wpi_getsystemmetrics( SM_CYCAPTION );
#ifndef __OS2_PM__
    _wpi_setintrectvalues( &proposed, new_origin->x, new_origin->y,
                           new_origin->x + width, new_origin->y + width );
#else
    _wpi_setrectvalues( &proposed, new_origin->x, new_origin->y - 1,
                        new_origin->x + width, new_origin->y + width - 1 );
#endif

    /*
     * Try to place at the origin passed in if we can.
     */
    if( !_wpi_ptinrect( &proposed, windowCoords[base] ) ) {
        MemFree( windowCoords );
        return;
    }

    for( i = base; i < image_count - 1; i++ ) {
        if( windowCoords[i + 1].x - windowCoords[i].x > 2 * width ) {
            break;
        }
    }

    temp.x = windowCoords[i].x + width;
#ifndef __OS2_PM__
    temp.y = windowCoords[i].x + width;
#else
    temp.y = windowCoords[i].y - width;
#endif

    _wpi_getclientrect( ClientWindow, &proposed );
#ifndef __OS2_PM__
    if( !_wpi_ptinrect( &proposed, temp ) ) {
        return;
    } else {
        new_origin->x = temp.x;
        new_origin->y = temp.y;
    }
#else
    new_origin->x = temp.x;
    new_origin->y = temp.y;
#endif

    MemFree( windowCoords );

} /* FindOrigin */