static  bool    FuncGetLine( a_window *wnd, int row, int piece,
                             wnd_line_piece *line )
{
    address     addr;
    func_window *func = WndFunc( wnd );

    if( row >= NameListNumRows( NameList( func ) ) ) return( FALSE );
    addr = NameListAddr( NameList( func ), row );
    switch( piece ) {
    case PIECE_BREAK:
        FileBreakGadget( wnd, line, FALSE, FindBreak( addr ) );
        return( TRUE );
    case PIECE_NAME:
        line->indent = MaxGadgetLength;
        line->text = TxtBuff;
        line->extent = WND_MAX_EXTEND;
        FuncGetSourceName( wnd, row );
        return( TRUE );
    case PIECE_DEMANGLED:
        if( NameListName( NameList( func ), row, TxtBuff, SN_DEMANGLED ) == 0 ) {
            return( FALSE );
        }
        line->text = TxtBuff;
        line->use_prev_attr = TRUE;
        line->indent = MaxGadgetLength + func->max_name + 2 * WndAvgCharX( wnd );
        return( TRUE );
    default:
        return( FALSE );
    }
}
Exemple #2
0
static  bool    BrkGetLine( a_window *wnd, int row, int piece,
                             wnd_line_piece *line )
{
    brkp                *bp;
    break_window        *wndbreak;
    bool                curr;

    wndbreak = WndBreak( wnd );
    bp = BrkGetBP( row );
    if( bp == NULL )
        return( false );
    line->text = TxtBuff;
    line->tabstop = false;
    switch( piece ) {
#ifdef OPENER_GADGET
    case PIECE_OPENER:
    {
        mod_handle              mh;
        line->text = LIT_DUI( Empty );
        if( bp->size == 0 ) {
            DeAliasAddrMod( bp->loc.addr, &mh );
            bp->status.b.source_open =
                OpenGadget( wnd, line, mh, bp->source_line != NULL );
        }
        return( true );
    }
#endif
    case PIECE_ACTIVE:
#ifdef OPENER_GADGET
        line->indent = MaxGadgetLength + WndAvgCharX( wnd );
#endif
        curr = AddrComp( bp->loc.addr, Context.execution ) == 0;
        FileBreakGadget( wnd, line, curr, bp );
        return( true );
    case PIECE_ADDR:
        line->indent = wndbreak->addr_indent;
        line->extent = WND_MAX_EXTEND;
        line->tabstop = true;
        GetBPAddr( bp, TxtBuff );
        return( true );
    case PIECE_SOURCE:
        line->indent = wndbreak->source_indent;
        line->tabstop = false;
        line->use_prev_attr = true;
        GetBPText( bp, TxtBuff );
        return( true );
    default:
        return( false );
    }
}
Exemple #3
0
static  bool    FileGetLine( a_window *wnd, int row, int piece,
                             wnd_line_piece *line )
{
    int         len;
    file_window *file = WndFile( wnd );
    address     addr;
    brkp        *bp;
    bool        curr;
    DIPHDL( cue, ch );

    line->text = LIT_ENG( Empty );
    if( file->viewhndl == NULL && ModHasInfo( file->mod, HK_CUE ) != DS_OK ) {
        return( false );
    }
    curr = ( row == file->active && ContextMod == file->mod );
    switch( piece ) {
    case PIECE_BREAK:
        line->tabstop = false;
        if( row >= file->eof )
            return( false );
        if( file->mod == NO_MOD )
            return( true );
        addr = NilAddr;
        if( !WndDoingSearch ) { // too expensive
            addr = GetRowAddr( file, row, true );
        }
        if( !IS_NIL_ADDR( addr ) ) {
            bp = FindBreakByLine( file->mod, file->file_id, row+1 );
            FileBreakGadget( wnd, line, curr, bp );
        }
        return( true );
    case PIECE_SOURCE:
        line->text = TxtBuff;
        line->extent = WND_MAX_EXTEND;
        if( curr )
            line->attr = WND_STANDOUT;
        if( file->mod != NO_MOD ) {
            line->indent = MaxGadgetLength;
        }
        if( file->viewhndl == NULL ) {
            Format( TxtBuff, LIT_DUI( No_Source_Line ), row+1 );
            if( LineCue( file->mod, file->file_id, 0, 0, ch ) != SR_NONE ) {
                if( (CueAdjust( ch, -1, ch ) & DS_ERR) ) {
                    file->eof = CueLine( ch );
                }
            }
            return( true );
        }
        len = FReadLine( file->viewhndl, row+1, 0, TxtBuff, MAX_LINE_LEN );
        if( len < 0 ) {
            file->eof = row;
            return( false );
        }
        if( len == MAX_LINE_LEN ) {
            StrCopy( " ...", TxtBuff + MAX_LINE_LEN );
        } else {
            TxtBuff[len] = NULLCHAR;
        }
        if( row >= file->rows ) {
            file->rows = row + 1;
            file->rows_offset = FLastOffset( file->viewhndl );
        }
        return( true );
    default:
        return( false );
    }
}