Bool WRESaveResourceToFile( WREResInfo *res_info ) { Bool ok; WRESetWaitCursor( TRUE ); ok = (res_info != NULL && res_info->info != NULL); if( ok ) { ok = WRSaveResource( res_info->info, TRUE ); } if( ok ) { WRESetResModified( res_info, FALSE ); } WRESetWaitCursor( FALSE ); return( ok ); }
bool WRELoadResourceSymbols( WREResInfo *info ) { char *symbol_file; if( info == NULL ) { return( FALSE ); } symbol_file = WRELoadSymbols( &info->symbol_table, NULL, TRUE ); if( symbol_file == NULL ) { return( FALSE ); } if( info->symbol_file != NULL ) { WRMemFree( info->symbol_file ); } info->symbol_file = symbol_file; WRESetResModified( info, TRUE ); // ***** call routine to update the edit sessions ***** return( TRUE ); }
static bool WREGetAndPasteBitmap( WREClipFormat *fmt, void *data, uint_32 dsize ) { WRECurrentResInfo curr; WResLangType lang; WResID *ctype; WResID *cname; bool dup; bool new_type; bool replace; bool ok; cname = NULL; ctype = NULL; new_type = TRUE; lang.lang = DEF_LANG; lang.sublang = DEF_SUBLANG; ok = (fmt != NULL && data != NULL && dsize != 0); if( ok ) { ctype = WResIDFromNum( fmt->type ); ok = (ctype != NULL); } if( ok ) { cname = WRRecallBitmapName(); if( cname == NULL ) { cname = WRECreateImageTitle( RESOURCE2INT( RT_BITMAP ) ); } 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, DEF_MEMFLAGS, 0, dsize, &lang, &dup, RESOURCE2INT( RT_BITMAP ), new_type ) && !dup; } if( ok ) { curr.lang->data = data; WRESetResModified( curr.info, TRUE ); } if( cname != NULL ) { WRMemFree( cname ); } if( ctype != NULL ) { WRMemFree( ctype ); } return( ok ); }
static bool WREGetAndPasteIconOrCursor( WREClipFormat *fmt ) { 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 ) { 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, fmt->type, new_type ) && !dup; } if( ok ) { if( fmt->type == RESOURCE2INT( RT_GROUP_ICON ) ) { ok = WRECreateIconEntries( &curr, data, dsize ); } else if( fmt->type == RESOURCE2INT( RT_GROUP_CURSOR ) ) { ok = WRECreateCursorEntries( &curr, data, dsize ); } else { ok = false; } } if( ok ) { WRESetResModified( curr.info, TRUE ); } if( data != NULL ) { WRMemFree( data ); } if( cdata != NULL ) { WRMemFree( cdata ); } if( cname != NULL ) { WRMemFree( cname ); } if( ctype != NULL ) { WRMemFree( ctype ); } if( !ok ) { if( data != NULL ) { WRMemFree( data ); } } return( ok ); }