bool WREResourceSaveSymbols( WREResInfo *info ) { if( info != NULL ) { return( WRESaveSymbols( info->symbol_table, &info->symbol_file, TRUE ) ); } return( FALSE ); }
Bool WREQuerySaveSymOnDeleteRes( WREResInfo *res_info, Bool fatal_exit ) { int ret; UINT style; char *text; char *file; HWND frame; if( WRENoInterface ) { return( TRUE ); } if( res_info == NULL || res_info->symbol_table == NULL ) { return( TRUE ); } if( WRIsHashTableDirty( res_info->symbol_table ) ) { if( fatal_exit ) { style = MB_YESNO | MB_APPLMODAL | MB_ICONEXCLAMATION; } else { style = MB_YESNOCANCEL | MB_APPLMODAL | MB_ICONEXCLAMATION; } WRECheckIfActiveWindow(); frame = WREGetMDIWindowHandle(); SendMessage( frame, WM_MDIRESTORE, (WPARAM)res_info->res_win, 0 ); SendMessage( frame, WM_MDIACTIVATE, (WPARAM)res_info->res_win, 0 ); file = WREGetQueryName( res_info ); text = WREAllocRCString( WRE_SAVEMODIFIEDSYM ); ret = MessageBox( res_info->res_win, text, file, style ); if( text != NULL ) { WREFreeRCString( text ); } if( ret == IDYES ) { if( res_info->symbol_file == NULL ) { res_info->symbol_file = WRECreateSymName( file ); } if( !WRESaveSymbols( res_info->symbol_table, &res_info->symbol_file, FALSE ) ) { return( FALSE ); } } else if( ret == IDCANCEL ) { return( FALSE ); } } return( TRUE ); }
Bool WRESaveResource( WREResInfo *res_info, Bool get_name ) { char *fn; WREGetFileStruct gf; int fn_offset; Bool got_name; Bool ok; fn_offset = 0; got_name = FALSE; ok = (res_info != NULL && res_info->info != NULL); if( ok ) { ok = (WRCountZeroLengthResources( res_info->info->dir ) == 0); if( !ok ) { WREDisplayErrorMsg( WRE_UPDATEBEFORESAVE ); } } if( ok ) { if( res_info->info->save_name != NULL ) { fn = res_info->info->save_name; } else { res_info->info->save_type = res_info->info->file_type; fn = WREStrDup( res_info->info->file_name ); got_name = TRUE; } if( get_name || fn == NULL || *fn == '\0' ) { gf.file_name = fn; gf.title = WREResSaveTitle; gf.filter = WREResFilter; gf.save_ext = TRUE; fn = WREGetSaveFileName( &gf ); got_name = TRUE; res_info->info->save_type = WR_DONT_KNOW; } ok = (fn != NULL && *fn != '\0'); } if( ok ) { if( got_name && res_info->info->save_name != NULL ) { WREMemFree( res_info->info->save_name ); } res_info->info->save_name = fn; if( res_info->info->save_type == WR_DONT_KNOW ) { res_info->info->save_type = WRESelectFileType( fn, res_info->is32bit ); } ok = (res_info->info->save_type != WR_DONT_KNOW); } if( ok ) { if( WRIsHashTableDirty( res_info->symbol_table ) ) { if( res_info->symbol_file == NULL ) { res_info->symbol_file = WRECreateSymName( fn ); } } } if( ok ) { WRECreateDLGInclude( &res_info->info->dir, res_info->symbol_file ); ok = WRESaveResourceToFile( res_info ); if( !ok ) { WREDisplayErrorMsg( WRE_SAVEFAILED ); } } if( ok ) { if( get_name || WRIsHashTableDirty( res_info->symbol_table ) ) { ok = WRESaveSymbols( res_info->symbol_table, &res_info->symbol_file, get_name ); } } if( ok ) { //fn_offset = WRFindFnOffset( fn ); SendMessage( res_info->res_win, WM_SETTEXT, 0, (LPARAM)(LPSTR)&fn[fn_offset] ); } return( ok ); }