home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ User's Journal & Wi…eveloper's Journal Tools
/
C-C__Users_Journal_and_Windows_Developers_Journal_Tools_1997.iso
/
windbase
/
windbase.exe
/
MEMSLC.3
/
EDITOR
/
SCREEN.C
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-18
|
9KB
|
287 lines
/*****************************************************************************\
** **
** WW WW IIIIIIII NNN NN DDDDDDD BBBBBBB AA SSSSSS EEEEEEEE **
** WW W WW II NNNN NN DD DD BB BB AA AA SS EE **
** WW W WW II NN NN NN DD DD BBBBBBB AAAAAAAA SSSSSS EEEEEE **
** WW W WW II NN NNNN DD DD BB BB AA AA SS EE **
** WWWWW IIIIIIII NN NNN DDDDDDD BBBBBBB AA AA SSSSSS EEEEEEEE **
** **
** SSSSSS OOOOOO FFFFFFFF TTTTTTTT WW WW AA RRRRRRR EEEEEEEE **
** SS OO OO FF TT WW W WW AA AA RR RR EE **
** SSSSS OO OO FFFFF TT WW W WW AAAAAAAA RRRRRRR EEEEEE **
** SS OO OO FF TT WW W WW AA AA RR RR EE **
** SSSSSS OOOOOO FF TT WWWWW AA AA RR RR EEEEEEEE **
** **
*********** NOTICE ************************************************************
** This file contains valuable trade secrets and proprietary **
** assets of Windbase Software Inc. Embodying substantial **
** creative efforts and confidential information. Unauthorized **
** use, copying, decompiling, translating, disclosure or **
** transfer, of any kind, is strictly prohibited. **
** **
** COPYRIGHT (C) 1992, 1993, 1994. Windbase Software Inc. **
** ALL RIGHTS RESERVED. **
\*****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <string.h>
#include <malloc.h>
#include <dos.h>
#include "../../memsl.h"
#include "port.h"
#include "vedt.h"
/***************************************************************************\
**
\***************************************************************************/
void FillScreen(EDITOR *editor)
{
WBDLIST *dlistptr;
char *strptr;
int i = 0, len;
int p1pos = editor->p1pos-editor->offset,
p2pos = editor->p2pos-editor->offset;
long linenum = 0;
if ((dlistptr = WBDListPointer(editor->dltopscr)) != NULL)
{
i = 0;
if (editor->p1 && editor->p2)
linenum = editor->linenum-editor->row;
strptr = WBDListGet(dlistptr,WB_CURRENT);
while (i <= editor->fillend && strptr != NULL)
{
if (i >= editor->fillstart && i <= editor->fillend)
{
if (strptr == editor->strptr)
strptr = editor->str;
len = strlen(strptr+1);
gotoxy(1,1+i);
if (WBDListIsPtrEqual(editor->p1,dlistptr)
&& WBDListIsPtrEqual(editor->p1,editor->p2))
{
if (p1pos < MAXCOL && (p1pos >= 0 || p2pos >= 0))
{
if (p1pos < 0)
p1pos = 0;
if (p2pos > MAXCOL)
p2pos = MAXCOL;
if (editor->offset < len)
scrprintf("%0.*s",p1pos,strptr+1+editor->offset);
else
scrprintf("%0.*s",p1pos,"");
if (editor->hideblock == 0)
reversevideo();
gotoxy(1+p1pos,1+i);
if (p1pos+editor->offset < len)
scrprintf("%0.*s",p2pos-p1pos,strptr+1+p1pos+editor->offset);
if (wherex() < p2pos)
for (p1pos = wherex(); p1pos < p2pos+1; p1pos++)
{
gotoxy(p1pos,1+i);
putch(' ');
}
normvideo();
gotoxy(1+p2pos,1+i);
if (p2pos+editor->offset < len)
scrprintf("%0.*s",MAXCOL-p2pos,strptr+1+p2pos+editor->offset);
}
else
if (editor->offset < len)
scrprintf("%0.*s",MAXCOL,strptr+1+editor->offset);
}
else if (WBDListIsPtrEqual(editor->p1,dlistptr))
{
if (p1pos < MAXCOL)
{
if (p1pos < 0)
p1pos = 0;
if (editor->offset < len)
scrprintf("%0.*s",p1pos,strptr+1+editor->offset);
else
scrprintf("%0.*s",p1pos,"");
if (editor->hideblock == 0)
reversevideo();
gotoxy(1+p1pos,1+i);
if (p1pos+editor->offset < len)
scrprintf("%0.*s",MAXCOL-p1pos,strptr+1+p1pos+editor->offset);
}
else
if (editor->offset < len)
scrprintf("%0.*s",MAXCOL,strptr+1+editor->offset);
}
else if (WBDListIsPtrEqual(editor->p2,dlistptr))
{
if (p2pos > 0)
{
if (p2pos > MAXCOL)
p2pos = MAXCOL;
if (editor->hideblock == 0)
reversevideo();
if (editor->offset < len)
scrprintf("%0.*s",p2pos,strptr+1+editor->offset);
if (wherex() < p2pos)
for (p1pos = wherex(); p1pos < p2pos+1; p1pos++)
{
gotoxy(p1pos,1+i);
putch(' ');
}
normvideo();
gotoxy(1+p2pos,1+i);
if (p2pos+editor->offset < len)
scrprintf("%0.*s",MAXCOL-p2pos,strptr+1+p2pos+editor->offset);
}
else
if (editor->offset < len)
scrprintf("%0.*s",MAXCOL,strptr+1+editor->offset);
}
else
{
if (editor->p1 && editor->p2)
if (linenum > editor->p1line
&& linenum < editor->p2line
&& editor->hideblock == 0)
reversevideo();
if (editor->offset < len)
scrprintf("%0.*s",MAXCOL,strptr+1+editor->offset);
}
clreol();
normvideo();
}
strptr = WBDListGet(dlistptr,WB_NEXT);
i++; linenum++;
}
normvideo();
while (i <= editor->fillend)
{
gotoxy(1,1+i);
clreol();
i++;
}
WBDListClose(dlistptr);
}
editor->refillscr = editor->fillend = 0;
editor->fillstart = MAXROW-1;
}
/***************************************************************************\
**
\***************************************************************************/
void Draw(EDITOR *editor)
{
if (editor->deltop)
{
gotoxy(1,1);
delline();
editor->deltop = 0;
}
else if (editor->instop)
{
gotoxy(1,1);
insline();
editor->instop = 0;
}
if (editor->refillscr)
FillScreen(editor);
}
/***************************************************************************\
**
\***************************************************************************/
void UpdateCoordinates(EDITOR *editor, int start, int end)
{
editor->refillscr = 1;
if (start < editor->fillstart && start >= 0)
editor->fillstart = start;
if (end > editor->fillend && end <= MAXROW-1)
editor->fillend = end;
}
/***************************************************************************\
**
\***************************************************************************/
void Cursor(int cursorsize)
{
union REGS regs;
regs.h.ah = 01;
switch(cursorsize)
{
case 0:
regs.h.ch|=0x20;
break;
case 1:
regs.h.ch = 1;
regs.h.cl = 14;
break;
case 2:
regs.h.ch = 13;
regs.h.cl = 14;
break;
}
int86(0x10,®s,®s);
}
/***************************************************************************\
**
\***************************************************************************/
void UpdateStats(EDITOR *editor, int updateall)
{
window(1,1,MAXSCRCOL,MAXSCRROW);
reversevideo();
if (updateall)
{
gotoxy(1,24); clreol();
gotoxy(1,25); clreol();
if (editor->viewonly)
{
gotoxy(1,25); scrprintf("View: %s",editor->filename);
}
else
{
gotoxy(1,25); scrprintf("Edit: %s",editor->filename);
gotoxy(26,24); scrprintf("%s",editor->insert?"Ins":"Ovr");
gotoxy(30,24); scrprintf("%s",(*editor->srchoptions&SRCH_FORWARD)?"Fwd":"Bck");
gotoxy(34,24); scrprintf("%s",editor->indent?"AI":" ");
gotoxy(37,24); scrprintf("Tabs: %d",editor->tabspec);
}
gotoxy(56,24);
if (editor->macro_on)
scrprintf("Macro Def");
else if (editor->macro_exe)
scrprintf("Macr