add some small quality of life functionality to the messages menu, re-introduce white backgrounds to some text, cut potential release

This commit is contained in:
camh 2022-02-25 23:35:59 -08:00
parent 1ad6cd04b6
commit 02098ef064
7 changed files with 277 additions and 35 deletions

Binary file not shown.

Binary file not shown.

View File

@ -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;

File diff suppressed because one or more lines are too long

View File

@ -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;
} }
}; };

View File

@ -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);
} }

View File

@ -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;
} }