1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 18:07:59 +00:00

Cursor painting is now _right_ and scrollbar removal works better.

[originally from svn r101]
This commit is contained in:
Ben Harris 1999-03-14 15:51:34 +00:00
parent 0494727737
commit 61504ef68c

View File

@ -1,4 +1,4 @@
/* $Id: macterm.c,v 1.1.2.20 1999/03/14 13:08:43 ben Exp $ */ /* $Id: macterm.c,v 1.1.2.21 1999/03/14 15:51:34 ben Exp $ */
/* /*
* Copyright (c) 1999 Ben Harris * Copyright (c) 1999 Ben Harris
* All rights reserved. * All rights reserved.
@ -54,8 +54,10 @@
#define DEFAULT_FG_BOLD 17 #define DEFAULT_FG_BOLD 17
#define DEFAULT_BG 18 #define DEFAULT_BG 18
#define DEFAULT_BG_BOLD 19 #define DEFAULT_BG_BOLD 19
#define CURSOR_FG 22 #define CURSOR_FG 20
#define CURSOR_FG_BOLD 23 #define CURSOR_FG_BOLD 21
#define CURSOR_BG 22
#define CURSOR_BG_BOLD 23
#define PTOCC(x) ((x) < 0 ? -(-(x - font_width - 1) / font_width) : \ #define PTOCC(x) ((x) < 0 ? -(-(x - font_width - 1) / font_width) : \
(x) / font_width) (x) / font_width)
@ -546,8 +548,10 @@ void mac_activateterm(WindowPtr window, Boolean active) {
term_update(); term_update();
if (active) if (active)
ShowControl(s->scrollbar); ShowControl(s->scrollbar);
else else {
PmBackColor(DEFAULT_BG); /* HideControl clears behind the control */
HideControl(s->scrollbar); HideControl(s->scrollbar);
}
} }
void mac_updateterm(WindowPtr window) { void mac_updateterm(WindowPtr window) {
@ -619,58 +623,81 @@ void do_text(struct mac_session *s, int x, int y, char *text, int len,
style |= underline; style |= underline;
TextFace(style); TextFace(style);
TextSize(cfg.fontheight); TextSize(cfg.fontheight);
if (attr & ATTR_REVERSE)
TextMode(notSrcCopy);
else
TextMode(srcCopy);
SetFractEnable(FALSE); /* We want characters on pixel boundaries */ SetFractEnable(FALSE); /* We want characters on pixel boundaries */
textrgn = NewRgn(); textrgn = NewRgn();
RectRgn(textrgn, &a.textrect); RectRgn(textrgn, &a.textrect);
DeviceLoop(textrgn, do_text_for_device, (long)&a, 0); DeviceLoop(textrgn, do_text_for_device, (long)&a, 0);
/* Tell the window manager about it in case this isn't an update */
DisposeRgn(textrgn); DisposeRgn(textrgn);
/* Tell the window manager about it in case this isn't an update */
ValidRect(&a.textrect); ValidRect(&a.textrect);
} }
static pascal void do_text_for_device(short depth, short devflags, static pascal void do_text_for_device(short depth, short devflags,
GDHandle device, long cookie) { GDHandle device, long cookie) {
struct do_text_args *a; struct do_text_args *a;
int bgcolour, fgcolour; int bgcolour, fgcolour, bright;
a = (struct do_text_args *)cookie; a = (struct do_text_args *)cookie;
bright = (a->attr & ATTR_BOLD) && cfg.bold_colour;
if (a->attr & ATTR_REVERSE)
TextMode(notSrcCopy);
else
TextMode(srcCopy);
switch (depth) { switch (depth) {
case 1: case 1:
/* XXX This should be done with a _little_ more configurability */ /* XXX This should be done with a _little_ more configurability */
ForeColor(whiteColor); ForeColor(whiteColor);
BackColor(blackColor); BackColor(blackColor);
if (a->attr & ATTR_ACTCURS)
TextMode((a->attr & ATTR_REVERSE) ? srcCopy : notSrcCopy);
break; break;
case 2: case 2:
if ((a->attr & ATTR_BOLD) && cfg.bold_colour) if (a->attr & ATTR_ACTCURS) {
PmForeColor(DEFAULT_FG_BOLD); PmForeColor(bright ? CURSOR_FG_BOLD : CURSOR_FG);
else PmBackColor(CURSOR_BG);
PmForeColor(DEFAULT_FG); TextMode(srcCopy);
if (a->attr & ATTR_ACTCURS) } else {
PmBackColor(CURSOR_FG); PmForeColor(bright ? DEFAULT_FG_BOLD : DEFAULT_FG);
else
PmBackColor(DEFAULT_BG); PmBackColor(DEFAULT_BG);
}
break; break;
default: default:
fgcolour = ((a->attr & ATTR_FGMASK) >> ATTR_FGSHIFT) * 2; if (a->attr & ATTR_ACTCURS) {
bgcolour = ((a->attr & ATTR_BGMASK) >> ATTR_BGSHIFT) * 2; fgcolour = (bright ? CURSOR_FG_BOLD : CURSOR_FG);
if ((a->attr & ATTR_BOLD) && cfg.bold_colour) bgcolour = CURSOR_BG;
if (a->attr & ATTR_REVERSE) TextMode(srcCopy);
bgcolour++; } else {
else fgcolour = ((a->attr & ATTR_FGMASK) >> ATTR_FGSHIFT) * 2;
fgcolour++; bgcolour = ((a->attr & ATTR_BGMASK) >> ATTR_BGSHIFT) * 2;
if (a->attr & ATTR_ACTCURS) if (bright)
bgcolour = CURSOR_FG; if (a->attr & ATTR_REVERSE)
bgcolour++;
else
fgcolour++;
}
PmForeColor(fgcolour); PmForeColor(fgcolour);
PmBackColor(bgcolour); PmBackColor(bgcolour);
break; break;
} }
MoveTo(a->textrect.left, a->textrect.top + a->s->font_ascent); MoveTo(a->textrect.left, a->textrect.top + a->s->font_ascent);
DrawText(a->text, 0, a->len); DrawText(a->text, 0, a->len);
if (a->attr & ATTR_PASCURS) {
PenNormal();
switch (depth) {
case 1:
PenMode(patXor);
break;
default:
PmForeColor(CURSOR_BG);
break;
}
FrameRect(&a->textrect);
}
} }
/* /*