コード例 #1
0
ファイル: wregcres.c プロジェクト: Ukusbobra/open-watcom-v2
Bool WREGetCurrentResource( WRECurrentResInfo *current )
{
    WRETypeName *tn;
    Bool        ok;
    HWND        resLbox;
    LRESULT     index;

    ok = (current != NULL);

    if( ok ) {
        current->type = NULL;
        current->res = NULL;
        current->lang = NULL;
        current->info = WREGetCurrentRes();
        ok = (current->info != NULL && current->info->info != NULL &&
              current->info->info->dir != NULL);
    }

    if( ok ) {
        tn = WREGetTypeNameFromRT( current->info->current_type );
        ok = (tn != NULL);
    }

    if( ok ) {
        current->type = WREFindTypeNode( current->info->info->dir, tn->type, NULL );
        ok = (current->type != NULL);
    }

    if( ok ) {
        resLbox = GetDlgItem( current->info->info_win, IDM_RNRES );
        ok = (resLbox != (HWND)NULL);
    }

    if( ok ) {
        index = SendMessage( resLbox, LB_GETCURSEL, 0, 0 );
        ok = (index != LB_ERR);
    }

    if( ok ) {
        current->lang = (WResLangNode *)SendMessage( resLbox, LB_GETITEMDATA,
                                                     (WPARAM)index, 0 );
        ok = (current->lang != NULL);
    }

    if( ok ) {
        current->res = WREFindResNodeFromLangNode( current->type, current->lang );
        ok = (current->res != NULL);
    }

    return( ok );
}
コード例 #2
0
ファイル: wreclip.c プロジェクト: Azarien/open-watcom-v2
static void WRESetPasteInfo( HWND hDlg, WREPasteData *pdata )
{
    WRETypeName *tn;
    char        *text;

    tn = WREGetTypeNameFromRT( pdata->type );
    if( tn != NULL ) {
        text = AllocRCString( tn->name );
        WRESetEditWithStr( GetDlgItem( hDlg, IDM_PASTE_TYPE ), text );
        if( text != NULL ) {
            FreeRCString( text );
        }
    }
    WRESetEditWithWResID( GetDlgItem( hDlg, IDM_PASTE_NAME ), pdata->name );
}
コード例 #3
0
ファイル: wrenames.c プロジェクト: Ukusbobra/open-watcom-v2
Bool WREAddToTypeListBox( HWND lbox, WResTypeNode *tnode )
{
    char                *text;
    WRETypeName         *tn;
    Bool                ok;

    text = NULL;

    ok = (tnode != NULL && lbox != (HWND)NULL);

    if( ok ) {
        if( tnode->Info.TypeName.IsName ) {
            text = WResIDToStr( &tnode->Info.TypeName );
        } else {
            tn = WREGetTypeNameFromRT( (uint_16)tnode->Info.TypeName.ID.Num );
            if( tn != NULL && tn->name != -1 && !tn->exclude ) {
                text = tn->typeName;
            }
        }
        ok = (text != NULL);
    }

    if( ok ) {
        ok = WRESetLBoxWithStr( lbox, text, tnode );
    }

    if( text != NULL && tnode->Info.TypeName.IsName ) {
        WREMemFree( text );
    }

    if( !ok && tn != NULL && tn->exclude ) {
        return( TRUE );
    }

    return( ok );
}
コード例 #4
0
ファイル: wreclip.c プロジェクト: Azarien/open-watcom-v2
static bool WREGetAndPasteResource( WREClipFormat *fmt )
{
    WRETypeName         *tn;
    WRECurrentResInfo   curr;
    WREClipData         *cdata;
    WResLangType        lang;
    WResID              *ctype;
    WResID              *cname;
    void                *data;
    uint_32             dsize;
    bool                dup;
    bool                new_type;
    bool                replace;
    bool                ok;

    cdata = NULL;
    cname = NULL;
    ctype = NULL;
    new_type = TRUE;
    lang.lang = DEF_LANG;
    lang.sublang = DEF_SUBLANG;

    ok = (fmt != NULL);

    if( ok ) {
        tn = WREGetTypeNameFromRT( fmt->type );
        ok = (tn != NULL);
    }

    if( ok ) {
        ctype = WResIDFromNum( fmt->type );
        ok = (ctype != NULL);
    }

    if( ok ) {
        ok = WREGetClipData( fmt, &data, &dsize );
    }

    if( ok ) {
        cdata = (WREClipData *)data;
        data = NULL;
        ok = (cdata != NULL);
    }

    if( ok ) {
        data = WRMemAlloc( cdata->data_size );
        ok = (data != NULL);
    }

    if( ok ) {
        memcpy( data, (BYTE *)cdata + cdata->data_offset, cdata->data_size );
        cname = WREGetClipDataName( cdata );
        ok = (cname != NULL);
    }

    if( ok ) {
        WREGetCurrentResource( &curr );
        if( curr.info == NULL ) {
            curr.info = WRECreateNewResource( NULL );
            ok = (curr.info != NULL);
        }
    }

    if( ok ) {
        ok = WREHandleClipDataNames( curr.info, ctype, &cname, &replace );
    }

    if( ok ) {
        if( curr.info != NULL ) {
            if( curr.info->info->dir ) {
                new_type = (WREFindTypeNodeFromWResID( curr.info->info->dir,
                                                       ctype ) == NULL);
            }
        }
        ok = WRENewResource( &curr, ctype, cname, cdata->memflags, 0,
                             (uint_32)cdata->data_size, &lang, &dup, tn->type,
                             new_type ) && !dup;
    }

    if( ok ) {
        curr.lang->data = data;
        WRESetResModified( curr.info, TRUE );
    }

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

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

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

    if( !ok ) {
        if( data != NULL ) {
            WRMemFree( data );
        }
    }

    return( ok );
}