static void CallInit( a_window *wnd ) { int row; call_window *call = WndCall( wnd ); traceback *curr,*prev; call_chain *chain; int i; UpdateTraceBack( &call->tb ); curr = call->tb.curr; prev = call->tb.prev; WndNoSelect( wnd ); if( curr->clean_size == 0 || curr->total_depth < prev->total_depth ) { WndRepaint( wnd ); } else { row = curr->total_depth; if( prev->total_depth > row ) { row = prev->total_depth; } while( --row >= curr->clean_size ) { WndRowDirty( wnd, row ); } } call->max_sym_len = 0; chain = curr->chain; for( i = 0; i < curr->current_depth; ++i ) { if( chain[ i ].sym_len == 0 ) { chain[ i ].sym_len = WndExtentX( wnd, chain[ i ].symbol ); } if( chain[ i ].sym_len > call->max_sym_len ) { call->max_sym_len = chain[ i ].sym_len; } } }
static void BrkModify( a_window *wnd, int row, int piece ) { brkp *bp; if( row < 0 ) { BrkMenuItem( wnd, MENU_BREAK_CREATE_NEW, row, piece ); return; } bp = BrkGetBP( row ); if( bp == NULL ) return; if( piece == PIECE_ACTIVE ) { WndRowDirty( wnd, row ); WndBreak( wnd )->toggled_break = true; ActPoint( bp, !bp->status.b.active ); #ifdef OPENER_GADGET } else if( piece == PIECE_OPENER ) { if( bp->size == 0 ) { if( bp->source_line != NULL ) { WndSrcInspect( bp->loc.addr ); } else { WndAsmInspect( bp->loc.addr ); } } #endif } else { WndFirstMenuItem( wnd, row, piece ); } }
static void FileModify( a_window *wnd, int row, int piece ) { file_window *file = WndFile( wnd ); address addr; if( piece == PIECE_BREAK ) { addr = GetRowAddr( file, row, TRUE ); if( IS_NIL_ADDR( addr ) ) return; file->toggled_break = ( ( WndFlags & UP_BREAK_CHANGE ) == 0 ); ToggleBreak( addr ); WndRowDirty( wnd, row ); } else { WndFirstMenuItem( wnd, row, piece ); } }
static void FuncModify( a_window *wnd, int row, int piece ) { address addr; func_window *func = WndFunc( wnd ); if( piece == PIECE_BREAK ) { if( row < 0 ) return; if( row >= NameListNumRows( NameList( func ) ) ) return; addr = NameListAddr( NameList( func ), row ); func->toggled_break = ( ( UpdateFlags & UP_BREAK_CHANGE ) == 0 ); ToggleBreak( addr ); WndRowDirty( wnd, row ); } else { WndFirstMenuItem( wnd, row, piece ); } }
static void AsmSetDotAddr( a_window *wnd, address addr ) { mod_handle mod; asm_window *asw = WndAsm( wnd ); if( AddrComp( asw->dotaddr, addr ) != 0 ) { WndRowDirty( wnd, -TITLE_SIZE ); asw->dotaddr = addr; DeAliasAddrMod( addr, &mod ); if( mod != asw->mod ) { DbgUpdate( UP_OPEN_CHANGE ); asw->mod = mod; AsmSetTitle( wnd ); } if( IS_NIL_ADDR( addr ) ) return; if( wnd == WndFindActive() ) { SrcMoveDot( asw->src, addr ); SetCodeDot( addr ); } } }
static void RepRefresh( a_window *wnd ) { event_record *ev; gui_ord extent, max_addr, max_cue; int count, row; if( EventList != NULL ) WndMoveCurrent( wnd, RepNumRows( wnd ) - 1, 0 ); max_addr = 0; max_cue = 0; count = 0; for( ev = EventList; ev != NULL; ev = ev->next ) { RepInitEv( ev ); extent = WndExtentX( wnd, ev->addr_string ); if( max_addr < extent ) max_addr = extent; extent = WndExtentX( wnd, ev->cue ); if( max_cue < extent ) max_cue = extent; ++count; } max_addr += WndMaxCharX( wnd ); max_cue += WndMaxCharX( wnd ); if( Indents[PIECE_SOURCE] != max_addr || Indents[PIECE_COMMAND] != max_addr + max_cue ) { WndRepaint( wnd ); } else { row = count; while( --row >= LastEventCount ) { WndRowDirty( wnd, row ); } } LastEventCount = count; Indents[PIECE_ADDRESS] = 0; Indents[PIECE_SOURCE] = max_addr; Indents[PIECE_COMMAND] = max_addr + max_cue; }
static void VarModify( a_window *wnd, int row, int piece ) { var_node *v; type_kind class; var_window *var = WndVar( wnd ); bool ok; bool followable; unsigned old; if( row < 0 ) { if( var->vtype == VAR_WATCH || var->vtype == VAR_VARIABLE ) { VarMenuItem( wnd, MENU_VAR_NEW_EXPRESSION, row, piece ); } return; } VarErrState(); VarKillExprSPCache( &var->i ); v = VarFindRow( &var->i, row ); if( v == NULL ) { v = VarFindRowNode( &var->i, row ); if( v == NULL ) return; if( piece != VAR_PIECE_GADGET && piece != VAR_PIECE_NAME ) return; if( v->expand != NULL || v->node_type == NODE_INHERIT ) { VarExpandRow( &var->i, v, row ); WndNewCurrent( wnd, row, VAR_PIECE_NAME ); VarRepaint( wnd ); } return; } followable = VarGetStackClass( &class ); switch( piece ) { case VAR_PIECE_GADGET: case VAR_PIECE_NAME: if( VarExpandable( class ) || followable || v->expand != NULL ) { VarExpandRow( &var->i, v, row ); WndNewCurrent( wnd, row, VAR_PIECE_NAME ); VarRepaint( wnd ); } break; case VAR_PIECE_VALUE: if( !VarExpandable( class ) ) { char *value = DbgAlloc( TXT_LEN ); char *name = DbgAlloc( TXT_LEN ); old = VarNewCurrRadix( v ); ExprValue( ExprSP ); VarBuildName( &var->i, v, FALSE ); StrCopy( TxtBuff, name ); VarPrintText( &var->i, value, PrintValue, TXT_LEN ); VarKillExprSPCache( &var->i ); v = VarFindRow( &var->i, row ); FreezeStack(); ok = DlgAnyExpr( name, value, TXT_LEN ); UnFreezeStack( FALSE ); if( ok ) VarDoAssign( &var->i, v, value ); NewCurrRadix( old ); WndRowDirty( wnd, row ); DbgFree( value ); DbgFree( name ); } break; } VarDoneRow( &var->i ); VarOldErrState(); }
STATIC void sampFixDirtyCurr( a_window *wnd ) /*******************************************/ { sio_data *curr_sio; wp_srcfile *src_file; rtn_info *curr_rtn; int src_line; int row; int piece; curr_sio = WndExtra( wnd ); WndGetCurrent( wnd, &row, &piece ); if( row == WND_NO_ROW ) return; if( curr_sio->level_open == LEVEL_SAMPLE ) { if( !simageGetLine( wnd, row ) ) return; } else if( curr_sio->level_open == LEVEL_IMAGE ) { if( !smodGetLine( wnd, row ) ) return; } else if( curr_sio->level_open == LEVEL_MODULE ) { if( !sfileGetLine( wnd, row ) ) return; } else if( curr_sio->level_open == LEVEL_FILE ) { if( !srtnGetLine( wnd, row ) ) return; } else { if( curr_sio->level_open == LEVEL_ROUTINE ) { if( !ssrcGetLine( wnd, row ) ) return; } else { if( !sasmGetLine( wnd, row ) ) return; } src_line = row + 1; if( curr_sio->level_open == LEVEL_SOURCE ) { src_line = WPAsmFindSrcLine( curr_sio, src_line ); } curr_rtn = curr_sio->curr_rtn; findRtnFromRow( curr_sio, src_line ); if( curr_rtn != curr_sio->curr_rtn ) { WndRowDirty( wnd, LEVEL_ROUTINE-STATUS_ROW-1+WndTop(wnd) ); } src_file = curr_sio->src_file; if( src_file != NULL ) { src_file->samp_line = src_line; } } curr_sio->curr_proc_row = -WND_MAX_ROW; if( row != curr_sio->curr_display_row ) { curr_sio->curr_display_row = row; if( curr_sio->total_samples == 0 || localTicks == 0 ) { curr_sio->abs_count = 0; curr_sio->rel_count = 0; } else { curr_sio->abs_count = (dispCount*1000) / curr_sio->total_samples; curr_sio->rel_count = (dispCount*1000) / localTicks; } curr_sio->abs_on_screen = absGraphBar; curr_sio->rel_on_screen = relGraphBar; if( dispCount > 0 ) { if( curr_sio->rel_count == 0 ) { curr_sio->rel_count = 1; } if( curr_sio->abs_count == 0 ) { curr_sio->abs_count = 1; } } WndRowDirty( wnd, -2+WndTop(wnd) ); } }
OVL_EXTERN void IOMenuItem( a_window wnd, gui_ctl_id id, wnd_row row, wnd_piece piece ) { io_window *io = WndIO( wnd ); address addr; bool ok; item_mach item; io_location *curr; mad_radix old_radix; /* unused parameters */ (void)piece; if( row < io->num_rows && row >= 0 ) { curr = &io->list[row]; } else { curr = NULL; } switch( id ) { case MENU_INITIALIZE: if( curr == NULL ) { WndMenuGrayAll( wnd ); } else { WndMenuEnableAll( wnd ); } WndMenuEnable( wnd, MENU_IO_NEW_ADDRESS, true ); break; case MENU_IO_DELETE: io->num_rows--; memcpy( &io->list[row], &io->list[row + 1], ( io->num_rows - row ) * sizeof( io_location ) ); WndNoSelect( wnd ); WndSetRepaint( wnd ); break; case MENU_IO_NEW_ADDRESS: addr = NilAddr; if( !DlgGivenAddr( LIT_DUI( New_Port_Addr ), &addr ) ) return; WndRowDirty( wnd, io->num_rows ); IOAddNewAddr( wnd, &addr, MENU_IO_FIRST_TYPE ); WndScrollBottom( wnd ); break; case MENU_IO_MODIFY: if( row >= io->num_rows || row < 0 ) break; if( piece == PIECE_VALUE ) { old_radix = NewCurrRadix( IOData.info[curr->type].piece_radix ); item.ud = curr->value_known ? curr->value.ud : 0; ok = DlgMadTypeExpr( TxtBuff, &item, IOData.info[curr->type].mth ); if( ok ) { curr->value = item; curr->value_known = true; } NewCurrRadix( old_radix ); } else { addr = curr->addr; if( !DlgGivenAddr( LIT_DUI( New_Port_Addr ), &addr ) ) return; curr->addr = addr; curr->value_known = false; } WndRowDirty( wnd, row ); break; case MENU_IO_READ: curr->value_known = true; if( ItemGetMAD( &curr->addr, &curr->value, IT_IO, IOData.info[curr->type].mth ) == IT_NIL ) { curr->value_known = false; } WndPieceDirty( wnd, row, PIECE_VALUE ); break; case MENU_IO_WRITE: if( curr->value_known ) { ItemPutMAD( &curr->addr, &curr->value, IT_IO, IOData.info[curr->type].mth ); } break; default: curr->type = PIECE_TYPE( id ); WndZapped( wnd ); break; } }
static void FileTrack( a_window *wnd, cue_handle *ch ) { unsigned active, old_active; unsigned end_line; int slack; file_window *file = WndFile( wnd ); mod_handle mod; cue_fileid id; wnd_row curr_row; int curr_piece; if( ch == NULL ) { mod = NO_MOD; id = 0; } else { mod = CueMod( ch ); id = CueFileId( ch ); } if( file->viewhndl == NULL || file->mod != mod || file->file_id != id ) { if( file->viewhndl != NULL ) { FDoneSource( file->viewhndl ); } file->mod = mod; file->file_id = id; FileSetDotAddr( wnd, GetCodeDot() ); if( file->mod == NO_MOD ) { file->viewhndl = NULL; } else { file->viewhndl = OpenSrcFile( ch ); } FileSetTitle( wnd, mod ); SeekToTheEnd( file ); file->eof = UINT_MAX; WndZapped( wnd ); FilePosInit( wnd ); file->active = NOT_ACTIVE; FilePos( wnd, 0 ); DbgUpdate( UP_OPEN_CHANGE ); } active = ActiveLine(); if( active != file->active ) { FileSetDotAddr( wnd, GetCodeDot() ); WndGetCurrent( wnd, &curr_row, &curr_piece ); WndNoCurrent( wnd ); if( curr_row != WND_NO_ROW ) { WndRowDirty( wnd, curr_row ); } } old_active = file->active; file->active = NOT_ACTIVE; slack = WndRows( wnd ) / 4; if( slack > 2 ) slack = 2; end_line = WndTop( wnd ) + WndRows( wnd ) - 1; if( old_active == NOT_ACTIVE || active > end_line ) { WndZapped( wnd ); WndScroll( wnd, active - slack - WndTop( wnd ) ); } else if( active > end_line - slack ) { WndRowDirtyImmed( wnd, old_active ); WndScroll( wnd, WndRows( wnd ) - 2 * slack ); } else if( active < WndTop( wnd ) ) { WndRowDirtyImmed( wnd, old_active ); WndScroll( wnd, active - WndTop( wnd ) - slack ); } else { WndRowDirty( wnd, old_active ); } WndNewCurrent( wnd, active, PIECE_SOURCE ); WndRowDirty( wnd, active ); file->active = active; }