Compare commits
4 Commits
ee85a728a7
...
62853faf1d
Author | SHA1 | Date |
---|---|---|
Cameron Henlin | 62853faf1d | |
camh | 02098ef064 | |
camh | 1ad6cd04b6 | |
camh | 34e352056d |
|
@ -14,14 +14,14 @@ Messages for Macintosh is built on a lot of technologies. The READMEs of each of
|
||||||
|
|
||||||
- [Retro68](https://github.com/autc04/Retro68) - a GCC-based cross compilation env for classic Macintosh systems
|
- [Retro68](https://github.com/autc04/Retro68) - a GCC-based cross compilation env for classic Macintosh systems
|
||||||
- [Nuklear Quickdraw](https://github.com/CamHenlin/nuklear-quickdraw) - a heavily modified, classic Macintosh-specific version of [Nuklear](https://github.com/Immediate-Mode-UI/Nuklear) allowing a simple way to provide GUI services
|
- [Nuklear Quickdraw](https://github.com/CamHenlin/nuklear-quickdraw) - a heavily modified, classic Macintosh-specific version of [Nuklear](https://github.com/Immediate-Mode-UI/Nuklear) allowing a simple way to provide GUI services
|
||||||
- [CoprocessorJS](https://github.com/CamHenlin/coprocessor.js) - a library that allows us to handle nodejs workloads sent over a serial port
|
- [CoprocessorJS](https://github.com/CamHenlin/coprocessor.js) - a library that allows us to handle nodejs workloads sent over a serial port to talk to [supporting software](https://github.com/CamHenlin/imessagegraphqlserver)
|
||||||
- [serialperformanceanalyzer](https://github.com/CamHenlin/serialperformanceanalyzer) - used to analyze the performance of many different parts of the application
|
- [serialperformanceanalyzer](https://github.com/CamHenlin/serialperformanceanalyzer) - used to analyze the performance of many different parts of the application
|
||||||
|
|
||||||
## Limitations / areas for improvement
|
## Limitations / areas for improvement
|
||||||
Messages for Macintosh is not perfect. Here are some known limitations and things that could be improved:
|
Messages for Macintosh is not perfect. Here are some known limitations and things that could be improved:
|
||||||
|
|
||||||
- 10 conversations at a time, with the ability to open a new conversation if you know the recipient's address book entry
|
- 10 conversations at a time, with the ability to open a new conversation if you know the recipient's address book entry. Nuklear supports scrolling and we could likely add more to the list, but the performance may begin degrading on 68000-based systems.
|
||||||
- Up to the most 15 recent messages are displayed in your selected chat. No pagination
|
- Up to the most 15 recent messages are displayed in your selected chat. No pagination. Nuklear supports scrolling so we could add more messages, but again it may be slow on 68000-based systems if we do that
|
||||||
- No image / emoji support (although emojis are generally translated to text)
|
- No image / emoji support (although emojis are generally translated to text)
|
||||||
|
|
||||||
## Pull requests and issues welcome
|
## Pull requests and issues welcome
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
IOParam outgoingSerialPortReference;
|
IOParam outgoingSerialPortReference;
|
||||||
IOParam incomingSerialPortReference;
|
IOParam incomingSerialPortReference;
|
||||||
// #define PRINT_ERRORS 1
|
// #define PRINT_ERRORS 1
|
||||||
#define DEBUGGING 1
|
// #define DEBUGGING 1
|
||||||
#define MAX_ATTEMPTS 10
|
#define MAX_ATTEMPTS 10
|
||||||
#define RECEIVE_WINDOW_SIZE 32767 // receive in up to 32kb chunks
|
#define RECEIVE_WINDOW_SIZE 32767 // receive in up to 32kb chunks
|
||||||
#define MAX_RECEIVE_SIZE 32767 // matching RECEIVE_WINDOW_SIZE for now
|
#define MAX_RECEIVE_SIZE 32767 // matching RECEIVE_WINDOW_SIZE for now
|
||||||
|
|
Binary file not shown.
Binary file not shown.
39
mac_main.c
39
mac_main.c
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
// #define MAC_APP_DEBUGGING
|
// #define MAC_APP_DEBUGGING
|
||||||
// #define PROFILING 1
|
// #define PROFILING 1
|
||||||
#define DEBUG_FUNCTION_CALLS
|
// #define DEBUG_FUNCTION_CALLS
|
||||||
#ifdef PROFILING
|
#ifdef PROFILING
|
||||||
|
|
||||||
OSErr writeSerialPortProfile(const char* str)
|
OSErr writeSerialPortProfile(const char* str)
|
||||||
|
@ -147,8 +147,10 @@ int main()
|
||||||
{
|
{
|
||||||
Initialize(); /* initialize the program */
|
Initialize(); /* initialize the program */
|
||||||
UnloadSeg((Ptr) Initialize); /* note that Initialize must not be in Main! */
|
UnloadSeg((Ptr) Initialize); /* note that Initialize must not be in Main! */
|
||||||
setupDebugSerialPort(boutRefNum);
|
#ifdef MAC_APP_DEBUGGING
|
||||||
writeSerialPortDebug(boutRefNum, "initializing messages for macintosh");
|
setupDebugSerialPort(boutRefNum);
|
||||||
|
writeSerialPortDebug(boutRefNum, "initializing messages for macintosh");
|
||||||
|
#endif
|
||||||
|
|
||||||
// run our nuklear app one time to render the window telling us to be patient for the coprocessor
|
// run our nuklear app one time to render the window telling us to be patient for the coprocessor
|
||||||
// app to load up
|
// app to load up
|
||||||
|
@ -161,7 +163,10 @@ int main()
|
||||||
|
|
||||||
char programResult[MAX_RECEIVE_SIZE];
|
char programResult[MAX_RECEIVE_SIZE];
|
||||||
sendProgramToCoprocessor((char *)OUTPUT_JS, programResult);
|
sendProgramToCoprocessor((char *)OUTPUT_JS, programResult);
|
||||||
writeSerialPortDebug(boutRefNum, "coprocessor loaded");
|
|
||||||
|
#ifdef MAC_APP_DEBUGGING
|
||||||
|
writeSerialPortDebug(boutRefNum, "coprocessor loaded");
|
||||||
|
#endif
|
||||||
|
|
||||||
coprocessorLoaded = 1;
|
coprocessorLoaded = 1;
|
||||||
|
|
||||||
|
@ -198,7 +203,7 @@ void EventLoop(struct nk_context *ctx)
|
||||||
ShowCursor();
|
ShowCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for new stuff every 10 sec?
|
// check for new stuff every x sec?
|
||||||
// note! this is used by some of the functionality in our nuklear_app to trigger
|
// note! this is used by some of the functionality in our nuklear_app to trigger
|
||||||
// new chat lookups
|
// new chat lookups
|
||||||
if (TickCount() - lastUpdatedTickCountMessagesInChat > 300) {
|
if (TickCount() - lastUpdatedTickCountMessagesInChat > 300) {
|
||||||
|
@ -597,7 +602,7 @@ void AdjustMenus()
|
||||||
if ( IsDAWindow(window) ) /* we can allow desk accessories to be closed from the menu */
|
if ( IsDAWindow(window) ) /* we can allow desk accessories to be closed from the menu */
|
||||||
EnableItem(menu, iClose);
|
EnableItem(menu, iClose);
|
||||||
else
|
else
|
||||||
DisableItem(menu, iClose); /* but not our traffic light window */
|
DisableItem(menu, iClose); /* but not our messages window */
|
||||||
|
|
||||||
menu = GetMenuHandle(mEdit);
|
menu = GetMenuHandle(mEdit);
|
||||||
if ( IsDAWindow(window) ) { /* a desk accessory might need the edit menuÉ */
|
if ( IsDAWindow(window) ) { /* a desk accessory might need the edit menuÉ */
|
||||||
|
@ -615,12 +620,16 @@ void AdjustMenus()
|
||||||
}
|
}
|
||||||
|
|
||||||
menu = GetMenuHandle(mLight);
|
menu = GetMenuHandle(mLight);
|
||||||
if ( IsAppWindow(window) ) { /* we know that it must be the traffic light */
|
if ( IsAppWindow(window) ) { /* this is the messages menu */
|
||||||
EnableItem(menu, iStop);
|
EnableItem(menu, NEW_MESSAGE);
|
||||||
EnableItem(menu, iGo);
|
EnableItem(menu, RESET_CHAT_LIST);
|
||||||
|
EnableItem(menu, REFRESH_MESSAGES);
|
||||||
|
EnableItem(menu, CLEAR_CHAT_INPUT);
|
||||||
} else {
|
} else {
|
||||||
DisableItem(menu, iStop);
|
DisableItem(menu, NEW_MESSAGE);
|
||||||
DisableItem(menu, iGo);
|
DisableItem(menu, RESET_CHAT_LIST);
|
||||||
|
DisableItem(menu, REFRESH_MESSAGES);
|
||||||
|
DisableItem(menu, CLEAR_CHAT_INPUT);
|
||||||
}
|
}
|
||||||
} /*AdjustMenus*/
|
} /*AdjustMenus*/
|
||||||
|
|
||||||
|
@ -680,6 +689,14 @@ void DoMenuCommand(menuResult)
|
||||||
case 2:
|
case 2:
|
||||||
getChats();
|
getChats();
|
||||||
break;
|
break;
|
||||||
|
case 3:
|
||||||
|
getMessages(activeChat, 0);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
memset(box_input_buffer, '\0', 2048);
|
||||||
|
box_input_len = 0;
|
||||||
|
forceRedrawMessages = 3;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
sendNewChat = 1;
|
sendNewChat = 1;
|
||||||
break;
|
break;
|
||||||
|
|
214
mac_main.h
214
mac_main.h
File diff suppressed because one or more lines are too long
|
@ -139,6 +139,10 @@ resource 'MENU' (mLight, preload) {
|
||||||
noicon, nokey, nomark, plain;
|
noicon, nokey, nomark, plain;
|
||||||
"Refresh Chat List",
|
"Refresh Chat List",
|
||||||
noicon, nokey, nomark, plain;
|
noicon, nokey, nomark, plain;
|
||||||
|
"Refresh Messages",
|
||||||
|
noicon, nokey, nomark, plain;
|
||||||
|
"Clear Chat Input",
|
||||||
|
noicon, nokey, nomark, plain;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
32
nuklear.h
32
nuklear.h
|
@ -17111,14 +17111,14 @@ nk_do_edit(nk_flags *state, struct nk_command_buffer *out,
|
||||||
cursor.y -= edit->scrollbar.y;
|
cursor.y -= edit->scrollbar.y;
|
||||||
nk_fill_rect(out, cursor, 0, cursor_color, true);
|
nk_fill_rect(out, cursor, 0, cursor_color, true);
|
||||||
|
|
||||||
// #ifdef COMMAND_CACHING
|
#ifdef COMMAND_CACHING
|
||||||
// struct nk_rect whiteTextarea2;
|
struct nk_rect whiteTextarea2;
|
||||||
// whiteTextarea2.x = cursor.x + cursor.w;
|
whiteTextarea2.x = cursor.x + cursor.w;
|
||||||
// whiteTextarea2.y = cursor.y - 2;
|
whiteTextarea2.y = cursor.y - 2;
|
||||||
// whiteTextarea2.h = cursor.h + 6;
|
whiteTextarea2.h = cursor.h + 6;
|
||||||
// whiteTextarea2.w = 9; //cursor.w * 2; // this was previously used when cursor.w = 4, doesn't work well at = 1
|
whiteTextarea2.w = 9; //cursor.w * 2; // this was previously used when cursor.w = 4, doesn't work well at = 1
|
||||||
// nk_fill_rect(out, whiteTextarea2, 0, qd.black, false);
|
nk_fill_rect(out, whiteTextarea2, 0, qd.black, false);
|
||||||
// #endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
/* draw cursor inside text */
|
/* draw cursor inside text */
|
||||||
// short glyph_len;
|
// short glyph_len;
|
||||||
|
@ -17175,14 +17175,14 @@ nk_do_edit(nk_flags *state, struct nk_command_buffer *out,
|
||||||
// background_color = whiteColor;
|
// background_color = whiteColor;
|
||||||
// else
|
// else
|
||||||
// background_color = background;
|
// background_color = background;
|
||||||
// #ifdef COMMAND_CACHING
|
#ifdef COMMAND_CACHING
|
||||||
// struct nk_rect whiteTextarea;
|
struct nk_rect whiteTextarea;
|
||||||
// whiteTextarea.x = area.x;
|
whiteTextarea.x = area.x;
|
||||||
// whiteTextarea.y = area.y;
|
whiteTextarea.y = area.y;
|
||||||
// whiteTextarea.h = area.h;
|
whiteTextarea.h = area.h;
|
||||||
// whiteTextarea.w = area.w;
|
whiteTextarea.w = area.w;
|
||||||
// nk_fill_rect(out, whiteTextarea, 0, qd.black, false);
|
nk_fill_rect(out, whiteTextarea, 0, qd.black, false);
|
||||||
// #endif
|
#endif
|
||||||
|
|
||||||
nk_edit_draw_text(out, style, area.x - edit->scrollbar.x, area.y - edit->scrollbar.y, 0, begin, l, row_height, font, style->normal, style->text_normal, nk_false, true);
|
nk_edit_draw_text(out, style, area.x - edit->scrollbar.x, area.y - edit->scrollbar.y, 0, begin, l, row_height, font, style->normal, style->text_normal, nk_false, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,7 +189,9 @@ void getChats() {
|
||||||
|
|
||||||
while (token != NULL) {
|
while (token != NULL) {
|
||||||
|
|
||||||
writeSerialPortDebug(boutRefNum, token);
|
#ifdef MESSAGES_FOR_MACINTOSH_DEBUGGING
|
||||||
|
writeSerialPortDebug(boutRefNum, token);
|
||||||
|
#endif
|
||||||
sprintf(&chatFriendlyNames[chatFriendlyNamesCounter++ * MAX_FRIENDLY_NAME_LENGTH], "%s", token);
|
sprintf(&chatFriendlyNames[chatFriendlyNamesCounter++ * MAX_FRIENDLY_NAME_LENGTH], "%s", token);
|
||||||
token = (char *)strtokm(NULL, ",");
|
token = (char *)strtokm(NULL, ",");
|
||||||
}
|
}
|
||||||
|
@ -249,8 +251,6 @@ void getChatCounts() {
|
||||||
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: getChatCounts");
|
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: getChatCounts");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
writeSerialPortDebug(boutRefNum, "getChatCounts!");
|
|
||||||
|
|
||||||
callFunctionOnCoprocessor("getChatCounts", "", chatCountFunctionResponse);
|
callFunctionOnCoprocessor("getChatCounts", "", chatCountFunctionResponse);
|
||||||
|
|
||||||
#ifdef MESSAGES_FOR_MACINTOSH_DEBUGGING
|
#ifdef MESSAGES_FOR_MACINTOSH_DEBUGGING
|
||||||
|
@ -261,7 +261,10 @@ void getChatCounts() {
|
||||||
// bail out if the responses ARE equal
|
// bail out if the responses ARE equal
|
||||||
if (!strcmp(chatCountFunctionResponse, previousChatCountFunctionResponse)) {
|
if (!strcmp(chatCountFunctionResponse, previousChatCountFunctionResponse)) {
|
||||||
|
|
||||||
writeSerialPortDebug(boutRefNum, "no need to update current chat count");
|
#ifdef MESSAGES_FOR_MACINTOSH_DEBUGGING
|
||||||
|
writeSerialPortDebug(boutRefNum, "no need to update current chat count");
|
||||||
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -415,13 +418,19 @@ void getHasNewMessagesInChat(char *thread) {
|
||||||
|
|
||||||
if (!strcmp(jsFunctionResponse, "true")) {
|
if (!strcmp(jsFunctionResponse, "true")) {
|
||||||
|
|
||||||
writeSerialPortDebug(boutRefNum, "update current chat");
|
#ifdef MESSAGES_FOR_MACINTOSH_DEBUGGING
|
||||||
|
writeSerialPortDebug(boutRefNum, "update current chat");
|
||||||
|
#endif
|
||||||
|
|
||||||
SysBeep(1);
|
SysBeep(1);
|
||||||
getMessages(thread, 0);
|
getMessages(thread, 0);
|
||||||
} else {
|
|
||||||
|
|
||||||
writeSerialPortDebug(boutRefNum, "do not update current chat");
|
|
||||||
}
|
}
|
||||||
|
#ifdef MESSAGES_FOR_MACINTOSH_DEBUGGING
|
||||||
|
else {
|
||||||
|
|
||||||
|
writeSerialPortDebug(boutRefNum, "do not update current chat");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#define ENABLED_DOUBLE_BUFFERING
|
#define ENABLED_DOUBLE_BUFFERING
|
||||||
#define COMMAND_CACHING
|
#define COMMAND_CACHING
|
||||||
#include "nuklear.h"
|
#include "nuklear.h"
|
||||||
#define NK_QUICKDRAW_GRAPHICS_DEBUGGING
|
// #define NK_QUICKDRAW_GRAPHICS_DEBUGGING
|
||||||
// #define DRAW_BLIT_LOCATION
|
// #define DRAW_BLIT_LOCATION
|
||||||
|
|
||||||
Boolean lastInputWasBackspace;
|
Boolean lastInputWasBackspace;
|
||||||
|
@ -495,12 +495,14 @@ void updateBounds(int top, int bottom, int left, int right) {
|
||||||
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: runDrawCommand");
|
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: runDrawCommand");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char x[255];
|
#ifdef NK_QUICKDRAW_GRAPHICS_DEBUGGING
|
||||||
sprintf(x, "cmd: %d", cmd->type);
|
char x[255];
|
||||||
writeSerialPortDebug(boutRefNum, x);
|
sprintf(x, "cmd: %d", cmd->type);
|
||||||
char y[255];
|
writeSerialPortDebug(boutRefNum, x);
|
||||||
sprintf(y, "lastCmd: %d", lastCmd->type);
|
char y[255];
|
||||||
writeSerialPortDebug(boutRefNum, y);
|
sprintf(y, "lastCmd: %d", lastCmd->type);
|
||||||
|
writeSerialPortDebug(boutRefNum, y);
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (cmd->type) {
|
switch (cmd->type) {
|
||||||
|
|
||||||
|
@ -562,7 +564,6 @@ void updateBounds(int top, int bottom, int left, int right) {
|
||||||
// http://mirror.informatimago.com/next/developer.apple.com/documentation/mac/QuickDraw/QuickDraw-102.html#MARKER-9-372
|
// http://mirror.informatimago.com/next/developer.apple.com/documentation/mac/QuickDraw/QuickDraw-102.html#MARKER-9-372
|
||||||
// http://mirror.informatimago.com/next/developer.apple.com/documentation/mac/QuickDraw/QuickDraw-103.html#HEADING103-0
|
// http://mirror.informatimago.com/next/developer.apple.com/documentation/mac/QuickDraw/QuickDraw-103.html#HEADING103-0
|
||||||
const struct nk_command_rect *r = (const struct nk_command_rect *)cmd;
|
const struct nk_command_rect *r = (const struct nk_command_rect *)cmd;
|
||||||
writeSerialPortDebug(boutRefNum, "NK_COMMAND_RECT2");
|
|
||||||
|
|
||||||
#ifdef COMMAND_CACHING
|
#ifdef COMMAND_CACHING
|
||||||
|
|
||||||
|
@ -575,26 +576,21 @@ void updateBounds(int top, int bottom, int left, int right) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
writeSerialPortDebug(boutRefNum, "NK_COMMAND_RECT3");
|
|
||||||
|
|
||||||
ForeColor(r->color);
|
ForeColor(r->color);
|
||||||
PenSize(r->line_thickness, r->line_thickness);
|
PenSize(r->line_thickness, r->line_thickness);
|
||||||
writeSerialPortDebug(boutRefNum, "NK_COMMAND_RECT4");
|
|
||||||
|
|
||||||
Rect quickDrawRectangle;
|
Rect quickDrawRectangle;
|
||||||
quickDrawRectangle.top = r->y;
|
quickDrawRectangle.top = r->y;
|
||||||
quickDrawRectangle.left = r->x;
|
quickDrawRectangle.left = r->x;
|
||||||
quickDrawRectangle.bottom = r->y + r->h;
|
quickDrawRectangle.bottom = r->y + r->h;
|
||||||
quickDrawRectangle.right = r->x + r->w;
|
quickDrawRectangle.right = r->x + r->w;
|
||||||
writeSerialPortDebug(boutRefNum, "NK_COMMAND_RECT5");
|
|
||||||
|
|
||||||
#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
|
||||||
writeSerialPortDebug(boutRefNum, "NK_COMMAND_RECT6");
|
|
||||||
|
|
||||||
FrameRoundRect(&quickDrawRectangle, r->rounding, r->rounding);
|
FrameRoundRect(&quickDrawRectangle, r->rounding, r->rounding);
|
||||||
writeSerialPortDebug(boutRefNum, "NK_COMMAND_RECT7 (done)");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -606,10 +602,8 @@ void updateBounds(int top, int bottom, int left, int right) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const struct nk_command_rect_filled *r = (const struct nk_command_rect_filled *)cmd;
|
const struct nk_command_rect_filled *r = (const struct nk_command_rect_filled *)cmd;
|
||||||
writeSerialPortDebug(boutRefNum, "NK_COMMAND_RECT_FILLED1");
|
|
||||||
|
|
||||||
if (r->allowCache == false) {
|
if (r->allowCache == false) {
|
||||||
writeSerialPortDebug(boutRefNum, "NK_COMMAND_RECT_FILLED2");
|
|
||||||
|
|
||||||
Rect quickDrawRectangle;
|
Rect quickDrawRectangle;
|
||||||
quickDrawRectangle.top = r->y;
|
quickDrawRectangle.top = r->y;
|
||||||
|
@ -617,17 +611,14 @@ void updateBounds(int top, int bottom, int left, int right) {
|
||||||
quickDrawRectangle.bottom = r->y + r->h;
|
quickDrawRectangle.bottom = r->y + r->h;
|
||||||
quickDrawRectangle.right = r->x + r->w;
|
quickDrawRectangle.right = r->x + r->w;
|
||||||
|
|
||||||
writeSerialPortDebug(boutRefNum, "NK_COMMAND_RECT_FILLED3");
|
|
||||||
#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
|
||||||
|
|
||||||
writeSerialPortDebug(boutRefNum, "NK_COMMAND_RECT_FILLED4");
|
|
||||||
FillRoundRect(&quickDrawRectangle, r->rounding, r->rounding, &qd.white);
|
FillRoundRect(&quickDrawRectangle, r->rounding, r->rounding, &qd.white);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
writeSerialPortDebug(boutRefNum, "NK_COMMAND_RECT_FILLED5");
|
|
||||||
#ifdef COMMAND_CACHING
|
#ifdef COMMAND_CACHING
|
||||||
|
|
||||||
if (!lastInputWasBackspace && cmd->type == lastCmd->type && memcmp(r, lastCmd, sizeof(struct nk_command_rect_filled)) == 0) {
|
if (!lastInputWasBackspace && cmd->type == lastCmd->type && memcmp(r, lastCmd, sizeof(struct nk_command_rect_filled)) == 0) {
|
||||||
|
@ -640,7 +631,6 @@ void updateBounds(int top, int bottom, int left, int right) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
writeSerialPortDebug(boutRefNum, "NK_COMMAND_RECT_FILLED6");
|
|
||||||
// TODO: to support coloring the lines, we need to map from qd Pattern types to integer colors
|
// TODO: to support coloring the lines, we need to map from qd Pattern types to integer colors
|
||||||
// color = nk_color_to_quickdraw_bw_color(r->color);
|
// color = nk_color_to_quickdraw_bw_color(r->color);
|
||||||
// ForeColor(color);
|
// ForeColor(color);
|
||||||
|
@ -654,18 +644,12 @@ void updateBounds(int top, int bottom, int left, int right) {
|
||||||
quickDrawRectangle.bottom = r->y + r->h;
|
quickDrawRectangle.bottom = r->y + r->h;
|
||||||
quickDrawRectangle.right = r->x + r->w;
|
quickDrawRectangle.right = r->x + r->w;
|
||||||
|
|
||||||
|
|
||||||
writeSerialPortDebug(boutRefNum, "NK_COMMAND_RECT_FILLED7");
|
|
||||||
|
|
||||||
#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
|
||||||
|
|
||||||
writeSerialPortDebug(boutRefNum, "NK_COMMAND_RECT_FILLED8");
|
|
||||||
FillRoundRect(&quickDrawRectangle, r->rounding, r->rounding, &r->color);
|
FillRoundRect(&quickDrawRectangle, r->rounding, r->rounding, &r->color);
|
||||||
writeSerialPortDebug(boutRefNum, "NK_COMMAND_RECT_FILLED9");
|
|
||||||
FrameRoundRect(&quickDrawRectangle, r->rounding, 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
|
||||||
writeSerialPortDebug(boutRefNum, "NK_COMMAND_RECT_FILLED10 (done)");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -1104,30 +1088,7 @@ void updateBounds(int top, int bottom, int left, int right) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef COMMAND_CACHING
|
#ifdef COMMAND_CACHING
|
||||||
int lastCalls = 0;
|
|
||||||
int currentCalls;
|
|
||||||
const struct nk_command *lastCmd;
|
const struct nk_command *lastCmd;
|
||||||
|
|
||||||
Boolean VALID_COMMANDS[18] = {
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
true
|
|
||||||
};
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NK_API void nk_quickdraw_render(WindowPtr window, struct nk_context *ctx) {
|
NK_API void nk_quickdraw_render(WindowPtr window, struct nk_context *ctx) {
|
||||||
|
@ -1136,10 +1097,6 @@ NK_API void nk_quickdraw_render(WindowPtr window, struct nk_context *ctx) {
|
||||||
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: nk_quickdraw_render");
|
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: nk_quickdraw_render");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef COMMAND_CACHING
|
|
||||||
currentCalls = 1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PROFILING
|
#ifdef PROFILING
|
||||||
PROFILE_START("IN nk_quickdraw_render");
|
PROFILE_START("IN nk_quickdraw_render");
|
||||||
#endif
|
#endif
|
||||||
|
@ -1195,7 +1152,7 @@ NK_API void nk_quickdraw_render(WindowPtr window, struct nk_context *ctx) {
|
||||||
writeSerialPortDebug(boutRefNum, "COMMAND_CACHING: get next cached command");
|
writeSerialPortDebug(boutRefNum, "COMMAND_CACHING: get next cached command");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (currentCalls < lastCalls && lastCmd && VALID_COMMANDS[lastCmd->type]) {
|
if (lastCmd && lastCmd->next) {
|
||||||
|
|
||||||
#ifdef NK_QUICKDRAW_GRAPHICS_DEBUGGING
|
#ifdef NK_QUICKDRAW_GRAPHICS_DEBUGGING
|
||||||
writeSerialPortDebug(boutRefNum, "COMMAND_CACHING: inside conditional");
|
writeSerialPortDebug(boutRefNum, "COMMAND_CACHING: inside conditional");
|
||||||
|
@ -1207,7 +1164,6 @@ NK_API void nk_quickdraw_render(WindowPtr window, struct nk_context *ctx) {
|
||||||
#ifdef NK_QUICKDRAW_GRAPHICS_DEBUGGING
|
#ifdef NK_QUICKDRAW_GRAPHICS_DEBUGGING
|
||||||
writeSerialPortDebug(boutRefNum, "COMMAND_CACHING: done getting lastCmd");
|
writeSerialPortDebug(boutRefNum, "COMMAND_CACHING: done getting lastCmd");
|
||||||
#endif
|
#endif
|
||||||
currentCalls++;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1228,7 +1184,6 @@ NK_API void nk_quickdraw_render(WindowPtr window, struct nk_context *ctx) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef COMMAND_CACHING
|
#ifdef COMMAND_CACHING
|
||||||
lastCalls = currentCalls;
|
|
||||||
lastInputWasBackspace = false;
|
lastInputWasBackspace = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue