mirror of
https://github.com/CamHenlin/MessagesForMacintosh.git
synced 2024-05-31 21:41:33 +00:00
new chat fixes, about dialog fixes
This commit is contained in:
parent
d806e62373
commit
1e205315c8
|
@ -5,7 +5,7 @@ const createHttpLink = require('apollo-link-http').createHttpLink;
|
||||||
const gql = require('graphql-tag')
|
const gql = require('graphql-tag')
|
||||||
|
|
||||||
// TEST_MODE can be turned on or off to prevent communications with the Apollo iMessage Server running on your moder Mac
|
// TEST_MODE can be turned on or off to prevent communications with the Apollo iMessage Server running on your moder Mac
|
||||||
const TEST_MODE = true
|
const TEST_MODE = false
|
||||||
|
|
||||||
const defaultOptions = {
|
const defaultOptions = {
|
||||||
watchQuery: {
|
watchQuery: {
|
||||||
|
|
|
@ -160,7 +160,7 @@ resource 'MENU' (mHelp, preload) {
|
||||||
|
|
||||||
/* this ALRT and DITL are used as an About screen */
|
/* this ALRT and DITL are used as an About screen */
|
||||||
resource 'ALRT' (rAboutAlert, purgeable) {
|
resource 'ALRT' (rAboutAlert, purgeable) {
|
||||||
{40, 20, 160, 290},
|
{40, 20, 160, 412},
|
||||||
rAboutAlert,
|
rAboutAlert,
|
||||||
{ /* array: 4 elements */
|
{ /* array: 4 elements */
|
||||||
/* [1] */
|
/* [1] */
|
||||||
|
@ -178,7 +178,7 @@ resource 'ALRT' (rAboutAlert, purgeable) {
|
||||||
resource 'DITL' (rAboutAlert, purgeable) {
|
resource 'DITL' (rAboutAlert, purgeable) {
|
||||||
{ /* array DITLarray: 5 elements */
|
{ /* array DITLarray: 5 elements */
|
||||||
/* [1] */
|
/* [1] */
|
||||||
{88, 180, 108, 260},
|
{88, 380, 108, 260},
|
||||||
Button {
|
Button {
|
||||||
enabled,
|
enabled,
|
||||||
"OK"
|
"OK"
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
// TODO:
|
// TODO:
|
||||||
// - IN PROGRESS new message window -- needs to blank out messages, then needs fixes on new mac end
|
// - IN PROGRESS new message window -- needs to blank out messages, then needs fixes on new mac end
|
||||||
// - chat during the day for a few minutes and figure out small issues
|
|
||||||
// - start writing blog posts
|
|
||||||
// - get new messages in other chats and display some sort of alert
|
// - get new messages in other chats and display some sort of alert
|
||||||
// - need timeout on serial messages in case the computer at the other end dies (prevent hard reset)
|
// - need timeout on serial messages in case the computer at the other end dies (prevent hard reset) -- probably possible in coprocessorjs library
|
||||||
// - delete doesnt work right (leaves characters at end of string)
|
// - delete doesnt work right (leaves characters at end of string)
|
||||||
|
|
||||||
#define WINDOW_WIDTH 510
|
#define WINDOW_WIDTH 510
|
||||||
|
@ -105,7 +103,7 @@ void getMessagesFromjsFunctionResponse() {
|
||||||
void sendMessage() {
|
void sendMessage() {
|
||||||
|
|
||||||
char output[2048];
|
char output[2048];
|
||||||
sprintf(output, "%s&&&%s", activeChat, box_input_buffer);
|
sprintf(output, "%s&&&%.*s", activeChat, box_input_len, box_input_buffer);
|
||||||
|
|
||||||
memset(&box_input_buffer, '\0', 2048);
|
memset(&box_input_buffer, '\0', 2048);
|
||||||
sprintf(box_input_buffer, "");
|
sprintf(box_input_buffer, "");
|
||||||
|
@ -125,8 +123,7 @@ void sendMessage() {
|
||||||
void sendIPAddressToCoprocessor() {
|
void sendIPAddressToCoprocessor() {
|
||||||
|
|
||||||
char output[2048];
|
char output[2048];
|
||||||
sprintf(output, "%s", ip_input_buffer);
|
sprintf(output, "%.*s", ip_input_buffer_len, ip_input_buffer);
|
||||||
|
|
||||||
|
|
||||||
writeSerialPortDebug(boutRefNum, output);
|
writeSerialPortDebug(boutRefNum, output);
|
||||||
callFunctionOnCoprocessor("setIPAddress", output, jsFunctionResponse);
|
callFunctionOnCoprocessor("setIPAddress", output, jsFunctionResponse);
|
||||||
|
@ -276,21 +273,34 @@ static void nuklearApp(struct nk_context *ctx) {
|
||||||
// prompt the user for new chat
|
// prompt the user for new chat
|
||||||
if (sendNewChat) {
|
if (sendNewChat) {
|
||||||
|
|
||||||
if (nk_begin_titled(ctx, "Enter New Message Recipient", "Enter New Message Recipient", nk_rect(WINDOW_WIDTH / 4, WINDOW_HEIGHT / 4, WINDOW_WIDTH / 2, 120), NK_WINDOW_TITLE|NK_WINDOW_BORDER)) {
|
if (nk_begin_titled(ctx, "Enter New Message Recipient", "Enter New Message Recipient", nk_rect(50, WINDOW_HEIGHT / 4, WINDOW_WIDTH - 100, 140), NK_WINDOW_TITLE|NK_WINDOW_BORDER)) {
|
||||||
|
|
||||||
|
nk_layout_row_begin(ctx, NK_STATIC, 30, 1);
|
||||||
|
{
|
||||||
|
nk_layout_row_push(ctx, WINDOW_WIDTH - 120);
|
||||||
|
nk_label(ctx, "this is known to be a bit finnicky,", NK_TEXT_ALIGN_LEFT);
|
||||||
|
nk_layout_row_push(ctx, WINDOW_WIDTH - 120);
|
||||||
|
nk_label(ctx, "input exact phone number", NK_TEXT_ALIGN_LEFT);
|
||||||
|
}
|
||||||
|
nk_layout_row_end(ctx);
|
||||||
|
|
||||||
nk_layout_row_begin(ctx, NK_STATIC, 30, 2);
|
nk_layout_row_begin(ctx, NK_STATIC, 30, 2);
|
||||||
{
|
{
|
||||||
|
nk_layout_row_push(ctx, WINDOW_WIDTH / 2);
|
||||||
nk_layout_row_push(ctx, WINDOW_WIDTH / 2 - 110);
|
|
||||||
nk_edit_string(ctx, NK_EDIT_SIMPLE, new_message_input_buffer, &new_message_input_buffer_len, 2048, nk_filter_default);
|
nk_edit_string(ctx, NK_EDIT_SIMPLE, new_message_input_buffer, &new_message_input_buffer_len, 2048, nk_filter_default);
|
||||||
nk_layout_row_push(ctx, 80);
|
nk_layout_row_push(ctx, 100);
|
||||||
|
|
||||||
if (nk_button_label(ctx, "open chat")) {
|
if (nk_button_label(ctx, "open chat")) {
|
||||||
|
|
||||||
sendNewChat = 0;
|
sendNewChat = 0;
|
||||||
forceRedraw = 2;
|
forceRedraw = 2;
|
||||||
|
|
||||||
sprintf(activeChat, new_message_input_buffer);
|
sprintf(activeChat, "%.*s", new_message_input_buffer_len, new_message_input_buffer);
|
||||||
|
|
||||||
|
for (int i = 0; i < MAX_CHAT_MESSAGES; i++) {
|
||||||
|
|
||||||
|
memset(&activeChatMessages[i], '\0', 2048);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nk_layout_row_end(ctx);
|
nk_layout_row_end(ctx);
|
||||||
|
@ -376,12 +386,12 @@ static void nuklearApp(struct nk_context *ctx) {
|
||||||
|
|
||||||
if (forceRedraw) {
|
if (forceRedraw) {
|
||||||
|
|
||||||
forceRedraw--;
|
forceRedraw = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drawChatsOneMoreTime) {
|
if (drawChatsOneMoreTime) {
|
||||||
|
|
||||||
drawChatsOneMoreTime--;
|
drawChatsOneMoreTime = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ NK_API NkQuickDrawFont* nk_quickdraw_font_create_from_file();
|
||||||
*
|
*
|
||||||
* ===============================================================
|
* ===============================================================
|
||||||
*/
|
*/
|
||||||
#define MAX_MEMORY_IN_KB 6
|
#define MAX_MEMORY_IN_KB 4
|
||||||
#ifdef NK_QUICKDRAW_IMPLEMENTATION
|
#ifdef NK_QUICKDRAW_IMPLEMENTATION
|
||||||
#ifndef NK_QUICKDRAW_TEXT_MAX
|
#ifndef NK_QUICKDRAW_TEXT_MAX
|
||||||
#define NK_QUICKDRAW_TEXT_MAX 256
|
#define NK_QUICKDRAW_TEXT_MAX 256
|
||||||
|
@ -561,10 +561,10 @@ void updateBounds(int top, int bottom, int left, int right) {
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
Rect quickDrawRectangle;
|
Rect quickDrawRectangle;
|
||||||
quickDrawRectangle.top = (int)s->y;
|
quickDrawRectangle.top = s->y;
|
||||||
quickDrawRectangle.left = (int)s->x;
|
quickDrawRectangle.left = s->x;
|
||||||
quickDrawRectangle.bottom = (int)s->y + (int)s->h;
|
quickDrawRectangle.bottom = s->y + s->h;
|
||||||
quickDrawRectangle.right = (int)s->x + (int)s->w;
|
quickDrawRectangle.right = s->x + s->w;
|
||||||
|
|
||||||
#ifdef ENABLED_DOUBLE_BUFFERING
|
#ifdef ENABLED_DOUBLE_BUFFERING
|
||||||
// we use "-8192" here to filter out nuklear "nk_null_rect" which we do not want updating bounds
|
// we use "-8192" here to filter out nuklear "nk_null_rect" which we do not want updating bounds
|
||||||
|
@ -577,36 +577,6 @@ void updateBounds(int top, int bottom, int left, int right) {
|
||||||
ClipRect(&quickDrawRectangle);
|
ClipRect(&quickDrawRectangle);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
|
||||||
case NK_COMMAND_LINE: {
|
|
||||||
|
|
||||||
#ifdef NK_QUICKDRAW_GRAPHICS_DEBUGGING
|
|
||||||
|
|
||||||
writeSerialPortDebug(boutRefNum, "NK_COMMAND_LINE");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const struct nk_command_line *l = (const struct nk_command_line *)cmd;
|
|
||||||
|
|
||||||
#ifdef COMMAND_CACHING
|
|
||||||
|
|
||||||
if (cmd->type == lastCmd->type && memcmp(l, lastCmd, sizeof(struct nk_command_line)) == 0) {
|
|
||||||
|
|
||||||
#ifdef NK_QUICKDRAW_GRAPHICS_DEBUGGING
|
|
||||||
writeSerialPortDebug(boutRefNum, "ALREADY DREW CMD nk_command_line");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
color = nk_color_to_quickdraw_bw_color(l->color);
|
|
||||||
// great reference: http://mirror.informatimago.com/next/developer.apple.com/documentation/mac/QuickDraw/QuickDraw-60.html
|
|
||||||
ForeColor(color);
|
|
||||||
PenSize((int)l->line_thickness, (int)l->line_thickness);
|
|
||||||
MoveTo((int)l->begin.x, (int)l->begin.y);
|
|
||||||
LineTo((int)l->end.x, (int)l->end.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case NK_COMMAND_RECT: {
|
case NK_COMMAND_RECT: {
|
||||||
|
|
||||||
|
@ -633,19 +603,19 @@ void updateBounds(int top, int bottom, int left, int right) {
|
||||||
color = nk_color_to_quickdraw_bw_color(r->color);
|
color = nk_color_to_quickdraw_bw_color(r->color);
|
||||||
|
|
||||||
ForeColor(color);
|
ForeColor(color);
|
||||||
PenSize((int)r->line_thickness, (int)r->line_thickness);
|
PenSize(r->line_thickness, r->line_thickness);
|
||||||
|
|
||||||
Rect quickDrawRectangle;
|
Rect quickDrawRectangle;
|
||||||
quickDrawRectangle.top = (int)r->y;
|
quickDrawRectangle.top = r->y;
|
||||||
quickDrawRectangle.left = (int)r->x;
|
quickDrawRectangle.left = r->x;
|
||||||
quickDrawRectangle.bottom = (int)r->y + (int)r->h;
|
quickDrawRectangle.bottom = r->y + r->h;
|
||||||
quickDrawRectangle.right = (int)r->x + (int)r->w;
|
quickDrawRectangle.right = r->x + r->w;
|
||||||
|
|
||||||
#ifdef ENABLED_DOUBLE_BUFFERING
|
#ifdef ENABLED_DOUBLE_BUFFERING
|
||||||
updateBounds(quickDrawRectangle.top, quickDrawRectangle.bottom, quickDrawRectangle.left, quickDrawRectangle.right);
|
updateBounds(quickDrawRectangle.top, quickDrawRectangle.bottom, quickDrawRectangle.left, quickDrawRectangle.right);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FrameRoundRect(&quickDrawRectangle, (float)r->rounding, (float)r->rounding);
|
FrameRoundRect(&quickDrawRectangle, r->rounding, r->rounding);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -661,16 +631,16 @@ void updateBounds(int top, int bottom, int left, int right) {
|
||||||
if (r->allowCache == false) {
|
if (r->allowCache == false) {
|
||||||
|
|
||||||
Rect quickDrawRectangle;
|
Rect quickDrawRectangle;
|
||||||
quickDrawRectangle.top = (int)r->y;
|
quickDrawRectangle.top = r->y;
|
||||||
quickDrawRectangle.left = (int)r->x;
|
quickDrawRectangle.left = r->x;
|
||||||
quickDrawRectangle.bottom = (int)r->y + (int)r->h;
|
quickDrawRectangle.bottom = r->y + r->h;
|
||||||
quickDrawRectangle.right = (int)r->x + (int)r->w;
|
quickDrawRectangle.right = r->x + r->w;
|
||||||
|
|
||||||
#ifdef ENABLED_DOUBLE_BUFFERING
|
#ifdef ENABLED_DOUBLE_BUFFERING
|
||||||
updateBounds(quickDrawRectangle.top, quickDrawRectangle.bottom, quickDrawRectangle.left, quickDrawRectangle.right);
|
updateBounds(quickDrawRectangle.top, quickDrawRectangle.bottom, quickDrawRectangle.left, quickDrawRectangle.right);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FillRoundRect(&quickDrawRectangle, (float)r->rounding, (float)r->rounding, &qd.white);
|
FillRoundRect(&quickDrawRectangle, r->rounding, r->rounding, &qd.white);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -692,17 +662,96 @@ void updateBounds(int top, int bottom, int left, int right) {
|
||||||
PenSize(1.0, 1.0);
|
PenSize(1.0, 1.0);
|
||||||
|
|
||||||
Rect quickDrawRectangle;
|
Rect quickDrawRectangle;
|
||||||
quickDrawRectangle.top = (int)r->y;
|
quickDrawRectangle.top = r->y;
|
||||||
quickDrawRectangle.left = (int)r->x;
|
quickDrawRectangle.left = r->x;
|
||||||
quickDrawRectangle.bottom = (int)r->y + (int)r->h;
|
quickDrawRectangle.bottom = r->y + r->h;
|
||||||
quickDrawRectangle.right = (int)r->x + (int)r->w;
|
quickDrawRectangle.right = r->x + r->w;
|
||||||
|
|
||||||
#ifdef ENABLED_DOUBLE_BUFFERING
|
#ifdef ENABLED_DOUBLE_BUFFERING
|
||||||
updateBounds(quickDrawRectangle.top, quickDrawRectangle.bottom, quickDrawRectangle.left, quickDrawRectangle.right);
|
updateBounds(quickDrawRectangle.top, quickDrawRectangle.bottom, quickDrawRectangle.left, quickDrawRectangle.right);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FillRoundRect(&quickDrawRectangle, (float)r->rounding, (float)r->rounding, &colorPattern);
|
FillRoundRect(&quickDrawRectangle, r->rounding, r->rounding, &colorPattern);
|
||||||
FrameRoundRect(&quickDrawRectangle, (float)r->rounding, (float)r->rounding); // http://mirror.informatimago.com/next/developer.apple.com/documentation/mac/QuickDraw/QuickDraw-105.html#HEADING105-0
|
FrameRoundRect(&quickDrawRectangle, r->rounding, r->rounding); // http://mirror.informatimago.com/next/developer.apple.com/documentation/mac/QuickDraw/QuickDraw-105.html#HEADING105-0
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case NK_COMMAND_TEXT: {
|
||||||
|
|
||||||
|
const struct nk_command_text *t = (const struct nk_command_text*)cmd;
|
||||||
|
|
||||||
|
#ifdef COMMAND_CACHING
|
||||||
|
if (t->allowCache && cmd->type == lastCmd->type && memcmp(t, lastCmd, sizeof(struct nk_command_text)) == 0) {
|
||||||
|
|
||||||
|
#ifdef NK_QUICKDRAW_GRAPHICS_DEBUGGING
|
||||||
|
char log[255];
|
||||||
|
|
||||||
|
sprintf(log, "ALREADY DREW CMD nk_command_text string: \"%s\", height: %d, length: %d, x: %d, y: %d, allowCache: %d", t->string, t->height, t->length, t->x, t->y, t->allowCache);
|
||||||
|
writeSerialPortDebug(boutRefNum, log);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef NK_QUICKDRAW_GRAPHICS_DEBUGGING
|
||||||
|
|
||||||
|
char log[255];
|
||||||
|
|
||||||
|
sprintf(log, "NK_COMMAND_TEXT string: \"%s\", height: %d, length: %d, x: %d, y: %d, allowCache: %d", t->string, t->height, t->length, t->x, t->y, t->allowCache);
|
||||||
|
writeSerialPortDebug(boutRefNum, log);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Rect quickDrawRectangle;
|
||||||
|
quickDrawRectangle.top = t->y;
|
||||||
|
quickDrawRectangle.left = t->x;
|
||||||
|
quickDrawRectangle.bottom = t->y + 15;
|
||||||
|
quickDrawRectangle.right = t->x + _get_text_width((const char*)t->string, (int)t->length);
|
||||||
|
|
||||||
|
#ifdef ENABLED_DOUBLE_BUFFERING
|
||||||
|
updateBounds(quickDrawRectangle.top, quickDrawRectangle.bottom, quickDrawRectangle.left, quickDrawRectangle.right);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef COMMAND_CACHING
|
||||||
|
EraseRect(&quickDrawRectangle);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
color = nk_color_to_quickdraw_bw_color(t->foreground);
|
||||||
|
ForeColor(color);
|
||||||
|
MoveTo(t->x, t->y + t->height);
|
||||||
|
|
||||||
|
PenSize(1.0, 1.0);
|
||||||
|
DrawText((const char*)t->string, 0, t->length);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case NK_COMMAND_LINE: {
|
||||||
|
|
||||||
|
#ifdef NK_QUICKDRAW_GRAPHICS_DEBUGGING
|
||||||
|
|
||||||
|
writeSerialPortDebug(boutRefNum, "NK_COMMAND_LINE");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
const struct nk_command_line *l = (const struct nk_command_line *)cmd;
|
||||||
|
|
||||||
|
#ifdef COMMAND_CACHING
|
||||||
|
|
||||||
|
if (cmd->type == lastCmd->type && memcmp(l, lastCmd, sizeof(struct nk_command_line)) == 0) {
|
||||||
|
|
||||||
|
#ifdef NK_QUICKDRAW_GRAPHICS_DEBUGGING
|
||||||
|
writeSerialPortDebug(boutRefNum, "ALREADY DREW CMD nk_command_line");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
color = nk_color_to_quickdraw_bw_color(l->color);
|
||||||
|
// great reference: http://mirror.informatimago.com/next/developer.apple.com/documentation/mac/QuickDraw/QuickDraw-60.html
|
||||||
|
ForeColor(color);
|
||||||
|
PenSize(l->line_thickness, l->line_thickness);
|
||||||
|
MoveTo(l->begin.x, l->begin.y);
|
||||||
|
LineTo(l->end.x, l->end.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -730,10 +779,10 @@ void updateBounds(int top, int bottom, int left, int right) {
|
||||||
|
|
||||||
ForeColor(color);
|
ForeColor(color);
|
||||||
Rect quickDrawRectangle;
|
Rect quickDrawRectangle;
|
||||||
quickDrawRectangle.top = (int)c->y;
|
quickDrawRectangle.top = c->y;
|
||||||
quickDrawRectangle.left = (int)c->x;
|
quickDrawRectangle.left = c->x;
|
||||||
quickDrawRectangle.bottom = (int)c->y + (int)c->h;
|
quickDrawRectangle.bottom = c->y + c->h;
|
||||||
quickDrawRectangle.right = (int)c->x + (int)c->w;
|
quickDrawRectangle.right = c->x + c->w;
|
||||||
|
|
||||||
#ifdef ENABLED_DOUBLE_BUFFERING
|
#ifdef ENABLED_DOUBLE_BUFFERING
|
||||||
updateBounds(quickDrawRectangle.top, quickDrawRectangle.bottom, quickDrawRectangle.left, quickDrawRectangle.right);
|
updateBounds(quickDrawRectangle.top, quickDrawRectangle.bottom, quickDrawRectangle.left, quickDrawRectangle.right);
|
||||||
|
@ -770,10 +819,10 @@ void updateBounds(int top, int bottom, int left, int right) {
|
||||||
// BackPat(&colorPattern); // inside macintosh: imaging with quickdraw 3-48
|
// BackPat(&colorPattern); // inside macintosh: imaging with quickdraw 3-48
|
||||||
PenSize(1.0, 1.0);
|
PenSize(1.0, 1.0);
|
||||||
Rect quickDrawRectangle;
|
Rect quickDrawRectangle;
|
||||||
quickDrawRectangle.top = (int)c->y;
|
quickDrawRectangle.top = c->y;
|
||||||
quickDrawRectangle.left = (int)c->x;
|
quickDrawRectangle.left = c->x;
|
||||||
quickDrawRectangle.bottom = (int)c->y + (int)c->h;
|
quickDrawRectangle.bottom = c->y + c->h;
|
||||||
quickDrawRectangle.right = (int)c->x + (int)c->w;
|
quickDrawRectangle.right = c->x + c->w;
|
||||||
|
|
||||||
#ifdef ENABLED_DOUBLE_BUFFERING
|
#ifdef ENABLED_DOUBLE_BUFFERING
|
||||||
updateBounds(quickDrawRectangle.top, quickDrawRectangle.bottom, quickDrawRectangle.left, quickDrawRectangle.right);
|
updateBounds(quickDrawRectangle.top, quickDrawRectangle.bottom, quickDrawRectangle.left, quickDrawRectangle.right);
|
||||||
|
@ -808,12 +857,12 @@ void updateBounds(int top, int bottom, int left, int right) {
|
||||||
color = nk_color_to_quickdraw_bw_color(t->color);
|
color = nk_color_to_quickdraw_bw_color(t->color);
|
||||||
|
|
||||||
ForeColor(color);
|
ForeColor(color);
|
||||||
PenSize((int)t->line_thickness, (int)t->line_thickness);
|
PenSize(t->line_thickness, t->line_thickness);
|
||||||
|
|
||||||
MoveTo((int)t->a.x, (int)t->a.y);
|
MoveTo(t->a.x, t->a.y);
|
||||||
LineTo((int)t->b.x, (int)t->b.y);
|
LineTo(t->b.x, t->b.y);
|
||||||
LineTo((int)t->c.x, (int)t->c.y);
|
LineTo(t->c.x, t->c.y);
|
||||||
LineTo((int)t->a.x, (int)t->a.y);
|
LineTo(t->a.x, t->a.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -844,10 +893,10 @@ void updateBounds(int top, int bottom, int left, int right) {
|
||||||
ForeColor(color);
|
ForeColor(color);
|
||||||
|
|
||||||
PolyHandle trianglePolygon = OpenPoly();
|
PolyHandle trianglePolygon = OpenPoly();
|
||||||
MoveTo((int)t->a.x, (int)t->a.y);
|
MoveTo(t->a.x, t->a.y);
|
||||||
LineTo((int)t->b.x, (int)t->b.y);
|
LineTo(t->b.x, t->b.y);
|
||||||
LineTo((int)t->c.x, (int)t->c.y);
|
LineTo(t->c.x, t->c.y);
|
||||||
LineTo((int)t->a.x, (int)t->a.y);
|
LineTo(t->a.x, t->a.y);
|
||||||
ClosePoly();
|
ClosePoly();
|
||||||
|
|
||||||
FillPoly(trianglePolygon, &colorPattern);
|
FillPoly(trianglePolygon, &colorPattern);
|
||||||
|
@ -982,56 +1031,6 @@ void updateBounds(int top, int bottom, int left, int right) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
|
||||||
case NK_COMMAND_TEXT: {
|
|
||||||
|
|
||||||
const struct nk_command_text *t = (const struct nk_command_text*)cmd;
|
|
||||||
|
|
||||||
#ifdef COMMAND_CACHING
|
|
||||||
if (t->allowCache && cmd->type == lastCmd->type && memcmp(t, lastCmd, sizeof(struct nk_command_text)) == 0) {
|
|
||||||
|
|
||||||
#ifdef NK_QUICKDRAW_GRAPHICS_DEBUGGING
|
|
||||||
char log[255];
|
|
||||||
|
|
||||||
sprintf(log, "ALREADY DREW CMD nk_command_text string: \"%s\", height: %d, length: %d, x: %d, y: %d, allowCache: %d", t->string, t->height, t->length, t->x, t->y, t->allowCache);
|
|
||||||
writeSerialPortDebug(boutRefNum, log);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef NK_QUICKDRAW_GRAPHICS_DEBUGGING
|
|
||||||
|
|
||||||
char log[255];
|
|
||||||
|
|
||||||
sprintf(log, "NK_COMMAND_TEXT string: \"%s\", height: %d, length: %d, x: %d, y: %d, allowCache: %d", t->string, t->height, t->length, t->x, t->y, t->allowCache);
|
|
||||||
writeSerialPortDebug(boutRefNum, log);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Rect quickDrawRectangle;
|
|
||||||
quickDrawRectangle.top = (int)t->y;
|
|
||||||
quickDrawRectangle.left = (int)t->x;
|
|
||||||
quickDrawRectangle.bottom = (int)t->y + 15;
|
|
||||||
quickDrawRectangle.right = (int)t->x + _get_text_width((const char*)t->string, (int)t->length);
|
|
||||||
|
|
||||||
#ifdef ENABLED_DOUBLE_BUFFERING
|
|
||||||
updateBounds(quickDrawRectangle.top, quickDrawRectangle.bottom, quickDrawRectangle.left, quickDrawRectangle.right);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// if (!t->allowCache) {
|
|
||||||
|
|
||||||
EraseRect(&quickDrawRectangle);
|
|
||||||
// }
|
|
||||||
|
|
||||||
color = nk_color_to_quickdraw_bw_color(t->foreground);
|
|
||||||
ForeColor(color);
|
|
||||||
MoveTo((int)t->x, (int)t->y + (int)t->height);
|
|
||||||
|
|
||||||
PenSize(1.0, 1.0);
|
|
||||||
DrawText((const char*)t->string, 0, (int)t->length);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case NK_COMMAND_CURVE: {
|
case NK_COMMAND_CURVE: {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user