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

View File

@ -3,6 +3,7 @@
short VSinit(short max); short VSinit(short max);
short VSiscapturing(short w); short VSiscapturing(short w);
short VSisprinting(short w); short VSisprinting(short w);
Boolean VSisvt7bit(short w);
void ClosePrintingFile(short w); void ClosePrintingFile(short w);
Boolean VSopencapture(short scrn_num, short w); Boolean VSopencapture(short scrn_num, short w);
void VSclosecapture(short w); void VSclosecapture(short w);
@ -11,7 +12,7 @@ short VSvalids(short w);
VSscrn *VSwhereis(short i); VSscrn *VSwhereis(short i);
void VSIclrbuf(void); void VSIclrbuf(void);
short VSnewscreen(short vtemulation, short maxlines, short screensave, short numLines, 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 VSdestroy(short w);
short VSredraw(short w, short x1, short y1, short x2, short y2); short VSredraw(short w, short x1, short y1, short x2, short y2);
short VSOredraw(short, short, short, short, short); short VSOredraw(short, short, short, short, short);

View File

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

View File

@ -5,6 +5,7 @@
short VSIclip(short *x1, short *y1, short *x2, short *y2, short *n, short *offset); 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 VSIcdellines(short w, short top, short bottom, short n, short scrolled);
short VSIcinslines(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 VSIcurson(short w, short x, short y, short ForceMove);
void VSIcuroff(short w); void VSIcuroff(short w);
short VSIcursorenabled( void ); 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 Boolean gPresentOpenConnectionDialog;
extern unsigned long gPresentOpenConnectionTicks; extern unsigned long gPresentOpenConnectionTicks;
static void ProcessURLEscapeCodes (char *url, char **end); static void ProcessURLEscapeCodes (char *url, char **end);
void AEunload(void) { } void AEunload(void) { }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -282,6 +282,11 @@ void pasteText(short scrn)
SetHandleSize(tw->outhand, uploadLength); SetHandleSize(tw->outhand, uploadLength);
if ( GetTranslationIndex(tw->outnational) != kTRJIS ) if ( GetTranslationIndex(tw->outnational) != kTRJIS )
tw->outhand = htrbuf_mac_nat(tw, tw->outhand); 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); HLock(tw->outhand);
tw->outptr = *tw->outhand; tw->outptr = *tw->outhand;
tw->outlen = GetHandleSize(tw->outhand); tw->outlen = GetHandleSize(tw->outhand);
@ -295,6 +300,11 @@ void pasteText(short scrn)
//pasteText(scrn); //pasteText(scrn);
netputevent(USERCLASS, PASTELEFT, scrn, 0); netputevent(USERCLASS, PASTELEFT, scrn, 0);
return; return;
} else {
// translation failed...
SysBeep(5);
tw->outlen = 0;
}
} }
} }
@ -303,8 +313,10 @@ void pasteText(short scrn)
tw->clientflags &= ~PASTE_IN_PROGRESS; tw->clientflags &= ~PASTE_IN_PROGRESS;
if (tw->isUploading) if (tw->isUploading)
FSClose(tw->uploadRefNum); FSClose(tw->uploadRefNum);
if ( tw->outhand ) {
HUnlock(tw->outhand); HUnlock(tw->outhand);
DisposeHandle(tw->outhand); DisposeHandle(tw->outhand);
}
tw->outptr = (char *) 0L; tw->outptr = (char *) 0L;
tw->outhand = (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 h,v; /* used for centering (h=horiz. , v=vert.) */
short wh,wv; /* Window horiz and vert */ short wh,wv; /* Window horiz and vert */
TPrStatus TPrStatus prStatus; /* Printing status record */
prStatus; /* Printing status record */
Rect prRect; /* the rectangle to print in */ Rect prRect; /* the rectangle to print in */
TPPrPort prPort; /* the printing port */ TPPrPort prPort; /* the printing port */
short j; /* VG identifier for pass-through */ short j; /* VG identifier for pass-through */
THPrint PrRecHandle; /* our print record handle */ THPrint PrRecHandle; /* our print record handle */
short vs;
vs = VGgetVS(dnum);
if ( vs < 0 )
return;
PrRecHandle = PrintSetupRecord(); PrRecHandle = PrintSetupRecord();
@ -119,8 +123,7 @@ void printGraph(short dnum) /* Which drawing to print */
prRect.left = (h- wh) /2; prRect.left = (h- wh) /2;
prRect.bottom = prRect.top + wv; prRect.bottom = prRect.top + wv;
prRect.right = prRect.left + wh; prRect.right = prRect.left + wh;
j = VGnewwin(TEK_DEVICE_PICTURE, vs, VGgettektype(vs), VGgettekclear(vs));
j=VGnewwin(TEK_DEVICE_PICTURE,VGgetVS(dnum)); /* NCSA 2.5: fixed the print call */
RGMPsize( &prRect ); RGMPsize( &prRect );
VGzcpy( dnum, j); /* Love dat zm factr */ VGzcpy( dnum, j); /* Love dat zm factr */
VGredraw(dnum,j); /* Copy the picture in i to j */ VGredraw(dnum,j); /* Copy the picture in i to j */

View File

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