Exemplo n.º 1
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 */
Exemplo n.º 2
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 */
Exemplo n.º 3
0
/*
 * CheckSquareGrid - checks the square grid item
 */
void CheckSquareGrid( HMENU hmenu )
{
    if ( _wpi_isitemchecked(hmenu, IMGED_SQUARE) ) {
        _wpi_checkmenuitem(hmenu, IMGED_SQUARE, MF_UNCHECKED, FALSE);
        ImgedConfigInfo.square_grid = FALSE;
        PrintHintTextByID( WIE_SQUAREGRIDOFF, NULL );
    } else {
        _wpi_checkmenuitem( hmenu, IMGED_SQUARE, MF_CHECKED, FALSE );
        ImgedConfigInfo.square_grid = TRUE;
        PrintHintTextByID( WIE_SQUAREGRIDON, NULL );
    }
} /* CheckSquareGrid */
Exemplo n.º 4
0
/*
 * CheckPaletteItem - handle when the color palette menu item has been selected
 */
void CheckPaletteItem( HMENU hmenu )
{
    HWND        frame_wnd;

    if( HColorPalette == NULL ) {
        _wpi_checkmenuitem( hmenu, IMGED_COLOR, MF_CHECKED, FALSE );
        return;
    }
    frame_wnd = _wpi_getframe( HColorPalette );

    if( _wpi_isitemchecked( hmenu, IMGED_COLOR ) ) {
        _wpi_checkmenuitem( hmenu, IMGED_COLOR, MF_UNCHECKED, FALSE );
        ShowWindow( frame_wnd, SW_HIDE );
        ImgedConfigInfo.show_state &= ~SET_SHOW_CLR;
    } else {
        _wpi_checkmenuitem( hmenu, IMGED_COLOR, MF_CHECKED, FALSE );
        ShowWindow( frame_wnd, SW_SHOWNA );
        _wpi_setfocus( HMainWindow );
        ImgedConfigInfo.show_state |= SET_SHOW_CLR;
    }

} /* CheckPaletteItem */
Exemplo n.º 5
0
/*
 * SetToolType - set the tool type
 */
int SetToolType( int toolid )
{
    HMENU       hmenu;
    int         i;
    int         prev_tool;
    img_node    *node;

    if( toolType == IMGED_CLIP ) {
        node = GetCurrentNode();
        if( node != NULL ) {
            RedrawPrevClip( node->hwnd );
            SetRectExists( FALSE );
        }
    }

    prev_tool = toolType;
    toolType = toolid;

    if( toolid == IMGED_PASTE || toolid == IMGED_SNAP ) {
        return( prev_tool );
    }

    if( HMainWindow == NULL ) {
        return( 0 );
    }
    hmenu = _wpi_getmenu( _wpi_getframe( HMainWindow ) );

    switch( toolid ) {
    case IMGED_FREEHAND:
        setTheCursor( PENCIL_CUR, NULL );
        break;
    case IMGED_LINE:
        setTheCursor( CROSS_CUR, NULL );
        break;
    case IMGED_HOTSPOT:
        setTheCursor( HOTSPOT_CUR, NULL );
        break;
    case IMGED_RECTO:
        setTheCursor( CROSS_CUR, NULL );
        break;
    case IMGED_RECTF:
        setTheCursor( CROSS_CUR, NULL );
        break;
    case IMGED_CIRCLEO:
        setTheCursor( CROSS_CUR, NULL );
        break;
    case IMGED_CIRCLEF:
        setTheCursor( CROSS_CUR, NULL );
        break;
    case IMGED_FILL:
        setTheCursor( FILL_CUR, NULL );
        break;
    case IMGED_BRUSH:
        setTheCursor( BRUSH_CUR, NULL );
        if( prev_tool != IMGED_PASTE && prev_tool !=IMGED_SNAP ) {
            WriteSetSizeText( WIE_BRUSHSIZEIS, ImgedConfigInfo.brush_size,
                              ImgedConfigInfo.brush_size );
        }
        break;
    case IMGED_CLIP:
        setTheCursor( CROSS_CUR, NULL );
        break;

    default:
        setTheCursor( PENCIL_CUR, NULL );
        toolType = IMGED_FREEHAND;
        break;
    }

    for( i = IMGED_CLIP; i <= IMGED_HOTSPOT; i++ ) {
#if 0
        if( _wpi_isitemenabled( hmenu, i ) ) {
            _wpi_checkmenuitem( hmenu, i, FALSE, FALSE );
        }
#else
        if( _wpi_isitemchecked( hmenu, i ) ) {
            _wpi_checkmenuitem( hmenu, i, FALSE, FALSE );
        }
#endif
    }
    _wpi_checkmenuitem( hmenu, toolType, TRUE, FALSE );

    SetDrawTool( toolType );
    return( prev_tool );

} /* SetToolType */