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

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

#if 0
    if( state->use_def_dlg ) {
        CheckDlgButton( hDlg, IDB_OPT_DEFDEF, BST_CHECKED );
        CheckDlgButton( hDlg, IDB_OPT_GENDEF, BST_UNCHECKED );
    } else {
        CheckDlgButton( hDlg, IDB_OPT_DEFDEF, BST_UNCHECKED );
        CheckDlgButton( hDlg, IDB_OPT_GENDEF, BST_CHECKED );
    }
#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 ) ? BST_CHECKED : BST_UNCHECKED );

    if( WdeCurrentState.inc_path != NULL ) {
        WdeSetEditWithStr( state->inc_path, hDlg, IDB_OPT_INCPATH );
    } else {
        WdeSetEditWithStr( "", hDlg, IDB_OPT_INCPATH );
    }
}
Exemple #2
0
void WdeInfoLookupComboEntry( HWND hWnd, WORD hw )
{
    char                *cp;
    char                *str;
    WdeHashValue        value;
    bool                found;
    LRESULT             index;
    int                 count;

    if( WdeCurrentInfo.res_info->hash_table == NULL ) {
        return;
    }

    count = SendDlgItemMessage( hWnd, IDB_INFO_IDSTR, CB_GETCOUNT, 0, 0 );
    if( count == 0 || count == CB_ERR ) {
        return;
    }

    str = NULL;
    if( hw == CBN_EDITCHANGE ) {
        str = WdeGetStrFromCombo( hWnd, IDB_INFO_IDSTR );
    } else {
        index = SendDlgItemMessage( hWnd, IDB_INFO_IDSTR, CB_GETCURSEL, 0, 0 );
        if( index != CB_ERR ) {
            str = WdeGetStrFromComboLBox( hWnd, IDB_INFO_IDSTR, index );
        }
    }

    if( str == NULL ) {
        return;
    }

    WRStripSymbol( str );

    // if the string numeric or empty then return
    strtoul( str, &cp, 0 );
    if( *cp == '\0' ) {
        WRMemFree( str );
        return;
    }

    if( _mbclen( (unsigned char *)str ) == 1 && str[0] == '"' ) {
        value = WdeLookupName( WdeCurrentInfo.res_info->hash_table, str, &found );
        if( found ) {
            WdeSetEditWithSINT32( (int_32)value, 10, hWnd, IDB_INFO_IDNUM );
        }
    }

    WRMemFree( str );
}
Exemple #3
0
void WdeChangeDialogInfo( WdeInfoStruct *is )
{
    WdeInfoStruct       c_is;
    char                *str;
    char                *cp;
    bool                quoted_str;
    bool                str_is_ordinal;
    uint_16             ord;
    bool                found;
    WdeHashValue        value;

    c_is = *is;

    str = NULL;
    cp = WdeGetStrFromEdit( WdeInfoWindow, IDB_INFO_CAPTION, NULL );
    if( cp != NULL ) {
        str = WRConvertStringTo( cp, "\t\n", "tn" );
        WRMemFree( cp );
    }
    c_is.d.caption = str;

    str = WdeGetStrFromCombo( WdeInfoWindow, IDB_INFO_IDSTR );
    if( str == NULL ) {
        WRMemFree( c_is.d.caption );
        c_is.d.caption = NULL;
        return;
    }

    WRStripSymbol( str );

    quoted_str = FALSE;
    if( _mbclen( (unsigned char *)str ) == 1 && str[0] == '"' ) {
        unsigned char   *s;

        str[0] = ' ';
        cp = NULL;
        for( s = (unsigned char *)str; *s != '\0'; s = _mbsinc( s ) ) {
            if( _mbclen( s ) == 1 && *s == '"' ) {
                cp = (char *)s;
            }
        }
        if( cp != NULL ) {
            *cp = '\0';
        }
        WRStripSymbol( str );
        quoted_str = TRUE;
    }

    if( str[0] == '\0' ) {
        WRMemFree( str );
        WRMemFree( c_is.d.caption );
        c_is.d.caption = NULL;
        return;
    }

    ord = (uint_16)strtoul( str, &cp, 0 );
    str_is_ordinal = (*cp == '\0');

    c_is.symbol = NULL;

    if( quoted_str ) {
        c_is.d.name = WResIDFromStr( str );
        WRMemFree( str );
    } else if( str_is_ordinal ) {
        c_is.d.name = WResIDFromNum( ord );
        WRMemFree( str );
    } else {
        if( !WdeIsValidSymbol( str ) ) {
            WRMemFree( str );
            WRMemFree( c_is.d.caption );
            c_is.d.caption = NULL;
            return;
        }
        strupr( str );
        c_is.symbol = str;
        c_is.d.name = NULL;
    }

    Forward( is->obj, MODIFY_INFO, &c_is, NULL );

    if( c_is.symbol ) {
        WdeAddUniqueStringToCombo( WdeInfoWindow, IDB_INFO_IDSTR, c_is.symbol );
        value = WdeLookupName( c_is.res_info->hash_table, c_is.symbol, &found );
        if( found ) {
            WdeSetEditWithSINT32( (int_32)value, 10, WdeInfoWindow, IDB_INFO_IDNUM );
        }
    } else if( str_is_ordinal ) {
        WdeSetEditWithSINT32( (int_32)ord, 10, WdeInfoWindow, IDB_INFO_IDNUM );
    } else {
        WdeSetEditWithStr( "", WdeInfoWindow, IDB_INFO_IDNUM );
    }

    *is = c_is;
}
Exemple #4
0
void WdeChangeControlInfo( WdeInfoStruct *is )
{
    char                *str;
    char                *cp;
    WdeInfoStruct       c_is;
    bool                str_is_ordinal;
    uint_16             ord;
    bool                found;
    WdeHashValue        value;

    c_is = *is;

    str = NULL;
    cp = WdeGetStrFromEdit( WdeInfoWindow, IDB_INFO_CAPTION, NULL );
    if( cp != NULL ) {
        str = WRConvertStringTo( cp, "\t\n", "tn" );
        WRMemFree( cp );
    }

    if( str != NULL ) {
        c_is.c.text = ResStrToNameOrOrd( str );
        WRMemFree( str );
    } else {
        c_is.c.text = NULL;
    }

    str = WdeGetStrFromCombo( WdeInfoWindow, IDB_INFO_IDSTR );
    if( str == NULL ) {
        WRMemFree( c_is.c.text );
        c_is.c.text = NULL;
        return;
    }

    WRStripSymbol( str );

    if( str[0] == '\0' ) {
        WRMemFree( str );
        WRMemFree( c_is.c.text );
        c_is.c.text = NULL;
        return;
    }

    ord = (uint_16)strtoul( str, &cp, 0 );
    str_is_ordinal = (*cp == '\0');

    c_is.symbol = NULL;

    if( str_is_ordinal ) {
        c_is.c.id = ord;
        WRMemFree( str );
    } else {
        if( !WdeIsValidSymbol( str ) ) {
            WRMemFree( str );
            WRMemFree( c_is.c.text );
            c_is.c.text = NULL;
            return;
        }
        strupr( str );
        c_is.symbol = str;
    }

    Forward( c_is.obj, MODIFY_INFO, &c_is, NULL );

    if( c_is.symbol ) {
        WdeAddUniqueStringToCombo( WdeInfoWindow, IDB_INFO_IDSTR, c_is.symbol );
        value = WdeLookupName( c_is.res_info->hash_table, c_is.symbol, &found );
        if( found ) {
            WdeSetEditWithSINT32( (int_32)value, 10, WdeInfoWindow, IDB_INFO_IDNUM );
        }
    } else if( str_is_ordinal ) {
        WdeSetEditWithSINT32( (int_32)ord, 10, WdeInfoWindow, IDB_INFO_IDNUM );
    } else {
        WdeSetEditWithStr( "", WdeInfoWindow, IDB_INFO_IDNUM );
    }

    *is = c_is;
}
Exemple #5
0
void WdeSetEditWithSINT16( int_16 val, int base, HWND hDlg, int id )
{
    WdeSetEditWithSINT32( (int_32)val, base, hDlg, id );
}