Bool WREChangeMemFlags( void ) { WRECurrentResInfo curr; HWND parent; char *name; int type; uint_16 mflags; FARPROC cb; Bool ok; cb = NULL; name = NULL; mflags = 0; ok = WREGetCurrentResource( &curr ); if( ok ) { if( curr.type->Info.TypeName.IsName ) { type = 0; } else { type = curr.type->Info.TypeName.ID.Num; } name = WREGetResName( curr.res, type ); parent = WREGetMainWindowHandle(); } if( ok ) { cb = MakeProcInstance( (FARPROC)WREHelpRoutine, WREGetAppInstance() ); ok = (cb != (FARPROC)NULL); } if( ok ) { mflags = curr.lang->Info.MemoryFlags; ok = WRChangeMemFlags( parent, name, &mflags, cb ); } if( ok ) { curr.lang->Info.MemoryFlags = mflags; } if( cb != (FARPROC)NULL ) { FreeProcInstance( (FARPROC)cb ); } if( name != NULL ) { WREMemFree( name ); } return( ok ); }
bool WREChangeMemFlags( void ) { WRECurrentResInfo curr; HWND parent; char *type_name; uint_16 type_id; uint_16 mflags; HELP_CALLBACK hcb; bool ok; hcb = (HELP_CALLBACK)NULL; type_name = NULL; mflags = 0; type_id = 0; ok = WREGetCurrentResource( &curr ); if( ok ) { if( !curr.type->Info.TypeName.IsName ) { type_id = curr.type->Info.TypeName.ID.Num; } type_name = WREGetResName( curr.res, type_id ); parent = WREGetMainWindowHandle(); } if( ok ) { hcb = (HELP_CALLBACK)MakeProcInstance( (FARPROC)WREHelpRoutine, WREGetAppInstance() ); ok = (hcb != (HELP_CALLBACK)NULL); } if( ok ) { mflags = curr.lang->Info.MemoryFlags; ok = WRChangeMemFlags( parent, type_name, &mflags, hcb ); } if( ok ) { curr.lang->Info.MemoryFlags = mflags; } if( hcb != (HELP_CALLBACK)NULL ) { FreeProcInstance( (FARPROC)hcb ); } if( type_name != NULL ) { WRMemFree( type_name ); } return( ok ); }
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 ); }