Browse Source

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

This reverts commit bac0b03481.
master
cancel 5 years ago
parent
commit
51c3d68d1b
  1. 9
      term_util.c
  2. 7
      term_util.h
  3. 18
      tui_main.c

9
term_util.c

@ -66,7 +66,6 @@ void term_util_init_colors() {
struct Qmsg { struct Qmsg {
Qblock qblock; Qblock qblock;
Qmsg_dismiss_type dismiss_type;
}; };
struct Qmenu { struct Qmenu {
@ -207,10 +206,9 @@ void qmsg_set_title(Qmsg* qm, char const* title) {
qblock_set_title(&qm->qblock, title); 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)); Qmsg* qm = malloc(sizeof(Qmsg));
qblock_init(&qm->qblock, Qblock_type_qmsg); qblock_init(&qm->qblock, Qblock_type_qmsg);
qm->dismiss_type = dismiss_type;
qnav_stack_push(&qm->qblock, height, width); qnav_stack_push(&qm->qblock, height, width);
return qm; return qm;
} }
@ -224,11 +222,6 @@ bool qmsg_drive(Qmsg* qm, int key) {
case KEY_ENTER: case KEY_ENTER:
return true; 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; return false;
} }

7
term_util.h

@ -74,11 +74,6 @@ typedef struct {
typedef struct Qmsg Qmsg; typedef struct Qmsg Qmsg;
typedef enum {
Qmsg_dismiss_easily,
Qmsg_dismiss_deliberately,
} Qmsg_dismiss_type;
typedef struct Qmenu Qmenu; typedef struct Qmenu Qmenu;
typedef enum { typedef enum {
@ -121,7 +116,7 @@ void qnav_stack_pop(void);
void qblock_print_frame(Qblock* qb, bool active); void qblock_print_frame(Qblock* qb, bool active);
void qblock_set_title(Qblock* qb, char const* title); 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); WINDOW* qmsg_window(Qmsg* qm);
void qmsg_set_title(Qmsg* qm, char const* title); void qmsg_set_title(Qmsg* qm, char const* title);
bool qmsg_drive(Qmsg* qm, int key); bool qmsg_drive(Qmsg* qm, int key);

18
tui_main.c

@ -1779,8 +1779,7 @@ void push_about_msg(void) {
width += hpad * 2; width += hpad * 2;
int logo_left_pad = (width - cols) / 2; int logo_left_pad = (width - cols) / 2;
int footer_left_pad = (width - footer_len) / 2; int footer_left_pad = (width - footer_len) / 2;
Qmsg* qm = Qmsg* qm = qmsg_push(tpad + rows + sep + 1 + bpad, width);
qmsg_push(tpad + rows + sep + 1 + bpad, width, Qmsg_dismiss_deliberately);
WINDOW* w = qmsg_window(qm); WINDOW* w = qmsg_window(qm);
for (int row = 0; row < rows; ++row) { for (int row = 0; row < rows; ++row) {
wmove(w, row + tpad, logo_left_pad); wmove(w, row + tpad, logo_left_pad);
@ -1851,8 +1850,7 @@ void push_controls_msg(void) {
} }
int mid_pad = 2; int mid_pad = 2;
int total_width = 1 + w_input + mid_pad + w_desc; int total_width = 1 + w_input + mid_pad + w_desc;
Qmsg* qm = qmsg_push(ORCA_ARRAY_COUNTOF(items), total_width, Qmsg* qm = qmsg_push(ORCA_ARRAY_COUNTOF(items), total_width);
Qmsg_dismiss_deliberately);
qmsg_set_title(qm, "Controls"); qmsg_set_title(qm, "Controls");
WINDOW* w = qmsg_window(qm); WINDOW* w = qmsg_window(qm);
for (int i = 0; i < (int)ORCA_ARRAY_COUNTOF(items); ++i) { for (int i = 0; i < (int)ORCA_ARRAY_COUNTOF(items); ++i) {
@ -1867,7 +1865,7 @@ void push_controls_msg(void) {
} }
} }
void push_opers_guide_msg(Qmsg_dismiss_type dismiss_type) { void push_opers_guide_msg(void) {
struct Guide_item { struct Guide_item {
char glyph; char glyph;
char const* name; char const* name;
@ -1921,7 +1919,7 @@ void push_opers_guide_msg(Qmsg_dismiss_type dismiss_type) {
int left_pad = 1; int left_pad = 1;
int mid_pad = 1; int mid_pad = 1;
int total_width = left_pad + 1 + mid_pad + w_desc; 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"); qmsg_set_title(qm, "Operators");
WINDOW* w = qmsg_window(qm); WINDOW* w = qmsg_window(qm);
for (int i = 0; i < (int)ORCA_ARRAY_COUNTOF(items); ++i) { for (int i = 0; i < (int)ORCA_ARRAY_COUNTOF(items); ++i) {
@ -1938,7 +1936,7 @@ void try_save_with_msg(Ged* ged) {
if (!ged->filename) if (!ged->filename)
return; return;
bool ok = hacky_try_save(&ged->field, ged->filename); 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); WINDOW* msgw = qmsg_window(msg);
wmove(msgw, 0, 1); wmove(msgw, 0, 1);
if (ok) { if (ok) {
@ -2256,8 +2254,6 @@ int main(int argc, char** argv) {
// Send initial BPM // Send initial BPM
send_num_message(ged_state.oosc_dev, "/orca/bpm", (I32)ged_state.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 (;;) { for (;;) {
switch (key) { switch (key) {
case ERR: { case ERR: {
@ -2430,7 +2426,7 @@ int main(int argc, char** argv) {
push_controls_msg(); push_controls_msg();
break; break;
case Main_menu_opers_guide: case Main_menu_opers_guide:
push_opers_guide_msg(Qmsg_dismiss_deliberately); push_opers_guide_msg();
break; break;
case Main_menu_about: case Main_menu_about:
push_about_msg(); push_about_msg();
@ -2642,7 +2638,7 @@ int main(int argc, char** argv) {
push_controls_msg(); push_controls_msg();
break; break;
case CTRL_PLUS('g'): case CTRL_PLUS('g'):
push_opers_guide_msg(Qmsg_dismiss_deliberately); push_opers_guide_msg();
break; break;
case CTRL_PLUS('s'): case CTRL_PLUS('s'):
try_save_with_msg(&ged_state); try_save_with_msg(&ged_state);

Loading…
Cancel
Save