summaryrefslogtreecommitdiff
path: root/src/fruits/cmc/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/fruits/cmc/ui')
-rw-r--r--src/fruits/cmc/ui/panes/list.c6
-rw-r--r--src/fruits/cmc/ui/panes/list.h2
-rw-r--r--src/fruits/cmc/ui/panes/log.c4
-rw-r--r--src/fruits/cmc/ui/panes/log.h2
-rw-r--r--src/fruits/cmc/ui/ui.c12
-rw-r--r--src/fruits/cmc/ui/widgets/now_playing.c7
-rw-r--r--src/fruits/cmc/ui/widgets/now_playing.h1
-rw-r--r--src/fruits/cmc/ui/widgets/tile.h11
8 files changed, 29 insertions, 16 deletions
diff --git a/src/fruits/cmc/ui/panes/list.c b/src/fruits/cmc/ui/panes/list.c
index 0e853db..34e18f9 100644
--- a/src/fruits/cmc/ui/panes/list.c
+++ b/src/fruits/cmc/ui/panes/list.c
@@ -220,10 +220,10 @@ bool cmc_list_pane_tick(struct cmc_list_pane *lp)
return tick;
}
-void cmc_list_pane_erase(struct cmc_list_pane *lp)
+void cmc_list_pane_clear(struct cmc_list_pane *lp)
{
ncplane_erase(lp->n);
- cmc_now_playing_erase(&lp->np);
+ cmc_now_playing_clear(&lp->np);
}
static void render_list_entries(struct cmc_list_pane *lp, struct cmc_list_tab *tab, s32 max_height)
@@ -283,6 +283,8 @@ static void render_list_entries(struct cmc_list_pane *lp, struct cmc_list_tab *t
void cmc_list_pane_render(struct cmc_list_pane *lp)
{
+ ncplane_erase(lp->n);
+ cmc_now_playing_erase(&lp->np);
if (lp->selected == -1) return;
struct cmc_list_tab *tab = &al_array_at(lp->tabs, lp->selected);
render_list_entries(lp, tab, lp->page_length);
diff --git a/src/fruits/cmc/ui/panes/list.h b/src/fruits/cmc/ui/panes/list.h
index bfeed59..3fb10f9 100644
--- a/src/fruits/cmc/ui/panes/list.h
+++ b/src/fruits/cmc/ui/panes/list.h
@@ -31,5 +31,5 @@ bool cmc_list_pane_layout(struct cmc_list_pane *lp, struct ncplane *parent);
void cmc_list_pane_add_list(struct cmc_list_pane *lp, struct cmc_list *list);
bool cmc_list_pane_handle_input(struct cmc_list_pane *lp, struct ncinput *input);
bool cmc_list_pane_tick(struct cmc_list_pane *lp);
-void cmc_list_pane_erase(struct cmc_list_pane *lp);
+void cmc_list_pane_clear(struct cmc_list_pane *lp);
void cmc_list_pane_render(struct cmc_list_pane *lp);
diff --git a/src/fruits/cmc/ui/panes/log.c b/src/fruits/cmc/ui/panes/log.c
index be9702c..370e91a 100644
--- a/src/fruits/cmc/ui/panes/log.c
+++ b/src/fruits/cmc/ui/panes/log.c
@@ -38,7 +38,7 @@ bool cmc_log_pane_tick(struct cmc_log_pane *lp)
return false;
}
-void cmc_log_pane_erase(struct cmc_log_pane *lp)
+void cmc_log_pane_clear(struct cmc_log_pane *lp)
{
ncplane_erase(lp->n);
}
@@ -47,6 +47,8 @@ void cmc_log_pane_render(struct cmc_log_pane *lp)
{
struct ncplane *n = lp->n;
+ ncplane_erase(n);
+
u32 max_height = ncplane_dim_y(n);
u32 count = lp->messages.count;
diff --git a/src/fruits/cmc/ui/panes/log.h b/src/fruits/cmc/ui/panes/log.h
index d79c7e9..b647c89 100644
--- a/src/fruits/cmc/ui/panes/log.h
+++ b/src/fruits/cmc/ui/panes/log.h
@@ -14,5 +14,5 @@ bool cmc_log_pane_layout(struct cmc_log_pane *lp, struct ncplane *parent);
void cmc_log_pane_push_message(struct cmc_log_pane *lp, char *message);
bool cmc_log_pane_handle_input(struct cmc_log_pane *lp, struct ncinput *input);
bool cmc_log_pane_tick(struct cmc_log_pane *lp);
-void cmc_log_pane_erase(struct cmc_log_pane *lp);
+void cmc_log_pane_clear(struct cmc_log_pane *lp);
void cmc_log_pane_render(struct cmc_log_pane *lp);
diff --git a/src/fruits/cmc/ui/ui.c b/src/fruits/cmc/ui/ui.c
index 7a0d8a1..a5d9125 100644
--- a/src/fruits/cmc/ui/ui.c
+++ b/src/fruits/cmc/ui/ui.c
@@ -39,10 +39,10 @@ static void erase_previous_pane(struct cmc_ui *ui, u8 previous, u8 upcoming)
{
switch (previous) {
case CMC_PANE_LIST:
- cmc_list_pane_erase(&ui->lists);
+ cmc_list_pane_clear(&ui->lists);
break;
case CMC_PANE_LOG:
- cmc_log_pane_erase(&ui->log);
+ cmc_log_pane_clear(&ui->log);
break;
}
switch (upcoming) {
@@ -69,14 +69,6 @@ void cmc_ui_queue_render(struct cmc_ui *ui)
{
//ncplane_erase(ui->n);
- switch (ui->pane) {
- case CMC_PANE_LIST:
- cmc_list_pane_erase(&ui->lists);
- break;
- case CMC_PANE_LOG:
- cmc_log_pane_erase(&ui->log);
- }
-
if (ui->overlay_shown) ncplane_erase(ui->oln);
switch (ui->pane) {
diff --git a/src/fruits/cmc/ui/widgets/now_playing.c b/src/fruits/cmc/ui/widgets/now_playing.c
index 845a572..ebb8361 100644
--- a/src/fruits/cmc/ui/widgets/now_playing.c
+++ b/src/fruits/cmc/ui/widgets/now_playing.c
@@ -80,6 +80,13 @@ void cmc_now_playing_erase(struct cmc_now_playing *np)
ncplane_erase(np->n);
}
+void cmc_now_playing_clear(struct cmc_now_playing *np)
+{
+ cmc_now_playing_erase(np);
+ ncplane_erase(np->wave);
+ np->blitted = NULL;
+}
+
void cmc_now_playing_render(struct cmc_now_playing *np, struct cmc_list_entry *entry)
{
u64 duration = 0, pos = 0;
diff --git a/src/fruits/cmc/ui/widgets/now_playing.h b/src/fruits/cmc/ui/widgets/now_playing.h
index 5993c59..5c89940 100644
--- a/src/fruits/cmc/ui/widgets/now_playing.h
+++ b/src/fruits/cmc/ui/widgets/now_playing.h
@@ -22,4 +22,5 @@ void cmc_now_playing_init(struct cmc_now_playing *np);
bool cmc_now_playing_layout(struct cmc_now_playing *np, struct ncplane *parent, u32 y);
bool cmc_now_playing_tick(struct cmc_now_playing *np, struct cmc_list_entry *entry);
void cmc_now_playing_erase(struct cmc_now_playing *np);
+void cmc_now_playing_clear(struct cmc_now_playing *np);
void cmc_now_playing_render(struct cmc_now_playing *np, struct cmc_list_entry *entry);
diff --git a/src/fruits/cmc/ui/widgets/tile.h b/src/fruits/cmc/ui/widgets/tile.h
index 6f15c7d..a410207 100644
--- a/src/fruits/cmc/ui/widgets/tile.h
+++ b/src/fruits/cmc/ui/widgets/tile.h
@@ -1,5 +1,14 @@
#pragma once
-struct cmc_tile {
+/*
+ Use-case examples:
+ - Twitter timeline type.
+ - Image grid (static/dynamic size, with or without title).
+
+ Implementation:
+ - Tile sets it's own size.
+ - Reel.
+*/
+struct cmc_tile {
};