This commit is contained in:
chombier 2001-05-17 10:17:21 +00:00
parent 362ca11c13
commit 031544d54e
16 changed files with 999 additions and 1247 deletions

View File

@ -100,12 +100,14 @@ typedef struct {
realbold,
oldScrollback,
jumpScroll,
realBlink;
realBlink,
vt7bits;
short
padding[100]; // So I'm generous....
padding[99]; // So I'm generous....
} TerminalPrefs;
#define TERMINALPREFS_RESTYPE 'TeR2'
#define TERMINALPREFS_APPID 1991 // The "<Default>" terminal seed copy
#define JPTERMINALPREFS_APPID 1992 // The "<Default>" terminal seed for japan
// Name of each instance is the resource name. Resource type SeSn
typedef struct {
@ -212,6 +214,7 @@ typedef struct {
} SessionPrefs;
#define SESSIONPREFS_RESTYPE 'SeSn'
#define SESSIONPREFS_APPID 1991 // The "<Default>" session seed copy
#define JPSESSIONPREFS_APPID 1992 // The "<Default>" session seed for japan
// Only one instance of this resource type. Resource type PrEf

View File

@ -76,12 +76,15 @@ unsigned short VSIkpnums[] = // RAB BetterTelnet 2.0b5 - macro numbers
0, 80, 81, 83, 82, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 71,
70, 72, 73, 50, 51, 52, 53 };
*/
unsigned short VSIkpnums[] = // RAB BetterTelnet 2.0b5 - macro numbers
{ 24, 25, 26, 22, 27, 28, 0, 40, 0, 42, 0,
// macro numbers
unsigned short VSIkpnums[] = {
24, 25, 26, 22, 27, 28, 0, 40, 0, 42, 0,
43, 0, 29, 0, 41, 0, 44, 58, 56, 54, 59,
23, 57, 21, 55, 20, 27, 0, 0, 0, 0, 0,
90, 91, 93, 92, 70, 71, 72, 73, 74, 75, 76,
77, 78, 79, 81, 80, 82, 83, 50, 51, 52, 53 };
77, 78, 79, 81, 80, 82, 83, 50, 51, 52, 53
};
extern TelInfoRec *TelInfo;
extern WindRec *screens;
@ -89,10 +92,11 @@ extern long TempItemsDirID;
extern short TempItemsVRefNum;
extern short RSa;
short
/* Internal variables for use in managing windows */
VSmax = 0, /* max nr screens allowed */
VSinuse = 0; /* nr screens actually in existence */
extern void syslog( int priority, const char *format, ...);
/* Internal variables for use in managing windows */
short VSmax = 0; /* max nr screens allowed */
short VSinuse = 0; /* nr screens actually in existence */
VSscrndata *VSscreens;
short VSinit
@ -100,21 +104,20 @@ short VSinit
short max /* max nr screens to allow */
)
/* initializes virtual screen and window handling. */
{
{
short i;
RSinitall(max);
VSmax = max;
VSIwn = 0;
if ((VSscreens = (VSscrndata *) myNewPtr(max * sizeof(VSscrndata))) == 0L)
return(-2);
for (i = 0; i < max; i++)
{
return -2;
for (i = 0; i < max; i++) {
VSscreens[i].loc = 0L;
VSscreens[i].stat = 0;
} /* for */
return(0);
} /* VSinit */
} /* VSinit */
short VSiscapturing(short w) { /* BYU 2.4.18 */
@ -215,6 +218,11 @@ short VSisprinting(short w)
return ((VSscreens[w].loc)->prredirect);
}
Boolean VSisvt7bit(short w)
{
return !(VSscreens[w].loc)->vteightbits;
}
void ClosePrintingFile(short w)
{
OSErr sts;
@ -297,26 +305,24 @@ short VSnewscreen
short screensave, /* whether to have a scrollback buffer */
short numLines, //numLines initially on screen (CCP 2.7)
short maxwid, /* number of columns on screen */
short forcesave, /* NCSA 2.5: force lines to be saved */
short ignoreBeeps,
short oldScrollback,
short jump,
short realBlink
unsigned long flags
)
/* creates a new virtual screen, and returns its number. */
{
if (maxlines < VSDEFLINES)
maxlines = VSDEFLINES;
if (VSinuse >= VSmax)
/* too many screens in existence */
return(-1);
if ( VSinuse >= VSmax ) {
// too many screens in existence
return -1;
}
VSIwn = 0;
while ((VSIwn < VSmax) && (VSscreens[VSIwn].stat == 1))
while ( VSIwn < VSmax && VSscreens[VSIwn].stat == 1 )
VSIwn++;
if (VSIwn >= VSmax)
/* shouldn't occur? */
return(-1);
if ( VSIwn >= VSmax ) {
// shouldn't occur?
return -1;
}
numLines -= 1; //correct for internal use
/*
@ -344,12 +350,14 @@ short VSnewscreen
/* All memory allocation for this function is done at once, to help damage control in
low memory situations */
if ((VSscreens[VSIwn].loc = VSIw = (VSscrn *) myNewPtr(sizeof(VSscrn))) == 0L)
if ((VSscreens[VSIwn].loc = VSIw = (VSscrn *) myNewPtr(sizeof(VSscrn))) == 0L) {
return(-2);
}
VSIw->vtemulation = vtemulation;
VSIw->vteightbits = !(flags & RSWvt7bit);
VSIw->oldScrollback = oldScrollback;
VSIw->oldScrollback = flags & RSWoldscrollback;
VSIw->lines = numLines;
//VSIw->lines = 23; CCP 2.7 set this from the start
@ -447,14 +455,14 @@ short VSnewscreen
VSIw->disableCursor = 0; // cursor may be visible (RAB BetterTelnet 2.0b4)
VSIw->linesjumped = 0; // reset the jump scrolling (RAB BetterTelnet 2.0b3)
VSIw->jumpScroll = jump;
VSIw->jumpScroll = flags & RSWjumpscroll;
VSIw->maxlines = maxlines;
VSIw->numlines = 0;
VSscreens[VSIwn].captureRN = 0; /* BYU 2.4.18 - capture file's RefNum */
VSIw->id = 'VSCR';
VSIw->maxwidth = maxwid - 1;
VSIw->savelines = screensave;
VSIw->forcesave = forcesave; /* NCSA 2.5 */
VSIw->forcesave = flags & RSWforcesave; /* NCSA 2.5 */
VSIw->attrib = 0;
VSIw->Pattrib = 0xffffffff; /* initially no saved attribute */
VSIw->x = 0;
@ -482,11 +490,11 @@ short VSnewscreen
VSIw->ESscroll = 1;
VSIw->prredirect = 0; /* LU */
VSIw->qprint = 0;
VSIw->ignoreBeeps = ignoreBeeps;
VSIw->ignoreBeeps = flags & RSWignoreBeeps;
VSIw->prbuf = 0; /* LU */
VSIw->refNum = -1; /* LU */
VSIw->possibleForce = 0;
VSIw->realBlink = realBlink;
VSIw->realBlink = flags & RSWrealBlink;
VSIclrbuf();
VSItabinit();
VSscreens[VSIwn].stat = 1;
@ -612,7 +620,6 @@ short VSredraw
short sx2;
Boolean cursOff;
if (VSvalids(w) != 0)
return(-3);
@ -639,7 +646,7 @@ short VSredraw
ty2 = y2;
tn = -1; // so we include more than 1 line
// if (VSIclip(&tx1, &ty1, &tx2, &ty2, &tn, &offset)!=0) return 0; // test clip region
if (!VSIclip(&tx1, &ty1, &tx2, &ty2, &tn, &offset)) {
cursOff = 0;
if ( VSIcursorenabled() && RScursison(w) ) {
@ -647,31 +654,23 @@ short VSredraw
VSIcuroff(w); // temporarily hide cursor
}
// draw visible part of scrollback buffer
if (y1 < 0) {
tx1 = x1; // Set up to clip redraw area to visible area of scrollback buffer
tx2 = x2;
ty1 = y1;
ty2 = (y2>=0) ? -1 : y2;
tn = -1;
if (!VSIclip(&tx1, &ty1, &tx2, &ty2, &tn, &offset)) {
sx1 = tx1;
sx2 = tx2;
ypt = VSIw->vistop;
for(y=VSIw->Rtop; y<y1; y++)
ypt = ypt->next; // Get pointer to top line we need
ypt = VSIGetLineStart(w, y1);
for (y=ty1; y<=ty2; y++) {
for ( y = ty1; y <= ty2; y++ ) {
char *pt;
VSAttrib *pa;
VSAttrib lasta;
short x, lastx;
short chw;
if ( VSIw->Rtop + y == 0 ) {
// on-screen buffer
ypt = *VSIw->linest;
}
pt = ypt->text + VSIw->Rleft;
pa = ypt->attr + VSIw->Rleft;
@ -691,86 +690,30 @@ short VSredraw
lastx = tx1;
lasta = pa[tx1] & ~kVSansi2b;
for(x = tx1+1; x <= tx2; x++) {
for (x = tx1+1; x <= tx2; x++) {
if ( (pa[x] & ~kVSansi2b) != lasta ) {
RSdraw(w, lastx, y, ypt->lattr, lasta, x-lastx, pt + lastx);
lastx = x;
lasta = pa[x] & ~kVSansi2b;
}
}
if (lastx<=tx2)
if (lastx <= tx2)
RSdraw(w, lastx, y, ypt->lattr, lasta, tx2-lastx+1, pt + lastx);
tx1 = sx1;
tx2 = sx2;
ypt = ypt->next;
}
}
y1 = 0; // continue with on-screen buffer, if any
}
// draw visible part of on-screen buffer, taking account of attributes
if (y2 >= 0) {
tx1 = x1; // Set up to clip redraw area to visible area of on-screen buffer
tx2 = x2;
ty1 = y1;
ty2 = y2;
tn = -1;
if (!VSIclip(&tx1, &ty1, &tx2, &ty2, &tn, &offset)) {
sx1 = tx1;
sx2 = tx2;
ypt = VSIw->linest[VSIw->Rtop+ty1];
for (y=ty1; y<=ty2; y++) {
char *pt;
VSAttrib *pa;
VSAttrib lasta;
short x, lastx;
short chw;
pt = ypt->text + VSIw->Rleft;
pa = ypt->attr + VSIw->Rleft;
// if double size, we must shift width
if (VSisdecdwh(ypt->lattr)) {
tx1 >>= 1;
tx2 >>= 1;
chw = 2;
} else
chw = 1;
// multi-byte
if ( tx1 > 0 && (pa[tx1-1] & kVSansi2b) )
--tx1;
if ( tx2 < VSIw->maxwidth && (pa[tx2] & kVSansi2b) )
++tx2;
lastx = tx1;
lasta = pa[tx1] & ~kVSansi2b;
for(x = tx1+1; x <= tx2; x++) {
if ( (pa[x] & ~kVSansi2b) != lasta ) {
RSdraw(w, lastx, y, ypt->lattr, lasta, x-lastx, pt + lastx);
lastx = x;
lasta = pa[x] & ~kVSansi2b;
}
}
if (lastx<=tx2)
RSdraw(w, lastx, y, ypt->lattr, lasta, tx2-lastx+1, pt + lastx);
tx1 = sx1;
tx2 = sx2;
ypt = ypt->next;
}
}
}
if (VSIcursorenabled() && cursOff)
if ( cursOff ) {
VSIcurson(w, VSIw->x, VSIw->y, 0); /* restore cursor at original position */
return(0);
} else {
// just calcutate the new coordinates
VScursset(w, VSIw->x, VSIw->y);
}
}
return 0;
} /* VSredraw */
@ -817,16 +760,12 @@ short VSOredraw
ty2 = y2;
tn = -1; // so we include more than 1 line
// if (VSIclip(&tx1, &ty1, &tx2, &ty2, &tn, &offset)!=0) return 0; // test clip region
cursOff = 0;
if ( VSIcursorenabled() && RScursison(w) ) {
cursOff = 1;
VSIcuroff(w); // temporarily hide cursor
}
// RSerase(w, tx1, ty1, tx2, ty2); // Erase the offending area
// draw visible part of scrollback buffer
if (y1 < 0) {
@ -930,9 +869,12 @@ short VSOredraw
}
}
if (VSIcursorenabled() && cursOff)
if ( cursOff ) {
VSIcurson(w, VSIw->x, VSIw->y, 0); /* restore cursor at original position */
} else {
// just calcutate the new coordinates
VScursset(w, VSIw->x, VSIw->y);
}
return(0);
} /* VSOredraw */
@ -953,7 +895,7 @@ short VSwrite
if (VSvalids(w) != 0)
return(-3);
cursOff = 0;
if ( VSIcursorenabled() ) {
if ( VSIcursorenabled() && RScursison(w) ) {
cursOff = 1;
VSIcuroff(w); // hide cursor momentarily
}
@ -961,8 +903,12 @@ short VSwrite
VSem((unsigned char *) ptr, len); /* BYU LSC - interpret the character stream */
VSIflush(); // RAB BetterTelnet 2.0b3
VSIcursenable();
if ( VSIcursorenabled() && cursOff )
if ( cursOff ) {
VSIcurson(w, VSIw->x, VSIw->y, 1); /* restore cursor, force it to be visible. */
} else {
// just calcutate the new coordinates
VScursset(w, VSIw->x, VSIw->y);
}
// _profile = 0;
return(0);
} /* VSwrite */
@ -1693,14 +1639,13 @@ char *VSIstrcopy(char *src, short len, char *dest, short table, short noClip)
trailing blanks. If table is nonzero, then this number (or more) of
consecutive embedded blanks will be replaced with a tab. Returns a pointer
to the position one past the last character copied to the *dest buffer. */
{
{
char *p, *tempp;
short tblck;
p = src + len - 1;
/* skip trailing blanks, but only if !noClip */
if (!noClip && (table || gApplicationPrefs->clipTrailingSpaces))
// RAB BetterTelnet 1.0fc7, 1.1
if (!noClip)
while ((*p == ' ') && (p >= src))
p--;
if (p < src)
@ -1732,7 +1677,7 @@ char *VSIstrcopy(char *src, short len, char *dest, short table, short noClip)
} /* if */
} /* while */
return(dest);
} /* VSIstrcopy */
} /* VSIstrcopy */
long VSOgettext(short w, short x1, short y1, short x2, short y2, char *charp, long max, char *EOLS, short table)
@ -1851,9 +1796,9 @@ long VSgettext(short w, short x1, short y1, short x2, short y2,
short outlen;
short i;
VSlinePtr ypt;
VSattrlinePtr ypa;
char *pt;
VSAttrib *pa;
char *tp;
// VSAttrib *pa;
if (VSvalids(w) != 0)
return(-3);
@ -1890,7 +1835,7 @@ long VSgettext(short w, short x1, short y1, short x2, short y2,
origcp = charp;
elen = strlen(EOLS);
/* Order the lower and upper bounds */
// Order the lower and upper bounds
ux = x1;
lx = x2;
uy = y1;
@ -1900,6 +1845,8 @@ long VSgettext(short w, short x1, short y1, short x2, short y2,
ux = x2;
lx = x1;
}
// single line
clipspaces = clipspaces && gApplicationPrefs->clipTrailingSpaces;
} else if (y1 > y2) {
uy = y2;
ly = y1;
@ -1908,13 +1855,13 @@ long VSgettext(short w, short x1, short y1, short x2, short y2,
}
x1 = ux + 1;
// get text from scrollback buffer
if (uy < 0) {
x2 = mw;
y2 = (ly >= 0) ? -1 : ly;
ypt = VSIGetLineStart(w, uy);
for ( y1 = uy; y1 <= y2 && max >= elen; y1++, x1 = 0, x2 = mw, ypt = ypt->next ) {
for ( y1 = uy; y1 <= ly && max >= elen; y1++, x1 = 0, x2 = mw, ypt = ypt->next ) {
if ( y1 == 0 ) {
// get text from on-screen buffer
ypt = *VSIw->linest;
}
pt = ypt->text;
// pa = ypt->attr;
if (y1 == ly)
@ -1923,40 +1870,14 @@ long VSgettext(short w, short x1, short y1, short x2, short y2,
if (outlen > max) {
outlen = max;
}
charp = VSIstrcopy(pt + x1, outlen, pt = charp, table, !clipspaces);
max -= charp - pt;
charp = VSIstrcopy(pt + x1, outlen, tp = charp, table, !clipspaces);
max -= charp - tp;
if (max >= elen && !VSiswrap(ypt->lattr) && y1 != ly) {
strcpy(charp, EOLS);
charp += elen;
max -= elen;
}
}
uy = 0; // continue with on-screen buffer, if any
}
// get text from on-screen buffer
if (ly >= 0) {
x2 = mw;
ypt = VSIw->linest[uy];
for ( y1 = uy; y1 <= ly && max >= elen; y1++, x1 = 0, x2 = mw, ypt = ypt->next ) {
pt = ypt->text;
// pa = ypt->attr;
if (y1 == ly)
x2 = lx;
outlen = x2 - x1 + 1;
if (outlen > max) {
outlen = max;
}
charp = VSIstrcopy(pt + x1, outlen, pt = charp, table, !clipspaces);
max -= charp - pt;
if (max >= elen && !VSiswrap(ypt->lattr) && y1 != ly) {
strcpy(charp, EOLS);
charp += elen;
max -= elen;
}
}
}
return charp - origcp;
}
@ -2025,13 +1946,13 @@ long VSgetattr(short w, short x1, short y1, short x2, short y2,
}
x1 = ux + 1;
// get attributes from scrollback buffer
if (uy < 0) {
x2 = mw;
y2 = (ly >= 0) ? -1 : ly;
ypt = VSIGetLineStart(w, uy);
for ( y1 = uy; y1 <= y2 && max >= sizeof(VSAttrib); y1++, x1 = 0, x2 = mw, ypt = ypt->next ) {
for ( y1 = uy; y1 <= ly && max >= sizeof(VSAttrib); y1++, x1 = 0, x2 = mw, ypt = ypt->next ) {
if (y1 == 0) {
// get text from on-screen buffer
ypt = *VSIw->linest;
}
pa = ypt->attr;
if (y1 == ly)
x2 = lx; // end last line
@ -2043,27 +1964,6 @@ long VSgetattr(short w, short x1, short y1, short x2, short y2,
attrp += outlen;
max -= outlen * sizeof(VSAttrib);
}
uy = 0; // continue with on-screen buffer, if any
}
// get attributes from on-screen buffer
if (ly >= 0) {
x2 = mw;
ypt = VSIw->linest[uy];
for ( y1 = uy; y1 <= ly && max >= sizeof(VSAttrib); y1++, x1 = 0, x2 = mw, ypt = ypt->next ) {
pa = ypt->attr;
if (y1 == ly)
x2 = lx;
outlen = (x2 - x1 + 1) * sizeof(VSAttrib);
if (outlen > max / sizeof(VSAttrib)) {
outlen = max / sizeof(VSAttrib);
}
memcpy(attrp, pa + x1, outlen * sizeof(VSAttrib));
attrp += outlen;
max -= outlen * sizeof(VSAttrib);
}
}
return attrp - origap;
}

View File

@ -3,6 +3,7 @@
short VSinit(short max);
short VSiscapturing(short w);
short VSisprinting(short w);
Boolean VSisvt7bit(short w);
void ClosePrintingFile(short w);
Boolean VSopencapture(short scrn_num, short w);
void VSclosecapture(short w);
@ -11,7 +12,7 @@ short VSvalids(short w);
VSscrn *VSwhereis(short i);
void VSIclrbuf(void);
short VSnewscreen(short vtemulation, short maxlines, short screensave, short numLines,
short maxwid, short forcesave, short ignoreBeeps, short oldScrollback, short jump, short blink);
short maxwid, unsigned long flags);
short VSdestroy(short w);
short VSredraw(short w, short x1, short y1, short x2, short y2);
short VSOredraw(short, short, short, short, short);

View File

@ -43,7 +43,7 @@
#define ScrollbackQuantum 100
//#define VSIclrattrib 0
#define VSIclrattrib (VSIw->attrib & 0x0003ffff)
//#define VSIclrattrib (VSIw->attrib & 0x0003ffff)
#include "vsintern.proto.h"
@ -151,18 +151,36 @@ short VSIcinslines(short w, short top, short bottom, short n, short scrolled) /*
return 0;
} /* VSIcinslines */
void VSIcurson
(
short w,
short x,
short y,
short ForceMove
)
/* displays the text cursor at the specified position. If
ForceMove is true, I am to do any appropriate scrolling of
the display to ensure the cursor is within the visible region.
Assumes cursor isn't currently being shown. */
{
void VScursset( short w, short x, short y )
{
short x2;
short y2;
short n = 1;
short offset;
short lattr;
if (VSvalids(w) != 0)
return;
lattr = VSIw->linest[y]->lattr;
if (!VSIclip(&x, &y, &x2, &y2, &n, &offset)) {
/* cursor already lies within visible region */
RScursset(w, lattr, x, y);
}
}
/*
* VSIcurson
*
* displays the text cursor at the specified position. If
* ForceMove is true, I am to do any appropriate scrolling of
* the display to ensure the cursor is within the visible region.
* Assumes cursor isn't currently being shown.
*/
void VSIcurson( short w, short x, short y, short ForceMove )
{
short
x2,
y2,
@ -170,6 +188,9 @@ void VSIcurson
offset;
short lattr;
if (VSvalids(w) != 0)
return;
if (!VSIw->DECCM) return; // Bri 970610
if (VSIw->disableCursor) return; // RAB BetterTelnet 2.0b4
@ -200,26 +221,35 @@ void VSIcurson
} /* if */
} /* VSIcurson */
void VSIcuroff
(
short w
)
/* hides the cursor for the specified screen. Assumes it
is currently being shown (or that it's on an invisible
part of the screen). */
{
/*
* VSIcuroff
*
* hides the cursor for the specified screen. Assumes it
* is currently being shown (or that it's on an invisible
* part of the screen).
*/
void VSIcuroff( short w )
{
short
x = VSIw->x,
y = VSIw->y,
x,
y,
x2,
y2,
n = 1,
offset;
if (VSvalids(w) != 0)
return;
x = VSIw->x;
y = VSIw->y;
if (!VSIclip(&x, &y, &x2, &y2, &n, &offset) || !VSIw->DECCM) // Bri 970610
/* cursor is on visible part of screen */
RScursoff(w);
} /* VSIcuroff */
} /* VSIcuroff */
void VSIcursdisable() // RAB BetterTelnet 2.0b4
{
@ -697,6 +727,7 @@ void VSIelo
Doesn't do anything to the display. */
{
char *tt;
VSAttrib attrib;
VSAttrib *ta;
short i;
@ -710,9 +741,16 @@ void VSIelo
ta = &VSIw->linest[s]->attr[0];
}
tt = &VSIw->linest[s]->text[0];
if (VSIw->vtemulation == 3)
attrib = VSIw->attrib;
else
// all off, keep multi-byte / graphic
attrib = VSIw->attrib & (kVSansi2b | kVSgrph);
for (i = 0; i <= VSIw->allwidth; i++)
{
*ta++ = VSIclrattrib;
*ta++ = attrib;
*tt++ = ' ';
} /* for */
} /* VSIelo */
@ -852,6 +890,7 @@ void VSIdellines
{
short i, j;
char *tt;
VSAttrib attrib;
VSAttrib *ta;
VSlinePtr ts, TD, BD, TI, BI, itt;
@ -892,6 +931,12 @@ void VSIdellines
their new position */
VSIlistmove(TD, BD, TI, BI);
if (VSIw->vtemulation == 3)
attrib = VSIw->attrib;
else
// all off, keep multi-byte / graphic
attrib = VSIw->attrib & (kVSansi2b | kVSgrph);
for (i = 0; i < n; i++)
{
itt->lattr = 0;
@ -900,7 +945,7 @@ void VSIdellines
for (j = 0; j <= VSIw->allwidth; j++)
{
*tt++ = ' ';
*ta++ = VSIclrattrib;
*ta++ = attrib;
} /* for */
itt = itt->next;
} /* for */
@ -929,6 +974,7 @@ void VSOdellines
VSAttrib *ta;
VSlinePtr as, ts, TD, BD, TI, BI, itt;
VSattrlinePtr ita;
VSAttrib attrib;
if (s < 0)
s = VSIw->y;
@ -974,6 +1020,12 @@ void VSOdellines
their new position */
VSIlistmove(TD, BD, TI, BI);
if (VSIw->vtemulation == 3)
attrib = VSIw->attrib;
else
// all off, keep multi-byte / graphic
attrib = VSIw->attrib & (kVSansi2b | kVSgrph);
/* blank out the newly-created replacement lines */
ita = (VSattrlinePtr)TD; /* start of attribute lines to be blanked out */
for (i = 0; i < n; i++)
@ -984,7 +1036,7 @@ void VSOdellines
for (j = 0; j <= VSIw->allwidth; j++)
{
*tt++ = ' ';
*ta++ = VSIclrattrib;
*ta++ = attrib;
} /* for */
ita = ita->next;
itt = itt->next;
@ -1014,6 +1066,7 @@ void VSIinslines
char *tt;
VSAttrib *ta;
VSlinePtr ts, TD, BD, TI, BI, itt;
VSAttrib attrib;
VSIflush(); // RAB BetterTelnet 2.0b3
@ -1052,6 +1105,12 @@ void VSIinslines
to its new position */
VSIlistmove(TD, BD, TI, BI);
if (VSIw->vtemulation == 3)
attrib = VSIw->attrib;
else
// all off, keep multi-byte / graphic
attrib = VSIw->attrib & (kVSansi2b | kVSgrph);
/* blank out the newly-inserted lines */
for (i = 0; i < n; i++)
{
@ -1060,7 +1119,7 @@ void VSIinslines
for (j = 0; j <= VSIw->allwidth; j++)
{
*tt++ = ' ';
*ta++ = VSIclrattrib;
*ta++ = attrib;
}
itt = itt->next;
} /* for */
@ -1089,6 +1148,7 @@ void VSOinslines
VSAttrib *ta;
VSlinePtr ts, TD, BD, TI, BI, itt;
VSattrlinePtr as, aTD, aBD, aTI, aBI, ita;
VSAttrib attrib;
if (s < 0)
s = VSIw->y;
@ -1132,6 +1192,12 @@ void VSOinslines
to its new position */
VSIlistmove((VSlinePtr)aTD, (VSlinePtr)aBD, (VSlinePtr)aTI, (VSlinePtr)aBI);
if (VSIw->vtemulation == 3)
attrib = VSIw->attrib;
else
// all off, keep multi-byte / graphic
attrib = VSIw->attrib & (kVSansi2b | kVSgrph);
/* blank out the newly-inserted lines */
ita = aTD; /* start of attribute lines to be blanked out */
for (i = 0; i < n; i++)
@ -1142,7 +1208,7 @@ void VSOinslines
for (j = 0; j <= VSIw->allwidth; j++)
{
*tt++ = ' ';
*ta++ = VSIclrattrib;
*ta++ = attrib;
}
itt = itt->next;
ita = ita->next;
@ -1202,27 +1268,22 @@ void VSIscroll
tmp->prev = VSIw->linest[VSIw->lines];
VSIw->numlines++; /* use one of the newly-allocated scrollback lines */
RSbufinfo(VSIwn, VSIw->numlines, VSIw->Rtop, VSIw->Rbottom); /* update vertical scroll bar accordingly */
}
else
{
} else {
/* not enough memory to extend scrollback buffer--reuse
oldest line and give up on future extensions */
VSIw->linest[VSIw->lines]->next = VSIw->buftop; /* Make it circular */
VSIw->buftop->prev = VSIw->linest[VSIw->lines];
VSIw->buftop = VSIw->buftop->next; /* step one forward */
} /* if */
}
else
{
} else {
/* either there's allocated, but not yet used, space at
VSIw->linest[VSIw->lines]->next, or the text line list
is circular. Either way, don't do any new scrollback
allocation. */
if (VSIw->linest[VSIw->lines]->next == VSIw->buftop)
if (VSIw->linest[VSIw->lines]->next == VSIw->buftop) {
/* scrollback buffer is at full size--reuse oldest line */
VSIw->buftop = VSIw->buftop->next;
else
{
} else {
/* haven't used up all the space I allocated last time */
VSIw->numlines++; /* count another line */
RSbufinfo(VSIwn, VSIw->numlines, VSIw->Rtop, VSIw->Rbottom); /* update vertical scroll bar accordingly */
@ -1259,11 +1320,13 @@ void VSIscroll
}
else
VSIw->vistop = VSIw->vistop->next; /* consistent with changed display */
/* clear line attribute */
VSIw->linest[VSIw->lines]->lattr = 0;
/* blank out newly-revealed bottom line */
tempa = VSIw->linest[VSIw->lines]->attr;
temp = VSIw->linest[VSIw->lines]->text;
for (i = 0; i <= VSIw->allwidth; i++)
{
for (i = 0; i <= VSIw->allwidth; i++) {
*temp++ = ' ';
*tempa++ = 0;
} /* for */
@ -1515,6 +1578,7 @@ void VSIeeol
offset;
short
i;
VSAttrib attrib;
// RAB BetterTelnet 2.0b1 - Fix for forcesave bug
@ -1560,6 +1624,12 @@ void VSIeeol
DisposePtr((Ptr) savedTextBlock); // VSIfreelinelist adds un-needed overhead here
}
if (VSIw->vtemulation == 3)
attrib = VSIw->attrib;
else
// all off, keep multi-byte / graphic
attrib = VSIw->attrib & (kVSansi2b | kVSgrph);
VSIwrapnow(&x1, &y1);
y2 = y1;
/* clear out screen line */
@ -1572,7 +1642,7 @@ void VSIeeol
tt = &VSIw->linest[y1]->text[x1];
for (i = VSIw->allwidth - x1 + 1; i > 0; i--)
{
*ta++ = VSIclrattrib;
*ta++ = attrib;
*tt++ = ' ';
}
/* update display */
@ -1604,6 +1674,7 @@ void VSIdelchars
*tempa;
short
lattr;
VSAttrib attrib;
VSIwrapnow(&x1, &y1);
y2 = y1;
@ -1617,6 +1688,13 @@ void VSIdelchars
tempa = VSIw->linest[y1]->attr;
}
temp = VSIw->linest[y1]->text;
if (VSIw->vtemulation == 3)
attrib = VSIw->attrib;
else
// all off, keep multi-byte / graphic
attrib = VSIw->attrib & (kVSansi2b | kVSgrph);
for (i = x1; i <= VSIw->maxwidth - x; i++)
{
/* move remainder of line to the left */
@ -1627,7 +1705,7 @@ void VSIdelchars
{
/* insert blank characters after end of line */
temp[i] = ' ';
tempa[i] = VSIclrattrib;
tempa[i] = attrib;
}
/* update display */
if (!VSIclip(&x1, &y1, &x2, &y2, &n, &offset))
@ -1712,6 +1790,7 @@ void VSIebol
offset;
short
i;
VSAttrib attrib;
VSIwrapnow(&x2, &y1);
y2 = y1;
@ -1722,10 +1801,17 @@ void VSIebol
} else {
ta = &VSIw->linest[y1]->attr[0];
}
if (VSIw->vtemulation == 3)
attrib = VSIw->attrib;
else
// all off, keep multi-byte / graphic
attrib = VSIw->attrib & (kVSansi2b | kVSgrph);
tt = &VSIw->linest[y1]->text[0];
for (i = 0; i <= x2; i++)
{
*ta++ = VSIclrattrib;
*ta++ = attrib;
*tt++ = ' ';
}
/* update display */
@ -1743,6 +1829,7 @@ void VSIel
VSAttrib *ta;
short x1 = 0, y1 = s, x2 = VSIw->maxwidth, y2 = s, n = -1, offset;
short i;
VSAttrib attrib;
if (s < 0)
{
@ -1757,10 +1844,17 @@ void VSIel
} else {
ta = &VSIw->linest[s]->attr[0];
}
if (VSIw->vtemulation == 3)
attrib = VSIw->attrib;
else
// all off, keep multi-byte / graphic
attrib = VSIw->attrib & (kVSansi2b | kVSgrph);
tt = &VSIw->linest[s]->text[0];
for(i = 0; i <= VSIw->allwidth; i++)
{
*ta++ = VSIclrattrib;
*ta++ = attrib;
*tt++ = ' ';
}
/* update display */
@ -2109,6 +2203,8 @@ void VSIinschar
short i, j;
char *temp;
VSAttrib *tempa;
VSAttrib attrib;
VSIwrapnow(&i, &j);
if (VSIw->oldScrollback)
@ -2122,10 +2218,17 @@ void VSIinschar
tempa[x + i] = tempa[i];
}
if ( clear ) {
if (VSIw->vtemulation == 3)
attrib = VSIw->attrib & (kVSansi2b | kVSgrph);
else
// all off, keep multi-byte / graphic
attrib = VSIw->attrib;
for (i = VSIw->x; i < VSIw->x + x; i++) {
/* insert appropriate number of blanks */
temp[i] = ' ';
tempa[i] = VSIclrattrib;
tempa[i] = attrib;
}
}
} /* VSIinschar */

View File

@ -5,6 +5,7 @@
short VSIclip(short *x1, short *y1, short *x2, short *y2, short *n, short *offset);
short VSIcdellines(short w, short top, short bottom, short n, short scrolled);
short VSIcinslines(short w, short top, short bottom, short n, short scrolled);
void VScursset( short w, short x, short y );
void VSIcurson(short w, short x, short y, short ForceMove);
void VSIcuroff(short w);
short VSIcursorenabled( void );

File diff suppressed because it is too large Load Diff

View File

@ -29,7 +29,6 @@ extern short scrn;
extern Boolean gPresentOpenConnectionDialog;
extern unsigned long gPresentOpenConnectionTicks;
static void ProcessURLEscapeCodes (char *url, char **end);
void AEunload(void) { }

View File

@ -62,7 +62,7 @@ static Boolean InNumOnly(short item);
static Str255 configPassword;
static Str255 configPassword2;
static ConstStringPtr gDefaultName = "\p<Default>";
ConstStringPtr gDefaultName = "\p<Default>";
static LinkedListNode *currentHead;
static ListHandle currentList;
@ -1045,11 +1045,22 @@ pascal short ColorBoxModalProc( DialogPtr dptr, EventRecord *evt, short *item)
return CallStdFilterProc(dptr, evt, item);
}
popup TPopup[] = {{TermFontPopup, (MenuHandle) 0, 1},
{41, (MenuHandle) 0, 1},
{0, (MenuHandle) 0, 0}};
SIMPLE_UPP(TerminalModalProc, ModalFilter);
pascal short TerminalModalProc( DialogPtr dptr, EventRecord *evt, short *item)
{
if (evt->what == mouseDown) return(PopupMousedown(dptr, evt, item));
if ( evt->what == mouseDown ) {
short oldChoice = TPopup[0].choice;
short result = PopupMousedown(dptr, evt, item);
if ( result && *item == TPopup[0].item ) {
TPopup[1].choice = TPopup[0].choice;
DrawPopUp(dptr, TPopup[1].item);
}
return result;
}
return(ColorBoxModalProc(dptr, evt, item));
}
@ -1201,10 +1212,12 @@ void ShowTermPanel(DialogPtr dptr, short panel)
ShowDialogItemRange(dptr, 22, 23);
ShowDialogItemRange(dptr, 25, 26);
ShowDialogItemRange(dptr, 29, 30);
//ShowDialogItemRange(dptr, 32, 33);
ShowDialogItem(dptr, 32);
ShowDialogItemRange(dptr, 45, 46);
// ShowDialogItem(dptr, TermANSIE);
if ( GetCntlVal(dptr, TermType) != 1 ) {
ShowDialogItem(dptr, 48);
}
//ShowDialogItem(dptr, 48);
break;
case 2:
@ -1237,10 +1250,9 @@ void HideTermPanel(DialogPtr dptr, short panel)
HideDialogItemRange(dptr, 22, 23);
HideDialogItemRange(dptr, 25, 26);
HideDialogItemRange(dptr, 29, 30);
//HideDialogItemRange(dptr, 32, 33);
HideDialogItem(dptr, 32);
HideDialogItemRange(dptr, 45, 46);
// HideDialogItem(dptr, TermANSIE);
HideDialogItem(dptr, 48);
break;
case 2:
@ -1278,9 +1290,7 @@ Boolean EditTerminal(StringPtr PrefRecordNamePtr)
RGBColor scratchRGBcolor;
Point ColorBoxPoint;
MenuHandle WeNeedAFontMenuHandle, WeNeedAnotherFontMenuHandle;
popup TPopup[] = {{TermFontPopup, (MenuHandle) 0, 1},
{41, (MenuHandle) 0, 1},
{0, (MenuHandle) 0, 0}};
short editField;
SetUpMovableModalMenus();
dptr = GetNewMySmallStrangeDialog(TermDLOG, NULL, kInFront, (void *)ThirdCenterDialog);
@ -1330,8 +1340,6 @@ Boolean EditTerminal(StringPtr PrefRecordNamePtr)
HideTermPanel(dptr, 3);
HideTermPanel(dptr, 4);
ShowTermPanel(dptr, currentPanel);
if (PrefRecordNamePtr[0] != 0) {
IsNewPrefRecord = FALSE;
UseResFile(TelInfo->SettingsFile);
@ -1371,6 +1379,7 @@ Boolean EditTerminal(StringPtr PrefRecordNamePtr)
SetCntrl(dptr, TermRemapKeypad, TermPrefsPtr->remapKeypad);
SetCntrl(dptr, 47, TermPrefsPtr->realBlink);
SetCntrl(dptr, 48, TermPrefsPtr->vt7bits);
scratchlong = (long)(TermPrefsPtr->vtwidth);
NumToString(scratchlong, scratchPstring);
SetTEText(dptr, TermWidth, scratchPstring);
@ -1422,7 +1431,12 @@ Boolean EditTerminal(StringPtr PrefRecordNamePtr)
ColorBoxPoint.h = 0; // Have the color picker center the box on the main
ColorBoxPoint.v = 0; // screen
SelectDialogItemText(dptr, TermName, 0, 32767);
ShowTermPanel(dptr, currentPanel);
if ( ((DialogPeek)dptr)->editField >= 0 ) {
SelectDialogItemText(dptr, ((DialogPeek)dptr)->editField + 1, 0, 255);
}
ShowWindow(dptr);
wasInAliasText = FALSE;
while (ditem > 2)
@ -1480,6 +1494,7 @@ Boolean EditTerminal(StringPtr PrefRecordNamePtr)
case 45:
case 46:
case 47:
case 48:
case Termvtwrap:
case Termarrow:
case TermMAT:
@ -1493,21 +1508,25 @@ Boolean EditTerminal(StringPtr PrefRecordNamePtr)
switch (GetCntlVal(dptr, ditem)) {
case 1:
SetTEText(dptr, TermAnswerback, "\pvt100");
HideDialogItem(dptr, 48);
//HideDialogItem(dptr,TermRemapKeypad);
//HideDialogItem(dptr,TermMAT);
break;
case 2:
SetTEText(dptr, TermAnswerback, "\pvt220");
ShowDialogItem(dptr, 48);
//ShowDialogItem(dptr,TermRemapKeypad);
//ShowDialogItem(dptr,TermMAT);
break;
case 3:
SetTEText(dptr, TermAnswerback, "\pansi");
ShowDialogItem(dptr, 48);
//ShowDialogItem(dptr,TermRemapKeypad);
//ShowDialogItem(dptr,TermMAT);
break;
case 4:
SetTEText(dptr, TermAnswerback, "\plinux");
ShowDialogItem(dptr, 48);
//ShowDialogItem(dptr,TermRemapKeypad);
//ShowDialogItem(dptr,TermMAT);
break;
@ -1543,13 +1562,17 @@ Boolean EditTerminal(StringPtr PrefRecordNamePtr)
}
break;
case 43: // switch tabs
newPanel = GetCntlVal(dptr, ditem);
if (newPanel == currentPanel) break;
if (newPanel == currentPanel)
break;
editField = ((DialogPeek)dptr)->editField + 1;
HideTermPanel(dptr, currentPanel);
ShowTermPanel(dptr, newPanel);
currentPanel = newPanel;
if (editField != ((DialogPeek)dptr)->editField + 1
&& ((DialogPeek)dptr)->editField >= 0) {
SelectDialogItemText(dptr, ((DialogPeek)dptr)->editField + 1, 0, 255);
}
break;
case TermName:
@ -1599,6 +1622,7 @@ Boolean EditTerminal(StringPtr PrefRecordNamePtr)
TermPrefsPtr->jumpScroll = GetCntlVal(dptr, 46);
TermPrefsPtr->boldFontStyle = GetCntlVal(dptr, 42);
TermPrefsPtr->realBlink = GetCntlVal(dptr, 47);
TermPrefsPtr->vt7bits = GetCntlVal(dptr, 48);
TermPrefsPtr->vtwrap = GetCntlVal(dptr, Termvtwrap);
if (GetCntlVal(dptr, TermMetaIsCmdCntrol))
@ -1819,6 +1843,7 @@ Boolean EditSession(StringPtr PrefRecordNamePtr)
popup SPopup[] = {{SessTermPopup, (MenuHandle) 0, 1},
{SessTransTablePopup, (MenuHandle) 0, 1},
{0, (MenuHandle) 0, 0}};
short editField;
SetUpMovableModalMenus();
dptr = GetNewMySmallStrangeDialog(SessionConfigDLOG, NULL, kInFront, (void *)ThirdCenterDialog);
@ -2004,7 +2029,10 @@ Boolean EditSession(StringPtr PrefRecordNamePtr)
HideSessPanel(dptr, i);
ShowSessPanel(dptr, currentPanel);
SelectDialogItemText(dptr, SessAlias, 0, 32767);
if ( ((DialogPeek)dptr)->editField >= 0 ) {
SelectDialogItemText(dptr, ((DialogPeek)dptr)->editField + 1, 0, 255);
}
ShowWindow(dptr);
wasInAliasText = FALSE;
while ((ditem > 2) || (ditem == 0)) {
@ -2187,12 +2215,17 @@ Boolean EditSession(StringPtr PrefRecordNamePtr)
case 45: // tab control
newPanel = GetCntlVal(dptr, 45);
if (newPanel == currentPanel) break;
if (newPanel == currentPanel)
break;
editField = ((DialogPeek)dptr)->editField + 1;
HideSessPanel(dptr, currentPanel);
ShowSessPanel(dptr, newPanel);
SelectDialogItemText(dptr,((DialogPeek)dptr)->editField + 1,0,32767);
currentPanel = newPanel;
if (editField != ((DialogPeek)dptr)->editField + 1
&& ((DialogPeek)dptr)->editField >= 0) {
SelectDialogItemText(dptr, ((DialogPeek)dptr)->editField + 1, 0, 255);
}
break;
case 40: // Save as Set...
@ -2551,6 +2584,9 @@ short AnsiPrompt(short allowDefaultBoldSelect, short *defaultBoldColor)
DialogPtr dptr;
Boolean UserLikesNewColor;
RGBColorPtr scratchRGB;
short itemType;
Handle itemHandle;
Rect itemRect;
SetUpMovableModalMenus();
scratchRGB = (RGBColorPtr) myNewPtr(sizeof(RGBColor));
@ -2605,14 +2641,17 @@ short AnsiPrompt(short allowDefaultBoldSelect, short *defaultBoldColor)
case ANSIBoldMagenta:
case ANSIBoldCyan:
case ANSIBoldWhite:
if (TelInfo->haveColorQuickDraw)
{
if (TelInfo->haveColorQuickDraw) {
Str255 askColorString;
GetIndString(askColorString,MISC_STRINGS,PICK_NEW_COLOR_STRING);
UserLikesNewColor = GetColor(ColorBoxPoint,askColorString,
&BoxColorData[ditem-ANSIBlack], scratchRGB);
if (UserLikesNewColor)
if (UserLikesNewColor) {
BoxColorData[ditem-ANSIBlack] = *scratchRGB;
// force refresh
GetDialogItem(dptr, ditem, &itemType, &itemHandle, &itemRect);
InvalRect(&itemRect);
}
}
break;
case ANSIBlackRadio:

View File

@ -37,7 +37,7 @@ void InitDebug(void)
// SetRect(&pRect, 50, 150, 700, 350); // Need to make this a resource!
SetRect(&pRect, 50, 150, 0, 0);
flags = RSWwrapon | RSWgoaway | RSWignoreBeeps | RSWsavelines;
flags = RSWwrapon | RSWgoaway | RSWignoreBeeps | RSWoldscrollback;
if (TelInfo->debug)
flags |= RSWshowit;

View File

@ -497,7 +497,7 @@ short sendmacro(struct WindRec *tw, short n) /* send macro number n */
plabel = s;
} else {
*s = 0;
if (plabel && SSH2PasswordDialog(plabel, password)) {
if (plabel && SSH2PasswordDialog(plabel, password, NULL)) {
SendStringAsIfTyped(tw, (char *)first, p-first);
// better wait for echo off...
startTicks = TickCount();

View File

@ -64,6 +64,15 @@ extern Boolean encryptOK;
extern unsigned char *gReadspace;
extern short gBlocksize;
extern ConstStringPtr gDefaultName;
static short numWind = 1;
static short stagNum = 1;
static Boolean startautocomplete = false;
static Boolean doneautocomplete = false;
static unsigned long autoTicks;
/*
extern void LockDialog();
extern void UnlockDialog();
@ -98,14 +107,17 @@ void OpenPortSpecial(MenuHandle menuh, short item)
OutOfMemory(1020);
return;
}
// use favorite's name as window name
if ( !(**theParams).WindowName[0] && memcmp(scratchPstring, gDefaultName, gDefaultName[0] + 1) ) {
BlockMoveData(scratchPstring, (**theParams).WindowName, scratchPstring[0] + 1);
NumToString(numWind++, scratchPstring);
pstrcat((**theParams).WindowName, "\p (");
pstrcat((**theParams).WindowName, scratchPstring);
pstrcat((**theParams).WindowName, "\p)");
}
success = CreateConnectionFromParams(theParams);
}
static Boolean startautocomplete = false;
static Boolean doneautocomplete = false;
static unsigned long autoTicks;
SIMPLE_UPP(POCdlogfilter, ModalFilter);
pascal short POCdlogfilter( DialogPtr dptr, EventRecord *evt, short *item)
{
@ -148,36 +160,10 @@ pascal short POCdlogfilter( DialogPtr dptr, EventRecord *evt, short *item)
// if (evt->what == mouseDown)
// return(PopupMousedown(dptr, evt, item));
/* NONO */
/*
if ( gApplicationPrefs->parseAliases ) {
editField = ((DialogPeek)dptr)->editField + 1;
if ( editField == NChostname ) {
GetTEText(dptr, editField, scratch1Pstring);
}
}
*/
/* NONO */
// RAB BetterTelnet 1.2 - we let StdFilterProc handle this now
// return(DLOGwOK_Cancel(dptr, evt, item));
result = CallStdFilterProc(dptr, evt, item);
/* NONO */
/*
if ( gApplicationPrefs->parseAliases ) {
if ( editField == NChostname && (evt->what == keyDown || evt->what == autoKey) ) {
GetTEText(dptr, editField, scratch2Pstring);
if (memcmp(scratch1Pstring, scratch2Pstring, scratch1Pstring[0] + 1)) {
// host name changed
//*item = editField;
//result = true;
autoTicks = LMGetTicks();
startautocomplete = true;
}
}
}
*/
if ( startautocomplete && LMGetTicks() - autoTicks >= 30 ) {
startautocomplete = false;
doneautocomplete = true;
@ -185,8 +171,6 @@ pascal short POCdlogfilter( DialogPtr dptr, EventRecord *evt, short *item)
result = -1;
}
/* NONO */
return result;
}
@ -253,7 +237,9 @@ Boolean PresentOpenConnectionDialog(void)
Boolean success;
long scratchlong;
Str255 hostString;
Str255 scratchPstring, terminalPopupString, scritchPstring;
Str255 scratchPstring;
Str255 terminalPopupString;
Str255 favoriteString;
Handle ItemHandle;
SessionPrefs **tempSessHdl;
short numberOfTerms, sessMark, requestPort;
@ -474,13 +460,13 @@ Boolean PresentOpenConnectionDialog(void)
}
MaxMem(&junk);
GetMenuItemText(SessPopupHdl, sessMark, scritchPstring);
GetMenuItemText(SessPopupHdl, sessMark, favoriteString);
/* don't try to convert hostname to alias if nothing has been typed */
parseAliases = gApplicationPrefs->parseAliases;
if (!typedHost)
gApplicationPrefs->parseAliases = false;
InitParams = NameToConnInitParams(scratchPstring, FALSE, scritchPstring, &wasAlias);
InitParams = NameToConnInitParams(scratchPstring, FALSE, favoriteString, &wasAlias);
gApplicationPrefs->parseAliases = parseAliases;
if (InitParams == NULL)
{
@ -539,10 +525,19 @@ Boolean PresentOpenConnectionDialog(void)
HUnlock((Handle)(**InitParams).session);
HUnlock((Handle)InitParams);
DisposeMenu(SessPopupHdl); // drh Ñ Bug fix: memory leak
DisposeMenu(SessPopupHdl);
DisposeDialog(dptr);
ResetMenus();
// use favorite's name as window name
if ( !(**InitParams).WindowName[0] && memcmp(favoriteString, gDefaultName, gDefaultName[0] + 1) ) {
BlockMoveData(favoriteString, (**InitParams).WindowName, favoriteString[0] + 1);
NumToString(numWind++, favoriteString);
pstrcat((**InitParams).WindowName, "\p (");
pstrcat((**InitParams).WindowName, favoriteString);
pstrcat((**InitParams).WindowName, "\p)");
}
success = CreateConnectionFromParams(InitParams);
return success;
}
@ -625,7 +620,6 @@ Boolean OpenConnectionFromURL(char *host, char *portstring, char *user, char *pa
Boolean CreateConnectionFromParams( ConnInitParams **Params)
{
short scratchshort, fontnumber, otherfnum;
static short numWind = 1, stagNum = 1;
SessionPrefs *SessPtr;
TerminalPrefs *TermPtr;
short cur;
@ -641,8 +635,7 @@ Boolean CreateConnectionFromParams( ConnInitParams **Params)
// Check if we have the max number of sessions open
if (TelInfo->numwindows == MaxSess) return(FALSE);
cur = TelInfo->numwindows; /* Adjust # of windows and get this window's number */
TelInfo->numwindows++;
cur = TelInfo->numwindows++; // Adjust # of windows and get this window's number
theScreen = &screens[cur];
theScreen->active = CNXN_NOTINUSE; // Make sure it is marked as dead (in case we
@ -671,26 +664,17 @@ Boolean CreateConnectionFromParams( ConnInitParams **Params)
if (SessPtr->hostname[0] == 0) {
OperationFailedAlert(5, 0, 0);
DisposeHandle((Handle)(**Params).terminal);
DisposeHandle((Handle)(**Params).session);
DisposeHandle((Handle)Params);
TelInfo->numwindows--;
updateCursor(1);
return(FALSE);
goto failed;
}
/* we have SSH.
if (SessPtr->protocol == 4) // make sure we have SSH
{
if (!ssh_glue_installed()) {
OperationFailedAlert(6, 0, 0);
DisposeHandle((Handle)(**Params).terminal);
DisposeHandle((Handle)(**Params).session);
DisposeHandle((Handle)Params);
TelInfo->numwindows--;
updateCursor(1);
return(FALSE);
goto failed;
}
}
*/
Mnetinit(); // RAB BetterTelnet 1.0fc4
@ -716,12 +700,7 @@ Boolean CreateConnectionFromParams( ConnInitParams **Params)
// Get the IP for the host while we set up the connection
if (DoTheDNR(hostname, cur) != noErr) {
OutOfMemory(1010);
DisposeHandle((Handle)(**Params).terminal);
DisposeHandle((Handle)(**Params).session);
DisposeHandle((Handle)Params);
TelInfo->numwindows--;
updateCursor(1);
return(FALSE);
goto failed;
}
*/
DoTheMenuChecks();
@ -819,27 +798,18 @@ Boolean CreateConnectionFromParams( ConnInitParams **Params)
if ( !theScreen->sshdata.login[0]
/*|| !theScreen->sshdata.password[0]*/ ) {
if ( !SSH2LoginDialog(theScreen->sshdata.host, theScreen->sshdata.login, theScreen->sshdata.password) ) {
DisposeHandle((Handle)(**Params).terminal);
DisposeHandle((Handle)(**Params).session);
DisposeHandle((Handle)Params);
TelInfo->numwindows--;
updateCursor(1);
return(FALSE);
goto failed;
}
}
}
/* NONO */
theScreen->active = CNXN_DNRWAIT; // Signal we are waiting for DNR.
// Get the IP for the host while we set up the connection
if (DoTheDNR(hostname, cur) != noErr) {
OutOfMemory(1010);
DisposeHandle((Handle)(**Params).terminal);
DisposeHandle((Handle)(**Params).session);
DisposeHandle((Handle)Params);
TelInfo->numwindows--;
updateCursor(1);
return(FALSE);
goto failed;
}
GetFNum(TermPtr->DisplayFont, &fontnumber);
@ -861,33 +831,28 @@ Boolean CreateConnectionFromParams( ConnInitParams **Params)
if (TermPtr->realbold)
flags |= RSWrealbold;
if (TermPtr->oldScrollback)
flags |= RSWsavelines;
flags |= RSWoldscrollback;
if (TermPtr->jumpScroll)
flags |= RSWjumpscroll;
if (TermPtr->realBlink)
flags |= RSWrealBlink;
if (TermPtr->vt7bits)
flags |= RSWvt7bit;
theScreen->vs = RSnewwindow(&((**Params).WindowLocation), TermPtr->numbkscroll, TermPtr->vtwidth,
TermPtr->vtheight, (**Params).WindowName, fontnumber,
TermPtr->fontsize, cur, otherfnum, TermPtr->boldFontSize,
TermPtr->boldFontStyle, TermPtr->vtemulation, flags);
if (theScreen->vs <0 ) { /* we have a problem opening up the virtual screen */
if (theScreen->vs < 0 ) { /* we have a problem opening up the virtual screen */
OutOfMemory(1011);
DisposeHandle((Handle)(**Params).terminal);
DisposeHandle((Handle)(**Params).session);
DisposeHandle((Handle)Params);
TelInfo->numwindows--;
DoTheMenuChecks();
updateCursor(1);
return(FALSE);
goto failed;
}
theScreen->wind = RSgetwindow( theScreen->vs);
((WindowPeek)theScreen->wind)->windowKind = WIN_CNXN;
/*
* Attach our extra part to display encryption status
*/
@ -962,7 +927,6 @@ Boolean CreateConnectionFromParams( ConnInitParams **Params)
scratchBoolean = RSsetcolors( theScreen->vs, 3, &TermPtr->bbcolor);
addinmenu(cur, (**Params).WindowName, diamondMark);
theScreen->active = CNXN_DNRWAIT; // Signal we are waiting for DNR.
theScreen->myInitParams = (Handle)Params;
HUnlock((Handle)(**Params).terminal);
@ -972,7 +936,21 @@ Boolean CreateConnectionFromParams( ConnInitParams **Params)
VSscrolcontrol( theScreen->vs, -1, theScreen->ESscroll);
updateCursor(1); /* Done stalling the user */
return(TRUE);
return TRUE;
failed:
theScreen->active = CNXN_NOTINUSE;
disposetranslation(theScreen);
disposemacros(&theScreen->sessmacros);
DisposeHandle((Handle)(**Params).terminal);
DisposeHandle((Handle)(**Params).session);
DisposeHandle((Handle)Params);
TelInfo->numwindows--;
DoTheMenuChecks();
updateCursor(1);
return FALSE;
}
void CompleteConnectionOpening(short dat, ip_addr the_IP, OSErr DNRerror, char *cname)
@ -1325,7 +1303,6 @@ void destroyport(short wind)
DisposePtr((Ptr)tw->aedata);
}
disposetranslation(tw);
/*
* Get handle to the WDEF patch block, kill the window, and then
@ -1372,6 +1349,8 @@ void removeport(WindRecPtr tw)
ssh_glue_close(tw);
}
disposetranslation(tw);
if (tw->outlen>0) {
tw->outlen=0; /* Kill the remaining send*/
HUnlock( tw->outhand); /* buffer */

View File

@ -63,6 +63,8 @@ extern WindRec *screens,
extern Cursor *theCursors[];
extern Boolean gHaveDragMgr;
extern void VSprintf(char *fmt, ...);
extern void VSdump(char *p, int len);
static gHaveInstalledNotification = 0;
NMRec *nRecPtr;
@ -574,6 +576,9 @@ emacsHack:
}
}
// VSprintf("trin: ");
// VSdump(&ascii, 1);
// Handle whatever mapping is needed.
// mac_nat(tw, &ascii); // LU/PM: Convert char from mac to nat
if ( GetTranslationIndex(tw->outnational) != kTRJIS ) {
@ -603,7 +608,7 @@ emacsHack:
// translation ok, or no data yet
if ( inlen ) {
// keep a few chars
for (i = inlen; i <= tw->troutcount; i++) {
for (i = inlen; i < tw->troutcount; i++) {
pbuf[i - inlen] = pbuf[i];
}
tw->troutcount -= inlen;
@ -639,6 +644,9 @@ emacsHack:
}
}
// VSprintf("trout: ");
// VSdump(pbuf, trlen);
if ( (tw->clientflags & PASTE_IN_PROGRESS) && tw->pastemethod ) {
// queue this
kbwrite( tw, pbuf, trlen);

View File

@ -93,20 +93,18 @@ void main(void)
ProfilerClear();
#endif
if (!Gestalt('appr',&dummy)) {
if ( !Gestalt('appr', &dummy) ) {
gHasAppearance = true;
if (!Gestalt(gestaltAppearanceVersion, &dummy) && dummy >= 0x110 ) {
if ( !Gestalt(gestaltAppearanceVersion, &dummy) && dummy >= 0x110 ) {
gHasAppearance11 = true;
}
RegisterAppearanceClient();
}
init(); /* JMB 2.6 - Call all init routines */
UnloadSeg(&init); /* Bye, bye to init routines... */
if (gApplicationPrefs->autoOpenDefault)
if ( gApplicationPrefs->autoOpenDefault )
OpenSpecial(3);
TelInfo->gotDocument = 0;
@ -120,13 +118,10 @@ void main(void)
if (!TelInfo->done) {
DoNetEvents();
}
//ssh2_sched();
memOK = RecoverReserveMemory();
if (memOK)
if ( memOK ) {
haveNotifiedLowMemory = false;
else if (!haveNotifiedLowMemory)
{
} else if (!haveNotifiedLowMemory) {
Alert(MemoryLowAlert, NULL);
haveNotifiedLowMemory = true;
}
@ -140,7 +135,7 @@ void main(void)
gPresentOpenConnectionDialog = 0;
}
}
} while (!TelInfo->done); /* BYU mod */
} while ( !TelInfo->done );
#ifdef PERFORMANCE
if (!PerfDump(ThePGlobals, "\pPerform.out", TRUE, 80))

View File

@ -282,6 +282,11 @@ void pasteText(short scrn)
SetHandleSize(tw->outhand, uploadLength);
if ( GetTranslationIndex(tw->outnational) != kTRJIS )
tw->outhand = htrbuf_mac_nat(tw, tw->outhand);
if ( tw->outhand && !(tw->outlen = GetHandleSize(tw->outhand)) ) {
DisposeHandle( tw->outhand );
tw->outhand = NULL;
}
if ( tw->outhand ) {
HLock(tw->outhand);
tw->outptr = *tw->outhand;
tw->outlen = GetHandleSize(tw->outhand);
@ -295,6 +300,11 @@ void pasteText(short scrn)
//pasteText(scrn);
netputevent(USERCLASS, PASTELEFT, scrn, 0);
return;
} else {
// translation failed...
SysBeep(5);
tw->outlen = 0;
}
}
}
@ -303,8 +313,10 @@ void pasteText(short scrn)
tw->clientflags &= ~PASTE_IN_PROGRESS;
if (tw->isUploading)
FSClose(tw->uploadRefNum);
if ( tw->outhand ) {
HUnlock(tw->outhand);
DisposeHandle(tw->outhand);
}
tw->outptr = (char *) 0L;
tw->outhand = (char **) 0L;

View File

@ -85,12 +85,16 @@ void printGraph(short dnum) /* Which drawing to print */
{
short h,v; /* used for centering (h=horiz. , v=vert.) */
short wh,wv; /* Window horiz and vert */
TPrStatus
prStatus; /* Printing status record */
TPrStatus prStatus; /* Printing status record */
Rect prRect; /* the rectangle to print in */
TPPrPort prPort; /* the printing port */
short j; /* VG identifier for pass-through */
THPrint PrRecHandle; /* our print record handle */
short vs;
vs = VGgetVS(dnum);
if ( vs < 0 )
return;
PrRecHandle = PrintSetupRecord();
@ -119,8 +123,7 @@ void printGraph(short dnum) /* Which drawing to print */
prRect.left = (h- wh) /2;
prRect.bottom = prRect.top + wv;
prRect.right = prRect.left + wh;
j=VGnewwin(TEK_DEVICE_PICTURE,VGgetVS(dnum)); /* NCSA 2.5: fixed the print call */
j = VGnewwin(TEK_DEVICE_PICTURE, vs, VGgettektype(vs), VGgettekclear(vs));
RGMPsize( &prRect );
VGzcpy( dnum, j); /* Love dat zm factr */
VGredraw(dnum,j); /* Copy the picture in i to j */

View File

@ -132,6 +132,7 @@ struct VGWINTYPE {
short pencolor; /* current pen color */
short fontnum,charx,chary; /* char size */
short count; /* for temporary use in special state loops */
char tekclear;
char TEKtype; /* 4105 or 4014? added: 16jul90dsw */
char TEKMarker; /* 4105 marker type 17jul90dsw */
char TEKOutline; /* 4105 panel outline boolean */