예제 #1
0
INT_PTR CALLBACK DialogDispDlgProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{
    bool    ret;

    wparam = wparam;
    lparam = lparam;

    ret = false;

    switch( msg ) {
    case WM_INITDIALOG:
        DialCount++;
        ret = true;
        break;
    case WM_SYSCOLORCHANGE:
        CvrCtl3dColorChange();
        ret = true;
        break;
    case WM_CLOSE:
        DestroyWindow( hwnd );
        ret = true;
        break;
    case WM_NCDESTROY:
        DialCount --;
        if( DialCount == 0 ) {
            FreeProcInstance_DLG( DialogDisp );
        }
        break;  /* we need to let WINDOWS see this message or fonts are left undeleted */
    }
    return( ret );
}
예제 #2
0
BOOL FAR PASCAL ExtendedSortProc( HWND hwnd, WORD msg, WORD wparam, DWORD lparam )
{
    char        buf[50];
    char        test[50];
    WORD        i;

    switch( msg ) {
    case WM_INITDIALOG:
        break;
    case WM_SYSCOLORCHANGE:
        CvrCtl3dColorChange();
        break;
    case WM_COMMAND:
        break;
    case BN_CLICKED:
        switch( wparam ) {
        case SORT_BT_1:
        case SORT_BT_2:
        case SORT_BT_3:
        case SORT_BT_4:
        case SORT_BT_5:
        case SORT_BT_6:
            GetDlgItemText( hwnd, wparam, buf, 50 );
            i = SORT_FLD_1;
            GetDlgItemText( hwnd, i, test, 50 );
            while( test[0] != '\0' ) {
                i++;
                GetDlgItemText( hwnd, i, test, 50 );
                if( i == SORT_FLD_LAST ) break;
            }
            SetDlgItemText( hwnd, i, buf );
            break;
        case SORT_OK:
        case SORT_CANCEL:
            EndDialog( hwnd, 0 );
            break;
        default:
            return( 0 );
        }
    case WM_CLOSE:
        EndDialog( hwnd, 0 );
        break;
    default:
        return( 0 );
    }
    return( 1 );
}
예제 #3
0
/*
 * AliasDlgProc - alias list dialog procedure
 */
INT_PTR CALLBACK AliasDlgProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{
    AnAlias     *cur;
    size_t      len;
    char        buf[CONST_LEN];
    char        msgbuf[256];
    int         sel;
    char        *endptr;
    char        *realend;
    char        *alias;
    long        id;
    WORD        cmd;

    switch( msg ) {
    case WM_INITDIALOG:
        if( (char *)lparam != NULL ) {
            SetWindowText( hwnd, (char *)lparam );
        }
        SendDlgItemMessage( hwnd, ALIAS_TEXT, EM_LIMITTEXT, 20, 0 );
        for( cur = CurHdl->data; cur != NULL; cur = cur->next ) {
            sprintf( buf, "0x%08lX", cur->id );
            SendDlgItemMessage( hwnd, ALIAS_ID_LIST, LB_ADDSTRING, 0, (LPARAM)buf );
        }
        break;
#ifndef NOUSE3D
    case WM_SYSCOLORCHANGE:
        CvrCtl3dColorChange();
        break;
#endif
    case WM_COMMAND:
        cmd = LOWORD( wparam );
        switch( cmd ) {
            case IDOK:
            case ALIAS_DO_MORE:
                SendDlgItemMessage( hwnd, ALIAS_CUR_ID, WM_GETTEXT, CONST_LEN, (LPARAM)buf );
                realend = buf;
                while( *realend != '\0' ) {
                    realend++;
                }
                realend--;
                while( isspace( *realend ) ) {
                    realend--;
                }
                realend++;
                id = strtol( buf, &endptr, 0 );
                if( endptr != realend || *buf == '\0' ) {
                    RCMessageBox( hwnd, ALIAS_VALUE_MUST_BE_INT, "", MB_OK );
                    break;
                }
                len = SendDlgItemMessage( hwnd, ALIAS_TEXT, WM_GETTEXTLENGTH, 0, 0 );
                alias = MemAlloc( len + 1 );
                len = SendDlgItemMessage( hwnd, ALIAS_TEXT, WM_GETTEXT, len + 1, (LPARAM)alias );
                /* check for spaces */
                endptr = alias;
                while( !isspace( *endptr ) && *endptr != '\0' ) {
                    endptr++;
                }
                realend = endptr;
                while( isspace( *endptr ) ) {
                    endptr++;
                }
                if( *endptr != '\0' ) {
                    RCMessageBox( hwnd, ALIAS_NO_SPACES_ALLOWED, "", MB_OK );
                    MemFree( alias );
                    break;
                }
                realend = '\0'; /* truncate trailing spaces */
                cur = findAliasFromText( CurHdl, alias );
                if( cur == NULL ) {
                    AddAlias( CurHdl, alias, id );
                } else {
                    RCsprintf( msgbuf, ALIAS_NO_DUPLICATES_ALLOWED, alias, cur->id );
                    MessageBox( hwnd, msgbuf, "", MB_OK );
                    MemFree( alias );
                    break;
                }
                MemFree( alias );
                EndDialog( hwnd, cmd );
                break;
            case IDCANCEL:
                EndDialog( hwnd, cmd );
                break;
            case ALIAS_ID_LIST:
                if( GET_WM_COMMAND_CMD( wparam, lparam ) == LBN_SELCHANGE ) {
                    sel = (int)SendDlgItemMessage( hwnd, ALIAS_ID_LIST, LB_GETCURSEL, 0, 0L );
                    SendDlgItemMessage( hwnd, ALIAS_ID_LIST, LB_GETTEXT, sel, (LPARAM)buf );
                    SendDlgItemMessage( hwnd, ALIAS_CUR_ID, WM_SETTEXT, 0, (LPARAM)buf );
                    cur = getIthAlias( CurHdl, sel );
                    SendDlgItemMessage( hwnd, ALIAS_TEXT, WM_SETTEXT, 0, (LPARAM)cur->name );
                }
                break;
            default:
                return( FALSE );
        }
    default:
        return( FALSE );
    }
    return( TRUE );
}
예제 #4
0
/*
 * AboutProc - callback routine for settings dialog
 */
WINEXPORT INT_PTR CALLBACK AboutProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{
    char        buff[256];
    LPABOUTINFO pai;

    lparam = lparam;

    switch( msg ) {
    case WM_INITDIALOG:
        pai = (LPABOUTINFO)lparam;
        if( pai->title != NULL ) {
            SetWindowText( hwnd, pai->title );
        }
        if( pai->name != NULL ) {
            sprintf( buff, banner1p1( "%s" ), pai->name );
            SetDlgItemText( hwnd, ABOUT_NAME, buff );
        }
        if( pai->version != NULL ) {
            SetDlgItemText( hwnd, ABOUT_VERSION, pai->version );
        }
        if( pai->first_cr_year != NULL ) {
#if defined( __WATCOMC__) && !defined( __ALPHA__ )
            if( _fstrcmp( pai->first_cr_year, CURR_YEAR ) ) {
#else
            if( strcmp( pai->first_cr_year, CURR_YEAR ) ) {
#endif
                sprintf( buff, banner2a( "%s" ), pai->first_cr_year );
            } else {
                strcpy( buff, banner2a( "1984" ) );
            }
            SetDlgItemText( hwnd, ABOUT_COPYRIGHT, buff );
        }
#if defined( __WINDOWS__ ) || defined( __WINDOWS_386__ )
        {
            DWORD       flags;
            DWORD       kfree;
            WORD        pcfree;
            SYSHEAPINFO shi;
            char        work[16];
            char        info[50];

            flags = GetWinFlags();
            if( flags & WF_ENHANCED ) {
                CopyRCString( ABT_386_ENH, info, sizeof( info ) );
            } else {
                CopyRCString( ABT_STD_MODE, info, sizeof( info ) );
            }
            SetDlgItemText( hwnd, ABOUT_INFO1, info );
            kfree = GetFreeSpace( 0 ) / 1024L;
            ltoa( kfree, work, 10 );
            RCsprintf( buff, ABT_MEM_X_KB_FREE, (LPSTR)work );
            SetDlgItemText( hwnd, ABOUT_INFO2, buff );

            shi.dwSize = sizeof( shi );
            if( SystemHeapInfo( &shi ) ) {
                pcfree = shi.wGDIFreePercent;
                if( pcfree > shi.wUserFreePercent )
                    pcfree = shi.wUserFreePercent;
                RCsprintf( buff, ABT_SYS_RESOURCES_FREE, pcfree );
            } else {
                CopyRCString( ABT_SYS_RESOURCES_N_A, buff, sizeof( buff ) );
            }
            SetDlgItemText( hwnd, ABOUT_INFO3, buff );
        }
#else
        {
            SYSTEM_INFO         si;
            MEMORYSTATUS        ms;

            GetSystemInfo( &si );
            switch( si.dwProcessorType ) {
            case PROCESSOR_INTEL_386:
                CopyRCString( ABT_RUNNING_ON_386, buff, sizeof( buff ) );
                break;
            case PROCESSOR_INTEL_486:
                CopyRCString( ABT_RUNNING_ON_486, buff, sizeof( buff ) );
                break;
            case PROCESSOR_INTEL_PENTIUM:
                CopyRCString( ABT_RUNNING_ON_586, buff, sizeof( buff ) );
                break;
            case PROCESSOR_MIPS_R4000:
            case PROCESSOR_ALPHA_21064:
            default:
                buff[0] = '\0';
                break;
            }
            SetDlgItemText( hwnd, ABOUT_INFO1, buff );

            ms.dwLength = sizeof( ms );
            GlobalMemoryStatus( &ms );
            RCsprintf( buff, ABT_VIRT_MEM,
                       (ms.dwAvailPhys + ms.dwAvailPageFile) / 1024L );
            SetDlgItemText( hwnd, ABOUT_INFO2, buff );
            RCsprintf( buff, ABT_MEM_LOAD, ms.dwMemoryLoad );
            SetDlgItemText( hwnd, ABOUT_INFO3, buff );

        }
#endif
        return( TRUE );
#ifndef NOUSE3D
    case WM_SYSCOLORCHANGE:
        CvrCtl3dColorChange();
        break;
#endif
    case WM_CLOSE:
        EndDialog( hwnd, 0 );
        break;
    case WM_COMMAND:
        switch( LOWORD( wparam ) ) {
        case IDOK:
        case IDCANCEL:
            EndDialog( hwnd, 0 );
            break;
        }
    }
    return( FALSE );

} /* AboutProc */

/*
 * DoAbout - show the startup dialog
 */
void DoAbout( LPABOUTINFO ai )
{
    FARPROC     proc;

    proc = MakeDlgProcInstance( AboutProc, ai->inst );
    DialogBoxParam( ai->inst, "About", ai->owner, (DLGPROC)proc, (LPARAM)ai );
    FreeProcInstance( proc );

} /* DoAbout */
예제 #5
0
/*
 * MarkDlgProc - handle messages from the mark dialog
 */
INT_PTR CALLBACK MarkDlgProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{
    char        buf[MARK_LEN];
    char        boxbuf[MARK_LEN];
    int         ret;
    HWND        hdl;

    lparam = lparam;
    switch( msg ) {
    case WM_INITDIALOG:
        SendDlgItemMessage( hwnd, MARK_BOXED, BM_SETCHECK, 1, 0L );
        hdl = GetDlgItem( hwnd, MARK_EDIT );
        SetFocus( hdl );
        return( FALSE );
//      strcpy( buf, "---------" );
//      SendDlgItemMessage( hwnd, MARK_EDIT, WM_SETTEXT, 0, (LPARAM)buf );
        break;
#ifndef NOUSE3D
    case WM_SYSCOLORCHANGE:
        CvrCtl3dColorChange();
        break;
#endif
    case WM_COMMAND:
        switch( wparam ) {
            case MARK_OK:
                ret = GetDlgItemText( hwnd, MARK_EDIT, buf, MARK_LEN );
                if( ret == 0 ) {
                    buf[0] = '\0';
                }
                if( IsDlgButtonChecked( hwnd, MARK_BOXED ) ) {
                    if( *buf == '\0' ) {
                        WriteFn( "*" );
                    } else {
                        strcpy( boxbuf, buf );
                        if( ret < MARK_LEN - 5 ) {
                            strcpy( boxbuf, "* " );
                            strcpy( boxbuf + 2, buf );
                            strcpy( boxbuf + ret + 2, " *" );
                        }
                        strcpy( buf, boxbuf );
                        strset( boxbuf, '*' );
                        WriteFn( boxbuf );
                        WriteFn( buf );
                        WriteFn( boxbuf );
                    }
                } else {
                    WriteFn( buf );
                }
                EndDialog( hwnd, -1 );
                break;
            case MARK_CANCEL:
                EndDialog( hwnd, -1 );
                break;
            default:
                return( FALSE );
        }
        break;
    default:
        return( FALSE );
    }
    return( TRUE );

} /* MarkDlgProc */
예제 #6
0
/*
 * FilterDlgProc - handle the dialogs to set message and callback
 *                 filters
 */
INT_PTR CALLBACK FilterDlgProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{
    unsigned            i;
    WORD                cmd;
    bool                ret;

    ret = false;

    switch( msg ) {
    case WM_INITDIALOG:

        /*
         * lparam is TRUE if this is a message filter dialog or
         * FALSE if this is a callback filter dialog.
         */

        if( lparam ) {
            FilterDlgInfo.filter = MsgFilter;
            FilterDlgInfo.first = MFILTER_FIRST_MSG;
            FilterDlgInfo.last = MFILTER_LAST_MSG;
        } else {
            FilterDlgInfo.filter = CBFilter;
            FilterDlgInfo.first = CFILTER_FIRST_MSG;
            FilterDlgInfo.last = CFILTER_LAST_MSG;
        }
        for( i = FilterDlgInfo.first; i <= FilterDlgInfo.last; i++ ) {
            if( FilterDlgInfo.filter[i - FilterDlgInfo.first] ) {
                CheckDlgButton( hwnd, i, BST_CHECKED );
            }
        }
        ret = true;
        break;
#ifndef NOUSE3D
    case WM_SYSCOLORCHANGE:
        CvrCtl3dColorChange();
        ret = true;
        break;
#endif
    case WM_COMMAND:
        cmd = LOWORD( wparam );
        switch( cmd ) {
        case IDOK:
            for( i = FilterDlgInfo.first; i <= FilterDlgInfo.last; i++ ) {
                if( IsDlgButtonChecked( hwnd, i ) ) {
                    FilterDlgInfo.filter[i - FilterDlgInfo.first] = true;
                } else {
                    FilterDlgInfo.filter[i - FilterDlgInfo.first] = false;
                }
            }
            ret = true;
            EndDialog( hwnd, -1 );
            break;
        case IDCANCEL:
            EndDialog( hwnd, -1 );
            ret = true;
            break;
        case CFILTER_ALL:
        case MFILTER_ALL:
            for( i = FilterDlgInfo.first; i <= FilterDlgInfo.last; i++ ) {
                CheckDlgButton( hwnd, i, BST_CHECKED );
            }
            ret = true;
            break;
        case CFILTER_NONE:
        case MFILTER_NONE:
            for( i = FilterDlgInfo.first; i <= FilterDlgInfo.last; i++ ) {
                CheckDlgButton( hwnd, i, BST_UNCHECKED );
            }
            ret = true;
            break;
        }
        break;
    }
    return( ret );

} /* FilterDlgProc */
예제 #7
0
/*
 * ConfigLogDlgProc - handle the configure log dialog
 */
WINEXPORT INT_PTR CALLBACK ConfigLogDlgProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{
    char    *buf;

    lparam = lparam;
    switch( msg ) {
    case WM_INITDIALOG:
        if( LogCurInfo.config.query_for_name ) {
            CheckDlgButton( hwnd, LOG_CFG_QUERY_NAME, TRUE );
        } else {
            CheckDlgButton( hwnd, LOG_CFG_USE_NAME, TRUE );
        }
        if( LogCurInfo.config.type == LOG_TYPE_BUFFER ) {
            CheckDlgButton( hwnd, LOG_CFG_PERIODIC, TRUE );
        } else {
            CheckDlgButton( hwnd, LOG_CFG_CONT, TRUE );
        }
        if( LogCurInfo.config.def_action == LOG_ACTION_APPEND ) {
            CheckDlgButton( hwnd, LOG_CFG_APPEND, TRUE );
        } else if( LogCurInfo.config.def_action == LOG_ACTION_TRUNC ) {
            CheckDlgButton( hwnd, LOG_CFG_REPLACE, TRUE );
        } else if( LogCurInfo.config.def_action == LOG_ACTION_QUERY ) {
            CheckDlgButton( hwnd, LOG_CFG_QUERY, TRUE );
        }
        SetDlgItemText( hwnd, LOG_CFG_NAME_EDIT, LogCurInfo.config.name );
        break;
#ifndef NOUSE3D
    case WM_SYSCOLORCHANGE:
        CvrCtl3dColorChange();
        break;
#endif
    case WM_COMMAND:
        switch( wparam ) {
        case LOG_CFG_BROWSE:
            buf = MemAlloc( LOG_MAX_FNAME );
            if( getLogName( buf, hwnd ) ) {
                strlwr( buf );
                SetDlgItemText( hwnd, LOG_CFG_NAME_EDIT, buf );
            }
            MemFree( buf );
            break;
        case LOG_CFG_OK:
            if( IsDlgButtonChecked( hwnd, LOG_CFG_QUERY_NAME ) ) {
                LogCurInfo.config.query_for_name = TRUE;
            } else if( IsDlgButtonChecked( hwnd, LOG_CFG_USE_NAME ) ) {
                LogCurInfo.config.query_for_name = FALSE;
            }
            if( IsDlgButtonChecked( hwnd, LOG_CFG_PERIODIC ) ) {
                LogCurInfo.config.type = LOG_TYPE_BUFFER;
            } else if( IsDlgButtonChecked( hwnd, LOG_CFG_CONT ) ) {
                LogCurInfo.config.type = LOG_TYPE_CONTINUOUS;
            }
            if( IsDlgButtonChecked( hwnd, LOG_CFG_APPEND ) ) {
                LogCurInfo.config.def_action = LOG_ACTION_APPEND;
            } else if( IsDlgButtonChecked( hwnd, LOG_CFG_REPLACE ) ) {
                LogCurInfo.config.def_action = LOG_ACTION_TRUNC;
            } else if( IsDlgButtonChecked( hwnd, LOG_CFG_QUERY ) ) {
                LogCurInfo.config.def_action = LOG_ACTION_QUERY;
            }
            GetDlgItemText( hwnd, LOG_CFG_NAME_EDIT,
                            LogCurInfo.config.name, LOG_MAX_FNAME );
            EndDialog( hwnd, TRUE );
            break;
        case LOG_CFG_CANCEL:
            EndDialog( hwnd, FALSE );
            break;
        default:
            return( FALSE );
        }
        break;
    default:
        return( FALSE );
    }
    return( TRUE );

} /* ConfigLogDlgProc */
예제 #8
0
/*
 * ConfigDlgProc - handle messages from the configure dialog
 */
BOOL FAR PASCAL ConfigDlgProc( HWND hwnd, WORD msg, WORD wparam, DWORD lparam )
{
    MemWndConfig        info;
    HeapConfigInfo      heapdef;
    char                buf[_MAX_PATH];

    lparam = lparam;
    switch( msg ) {
    case WM_INITDIALOG:
        GetMemWndConfig( &info );
        SetupConfigDlg( &Config, &info, hwnd );
        break;
    case WM_SYSCOLORCHANGE:
        CvrCtl3dColorChange();
        break;
    case WM_COMMAND:
        switch( wparam ) {
        case CONFIG_GLOB_BROWSE:
            doFileBrowse( hwnd, CONFIG_GNAME );
            break;
        case CONFIG_LOCAL_BROWSE:
            doFileBrowse( hwnd, CONFIG_LNAME );
            break;
        case CONFIG_MEM_BROWSE:
            doFileBrowse( hwnd, CONFIG_MNAME );
            break;
        case CONFIG_DEFAULT:
            GetMemWndDefault( &info );
            GetDefaults( &heapdef );
            SetupConfigDlg( &heapdef, &info, hwnd );
            break;
        case CONFIG_OK:
            GetDlgItemText( hwnd, CONFIG_GNAME, buf, _MAX_PATH );
            if( !ValidateFName( buf ) ) {
                GetWindowText( hwnd, buf, sizeof( buf ) );
                RCMessageBox( hwnd, STR_INVALID_GLOB_FNAME,
                              buf, MB_OK | MB_ICONEXCLAMATION );
                break;
            }
            GetDlgItemText( hwnd, CONFIG_LNAME, buf, _MAX_PATH );
            if( !ValidateFName( buf ) ) {
                GetWindowText( hwnd, buf, sizeof( buf ) );
                RCMessageBox( hwnd, STR_INVALID_LCL_FNAME, buf,
                            MB_OK | MB_ICONEXCLAMATION );
                break;
            }
            GetDlgItemText( hwnd, CONFIG_MNAME, buf, _MAX_PATH );
            if( !ValidateFName( buf ) ) {
                GetWindowText( hwnd, buf, sizeof( buf ) );
                RCMessageBox( hwnd, STR_INVALID_MEM_FNAME, buf,
                            MB_OK | MB_ICONEXCLAMATION );
                break;
            }
            GetMemWndConfig( &info );
            info.autopos_info = IsDlgButtonChecked( hwnd, CONFIG_AUTOPOS );
            info.disp_info = IsDlgButtonChecked( hwnd, CONFIG_DISP_MEM_INFO );
            if( IsDlgButtonChecked( hwnd, CONFIG_MULT_MEM_WND ) ) {
                info.allowmult = WND_MULTI;
            } else {
                info.allowmult = WND_REPLACE;
            }
            Config.disp_res = IsDlgButtonChecked( hwnd, CONFIG_DISP_RES );
            Config.save_glob_pos = IsDlgButtonChecked( hwnd,
                                                       CONFIG_SAVE_MAIN_POS );
            Config.save_mem_pos = IsDlgButtonChecked( hwnd,
                                                       CONFIG_SAVE_MEM_POS );
            GetDlgItemText( hwnd, CONFIG_GNAME, Config.gfname, _MAX_PATH );
            GetDlgItemText( hwnd, CONFIG_LNAME, Config.lfname, _MAX_PATH );
            GetDlgItemText( hwnd, CONFIG_MNAME, info.fname, _MAX_PATH );
            SetMemWndConfig( &info );
            /* fall through */
        case CONFIG_CANCEL:
            EndDialog( hwnd, FALSE );
            break;
        default:
            return( FALSE );
        }
        break;
    case WM_CLOSE:
        EndDialog( hwnd, 0 );
        break;
    default:
        return( FALSE );
    }
    return( TRUE );
} /* ConfigDlgProc */