Ejemplo n.º 1
0
void
CPictFile::LineRight()
{
	int	xpoint, ypoint;

	putc ( RGBfgndOp[0], m_OutFile );
	putc ( RGBfgndOp[1], m_OutFile );

	PutColor( RGB(0,0,0) );

	putc ( PenPattOp[0], m_OutFile );
	putc ( PenPattOp[1], m_OutFile );
	putc ( -1, m_OutFile );
	putc ( -1, m_OutFile );
	putc ( -1, m_OutFile );
	putc ( -1, m_OutFile );
	putc ( -1, m_OutFile );
	putc ( -1, m_OutFile );
	putc ( -1, m_OutFile );
	putc ( -1, m_OutFile );

              	
	putc ( LineOp[0], m_OutFile );
	putc ( LineOp[1], m_OutFile );

	xpoint = m_xpos + m_dev_xsize - m_dev_xsize - 1;
	ypoint = m_ypos - m_dev_ysize;
	MakePoint( xpoint, ypoint );
	xpoint = m_xpos + m_dev_xsize - m_dev_xsize - 1;
	ypoint = m_ypos - 1;
	MakePoint( xpoint, ypoint );
             
	return;
}
Ejemplo n.º 2
0
/*** Replace - edit character in a file
*
* Purpose:
*   Replace will take the specified character and place it into the
*   specified position in the specified file.  If the edit is a NOP
*   (overstriking the same character) then no modification takes place
*
* Input:
*   c		character to edit in file
*   x, y	column, row of file to be changed
*   pFile	file being modified
*   fInsert	TRUE => character is inserted before the position
*
* Output:
*    TRUE => line was successfully edited, FALSE => line was too long
*
* Notes:
*
*************************************************************************/
flagType
Replace (
    char    c,
    COL     x,
    LINE    y,
    PFILE   pFile,
    flagType fInsert
    )
{
    linebuf buf;                             /* working buffer               */
    struct  lineAttr rgla[sizeof(linebuf)];
    flagType fColor = FALSE, fSpace = 0;
    char    *pxLog;

    fColor = GetColor (y, rgla, pFile);

    if (fInsSpaceColor (x, y, fInsert ? 1 : 0, pFile, buf, fColor ? rgla : NULL)) {

        pxLog = pLog (buf, x, TRUE);

        if (cbLog(buf) <= x) {

            /*
             * If the logical length of the buffer is less than what we need, then it was
             * at least space filled by fInsert, and we just need to append our character
             * to the buffer
             */

            *(unsigned int UNALIGNED *)pxLog = (unsigned int)(unsigned char)c;

        } else if (fInsert || (*pxLog != c)) {

            /*
             * if we're inserting, or the character we're overtyping is different, place
             * the character. Be sure to check the new logical length of the line as well,
             * in case it was a tab that overflowed it.
             */

            *pxLog = c;
            if (cbLog(buf) >= sizeof(linebuf)) {
                return FALSE;
            }
        }

        if (fInsert) {
            MarkCopyBox (pFile, pFile, x, y, sizeof(linebuf), y, x+1, y);
        }

        PutLine (y, buf, pFile);
        if (fColor) {
            ColorToLog (rgla, buf);
            PutColor (y, rgla, pFile);
        }
        return TRUE;
    }
    return FALSE;
}
Ejemplo n.º 3
0
STRONG_INLINE void ColorPutter<bpp, incrementPtr>::PutColorAlphaSwitch(Uint8 *&ptr, const Uint8 & R, const Uint8 & G, const Uint8 & B, const Uint8 & A)
{
	switch (A)
	{
	case 255:
		ptr += bpp * incrementPtr;
		return;
	case 0:
		PutColor(ptr, R, G, B);
		return;
	case 128:  // optimized
		PutColor(ptr,	((Uint16)R + (Uint16)ptr[2]) >> 1, 
			((Uint16)G + (Uint16)ptr[1]) >> 1, 
			((Uint16)B + (Uint16)ptr[0]) >> 1);
		return;
	default:
		PutColor(ptr, R, G, B, A);
		return;
	}
}
Ejemplo n.º 4
0
void
CPictFile::CharOut( char c, COLORREF ForeGround, COLORREF BackGround )
{
	int	xpoint, ypoint;

	putc ( RGBfgndOp[0], m_OutFile );
	putc ( RGBfgndOp[1], m_OutFile );

	PutColor( BackGround );
              	
	putc ( PaintRectOp[0], m_OutFile );
	putc ( PaintRectOp[1], m_OutFile );
	xpoint = m_xpos;
	ypoint = m_ypos - m_dev_ysize;
	MakePoint( xpoint, ypoint );
	xpoint = m_xpos + m_dev_xsize;
	ypoint = m_ypos;
	MakePoint( xpoint, ypoint );
             
	putc( RGBfgndOp[0], m_OutFile );
	putc( RGBfgndOp[1], m_OutFile );

	PutColor( ForeGround );

	putc ( LongTextOp[0], m_OutFile );
	putc ( LongTextOp[1], m_OutFile );

	xpoint = m_xpos;
	ypoint = m_ypos - m_fontdescent;

	MakePoint( xpoint, ypoint );

	putc ( 1, m_OutFile );
	putc ( c, m_OutFile );


	m_xpos = m_xpos + m_dev_xsize; // {need to move anyway}

	return;
}
Ejemplo n.º 5
0
void 
CPictFile::SumFillRect( CRect& rect, COLORREF *pColor )
{
	int	xpoint, ypoint;

	putc ( RGBfgndOp[0], m_OutFile );
	putc ( RGBfgndOp[1], m_OutFile );

	PutColor( *pColor );

	putc ( PaintRectOp[0], m_OutFile );
	putc ( PaintRectOp[1], m_OutFile );

	CPoint tl = rect.TopLeft();
	xpoint = m_xpos + tl.x;
	ypoint = m_ypos - m_dev_ysize + tl.y;
	MakePoint( xpoint, ypoint );

	tl = rect.BottomRight();
	xpoint = m_xpos + tl.x;
	ypoint = m_ypos - m_dev_ysize + tl.y;
	MakePoint( xpoint, ypoint );

}
Ejemplo n.º 6
0
STRONG_INLINE void ColorPutter<bpp, incrementPtr>::PutColor(Uint8 *&ptr, const SDL_Color & Color)
{
	PutColor(ptr, Color.r, Color.g, Color.b);
}
Ejemplo n.º 7
0
/*** DoCDelete - perform character deletion
*
*  Delete the character at the current cursor location
*
* Input:
*  fEmacs	- EMACs type delete flag
*
* Output:
*  Returns TRUE on deletion
*
*************************************************************************/
flagType
DoCDelete (
    flagType fEmacs
    ) {

    fl      fl;                             /* file loc to position at      */
    int     x;
    char    *p;
    linebuf tempbuf;
    struct lineAttr rgla[sizeof(linebuf)];
    flagType fColor;

    fl.col = XCUR(pInsCur);
    fl.lin = YCUR(pInsCur);
    /*
     * xCursor is zero. If yCursor is also zero (top of file), we can't move
     * back, so nothing to delete. Otherwise, move to end of previous line, and
     * if emacs & insert mode, join the lines.
     */
    if (fl.col == 0) {
        if (fl.lin == 0) {
            return FALSE;
        } else {
            fl.lin--;
            fl.col = LineLength (fl.lin, pFileHead);
            if (fInsert && fEmacs) {
                DelStream (pFileHead, fl.col, fl.lin, 0, fl.lin + 1);
            }
        }
    } else {
        /*
         * column is non-zero, so back it up one.
         */
        GetLine (fl.lin, tempbuf, pFileHead);
        x = cbLog (tempbuf);
        fl.col = DecCol (fl.col, tempbuf);
        /*
         * we're in the middle of a line. If in insert mode, back up the cursor, and
         * delete the character there.
         */
        if (fInsert) {
            DelBox (pFileHead, fl.col, fl.lin, fl.col, fl.lin);
        } else {
            /*
             * we're in the middle of a line, but not insert mode. Get the text of the
             * line & pointer to character.
             */
            p = pLog (tempbuf, fl.col, TRUE);
            /*
             * If emacs, and we're actually IN text, then replace the character with a
             * space.
             */
            if (fEmacs) {
                if (fl.col+1 <= x && *p != ' ') {
                    *p = ' ';
                    // SetColor (pFileHead, fl.lin, fl.col, 1, fgColor);
                    PutLine (fl.lin, tempbuf, pFileHead);
                }
            }
            /*
             * if we're beyond the end of the line, just position to the end of the line.
             */
            else if (fl.col+1 > x) {
                fl.col = x;
            }
            /*
             * if the first non-blank character is PAST the current position, then just
             * position at the begining of the line.
             */
            else if ((colPhys (tempbuf, whiteskip (tempbuf)) > fl.col)) {
                fl.col = 0;
            }
            /*
             * finaly, when all else fails, back up, and replace the character under the
             * cursor with a space.
             */
            else if (*p != ' ') {
                *pLog (tempbuf,fl.col,TRUE) = ' ';
                if (fColor = GetColor (fl.lin, rgla, pFileHead)) {
                    ShiftColor (rgla, fl.col, -1);
                    ColorToLog (rgla, buf);
                }
                PutLine (fl.lin, tempbuf, pFileHead);
                if (fColor) {
                    PutColor (fl.lin, rgla, pFileHead);
                }
            }
        }
    }
    cursorfl (fl);

    return TRUE;
}