コード例 #1
0
OVL_EXTERN bool AsyncEvent( gui_window *gui, gui_event gui_ev, void *param )
{
    gui_ctl_id      id;

    switch( gui_ev ) {
    case GUI_INIT_DIALOG:
        dlg.cond = 0;
        GUISetFocus( gui, CTL_ASYNC_STOP );
        AsyncWnd = gui;
        return( TRUE );
    case GUI_CONTROL_CLICKED :
        GUI_GETID( param, id );
        switch( id ) {
        case CTL_ASYNC_STOP:
            AsyncWnd = 0;
            dlg.cond = StopAsync();
            GUICloseDialog( gui );
            return( TRUE );
        }
        return( FALSE );
    case GUI_DESTROY:
        AsyncWnd = 0;
        return( TRUE );
    }

    return( FALSE );
}
コード例 #2
0
ファイル: dlgwind.c プロジェクト: ABratovic/open-watcom-v2
OVL_EXTERN bool WndSetEvent( gui_window * gui, gui_event gui_ev, void * param )
{
    unsigned    id;
    dlg_window_set      *wndset;

    wndset = GUIGetExtra( gui );
    switch( gui_ev ) {
    case GUI_INIT_DIALOG:
        GUISetFocus( gui, CTL_WIND_ASM_SOURCE );
        SetDlgStatus( gui );
        return( TRUE );
    case GUI_CONTROL_CLICKED :
        GUI_GETID( param, id );
        switch( id ) {
        case CTL_WIND_OK:
            wndset->cancel = FALSE;
            GetDlgStatus( gui );
            GUICloseDialog( gui );
            break;
        case CTL_WIND_CANCEL:
            wndset->cancel = TRUE;
            GUICloseDialog( gui );
            break;
        case CTL_WIND_DEFAULTS:
            SetDlgStatus( gui );
            break;
        }
        return( TRUE );
    }
    return( FALSE );
}
コード例 #3
0
ファイル: dlgoptn.c プロジェクト: ABratovic/open-watcom-v2
OVL_EXTERN bool OptSetEvent( gui_window * gui, gui_event gui_ev, void * param )
{
    unsigned    id;
    dlg_window_set      *optset;

    optset = GUIGetExtra( gui );
    switch( gui_ev ) {
    case GUI_INIT_DIALOG:
        SetDlgStatus( gui );
        GUISetFocus( gui, CTL_OPT_RADIX );
        return( TRUE );
    case GUI_CONTROL_CLICKED :
        GUI_GETID( param, id );
        switch( id ) {
        case CTL_OPT_OK:
            optset->cancel = FALSE;
            GetDlgStatus( gui );
            GUICloseDialog( gui );
            break;
        case CTL_OPT_CANCEL:
            optset->cancel = TRUE;
            GUICloseDialog( gui );
            break;
        case CTL_OPT_DEFAULTS:
            SetDlgStatus( gui );
            break;
        }
        return( TRUE );
    }
    return( FALSE );
}
コード例 #4
0
ファイル: dlgcnvt.c プロジェクト: ABratovic/open-watcom-v2
STATIC bool progEvent( gui_window * gui, gui_event gui_ev, void * param )
/***********************************************************************/
{
    unsigned            id;

    switch( gui_ev ) {
    case GUI_INIT_DIALOG:
        setDlgValues( gui );
        GUISetFocus( gui, CTL_NAME );
        return( P_TRUE );
    case GUI_CONTROL_CLICKED :
        GUI_GETID( param, id );
        switch( id ) {
        case CTL_BROWSE:
            dlgBrowseFmtFile( gui );
            return( P_TRUE );
        case CTL_OK:
            getDlgValues( gui );
            if( dlgOpenFmtFile() ) {
                GUICloseDialog( gui );
            }
            return( P_TRUE );
        case CTL_DEFAULTS:
            setDlgDefaults( gui );
            return( P_TRUE );
        case CTL_CANCEL:
            GUICloseDialog( gui );
            return( P_TRUE );
        }
        return( P_FALSE );
    case GUI_DESTROY:
        return( P_TRUE );
    }
    return( P_FALSE );
}
コード例 #5
0
OVL_EXTERN bool VarGUIEventProc( gui_window *gui, gui_event gui_ev, void *param )
{
    gui_ctl_id      id;
    dlg_var_expand  *varx;

    varx = GUIGetExtra( gui );
    switch( gui_ev ) {
    case GUI_INIT_DIALOG:
        SetDlgStatus( varx, gui );
        GUISetFocus( gui, CTL_VARX_START );
        return( true );
    case GUI_CONTROL_CLICKED :
        GUI_GETID( param, id );
        switch( id ) {
        case CTL_VARX_OK:
            if( GetDlgStatus( varx, gui ) ) {
                varx->cancel = false;
                GUICloseDialog( gui );
            }
            return( true );
        case CTL_VARX_CANCEL:
            varx->cancel = true;
            GUICloseDialog( gui );
            return( true );
        case CTL_VARX_DEFAULTS:
            SetDlgStatus( varx, gui );
            return( true );
        }
        break;
    }
    return( false );
}
コード例 #6
0
ファイル: dlgcmd.c プロジェクト: Graham-stott/open-watcom-v2
extern bool CmdEvent( gui_window * gui, gui_event gui_ev, void * param )
{
    gui_ctl_id  id;
    char        *text;
    char        *cmd;
    int         i;

    cmd = GUIGetExtra( gui );
    switch( gui_ev ) {
    case GUI_INIT_DIALOG:
        GUISetText( gui, CTL_CMD_EDIT, "Hi Lisa!" );
        GUISetFocus( gui, CTL_CMD_EDIT );
        GUIClearList( gui, CTL_CMD_HISTORY );
        for( i = 0; i < ArraySize( Stuff ); ++i ) {
            GUIAddText( gui, CTL_CMD_HISTORY, Stuff[i] );
        }
        GUISetCurrSelect( gui, CTL_CMD_HISTORY, 1 );
        return( TRUE );
    case GUI_KEY_CONTROL:
        GUISetCurrSelect( gui, CTL_CMD_HISTORY, 2 );
        cmd = GUIGetText( gui, CTL_CMD_HISTORY );
        GUISetText( gui, CTL_CMD_EDIT, cmd );
        GUISelectAll( gui, CTL_CMD_EDIT, TRUE );
        GUIMemFree( cmd );
        return( TRUE );
    case GUI_CONTROL_DCLICKED:
    case GUI_CONTROL_CLICKED:
        GUI_GETID( param, id );
        switch( id ) {
        case CTL_CMD_HISTORY:
            text = GUIGetText( gui, CTL_CMD_HISTORY );
            GUISetText( gui, CTL_CMD_EDIT, text );
            GUIMemFree( text );
            if( gui_ev == GUI_CONTROL_CLICKED )
                return( TRUE );
            /* fall through */
        case CTL_CMD_OK:
            text = GUIGetText( gui, CTL_CMD_EDIT );
            if( text != NULL )
                DoCmd( text );
            GUIMemFree( text );
            break;
        case CTL_CMD_CHECK:
            return( FALSE );
        }
        GUICloseDialog( gui );
        /* fall through */
    case GUI_DESTROY:
        WndFree( cmd );
        return( TRUE );
    default:
        return( FALSE );
    }
}
コード例 #7
0
ファイル: dlgnewp.c プロジェクト: Azarien/open-watcom-v2
OVL_EXTERN bool ProgEvent( gui_window * gui, gui_event gui_ev, void * param )
{
    gui_ctl_id          id;
    dlg_new_prog        *dlg;

    dlg = GUIGetExtra( gui );
    switch( gui_ev ) {
    case GUI_INIT_DIALOG:
        GUILimitEditText( gui, CTL_NEWP_PROG, UTIL_LEN - 1 );
        GUILimitEditText( gui, CTL_NEWP_ARGS, UTIL_LEN - 1 );
        GUISetText( gui, CTL_NEWP_PROG, dlg->prog );
        GUISetText( gui, CTL_NEWP_ARGS, dlg->args );
        GUISetFocus( gui, CTL_NEWP_PROG );
        return( true );
    case GUI_CONTROL_CLICKED :
        GUI_GETID( param, id );
        switch( id ) {
        case CTL_NEWP_BROWSE:
            GUIDlgBuffGetText( gui, CTL_NEWP_PROG, TxtBuff, TXT_LEN );
            if( !ExeBrowse() )
                return( true );
            GUISetText( gui, CTL_NEWP_PROG, TxtBuff );
            GUISetFocus( gui, CTL_NEWP_PROG );
            return( true );
        case CTL_NEWP_OK:
            GUIDlgBuffGetText( gui, CTL_NEWP_PROG, prog, sizeof( prog ) );
            GUIDlgBuffGetText( gui, CTL_NEWP_ARGS, args, sizeof( args ) );
            dlg->cancel = false;
            GUICloseDialog( gui );
            return( true );
        case CTL_NEWP_CANCEL:
            GUICloseDialog( gui );
            return( true );
        }
        return( false );
    case GUI_DESTROY:
        return( true );
    }

    return( false );
}
コード例 #8
0
ファイル: dlggen.c プロジェクト: Ukusbobra/open-watcom-v2
static void SetFocusCtrl( gui_window *gui, a_dialog_header *curr_dialog )
/*************************************************************************/
/* Set the default variable values. Decide how to set these  */
/* default values based on edit control type. */
{
    int                 i, j;

    for( i = 0; i < curr_dialog->num_controls; i++ ) {
        switch( curr_dialog->controls[i].control_class ) {
        case GUI_EDIT_MLE:
        case GUI_EDIT:
            GUISetFocus( gui, curr_dialog->controls[i].id );
            return;
        case GUI_RADIO_BUTTON:
        case GUI_CHECK_BOX:
            for( j = i;; ++j ) {
                if( curr_dialog->controls[j].control_class != GUI_RADIO_BUTTON &&
                    curr_dialog->controls[j].control_class != GUI_CHECK_BOX ) {
                    break;
                }
                if( GUIIsChecked( gui, curr_dialog->controls[j].id ) ) {
                    GUISetFocus( gui, curr_dialog->controls[j].id );
                    return;
                }
            }
            GUISetFocus( gui, curr_dialog->controls[i].id );
            return;
        default:
            break;
        }
    }
    for( i = 0; i < curr_dialog->num_controls; i++ ) {
        if( curr_dialog->controls[i].control_class == GUI_DEFPUSH_BUTTON ) {
            GUISetFocus( gui, curr_dialog->controls[i].id );
            return;
        }
    }
}
コード例 #9
0
static bool GetDlgStatus( dlg_var_expand *varx, gui_window *gui )
{
    long        start,end;

    if( DlgGetLong( gui, CTL_VARX_START, &start ) &&
        DlgGetLong( gui, CTL_VARX_END, &end ) && end >= start ) {
        varx->start = start;
        varx->end = end;
        return( true );
    }
    ErrorRet( ERR_NONE, LIT_DUI( ERR_BAD_ARRAY_INDEX ) );
    GUISetFocus( gui, CTL_VARX_START );
    return( false );
}
コード例 #10
0
ファイル: dlgcnvt.c プロジェクト: ABratovic/open-watcom-v2
STATIC void dlgBrowseFmtFile( gui_window *gui )
/*********************************************/
{
    for( ;; ) {
        if( !DlgFileBrowse( LIT( Convert_File_Name ), cnvtFilterList,
                            convertPath, sizeof( convertPath ),
                            OFN_HIDEREADONLY ) ) break;
        if( dlgOpenFmtFile() ) {
            fclose( ConvertFile );
            remove( convertPath );
            break;
        }
    }
    GUISetFocus( gui, CTL_NAME );
}
コード例 #11
0
ファイル: dlgsrch.c プロジェクト: GEO-IASS/open-watcom-v2
extern bool SrchEvent( gui_window * gui, gui_event event, void * param )
{
    gui_ctl_id  id;
    dlg_search  *dlg;

    dlg = GUIGetExtra( gui );
    switch( event ) {
    case GUI_INIT_DIALOG:
        SetDlgStatus( gui, dlg );
        GUISetFocus( gui, CTL_SRCH_EDIT );
        break;
    case GUI_KEY_CONTROL:
        return( DlgHistoryKey( gui, param, CTL_SRCH_EDIT, CTL_SRCH_LIST ) );
    case GUI_CONTROL_DCLICKED:
    case GUI_CONTROL_CLICKED:
        GUI_GETID( param, id );
        switch( id ) {
        case CTL_SRCH_LIST:
            DlgClickHistory( gui, CTL_SRCH_EDIT, CTL_SRCH_LIST );
            if( event == GUI_CONTROL_CLICKED ) return( true );
            /* fall through */
        case CTL_SRCH_NEXT:
            dlg->direction = 1;
            GetDlgStatus( gui, dlg );
            GUICloseDialog( gui );
            break;
        case CTL_SRCH_EDIT_RX:
            ResDlgOpen( &RXEvent, NULL, GUI_MAKEINTRESOURCE( DIALOG_RX ) );
            break;
        case CTL_SRCH_PREV:
            dlg->direction = -1;
            GetDlgStatus( gui, dlg );
            GUICloseDialog( gui );
            break;
        case CTL_SRCH_CANCEL:
            dlg->direction = 0;
            GUICloseDialog( gui );
            break;
        default :
            break;
        }
        return( true );
    default :
        break;
    }
    return( false );
}
コード例 #12
0
ファイル: guidropd.c プロジェクト: ABratovic/open-watcom-v2
bool GUIDropDown( gui_window *wnd, unsigned id, bool drop )
{
    gui_control_class control_class;

    if( !GUIGetControlClass( wnd, id, &control_class ) ) {
        return( false );
    }
    switch( control_class ) {
    case GUI_COMBOBOX :
    case GUI_EDIT_COMBOBOX :
        if( !GUISetFocus( wnd, id ) ) {
            return( false );
        }
        return( GUIToControl( wnd, id, CB_SHOWDROPDOWN, (WPI_PARAM1)drop, 0L, NULL ) );
        break;
    default :
        return( false );
    }
}
コード例 #13
0
ファイル: dlgsrch.c プロジェクト: GEO-IASS/open-watcom-v2
extern void DlgSetHistory( gui_window *gui, void *history, char *cmd,
                           int edit, int list )
{
    int         i;

    GUISetFocus( gui, edit );
    if( !WndPrevFromHistory( history, cmd ) ) return;
    GUISetText( gui, edit, cmd );
    GUISelectAll( gui, edit, true );
    GUIClearList( gui, list );
    while( WndPrevFromHistory( history, cmd ) ) {
        /* nothing */
    }
    i = -1;
    for( ;; ) {
        if( !WndNextFromHistory( history, cmd ) ) break;
        GUIAddText( gui, list, cmd );
        ++i;
    }
    if( i >= 0 ) GUISetCurrSelect( gui, list, i );
}
コード例 #14
0
ファイル: dlgstk.c プロジェクト: NoSuchProcess/open-watcom-v2
OVL_EXTERN bool StkOrHistoryEvent( gui_window *gui, gui_event gui_ev, void *param )
{
    gui_ctl_id  id;
    gui_ctl_id  *resp;

    resp = GUIGetExtra( gui );
    switch( gui_ev ) {
    case GUI_INIT_DIALOG:
        GUISetFocus( gui, CTL_STK_YES );
        return( true );
    case GUI_CONTROL_CLICKED :
        GUI_GETID( param, id );
        switch( id ) {
        case CTL_STK_CANCEL:
        case CTL_STK_NO:
        case CTL_STK_YES:
            *resp = id;
            GUICloseDialog( gui );
            return( true );
        }
        return( false );
    }
    return( false );
}
コード例 #15
0
ファイル: dlgsrch.c プロジェクト: GEO-IASS/open-watcom-v2
extern bool RXEvent( gui_window * gui, gui_event event, void * param )
{
    gui_ctl_id  id;

    switch( event ) {
    case GUI_INIT_DIALOG:
        SetRXStatus( gui );
        GUISetFocus( gui, CTL_RX_OK );
        break;
    case GUI_CONTROL_CLICKED:
        GUI_GETID( param, id );
        switch( id ) {
        case CTL_RX_OK:
            GetRXStatus( gui );
        case CTL_RX_CANCEL:
            GUICloseDialog( gui );
            break;
        }
        return( true );
    default :
        break;
    }
    return( false );
}
コード例 #16
0
static bool SourceEvent( gui_window *gui, gui_event gui_ev, void *param )
{
    gui_ctl_id  id;
    void        *curr;
    int         i;
    int         size;
    char        *text;
    dlg_list    *dlg;

    dlg = GUIGetExtra( gui );
    switch( gui_ev ) {
    case GUI_DESTROY:
        WndFree( dlg->title );
        return( true );
    case GUI_INIT_DIALOG:
        GUISetWindowText( gui, dlg->title );
        GUIClearList( gui, CTL_LIST_LIST );
        for( curr = dlg->next( NULL ); curr != NULL; curr = dlg->next( curr ) ) {
            AddText( gui, dlg->name( curr ) );
        }
        GUISetFocus( gui, CTL_LIST_EDIT );
        return( true );
    case GUI_CONTROL_CLICKED:
        GUI_GETID( param, id );
        switch( id ) {
        case CTL_LIST_LIST:
            GUIDlgBuffGetText( gui, CTL_LIST_LIST, TxtBuff, TXT_LEN );
            GUISetText( gui, CTL_LIST_EDIT, TxtBuff );
            break;
        case CTL_LIST_DELETE:
            i = GUIGetCurrSelect( gui, CTL_LIST_LIST );
            if( i != -1 ) {
                GUIDeleteItem( gui, CTL_LIST_LIST, i );
            }
            size = GUIGetListSize( gui, CTL_LIST_LIST );
            if( i < size ) {
                GUISetCurrSelect( gui, CTL_LIST_LIST, i );
            } else {
                SelectListLast( gui );
            }
            GUISetFocus( gui, CTL_LIST_LIST );
            GUISetText( gui, CTL_LIST_EDIT, NULL );
            break;
        case CTL_LIST_ADD:
        case CTL_LIST_OK:
            GUIDlgBuffGetText( gui, CTL_LIST_EDIT, TxtBuff, TXT_LEN );
            if( TxtBuff[0] != '\0' )
                AddText( gui, TxtBuff );
            SelectListLast( gui );
            GUIClearText( gui, CTL_LIST_EDIT );
            GUISetFocus( gui, CTL_LIST_EDIT );
            if( id == CTL_LIST_ADD )
                break;
            dlg->clear();
            size = GUIGetListSize( gui, CTL_LIST_LIST );
            for( i = 0; i < size; ++i ) {
                text = GUIGetListItem( gui, CTL_LIST_LIST, i );
                if( text != NULL ) {
                    dlg->add( text, strlen( text ) );
                    GUIMemFree( text );
                }
            }
            /* fall through */
        case CTL_LIST_CANCEL:
            GUICloseDialog( gui );
            break;
        case CTL_LIST_BROWSE:
            GUIDlgBuffGetText( gui, CTL_LIST_EDIT, TxtBuff, TXT_LEN );
            if( !AllBrowse( TxtBuff ) )
                return( true );
            GUISetText( gui, CTL_LIST_EDIT, TxtBuff );
            GUISetFocus( gui, CTL_LIST_EDIT );
            return( true );
        }
        return( true );
    default:
        return( false );
    }
}
コード例 #17
0
ファイル: dlggen.c プロジェクト: Ukusbobra/open-watcom-v2
static void UpdateControlVisibility( gui_window *gui, a_dialog_header *curr_dialog, bool init )
/*********************************************************************************************/
// Hide controls which have the optional visibility condition evaluate to false, and show
// the ones that have it evaluate to true. (Controls with no vis. condition are always shown.)
// When a control is hidden, the controls BELOW it move up by the hidden control's height.
// A currently hidden controls that needs to be made visible causes all controls BELOW it
// to move down by the "appearing" control's height so that it can be shown again.
// The dialog window height also gets affected, while the top edge remains fixed on the screen.
//
// NOTE: be careful with RADIO_BUTTONS... making radio buttons appear and disappear because of
// other radio buttons in the same dialog being checked may not work (nor does it make sense anyways)
{
    gui_ord             last_height;
    gui_rect            rect;
    gui_rect            control_rect;
    gui_rect            parent_rect;
    gui_window          *parent;
    int                 i, j, sign;
    unsigned            id_i;
    unsigned            id_j;
    unsigned            checked_radio_id = 0;
    unsigned            new_check_candidate;
    unsigned            focus;
    unsigned            new_focus;
    bool                enabled;
    bool                control_on_new_line[MAX_VARS];
    bool                visible_checked_radiobutton;
    vhandle             var_handle;
//    vhandle             *pVariable;

    if( gui == NULL ) return;
    if( init ) {
        // How much the height of the dialog has changed from its original value
        curr_dialog->height_change = 0;

        // The GUIGetRect below gets the dialog's position so that when it is resized,
        // it can be put back in its original position

        // NOTE that GUIGetRect does not want to give the EXACT location of the dialog,
        // so if you set the position to the coordinates that you got with GUIGetRect,
        // the dialog will MOVE slightly (not pleasing to the eye).
        // The current hack is to get the original coordinates, and go back to them every time
        // the dialog is resized with GUIResizeWindow.
        // This way, the dialog will be off by the same amount from the original
        // every time, and not appear to move.
        GUIGetRect( gui, &curr_dialog->original_rect );

        // Make child windows appear in the correct place, since GUIGetRect() gives back
        // a rect that is tranlsated off by the parent's x and y.
        parent = GUIGetParentWindow( gui );
        if( parent != MainWnd && parent != NULL ) {
            GUIGetRect( parent, &parent_rect );
            curr_dialog->original_rect.x -= parent_rect.x;
            curr_dialog->original_rect.y -= parent_rect.y;
        }

        // Return if there are radio buttons
        // because UpdateControlVisibility is going to be called again anyways after init.
        // Without returning, the visibility conditions having to do with radio buttons
        // would not work sometimes.
        // We do not want to return if there are no radio buttons
        // because UpdateControlVisibility will not be called before showing
        // the dialog in that case.
        for( i = 0; i < curr_dialog->num_controls; i++ ) {
            if( curr_dialog->controls[i].control_class == GUI_RADIO_BUTTON ) {
                return;
            }
        }
    }
    memcpy( &rect, &curr_dialog->original_rect, sizeof( gui_rect ) );
    last_height = rect.height + curr_dialog->height_change;

    control_on_new_line[0] = TRUE;

    GUIGetFocus( gui, &focus );

    // Figure out which controls are on a separate line from the last control
    for( i = 1; i < curr_dialog->num_controls; i++ ) {
        if( curr_dialog->controls[i].rect.y >
            curr_dialog->controls[i - 1].rect.y ) {
            control_on_new_line[i] = TRUE;
        } else {
            control_on_new_line[i] = FALSE;
        }
    }

    // Initialize Variables corresponding to radio buttons and check boxes
    // This needs to be done for the part further below that checks to see if any
    // buttons are checked to work.
    // Also, figure out which radio button is currently checked.

    for( i = 0; i < curr_dialog->num_controls; i++ ) {
        if( curr_dialog->controls[i].control_class == GUI_RADIO_BUTTON ||
            curr_dialog->controls[i].control_class == GUI_CHECK_BOX ) {
//            pVariable = curr_dialog->pVariables;
            var_handle = curr_dialog->controls[i].id;
            if( curr_dialog->controls[i].control_class == GUI_RADIO_BUTTON &&
                GUIIsChecked( gui, VarGetId( var_handle ) ) ) {
                checked_radio_id = var_handle;
            }
            for( j = 0; curr_dialog->pVariables[j] != NO_VAR; j++ ) {
                if( curr_dialog->pVariables[j] == var_handle &&
                    GUIIsChecked( gui, VarGetId( var_handle ) ) ) {
                    SetVariableByHandle( var_handle, "1" );
                }
            }
        }
    }

    // Allow EvalCondition to evaluate conditions with no 'shortcuts'
    // (See GetOptionVarValue() in setupinf.c)
    // Kind of like an on and off (below) switch
    // for special behaviour of GetOptionVarValue()
    // SetVariableByName( "_Visibility_Condition_", "1" );
    VisibilityCondition = 1;

    for( i = 0; i < curr_dialog->num_controls; i++ ) {
    // Figure out which controls to hide and which to show.
    // Move all the controls below any control in transition
    // either up or down.

        if( curr_dialog->pVisibilityConds[i] != NULL ) {
            id_i = curr_dialog->controls[i].id;
            enabled = GUIIsControlEnabled( gui, id_i );
            if( EvalCondition( curr_dialog->pVisibilityConds[i] ) ) {
                if( !enabled ) {
                    GUIEnableControl( gui, id_i, TRUE );
                    sign = 1;
                } else {
                    continue;
                }
            } else if( enabled ) {
                GUIEnableControl( gui, id_i, FALSE );
                GUIHideControl( gui, curr_dialog->controls[i].id );
                sign = -1;
            } else {
                continue;
            }
            if( control_on_new_line[i] ) {
                for( j = i + 1; j < curr_dialog->num_controls &&
                                !control_on_new_line[j]; j++ );
                for( ; j < curr_dialog->num_controls; j++ ) {
                    id_j = curr_dialog->controls[j].id;
                    enabled = GUIIsControlEnabled( gui, id_j );
                    GUIGetControlRect( gui, curr_dialog->controls[j].id, &control_rect );
                    control_rect.y += curr_dialog->controls[i].rect.height * sign;
                    if( enabled ) {
                        GUIHideControl( gui, id_j );
                        // control will be made visible again below
                        // after being moved.
                    }
                    GUIResizeControl( gui, id_j, &control_rect );
                }
                curr_dialog->height_change += curr_dialog->controls[i].rect.height * sign;
            }
        }
    }

    // SetVariableByName( "_Visibility_Condition_", "0" );
    VisibilityCondition = 0;

    visible_checked_radiobutton = FALSE;
    new_check_candidate = 0;

    for( i = 0; i < curr_dialog->num_controls; i++ ) {
        id_i = curr_dialog->controls[i].id;

        // figure out if there are no enabled radio buttons that are checked
        // use this info further down...
        if( curr_dialog->controls[i].control_class == GUI_RADIO_BUTTON &&
            !visible_checked_radiobutton && GUIIsControlEnabled( gui, id_i ) ) {
            if( GUIIsChecked( gui, id_i ) == GUI_CHECKED ) {
                visible_checked_radiobutton = TRUE;
            } else if( new_check_candidate == 0 ) {
                new_check_candidate = id_i;
            }
        }

        // show enabled controls that were hidden for moving only
        if( GUIIsControlEnabled( gui, id_i ) && !GUIIsControlVisible( gui, id_i ) ) {
            GUIShowControl( gui, id_i );
        }
    }

    // Keep the original focus in case it has changed.
    GUIGetFocus( gui, &new_focus );
    if( new_focus != focus && GUIIsControlEnabled( gui, focus ) ) {
        GUISetFocus( gui, focus );
    }

    if( GUIIsControlEnabled( gui, checked_radio_id ) ) {
        GUISetChecked( gui, checked_radio_id, 1 );
    } else if( !visible_checked_radiobutton && new_check_candidate != 0 ) {
        // 'Check' a visible radio button if the currently checked button
        // is invisible.
        GUISetChecked( gui, new_check_candidate, 1 );
    }

    rect.height += curr_dialog->height_change;

    if( rect.height != last_height ) {
        GUIResizeWindow( gui, &rect );
    }
}
コード例 #18
0
ファイル: guifdlg.c プロジェクト: ABratovic/open-watcom-v2
/*
 * GetFileNameEvent - event handler for GetFileName dialog
 */
extern bool GetFileNameEvent( gui_window *gui, gui_event gui_ev, void *param )
{
    unsigned    id;
    int         sel;
    char        *ptr;
    char        path[_MAX_PATH];
    dlg_info    *dlg = GUIGetExtra( gui );

    switch( gui_ev ) {
    case GUI_INIT_DIALOG:
        dlg->initted = false;
        InitTextList( gui, CTL_FILE_TYPES, GetFileTypesTextList() );
#if !defined( __UNIX__ ) && !defined( __NETWARE__ )
        InitTextList( gui, CTL_DRIVES, GetDriveTextList() );
#endif
        if( !initDialog( gui, dlg->fileExtensions[dlg->currExtIndex], dlg->currOFN->file_name ) ) {
            dlg->dialogRC = OFN_RC_FAILED_TO_INITIALIZE;
            return( false );
        }
        dlg->initted = true;
        GUISetFocus( gui, CTL_EDIT );
        return( true );
        break;
    case GUI_CONTROL_DCLICKED:
        GUI_GETID( param, id );
        switch( id ) {
        case CTL_FILE_LIST:
        case CTL_DIR_LIST:
            ProcessOKorDClick( gui, id );
            break;
        }
        break;
    case GUI_CONTROL_CLICKED:
        if( !dlg->initted ) break;
        GUI_GETID( param, id );
        switch( id ) {
        case CTL_OK:
            ProcessOKorDClick( gui, id );
            break;
        case CTL_CANCEL:
            GUICloseDialog( gui );
            break;
        case CTL_FILE_LIST:
            ptr = GUIGetText( gui, id );
            GUISetText( gui, CTL_EDIT, ptr );
            GUIMemFree( ptr );
            break;
        case CTL_DRIVES :
            sel = GUIGetCurrSelect( gui, id );
            strcpy( path, GetDriveTextList()[sel] );
            path[2] = 0;
            goToDir( gui, path );
            if( !initDialog( gui, NULL, NULL ) ) {
                dlg->dialogRC = OFN_RC_RUNTIME_ERROR;
                GUICloseDialog( gui );
            }
            break;
        case CTL_FILE_TYPES:
            sel = GUIGetCurrSelect( gui, id );
            if( !initDialog( gui, dlg->fileExtensions[sel], NULL ) ) {
                dlg->dialogRC = OFN_RC_RUNTIME_ERROR;
                GUICloseDialog( gui );
            }
            break;
        }
        return( true );
    default:
        break;  // makes GCC happy.
    }
    return( false );

} /* GetFileNameEvent */