示例#1
0
static int FileScroll( a_window *wnd, int lines )
{
    int         old_top;

    old_top = WndTop( wnd );
    FilePos( wnd, old_top + lines );
    return( WndTop( wnd ) - old_top );
}
示例#2
0
extern int W5Scroll( a_window *wnd, int lines )
{
    int         old_top;
    int         new_top;

    old_top = WndTop( wnd );
    new_top = old_top + lines;
    if( new_top >= NUM_ROWS ) new_top = NUM_ROWS-1;
    if( new_top < 0 ) new_top = 0;
    WndSetTop( wnd, new_top );
    WndSetVScrollRange( wnd, WndRows( wnd ) + NUM_ROWS - 1 );
    WndSetThumbPos( wnd, new_top );
    return( new_top - old_top );
}
示例#3
0
static void GotoLine( a_window *wnd )
{
    long        line;
    mad_radix   old_radix;
    wnd_row     curr_row;
    int         curr_piece;

    old_radix = NewCurrRadix( 10 );
    WndGetCurrent( wnd, &curr_row, &curr_piece );
    if( curr_row < 0 || curr_row == WND_NO_ROW ) {
        line = WndTop( wnd );
    } else {
        line = curr_row;
    }
    ++line;
    if( DlgLongExpr( LIT_DUI( New_Line ), &line ) ) {
        --line;
        WndDirtyCurr( wnd );
        Centre( wnd, line );
        WndNewCurrent( wnd, line, PIECE_SOURCE );
    }
    NewCurrRadix( old_radix );
}
示例#4
0
static void GotoLine( a_window *wnd )
{
    long        line;
    unsigned    old;
    wnd_row     row;
    int         piece;

    old = NewCurrRadix( 10 );
    WndGetCurrent( wnd, &row, &piece );
    if( row < 0 || row == WND_NO_ROW ) {
        line = WndTop( wnd );
    } else {
        line = row;
    }
    ++line;
    if( DlgLongExpr( LIT( New_Line ), &line ) ) {
        --line;
        WndDirtyCurr( wnd );
        Centre( wnd, line );
        WndNewCurrent( wnd, line, PIECE_SOURCE );
    }
    NewCurrRadix( old );
}
示例#5
0
static void WPZoomIn( a_window *wnd, int row )
/********************************************/
{
    sio_data        *curr_sio;
    int             detail_rows;
    int             top_line;
    int             old_level;
    int             curr_line;
    bool            multi_level;

    curr_sio = WndExtra( wnd );
    if( row >= curr_sio->level_open && row < STATUS_ROW ) {
        Ring();
        return;
    }
    if( row < curr_sio->level_open ) {
        curr_sio->level_open = row;
        WndSetTop( wnd, 0 );
        gatherSort( curr_sio );
        if( curr_sio->level_open == LEVEL_ROUTINE ) {
            curr_line = srtnOpenDetail( curr_sio, false );
        } else {
            curr_line = WPGetRow( curr_sio );
        }
    } else {
        row = row - STATUS_ROW - 1;
        curr_line = row;
        detail_rows = SampleNumRows( wnd );
        if( detail_rows < row+1 ) {
            Ring();
            return;
        }
        multi_level = false;
        for( ;; ) {
            old_level = curr_sio->level_open;
            curr_line = overviewDetailRtns[curr_sio->level_open](
                                           wnd, row, multi_level );
            if( old_level == curr_sio->level_open ) break;
            detail_rows = SampleNumRows( wnd );
            if( detail_rows != 1 ) break;
            row = 0;
            multi_level = true;
        }
    }
    curr_sio->curr_proc_row = -WND_MAX_ROW;
    curr_sio->curr_display_row = -WND_MAX_ROW;
    detail_rows = SampleNumRows( wnd );
    top_line = WndTop( wnd );
    row = curr_line - top_line;
    if( row >= WndRows( wnd ) ) {
        top_line = curr_line - WndRows( wnd ) / 2;
    }
    if( row < 0 ) {
        top_line = curr_line;
    }
    if( detail_rows-top_line < WndRows( wnd ) ) {
        top_line = detail_rows - WndRows( wnd );
        if( top_line < 0 ) {
            top_line = 0;
        }
    }
    WndSetTop( wnd, top_line );
    WndNewCurrent( wnd, curr_line, PIECE_DETAIL_NAME );
    WndDirty( wnd );
    if( curr_sio->level_open < LEVEL_SOURCE
     && curr_sio->asm_file != NULL ) {
        WPAsmClose( curr_sio->asm_file );
        curr_sio->asm_file = NULL;
    }
    if( curr_sio->level_open < LEVEL_ROUTINE
     && curr_sio->src_file != NULL ) {
        WPSourceClose( curr_sio->src_file );
        curr_sio->src_file = NULL;
    }
}
示例#6
0
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) );
    }
}
示例#7
0
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;
}
示例#8
0
static void Centre( a_window *wnd, unsigned line )
{
    WndZapped( wnd );
    WndScroll( wnd, line - ( WndRows( wnd ) / 2 ) - WndTop( wnd ) );
}