SCTC
the soundcloud.com terminal client
Data Structures | Macros | Functions | Variables
tui.c File Reference
#include "tui.h"
#include <ncurses.h>
#include <term.h>
#include "helper.h"
#include "log.h"
#include "state.h"
#include "track.h"
#include "command.h"
Include dependency graph for tui.c:

Data Structures

struct  textbox_window
 

Macros

#define COLOR_SHELL   -1 /* the default color used by the shell, required to be -1 */
 
#define COLOR_GRAY   78 /* user defined color 'gray' */
 
#define COLOR_DGRAY   79 /* user defined color 'dark gray' */
 
#define COLOR_DGREEN   80
 
#define TIME_BUFFER_SIZE   64
 
#define wcsps(S)   mbstowcs(NULL, S, 0)
 
#define INIT_COLOR(C, R, G, B)   if(ERR == init_color(C, R, G, B)) { _log("init_color("#C", %d, %d, %d) failed", R, G, B); }
 
#define INIT_PAIR(CP, CF, CB)   if(ERR == init_pair(CP, CF, CB)) { _log("init_pair("#CP", "#CF", "#CB") failed"); }
 

Functions

static void tui_track_print_line (struct track *entry, bool selected, int line)
 
static void tui_print (char *fmt,...)
 
static void tui_track_list_print ()
 
static size_t tui_track_focus ()
 
static void tui_update_suggestion_list ()
 
static void tui_update_textbox ()
 
static void tui_redraw ()
 
static void tui_draw_title_line ()
 
static void tui_draw_tab_bar ()
 
static void tui_draw_status_line ()
 
static void * _thread_tui_function (void *unused)
 
static size_t tui_track_print_played (size_t remaining, bool selected, enum color color, enum color color_played, enum color color_selected, char *format,...)
 
static size_t tui_draw_text (WINDOW *win, char *text, const int max_width)
 
void tui_submit_action (enum tui_action_kind _action)
 
static void tui_callback_textbox_modifed ()
 
static void tui_callback_tabbar_modified ()
 
static void tui_callback_titlebar_modified ()
 
static void tui_callback_statusbar_modified ()
 
static void tui_callback_list_modified ()
 
static void tui_callback_sugg_modified ()
 
static void tui_terminal_resized (int signum)
 
bool tui_init ()
 
void tui_finalize ()
 

Variables

static pthread_t thread_tui
 
static bool terminate = false
 
static bool whole_redraw_required = false
 
static struct textbox_window textbox_window = { NULL }
 
static WINDOW * suggestion_window = NULL
 
static sem_t sem_have_action
 
static sem_t sem_wait_action
 
static enum tui_action_kind action
 

Macro Definition Documentation

#define COLOR_DGRAY   79 /* user defined color 'dark gray' */
#define COLOR_DGREEN   80
#define COLOR_GRAY   78 /* user defined color 'gray' */
#define COLOR_SHELL   -1 /* the default color used by the shell, required to be -1 */
#define INIT_COLOR (   C,
  R,
  G,
 
)    if(ERR == init_color(C, R, G, B)) { _log("init_color("#C", %d, %d, %d) failed", R, G, B); }
#define INIT_PAIR (   CP,
  CF,
  CB 
)    if(ERR == init_pair(CP, CF, CB)) { _log("init_pair("#CP", "#CF", "#CB") failed"); }
#define TIME_BUFFER_SIZE   64
#define wcsps (   S)    mbstowcs(NULL, S, 0)

Function Documentation

static void* _thread_tui_function ( void *  unused)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void tui_callback_list_modified ( )
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void tui_callback_statusbar_modified ( )
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void tui_callback_sugg_modified ( )
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void tui_callback_tabbar_modified ( )
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void tui_callback_textbox_modifed ( )
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void tui_callback_titlebar_modified ( )
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void tui_draw_status_line ( )
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void tui_draw_tab_bar ( )
static

Here is the call graph for this function:

Here is the caller graph for this function:

static size_t tui_draw_text ( WINDOW *  win,
char *  text,
const int  max_width 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void tui_draw_title_line ( )
static

Here is the call graph for this function:

Here is the caller graph for this function:

void tui_finalize ( )

Here is the caller graph for this function:

bool tui_init ( )

Here is the call graph for this function:

Here is the caller graph for this function:

static void tui_print ( char *  fmt,
  ... 
)
static

Here is the caller graph for this function:

static void tui_redraw ( )
static

Here is the call graph for this function:

Here is the caller graph for this function:

void tui_submit_action ( enum tui_action_kind  _action)

Here is the caller graph for this function:

static void tui_terminal_resized ( int  signum)
static

Here is the caller graph for this function:

static size_t tui_track_focus ( )
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void tui_track_list_print ( )
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void tui_track_print_line ( struct track entry,
bool  selected,
int  line 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static size_t tui_track_print_played ( size_t  remaining,
bool  selected,
enum color  color,
enum color  color_played,
enum color  color_selected,
char *  format,
  ... 
)
static

Here is the caller graph for this function:

static void tui_update_suggestion_list ( )
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void tui_update_textbox ( )
static

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

enum tui_action_kind action
static
sem_t sem_have_action
static
sem_t sem_wait_action
static
WINDOW* suggestion_window = NULL
static
bool terminate = false
static
struct textbox_window textbox_window = { NULL }
static
pthread_t thread_tui
static
bool whole_redraw_required = false
static