コード例 #1
0
ファイル: srchook.c プロジェクト: Azarien/open-watcom-v2
/*
 * InvokeColSelHook - invoke column hook with specified data
 */
vi_rc InvokeColSelHook( int sc, int ec )
{
    int         j, i;
    char        wordbuff[MAX_STR];
    char        data[MAX_STR + 32];
    int         lne;
#ifndef __WIN__
    int         x1;
    int         has_bord;
#endif

#ifdef __WIN__
    if( LastEvent != VI_KEY( FAKEMOUSE ) ) {
        lne = (CurrentPos.line - LeftTopPos.line) * FontHeight( WIN_TEXT_FONT( &EditWindow ) );
    } else {
        lne = MouseY;
    }
#else
    has_bord = WindowAuxInfo( current_window_id, WIND_INFO_HAS_BORDER );
    x1 = WindowAuxInfo( current_window_id, WIND_INFO_X1 );
    if( LastEvent != VI_KEY( MOUSEEVENT ) ) {
        lne = WindowAuxInfo( current_window_id, WIND_INFO_Y1 ) + CurrentPos.line - LeftTopPos.line;
        if( has_bord ) {
            ++lne;
        }
    } else {
        lne = MouseRow;
    }
#endif

    j = 0;
    if( ec - sc >= MAX_STR ) {
        ec = sc + MAX_STR - 2;
    }
    for( i = sc - 1; i <= ec - 1; i++ ) {
        wordbuff[j++] = CurrentLine->data[i];
    }
    wordbuff[j] = '\0';
#ifdef __WIN__
    sc = MyTextExtent( current_window_id, WIN_TEXT_STYLE( &EditWindow ),
        &CurrentLine->data[0], sc );
    ec = MyTextExtent( current_window_id, WIN_TEXT_STYLE( &EditWindow ),
        &CurrentLine->data[0], ec );
#else
    sc = x1 + VirtualColumnOnCurrentLine( sc ) - LeftTopPos.column;
    ec = x1 + VirtualColumnOnCurrentLine( ec ) - LeftTopPos.column;
    if( !has_bord ) {
        sc--;
        ec--;
    }
#endif
    MySprintf( data, "\"%s\" %d %d %d %d", wordbuff, lne, sc, ec, ec - sc + 1 );
    return( SourceHookData( SRC_HOOK_MOUSE_CHARSEL, data ) );

} /* InvokeColSelHook */
コード例 #2
0
static void sendNewColour( NewColourOps op )
{
    type_style  *mod_style;

    if( BAD_ID( mod_wid ) ) {
        return;
    }

    if( mod_wid == GetToolbarWindow() ) {
        sendNewColourToolbar();
    } else if( mod_wid == current_window_id ) {
        sendNewColourCurrentWindow( op );
    } else {
        mod_style = WIN_TEXT_STYLE( WINDOW_FROM_ID( mod_wid ) );
        if( op == NC_FORE ) {
            mod_style->foreground = INDEX_FROM_XY( cursx, cursy );
        } else {
            mod_style->background = INDEX_FROM_XY( cursx, cursy );
        }
        StatusWndChangeSysColors( RGBValues[statusw_info.text_style.background],
                                  RGBValues[statusw_info.text_style.foreground],
                                  GetSysColor( COLOR_BTNHIGHLIGHT ),
                                  GetSysColor( COLOR_BTNSHADOW ) );
        ReDisplayScreen();
    }
}
コード例 #3
0
ファイル: message.c プロジェクト: Azarien/open-watcom-v2
static void msgString( int line_no, const char *str )
{
    int     height;
    RECT    rect;
    HDC     hdc;

    if( !AllowDisplay || BAD_ID( message_window_id ) ) {
        return;
    }
    GetClientRect( message_window_id, &rect );
    height = FontHeight( WIN_TEXT_FONT( &MessageBar ) );
    rect.top += (line_no - 1) * height;
    rect.bottom = rect.top + height;
    hdc = TextGetDC( message_window_id, WIN_TEXT_STYLE( &MessageBar ) );
    FillRect( hdc, &rect, ColorBrush( WIN_TEXT_BACKCOLOR( &MessageBar ) ) );
    TextReleaseDC( message_window_id, hdc );
    WriteString( message_window_id, 0, rect.top, WIN_TEXT_STYLE( &MessageBar ), str );
}
コード例 #4
0
ファイル: repcnt.c プロジェクト: Azarien/open-watcom-v2
/*
 * drawRepeatString - draw the current repeat string
 */
static void drawRepeatString( void )
{
    int     height;
    RECT    rect;
    HDC     hdc;

    if( !AllowDisplay || BAD_ID( repeat_window_id ) ) {
        return;
    }
    GetClientRect( repeat_window_id, &rect );
    height = FontHeight( WIN_TEXT_FONT( &RepeatCountWindow ) );
    rect.bottom = rect.top + height;
    hdc = TextGetDC( repeat_window_id, WIN_TEXT_STYLE( &RepeatCountWindow ) );
    FillRect( hdc, &rect, ColorBrush( WIN_TEXT_BACKCOLOR( &RepeatCountWindow ) ) );
    TextReleaseDC( repeat_window_id, hdc );
    WriteString( repeat_window_id, 0, rect.top, WIN_TEXT_STYLE( &RepeatCountWindow ), repString );

} /* drawRepeatString */