static void BrkInit( a_window *wnd ) { gui_ord length, max; break_window *wndbreak; brkp *bp; int count; wndbreak = WndBreak( wnd ); max = 0; count = 0; for( bp = BrkList; bp != NULL; bp = bp->next ) { GetBPAddr( bp, TxtBuff ); length = WndExtentX( wnd, TxtBuff ); if( max < length ) max = length; ++count; } length = MaxGadgetLength + WndAvgCharX( wnd ); #ifdef OPENER_GADGET length += length; #endif wndbreak->addr_indent = length; length += max + 2 * WndMaxCharX( wnd ); wndbreak->source_indent = length; if( wndbreak->toggled_break ) { wndbreak->toggled_break = false; return; } WndNoSelect( wnd ); WndRepaint( wnd ); }
static void CalcIndents( a_window *wnd ) { image_entry *img; gui_ord max_image; gui_ord max_symbol; gui_ord curr; max_image = WndExtentX( wnd, LIT_DUI( Executable_File ) ); max_symbol = WndExtentX( wnd, LIT_DUI( Debug_Information ) ); for( img = DbgImageList; img != NULL; img = img->link ) { curr = WndExtentX( wnd, img->image_name ); if( curr > max_image ) max_image = curr; curr = WndExtentX( wnd, ImgSymName( img, FALSE ) ); if( curr > max_symbol ) max_symbol = curr; } Indents[PIECE_SYMBOL] = max_image + 2*WndMaxCharX( wnd ); Indents[PIECE_DIP] = Indents[PIECE_SYMBOL] + max_symbol + 4*WndMaxCharX( wnd ); }
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; }
OVL_EXTERN bool IOGetLine( a_window wnd, wnd_row row, wnd_piece piece, wnd_line_piece *line ) { io_window *io = WndIO( wnd ); // bool ret; io_location *curr; int i; mad_radix old_radix, new_radix; size_t max; if( row >= io->num_rows ) return( false ); curr = &io->list[row]; // ret = true; line->text = TxtBuff; switch( piece ) { case PIECE_READ: SetGadgetLine( wnd, line, GADGET_READ ); return( true ); case PIECE_WRITE: SetGadgetLine( wnd, line, GADGET_WRITE ); line->indent = MaxGadgetLength; return( true ); case PIECE_ADDRESS: AddrToIOString( &curr->addr, TxtBuff, TXT_LEN ); line->indent = 2 * MaxGadgetLength; return( true ); case PIECE_VALUE: new_radix = IOData.info[curr->type].piece_radix; old_radix = NewCurrRadix( new_radix ); line->indent = 2 * MaxGadgetLength + 10 * WndMaxCharX( wnd ); if( curr->value_known ) { max = TXT_LEN; MADTypeHandleToString( new_radix, IOData.info[curr->type].mth, &curr->value, TxtBuff, &max ); } else { for( i = 0; i < IOData.info[curr->type].item_width; ++i ) { TxtBuff[i] = '?'; } TxtBuff[i] = NULLCHAR; } NewCurrRadix( old_radix ); return( true ); default: return( false ); } }
STATIC bool sampleSetLine( a_window *wnd, int row, int piece, wnd_line_piece *line ) /************************************************************/ { sio_data *curr_sio; clicks_t bar_range; gui_ord catcher_extent; gui_ord slacker; int wnd_rows; if( piece >= PIECE_LAST ) { return( false ); } curr_sio = WndExtra( wnd ); wnd_rows = SampleNumRows( wnd ); if( row > wnd_rows-1 ) { Ring(); return( false ); } catcher_extent = 0; if( sampNewRow ) { catcher_extent = BAR_TAIL_POINT - (WndMaxCharX( wnd ) / 2); catcher_extent = WPPixelTruncWidth( catcher_extent ); bar_range = catcher_extent * dispCount; if( curr_sio->total_samples == 0 ) { curr_sio->total_samples = 1; } if( localTicks == 0 ) { localTicks = 1; } if( maxTime == 0 ) { maxTime = 1; } slacker = WPPixelWidth( wnd ); if( !absGraphBar ) { bar2Extent = 0; } else { if( !barMaxTime || relGraphBar ) { bar2Extent = bar_range / curr_sio->total_samples; } else { bar2Extent = bar_range / maxTime; } if( bar2Extent < slacker && bar_range != 0 ) { bar2Extent = slacker; } } if( !relGraphBar ) { barExtent = 0; } else { if( barMaxTime ) { barExtent = bar_range / maxTime; } else { barExtent = bar_range / localTicks; } if( barExtent < slacker && bar_range != 0 ) { barExtent = slacker; } } barExtent = WPPixelTruncWidth( barExtent ); bar2Extent = WPPixelTruncWidth( bar2Extent ); if( barExtent < bar2Extent ) { barExtent = bar2Extent; } } if( piece == PIECE_MOUSE_CATCHER ) { line->indent = 0; line->text = LIT( Empty_Str ); line->extent = catcher_extent - barExtent; line->tabstop = false; line->master_tabstop = true; } else if( piece == PIECE_BAR ) { line->extent = barExtent; line->indent = BAR_TAIL_POINT - barExtent; if( WPPixelTruncWidth( WndMaxCharX( wnd ) / 2 ) == 0 ) { line->indent -= WndMaxCharX( wnd ) / 2; } if( barExtent || bar2Extent ) { barData.bar_style = GUI_BAR_SHADOW; barData.bar_colour = WPA_REL_BAR; barData.bar_colour2 = WPA_ABS_BAR; barData.bar_size2 = bar2Extent; barData.bar_group = true; barData.bar_selected = false; line->draw_bar = true; line->text = (char *)&barData; } else { line->text = LIT( Empty_Str ); } line->tabstop = false; line->master_tabstop = true; } else if( piece == PIECE_SEPARATOR ) { line->indent = SEPARATOR_POINT; line->vertical_line = true; line->text = LIT( Empty_Str ); line->attr = WPA_PLAIN; line->tabstop = false; line->master_tabstop = true; } else if( piece == PIECE_DETAIL_NAME ) { line->indent = SEPARATOR_POINT + WndMaxCharX( wnd ); line->text = dispName; if( dispHighLight ) { line->attr = WPA_STANDOUT; } else { line->attr = WPA_PLAIN; } line->tabstop = true; line->master_tabstop = true; } else { return( false ); } return( true ); }
STATIC bool sampleProcOverview( a_window * wnd, int row, int piece, wnd_line_piece * line ) /******************************************************************/ { sio_data * curr_sio; clicks_t tick_count; clicks_t total_ticks; char * text; if( piece >= PIECE_LAST ) { return( false ); } curr_sio = WndExtra( wnd ); row += STATUS_ROW + 1; text = LIT( Empty_Str ); tick_count = 0; if( row <= curr_sio->level_open ) { if( row == 0 ) { text = curr_sio->samp_file_name; tick_count = curr_sio->total_samples; } else if( row == 1 ) { text = curr_sio->curr_image->name; tick_count = curr_sio->curr_image->agg_count; } else if( row == 2 ) { text = curr_sio->curr_mod->name; tick_count = curr_sio->curr_mod->agg_count; } else if( row == 3 ) { text = curr_sio->curr_file->name; tick_count = curr_sio->curr_file->agg_count; } else if( row == 4 ) { text = curr_sio->curr_rtn->name; tick_count = curr_sio->curr_rtn->tick_count; } } if( piece == PIECE_MOUSE_CATCHER ) { line->indent = 0; line->tabstop = false; line->master_tabstop = true; line->attr = WPA_PLAIN; line->text = LIT( Empty_Str ); if( row <= curr_sio->level_open ) { line->extent = BAR_TAIL_POINT; } } else if( piece == PIECE_BAR ) { line->indent = BAR_TAIL_POINT; if( curr_sio->total_samples == 0 ) { curr_sio->total_samples = 1; } total_ticks = curr_sio->total_samples; line->attr = WPA_PLAIN; line->tabstop = false; line->master_tabstop = true; if( row > curr_sio->level_open ) { line->text = LIT( Empty_Str ); } else { line->draw_bar = true; barData.bar_style = GUI_BAR_SHADOW; barData.bar_colour = WPA_ABS_BAR; barData.bar_group = false; barData.bar_selected = false; tick_count *= BAR_TAIL_POINT - (WndMaxCharX( wnd ) / 2); line->extent = tick_count / total_ticks; if( line->extent == 0 && tick_count != 0 ) { line->extent = 1; } line->indent -= line->extent; line->text = (char *)&barData; } } else if( piece == PIECE_SEPARATOR ) { indentPiece = SEPARATOR_POINT; line->indent = indentPiece; line->vertical_line = true; line->text = LIT( Empty_Str ); line->attr = WPA_PLAIN; line->tabstop = false; line->master_tabstop = true; } else if( piece == PIECE_HOOK ) { if( row > curr_sio->level_open ) { return( false ); } line->tabstop = false; line->master_tabstop = true; line->text = LIT( Empty_Str ); if( row == 0 ) { indentPiece += WndMaxCharX( wnd ); } else { indentPiece += (row*2 - 1) * WndMaxCharX( wnd ); line->indent = indentPiece; indentPiece += 2 * WndMaxCharX( wnd ); line->draw_hook = true; line->attr = WPA_PLAIN; } } else if( piece == PIECE_NAME_TITLE ) { line->indent = indentPiece; nameBuff = ProfRealloc( nameBuff, strlen( overviewHeaders[row] ) + 1 ); strcpy( nameBuff, overviewHeaders[row] ); line->text = nameBuff; line->tabstop = false; line->master_tabstop = true; if( curr_sio->level_open == row ) { line->attr = WPA_OVERVIEW_NAME; } else { line->attr = WPA_PLAIN; } indentPiece += WndExtentX( wnd, nameBuff ); } else { line->indent = indentPiece; nameBuff = ProfRealloc( nameBuff, strlen( text ) + 1 ); strcpy( nameBuff, text ); line->text = nameBuff; line->tabstop = false; line->master_tabstop = true; if( curr_sio->level_open == row ) { line->attr = WPA_OVERVIEW_NAME; } else { line->attr = WPA_PLAIN; } } return( true ); }
STATIC bool sampleProcStatus( a_window *wnd, int row, int piece, wnd_line_piece *line ) /***************************************************************/ { sio_data *curr_sio; clicks_t abs_count; clicks_t rel_count; gui_ord point_adjust; row=row; if( piece >= PIECE_HEADER_LAST ) { return( false ); } curr_sio = WndExtra( wnd ); if( piece == PIECE_MOUSE_CATCHER ) { line->indent = 0; line->tabstop = false; line->attr = WPA_PLAIN; line->text = LIT( Empty_Str ); abs_count = curr_sio->abs_count; rel_count = curr_sio->rel_count; sprintf( relData, "%ld.%ld%%", rel_count/10, rel_count-((rel_count/10)*10) ); sprintf( absData, "%ld.%ld%%", abs_count/10, abs_count-((abs_count/10)*10) ); if( WPPixelTruncWidth( WndMaxCharX( wnd ) / 2 ) == 0 ) { point_adjust = WndMaxCharX( wnd ) / 2; } else { point_adjust = 0; } absPctStatusIndent = BAR_TAIL_POINT - WndExtentX( wnd, absData ) - point_adjust; indentPiece = BAR_TAIL_POINT - WndExtentX( wnd, "199.9%" ) - (2 * WndExtentX( wnd, " " )) - point_adjust; relPctStatusIndent = indentPiece - WndExtentX( wnd, relData ); indentPiece -= WndExtentX( wnd, "199.9%" ); if( GUIIsGUI() ) { indentPiece -= WndExtentX( wnd, LIT( Rel_Header ) ) + WndExtentX( wnd, LIT( Abs_Header ) ); relPctStatusIndent -= WndExtentX( wnd, LIT( Abs_Header ) ); line->extent = indentPiece; } } else if( piece == PIECE_REL_HEADER ) { line->indent = indentPiece; if( GUIIsGUI() ) { line->text = LIT( Rel_Header ); } else { line->text = LIT( Empty_Str ); } line->tabstop = false; if( relGraphBar ) { line->attr = WPA_REL_BAR; } else { line->attr = WPA_PLAIN_INACTIVE; } } else if( piece == PIECE_REL_PERCENT ) { line->text = relData; line->indent = relPctStatusIndent; line->tabstop = false; if( curr_sio->rel_on_screen ) { line->attr = WPA_REL_BAR; } else { line->attr = WPA_PLAIN_INACTIVE; } } else if( piece == PIECE_ABS_HEADER ) { indentPiece = BAR_TAIL_POINT - WndExtentX( wnd, "199.9%" ); if( GUIIsGUI() ) { line->text = LIT( Abs_Header ); indentPiece -= WndExtentX( wnd, LIT( Abs_Header ) ); } else { line->text = LIT( Empty_Str ); } line->indent = indentPiece; line->tabstop = false; if( curr_sio->abs_on_screen ) { line->attr = WPA_ABS_BAR; } else { line->attr = WPA_PLAIN_INACTIVE; } } else if( piece == PIECE_ABS_PERCENT ) { line->text = absData; line->indent = absPctStatusIndent; line->tabstop = false; if( curr_sio->abs_on_screen ) { line->attr = WPA_ABS_BAR; } else { line->attr = WPA_PLAIN_INACTIVE; } } else if( piece == PIECE_PERCENT_SEPARATOR ) { if( !GUIIsGUI() ) { line->vertical_line = true; } line->indent = SEPARATOR_POINT; line->text = LIT( Empty_Str ); line->attr = WPA_PLAIN; line->tabstop = false; } else if( piece == PIECE_DETAIL_TITLE ) { line->indent = SEPARATOR_POINT + WndMaxCharX( wnd ); curr_sio = WndExtra( wnd ); if( curr_sio->level_open == LEVEL_ROUTINE ) { sprintf( lineData, "%s: %.5d", statusHeaders[curr_sio->level_open], curr_sio->curr_display_row+1 ); line->text = lineData; } else { line->text = statusHeaders[curr_sio->level_open]; } line->tabstop = false; line->attr = WPA_PLAIN; } return( true ); }