コード例 #1
0
ファイル: dbgwinsp.c プロジェクト: groessler/open-watcom-v2
static a_window *WndVarNewWindow( const char *item )
{
    a_window    *wnd;

    WndSetOpenNoShow();
    wnd = WndVarOpen();
    WndSetTitle( wnd, item );
    WndVarAdd( wnd, item, strlen( item ), true );
    WndFirstCurrent( wnd );
    WndForcePaint( wnd );
    WndShrinkToMouse( wnd, WndMetrics[ WND_WATCH ] );
    WndShowWindow( wnd );
    return( wnd );
}
コード例 #2
0
static void AsmSetTitle( a_window *wnd )
{
    char        *p;
    char        *image_name;
    asm_window  *asw = WndAsm( wnd );

    p = StrCopy( ": ", StrCopy( LIT( WindowAssembly ), TxtBuff ) );
    p += ModName( asw->mod, p, TXT_LEN );
    image_name = ModImageName( asw->mod );
    if( image_name[0] != '\0' ) {
        p = StrCopy( "(", StrCopy( " ", p ) );
        p = StrCopy( ")", StrCopy( SkipPathInfo( image_name, OP_REMOTE ), p ) );
    }
    WndSetTitle( wnd, TxtBuff );
}
コード例 #3
0
static void FileSetTitle( a_window *wnd, mod_handle mod )
{
    char        *p;
    const char  *image_name;
    file_window *file = WndFile( wnd );

    if( file->track ) {
        p = StrCopy( ": ", StrCopy( LIT_DUI( WindowSource ), TxtBuff ) );
    } else {
        p = TxtBuff;
    }
    if( file->viewhndl != NULL ) {
        p = StrCopy( SkipPathInfo( FGetName( file->viewhndl ), 0 ), p );
    } else if( file->mod != NO_MOD ) {
        p += ModName( file->mod, p, TXT_LEN );
    }
    image_name = ModImageName( mod );
    if( image_name[0] != NULLCHAR ) {
        p = StrCopy( "(", StrCopy( " ", p ) );
        p = StrCopy( ")", StrCopy( SkipPathInfo( image_name, OP_REMOTE ), p ) );
    }
    WndSetTitle( wnd, TxtBuff );
}
コード例 #4
0
char *CheckForPowerBuilder( char *name )
{
    static char pid[20];

    if( _IsOff( SW_POWERBUILDER ) ) return( name );
    EnumWindows( FindPidPB, 0 );
    if( AlreadyRunning ) {
        StartupErr( LIT( PowerBuilder_Debugger_Already_Running ) );
        return( "" );
    }
    if( PidPB == 0 ) {
        StartupErr( LIT( PowerBuilder_Not_Running ) );
        return( "" );
    } else {
        pid[0] = '#';
        itoa( PidPB, pid+1, 16 );
        #ifdef __GUI__
            WndSetTitle( WndMain, LIT( The_WATCOM_Debugger_for_PowerBuilder ) );
        #else
            SetConsoleTitle( LIT( The_WATCOM_Debugger_for_PowerBuilder ) );
        #endif
        return( pid );
    }
}
コード例 #5
0
ファイル: wndcreat.c プロジェクト: Azarien/open-watcom-v2
static a_window *WndCreateWithStructBody( wnd_create_struct *info,
                                          gui_create_info *init )
{
    a_window    *wnd;
    gui_window  *gui;
    char        buff[256];
    int         size;

    if( info->title == NULL ) {
        buff[0] = '\0';
    } else {        // might be clobbered by create
        strcpy( buff, info->title );
    }
    if( info->title != NULL )
        strcpy( buff, info->title ); // might be clobbered by create
    size = sizeof( *wnd ) + ( WndMaxDirtyRects - 1 ) * sizeof( wnd->dirty ); //
    wnd = WndAlloc( size );
    if( wnd == NULL ) {
        WndFree( info->extra );
        WndNoMemory();
    }
    memset( wnd, 0, size );
    wnd->u.button_down.row = (char)-1;
    wnd->gui = NULL;
    wnd->info = info->info;
    wnd->wndclass = info->wndclass;
    wnd->extra = info->extra;
    wnd->title_size = info->title_size;
    wnd->rows = 1;      // just so it's not zero in init code
    WndNoSelect( wnd );
    WndNoCurrent( wnd );
    WndSetCurrCol( wnd );
    WndNullPopItem( wnd );
    wnd->dirtyrects= 0; // wndnoselect changes this!
    wnd->vscroll_pending = 0;
    wnd->hscroll_pending = -1;
    wnd->keypiece = WND_NO_PIECE;

    wnd->switches = WSW_SELECT_IN_TABSTOP | WSW_MUST_CLICK_ON_PIECE |
                    WSW_ALLOW_POPUP | WSW_SEARCH_WRAP | WSW_HIGHLIGHT_CURRENT |
                    WSW_ONLY_MODIFY_TABSTOP | WSW_MENU_ACCURATE_ROW;

    if( info->rect.width == 0 || info->rect.height == 0 ) {
        init->rect.x = 0;
        init->rect.y = 0;
        init->rect.width = WndMax.x;
        init->rect.height = WndMax.y;
    } else {
        init->rect.x = info->rect.x;
        init->rect.y = info->rect.y;
        init->rect.width = info->rect.width;
        init->rect.height = info->rect.height;
    }
    init->scroll = info->scroll;
    init->style = info->style;
    init->style |= GUI_VSCROLL_EVENTS;
    init->style &= ~GUI_HSCROLL_EVENTS;
    init->title = ( info->title == NULL ) ? NULL : "";
    if( WndMain != NULL ) {
        init->style |= GUI_VISIBLE;
        init->parent = WndMain->gui;
        init->num_menus = 0;
        init->menu = NULL;
    } else {
        init->style &= ~GUI_VISIBLE;
        init->scroll = GUI_NOSCROLL;
        init->num_menus = WndNumMenus;
        init->menu = WndMainMenu;
        init->parent = NULL;
    }
    if( init->style & GUI_POPUP ) {
        init->parent = NULL;
    }
    init->num_attrs = WndNumColours;
    init->colours = info->colour;
    init->call_back = WndMainEventProc;
    init->extra = wnd;

    _Set( wnd, WSW_ACTIVE );

    gui = GUICreateWindow( init );
    if( gui == NULL ) {
        WndFree( info->extra );
        WndFree( wnd );
        WndNoMemory();
        return( NULL );
    } else {
        if( buff[0] != '\0' ) {
            WndSetTitle( wnd, buff );
        }
    }
    ++NumWindows;
    return( wnd );
}
コード例 #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 );
}