Exemplo n.º 1
0
void WdeDisplayControlInfo( WdeInfoStruct *is )
{
    char             *str;
    char             *cp;

    str = NULL;
    cp = WdeResNameOrOrdinalToStr( is->c.text, 10 );
    if( cp != NULL ) {
        str = WRConvertStringFrom( cp, "\t\n", "tn" );
        WRMemFree( cp );
    }

    if( str != NULL ) {
        WdeSetEditWithStr( str, WdeInfoWindow, IDB_INFO_CAPTION );
        WRMemFree( str );
    } else {
        WdeSetEditWithStr( "", WdeInfoWindow, IDB_INFO_CAPTION );
    }

    if( is->symbol ) {
        WdeSetComboWithStr( is->symbol, WdeInfoWindow, IDB_INFO_IDSTR );
    } else {
        WdeSetEditWithSINT16( (int_16)is->c.id, 10, WdeInfoWindow, IDB_INFO_IDSTR );
    }

    WdeSetEditWithSINT16( (int_16)is->c.id, 10, WdeInfoWindow, IDB_INFO_IDNUM );
}
Exemplo n.º 2
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 );
    }
}
Exemplo n.º 3
0
void WdeDisplayDialogInfo( WdeInfoStruct *is )
{
    char          *str;
    WResID        *name;

    str = WRConvertStringFrom( is->d.caption, "\t\n", "tn" );
    if( str == NULL ) {
        WdeSetEditWithStr( "", WdeInfoWindow, IDB_INFO_CAPTION );
    } else {
        WdeSetEditWithStr( str, WdeInfoWindow, IDB_INFO_CAPTION );
        WRMemFree( str );
    }

    name = is->d.name;
    if( name->IsName ) {
        char    *str1, *str2;
        int     len;
        bool    ok;

        ok = false;
        str1 = WResIDToStr( name );
        if( str1 != NULL ) {
            len = strlen( str1 ) + 3;
            str2 = WRMemAlloc( len );
            if( str2 != NULL ) {
                str2[0] = '"';
                strcpy( &str2[1], str1 );
                str2[len - 2] = '"';
                str2[len - 1] = '\0';
                WdeSetComboWithStr( str2, WdeInfoWindow, IDB_INFO_IDSTR );
                WRMemFree( str2 );
                ok = true;
            }
            WRMemFree( str1 );
        }
        if( !ok ) {
            WdeSetComboWithStr( "", WdeInfoWindow, IDB_INFO_IDSTR );
        }
        WdeSetEditWithStr( "", WdeInfoWindow, IDB_INFO_IDNUM );
    } else {
        if( is->symbol != NULL ) {
            WdeSetComboWithStr( is->symbol, WdeInfoWindow, IDB_INFO_IDSTR );
        } else {
            WdeSetEditWithSINT16( (int_16)name->ID.Num, 10, WdeInfoWindow, IDB_INFO_IDSTR );
        }
        WdeSetEditWithSINT16( (int_16)name->ID.Num, 10, WdeInfoWindow, IDB_INFO_IDNUM );
    }
}
Exemplo n.º 4
0
void WdeWriteObjectDimensions( int x, int y, int width, int height )
{
    char str[56];

    sprintf( str, "(%d,%d) (%d,%d) %dx%d",
             x, y, x + width, y + height, width, height );

    WdeSetEditWithStr( str, WdeInfoWindow, IDB_INFO_SIZE );
}
Exemplo n.º 5
0
void WdeSetEditWithSINT32( int_32 val, int base, HWND hDlg, int id )
{
    char temp[35];

    ltoa( val, temp, base );
    if( base == 16 ) {
        memmove( temp + 2, temp, 33 );
        temp[0] = '0';
        temp[1] = 'x';
    } else if( base == 8 ) {
        memmove( temp + 1, temp, 34 );
        temp[0] = '0';
    }
    WdeSetEditWithStr( temp, hDlg, id );
}
Exemplo n.º 6
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;
}
Exemplo n.º 7
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;
}
Exemplo n.º 8
0
void WdeWriteInfo( WdeInfoStruct *is )
{
    static WdeHashTable *last_table = NULL;
    static WdeResInfo   *last_res = NULL;
    static OBJ_ID       last_obj = 0;
    char                *cap_text, *id;
    bool                same_hash;

    if( WdeInfoWindowDepth == 0 || WdeInfoWindow == NULL ) {
        return;
    }

    if( is == NULL || is->obj == NULL || is->res_info == NULL ) {
        WdeWriteTrail( "WdeWriteDialogInfo: NULL parameter!" );
        return;
    }

    /* make sure the resource window is not robbed of focus */
    if( GetFocus() != is->res_info->res_win ) {
        SetFocus( is->res_info->res_win );
    }

    WdeCurrentInfo = *is;

    same_hash = (last_res == is->res_info && last_table == is->res_info->hash_table);

    WdeWriteSymInfo( is, same_hash, NULL );

    last_table = is->res_info->hash_table;
    last_res = is->res_info;

    if( is->obj_id == BASE_OBJ ) {
        WdeSetEditWithStr( "", WdeInfoWindow, IDB_INFO_SIZE );
        WdeEnableInfoWindowInput( FALSE );
        WdeSetEditWithStr( "", WdeInfoWindow, IDB_INFO_CAPTION );
        WdeSetEditWithStr( "", WdeInfoWindow, IDB_INFO_IDSTR );
        WdeSetEditWithStr( "", WdeInfoWindow, IDB_INFO_IDNUM );
    } else {
        WdeWriteObjectDimensions( (int_16)is->size.x, (int_16)is->size.y,
                                  (int_16)is->size.width, (int_16)is->size.height );
        WdeEnableInfoWindowInput( TRUE );
        if( is->obj_id == DIALOG_OBJ ) {
            WdeDisplayDialogInfo( is );
        } else if( is->obj_id == CONTROL_OBJ ) {
            WdeDisplayControlInfo( is );
        }
    }

    if( last_obj != is->obj_id ) {
        if( is->obj_id == DIALOG_OBJ ) {
            cap_text = WdeCaptionText;
            id = WdeDlgNameText;
        } else if( is->obj_id == CONTROL_OBJ ) {
            cap_text = WdeTextText;
            id = WdeIDText;
        } else if( is->obj_id == BASE_OBJ ) {
            cap_text = "";
            id       = "";
        }
        WdeSetEditWithStr( cap_text, WdeInfoWindow, IDB_INFO_CAPTEXT );
        WdeSetEditWithStr( id, WdeInfoWindow, IDB_INFO_NAMETEXT );
        last_obj = is->obj_id;
    }
}
Exemplo n.º 9
0
void WdeSetComboWithStr( char *cp, HWND hDlg, int id )
{
    WdeSetEditWithStr( cp, hDlg, id );
}