shithub: orca

Download patch

ref: 51c3d68d1b0342876c05e4637043fae41f8ac5a5
parent: bac0b034810bdb5bfda0cdc45235c7c567ae0575
author: cancel <cancel@cancel.fm>
date: Wed Jan 1 00:17:42 EST 2020

Revert "Add auto-display of operators guide at startup"

This reverts commit bac0b034810bdb5bfda0cdc45235c7c567ae0575.

--- a/term_util.c
+++ b/term_util.c
@@ -66,7 +66,6 @@
 
 struct Qmsg {
   Qblock qblock;
-  Qmsg_dismiss_type dismiss_type;
 };
 
 struct Qmenu {
@@ -207,10 +206,9 @@
   qblock_set_title(&qm->qblock, title);
 }
 
-Qmsg* qmsg_push(int height, int width, Qmsg_dismiss_type dismiss_type) {
+Qmsg* qmsg_push(int height, int width) {
   Qmsg* qm = malloc(sizeof(Qmsg));
   qblock_init(&qm->qblock, Qblock_type_qmsg);
-  qm->dismiss_type = dismiss_type;
   qnav_stack_push(&qm->qblock, height, width);
   return qm;
 }
@@ -222,11 +220,6 @@
   case 27:
   case '\r':
   case KEY_ENTER:
-    return true;
-  }
-  // TODO do we need some smarter filter here? What kinds of control codes do
-  // we need to ignore so that we only dismiss on keyboard events?
-  if (qm->dismiss_type == Qmsg_dismiss_easily) {
     return true;
   }
   return false;
--- a/term_util.h
+++ b/term_util.h
@@ -74,11 +74,6 @@
 
 typedef struct Qmsg Qmsg;
 
-typedef enum {
-  Qmsg_dismiss_easily,
-  Qmsg_dismiss_deliberately,
-} Qmsg_dismiss_type;
-
 typedef struct Qmenu Qmenu;
 
 typedef enum {
@@ -121,7 +116,7 @@
 void qblock_print_frame(Qblock* qb, bool active);
 void qblock_set_title(Qblock* qb, char const* title);
 
-Qmsg* qmsg_push(int height, int width, Qmsg_dismiss_type dismiss_type);
+Qmsg* qmsg_push(int height, int width);
 WINDOW* qmsg_window(Qmsg* qm);
 void qmsg_set_title(Qmsg* qm, char const* title);
 bool qmsg_drive(Qmsg* qm, int key);
--- a/tui_main.c
+++ b/tui_main.c
@@ -1779,8 +1779,7 @@
   width += hpad * 2;
   int logo_left_pad = (width - cols) / 2;
   int footer_left_pad = (width - footer_len) / 2;
-  Qmsg* qm =
-      qmsg_push(tpad + rows + sep + 1 + bpad, width, Qmsg_dismiss_deliberately);
+  Qmsg* qm = qmsg_push(tpad + rows + sep + 1 + bpad, width);
   WINDOW* w = qmsg_window(qm);
   for (int row = 0; row < rows; ++row) {
     wmove(w, row + tpad, logo_left_pad);
@@ -1851,8 +1850,7 @@
   }
   int mid_pad = 2;
   int total_width = 1 + w_input + mid_pad + w_desc;
-  Qmsg* qm = qmsg_push(ORCA_ARRAY_COUNTOF(items), total_width,
-                       Qmsg_dismiss_deliberately);
+  Qmsg* qm = qmsg_push(ORCA_ARRAY_COUNTOF(items), total_width);
   qmsg_set_title(qm, "Controls");
   WINDOW* w = qmsg_window(qm);
   for (int i = 0; i < (int)ORCA_ARRAY_COUNTOF(items); ++i) {
@@ -1867,7 +1865,7 @@
   }
 }
 
-void push_opers_guide_msg(Qmsg_dismiss_type dismiss_type) {
+void push_opers_guide_msg(void) {
   struct Guide_item {
     char glyph;
     char const* name;
@@ -1921,7 +1919,7 @@
   int left_pad = 1;
   int mid_pad = 1;
   int total_width = left_pad + 1 + mid_pad + w_desc;
-  Qmsg* qm = qmsg_push(ORCA_ARRAY_COUNTOF(items), total_width, dismiss_type);
+  Qmsg* qm = qmsg_push(ORCA_ARRAY_COUNTOF(items), total_width);
   qmsg_set_title(qm, "Operators");
   WINDOW* w = qmsg_window(qm);
   for (int i = 0; i < (int)ORCA_ARRAY_COUNTOF(items); ++i) {
@@ -1938,7 +1936,7 @@
   if (!ged->filename)
     return;
   bool ok = hacky_try_save(&ged->field, ged->filename);
-  Qmsg* msg = qmsg_push(3, 50, Qmsg_dismiss_deliberately);
+  Qmsg* msg = qmsg_push(3, 50);
   WINDOW* msgw = qmsg_window(msg);
   wmove(msgw, 0, 1);
   if (ok) {
@@ -2256,8 +2254,6 @@
   // Send initial BPM
   send_num_message(ged_state.oosc_dev, "/orca/bpm", (I32)ged_state.bpm);
 
-  push_opers_guide_msg(Qmsg_dismiss_easily); // I don't know about this
-
   for (;;) {
     switch (key) {
     case ERR: {
@@ -2430,7 +2426,7 @@
                 push_controls_msg();
                 break;
               case Main_menu_opers_guide:
-                push_opers_guide_msg(Qmsg_dismiss_deliberately);
+                push_opers_guide_msg();
                 break;
               case Main_menu_about:
                 push_about_msg();
@@ -2642,7 +2638,7 @@
       push_controls_msg();
       break;
     case CTRL_PLUS('g'):
-      push_opers_guide_msg(Qmsg_dismiss_deliberately);
+      push_opers_guide_msg();
       break;
     case CTRL_PLUS('s'):
       try_save_with_msg(&ged_state);