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 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 CalcIndent( a_window *wnd ) { gui_ord len,max; int row,rows; rows = FuncNumRows( wnd ); max = 0; for( row = 0; row < rows; ++row ) { FuncGetSourceName( wnd, row ); len = WndExtentX( wnd, TxtBuff ); if( len > max ) max = len; } WndFunc( wnd )->max_name = max; }
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 ModCalcIndent( a_window *wnd ) { gui_ord extent,max_extent; int i,size; mod_window *mod = WndMod( wnd ); size = ModListNumRows( ModList( mod ) ); max_extent = 0; for( i = 0; i < size; ++i ) { ModListName( ModList( mod ), i, TxtBuff ); extent = WndExtentX( wnd, TxtBuff ); if( extent > max_extent ) max_extent = extent; } mod->max_modlen = max_extent + WndMidCharX( wnd ); WndNoSelect( wnd ); WndRepaint( wnd ); }
STATIC bool aboutGetLine( a_window * wnd, wnd_row row, int piece, wnd_line_piece * line ) /***********************************************************/ { // gui_coord size; wnd=wnd; if( piece != 0 || !aboutOn ) return( P_FALSE ); if( row >= AboutSize ) { /* the following code fragment was ripped from the debugger */ /* Something like this can be done for the splash page?? */ // if( row > AboutSize || !GUIIsGUI() ) return( P_FALSE ); // WndSetGadgetLine( wnd, line, GADGET_SPLASH, MaxGadgetLength ); // WndGetGadgetSize( GADGET_SPLASH, &size ); // line->indent = ( WndWidth( wnd ) - size.x ) / 2; // return( P_TRUE ); return( P_FALSE ); } line->text = AboutMessage[ row ]; line->indent = ( WndWidth( wnd ) - WndExtentX( wnd, line->text ) ) / 2; return( P_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 ); }
static bool RegResize( a_window *wnd ) { reg_window *reg = WndReg( wnd ); gui_ord space; int old_up; int i,j; reg_display_piece disp; gui_ord max_extent; gui_ord max_descript; a_reg_info *info; gui_ord indent; gui_ord value,descript; char *p; unsigned len; old_up = reg->up; reg->up = 1; RegFindData( reg->kind, ®->data ); reg->count = 0; while( GetDisplayPiece( &disp, reg, DbgRegs, reg->count ) ) { reg->count++; } WndFree( reg->info ); reg->info = WndMustAlloc( reg->count * sizeof( *reg->info ) ); space = WndAvgCharX( wnd ); max_extent = 0; max_descript = 0; for( i = 0; i < reg->count; ++i ) { GetDisplayPiece( &disp, reg, DbgRegs, i ); if( disp.max_value == 0 && disp.reginfo != NULL ) { disp.max_value = GetMADMaxFormatWidth( disp.disp_type ); } info = ®->info[i]; info->max_value = disp.max_value; info->info = disp.reginfo; if( disp.max_descript > strlen( disp.descript ) ) { info->max_descript = space + disp.max_descript * WndAvgCharX( wnd ); } else { info->max_descript = space + WndExtentX( wnd, disp.descript ); } info->max_extent = space + disp.max_value * WndAvgCharX( wnd ); info->standout = false; if( max_extent < info->max_extent ) { max_extent = info->max_extent; } if( max_descript < info->max_descript ) { max_descript = info->max_descript; } } reg->up = MADRegSetDisplayGrouping( reg->data ); if( reg->up == 0 ) { reg->up = WndWidth( wnd ) / ( max_extent + max_descript ); if( reg->up < 1 ) reg->up = 1; if( reg->up > reg->count ) { reg->up = reg->count; } } reg->rows = ( reg->count + reg->up - 1 ) / reg->up; // calculate the indents WndFree( reg->indents ); reg->indents = WndMustAlloc( reg->count * sizeof( *reg->indents ) ); // For each column for( i = 0; i < reg->up; ++i ) { reg->indents[i].descript = 0; reg->indents[i].value = 0; // Calc max widths for column for( j = i; j < reg->count; j += reg->up ) { if( reg->indents[i].value < reg->info[j].max_extent ) { reg->indents[i].value = reg->info[j].max_extent; } if( reg->indents[i].descript < reg->info[j].max_descript ) { reg->indents[i].descript = reg->info[j].max_descript; } } } // Calc indents for each column indent = 0; value = 0; descript = 0; // For each column for( i = 0; i < reg->up; ++i ) { value = reg->indents[i].value; descript = reg->indents[i].descript; reg->indents[i].descript = indent; reg->indents[i].value = indent + descript; indent += value + descript; #if ( defined( __GUI__ ) && defined( __OS2__ ) ) // OS/2 PM GUI needs more space between columns indent += space; #endif } // Copy indents to all registers by column for( i = reg->up; i < reg->count; ++i ) { reg->indents[i] = reg->indents[i % reg->up]; } if( reg->up != old_up ) { WndScrollAbs( wnd, 0 ); WndNoCurrent( wnd ); } p = TxtBuff + MADCliString( MADRegSetName( reg->data ), TxtBuff, TXT_LEN ); *p++ = ' '; *p++ = '('; len = MADRegSetLevel( reg->data, p, TXT_LEN - ( p - TxtBuff ) ); if( len == 0 ) { p -= 2; } else { p += len; *p++ = ')'; } *p++ = NULLCHAR; WndSetTitle( wnd, TxtBuff ); return( true ); }