コード例 #1
0
extern  bool    SrcMoveDot( a_window *wnd, address addr )
{
    unsigned    line;
    mod_handle  mod;
    file_window *file;
    DIPHDL( cue, ch );

    if( wnd == NULL ) return( FALSE );
    file = WndFile( wnd );
    if( file->mod == NO_MOD && !file->track ) return( FALSE );
    if( IS_NIL_ADDR( addr ) ) {
        WndScrollAbs( wnd, 0 );
        return( FALSE );
    }
    DeAliasAddrMod( addr, &mod );
    if( DeAliasAddrCue( mod, addr, ch ) == SR_NONE ) {
        if( LineCue( mod, 0, 0, 0, ch ) == SR_NONE ) return( FALSE );
    }
    line = CueLine( ch );
    if( mod != file->mod || CueFileId( ch ) != file->file_id ) {
        if( !file->track ) return( FALSE );
        FileTrack( wnd, ch );
    }
    --line;
    WndScrollAbs( wnd, line ); //
    WndMoveCurrent( wnd, line, PIECE_SOURCE );
    FileSetDotAddr( wnd, addr );
    FileSetTitle( wnd, CueMod( ch ) );
    return( TRUE );
}
コード例 #2
0
ファイル: window5.c プロジェクト: Ukusbobra/open-watcom-v2
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 );
}
コード例 #3
0
ファイル: window5.c プロジェクト: ideafarm/open-watcom-v2
a_window W5Open( void )
{
    a_window    wnd;

    wnd = WndCreate( "Just some more text", &W5Info, 0, NULL );
    WndSetRepaint( wnd );
    WndScrollAbs( wnd, 0 );
    WndScrollAbs( wnd, NUM_ROWS );
    WndScrollAbs( wnd, NUM_ROWS / 2 );
    return( wnd );
}
コード例 #4
0
static void FuncNoMod( a_window *wnd )
{
    func_window *func = WndFunc( wnd );

    WndScrollAbs( wnd, 0 );
    NameListFree( NameList( func ) );
    WndZapped( wnd );
}
コード例 #5
0
ファイル: dbgwglob.c プロジェクト: Ukusbobra/open-watcom-v2
static  void    GlobInit( a_window *wnd )
{
    glob_window *glob = WndGlob( wnd );

    WndScrollAbs( wnd, 0 );
    NameListFree( NameList( glob ) );
    WndZapped( wnd );
    NameListAddModules( NameList( glob ), glob->mod, glob->d2_only, TRUE );
    WndSetKey( wnd, PIECE_NAME );
}
コード例 #6
0
ファイル: window4.c プロジェクト: Ukusbobra/open-watcom-v2
extern void     W4MenuItem( a_window *wnd, unsigned id, int row, int piece )
{

    row=row;piece=piece;
    switch( id ) {
    case MENU_INITIALIZE:
        WndMenuGrayAll( wnd );
        if( row < 0 ) break;
        WndMenuEnableAll( wnd );
        break;
    case MENU_W2_SAY:
        Say2( "Say", WndPopItem( wnd ) );
        break;
    case MENU_W2_OPEN1:
        W1Open();
        break;
    case MENU_W2_TOP:
        WndScrollAbs( wnd, 0 );
        break;
    }
}
コード例 #7
0
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, &reg->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 = &reg->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 );
}
コード例 #8
0
ファイル: wndsrch.c プロジェクト: Ukusbobra/open-watcom-v2
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 );
}
コード例 #9
0
void WndScrollBottom( a_window *wnd )
{
    WndDirtyCurr( wnd );
    WndScrollAbs( wnd, WND_MAX_ROW );
    WndLastCurrent( wnd );
}
コード例 #10
0
void WndScrollTop( a_window *wnd )
{
    WndDirtyCurr( wnd );
    WndScrollAbs( wnd, -wnd->title_size );
    WndFirstCurrent( wnd );
}