⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wdeopts.c

📁 开放源码的编译器open watcom 1.6.0版的源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
        case WdeOptIsWResFmt:
            ret = WdeCurrentState.is_wres_fmt;
            break;

        case WdeOptUseDefDlg:
            ret = WdeCurrentState.use_def_dlg;
            break;

        case WdeOptReqGridX:
            ret = WdeCurrentState.grid_x;
            break;

        case WdeOptReqGridY:
            ret = WdeCurrentState.grid_y;
            break;

        case WdeOptIgnoreInc:
            ret = WdeCurrentState.ignore_inc;
            break;

        case WdeOptIsScreenMax:
            ret = WdeCurrentState.is_screen_maximized;
            break;

        case WdeOptIsCntlsTBarVisible:
            ret = WdeCurrentState.is_ctoolbar_visible;
            break;

        case WdeOptIsRibbonVisible:
            ret = WdeCurrentState.is_ribbon_visible;
            break;

        case WdeOptUse3DEffects:
            ret = WdeCurrentState.use_3d_effects;
            break;

        default:
            ret = WDE_BAD_OPT_REQ;
    }

    return ( ret );
}

char *WdeGetIncPathOption ( void )
{
    return ( WdeCurrentState.inc_path );
}

void WdeSetIncPathOption ( char *path )
{
    if ( WdeCurrentState.inc_path != NULL ) {
        WdeMemFree ( WdeCurrentState.inc_path );
    }
    WdeCurrentState.inc_path = path;
}

void WdeGetScreenPosOption ( RECT *pos )
{
    *pos = WdeCurrentState.screen_pos;
}

void WdeSetScreenPosOption ( RECT *pos )
{
    WdeCurrentState.screen_pos = *pos;
}

void WdeGetCntlTBarPosOption ( RECT *pos )
{
    *pos = WdeCurrentState.control_toolbar_pos;
}

void WdeSetCntlTBarPosOption ( RECT *pos )
{
    WdeCurrentState.control_toolbar_pos = *pos;
}

int WdeSetOption ( WdeOptReq req, int val )
{
    int old;

    switch ( req ) {
        case WdeOptIsWResFmt:
            old = WdeCurrentState.is_wres_fmt;
            WdeCurrentState.is_wres_fmt = ( Bool ) val;
            break;

        case WdeOptUseDefDlg:
            old = WdeCurrentState.use_def_dlg;
            WdeCurrentState.use_def_dlg = ( Bool ) val;
            break;

        case WdeOptReqGridX:
            old = WdeCurrentState.grid_x;
            WdeCurrentState.grid_x = val;
            break;

        case WdeOptReqGridY:
            old = WdeCurrentState.grid_y;
            WdeCurrentState.grid_y = val;
            break;

        case WdeOptIgnoreInc:
            old = WdeCurrentState.ignore_inc;
            WdeCurrentState.ignore_inc = ( Bool ) val;
            break;

        case WdeOptIsScreenMax:
            old = WdeCurrentState.is_screen_maximized;
            WdeCurrentState.is_screen_maximized = ( Bool ) val;
            break;

        case WdeOptIsCntlsTBarVisible:
            old = WdeCurrentState.is_ctoolbar_visible;
            WdeCurrentState.is_ctoolbar_visible = ( Bool ) val;
            break;

        case WdeOptIsRibbonVisible:
            old = WdeCurrentState.is_ribbon_visible;
            WdeCurrentState.is_ribbon_visible = ( Bool ) val;
            break;

        case WdeOptUse3DEffects:
            old = WdeCurrentState.use_3d_effects;
            WdeCurrentState.use_3d_effects = ( Bool ) val;
            break;

    }

    return ( old );
}

Bool WdeDisplayOptions ( void )
{
    HWND      dialog_owner;
    DLGPROC   proc_inst;
    HINSTANCE app_inst;
    Bool      modified;

    WdeSetStatusText( NULL, " ", FALSE );
    WdeSetStatusByID( WDE_DISPLAYOPTIONS, -1 );

    dialog_owner  = WdeGetMainWindowHandle();

    app_inst = WdeGetAppInstance();

    proc_inst = (DLGPROC) MakeProcInstance ( (FARPROC) WdeOptionsProc,
                                             app_inst );

    modified = JDialogBoxParam( app_inst, "WdeOptions", dialog_owner,
                                proc_inst, (LPARAM) NULL );

    FreeProcInstance ( (FARPROC) proc_inst );

    if ( modified == -1 ) {
        WdeWriteTrail("WdeDisplayOptions: Dialog not created!");
        return ( FALSE );
    }

    WdeSetStatusReadyText( );

    return ( TRUE );
}

static void WdeSetOptInfo( HWND hDlg, WdeOptState *state )
{
    if( state == NULL ) {
        return;
    }

    if( state->is_wres_fmt ) {
        CheckDlgButton( hDlg, IDB_OPT_WRES, 1 );
        CheckDlgButton( hDlg, IDB_OPT_MRES, 0 );
    } else {
        CheckDlgButton( hDlg, IDB_OPT_WRES, 0 );
        CheckDlgButton( hDlg, IDB_OPT_MRES, 1 );
    }

    #if 0
        if( state->use_def_dlg ) {
            CheckDlgButton( hDlg, IDB_OPT_DEFDEF, 1 );
            CheckDlgButton( hDlg, IDB_OPT_GENDEF, 0 );
        } else {
            CheckDlgButton( hDlg, IDB_OPT_DEFDEF, 0 );
            CheckDlgButton( hDlg, IDB_OPT_GENDEF, 1 );
        }
    #endif

    WdeSetEditWithSINT32( (int_32) state->grid_x,
                          10, hDlg, IDB_OPT_HINC );

    WdeSetEditWithSINT32( (int_32) state->grid_y,
                          10, hDlg, IDB_OPT_VINC );

    CheckDlgButton( hDlg, IDB_OPT_IGNOREINC, state->ignore_inc );

    if( WdeCurrentState.inc_path != NULL ) {
        WdeSetEditWithStr( state->inc_path, hDlg, IDB_OPT_INCPATH );
    } else {
        WdeSetEditWithStr( "", hDlg, IDB_OPT_INCPATH );
    }
}

static void WdeGetOptInfo( HWND hDlg )
{

    if ( IsDlgButtonChecked ( hDlg, IDB_OPT_WRES ) ) {
        WdeCurrentState.is_wres_fmt = TRUE;
    } else {
        WdeCurrentState.is_wres_fmt = FALSE;
    }

    #if 0
        if( IsDlgButtonChecked( hDlg, IDB_OPT_DEFDEF ) ) {
            WdeCurrentState.use_def_dlg = TRUE;
        } else {
            WdeCurrentState.use_def_dlg = FALSE;
        }
    #endif

    WdeCurrentState.grid_x =
        ( int ) WdeGetSINT32FromEdit (hDlg, IDB_OPT_HINC, NULL);
    WdeCurrentState.grid_y =
        ( int ) WdeGetSINT32FromEdit (hDlg, IDB_OPT_VINC, NULL);

    WdeCurrentState.ignore_inc =
        IsDlgButtonChecked ( hDlg, IDB_OPT_IGNOREINC );

    if ( WdeCurrentState.inc_path != NULL ) {
        WdeMemFree ( WdeCurrentState.inc_path );
    }

    WdeCurrentState.inc_path =
        WdeGetStrFromEdit ( hDlg, IDB_OPT_INCPATH, NULL );

    if ( WdeCurrentState.inc_path ) {
        if ( WdeIsStrSpace ( WdeCurrentState.inc_path )  ) {
            WdeMemFree ( WdeCurrentState.inc_path );
            WdeCurrentState.inc_path = NULL;
        }
    }
}

BOOL WINEXPORT WdeOptionsProc ( HWND hDlg, UINT message,
                                WPARAM wParam, LPARAM lParam )
{
    BOOL ret;

    /* touch unused vars to get rid of warning */
    _wde_touch ( lParam );

    ret = FALSE;

    switch (message) {

        case WM_SYSCOLORCHANGE:
            WdeCtl3dColorChange ();
            break;

        case WM_INITDIALOG:
            WdeOptWin = hDlg;
            WdeSetOptInfo( hDlg, &WdeCurrentState );
            ret = TRUE;
            break;

        case WM_DESTROY:
            WdeOptWin = NULL;
            break;

        case WM_COMMAND:
            switch ( LOWORD(wParam) ) {
                case IDB_HELP:
                    WdeHelpRoutine();
                    break;

                case IDOK:
                    WdeGetOptInfo ( hDlg );
                    EndDialog ( hDlg, TRUE );
                    ret  = TRUE;
                    break;

                case IDCANCEL:
                    EndDialog ( hDlg, FALSE );
                    ret  = TRUE;
                    break;

                #if 0
                case IDB_OPT_SETDEFS:
                    WdeSetOptInfo ( hDlg, &WdeDefaultState );
                    break;
                #endif

            }
    }

    return ( ret );
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -