diff --git a/ruamoko/qwaq/qwaq-app.h b/ruamoko/qwaq/qwaq-app.h index d8b899624..7062ad096 100644 --- a/ruamoko/qwaq/qwaq-app.h +++ b/ruamoko/qwaq/qwaq-app.h @@ -1,18 +1,21 @@ #ifndef __qwaq_app_h #define __qwaq_app_h +#include + #include "event.h" -#include "qwaq-group.h" -@class Screen; +@class Group; -@interface QwaqApplication: Group +@interface QwaqApplication: Object { qwaq_event_t event; qwaq_command endState; - Screen *screen; + + Group *objects; } -run; +-draw; -handleEvent: (qwaq_event_t *) event; @end diff --git a/ruamoko/qwaq/qwaq-app.r b/ruamoko/qwaq/qwaq-app.r index fffe51c7b..5b5889768 100644 --- a/ruamoko/qwaq/qwaq-app.r +++ b/ruamoko/qwaq/qwaq-app.r @@ -38,16 +38,17 @@ arp_end (void) init_pair (1, COLOR_WHITE, COLOR_BLUE); init_pair (2, COLOR_WHITE, COLOR_BLACK); - screen = [[Screen screen] retain]; - [self insert:screen]; - [screen setBackground: COLOR_PAIR (1)]; - Rect r = *[screen getRect]; + TextContext *screen = [TextContext screen]; + objects = [[Group alloc] initWithContext: screen]; + + [screen bkgd: COLOR_PAIR (1)]; + Rect r = { nil, [screen size] }; r.offset.x = r.extent.width / 4; r.offset.y = r.extent.height / 4; r.extent.width /= 2; r.extent.height /= 2; Window *w; - [self insert: w=[[Window windowWithRect: r] setBackground: COLOR_PAIR (2)]]; + [objects insert: w=[[Window windowWithRect: r] setBackground: COLOR_PAIR (2)]]; //wprintf (w.window, "%d %d %d %d\n", r.offset.x, r.offset.y, r.extent.width, r.ylen); return self; } @@ -70,14 +71,14 @@ arp_end (void) -draw { - [super draw]; + [objects draw]; [TextContext refresh]; return self; } -handleEvent: (qwaq_event_t *) event { - [screen handleEvent: event]; + [objects handleEvent: event]; if (event.what == qe_key && event.key == '\x18') { event.what = qe_command; event.message.command = qc_exit; diff --git a/ruamoko/qwaq/qwaq-group.h b/ruamoko/qwaq/qwaq-group.h index b599a0c36..be251b243 100644 --- a/ruamoko/qwaq/qwaq-group.h +++ b/ruamoko/qwaq/qwaq-group.h @@ -31,8 +31,9 @@ typedef BOOL condition_func2 (id object, void *anObject, void *data); { Array *views; int focused; - TextContext *buffer; + id buffer; //FIXME id or sim } +-initWithContext: (id) context; //FIXME id or sim -insert: (View *) view; -remove: (View *) view; @end diff --git a/ruamoko/qwaq/qwaq-group.r b/ruamoko/qwaq/qwaq-group.r index 6b8296182..57a5eb8a6 100644 --- a/ruamoko/qwaq/qwaq-group.r +++ b/ruamoko/qwaq/qwaq-group.r @@ -66,11 +66,16 @@ @end @implementation Group --init + +-initWithContext: (id) context { if (!(self = [super init])) { return nil; } + textContext = context; + absRect = rect = { nil, [textContext size] }; + printf ("\n\nsize:%d %d\n\n", rect.extent.width, rect.extent.height); + buffer = [DrawBuffer buffer: rect.extent]; views = [[Array array] retain]; return self; } @@ -92,6 +97,7 @@ -insert: (View *) view { [views addObject: view]; + view.textContext = buffer; return self; } @@ -114,13 +120,8 @@ not_dont_draw (id aView, void *aGroup) { View *view = aView; Group *group = (Group *) aGroup; - if (!(view.options & ofDontDraw)) { - if (!view.textContext) { - view.textContext = group.buffer; - } - return YES; - } - return NO; + + return !(view.options & ofDontDraw); } -draw diff --git a/ruamoko/qwaq/qwaq-screen.h b/ruamoko/qwaq/qwaq-screen.h index c51910d0e..9ec2ba8f3 100644 --- a/ruamoko/qwaq/qwaq-screen.h +++ b/ruamoko/qwaq/qwaq-screen.h @@ -10,7 +10,6 @@ } +(Screen *) screen; -handleEvent: (qwaq_event_t *) event; --setBackground: (int) ch; @end #endif//__qwaq_screen_h diff --git a/ruamoko/qwaq/qwaq-screen.r b/ruamoko/qwaq/qwaq-screen.r index 5b2db43ce..16d3f1be6 100644 --- a/ruamoko/qwaq/qwaq-screen.r +++ b/ruamoko/qwaq/qwaq-screen.r @@ -29,20 +29,14 @@ -draw { - update_panels (); - [TextContext doupdate]; return self; } -redraw { - [textContext refresh]; - return self; -} - --setBackground: (int) ch -{ - [textContext bkgd:ch]; + //update_panels (); + [TextContext refresh]; + //[TextContext doupdate]; return self; } diff --git a/ruamoko/qwaq/qwaq-view.h b/ruamoko/qwaq/qwaq-view.h index 086b9d12d..e6b5bd47e 100644 --- a/ruamoko/qwaq/qwaq-view.h +++ b/ruamoko/qwaq/qwaq-view.h @@ -57,6 +57,7 @@ enum { -(struct Rect_s *)getRect; -draw; -redraw; +-handleEvent: (qwaq_event_t *) event; - (void) refresh; - (void) mvprintf: (Point) pos, string fmt, ...; diff --git a/ruamoko/qwaq/qwaq-view.r b/ruamoko/qwaq/qwaq-view.r index 19df51b9c..b005dd4de 100644 --- a/ruamoko/qwaq/qwaq-view.r +++ b/ruamoko/qwaq/qwaq-view.r @@ -126,5 +126,9 @@ updateScreenCursor (View *view) [textContext mvaddch: pos, ch]; } +-handleEvent: (qwaq_event_t *) event +{ + return self; +} @end