AmendHub

Download:

jcs

/

wifi_da

/

amendments

/

28

main: Make debug logging suck much less

ScrollRect the whole window to act like a scrolling TextEdit control

jcs made amendment 28 2 months ago
--- main.c Wed Oct 25 10:47:21 2023 +++ main.c Thu Sep 19 20:59:25 2024 @@ -34,7 +34,6 @@ MenuHandle menu, apple_menu; short menuID = 0; WindowPtr win = 0L; Cursor watch; -short logger_y = 12; WindowPtr logger = 0; short main(cntrlParam *p, DCtlPtr d, short n); @@ -296,23 +295,22 @@ logger_vprintf(const char *format, va_list ap) static char buf[512]; GrafPtr savePort; ssize_t len; + RgnHandle clip; len = vsnprintf(buf, sizeof(buf), format, ap); GetPort(&savePort); SetPort(logger); - - if (logger_y >= (logger->portRect.bottom - logger->portRect.top)) { - EraseRect(&logger->portRect); - logger_y = 12; - } - - MoveTo(4, logger_y); + + clip = NewRgn(); + ScrollRect(&logger->portRect, 0, -11, clip); + DisposeRgn(clip); + + MoveTo(4, logger->portRect.bottom - 4); TextFont(geneva); TextSize(9); DrawText(buf, 0, len); - logger_y += 10; - + ValidRect(&logger->portRect); SetPort(savePort); }