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 ); } } }
void WFreeAccelTable( WAccelTable *tbl ) { if( tbl != NULL ) { WFreeAccelTableEntries( tbl->first_entry ); WRMemFree( tbl ); } }
void WInitAccelTable( WAccelInfo *info, WAccelTable *tbl ) { WAccelEntry *entry; AccelTableEntry *data; AccelTableEntry32 *data32; int i; int last; entry = tbl->first_entry; if( entry == NULL ) { return; } i = 0; last = 0; if( info->is32bit ) { data32 = (AccelTableEntry32 *)info->data; for( ; entry != NULL && last == 0; entry = entry->next ) { entry->is32bit = true; entry->u.entry32 = data32[i]; entry->u.entry32.Flags &= ~ACCEL_LAST; last = (data32[i].Flags & ACCEL_LAST); i++; } } else { data = (AccelTableEntry *)info->data; for( ; entry != NULL && last == 0; entry = entry->next ) { entry->is32bit = false; entry->u.entry = data[i]; entry->u.entry.Flags &= ~ACCEL_LAST; last = (data[i].Flags & ACCEL_LAST); i++; } } if( entry != NULL ) { entry->prev->next = NULL; WFreeAccelTableEntries( entry ); } tbl->num = i; }
void WInitAccelTable( WAccelInfo *info, WAccelTable *tbl ) { WAccelEntry *entry; AccelTableEntry *data; AccelTableEntry32 *data32; int i; entry = tbl->first_entry; if( entry == NULL ) { return; } i = -1; if( info->is32bit ) { data32 = (AccelTableEntry32 *)info->data; do { i++; entry->is32bit = TRUE; entry->entry32 = data32[i]; entry->entry32.Flags &= ~ACCEL_LAST; entry = entry->next; } while( entry != NULL && !(data32[i].Flags & ACCEL_LAST) ); } else { data = (AccelTableEntry *)info->data; do { i++; entry->is32bit = FALSE; entry->entry = data[i]; entry->entry.Flags &= ~ACCEL_LAST; entry = entry->next; } while( entry != NULL && !(data[i].Flags & ACCEL_LAST) ); } if( entry != NULL ) { entry->prev->next = NULL; WFreeAccelTableEntries( entry ); } tbl->num = i + 1; }