void WHandleClear( WMenuEditInfo *einfo ) { if( einfo->menu != NULL && einfo->menu->first_entry != NULL ) { if( WQueryClearRes( einfo ) ) { WSetEditWindowText( einfo->edit_dlg, 0, NULL ); WSetEditWindowID( einfo->edit_dlg, 0, TRUE, NULL ); WResetEditWindowFlags( einfo->edit_dlg ); SendDlgItemMessage( einfo->edit_dlg, IDM_MENUEDLIST, LB_RESETCONTENT, 0, 0 ); WFreeMenuEntries( einfo->menu->first_entry ); einfo->menu->first_entry = NULL; einfo->current_entry = NULL; einfo->current_pos = -1; einfo->first_preview_id = FIRST_PREVIEW_ID; WResetPrevWindowMenu( einfo ); if( einfo->info->stand_alone ) { if( einfo->file_name != NULL ) { WMemFree( einfo->file_name ); einfo->file_name = NULL; WSetEditTitle( einfo ); } if( einfo->info->symbol_table != NULL ) { WRFreeHashTable( einfo->info->symbol_table ); einfo->info->symbol_table = WRInitHashTable(); } } einfo->info->modified = TRUE; SetFocus( einfo->edit_dlg ); WSetStatusByID( einfo->wsb, W_MENUCLEARMSG, -1 ); } } }
void WHandleClear( WStringEditInfo *einfo ) { if( einfo->tbl != NULL && einfo->tbl->first_block != NULL ) { if( WQueryClearRes( einfo ) ) { WResetEditWindow( einfo ); SendDlgItemMessage( einfo->edit_dlg, IDM_STREDLIST, LB_RESETCONTENT, 0, 0 ); WFreeStringTableBlocks( einfo->tbl->first_block ); einfo->tbl->first_block = NULL; einfo->current_block = NULL; einfo->current_string = 0; einfo->current_pos = -1; if( einfo->info->stand_alone ) { if( einfo->file_name != NULL ) { WRMemFree( einfo->file_name ); einfo->file_name = NULL; WSetEditTitle( einfo ); } if( einfo->info->symbol_table != NULL ) { WRFreeHashTable( einfo->info->symbol_table ); einfo->info->symbol_table = WRInitHashTable(); } } einfo->info->modified = true; SetFocus( einfo->edit_dlg ); WSetStatusByID( einfo->wsb, W_STRINGCLEARMSG, -1 ); } } }
void WHandleClear( WAccelEditInfo *einfo ) { if( einfo->tbl != NULL && einfo->tbl->num != 0 ) { if( WQueryClearRes( einfo ) ) { WResetEditWindow( einfo ); SendDlgItemMessage( einfo->edit_dlg, IDM_ACCEDLIST, LB_RESETCONTENT, 0, 0 ); WFreeAccelTableEntries( einfo->tbl->first_entry ); einfo->tbl->first_entry = NULL; einfo->tbl->num = 0; einfo->current_entry = NULL; einfo->current_pos = -1; einfo->getting_key = FALSE; if( einfo->info->stand_alone ) { if( einfo->file_name != NULL ) { WRMemFree( einfo->file_name ); einfo->file_name = NULL; WSetEditTitle( einfo ); } if( einfo->info->symbol_table != NULL ) { WRFreeHashTable( einfo->info->symbol_table ); einfo->info->symbol_table = WRInitHashTable(); } } einfo->info->modified = true; SetFocus( einfo->edit_dlg ); WSetStatusByID( einfo->wsb, W_ACCELCLEARMSG, -1 ); } } }
bool WSaveObjectAs( bool get_name, WAccelEditInfo *einfo ) { char resfile[_MAX_PATH]; char *fname; WRFileType ftype; WRFileType rtype; WGetFileStruct gf; WRSaveIntoData idata; WRSaveIntoData idata2; bool got_name; bool ok; fname = NULL; got_name = FALSE; ok = (einfo != NULL); if( ok ) { memset( &idata2, 0, sizeof( idata2 ) ); if( einfo->info->symbol_file != NULL ) { idata2.next = NULL; idata2.type = WResIDFromNum( RESOURCE2INT( RT_RCDATA ) ); idata2.name = WResIDFromStr( "DLGINCLUDE" ); idata2.data = einfo->info->symbol_file; idata2.lang = einfo->info->lang; idata2.size = (uint_32)( strlen( einfo->info->symbol_file ) + 1 ); idata2.MemFlags = MEMFLAG_DISCARDABLE; } } if( ok ) { idata.next = NULL; if( einfo->info->symbol_file != NULL ) { idata.next = &idata2; } idata.type = WResIDFromNum( RESOURCE2INT( RT_ACCELERATOR ) ); ok = (idata.type != NULL); } if( ok ) { if( einfo->file_name == NULL || get_name ) { gf.file_name = NULL; gf.title = AllocRCString( W_SAVERESAS ); gf.filter = AllocRCString( W_SAVERESFILTER ); WMassageFilter( gf.filter ); fname = WGetSaveFileName( einfo->win, &gf ); if( gf.title != NULL ) { FreeRCString( gf.title ); } if( gf.filter != NULL ) { FreeRCString( gf.filter ); } if( fname != NULL ) { got_name = TRUE; } } else { fname = einfo->file_name; } ok = (fname != NULL); } if( ok ) { if( got_name ) { ftype = WSelectFileType( einfo->win, fname, einfo->info->is32bit, TRUE, WGetEditInstance(), WAccHelpRoutine ); } else { ftype = einfo->file_type; } ok = (ftype != WR_DONT_KNOW); } if( ok ) { if( ftype == WR_WIN_RC_ACCEL ) { ok = WSaveObjectToRC( einfo, fname, FALSE, FALSE ); if( ok ) { WGetInternalRESName( fname, resfile ); if( einfo->info->is32bit ) { rtype = WR_WINNTW_RES; } else { rtype = WR_WIN16W_RES; } } } else { strcpy( resfile, fname ); rtype = ftype; } } if( ok ) { idata.name = einfo->info->res_name; idata.data = einfo->info->data; idata.lang = einfo->info->lang; idata.size = (uint_32)einfo->info->data_size; idata.MemFlags = einfo->info->MemFlags; ok = WRSaveObjectAs( resfile, rtype, &idata ); } if( ok ) { if( got_name ) { if( einfo->file_name != NULL ) { WRMemFree( einfo->file_name ); } einfo->file_name = fname; einfo->file_type = ftype; WSetEditTitle( einfo ); } } else { if( fname != NULL && got_name ) { WRMemFree( fname ); } } if( idata.type != NULL ) { WRMemFree( idata.type ); } if( idata2.type != NULL ) { WRMemFree( idata2.type ); } if( idata2.name != NULL ) { WRMemFree( idata2.name ); } return( ok ); }