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 WdeResizeEditWindows( WdeResInfo *info ) { RECT rect; if( info == NULL || info->res_win == NULL || info->forms_win == NULL || info->edit_win == NULL ) { return( FALSE ); } GetClientRect( info->res_win, &rect ); MoveWindow( info->forms_win, 0, 0, rect.right - rect.left, rect.bottom - rect.top, TRUE ); WdeCheckBaseScrollbars( TRUE ); GetClientRect( info->forms_win, &rect ); MoveWindow( info->edit_win, 0, 0, rect.right - rect.left, rect.bottom - rect.top, TRUE ); return( TRUE ); }
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 ); }