#pragma once #include #include #include #include #include #include #include "panes/list.h" #include "panes/log.h" enum { CMC_PANE_LIST = 0, CMC_PANE_SEARCH, CMC_PANE_LOG }; struct cmc; struct cmc_ui { struct notcurses *nc; struct nn_event_loop *loop; u32 term_cols; u32 term_rows; u8 pane; bool layed_out; struct ncplane *n; // window. struct ncplane *oln; // overlay. bool overlay_shown; u32 last_mouse_x; u32 last_mouse_y; u64 last_mouse_ts; struct cmc_list_pane lists; struct cmc_log_pane log; struct nn_poll input_poll; struct nn_timer render_timer; struct cmc *c; }; #define CONSIDER_INPUT() \ if (!cmc_ui_consider_input(input, false)) return false #define CONSIDER_INPUT_REPEAT() \ if (!cmc_ui_consider_input(input, true)) return false #define CONSIDER_INPUT_MOD_CTRL() \ if (!input->ctrl) return false; void cmc_ui_putnwstr_yx(struct ncplane *n, u32 y, u32 x, u32 width, wstr *w); void cmc_ui_putnstr_yx(struct ncplane *n, u32 y, u32 x, u32 width, str *s); bool cmc_ui_consider_input(struct ncinput *input, bool repeat); bool cmc_ui_init(struct cmc_ui *ui, struct nn_event_loop *loop, struct cmc *c); void cmc_ui_queue_render(struct cmc_ui *ui); void cmc_ui_toggle_overlay(struct cmc_ui *ui); void cmc_ui_close(struct cmc_ui *ui);