From 115541877a8a1ab83a5de079b9d9087e2fefee51 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 26 Mar 2020 09:01:39 +0900 Subject: [PATCH] [qwaq] Set up an application color palette Nothing special, just all the combinations of the 8 colors --- ruamoko/qwaq/qwaq-app.h | 2 ++ ruamoko/qwaq/qwaq-app.r | 12 +++++++----- ruamoko/qwaq/qwaq-editor.r | 5 +++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/ruamoko/qwaq/qwaq-app.h b/ruamoko/qwaq/qwaq-app.h index 3facb0bc6..36cb41cef 100644 --- a/ruamoko/qwaq/qwaq-app.h +++ b/ruamoko/qwaq/qwaq-app.h @@ -11,6 +11,8 @@ @class TextContext; @class View; +extern int color_palette[64]; + @interface QwaqApplication: Object { qwaq_event_t event; diff --git a/ruamoko/qwaq/qwaq-app.r b/ruamoko/qwaq/qwaq-app.r index 7a9e6ed97..19c9740c1 100644 --- a/ruamoko/qwaq/qwaq-app.r +++ b/ruamoko/qwaq/qwaq-app.r @@ -10,6 +10,8 @@ int fence; #include "qwaq-group.h" #include "qwaq-view.h" +int color_palette[64]; + static AutoreleasePool *autorelease_pool; static void arp_start (void) @@ -37,16 +39,16 @@ arp_end (void) } initialize (); - init_pair (1, COLOR_WHITE, COLOR_BLUE); - init_pair (2, COLOR_WHITE, COLOR_BLACK); - init_pair (3, COLOR_BLACK, COLOR_GREEN); - init_pair (4, COLOR_YELLOW, COLOR_RED); + for (int i = 1; i < 64; i++) { + init_pair (i, i & 0x7, i >> 3); + color_palette[i] = COLOR_PAIR (i); + } screen = [TextContext screen]; screenSize = [screen size]; objects = [[Group alloc] initWithContext: screen owner: nil]; - [screen bkgd: COLOR_PAIR (1)]; + [screen bkgd: color_palette[047]]; [screen scrollok: 1]; [screen clear]; wrefresh (stdscr);//FIXME diff --git a/ruamoko/qwaq/qwaq-editor.r b/ruamoko/qwaq/qwaq-editor.r index 6bf9e3389..770b4158d 100644 --- a/ruamoko/qwaq/qwaq-editor.r +++ b/ruamoko/qwaq/qwaq-editor.r @@ -1,5 +1,5 @@ #include -#include "color.h" +#include "qwaq-app.h" #include "qwaq-editor.h" #include "qwaq-listener.h" @@ -37,7 +37,8 @@ int *lbuf = [linebuffer buffer]; for (int y = 0; y < ylen; y++) { lind = [buffer formatLine:lind from:scroll.x into:lbuf width:xlen - highlight:selection colors: {COLOR_PAIR (1), COLOR_PAIR(2)}]; + highlight:selection colors: {color_palette[047], + color_palette[007]}]; [textContext blitFromBuffer: linebuffer to: {xpos, ypos + y} from: [linebuffer rect]]; }