Esempio n. 1
0
/*
 * SelImgDlgProc - select the image type to edit.
 */
WPI_DLGRESULT CALLBACK SelImgDlgProc( HWND hwnd, WPI_MSG msg, WPI_PARAM1 wparam, WPI_PARAM2 lparam )
{
    bool    ret;

    ret = false;

    if( _wpi_dlg_command( hwnd, &msg, &wparam, &lparam ) ) {
        switch( LOWORD( wparam ) ) {
        case DLGID_OK:
            if( IsDlgButtonChecked( hwnd, SEL_BITMAP ) ) {
                imgType = BITMAP_IMG;
            } else if( IsDlgButtonChecked( hwnd, SEL_ICON ) ) {
                imgType = ICON_IMG;
            } else {
                imgType = CURSOR_IMG;
            }
            _wpi_enddialog( hwnd, DLGID_OK );
            break;

        case DLGID_CANCEL:
            _wpi_enddialog( hwnd, DLGID_CANCEL );
            break;

        case IDB_HELP:
            IEHelpRoutine();
            break;
        }
    } else {
        switch( msg ) {
        case WM_INITDIALOG:
            if ( imgType == UNDEF_IMG ) {
                _wpi_checkradiobutton( hwnd, SEL_BITMAP, SEL_CURSOR, SEL_BITMAP );
            } else {
                _wpi_checkradiobutton( hwnd, SEL_BITMAP, SEL_CURSOR, SEL_BITMAP + imgType - 1 );
            }
            ret = true;
            break;

#ifndef __OS2_PM__
        case WM_SYSCOLORCHANGE:
            IECtl3dColorChange();
            break;
#endif

        case WM_CLOSE:
            _wpi_enddialog( hwnd, DLGID_CANCEL );
            break;
        default:
            return( _wpi_defdlgproc( hwnd, msg, wparam, lparam ) );
        }
    }
    _wpi_dlgreturn( ret );

} /* SelImgDlgProc */
Esempio n. 2
0
/*
 * CurrentSettingsProc - display the current settings and allows for change
 */
WPI_DLGRESULT CALLBACK CurrentSettingsProc( HWND hwnd, WPI_MSG msg,
                                            WPI_PARAM1 wparam, WPI_PARAM2 lparam )
{
    BOOL                err;
    char                *title;
    char                *text;
    char                *msg_text;
    short               new_shift;
    static BOOL         keepsquare;

    if( _wpi_dlg_command( hwnd, &msg, &wparam, &lparam ) ) {
        switch( LOWORD( wparam ) ) {
        case DLGID_OK:
            new_shift = _wpi_getdlgitemshort( hwnd, SHIFT_AMOUNT, &err, TRUE );
            if( new_shift > MAX_DIM || new_shift < MIN_DIM ) {
                title = IEAllocRCString( WIE_NOTE );
                text = IEAllocRCString( WIE_SHIFTBETWEEN );
                if( text != NULL ) {
                    msg_text = (char *)MemAlloc( strlen( text ) + 20 + 1 );
                    if( msg_text != NULL ) {
                        sprintf( msg_text, text, MIN_DIM, MAX_DIM );
                        MessageBox( hwnd, msg_text, title, MB_OK | MB_ICONINFORMATION );
                        MemFree( msg_text );
                    }
                    IEFreeRCString( text );
                }
                if( title != NULL ) {
                    IEFreeRCString( title );
                }
                return( FALSE );
            }
            ImgedConfigInfo.shift = new_shift;

            fKeepSelectedArea = _wpi_isbuttonchecked( hwnd, LEAVE_AREA );
            fSaveSettings = _wpi_isbuttonchecked( hwnd, SAVE_SETTINGS );
            fSavePosition = _wpi_isbuttonchecked( hwnd, SAVE_POSITION );

            if( _wpi_isbuttonchecked( hwnd, KEEP_SQUARE ) && !keepsquare ) {
                fCheckSquareGrid = TRUE;
            } else if( !_wpi_isbuttonchecked( hwnd, KEEP_SQUARE ) && keepsquare ) {
                fCheckSquareGrid = TRUE;
            } else {
                fCheckSquareGrid = FALSE;
            }

            if( _wpi_isbuttonchecked( hwnd, STRETCH_PASTE ) ) {
                stretchClipPaste = STRETCH_PASTE;
            } else {
                stretchClipPaste = CLIP_PASTE;
            }
            if( _wpi_isbuttonchecked( hwnd, STRETCH_ROTATE ) ) {
                rotateType = STRETCH_ROTATE;
            } else if( _wpi_isbuttonchecked( hwnd, SIMPLE_ROTATE ) ) {
                rotateType = SIMPLE_ROTATE;
            } else {
                rotateType = CLIP_ROTATE;
            }

            fWrapShift = _wpi_isbuttonchecked( hwnd, WRAP_SHIFT );
            SetViewWindow( _wpi_isbuttonchecked( hwnd, SHOW_ONE ) );
            _wpi_enddialog( hwnd, DLGID_OK );
            break;

        case DLGID_CANCEL:
            _wpi_enddialog( hwnd, DLGID_CANCEL );
            break;

        case SETTINGS_HELP:
            IEHelpRoutine();
            return( FALSE );

        default:
            return( FALSE );
        }
    } else {
        switch( msg ) {
        case WM_INITDIALOG:
            _wpi_checkradiobutton( hwnd, STRETCH_PASTE, CLIP_PASTE, stretchClipPaste );
            _wpi_checkradiobutton( hwnd, SIMPLE_ROTATE, CLIP_ROTATE, rotateType );

            if( IsOneViewWindow() ) {
                _wpi_checkradiobutton( hwnd, SHOW_ONE, SHOW_ALL, SHOW_ONE );
            } else {
                _wpi_checkradiobutton( hwnd, SHOW_ONE, SHOW_ALL, SHOW_ALL );
            }
            _wpi_checkdlgbutton( hwnd, LEAVE_AREA, ( fKeepSelectedArea ) ? BST_CHECKED : BST_UNCHECKED );
            _wpi_checkdlgbutton( hwnd, SAVE_SETTINGS, ( fSaveSettings ) ? BST_CHECKED : BST_UNCHECKED );
            _wpi_checkdlgbutton( hwnd, SAVE_POSITION, ( fSavePosition ) ? BST_CHECKED : BST_UNCHECKED );

            if( ImgedConfigInfo.square_grid ) {
                keepsquare = TRUE;
            } else {
                keepsquare = FALSE;
            }
            _wpi_checkdlgbutton( hwnd, KEEP_SQUARE, ( keepsquare ) ? BST_CHECKED : BST_UNCHECKED );
            _wpi_setdlgitemshort( hwnd, SHIFT_AMOUNT, ImgedConfigInfo.shift, FALSE );

            if( fWrapShift ) {
                _wpi_checkradiobutton( hwnd, WRAP_SHIFT, CLIP_SHIFT, WRAP_SHIFT );
            } else {
                _wpi_checkradiobutton( hwnd, WRAP_SHIFT, CLIP_SHIFT, CLIP_SHIFT );
            }
            return( TRUE );

#ifndef __OS2_PM__
        case WM_SYSCOLORCHANGE:
            IECtl3dColorChange();
            break;
#endif

        case WM_CLOSE:
            _wpi_enddialog( hwnd, IDCANCEL );
            break;
        default:
            return( _wpi_defdlgproc( hwnd, msg, wparam, lparam ) );
        }
    }
    _wpi_dlgreturn( FALSE );

} /* CurrentSettingsProc */
Esempio n. 3
0
/*
 * SelBitmapDlgProc - select options for the bitmap (size and color scheme)
 */
WPI_DLGRESULT CALLBACK SelBitmapDlgProc( HWND hwnd, WPI_MSG msg, WPI_PARAM1 wparam, WPI_PARAM2 lparam )
{
    char        *title;
    char        *text;
    char        *msg_text;
    BOOL        err;
    bool        ret;

    ret = false;

    if( _wpi_dlg_command( hwnd, &msg, &wparam, &lparam ) ) {
        switch( LOWORD( wparam ) ) {
        case SEL_SELECT:
            _wpi_enddialog( hwnd, SEL_SELECT );
            break;

        case DLGID_OK:
            imgHeight = _wpi_getdlgitemshort( hwnd, BMP_HEIGHT, &err, FALSE );
            imgWidth = _wpi_getdlgitemshort( hwnd, BMP_WIDTH, &err, FALSE );
            if( imgHeight > MAX_DIM || imgHeight < MIN_DIM ||
                imgWidth > MAX_DIM || imgWidth < MIN_DIM ) {
                title = IEAllocRCString( WIE_NOTE );
                text = IEAllocRCString( WIE_DIMENSIONSBETWEEN );
                if( text != NULL ) {
                    msg_text = (char *)MemAlloc( strlen( text ) + 20 + 1 );
                    if( msg_text != NULL ) {
                        sprintf( msg_text, text, MIN_DIM, MAX_DIM );
                        MessageBox( hwnd, msg_text, title, MB_OK | MB_ICONINFORMATION );
                        MemFree( msg_text );
                    }
                    IEFreeRCString( text );
                }
                if( title != NULL ) {
                    IEFreeRCString( title );
                }
                break;
            }

            if( _wpi_isbuttonchecked( hwnd, BMP_TRUECOLOR ) ) {
                bitCount = 24;
            } else if( _wpi_isbuttonchecked( hwnd, BMP_256COLOR ) ) {
                bitCount = 8;
            } else if( _wpi_isbuttonchecked( hwnd, BMP_16COLOR ) ) {
                bitCount = 4;
            } else if( _wpi_isbuttonchecked( hwnd, BMP_2COLOR ) ) {
                bitCount = 1;
            }
            _wpi_enddialog( hwnd, DLGID_OK );
            break;

        case DLGID_CANCEL:
            _wpi_enddialog( hwnd, DLGID_CANCEL );
            break;

        case IDB_HELP:
            IEHelpRoutine();
            break;
        }

    } else {

        switch( msg ) {
        case WM_INITDIALOG: // WS_GROUP
            _wpi_setdlgitemshort( hwnd, BMP_HEIGHT, imgHeight, FALSE );
            _wpi_setdlgitemshort( hwnd, BMP_WIDTH, imgWidth, FALSE );
            if( bitCount == 1 ) {
                _wpi_checkradiobutton( hwnd, BMP_TRUECOLOR, BMP_2COLOR, BMP_2COLOR );
            } else if( bitCount == 4 ) {
                _wpi_checkradiobutton( hwnd, BMP_TRUECOLOR, BMP_2COLOR, BMP_16COLOR );
            } else if( bitCount == 8 ) {
                _wpi_checkradiobutton( hwnd, BMP_TRUECOLOR, BMP_2COLOR, BMP_256COLOR );
            } else {
                _wpi_checkradiobutton( hwnd, BMP_TRUECOLOR, BMP_2COLOR, BMP_TRUECOLOR );
            }
            ret = true;
            break;

#ifndef __OS2_PM__
        case WM_SYSCOLORCHANGE:
            IECtl3dColorChange();
            break;
#endif

        case WM_CLOSE:
            _wpi_enddialog( hwnd, IDCANCEL );
            break;
        default:
            return( _wpi_defdlgproc( hwnd, msg, wparam, lparam ) );
        }
    }
    _wpi_dlgreturn( ret );

} /* SelBitmapDlgProc */
Esempio n. 4
0
/*
 * ChangeSizeDlgProc - change the size of the image being edited
 */
WPI_DLGRESULT CALLBACK ChangeSizeDlgProc( HWND hwnd, WPI_MSG msg, WPI_PARAM1 wparam, WPI_PARAM2 lparam )
{
    BOOL        trnslate;
    char        *title;
    char        *text;
    char        *msg_text;
    bool        ret;

    ret = false;

    if( _wpi_dlg_command( hwnd, &msg, &wparam, &lparam ) ) {
        switch( LOWORD( wparam ) ) {
        case DLGID_OK:
            imgHeight = _wpi_getdlgitemint( hwnd, SIZE_HEIGHT, &trnslate, TRUE );
            imgWidth = _wpi_getdlgitemint( hwnd, SIZE_WIDTH, &trnslate, TRUE );
            if( !trnslate ) {
                break;
            }
            if( imgHeight > MAX_DIM || imgHeight < MIN_DIM ||
                imgWidth > MAX_DIM || imgWidth < MIN_DIM ) {
                title = IEAllocRCString( WIE_NOTE );
                text = IEAllocRCString( WIE_DIMENSIONSBETWEEN );
                if( text != NULL ) {
                    msg_text = (char *)MemAlloc( strlen( text ) + 20 + 1 );
                    if( msg_text != NULL ) {
                        sprintf( msg_text, text, MIN_DIM, MAX_DIM );
                        MessageBox( hwnd, msg_text, title, MB_OK | MB_ICONINFORMATION );
                        MemFree( msg_text );
                    }
                    IEFreeRCString( text );
                }
                if( title != NULL ) {
                    IEFreeRCString( title );
                }
                break;
            }

            if( _wpi_isbuttonchecked( hwnd, SIZE_STRETCH ) ) {
                stretchImage = TRUE;
            } else {
                stretchImage = FALSE;
            }
            _wpi_enddialog( hwnd, DLGID_OK );
            break;

        case DLGID_CANCEL:
            _wpi_enddialog( hwnd, DLGID_CANCEL );
            break;

        case IDB_HELP:
            IEHelpRoutine();
            break;
        }
    } else {
        switch( msg ) {
        case WM_INITDIALOG:
            _wpi_setdlgitemint( hwnd, SIZE_HEIGHT, imgHeight, FALSE );
            _wpi_setdlgitemint( hwnd, SIZE_WIDTH, imgWidth, FALSE );
            if( stretchImage ) {
                _wpi_checkradiobutton( hwnd, SIZE_STRETCH, SIZE_CLIP, SIZE_STRETCH );
            } else {
                _wpi_checkradiobutton( hwnd, SIZE_STRETCH, SIZE_CLIP, SIZE_CLIP );
            }
            ret = true;
            break;

#ifndef __OS2_PM__
        case WM_SYSCOLORCHANGE:
            IECtl3dColorChange();
            break;
#endif

        case WM_CLOSE:
            _wpi_enddialog( hwnd, IDCANCEL );
            break;
        default:
            return( _wpi_defdlgproc( hwnd, msg, wparam, lparam ) );
        }
    }
    _wpi_dlgreturn( ret );

} /* ChangeSizeDlgProc */