bool WdeSaveResourceToFile( WdeResInfo *res_info ) { bool ok; char fn[_MAX_PATH]; WdeSetWaitCursor( TRUE ); ok = (res_info != NULL && res_info->info != NULL); if( ok ) { if( res_info->info->save_type == WR_WIN_RC_DLG || res_info->info->save_type == WR_WIN_RC ) { if( res_info->info->internal_type == WR_DONT_KNOW ) { WRGetInternalRESName( res_info->info->save_name, fn ); res_info->info->internal_type = WdeSelectFileType( fn, res_info->is32bit ); } } } if( ok ) { ok = WdeInfoToData( res_info ); } if( ok ) { if( res_info->info->save_type == WR_WIN_RC_DLG || res_info->info->save_type == WR_WIN_RC ) { ok = WdeSaveRC( res_info->info->save_name, res_info ); } } // if we are saving a .RES file then auto create a dlg script if( ok ) { if( res_info->info->save_type == WR_WIN16M_RES || res_info->info->save_type == WR_WIN16W_RES || res_info->info->save_type == WR_WINNTM_RES || res_info->info->save_type == WR_WINNTW_RES ) { char dlgName[_MAX_PATH]; if( WdeCreateDLGName( res_info->info->save_name, dlgName ) ) { ok = WdeSaveRC( dlgName, res_info ); } } } if( ok ) { ok = WRSaveResource( res_info->info, true ); } if( ok ) { WdeSetResModified( res_info, FALSE ); } if( res_info != NULL && res_info->info->save_type != WR_WIN_RC_DLG ) { WdeFreeInfoData( res_info ); } WdeSetWaitCursor( FALSE ); return( ok ); }
WdeResInfo *WdeCreateNewResource( char *title ) { WdeResInfo *res_info; bool ok; ok = ((res_info = WdeAllocResInfo()) != NULL); if( ok ) { ok = ((res_info->info = WRAllocWRInfo()) != NULL); } if( ok ) { res_info->hash_table = WRInitHashTable(); ok = (res_info->hash_table != NULL); } if( ok ) { if( title != NULL ) { res_info->info->save_name = WdeStrDup( title ); ok = (res_info->info->save_name != NULL); } } if( ok ) { #ifdef __NT__ res_info->is32bit = TRUE; #else res_info->is32bit = FALSE; #endif ok = WdeCreateResourceWindow( res_info, 0, title ); } if( ok ) { ListAddElt( &WdeResList, (void *)res_info ); if( !WdeIsDDE() || title == NULL ) { ok = (WdeCreateNewDialog( NULL, res_info->is32bit ) != NULL); } } if( ok ) { WdeCheckBaseScrollbars( FALSE ); } if( res_info ) { if( ok ) { WdeSetResModified( res_info, FALSE ); } else { WdeRemoveResource( res_info ); res_info = NULL; } } return( res_info ); }
bool WdeUpdateDDEEditSession( void ) { WdeResInfo *rinfo; WdeResDlgItem *ditem; HDDEDATA hdata; bool ok; hdata = (HDDEDATA)NULL; ditem = WdeGetDlgItem(); ok = (WdeClientConv != (HCONV)NULL && ditem != NULL); if( ok ) { hdata = WdeCreateResData( ditem ); ok = (hdata != (HDDEDATA)NULL); } if( ok ) { ok = DdeClientTransaction( (LPBYTE)hdata, -1, WdeClientConv, hDataItem, WdeDataClipbdFormat, XTYP_POKE, TIME_OUT, NULL ) != 0; } if( hdata != (HDDEDATA)NULL ) { DdeFreeDataHandle( hdata ); } if( ok ) { hdata = WdeCreateResNameData( ditem->dialog_name, ditem->is32bit ); ok = (hdata != (HDDEDATA)NULL); } if( ok ) { ok = DdeClientTransaction( (LPBYTE)hdata, -1, WdeClientConv, hNameItem, WdeDataClipbdFormat, XTYP_POKE, TIME_OUT, NULL ) != 0; } if( hdata != (HDDEDATA)NULL ) { DdeFreeDataHandle( hdata ); } if( ok ) { rinfo = WdeGetCurrentRes(); WdeSetResModified( rinfo, FALSE ); } return( ok ); }
bool WdeOpenResource( char *fn ) { char *name; WdeResInfo *res_info; WdeGetFileStruct gf; bool ok, got_name; WdeSetWaitCursor( TRUE ); res_info = NULL; name = NULL; got_name = FALSE; if( fn != NULL ) { if( WdeFileExists( fn ) ) { name = WdeStrDup( fn ); gf.fn_offset = WRFindFnOffset( name ); } else { return( FALSE ); } } else { gf.file_name = NULL; gf.title = WdeResOpenTitle; gf.filter = WdeResOpenFilter; ok = ((name = WdeGetOpenFileName( &gf )) != NULL); } if( ok ) { got_name = TRUE; ok = ((res_info = WdeLoadResource( name )) != NULL); } if( ok ) { res_info->hash_table = WRInitHashTable(); ok = (res_info->hash_table != NULL); } if( ok ) { if( res_info->info->internal_type != WR_DONT_KNOW ) { res_info->is32bit = WRIs32Bit( res_info->info->internal_type ); } else { res_info->is32bit = WRIs32Bit( res_info->info->file_type ); } ok = WdeAddDlgItems( res_info ); } if( ok ) { WdeFindAndLoadSymbols( res_info ); ok = WdeCreateResourceWindow( res_info, gf.fn_offset, NULL ); } if( ok ) { if( WdeResInfoHasDialogs( res_info ) ) { WdeSelectDialog( res_info ); } else { WdeDisplayErrorMsg( WDE_PRJHASNODIALOGS ); } ListAddElt( &WdeResList, (void *)res_info ); WdeSetResModified( res_info, FALSE ); WdeCheckBaseScrollbars( FALSE ); } if( !ok ) { if( res_info != NULL ) { WdeFreeResInfo( res_info ); res_info = NULL; } if( got_name ) { WdeDisplayErrorMsg( WDE_RESOURCESNOTLOADED ); } } if( name != NULL ) { WRMemFree( name ); } WdeSetWaitCursor( FALSE ); return( ok ); }