From f9d798c31439a6528df041944dd1a2496fccb676 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 10 Mar 2020 02:58:30 +0900 Subject: [PATCH] [qwaq] Use forwarding for some text methods refresh won't be in the drawing buffer protocol, and the move commands need to be offset by the view's position in its window, but it works as intended. --- ruamoko/qwaq/qwaq-view.h | 10 +++++++--- ruamoko/qwaq/qwaq-view.r | 20 ++++++++------------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ruamoko/qwaq/qwaq-view.h b/ruamoko/qwaq/qwaq-view.h index 10e0c93ae..086b9d12d 100644 --- a/ruamoko/qwaq/qwaq-view.h +++ b/ruamoko/qwaq/qwaq-view.h @@ -59,12 +59,16 @@ enum { -redraw; - (void) refresh; -- (void) printf: (string) fmt, ...; -- (void) vprintf: (string) fmt, @va_list args; -- (void) addch: (int) ch; - (void) mvprintf: (Point) pos, string fmt, ...; - (void) mvvprintf: (Point) pos, string fmt, @va_list args; - (void) mvaddch: (Point) pos, int ch; @end +//These are forwarded (FIXME make a protocol) +@interface View (TextContext) +- (void) printf: (string) fmt, ...; +- (void) vprintf: (string) fmt, @va_list args; +- (void) addch: (int) ch; +@end + #endif//__qwaq_view_h diff --git a/ruamoko/qwaq/qwaq-view.r b/ruamoko/qwaq/qwaq-view.r index fc0ccf90f..98cdf4429 100644 --- a/ruamoko/qwaq/qwaq-view.r +++ b/ruamoko/qwaq/qwaq-view.r @@ -89,14 +89,15 @@ updateScreenCursor (View *view) return ▭ } -- (void) printf: (string) fmt, ... +- (void) forward: (SEL) sel : (@va_list) args { - [textContext vprintf: fmt, @args]; -} - -- (void) vprintf: (string) fmt, @va_list args -{ - [textContext vprintf: fmt, args]; + if (!textContext) { + return; + } + if (!__obj_responds_to (textContext, sel)) { + [self error: "no implementation for %s", sel_get_name (sel)]; + } + obj_msg_sendv (textContext, sel, args); } - (void) refresh @@ -104,11 +105,6 @@ updateScreenCursor (View *view) [textContext refresh]; } -- (void) addch: (int) ch -{ - [textContext addch:ch]; -} - - (void) mvprintf: (Point) pos, string fmt, ... { pos.x += xpos;