Esempio n. 1
0
extern  void    AsmMoveDot( a_window *wnd, address addr )
{
    int         row;
    asm_window  *asw;
    DIPHDL( cue, ch1 );
    DIPHDL( cue, ch2 );

    if( wnd == NULL ) return;

    asw = WndAsm( wnd );
    if( DeAliasAddrCue( asw->mod, addr, ch1 ) != SR_NONE &&
        DeAliasAddrCue( asw->mod, asw->dotaddr, ch2 ) != SR_NONE ) {
        if( CueMod( ch1 )    == CueMod( ch2 ) &&
            CueFileId( ch1 ) == CueFileId( ch2 ) &&
            CueLine( ch1 )   == CueLine( ch2 ) ) {
            return;
        }
    }
    WndNoSelect( wnd );
    row = AsmAddrRow( wnd, addr );
    if( row == WndRows( wnd ) ) {
        AsmSetFirst( wnd, addr, TRUE );
        row = AsmAddrRow( wnd, addr );
        WndDirtyCurr( wnd );
        WndNewCurrent( wnd, row, PIECE_CURRENT );
        WndRepaint( wnd );
        row = 0;
    } else {
        WndDirtyCurr( wnd );
        WndNewCurrent( wnd, row, PIECE_CURRENT );
    }
    AsmSetDotAddr( wnd, addr );
}
Esempio n. 2
0
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;
        }
    }
}
Esempio n. 3
0
static void FuncRefresh( a_window *wnd )
{
    func_window *func = WndFunc( wnd );
    mod_handle  mod;

    if( UpdateFlags & UP_SYM_CHANGE ) {
        if( func->is_global ) {
            FuncNewMod( wnd, func->mod );
        } else if( DeAliasAddrMod( GetCodeDot(), &mod ) == SR_NONE ) {
            FuncNoMod( wnd );
        } else {
            FuncNewMod( wnd, mod );
        }
    } else if( ( UpdateFlags & UP_CODE_ADDR_CHANGE ) && !func->is_global ) {
        if( DeAliasAddrMod( GetCodeDot(), &mod ) == SR_NONE ) {
            FuncNoMod( wnd );
        } else {
            FuncNewMod( wnd, mod );
        }
    } else if( UpdateFlags & UP_BREAK_CHANGE ) {
        if( func->toggled_break ) {
            func->toggled_break = FALSE;
        } else {
            WndRepaint( wnd );
        }
    }
}
Esempio n. 4
0
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 );
}
Esempio n. 5
0
static void NotFound( a_window *wnd, regexp *rx, char *msg )
{
    Ring();
    WndNextRow( wnd, WND_NO_ROW, WND_RESTORE_ROW );
    WndStatusText( msg );
    WndFreeRX( rx );
    WndDoingSearch = FALSE;
    WndRepaint( wnd );
}
Esempio n. 6
0
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 );
}
Esempio n. 7
0
extern a_window *W5Open()
{
    a_window    *wnd;
    wnd = WndCreate( "Just some more text", &W5Info, 0, NULL );
    WndRepaint( wnd );
    WndScrollAbs( wnd, 0 );
    WndScrollAbs( wnd, NUM_ROWS );
    WndScrollAbs( wnd, NUM_ROWS/2 );
    return( wnd );
}
Esempio n. 8
0
static  void    VarRepaint( a_window *wnd )
{
    var_window  *var = WndVar( wnd );

    VarAllNodesInvalid( &var->i );
    VarKillExprSPCache( &var->i );
    WndSetThumb( wnd );
    WndNoSelect( wnd );
    WndRepaint( wnd );
    WndResetScroll( wnd );
}
Esempio n. 9
0
void RunThreadNotify( void )
{
    thread_state    *thd;

    if( HeadThd && HaveRemoteRunThread() ) {
        RemotePollRunThread();

        if( RunThreadWnd ) {
            for( thd = HeadThd; thd != NULL; thd = thd->link ) {
                RemoteUpdateRunThread( thd );
            }
            WndRepaint( RunThreadWnd );
        }
    }
}
Esempio n. 10
0
static void TrdRefresh( a_window *wnd )
{
    thread_state    *thd;
    int                 row;

    row = 0;
    for( thd = HeadThd; thd != NULL; thd = thd->link ) {
        if( IsThdCurr( thd ) ) {
            WndMoveCurrent( wnd, row, PIECE_ID );
            break;
        }
        ++row;
    }
    WndNoSelect( wnd );
    WndRepaint( wnd );
}
Esempio n. 11
0
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 );
}
Esempio n. 12
0
static  void    DoWndDirtyScreenPiece( a_window *wnd, wnd_row row,
                                       int piece, int col, int end_col )
{
    int         i;
    int         same_row;

    /* check if any piece contains this one */
    same_row = -1;
    for( i = 0; i < wnd->dirtyrects; ++i ) {
        if( wnd->dirty[i].row != row ) continue;
        same_row = i;
        if( wnd->dirty[i].piece == WND_NO_PIECE || piece == WND_NO_PIECE ) {
            wnd->dirty[i].piece = WND_NO_PIECE;
            return;
        }
        if( wnd->dirty[i].piece != piece ) continue;
        if( wnd->dirty[i].col == WND_NO_COL || col == WND_NO_COL ) {
            wnd->dirty[i].col = WND_NO_COL;
            return;
        }
        if( col < wnd->dirty[i].col ) wnd->dirty[i].col = col;
        if( end_col > wnd->dirty[i].end_col ) wnd->dirty[i].end_col = end_col;
        return;
    }
    if( wnd->dirtyrects >= WndMaxDirtyRects ) {
        if( same_row != -1 ) {
            wnd->dirty[same_row].piece = WND_NO_PIECE;
        } else {
            WndRepaint( wnd );
        }
        return;
    }
    wnd->dirty[ (unsigned)wnd->dirtyrects ].row = row;
    wnd->dirty[ (unsigned)wnd->dirtyrects ].piece = piece;
    wnd->dirty[ (unsigned)wnd->dirtyrects ].col = col;
    wnd->dirty[ (unsigned)wnd->dirtyrects ].end_col = end_col;
    wnd->dirtyrects++;
}
Esempio n. 13
0
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;
}
Esempio n. 14
0
extern  void    WndSetTitleSize( a_window *wnd, int size )
{
    wnd->title_size = size;
    WndRepaint( wnd );
}
Esempio n. 15
0
void WndPaintDirt( a_window *wnd )
{
    int                 i;
    wnd_line_piece      line;
    wnd_line_piece      next_piece_line;
    gui_rect            rect;
    wnd_dirt            *dirt;
    gui_coord           size;
    gui_coord           half_char;
    a_window            *next;
//    a_window            *last;

//    last = NULL;
    for( wnd = WndNext( NULL ); wnd != NULL; wnd = next ) {
        next = WndNext( wnd );
        if( wnd->vscroll_pending != 0 ) {
            if( wnd->hscroll_pending != -1 ) {
                _Set( wnd, WSW_REPAINT );
            }
            if( _Is( wnd, WSW_REPAINT ) ) {
                if( wnd->hscroll_pending != -1 ) {
                    GUIInitHScroll( wnd->gui, wnd->hscroll_pending );
                }
                WndRepaint( wnd );
                wnd->hscroll_pending = -1;
                wnd->vscroll_pending = 0;
            } else {
                for( i = 0; i < wnd->title_size; ++i ) {
                    GUIDrawTextExtent( wnd->gui, " ", 1, i, 0, GUI_BACKGROUND, GUI_NO_COLUMN );
                }
                GUIDoVScrollClip( wnd->gui, wnd->vscroll_pending,
                                  wnd->title_size, wnd->rows - 1 );
                wnd->vscroll_pending = 0;
            }
        }
        if( _Is( wnd, WSW_REPAINT ) ) {
            _Clr( wnd, WSW_REPAINT );
            WndKillCacheLines( wnd );
            WndCheckCurrentValid( wnd );
            GUIWndDirty( wnd->gui );
            if( wnd->max_indent != 0 && wnd->width >= wnd->max_indent ) {
                GUISetHScroll( wnd->gui, 0 );
                wnd->hscroll_pending = -1;
                GUISetHScrollRange( wnd->gui, wnd->max_indent );
            }
            next = wnd;
        } else {
            for( i = 0; i < wnd->dirtyrects; ++i ) {
                dirt = &wnd->dirty[i];
                if( dirt->row < 0 ) continue;
                if( dirt->row >= wnd->rows ) continue;
                if( dirt->piece == WND_NO_PIECE ) {
                    if( !WndGetLine( wnd, dirt->row, 0, &line ) ) continue;
                    GUIWndDirtyRow( wnd->gui, dirt->row );
                } else {
                    if( !WndGetLine( wnd, dirt->row, dirt->piece, &line ) ) continue;
                    if( line.bitmap ) {
                        GUIGetHotSpotSize( line.text[0], &size );
                        rect.x = line.indent;
                        rect.y = dirt->row * wnd->max_char.y;
                        rect.width = line.length;
                        rect.height = size.y;
                    } else if( dirt->col != WND_NO_COL ) {
                        if( line.length == 0 ) line.text = " ";
                        rect.x = line.indent;
                        rect.x += GUIGetExtentX(wnd->gui, line.text, dirt->col);
                        rect.y = dirt->row * wnd->max_char.y;
                        rect.width = GUIGetExtentX( wnd->gui, line.text+dirt->col, dirt->end_col-dirt->col+GUICharLen( line.text[dirt->col] ) );
                        rect.height = wnd->max_char.y;
                    } else if( line.extent == WND_MAX_EXTEND || line.master_tabstop ) {
                        rect.width = 0;
                        rect.height = 0;
                        GUIWndDirtyRow( wnd->gui, dirt->row );
                    } else {
                        rect.x = line.indent;
                        if( WndGetLine( wnd, dirt->row, dirt->piece+1, &next_piece_line ) ) {
                            if( next_piece_line.indent < line.indent ) {
                                rect.width = WND_APPROX_SIZE;
                            } else {
                                rect.width = next_piece_line.indent - line.indent;
                            }
                        } else {
                            rect.width = WND_APPROX_SIZE;
                        }
                        rect.y = dirt->row * wnd->max_char.y;
                        rect.height = wnd->max_char.y;
                    }
                    /* begin kludge for Kerning problem */
                    if( rect.width != 0 || rect.height != 0 ) {
                        half_char.x = WndAvgCharX( wnd ) / 2;
                        half_char.y = 0;
                        GUITruncToPixel( &half_char );
                        if( rect.x < half_char.x ) {
                            rect.width += half_char.x + rect.x;
                            rect.x = 0;
                        } else {
                            rect.x -= half_char.x;
                            rect.width += half_char.x + half_char.x;
                        }
                        GUIWndDirtyRect( wnd->gui, &rect );
                    }
                }
            }
        }
        if( wnd->hscroll_pending != -1 ) {
            GUISetHScroll( wnd->gui, wnd->hscroll_pending );
            wnd->hscroll_pending = -1;
        }
        wnd->dirtyrects = 0;
        WndSetThumb( wnd );
    }
}
Esempio n. 16
0
extern  bool    WndSearch( a_window *wnd, bool from_top, int direction )
{
    wnd_line_piece      line;
    regexp              *rx;
    char                *pos;
    char                *endpos;
    bool                wrap;
    int                 rows;
    bool                rc;
    bool                had_cache;
    char                *not_found;
    char                *top_of_window;
    char                *end_of_window;
    char                *search_wrapped;

    wnd_subpiece        next_occurence;
    wnd_subpiece        prev_occurence;
    wnd_subpiece        curr;
    wnd_coord           starting_pos;

    if( direction == 0 ) return( FALSE );
    if( wnd == NULL ) return( FALSE );
    if( wnd->searchitem == NULL ) return( FALSE );
    rx = WndCompileRX( wnd->searchitem );
    if( rx == NULL ) return( FALSE );
    not_found = WndLoadString( LITERAL_Not_Found );
    top_of_window = WndLoadString( LITERAL_Top_Of_Window );
    end_of_window = WndLoadString( LITERAL_End_Of_Window );
    search_wrapped = WndLoadString( LITERAL_Search_Wrapped );
    wrap = FALSE;
    starting_pos.piece = 0;
    starting_pos.col = direction > 0 ? -1 : WND_MAX_COL;
    if( from_top ) {
        curr.row = 0;
    } else if( WndHasCurrent( wnd ) ) {
        curr.row = WndVirtualRow( wnd, wnd->current.row );
        starting_pos.piece = wnd->current.piece;
        starting_pos.col = wnd->current.col;
    } else {
        curr.row = WndVirtualTop( wnd );
    }
    starting_pos.row = curr.row;
    WndNextRow( wnd, WND_NO_ROW, WND_SAVE_ROW );
    WndStatusText( "" );
    WndDoingSearch = TRUE;
    had_cache = WndSetCache( wnd, FALSE );
    for( ;; ) {
        if( curr.row < 0 ) {
            if( wrap ) {
                NotFound( wnd, rx, not_found );
                rc = FALSE;
                goto done;
            } else if( _Is( wnd, WSW_SEARCH_WRAP ) ) {
                rows = WndNumRows( wnd );
                if( rows == -1 ) {
                    WndRepaint( wnd );
                    WndScrollAbs( wnd, -wnd->title_size );
                    rows = WndScrollAbs( wnd, WND_MAX_ROW ) + WndRows( wnd );
                }
                curr.row = rows - 1;
                curr.col = 0;
                curr.piece = -1;
                wrap = TRUE;
                continue;
            } else {
                NotFound( wnd, rx, top_of_window );
                rc = FALSE;
                goto done;
            }
        }
        next_occurence.col = -1;
        prev_occurence.col = -1;
        for( curr.piece = 0;; ++curr.piece ) { // look for both next and prev match
            if( !WndGetLineAbs( wnd, curr.row, curr.piece, &line ) ) {
                if( curr.piece != 0 ) break;
                if( wrap ) {
                    NotFound( wnd, rx, not_found );
                    rc = FALSE;
                    goto done;
                } else if( _Is( wnd, WSW_SEARCH_WRAP ) ) {
                    curr.row = 0;
                    curr.col = 0;
                    curr.piece = -1;
                    wrap = TRUE;
                    continue;
                } else {
                    NotFound( wnd, rx, end_of_window );
                    rc = FALSE;
                    goto done;
                }
            }
            if( line.bitmap ) continue;
            pos = line.text;
            endpos = NULL;
            while( WndRXFind( rx, &pos, &endpos ) ) {
                curr.end = endpos - line.text;
                curr.col = pos - line.text;
                if( curr.piece < starting_pos.piece ) {
                    prev_occurence = curr;
                } else if( curr.piece > starting_pos.piece ) {
                    if( next_occurence.col == -1 ) {
                        next_occurence = curr;
                    }
                } else if( curr.col > starting_pos.col ) {
                    if( next_occurence.col == -1 ) {
                        next_occurence = curr;
                    }
                } else if( curr.col < starting_pos.col ) {
                    prev_occurence = curr;
                }
                ++pos;
            }
        }
        if( direction < 0 ) {
            next_occurence = prev_occurence;
        }
        if( next_occurence.col != -1 ) {
            WndDoingSearch = FALSE;
            WndKillCacheLines( wnd );
            WndDirtyCurr( wnd );
            WndNoSelect( wnd );
            WndNoCurrent( wnd );
            if( curr.row < WndVirtualTop( wnd ) ) {
                if( curr.row > wnd->rows / 2 ) {
                    WndRepaint( wnd );
                    WndScrollAbs( wnd, curr.row - wnd->rows / 2 );
                } else {
                    WndRepaint( wnd );
                    WndScrollAbs( wnd, -wnd->title_size );
                }
            } else if( curr.row >= WndVirtualBottom( wnd ) ) {
                WndRepaint( wnd );
                WndScrollAbs( wnd, curr.row - wnd->rows / 2 );
            }
            wnd->sel_start.row = WndScreenRow( wnd, curr.row );
            wnd->sel_start.piece = next_occurence.piece;
            wnd->sel_start.col = next_occurence.col;

            wnd->sel_end = wnd->sel_start;
            wnd->sel_end.col = next_occurence.end - 1;

            wnd->current.col = wnd->sel_end.col;
            wnd->current = wnd->sel_start;
            WndSetCurrCol( wnd );
            WndCurrVisible( wnd );
            WndDirtyCurr( wnd );
            WndFreeRX( rx );
            if( wrap ) WndStatusText( search_wrapped );
            rc = TRUE;
            goto done;
        }
        if( direction > 0 ) {
            if( wrap && curr.row > starting_pos.row ) {
                NotFound( wnd, rx, not_found );
                rc = FALSE;
                goto done;
            }
            starting_pos.col = -1;
            starting_pos.piece = 0;
            curr.row = WndNextRow( wnd, curr.row, 1 );
        } else {
            starting_pos.col = WND_MAX_COL;
            starting_pos.piece = WND_MAX_COL;
            curr.row = WndNextRow( wnd, curr.row, -1 );
        }
        curr.piece = 0;
    }
done:;
    WndSetCache( wnd, had_cache );
    WndFree( not_found );
    WndFree( top_of_window );
    WndFree( end_of_window );
    WndFree( search_wrapped );
    return( rc );
}
Esempio n. 17
0
static void    W7Refresh( a_window *wnd )
{
    WndRepaint( wnd );
}
Esempio n. 18
0
void    W4Refresh( a_window *wnd )
{
    WndRepaint( wnd );
}