Exemplo n.º 1
0
/*
 * FinishWindows - done with windows; close down
 */
void FinishWindows( void )
{
    cursor_type ct;
    window_id   i;

    // Close Down All Straggling Windows
    for( i = 0; i < MAX_WINDS; i++ ) {
        if( Windows[i] != NULL ) {
            // CloseAWindow( i );
        }
    }

    // Close down the windowing system.

    if( EditFlags.ZapColors ) {
        int             i, total;

        if( !EditFlags.Quiet && Scrn != NULL ) {
            total = EditVars.WindMaxWidth * EditVars.WindMaxHeight;
            for( i = 0; i < total; i++ ) {
                Scrn[i].cinfo_attr = EditVars.ExitAttr;
            }
#ifdef __VIO__
            MyVioShowBuf( 0, EditVars.WindMaxWidth * EditVars.WindMaxHeight );
#endif
        }
    }
    FiniColors();
    ct.height = 7;
    ct.width = 100;
    NewCursor( NO_WINDOW, ct );
    MemFree( ScreenImage );

} /* FinishWindows */
Exemplo n.º 2
0
/*
 * DrawVerticalThumb - draw the scroll thumb on the screen
 */
void DrawVerticalThumb( wind *w, char ch )
{
    char_info   what = {0, 0};
    int         addr;
    char_info   *txt;
    window_id   *over;
    unsigned    oscr;

    if( w->vert_scroll_pos < THUMB_START || EditFlags.Quiet ) {
        return;
    }

    txt = w->text;
    over = w->overlap;

    what.cinfo_char = ch;
    what.cinfo_attr = MAKE_ATTR( w, w->border_color1, w->border_color2 );

    addr = w->width - 1 + w->vert_scroll_pos * w->width;
    oscr = (w->x2) + (w->y1 + w->vert_scroll_pos) * EditVars.WindMaxWidth;

    WRITE_SCREEN_DATA( txt[addr], what );
    if( over[addr] == NO_WINDOW ) {
        WRITE_SCREEN( Scrn[oscr], what );
    }
#ifdef __VIO__
    MyVioShowBuf( oscr, 1 );
#endif

} /* DrawVerticalThumb */
Exemplo n.º 3
0
/*
 * ShiftWindowUpDown - shift the stuff in a window in an up/down direction
 */
void ShiftWindowUpDown( window_id id, int diff )
{
    wind                *w;
    int                 start, spl, i, j;
    int                 sline, eline, add;
    char_info           _FAR *scr_d;
    char_info           *txt_s, *txt_d;

    if( EditFlags.DisplayHold || EditFlags.Quiet ) {
        return;
    }
    w = AccessWindow( id );
    if( w->has_border ) {
        start = 1;
        spl = 0;
    } else {
        start = 0;
        spl = -1;
    }
    if( diff < 0 ) {
        sline = w->text_lines + diff;
        eline = 1;
        add = -1;
    } else {
        sline = diff + 1;
        eline = w->text_lines;
        add = 1;
    }

    /*
     * current window is never overlapped, so we can just blast away
     */
    sline += spl;
    eline += spl;
    i = sline;
    while( 1 ) {
        txt_s = (char_info *) &w->text[(i * w->width + start) * sizeof( char_info )];
        txt_d = (char_info *) &w->text[((i - diff) * w->width + start) *
                                       sizeof( char_info )];
        scr_d = (char_info _FAR *) &Scrn[(w->x1 + start + (w->y1 + i - diff) *
                                          WindMaxWidth) * sizeof( char_info )];
        for( j = 0; j < w->text_cols; j++ ) {
            WRITE_SCREEN( scr_d[j], txt_s[j] );
            WRITE_SCREEN_DATA( txt_d[j], txt_s[j] );
        }
#ifdef __VIO__
        MyVioShowBuf( (unsigned)((char *) scr_d - Scrn), w->text_cols );
#endif
        if( i == eline ) {
            break;
        }
        i += add;
    }
    ReleaseWindow( w );

} /* ShiftWindowUpDown */
Exemplo n.º 4
0
void TimerThread( void )
{
    char        date[80];
    char_info   *clk;

    while( !exit_thread ) {
        Sleep( 55 );
        ClockTicks++;
        if( EditFlags.ClockActive && EditFlags.SpinningOurWheels &&
            EditFlags.Spinning ) {
            (*(char_info *)SpinLoc).ch = SpinData[SpinCount];
            MyVioShowBuf( SpinLoc-Scrn, 1 );
            SpinCount++;
            if( SpinCount >= 4 ) {
                SpinCount = 0;
            }
        }
        if( (ClockTicks % 9) != 0 ) {
            continue;
        }
        GetDateTimeString( date );
        if( EditFlags.ClockActive && EditFlags.Clock ) {
            int bytes = 5;
            clk = (char_info *) ClockStart;
            if( EditFlags.DisplaySeconds ) {
                clk[7].ch = date[DATE_LEN - 1];
                clk[6].ch = date[DATE_LEN - 2];
                clk[5].ch = ':';
                bytes = 8;
            }
            clk[4].ch = date[DATE_LEN - 4];
            clk[3].ch = date[DATE_LEN - 5];
            clk[2].ch = ':';
            clk[1].ch = date[DATE_LEN - 7];
            clk[0].ch = date[DATE_LEN - 8];
            MyVioShowBuf( ClockStart - Scrn, bytes );
        }
    }
    ExitThread( 0 );
}
Exemplo n.º 5
0
/*
 * clearSpin - clear spin area
 */
static void clearSpin( void )
{
    if( EditFlags.Spinning ) {
#if !defined(__WIN__)
        SpinLoc->cinfo_char = ' ';
#endif
#ifdef __VIO__
        MyVioShowBuf( SpinLoc - Scrn, 1 );
#endif
        EditFlags.SpinningOurWheels = false;
    }

} /* clearSpin */
Exemplo n.º 6
0
/*
 * ClearWindow - do just that
 */
void ClearWindow( window_id wn )
{
    wind                *w;
    window_id           *over;
    char_info           *txt;
    char_info           _FAR *scr;
    unsigned            oscr;
    int                 j, i, shift, addr;
    char_info           what = {0, 0};

    if( EditFlags.Quiet ) {
        return;
    }
    w = AccessWindow( wn );

    /*
     * clear text area
     */
    what.cinfo_char = ' ';
    what.cinfo_attr = MAKE_ATTR( w, w->text_color, w->background_color );
    shift = 0;
    addr = 0;
    if( w->has_border ) {
        shift = 1;
        addr = w->width + shift;
    }
    for( j = w->y1 + shift; j <= w->y2 - shift; j++ ) {
        oscr = w->x1 + shift + j * EditVars.WindMaxWidth;
        scr = &Scrn[oscr];
        txt = &(w->text[addr]);
        over = &(w->overlap[addr]);
        for( i = w->x1 + shift; i <= w->x2 - shift; i++ ) {
            WRITE_SCREEN_DATA( *txt++, what );
            if( *over++ == NO_WINDOW ) {
                WRITE_SCREEN( *scr, what );
            }
            scr++;
        }
#ifdef __VIO__
        MyVioShowBuf( oscr, w->width - 2 * shift ); // inside of window only
#endif
        addr += w->width;
    }

    ReleaseWindow( w );

} /* ClearWindow */
Exemplo n.º 7
0
/*
 * reDisplayWindow - redisplay the saved window text
 */
static void reDisplayWindow( window_id wn )
{
    wind                *w;
    char_info           *txt;
    window_id           *over;
    char_info           _FAR *scr;
    unsigned            oscr;
    int                 j, i;

    if( EditFlags.Quiet ) {
        return;
    }
    w = AccessWindow( wn );

    /*
     * re-display text area
     */
    txt = w->text;
    over = w->overlap;
    for( j = w->y1; j <= w->y2; j++ ) {
        oscr = w->x1 + j * EditVars.WindMaxWidth;
        scr = &Scrn[oscr];
        for( i = w->x1; i <= w->x2; i++ ) {
            if( *over++ == NO_WINDOW ) {
                WRITE_SCREEN( *scr, *txt );
            }
            scr++;
            txt++;
        }
#ifdef __VIO__
        MyVioShowBuf( oscr, w->width );
#endif
    }

    DrawBorder( wn );
    ReleaseWindow( w );

} /* reDisplayWindow */
Exemplo n.º 8
0
/*
 * RestoreOverlap - restore overlap information from a window that is
 *                  "going away" - either relocating or dying
 */
void RestoreOverlap( window_id wn, bool scrflag )
{
    wind                *w, *wo, *o;
    int                 i, j, k, l;
    char                *whoover, *over, *img;
    char_info           _FAR *scr;
#ifdef __VIO__
    unsigned            oscr;
#endif

    if( EditFlags.Quiet ) {
        scrflag = FALSE;
    }
    w = AccessWindow( wn );
    whoover = w->whooverlapping;
    over = w->overlap;

    for( j = w->y1; j <= w->y2; j++ ) {
        if( scrflag ) {
            scr = (char_info _FAR *) &Scrn[(w->x1 + j * WindMaxWidth) *
                                           sizeof( char_info )];
#ifdef __VIO__
            oscr = (unsigned) ((char *)scr - Scrn);
#endif
        }
        img = &ScreenImage[w->x1 + j * WindMaxWidth];
        for( i = w->x1; i <= w->x2; i++ ) {

            /*
             * if we are over someone, then reset the screen
             * with the proper information
             *
             * if we are not over someone, check for over us
             */
            if( *whoover != NO_CHAR ) {
                wo = AccessWindow( *whoover );
                k = (i - wo->x1) + (j - wo->y1) * wo->width;
                /*
                 * if we are being overlapped at the same
                 * spot, then point the guy overlapping us
                 * at the guy we are overlapping
                 *
                 * otherwise, mark the guy we are overlapping
                 * as not being overlapped, and restore his
                 * text to the screen
                 */
                if( *over != NO_CHAR ) {
                    o = AccessWindow( *over );
                    l = (i - o->x1) + (j - o->y1) * o->width;
                    o->whooverlapping[l] = *whoover;
                    wo->overlap[k] = *over;
                    ReleaseWindow( o );
                } else {
                    wo->overlap[k] = NO_CHAR;
                    wo->overcnt[j - wo->y1]--;
                    if( scrflag ) {
                        WRITE_SCREEN( *scr, ((char_info *)wo->text)[k] );
                    }
                    *img = *whoover;
                }
                ReleaseWindow( wo );
            } else {
                /*
                 * we are not overlapping anyone, so
                 * see if anyone is overlapping us;
                 * if so, reset them to be not overlapping
                 * anyone
                 *
                 * if not, clear the screen
                 */
                if( *over != NO_CHAR ) {
                    o = AccessWindow( *over );
                    l = (i - o->x1) + (j - o->y1) * o->width;
                    o->whooverlapping[l] = NO_CHAR;
                    ReleaseWindow( o );
                } else {
                    if( scrflag ) {
                        WRITE_SCREEN( *scr, WindowNormalAttribute );
                    }
                    *img = NO_CHAR;
                }
            }
            img++;
            over++;
            whoover++;
            if( scrflag ) {
                scr++;
            }
        }
#ifdef __VIO__
        if( scrflag ) {
            MyVioShowBuf( oscr, w->width );
        }
#endif

    }
    ReleaseWindow( w );

} /* RestoreOverlap */
Exemplo n.º 9
0
/*
 * DrawBorder - display border
 */
void DrawBorder( window_id wn )
{
    wind                *w;
    int                 i, j, k, stc, etc, ctc;
    int                 tl, bl, tr, br;
    int                 xtl, xbl, xtr, xbr;
    char                *over, c;
    unsigned short      clr;
    char_info           what, what2;
    char_info           _FAR *scr;
    char_info           *txt;
    int                 topscol, topecol, topccol;
    char                *wb;

    if( EditFlags.Quiet ) {
        return;
    }
    if( !Windows[wn]->has_border ) {
        return;
    }
    w = AccessWindow( wn );
    txt = (char_info *) w->text;
    over = w->overlap;
    scr = (char_info _FAR *) Scrn;

    if( w->has_gadgets ) {
        wb = GadgetString;
    } else {
        wb = WindowBordersNG;
    }

    /*
     * set up for border addendums (title and misc top data)
     */
    if( w->title != NULL ) {
        stc = (w->width - strlen( w->title )) / 2 - 1;
        if( stc < 1 ) {
            stc = 1;
        }
        etc = stc + strlen( w->title ) + 1;
        ctc = 0;
    }
    if( w->borderdata != NULL ) {
        topscol = w->bordercol;
        topecol = topscol + strlen( w->borderdata ) - 1;
        topccol = 0;
    }

    tl = (w->x1) + (w->y1) * WindMaxWidth;
    tr = (w->x2) + (w->y1) * WindMaxWidth;
    bl = (w->x1) + (w->y2) * WindMaxWidth;
    br = (w->x2) + (w->y2) * WindMaxWidth;
    xtl = 0;
    xtr = w->width - 1;
    xbl = (w->height - 1) * w->width;
    xbr = w->width - 1 + (w->height - 1) * w->width;
    clr = MAKE_ATTR( w, w->border_color1, w->border_color2 );
    what.attr = clr;
    what2.attr = clr;

    /*
     * do the corner pieces
     */
    what.ch = wb[WB_TOPLEFT];
    WRITE_SCREEN_DATA( txt[xtl], what );
    if( over[xtl] == NO_CHAR ) {
        WRITE_SCREEN( scr[tl], what );
    }
    what.ch = wb[WB_TOPRIGHT];
    WRITE_SCREEN_DATA( txt[xtr], what );
    if( over[xtr] == NO_CHAR ) {
        WRITE_SCREEN( scr[tr], what );
    }
    what.ch = wb[WB_BOTTOMLEFT];
    WRITE_SCREEN_DATA( txt[xbl], what );
    if( over[xbl] == NO_CHAR ) {
        WRITE_SCREEN( scr[bl], what );
    }
    what.ch = wb[WB_BOTTOMRIGHT];
    WRITE_SCREEN_DATA( txt[xbr], what );
    if( over[xbr] == NO_CHAR ) {
        WRITE_SCREEN( scr[br], what );
    }

    /*
     * do the left side
     */
    what.ch = wb[WB_LEFTSIDE];
    k = xtl + w->width;
    j = tl + WindMaxWidth;
    for( i = 1; i < w->height - 1; i++ ) {
        WRITE_SCREEN_DATA( txt[k], what );
        if( over[k] == NO_CHAR ) {
            WRITE_SCREEN( scr[j], what );
#ifdef __VIO__
            MyVioShowBuf( sizeof( char_info ) * j, 1 );
#endif
        }
        k += w->width;
        j += WindMaxWidth;
    }

    /*
     * do the right side
     */
    what.ch = wb[WB_RIGHTSIDE];
    k = xtr + w->width;
    j = tr + WindMaxWidth;
    for( i = 1; i < w->height - 1; i++ ) {
        WRITE_SCREEN_DATA( txt[k], what );
        if( over[k] == NO_CHAR ) {
            WRITE_SCREEN( scr[j], what );
#ifdef __VIO__
            MyVioShowBuf( sizeof( char_info ) * j, 1 );
#endif
        }
        k += w->width;
        j += WindMaxWidth;
    }

    /*
     * now do bottom and top
     */
    what2.ch = wb[WB_TOPBOTTOM];
    for( i = 1; i < w->width - 1; i++ ) {
        k = xtl + i;
        c = wb[5];
        if( w->title != NULL ) {
            if( i >= stc && i <= etc ) {
                if( i == stc ) {
                    c = wb[WB_RIGHTT];
                } else if( i == etc ) {
                    c = wb[WB_LEFTT];
                } else {
                    c = w->title[ctc++];
                }
            }
        }
        if( w->borderdata != NULL ) {
            if( i >= topscol && i <= topecol ) {
                c = w->borderdata[topccol++];
            }
        }
        what.ch = c;
        WRITE_SCREEN_DATA( txt[k], what );
        if( over[k] == NO_CHAR ) {
            WRITE_SCREEN( scr[tl + i] , what );
        }

        k = xbl + i;
        WRITE_SCREEN_DATA( txt[k], what2 );
        if( over[k] == NO_CHAR ) {
            WRITE_SCREEN( scr[bl + i] , what2 );
        }
    }

    /*
     * add side gadgets
     */
    if( w->has_gadgets || w->has_scroll_gadgets ) {
        what.ch = wb[WB_UPTRIANGLE];
        WRITE_SCREEN_DATA( txt[xtr + w->width], what );
        if( over[xtr + w->width] == NO_CHAR ) {
            WRITE_SCREEN( scr[tr + WindMaxWidth], what );
#ifdef __VIO__
            MyVioShowBuf( sizeof( char_info ) * (tr + WindMaxWidth), 1 );
#endif
        }
        what.ch = wb[WB_DOWNTRIANGLE];
        WRITE_SCREEN_DATA( txt[xbr - w->width], what );
        if( over[xbr - w->width] == NO_CHAR ) {
            WRITE_SCREEN( scr[br - WindMaxWidth], what );
#ifdef __VIO__
            MyVioShowBuf( sizeof( char_info ) * (br - WindMaxWidth), 1 );
#endif
        }
    }
#ifdef __VIO__
    MyVioShowBuf( sizeof( char_info ) * tl, w->width );
    MyVioShowBuf( sizeof( char_info ) * bl, w->width );
#endif
    if( w->has_gadgets ) {
        DrawVerticalThumb( w, GadgetString[WB_THUMB] );
    }
    ReleaseWindow( w );

} /* DrawBorder */
Exemplo n.º 10
0
/*
 * displayLineInWindowGeneric - takes an ss_block directly
 */
vi_rc displayLineInWindowGeneric( window_id wn, int c_line_no,
                                char *text, int start_col, ss_block *ss )
{
    wind                *w;
    char_info           *txt;
    char                *over, *tmp, *otmp;
    char_info           _FAR *scr;
    int                 addr, start, end, a, spend;
    int                 cnt1, cnt2, startc, spl;
    char_info           blank, what;
#ifdef __VIO__
    unsigned            oscr;
    unsigned            tbytes;
#endif
    bool                has_mouse, write_eol;
    unsigned            ss_i; // index into text, not ss[ss_i]

    if( EditFlags.Quiet ) {
        return( ERR_NO_ERR );
    }
    w = Windows[wn];

    write_eol = FALSE;
    if( EditFlags.RealTabs ) {
        a = strlen( text );
        otmp = tmp = StaticAlloc();
        ExpandTabsInABuffer( text, a, tmp, MaxLinem1 + 2 );
    } else {
        tmp = text;
    }
    tmp += start_col;
    a = strlen( tmp );

    /*
     * find dimensions of line
     */
    if( w->has_border ) {
        if( c_line_no < 1 || c_line_no > w->height - 2 ) {
            if( EditFlags.RealTabs ) {
                StaticFree( otmp );
            }
            return( ERR_WIND_NO_SUCH_LINE );
        }
        start = 1;
        spl = c_line_no;
        spend = end = w->width - 1;
        if( a < end - 1 ) {
            end = a + 1;
        } else if( a >= end ) {
            write_eol = TRUE;
        }
    } else {
        if( c_line_no < 1 || c_line_no > w->height ) {
            if( EditFlags.RealTabs ) {
                StaticFree( otmp );
            }
            return( ERR_WIND_NO_SUCH_LINE );
        }
        start = 0;
        spl = c_line_no - 1;
        spend = end = w->width;
        if( a < end ) {
            end = a;
        } else if( a > end ) {
            write_eol = TRUE;
        }
    }
    startc = start;
    cnt1 = end - start;
    cnt2 = spend - end;

    c_line_no--;
    w = AccessWindow( wn );

    /*
     * initialize
     */
    addr = startc + spl * w->width;
    txt = (char_info *) &(w->text[sizeof( char_info ) * addr]);
    scr = (char_info _FAR *) &Scrn[(w->x1 + startc +
                                   (spl + w->y1) * WindMaxWidth) * sizeof(char_info)];
#ifdef __VIO__
    oscr = (unsigned) ((char *) scr - Scrn);
    tbytes = cnt1 + cnt2;
#endif

    ss_i = 0;
    what.attr = MAKE_ATTR( w, SEType[ss->type].foreground,
                              SEType[ss->type].background );
    blank.ch = ' ';

    has_mouse = DisplayMouse( FALSE );

    /*
     * display line
     */
    if( w->overcnt[spl] ) {
        over = &(w->overlap[addr]);
        while( cnt1-- != 0 ) {
            what.ch = (*tmp);
            WRITE_SCREEN_DATA( *txt, what );
            if( *over++ == NO_CHAR ) {
                WRITE_SCREEN( *scr, what );
            }
            tmp++;
            scr++;
            txt++;
            if( ++ss_i > ss->end ) {
                ss++;
                what.attr = MAKE_ATTR( w, SEType[ss->type].foreground,
                                          SEType[ss->type].background );
            }
        }
        if( write_eol && *(over - 1) == NO_CHAR ) {
            WriteLongLineMarker( wn, &( SEType[SE_EOFTEXT] ),
                                 txt - 1, scr - 1, *(tmp - 1) );
        } else {
            blank.attr = MAKE_ATTR( w, SEType[ss->type].foreground,
                                       SEType[ss->type].background );
            while( cnt2-- != 0 ) {
                WRITE_SCREEN_DATA( *txt, blank );
                if( *over++ == NO_CHAR ) {
                    WRITE_SCREEN( *scr, blank );
                }
                scr++;
                txt++;
            }
        }
    } else {
        while( cnt1-- != 0 ) {
            what.ch = (*tmp);
            WRITE_SCREEN_DATA( *txt, what );
            WRITE_SCREEN( *scr, what );
            scr++;
            txt++;
            tmp++;
            if( ++ss_i > ss->end ) {
                ss++;
                what.attr = MAKE_ATTR( w, SEType[ss->type].foreground,
                                          SEType[ss->type].background );
            }
        }
        if( write_eol ) {
            WriteLongLineMarker( wn, &( SEType[SE_EOFTEXT] ),
                                 txt - 1, scr - 1, *(tmp - 1) );
        } else {
            blank.attr = MAKE_ATTR( w, SEType[ss->type].foreground,
                                       SEType[ss->type].background );
            while( cnt2-- != 0 ) {
                WRITE_SCREEN_DATA( *txt, blank );
                WRITE_SCREEN( *scr, blank );
                txt++;
                scr++;
            }
        }
    }

#ifdef __VIO__
    MyVioShowBuf( oscr, tbytes );
#endif
    if( EditFlags.RealTabs ) {
        StaticFree( otmp );
    }
    ReleaseWindow( w );
    DisplayMouse( has_mouse );
    return( ERR_NO_ERR );

} /* displayLineInWindowGeneric */
Exemplo n.º 11
0
/*
 * SetCharInWindowWithColor - do just that, using given colors
 */
vi_rc SetCharInWindowWithColor( window_id wn, int line, int col, char text,
                              type_style *style )
{
    wind                *w;
    char                *over;
    int                 attr, addr, start, spl;
    char_info           tmp;
    char_info           *txt;
    char_info           _FAR *scr;
    bool                has_mouse;

    if( EditFlags.Quiet ) {
        return( ERR_NO_ERR );
    }
    w = Windows[wn];

    /*
     * find dimensions of line
     */
    if( w->has_border ) {
        if( line < 1 || line > w->height - 2 ) {
            return( ERR_WIND_NO_SUCH_LINE );
        }
        start = 1;
        spl = line;
    } else {
        if( line < 1 || line > w->height ) {
            return( ERR_WIND_NO_SUCH_LINE );
        }
        start = 0;
        spl = line - 1;
    }
    if( col < 1 || col > w->width ) {
        return( ERR_WIND_NO_SUCH_COLUMN );
    }
    line--;
    col--;

    /*
     * initialize
     */
    w = AccessWindow( wn );
    addr = col + start + spl * w->width;
    txt = (char_info *) &(w->text[sizeof( char_info ) * addr]);
    scr = (char_info _FAR *) &Scrn[(w->x1 + start + col + (spl + w->y1) *
                                    WindMaxWidth) * sizeof( char_info )];
    attr = MAKE_ATTR( w, style->foreground, style->background );

    /*
     * display char
     */
    has_mouse = DisplayMouse( FALSE );
    over = &(w->overlap[addr]);
    tmp.attr = attr;
    tmp.ch = text;
    WRITE_SCREEN_DATA( *txt, tmp );
    if( *over == NO_CHAR ) {
        WRITE_SCREEN( *scr, tmp );
    }
#ifdef __VIO__
    MyVioShowBuf( (unsigned)((char *) scr - Scrn), 1 );
#endif

    ReleaseWindow( w );
    DisplayMouse( has_mouse );
    return( ERR_NO_ERR );

} /* SetCharInWindowWithColor */
Exemplo n.º 12
0
/*
 * changeColorOfDisplayLine - do just that, using given colors and column range
 */
static void changeColorOfDisplayLine( int line, int scol, int ecol, type_style *s )
{
    wind                *w;
    char                *over;
    char_info           _FAR *scr;
    char_info           what;
#ifdef __VIO__
    unsigned            oscr;
    unsigned            onscr;
#endif
    int                 attr, t, end, spend, cnt1, cnt2, sscol, spl;

    if( EditFlags.Quiet ) {
        return;
    }
    w = AccessWindow( CurrentWindow );

    /*
     * find dimensions of line
     */
    if( w->has_border ) {
        if( line < 1 || line > w->height - 2 ) {
            ReleaseWindow( w );
            return;
        }
        spl = line;
        sscol = 1 + scol;
        spend = end = ecol + 2;
        if( spend > w->width - 1 ) {
            spend = end = w->width - 1;
        }
        if( sscol < 1 ) {
            sscol = 1;
        }
    } else {
        if( line < 1 || line > w->height ) {
            ReleaseWindow( w );
            return;
        }
        spl = line - 1;
        sscol = scol;
        spend = end = ecol + 1;
        if( spend > w->width ) {
            spend = end = w->width;
        }
        if( sscol < 0 ) {
            sscol = 0;
        }
    }
    cnt1 = end - sscol;
    cnt2 = spend - end;

    line--;

    /*
     * initialize
     */
    t = sscol + spl * w->width;
    scr = (char_info _FAR *) &Scrn[(w->x1 + sscol + (spl + w->y1) * WindMaxWidth) *
                                   sizeof( char_info )];
#ifdef __VIO__
    oscr = (unsigned) ((char _FAR *) scr - Scrn);
    onscr = 0;
#endif
    attr = MAKE_ATTR( w, s->foreground, s->background );
    what.attr = attr;

    /*
     * display line
     */
    if( w->overcnt[spl] ) {
        over = w->overlap + t;
        while( cnt1-- != 0 ) {
            if( *over++ == NO_CHAR ) {
                what.ch = (*scr).ch;
                WRITE_SCREEN( *scr, what );
#ifdef __VIO__
                onscr++;
#endif
            }
            scr++;
        }
        while( cnt2-- != 0 ) {
            if( *over++ == NO_CHAR ) {
                what.ch = (*scr).ch;
                WRITE_SCREEN( *scr, what );
#ifdef __VIO__
                onscr++;
#endif
            }
            scr++;
        }
    } else {
        while( cnt1-- != 0 ) {
            what.ch = (*scr).ch;
            WRITE_SCREEN( *scr, what );
#ifdef __VIO__
            onscr++;
#endif
            scr++;
        }
        while( cnt2-- != 0 ) {
            what.ch = (*scr).ch;
            WRITE_SCREEN( *scr, what );
#ifdef __VIO__
            onscr++;
#endif
            scr++;
        }
    }
#ifdef __VIO__
    MyVioShowBuf( oscr, onscr );
#endif
    ReleaseWindow( w );

} /* changeColorOfDisplayLine */
Exemplo n.º 13
0
/*
 * DisplayCrossLineInWindow - do just that, using given colors
 */
void DisplayCrossLineInWindow( window_id wn, int line )
{
    wind                *w;
    char                *over;
    char_info           *txt;
    char_info           _FAR *scr;
#ifdef __VIO__
    unsigned            oscr;
#endif
    int                 addr, i;
    char_info           what;

    if( EditFlags.Quiet ) {
        return;
    }
    w = Windows[wn];

    /*
     * find dimensions of line
     */
    if( !w->has_border ) {
        return;
    }
    if( line < 1 || line > w->height - 2 ) {
        return;
    }
    line--;

    /*
     * initialize
     */
    w = AccessWindow( wn );
    addr = 1 + (1 + line) * w->width;
    txt = (char_info *) &(w->text[sizeof( char_info ) * addr]);
    scr = (char_info _FAR *) &Scrn[(w->x1 + (1 + line + w->y1) * WindMaxWidth) *
                                    sizeof( char_info )];
#ifdef __VIO__
    oscr = (unsigned) ((char _FAR *) (scr) - Scrn);
#endif
    what.attr = MAKE_ATTR( w, w->border_color1, w->border_color2 );
    what.ch = WindowBordersNG[WB_LEFTT];

    over = &(w->overlap[addr]);
    if( *over++ == NO_CHAR ) {
        WRITE_SCREEN( *scr, what );
    }
    WRITE_SCREEN_DATA( *txt, what );
    txt++;
    scr++;

    what.ch = WindowBordersNG[WB_TOPBOTTOM];
    for( i = w->x1 + 1; i < w->x2; i++ ) {
        if( *over++ == NO_CHAR ) {
            WRITE_SCREEN( *scr, what );
        }
        WRITE_SCREEN_DATA( *txt, what );
        txt++;
        scr++;
    }

    if( line != w->height - 3 && line != 0 ) {
        what.ch = WindowBordersNG[WB_RIGHTT];
        WRITE_SCREEN_DATA( *txt, what );
        if( *over == NO_CHAR ) {
            WRITE_SCREEN( *scr, what );
        }
        scr++;
        txt++;
    }

#ifdef __VIO__
    MyVioShowBuf( oscr, w->width );
#endif
    ReleaseWindow( w );

} /* DisplayCrossLineInWindow */