Exemple #1
0
a_window DoWndIOOpen( address *addr, mad_type_handle mth )
{
    io_window   *io;
    int         i;

    if( IOData.num_types == 0 )
        return( NULL );
    io = WndMustAlloc( sizeof( io_window ) );
    io->list = WndMustAlloc( sizeof( io_location ) );
    io->num_rows = 1;
    io->list->addr = *addr;
    io->list->type = PIECE_TYPE( MENU_IO_FIRST_TYPE );
    if( mth != MAD_NIL_TYPE_HANDLE ) {
        for( i = 0; i < IOData.num_types; i++ ) {
            if( IOData.info[i].mth == mth ) {
                break;
            }
        }
        if( i != IOData.num_types ) {
            io->list->type = i;
        }
    }
    io->list->value.ud = 0;
    io->list->value_known = false;
    return( DbgWndCreate( LIT_DUI( WindowIO_Ports ), &IOInfo, WND_IO, io, &IOIcon ) );
}
Exemple #2
0
void InitIOWindow( void )
{
    int                 i;

    MemInitTypes( MAS_IO | MTK_INTEGER, &IOData );
    if( IOData.num_types == 0 ) {
        return;
    }
    IOTypeMenu = WndMustAlloc( IOData.num_types * sizeof( *IOTypeMenu ) );
    for( i = 0; i < IOData.num_types; ++i ) {
        IOTypeMenu[i].id = MENU_IO_FIRST_TYPE + i;
        IOTypeMenu[i].style = GUI_STYLE_MENU_ENABLED | WND_MENU_ALLOCATED;
        IOTypeMenu[i].label = DupStr( IOData.labels[i] );
        IOTypeMenu[i].hinttext = DupStr( LIT_ENG( Empty ) );
        IOTypeMenu[i].child_num_items = 0;
        IOTypeMenu[i].child = NULL;
    }
    for( i = 0; i < ArraySize( IOMenu ); ++i ) {
        if( IOMenu[i].id == MENU_IO_TYPE ) {
            IOMenu[i].child = IOTypeMenu;
            IOMenu[i].child_num_items = IOData.num_types;
            break;
        }
    }
}
Exemple #3
0
extern a_window *DoWndGlobOpen( mod_handle mod )
{
    glob_window *glob;

    glob = WndMustAlloc( sizeof( glob_window ) );
    glob->mod = mod;
    return( DbgWndCreate( LIT( WindowGlobals ), &GlobInfo, WND_GLOBALS, glob, &GlobIcon ) );
}
Exemple #4
0
extern a_window *DoWndModOpen( mod_handle handle )
{
    mod_window  *mod;

    mod = WndMustAlloc( sizeof( mod_window ) );
    mod->handle = handle;
    return( DbgWndCreate( LIT( WindowModules ), &ModInfo, WND_MODULES, mod, &ModIcon ) );
}
extern a_window *WndCallOpen( void )
{
    call_window *call;
    a_window    *wnd;

    call = WndMustAlloc( sizeof( call_window ) );
    wnd = DbgWndCreate( LIT_DUI( WindowCalls ), &CallInfo, WND_CALL, call, &CallIcon );
    return( wnd );
}
Exemple #6
0
extern  void    DlgCmd( void )
{
    char        *cmd;

    cmd = WndMustAlloc( 100 );
    GUISetModalDlgs( TRUE );
    DlgOpen( "Enter a command", DLG_CMD_ROWS, DLG_CMD_COLS,
             Controls, NUM_CONTROLS, &CmdEvent, cmd );
    GUISetModalDlgs( FALSE );
}
Exemple #7
0
extern a_window *WndMadRegOpen( mad_type_kind kind, wnd_class_wv wndclass, gui_resource *icon )
{
    reg_window  *reg;
    a_window    *wnd;

    reg = WndMustAlloc( sizeof( reg_window ) );
    reg->kind = kind;
    wnd = DbgWndCreate( LIT_ENG( Empty ), &MadRegInfo, wndclass, reg, icon );
    return( wnd );
}
Exemple #8
0
extern  void    WndSelPopPiece( a_window *wnd, bool paint_immed )
{
    wnd_row             row;
    wnd_coord           *start;
    wnd_coord           *end;
    int                 piece;
    int                 buff_size;
    char                *ptr;
    int                 first;
    int                 len;
    wnd_line_piece      line;

    _Clr( wnd, WSW_SELECTING );
    _Clr( wnd, WSW_SELECTING_WITH_KEYBOARD );
    WndSelEnds( wnd, &start, &end );
    if( _Isnt( wnd, WSW_SUBWORD_SELECT ) ||
        ( start->row == end->row &&
          start->piece == end->piece && start->col == end->col ) ) {
        WndGetLine( wnd, start->row, start->piece, &line );
        GoBackward( wnd, start, &line );
        WndGetLine( wnd, end->row, end->piece, &line );
        GoForward( wnd, end, &line );
        if( end->row != start->row ) {
            GUIWndDirtyRow( wnd->gui, end->row );
            GUIWndDirtyRow( wnd->gui, start->row );
        } else if( paint_immed ) {
            GUIWndDirtyRow( wnd->gui, start->row );
        } else {
            WndDirtyScreenRange( wnd, start, end->col );
        }
    }
    buff_size = 0;
    for( row = start->row; row <= end->row; ++row ) {
        for( piece = 0; ; ++piece ) {
            if( !WndGetLine( wnd, row, piece, &line ) ) break;
            if( WndSelected( wnd, &line, row, piece, &first, &len ) ) {
                buff_size += len + 1;
            }
        }
    }
    WndFree( wnd->popitem );
    wnd->popitem = WndMustAlloc( buff_size+2 );
    ptr = wnd->popitem;
    for( row = start->row; row <= end->row; ++row ) {
        for( piece = 0; ; ++piece ) {
            if( !WndGetLine( wnd, row, piece, &line ) ) break;
            if( WndSelected( wnd, &line, row, piece, &first, &len ) ) {
                if( ptr != wnd->popitem ) *ptr++ = ' ';
                memcpy( ptr, line.text+first, len );
                ptr += len;
            }
        }
    }
    *ptr = '\0';
}
Exemple #9
0
extern a_window *WndBrkOpen( void )
{
    a_window            *wnd;
    break_window        *brkw;

    brkw = WndMustAlloc( sizeof( *brkw ) );
    wnd = DbgWndCreate( LIT_DUI( WindowBrk ), &BrkInfo, WND_BREAK, brkw, &BrkIcon );
    if( wnd != NULL )
        WndClrSwitches( wnd, WSW_ONLY_MODIFY_TABSTOP );
    return( wnd );
}
Exemple #10
0
a_window WndIOOpen( void )
{
    io_window   *io;
    a_window    wnd;

    io = WndMustAlloc( sizeof( io_window ) );
    io->list = NULL;
    io->num_rows = 0;
    wnd = DbgWndCreate( LIT_DUI( WindowIO_Ports ), &IOInfo, WND_IO, io, &IOIcon );
    if( wnd != NULL )
        WndClrSwitches( wnd, WSW_ONLY_MODIFY_TABSTOP );
    return( wnd );
}
Exemple #11
0
char *WndLoadString( int id )
{
    char        buff[256];
    char        *ret;
    int         size;

    if( !GUILoadString( id, buff, sizeof( buff ) -1 ) ) {
        buff[0]='\0';
    }
    size = strlen( buff ) + 1;
    ret = WndMustAlloc( size );
    strcpy( ret, buff );
    return( ret );
}
extern a_window *DoWndFuncOpen( bool is_global, mod_handle mod )
{
    func_window *func;
    wnd_class   wndcls;
    const char  *title;

    func = WndMustAlloc( sizeof( func_window ) );
    func->mod = mod;
    if( is_global ) {
        wndcls = WND_GBLFUNCTIONS;
        func->is_global = TRUE;
    } else {
        wndcls = WND_FUNCTIONS;
        func->is_global = FALSE;
    }
    if( is_global ) {
        title = LIT_DUI( WindowGlobal_Functions );
    } else {
        title = LIT_DUI( WindowFunctions );
    }
    return( DbgWndCreate( title, &FuncInfo, wndcls, func, &FuncIcon ) );
}
Exemple #13
0
static int DoDlgSearch( a_window *wnd, void *history, bool want_prev )
{
    dlg_search  *dlg;
    int direction;

    dlg = WndMustAlloc( sizeof( *dlg ) );
    dlg->wnd = wnd;
    dlg->direction = 0;
    dlg->case_ignore = SrchIgnoreCase;
    dlg->use_rx = SrchRX;
    dlg->history = history;
    ResDlgOpen( &SrchEvent, dlg, GUI_MAKEINTRESOURCE( want_prev ? DIALOG_SEARCH : DIALOG_SEARCH_ALL ) );
    direction = dlg->direction;
    SrchRX = dlg->use_rx;
    SrchIgnoreCase = dlg->case_ignore;
    if( dlg->use_rx ) {
        WndSetMagicStr( SrchMagicChars );
    } else {
        WndSetMagicStr( "" );
    }
    WndFree( dlg );
    return( direction );
}
Exemple #14
0
extern  void    WndNullPopItem( a_window *wnd )
{
    WndFree( wnd->popitem );
    wnd->popitem = WndMustAlloc( 1 );
    wnd->popitem[0] = '\0';
}
Exemple #15
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 );
}