diff options
Diffstat (limited to 'src/fruits/cmc/ui/panes')
| -rw-r--r-- | src/fruits/cmc/ui/panes/list.c | 163 | ||||
| -rw-r--r-- | src/fruits/cmc/ui/panes/search.h | 13 |
2 files changed, 13 insertions, 163 deletions
diff --git a/src/fruits/cmc/ui/panes/list.c b/src/fruits/cmc/ui/panes/list.c index 15554b6..b599cc5 100644 --- a/src/fruits/cmc/ui/panes/list.c +++ b/src/fruits/cmc/ui/panes/list.c @@ -291,166 +291,3 @@ void cmc_list_pane_render(struct cmc_list_pane *lp) render_list_entries(lp, tab, lp->page_length); cmc_now_playing_render(&lp->np, tab_current_entry(tab)); } - -//static void render_now_playing(struct cmc_ui *ui, struct cmc_list_tab *tab, u32 y, u32 height) -//{ -// struct ncplane *n = ui->lp.n; -// u32 width = ncplane_dim_x(n); -// -// struct cmc_list_entry *entry = NULL; -// if (tab->list->entries.count > (u32)tab->list->current) { -// entry = al_array_at(tab->list->entries, tab->list->current); -// } -// -// u64 pos = 0; -// u64 duration = 0; -// u64 remaining = 0; -// u32 y_off = height - 7; -// -// ncplane_set_styles(n, NCSTYLE_BOLD); -// if (entry) { -// pos = entry->offset; -// duration = entry->duration; -// u64 now = nn_get_timestamp(); -// bool paused = entry->start == LIANA_TIMESTAMP_INVALID; -// if (!paused && now > entry->start) { -// pos += now - entry->start; -// } -// pos = MIN(pos, duration); -// remaining = duration - pos; -// //ncplane_putstr_yx(n, y_off, 2, "▸"); -// //ncplane_putstr_yx(n, y_off, 2, "▶"); -// //ncplane_putstr_yx(n, y_off, 2, "⏵ "); -// //ncplane_putstr_yx(n, y_off, 2, "|"); -// //ncplane_putstr_yx(n, y_off, 2, "|"); -// //ncplane_putstr_yx(n, y_off, 2, "⏵"); -// //ncplane_putstr_yx(n, y_off, 2, "⏸"); -// if (remaining == 0) { -// ncplane_putstr_yx(n, y_off - 1, 2, "∨"); -// } else { -// ncplane_putstr_yx(n, y_off - 1, 2, paused ? "^": ">"); -// } -// } else { -// ncplane_putstr_yx(n, y_off - 1, 2, "∨"); -// } -// ncplane_set_styles(n, NCSTYLE_NONE); -// -// f32 percent = 1.f; -// if (duration > 0) percent = MIN(pos / (f32)duration, 1.f); -// for (u32 i = 0; i < (width - 2) * percent; i++) { -// ncplane_putchar_yx(n, y_off, i + 1, '-'); -// } -// -// y_off--; -// -// char timestr[16] = { 0 }; // max = 829128280:01:49\0 -// s32 offset = camu_print_time(timestr, sizeof(timestr), pos, true, 4); -// ncplane_putstr_yx(n, y_off, 4, timestr); -// ncplane_putstr_yx(n, y_off, 4 + offset, "⎹"); -// -// if (entry) { -// cmc_ui_putnwstr_yx(n, y_off, 6 + offset, MIN(entry->name.length, (u32)60), &entry->name); -// } -// -// bool show_remaining = false; -// if (show_remaining) { -// offset = camu_print_time(timestr, sizeof(timestr), remaining, true, 4); -// } else { -// offset = camu_print_time(timestr, sizeof(timestr), duration, true, 4); -// } -// ncplane_putstr_yx(n, y_off, width - 4 - offset, "⎸"); -// // "=" Duration, "+" Segment, "-" Remaining. -// if (show_remaining) { -// ncplane_putstr_yx(n, y_off, width - 3 - offset, "-"); -// } else { -// ncplane_putstr_yx(n, y_off, width - 3 - offset, "="); -// } -// ncplane_putstr_yx(n, y_off, width - 2 - offset, timestr); -// -// /* -// ncplane_putchar_yx(n, height - 5, 2, 'A'); -// ncplane_putchar_yx(n, height - 4, 2, 'A'); -// ncplane_putchar_yx(n, height - 3, 2, 'A'); -// ncplane_putchar_yx(n, height - 2, 2, 'A'); -// */ -// -// if (entry && entry->raw.data != NULL) { -// u32 length = width - 2; -// u32 top = height - 6; -// u32 wave_height = 5; -// if (entry->raw.drawing == NULL || entry != ui->lp.blitted) { -// entry->raw.drawing = al_malloc(sizeof(char **) * wave_height); -// for (u32 j = 0; j < wave_height; j++) { -// entry->raw.drawing[j] = al_malloc(sizeof(char *) * length); -// for (u32 i = 0; i < length; i++) { -// entry->raw.drawing[j][i] = al_calloc(1, 6); -// } -// } -// if (!ui->lp.w) { -// struct ncplane_options opts = { 0 }; -// opts.x = 1; -// opts.y = top; -// opts.cols = length; -// opts.rows = wave_height; -// ui->lp.w = ncplane_create(n, &opts); -// } -// /* -// struct nccell ncl; -// nccell_init(&ncl); -// nccell_load(w, &ncl, " "); -// nccell_set_bg_palindex(&ncl, 3); -// ncplane_polyfill_yx(w, 0, 0, &ncl); -// */ -// u32 *rgba; -// u32 pixel_width, pixel_height; -// ncplane_pixel_geom(ui->lp.w, &pixel_height, &pixel_width, NULL, NULL, NULL, NULL); -// //cmc_draw_waveform(entry, length, wave_height, false, entry->raw.drawing, &rgba); -// cmc_draw_waveform(entry, pixel_width, pixel_height, false, entry->raw.drawing, &rgba); -// if (ui->lp.vis) { -// ncvisual_destroy(ui->lp.vis); -// } -// ui->lp.vis = ncvisual_from_rgba(rgba, pixel_height, pixel_width * 4, pixel_width); -// } -// -// if (entry != ui->lp.blitted) { -// ncplane_erase(ui->lp.w); -// struct ncvisual_options vopts = { 0 }; -// vopts.blitter = NCBLIT_PIXEL; -// vopts.scaling = NCSCALE_STRETCH; -// vopts.flags = NCVISUAL_OPTION_NOINTERPOLATE; -// vopts.n = ui->lp.w; -// vopts.x = 0; -// vopts.y = 0; -// ncvisual_blit(ui->nc, ui->lp.vis, &vopts); -// ui->lp.blitted = entry; -// } -// -// /* -// ncplane_set_fg_palindex(n, 5); -// for (u32 j = 0; j < wave_height; j++) { -// for (u32 i = 0; i < length; i++) { -// char *cell = entry->raw.drawing[j][i]; -// if (cell[0] == 'R') { -// ncplane_set_bg_palindex(n, 2); -// } -// ncplane_putstr_yx(n, top + j, 1 + i, cell + 1); -// if (cell[0] == 'R') { -// ncplane_set_bg_default(n); -// } -// } -// } -// ncplane_set_fg_default(n); -// */ -// } -// -// /* -// char buf[24]; -// al_snprintf(buf, sizeof(buf), "%u, %u | %u, %u", ui->last_mouse_x, ui->last_mouse_y, width, height); -// ncplane_putstr_yx(n, height - 5, 5, buf); -// */ -// -// u64 c = 0; -// ncchannels_set_fg_default(&c); -// ncplane_cursor_move_yx(n, y, 0); -// ncplane_light_box(n, NCSTYLE_NONE, c, height - 1, width - 1, 0); -//} diff --git a/src/fruits/cmc/ui/panes/search.h b/src/fruits/cmc/ui/panes/search.h new file mode 100644 index 0000000..7f9a2a7 --- /dev/null +++ b/src/fruits/cmc/ui/panes/search.h @@ -0,0 +1,13 @@ +#pragma once + +/* +struct cmc_search_tab { + struct cmc_search *search; + struct ncplane *input; + u32 cursor; + u32 visual_cursor; + bool input_active; + wstr input_text; + bool input_changed; +}; +*/ |