コード例 #1
0
ファイル: wsetedit.c プロジェクト: ABratovic/open-watcom-v2
int_32 WGetSINT32FromEdit( HWND edit, bool *mod )
{
    int_32  val;
    char    *cp;
    char    *ep;

    val = 0;

    cp = WGetStrFromEdit( edit, mod );

    /* find out if the edit field has changed */
    if( mod == NULL || *mod ) {
        if( cp == NULL ) {
            return( 0 );
        }
        val = (int_32)strtol( cp, &ep, 0 );
        if( *ep != '\0' ) {
            if( mod != NULL ) {
                *mod = FALSE;
            }
            val = 0;
        }
    }

    if( cp != NULL ) {
        WRMemFree( cp );
    }

    return( val );
}
コード例 #2
0
ファイル: wsetedit.c プロジェクト: ABratovic/open-watcom-v2
WResID *WGetWResIDFromEdit( HWND edit, bool *mod )
{
    WResID  *rp;
    uint_16 ordID;
    char    *cp;
    char    *ep;

    rp = NULL;

    cp = WGetStrFromEdit( edit, mod );

    /* find out if the edit field has changed */
    if( mod == NULL || *mod ) {
        if( cp == NULL ) {
            return( NULL );
        }
        ordID = (uint_16)strtoul( cp, &ep, 0 );
        if( *ep == '\0' ) {
            rp = WResIDFromNum( ordID );
        } else {
            rp = WResIDFromStr( cp );
        }
    }

    if( cp != NULL ) {
        WRMemFree( cp );
    }

    return( rp );
}
コード例 #3
0
ファイル: wmain.c プロジェクト: Ukusbobra/open-watcom-v2
static void handleSymbols( WMenuEditInfo *einfo )
{
    char        *text;

    if( !WEditSymbols( einfo->win, &einfo->info->symbol_table,
                       WGetEditInstance(), WMenuHelpRoutine ) ) {
        return;
    }

    WResolveMenuSymIDs( einfo );

    text = WGetStrFromEdit( GetDlgItem( einfo->edit_dlg, IDM_MENUEDID ), NULL );
    WRAddSymbolsToComboBox( einfo->info->symbol_table, einfo->edit_dlg,
                            IDM_MENUEDID, WR_HASHENTRY_ALL );
    if( text != NULL ) {
        WSetEditWithStr( GetDlgItem( einfo->edit_dlg, IDM_MENUEDID ), text );
        WMemFree( text );
    }

    WHandleSelChange( einfo );
}
コード例 #4
0
ファイル: wedit.c プロジェクト: Ukusbobra/open-watcom-v2
Bool WGetEditWindowText( HWND dlg, char **text )
{
    Bool        ok;
    char        *n;

    ok = (dlg != (HWND)NULL && text != NULL);

    if( ok ) {
        n = WGetStrFromEdit( GetDlgItem( dlg, IDM_MENUEDTEXT ), NULL );
        if( n != NULL && *n == '\0' ) {
            WMemFree( n );
            n = NULL;
        }
        *text = WConvertStringTo( n, "\t\x8", "ta" );
        if( n != NULL ) {
            WMemFree( n );
        }
        ok = (*text != NULL);
    }

    return( ok );
}
コード例 #5
0
ファイル: wedit.c プロジェクト: Azarien/open-watcom-v2
bool WGetEditWindowKey( HWND dlg, uint_16 *key, uint_16 *flags, bool *force_ascii )
{
    bool    ok;
    char    *text;

    text = NULL;

    ok = (dlg != (HWND)NULL && key != NULL && flags != NULL && force_ascii != NULL);

    if( ok ) {
        text = WGetStrFromEdit( GetDlgItem( dlg, IDM_ACCEDKEY ), NULL );
        ok = (text != NULL);
    }

    if( ok ) {
        ok = WGetKeyFromText( text, key, flags, force_ascii );
    }

    if( text != NULL ) {
        WRMemFree( text );
    }

    return( ok );
}
コード例 #6
0
ファイル: wedit.c プロジェクト: Ukusbobra/open-watcom-v2
Bool WGetEditWindowID( HWND dlg, char **symbol, uint_16 *id,
                       WRHashTable *symbol_table, Bool combo_change )
{
    int_32      val;
    char        *ep;
    WRHashValue hv;
    WRHashEntry *new_entry;
    BOOL        dup;

    if( dlg == (HWND)NULL ) {
        return( FALSE );
    }

    if( combo_change ) {
        *symbol = WGetStrFromComboLBox( GetDlgItem( dlg, IDM_MENUEDID ), -1 );
    } else {
        *symbol = WGetStrFromEdit( GetDlgItem( dlg, IDM_MENUEDID ), NULL );
    }

    if( *symbol == NULL ) {
        return( FALSE );
    }

    if( **symbol == '\0' ) {
        *symbol = WGetStrFromEdit( GetDlgItem( dlg, IDM_MENUEDNUM ), NULL );
    }

    if( *symbol == NULL ) {
        return( FALSE );
    }

    strupr( *symbol );

    // check if the string has a numeric representation
    val = (int_32)strtol( *symbol, &ep, 0 );
    if( *ep != '\0' ) {
        // the string did not have a numeric representation
        // so let's look it up in the hash table
        if( WRLookupName( symbol_table, *symbol, &hv ) ) {
            *id = (uint_16)hv;
        } else {
            dup = FALSE;
            new_entry = WRAddDefHashEntry( symbol_table, *symbol, &dup );
            if( new_entry != NULL ) {
                *id = (uint_16)new_entry->value;
                if( !dup ) {
                    SendDlgItemMessage( dlg, IDM_MENUEDID, CB_ADDSTRING,
                                        0, (LPARAM)(LPSTR)new_entry->name );
                    SendDlgItemMessage( dlg, IDM_MENUEDID, CB_SETITEMDATA,
                                        0, (LPARAM)new_entry );
                }
            } else {
                *id = 0;
                WMemFree( *symbol );
                *symbol = NULL;
                return( FALSE );
            }
        }
    } else {
        // the string did have a numeric representation
        *id = (uint_16)val;
        WMemFree( *symbol );
        *symbol = NULL;
    }

    return( TRUE );
}