Example #1
0
static  void    AsmResize( a_window *wnd )
{
    asm_window          *asw = WndAsm( wnd );
    asm_addr            *new_ins;
    address             first;
    int         size;

    size = WndRows( wnd );
    if( size <= 0 ) size = 1;
    first = asw->ins[ 0 ].addr;
    new_ins = WndAlloc( size*sizeof( *new_ins ) );
    memset( new_ins, 0, size*sizeof( *new_ins ) );
    if( new_ins == NULL ) {
        WndClose( wnd );
        WndNoMemory();
    }
    WndFree( asw->ins );
    asw->ins = new_ins;
    asw->ins_size = size;
    AsmSetFirst( wnd, first, asw->ins[ 0 ].line != 0 );
    CalcAddrLen( wnd, first );
    if( asw->last_width != WndWidth( wnd ) ) {
        WndZapped( wnd );
    }
    asw->last_width = WndWidth( wnd );
    WndFixedThumb( wnd );
}
Example #2
0
extern  bool    W4GetLine( a_window *wnd, wnd_row row, int piece,
                             wnd_line_piece *line )
{
    static char buff[20];

    wnd=wnd;
    if( row == -2 ) {
        if( piece != 0 ) return( FALSE );
        line->text = "Title line 1";
        line->tabstop = FALSE;
        line->static_text = TRUE;
    } else if( row == -1 ) {
        if( piece != 0 ) return( FALSE );
        line->tabstop = FALSE;
        line->static_text = TRUE;
        #if 0
            line->text = UiMapChar;
        #else
            line->text = "";
            line->underline = TRUE;
            line->extent = WndWidth( wnd );
            line->indent = 0;
        #endif
    } else if( row >= SIZE ) {
        return( FALSE );
    } else {
        switch( piece ) {
        case 0:
            line->tabstop = TRUE;
            itoa( row, buff, 10 );
            line->text = buff;
            line->extent = WND_MAX_EXTEND;
            return( TRUE );
        case 1:
            line->tabstop = FALSE;
            line->use_prev_attr = TRUE;
            line->text = "";
            line->extent = WND_MAX_EXTEND;
            line->indent = 1000;
            return( TRUE );
        case 2:
            line->tabstop = FALSE;
            line->use_prev_attr = TRUE;
            line->text = Stuff[ row ];
            line->extent = WND_MAX_EXTEND;
            line->indent = 2000;
            return( TRUE );
        case 3:
            line->tabstop = FALSE;
            line->use_prev_attr = TRUE;
            line->text = "";
            line->extent = WND_MAX_EXTEND;
            line->indent = 3000;
            return( TRUE );
        default:
            return( FALSE );
        }
    }
    return( TRUE );
}
Example #3
0
static void     VarSetWidth( a_window *wnd )
/*
    Always leave room for a vertical scroll bar. It's most annoying
    having the window repaint whenever it appears/disappears.
 */
{
    var_window  *var = WndVar( wnd );

    var->last_width = WndWidth( wnd );
    if( VarRowTotal( &var->i ) <= WndRows( wnd ) ) {
        var->last_width -= WndVScrollWidth( wnd );
    }
    var->last_width -= WndAvgCharX( wnd ) / 2;

}
Example #4
0
STATIC bool sampleProcBotStatus( a_window *wnd, int row, int piece,
                                               wnd_line_piece *line )
/*******************************************************************/
{
    gui_point           start;
    gui_point           end;
    gui_ord             vertical_x;
    gui_ord             max_x;
    gui_ord             max_y;
    gui_ord             client_height;
    gui_ord             client_width;
    gui_ord             cross_y;

    row=row;
    piece=piece;
    line=line;
    if( piece > PIECE_DRAW_LINE )
        return( false );
    if( piece == PIECE_MOUSE_CATCHER ) {
        line->indent = 0;
        line->tabstop = false;
        line->attr = WPA_PLAIN;
        line->text = LIT( Empty_Str );
        line->extent = WndWidth( wnd );
        return( true );
    }
    max_y = WndMaxCharY( wnd );
    max_x = WndAvgCharX( wnd );
    vertical_x = SEPARATOR_POINT + max_x / 2;
    client_height = WPGetClientHeight( wnd );
    client_width = WPGetClientWidth( wnd );
    cross_y = max_y * STATUS_ROW + max_y/4;
    start.x = 0;
    end.x = client_width;
    start.y = cross_y;
    end.y = start.y;
    GUIDrawLine( WndGui( wnd ), &start, &end, GUI_PEN_SOLID, 0, WPA_PLAIN );
    start.x = vertical_x;
    end.x = vertical_x;
    start.y = cross_y;
    end.y = client_height;
    GUIDrawLine( WndGui( wnd ), &start, &end, GUI_PEN_SOLID, 0, WPA_PLAIN );
    return( true );
}
Example #5
0
STATIC bool aboutGetLine( a_window * wnd, wnd_row row, int piece,
                          wnd_line_piece * line )
/***********************************************************/
{
//    gui_coord           size;

    wnd=wnd;
    if( piece != 0 || !aboutOn ) return( P_FALSE );
    if( row >= AboutSize ) {
        /* the following code fragment was ripped from the debugger */
        /* Something like this can be done for the splash page?? */
//        if( row > AboutSize || !GUIIsGUI() ) return( P_FALSE );
//    WndSetGadgetLine( wnd, line, GADGET_SPLASH, MaxGadgetLength );
//        WndGetGadgetSize( GADGET_SPLASH, &size );
//        line->indent = ( WndWidth( wnd ) - size.x ) / 2;
//        return( P_TRUE );
        return( P_FALSE );
    }
    line->text = AboutMessage[ row ];
    line->indent = ( WndWidth( wnd ) - WndExtentX( wnd, line->text ) ) / 2;
    return( P_TRUE );
}
Example #6
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 );
}