bool WRAPI WRDeleteGroupImages( WRInfo *info, WResLangNode *lnode, uint_16 type ) { WResLangType lt; WResTypeNode *itnode; WResResNode *irnode; WResLangNode *ilnode; void *data; RESICONHEADER *ih; RESCURSORHEADER *ch; int i; uint_16 ord; bool ok; ok = (info != NULL && lnode != NULL && (type == RESOURCE2INT( RT_GROUP_ICON ) || type == RESOURCE2INT( RT_GROUP_CURSOR ))); if( ok ) { data = WRCopyResData( info, lnode ); ok = (data != NULL); } if( ok ) { if( type == RESOURCE2INT( RT_GROUP_ICON ) ) { ih = (RESICONHEADER *)data; for( i = 0; ok && i < ih->cwCount; i++ ) { ord = (uint_16)ih->idEntries[i].wNameOrdinal; lt = lnode->Info.lang; if( WRFindImageId( info, &itnode, &irnode, &ilnode, RESOURCE2INT( RT_ICON ), ord, < ) ) { if( ilnode->data != NULL ) { MemFree( ilnode->data ); ilnode->data = NULL; } ok = WRRemoveLangNodeFromDir( info->dir, &itnode, &irnode, &ilnode ); } } } else { ch = (RESCURSORHEADER *)data; for( i = 0; ok && i < ch->cwCount; i++ ) { ord = (uint_16)ch->cdEntries[i].wNameOrdinal; lt = lnode->Info.lang; if( WRFindImageId( info, &itnode, &irnode, &ilnode, RESOURCE2INT( RT_CURSOR ), ord, < ) ) { if( ilnode->data != NULL ) { MemFree( ilnode->data ); ilnode->data = NULL; } ok = WRRemoveLangNodeFromDir( info->dir, &itnode, &irnode, &ilnode ); } } } } if( data != NULL ) { MemFree( data ); } return( ok ); }
bool WdeRemoveDialogFromResInfo( WdeResInfo *res_info, WdeResDlgItem *ditem, bool destroy_object ) { WResResNode *rnode; WResLangNode *lnode; if( res_info == NULL || ditem == NULL ) { return( FALSE ); } res_info->modified = true; rnode = ditem->rnode; lnode = ditem->lnode; ListRemoveElt( &res_info->dlg_item_list, ditem ); WdeFreeResDlgItem( &ditem, destroy_object ); if( rnode != NULL || lnode != NULL ) { return( WRRemoveLangNodeFromDir( res_info->info->dir, &res_info->dlg_entry, &rnode, &lnode ) ); } return( TRUE ); }
bool WRERemoveEmptyResource( WRECurrentResInfo *curr ) { char *name; int type; bool ok; LRESULT index; HWND res_lbox; name = NULL; ok = true; if( ok ) { if( curr->type->Info.TypeName.IsName ) { type = 0; } else { type = curr->type->Info.TypeName.ID.Num; } name = WREGetResName( curr->res, type ); ok = (name != NULL); } if( ok ) { ok = WRRemoveLangNodeFromDir( curr->info->info->dir, &curr->type, &curr->res, &curr->lang ); curr->info->modified = true; } if( ok ) { if( !curr->type ) { curr->info->current_type = 0; ok = WREInitResourceWindow( curr->info, 0 ); } else { res_lbox = GetDlgItem( curr->info->info_win, IDM_RNRES ); index = SendMessage( res_lbox, LB_FINDSTRING, 0, (LPARAM)name ); if( index == LB_ERR ) { index = 0; } ok = WRESetResNamesFromType( curr->info, curr->info->current_type, TRUE, NULL, index ); } } if( name != NULL ) { WRMemFree( name ); } return( ok ); }
bool WREDeleteResource( WRECurrentResInfo *curr, bool force ) { char *name; int type; bool ok; LRESULT index; HWND res_lbox; WResLangNode *lnode; name = NULL; lnode = NULL; if( curr->info->current_type == RESOURCE2INT( RT_STRING ) ) { return( WREDeleteStringResources( curr, FALSE ) ); } ok = (curr->info != NULL && curr->res != NULL && curr->lang != NULL); if( ok ) { if( curr->type->Info.TypeName.IsName ) { type = 0; } else { type = curr->type->Info.TypeName.ID.Num; } name = WREGetResName( curr->res, type ); ok = (name != NULL); } if( ok && !force ) { ok = WREQueryDeleteName( name ); } // nuke any edit sessions on this resource if( ok ) { lnode = curr->lang; switch( type ) { case RT_MENU: WREEndLangMenuSession( lnode ); break; case RT_STRING: WREEndResStringSessions( curr->info ); break; case RT_ACCELERATOR: WREEndLangAccelSession( lnode ); break; case RT_DIALOG: WREEndLangDialogSession( lnode ); break; case RT_GROUP_CURSOR: case RT_GROUP_ICON: ok = WREDeleteGroupImages( curr, (uint_16)type ); /* fall through */ case RT_BITMAP: if( ok ) { WREEndLangImageSession( lnode ); } break; } } if( ok ) { ok = WRRemoveLangNodeFromDir( curr->info->info->dir, &curr->type, &curr->res, &curr->lang ); curr->info->modified = true; } if( ok ) { if( !curr->type ) { curr->info->current_type = 0; ok = WREInitResourceWindow( curr->info, 0 ); } else { res_lbox = GetDlgItem( curr->info->info_win, IDM_RNRES ); index = SendMessage( res_lbox, LB_FINDSTRING, 0, (LPARAM)name ); if( index == LB_ERR ) { index = 0; } ok = WRESetResNamesFromType( curr->info, curr->info->current_type, TRUE, NULL, index ); } } if( ok ) { WRESetTotalText( curr->info ); } if( name != NULL ) { WRMemFree( name ); } return( ok ); }