STATIC bool sampleEventProc( a_window *wnd, gui_event gui_ev, void *parm ) /************************************************************************/ { sio_data *curr_sio; parm=parm; switch( gui_ev ) { case GUI_INIT_WINDOW: return( true ); case GUI_FONT_CHANGED: WPSetRowHeight( wnd ); return( true ); case GUI_RESIZE: WPAdjustRowHeight( wnd, false ); return( true ); case GUI_NOW_ACTIVE: curr_sio = WndExtra( wnd ); curr_sio->curr_proc_row = -WND_MAX_ROW; curr_sio->curr_display_row = -WND_MAX_ROW; WPDipSetProc( curr_sio->dip_process ); SetCurrentMAD( curr_sio->config.mad ); CurrSIOData = curr_sio; return( true ); case WND_CURRENT_CHANGED: sampFixDirtyCurr( wnd ); return( true ); case GUI_DESTROY: curr_sio = WndExtra( wnd ); if( curr_sio != NULL ) { ClearSample( curr_sio ); } return( false ); } return( false ); }
STATIC bool simageGetLine( a_window * wnd, int row ) /**************************************************/ { sio_data * curr_sio; image_info * image; curr_sio = WndExtra( wnd ); sampNewRow = row != curr_sio->curr_proc_row; if( sampNewRow ) { curr_sio->curr_proc_row = row; image = SImageGetImage( wnd, row ); if( image == NULL ) { return( false ); } curr_sio->curr_image = image; dispHighLight = image->main_load; dispName = image->name; dispCount = image->agg_count; localTicks = curr_sio->total_samples; maxTime = curr_sio->max_time; barMaxTime = curr_sio->bar_max; absGraphBar = curr_sio->abs_bar; relGraphBar = curr_sio->rel_bar; } return( true ); }
STATIC bint sfileGetLine( a_window *wnd, int row ) /************************************************/ { sio_data *curr_sio; file_info *curr_file; curr_sio = WndExtra( wnd ); sampNewRow = row != curr_sio->curr_proc_row; if( sampNewRow ) { curr_sio->curr_proc_row = row; curr_file = SFileGetFile( wnd, row ); if( curr_file == NULL ) { return( P_FALSE ); } dispHighLight = P_FALSE; dispName = curr_file->name; dispCount = curr_file->agg_count; localTicks = curr_sio->curr_mod->agg_count; maxTime = curr_sio->curr_mod->max_time; barMaxTime = curr_sio->curr_mod->bar_max; absGraphBar = curr_sio->curr_mod->abs_bar; relGraphBar = curr_sio->curr_mod->rel_bar; } return( P_TRUE ); }
STATIC bool smodGetLine( a_window *wnd, int row ) /***********************************************/ { sio_data *curr_sio; mod_info *mod; curr_sio = WndExtra( wnd ); sampNewRow = row != curr_sio->curr_proc_row; if( sampNewRow ) { curr_sio->curr_proc_row = row; mod = SModGetModule( wnd, row ); if( mod == NULL ) { return( false ); } curr_sio->curr_mod = mod; dispHighLight = false; dispName = mod->name; dispCount = mod->agg_count; localTicks = curr_sio->curr_image->agg_count; maxTime = curr_sio->curr_image->max_time; barMaxTime = curr_sio->curr_image->bar_max; absGraphBar = curr_sio->curr_image->abs_bar; relGraphBar = curr_sio->curr_image->rel_bar; } return( true ); }
STATIC bool srtnGetLine( a_window *wnd, int row ) /***********************************************/ { sio_data *curr_sio; rtn_info *curr_rtn; curr_sio = WndExtra( wnd ); sampNewRow = row != curr_sio->curr_proc_row; if( sampNewRow ) { curr_sio->curr_proc_row = row; curr_rtn = SRtnGetRoutine( wnd, row ); if( curr_rtn == NULL ) { return( false ); } dispHighLight = false; dispName = curr_rtn->name; dispCount = curr_rtn->tick_count; localTicks = curr_sio->curr_file->agg_count; maxTime = curr_sio->curr_file->max_time; barMaxTime = curr_sio->curr_file->bar_max; absGraphBar = curr_sio->curr_file->abs_bar; relGraphBar = curr_sio->curr_file->rel_bar; } return( true ); }
extern char * WPSourceGetLine( a_window * wnd, int line ) /*******************************************************/ { sio_data * curr_sio; wp_srcfile * wp_src; int buff_len; curr_sio = WndExtra( wnd ); wp_src = curr_sio->src_file; if( wp_src->src_buff_len == 0 ) { wp_src->src_buff = ProfAlloc( 100 ); wp_src->src_buff_len = 100; } for( ;; ) { buff_len = FReadLine( wp_src->src_file, line, 0, wp_src->src_buff, wp_src->src_buff_len ); if( buff_len != wp_src->src_buff_len ) break; wp_src->src_buff_len += 120; wp_src->src_buff = ProfRealloc( wp_src->src_buff, wp_src->src_buff_len ); } if( buff_len < 0 ) { wp_src->src_eof = P_TRUE; return( NULL ); } wp_src->src_eof = P_FALSE; wp_src->src_buff[buff_len] = NULLCHAR; return( wp_src->src_buff ); }
extern int W2Scroll( a_window *wnd, int lines ) { w2_struct *w2 = WndExtra( wnd ); int old_top; old_top = w2->top; Pos( wnd, old_top + lines ); WndRepaint( wnd ); return( w2->top - old_top ); }
extern void Pos( a_window *wnd, int pos ) { w2_struct *w2 = WndExtra( wnd ); int last; last = WORD_SIZE - WndRows( wnd ) + TITLE_SIZE; if( pos < 0 ) pos = 0; if( pos > last ) pos = last; w2->top = pos; WndSetThumbPercent( w2->wnd, pos * 100L / last ); }
void WPDoPopUp( a_window * wnd, gui_menu_struct * gui_menu ) /**********************************************************/ { sio_data * curr_sio; WndPopUp( wnd, gui_menu ); WndNoSelect( wnd ); curr_sio = WndExtra( wnd ); curr_sio->curr_proc_row = -WND_MAX_ROW; curr_sio->curr_display_row = -WND_MAX_ROW; }
static void WPBackOut( a_window * wnd ) /*************************************/ { sio_data * curr_sio; curr_sio = WndExtra( wnd ); if( curr_sio->level_open == 0 ) { Ring(); return; } WPZoomIn( wnd, curr_sio->level_open-1 ); }
extern void DlgGetConvert( a_window * wnd ) /*****************************************/ { ConvertFile = NULL; CurrSIOData = WndExtra( wnd ); if( CurrSIOData == NULL ) return; strcpy( convertPath, CurrSIOData->samp_file_name ); DlgOpen( LIT( Convert_Data ), DLG_CNVT_ROWS, DLG_CNVT_COLS, &convertControls[0], ArraySize( convertControls ), &progEvent, NULL ); if( CurrSIOData != NULL ) { WndDirty( CurrSIOData->sample_window ); } }
extern void W2Modify( a_window *wnd, int row, int piece ) { w2_struct *w2 = WndExtra( wnd ); piece=piece; if( row == 0 ) { Say( "Modify title" ); } else if( row == 1 ) { Say( "Shouldn't get this event" ); } else { row += w2->top - TITLE_SIZE; Say2( "Modify", w2->words[row] ); } }
STATIC int srtnDetailLine( a_window *wnd, int row, bool multi_level ) /*******************************************************************/ { sio_data *curr_sio; rtn_info *curr_rtn; int line; multi_level = multi_level; curr_sio = WndExtra( wnd ); curr_rtn = SRtnGetRoutine( wnd, row ); curr_sio->curr_rtn = curr_rtn; line = srtnOpenDetail( curr_sio, true ); return( line ); }
char * WPAsmGetLine( a_window * wnd, int line ) /*********************************************/ { sio_data * curr_sio; wp_asmfile * wpasm_file; src_info * src; wp_asmline * asm_line; int asm_group; int asm_row; int buff_len; curr_sio = WndExtra( wnd ); wpasm_file = curr_sio->asm_file; if( line >= wpasm_file->asm_rows ) { return( NULL ); } asm_line = WPGetAsmLoc( wpasm_file, line, &asm_group, &asm_row ); if( asm_line->source_line ) { src = &asm_line->u.src; if( src->src_file == NULL ) { strcpy( wpasm_file->asm_buff, LIT( Unable_To_Open_Src ) ); } else { for( ;; ) { buff_len = FReadLine( src->src_file, src->line, 0, wpasm_file->asm_buff, wpasm_file->asm_buff_len ); if( buff_len != wpasm_file->asm_buff_len ) break; wpasm_file->asm_buff_len += 120; wpasm_file->asm_buff = ProfRealloc( wpasm_file->asm_buff, wpasm_file->asm_buff_len ); } if( buff_len < 0 ) { buff_len = 0; } wpasm_file->asm_buff[buff_len] = NULLCHAR; } } else { SetNumBytes( 0 ); SetExeFile( wpasm_file->fh, false ); SetExeImage( curr_sio->curr_image ); GetFullInstruct( asm_line->u.asm_line.addr, wpasm_file->asm_buff, wpasm_file->asm_buff_len-1 ); } return( wpasm_file->asm_buff ); }
STATIC int smodDetailLine( a_window *wnd, int row, bool multi_level ) /*******************************************************************/ { sio_data *curr_sio; mod_info *mod; curr_sio = WndExtra( wnd ); mod = SModGetModule( wnd, row ); if( mod->agg_count == 0 && mod->file_count == 2 ) { if( !multi_level ) { ErrorMsg( LIT( No_Symbol_Info ), mod->name ); } return( row ); } curr_sio->level_open++; curr_sio->curr_mod = mod; gatherSort( curr_sio ); return( 0 ); }
STATIC int sfileDetailLine( a_window *wnd, int row, bool multi_level ) /********************************************************************/ { sio_data *curr_sio; file_info *curr_file; curr_sio = WndExtra( wnd ); curr_file = SFileGetFile( wnd, row ); if( curr_file->rtn_count == 0 ) { if( !multi_level ) { ErrorMsg( LIT( No_Routine_Names ), curr_file->name ); } return( row ); } curr_sio->level_open++; curr_sio->curr_file = curr_file; gatherSort( curr_sio ); return( 0 ); }
STATIC int ssrcDetailLine( a_window *wnd, int row, bool multi_level ) /*******************************************************************/ { sio_data *curr_sio; wp_asmfile *asm_file; int top_line; curr_sio = WndExtra( wnd ); asm_file = WPAsmOpen( curr_sio, row+1, multi_level ); if( asm_file == NULL ) { return( row ); } curr_sio->level_open++; curr_sio->asm_file = asm_file; top_line = asm_file->entry_line - WndRows( wnd ) / 2; if( top_line >= 0 ) { WndSetTop( wnd, top_line ); } return( asm_file->entry_line ); }
STATIC bool ssrcGetLine( a_window *wnd, int row ) /***********************************************/ { sio_data *curr_sio; wp_srcfile *wp_src; wp_srcline *lines; int index; int adjusted_row; curr_sio = WndExtra( wnd ); if( curr_sio->src_file == NULL ) { return( false ); } adjusted_row = row + 1; sampNewRow = row != curr_sio->curr_proc_row; if( sampNewRow ) { curr_sio->curr_proc_row = row; dispName = WPSourceGetLine( wnd, adjusted_row ); if( dispName == NULL ) { return( false ); } dispHighLight = false; wp_src = curr_sio->src_file; lines = wp_src->src_lines; dispCount = 0; index = 0; while( index < wp_src->wp_line_count ) { if( adjusted_row == lines[index].line ) { dispCount = lines[index].tick_count; break; } index++; } localTicks = curr_sio->curr_file->agg_count; maxTime = wp_src->max_time; barMaxTime = curr_sio->asm_src_info.bar_max; absGraphBar = curr_sio->asm_src_info.abs_bar; relGraphBar = curr_sio->asm_src_info.rel_bar; } return( true ); }
STATIC bool sampleGetLine( a_window *wnd, wnd_row row, int piece, wnd_line_piece *line ) /*************************************************************/ { sio_data *curr_sio; if( row <= -4 ) { return( sampleProcOverview( wnd, row, piece, line ) ); } if( row == -3 ) { return( sampleProcTopStatus( wnd, row, piece, line ) ); } if( row == -2 ) { return( sampleProcStatus( wnd, row, piece, line ) ); } if( row == -1 ) { return( sampleProcBotStatus( wnd, row, piece, line ) ); } curr_sio = WndExtra( wnd ); if( !sampleGetRtns[curr_sio->level_open]( wnd, row ) ) return( P_FALSE ); return( sampleSetLine( wnd, row, piece, line ) ); }
image_info * SImageGetImage( a_window wnd, int row ) /**************************************************/ { sio_data * curr_sio; image_info * image; int count; int count2; int image_count; curr_sio = WndExtra( wnd ); image_count = 0; count = 0; for( count2 = curr_sio->image_count; count2 > 0; --count2 ) { image = curr_sio->images[image_count++]; if( !image->ignore_unknown_image && !image->ignore_gather ) { if( count++ == row ) { return( image ); } } } return( NULL ); }
STATIC bool sasmGetLine( a_window *wnd, int row ) /***********************************************/ { sio_data *curr_sio; wp_asmfile *wpasm_file; wp_asmline *asm_line; int asm_group; int asm_row; curr_sio = WndExtra( wnd ); if( curr_sio->asm_file == NULL ) { return( false ); } sampNewRow = row != curr_sio->curr_proc_row; if( sampNewRow ) { curr_sio->curr_proc_row = row; dispName = WPAsmGetLine( wnd, row ); if( dispName == NULL ) { return( false ); } wpasm_file = curr_sio->asm_file; asm_line = WPGetAsmLoc( wpasm_file, row, &asm_group, &asm_row ); dispHighLight = asm_line->source_line; if( dispHighLight ) { dispCount = 0; } else { dispCount = asm_line->u.asm_line.tick_count; } localTicks = curr_sio->curr_mod->agg_count; maxTime = wpasm_file->max_time; barMaxTime = curr_sio->asm_src_info.bar_max; absGraphBar = curr_sio->asm_src_info.abs_bar; relGraphBar = curr_sio->asm_src_info.rel_bar; } else if( dispName == NULL ) { return( false ); } return( true ); }
STATIC int simageDetailLine( a_window *wnd, int row, bool multi_level ) /*********************************************************************/ { sio_data *curr_sio; image_info *image; curr_sio = WndExtra( wnd ); image = SImageGetImage( wnd, row ); if( image == NULL ) { if( !multi_level ) { Ring(); } return( row ); } if( image->exe_not_found ) { if( !multi_level ) { ErrorMsg( LIT( Exe_Not_Found ), image->name ); } return( row ); } if( image->dip_handle == NO_MOD ) { if( !multi_level ) { ErrorMsg( LIT( No_Symbol_Info ), image->name ); } return( row ); } if( image->exe_changed ) { if( !multi_level ) { ErrorMsg( LIT( Exe_Has_Changed ), image->name ); image->exe_changed = false; } } curr_sio->level_open++; curr_sio->curr_image = image; gatherSort( curr_sio ); return( 0 ); }
mod_info * SModGetModule( a_window wnd, int row ) /***********************************************/ { sio_data * curr_sio; image_info * curr_image; mod_info * mod; int count; int count2; int mod_count; curr_sio = WndExtra( wnd ); curr_image = curr_sio->curr_image; count = 0; mod_count = 0; for( count2 = curr_image->mod_count; count2 > 0; --count2 ) { mod = curr_image->module[mod_count++]; if( !mod->ignore_unknown_mod && !mod->ignore_gather ) { if( count++ == row ) { return( mod ); } } } return( NULL ); }
rtn_info * SRtnGetRoutine( a_window wnd, int row ) /************************************************/ { sio_data * curr_sio; file_info * curr_file; rtn_info * rtn; int count; int count2; int rtn_count; curr_sio = WndExtra( wnd ); curr_file = curr_sio->curr_file; count = 0; rtn_count = 0; for( count2 = curr_file->rtn_count; count2 > 0; --count2 ) { rtn = curr_file->routine[rtn_count++]; if( !rtn->ignore_unknown_rtn && !rtn->ignore_gather ) { if( count++ == row ) { return( rtn ); } } } return( NULL ); }
file_info * SFileGetFile( a_window wnd, int row ) /***********************************************/ { sio_data * curr_sio; mod_info * curr_mod; file_info * curr_file; int count; int count2; int file_count; curr_sio = WndExtra( wnd ); curr_mod = curr_sio->curr_mod; count = 0; file_count = 0; for( count2 = curr_mod->file_count; count2 > 0; --count2 ) { curr_file = curr_mod->mod_file[file_count++]; if( !curr_file->ignore_unknown_file && !curr_file->ignore_gather ) { if( count++ == row ) { return( curr_file ); } } } return( NULL ); }
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 void sampleMenuItem( a_window * wnd, gui_ctl_id id, int row, int piece ) /*****************************************************************************/ { sio_data * curr_sio; int sort_type; piece=piece; curr_sio = WndExtra( wnd ); row += STATUS_ROW + 1; switch( id ) { case MENU_INITIALIZE: if( row <= STATUS_ROW ) { WndMenuGrayAll( wnd ); if( row < 0 || row-1 >= curr_sio->level_open ) break; WndMenuEnable( wnd, MENU_SAMP_ZOOM_IN, true ); break; } WndMenuEnableAll( wnd ); WndMenuCheck( wnd, MENU_SAMP_GATHER, GetCurrentGather( curr_sio ) ); WndMenuCheck( wnd, MENU_SAMP_BAR_MAX_TIME, GetCurrentMaxBar( curr_sio ) ); WndMenuCheck( wnd, MENU_SAMP_ABS, GetCurrentAbsBar( curr_sio ) ); WndMenuCheck( wnd, MENU_SAMP_REL, GetCurrentRelBar( curr_sio ) ); sort_type = GetCurrentSort( curr_sio ); WndMenuCheck( wnd, MENU_SORT_COUNT, sort_type==SORT_COUNT ); WndMenuCheck( wnd, MENU_SORT_NAME, sort_type==SORT_NAME ); if( row <= STATUS_ROW || curr_sio->level_open >= LEVEL_ROUTINE ) { WndMenuEnable( wnd, MENU_SAMP_GATHER, false ); WndMenuEnable( wnd, MENU_SAMP_SORT, false ); WndMenuEnable( wnd, MENU_SORT_COUNT, false ); WndMenuEnable( wnd, MENU_SORT_NAME, false ); if( row <= STATUS_ROW ) { WndMenuEnable( wnd, MENU_SAMP_BAR_MAX_TIME, false ); WndMenuEnable( wnd, MENU_SAMP_ABS, false ); WndMenuEnable( wnd, MENU_SAMP_REL, false ); } } break; case MENU_SAMP_ZOOM_IN: WPZoomIn( wnd, row ); break; case MENU_SAMP_BACK_OUT: WPBackOut( wnd ); break; // case MENU_SAMP_DATA: // WPSImageOpen( curr_sio ); // break; case MENU_SAMP_GATHER: FlipCurrentGather( curr_sio ); WndMenuCheck( wnd, MENU_SAMP_GATHER, GetCurrentGather( curr_sio ) ); gatherSort( curr_sio ); setDisplay( wnd, curr_sio, true ); break; case MENU_SAMP_BAR_MAX_TIME: FlipCurrentMaxBar( curr_sio ); WndMenuCheck( wnd, MENU_SAMP_BAR_MAX_TIME, GetCurrentMaxBar( curr_sio ) ); setDisplay( wnd, curr_sio, false ); break; case MENU_SAMP_ABS: FlipCurrentAbsBar( curr_sio ); WndMenuCheck( wnd, MENU_SAMP_ABS, GetCurrentAbsBar( curr_sio ) ); setDisplay( wnd, curr_sio, false ); break; case MENU_SAMP_REL: FlipCurrentRelBar( curr_sio ); WndMenuCheck( wnd, MENU_SAMP_ABS, GetCurrentRelBar( curr_sio ) ); setDisplay( wnd, curr_sio, false ); break; case MENU_SORT_COUNT: case MENU_SORT_NAME: WndMenuCheck( wnd, MENU_SORT_COUNT, ( id == MENU_SORT_COUNT ) ); WndMenuCheck( wnd, MENU_SORT_NAME, ( id == MENU_SORT_COUNT ) ); if( id == MENU_SORT_COUNT ) { SetCurrentSort( curr_sio, SORT_COUNT ); } else { SetCurrentSort( curr_sio, SORT_NAME ); } SortCurrent( curr_sio ); setDisplay( wnd, curr_sio, true ); break; } }
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 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 ); }
if( row == 0 ) { Say( "Modify title" ); } else if( row == 1 ) { Say( "Shouldn't get this event" ); } else { row += w2->top - TITLE_SIZE; Say2( "Modify", w2->words[row] ); } } extern WNDNEXTROW W2NextRow; extern int W2NextRow( a_window *wnd, int row, int inc ) { int new; w2_struct *w2 = WndExtra( wnd ); if( row == WND_NO_ROW ) { if( inc == WND_SAVE_ROW ) { w2->saved_top = w2->top; } else if( inc == WND_RESTORE_ROW ) { Pos( wnd, w2->saved_top ); } return( 0 ); } new = row + inc; if( row >= TITLE_SIZE && new < TITLE_SIZE ) { // backing over title if( w2->top >= -inc ) { new = row; W2Scroll( wnd, inc ); } else {