home *** CD-ROM | disk | FTP | other *** search
- /* amiga_render.c -- Rendering for AmigaDOS
- Copyright (C) 1993, 1994 John Harper <jsh@ukc.ac.uk>
-
- This file is part of Jade.
-
- Jade is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- Jade is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Jade; see the file COPYING. If not, write to
- the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
- #include "jade.h"
- #include "jade_protos.h"
-
- #ifdef _DCC
- # define GfxBase_DECLARED
- #endif
- #include <clib/graphics_protos.h>
- #include <graphics/gfxbase.h>
- #include <graphics/gfxmacros.h>
-
- _PR void redrawcmdline(VW *, u_char *, u_char *, long, long);
- _PR void redrawcmdlinefrom(VW *, u_char *, u_char*, long, long, long);
- _PR void restorecmdline(VW *);
- _PR void cmdlncursor(VW *, bool);
- _PR void scrollvw(VW *, long);
-
- extern struct GfxBase *GfxBase;
-
- /*
- */
- void
- redrawcmdline(VW *vw, u_char *prompt, u_char *cmdLine, long promptLen, long cmdLen)
- {
- short yclr = ((vw->vw_MaxY - 1) * vw->vw_FontY) + vw->vw_YStartPix;
- CLR_RECT(vw, vw->vw_XStartPix, yclr, vw->vw_XEndPix, yclr + vw->vw_FontY);
- MOVE(vw, vw->vw_XStartPix, ((vw->vw_MaxY - 1) * vw->vw_FontY) + vw->vw_FontStart);
- drawbit(vw, P_TEXT, prompt, 100000, 0, promptLen + 1);
- drawbit(vw, P_TEXT, cmdLine - promptLen, 100000, promptLen,
- cmdLen + promptLen + 1);
- }
-
- void
- redrawcmdlinefrom(VW *vw, u_char *prompt, u_char *cmdLine, long promptLen, long cmdLen, long startPos)
- {
- struct RastPort *rp = vw->vw_WindowSys.ws_Rp;
- short yclr = ((vw->vw_MaxY - 1) * vw->vw_FontY) + vw->vw_YStartPix;
- short xord;
- if(startPos < vw->vw_StartCol)
- startPos = vw->vw_StartCol;
- if(startPos < (vw->vw_StartCol + vw->vw_MaxX))
- {
- xord = vw->vw_XStartPix + (startPos * vw->vw_FontX);
- CLR_RECT(vw, xord, yclr, vw->vw_XEndPix, yclr + vw->vw_FontY);
- MOVE(vw, xord, ((vw->vw_MaxY - 1) * vw->vw_FontY) + vw->vw_FontStart);
- if(startPos < promptLen)
- {
- drawbit(vw, P_TEXT, prompt, 100000, startPos, promptLen + 1);
- drawbit(vw, P_TEXT, cmdLine - promptLen, 100000, promptLen,
- cmdLen + promptLen + 1);
- }
- else
- drawbit(vw, P_TEXT, cmdLine - promptLen, 100000,
- startPos, cmdLen + promptLen + 1);
- }
- }
-
- /*
- * redraws the line which the command line overwrote
- */
- void
- restorecmdline(VW *vw)
- {
- TX *tx = vw->vw_LastRefTx ? vw->vw_LastRefTx : vw->vw_Tx;
- short yord = ((vw->vw_MaxY - 1) * vw->vw_FontY) + vw->vw_YStartPix;
- long linenum = vw->vw_StartLine + vw->vw_MaxY - 1;
- CLR_RECT(vw, vw->vw_XStartPix, yord, vw->vw_XEndPix, yord + vw->vw_FontY);
- if(tx->tx_NumLines > linenum)
- {
- pentoline(vw, vw->vw_MaxY - 1);
- drawline(vw, tx->tx_Lines + linenum, linenum);
- }
- }
-
- /*
- * draws the cursor for the command line
- */
- void
- cmdlncursor(VW *vw, bool status)
- {
- struct RastPort *rp = vw->vw_WindowSys.ws_Rp;
- if(status == CURS_ON)
- {
- SetAPen(rp, 1);
- SetDrMd(rp, JAM1 | INVERSVID);
- }
- else
- {
- SetAPen(rp, 1);
- SetDrMd(rp, JAM1);
- }
- Move(rp, vw->vw_XStartPix + ((vw->vw_CursorPos.pos_Col - vw->vw_StartCol) * vw->vw_FontX), ((vw->vw_MaxY - 1) * vw->vw_FontY) + vw->vw_FontStart);
- Text(rp, " ", 1);
- }
-
- /*
- * Scrolls the view `lines' towards line 0,
- */
- void
- scrollvw(VW *vw, long lines)
- {
- struct RastPort *rp = vw->vw_WindowSys.ws_Rp;
- ScrollRaster(rp, 0, lines * vw->vw_FontY, vw->vw_XStartPix,
- vw->vw_YStartPix, vw->vw_XEndPix,
- vw->vw_YStartPix + (vw->vw_MaxY * vw->vw_FontY) - 1);
- }
-